package calendar

type Era struct {
	//完整农历年的公历年映射
	Year              int
	Emperor           string
	Nianhao           string
	OtherNianHaoStart string
	Dynasty           string
	Offset            int
}

type EraDesc struct {
	YearOfNianHao int
	Emperor       string
	Nianhao       string
	Dynasty       string
}

// String 年号字符串 / era description string.
func (e EraDesc) String() string {
	if e.YearOfNianHao == 1 {
		return e.Nianhao + "元年"
	}
	return e.Nianhao + number2Chinese(e.YearOfNianHao, false) + "年"
}

func innerEras(year int, eraSource func() []Era) []EraDesc {
	var eras []Era
	eras = eraSource()
	var firstEra, secEra, thirdEra Era
	for _, v := range eras {
		if year < v.Year {
			continue
		}
		if firstEra.Year == secEra.Year && firstEra.OtherNianHaoStart != "" && secEra.OtherNianHaoStart != "" {
			thirdEra = v
			break
		}
		if v.OtherNianHaoStart != "" && secEra.Year == 0 && v.Year == year {
			secEra = v
			continue
		}
		firstEra = v
		if firstEra.Year == secEra.Year && firstEra.OtherNianHaoStart != "" && secEra.OtherNianHaoStart != "" {
			continue
		}
		break
	}
	var result []EraDesc
	nianHao := firstEra.Nianhao
	if firstEra.OtherNianHaoStart != "" {
		nianHao = firstEra.OtherNianHaoStart
	}
	result = append(result, EraDesc{
		YearOfNianHao: year - firstEra.Year + 1 + firstEra.Offset,
		Emperor:       firstEra.Emperor,
		Nianhao:       nianHao,
		Dynasty:       firstEra.Dynasty,
	})
	nianHao = secEra.Nianhao
	if secEra.OtherNianHaoStart != "" {
		nianHao = secEra.OtherNianHaoStart
	}
	if secEra.Year != 0 {
		result = append(result, EraDesc{
			YearOfNianHao: year - secEra.Year + 1 + secEra.Offset,
			Emperor:       secEra.Emperor,
			Nianhao:       nianHao,
			Dynasty:       secEra.Dynasty,
		})
	}
	nianHao = thirdEra.Nianhao
	if thirdEra.OtherNianHaoStart != "" {
		nianHao = thirdEra.OtherNianHaoStart
	}
	if thirdEra.Year != 0 {
		result = append(result, EraDesc{
			YearOfNianHao: year - thirdEra.Year + 1 + thirdEra.Offset,
			Emperor:       thirdEra.Emperor,
			Nianhao:       nianHao,
			Dynasty:       thirdEra.Dynasty,
		})
	}

	return result
}

func nianHaoMap() map[string][][]int {
	m := map[string][][]int{
		"民国":   [][]int{{1912, 1949}},
		"宣统":   [][]int{{1909, 1911}},
		"光绪":   [][]int{{1875, 1908}},
		"同治":   [][]int{{1862, 1874}},
		"咸丰":   [][]int{{1851, 1861}},
		"道光":   [][]int{{1821, 1850}},
		"嘉庆":   [][]int{{1796, 1820}},
		"乾隆":   [][]int{{1736, 1795}},
		"雍正":   [][]int{{1723, 1735}},
		"康熙":   [][]int{{1662, 1722}},
		"顺治":   [][]int{{1644, 1661}},
		"崇祯":   [][]int{{1628, 1644}},
		"天启":   [][]int{{1621, 1627}},
		"泰昌":   [][]int{{1620, 1620}},
		"万历":   [][]int{{1573, 1620}},
		"隆庆":   [][]int{{1567, 1572}},
		"嘉靖":   [][]int{{1522, 1566}},
		"正德":   [][]int{{1506, 1521}},
		"弘治":   [][]int{{1488, 1505}},
		"成化":   [][]int{{1465, 1487}},
		"天顺":   [][]int{{1457, 1464}},
		"景泰":   [][]int{{1450, 1456}},
		"正统":   [][]int{{1436, 1449}},
		"宣德":   [][]int{{1426, 1435}},
		"洪熙":   [][]int{{1425, 1425}},
		"永乐":   [][]int{{1403, 1424}},
		"建文":   [][]int{{1399, 1402}},
		"洪武":   [][]int{{1368, 1398}},
		"至正":   [][]int{{1341, 1368}},
		"元统":   [][]int{{1333, 1335}},
		"至顺":   [][]int{{1330, 1333}},
		"天历":   [][]int{{1328, 1330}},
		"泰定":   [][]int{{1324, 1328}},
		"至治":   [][]int{{1321, 1323}},
		"延祐":   [][]int{{1314, 1320}},
		"皇庆":   [][]int{{1312, 1313}},
		"至大":   [][]int{{1308, 1311}},
		"大德":   [][]int{{1297, 1307}},
		"元贞":   [][]int{{1295, 1297}},
		"至元":   [][]int{{1264, 1294}, {1335, 1368}},
		"祥兴":   [][]int{{1278, 1279}},
		"景炎":   [][]int{{1276, 1278}},
		"德祐":   [][]int{{1275, 1276}},
		"咸淳":   [][]int{{1265, 1275}},
		"景定":   [][]int{{1260, 1264}},
		"开庆":   [][]int{{1259, 1259}},
		"宝祐":   [][]int{{1253, 1258}},
		"淳祐":   [][]int{{1241, 1252}},
		"嘉熙":   [][]int{{1237, 1240}},
		"端平":   [][]int{{1234, 1236}},
		"绍定":   [][]int{{1228, 1233}},
		"宝庆":   [][]int{{1225, 1227}},
		"嘉定":   [][]int{{1208, 1224}},
		"开禧":   [][]int{{1205, 1207}},
		"嘉泰":   [][]int{{1201, 1204}},
		"庆元":   [][]int{{1195, 1200}},
		"绍熙":   [][]int{{1190, 1194}},
		"淳熙":   [][]int{{1174, 1189}},
		"乾道":   [][]int{{1165, 1173}},
		"隆兴":   [][]int{{1163, 1164}},
		"绍兴":   [][]int{{1131, 1162}},
		"建炎":   [][]int{{1127, 1130}},
		"靖康":   [][]int{{1126, 1127}},
		"宣和":   [][]int{{1119, 1126}},
		"重和":   [][]int{{1118, 1119}},
		"政和":   [][]int{{1111, 1118}},
		"大观":   [][]int{{1107, 1110}},
		"崇宁":   [][]int{{1102, 1106}},
		"建中靖国": [][]int{{1101, 1101}},
		"元符":   [][]int{{1098, 1100}},
		"绍圣":   [][]int{{1094, 1098}},
		"元祐":   [][]int{{1086, 1094}},
		"元丰":   [][]int{{1078, 1085}},
		"熙宁":   [][]int{{1068, 1077}},
		"治平":   [][]int{{1064, 1067}},
		"嘉祐":   [][]int{{1056, 1063}},
		"至和":   [][]int{{1054, 1056}},
		"皇祐":   [][]int{{1049, 1054}},
		"庆历":   [][]int{{1041, 1048}},
		"康定":   [][]int{{1040, 1041}},
		"宝元":   [][]int{{1038, 1040}},
		"景祐":   [][]int{{1034, 1038}},
		"明道":   [][]int{{1032, 1033}},
		"天圣":   [][]int{{1023, 1032}},
		"乾兴":   [][]int{{1022, 1022}},
		"天禧":   [][]int{{1017, 1021}},
		"大中祥符": [][]int{{1008, 1016}},
		"景德":   [][]int{{1004, 1007}},
		"咸平":   [][]int{{998, 1003}},
		"至道":   [][]int{{995, 997}},
		"淳化":   [][]int{{990, 994}},
		"端拱":   [][]int{{988, 989}},
		"雍熙":   [][]int{{984, 987}},
		"太平兴国": [][]int{{976, 984}},
		"开宝":   [][]int{{968, 976}},
		"乾德":   [][]int{{963, 968}},
		"建隆":   [][]int{{960, 963}},
		"显德":   [][]int{{954, 960}},
		"广顺":   [][]int{{951, 954}},
		"乾祐":   [][]int{{948, 950}},
		"开运":   [][]int{{944, 948}},
		"天福":   [][]int{{936, 944}},
		"清泰":   [][]int{{934, 936}},
		"长兴":   [][]int{{930, 934}},
		"天成":   [][]int{{926, 930}},
		"同光":   [][]int{{923, 926}},
		"龙德":   [][]int{{921, 923}},
		"贞明":   [][]int{{915, 921}},
		"乾化":   [][]int{{911, 915}},
		"开平":   [][]int{{907, 911}},
		"天祐":   [][]int{{904, 907}},
		"天复":   [][]int{{901, 904}},
		"光化":   [][]int{{898, 901}},
		"乾宁":   [][]int{{894, 898}},
		"景福":   [][]int{{892, 893}},
		"大顺":   [][]int{{890, 891}},
		"龙纪":   [][]int{{889, 889}},
		"文德":   [][]int{{888, 889}},
		"光启":   [][]int{{885, 888}},
		"中和":   [][]int{{881, 885}},
		"广明":   [][]int{{880, 881}},
		"乾符":   [][]int{{874, 880}},
		"咸通":   [][]int{{860, 874}},
		"大中":   [][]int{{847, 860}},
		"会昌":   [][]int{{841, 846}},
		"开成":   [][]int{{836, 840}},
		"大和":   [][]int{{827, 835}},
		"宝历":   [][]int{{825, 827}},
		"长庆":   [][]int{{821, 824}},
		"永贞":   [][]int{{805, 805}},
		"贞元":   [][]int{{785, 805}},
		"兴元":   [][]int{{784, 784}},
		"建中":   [][]int{{780, 783}},
		"大历":   [][]int{{766, 779}},
		"广德":   [][]int{{763, 765}},
		"宝应":   [][]int{{762, 763}},
		"乾元":   [][]int{{758, 760}},
		"天宝":   [][]int{{742, 756}},
		"开元":   [][]int{{713, 741}},
		"先天":   [][]int{{712, 713}},
		"延和":   [][]int{{712, 712}},
		"太极":   [][]int{{712, 712}},
		"景云":   [][]int{{710, 712}},
		"唐隆":   [][]int{{710, 710}},
		"景龙":   [][]int{{707, 710}},
		"神龙":   [][]int{{705, 707}},
		"长安":   [][]int{{701, 705}},
		"大足":   [][]int{{701, 701}},
		"久视":   [][]int{{700, 700}},
		"圣历":   [][]int{{698, 700}},
		"万岁通天": [][]int{{696, 697}},
		"万岁登封": [][]int{{696, 696}},
		"天册万岁": [][]int{{695, 695}},
		"证圣":   [][]int{{695, 695}},
		"延载":   [][]int{{694, 694}},
		"长寿":   [][]int{{692, 694}},
		"如意":   [][]int{{692, 692}},
		"天授":   [][]int{{690, 692}},
		"载初":   [][]int{{690, 690}},
		"垂拱":   [][]int{{685, 688}},
		"光宅":   [][]int{{684, 684}},
		"文明":   [][]int{{684, 684}},
		"嗣圣":   [][]int{{684, 684}},
		"弘道":   [][]int{{683, 683}},
		"永淳":   [][]int{{682, 683}},
		"开耀":   [][]int{{681, 682}},
		"永隆":   [][]int{{680, 681}},
		"调露":   [][]int{{679, 680}},
		"仪凤":   [][]int{{676, 679}},
		"上元":   [][]int{{674, 676}, {760, 762}},
		"咸亨":   [][]int{{670, 674}},
		"总章":   [][]int{{668, 670}},
		"乾封":   [][]int{{666, 668}},
		"麟德":   [][]int{{664, 665}},
		"龙朔":   [][]int{{661, 663}},
		"显庆":   [][]int{{656, 661}},
		"永徽":   [][]int{{650, 655}},
		"贞观":   [][]int{{627, 649}},
		"武德":   [][]int{{618, 626}},
		"义宁":   [][]int{{617, 618}},
		"大业":   [][]int{{605, 617}},
		"仁寿":   [][]int{{601, 604}},
		//special case
		"开皇":   [][]int{{581, 600}},
		"祯明":   [][]int{{587, 589}},
		"至德":   [][]int{{583, 586}, {756, 758}},
		"太建":   [][]int{{569, 582}},
		"光大":   [][]int{{567, 568}},
		"天康":   [][]int{{566, 566}},
		"天嘉":   [][]int{{560, 566}},
		"永定":   [][]int{{557, 559}},
		"太平":   [][]int{{556, 557}},
		"绍泰":   [][]int{{555, 556}},
		"承圣":   [][]int{{552, 555}},
		"大宝":   [][]int{{550, 551}},
		"太清":   [][]int{{547, 549}},
		"中大同":  [][]int{{546, 547}},
		"大同":   [][]int{{535, 546}},
		"中大通":  [][]int{{529, 534}},
		"大通":   [][]int{{527, 529}},
		"普通":   [][]int{{520, 527}},
		"天监":   [][]int{{502, 519}},
		"中兴":   [][]int{{501, 502}},
		"永泰":   [][]int{{498, 498}, {765, 766}},
		"永明":   [][]int{{483, 494}},
		"升明":   [][]int{{477, 479}},
		"元徽":   [][]int{{473, 477}},
		"泰豫":   [][]int{{472, 472}},
		"大明":   [][]int{{457, 465}},
		"孝建":   [][]int{{454, 456}},
		"景平":   [][]int{{423, 424}},
		"元熙":   [][]int{{419, 420}},
		"义熙":   [][]int{{405, 419}},
		"大亨":   [][]int{{402, 404}},
		"隆安":   [][]int{{397, 402}},
		"太元":   [][]int{{376, 396}},
		"宁康":   [][]int{{373, 375}},
		"咸安":   [][]int{{371, 372}},
		"兴宁":   [][]int{{363, 365}},
		"隆和":   [][]int{{362, 363}},
		"升平":   [][]int{{357, 362}},
		"建元":   [][]int{{343, 344}, {479, 482}},
		"咸康":   [][]int{{335, 342}},
		"咸和":   [][]int{{326, 334}},
		"太宁":   [][]int{{323, 326}},
		"永昌":   [][]int{{322, 323}, {689, 689}},
		"大兴":   [][]int{{318, 322}},
		"建兴":   [][]int{{313, 317}},
		"光熙":   [][]int{{306, 306}},
		"太安":   [][]int{{302, 304}},
		"永熙":   [][]int{{290, 291}},
		"太康":   [][]int{{280, 290}},
		"咸宁":   [][]int{{275, 280}},
		"泰始":   [][]int{{265, 274}, {465, 472}},
		"咸熙":   [][]int{{264, 265}},
		"景元":   [][]int{{260, 264}},
		"正元":   [][]int{{254, 256}},
		"嘉平":   [][]int{{249, 254}},
		"正始":   [][]int{{240, 249}},
		"景初":   [][]int{{237, 239}},
		"青龙":   [][]int{{233, 237}},
		"太和":   [][]int{{227, 233}, {366, 371}},
		"黄初":   [][]int{{220, 226}},
		"延康":   [][]int{{220, 220}},
		"建安":   [][]int{{196, 220}},
		"兴平":   [][]int{{194, 195}},
		"初平":   [][]int{{190, 193}},
		"中平":   [][]int{{184, 189}},
		"光和":   [][]int{{178, 184}},
		"熹平":   [][]int{{172, 178}},
		"建宁":   [][]int{{168, 172}},
		"永康":   [][]int{{167, 167}, {300, 301}},
		"延熹":   [][]int{{158, 167}},
		"永寿":   [][]int{{155, 158}},
		"永兴":   [][]int{{153, 154}, {304, 306}},
		"元嘉":   [][]int{{151, 153}, {424, 453}},
		"和平":   [][]int{{150, 150}},
		"建和":   [][]int{{147, 149}},
		"本初":   [][]int{{146, 146}},
		"永嘉":   [][]int{{145, 145}, {307, 313}},
		"建康":   [][]int{{144, 144}},
		"汉安":   [][]int{{142, 144}},
		"永和":   [][]int{{136, 141}, {345, 356}},
		"阳嘉":   [][]int{{132, 135}},
		"永建":   [][]int{{126, 132}},
		"延光":   [][]int{{122, 125}},
		"建光":   [][]int{{121, 122}},
		"永宁":   [][]int{{120, 121}, {301, 302}},
		"元初":   [][]int{{114, 120}},
		"永初":   [][]int{{107, 113}, {420, 423}},
		"延平":   [][]int{{106, 106}},
		"元兴":   [][]int{{105, 106}},
		"永元":   [][]int{{89, 105}, {499, 501}},
		"章和":   [][]int{{87, 88}},
		"元和":   [][]int{{84, 87}, {806, 820}},
		"建初":   [][]int{{76, 84}},
		"永平":   [][]int{{58, 75}},
		"建武中元": [][]int{{56, 57}},
		"建武":   [][]int{{25, 56}, {317, 318}, {494, 498}},
		"更始":   [][]int{{23, 25}},
		"地皇":   [][]int{{20, 23}},
		"天凤":   [][]int{{14, 19}},
		"始建国":  [][]int{{9, 13}},
		"初始":   [][]int{{8, 8}},
		"居摄":   [][]int{{6, 8}},
		"元始":   [][]int{{1, 5}},
		"元寿":   [][]int{{-1, 0}},
		"建平":   [][]int{{-5, -2}},
		"绥和":   [][]int{{-7, -6}},
		"元延":   [][]int{{-11, -8}},
		"永始":   [][]int{{-15, -12}},
		"鸿嘉":   [][]int{{-19, -16}},
		"阳朔":   [][]int{{-23, -20}},
		"河平":   [][]int{{-27, -24}},
		"建始":   [][]int{{-31, -27}},
		"竟宁":   [][]int{{-32, -32}},
		"建昭":   [][]int{{-37, -33}},
		"永光":   [][]int{{-42, -38}},
		"初元":   [][]int{{-47, -43}},
		"黄龙":   [][]int{{-48, -48}},
		"甘露":   [][]int{{-52, -49}, {256, 260}},
		"五凤":   [][]int{{-56, -53}},
		"神爵":   [][]int{{-60, -57}},
		"元康":   [][]int{{-64, -60}, {291, 300}},
		"地节":   [][]int{{-68, -65}},
		"本始":   [][]int{{-72, -69}},
		"元平":   [][]int{{-73, -73}},
		"元凤":   [][]int{{-79, -74}},
		"始元":   [][]int{{-85, -79}},
		"后元":   [][]int{{-87, -86}},
		"征和":   [][]int{{-91, -88}},
		"太始":   [][]int{{-95, -92}},
		"天汉":   [][]int{{-99, -96}},
		"太初":   [][]int{{-103, -100}},
	}
	addNianHaoYouCompatAliases(m)
	return m
}

func addNianHaoYouCompatAliases(m map[string][][]int) {
	for alias, canonical := range map[string]string{
		"延佑": "延祐",
		"德佑": "德祐",
		"宝佑": "宝祐",
		"淳佑": "淳祐",
		"元佑": "元祐",
		"嘉佑": "嘉祐",
		"皇佑": "皇祐",
		"景佑": "景祐",
		"乾佑": "乾祐",
		"天佑": "天祐",
	} {
		if years, ok := m[canonical]; ok {
			m[alias] = years
		}
	}
}

func hanEras() []Era {
	return []Era{
		{
			Year:              220,
			Emperor:           "魏文帝",
			OtherNianHaoStart: "黄初",
			Dynasty:           "魏",
		},
		{
			Year:              220,
			Emperor:           "汉献帝",
			OtherNianHaoStart: "延康",
			Dynasty:           "东汉",
		},
		{
			Year:    196,
			Emperor: "汉献帝",
			Nianhao: "建安",
			Dynasty: "东汉",
		},
		{
			Year:    194,
			Emperor: "汉献帝",
			Nianhao: "兴平",
			Dynasty: "东汉",
		},
		{
			Year:    190,
			Emperor: "汉献帝",
			Nianhao: "初平",
			Dynasty: "东汉",
		},
		{
			Year:              184,
			Emperor:           "汉灵帝",
			OtherNianHaoStart: "中平",
			Dynasty:           "东汉",
		},
		{
			Year:              178,
			Emperor:           "汉灵帝",
			OtherNianHaoStart: "光和",
			Dynasty:           "东汉",
		},
		{
			Year:              172,
			Emperor:           "汉灵帝",
			OtherNianHaoStart: "熹平",
			Dynasty:           "东汉",
		},
		{
			Year:    168,
			Emperor: "汉灵帝",
			Nianhao: "建宁",
			Dynasty: "东汉",
		},
		{
			Year:              167,
			Emperor:           "汉桓帝",
			OtherNianHaoStart: "永康",
			Dynasty:           "东汉",
		},
		{
			Year:              158,
			Emperor:           "汉桓帝",
			OtherNianHaoStart: "延熹",
			Dynasty:           "东汉",
		},
		{
			Year:    155,
			Emperor: "汉桓帝",
			Nianhao: "永寿",
			Dynasty: "东汉",
		},
		{
			Year:              153,
			Emperor:           "汉桓帝",
			OtherNianHaoStart: "永兴",
			Dynasty:           "东汉",
		},
		{
			Year:    151,
			Emperor: "汉桓帝",
			Nianhao: "元嘉",
			Dynasty: "东汉",
		},
		{
			Year:    150,
			Emperor: "汉桓帝",
			Nianhao: "和平",
			Dynasty: "东汉",
		},
		{
			Year:    147,
			Emperor: "汉桓帝",
			Nianhao: "建和",
			Dynasty: "东汉",
		},
		{
			Year:    146,
			Emperor: "汉质帝",
			Nianhao: "本初",
			Dynasty: "东汉",
		},
		{
			Year:    145,
			Emperor: "汉冲帝",
			Nianhao: "永嘉",
			Dynasty: "东汉",
		},
		{
			Year:              144,
			Emperor:           "汉顺帝",
			OtherNianHaoStart: "建康",
			Dynasty:           "东汉",
		},
		{
			Year:    142,
			Emperor: "汉顺帝",
			Nianhao: "汉安",
			Dynasty: "东汉",
		},
		{
			Year:    136,
			Emperor: "汉顺帝",
			Nianhao: "永和",
			Dynasty: "东汉",
		},
		{
			Year:              132,
			Emperor:           "汉顺帝",
			OtherNianHaoStart: "阳嘉",
			Dynasty:           "东汉",
		},
		{
			Year:    126,
			Emperor: "汉顺帝",
			Nianhao: "永建",
			Dynasty: "东汉",
		},
		{
			Year:              122,
			Emperor:           "汉安帝",
			OtherNianHaoStart: "延光",
			Dynasty:           "东汉",
		},
		{
			Year:              121,
			Emperor:           "汉安帝",
			OtherNianHaoStart: "建光",
			Dynasty:           "东汉",
		},
		{
			Year:              120,
			Emperor:           "汉安帝",
			OtherNianHaoStart: "永宁",
			Dynasty:           "东汉",
		},
		{
			Year:    114,
			Emperor: "汉安帝",
			Nianhao: "元初",
			Dynasty: "东汉",
		},
		{
			Year:    107,
			Emperor: "汉安帝",
			Nianhao: "永初",
			Dynasty: "东汉",
		},
		{
			Year:              106,
			Emperor:           "汉殇帝",
			OtherNianHaoStart: "延平",
			Dynasty:           "东汉",
		},
		{
			Year:              105,
			Emperor:           "汉和帝",
			OtherNianHaoStart: "元兴",
			Dynasty:           "东汉",
		},
		{
			Year:    89,
			Emperor: "汉和帝",
			Nianhao: "永元",
			Dynasty: "东汉",
		},
		{
			Year:              87,
			Emperor:           "汉章帝",
			OtherNianHaoStart: "章和",
			Dynasty:           "东汉",
		},
		{
			Year:              84,
			Emperor:           "汉章帝",
			OtherNianHaoStart: "元和",
			Dynasty:           "东汉",
		},
		{
			Year:    76,
			Emperor: "汉章帝",
			Nianhao: "建初",
			Dynasty: "东汉",
		},
		{
			Year:    58,
			Emperor: "汉明帝",
			Nianhao: "永平",
			Dynasty: "东汉",
		},
		{
			Year:              56,
			Emperor:           "汉光武帝",
			OtherNianHaoStart: "建武中元",
			Dynasty:           "东汉",
		},
		{
			Year:              25,
			Emperor:           "汉光武帝",
			OtherNianHaoStart: "建武",
			Dynasty:           "东汉",
		},
		{
			Year:              23,
			Emperor:           "汉更始帝",
			OtherNianHaoStart: "更始",
			Dynasty:           "汉",
		},
		{
			Year:    20,
			Emperor: "新王莽",
			Nianhao: "地皇",
			Dynasty: "新",
		},
		{
			Year:    14,
			Emperor: "新王莽",
			Nianhao: "天凤",
			Dynasty: "新",
		},
		{
			Year:    9,
			Emperor: "新王莽",
			Nianhao: "始建国",
			Dynasty: "新",
		},
		{
			Year:              8,
			Emperor:           "汉平帝",
			OtherNianHaoStart: "初始",
			Dynasty:           "西汉",
		},
		{
			Year:    6,
			Emperor: "汉平帝",
			Nianhao: "居摄",
			Dynasty: "西汉",
		},
		{
			Year:    1,
			Emperor: "汉平帝",
			Nianhao: "元始",
			Dynasty: "西汉",
		},
		{
			Year:    -1,
			Emperor: "汉哀帝",
			Nianhao: "元寿",
			Dynasty: "西汉",
		},
		{
			Year:    -5,
			Emperor: "汉哀帝",
			Nianhao: "建平",
			Dynasty: "西汉",
		},
		{
			Year:    -7,
			Emperor: "汉成帝",
			Nianhao: "绥和",
			Dynasty: "西汉",
		},
		{
			Year:    -11,
			Emperor: "汉成帝",
			Nianhao: "元延",
			Dynasty: "西汉",
		},
		{
			Year:    -15,
			Emperor: "汉成帝",
			Nianhao: "永始",
			Dynasty: "西汉",
		},
		{
			Year:    -19,
			Emperor: "汉成帝",
			Nianhao: "鸿嘉",
			Dynasty: "西汉",
		},
		{
			Year:    -23,
			Emperor: "汉成帝",
			Nianhao: "阳朔",
			Dynasty: "西汉",
		},
		{
			Year:              -27,
			Emperor:           "汉成帝",
			OtherNianHaoStart: "河平",
			Dynasty:           "西汉",
		},
		{
			Year:    -31,
			Emperor: "汉成帝",
			Nianhao: "建始",
			Dynasty: "西汉",
		},
		{
			Year:    -32,
			Emperor: "汉元帝",
			Nianhao: "竟宁",
			Dynasty: "西汉",
		},
		{
			Year:    -37,
			Emperor: "汉元帝",
			Nianhao: "建昭",
			Dynasty: "西汉",
		},
		{
			Year:    -42,
			Emperor: "汉元帝",
			Nianhao: "永光",
			Dynasty: "西汉",
		},
		{
			Year:    -47,
			Emperor: "汉元帝",
			Nianhao: "初元",
			Dynasty: "西汉",
		},
		{
			Year:    -48,
			Emperor: "汉宣帝",
			Nianhao: "黄龙",
			Dynasty: "西汉",
		},
		{
			Year:    -52,
			Emperor: "汉宣帝",
			Nianhao: "甘露",
			Dynasty: "西汉",
		},
		{
			Year:    -56,
			Emperor: "汉宣帝",
			Nianhao: "五凤",
			Dynasty: "西汉",
		},
		{
			Year:              -60,
			Emperor:           "汉宣帝",
			OtherNianHaoStart: "神爵",
			Dynasty:           "西汉",
		},
		{
			Year:    -64,
			Emperor: "汉宣帝",
			Nianhao: "元康",
			Dynasty: "西汉",
		},
		{
			Year:    -68,
			Emperor: "汉宣帝",
			Nianhao: "地节",
			Dynasty: "西汉",
		},
		{
			Year:    -72,
			Emperor: "汉宣帝",
			Nianhao: "本始",
			Dynasty: "西汉",
		},
		{
			Year:    -73,
			Emperor: "汉昭帝",
			Nianhao: "元平",
			Dynasty: "西汉",
		},
		{
			Year:              -79,
			Emperor:           "汉昭帝",
			OtherNianHaoStart: "元凤",
			Dynasty:           "西汉",
		},
		{
			Year:    -85,
			Emperor: "汉昭帝",
			Nianhao: "始元",
			Dynasty: "西汉",
		},
		{
			Year:    -87,
			Emperor: "汉武帝",
			Nianhao: "后元",
			Dynasty: "西汉",
		},
		{
			Year:    -91,
			Emperor: "汉武帝",
			Nianhao: "征和",
			Dynasty: "西汉",
		},
		{
			Year:    -95,
			Emperor: "汉武帝",
			Nianhao: "太始",
			Dynasty: "西汉",
		},
		{
			Year:    -99,
			Emperor: "汉武帝",
			Nianhao: "天汉",
			Dynasty: "西汉",
		},
		{
			Year:    -103,
			Emperor: "汉武帝",
			Nianhao: "太初",
			Dynasty: "西汉",
		},
	}
}

