Socket
Socket
Sign inDemoInstall

temporal-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

temporal-polyfill - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/calendarImpl/bugs.ts

2

dist/global.js

@@ -1,2 +0,2 @@

function n(n,e,t){const o=function(n,e,t){return(r,o)=>{if(void 0===r){const e=o??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[r])throw new RangeError(`Invalid ${n}: ${r}`);return e[r]}}(n,e,t);return(e,t)=>{const i=r(e);return o(i[n],t)}}function e(n,e,t,r){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const o=Math.min(Math.max(n,e),t);if(o!==n&&r===c)throw new RangeError("Invalid overflowed value "+n);return o}function t(n,e){const t={};let r=0;for(const o in e)void 0!==n[o]&&(t[o]=e[o](n[o]),r++);if(!r)throw new TypeError("Invalid object, no keys");return t}function r(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var o=/object|function/;function i(n){return null!==n&&o.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,l(e,(n=>({get:n}))))}function l(n,e){const t={};for(const r in n)t[r]=e(n[r],r);return t}function f(n,e){const t={};return n.forEach(((n,r)=>{t[n]=e(n,r)})),t}function m(n,e,...t){return e instanceof n?e:n.from(e,...t)}var g=class{toJSON(){return this.toString()}},y=class extends g{valueOf(){throw new Error("Cannot convert object using valueOf")}},[p,w]=d(),v=class extends y{constructor(n){super(),w(this,Object.freeze(n))}getISOFields(){return p(this)}},M=1000n,I=1000000n,S=1000000000n,T=60000000000n,D=3600000000000n,F=86400000000000n,O=[1,1e3,1e6,1e9,6e10,36e11,864e11],N=[9,6,3];function Y(n){return n<=6}function b(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),E=["nanosecond","microsecond","millisecond","second","minute","hour"],C=[...E,"day","week","month","year"],P=C.map((n=>n+"s")),U=f(C,((n,e)=>e)),B=f(P,((n,e)=>e));function R(n,e,t,r){let o;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");o=e}else if(o=U[n]??B[n],void 0===o||o<t||o>r)throw new RangeError("Invalid unit "+n);return o}function x(n,e,t,o,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=r(n),u=c.roundingIncrement??1,d=R(c.smallestUnit,e,t,o);if(!s&&a){if(d<6&&864e11%u*O[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?O[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*O[d]>=O[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function k(n,e,t,o,i,s,a){const c=x(n,t,o,i,!a,s);e=Math.max(e,c.smallestUnit);let u=r(n).largestUnit;"auto"===u&&(u=void 0);const d=R(u,e,o,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function j(n,e){return n<e?-1:n>e?1:0}function L(n){return j(n,0)}function H(n,e,t){const r=BigInt(e),o=n/r*r,i=Number(n-o);return o+BigInt(t(i/e))*r}function $(n,e){return(n%e+e)%e}function A(n){return W(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function q(n){return Math.floor(z(n)/1e3)}function z(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function W(n,e,t,r,o,i,s,a,c){return BigInt(G(n,e,t,r,o,i,s))*I+BigInt(a??0)*M+BigInt(c??0)}function G(n,e,t,r,o,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,l,f=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;f<31;f++){h=u-d*f;const n=Date.UTC(g,c-1,h,r??0,o??0,i??0,s??0);if(!rn(n)){l=n+d*f*864e5;break}}return(void 0===l||h<1||h>hn.daysInMonth(a,c))&&on(),m&&(l=new Date(l).setUTCFullYear(a)),l}function J(n){let e=n/I,t=Number(n-e*I);t<0&&(t+=1e6,e-=1n);const r=Math.floor(t/1e3);return t-=1e3*r,{...K(Number(e)),isoMicrosecond:r,isoNanosecond:t}}function K(n){const[e,t]=tn(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function Q(n){return tn(1e3*n)[0].getUTCFullYear()}function V(n){return Math.floor(G(n)/1e3)}function X(n,e){return Math.round((e-n)/864e5)}function _(n,e){return n+864e5*e}function nn(n,e,t){const[r,o]=tn(G(n,e,t));return $(r.getUTCDay()+o,7)||7}function en(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&on()}function tn(n){const e=L(n);let t,r=0;for(;r<31;r++){const o=new Date(n-e*r*864e5);if(!rn(o)){t=o;break}}return void 0===t&&on(),[t,e*r]}function rn(n){return isNaN(n.valueOf())}function on(){throw new RangeError("Date outside of supported range")}function sn(n,e){return String(n).padStart(e,"0")}function an(n){return n<0?"-":"+"}var cn={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{"before-roc":-1,minguo:0},buddhist:{be:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},un=class{constructor(n){this.id=n}era(n,e,t){}eraYear(n,e,t){}monthCode(n,e){return"M"+sn(n,2)}convertMonthCode(n,e){return parseInt(n.substr(1))}convertEraYear(n,e,t){let r=cn[this.id]?.[e];if(void 0===r){if(t)throw new Error("Unkown era "+e);r=0}return(r+n)*(L(r)||1)}},dn=class extends un{year(n){return n}month(n,e){return e}day(n,e,t){return t}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},hn=new dn("iso8601"),ln=class extends dn{era(n,e,t){return n<1?"bce":"ce"}eraYear(n,e,t){return n<1?-(n-1):n}},fn=n("calendarName",{auto:0,never:1,always:2},0),mn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},gn={...mn,day:Number},yn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},pn={...gn,...yn},wn={...pn,offset:String},vn=f(P,(()=>Number)),Mn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function In(n,t=4){const o=r(n),i=o.smallestUnit,s=o.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=R(i,void 0,0,t),d=O[u],a=N[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Sn=n("timeZoneName",{auto:0,never:1},0);function Tn(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/M},epochMilliseconds(){return Number(this.epochNanoseconds/I)},epochSeconds(){return Number(this.epochNanoseconds/S)}})}var Dn,Fn={calendar:"calendar"};for(const n of C)Fn[n]="iso"+((Dn=n).charAt(0).toUpperCase()+Dn.slice(1));function On(n,e=[]){h(n,f(e.concat("calendar"),(n=>function(){return this.getISOFields()[Fn[n]]})))}var Nn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],Yn=[...Nn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function bn(n,e){h(n,f(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var Zn=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0);var En=class{constructor(n){this.id=n}},Cn=class extends En{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function Pn(n,e){const t={},r=n.formatToParts(e);for(const n of r)t[n.type]=n.value;return t}var Un={bc:"bce",ad:"ce"};function Bn(n){return n=n.toLowerCase().replace(/[^a-z0-9]g/,"").replace(/ /g,"-"),Un[n]||n}var Rn=n("offset",{auto:0,never:1},0),PlainMonthDay=class extends v{constructor(n,e,t=cr(),r){super({...Ht({isoYear:r??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return kn(n.getISOFields());if("object"==typeof n){const r=ur(n);let o=t(n,xn);return void 0===o.year&&void 0===n.calendar&&(o={...o,year:1972}),r.monthDayFromFields(o,e)}const r=function(n){const e=Ye.exec(Ge(n));if(e)return{...Le(e),calendar:e[6]?new Calendar2(e[6]):cr()}}(o=String(n))||xe(o)||Ke("monthDay",o);var o;return void 0===r.calendar&&(r.isoYear=1972),kn(Ce(r))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,xn),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=m(PlainMonthDay,n),e.calendar.id===t.calendar.id&&A(e.getISOFields())===A(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,r=fn(n);return("iso8601"===t?function(n){return sn(n.isoMonth,2)+"-"+sn(n.isoDay,2)}(e):ht(e))+gt(t,r)}toLocaleString(n,e){return le(this,n,{month:"numeric",day:"numeric",...e,weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};On(PlainMonthDay),bn(PlainMonthDay,["monthCode","day"]);var xn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function kn(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}var jn={day:1},PlainYearMonth=class extends v{constructor(n,e,t=cr(),r=1){const o=Ht({isoYear:n,isoMonth:e,isoDay:r},c);A(o),super({...o,calendar:m(Calendar2,t)})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return Hn(n.getISOFields());if("object"==typeof n){const r=t(n,mn);return ur(n).yearMonthFromFields(r,e)}const r=Ue(String(n));return void 0===r.calendar&&(r.isoDay=1),Hn(Ce(r))}static compare(n,e){return An(m(PlainYearMonth,n),m(PlainYearMonth,e))}with(n,e){const t=a(n,mn);return this.calendar.yearMonthFromFields($n(t,this),e)}add(n,e){return Ln(this,m(Duration,n),e)}subtract(n,e){return Ln(this,m(Duration,n).negated(),e)}until(n,e){return qt(this.toPlainDate(jn),m(PlainYearMonth,n).toPlainDate(jn),k(e,9,8,8,9))}since(n,e){return qt(this.toPlainDate(jn),m(PlainYearMonth,n).toPlainDate(jn),k(e,9,8,8,9),!0)}equals(n){return 0===An(this,m(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,r=fn(n);return("iso8601"===t?lt(e):ht(e))+gt(t,r)}toLocaleString(n,e){return le(this,n,{year:"numeric",month:"numeric",...e,weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function Ln(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function Hn(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function $n(n,e){const t={};let r=!1,o=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,r=!0),void 0!==n.year&&(t.year=n.year,r=!0),r||(t.year=e.year),void 0!==n.month&&(t.month=n.month,o=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,o=!0),o||(t.month=e.month),t}function An(n,e){return j(A(n.getISOFields()),A(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}On(PlainYearMonth),bn(PlainYearMonth,Nn);var[qn,zn]=d(),ZonedDateTime=class extends v{constructor(n,e,t=cr()){const r=m(TimeZone,e),o=m(Calendar2,t),i=new Instant(n),s=r.getOffsetNanosecondsFor(i);super({...J(n+BigInt(s)),calendar:o,timeZone:r,offset:r.getOffsetStringFor(i)}),zn(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const r=Mn(e,3),o=u(e);return _n(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?ne(t(n,wn),e,o,ur(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return m(TimeZone,n.timeZone)}(n)):Pe(Ue(String(n))),e,r)}static compare(n,e){return j(m(ZonedDateTime,n).epochNanoseconds,m(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return qn(this).epochNanoseconds}get offsetNanoseconds(){return qn(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,wn),r={...gr(o=t,i=this),offset:o.offset??i.offset};var o,i;const s=Mn(e,0),c=u(e);return Zn(e),_n(ne(r,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=m(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:r}=this,o=r.getInstantFor(t);return new ZonedDateTime(o.epochNanoseconds,r,hr(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return ee(this,m(Duration,n),e)}subtract(n,e){return ee(this,m(Duration,n).negated(),e)}until(n,e){return te(this,m(ZonedDateTime,n),e)}since(n,e){return te(this,m(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const r=ot(n);return{day:t(Number(r)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,ae(n),t.roundingMode);return fr(Xn(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return ce(n,Vn(t),t.roundingMode)}(this,n)}equals(n){const e=m(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return _n({...this.getISOFields(),...se,offset:void 0},void 0,3)}get hoursInDay(){return ae(this)/36e11}toString(n){const e=In(n),t=Rn(n),r=Sn(n),o=fn(n),i=ce(this,e.roundingIncrement,e.roundingMode).getISOFields();return dt(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,r)+gt(i.calendar.id,o)}toLocaleString(n,e){return function(n,e,t){const r=n.getISOFields(),o=r.calendar.id,i=r.timeZone.id,{timeZone:s}=t;if(void 0!==s&&s!==i)throw new RangeError("Given timeZone must agree");return fe(n.epochMilliseconds,o,e,{timeZone:i,timeZoneName:"short",...t})}(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toPlainYearMonth(){return Hn(this.getISOFields())}toPlainMonthDay(){return kn(this.getISOFields())}toPlainDateTime(){return fr(this.getISOFields())}toPlainDate(){return kt(this.getISOFields())}toPlainTime(){return Qe(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Wn(n,e,t,r){const o=P[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=P[t];s[e]=n[e]}const a={[o]:i},c=t.add(s),u=c.add(a),d=Gn(c),h=Gn(u),l=Gn(r),f=Number(l-d)/Number(h-d)*i;return s[o]+=f,s}function Gn(n){const{epochNanoseconds:e}=n;return void 0!==e?e:A(n.getISOFields())}function Jn(n,e,t,r,o){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!b(i))return Ot(Qn((ie(r)-ie(t))*(o?-1n:1n),e),i);let u=Wn(n,s,t,r);const d=P[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),o&&(u=Pt(u)),c!==Math.round&&h();let l=Mt(u);return s>0&&(l=o?Tt(l.negated(),i,t).negated():Tt(l,i,t)),l}function Kn(n,e,t){return it(H(ot(n),e,t))}function Qn(n,e){return H(n,Vn(e),e.roundingMode)}function Vn(n){return O[n.smallestUnit]*n.roundingIncrement}function Xn(n,e){return{...xt(n,e.day),...st(e)}}function _n(n,e,t){const{calendar:r,timeZone:o,offset:i,Z:s}=n;let a;if(void 0!==i&&2!==t&&(a=A(n)-BigInt(i),1!==t&&!s)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(a,o.getPossibleInstantsFor(fr(n)))){if(3===t)throw new RangeError("Mismatching offset/timezone");a=void 0}}return void 0===a&&(a=o.getInstantFor(fr(n),e).epochNanoseconds),new ZonedDateTime(a,o,r)}function ne(n,e,t,r,o){return{...mr(n,e,t,r),timeZone:o,offset:n.offset?(i=n.offset,ke(i)??Ke("timeZone",i)):void 0};var i}function ee(n,e,t){const{calendar:r,timeZone:o}=n,i=bt(e),s=Zt(e),a=r.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:o}),c=ot(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,o,r)}function te(n,e,t,r){const o=k(t,5,0,0,9),{largestUnit:i}=o;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return Jn(re(n,e,i),o,n,e,r)}function re(n,e,t){const r=dr(n,e);if(!b(t))return oe(n,e,t);const o=kt(n.getISOFields());let i,s,a,c,u,d=kt(e.getISOFields());do{s=r.dateUntil(o,d,{largestUnit:C[t]}),i=n.add(s),a=oe(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return St(s,a)}function oe(n,e,t){return Ot(ie(e)-ie(n),t)}function ie(n){return n instanceof PlainDateTime?A(n.getISOFields()):n.epochNanoseconds}On(ZonedDateTime,E),bn(ZonedDateTime,Yn),Tn(ZonedDateTime);var se={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function ae(n){const e={...n.getISOFields(),...se,offset:void 0},t=_n(e,void 0,3),r=_n({...e,...xt(e,1)},void 0,3);return Number(r.epochNanoseconds-t.epochNanoseconds)}function ce(n,e,t){return _n({...Mr(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}var ue=Intl.DateTimeFormat;function de(n){return void 0===n?n:he(n)}function he(n){return"number"==typeof n||n instanceof Date?n:n instanceof Instant||n instanceof ZonedDateTime?n.epochMilliseconds:z(n.getISOFields())}function le(n,e,t,r){const o=n.getISOFields(),i=o.calendar.id;let s,{timeZone:a}=t;if(void 0!==a){const e=new TimeZone(a),t=fr({...se,...n.getISOFields()});s=e.getInstantFor(t).epochMilliseconds}else s=z(o),a="UTC";return fe(s,i,e,{...t,timeZone:a,timeZoneName:void 0},r)}function fe(n,e,t,r,o){const i=new ue(t,{calendar:me(t)?void 0:e,...r});if((o||"iso8601"!==e)&&e!==i.resolvedOptions().calendar)throw new RangeError("Non-iso calendar mismatch");return i.format(n)}function me(n){const e=[].concat(n||[]);for(const n of e)if(-1!==n.indexOf("-u-ca-"))return!0;return!1}var ge={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},ye=[182,91,273],pe=class extends En{constructor(n){const e=new ue("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=ge[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const r of e){const[e,o,i]=r,s=n-o,a=n-i;if(e>s&&e>a)return[o];if(!(e<=s&&e<=a))return[o,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(Q(n))]}getOffset(n){const e=Pn(this.format,1e3*n);let t=parseInt(e.year);"bce"===Bn(e.era)&&(t=-(t-1));const r=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(r/1e3)-n}getTransition(n,e){const t=Q(n);for(let r=0;r<5;r++){const o=t+r*e,i=this.getTransitionsInYear(o),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const r=i[a+t*e];if(j(r[0],n)===e)return r}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(V(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),r=V(n)-1,o=V(n+1)-1;if(e!==t)return[this.searchTransition(r,o,e,t)];const i=this.searchIsland(e,r);return void 0!==i?[this.searchTransition(r,i[0],e,i[1]),this.searchTransition(i[0],o,i[1],t)]:[]}searchTransition(n,e,t,r){for(;e-n>1;){const r=Math.floor(n+(e-n)/2);this.getOffset(r)===t?n=r:e=r}return[e,t,r]}searchIsland(n,e){for(const t of ye){const r=e+86400*t,o=this.getOffset(r);if(o!==n)return[r,o]}}},we={UTC:new Cn("UTC",0)};var[ve,Me]=d(),TimeZone=class extends g{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),Me(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(we[e])return we[e];const t=ke(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new Cn(mt(t),Math.trunc(t/1e9))}return we[e]=new pe(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=xe(String(n));return new TimeZone(e&&(e.timeZone||e.Z&&"UTC"||void 0!==e.offset&&mt(e.offset))||n)}get id(){return ve(this).id}getOffsetStringFor(n){return mt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=m(Instant,n);return 1e9*ve(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=cr()){const t=m(Instant,n);return fr({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:m(Calendar2,e)})}getInstantFor(n,e){const t=Zn(e),r=m(PlainDateTime,n).getISOFields(),o=q(r),i=ve(this).getPossibleOffsets(o);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return Ie(o-s,r)}getPossibleInstantsFor(n){const e=m(PlainDateTime,n).getISOFields(),t=q(e);let r=ve(this).getPossibleOffsets(t);return 2===r.length&&r[0]<r[1]&&(r=[]),r.map((n=>Ie(t-n,e)))}getPreviousTransition(n){const e=m(Instant,n),t=ve(this).getTransition(e.epochSeconds,-1);return t?Ie(t[0]):null}getNextTransition(n){const e=m(Instant,n),t=ve(this).getTransition(e.epochSeconds,1);return t?Ie(t[0]):null}toString(){return this.id}};function Ie(n,e){return new Instant(BigInt(n)*S+(e?BigInt(e.isoMillisecond)*I+BigInt(e.isoMicrosecond)*M+BigInt(e.isoNanosecond):0n))}var Se="(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?",Te=`([+-])${Se}`,De=`(Z|${Te})?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?`,Fe=Je(Te),Oe=Je(Se+De),Ne=Je(`([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?([T ]${Se})?`+De),Ye=Je("(--)?(\\d{2})-?(\\d{2})?"+De),be=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Ze=/Z/i,Ee=/\u2212/g;function Ce(n){return{...n,calendar:void 0===n.calendar?cr():new Calendar2(n.calendar)}}function Pe(n){return{...Ce(n),timeZone:new TimeZone(n.timeZone)}}function Ue(n){return xe(n)||Ke("dateTime",n)}function Be(n){return function(n){const e=Oe.exec(n);if(e&&e[1])return He(e.slice(1))}(n)||xe(n)||Ke("time",n)}function Re(n){return function(n){const e=be.exec(Ge(n));if(e){let n,t,r,o;[n,o]=je(e[8],e[10],5,void 0),[t,o]=je(e[12],e[14],4,o),[r,o]=je(e[16],e[18],3,o);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:We(e[2]),months:We(e[3]),weeks:We(e[4]),days:We(e[5]),hours:n,minutes:t,seconds:r});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=ct(BigInt(o||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=Pt(i)),i}}(n)||Ke("duration",n)}function xe(n){const e=Ne.exec(Ge(n));if(e){const n=Ze.test(e[10]);return{...(t=e.slice(1),{isoYear:ze(t[0]),isoMonth:ze(t[1]),isoDay:ze(t[2])}),...He(e.slice(5)),Z:n,offset:n?0:$e(e.slice(11)),timeZone:e[18],calendar:e[20]}}var t}function ke(n){const e=Fe.exec(Ge(n));if(e)return $e(e.slice(1))}function je(n,e,t,r){if(void 0!==n){if(void 0!==r)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?Ae(e)*(O[t]/1e9):void 0]}if(void 0!==r){const n=Math.trunc(r/O[t]);return[n,r-n*O[t]]}return[void 0,void 0]}function Le(n){return{isoYear:1972,isoMonth:ze(n[2]),isoDay:ze(n[3])}}function He(n){const e=qe(n[2]);return{...st(ct(BigInt(Ae(n[4]||"")),2)),isoHour:qe(n[0]),isoMinute:qe(n[1]),isoSecond:60===e?59:e}}function $e(n){const e=n[0];if(void 0!==e&&n[1])return("+"===e?1:-1)*function(n){return 36e11*qe(n[0])+6e10*qe(n[1])+1e9*qe(n[2])+Ae(n[4]||"")}(n.slice(1))}function Ae(n){return parseInt(n.padEnd(9,"0"))}function qe(n){return parseInt(n||"0")}function ze(n){return parseInt(n||"1")}function We(n){return void 0===n?void 0:parseInt(n)}function Ge(n){return n.replace(Ee,"-")}function Je(n){return new RegExp(`^${n}$`,"i")}function Ke(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}var PlainTime=class extends v{constructor(n=0,e=0,t=0,r=0,o=0,i=0){super({...Ve({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:r,isoMicrosecond:o,isoNanosecond:i},c),calendar:cr()})}static from(n,e){const r=u(e);return Qe(n instanceof PlainTime?n.getISOFields():"object"==typeof n?et(t(n,yn),r):Be(String(n)))}static compare(n,e){return rt(m(PlainTime,n),m(PlainTime,e))}with(n,e){return Qe(et(Xe(a(n,yn),this),u(e)))}add(n){return _e(this,m(Duration,n))}subtract(n){return _e(this,m(Duration,n).negated())}until(n,e){return nt(this,m(PlainTime,n),e)}since(n,e){return nt(m(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return Qe(st(Kn(n,Vn(t),t.roundingMode)))}(this,n)}equals(n){return 0===rt(this,m(PlainTime,n))}toString(n){const e=In(n);return ft(st(Kn(this,e.roundingIncrement,e.roundingMode)),e)}toLocaleString(n,e){return new ue(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}).format(Number(ot(this)/I))}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return m(PlainDate,n).toPlainDateTime(this)}};function Qe(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function Ve({isoHour:n,isoMinute:t,isoSecond:r,isoMillisecond:o,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:r=e(r,0,59,a),isoMillisecond:o=e(o,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function Xe(n,e){return l(yn,((t,r)=>n[r]??e[r]))}function _e(n,e){var t,r;return Qe(st((t=n,r=Zt(e),it(ot(t)+ot(r)))))}function nt(n,e,t){const r=k(t,5,0,0,5);return Ot(Qn(ot(e)-ot(n),r),r.largestUnit)}function et(n,e){return Ve(st(n),e)}function tt(n){return m(PlainTime,n??{hour:0})}function rt(n,e){return j(ot(n),ot(e))}function ot(n){return BigInt(n.hour)*D+BigInt(n.minute)*T+BigInt(n.second)*S+BigInt(n.millisecond)*I+BigInt(n.microsecond)*M+BigInt(n.nanosecond)}function it(n){const[e,t]=ut(n);return{...ct(t,5),day:Number(e/F)}}function st(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function at(n){return BigInt(n.day)*F+ot(n)}function ct(n,e){const t={};for(let r=e;r>=0;r--){const e=BigInt(O[r]),o=n/e;n-=o*e,t[C[r]]=Number(o)}return t}function ut(n){const e=J(n);return[W(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*D+BigInt(t.isoMinute)*T+BigInt(t.isoSecond)*S+BigInt(t.isoMillisecond)*I+BigInt(t.isoMicrosecond)*M+BigInt(t.isoNanosecond))];var t}function dt(n,e){return ht(n)+"T"+ft(n,e)}function ht(n){return lt(n)+"-"+sn(n.isoDay,2)}function lt(n){const{isoYear:e}=n;return(e<1e3||e>9999?an(e)+sn(Math.abs(e),6):sn(e,4))+"-"+sn(n.isoMonth,2)}function ft(n,e){const t=[sn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(sn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(sn(n.isoSecond,2)+pt(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function mt(n){const e=ct(BigInt(Math.abs(n)),5),t=pt(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return an(n)+sn(e.hour,2)+":"+sn(e.minute,2)+(e.second||t?":"+sn(e.second,2)+t:"")}function gt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function yt(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function pt(n,e,t,r,o,i){let s=BigInt(t)+BigInt(e)*M+BigInt(n)*I;o&&(s=H(s,void 0===r?O[i]:Math.pow(10,9-r),o));const a=s<0?-s:s,c=a/S;let u=sn(Number(a-c*S),9);return u=void 0===r?u.replace(/0+$/,""):u.substr(0,r),[u?"."+u:"",Number(c)*(s<0?-1:1)]}On(PlainTime,E);var[wt,vt]=d(),Duration=class extends y{constructor(n=0,e=0,t=0,r=0,o=0,i=0,s=0,a=0,c=0,u=0){super(),vt(this,function(n){const e={};let t=0;for(const r of P){const o=Number(n[r]||0),i=L(n[r]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(o))throw new RangeError("Duration fields must be integers");e[r]=o}return e.sign=t,e}({years:n,months:e,weeks:t,days:r,hours:o,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Mt("object"==typeof n?t(n,vn):Re(n))}static compare(n,e,t){return function(n,e,t){const r=m(Duration,n),o=m(Duration,e),i=Yt(r),s=Yt(o);if(void 0===t&&i&&s)return j(at(i),at(s));const a=Et(t),c=a.add(r),u=a.add(o);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,r(t).relativeTo)}get years(){return wt(this).years}get months(){return wt(this).months}get weeks(){return wt(this).weeks}get days(){return wt(this).days}get hours(){return wt(this).hours}get minutes(){return wt(this).minutes}get seconds(){return wt(this).seconds}get milliseconds(){return wt(this).milliseconds}get microseconds(){return wt(this).microseconds}get nanoseconds(){return wt(this).nanoseconds}get sign(){return wt(this).sign}get blank(){return!this.sign}with(n){return Mt({...wt(this),...a(n,vn)})}negated(){return Mt(Pt(wt(this)))}abs(){return Mt(l(wt(this),(n=>Math.abs(n))))}add(n,e){return It(this,m(Duration,n),r(e).relativeTo)}subtract(n,e){return It(this,m(Duration,n).negated(),r(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=Ft(n),r=k(e,t,0,0,9,!1,!0),{largestUnit:o,smallestUnit:s}=r,a=Yt(n);if(void 0===e.relativeTo&&a&&Y(o)&&Y(s)){return Nt(ct(Qn(at(a),r),o))}const c=Ct(e.relativeTo),u=Dt(n,o,c);return Jn(u,r,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const r=Yt(n);if(void 0===t&&r&&Y(e))return Number(at(r))/O[e];const o=Ct(t),i=Dt(n,e,o,!0);return Wn(i,e,o,o.add(i))[P[e]]}(this,R(r(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=In(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:r,roundingMode:o}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=pt(n.milliseconds,n.microseconds,n.nanoseconds,r,o,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+yt([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+yt([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(wt(this),e)}toLocaleString(n,e){return this.toString()}};function Mt(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function It(n,e,t){const r=Yt(n),o=Yt(e),i=Math.max(Ft(n),Ft(e));if(void 0===t&&r&&o)return Ot(at(r)+at(o),i);const s=Et(t),a=s.add(n).add(e);return re(s,a,i)}function St(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Tt(n,e,t){return t instanceof PlainDate?function(n,e,t){const r=t.add(n);return t.calendar.dateUntil(t,r,{largestUnit:C[e]})}(n,Math.max(6,e),t):Dt(n,e,t)}function Dt(n,e,t,r){const o=!0!==r&&e>7&&n.weeks;o&&(n=n.with({weeks:0}));const i=t.add(n);let s=re(t,i,e);return o&&(s=St(s,new Duration(0,0,o))),s}function Ft(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function Ot(n,e){return Nt(ct(n,e))}function Nt(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Yt(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...Zt(n)}}function bt(n){return new Duration(n.years,n.months,n.weeks,n.days)}function Zt(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function Et(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=Ue(String(n));return void 0!==e.timeZone?_n(Pe(e),void 0,0):fr(Ce(e))}}function Ct(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:m(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=xe(String(n));if(e)return void 0!==e.timeZone?_n(Pe(e),void 0,3):fr(Ce(e));throw new RangeError("Invalid value of relativeTo")}function Pt(n){return l(n,(n=>-n||0))}function Ut(n,e,t,r){n=Rt(n=Bt(n,e.years,t,r),e.months,t,r);let o=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=ot(Zt(n)),t=e/F;return[ct(e-t*F,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return o=_(o,7*i.weeks+i.days),K(o)}function Bt({year:n,month:t,day:r},o,i,s){n+=o;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?r:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function Rt({year:n,month:t,day:r},o,i,s){if(o){if(t+=o,o<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}r=e(r,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:r}}function xt(n,e){return e?{...K(_(z(n),e)),calendar:n.calendar}:n}function kt(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function jt(n,e){return{...$n(n,e),day:n.day??e.day}}function Lt(n,t,r,o,i){return[n=Number(n),t=e(t,1,o.monthsInYear(n),i),r=e(r,1,o.daysInMonth(n,t),i)]}function Ht(n,e){const[t,r,o]=Lt(n.isoYear,n.isoMonth,n.isoDay,hn,e);return{isoYear:t,isoMonth:r,isoDay:o}}function $t(n,e){return j(A(n.getISOFields()),A(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function At(n,e){return j(n.year,e.year)||function(n,e){return j(n.month,e.month)||j(n.day,e.day)}(n,e)}function qt(n,e,t,r){return Jn(dr(n,e).dateUntil(n,e,{largestUnit:C[t.largestUnit]}),t,n,e,r)}var PlainDate=class extends v{constructor(n,e,t,r=cr()){const o=Ht({isoYear:n,isoMonth:e,isoDay:t},c);!function(n){const e=A(n);en(e+(e<0n?86399999999999n:0n))}(o),super({...o,calendar:m(Calendar2,r)})}static from(n,e){if(u(e),n instanceof PlainDate)return kt(n.getISOFields());if("object"==typeof n){const r=t(n,gn);return ur(n).dateFromFields(r,e)}return kt(Ce(Ue(String(n))))}static compare(n,e){return $t(m(PlainDate,n),m(PlainDate,e))}with(n,e){const t=jt(a(n,gn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,m(Duration,n).negated(),e)}until(n,e){return qt(this,m(PlainDate,n),k(e,6,6,6,9))}since(n,e){return qt(this,m(PlainDate,n),k(e,6,6,6,9),!0)}equals(n){return 0===$t(this,m(PlainDate,n))}toString(n){const e=fn(n),t=this.getISOFields();return ht(t)+gt(t.calendar.id,e)}toLocaleString(n,e){return le(this,n,{year:"numeric",month:"numeric",day:"numeric",...e,hour:void 0,minute:void 0,second:void 0})}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return fr({...this.getISOFields(),...tt(n).getISOFields()})}toPlainYearMonth(){return Hn(this.getISOFields())}toPlainMonthDay(){return kn(this.getISOFields())}};function zt(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function Wt(n,e,t){let r;if(n instanceof PlainDate)r=n;else if(zt(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");r=kt(n.getISOFields())}else r=PlainDate.from(n);return lr(r.calendar,e),r}function Gt(n,e,t){if(zt(n))return n.getISOFields();let{era:r,eraYear:o,year:i,month:s,monthCode:a,day:c}=n;if(void 0===i){if(void 0===o||void 0===r)throw new TypeError("Must specify either a year or an era & eraYear");i=e.convertEraYear(o,r,!0)}if(void 0!==a){const n=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");s=n}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");if(void 0===c)throw new TypeError("Must specify day");return[i,s,c]=Lt(i,s,c,e,u(t)),K(e.epochMilliseconds(i,s,c))}function Jt(n,e){if(zt(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function Kt(n,e){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function Qt(n,e,t,r){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,r))+1}On(PlainDate),bn(PlainDate,Yn);var Vt=class extends un{constructor(n){const e=Xt(n);if(!function(n,e){const t=n.split("-"),r=e.split("-");return t[0]===r[0]}(n,e.resolvedOptions().calendar))throw new RangeError("Invalid calendar: "+n);super(n),this.format=e,this.yearCorrection=this.computeFields(0).year-1970,this.yearMonthCache={}}era(n,e,t){const r=G(n,e,t);return this.computeFields(r).era}eraYear(n,e,t){const r=G(n,e,t);return this.computeFields(r).eraYear}year(n,e,t){const r=G(n,e,t);return this.computeFields(r).year}month(n,e,t){const r=G(n,e,t);return this.computeFields(r).month}day(n,e,t){const r=G(n,e,t);return this.computeFields(r).day}epochMilliseconds(n,e,t){this.ensureYear(n);return _(this.yearMonthCache[n][e-1],t-1)}daysInMonth(n,e){const{yearMonthCache:t}=this;this.ensureYear(n);const r=t[n],o=r[e-1];e>=r.length&&(n++,e=0);return X(o,t[n][e])}monthsInYear(n){return this.ensureYear(n),this.yearMonthCache[n].length}inLeapYear(n){const e=Kt(this,n);return e>Kt(this,n-1)&&e>Kt(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const r=t+100;for(;t<r;t++){const r=this.convertMonthCode(n,t);if(r<=this.monthsInYear(t)&&e<=this.daysInMonth(t,r))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}ensureYear(n){const{yearMonthCache:e,yearCorrection:t}=this;if(!e[n]||!e[n+1]){let e=G(n-t);e=_(e,400),this.ensureDown(e,n)}}ensureDown(n,e){const{yearMonthCache:t}=this;let r=this.computeFields(n);for(let o=r.year;o>=e;o--){const e=t[o]||(t[o]=[]),i=e.length+1;for(let t=r.month;t>=i;t--)n=_(n,1-r.day),e[t-1]=n,n=_(n,-1),r=this.computeFields(n)}}computeFields(n){const e=Pn(this.format,n);let t,r,o=parseInt(e.relatedYear||e.year);return e.era&&(t=Bn(e.era),r=o,o=this.convertEraYear(r,t)),{era:t,eraYear:r,year:o,month:this.parseMonth(e.month,o),day:parseInt(e.day)}}parseMonth(n,e){return parseInt(n)}};function Xt(n){return new ue("en-US",{calendar:n,era:"short",year:"numeric",month:"numeric",day:"numeric",timeZone:"UTC"})}var _t={Tishri:"M01",Heshvan:"M02",Kislev:"M03",Tevet:"M04",Shevat:"M05","Adar I":"M05L","Adar II":"M06",Adar:"M06",Nisan:"M07",Iyar:"M08",Sivan:"M09",Tamuz:"M10",Av:"M11",Elul:"M12"},nr=G(1868,9,8),er={gregory:ln,hebrew:class extends Vt{parseMonth(n,e){const t=parseInt(n);return isNaN(t)?this.convertMonthCode(_t[n],e):t}monthCode(n,e){const t=this.inLeapYear(e)&&n>5;return super.monthCode(n-Number(t),e)+(t&&6===n?"L":"")}convertMonthCode(n,e){const t=super.convertMonthCode(n,e);return t+(n.match(/L$/)||this.inLeapYear(e)&&t>5?1:0)}inLeapYear(n){const e=this.monthsInYear(n);return e>this.monthsInYear(n-1)&&e>this.monthsInYear(n+1)}},japanese:class extends ln{constructor(){super(...arguments),this.format=Xt("japanese")}era(n,e,t){const r=G(n,e,t);return r<nr?super.era(n,e,t):Bn(Pn(this.format,r).era)}}},tr={iso8601:hn};function rr(n,e,t,r){let o=0,i=0,s=0,a=0;switch(r){case 9:o=function(n,e,t){const[,r,o]=Lt(e.year,n.month,n.day,t,0),i=At(e,n),s=j(e.month,r)||j(e.day,o);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=Bt(n,o,t,0);case 8:i=function(n,e,t){let r=0;const o=At(e,n);if(o){let{year:i}=n;for(;i!==e.year;)r+=t.monthsInYear(i)*o,i+=o;const[,s,a]=Lt(e.year,n.month,n.day,t,0);r+=e.month-s;const c=j(e.day,a);c&&o&&c!==o&&(r-=o)}return r}(n,e,t),n=Rt(n,i,t,0)}return a=X(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===r&&(s=Math.trunc(a/7),a%=7),new Duration(o,i,s,a)}function or(n,e,t){const r=7+e-t;return-$(nn(n,1,r)-e,7)+r-1}function ir(n,e,t){const r=or(n,e,t),o=or(n+1,e,t);return(Kt(hn,n)-r+o)/7}var[sr,ar]=d(),Calendar2=class extends g{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),ar(this,function(n){const e=(n=String(n)).toLocaleLowerCase();return tr[e]||(tr[e]=new(er[e]||Vt)(n))}(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar2(String(n))}(n.calendar):n;const e=xe(String(n));return new Calendar2(e?e.calendar||"iso8601":n)}get id(){return sr(this).id}era(n){const e=Jt(n,!0);return sr(this).era(e.isoYear,e.isoMonth,e.isoDay)}eraYear(n){const e=Jt(n,!0);return sr(this).eraYear(e.isoYear,e.isoMonth,e.isoDay)}year(n){const e=Jt(n,!0);return sr(this).year(e.isoYear,e.isoMonth,e.isoDay)}month(n){const e=Jt(n,!0);return sr(this).month(e.isoYear,e.isoMonth,e.isoDay)}monthCode(n){const e=Wt(n,this);return sr(this).monthCode(e.month,e.year)}day(n){const e=Jt(n);return sr(this).day(e.isoYear,e.isoMonth,e.isoDay)}dayOfWeek(n){const e=Jt(n,!0);return nn(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=Wt(n,this,!0);return Qt(sr(this),e.year,e.month,e.day)}weekOfYear(n){const e=Jt(n,!0);return function(n,e,t,r,o){const i=or(n,r,o),s=Math.floor((Qt(hn,n,e,t)-i-1)/7)+1;if(s<1)return s+ir(n-1,r,o);const a=ir(n,r,o);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return Jt(n,!0),7}daysInMonth(n){const e=Wt(n,this,!0);return sr(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=Wt(n,this,!0);return Kt(sr(this),e.year)}monthsInYear(n){const e=Wt(n,this,!0);return sr(this).monthsInYear(e.year)}inLeapYear(n){return sr(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=Gt(n,sr(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=Gt({...n,day:1},sr(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=sr(this);let{era:r,eraYear:o,year:i,monthCode:s,day:a}=n;if(void 0===a)throw new TypeError("required property 'day' missing or undefined");void 0!==r&&void 0!==o&&(i=t.convertEraYear(o,r));let c=i;if(void 0===c){if(void 0===s)throw new TypeError("either year or monthCode required with month");c=t.guessYearForMonthDay(s,a)}const u=Gt({...n,year:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const r=sr(this),o=Ut(m(PlainDate,n,t),m(Duration,e),r,u(t));return new PlainDate(o.isoYear,o.isoMonth,o.isoDay,this)}dateUntil(n,e,t){const o=sr(this),i=m(PlainDate,n),s=m(PlainDate,e),a=R(r(t).largestUnit,6,6,9);return lr(dr(i,s),this),rr(i,s,o,a)}toString(){return this.id}};function cr(){return new Calendar2("iso8601")}function ur(n){return void 0===n.calendar?cr():m(Calendar2,n.calendar)}function dr(n,e){const{calendar:t}=n;return lr(t,e.calendar),t}function hr(n,e){const t=n.calendar,r=e.calendar;if("iso8601"===t.id)return r;if("iso8601"===r.id)return t;if(t.id!==r.id)throw new RangeError("Non-ISO calendars incompatible");return t}function lr(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends v{constructor(n,e,t,r=0,o=0,i=0,s=0,a=0,u=0,d=cr()){const h=yr({isoYear:n,isoMonth:e,isoDay:t,isoHour:r,isoMinute:o,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c);en(A(h)),super({...h,calendar:m(Calendar2,d)})}static from(n,e){const r=u(e);return fr(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?mr(t(n,pn),e,r,ur(n)):Ce(Ue(String(n))))}static compare(n,e){return pr(m(PlainDateTime,n),m(PlainDateTime,e))}with(n,e){return fr(mr(gr(a(n,pn),this),e,u(e),this.calendar))}withPlainDate(n){const e=m(PlainDate,n);return fr({...this.getISOFields(),...e.getISOFields(),calendar:hr(this,e)})}withPlainTime(n){return fr({...this.getISOFields(),...tt(n).getISOFields()})}withCalendar(n){return fr({...this.getISOFields(),calendar:m(Calendar2,n)})}add(n,e){return wr(this,m(Duration,n),e)}subtract(n,e){return wr(this,m(Duration,n).negated(),e)}until(n,e){return vr(this,m(PlainDateTime,n),e)}since(n,e){return vr(this,m(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return Mr(n,Vn(t),t.roundingMode)}(this,n)}equals(n){return 0===pr(this,m(PlainDateTime,n))}toString(n){const e=In(n),t=fn(n),r=Mr(this,e.roundingIncrement,e.roundingMode).getISOFields();return dt(r,e)+gt(r.calendar.id,t)}toLocaleString(n,e){return le(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toZonedDateTime(n,e){const t=m(TimeZone,n),r=t.getInstantFor(this,e);return new ZonedDateTime(r.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return Hn(this.getISOFields())}toPlainMonthDay(){return kn(this.getISOFields())}toPlainDate(){return kt(this.getISOFields())}toPlainTime(){return Qe(this.getISOFields())}};function fr(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function mr(n,e,t,r){return{...r.dateFromFields(n,e).getISOFields(),...et(n,t)}}function gr(n,e){return{...jt(n,e),...Xe(n,e)}}function yr(n,e){return{...Ht(n,e),...Ve(n,e)}}function pr(n,e){return j(A(n.getISOFields()),A(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function wr(n,e,t){const{calendar:r}=n,o=bt(e),i=Zt(e);return fr({...J(A(r.dateAdd(kt(n.getISOFields()),o,t).getISOFields())+ot(n)+ot(i)),calendar:r})}function vr(n,e,t,r){const o=k(t,6,0,0,9);return Jn(re(n,e,o.largestUnit),o,n,e,r)}function Mr(n,e,t){const r=Kn(n,e,t);return fr(Xn(n.getISOFields(),r))}function Ir(n,e){return j(n.epochNanoseconds,e.epochNanoseconds)}function Sr(n,e){if(Ft(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+ot(Zt(e)))}function Tr(n,e,t){const r=k(t,3,0,0,5,!0);return Ot(Qn(e.epochNanoseconds-n.epochNanoseconds,r),r.largestUnit)}On(PlainDateTime,E),bn(PlainDateTime,Yn);var[Dr,Fr]=d(),Instant=class extends y{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&on(),Fr(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=Ue(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant(A(yr(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*S)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*I)}static fromEpochMicroseconds(n){return new Instant(n*M)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Ir(m(Instant,n),m(Instant,e))}get epochNanoseconds(){return Dr(this)}add(n){return Sr(this,m(Duration,n))}subtract(n){return Sr(this,m(Duration,n).negated())}until(n,e){return Tr(this,m(Instant,n),e)}since(n,e){return Tr(m(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[r,o]=ut(n.epochNanoseconds);return new Instant(r+Qn(o,t))}(this,n)}equals(n){return 0===Ir(this,m(Instant,n))}toString(n){const e=r(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toLocaleString(n,e){return new ue(n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e}).format(this.epochMilliseconds)}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function Or(n=Er()){return Zr().toZonedDateTimeISO(n)}function Nr(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return Zr().toZonedDateTime({calendar:n,timeZone:e??Er()})}function Yr(n=Er()){return Or(n).toPlainDateTime()}function br(n,e){return Nr(n,e).toPlainDateTime()}function Zr(){return new Instant(BigInt(Date.now())*M)}function Er(){return new TimeZone((new ue).resolvedOptions().timeZone)}Tn(Instant);var Cr={zonedDateTimeISO:Or,zonedDateTime:Nr,plainDateTimeISO:Yr,plainDateTime:br,plainDateISO:function(n=Er()){return Yr(n).toPlainDate()},plainDate:function(n,e){return br(n,e).toPlainDate()},plainTimeISO:function(n=Er()){return Zr().toZonedDateTimeISO(n).toPlainTime()},instant:Zr,timeZone:Er};!function(){if(!globalThis.Temporal){globalThis.Temporal={PlainYearMonth:PlainYearMonth,PlainMonthDay:PlainMonthDay,PlainDate:PlainDate,PlainTime:PlainTime,PlainDateTime:PlainDateTime,ZonedDateTime:ZonedDateTime,Instant:Instant,Calendar:Calendar2,TimeZone:TimeZone,Duration:Duration,Now:Cr},globalThis.Date.prototype.toTemporalInstant=function(){return n=this,Instant.fromEpochMilliseconds(n.valueOf());var n};class n extends ue{format(n){return super.format(de(n))}formatToParts(n){return super.formatToParts(de(n))}formatRange(n,e){return super.formatRange(he(n),he(e))}formatRangeToParts(n,e){return super.formatRangeToParts(he(n),he(e))}}globalThis.Intl.DateTimeFormat=n}}();
function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,l(e,(n=>({get:n}))))}function l(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function f(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}function m(n,e,...t){return e instanceof n?e:n.from(e,...t)}var g=class{toJSON(){return this.toString()}},y=class extends g{valueOf(){throw new Error("Cannot convert object using valueOf")}},[p,w]=d(),v=class extends y{constructor(n){super(),w(this,Object.freeze(n))}getISOFields(){return p(this)}},I=1000n,M=1000000n,S=1000000000n,D=60000000000n,F=3600000000000n,O=86400000000000n,T=[1,1e3,1e6,1e9,6e10,36e11,864e11],b=[9,6,3];function N(n){return n<=6}function Y(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),E=["nanosecond","microsecond","millisecond","second","minute","hour"],C=[...E,"day","week","month","year"],P=C.map((n=>n+"s")),U=f(C,((n,e)=>e)),B=f(P,((n,e)=>e));function R(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=U[n]??B[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function x(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=R(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*T[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?T[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*T[d]>=T[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function k(n,e,t,r,i,s,a){const c=x(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=R(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function j(n,e){return n<e?-1:n>e?1:0}function L(n){return j(n,0)}function q(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function H(n,e){return(n%e+e)%e}function $(n){return W(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function z(n){return Math.floor(A(n)/1e3)}function A(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function W(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*M+BigInt(a??0)*I+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,l,f=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;f<31;f++){h=u-d*f;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!tn(n)){l=n+d*f*864e5;break}}return(void 0===l||h<1||h>ln.daysInMonth(a,c))&&on(),m&&(l=new Date(l).setUTCFullYear(a)),l}function J(n){let e=n/M,t=Number(n-e*M);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...K(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function K(n){const[e,t]=en(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function Q(n){return en(1e3*n)[0].getUTCFullYear()}function V(n){return Math.floor(G(n)/1e3)}function X(n,e){return Math.round((e-n)/864e5)}function _(n,e){return n+864e5*e}function nn(n,e,t){const[o,r]=en(G(n,e,t));return H(o.getUTCDay()+r,7)||7}function en(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!tn(r)){t=r;break}}return void 0===t&&on(),[t,e*o]}function tn(n){return isNaN(n.valueOf())}function on(){throw new RangeError("Date outside of supported range")}function rn(n,e){return String(n).padStart(e,"0")}function sn(n){return n<0?"-":"+"}var an={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{beforeroc:-1,minguo:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},cn=class{constructor(n){this.id=n}monthCode(n,e){return"M"+rn(n,2)}convertMonthCode(n,e){const t=/L$/.test(n),o=parseInt(n.substr(1));if(t)throw new RangeError("Calendar system doesnt support leap months");return[o,!1]}};function un(n,e,t,o){let r=an[dn(n)]?.[t];if(void 0===r){if(!o)throw new Error("Unkown era "+t);r=0}return(r+e)*(L(r)||1)}function dn(n){return n.split("-")[0]}var hn=class extends cn{computeFields(n){const e=K(n);return{era:void 0,eraYear:void 0,year:e.isoYear,month:e.isoMonth,day:e.isoDay}}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},ln=new hn("iso8601"),fn=class extends hn{computeFields(n){const e=super.computeFields(n),{year:t}=e;return{...e,era:t<1?"bce":"ce",eraYear:t<1?-(t-1):t}}},mn=n("calendarName",{auto:0,never:1,always:2},0),gn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},yn={...gn,day:Number},pn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},wn={...yn,...pn},vn={...wn,offset:String},In=f(P,(()=>Number)),Mn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function Sn(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=R(i,void 0,0,t),d=T[u],a=b[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Dn=n("timeZoneName",{auto:0,never:1},0);function Fn(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/I},epochMilliseconds(){return Number(this.epochNanoseconds/M)},epochSeconds(){return Number(this.epochNanoseconds/S)}})}var On,Tn={calendar:"calendar"};for(const n of C)Tn[n]="iso"+((On=n).charAt(0).toUpperCase()+On.slice(1));function bn(n,e=[]){h(n,f(e.concat("calendar"),(n=>function(){return this.getISOFields()[Tn[n]]})))}var Nn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],Yn=[...Nn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function Zn(n,e){h(n,f(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var En=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0);var Cn=class{constructor(n){this.id=n}},Pn=class extends Cn{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function Un(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var Bn={bc:"bce",ad:"ce"};function Rn(n){return n=n.toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g,""),Bn[n]||n}var xn=n("offset",{auto:0,never:1},0);function kn(n,e){const t=$(n);jn(t),lo(t,e)}function jn(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&on()}var PlainMonthDay=class extends v{constructor(n,e,t=vo(),o){super({...zt({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return qn(n.getISOFields());if("object"==typeof n){const o=Mo(n);let r=t(n,Ln);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=function(n){const e=Ee.exec(Qe(n));if(e)return{...$e(e),calendar:e[6]?new Calendar2(e[6]):vo()}}(r=String(n))||Le(r)||Xe("monthDay",r);var r;return void 0===o.calendar&&(o.isoYear=1972),qn(Be(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Ln),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=m(PlainMonthDay,n),e.calendar.id===t.calendar.id&&$(e.getISOFields())===$(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?function(n){return rn(n.isoMonth,2)+"-"+rn(n.isoDay,2)}(e):mt(e))+wt(t,o)}toLocaleString(n,e){return ge(this,n,{month:"numeric",day:"numeric",...e,weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};bn(PlainMonthDay),Zn(PlainMonthDay,["monthCode","day"]);var Ln={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function qn(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}var Hn={day:1},PlainYearMonth=class extends v{constructor(n,e,t=vo(),o=1){const r=zt({isoYear:n,isoMonth:e,isoDay:o},c),i=m(Calendar2,t);var s,a;s=r,a=i.id,lo($(s),a),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return zn(n.getISOFields());if("object"==typeof n){const o=t(n,gn);return Mo(n).yearMonthFromFields(o,e)}const o=xe(String(n));return void 0===o.calendar&&(o.isoDay=1),zn(Be(o))}static compare(n,e){return Wn(m(PlainYearMonth,n),m(PlainYearMonth,e))}with(n,e){const t=a(n,gn);return this.calendar.yearMonthFromFields(An(t,this),e)}add(n,e){return $n(this,m(Duration,n),e)}subtract(n,e){return $n(this,m(Duration,n).negated(),e)}until(n,e){return Gt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9))}since(n,e){return Gt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9),!0)}equals(n){return 0===Wn(this,m(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?gt(e):mt(e))+wt(t,o)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",...e,weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function $n(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function zn(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function An(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function Wn(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}bn(PlainYearMonth),Zn(PlainYearMonth,Nn);var[Gn,Jn]=d(),ZonedDateTime=class extends v{constructor(n,e,t=vo()){const o=m(TimeZone,e),r=m(Calendar2,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i),a=J(n+BigInt(s));kn(a,r.id),super({...a,calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),Jn(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Mn(e,3),r=u(e);return te(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?oe(t(n,vn),e,r,Mo(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return m(TimeZone,n.timeZone)}(n)):Re(xe(String(n))),e,o)}static compare(n,e){return j(m(ZonedDateTime,n).epochNanoseconds,m(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return Gn(this).epochNanoseconds}get offsetNanoseconds(){return Gn(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,vn),o={...bo(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Mn(e,0),c=u(e);return En(e),te(oe(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=m(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,Do(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return re(this,m(Duration,n),e)}subtract(n,e){return re(this,m(Duration,n).negated(),e)}until(n,e){return ie(this,m(ZonedDateTime,n),e)}since(n,e){return ie(this,m(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=at(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,de(n),t.roundingMode);return Oo(ee(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return he(n,ne(t),t.roundingMode)}(this,n)}equals(n){const e=m(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return te({...this.getISOFields(),...ue,offset:void 0},void 0,3)}get hoursInDay(){return de(this)/36e11}toString(n){const e=Sn(n),t=xn(n),o=Dn(n),r=mn(n),i=he(this,e.roundingIncrement,e.roundingMode).getISOFields();return ft(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+wt(i.calendar.id,r)}toLocaleString(n,e){return function(n,e,t){const o=n.getISOFields(),r=o.calendar.id,i=o.timeZone.id,{timeZone:s}=t;if(void 0!==s&&s!==i)throw new RangeError("Given timeZone must agree");return ye(n.epochMilliseconds,r,e,{timeZone:i,timeZoneName:"short",...t})}(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDateTime(){return Oo(this.getISOFields())}toPlainDate(){return qt(this.getISOFields())}toPlainTime(){return _e(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Kn(n,e,t,o){const r=P[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=P[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=Qn(c),h=Qn(u),l=Qn(o),f=Number(l-d)/Number(h-d)*i;return s[r]+=f,s}function Qn(n){const{epochNanoseconds:e}=n;return void 0!==e?e:$(n.getISOFields())}function Vn(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!Y(i))return Yt(_n((ce(o)-ce(t))*(r?-1n:1n),e),i);let u=Kn(n,s,t,o);const d=P[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=Rt(u)),c!==Math.round&&h();let l=Dt(u);return s>0&&(l=r?Tt(l.negated(),i,t).negated():Tt(l,i,t)),l}function Xn(n,e,t){return ct(q(at(n),e,t))}function _n(n,e){return q(n,ne(e),e.roundingMode)}function ne(n){return T[n.smallestUnit]*n.roundingIncrement}function ee(n,e){return{...Lt(n,e.day),...ut(e)}}function te(n,e,t){const{calendar:o,timeZone:r,offset:i,Z:s}=n;let a;if(void 0!==i&&2!==t&&(a=$(n)-BigInt(i),1!==t&&!s)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(a,r.getPossibleInstantsFor(Oo(n)))){if(3===t)throw new RangeError("Mismatching offset/timezone");a=void 0}}return void 0===a&&(a=r.getInstantFor(Oo(n),e).epochNanoseconds),new ZonedDateTime(a,r,o)}function oe(n,e,t,o,r){return{...To(n,e,t,o),timeZone:r,offset:n.offset?(i=n.offset,qe(i)??Xe("timeZone",i)):void 0};var i}function re(n,e,t){const{calendar:o,timeZone:r}=n,i=Ct(e),s=Pt(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=at(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function ie(n,e,t,o){const r=k(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return Vn(se(n,e,i),r,n,e,o)}function se(n,e,t){const o=So(n,e);if(!Y(t))return ae(n,e,t);const r=qt(n.getISOFields());let i,s,a,c,u,d=qt(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:C[t]}),i=n.add(s),a=ae(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return Ot(s,a)}function ae(n,e,t){return Yt(ce(e)-ce(n),t)}function ce(n){return n instanceof PlainDateTime?$(n.getISOFields()):n.epochNanoseconds}bn(ZonedDateTime,E),Zn(ZonedDateTime,Yn),Fn(ZonedDateTime);var ue={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function de(n){const e={...n.getISOFields(),...ue,offset:void 0},t=te(e,void 0,3),o=te({...e,...Lt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function he(n,e,t){return te({...Co(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}var le=Intl.DateTimeFormat;function fe(n){return void 0===n?n:me(n)}function me(n){return"number"==typeof n||n instanceof Date?n:n instanceof Instant||n instanceof ZonedDateTime?n.epochMilliseconds:A(n.getISOFields())}function ge(n,e,t,o){const r=n.getISOFields(),i=r.calendar.id;let s,{timeZone:a}=t;if(void 0!==a){const e=new TimeZone(a),t=Oo({...ue,...n.getISOFields()});s=e.getInstantFor(t).epochMilliseconds}else s=A(r),a="UTC";return ye(s,i,e,{...t,timeZone:a,timeZoneName:void 0},o)}function ye(n,e,t,o,r){const i=new le(t,{calendar:pe(t)?void 0:e,...o});if((r||"iso8601"!==e)&&e!==i.resolvedOptions().calendar)throw new RangeError("Non-iso calendar mismatch");return i.format(n)}function pe(n){const e=[].concat(n||[]);for(const n of e)if(-1!==n.indexOf("-u-ca-"))return!0;return!1}var we={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},ve=[182,91,273],Ie=class extends Cn{constructor(n){const e=new le("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=we[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(Q(n))]}getOffset(n){const e=Un(this.format,1e3*n);let t=parseInt(e.year);"bce"===Rn(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=Q(n);for(let o=0;o<5;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(j(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(V(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=V(n)-1,r=V(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of ve){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},Me={UTC:new Pn("UTC",0)};var[Se,De]=d(),TimeZone=class extends g{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),De(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(Me[e])return Me[e];const t=qe(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new Pn(pt(t),Math.trunc(t/1e9))}return Me[e]=new Ie(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=Le(String(n));return new TimeZone(e&&(e.timeZone||e.Z&&"UTC"||void 0!==e.offset&&pt(e.offset))||n)}get id(){return Se(this).id}getOffsetStringFor(n){return pt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=m(Instant,n);return 1e9*Se(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=vo()){const t=m(Instant,n);return Oo({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:m(Calendar2,e)})}getInstantFor(n,e){const t=En(e),o=m(PlainDateTime,n).getISOFields(),r=z(o),i=Se(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return Fe(r-s,o)}getPossibleInstantsFor(n){const e=m(PlainDateTime,n).getISOFields(),t=z(e);let o=Se(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>Fe(t-n,e)))}getPreviousTransition(n){const e=m(Instant,n),t=Se(this).getTransition(e.epochSeconds,-1);return t?Fe(t[0]):null}getNextTransition(n){const e=m(Instant,n),t=Se(this).getTransition(e.epochSeconds,1);return t?Fe(t[0]):null}toString(){return this.id}};function Fe(n,e){return new Instant(BigInt(n)*S+(e?BigInt(e.isoMillisecond)*M+BigInt(e.isoMicrosecond)*I+BigInt(e.isoNanosecond):0n))}var Oe="(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?",Te=`([+-])${Oe}`,be=`(Z|${Te})?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?`,Ne=Ve(Te),Ye=Ve(Oe+be),Ze=Ve(`([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?([T ]${Oe})?`+be),Ee=Ve("(--)?(\\d{2})-?(\\d{2})?"+be),Ce=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Pe=/Z/i,Ue=/\u2212/g;function Be(n){return{...n,calendar:void 0===n.calendar?vo():new Calendar2(n.calendar)}}function Re(n){return{...Be(n),timeZone:new TimeZone(n.timeZone)}}function xe(n){return Le(n)||Xe("dateTime",n)}function ke(n){return function(n){const e=Ye.exec(n);if(e&&e[1])return ze(e.slice(1))}(n)||Le(n)||Xe("time",n)}function je(n){return function(n){const e=Ce.exec(Qe(n));if(e){let n,t,o,r;[n,r]=He(e[8],e[10],5,void 0),[t,r]=He(e[12],e[14],4,r),[o,r]=He(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:Ke(e[2]),months:Ke(e[3]),weeks:Ke(e[4]),days:Ke(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=ht(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=Rt(i)),i}}(n)||Xe("duration",n)}function Le(n){const e=Ze.exec(Qe(n));if(e){const n=Pe.test(e[10]);return{...(t=e.slice(1),{isoYear:Je(t[0]),isoMonth:Je(t[1]),isoDay:Je(t[2])}),...ze(e.slice(5)),Z:n,offset:n?0:Ae(e.slice(11)),timeZone:e[18],calendar:e[20]}}var t}function qe(n){const e=Ne.exec(Qe(n));if(e)return Ae(e.slice(1))}function He(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?We(e)*(T[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/T[t]);return[n,o-n*T[t]]}return[void 0,void 0]}function $e(n){return{isoYear:1972,isoMonth:Je(n[2]),isoDay:Je(n[3])}}function ze(n){const e=Ge(n[2]);return{...ut(ht(BigInt(We(n[4]||"")),2)),isoHour:Ge(n[0]),isoMinute:Ge(n[1]),isoSecond:60===e?59:e}}function Ae(n){const e=n[0];if(void 0!==e&&n[1])return("+"===e?1:-1)*function(n){return 36e11*Ge(n[0])+6e10*Ge(n[1])+1e9*Ge(n[2])+We(n[4]||"")}(n.slice(1))}function We(n){return parseInt(n.padEnd(9,"0"))}function Ge(n){return parseInt(n||"0")}function Je(n){return parseInt(n||"1")}function Ke(n){return void 0===n?void 0:parseInt(n)}function Qe(n){return n.replace(Ue,"-")}function Ve(n){return new RegExp(`^${n}$`,"i")}function Xe(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}var PlainTime=class extends v{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...nt({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:vo()})}static from(n,e){const o=u(e);return _e(n instanceof PlainTime?n.getISOFields():"object"==typeof n?rt(t(n,pn),o):ke(String(n)))}static compare(n,e){return st(m(PlainTime,n),m(PlainTime,e))}with(n,e){return _e(rt(et(a(n,pn),this),u(e)))}add(n){return tt(this,m(Duration,n))}subtract(n){return tt(this,m(Duration,n).negated())}until(n,e){return ot(this,m(PlainTime,n),e)}since(n,e){return ot(m(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return _e(ut(Xn(n,ne(t),t.roundingMode)))}(this,n)}equals(n){return 0===st(this,m(PlainTime,n))}toString(n){const e=Sn(n);return yt(ut(Xn(this,e.roundingIncrement,e.roundingMode)),e)}toLocaleString(n,e){return new le(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}).format(Number(at(this)/M))}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return m(PlainDate,n).toPlainDateTime(this)}};function _e(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function nt({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function et(n,e){return l(pn,((t,o)=>n[o]??e[o]))}function tt(n,e){var t,o;return _e(ut((t=n,o=Pt(e),ct(at(t)+at(o)))))}function ot(n,e,t){const o=k(t,5,0,0,5);return Yt(_n(at(e)-at(n),o),o.largestUnit)}function rt(n,e){return nt(ut(n),e)}function it(n){return m(PlainTime,n??{hour:0})}function st(n,e){return j(at(n),at(e))}function at(n){return BigInt(n.hour)*F+BigInt(n.minute)*D+BigInt(n.second)*S+BigInt(n.millisecond)*M+BigInt(n.microsecond)*I+BigInt(n.nanosecond)}function ct(n){const[e,t]=lt(n);return{...ht(t,5),day:Number(e/O)}}function ut(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function dt(n){return BigInt(n.day)*O+at(n)}function ht(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(T[o]),r=n/e;n-=r*e,t[C[o]]=Number(r)}return t}function lt(n){const e=J(n);return[W(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*F+BigInt(t.isoMinute)*D+BigInt(t.isoSecond)*S+BigInt(t.isoMillisecond)*M+BigInt(t.isoMicrosecond)*I+BigInt(t.isoNanosecond))];var t}function ft(n,e){return mt(n)+"T"+yt(n,e)}function mt(n){return gt(n)+"-"+rn(n.isoDay,2)}function gt(n){const{isoYear:e}=n;return(e<1e3||e>9999?sn(e)+rn(Math.abs(e),6):rn(e,4))+"-"+rn(n.isoMonth,2)}function yt(n,e){const t=[rn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(rn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(rn(n.isoSecond,2)+It(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function pt(n){const e=ht(BigInt(Math.abs(n)),5),t=It(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return sn(n)+rn(e.hour,2)+":"+rn(e.minute,2)+(e.second||t?":"+rn(e.second,2)+t:"")}function wt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function vt(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function It(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*I+BigInt(n)*M;r&&(s=q(s,void 0===o?T[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/S;let u=rn(Number(a-c*S),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}bn(PlainTime,E);var[Mt,St]=d(),Duration=class extends y{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),St(this,function(n){const e={};let t=0;for(const o of P){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Dt("object"==typeof n?t(n,In):je(n))}static compare(n,e,t){return function(n,e,t){const o=m(Duration,n),r=m(Duration,e),i=Et(o),s=Et(r);if(void 0===t&&i&&s)return j(dt(i),dt(s));const a=Ut(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return Mt(this).years}get months(){return Mt(this).months}get weeks(){return Mt(this).weeks}get days(){return Mt(this).days}get hours(){return Mt(this).hours}get minutes(){return Mt(this).minutes}get seconds(){return Mt(this).seconds}get milliseconds(){return Mt(this).milliseconds}get microseconds(){return Mt(this).microseconds}get nanoseconds(){return Mt(this).nanoseconds}get sign(){return Mt(this).sign}get blank(){return!this.sign}with(n){return Dt({...Mt(this),...a(n,In)})}negated(){return Dt(Rt(Mt(this)))}abs(){return Dt(l(Mt(this),(n=>Math.abs(n))))}add(n,e){return Ft(this,m(Duration,n),o(e).relativeTo)}subtract(n,e){return Ft(this,m(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=Nt(n),o=k(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=Et(n);if(void 0===e.relativeTo&&a&&N(r)&&N(s)){return Zt(ht(_n(dt(a),o),r))}const c=Bt(e.relativeTo),u=bt(n,r,c);return Vn(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=Et(n);if(void 0===t&&o&&N(e))return Number(dt(o))/T[e];const r=Bt(t),i=bt(n,e,r,!0);return Kn(i,e,r,r.add(i))[P[e]]}(this,R(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=Sn(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=It(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+vt([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+vt([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(Mt(this),e)}toLocaleString(n,e){return this.toString()}};function Dt(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function Ft(n,e,t){const o=Et(n),r=Et(e),i=Math.max(Nt(n),Nt(e));if(void 0===t&&o&&r)return Yt(dt(o)+dt(r),i);const s=Ut(t),a=s.add(n).add(e);return se(s,a,i)}function Ot(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Tt(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:C[e]})}(n,Math.max(6,e),t):bt(n,e,t)}function bt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=se(t,i,e);return r&&(s=Ot(s,new Duration(0,0,r))),s}function Nt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function Yt(n,e){return Zt(ht(n,e))}function Zt(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Et(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...Pt(n)}}function Ct(n){return new Duration(n.years,n.months,n.weeks,n.days)}function Pt(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function Ut(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=xe(String(n));return void 0!==e.timeZone?te(Re(e),void 0,0):Oo(Be(e))}}function Bt(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:m(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=Le(String(n));if(e)return void 0!==e.timeZone?te(Re(e),void 0,3):Oo(Be(e));throw new RangeError("Invalid value of relativeTo")}function Rt(n){return l(n,(n=>-n||0))}function xt(n,e,t,o){n=jt(n=kt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=at(Pt(n)),t=e/O;return[ht(e-t*O,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=_(r,7*i.weeks+i.days),K(r)}function kt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function jt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function Lt(n,e){return e?{...K(_(A(n),e)),calendar:n.calendar}:n}function qt(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function Ht(n,e){return{...An(n,e),day:n.day??e.day}}function $t(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function zt(n,e){const[t,o,r]=$t(n.isoYear,n.isoMonth,n.isoDay,ln,e);return{isoYear:t,isoMonth:o,isoDay:r}}function At(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Wt(n,e){return j(n.year,e.year)||function(n,e){return j(n.month,e.month)||j(n.day,e.day)}(n,e)}function Gt(n,e,t,o){return Vn(So(n,e).dateUntil(n,e,{largestUnit:C[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends v{constructor(n,e,t,o=vo()){const r=zt({isoYear:n,isoMonth:e,isoDay:t},c),i=m(Calendar2,o);!function(n,e){const t=$(n);jn(t+(t<0n?86399999999999n:0n)),lo(t,e)}(r,i.id),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainDate)return qt(n.getISOFields());if("object"==typeof n){const o=t(n,yn);return Mo(n).dateFromFields(o,e)}return qt(Be(xe(String(n))))}static compare(n,e){return At(m(PlainDate,n),m(PlainDate,e))}with(n,e){const t=Ht(a(n,yn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,m(Duration,n).negated(),e)}until(n,e){return Gt(this,m(PlainDate,n),k(e,6,6,6,9))}since(n,e){return Gt(this,m(PlainDate,n),k(e,6,6,6,9),!0)}equals(n){return 0===At(this,m(PlainDate,n))}toString(n){const e=mn(n),t=this.getISOFields();return mt(t)+wt(t.calendar.id,e)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",day:"numeric",...e,hour:void 0,minute:void 0,second:void 0})}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return Oo({...this.getISOFields(),...it(n).getISOFields()})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}};function Jt(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function Kt(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(Jt(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=qt(n.getISOFields())}else o=PlainDate.from(n);return Fo(o.calendar,e),o}function Qt(n,e,t){if(Jt(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:d}=n;const h=void 0!==r&&void 0!==o?un(e.id,r,o):void 0;if(void 0===i){if(void 0===h)throw new TypeError("Must specify either a year or an era & eraYear");i=h}else if(void 0!==h&&h!==i)throw new RangeError("year and era/eraYear must match");if(void 0===d)throw new TypeError("Must specify day");const l=u(t);if(void 0!==a){const[n,t]=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");if(s=n,t){if(l===c)throw new RangeError("Month code out of range");d=e.daysInMonth(i,s)}}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");return[i,s,d]=$t(i,s,d,e,l),K(e.epochMilliseconds(i,s,d))}function Vt(n,e){if(Jt(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function Xt(n,e){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function _t(n,e,t,o){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}bn(PlainDate),Zn(PlainDate,Yn);var no={hebrew:6,chinese:0,dangi:0},eo=class extends cn{constructor(n){const e=to(n);if(t=n,o=e.resolvedOptions().calendar,dn(t)!==dn(o))throw new RangeError("Invalid calendar: "+n);var t,o;super(n),this.format=e,this.yearCorrection=this.computeFieldsDumb(0).year-1970,this.monthCacheByYear={}}epochMilliseconds(n,e,t){return _(this.queryMonthCache(n)[0][e-1],t-1)}daysInMonth(n,e){const t=this.queryMonthCache(n)[0],o=t[e-1];e>=t.length&&(n++,e=0);return X(o,this.queryMonthCache(n)[0][e])}monthsInYear(n){return this.queryMonthCache(n)[0].length}monthCode(n,e){const t=this.queryLeapMonthByYear(e);return!t||n<t?super.monthCode(n,e):super.monthCode(n-1,e)+(n===t?"L":"")}convertMonthCode(n,e){const t=this.queryLeapMonthByYear(e);let o=/L$/.test(n),r=parseInt(n.substr(1)),i=!1;if(o){const n=no[this.id];if(void 0===n)throw new RangeError("Calendar system doesnt support leap months");if(n){if(r!==n-1)throw new RangeError("Invalid leap-month month code")}else if(r<=1||r>=12)throw new RangeError("Invalid leap-month month code")}return!o||t&&r===t-1||(i=!0,o=!1),(o||t&&r>=t)&&r++,[r,i]}inLeapYear(n){const e=Xt(this,n);return e>Xt(this,n-1)&&e>Xt(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const[o,r]=this.convertMonthCode(n,t);if(!r&&o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}computeFields(n){const e=this.computeFieldsDumb(n),t=this.queryMonthCache(e.year)[2];return{...e,month:t[e.month]}}computeFieldsDumb(n){const e=Un(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);var i;return e.era&&(i=this.id,void 0!==an[dn(i)])&&(t=Rn(e.era),o=r,r=un(this.id,o,t,!0)),{era:t,eraYear:o,year:r,month:e.month,day:parseInt(e.day)}}queryLeapMonthByYear(n){const e=this.queryMonthCache(n),t=this.queryMonthCache(n-1),o=this.queryMonthCache(n+1);if(e[0].length>t[0].length&&e[0].length>o[0].length){const n=e[1],o=t[1];for(let e=0;e<o.length;e++)if(o[e]!==n[e])return e+1}}queryMonthCache(n){const{monthCacheByYear:e}=this;return e[n]||(e[n]=this.buildMonthCache(n))}buildMonthCache(n){const e=[],t=[],o={};let r=G(this.guessISOYear(n));for(r=_(r,400);;){const o=this.computeFieldsDumb(r);if(o.year<n)break;r=_(r,1-o.day),o.year===n&&(e.unshift(r),t.unshift(o.month)),r=_(r,-1)}for(let n=0;n<t.length;n++)o[t[n]]=n+1;return[e,t,o]}guessISOYear(n){return n-this.yearCorrection}};function to(n){return new le("en-US",{calendar:n,era:"short",year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}var oo=G(1868,9,8),ro={gregory:fn,japanese:class extends fn{constructor(){super(...arguments),this.format=to("japanese")}computeFields(n){const e=super.computeFields(n);if(n>=oo){const t=Un(this.format,n);e.era=Rn(t.era),e.eraYear=parseInt(t.relatedYear||t.year)}return e}},islamic:class extends eo{guessISOYear(n){return Math.ceil(32*n/33+622)}}},io={iso8601:ln};function so(n){const e=(n=String(n)).toLocaleLowerCase();return io[e]||(io[e]=new(ro[dn(e)]||eo)(n))}var ao=G(1582,10,15),co=G(622,7,18),uo={buddhist:ao,japanese:ao,roc:ao,islamic:co,"islamic-rgsa":co,indian:0},ho={};function lo(n,e){return fo(Number(n/M),e)}function fo(n,e){if(function(n,e){return function(n){let e=ho[n];if(void 0===e){const t=uo[n];if(void 0===t)e=!1;else{let o=so(n);o instanceof eo||(o=new eo(n));const r=t-864e5,i=o.computeFields(r);e=r!==o.epochMilliseconds(i.year,i.month,i.day)}ho[n]=e}return e}(e)&&n<uo[e]}(n,e))throw new RangeError("Invalid timestamp for calendar")}function mo(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=$t(e.year,n.month,n.day,t,0),i=Wt(e,n),s=j(e.month,o)||j(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=kt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=Wt(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=$t(e.year,n.month,n.day,t,0);o+=e.month-s;const c=j(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=jt(n,i,t,0)}return a=X(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function go(n,e,t){const o=7+e-t;return-H(nn(n,1,o)-e,7)+o-1}function yo(n,e,t){const o=go(n,e,t),r=go(n+1,e,t);return(Xt(ln,n)-o+r)/7}var[po,wo]=d(),Calendar2=class extends g{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),wo(this,so(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar2(String(n))}(n.calendar):n;const e=Le(String(n));return new Calendar2(e?e.calendar||"iso8601":n)}get id(){return po(this).id}era(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).era}eraYear(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).eraYear}year(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).year}month(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).month}monthCode(n){const e=Kt(n,this);return po(this).monthCode(e.month,e.year)}day(n){const e=Vt(n);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).day}dayOfWeek(n){const e=Vt(n,!0);return nn(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=Kt(n,this,!0);return _t(po(this),e.year,e.month,e.day)}weekOfYear(n){const e=Vt(n,!0);return function(n,e,t,o,r){const i=go(n,o,r),s=Math.floor((_t(ln,n,e,t)-i-1)/7)+1;if(s<1)return s+yo(n-1,o,r);const a=yo(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return Vt(n,!0),7}daysInMonth(n){const e=Kt(n,this,!0);return po(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=Kt(n,this,!0);return Xt(po(this),e.year)}monthsInYear(n){const e=Kt(n,this,!0);return po(this).monthsInYear(e.year)}inLeapYear(n){return po(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=Qt(n,po(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=Qt({...n,day:1},po(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=po(this);let{era:o,eraYear:r,year:i,monthCode:s,day:a}=n;if(void 0===a)throw new TypeError("required property 'day' missing or undefined");void 0!==o&&void 0!==r&&(i=un(t.id,r,o));let c=i;if(void 0===c){if(void 0===s)throw new TypeError("either year or monthCode required with month");c=t.guessYearForMonthDay(s,a)}const u=Qt({...n,year:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=po(this),r=xt(m(PlainDate,n,t),m(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=po(this),i=m(PlainDate,n),s=m(PlainDate,e),a=R(o(t).largestUnit,6,6,9);return Fo(So(i,s),this),mo(i,s,r,a)}toString(){return this.id}};function vo(){return new Calendar2("iso8601")}function Io(n,e,t,o){const r=G(e,t,o);return fo(r,n.id),n.computeFields(r)}function Mo(n){return void 0===n.calendar?vo():m(Calendar2,n.calendar)}function So(n,e){const{calendar:t}=n;return Fo(t,e.calendar),t}function Do(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function Fo(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends v{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=vo()){const h=No({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c),l=m(Calendar2,d);kn(h,l.id),super({...h,calendar:l})}static from(n,e){const o=u(e);return Oo(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?To(t(n,wn),e,o,Mo(n)):Be(xe(String(n))))}static compare(n,e){return Yo(m(PlainDateTime,n),m(PlainDateTime,e))}with(n,e){return Oo(To(bo(a(n,wn),this),e,u(e),this.calendar))}withPlainDate(n){const e=m(PlainDate,n);return Oo({...this.getISOFields(),...e.getISOFields(),calendar:Do(this,e)})}withPlainTime(n){return Oo({...this.getISOFields(),...it(n).getISOFields()})}withCalendar(n){return Oo({...this.getISOFields(),calendar:m(Calendar2,n)})}add(n,e){return Zo(this,m(Duration,n),e)}subtract(n,e){return Zo(this,m(Duration,n).negated(),e)}until(n,e){return Eo(this,m(PlainDateTime,n),e)}since(n,e){return Eo(this,m(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return Co(n,ne(t),t.roundingMode)}(this,n)}equals(n){return 0===Yo(this,m(PlainDateTime,n))}toString(n){const e=Sn(n),t=mn(n),o=Co(this,e.roundingIncrement,e.roundingMode).getISOFields();return ft(o,e)+wt(o.calendar.id,t)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toZonedDateTime(n,e){const t=m(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDate(){return qt(this.getISOFields())}toPlainTime(){return _e(this.getISOFields())}};function Oo(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function To(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...rt(n,t)}}function bo(n,e){return{...Ht(n,e),...et(n,e)}}function No(n,e){return{...zt(n,e),...nt(n,e)}}function Yo(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Zo(n,e,t){const{calendar:o}=n,r=Ct(e),i=Pt(e);return Oo({...J($(o.dateAdd(qt(n.getISOFields()),r,t).getISOFields())+at(n)+at(i)),calendar:o})}function Eo(n,e,t,o){const r=k(t,6,0,0,9);return Vn(se(n,e,r.largestUnit),r,n,e,o)}function Co(n,e,t){const o=Xn(n,e,t);return Oo(ee(n.getISOFields(),o))}function Po(n,e){return j(n.epochNanoseconds,e.epochNanoseconds)}function Uo(n,e){if(Nt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+at(Pt(e)))}function Bo(n,e,t){const o=k(t,3,0,0,5,!0);return Yt(_n(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}bn(PlainDateTime,E),Zn(PlainDateTime,Yn);var[Ro,xo]=d(),Instant=class extends y{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&on(),xo(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=xe(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant($(No(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*S)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*M)}static fromEpochMicroseconds(n){return new Instant(n*I)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Po(m(Instant,n),m(Instant,e))}get epochNanoseconds(){return Ro(this)}add(n){return Uo(this,m(Duration,n))}subtract(n){return Uo(this,m(Duration,n).negated())}until(n,e){return Bo(this,m(Instant,n),e)}since(n,e){return Bo(m(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[o,r]=lt(n.epochNanoseconds);return new Instant(o+_n(r,t))}(this,n)}equals(n){return 0===Po(this,m(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toLocaleString(n,e){return new le(n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e}).format(this.epochMilliseconds)}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function ko(n=$o()){return Ho().toZonedDateTimeISO(n)}function jo(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return Ho().toZonedDateTime({calendar:n,timeZone:e??$o()})}function Lo(n=$o()){return ko(n).toPlainDateTime()}function qo(n,e){return jo(n,e).toPlainDateTime()}function Ho(){return new Instant(BigInt(Date.now())*M)}function $o(){return new TimeZone((new le).resolvedOptions().timeZone)}Fn(Instant);var zo={zonedDateTimeISO:ko,zonedDateTime:jo,plainDateTimeISO:Lo,plainDateTime:qo,plainDateISO:function(n=$o()){return Lo(n).toPlainDate()},plainDate:function(n,e){return qo(n,e).toPlainDate()},plainTimeISO:function(n=$o()){return Ho().toZonedDateTimeISO(n).toPlainTime()},instant:Ho,timeZone:$o};!function(){if(!globalThis.Temporal){globalThis.Temporal={PlainYearMonth:PlainYearMonth,PlainMonthDay:PlainMonthDay,PlainDate:PlainDate,PlainTime:PlainTime,PlainDateTime:PlainDateTime,ZonedDateTime:ZonedDateTime,Instant:Instant,Calendar:Calendar2,TimeZone:TimeZone,Duration:Duration,Now:zo},globalThis.Date.prototype.toTemporalInstant=function(){return n=this,Instant.fromEpochMilliseconds(n.valueOf());var n};class n extends le{format(n){return super.format(fe(n))}formatToParts(n){return super.formatToParts(fe(n))}formatRange(n,e){return super.formatRange(me(n),me(e))}formatRangeToParts(n,e){return super.formatRangeToParts(me(n),me(e))}}globalThis.Intl.DateTimeFormat=n}}();
//# sourceMappingURL=global.js.map

@@ -1,2 +0,2 @@

function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,f(e,(n=>({get:n}))))}function f(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function l(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}function m(n,e,...t){return e instanceof n?e:n.from(e,...t)}var g=class{toJSON(){return this.toString()}},y=class extends g{valueOf(){throw new Error("Cannot convert object using valueOf")}},[w,p]=d(),v=class extends y{constructor(n){super(),p(this,Object.freeze(n))}getISOFields(){return w(this)}},M=1000n,I=1000000n,S=1000000000n,F=60000000000n,O=3600000000000n,D=86400000000000n,N=[1,1e3,1e6,1e9,6e10,36e11,864e11],T=[9,6,3];function Y(n){return n<=6}function b(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),E=["nanosecond","microsecond","millisecond","second","minute","hour"],C=[...E,"day","week","month","year"],U=C.map((n=>n+"s")),P=l(C,((n,e)=>e)),B=l(U,((n,e)=>e));function x(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=P[n]??B[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function R(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=x(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*N[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?N[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*N[d]>=N[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function k(n,e,t,r,i,s,a){const c=R(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=x(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function j(n,e){return n<e?-1:n>e?1:0}function L(n){return j(n,0)}function H(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function $(n,e){return(n%e+e)%e}function A(n){return W(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function q(n){return Math.floor(z(n)/1e3)}function z(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function W(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*I+BigInt(a??0)*M+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,f,l=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;l<31;l++){h=u-d*l;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!on(n)){f=n+d*l*864e5;break}}return(void 0===f||h<1||h>hn.daysInMonth(a,c))&&rn(),m&&(f=new Date(f).setUTCFullYear(a)),f}function J(n){let e=n/I,t=Number(n-e*I);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...K(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function K(n){const[e,t]=tn(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function Q(n){return tn(1e3*n)[0].getUTCFullYear()}function V(n){return Math.floor(G(n)/1e3)}function X(n,e){return Math.round((e-n)/864e5)}function _(n,e){return n+864e5*e}function nn(n,e,t){const[o,r]=tn(G(n,e,t));return $(o.getUTCDay()+r,7)||7}function en(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&rn()}function tn(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!on(r)){t=r;break}}return void 0===t&&rn(),[t,e*o]}function on(n){return isNaN(n.valueOf())}function rn(){throw new RangeError("Date outside of supported range")}function sn(n,e){return String(n).padStart(e,"0")}function an(n){return n<0?"-":"+"}var cn={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{"before-roc":-1,minguo:0},buddhist:{be:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},un=class{constructor(n){this.id=n}era(n,e,t){}eraYear(n,e,t){}monthCode(n,e){return"M"+sn(n,2)}convertMonthCode(n,e){return parseInt(n.substr(1))}convertEraYear(n,e,t){let o=cn[this.id]?.[e];if(void 0===o){if(t)throw new Error("Unkown era "+e);o=0}return(o+n)*(L(o)||1)}},dn=class extends un{year(n){return n}month(n,e){return e}day(n,e,t){return t}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},hn=new dn("iso8601"),fn=class extends dn{era(n,e,t){return n<1?"bce":"ce"}eraYear(n,e,t){return n<1?-(n-1):n}},ln=n("calendarName",{auto:0,never:1,always:2},0),mn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},gn={...mn,day:Number},yn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},wn={...gn,...yn},pn={...wn,offset:String},vn=l(U,(()=>Number)),Mn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function In(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=x(i,void 0,0,t),d=N[u],a=T[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Sn=n("timeZoneName",{auto:0,never:1},0);function Fn(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/M},epochMilliseconds(){return Number(this.epochNanoseconds/I)},epochSeconds(){return Number(this.epochNanoseconds/S)}})}var On,Dn={calendar:"calendar"};for(const n of C)Dn[n]="iso"+((On=n).charAt(0).toUpperCase()+On.slice(1));function Nn(n,e=[]){h(n,l(e.concat("calendar"),(n=>function(){return this.getISOFields()[Dn[n]]})))}var Tn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],Yn=[...Tn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function bn(n,e){h(n,l(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var Zn=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0);var En=class{constructor(n){this.id=n}},Cn=class extends En{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function Un(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var Pn={bc:"bce",ad:"ce"};function Bn(n){return n=n.toLowerCase().replace(/[^a-z0-9]g/,"").replace(/ /g,"-"),Pn[n]||n}var xn=n("offset",{auto:0,never:1},0),PlainMonthDay=class extends v{constructor(n,e,t=uo(),o){super({...$t({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return kn(n.getISOFields());if("object"==typeof n){const o=ho(n);let r=t(n,Rn);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=function(n){const e=be.exec(Je(n));if(e)return{...He(e),calendar:e[6]?new Calendar2(e[6]):uo()}}(r=String(n))||ke(r)||Qe("monthDay",r);var r;return void 0===o.calendar&&(o.isoYear=1972),kn(Ue(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Rn),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=m(PlainMonthDay,n),e.calendar.id===t.calendar.id&&A(e.getISOFields())===A(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=ln(n);return("iso8601"===t?function(n){return sn(n.isoMonth,2)+"-"+sn(n.isoDay,2)}(e):ft(e))+yt(t,o)}toLocaleString(n,e){return le(this,n,{month:"numeric",day:"numeric",...e,weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};Nn(PlainMonthDay),bn(PlainMonthDay,["monthCode","day"]);var Rn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function kn(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}var jn={day:1},PlainYearMonth=class extends v{constructor(n,e,t=uo(),o=1){const r=$t({isoYear:n,isoMonth:e,isoDay:o},c);A(r),super({...r,calendar:m(Calendar2,t)})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return Hn(n.getISOFields());if("object"==typeof n){const o=t(n,mn);return ho(n).yearMonthFromFields(o,e)}const o=Be(String(n));return void 0===o.calendar&&(o.isoDay=1),Hn(Ue(o))}static compare(n,e){return An(m(PlainYearMonth,n),m(PlainYearMonth,e))}with(n,e){const t=a(n,mn);return this.calendar.yearMonthFromFields($n(t,this),e)}add(n,e){return Ln(this,m(Duration,n),e)}subtract(n,e){return Ln(this,m(Duration,n).negated(),e)}until(n,e){return zt(this.toPlainDate(jn),m(PlainYearMonth,n).toPlainDate(jn),k(e,9,8,8,9))}since(n,e){return zt(this.toPlainDate(jn),m(PlainYearMonth,n).toPlainDate(jn),k(e,9,8,8,9),!0)}equals(n){return 0===An(this,m(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=ln(n);return("iso8601"===t?lt(e):ft(e))+yt(t,o)}toLocaleString(n,e){return le(this,n,{year:"numeric",month:"numeric",...e,weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function Ln(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function Hn(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function $n(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function An(n,e){return j(A(n.getISOFields()),A(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}Nn(PlainYearMonth),bn(PlainYearMonth,Tn);var[qn,zn]=d(),ZonedDateTime=class extends v{constructor(n,e,t=uo()){const o=m(TimeZone,e),r=m(Calendar2,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i);super({...J(n+BigInt(s)),calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),zn(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Mn(e,3),r=u(e);return _n(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?ne(t(n,pn),e,r,ho(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return m(TimeZone,n.timeZone)}(n)):Pe(Be(String(n))),e,o)}static compare(n,e){return j(m(ZonedDateTime,n).epochNanoseconds,m(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return qn(this).epochNanoseconds}get offsetNanoseconds(){return qn(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,pn),o={...wo(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Mn(e,0),c=u(e);return Zn(e),_n(ne(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=m(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,lo(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return ee(this,m(Duration,n),e)}subtract(n,e){return ee(this,m(Duration,n).negated(),e)}until(n,e){return te(this,m(ZonedDateTime,n),e)}since(n,e){return te(this,m(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=R(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=it(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,ae(n),t.roundingMode);return go(Xn(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return ce(n,Vn(t),t.roundingMode)}(this,n)}equals(n){const e=m(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return _n({...this.getISOFields(),...se,offset:void 0},void 0,3)}get hoursInDay(){return ae(this)/36e11}toString(n){const e=In(n),t=xn(n),o=Sn(n),r=ln(n),i=ce(this,e.roundingIncrement,e.roundingMode).getISOFields();return ht(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+yt(i.calendar.id,r)}toLocaleString(n,e){return fe(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toPlainYearMonth(){return Hn(this.getISOFields())}toPlainMonthDay(){return kn(this.getISOFields())}toPlainDateTime(){return go(this.getISOFields())}toPlainDate(){return jt(this.getISOFields())}toPlainTime(){return Ve(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Wn(n,e,t,o){const r=U[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=U[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=Gn(c),h=Gn(u),f=Gn(o),l=Number(f-d)/Number(h-d)*i;return s[r]+=l,s}function Gn(n){const{epochNanoseconds:e}=n;return void 0!==e?e:A(n.getISOFields())}function Jn(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!b(i))return Tt(Qn((ie(o)-ie(t))*(r?-1n:1n),e),i);let u=Wn(n,s,t,o);const d=U[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=Pt(u)),c!==Math.round&&h();let f=It(u);return s>0&&(f=r?Ot(f.negated(),i,t).negated():Ot(f,i,t)),f}function Kn(n,e,t){return st(H(it(n),e,t))}function Qn(n,e){return H(n,Vn(e),e.roundingMode)}function Vn(n){return N[n.smallestUnit]*n.roundingIncrement}function Xn(n,e){return{...kt(n,e.day),...at(e)}}function _n(n,e,t){const{calendar:o,timeZone:r,offset:i,Z:s}=n;let a;if(void 0!==i&&2!==t&&(a=A(n)-BigInt(i),1!==t&&!s)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(a,r.getPossibleInstantsFor(go(n)))){if(3===t)throw new RangeError("Mismatching offset/timezone");a=void 0}}return void 0===a&&(a=r.getInstantFor(go(n),e).epochNanoseconds),new ZonedDateTime(a,r,o)}function ne(n,e,t,o,r){return{...yo(n,e,t,o),timeZone:r,offset:n.offset?(i=n.offset,je(i)??Qe("timeZone",i)):void 0};var i}function ee(n,e,t){const{calendar:o,timeZone:r}=n,i=Zt(e),s=Et(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=it(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function te(n,e,t,o){const r=k(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return Jn(oe(n,e,i),r,n,e,o)}function oe(n,e,t){const o=fo(n,e);if(!b(t))return re(n,e,t);const r=jt(n.getISOFields());let i,s,a,c,u,d=jt(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:C[t]}),i=n.add(s),a=re(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return Ft(s,a)}function re(n,e,t){return Tt(ie(e)-ie(n),t)}function ie(n){return n instanceof PlainDateTime?A(n.getISOFields()):n.epochNanoseconds}Nn(ZonedDateTime,E),bn(ZonedDateTime,Yn),Fn(ZonedDateTime);var se={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function ae(n){const e={...n.getISOFields(),...se,offset:void 0},t=_n(e,void 0,3),o=_n({...e,...kt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function ce(n,e,t){return _n({...So(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}var ue=Intl.DateTimeFormat;function de(n){return void 0===n?n:he(n)}function he(n){return"number"==typeof n||n instanceof Date?n:n instanceof Instant||n instanceof ZonedDateTime?n.epochMilliseconds:z(n.getISOFields())}function fe(n,e,t){const o=n.getISOFields(),r=o.calendar.id,i=o.timeZone.id,{timeZone:s}=t;if(void 0!==s&&s!==i)throw new RangeError("Given timeZone must agree");return me(n.epochMilliseconds,r,e,{timeZone:i,timeZoneName:"short",...t})}function le(n,e,t,o){const r=n.getISOFields(),i=r.calendar.id;let s,{timeZone:a}=t;if(void 0!==a){const e=new TimeZone(a),t=go({...se,...n.getISOFields()});s=e.getInstantFor(t).epochMilliseconds}else s=z(r),a="UTC";return me(s,i,e,{...t,timeZone:a,timeZoneName:void 0},o)}function me(n,e,t,o,r){const i=new ue(t,{calendar:ge(t)?void 0:e,...o});if((r||"iso8601"!==e)&&e!==i.resolvedOptions().calendar)throw new RangeError("Non-iso calendar mismatch");return i.format(n)}function ge(n){const e=[].concat(n||[]);for(const n of e)if(-1!==n.indexOf("-u-ca-"))return!0;return!1}var ye={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},we=[182,91,273],pe=class extends En{constructor(n){const e=new ue("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=ye[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(Q(n))]}getOffset(n){const e=Un(this.format,1e3*n);let t=parseInt(e.year);"bce"===Bn(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=Q(n);for(let o=0;o<5;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(j(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(V(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=V(n)-1,r=V(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of we){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},ve={UTC:new Cn("UTC",0)};var[Me,Ie]=d(),TimeZone=class extends g{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),Ie(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(ve[e])return ve[e];const t=je(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new Cn(gt(t),Math.trunc(t/1e9))}return ve[e]=new pe(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=ke(String(n));return new TimeZone(e&&(e.timeZone||e.Z&&"UTC"||void 0!==e.offset&&gt(e.offset))||n)}get id(){return Me(this).id}getOffsetStringFor(n){return gt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=m(Instant,n);return 1e9*Me(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=uo()){const t=m(Instant,n);return go({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:m(Calendar2,e)})}getInstantFor(n,e){const t=Zn(e),o=m(PlainDateTime,n).getISOFields(),r=q(o),i=Me(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return Se(r-s,o)}getPossibleInstantsFor(n){const e=m(PlainDateTime,n).getISOFields(),t=q(e);let o=Me(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>Se(t-n,e)))}getPreviousTransition(n){const e=m(Instant,n),t=Me(this).getTransition(e.epochSeconds,-1);return t?Se(t[0]):null}getNextTransition(n){const e=m(Instant,n),t=Me(this).getTransition(e.epochSeconds,1);return t?Se(t[0]):null}toString(){return this.id}};function Se(n,e){return new Instant(BigInt(n)*S+(e?BigInt(e.isoMillisecond)*I+BigInt(e.isoMicrosecond)*M+BigInt(e.isoNanosecond):0n))}var Fe="(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?",Oe=`([+-])${Fe}`,De=`(Z|${Oe})?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?`,Ne=Ke(Oe),Te=Ke(Fe+De),Ye=Ke(`([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?([T ]${Fe})?`+De),be=Ke("(--)?(\\d{2})-?(\\d{2})?"+De),Ze=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Ee=/Z/i,Ce=/\u2212/g;function Ue(n){return{...n,calendar:void 0===n.calendar?uo():new Calendar2(n.calendar)}}function Pe(n){return{...Ue(n),timeZone:new TimeZone(n.timeZone)}}function Be(n){return ke(n)||Qe("dateTime",n)}function xe(n){return function(n){const e=Te.exec(n);if(e&&e[1])return $e(e.slice(1))}(n)||ke(n)||Qe("time",n)}function Re(n){return function(n){const e=Ze.exec(Je(n));if(e){let n,t,o,r;[n,r]=Le(e[8],e[10],5,void 0),[t,r]=Le(e[12],e[14],4,r),[o,r]=Le(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:Ge(e[2]),months:Ge(e[3]),weeks:Ge(e[4]),days:Ge(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=ut(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=Pt(i)),i}}(n)||Qe("duration",n)}function ke(n){const e=Ye.exec(Je(n));if(e){const n=Ee.test(e[10]);return{...(t=e.slice(1),{isoYear:We(t[0]),isoMonth:We(t[1]),isoDay:We(t[2])}),...$e(e.slice(5)),Z:n,offset:n?0:Ae(e.slice(11)),timeZone:e[18],calendar:e[20]}}var t}function je(n){const e=Ne.exec(Je(n));if(e)return Ae(e.slice(1))}function Le(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?qe(e)*(N[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/N[t]);return[n,o-n*N[t]]}return[void 0,void 0]}function He(n){return{isoYear:1972,isoMonth:We(n[2]),isoDay:We(n[3])}}function $e(n){const e=ze(n[2]);return{...at(ut(BigInt(qe(n[4]||"")),2)),isoHour:ze(n[0]),isoMinute:ze(n[1]),isoSecond:60===e?59:e}}function Ae(n){const e=n[0];if(void 0!==e&&n[1])return("+"===e?1:-1)*function(n){return 36e11*ze(n[0])+6e10*ze(n[1])+1e9*ze(n[2])+qe(n[4]||"")}(n.slice(1))}function qe(n){return parseInt(n.padEnd(9,"0"))}function ze(n){return parseInt(n||"0")}function We(n){return parseInt(n||"1")}function Ge(n){return void 0===n?void 0:parseInt(n)}function Je(n){return n.replace(Ce,"-")}function Ke(n){return new RegExp(`^${n}$`,"i")}function Qe(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}var PlainTime=class extends v{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...Xe({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:uo()})}static from(n,e){const o=u(e);return Ve(n instanceof PlainTime?n.getISOFields():"object"==typeof n?tt(t(n,yn),o):xe(String(n)))}static compare(n,e){return rt(m(PlainTime,n),m(PlainTime,e))}with(n,e){return Ve(tt(_e(a(n,yn),this),u(e)))}add(n){return nt(this,m(Duration,n))}subtract(n){return nt(this,m(Duration,n).negated())}until(n,e){return et(this,m(PlainTime,n),e)}since(n,e){return et(m(PlainTime,n),this,e)}round(n){return function(n,e){const t=R(e,void 0,0,5);return Ve(at(Kn(n,Vn(t),t.roundingMode)))}(this,n)}equals(n){return 0===rt(this,m(PlainTime,n))}toString(n){const e=In(n);return mt(at(Kn(this,e.roundingIncrement,e.roundingMode)),e)}toLocaleString(n,e){return new ue(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}).format(Number(it(this)/I))}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return m(PlainDate,n).toPlainDateTime(this)}};function Ve(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function Xe({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function _e(n,e){return f(yn,((t,o)=>n[o]??e[o]))}function nt(n,e){var t,o;return Ve(at((t=n,o=Et(e),st(it(t)+it(o)))))}function et(n,e,t){const o=k(t,5,0,0,5);return Tt(Qn(it(e)-it(n),o),o.largestUnit)}function tt(n,e){return Xe(at(n),e)}function ot(n){return m(PlainTime,n??{hour:0})}function rt(n,e){return j(it(n),it(e))}function it(n){return BigInt(n.hour)*O+BigInt(n.minute)*F+BigInt(n.second)*S+BigInt(n.millisecond)*I+BigInt(n.microsecond)*M+BigInt(n.nanosecond)}function st(n){const[e,t]=dt(n);return{...ut(t,5),day:Number(e/D)}}function at(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function ct(n){return BigInt(n.day)*D+it(n)}function ut(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(N[o]),r=n/e;n-=r*e,t[C[o]]=Number(r)}return t}function dt(n){const e=J(n);return[W(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*O+BigInt(t.isoMinute)*F+BigInt(t.isoSecond)*S+BigInt(t.isoMillisecond)*I+BigInt(t.isoMicrosecond)*M+BigInt(t.isoNanosecond))];var t}function ht(n,e){return ft(n)+"T"+mt(n,e)}function ft(n){return lt(n)+"-"+sn(n.isoDay,2)}function lt(n){const{isoYear:e}=n;return(e<1e3||e>9999?an(e)+sn(Math.abs(e),6):sn(e,4))+"-"+sn(n.isoMonth,2)}function mt(n,e){const t=[sn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(sn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(sn(n.isoSecond,2)+pt(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function gt(n){const e=ut(BigInt(Math.abs(n)),5),t=pt(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return an(n)+sn(e.hour,2)+":"+sn(e.minute,2)+(e.second||t?":"+sn(e.second,2)+t:"")}function yt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function wt(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function pt(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*M+BigInt(n)*I;r&&(s=H(s,void 0===o?N[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/S;let u=sn(Number(a-c*S),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}Nn(PlainTime,E);var[vt,Mt]=d(),Duration=class extends y{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),Mt(this,function(n){const e={};let t=0;for(const o of U){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return It("object"==typeof n?t(n,vn):Re(n))}static compare(n,e,t){return function(n,e,t){const o=m(Duration,n),r=m(Duration,e),i=bt(o),s=bt(r);if(void 0===t&&i&&s)return j(ct(i),ct(s));const a=Ct(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return vt(this).years}get months(){return vt(this).months}get weeks(){return vt(this).weeks}get days(){return vt(this).days}get hours(){return vt(this).hours}get minutes(){return vt(this).minutes}get seconds(){return vt(this).seconds}get milliseconds(){return vt(this).milliseconds}get microseconds(){return vt(this).microseconds}get nanoseconds(){return vt(this).nanoseconds}get sign(){return vt(this).sign}get blank(){return!this.sign}with(n){return It({...vt(this),...a(n,vn)})}negated(){return It(Pt(vt(this)))}abs(){return It(f(vt(this),(n=>Math.abs(n))))}add(n,e){return St(this,m(Duration,n),o(e).relativeTo)}subtract(n,e){return St(this,m(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=Nt(n),o=k(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=bt(n);if(void 0===e.relativeTo&&a&&Y(r)&&Y(s)){return Yt(ut(Qn(ct(a),o),r))}const c=Ut(e.relativeTo),u=Dt(n,r,c);return Jn(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=bt(n);if(void 0===t&&o&&Y(e))return Number(ct(o))/N[e];const r=Ut(t),i=Dt(n,e,r,!0);return Wn(i,e,r,r.add(i))[U[e]]}(this,x(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=In(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=pt(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+wt([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+wt([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(vt(this),e)}toLocaleString(n,e){return this.toString()}};function It(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function St(n,e,t){const o=bt(n),r=bt(e),i=Math.max(Nt(n),Nt(e));if(void 0===t&&o&&r)return Tt(ct(o)+ct(r),i);const s=Ct(t),a=s.add(n).add(e);return oe(s,a,i)}function Ft(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Ot(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:C[e]})}(n,Math.max(6,e),t):Dt(n,e,t)}function Dt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=oe(t,i,e);return r&&(s=Ft(s,new Duration(0,0,r))),s}function Nt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function Tt(n,e){return Yt(ut(n,e))}function Yt(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function bt(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...Et(n)}}function Zt(n){return new Duration(n.years,n.months,n.weeks,n.days)}function Et(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function Ct(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=Be(String(n));return void 0!==e.timeZone?_n(Pe(e),void 0,0):go(Ue(e))}}function Ut(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:m(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=ke(String(n));if(e)return void 0!==e.timeZone?_n(Pe(e),void 0,3):go(Ue(e));throw new RangeError("Invalid value of relativeTo")}function Pt(n){return f(n,(n=>-n||0))}function Bt(n,e,t,o){n=Rt(n=xt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=it(Et(n)),t=e/D;return[ut(e-t*D,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=_(r,7*i.weeks+i.days),K(r)}function xt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function Rt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function kt(n,e){return e?{...K(_(z(n),e)),calendar:n.calendar}:n}function jt(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function Lt(n,e){return{...$n(n,e),day:n.day??e.day}}function Ht(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function $t(n,e){const[t,o,r]=Ht(n.isoYear,n.isoMonth,n.isoDay,hn,e);return{isoYear:t,isoMonth:o,isoDay:r}}function At(n,e){return j(A(n.getISOFields()),A(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function qt(n,e){return j(n.year,e.year)||function(n,e){return j(n.month,e.month)||j(n.day,e.day)}(n,e)}function zt(n,e,t,o){return Jn(fo(n,e).dateUntil(n,e,{largestUnit:C[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends v{constructor(n,e,t,o=uo()){const r=$t({isoYear:n,isoMonth:e,isoDay:t},c);!function(n){const e=A(n);en(e+(e<0n?86399999999999n:0n))}(r),super({...r,calendar:m(Calendar2,o)})}static from(n,e){if(u(e),n instanceof PlainDate)return jt(n.getISOFields());if("object"==typeof n){const o=t(n,gn);return ho(n).dateFromFields(o,e)}return jt(Ue(Be(String(n))))}static compare(n,e){return At(m(PlainDate,n),m(PlainDate,e))}with(n,e){const t=Lt(a(n,gn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,m(Duration,n).negated(),e)}until(n,e){return zt(this,m(PlainDate,n),k(e,6,6,6,9))}since(n,e){return zt(this,m(PlainDate,n),k(e,6,6,6,9),!0)}equals(n){return 0===At(this,m(PlainDate,n))}toString(n){const e=ln(n),t=this.getISOFields();return ft(t)+yt(t.calendar.id,e)}toLocaleString(n,e){return le(this,n,{year:"numeric",month:"numeric",day:"numeric",...e,hour:void 0,minute:void 0,second:void 0})}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return go({...this.getISOFields(),...ot(n).getISOFields()})}toPlainYearMonth(){return Hn(this.getISOFields())}toPlainMonthDay(){return kn(this.getISOFields())}};function Wt(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function Gt(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(Wt(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=jt(n.getISOFields())}else o=PlainDate.from(n);return mo(o.calendar,e),o}function Jt(n,e,t){if(Wt(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:c}=n;if(void 0===i){if(void 0===r||void 0===o)throw new TypeError("Must specify either a year or an era & eraYear");i=e.convertEraYear(r,o,!0)}if(void 0!==a){const n=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");s=n}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");if(void 0===c)throw new TypeError("Must specify day");return[i,s,c]=Ht(i,s,c,e,u(t)),K(e.epochMilliseconds(i,s,c))}function Kt(n,e){if(Wt(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function Qt(n,e){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function Vt(n,e,t,o){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}Nn(PlainDate),bn(PlainDate,Yn);var Xt=class extends un{constructor(n){const e=_t(n);if(!function(n,e){const t=n.split("-"),o=e.split("-");return t[0]===o[0]}(n,e.resolvedOptions().calendar))throw new RangeError("Invalid calendar: "+n);super(n),this.format=e,this.yearCorrection=this.computeFields(0).year-1970,this.yearMonthCache={}}era(n,e,t){const o=G(n,e,t);return this.computeFields(o).era}eraYear(n,e,t){const o=G(n,e,t);return this.computeFields(o).eraYear}year(n,e,t){const o=G(n,e,t);return this.computeFields(o).year}month(n,e,t){const o=G(n,e,t);return this.computeFields(o).month}day(n,e,t){const o=G(n,e,t);return this.computeFields(o).day}epochMilliseconds(n,e,t){this.ensureYear(n);return _(this.yearMonthCache[n][e-1],t-1)}daysInMonth(n,e){const{yearMonthCache:t}=this;this.ensureYear(n);const o=t[n],r=o[e-1];e>=o.length&&(n++,e=0);return X(r,t[n][e])}monthsInYear(n){return this.ensureYear(n),this.yearMonthCache[n].length}inLeapYear(n){const e=Qt(this,n);return e>Qt(this,n-1)&&e>Qt(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const o=this.convertMonthCode(n,t);if(o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}ensureYear(n){const{yearMonthCache:e,yearCorrection:t}=this;if(!e[n]||!e[n+1]){let e=G(n-t);e=_(e,400),this.ensureDown(e,n)}}ensureDown(n,e){const{yearMonthCache:t}=this;let o=this.computeFields(n);for(let r=o.year;r>=e;r--){const e=t[r]||(t[r]=[]),i=e.length+1;for(let t=o.month;t>=i;t--)n=_(n,1-o.day),e[t-1]=n,n=_(n,-1),o=this.computeFields(n)}}computeFields(n){const e=Un(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);return e.era&&(t=Bn(e.era),o=r,r=this.convertEraYear(o,t)),{era:t,eraYear:o,year:r,month:this.parseMonth(e.month,r),day:parseInt(e.day)}}parseMonth(n,e){return parseInt(n)}};function _t(n){return new ue("en-US",{calendar:n,era:"short",year:"numeric",month:"numeric",day:"numeric",timeZone:"UTC"})}var no={Tishri:"M01",Heshvan:"M02",Kislev:"M03",Tevet:"M04",Shevat:"M05","Adar I":"M05L","Adar II":"M06",Adar:"M06",Nisan:"M07",Iyar:"M08",Sivan:"M09",Tamuz:"M10",Av:"M11",Elul:"M12"},eo=G(1868,9,8),to={gregory:fn,hebrew:class extends Xt{parseMonth(n,e){const t=parseInt(n);return isNaN(t)?this.convertMonthCode(no[n],e):t}monthCode(n,e){const t=this.inLeapYear(e)&&n>5;return super.monthCode(n-Number(t),e)+(t&&6===n?"L":"")}convertMonthCode(n,e){const t=super.convertMonthCode(n,e);return t+(n.match(/L$/)||this.inLeapYear(e)&&t>5?1:0)}inLeapYear(n){const e=this.monthsInYear(n);return e>this.monthsInYear(n-1)&&e>this.monthsInYear(n+1)}},japanese:class extends fn{constructor(){super(...arguments),this.format=_t("japanese")}era(n,e,t){const o=G(n,e,t);return o<eo?super.era(n,e,t):Bn(Un(this.format,o).era)}}},oo={iso8601:hn};function ro(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=Ht(e.year,n.month,n.day,t,0),i=qt(e,n),s=j(e.month,o)||j(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=xt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=qt(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=Ht(e.year,n.month,n.day,t,0);o+=e.month-s;const c=j(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=Rt(n,i,t,0)}return a=X(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function io(n,e,t){const o=7+e-t;return-$(nn(n,1,o)-e,7)+o-1}function so(n,e,t){const o=io(n,e,t),r=io(n+1,e,t);return(Qt(hn,n)-o+r)/7}var[ao,co]=d(),Calendar2=class extends g{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),co(this,function(n){const e=(n=String(n)).toLocaleLowerCase();return oo[e]||(oo[e]=new(to[e]||Xt)(n))}(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar2(String(n))}(n.calendar):n;const e=ke(String(n));return new Calendar2(e?e.calendar||"iso8601":n)}get id(){return ao(this).id}era(n){const e=Kt(n,!0);return ao(this).era(e.isoYear,e.isoMonth,e.isoDay)}eraYear(n){const e=Kt(n,!0);return ao(this).eraYear(e.isoYear,e.isoMonth,e.isoDay)}year(n){const e=Kt(n,!0);return ao(this).year(e.isoYear,e.isoMonth,e.isoDay)}month(n){const e=Kt(n,!0);return ao(this).month(e.isoYear,e.isoMonth,e.isoDay)}monthCode(n){const e=Gt(n,this);return ao(this).monthCode(e.month,e.year)}day(n){const e=Kt(n);return ao(this).day(e.isoYear,e.isoMonth,e.isoDay)}dayOfWeek(n){const e=Kt(n,!0);return nn(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=Gt(n,this,!0);return Vt(ao(this),e.year,e.month,e.day)}weekOfYear(n){const e=Kt(n,!0);return function(n,e,t,o,r){const i=io(n,o,r),s=Math.floor((Vt(hn,n,e,t)-i-1)/7)+1;if(s<1)return s+so(n-1,o,r);const a=so(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return Kt(n,!0),7}daysInMonth(n){const e=Gt(n,this,!0);return ao(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=Gt(n,this,!0);return Qt(ao(this),e.year)}monthsInYear(n){const e=Gt(n,this,!0);return ao(this).monthsInYear(e.year)}inLeapYear(n){return ao(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=Jt(n,ao(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=Jt({...n,day:1},ao(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=ao(this);let{era:o,eraYear:r,year:i,monthCode:s,day:a}=n;if(void 0===a)throw new TypeError("required property 'day' missing or undefined");void 0!==o&&void 0!==r&&(i=t.convertEraYear(r,o));let c=i;if(void 0===c){if(void 0===s)throw new TypeError("either year or monthCode required with month");c=t.guessYearForMonthDay(s,a)}const u=Jt({...n,year:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=ao(this),r=Bt(m(PlainDate,n,t),m(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=ao(this),i=m(PlainDate,n),s=m(PlainDate,e),a=x(o(t).largestUnit,6,6,9);return mo(fo(i,s),this),ro(i,s,r,a)}toString(){return this.id}};function uo(){return new Calendar2("iso8601")}function ho(n){return void 0===n.calendar?uo():m(Calendar2,n.calendar)}function fo(n,e){const{calendar:t}=n;return mo(t,e.calendar),t}function lo(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function mo(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends v{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=uo()){const h=po({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c);en(A(h)),super({...h,calendar:m(Calendar2,d)})}static from(n,e){const o=u(e);return go(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?yo(t(n,wn),e,o,ho(n)):Ue(Be(String(n))))}static compare(n,e){return vo(m(PlainDateTime,n),m(PlainDateTime,e))}with(n,e){return go(yo(wo(a(n,wn),this),e,u(e),this.calendar))}withPlainDate(n){const e=m(PlainDate,n);return go({...this.getISOFields(),...e.getISOFields(),calendar:lo(this,e)})}withPlainTime(n){return go({...this.getISOFields(),...ot(n).getISOFields()})}withCalendar(n){return go({...this.getISOFields(),calendar:m(Calendar2,n)})}add(n,e){return Mo(this,m(Duration,n),e)}subtract(n,e){return Mo(this,m(Duration,n).negated(),e)}until(n,e){return Io(this,m(PlainDateTime,n),e)}since(n,e){return Io(this,m(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=R(e,void 0,0,6);return So(n,Vn(t),t.roundingMode)}(this,n)}equals(n){return 0===vo(this,m(PlainDateTime,n))}toString(n){const e=In(n),t=ln(n),o=So(this,e.roundingIncrement,e.roundingMode).getISOFields();return ht(o,e)+yt(o.calendar.id,t)}toLocaleString(n,e){return le(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toZonedDateTime(n,e){const t=m(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return Hn(this.getISOFields())}toPlainMonthDay(){return kn(this.getISOFields())}toPlainDate(){return jt(this.getISOFields())}toPlainTime(){return Ve(this.getISOFields())}};function go(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function yo(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...tt(n,t)}}function wo(n,e){return{...Lt(n,e),..._e(n,e)}}function po(n,e){return{...$t(n,e),...Xe(n,e)}}function vo(n,e){return j(A(n.getISOFields()),A(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Mo(n,e,t){const{calendar:o}=n,r=Zt(e),i=Et(e);return go({...J(A(o.dateAdd(jt(n.getISOFields()),r,t).getISOFields())+it(n)+it(i)),calendar:o})}function Io(n,e,t,o){const r=k(t,6,0,0,9);return Jn(oe(n,e,r.largestUnit),r,n,e,o)}function So(n,e,t){const o=Kn(n,e,t);return go(Xn(n.getISOFields(),o))}function Fo(n,e){return j(n.epochNanoseconds,e.epochNanoseconds)}function Oo(n,e){if(Nt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+it(Et(e)))}function Do(n,e,t){const o=k(t,3,0,0,5,!0);return Tt(Qn(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}Nn(PlainDateTime,E),bn(PlainDateTime,Yn);var[No,To]=d(),Instant=class extends y{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&rn(),To(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=Be(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant(A(po(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*S)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*I)}static fromEpochMicroseconds(n){return new Instant(n*M)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Fo(m(Instant,n),m(Instant,e))}get epochNanoseconds(){return No(this)}add(n){return Oo(this,m(Duration,n))}subtract(n){return Oo(this,m(Duration,n).negated())}until(n,e){return Do(this,m(Instant,n),e)}since(n,e){return Do(m(Instant,n),this,e)}round(n){return function(n,e){const t=R(e,void 0,0,5,!1,!0),[o,r]=dt(n.epochNanoseconds);return new Instant(o+Qn(r,t))}(this,n)}equals(n){return 0===Fo(this,m(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toLocaleString(n,e){return new ue(n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e}).format(this.epochMilliseconds)}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function Yo(n){return Instant.fromEpochMilliseconds(n.valueOf())}function bo(n=Po()){return Uo().toZonedDateTimeISO(n)}function Zo(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return Uo().toZonedDateTime({calendar:n,timeZone:e??Po()})}function Eo(n=Po()){return bo(n).toPlainDateTime()}function Co(n,e){return Zo(n,e).toPlainDateTime()}function Uo(){return new Instant(BigInt(Date.now())*M)}function Po(){return new TimeZone((new ue).resolvedOptions().timeZone)}Fn(Instant);var Bo={zonedDateTimeISO:bo,zonedDateTime:Zo,plainDateTimeISO:Eo,plainDateTime:Co,plainDateISO:function(n=Po()){return Eo(n).toPlainDate()},plainDate:function(n,e){return Co(n,e).toPlainDate()},plainTimeISO:function(n=Po()){return Uo().toZonedDateTimeISO(n).toPlainTime()},instant:Uo,timeZone:Po};export{Calendar2 as Calendar,Duration,Instant,Bo as Now,ue as OrigDateTimeFormat,PlainDate,PlainDateTime,PlainMonthDay,PlainTime,PlainYearMonth,TimeZone,ZonedDateTime,Yo as dateToTemporalInstant,le as formatUnzoned,fe as formatZoned,he as normalizeIntlDateArg,de as normalizeIntlOptionalDateArg};
function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,f(e,(n=>({get:n}))))}function f(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function l(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}function m(n,e,...t){return e instanceof n?e:n.from(e,...t)}var g=class{toJSON(){return this.toString()}},y=class extends g{valueOf(){throw new Error("Cannot convert object using valueOf")}},[w,p]=d(),v=class extends y{constructor(n){super(),p(this,Object.freeze(n))}getISOFields(){return w(this)}},I=1000n,M=1000000n,S=1000000000n,F=60000000000n,O=3600000000000n,D=86400000000000n,b=[1,1e3,1e6,1e9,6e10,36e11,864e11],N=[9,6,3];function T(n){return n<=6}function Y(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),E=["nanosecond","microsecond","millisecond","second","minute","hour"],C=[...E,"day","week","month","year"],U=C.map((n=>n+"s")),B=l(C,((n,e)=>e)),P=l(U,((n,e)=>e));function R(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=B[n]??P[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function x(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=R(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*b[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?b[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*b[d]>=b[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function k(n,e,t,r,i,s,a){const c=x(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=R(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function j(n,e){return n<e?-1:n>e?1:0}function L(n){return j(n,0)}function q(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function H(n,e){return(n%e+e)%e}function $(n){return W(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function z(n){return Math.floor(A(n)/1e3)}function A(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function W(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*M+BigInt(a??0)*I+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,f,l=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;l<31;l++){h=u-d*l;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!tn(n)){f=n+d*l*864e5;break}}return(void 0===f||h<1||h>fn.daysInMonth(a,c))&&on(),m&&(f=new Date(f).setUTCFullYear(a)),f}function J(n){let e=n/M,t=Number(n-e*M);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...K(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function K(n){const[e,t]=en(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function Q(n){return en(1e3*n)[0].getUTCFullYear()}function V(n){return Math.floor(G(n)/1e3)}function X(n,e){return Math.round((e-n)/864e5)}function _(n,e){return n+864e5*e}function nn(n,e,t){const[o,r]=en(G(n,e,t));return H(o.getUTCDay()+r,7)||7}function en(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!tn(r)){t=r;break}}return void 0===t&&on(),[t,e*o]}function tn(n){return isNaN(n.valueOf())}function on(){throw new RangeError("Date outside of supported range")}function rn(n,e){return String(n).padStart(e,"0")}function sn(n){return n<0?"-":"+"}var an={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{beforeroc:-1,minguo:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},cn=class{constructor(n){this.id=n}monthCode(n,e){return"M"+rn(n,2)}convertMonthCode(n,e){const t=/L$/.test(n),o=parseInt(n.substr(1));if(t)throw new RangeError("Calendar system doesnt support leap months");return[o,!1]}};function un(n,e,t,o){let r=an[dn(n)]?.[t];if(void 0===r){if(!o)throw new Error("Unkown era "+t);r=0}return(r+e)*(L(r)||1)}function dn(n){return n.split("-")[0]}var hn=class extends cn{computeFields(n){const e=K(n);return{era:void 0,eraYear:void 0,year:e.isoYear,month:e.isoMonth,day:e.isoDay}}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},fn=new hn("iso8601"),ln=class extends hn{computeFields(n){const e=super.computeFields(n),{year:t}=e;return{...e,era:t<1?"bce":"ce",eraYear:t<1?-(t-1):t}}},mn=n("calendarName",{auto:0,never:1,always:2},0),gn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},yn={...gn,day:Number},wn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},pn={...yn,...wn},vn={...pn,offset:String},In=l(U,(()=>Number)),Mn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function Sn(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=R(i,void 0,0,t),d=b[u],a=N[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Fn=n("timeZoneName",{auto:0,never:1},0);function On(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/I},epochMilliseconds(){return Number(this.epochNanoseconds/M)},epochSeconds(){return Number(this.epochNanoseconds/S)}})}var Dn,bn={calendar:"calendar"};for(const n of C)bn[n]="iso"+((Dn=n).charAt(0).toUpperCase()+Dn.slice(1));function Nn(n,e=[]){h(n,l(e.concat("calendar"),(n=>function(){return this.getISOFields()[bn[n]]})))}var Tn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],Yn=[...Tn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function Zn(n,e){h(n,l(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var En=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0);var Cn=class{constructor(n){this.id=n}},Un=class extends Cn{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function Bn(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var Pn={bc:"bce",ad:"ce"};function Rn(n){return n=n.toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g,""),Pn[n]||n}var xn=n("offset",{auto:0,never:1},0);function kn(n,e){const t=$(n);jn(t),lo(t,e)}function jn(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&on()}var PlainMonthDay=class extends v{constructor(n,e,t=Io(),o){super({...At({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return qn(n.getISOFields());if("object"==typeof n){const o=So(n);let r=t(n,Ln);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=function(n){const e=Ce.exec(Ve(n));if(e)return{...ze(e),calendar:e[6]?new Calendar2(e[6]):Io()}}(r=String(n))||qe(r)||_e("monthDay",r);var r;return void 0===o.calendar&&(o.isoYear=1972),qn(Re(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Ln),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=m(PlainMonthDay,n),e.calendar.id===t.calendar.id&&$(e.getISOFields())===$(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?function(n){return rn(n.isoMonth,2)+"-"+rn(n.isoDay,2)}(e):gt(e))+vt(t,o)}toLocaleString(n,e){return ye(this,n,{month:"numeric",day:"numeric",...e,weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};Nn(PlainMonthDay),Zn(PlainMonthDay,["monthCode","day"]);var Ln={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function qn(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}var Hn={day:1},PlainYearMonth=class extends v{constructor(n,e,t=Io(),o=1){const r=At({isoYear:n,isoMonth:e,isoDay:o},c),i=m(Calendar2,t);var s,a;s=r,a=i.id,lo($(s),a),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return zn(n.getISOFields());if("object"==typeof n){const o=t(n,gn);return So(n).yearMonthFromFields(o,e)}const o=ke(String(n));return void 0===o.calendar&&(o.isoDay=1),zn(Re(o))}static compare(n,e){return Wn(m(PlainYearMonth,n),m(PlainYearMonth,e))}with(n,e){const t=a(n,gn);return this.calendar.yearMonthFromFields(An(t,this),e)}add(n,e){return $n(this,m(Duration,n),e)}subtract(n,e){return $n(this,m(Duration,n).negated(),e)}until(n,e){return Jt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9))}since(n,e){return Jt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9),!0)}equals(n){return 0===Wn(this,m(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?yt(e):gt(e))+vt(t,o)}toLocaleString(n,e){return ye(this,n,{year:"numeric",month:"numeric",...e,weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function $n(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function zn(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function An(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function Wn(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}Nn(PlainYearMonth),Zn(PlainYearMonth,Tn);var[Gn,Jn]=d(),ZonedDateTime=class extends v{constructor(n,e,t=Io()){const o=m(TimeZone,e),r=m(Calendar2,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i),a=J(n+BigInt(s));kn(a,r.id),super({...a,calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),Jn(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Mn(e,3),r=u(e);return te(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?oe(t(n,vn),e,r,So(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return m(TimeZone,n.timeZone)}(n)):xe(ke(String(n))),e,o)}static compare(n,e){return j(m(ZonedDateTime,n).epochNanoseconds,m(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return Gn(this).epochNanoseconds}get offsetNanoseconds(){return Gn(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,vn),o={...To(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Mn(e,0),c=u(e);return En(e),te(oe(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=m(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,Oo(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return re(this,m(Duration,n),e)}subtract(n,e){return re(this,m(Duration,n).negated(),e)}until(n,e){return ie(this,m(ZonedDateTime,n),e)}since(n,e){return ie(this,m(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=ct(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,de(n),t.roundingMode);return bo(ee(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return he(n,ne(t),t.roundingMode)}(this,n)}equals(n){const e=m(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return te({...this.getISOFields(),...ue,offset:void 0},void 0,3)}get hoursInDay(){return de(this)/36e11}toString(n){const e=Sn(n),t=xn(n),o=Fn(n),r=mn(n),i=he(this,e.roundingIncrement,e.roundingMode).getISOFields();return mt(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+vt(i.calendar.id,r)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDateTime(){return bo(this.getISOFields())}toPlainDate(){return Ht(this.getISOFields())}toPlainTime(){return nt(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Kn(n,e,t,o){const r=U[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=U[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=Qn(c),h=Qn(u),f=Qn(o),l=Number(f-d)/Number(h-d)*i;return s[r]+=l,s}function Qn(n){const{epochNanoseconds:e}=n;return void 0!==e?e:$(n.getISOFields())}function Vn(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!Y(i))return Zt(_n((ce(o)-ce(t))*(r?-1n:1n),e),i);let u=Kn(n,s,t,o);const d=U[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=xt(u)),c!==Math.round&&h();let f=Ot(u);return s>0&&(f=r?Nt(f.negated(),i,t).negated():Nt(f,i,t)),f}function Xn(n,e,t){return ut(q(ct(n),e,t))}function _n(n,e){return q(n,ne(e),e.roundingMode)}function ne(n){return b[n.smallestUnit]*n.roundingIncrement}function ee(n,e){return{...qt(n,e.day),...dt(e)}}function te(n,e,t){const{calendar:o,timeZone:r,offset:i,Z:s}=n;let a;if(void 0!==i&&2!==t&&(a=$(n)-BigInt(i),1!==t&&!s)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(a,r.getPossibleInstantsFor(bo(n)))){if(3===t)throw new RangeError("Mismatching offset/timezone");a=void 0}}return void 0===a&&(a=r.getInstantFor(bo(n),e).epochNanoseconds),new ZonedDateTime(a,r,o)}function oe(n,e,t,o,r){return{...No(n,e,t,o),timeZone:r,offset:n.offset?(i=n.offset,He(i)??_e("timeZone",i)):void 0};var i}function re(n,e,t){const{calendar:o,timeZone:r}=n,i=Ut(e),s=Bt(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=ct(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function ie(n,e,t,o){const r=k(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return Vn(se(n,e,i),r,n,e,o)}function se(n,e,t){const o=Fo(n,e);if(!Y(t))return ae(n,e,t);const r=Ht(n.getISOFields());let i,s,a,c,u,d=Ht(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:C[t]}),i=n.add(s),a=ae(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return bt(s,a)}function ae(n,e,t){return Zt(ce(e)-ce(n),t)}function ce(n){return n instanceof PlainDateTime?$(n.getISOFields()):n.epochNanoseconds}Nn(ZonedDateTime,E),Zn(ZonedDateTime,Yn),On(ZonedDateTime);var ue={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function de(n){const e={...n.getISOFields(),...ue,offset:void 0},t=te(e,void 0,3),o=te({...e,...qt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function he(n,e,t){return te({...Uo(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}var fe=Intl.DateTimeFormat;function le(n){return void 0===n?n:me(n)}function me(n){return"number"==typeof n||n instanceof Date?n:n instanceof Instant||n instanceof ZonedDateTime?n.epochMilliseconds:A(n.getISOFields())}function ge(n,e,t){const o=n.getISOFields(),r=o.calendar.id,i=o.timeZone.id,{timeZone:s}=t;if(void 0!==s&&s!==i)throw new RangeError("Given timeZone must agree");return we(n.epochMilliseconds,r,e,{timeZone:i,timeZoneName:"short",...t})}function ye(n,e,t,o){const r=n.getISOFields(),i=r.calendar.id;let s,{timeZone:a}=t;if(void 0!==a){const e=new TimeZone(a),t=bo({...ue,...n.getISOFields()});s=e.getInstantFor(t).epochMilliseconds}else s=A(r),a="UTC";return we(s,i,e,{...t,timeZone:a,timeZoneName:void 0},o)}function we(n,e,t,o,r){const i=new fe(t,{calendar:pe(t)?void 0:e,...o});if((r||"iso8601"!==e)&&e!==i.resolvedOptions().calendar)throw new RangeError("Non-iso calendar mismatch");return i.format(n)}function pe(n){const e=[].concat(n||[]);for(const n of e)if(-1!==n.indexOf("-u-ca-"))return!0;return!1}var ve={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},Ie=[182,91,273],Me=class extends Cn{constructor(n){const e=new fe("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=ve[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(Q(n))]}getOffset(n){const e=Bn(this.format,1e3*n);let t=parseInt(e.year);"bce"===Rn(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=Q(n);for(let o=0;o<5;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(j(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(V(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=V(n)-1,r=V(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of Ie){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},Se={UTC:new Un("UTC",0)};var[Fe,Oe]=d(),TimeZone=class extends g{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),Oe(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(Se[e])return Se[e];const t=He(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new Un(pt(t),Math.trunc(t/1e9))}return Se[e]=new Me(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=qe(String(n));return new TimeZone(e&&(e.timeZone||e.Z&&"UTC"||void 0!==e.offset&&pt(e.offset))||n)}get id(){return Fe(this).id}getOffsetStringFor(n){return pt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=m(Instant,n);return 1e9*Fe(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=Io()){const t=m(Instant,n);return bo({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:m(Calendar2,e)})}getInstantFor(n,e){const t=En(e),o=m(PlainDateTime,n).getISOFields(),r=z(o),i=Fe(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return De(r-s,o)}getPossibleInstantsFor(n){const e=m(PlainDateTime,n).getISOFields(),t=z(e);let o=Fe(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>De(t-n,e)))}getPreviousTransition(n){const e=m(Instant,n),t=Fe(this).getTransition(e.epochSeconds,-1);return t?De(t[0]):null}getNextTransition(n){const e=m(Instant,n),t=Fe(this).getTransition(e.epochSeconds,1);return t?De(t[0]):null}toString(){return this.id}};function De(n,e){return new Instant(BigInt(n)*S+(e?BigInt(e.isoMillisecond)*M+BigInt(e.isoMicrosecond)*I+BigInt(e.isoNanosecond):0n))}var be="(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?",Ne=`([+-])${be}`,Te=`(Z|${Ne})?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?`,Ye=Xe(Ne),Ze=Xe(be+Te),Ee=Xe(`([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?([T ]${be})?`+Te),Ce=Xe("(--)?(\\d{2})-?(\\d{2})?"+Te),Ue=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Be=/Z/i,Pe=/\u2212/g;function Re(n){return{...n,calendar:void 0===n.calendar?Io():new Calendar2(n.calendar)}}function xe(n){return{...Re(n),timeZone:new TimeZone(n.timeZone)}}function ke(n){return qe(n)||_e("dateTime",n)}function je(n){return function(n){const e=Ze.exec(n);if(e&&e[1])return Ae(e.slice(1))}(n)||qe(n)||_e("time",n)}function Le(n){return function(n){const e=Ue.exec(Ve(n));if(e){let n,t,o,r;[n,r]=$e(e[8],e[10],5,void 0),[t,r]=$e(e[12],e[14],4,r),[o,r]=$e(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:Qe(e[2]),months:Qe(e[3]),weeks:Qe(e[4]),days:Qe(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=ft(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=xt(i)),i}}(n)||_e("duration",n)}function qe(n){const e=Ee.exec(Ve(n));if(e){const n=Be.test(e[10]);return{...(t=e.slice(1),{isoYear:Ke(t[0]),isoMonth:Ke(t[1]),isoDay:Ke(t[2])}),...Ae(e.slice(5)),Z:n,offset:n?0:We(e.slice(11)),timeZone:e[18],calendar:e[20]}}var t}function He(n){const e=Ye.exec(Ve(n));if(e)return We(e.slice(1))}function $e(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?Ge(e)*(b[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/b[t]);return[n,o-n*b[t]]}return[void 0,void 0]}function ze(n){return{isoYear:1972,isoMonth:Ke(n[2]),isoDay:Ke(n[3])}}function Ae(n){const e=Je(n[2]);return{...dt(ft(BigInt(Ge(n[4]||"")),2)),isoHour:Je(n[0]),isoMinute:Je(n[1]),isoSecond:60===e?59:e}}function We(n){const e=n[0];if(void 0!==e&&n[1])return("+"===e?1:-1)*function(n){return 36e11*Je(n[0])+6e10*Je(n[1])+1e9*Je(n[2])+Ge(n[4]||"")}(n.slice(1))}function Ge(n){return parseInt(n.padEnd(9,"0"))}function Je(n){return parseInt(n||"0")}function Ke(n){return parseInt(n||"1")}function Qe(n){return void 0===n?void 0:parseInt(n)}function Ve(n){return n.replace(Pe,"-")}function Xe(n){return new RegExp(`^${n}$`,"i")}function _e(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}var PlainTime=class extends v{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...et({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:Io()})}static from(n,e){const o=u(e);return nt(n instanceof PlainTime?n.getISOFields():"object"==typeof n?it(t(n,wn),o):je(String(n)))}static compare(n,e){return at(m(PlainTime,n),m(PlainTime,e))}with(n,e){return nt(it(tt(a(n,wn),this),u(e)))}add(n){return ot(this,m(Duration,n))}subtract(n){return ot(this,m(Duration,n).negated())}until(n,e){return rt(this,m(PlainTime,n),e)}since(n,e){return rt(m(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return nt(dt(Xn(n,ne(t),t.roundingMode)))}(this,n)}equals(n){return 0===at(this,m(PlainTime,n))}toString(n){const e=Sn(n);return wt(dt(Xn(this,e.roundingIncrement,e.roundingMode)),e)}toLocaleString(n,e){return new fe(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}).format(Number(ct(this)/M))}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return m(PlainDate,n).toPlainDateTime(this)}};function nt(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function et({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function tt(n,e){return f(wn,((t,o)=>n[o]??e[o]))}function ot(n,e){var t,o;return nt(dt((t=n,o=Bt(e),ut(ct(t)+ct(o)))))}function rt(n,e,t){const o=k(t,5,0,0,5);return Zt(_n(ct(e)-ct(n),o),o.largestUnit)}function it(n,e){return et(dt(n),e)}function st(n){return m(PlainTime,n??{hour:0})}function at(n,e){return j(ct(n),ct(e))}function ct(n){return BigInt(n.hour)*O+BigInt(n.minute)*F+BigInt(n.second)*S+BigInt(n.millisecond)*M+BigInt(n.microsecond)*I+BigInt(n.nanosecond)}function ut(n){const[e,t]=lt(n);return{...ft(t,5),day:Number(e/D)}}function dt(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function ht(n){return BigInt(n.day)*D+ct(n)}function ft(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(b[o]),r=n/e;n-=r*e,t[C[o]]=Number(r)}return t}function lt(n){const e=J(n);return[W(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*O+BigInt(t.isoMinute)*F+BigInt(t.isoSecond)*S+BigInt(t.isoMillisecond)*M+BigInt(t.isoMicrosecond)*I+BigInt(t.isoNanosecond))];var t}function mt(n,e){return gt(n)+"T"+wt(n,e)}function gt(n){return yt(n)+"-"+rn(n.isoDay,2)}function yt(n){const{isoYear:e}=n;return(e<1e3||e>9999?sn(e)+rn(Math.abs(e),6):rn(e,4))+"-"+rn(n.isoMonth,2)}function wt(n,e){const t=[rn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(rn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(rn(n.isoSecond,2)+Mt(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function pt(n){const e=ft(BigInt(Math.abs(n)),5),t=Mt(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return sn(n)+rn(e.hour,2)+":"+rn(e.minute,2)+(e.second||t?":"+rn(e.second,2)+t:"")}function vt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function It(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function Mt(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*I+BigInt(n)*M;r&&(s=q(s,void 0===o?b[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/S;let u=rn(Number(a-c*S),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}Nn(PlainTime,E);var[St,Ft]=d(),Duration=class extends y{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),Ft(this,function(n){const e={};let t=0;for(const o of U){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Ot("object"==typeof n?t(n,In):Le(n))}static compare(n,e,t){return function(n,e,t){const o=m(Duration,n),r=m(Duration,e),i=Ct(o),s=Ct(r);if(void 0===t&&i&&s)return j(ht(i),ht(s));const a=Pt(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return St(this).years}get months(){return St(this).months}get weeks(){return St(this).weeks}get days(){return St(this).days}get hours(){return St(this).hours}get minutes(){return St(this).minutes}get seconds(){return St(this).seconds}get milliseconds(){return St(this).milliseconds}get microseconds(){return St(this).microseconds}get nanoseconds(){return St(this).nanoseconds}get sign(){return St(this).sign}get blank(){return!this.sign}with(n){return Ot({...St(this),...a(n,In)})}negated(){return Ot(xt(St(this)))}abs(){return Ot(f(St(this),(n=>Math.abs(n))))}add(n,e){return Dt(this,m(Duration,n),o(e).relativeTo)}subtract(n,e){return Dt(this,m(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=Yt(n),o=k(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=Ct(n);if(void 0===e.relativeTo&&a&&T(r)&&T(s)){return Et(ft(_n(ht(a),o),r))}const c=Rt(e.relativeTo),u=Tt(n,r,c);return Vn(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=Ct(n);if(void 0===t&&o&&T(e))return Number(ht(o))/b[e];const r=Rt(t),i=Tt(n,e,r,!0);return Kn(i,e,r,r.add(i))[U[e]]}(this,R(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=Sn(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=Mt(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+It([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+It([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(St(this),e)}toLocaleString(n,e){return this.toString()}};function Ot(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function Dt(n,e,t){const o=Ct(n),r=Ct(e),i=Math.max(Yt(n),Yt(e));if(void 0===t&&o&&r)return Zt(ht(o)+ht(r),i);const s=Pt(t),a=s.add(n).add(e);return se(s,a,i)}function bt(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Nt(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:C[e]})}(n,Math.max(6,e),t):Tt(n,e,t)}function Tt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=se(t,i,e);return r&&(s=bt(s,new Duration(0,0,r))),s}function Yt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function Zt(n,e){return Et(ft(n,e))}function Et(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Ct(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...Bt(n)}}function Ut(n){return new Duration(n.years,n.months,n.weeks,n.days)}function Bt(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function Pt(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=ke(String(n));return void 0!==e.timeZone?te(xe(e),void 0,0):bo(Re(e))}}function Rt(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:m(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=qe(String(n));if(e)return void 0!==e.timeZone?te(xe(e),void 0,3):bo(Re(e));throw new RangeError("Invalid value of relativeTo")}function xt(n){return f(n,(n=>-n||0))}function kt(n,e,t,o){n=Lt(n=jt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=ct(Bt(n)),t=e/D;return[ft(e-t*D,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=_(r,7*i.weeks+i.days),K(r)}function jt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function Lt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function qt(n,e){return e?{...K(_(A(n),e)),calendar:n.calendar}:n}function Ht(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function $t(n,e){return{...An(n,e),day:n.day??e.day}}function zt(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function At(n,e){const[t,o,r]=zt(n.isoYear,n.isoMonth,n.isoDay,fn,e);return{isoYear:t,isoMonth:o,isoDay:r}}function Wt(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Gt(n,e){return j(n.year,e.year)||function(n,e){return j(n.month,e.month)||j(n.day,e.day)}(n,e)}function Jt(n,e,t,o){return Vn(Fo(n,e).dateUntil(n,e,{largestUnit:C[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends v{constructor(n,e,t,o=Io()){const r=At({isoYear:n,isoMonth:e,isoDay:t},c),i=m(Calendar2,o);!function(n,e){const t=$(n);jn(t+(t<0n?86399999999999n:0n)),lo(t,e)}(r,i.id),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainDate)return Ht(n.getISOFields());if("object"==typeof n){const o=t(n,yn);return So(n).dateFromFields(o,e)}return Ht(Re(ke(String(n))))}static compare(n,e){return Wt(m(PlainDate,n),m(PlainDate,e))}with(n,e){const t=$t(a(n,yn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,m(Duration,n).negated(),e)}until(n,e){return Jt(this,m(PlainDate,n),k(e,6,6,6,9))}since(n,e){return Jt(this,m(PlainDate,n),k(e,6,6,6,9),!0)}equals(n){return 0===Wt(this,m(PlainDate,n))}toString(n){const e=mn(n),t=this.getISOFields();return gt(t)+vt(t.calendar.id,e)}toLocaleString(n,e){return ye(this,n,{year:"numeric",month:"numeric",day:"numeric",...e,hour:void 0,minute:void 0,second:void 0})}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return bo({...this.getISOFields(),...st(n).getISOFields()})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}};function Kt(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function Qt(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(Kt(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=Ht(n.getISOFields())}else o=PlainDate.from(n);return Do(o.calendar,e),o}function Vt(n,e,t){if(Kt(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:d}=n;const h=void 0!==r&&void 0!==o?un(e.id,r,o):void 0;if(void 0===i){if(void 0===h)throw new TypeError("Must specify either a year or an era & eraYear");i=h}else if(void 0!==h&&h!==i)throw new RangeError("year and era/eraYear must match");if(void 0===d)throw new TypeError("Must specify day");const f=u(t);if(void 0!==a){const[n,t]=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");if(s=n,t){if(f===c)throw new RangeError("Month code out of range");d=e.daysInMonth(i,s)}}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");return[i,s,d]=zt(i,s,d,e,f),K(e.epochMilliseconds(i,s,d))}function Xt(n,e){if(Kt(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function _t(n,e){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function no(n,e,t,o){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}Nn(PlainDate),Zn(PlainDate,Yn);var eo={hebrew:6,chinese:0,dangi:0},to=class extends cn{constructor(n){const e=oo(n);if(t=n,o=e.resolvedOptions().calendar,dn(t)!==dn(o))throw new RangeError("Invalid calendar: "+n);var t,o;super(n),this.format=e,this.yearCorrection=this.computeFieldsDumb(0).year-1970,this.monthCacheByYear={}}epochMilliseconds(n,e,t){return _(this.queryMonthCache(n)[0][e-1],t-1)}daysInMonth(n,e){const t=this.queryMonthCache(n)[0],o=t[e-1];e>=t.length&&(n++,e=0);return X(o,this.queryMonthCache(n)[0][e])}monthsInYear(n){return this.queryMonthCache(n)[0].length}monthCode(n,e){const t=this.queryLeapMonthByYear(e);return!t||n<t?super.monthCode(n,e):super.monthCode(n-1,e)+(n===t?"L":"")}convertMonthCode(n,e){const t=this.queryLeapMonthByYear(e);let o=/L$/.test(n),r=parseInt(n.substr(1)),i=!1;if(o){const n=eo[this.id];if(void 0===n)throw new RangeError("Calendar system doesnt support leap months");if(n){if(r!==n-1)throw new RangeError("Invalid leap-month month code")}else if(r<=1||r>=12)throw new RangeError("Invalid leap-month month code")}return!o||t&&r===t-1||(i=!0,o=!1),(o||t&&r>=t)&&r++,[r,i]}inLeapYear(n){const e=_t(this,n);return e>_t(this,n-1)&&e>_t(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const[o,r]=this.convertMonthCode(n,t);if(!r&&o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}computeFields(n){const e=this.computeFieldsDumb(n),t=this.queryMonthCache(e.year)[2];return{...e,month:t[e.month]}}computeFieldsDumb(n){const e=Bn(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);var i;return e.era&&(i=this.id,void 0!==an[dn(i)])&&(t=Rn(e.era),o=r,r=un(this.id,o,t,!0)),{era:t,eraYear:o,year:r,month:e.month,day:parseInt(e.day)}}queryLeapMonthByYear(n){const e=this.queryMonthCache(n),t=this.queryMonthCache(n-1),o=this.queryMonthCache(n+1);if(e[0].length>t[0].length&&e[0].length>o[0].length){const n=e[1],o=t[1];for(let e=0;e<o.length;e++)if(o[e]!==n[e])return e+1}}queryMonthCache(n){const{monthCacheByYear:e}=this;return e[n]||(e[n]=this.buildMonthCache(n))}buildMonthCache(n){const e=[],t=[],o={};let r=G(this.guessISOYear(n));for(r=_(r,400);;){const o=this.computeFieldsDumb(r);if(o.year<n)break;r=_(r,1-o.day),o.year===n&&(e.unshift(r),t.unshift(o.month)),r=_(r,-1)}for(let n=0;n<t.length;n++)o[t[n]]=n+1;return[e,t,o]}guessISOYear(n){return n-this.yearCorrection}};function oo(n){return new fe("en-US",{calendar:n,era:"short",year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}var ro=G(1868,9,8),io={gregory:ln,japanese:class extends ln{constructor(){super(...arguments),this.format=oo("japanese")}computeFields(n){const e=super.computeFields(n);if(n>=ro){const t=Bn(this.format,n);e.era=Rn(t.era),e.eraYear=parseInt(t.relatedYear||t.year)}return e}},islamic:class extends to{guessISOYear(n){return Math.ceil(32*n/33+622)}}},so={iso8601:fn};function ao(n){const e=(n=String(n)).toLocaleLowerCase();return so[e]||(so[e]=new(io[dn(e)]||to)(n))}var co=G(1582,10,15),uo=G(622,7,18),ho={buddhist:co,japanese:co,roc:co,islamic:uo,"islamic-rgsa":uo,indian:0},fo={};function lo(n,e){return mo(Number(n/M),e)}function mo(n,e){if(function(n,e){return function(n){let e=fo[n];if(void 0===e){const t=ho[n];if(void 0===t)e=!1;else{let o=ao(n);o instanceof to||(o=new to(n));const r=t-864e5,i=o.computeFields(r);e=r!==o.epochMilliseconds(i.year,i.month,i.day)}fo[n]=e}return e}(e)&&n<ho[e]}(n,e))throw new RangeError("Invalid timestamp for calendar")}function go(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=zt(e.year,n.month,n.day,t,0),i=Gt(e,n),s=j(e.month,o)||j(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=jt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=Gt(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=zt(e.year,n.month,n.day,t,0);o+=e.month-s;const c=j(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=Lt(n,i,t,0)}return a=X(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function yo(n,e,t){const o=7+e-t;return-H(nn(n,1,o)-e,7)+o-1}function wo(n,e,t){const o=yo(n,e,t),r=yo(n+1,e,t);return(_t(fn,n)-o+r)/7}var[po,vo]=d(),Calendar2=class extends g{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),vo(this,ao(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar2(String(n))}(n.calendar):n;const e=qe(String(n));return new Calendar2(e?e.calendar||"iso8601":n)}get id(){return po(this).id}era(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).era}eraYear(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).eraYear}year(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).year}month(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).month}monthCode(n){const e=Qt(n,this);return po(this).monthCode(e.month,e.year)}day(n){const e=Xt(n);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).day}dayOfWeek(n){const e=Xt(n,!0);return nn(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=Qt(n,this,!0);return no(po(this),e.year,e.month,e.day)}weekOfYear(n){const e=Xt(n,!0);return function(n,e,t,o,r){const i=yo(n,o,r),s=Math.floor((no(fn,n,e,t)-i-1)/7)+1;if(s<1)return s+wo(n-1,o,r);const a=wo(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return Xt(n,!0),7}daysInMonth(n){const e=Qt(n,this,!0);return po(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=Qt(n,this,!0);return _t(po(this),e.year)}monthsInYear(n){const e=Qt(n,this,!0);return po(this).monthsInYear(e.year)}inLeapYear(n){return po(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=Vt(n,po(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=Vt({...n,day:1},po(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=po(this);let{era:o,eraYear:r,year:i,monthCode:s,day:a}=n;if(void 0===a)throw new TypeError("required property 'day' missing or undefined");void 0!==o&&void 0!==r&&(i=un(t.id,r,o));let c=i;if(void 0===c){if(void 0===s)throw new TypeError("either year or monthCode required with month");c=t.guessYearForMonthDay(s,a)}const u=Vt({...n,year:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=po(this),r=kt(m(PlainDate,n,t),m(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=po(this),i=m(PlainDate,n),s=m(PlainDate,e),a=R(o(t).largestUnit,6,6,9);return Do(Fo(i,s),this),go(i,s,r,a)}toString(){return this.id}};function Io(){return new Calendar2("iso8601")}function Mo(n,e,t,o){const r=G(e,t,o);return mo(r,n.id),n.computeFields(r)}function So(n){return void 0===n.calendar?Io():m(Calendar2,n.calendar)}function Fo(n,e){const{calendar:t}=n;return Do(t,e.calendar),t}function Oo(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function Do(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends v{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=Io()){const h=Yo({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c),f=m(Calendar2,d);kn(h,f.id),super({...h,calendar:f})}static from(n,e){const o=u(e);return bo(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?No(t(n,pn),e,o,So(n)):Re(ke(String(n))))}static compare(n,e){return Zo(m(PlainDateTime,n),m(PlainDateTime,e))}with(n,e){return bo(No(To(a(n,pn),this),e,u(e),this.calendar))}withPlainDate(n){const e=m(PlainDate,n);return bo({...this.getISOFields(),...e.getISOFields(),calendar:Oo(this,e)})}withPlainTime(n){return bo({...this.getISOFields(),...st(n).getISOFields()})}withCalendar(n){return bo({...this.getISOFields(),calendar:m(Calendar2,n)})}add(n,e){return Eo(this,m(Duration,n),e)}subtract(n,e){return Eo(this,m(Duration,n).negated(),e)}until(n,e){return Co(this,m(PlainDateTime,n),e)}since(n,e){return Co(this,m(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return Uo(n,ne(t),t.roundingMode)}(this,n)}equals(n){return 0===Zo(this,m(PlainDateTime,n))}toString(n){const e=Sn(n),t=mn(n),o=Uo(this,e.roundingIncrement,e.roundingMode).getISOFields();return mt(o,e)+vt(o.calendar.id,t)}toLocaleString(n,e){return ye(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toZonedDateTime(n,e){const t=m(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDate(){return Ht(this.getISOFields())}toPlainTime(){return nt(this.getISOFields())}};function bo(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function No(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...it(n,t)}}function To(n,e){return{...$t(n,e),...tt(n,e)}}function Yo(n,e){return{...At(n,e),...et(n,e)}}function Zo(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Eo(n,e,t){const{calendar:o}=n,r=Ut(e),i=Bt(e);return bo({...J($(o.dateAdd(Ht(n.getISOFields()),r,t).getISOFields())+ct(n)+ct(i)),calendar:o})}function Co(n,e,t,o){const r=k(t,6,0,0,9);return Vn(se(n,e,r.largestUnit),r,n,e,o)}function Uo(n,e,t){const o=Xn(n,e,t);return bo(ee(n.getISOFields(),o))}function Bo(n,e){return j(n.epochNanoseconds,e.epochNanoseconds)}function Po(n,e){if(Yt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+ct(Bt(e)))}function Ro(n,e,t){const o=k(t,3,0,0,5,!0);return Zt(_n(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}Nn(PlainDateTime,E),Zn(PlainDateTime,Yn);var[xo,ko]=d(),Instant=class extends y{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&on(),ko(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=ke(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant($(Yo(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*S)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*M)}static fromEpochMicroseconds(n){return new Instant(n*I)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Bo(m(Instant,n),m(Instant,e))}get epochNanoseconds(){return xo(this)}add(n){return Po(this,m(Duration,n))}subtract(n){return Po(this,m(Duration,n).negated())}until(n,e){return Ro(this,m(Instant,n),e)}since(n,e){return Ro(m(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[o,r]=lt(n.epochNanoseconds);return new Instant(o+_n(r,t))}(this,n)}equals(n){return 0===Bo(this,m(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toLocaleString(n,e){return new fe(n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e}).format(this.epochMilliseconds)}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function jo(n){return Instant.fromEpochMilliseconds(n.valueOf())}function Lo(n=Ao()){return zo().toZonedDateTimeISO(n)}function qo(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return zo().toZonedDateTime({calendar:n,timeZone:e??Ao()})}function Ho(n=Ao()){return Lo(n).toPlainDateTime()}function $o(n,e){return qo(n,e).toPlainDateTime()}function zo(){return new Instant(BigInt(Date.now())*M)}function Ao(){return new TimeZone((new fe).resolvedOptions().timeZone)}On(Instant);var Wo={zonedDateTimeISO:Lo,zonedDateTime:qo,plainDateTimeISO:Ho,plainDateTime:$o,plainDateISO:function(n=Ao()){return Ho(n).toPlainDate()},plainDate:function(n,e){return $o(n,e).toPlainDate()},plainTimeISO:function(n=Ao()){return zo().toZonedDateTimeISO(n).toPlainTime()},instant:zo,timeZone:Ao};export{Calendar2 as Calendar,Duration,Instant,Wo as Now,fe as OrigDateTimeFormat,PlainDate,PlainDateTime,PlainMonthDay,PlainTime,PlainYearMonth,TimeZone,ZonedDateTime,jo as dateToTemporalInstant,ye as formatUnzoned,ge as formatZoned,me as normalizeIntlDateArg,le as normalizeIntlOptionalDateArg};
//# sourceMappingURL=impl.js.map
{
"name": "temporal-polyfill",
"version": "0.0.3",
"version": "0.0.4",
"title": "Temporal Polyfill",

@@ -5,0 +5,0 @@ "description": "A spec-compliant Temporal JavaScript polyfill in less than 15kb",

@@ -8,3 +8,7 @@

[Codepen](https://codepen.io/arshaw/pen/VwrMQPJ?editors=1111)
[CDN link](https://cdn.jsdelivr.net/npm/temporal-polyfill@0.0.3/dist/global.js)
## Installation

@@ -35,3 +39,3 @@

The above techniques try using the built-in `Temporal` object and fall back to the polyfill.
**C)** The above techniques try using the built-in `Temporal` object and fall back to the polyfill.
To guarantee using the polyfill, do this:

@@ -38,0 +42,0 @@

@@ -5,2 +5,18 @@ import { numSign } from '../utils/math'

export interface CalendarImplFields { // like DateFields, but without monthCode
era: string | undefined
eraYear: number | undefined
year: number
month: number
day: number
}
export interface CalendarImplFieldsDumb { // like CalendarImplFields, but with month string
era: string | undefined
eraYear: number | undefined
year: number,
month: string,
day: number
}
export abstract class CalendarImpl {

@@ -11,15 +27,5 @@ constructor(

era(_isoYear: number, _isoMonth: number, _isoDay: number): string | undefined {
return undefined
}
eraYear(_isoYear: number, _isoMonth: number, _isoDay: number): number | undefined {
return undefined
}
// ISO -> Calendar-dependent
abstract year(isoYear: number, isoMonth: number, isoDay: number): number
abstract month(isoYear: number, isoMonth: number, isoDay: number): number
abstract day(isoYear: number, isoMonth: number, isoDay: number): number
abstract computeFields(epochMilli: number): CalendarImplFields

@@ -43,21 +49,47 @@ // Calendar-dependent computation

// not responsible for constraining
convertMonthCode(monthCode: string, _year: number): number {
return parseInt(monthCode.substr(1)) // chop off 'M'
// TODO: throw error when not starting with M?
convertMonthCode(monthCode: string, _year: number): [
number, // month
boolean, // unusedLeap (a valid 'L', but not used in this year)
] {
// TODO: more DRY
const monthCodeIsLeap = /L$/.test(monthCode)
const monthCodeInt = parseInt(monthCode.substr(1)) // chop off 'M'
if (monthCodeIsLeap) {
throw new RangeError('Calendar system doesnt support leap months') // TODO: more DRY
}
return [monthCodeInt, false]
}
}
// eraYear -> year
convertEraYear(eraYear: number, era: string, errorUnknownEra?: boolean): number {
let origin = eraOrigins[this.id]?.[era]
// eraYear -> year
export function convertEraYear(
calendarID: string,
eraYear: number,
era: string,
fromDateTimeFormat?: boolean,
): number {
let origin = eraOrigins[getCalendarIDBase(calendarID)]?.[era]
if (origin === undefined) {
if (errorUnknownEra) {
throw new Error('Unkown era ' + era)
} else {
origin = 0
}
if (origin === undefined) {
if (fromDateTimeFormat) {
origin = 0
} else {
throw new Error('Unkown era ' + era)
}
}
// see the origin format in the config file
return (origin + eraYear) * (numSign(origin) || 1)
}
// see the origin format in the config file
return (origin + eraYear) * (numSign(origin) || 1)
}
// TODO: somehow combine with convertEraYear
export function hasEras(calendarID: string): boolean {
return eraOrigins[getCalendarIDBase(calendarID)] !== undefined
}
export function getCalendarIDBase(calendarID: string): string {
return calendarID.split('-')[0]
}

@@ -1,5 +0,5 @@

import { CalendarImpl } from './calendarImpl'
import { CalendarImpl, getCalendarIDBase } from './calendarImpl'
import { GregoryCalendarImpl } from './gregoryCalendarImpl'
import { HebrewCalendarImpl } from './hebrewCalendarImpl'
import { IntlCalendarImpl } from './intlCalendarImpl'
import { IslamicCalendarImpl } from './islamicCalendarImpl'
import { isoCalendarID, isoCalendarImpl } from './isoCalendarImpl'

@@ -10,4 +10,4 @@ import { JapaneseCalendarImpl } from './japaneseCalendarImpl'

gregory: GregoryCalendarImpl,
hebrew: HebrewCalendarImpl,
japanese: JapaneseCalendarImpl,
islamic: IslamicCalendarImpl,
}

@@ -24,3 +24,6 @@

return implCache[key] ||
(implCache[key] = new (implClasses[key] || IntlCalendarImpl)(id))
(implCache[key] = new (
implClasses[getCalendarIDBase(key)] ||
IntlCalendarImpl
)(id))
}

@@ -27,3 +27,3 @@

roc: {
'before-roc': -1,
beforeroc: -1,
minguo: 0,

@@ -34,2 +34,11 @@ },

},
islamic: {
ah: 0,
},
indian: {
saka: 0,
},
persian: {
ap: 0,
},
japanese: {

@@ -36,0 +45,0 @@ bce: -1,

@@ -0,1 +1,2 @@

import { CalendarImplFields } from './calendarImpl'
import { ISOCalendarImpl } from './isoCalendarImpl'

@@ -6,9 +7,11 @@

export class GregoryCalendarImpl extends ISOCalendarImpl {
era(isoYear: number, _isoMonth: number, _isoDay: number): string {
return isoYear < 1 ? 'bce' : 'ce'
computeFields(epochMilli: number): CalendarImplFields {
const fields = super.computeFields(epochMilli)
const { year } = fields
return {
...fields,
era: year < 1 ? 'bce' : 'ce',
eraYear: year < 1 ? -(year - 1) : year,
}
}
eraYear(isoYear: number, _isoMonth: number, _isoDay: number): number {
return isoYear < 1 ? -(isoYear - 1) : isoYear
}
}

@@ -10,12 +10,31 @@ import { computeDaysInYear } from '../dateUtils/calendar'

import { OrigDateTimeFormat } from '../native/intl'
import { CalendarImpl } from './calendarImpl'
import {
CalendarImpl,
CalendarImplFields,
CalendarImplFieldsDumb,
convertEraYear,
getCalendarIDBase,
hasEras,
} from './calendarImpl'
type MonthCache = [
number[], // epochMillis
string[], // monthStrs
{ [monthStr: string]: number }, // monthStrToNum (value is 1-based)
]
const calLeapMonths: { [cal: string]: number } = {
hebrew: 6, // consistent month
chinese: 0, // zero implies variable month
dangi: 0, // "
}
export class IntlCalendarImpl extends CalendarImpl {
private format: Intl.DateTimeFormat
// difference between iso year numbers and the calendar's
// difference between iso year numbers and the calendar's at 1980
private yearCorrection: number
// epochMilli starting points for each month
private yearMonthCache: { [year: string]: number[] }
private monthCacheByYear: { [year: string]: MonthCache }

@@ -31,37 +50,10 @@ constructor(id: string) {

this.format = format
this.yearCorrection = this.computeFields(0).year - isoEpochOriginYear
this.yearMonthCache = {}
this.yearCorrection = this.computeFieldsDumb(0).year - isoEpochOriginYear
this.monthCacheByYear = {}
}
era(isoYear: number, isoMonth: number, isoDay: number): string | undefined {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
return this.computeFields(epochMilli).era
}
eraYear(isoYear: number, isoMonth: number, isoDay: number): number | undefined {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
return this.computeFields(epochMilli).eraYear
}
year(isoYear: number, isoMonth: number, isoDay: number): number {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
return this.computeFields(epochMilli).year
}
month(isoYear: number, isoMonth: number, isoDay: number): number {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
return this.computeFields(epochMilli).month
}
day(isoYear: number, isoMonth: number, isoDay: number): number {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
return this.computeFields(epochMilli).day
}
epochMilliseconds(year: number, month: number, day: number): number {
this.ensureYear(year)
const epochMillis = this.queryMonthCache(year)[0]
const marker = epochMillis[month - 1]
// will be start-of-month
const marker = this.yearMonthCache[year][month - 1]
// move to correct day-of-month

@@ -72,11 +64,8 @@ return addDaysMilli(marker, day - 1)

daysInMonth(year: number, month: number): number {
const { yearMonthCache } = this
this.ensureYear(year)
const epochMillis = this.queryMonthCache(year)[0]
const startMarker = epochMillis[month - 1]
const monthCache = yearMonthCache[year]
const startMarker = monthCache[month - 1]
// The `month` variable, which is 1-based, should now be considered an index for `monthCache`
// It is +1 from the previous index, used to compute the `endMarker`
if (month >= monthCache.length) {
if (month >= epochMillis.length) {
year++

@@ -86,6 +75,3 @@ month = 0

// In the case month was incremented above,
// `ensureCacheForYear` guarantees the next year is at least partially populated
const endMarker = yearMonthCache[year][month]
const endMarker = this.queryMonthCache(year)[0][month]
return diffDaysMilli(startMarker, endMarker)

@@ -95,6 +81,59 @@ }

monthsInYear(year: number): number {
this.ensureYear(year)
return this.yearMonthCache[year].length
const epochMillis = this.queryMonthCache(year)[0]
return epochMillis.length
}
// month -> monthCode
monthCode(month: number, year: number): string {
const leapMonth = this.queryLeapMonthByYear(year)
if (!leapMonth || month < leapMonth) {
return super.monthCode(month, year)
}
return super.monthCode(month - 1, year) +
(month === leapMonth ? 'L' : '')
}
// monthCode -> month
convertMonthCode(monthCode: string, year: number): [number, boolean] {
const leapMonth = this.queryLeapMonthByYear(year) // 0 if none
// TODO: more DRY
let monthCodeIsLeap = /L$/.test(monthCode)
let monthCodeInt = parseInt(monthCode.substr(1)) // chop off 'M'
let unusedLeap = false
// validate the leap-month
if (monthCodeIsLeap) {
const presetLeapMonth = calLeapMonths[this.id] // TODO: use base ID?
if (presetLeapMonth === undefined) {
throw new RangeError('Calendar system doesnt support leap months')
}
if (presetLeapMonth) {
if (monthCodeInt !== presetLeapMonth - 1) {
throw new RangeError('Invalid leap-month month code')
}
} else { // variable leap months (HACK: hardcoded for chinese/dangi)
if (monthCodeInt <= 1 || monthCodeInt >= 12) {
throw new RangeError('Invalid leap-month month code')
}
}
}
if (monthCodeIsLeap && !(leapMonth && monthCodeInt === leapMonth - 1)) {
unusedLeap = true
monthCodeIsLeap = false // yuck
}
if (monthCodeIsLeap || (leapMonth && monthCodeInt >= leapMonth)) {
monthCodeInt++
}
return [monthCodeInt, unusedLeap]
}
// TODO: look at number of months too?
inLeapYear(year: number): boolean {

@@ -111,4 +150,6 @@ const days = computeDaysInYear(this, year)

for (; year < maxYear; year++) {
const month = this.convertMonthCode(monthCode, year)
const [month, unusedLeap] = this.convertMonthCode(monthCode, year)
if (
!unusedLeap &&
month <= this.monthsInYear(year) &&

@@ -121,3 +162,3 @@ day <= this.daysInMonth(year, month)

throw new Error('Could not guess year') // TODO: better
throw new Error('Could not guess year') // TODO: better error
}

@@ -129,48 +170,14 @@

private ensureYear(year: number): void {
const { yearMonthCache, yearCorrection } = this
computeFields(epochMilli: number): CalendarImplFields {
const dumbFields = this.computeFieldsDumb(epochMilli)
const monthStrToNum = this.queryMonthCache(dumbFields.year)[2]
// since the yearCache is guaranteed to populate an entire year and extra month(s) into the
// next year, if two consecutive years are filled, the first year is guaranteed to be populated.
if (!yearMonthCache[year] || !yearMonthCache[year + 1]) {
// either part-way through the desired year or very slighly before
let epochMilli = isoToEpochMilli(year - yearCorrection)
// ensure marker is in year+1
epochMilli = addDaysMilli(epochMilli, 400)
// will populate the downward until (and including) year
this.ensureDown(epochMilli, year)
return {
...dumbFields,
month: monthStrToNum[dumbFields.month],
}
}
// guarantees cache is populated all the way down (and including) to floorYear
private ensureDown(epochMilli: number, floorYear: number) {
const { yearMonthCache } = this
let fields = this.computeFields(epochMilli)
for (let y = fields.year; y >= floorYear; y--) {
const monthCache = yearMonthCache[y] || (yearMonthCache[y] = [])
const floorMonth = monthCache.length + 1
// as we move down to lower months, don't recompute months we already computed (floorMonth)
for (let m = fields.month; m >= floorMonth; m--) {
// move to start-of-month
epochMilli = addDaysMilli(epochMilli, 1 - fields.day)
monthCache[m - 1] = epochMilli
// move to last day of previous month
epochMilli = addDaysMilli(epochMilli, -1)
fields = this.computeFields(epochMilli)
}
}
}
protected computeFields(epochMilli: number): {
era: string | undefined,
eraYear: number | undefined,
year: number,
month: number,
day: number
} {
// returns a *string* month, not numeric
private computeFieldsDumb(epochMilli: number): CalendarImplFieldsDumb {
const partHash = hashIntlFormatParts(this.format, epochMilli)

@@ -181,6 +188,6 @@ let era: string | undefined

if (partHash.era) {
if (partHash.era && hasEras(this.id)) {
era = normalizeShortEra(partHash.era)
eraYear = year
year = this.convertEraYear(eraYear, era)
year = convertEraYear(this.id, eraYear, era, true) // fromDateTimeFormat=true
}

@@ -192,3 +199,3 @@

year,
month: this.parseMonth(partHash.month, year),
month: partHash.month,
day: parseInt(partHash.day),

@@ -198,5 +205,80 @@ }

protected parseMonth(monthStr: string, _year: number): number {
return parseInt(monthStr)
// the month number (1-based) that the leap-month falls on
// for example, the '3bis' leap month would fall on `4`
// TODO: cache somehow?
private queryLeapMonthByYear(year: number): number | undefined {
const currentCache = this.queryMonthCache(year)
const prevCache = this.queryMonthCache(year - 1)
const nextCache = this.queryMonthCache(year + 1)
// in a leap year?
// TODO: consolidate with inLeapYear?
if (
currentCache[0].length > prevCache[0].length &&
currentCache[0].length > nextCache[0].length
) {
const currentMonthStrs = currentCache[1]
const prevMonthStrs = prevCache[1]
for (let i = 0; i < prevMonthStrs.length; i++) {
if (prevMonthStrs[i] !== currentMonthStrs[i]) {
return i + 1 // convert to 1-based
}
}
}
return undefined
}
private queryMonthCache(year: number): MonthCache {
const { monthCacheByYear } = this
return monthCacheByYear[year] ||
(monthCacheByYear[year] = this.buildMonthCache(year))
}
private buildMonthCache(year: number): MonthCache {
const epochMillis: number[] = []
const monthStrs: string[] = []
const monthStrToNum: { [monthStr: string]: number } = {}
// either part-way through the desired year or very slightly before
let epochMilli = isoToEpochMilli(this.guessISOYear(year))
// ensure marker is in year+1
epochMilli = addDaysMilli(epochMilli, 400)
// move epochMilli into past through each month
while (true) {
const fields = this.computeFieldsDumb(epochMilli)
// stop if month went too far into past
if (fields.year < year) {
break
}
// move to start-of-month
epochMilli = addDaysMilli(epochMilli, 1 - fields.day)
// only record the epochMilli if NOT in future year
if (fields.year === year) {
epochMillis.unshift(epochMilli)
monthStrs.unshift(fields.month)
}
// move to last day of previous month
epochMilli = addDaysMilli(epochMilli, -1)
}
for (let i = 0; i < monthStrs.length; i++) {
monthStrToNum[monthStrs[i]] = i + 1
}
return [epochMillis, monthStrs, monthStrToNum]
}
// subclasses that override should round UP
protected guessISOYear(year: number): number {
return year - this.yearCorrection
}
}

@@ -211,3 +293,3 @@

year: 'numeric',
month: 'numeric',
month: 'short', // easier to identify monthCodes
day: 'numeric',

@@ -221,5 +303,3 @@ timeZone: 'UTC',

function isRelatedCalendar(specificCalendarID: string, relatedCalendarID: string): boolean {
const parts0 = specificCalendarID.split('-')
const parts1 = relatedCalendarID.split('-')
return parts0[0] === parts1[0]
return getCalendarIDBase(specificCalendarID) === getCalendarIDBase(relatedCalendarID)
}

@@ -1,17 +0,16 @@

import { isoEpochLeapYear, isoToEpochMilli } from '../dateUtils/isoMath'
import { CalendarImpl } from './calendarImpl'
import { epochMilliToISOFields, isoEpochLeapYear, isoToEpochMilli } from '../dateUtils/isoMath'
import { CalendarImpl, CalendarImplFields } from './calendarImpl'
export class ISOCalendarImpl extends CalendarImpl {
year(isoYear: number): number {
return isoYear
computeFields(epochMilli: number): CalendarImplFields {
const fields = epochMilliToISOFields(epochMilli)
return {
era: undefined,
eraYear: undefined,
year: fields.isoYear,
month: fields.isoMonth,
day: fields.isoDay,
}
}
month(_isoYear: number, isoMonth: number): number {
return isoMonth
}
day(_isoYear: number, _isoMonth: number, isoDay: number): number {
return isoDay
}
epochMilliseconds(year: number, month: number, day: number): number {

@@ -18,0 +17,0 @@ return isoToEpochMilli(year, month, day)

import { hashIntlFormatParts, normalizeShortEra } from '../dateUtils/intlFormat'
import { isoToEpochMilli } from '../dateUtils/isoMath'
import { CalendarImplFields } from './calendarImpl'
import { GregoryCalendarImpl } from './gregoryCalendarImpl'

@@ -11,3 +12,2 @@ import { buildFormat } from './intlCalendarImpl'

but has era names that are Japanese after a certain point.
FYI, IntlCalendarImpl would have trouble parsing era/eraYears before this point.
*/

@@ -17,10 +17,13 @@ export class JapaneseCalendarImpl extends GregoryCalendarImpl {

era(isoYear: number, isoMonth: number, isoDay: number): string {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
return epochMilli < primaryEraMilli
? super.era(isoYear, isoMonth, isoDay)
: normalizeShortEra(hashIntlFormatParts(this.format, epochMilli).era)
computeFields(epochMilli: number): CalendarImplFields {
const fields = super.computeFields(epochMilli)
if (epochMilli >= primaryEraMilli) {
const partHash = hashIntlFormatParts(this.format, epochMilli)
fields.era = normalizeShortEra(partHash.era)
fields.eraYear = parseInt(partHash.relatedYear || partHash.year) // TODO: more DRY w/ intl
}
return fields
}
// TODO: implement eraYear as well
}
import { ensureCalendarsEqual } from '../argParse/calendar'
import { parseOverflowOption } from '../argParse/overflowHandling'
import { CalendarImpl } from '../calendarImpl/calendarImpl'
import { OVERFLOW_REJECT, parseOverflowOption } from '../argParse/overflowHandling'
import { CalendarImpl, convertEraYear } from '../calendarImpl/calendarImpl'
import { Calendar } from '../public/calendar'

@@ -72,17 +72,42 @@ import { PlainDate } from '../public/plainDate'

let { era, eraYear, year, month, monthCode, day } = dateLike as Partial<DateFields>
const yearFromEra = (eraYear !== undefined && era !== undefined)
? convertEraYear(calendarImpl.id, eraYear, era)
: undefined
if (year === undefined) {
if (eraYear === undefined || era === undefined) {
if (yearFromEra !== undefined) {
year = yearFromEra
} else {
throw new TypeError('Must specify either a year or an era & eraYear')
} else {
year = calendarImpl.convertEraYear(eraYear, era, true) // errorUnknownEra=true
}
} else {
if (yearFromEra !== undefined) {
if (yearFromEra !== year) {
throw new RangeError('year and era/eraYear must match')
}
}
}
if (day === undefined) {
throw new TypeError('Must specify day')
}
const overflow = parseOverflowOption(options)
if (monthCode !== undefined) {
const m = calendarImpl.convertMonthCode(monthCode, year)
if (month !== undefined && month !== m) {
const [tryMonth, unusedLeap] = calendarImpl.convertMonthCode(monthCode, year)
if (month !== undefined && month !== tryMonth) {
throw new RangeError('Month doesnt match with monthCode')
}
month = m
month = tryMonth
if (unusedLeap) {
if (overflow === OVERFLOW_REJECT) {
throw new RangeError('Month code out of range')
}
// constrain to last day of month
day = calendarImpl.daysInMonth(year, month)
}
} else if (month === undefined) {

@@ -92,10 +117,6 @@ throw new TypeError('Must specify either a month or monthCode')

if (day === undefined) {
throw new TypeError('Must specify day')
}
[year, month, day] = constrainDateFields(
year, month, day,
calendarImpl,
parseOverflowOption(options),
overflow,
)

@@ -102,0 +123,0 @@

@@ -24,8 +24,9 @@

export function normalizeShortEra(formattedEra: string): string {
// Example 'Before R.O.C.' -> 'before-roc'
formattedEra = formattedEra.toLowerCase()
.replace(/[^a-z0-9]g/, '')
.replace(/ /g, '-')
// Example 'Before R.O.C.' -> 'beforeroc'
formattedEra = formattedEra
.toLowerCase()
.normalize('NFD') // break apart accents, for 'Shōwa' -> 'Showa'
.replace(/[^a-z0-9]/g, '')
return eraRemap[formattedEra] || formattedEra
}

@@ -5,3 +5,2 @@ import { isoCalendarImpl } from '../calendarImpl/isoCalendarImpl'

import { numSign, positiveModulo } from '../utils/math'
import { DateISOEssentials } from './date'
import {

@@ -211,60 +210,2 @@ milliInDay,

// Validation
/*
Extreme valid inputs
Legacy Date
Date.UTC(-271821, 4 - 1, 20, 0, 0, 0, 0)
Date.UTC(275760, 9 - 1, 13, 0, 0, 0, 0)
Instant
Temporal.Instant.fromEpochMilliseconds(Date.UTC(-271821, 4 - 1, 20, 0, 0, 0, 0))
Temporal.Instant.fromEpochMilliseconds(Date.UTC(275760, 9 - 1, 13, 0, 0, 0, 0))
PlainDateTime
new Temporal.PlainDateTime(-271821, 4, 19, 0, 0, 0, 0, 0, 1).toString()
new Temporal.PlainDateTime(275760, 9, 13, 23, 59, 59, 999, 999, 999).toString()
PlainDate
new Temporal.PlainDate(-271821, 4, 19).toString()
new Temporal.PlainDate(275760, 9, 13).toString()
PlainYearMonth
new Temporal.PlainYearMonth(-271821, 4).toString()
new Temporal.PlainYearMonth(275760, 9).toString()
*/
export function validateYearMonth(isoFields: DateISOEssentials): void {
// might throw an error
// moves between days in month
isoFieldsToEpochNano(isoFields)
}
export function validateDate(isoFields: DateISOEssentials): void {
const nano = isoFieldsToEpochNano(isoFields)
validatePlain(
// if potentially very negative, measure last nanosecond of day
// to increase changes it's in-bounds
nano + (nano < 0n ? 86399999999999n : 0n),
)
}
export function validateDateTime(isoFields: DateTimeISOEssentials): void {
validatePlain(isoFieldsToEpochNano(isoFields))
}
export function validateInstant(epochNano: bigint): void {
if (
epochNano < -8640000000000000000000n ||
epochNano > 8640000000000000000000n
) {
throwOutOfRange()
}
}
export function validatePlain(epochNano: bigint): void {
// like validateInstant's bounds, but expanded 24:59:59.999999999
if (
epochNano < -8640000086399999999999n ||
epochNano > 8640000086399999999999n
) {
throwOutOfRange()
}
}
function nudgeToLegacyDate(epochMilli: number): [Date, number] {

@@ -297,4 +238,4 @@ const sign = numSign(epochMilli)

function throwOutOfRange() {
export function throwOutOfRange(): void {
throw new RangeError('Date outside of supported range')
}

@@ -10,3 +10,4 @@ import {

import { parseUnit } from '../argParse/unitStr'
import { CalendarImpl } from '../calendarImpl/calendarImpl'
import { checkEpochMilliBuggy } from '../calendarImpl/bugs'
import { CalendarImpl, CalendarImplFields, convertEraYear } from '../calendarImpl/calendarImpl'
import { queryCalendarImpl } from '../calendarImpl/calendarImplQuery'

@@ -24,3 +25,3 @@ import { isoCalendarID } from '../calendarImpl/isoCalendarImpl'

import { diffDateFields } from '../dateUtils/diff'
import { computeISODayOfWeek } from '../dateUtils/isoMath'
import { computeISODayOfWeek, isoToEpochMilli } from '../dateUtils/isoMath'
import { MonthDayFields } from '../dateUtils/monthDay'

@@ -55,3 +56,3 @@ import { tryParseDateTimeISO } from '../dateUtils/parse'

if (id === 'islamicc') { // deprecated
if (id === 'islamicc') { // deprecated... TODO: use conversion map
id = 'islamic-civil'

@@ -83,7 +84,8 @@ }

const isoFields = getExistingDateISOFields(arg, true) // disallowMonthDay=true
return getImpl(this).era(
return isoToEpochNanoSafe(
getImpl(this),
isoFields.isoYear,
isoFields.isoMonth,
isoFields.isoDay,
)
).era
}

@@ -93,7 +95,8 @@

const isoFields = getExistingDateISOFields(arg, true) // disallowMonthDay=true
return getImpl(this).eraYear(
return isoToEpochNanoSafe(
getImpl(this),
isoFields.isoYear,
isoFields.isoMonth,
isoFields.isoDay,
)
).eraYear
}

@@ -103,7 +106,8 @@

const isoFields = getExistingDateISOFields(arg, true) // disallowMonthDay=true
return getImpl(this).year(
return isoToEpochNanoSafe(
getImpl(this),
isoFields.isoYear,
isoFields.isoMonth,
isoFields.isoDay,
)
).year
}

@@ -113,7 +117,8 @@

const isoFields = getExistingDateISOFields(arg, true) // disallowMonthDay=true
return getImpl(this).month(
return isoToEpochNanoSafe(
getImpl(this),
isoFields.isoYear,
isoFields.isoMonth,
isoFields.isoDay,
)
).month
}

@@ -128,7 +133,8 @@

const isoFields = getExistingDateISOFields(arg)
return getImpl(this).day(
return isoToEpochNanoSafe(
getImpl(this),
isoFields.isoYear,
isoFields.isoMonth,
isoFields.isoDay,
)
).day
}

@@ -213,3 +219,3 @@

if (era !== undefined && eraYear !== undefined) {
year = impl.convertEraYear(eraYear, era) // maybe do errorOnUnknown???
year = convertEraYear(impl.id, eraYear, era)
}

@@ -273,1 +279,15 @@

}
// utils
// TODO: can we eliminate this now that it's checked in public date classes?
function isoToEpochNanoSafe(
calendarImpl: CalendarImpl,
isoYear: number,
isoMonth: number,
isoDay: number,
): CalendarImplFields {
const epochMilli = isoToEpochMilli(isoYear, isoMonth, isoDay)
checkEpochMilliBuggy(epochMilli, calendarImpl.id)
return calendarImpl.computeFields(epochMilli)
}

@@ -6,3 +6,4 @@ import { OVERFLOW_REJECT } from '../argParse/overflowHandling'

import { addToInstant, compareInstants, diffInstants, roundInstant } from '../dateUtils/instant'
import { isoFieldsToEpochNano, validateInstant } from '../dateUtils/isoMath'
import { validateInstant } from '../dateUtils/isoFieldValidation'
import { isoFieldsToEpochNano } from '../dateUtils/isoMath'
import { ComputedEpochFields, mixinEpochFields } from '../dateUtils/mixins'

@@ -9,0 +10,0 @@ import { parseDateTimeISO } from '../dateUtils/parse'

@@ -1,2 +0,2 @@

import { nanoInMicroBI } from '../dateUtils/units'
import { nanoInMilliBI } from '../dateUtils/units'
import { OrigDateTimeFormat } from '../native/intl'

@@ -46,3 +46,3 @@ import { Instant } from './instant'

function getInstant(): Instant {
return new Instant(BigInt(Date.now()) * nanoInMicroBI)
return new Instant(BigInt(Date.now()) * nanoInMilliBI)
}

@@ -49,0 +49,0 @@

@@ -16,4 +16,4 @@ import { extractCalendar } from '../argParse/calendar'

import { createDateTime } from '../dateUtils/dateTime'
import { validateDate } from '../dateUtils/isoFieldValidation'
import { formatCalendarID, formatDateISO } from '../dateUtils/isoFormat'
import { validateDate } from '../dateUtils/isoMath'
import {

@@ -62,6 +62,9 @@ DateCalendarFields,

const constrained = constrainDateISO({ isoYear, isoMonth, isoDay }, OVERFLOW_REJECT)
validateDate(constrained)
const calendar = ensureObj(Calendar, calendarArg)
validateDate(constrained, calendar.id)
super({
...constrained,
calendar: ensureObj(Calendar, calendarArg),
calendar,
})

@@ -68,0 +71,0 @@ }

@@ -21,4 +21,4 @@ import { extractCalendar, getStrangerCalendar } from '../argParse/calendar'

} from '../dateUtils/dateTime'
import { validateDateTime } from '../dateUtils/isoFieldValidation'
import { formatCalendarID, formatDateTimeISO } from '../dateUtils/isoFormat'
import { validateDateTime } from '../dateUtils/isoMath'
import {

@@ -86,6 +86,9 @@ DateCalendarFields,

}, OVERFLOW_REJECT)
validateDateTime(constrained)
const calendar = ensureObj(Calendar, calendarArg)
validateDateTime(constrained, calendar.id)
super({
...constrained,
calendar: ensureObj(Calendar, calendarArg),
calendar,
})

@@ -92,0 +95,0 @@ }

@@ -10,4 +10,4 @@ import { extractCalendar } from '../argParse/calendar'

import { constrainDateISO, diffDates } from '../dateUtils/date'
import { validateYearMonth } from '../dateUtils/isoFieldValidation'
import { formatCalendarID, formatDateISO, formatYearMonthISO } from '../dateUtils/isoFormat'
import { validateYearMonth } from '../dateUtils/isoMath'
import {

@@ -59,6 +59,9 @@ YearMonthCalendarFields,

}, OVERFLOW_REJECT)
validateYearMonth(constrained)
const calendar = ensureObj(Calendar, calendarArg)
validateYearMonth(constrained, calendar.id)
super({
...constrained,
calendar: ensureObj(Calendar, calendarArg),
calendar,
})

@@ -65,0 +68,0 @@ }

@@ -16,2 +16,3 @@ import { extractCalendar, getStrangerCalendar } from '../argParse/calendar'

import { createDateTime } from '../dateUtils/dateTime'
import { validateDateTime } from '../dateUtils/isoFieldValidation'
import { formatCalendarID, formatDateTimeISO, formatTimeZoneID } from '../dateUtils/isoFormat'

@@ -90,7 +91,10 @@ import { epochNanoToISOFields } from '../dateUtils/isoMath'

const calendar = ensureObj(Calendar, calendarArg)
const instant = new Instant(epochNanoseconds)
const instant = new Instant(epochNanoseconds) // will do validation
const offsetNanoseconds = timeZone.getOffsetNanosecondsFor(instant)
const isoFields = epochNanoToISOFields(epochNanoseconds + BigInt(offsetNanoseconds))
validateDateTime(isoFields, calendar.id)
super({
...epochNanoToISOFields(epochNanoseconds + BigInt(offsetNanoseconds)),
...isoFields,
calendar,

@@ -97,0 +101,0 @@ timeZone,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc