lunisolar
Version:
专业农历库,支持公历阴历互转,支持各类黄历数据查询,如八字四柱、阴历、神煞宜忌、时辰吉凶、建除十二神、胎神占方、五行纳音等。支持自定义插件。
2 lines (1 loc) • 44.4 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).lunisolar=e()}(this,(function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function n(t,e,n,r){var a,o=arguments.length,i=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(i=(o<3?a(i):o>3?a(e,n,i):a(e,n))||i);return o>3&&i&&Object.defineProperty(e,n,i),i}function r(t,e,n){if(n||2===arguments.length)for(var r,a=0,o=e.length;a<o;a++)!r&&a in e||(r||(r=Array.prototype.slice.call(e,0,a)),r[a]=e[a]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var a={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",q:"quarter",y:"year",lh:"lunarhour",ld:"lunarday",lM:"lunarmonth",ly:"lunaryear",ch:"char8hour",cd:"char8day",cM:"char8month",cy:"char8year"},o=new Set(["lunarhour","lunarday","lunarmonth","lunaryear"]),i="Invalid Date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,c=/\[([^\]]+)]|cZ|t|T|lYn|lMn|lDn|lHn|lY|lM|lL|lD|lH|cYsn|cYs|cYbn|cYb|cYn|cY|cMsn|cMs|cMbn|cMb|cMn|cM|cDsn|cDs|cDbn|cDb|cDn|cD|cHsn|cHs|cHbn|cHb|cHn|cH|dRr|dR|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,s=[[9],[5,9,7],[0,2,4],[1],[4,1,9],[2,6,4],[3,5],[5,3,1],[6,8,4],[7],[4,7,3],[8,0]],l=[2018,12,7],f=[2022,3,12],h={name:"zh",leap:"閏",lunarYearUnit:"年",lunarHourUnit:"時",bigMonth:"大",smallMonth:"小",weekdays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],weekdaysShort:["週日","週一","週二","週三","週四","週五","週六"],weekdaysMin:["日","一","二","三","四","五","六"],months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),lunarMonths:"正月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),lunarMonthsAlias:"正月_二月_三月_四月_五月_六月_七月_八月_九月_十月_冬月_腊月".split("_"),lunarDays:"初一_初二_初三_初四_初五_初六_初七_初八_初九_初十_十一_十二_十三_十四_十五_十六_十七_十八_十九_二十_廿一_廿二_廿三_廿四_廿五_廿六_廿七_廿八_廿九_三十".split("_"),numerals:"〇一二三四五六七八九十".split(""),constellationName:"白羊座_金牛座_雙子座_巨蟹座_狮子座_處女座_天秤座_天蝎座_射手座_摩羯座_水瓶座_雙魚座".split("_"),solarTerm:"小寒_大寒_立春_雨水_驚蟄_春分_清明_穀雨_立夏_小滿_芒種_夏至_小暑_大暑_立秋_處暑_白露_秋分_寒露_霜降_立冬_小雪_大雪_冬至".split("_"),seasonName:"春夏秋冬".split(""),stems:["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],branchs:["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],stemBranchSeparator:"",chineseZodiac:["鼠","牛","虎","兔","龍","蛇","馬","羊","猴","雞","狗","豬"],fiveElements:["木","火","土","金","水"],eightTrigram:"坤震坎兌艮離巽乾".split(""),moonPhase:{"朔":"朔","望":"望","弦":"弦","晦":"晦"},directions:["","北","西南","東","東南","中","西北","西","東北","南"],formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah點mm分",LLLL:"YYYY年M月D日ddddAh點mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiem:function(t,e){var n=100*t+e;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}},g={isUTC:!1,offset:0,changeAgeTerm:2,locales:{zh:h},lang:"zh"},p=1901,v=2100,y=[1874,3749,43818,1611,2715,39590,1386,2905,19370,1874,52645,2853,2635,47691,685,1387,17845,3497,65170,3730,3365,44333,2646,694,39637,1748,3753,20298,3730,50854,1323,2647,47446,2906,1748,30561,1865,64275,2707,1323,54555,2733,1386,40357,2980,2889,19787,2709,60077,1334,2733,47818,1458,3493,32418,3402,66965,2711,1366,50549,2773,1746,34645,3749,1610,26191,2715,60122,1386,2921,43954,2898,2853,35627,2635,68267,685,1389,54697,3497,3474,36501,3365,85581,2646,694,49909,1749,3753,44882,3730,3366,25902,2647,68310,858,1749,43881,1865,1683,35483,1323,2651,19118,1386,60885,2980,2889,44371,2709,1325,34141,2741,76714,1490,3493,56970,3402,3221,35486,1366,2741,19162,1746,51045,1829,1611,42583,3243,1370,25966,2921,94034,2898,2853,56587,2635,1195,41659,1453,2922,19882,3474,61093,3365,2645,47693,1206,1461,30418,3785,69522,3730,3366,54550,2647,1366,37733,1877,1865,26443,1683,60075,1323,2651,43706,1386,2917,35754,2890,69013,2709,1325,50541,2741,1450,34261,3493,3402,28237,3222,60622,1366,2741,47826,1746,3749,34602,1675,67223,1195,1371,54614,2922,1874,35733,2885,2699,19023,1195],m=[219,208,129,216,204,125,213,202,122,210,130,218,206,126,214,203,123,211,201,220,208,128,216,205,124,213,202,123,210,130,217,206,126,214,204,124,211,131,219,208,127,215,205,125,213,202,122,210,129,217,206,127,214,203,124,212,131,218,208,128,215,205,125,213,202,121,209,130,217,206,127,215,203,123,211,131,218,207,128,216,205,125,213,202,220,209,129,217,206,127,215,204,123,210,131,219,207,128,216,205,124,212,201,122,209,129,218,207,126,214,203,123,210,131,219,208,128,216,205,125,212,201,122,210,129,217,206,126,213,203,123,211,131,219,208,128,215,204,124,212,201,122,210,130,217,206,126,214,202,123,211,201,219,208,128,215,204,124,212,202,121,209,129,217,205,126,214,203,123,211,131,219,207,127,215,205,124,212,202,122,209,129,217,206,126,214,203,124,210,130,218,207,127,215,205,125,212,201,121,209],d=[4,19,3,18,4,19,4,19,4,20,4,20,6,22,6,22,6,22,7,22,6,21,6,21],b=[0x6aaaa6aa9a5a,0xaaaaaabaaa6a,0xaaabbabbafaa,99670716471979,0xaaaaaaaaaa6a,0x6aaaa6aa9a56,0xaaaaaaaa9a5a,0xaaabaabaaeaa,95203950484138,99671807007318,0x6aaaaaaa9a5a,99671806990934,0xaaabaabaaa6a,93829556755114,99670716471894,93829556689578,95203950484054,0x6aa6a6aa9a56,93829288253866,95203950484053,0x6aa6a6a65a56,93829288252842,93824993285482,93829556755029,93824992236906,93829556689493,0x6aa6a6aa9a5a,93824992232810,93829288254037,99601996995158,0x6aa6a6a69a5a,93824925123930,93829288253781,99671790213718,23456180946266,93824993285461,95203946289749,93824993285397,93824992236821,23439001077082,93824992232725,23439000814938,93824925123861,23439000798550,93824925123845,23437910279510,23456180946181,5845724235094,23439000814853,5777004758358,23439000798469,1378954052950,23437910279425,1378954052949,93824992236885,5845724235009,4564518229,4296017237,5777004758273,23438984021253,1378954052865,23437910279429,1048661,1378954052864,85,4564518144,21,4296082688],_=[0,1,2,3,0,4,2,3,0,4,2,3,5,6,7,8,9,10,7,8,11,10,12,8,11,0,1,13,14,0,1,13,14,0,4,13,14,0,4,13,14,0,4,15,16,17,6,18,19,20,6,18,19,11,0,21,19,14,0,22,23,14,0,22,23,14,0,24,23,14,0,24,25,14,26,27,28,29,30,27,28,16,20,31,32,19,33,34,35,36,14,34,37,23,14,34,38,23,14,34,38,23,14,34,38,28,14,39,40,28,29,41,42,28,16,43,44,32,36,45,46,35,36,47,46,38,23,47,46,38,23,47,46,38,28,47,46,38,28,47,48,40,28,49,50,42,28,51,52,44,35,53,52,44,54,53,55,46,54,56,55,46,38,56,55,46,38,57,55,48,38,57,58,48,42,57,58,59,42,57,60,61,44,62,63,52,44,64,63,55,46,64,65,55,46,66,67,55,46,38],M=function(t){return t?(t=t.trim(),a[t]||(t||"").toLowerCase().replace(/s$/,"")):""},O=function(t,e){if(void 0===e&&(e=!1),void 0===t)return new Date;if(null===t)return new Date(NaN);if("object"==typeof t&&!(t instanceof Date)&&void 0!==t.toDate){var n=t.toDate();if(n instanceof Date)return n}if(t instanceof Date)return new Date(t.valueOf());if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(u);if(r){var a=r[2]-1||0,o=(r[7]||"0").substring(0,3);return e?new Date(Date.UTC(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)):new Date(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)}}return new Date(t)},S=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var r=L(t,"FullYear",e),a=L(t,"Month",e),o=L(t,"Hours",e),i=L(t,"Date",e),u=n?23===o?" 00:00":" ".concat(String(o).padStart(2,"0"),":00"):"";return O("".concat(r,"/").concat(a+1,"/").concat(i+(23===o?1:0)).concat(u),e)},w=function(t){var e=m[t-p];return O("".concat(t,"/").concat(Math.floor(e/100),"/").concat(e%100))},T=function(t){var e=y[t-p];return[e>>13,1===(e>>12&1)]},D=function(t,e){var n;!function(t,e){var n=g.locales[null!=e?e:g.lang];if("string"==typeof t.year){for(var r="",a=0;a<t.year.length;a++){var o=-1;r+=(o="零"===t.year[a]||"〇"===t.year[a]?0:n.numerals.indexOf(t.year[a]))>=0?o:""}t.year=Number(r)}if("string"==typeof t.month){var i=t.month;i[0]===n.leap&&(t.isLeapMonth=!0,i=t.month.slice(1));var u=n.lunarMonths.indexOf(i);-1===u&&(u=n.lunarMonthsAlias.indexOf(i)),t.month=t.isLeapMonth?u+100+1:u+1}"string"==typeof t.day&&(t.day=n.lunarDays.indexOf(t.day)+1),"string"==typeof t.hour&&(t.hour=n.branchs.indexOf(t.hour))}(t,e);var r=new Date,a=t.year?Number(t.year):r.getFullYear(),o=Number(t.month),i=Number(t.day),u=t.hour?Number(t.hour):0,c=null!==(n=t.isLeapMonth)&&void 0!==n&&n;if(o>100&&(o-=100,c=!0),a<p||a>v)throw new Error("Invalid lunar year: out of range");if(o<1)throw new Error("Invalid lunar month");var s=w(a),l=T(a),f=l[0],h=l[1];if(c&&f!==o)throw new Error("Invalid lunar leap month: no this leap month");for(var m=y[a-p],d=c?h:m>>o-1&1,b=0,_=0;_<o;_++){if(b+=m>>_&1?30:29,_===o-1&&!c)break;_===f-1&&(b+=h?30:29)}b-=(d?30:29)-i+1;var M=new Date(s.valueOf()+24*b*60*60*1e3),S=M.getFullYear(),D=M.getMonth()+1,j=M.getDate();return O("".concat(S,"/").concat(D,"/").concat(j," ").concat(2*u,":00"))},j=function(t,e,n,r){void 0===r&&(r=!1);var a=n.getDate(),o=L(t,"Month",r),i=e/2>>0,u=i<o||0===o&&11===i||a>L(t,"Date",r)&&!(a-1===L(t,"Date",r)&&L(t,"Hours",r)>=23)?-1:0;return((12*(L(t,"FullYear",r)-l[0])+L(t,"Month",r)-l[1]+1)%60+u+60)%60};var Y={stem:[10,"stems"],branch:[12,"branchs"],trigram8:[8,"eightTrigram"],element5:[5,"fiveElements"]},P=function(t,e,n,r){if("number"==typeof t)t%=Y[e][0];else if("string"==typeof t){var a=r.locales[n][Y[e][1]].indexOf(t);if(-1===a)throw new Error("Invalid ".concat(e," value"));t=a}return t},L=function(t,e,n){void 0===n&&(n=!1);var r=e.slice(0,1).toUpperCase()+e.slice(1);return n?t["getUTC".concat(r)]():t["get".concat(r)]()};var C=function(t,e){var n;t=(n=[O(t),O(e)])[0];var r=12*((e=n[1]).getFullYear()-t.getFullYear())+(e.getMonth()-t.getMonth()),a=new Date(t).setMonth(t.getMonth()+r),o=a.valueOf()>e.valueOf(),i=new Date(t).setMonth(t.getMonth()+r+(o?-1:1));return r+(e.valueOf()-a.valueOf())/(o?a-i:i-a)||0},A=function(t,e,n){if(t>e)return-A(e,t);for(var r=[t.lunar,e.lunar],a=r[0],o=r[1],i=[a.year,o.year],u=i[0],c=i[1],s=[a.month,o.month],l=s[0],f=s[1],h=u,g=0;h<=c;){var p=[1,12],v=p[0],y=p[1];h===u&&(v=l),h===c&&(y=f),g+=U(h,v,y),h++}if(!n)return g-1;if(g>0)g+=N(t,!0)+N(e,!1)-2;else{var m=a.isBigMonth?30:29;g=(e.valueOf()-t.valueOf())/(864e5*m)}return g},U=function(t,e,n){var r=!1;(e=e||1)>100&&(e-=100,r=!0),(n=n||12)>100&&(n-=100,r=!0);var a=y[t-p]>>13;return e<=a&&a<=n&&(r=!0),n-e+1+(r?1:0)},N=function(t,e){void 0===e&&(e=!1);var n=t.lunar.isBigMonth?30:29,r=t.lunar.day;return e?1-r/n:r/n},H=function(t,e){void 0===e&&(e=!1);var n=t.lunar.leapMonth,r=n>0?13:12,a=!1,o=t.lunar.month;o>100&&(o-=100,a=!0),n>0&&(o>n||o===n&&a)&&o++;var i=N(t,e);return e?1-(o-i)/r:(o+i-1)/r};var k=function(t,e){if(e.toUTCString()===i)return i;var n,r,a,o,u=t||"YYYY-MM-DDTHH:mm:ssZ",s=e.year,l=e.month,f=e.day,h=e.dayOfWeek,p=e.hour,v=e.minute,y=e.second,m=(n=-e.utcOffset(),r=Math.abs(n),a=Math.floor(r/60),o=r%60,"".concat(n<=0?"+":"-").concat(String(a).padStart(2,"0"),":").concat(String(o).padStart(2,"0"))),d=e.lunar,b=e.char8,_=g.locales[e._config.lang],M=_.weekdays,O=_.months,S=_.meridiem,w=function(t,e,n,r){return t&&t[e]||(n?n[e].slice(0,r):"")},T=p%12||12,D=S||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},j={YY:String(s).slice(-2),YYYY:String(s),M:String(l),MM:String(l).padStart(2,"0"),MMM:w(_.monthsShort,l-1,O,3),MMMM:w(O,l-1),D:String(f),DD:String(f).padStart(2,"0"),d:String(h),dd:w(_.weekdaysMin,h,M,2),ddd:w(_.weekdaysShort,h,M,3),dddd:M[h],H:String(p),HH:String(p).padStart(2,"0"),h:String(T),hh:String(T).padStart(2,"0"),a:D(p,v,!0),A:D(p,v,!1),m:String(v),mm:String(v).padStart(2,"0"),s:String(y),ss:String(y).padStart(2,"0"),SSS:String(e.millis).padStart(3,"0"),Z:m,cZ:_.chineseZodiac[b.year.branch.value],t:e.solarTerm?String(e.solarTerm.value+1):"",T:e.solarTerm?e.solarTerm.toString():"",lY:d.getYearName(),lM:d.getMonthName(),lD:d.getDayName(),lH:d.getHourName(),lL:d.isBigMonth?_.bigMonth:_.smallMonth,lYn:String(d.year),lMn:String(d.month),lDn:String(d.day),lHn:String(d.hour+1),cY:b.year.toString(),cYs:b.year.stem.toString(),cYb:b.year.branch.toString(),cM:b.month.toString(),cMs:b.month.stem.toString(),cMb:b.month.branch.toString(),cD:b.day.toString(),cDs:b.day.stem.toString(),cDb:b.day.branch.toString(),cH:b.hour.toString(),cHs:b.hour.stem.toString(),cHb:b.hour.branch.toString(),cYn:b.year.value,cYsn:b.year.stem.value,cYbn:b.year.branch.value,cMn:b.month.value,cMsn:b.month.stem.value,cMbn:b.month.branch.value,cDn:b.day.value,cDsn:b.day.stem.value,cDbn:b.day.branch.value,cHn:b.hour.value,cHsn:b.hour.stem.value,cHbn:b.hour.branch.value,dR:function(){return String(Math.ceil(f/7))},dRr:function(){var t=e.lunisolar("".concat(s,"-").concat(l+1,"-1 ").concat(p,":").concat(v,":").concat(y),e._config),n=Math.abs(t.diff(e,"day"));return String(Math.ceil(n/7))}};return u=u.replace(c,(function(t,e){var n=j[t];return e||("function"==typeof n?n():void 0!==n?n:m.replace(":",""))}))};function x(t,e){return Math.round((e.valueOf()-t.valueOf())/864e5)}var B=function(){function t(t,e){var n;this._config={lang:g.lang,isUTC:!1},e&&(this._config=Object.assign({},this._config,e));var r=O(t);this._date=r;var a=this._config.isUTC,o=L(r,"FullYear",a),i=L(r,"Month",a),u=L(r,"Hours",a),c=S(r,a);if(o<p||o>v||o===p&&i<1||o===p&&1===i&&c.getDate()<19)throw new Error("Invalid lunar year: out of range");var s=x(w(o),c);s<0&&(s=x(w(o-=1),c)),this.year=o;var l=T(o),f=l[0],h=l[1];this.leapMonth=f,this.leapMonthIsBig=h,n=function(t,e,n){var r=y[t-p],a=n||T(t),o=a[0],i=a[1],u=1;e+=1;for(var c=!1;e>29;){if(e-=r>>u-1&1?30:29,u===o&&e>0){var s=i?30:29;if(!(e>s)){c=!0;break}e-=s}u++}return c&&(u+=100),0===e&&(e=30,u--),[u,e]}(o,s,[f,h]),this.month=n[0],this.day=n[1],this.hour=(u+1)%24>>1}return t.fromLunar=function(e,n){return new t(D(e,null==n?void 0:n.lang),n)},Object.defineProperty(t.prototype,"isLeapMonth",{get:function(){return this.month>100},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBigMonth",{get:function(){var t=y[this.year-p];return this.isLeapMonth?1==(t>>12&1):1==(t>>this.month-1&1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLastDayOfMonth",{get:function(){return!(!this.isBigMonth||30!==this.day)||!this.isBigMonth&&29===this.day},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lunarNewYearDay",{get:function(){return w(this.year)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastDayOfYear",{get:function(){var t=w(this.year+1);return new Date(t.valueOf()-864e5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"phaseOfTheMoon",{get:function(){return function(t,e){var n=t.day;return 1===n?e.moonPhase.朔:[7,8,22,23].includes(n)?e.moonPhase.弦:15===n?e.moonPhase.望:t.isLastDayOfMonth?e.moonPhase.晦:""}(this,g.locales[this._config.lang])},enumerable:!1,configurable:!0}),t.prototype.toDate=function(){return new Date(this._date.valueOf())},t.prototype.getYearName=function(){for(var t="",e=this.year,n=g.locales[this._config.lang].numerals;e;){t=n[e%10]+t,e=Math.floor(e/10)}return t},t.prototype.getMonthName=function(){var t=g.locales[this._config.lang].lunarMonths,e=g.locales[this._config.lang].leap;return(this.isLeapMonth?e:"")+t[this.month%100-1]},t.prototype.getDayName=function(){return g.locales[this._config.lang].lunarDays[this.day-1]},t.prototype.getHourName=function(){return g.locales[this._config.lang].branchs[this.hour]},t.prototype.toString=function(){var t=g.locales[this._config.lang];return"".concat(this.getYearName()).concat(t.lunarYearUnit).concat(this.getMonthName()).concat(this.getDayName()).concat(this.getHourName()).concat(t.lunarHourUnit)},t.prototype.valueOf=function(){return this._date.valueOf()},t.getLunarNewYearDay=function(t){return w(t)},t}(),F=function(){function t(e,n){if(this.value=-1,this._config={lang:g.lang,isUTC:!1},n&&(this._config=Object.assign({},this._config,n)),e instanceof t)return e;if("number"==typeof e)this.value=e%24;else if("string"==typeof e){var r=g.locales[this._config.lang].solarTerm.indexOf(e);if(-1===r)throw new Error("Invalid term value");this.value=r}}return Object.defineProperty(t.prototype,"name",{get:function(){return String(g.locales[this._config.lang].solarTerm[this.value])},enumerable:!1,configurable:!0}),t.getNames=function(t){return t=t||g.lang,r([],g.locales[t].solarTerm,!0)},t.getYearTermDayList=function(t){for(var e=[],n=b[_[t-p]].toString(2).padStart(48,"0");e.length<24;){var r=parseInt(n.slice(n.length-2),2),a=d[e.length];e.push(r+a),n=n.slice(0,n.length-2)}return e},t.getMonthTerms=function(t,e){var n=b[_[t-p]].toString(2).padStart(48,"0"),r=4*(e-1),a=parseInt(n.slice(n.length-r-4,n.length-r),2);return[(3&a)+d[2*(e-1)],(a>>2&3)+d[2*(e-1)+1]]},t.findDate=function(e,n,r){var a=r&&r.lang?r.lang:g.lang;return n instanceof t&&(n=n.value),[e,((n="string"==typeof n?g.locales[a].solarTerm.indexOf(n):n%24)>>1)+1,t.getYearTermDayList(e)[n]]},t.findNode=function(e,n){var r,a={lang:g.lang,returnValue:!1,nodeFlag:0,isUTC:!1},o=n?Object.assign({},a,n):a,i=o.returnValue,u=o.nodeFlag;if(u>2)throw new Error("Invalid nodeFlag");var c,s={lang:o.lang||g.lang},l=L(e,"FullYear",o.isUTC),f=L(e,"Month",o.isUTC),h=L(e,"Date",o.isUTC),p=L(e,"Hours",o.isUTC),v=(2*f+24)%24,y=t.getMonthTerms(l,f+1),m=y[0],d=y[1],b=!1,_=!1;h<m&&!(h===m-1&&p>=23)?b=!0:h<d&&!(h===d-1&&p>=23)&&(_=!0,1===u&&(b=!0));var M=!1;b?(f-1<0?(l--,f=11):f--,v=(2*f+24)%24,m=(r=t.getMonthTerms(l,f+1))[0],d=r[1],u>0&&(M=!0)):(1===u||2===u&&!_)&&(M=!0),c=M?d:m,v=M?(v+1)%24:v;var S=O("".concat(l,"-").concat(f+1,"-").concat(c));return i?[v,S]:[new t(v,s),S]},t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.name},t}(),I=function(){function t(e,n){if(this.value=-1,this._config={lang:g.lang},e instanceof t)return e;n&&(this._config=Object.assign({},this._config,n)),this.value=P(e,"element5",this._config.lang,g)}return t.getNames=function(t){return t=t||g.lang,r([],g.locales[t].fiveElements,!0)},t.create=function(e,n){if(e instanceof t)return e;var r=(null==n?void 0:n.lang)||g.lang;e=P(e,"element5",r,g);var a="".concat(e,":").concat(r);if(t.instances.has(a))return t.instances.get(a);var o=new t(e,n);return t.instances.set(a,o),o},Object.defineProperty(t.prototype,"name",{get:function(){return-1===this.value?"":g.locales[this._config.lang].fiveElements[this.value]},enumerable:!1,configurable:!0}),t.prototype.generating=function(){var e=(this.value+1)%5;return t.create(e,this._config)},t.prototype.overcoming=function(){var e=(this.value+2)%5;return t.create(e,this._config)},t.prototype.weakening=function(){var e=(this.value+4)%5;return t.create(e,this._config)},t.prototype.counteracting=function(){var e=(this.value+3)%5;return t.create(e,this._config)},t.prototype.toString=function(){return-1===this.value?"Invalid five-element value":this.name},t.prototype.valueOf=function(){return this.value},t.instances=new Map,t}(),E=function(){function t(t,e){this.value=-1,this._config={lang:g.lang},e&&(this._config=Object.assign({},this._config,e)),this.value=t%8}return t.getNames=function(t){return t=t||g.lang,r([],g.locales[t].eightTrigram,!0)},t.create=function(e,n){var r=(null==n?void 0:n.lang)||g.lang;e=P(e,"trigram8",r,g);var a="".concat(e,":").concat(r);if(t.instances.has(a))return t.instances.get(a);var o=new t(e,n);return t.instances.set(a,o),o},Object.defineProperty(t.prototype,"name",{get:function(){return g.locales[this._config.lang].eightTrigram[this.value]},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.valueOf=function(){return this.value},t.instances=new Map,t}();function z(t,e){return void 0===e&&(e=!1),function(n,a,o){var i=void 0===o.value?o.get:o.value;o[void 0===o.value?"get":"value"]=function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];if(n.length>0&&e){var o=JSON.stringify(n);t+=o}if(this.cache.has(t))return this.cache.get(t);var u=i.call.apply(i,r([this],n,!1));return this.cache.set(t,u),u}}}var Z=function(){this.cache=new Map},G=function(t){function a(e,n){var r=t.call(this)||this;return r.value=-1,r._config={lang:g.lang},e instanceof a?e:(n&&(r._config=Object.assign({},r._config,n)),r.value=P(e,"branch",r._config.lang,g),r)}return e(a,t),a.getNames=function(t){return t=t||g.lang,r([],g.locales[t].branchs,!0)},a.create=function(t,e){if(t instanceof a)return t;var n=(null==e?void 0:e.lang)||g.lang;t=P(t,"branch",n,g);var r="".concat(t,":").concat(n);if(a.instances.has(r))return a.instances.get(r);var o=new a(t,e);return a.instances.set(r,o),o},Object.defineProperty(a.prototype,"name",{get:function(){return g.locales[this._config.lang].branchs[this.value]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"hiddenStems",{get:function(){return s[this.value].map((function(t){return new R(t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"e5",{get:function(){var t=Math.floor((this.value+10)/3)%4;return(this.value+10)%3==2?I.create(2,this._config):I.create(t<2?t:t+1,this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"triad",{get:function(){return[a.create((this.value+4)%12,this._config),a.create((this.value+8)%12,this._config)]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"triadE5",{get:function(){return I.create([4,0,1,3][this.value%4],this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"group6",{get:function(){return a.create((13-this.value)%12,this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"group6E5",{get:function(){return I.create((t=this.value,e=[2,0,1,3,4,2],(t=0===t?12:t)<7?e[t-1]:e[12-t]),this._config);var t,e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"punishing",{get:function(){return a.create([3,10,5,0,4,8,6,1,2,9,7,11][this.value],this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"punishBy",{get:function(){return a.create([3,7,8,0,4,2,6,10,5,9,1,11][this.value],this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"conflict",{get:function(){return a.create((this.value+6)%12,this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"destroying",{get:function(){return a.create([9,4,11,6,1,8,3,10,5,0,7,2][this.value],this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"harming",{get:function(){var t=this.value>7?19-this.value:7-this.value;return a.create(t,this._config)},enumerable:!1,configurable:!0}),a.prototype.toString=function(){return this.name},a.prototype.valueOf=function(){return this.value},a.instances=new Map,n([z("branch:hiddenStems")],a.prototype,"hiddenStems",null),n([z("branch:e5")],a.prototype,"e5",null),n([z("branch:punishing")],a.prototype,"punishing",null),n([z("branch:punishBy")],a.prototype,"punishBy",null),n([z("branch:conflict")],a.prototype,"conflict",null),n([z("branch:destroying")],a.prototype,"destroying",null),n([z("branch:harming")],a.prototype,"harming",null),a}(Z),R=function(t){function a(e,n){var r=t.call(this)||this;return r.value=-1,r._config={lang:g.lang},e instanceof a?e:(n&&(r._config=Object.assign({},r._config,n)),r.value=P(e,"stem",r._config.lang,g),r)}return e(a,t),a.getNames=function(t){return t=t||g.lang,r([],g.locales[t].stems,!0)},a.create=function(t,e){if(t instanceof a)return t;var n=(null==e?void 0:e.lang)||g.lang;t=P(t,"stem",n,g);var r="".concat(t,":").concat(n);if(a.instances.has(r))return a.instances.get(r);var o=new a(t,e);return a.instances.set(r,o),o},Object.defineProperty(a.prototype,"name",{get:function(){return g.locales[this._config.lang].stems[this.value]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"branchs",{get:function(){var t=this;return g.locales[this._config.lang].branchs.filter((function(e,n){return n%2==t.value%2})).map((function(e){return G.create(e,t._config)}))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"e5",{get:function(){return I.create(Math.floor(this.value/2),this._config)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"trigram8",{get:function(){return E.create([7,0,4,3,2,5,1,5,7,0][this.value],this._config)},enumerable:!1,configurable:!0}),a.prototype.toString=function(){return this.name},a.prototype.valueOf=function(){return this.value},a.instances=new Map,n([z("stem:branchs")],a.prototype,"branchs",null),n([z("stem:e5")],a.prototype,"e5",null),a}(Z),V=function(){function t(t,e,n){if(this.value=-1,this._config={lang:g.lang},n&&(this._config=Object.assign({},this._config,n)),"number"==typeof e||"string"==typeof e||e instanceof G){this.stem=R.create(t,this._config),this.branch=G.create(e,this._config);var r=this.stem.valueOf(),a=this.branch.valueOf();this.value=function(t,e){if((t+e)%2!=0)throw new Error("Invalid SB value");return t%10+(6-(e>>1)+(t>>1))%6*10}(r,a)}else{if("number"!=typeof t)throw new Error("Invalid SB value");this.value=t%60;r=this.value%10,a=this.value%12;this.stem=R.create(r,this._config),this.branch=G.create(a,this._config)}}return t.getNames=function(t){t=t||g.lang;var e=g.locales[t];return new Array(60).fill("").map((function(t,n){var r,a=n%10,o=n%12;return e.stems[a]+(null!==(r=null==e?void 0:e.stemBranchSeparator)&&void 0!==r?r:"")+e.branchs[o]}))},t.create=function(e,n){if(e instanceof t)return e;var r=(null==n?void 0:n.lang)||g.lang,a="".concat(e,":").concat(r);if(t.instances.has(a))return t.instances.get(a);var o=new t(e,void 0,n);return t.instances.set(a,o),o},Object.defineProperty(t.prototype,"missing",{get:function(){var t=2*(5-Math.floor(this.value/10));return[G.create(t,this._config),G.create(t+1,this._config)]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){var t,e=g.locales[this._config.lang];return"".concat(this.stem).concat(null!==(t=null==e?void 0:e.stemBranchSeparator)&&void 0!==t?t:"").concat(this.branch)},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.valueOf=function(){return this.value},t.instances=new Map,t}(),$=function(){function t(e,n){if(this.value=-1,this._config={changeAgeTerm:g.changeAgeTerm,isUTC:!1,lang:g.lang,offset:0},n&&(this._config=Object.assign({},this._config,n)),e instanceof Date){var r=this._config.isUTC,a=S(e,r,!0),o=t.computeSBYear(a,this._config),i=t.computeSBMonth(a,this._config),u=t.computeSBDay(a,this._config);e=[o,i,u,t.computeSBHour(a,u,this._config)]}if(!Array.isArray(e))throw new Error("Invalid Char8");this._list=e,this.value=t.computeValue(e)}return t.prototype.getConfig=function(){return Object.assign({},this._config)},Object.defineProperty(t.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"year",{get:function(){return this._list[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"month",{get:function(){return this._list[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"day",{get:function(){return this._list[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hour",{get:function(){return this._list[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"me",{get:function(){return this._list[2].stem},enumerable:!1,configurable:!0}),t.computeValue=function(t){for(var e=0,n=0;n<4;n++)e+=t[n].valueOf()*Math.pow(10,2*(3-n));return e},t.computeSBYear=function(t,e){var n=e&&void 0!==e.changeAgeTerm?e.changeAgeTerm:g.changeAgeTerm,r=e&&e.isUTC,a="number"!=typeof t?L(t,"FullYear",r):t;if(null!=n&&"number"!=typeof t){var o=(n%=24)<0;n=n>=0?n:24+n;var i=L(t,"FullYear",r);o&&i--;var u=i+1,c=F.findDate(i,n),s=F.findDate(u,n),l=O("".concat(c[0],"-").concat(c[1],"-").concat(c[2]-1," 23:00:00")),f=O("".concat(s[0],"-").concat(s[1],"-").concat(s[2]-1," 23:00:00"));t.valueOf()<l.valueOf()?a--:t.valueOf()>=f.valueOf()&&a++}else if(null===n&&"number"!=typeof t){var h=B.getLunarNewYearDay(a);t.valueOf()<h.valueOf()-36e5&&a--}return new V((a-4)%10,(a-4)%12,e)},t.computeSBMonth=function(t,e){var n,r=e&&void 0!==e.lang?e.lang:g.lang,a=e&&void 0!==e.changeAgeTerm?e.changeAgeTerm:g.changeAgeTerm;a=a||0;var o=null!==(n=null==e?void 0:e.isUTC)&&void 0!==n&&n,i={isUTC:o,lang:r,returnValue:!0,nodeFlag:(a+24)%2},u=F.findNode(t,i),c=u[0],s=u[1],l=j(t,c,s,o);return new V(l,void 0,{lang:r})},t.computeSBDay=function(t,e){var n=(null==e?void 0:e.isUTC)||!1,r=(null==e?void 0:e.offset)||0,a=n?t.valueOf()-60*r*1e3:t.valueOf(),o=O("".concat(f[0],"-").concat(f[1],"-").concat(f[2]-1," 23:00:00")),i=Math.floor((a-o.valueOf())/864e5)%60;return i<0&&(i+=60),new V(i,void 0,e)},t.computeSBHour=function(e,n,r){var a=(null==r?void 0:r.isUTC)||!1;n||(n=t.computeSBDay(e,r));var o,i,u=L(e,"Hours",a),c=n.stem,s=(u+1>>1)%12,l=(o=c.value,void 0===(i=s)&&(i=0),(o%5*2+i)%10);return new V(l,s,r)},t.prototype.toString=function(){return"".concat(this.year," ").concat(this.month," ").concat(this.day," ").concat(this.hour)},t.prototype.valueOf=function(){return this.value},t}();function q(t,e,n){for(var r in t){var a=t[r],o=[];if(Array.isArray(a))for(var i=0,u=a;i<u.length;i++){var c=u[i];o.push(W(c,n))}else o.push(W(a,n));e.has(r)?e.set(r,(e.get(r)||[]).concat(o)):e.set(r,o)}return e}function W(t,e){var n=t.tag,r={tag:[],name:t.name};return Array.isArray(n)?r.tag=n.slice():"string"==typeof n&&r.tag.push(n),Array.isArray(e)?r.tag=r.tag.concat(e):"string"==typeof e&&r.tag.push(e),void 0!==t.data&&(r.data=Object.assign({},t.data)),r}function J(t,e,n){return void 0===n&&(n=!1),t.filter((function(t){if(n){var r=Array.isArray(e)?e:[e];return!nt(t.tag,r)}return Array.isArray(e)?!e.includes(t.name):e!==t.name}))}function K(t,e,n,r){void 0===n&&(n=!0);var a=function(e,r){if(!t.has(e))return!1;var a=t.get(e);if(void 0===a)return!1;if(void 0===r)return t.delete(e),!1;var o=J(a,r,n);return 0===o.length?t.delete(e):o.length<a.length&&t.set(e,o),!0};if(void 0===r)for(var o=0,i=Array.from(t.keys());o<i.length;o++){a(i[o],e)}else if(Array.isArray(r))for(var u=0,c=r;u<c.length;u++){a(c[u],e)}else a(r,e)}function Q(t,e,n){void 0===n&&(n=!0),function(t,e,n){void 0===n&&(n=!0);for(var r=t.formatList,a=t.formatMap,o=[],i=0,u=r;i<u.length;i++){var c=u[i];X(a,c,e,n)&&o.push(c)}o.length!==r.length&&(t.formatList=o)}(t,e,n),tt(t,e,n)}function X(t,e,n,r,a){if(void 0===r&&(r=!0),t.has(e)){var o=t.get(e);if(void 0===o)return!1;if(K(o,n,r,a),0!==o.size)return!0;t.delete(e)}return!1}function tt(t,e,n,r){void 0===n&&(n=!0);for(var a=t.fnList,o=[],i=0,u=a;i<u.length;i++){var c=u[i],s=c.fn,l=c.markers;K(l,e,n,r),l.size>0&&o.push({fn:s,markers:l})}o.length!==a.length&&(t.fnList=o)}function et(t,e,n){var r=t.formatMap;if(!r.has(e))return null;var a=r.get(e);if(void 0===a)return null;if(!a.has(n))return null;var o=a.get(n);return void 0===o?null:o}function nt(t,e){for(var n=0;n<e.length;n++)if(t.includes(e[n]))return!0;return!1}function rt(t,e){for(var n in t){var r=t[n],a=e[n];if("tag"===n){if(Array.isArray(r)){if(!Array.isArray(a))return!1;if(!nt(r,a))return!1}else if(Array.isArray(a)&&!a.includes(r))return!1}else if("object"==typeof r&&"object"==typeof a){if(!rt(r,a))return!1}else if(r!==a)return!1}return!0}var at=function(){function t(t){this._list=null,this.storeMarkers=[],this.storeMarkersFromGlobal=[],this.lsr=t,this.init()}return t.add=function(e,n){return function(t,e,n){for(var r=0,a=e;r<a.length;r++){var o=a[r],i=o.format,u=o.markers;if("string"==typeof i){var c=void 0;t.formatMap.has(i)?c=t.formatMap.get(i):t.formatList.push(i),void 0===c&&(c=new Map),q(u,c,n),t.formatMap.set(i,c)}else if("function"==typeof i){var s=new Map;q(u,s,n),t.fnList.push({fn:i,markers:s})}}}(t.store,e,n),t},t.clean=function(){return t.store.formatList=[],t.store.formatMap=new Map,t.store.fnList=[],t},t.cleanFnList=function(){return t.store.fnList=[],t},t.remove=function(e,n,r){return function(t,e,n,r){if(!0===e)tt(t,r,!1,n);else{var a=t.formatList,o=t.formatMap;X(o,e,r,!1,n),o.has(e)||(t.formatList=a.filter((function(t,n){return t!==e})))}}(t.store,e,n,r),t},t.removeByTag=function(e){return Q(t.store,e,!0),t},t.removeByName=function(e){return Q(t.store,e,!1),t},t.prototype.init=function(){for(var e,n=[],a=t.store,o=0,i=a.formatList;o<i.length;o++){var u=i[o],c=et(a,u,this.lsr.format(u));c&&n.push(c)}(e=this.storeMarkersFromGlobal).splice.apply(e,r([0,this.storeMarkersFromGlobal.length],n.flat(),!1))},t.prototype.add=function(t,e){if(this._list=null,Array.isArray(t))for(var n=0,r=t;n<r.length;n++){var a=r[n];this.add(a,e)}else{var o=W(t,e);this.storeMarkers.push(o)}return this},t.prototype.remove=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=0),this._list=null,0!==n&&1!==n||(this.storeMarkersFromGlobal=J(this.storeMarkersFromGlobal,t,e)),0!==n&&2!==n||(this.storeMarkers=J(this.storeMarkers,t,e)),this},t.prototype.clean=function(t){return void 0===t&&(t=0),this._list=null,0!==t&&1!==t||(this.storeMarkersFromGlobal=[]),0!==t&&2!==t||(this.storeMarkers=[]),this},t.prototype.reset=function(){return this._list=null,this.clean(0),this.init(),this},t.prototype[Symbol.iterator]=function(){var t=0,e=this.list;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}},Object.defineProperty(t.prototype,"list",{get:function(){return null==this._list&&(this._list=r(r([],this.storeMarkersFromGlobal,!0),this.storeMarkers,!0)),this._list},enumerable:!1,configurable:!0}),t.prototype.filter=function(t){return"function"==typeof t?this.list.filter(t):"object"==typeof t?this.list.filter((function(e){return rt(t,e)})):[]},t.prototype.find=function(t){return"function"==typeof t?this.list.find(t):"object"==typeof t?this.list.find((function(e){return rt(t,e)})):void 0},t.prototype.toString=function(){return this.list.map((function(t){return t.name})).join(",")},t.store={formatList:[],formatMap:new Map,fnList:[]},t}(),ot=function(t){function r(e,n){var r=t.call(this)||this;r._config=Object.assign({extra:{}},g,n);var a=r._config,o=a.isUTC,i=a.offset,u=O(e,o);0!==i&&u.setMinutes(u.getMinutes()+i);var c=-1*O(e).getTimezoneOffset();return r._config.extra.localTimezoneOffset=c,r._date=u,r._offset=i,r}return e(r,t),Object.defineProperty(r.prototype,"lunisolar",{get:function(){return gt},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"year",{get:function(){return L(this._date,"FullYear",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"month",{get:function(){return L(this._date,"Month",this.isUTC())+1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"day",{get:function(){return L(this._date,"Date",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dayOfWeek",{get:function(){return L(this._date,"Day",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hour",{get:function(){return L(this._date,"Hours",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"minute",{get:function(){return L(this._date,"Minutes",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"second",{get:function(){return L(this._date,"Seconds",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"millis",{get:function(){return L(this._date,"Milliseconds",this.isUTC())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lunar",{get:function(){return new B(this._date,{lang:this._config.lang,isUTC:this.isUTC()})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"char8",{get:function(){var t={lang:this._config.lang,changeAgeTerm:this._config.changeAgeTerm,isUTC:this.isUTC(),offset:this._offset};return new $(this._date,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"markers",{get:function(){return new at(this)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"solarTerm",{get:function(){var t=this.year;if(t<p||t>v)throw new Error("".concat(t," is not in the allowed time range."));var e=this.month,n=this.day,r=F.getMonthTerms(t,e),a=r[0],o=r[1],i={lang:this._config.lang};return n===a?new F(2*(e-1),i):n===o?new F(2*(e-1)+1,i):null},enumerable:!1,configurable:!0}),r.prototype.recentSolarTerm=function(t){return F.findNode(this._date,{lang:this._config.lang,nodeFlag:t,returnValue:!1})},r.prototype.getMonthBuilder=function(t){void 0===t&&(t=0);var e={lang:this.getConfig("lang")},n=this.recentSolarTerm(t),r=n[0],a=n[1],o=j(this.toDate(),r.value,a);return[new V(o,void 0,e),r,a]},r.prototype.getSeasonIndex=function(){var t=this.recentSolarTerm(0)[0].value;return 2<=t&&t<8?0:8<=t&&t<14?1:14<=t&&t<20?2:3},r.prototype.getSeason=function(t){void 0===t&&(t=!1);var e=this.getSeasonIndex(),n=this.getLocale();return t&&n.seasonShortName?n.seasonShortName[e]:n.seasonName[e]},r.prototype.getLocale=function(t){return g.locales[null!=t?t:this._config.lang]},r.prototype.L=function(t){return function(t,e){for(var n=e.split("."),r=t,a=e,o=function(t){return("string"==typeof t||"number"==typeof t||"function"==typeof t)&&(a=t,!0)};n.length>=0&&!o(r)&&0!==n.length;){var i=n.shift();if(void 0===i)return"";if(Array.isArray(r)){var u=Number(i);if(isNaN(u)||u>=r.length)return"";r=r[u],a=r}else{if(!r.hasOwnProperty(i))return n[n.length-1]||i;r=r[i]}}return a}(this.getLocale(),t)},r.prototype.getConfig=function(t){return void 0===t?this._config:(this._config[t],this._config[t])},r.prototype.toDate=function(){return new Date(this.valueOf())},r.prototype.clone=function(){return new r(this.valueOf(),this._config)},r.prototype.unix=function(){return Math.floor(this.valueOf()/1e3)},r.prototype.valueOf=function(){return this._date.valueOf()-60*this._offset*1e3},r.prototype.local=function(){var t=Object.assign({},this._config,{isUTC:!1,offset:0});return new r(this.toDate(),t)},r.prototype.utc=function(){return this.utcOffset(-this._offset)},r.prototype.isUTC=function(){return this._config.isUTC},r.prototype.utcOffset=function(t){if(void 0===t)return this.isUTC()?this._offset:(e=this._date,15*-Math.round(e.getTimezoneOffset()/15));var e,n=Object.assign({},this._config,{isUTC:!0,offset:Math.abs(t)<=16?60*t:t});return new r(this._date,n)},r.prototype.toISOString=function(){return this._date.toISOString()},r.prototype.toUTCString=function(){return this._date.toUTCString()},r.prototype.toString=function(){return this._date.toUTCString()+" (".concat(this.lunar,")")+" utcOffset: ".concat(this.utcOffset())},r.prototype.format=function(t){return k(t,this)},r.prototype.diff=function(t,e,n){return void 0===n&&(n=!1),e=e?M(e):"millisecond",o.has(e)?function(t,e,n,r){var o=[t.lunar,e.lunar],i=o[1],u=[o[0].year,i.year],c=u[0],s=u[1],l=e.valueOf()-t.valueOf();if((n=M(n))===a.ly){var f=s-c;return r?f-1+H(t,!0)+H(e,!1):f}return n===a.lM?A(t,e,r):(n===a.ld?l/=864e5:n===a.lh&&(l/=72e5),r?l:Math.ceil(l))}(this,t instanceof r?t:new r(t,this._config),e,n):function(t,e,n,r){var o;t=(o=[O(t),O(e)])[0];var i=(e=o[1]).valueOf()-t.valueOf();n=n?M(n):"millisecond";var u=i;return a.s===n?u=i/1e3:a.m===n?u=i/6e4:a.h===n?u=i/36e5:a.d===n?u=i/864e5:a.w===n?u=i/6048e5:a.M===n?u=C(t,e):a.y===n?u=C(t,e)/12:a.q===n&&(u=C(t,e)/3),r?u:parseInt(String(u))}(this._date,t,e,n)},r.prototype.add=function(t,e){var n=function(t,e,n){var r=(t=O(t)).getFullYear(),o=t.getMonth()+1,i=e;if((n=n?M(n):"millisecond")===a.d||n===a.ld)i=24*e*60*60*1e3;else if(n===a.h)i=60*e*60*1e3;else if(n===a.m)i=60*e*1e3;else if(n===a.s)i=1e3*e;else{if(n===a.M)return new Date(t.setMonth(o-1+e));if(n===a.y)return new Date(t.setFullYear(r+e))}return new Date(t.valueOf()+i)}(this.toDate(),t,e);return new r(n,this.getConfig())},n([z("lunisolar:lunar")],r.prototype,"lunar",null),n([z("lunisolar:char8")],r.prototype,"char8",null),n([z("lunisolar:markers")],r.prototype,"markers",null),n([z("lunisolar:solarTerm")],r.prototype,"solarTerm",null),n([z("lunisolar:recentSolarTerm",!0)],r.prototype,"recentSolarTerm",null),n([z("lunisolar:getMonthBuilder",!0)],r.prototype,"getMonthBuilder",null),r}(Z),it=[5,7,11,13,-1,-2,17,19,23,1],ut=[4,6,0,7],ct=[1,1,8,8,8,3,3,3,4,4,4,9,9,9,2,2,2,7,7,7,6,6,6,1],st=new Map,lt=function(t){void 0===t&&(t="zh");var e="direction24List:".concat(t);if(st.has(e))return st.get(e);var n={lang:t},r=[G.create(0,n),R.create(9,n),G.create(1,n),E.create(4,n),G.create(2,n),R.create(0,n),G.create(3,n),R.create(1,n),G.create(4,n),E.create(6,n),G.create(5,n),R.create(2,n),G.create(6,n),R.create(3,n),G.create(7,n),E.create(0,n),G.create(8,n),R.create(6,n),G.create(9,n),R.create(7,n),G.create(10,n),E.create(7,n),G.create(11,n),R.create(8,n)];return st.set(e,r),r};function ft(t){if("number"==typeof t)return t;var e=t.constructor.name,n=t.value;if("Stem"===e)t=it[n];else if("Branch"===e)t=2*n;else{if("Trigram8"!==e)throw new Error("Invalid direction24 value");var r=ut.indexOf(n);if(-1===r)throw new Error("Invalid direction24 value");t=3*(2*r+1)}return t}var ht=function(){function t(t,e){this._config={lang:g.lang};var n=ft(t);this.value=n;var r=(null==e?void 0:e.lang)||g.lang,a=lt(r);this._sign=-1===n?R.create(4,e):-1===n?R.create(5,e):a[n%24]}return t.create=function(e,n){var r=ft(e),a=(null==n?void 0:n.lang)||"zh",o="".concat(r,":").concat(a);if(t.instances.has(o))return t.instances.get(o);var i=new t(r,n);return t.instances.set(o,i),i},t.createFromAngle=function(e,n){var r=Math.round(e%360/15);return t.create(r,n)},t.getNames=function(t){return t=t||g.lang,lt(t).map((function(t){return t.name}))},Object.defineProperty(t.prototype,"sign",{get:function(){return this._sign},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._sign.toString()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._sign.constructor.name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this.value>0?15*this.value:NaN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return g.locales[this._config.lang].directions[this.directionIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"directionIndex",{get:function(){return this.value<0?5:ct[this.value]},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this._sign.toString()},t.prototype.valueOf=function(){return this.value},t.instances=new Map,t}();function gt(t,e){return new ot(t,e)}return gt.utc=function(t,e){return new ot(t,Object.assign({},e,{isUTC:!0}))},gt.Lunar=B,gt.SolarTerm=F,gt.Char8=$,gt.SB=V,gt.Stem=R,gt.Branch=G,gt.Element5=I,gt.Lunisolar=ot,gt.Trigram8=E,gt.Direction24=ht,gt.fromLunar=function(t,e){var n=D(t,null==e?void 0:e.lang);return new ot(n,e)},gt.config=function(t){return t?(Object.assign(g,t),gt):gt},gt.extend=function(t,e){return t.$once||(t(e,ot,gt),t.$once=!0),gt},gt.locale=function(t,e){if(void 0===e&&(e=!1),Array.isArray(t)){for(var n=0,r=t;n<r.length;n++){var a=r[n];gt.locale(a,e)}return gt}return t&&t.name?(g.locales[t.name]=Object.assign({},g.locales[t.name],h,t),e||(g.lang=t.name),e&&"zh"!==g.lang&&(g.locales[g.lang]=Object.assign({},g.locales.zh,g.locales[g.lang])),gt):gt},gt.getLocale=function(t){return g.locales[t]},gt.defineLocale=function(t){return t},gt.Markers=at,gt._globalConfig=g,Object.defineProperty(gt,"_globalConfig",{writable:!1}),gt}));