func weiJinNanBeiChaoEras() []Era {
	return []Era{
		{
			Year:              617,
			Emperor:           "隋恭帝",
			OtherNianHaoStart: "义宁",
			Dynasty:           "隋",
		},
		{
			Year:    605,
			Emperor: "隋炀帝",
			Nianhao: "大业",
			Dynasty: "隋",
		},
		{
			Year:    601,
			Emperor: "隋文帝",
			Nianhao: "仁寿",
			Dynasty: "隋",
		},
		{
			Year:    589,
			Emperor: "隋文帝",
			Nianhao: "开皇",
			Dynasty: "隋",
			Offset:  8,
		},
		{
			Year:    587,
			Emperor: "陈后主",
			Nianhao: "祯明",
			Dynasty: "南朝陈",
		},
		{
			Year:    583,
			Emperor: "陈后主",
			Nianhao: "至德",
			Dynasty: "南朝陈",
		},
		{
			Year:    569,
			Emperor: "陈宣帝",
			Nianhao: "太建",
			Dynasty: "南朝陈",
		},
		{
			Year:    567,
			Emperor: "陈伯宗",
			Nianhao: "光大",
			Dynasty: "南朝陈",
		},
		{
			Year:              566,
			Emperor:           "陈文帝",
			OtherNianHaoStart: "天康",
			Dynasty:           "南朝陈",
		},
		{
			Year:    560,
			Emperor: "陈文帝",
			Nianhao: "天嘉",
			Dynasty: "南朝陈",
		},
		{
			Year:              557,
			Emperor:           "陈武帝",
			OtherNianHaoStart: "永定",
			Dynasty:           "南朝陈",
		},
		{
			Year:              556,
			Emperor:           "梁敬帝",
			OtherNianHaoStart: "太平",
			Dynasty:           "南朝梁",
		},
		{
			Year:              555,
			Emperor:           "梁敬帝",
			OtherNianHaoStart: "绍泰",
			Dynasty:           "南朝梁",
		},
		{
			Year:    552,
			Emperor: "梁元帝",
			Nianhao: "承圣",
			Dynasty: "南朝梁",
		},
		{
			Year:    550,
			Emperor: "梁简文帝",
			Nianhao: "大宝",
			Dynasty: "南朝梁",
		},
		{
			Year:              547,
			Emperor:           "梁武帝",
			OtherNianHaoStart: "太清",
			Dynasty:           "南朝梁",
		},
		{
			Year:              546,
			Emperor:           "梁武帝",
			OtherNianHaoStart: "中大同",
			Dynasty:           "南朝梁",
		},
		{
			Year:    535,
			Emperor: "梁武帝",
			Nianhao: "大同",
			Dynasty: "南朝梁",
		},
		{
			Year:              529,
			Emperor:           "梁武帝",
			OtherNianHaoStart: "中大通",
			Dynasty:           "南朝梁",
		},
		{
			Year:              527,
			Emperor:           "梁武帝",
			OtherNianHaoStart: "大通",
			Dynasty:           "南朝梁",
		},
		{
			Year:    520,
			Emperor: "梁武帝",
			Nianhao: "普通",
			Dynasty: "南朝梁",
		},
		{
			Year:              502,
			Emperor:           "梁武帝",
			OtherNianHaoStart: "天监",
			Dynasty:           "南朝梁",
		},
		{
			Year:              501,
			Emperor:           "齐和帝",
			OtherNianHaoStart: "中兴",
			Dynasty:           "南朝齐",
		},
		{
			Year:    499,
			Emperor: "齐东昏侯",
			Nianhao: "永元",
			Dynasty: "南朝齐",
		},
		{
			Year:              498,
			Emperor:           "齐明帝",
			OtherNianHaoStart: "永泰",
			Dynasty:           "南朝齐",
		},
		{
			Year:              494,
			Emperor:           "齐明帝",
			OtherNianHaoStart: "建武",
			Dynasty:           "南朝齐",
		},
		{
			Year:    483,
			Emperor: "齐武帝",
			Nianhao: "永明",
			Dynasty: "南朝齐",
		},
		{
			Year:              479,
			Emperor:           "齐高帝",
			OtherNianHaoStart: "建元",
			Dynasty:           "南朝齐",
		},
		{
			Year:              477,
			Emperor:           "宋顺帝",
			OtherNianHaoStart: "升明",
			Dynasty:           "南朝宋",
		},
		{
			Year:    473,
			Emperor: "宋后废帝",
			Nianhao: "元徽",
			Dynasty: "南朝宋",
		},
		{
			Year:              472,
			Emperor:           "宋明帝",
			OtherNianHaoStart: "泰豫",
			Dynasty:           "南朝宋",
		},
		{
			Year:              465,
			Emperor:           "宋明帝",
			OtherNianHaoStart: "泰始",
			Dynasty:           "南朝宋",
		},
		{
			Year:    457,
			Emperor: "宋孝武帝",
			Nianhao: "大明",
			Dynasty: "南朝宋",
		},
		{
			Year:    454,
			Emperor: "宋孝武帝",
			Nianhao: "孝建",
			Dynasty: "南朝宋",
		},
		{
			Year:              424,
			Emperor:           "宋文帝",
			OtherNianHaoStart: "元嘉",
			Dynasty:           "南朝宋",
		},
		{
			Year:              423,
			Emperor:           "宋少帝",
			OtherNianHaoStart: "景平",
			Dynasty:           "南朝宋",
		},
		{
			Year:              420,
			Emperor:           "宋武帝",
			OtherNianHaoStart: "永初",
			Dynasty:           "南朝宋",
		},
		{
			Year:              419,
			Emperor:           "晋恭帝",
			OtherNianHaoStart: "元熙",
			Dynasty:           "东晋",
		},
		{
			Year:    405,
			Emperor: "晋安帝",
			Nianhao: "义熙",
			Dynasty: "东晋",
		},
		{
			Year:              402,
			Emperor:           "晋安帝",
			OtherNianHaoStart: "大亨",
			Dynasty:           "东晋",
		},
		{
			Year:    397,
			Emperor: "晋安帝",
			Nianhao: "隆安",
			Dynasty: "东晋",
		},
		{
			Year:    376,
			Emperor: "晋孝武帝",
			Nianhao: "太元",
			Dynasty: "东晋",
		},
		{
			Year:    373,
			Emperor: "晋孝武帝",
			Nianhao: "宁康",
			Dynasty: "东晋",
		},
		{
			Year:              371,
			Emperor:           "晋简文帝",
			OtherNianHaoStart: "咸安",
			Dynasty:           "东晋",
		},
		{
			Year:    366,
			Emperor: "晋废帝",
			Nianhao: "太和",
			Dynasty: "东晋",
		},
		{
			Year:              363,
			Emperor:           "晋哀帝",
			OtherNianHaoStart: "兴宁",
			Dynasty:           "东晋",
		},
		{
			Year:              362,
			Emperor:           "晋哀帝",
			OtherNianHaoStart: "隆和",
			Dynasty:           "东晋",
		},
		{
			Year:    357,
			Emperor: "晋穆帝",
			Nianhao: "升平",
			Dynasty: "东晋",
		},
		{
			Year:    345,
			Emperor: "晋穆帝",
			Nianhao: "永和",
			Dynasty: "东晋",
		},
		{
			Year:    343,
			Emperor: "晋康帝",
			Nianhao: "建元",
			Dynasty: "东晋",
		},
		{
			Year:    335,
			Emperor: "晋成帝",
			Nianhao: "咸康",
			Dynasty: "东晋",
		},
		{
			Year:              326,
			Emperor:           "晋成帝",
			OtherNianHaoStart: "咸和",
			Dynasty:           "东晋",
		},
		{
			Year:              323,
			Emperor:           "晋明帝",
			OtherNianHaoStart: "太宁",
			Dynasty:           "东晋",
		},
		{
			Year:              322,
			Emperor:           "晋元帝",
			OtherNianHaoStart: "永昌",
			Dynasty:           "东晋",
		},
		{
			Year:              318,
			Emperor:           "晋元帝",
			OtherNianHaoStart: "大兴",
			Dynasty:           "东晋",
		},
		{
			Year:              317,
			Emperor:           "晋元帝",
			OtherNianHaoStart: "建武",
			Dynasty:           "东晋",
		},
		{
			Year:              313,
			Emperor:           "晋愍帝",
			OtherNianHaoStart: "建兴",
			Dynasty:           "西晋",
		},
		{
			Year:    307,
			Emperor: "晋怀帝",
			Nianhao: "永嘉",
			Dynasty: "西晋",
		},
		{
			Year:              306,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "光熙",
			Dynasty:           "西晋",
		},
		{
			Year:              304,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "永兴",
		},
		{
			Year:              302,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "太安",
			Dynasty:           "西晋",
		},
		{
			Year:              301,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "永宁",
			Dynasty:           "西晋",
		},
		{
			Year:              300,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "永康",
			Dynasty:           "西晋",
		},
		{
			Year:              291,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "元康",
			Dynasty:           "西晋",
		},
		{
			Year:              290,
			Emperor:           "晋惠帝",
			OtherNianHaoStart: "永熙",
			Dynasty:           "西晋",
		},
		{
			Year:              280,
			Emperor:           "晋武帝",
			OtherNianHaoStart: "太康",
			Dynasty:           "西晋",
		},
		{
			Year:    275,
			Emperor: "晋武帝",
			Nianhao: "咸宁",
			Dynasty: "西晋",
		},
		{
			Year:              265,
			Emperor:           "晋武帝",
			OtherNianHaoStart: "泰始",
			Dynasty:           "西晋",
		},
		{
			Year:              264,
			Emperor:           "魏元帝",
			OtherNianHaoStart: "咸熙",
			Dynasty:           "魏",
		},
		{
			Year:              260,
			Emperor:           "魏元帝",
			OtherNianHaoStart: "景元",
			Dynasty:           "魏",
		},
		{
			Year:              256,
			Emperor:           "魏少帝",
			OtherNianHaoStart: "甘露",
			Dynasty:           "魏",
		},
		{
			Year:              254,
			Emperor:           "魏少帝",
			OtherNianHaoStart: "正元",
			Dynasty:           "魏",
		},
		{
			Year:              249,
			Emperor:           "魏少帝",
			OtherNianHaoStart: "嘉平",
			Dynasty:           "魏",
		},
		{
			Year:    240,
			Emperor: "魏少帝",
			Nianhao: "正始",
			Dynasty: "魏",
		},
		{
			Year:              237,
			Emperor:           "魏明帝",
			OtherNianHaoStart: "景初",
			Dynasty:           "魏",
		},
		{
			Year:              233,
			Emperor:           "魏明帝",
			OtherNianHaoStart: "青龙",
			Dynasty:           "魏",
		},
		{
			Year:    227,
			Emperor: "魏明帝",
			Nianhao: "太和",
			Dynasty: "魏",
		},
		{
			Year:              220,
			Emperor:           "魏文帝",
			OtherNianHaoStart: "黄初",
			Dynasty:           "魏",
		},
		{
			Year:    220,
			Emperor: "汉献帝",
			Nianhao: "延康",
			Dynasty: "东汉",
		},
	}
}

func tangEras() []Era {
	return []Era{
		{
			Year:              904,
			Emperor:           "唐哀帝",
			OtherNianHaoStart: "天祐",
			Dynasty:           "唐",
		},
		{
			Year:              901,
			Emperor:           "唐昭宗",
			OtherNianHaoStart: "天复",
			Dynasty:           "唐",
		},
		{
			Year:              898,
			Emperor:           "唐昭宗",
			OtherNianHaoStart: "光化",
			Dynasty:           "唐",
		},
		{
			Year:    894,
			Emperor: "唐昭宗",
			Nianhao: "乾宁",
			Dynasty: "唐",
		},
		{
			Year:    892,
			Emperor: "唐昭宗",
			Nianhao: "景福",
			Dynasty: "唐",
		},
		{
			Year:    890,
			Emperor: "唐昭宗",
			Nianhao: "大顺",
			Dynasty: "唐",
		},
		{
			Year:              889,
			Emperor:           "唐昭宗",
			OtherNianHaoStart: "龙纪",
			Dynasty:           "唐",
		},
		{
			Year:              888,
			Emperor:           "唐昭宗",
			OtherNianHaoStart: "文德",
			Dynasty:           "唐",
		},
		{
			Year:              885,
			Emperor:           "唐僖宗",
			OtherNianHaoStart: "光启",
			Dynasty:           "唐",
		},
		{
			Year:              881,
			Emperor:           "唐僖宗",
			OtherNianHaoStart: "中和",
			Dynasty:           "唐",
		},
		{
			Year:              880,
			Emperor:           "唐僖宗",
			OtherNianHaoStart: "广明",
			Dynasty:           "唐",
		},
		{
			Year:              874,
			Emperor:           "唐僖宗",
			OtherNianHaoStart: "乾符",
			Dynasty:           "唐",
		},
		{
			Year:              860,
			Emperor:           "唐懿宗",
			OtherNianHaoStart: "咸通",
			Dynasty:           "唐",
		},
		{
			Year:    847,
			Emperor: "唐宣宗",
			Nianhao: "大中",
			Dynasty: "唐",
		},
		{
			Year:    841,
			Emperor: "唐武宗",
			Nianhao: "会昌",
			Dynasty: "唐",
		},
		{
			Year:    836,
			Emperor: "唐文宗",
			Nianhao: "开成",
			Dynasty: "唐",
		},
		{
			Year:              827,
			Emperor:           "唐文宗",
			OtherNianHaoStart: "大和",
			Dynasty:           "唐",
		},
		{
			Year:    825,
			Emperor: "唐敬宗",
			Nianhao: "宝历",
			Dynasty: "唐",
		},
		{
			Year:    821,
			Emperor: "唐穆宗",
			Nianhao: "长庆",
			Dynasty: "唐",
		},
		{
			Year:    806,
			Emperor: "唐宪宗",
			Nianhao: "元和",
			Dynasty: "唐",
		},
		{
			Year:              805,
			Emperor:           "唐顺宗",
			OtherNianHaoStart: "永贞",
			Dynasty:           "唐",
		},
		{
			Year:    785,
			Emperor: "唐德宗",
			Nianhao: "贞元",
			Dynasty: "唐",
		},
		{
			Year:    784,
			Emperor: "唐德宗",
			Nianhao: "兴元",
			Dynasty: "唐",
		},
		{
			Year:    780,
			Emperor: "唐德宗",
			Nianhao: "建中",
			Dynasty: "唐",
		},
		{
			Year:              766,
			Emperor:           "唐代宗",
			OtherNianHaoStart: "大历",
			Dynasty:           "唐",
		},
		{
			Year:              765,
			Emperor:           "唐代宗",
			OtherNianHaoStart: "永泰",
			Dynasty:           "唐",
		},
		{
			Year:              763,
			Emperor:           "唐代宗",
			OtherNianHaoStart: "广德",
			Dynasty:           "唐",
		},
		{
			Year:              762,
			Emperor:           "唐代宗",
			OtherNianHaoStart: "宝应",
			Dynasty:           "唐",
		},
		{
			Year:              760,
			Emperor:           "唐肃宗",
			OtherNianHaoStart: "上元",
			Dynasty:           "唐",
		},
		{
			Year:              758,
			Emperor:           "唐肃宗",
			OtherNianHaoStart: "乾元",
			Dynasty:           "唐",
		},
		{
			Year:              756,
			Emperor:           "唐肃宗",
			OtherNianHaoStart: "至德",
			Dynasty:           "唐",
		},
		{
			Year:    742,
			Emperor: "唐玄宗",
			Nianhao: "天宝",
			Dynasty: "唐",
		},
		{
			Year:              713,
			Emperor:           "唐玄宗",
			OtherNianHaoStart: "开元",
			Dynasty:           "唐",
		},
		{
			Year:              712,
			Emperor:           "唐玄宗",
			OtherNianHaoStart: "先天",
			Dynasty:           "唐",
		},
		{
			Year:              712,
			Emperor:           "唐睿宗",
			OtherNianHaoStart: "延和",
			Dynasty:           "唐",
		},
		{
			Year:              712,
			Emperor:           "唐睿宗",
			OtherNianHaoStart: "太极",
			Dynasty:           "唐",
		},
		{
			Year:              710,
			Emperor:           "唐睿宗",
			OtherNianHaoStart: "景云",
			Dynasty:           "唐",
		},
		{
			Year:              710,
			Emperor:           "唐殇帝",
			OtherNianHaoStart: "唐隆",
			Dynasty:           "唐",
		},
		{
			Year:              707,
			Emperor:           "唐中宗",
			OtherNianHaoStart: "景龙",
			Dynasty:           "唐",
		},
		{
			Year:              705,
			Emperor:           "唐中宗",
			OtherNianHaoStart: "神龙",
			Dynasty:           "唐",
		},
		{
			Year:              701,
			Emperor:           "武则天",
			OtherNianHaoStart: "长安",
			Dynasty:           "武周",
		},
		{
			Year:    701,
			Emperor: "武则天",
			Nianhao: "大足",
			Dynasty: "武周",
		},
		{
			Year:              700,
			Emperor:           "武则天",
			OtherNianHaoStart: "久视",
			Dynasty:           "武周",
		},
		{
			Year:    698,
			Emperor: "武则天",
			Nianhao: "圣历",
			Dynasty: "武周",
		},
		{
			Year:              696,
			Emperor:           "武则天",
			OtherNianHaoStart: "万岁通天",
			Dynasty:           "武周",
		},
		{
			Year:    696,
			Emperor: "武则天",
			Nianhao: "万岁登封",
			Dynasty: "武周",
		},
		{
			Year:              695,
			Emperor:           "武则天",
			OtherNianHaoStart: "天册万岁",
			Dynasty:           "武周",
		},
		{
			Year:    695,
			Emperor: "武则天",
			Nianhao: "证圣",
			Dynasty: "武周",
		},
		{
			Year:              694,
			Emperor:           "武则天",
			OtherNianHaoStart: "延载",
			Dynasty:           "武周",
		},
		{
			Year:              692,
			Emperor:           "武则天",
			OtherNianHaoStart: "长寿",
			Dynasty:           "武周",
		},
		{
			Year:              692,
			Emperor:           "武则天",
			OtherNianHaoStart: "如意",
			Dynasty:           "武周",
		},
		{
			Year:              690,
			Emperor:           "武则天",
			OtherNianHaoStart: "天授",
			Dynasty:           "武周",
		},
		{
			Year:    690,
			Emperor: "唐睿宗",
			Nianhao: "载初",
			Dynasty: "唐",
		},
		{
			Year:    689,
			Emperor: "唐睿宗",
			Nianhao: "永昌",
			Dynasty: "唐",
		},
		{
			Year:    685,
			Emperor: "唐睿宗",
			Nianhao: "垂拱",
			Dynasty: "唐",
		},
		{
			Year:              684,
			Emperor:           "唐睿宗",
			OtherNianHaoStart: "光宅",
			Dynasty:           "唐",
		},
		{
			Year:              684,
			Emperor:           "唐睿宗",
			OtherNianHaoStart: "文明",
			Dynasty:           "唐",
		},
		{
			Year:    684,
			Emperor: "唐中宗",
			Nianhao: "嗣圣",
			Dynasty: "唐",
		},
		{
			Year:              683,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "弘道",
			Dynasty:           "唐",
		},
		{
			Year:              682,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "永淳",
			Dynasty:           "唐",
		},
		{
			Year:              681,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "开耀",
			Dynasty:           "唐",
		},
		{
			Year:              680,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "永隆",
			Dynasty:           "唐",
		},
		{
			Year:              679,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "调露",
			Dynasty:           "唐",
		},
		{
			Year:              676,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "仪凤",
			Dynasty:           "唐",
		},
		{
			Year:              674,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "上元",
			Dynasty:           "唐",
		},
		{
			Year:              670,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "咸亨",
			Dynasty:           "唐",
		},
		{
			Year:              668,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "总章",
			Dynasty:           "唐",
		},
		{
			Year:    666,
			Emperor: "唐高宗",
			Nianhao: "乾封",
			Dynasty: "唐",
		},
		{
			Year:    664,
			Emperor: "唐高宗",
			Nianhao: "麟德",
			Dynasty: "唐",
		},
		{
			Year:              661,
			Emperor:           "唐高宗",
			OtherNianHaoStart: "龙朔",
			Dynasty:           "唐",
		},
		{
			Year:    656,
			Emperor: "唐高宗",
			Nianhao: "显庆",
			Dynasty: "唐",
		},
		{
			Year:    650,
			Emperor: "唐高宗",
			Nianhao: "永徽",
			Dynasty: "唐",
		},
		{
			Year:    627,
			Emperor: "唐太宗",
			Nianhao: "贞观",
			Dynasty: "唐",
		},
		{
			Year:              618,
			Emperor:           "唐高祖",
			OtherNianHaoStart: "武德",
			Dynasty:           "唐",
		},
		{
			Year:    617,
			Emperor: "隋恭帝",
			Nianhao: "义宁",
			Dynasty: "隋",
		},
	}
}

func wudaiSongYuanEras() []Era {
	return []Era{
		{
			Year:    1341,
			Emperor: "元顺帝",
			Nianhao: "至正",
			Dynasty: "元",
		},
		{
			Year:              1335,
			Emperor:           "元顺帝",
			OtherNianHaoStart: "至元",
			Dynasty:           "元",
		},
		{
			Year:              1333,
			Emperor:           "元顺帝",
			OtherNianHaoStart: "元统",
			Dynasty:           "元",
		},
		{
			Year:              1330,
			Emperor:           "元文宗",
			OtherNianHaoStart: "至顺",
			Dynasty:           "元",
		},
		{
			Year:              1328,
			Emperor:           "元文宗",
			OtherNianHaoStart: "天历",
			Dynasty:           "元",
		},
		{
			Year:    1324,
			Emperor: "元泰定帝",
			Nianhao: "泰定",
			Dynasty: "元",
		},
		{
			Year:    1321,
			Emperor: "元英宗",
			Nianhao: "至治",
			Dynasty: "元",
		},
		{
			Year:    1314,
			Emperor: "元仁宗",
			Nianhao: "延祐",
			Dynasty: "元",
		},
		{
			Year:    1312,
			Emperor: "元仁宗",
			Nianhao: "皇庆",
			Dynasty: "元",
		},
		{
			Year:    1308,
			Emperor: "元武宗",
			Nianhao: "至大",
			Dynasty: "元",
		},
		{
			Year:              1297,
			Emperor:           "元成宗",
			OtherNianHaoStart: "大德",
			Dynasty:           "元",
		},
		{
			Year:    1295,
			Emperor: "元成宗",
			Nianhao: "元贞",
			Dynasty: "元",
		},
		{
			Year:              1279,
			Emperor:           "元世祖",
			OtherNianHaoStart: "至元",
			Dynasty:           "元",
			Offset:            15,
		},
		{
			Year:              1278,
			Emperor:           "宋帝昺",
			OtherNianHaoStart: "祥兴",
			Dynasty:           "宋",
		},
		{
			Year:              1276,
			Emperor:           "宋端宗",
			OtherNianHaoStart: "景炎",
			Dynasty:           "宋",
		},
		{
			Year:              1275,
			Emperor:           "宋恭帝",
			OtherNianHaoStart: "德祐",
			Dynasty:           "宋",
		},
		{
			Year:    1265,
			Emperor: "宋度宗",
			Nianhao: "咸淳",
			Dynasty: "宋",
		},
		{
			Year:    1260,
			Emperor: "宋理宗",
			Nianhao: "景定",
			Dynasty: "宋",
		},
		{
			Year:    1259,
			Emperor: "宋理宗",
			Nianhao: "开庆",
			Dynasty: "宋",
		},
		{
			Year:    1253,
			Emperor: "宋理宗",
			Nianhao: "宝祐",
			Dynasty: "宋",
		},
		{
			Year:    1241,
			Emperor: "宋理宗",
			Nianhao: "淳祐",
			Dynasty: "宋",
		},
		{
			Year:    1237,
			Emperor: "宋理宗",
			Nianhao: "嘉熙",
			Dynasty: "宋",
		},
		{
			Year:    1234,
			Emperor: "宋理宗",
			Nianhao: "端平",
			Dynasty: "宋",
		},
		{
			Year:    1228,
			Emperor: "宋理宗",
			Nianhao: "绍定",
			Dynasty: "宋",
		},
		{
			Year:    1225,
			Emperor: "宋理宗",
			Nianhao: "宝庆",
			Dynasty: "宋",
		},
		{
			Year:    1208,
			Emperor: "宋宁宗",
			Nianhao: "嘉定",
			Dynasty: "宋",
		},
		{
			Year:    1205,
			Emperor: "宋宁宗",
			Nianhao: "开禧",
			Dynasty: "宋",
		},
		{
			Year:    1201,
			Emperor: "宋宁宗",
			Nianhao: "嘉泰",
			Dynasty: "宋",
		},
		{
			Year:    1195,
			Emperor: "宋宁宗",
			Nianhao: "庆元",
			Dynasty: "宋",
		},
		{
			Year:    1190,
			Emperor: "宋光宗",
			Nianhao: "绍熙",
			Dynasty: "宋",
		},
		{
			Year:    1174,
			Emperor: "宋孝宗",
			Nianhao: "淳熙",
			Dynasty: "宋",
		},
		{
			Year:    1165,
			Emperor: "宋孝宗",
			Nianhao: "乾道",
			Dynasty: "宋",
		},
		{
			Year:    1163,
			Emperor: "宋孝宗",
			Nianhao: "隆兴",
			Dynasty: "宋",
		},
		{
			Year:    1131,
			Emperor: "宋高宗",
			Nianhao: "绍兴",
			Dynasty: "宋",
		},
		{
			Year:              1127,
			Emperor:           "宋高宗",
			OtherNianHaoStart: "建炎",
			Dynasty:           "宋",
		},
		{
			Year:              1126,
			Emperor:           "宋钦宗",
			OtherNianHaoStart: "靖康",
			Dynasty:           "宋",
		},
		{
			Year:              1119,
			Emperor:           "宋徽宗",
			OtherNianHaoStart: "宣和",
			Dynasty:           "宋",
		},
		{
			Year:              1118,
			Emperor:           "宋徽宗",
			OtherNianHaoStart: "重和",
			Dynasty:           "宋",
		},
		{
			Year:    1111,
			Emperor: "宋徽宗",
			Nianhao: "政和",
			Dynasty: "宋",
		},
		{
			Year:    1107,
			Emperor: "宋徽宗",
			Nianhao: "大观",
			Dynasty: "宋",
		},
		{
			Year:    1102,
			Emperor: "宋徽宗",
			Nianhao: "崇宁",
			Dynasty: "宋",
		},
		{
			Year:    1101,
			Emperor: "宋徽宗",
			Nianhao: "建中靖国",
			Dynasty: "宋",
		},
		{
			Year:              1098,
			Emperor:           "宋哲宗",
			OtherNianHaoStart: "元符",
			Dynasty:           "宋",
		},
		{
			Year:              1094,
			Emperor:           "宋哲宗",
			OtherNianHaoStart: "绍圣",
			Dynasty:           "宋",
		},
		{
			Year:    1086,
			Emperor: "宋哲宗",
			Nianhao: "元祐",
			Dynasty: "宋",
		},
		{
			Year:    1078,
			Emperor: "宋神宗",
			Nianhao: "元丰",
			Dynasty: "宋",
		},
		{
			Year:    1068,
			Emperor: "宋神宗",
			Nianhao: "熙宁",
			Dynasty: "宋",
		},
		{
			Year:    1064,
			Emperor: "宋英宗",
			Nianhao: "治平",
			Dynasty: "宋",
		},
		{
			Year:              1056,
			Emperor:           "宋仁宗",
			OtherNianHaoStart: "嘉祐",
			Dynasty:           "宋",
		},
		{
			Year:              1054,
			Emperor:           "宋仁宗",
			OtherNianHaoStart: "至和",
			Dynasty:           "宋",
		},
		{
			Year:    1049,
			Emperor: "宋仁宗",
			Nianhao: "皇祐",
			Dynasty: "宋",
		},
		{
			Year:              1041,
			Emperor:           "宋仁宗",
			OtherNianHaoStart: "庆历",
			Dynasty:           "宋",
		},
		{
			Year:              1040,
			Emperor:           "宋仁宗",
			OtherNianHaoStart: "康定",
			Dynasty:           "宋",
		},
		{
			Year:              1038,
			Emperor:           "宋仁宗",
			OtherNianHaoStart: "宝元",
			Dynasty:           "宋",
		},
		{
			Year:    1034,
			Emperor: "宋仁宗",
			Nianhao: "景祐",
			Dynasty: "宋",
		},
		{
			Year:              1032,
			Emperor:           "宋仁宗",
			OtherNianHaoStart: "明道",
			Dynasty:           "宋",
		},
		{
			Year:    1023,
			Emperor: "宋仁宗",
			Nianhao: "天圣",
			Dynasty: "宋",
		},
		{
			Year:    1022,
			Emperor: "宋真宗",
			Nianhao: "乾兴",
			Dynasty: "宋",
		},
		{
			Year:    1017,
			Emperor: "宋真宗",
			Nianhao: "天禧",
			Dynasty: "宋",
		},
		{
			Year:    1008,
			Emperor: "宋真宗",
			Nianhao: "大中祥符",
			Dynasty: "宋",
		},
		{
			Year:    1004,
			Emperor: "宋真宗",
			Nianhao: "景德",
			Dynasty: "宋",
		},
		{
			Year:    998,
			Emperor: "宋真宗",
			Nianhao: "咸平",
			Dynasty: "宋",
		},
		{
			Year:    995,
			Emperor: "宋太宗",
			Nianhao: "至道",
			Dynasty: "宋",
		},
		{
			Year:    990,
			Emperor: "宋太宗",
			Nianhao: "淳化",
			Dynasty: "宋",
		},
		{
			Year:    988,
			Emperor: "宋太宗",
			Nianhao: "端拱",
			Dynasty: "宋",
		},
		{
			Year:              984,
			Emperor:           "宋太宗",
			OtherNianHaoStart: "雍熙",
			Dynasty:           "宋",
		},
		{
			Year:              976,
			Emperor:           "宋太宗",
			OtherNianHaoStart: "太平兴国",
			Dynasty:           "宋",
		},
		{
			Year:              968,
			Emperor:           "宋太祖",
			OtherNianHaoStart: "开宝",
			Dynasty:           "宋",
		},
		{
			Year:              963,
			Emperor:           "宋太祖",
			OtherNianHaoStart: "乾德",
			Dynasty:           "宋",
		},
		{
			Year:              960,
			Emperor:           "宋太祖",
			OtherNianHaoStart: "建隆",
			Dynasty:           "宋",
		},
		{
			Year:              954,
			Emperor:           "后周世宗",
			OtherNianHaoStart: "显德",
			Dynasty:           "后周",
		},
		{
			Year:    951,
			Emperor: "后周太祖",
			Nianhao: "广顺",
			Dynasty: "后周",
		},
		{
			Year:              948,
			Emperor:           "后汉隐帝",
			OtherNianHaoStart: "乾祐",
			Dynasty:           "后汉",
		},
		{
			Year:              944,
			Emperor:           "后晋出帝",
			OtherNianHaoStart: "开运",
			Dynasty:           "后晋",
		},
		{
			Year:              936,
			Emperor:           "后晋高祖",
			OtherNianHaoStart: "天福",
			Dynasty:           "后晋",
		},
		{
			Year:              934,
			Emperor:           "后唐末帝",
			OtherNianHaoStart: "清泰",
			Dynasty:           "后唐",
		},
		{
			Year:              930,
			Emperor:           "后唐明宗",
			OtherNianHaoStart: "长兴",
			Dynasty:           "后唐",
		},
		{
			Year:              926,
			Emperor:           "后唐明宗",
			OtherNianHaoStart: "天成",
			Dynasty:           "后唐",
		},
		{
			Year:              923,
			Emperor:           "后唐庄宗",
			OtherNianHaoStart: "同光",
			Dynasty:           "后唐",
		},
		{
			Year:              921,
			Emperor:           "后梁末帝",
			OtherNianHaoStart: "龙德",
			Dynasty:           "后梁",
		},
		{
			Year:              915,
			Emperor:           "后梁末帝",
			OtherNianHaoStart: "贞明",
			Dynasty:           "后梁",
		},
		{
			Year:              911,
			Emperor:           "后梁太祖",
			OtherNianHaoStart: "乾化",
			Dynasty:           "后梁",
		},
		{
			Year:              907,
			Emperor:           "后梁太祖",
			OtherNianHaoStart: "开平",
			Dynasty:           "后梁",
		},
		{
			Year:    904,
			Emperor: "唐哀帝",
			Nianhao: "天祐",
			Dynasty: "唐",
		},
	}
}

func mingQingEras() []Era {
	return []Era{
		{
			Year:    1949,
			Emperor: "新中国",
			Nianhao: "",
			Dynasty: "新中国",
		},
		{
			Year:    1912,
			Emperor: "",
			Nianhao: "民国",
			Dynasty: "中华民国",
		},
		{
			Year:    1909,
			Emperor: "清宣统帝",
			Nianhao: "宣统",
			Dynasty: "清",
		},
		{
			Year:    1875,
			Emperor: "清德宗",
			Nianhao: "光绪",
			Dynasty: "清",
		},
		{
			Year:    1862,
			Emperor: "清穆宗",
			Nianhao: "同治",
			Dynasty: "清",
		},
		{
			Year:    1851,
			Emperor: "清文宗",
			Nianhao: "咸丰",
			Dynasty: "清",
		},
		{
			Year:    1821,
			Emperor: "清宣宗",
			Nianhao: "道光",
			Dynasty: "清",
		},
		{
			Year:    1796,
			Emperor: "清仁宗",
			Nianhao: "嘉庆",
			Dynasty: "清",
		},
		{
			Year:    1736,
			Emperor: "清高宗",
			Nianhao: "乾隆",
			Dynasty: "清",
		},
		{
			Year:    1723,
			Emperor: "清世宗",
			Nianhao: "雍正",
			Dynasty: "清",
		},
		{
			Year:    1662,
			Emperor: "清圣祖",
			Nianhao: "康熙",
			Dynasty: "清",
		},
		{
			Year:    1644,
			Emperor: "清世祖",
			Nianhao: "顺治",
			Dynasty: "清",
		},
		{
			Year:              1644,
			Emperor:           "清世祖",
			OtherNianHaoStart: "顺治",
			Dynasty:           "清",
		},
		{
			Year:    1628,
			Emperor: "明思宗",
			Nianhao: "崇祯",
			Dynasty: "明",
		},
		{
			Year:    1621,
			Emperor: "明熹宗",
			Nianhao: "天启",
			Dynasty: "明",
		},
		{
			Year:              1620,
			Emperor:           "明光宗",
			OtherNianHaoStart: "泰昌",
			Dynasty:           "明",
		},
		{
			Year:    1573,
			Emperor: "明神宗",
			Nianhao: "万历",
			Dynasty: "明",
		},
		{
			Year:    1567,
			Emperor: "明穆宗",
			Nianhao: "隆庆",
			Dynasty: "明",
		},
		{
			Year:    1522,
			Emperor: "明世宗",
			Nianhao: "嘉靖",
			Dynasty: "明",
		},
		{
			Year:    1506,
			Emperor: "明武宗",
			Nianhao: "正德",
			Dynasty: "明",
		},
		{
			Year:    1488,
			Emperor: "明孝宗",
			Nianhao: "弘治",
			Dynasty: "明",
		},
		{
			Year:    1465,
			Emperor: "明宪宗",
			Nianhao: "成化",
			Dynasty: "明",
		},
		{
			Year:    1457,
			Emperor: "明英宗",
			Nianhao: "天顺",
			Dynasty: "明",
		},
		{
			Year:    1450,
			Emperor: "明代宗",
			Nianhao: "景泰",
			Dynasty: "明",
		},
		{
			Year:    1436,
			Emperor: "明英宗",
			Nianhao: "正统",
			Dynasty: "明",
		},
		{
			Year:    1426,
			Emperor: "明宣宗",
			Nianhao: "宣德",
			Dynasty: "明",
		},
		{
			Year:    1425,
			Emperor: "明仁宗",
			Nianhao: "洪熙",
			Dynasty: "明",
		},
		{
			Year:    1403,
			Emperor: "明成祖",
			Nianhao: "永乐",
			Dynasty: "明",
		},
		{
			Year:    1399,
			Emperor: "明惠帝",
			Nianhao: "建文",
			Dynasty: "明",
		},
		{
			Year:              1368,
			Emperor:           "明太祖",
			OtherNianHaoStart: "洪武",
			Dynasty:           "明",
		},
		{
			Year:    1341,
			Emperor: "元顺帝",
			Nianhao: "至正",
			Dynasty: "元",
		},
	}
}
