@christtrade/depth 0.12.23 → 0.12.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ var Pe=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var Qr=Object.prototype.hasOwnProperty;var Kr=(n,e,t)=>e in n?Pe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ei=(n,e)=>{for(var t in e)Pe(n,t,{get:e[t],enumerable:!0})},ti=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xr(e))!Qr.call(n,i)&&i!==t&&Pe(n,i,{get:()=>e[i],enumerable:!(r=Jr(e,i))||r.enumerable});return n};var ni=n=>ti(Pe({},"__esModule",{value:!0}),n);var I=(n,e,t)=>Kr(n,typeof e!="symbol"?e+"":e,t);var Ho={};ei(Ho,{DEFAULT_STRATEGY_CONFIG:()=>Qt,DataLevel:()=>Gt,ExitReason:()=>Jt,Layout:()=>jt,PluginType:()=>Ht,SCRIPT_DSL:()=>Xt,STDLIB:()=>oe,STDLIB_SIGNATURE:()=>Yo,StrategyEngine:()=>st,axisValues:()=>ot,buildScriptScope:()=>Gr,checkSweepBudget:()=>$r,defaultStrategyDraw:()=>Uo,evalScriptInScope:()=>Zo,expandGrid:()=>Br,parameterStability:()=>Yr,pickBest:()=>Hr,planWalkForward:()=>Zr,splitIndex:()=>_r,walkForwardEfficiency:()=>Ur});module.exports=ni(Ho);var U=class extends Error{},St=class extends U{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Tt=class extends U{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},kt=class extends U{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},J=class extends U{},Ue=class extends U{constructor(e){super(`Invalid unit ${e}`)}},M=class extends U{},_=class extends U{constructor(){super("Zone is an abstract class")}},h="numeric",B="short",A="long",Ye={year:h,month:h,day:h},Rn={year:h,month:B,day:h},ri={year:h,month:B,day:h,weekday:B},Pn={year:h,month:A,day:h},qn={year:h,month:A,day:h,weekday:A},Vn={hour:h,minute:h},zn={hour:h,minute:h,second:h},Bn={hour:h,minute:h,second:h,timeZoneName:B},$n={hour:h,minute:h,second:h,timeZoneName:A},_n={hour:h,minute:h,hourCycle:"h23"},Zn={hour:h,minute:h,second:h,hourCycle:"h23"},Un={hour:h,minute:h,second:h,hourCycle:"h23",timeZoneName:B},Yn={hour:h,minute:h,second:h,hourCycle:"h23",timeZoneName:A},Hn={year:h,month:h,day:h,hour:h,minute:h},Gn={year:h,month:h,day:h,hour:h,minute:h,second:h},jn={year:h,month:B,day:h,hour:h,minute:h},Jn={year:h,month:B,day:h,hour:h,minute:h,second:h},ii={year:h,month:B,day:h,weekday:B,hour:h,minute:h},Xn={year:h,month:A,day:h,hour:h,minute:h,timeZoneName:B},Qn={year:h,month:A,day:h,hour:h,minute:h,second:h,timeZoneName:B},Kn={year:h,month:A,day:h,weekday:A,hour:h,minute:h,timeZoneName:A},er={year:h,month:A,day:h,weekday:A,hour:h,minute:h,second:h,timeZoneName:A},ie=class{get type(){throw new _}get name(){throw new _}get ianaName(){return this.name}get isUniversal(){throw new _}offsetName(e,t){throw new _}formatOffset(e,t){throw new _}offset(e){throw new _}equals(e){throw new _}get isValid(){throw new _}},ft=null,He=class n extends ie{static get instance(){return ft===null&&(ft=new n),ft}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return fr(e,t,r)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},xt=new Map;function si(n){let e=xt.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),xt.set(n,e)),e}var oi={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ai(n,e){let t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,s,o,a,l,u,c]=r;return[o,i,s,a,l,u,c]}function li(n,e){let t=n.formatToParts(e),r=[];for(let i=0;i<t.length;i++){let{type:s,value:o}=t[i],a=oi[s];s==="era"?r[a]=o:y(a)||(r[a]=parseInt(o,10))}return r}var mt=new Map,Q=class n extends ie{static create(e){let t=mt.get(e);return t===void 0&&mt.set(e,t=new n(e)),t}static resetCache(){mt.clear(),xt.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=n.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return fr(e,t,r,this.name)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let r=si(this.name),[i,s,o,a,l,u,c]=r.formatToParts?li(r,t):ai(r,t);a==="BC"&&(i=-Math.abs(i)+1);let d=Ke({year:i,month:s,day:o,hour:l===24?0:l,minute:u,second:c,millisecond:0}),f=+t,g=f%1e3;return f-=g>=0?g:1e3+g,(d-f)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},on={};function ui(n,e={}){let t=JSON.stringify([n,e]),r=on[t];return r||(r=new Intl.ListFormat(n,e),on[t]=r),r}var Ot=new Map;function vt(n,e={}){let t=JSON.stringify([n,e]),r=Ot.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),Ot.set(t,r)),r}var Nt=new Map;function ci(n,e={}){let t=JSON.stringify([n,e]),r=Nt.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),Nt.set(t,r)),r}var Mt=new Map;function fi(n,e={}){let{base:t,...r}=e,i=JSON.stringify([n,r]),s=Mt.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(n,e),Mt.set(i,s)),s}var Oe=null;function mi(){return Oe||(Oe=new Intl.DateTimeFormat().resolvedOptions().locale,Oe)}var Dt=new Map;function tr(n){let e=Dt.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),Dt.set(n,e)),e}var Ct=new Map;function hi(n){let e=Ct.get(n);if(!e){let t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...nr,...e}),Ct.set(n,e)}return e}function di(n){let e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));let t=n.indexOf("-u-");if(t===-1)return[n];{let r,i;try{r=vt(n).resolvedOptions(),i=n}catch{let l=n.substring(0,t);r=vt(l).resolvedOptions(),i=l}let{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function gi(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function yi(n){let e=[];for(let t=1;t<=12;t++){let r=T.utc(2009,t,1);e.push(n(r))}return e}function pi(n){let e=[];for(let t=1;t<=7;t++){let r=T.utc(2016,11,13+t);e.push(n(r))}return e}function qe(n,e,t,r){let i=n.listingMode();return i==="error"?null:i==="en"?t(e):r(e)}function bi(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||tr(n.locale).numberingSystem==="latn"}var It=class{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:i,floor:s,...o}=r;if(!t||Object.keys(o).length>0){let a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=ci(e,a)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):$t(e,3);return v(t,this.padTo)}}},Et=class{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Q.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=vt(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Ft=class{constructor(e,t,r){this.opts={style:"long",...r},!t&&ur()&&(this.rtf=fi(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):Vi(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},nr={firstDay:1,minimalDays:4,weekend:[6,7]},S=class n{static fromOpts(e){return n.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,i,s=!1){let o=e||x.defaultLocale,a=o||(s?"en-US":mi()),l=t||x.defaultNumberingSystem,u=r||x.defaultOutputCalendar,c=Lt(i)||x.defaultWeekSettings;return new n(a,l,u,c,o)}static resetCache(){Oe=null,Ot.clear(),Nt.clear(),Mt.clear(),Dt.clear(),Ct.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:i}={}){return n.create(e,t,r,i)}constructor(e,t,r,i,s){let[o,a,l]=di(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=r||l||null,this.weekSettings=i,this.intl=gi(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=bi(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:n.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Lt(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return qe(this,e,dr,()=>{let r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;let i=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";if(!this.monthsCache[s][e]){let o=r?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[s][e]=yi(o)}return this.monthsCache[s][e]})}weekdays(e,t=!1){return qe(this,e,pr,()=>{let r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=pi(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return qe(this,void 0,()=>br,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[T.utc(2016,11,13,9),T.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return qe(this,e,wr,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[T.utc(-40,1,1),T.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){let i=this.dtFormatter(e,t),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new It(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Et(e,this.intl,t)}relFormatter(e={}){return new Ft(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ui(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||tr(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:cr()?hi(this.locale):nr}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},ht=null,P=class n extends ie{static get utcInstance(){return ht===null&&(ht=new n(0)),ht}static instance(e){return e===0?n.utcInstance:new n(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new n(et(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Me(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Me(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Me(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},At=class extends ie{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function j(n,e){if(y(n)||n===null)return e;if(n instanceof ie)return n;if(Oi(n)){let t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?He.instance:t==="utc"||t==="gmt"?P.utcInstance:P.parseSpecifier(t)||Q.create(n)}else return X(n)?P.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new At(n)}var qt={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},an={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},wi=qt.hanidec.replace(/[\[|\]]/g,"").split("");function Si(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(n[t].search(qt.hanidec)!==-1)e+=wi.indexOf(n[t]);else for(let i in an){let[s,o]=an[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}var Wt=new Map;function Ti(){Wt.clear()}function V({numberingSystem:n},e=""){let t=n||"latn",r=Wt.get(t);r===void 0&&(r=new Map,Wt.set(t,r));let i=r.get(e);return i===void 0&&(i=new RegExp(`${qt[t]}${e}`),r.set(e,i)),i}var ln=()=>Date.now(),un="system",cn=null,fn=null,mn=null,hn=60,dn,gn=null,x=class{static get now(){return ln}static set now(e){ln=e}static set defaultZone(e){un=e}static get defaultZone(){return j(un,He.instance)}static get defaultLocale(){return cn}static set defaultLocale(e){cn=e}static get defaultNumberingSystem(){return fn}static set defaultNumberingSystem(e){fn=e}static get defaultOutputCalendar(){return mn}static set defaultOutputCalendar(e){mn=e}static get defaultWeekSettings(){return gn}static set defaultWeekSettings(e){gn=Lt(e)}static get twoDigitCutoffYear(){return hn}static set twoDigitCutoffYear(e){hn=e%100}static get throwOnInvalid(){return dn}static set throwOnInvalid(e){dn=e}static resetCaches(){S.resetCache(),Q.resetCache(),T.resetCache(),Ti()}},F=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},rr=[0,31,59,90,120,151,181,212,243,273,304,334],ir=[0,31,60,91,121,152,182,213,244,274,305,335];function L(n,e){return new F("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Vt(n,e,t){let r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function sr(n,e,t){return t+(Ce(n)?ir:rr)[e-1]}function or(n,e){let t=Ce(n)?ir:rr,r=t.findIndex(s=>s<e),i=e-t[r];return{month:r+1,day:i}}function zt(n,e){return(n-e+7)%7+1}function Ge(n,e=4,t=1){let{year:r,month:i,day:s}=n,o=sr(r,i,s),a=zt(Vt(r,i,s),t),l=Math.floor((o-a+14-e)/7),u;return l<1?(u=r-1,l=De(u,e,t)):l>De(r,e,t)?(u=r+1,l=1):u=r,{weekYear:u,weekNumber:l,weekday:a,...tt(n)}}function yn(n,e=4,t=1){let{weekYear:r,weekNumber:i,weekday:s}=n,o=zt(Vt(r,1,e),t),a=me(r),l=i*7+s-o-7+e,u;l<1?(u=r-1,l+=me(u)):l>a?(u=r+1,l-=me(r)):u=r;let{month:c,day:m}=or(u,l);return{year:u,month:c,day:m,...tt(n)}}function dt(n){let{year:e,month:t,day:r}=n,i=sr(e,t,r);return{year:e,ordinal:i,...tt(n)}}function pn(n){let{year:e,ordinal:t}=n,{month:r,day:i}=or(e,t);return{year:e,month:r,day:i,...tt(n)}}function bn(n,e){if(!y(n.localWeekday)||!y(n.localWeekNumber)||!y(n.localWeekYear)){if(!y(n.weekday)||!y(n.weekNumber)||!y(n.weekYear))throw new J("Cannot mix locale-based week fields with ISO-based week fields");return y(n.localWeekday)||(n.weekday=n.localWeekday),y(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),y(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ki(n,e=4,t=1){let r=Qe(n.weekYear),i=R(n.weekNumber,1,De(n.weekYear,e,t)),s=R(n.weekday,1,7);return r?i?s?!1:L("weekday",n.weekday):L("week",n.weekNumber):L("weekYear",n.weekYear)}function xi(n){let e=Qe(n.year),t=R(n.ordinal,1,me(n.year));return e?t?!1:L("ordinal",n.ordinal):L("year",n.year)}function ar(n){let e=Qe(n.year),t=R(n.month,1,12),r=R(n.day,1,je(n.year,n.month));return e?t?r?!1:L("day",n.day):L("month",n.month):L("year",n.year)}function lr(n){let{hour:e,minute:t,second:r,millisecond:i}=n,s=R(e,0,23)||e===24&&t===0&&r===0&&i===0,o=R(t,0,59),a=R(r,0,59),l=R(i,0,999);return s?o?a?l?!1:L("millisecond",i):L("second",r):L("minute",t):L("hour",e)}function y(n){return typeof n>"u"}function X(n){return typeof n=="number"}function Qe(n){return typeof n=="number"&&n%1===0}function Oi(n){return typeof n=="string"}function vi(n){return Object.prototype.toString.call(n)==="[object Date]"}function ur(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function cr(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ni(n){return Array.isArray(n)?n:[n]}function wn(n,e,t){if(n.length!==0)return n.reduce((r,i)=>{let s=[e(i),i];return r&&t(r[0],s[0])===r[0]?r:s},null)[1]}function Mi(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function ge(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Lt(n){if(n==null)return null;if(typeof n!="object")throw new M("Week settings must be an object");if(!R(n.firstDay,1,7)||!R(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!R(e,1,7)))throw new M("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function R(n,e,t){return Qe(n)&&n>=e&&n<=t}function Di(n,e){return n-e*Math.floor(n/e)}function v(n,e=2){let t=n<0,r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function G(n){if(!(y(n)||n===null||n===""))return parseInt(n,10)}function te(n){if(!(y(n)||n===null||n===""))return parseFloat(n)}function Bt(n){if(!(y(n)||n===null||n==="")){let e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function $t(n,e,t="round"){let r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Ce(n){return n%4===0&&(n%100!==0||n%400===0)}function me(n){return Ce(n)?366:365}function je(n,e){let t=Di(e-1,12)+1,r=n+(e-t)/12;return t===2?Ce(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ke(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Sn(n,e,t){return-zt(Vt(n,1,e),t)+e-1}function De(n,e=4,t=1){let r=Sn(n,e,t),i=Sn(n+1,e,t);return(me(n)-r+i)/7}function Rt(n){return n>99?n:n>x.twoDigitCutoffYear?1900+n:2e3+n}function fr(n,e,t,r=null){let i=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);let o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(t,o).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function et(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);let r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function mr(n){let e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new M(`Invalid unit value ${n}`);return e}function Je(n,e){let t={};for(let r in n)if(ge(n,r)){let i=n[r];if(i==null)continue;t[e(r)]=mr(i)}return t}function Me(n,e){let t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return`${i}${v(t,2)}:${v(r,2)}`;case"narrow":return`${i}${t}${r>0?`:${r}`:""}`;case"techie":return`${i}${v(t,2)}${v(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function tt(n){return Mi(n,["hour","minute","second","millisecond"])}var Ci=["January","February","March","April","May","June","July","August","September","October","November","December"],hr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ii=["J","F","M","A","M","J","J","A","S","O","N","D"];function dr(n){switch(n){case"narrow":return[...Ii];case"short":return[...hr];case"long":return[...Ci];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var gr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],yr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ei=["M","T","W","T","F","S","S"];function pr(n){switch(n){case"narrow":return[...Ei];case"short":return[...yr];case"long":return[...gr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var br=["AM","PM"],Fi=["Before Christ","Anno Domini"],Ai=["BC","AD"],Wi=["B","A"];function wr(n){switch(n){case"narrow":return[...Wi];case"short":return[...Ai];case"long":return[...Fi];default:return null}}function Li(n){return br[n.hour<12?0:1]}function Ri(n,e){return pr(e)[n.weekday-1]}function Pi(n,e){return dr(e)[n.month-1]}function qi(n,e){return wr(e)[n.year<0?0:1]}function Vi(n,e,t="always",r=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){let m=n==="days";switch(e){case 1:return m?"tomorrow":`next ${i[n][0]}`;case-1:return m?"yesterday":`last ${i[n][0]}`;case 0:return m?"today":`this ${i[n][0]}`}}let o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,u=i[n],c=r?l?u[1]:u[2]||u[1]:l?i[n][0]:n;return o?`${a} ${c} ago`:`in ${a} ${c}`}function Tn(n,e){let t="";for(let r of n)r.literal?t+=r.val:t+=e(r.val);return t}var zi={D:Ye,DD:Rn,DDD:Pn,DDDD:qn,t:Vn,tt:zn,ttt:Bn,tttt:$n,T:_n,TT:Zn,TTT:Un,TTTT:Yn,f:Hn,ff:jn,fff:Xn,ffff:Kn,F:Gn,FF:Jn,FFF:Qn,FFFF:er},E=class n{static create(e,t={}){return new n(e,t)}static parseFormat(e){let t=null,r="",i=!1,s=[];for(let o=0;o<e.length;o++){let a=e.charAt(o);a==="'"?((r.length>0||i)&&s.push({literal:i||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",i=!i):i||a===t?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,t=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return zi[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return v(e,t);let i={...this.opts};return t>0&&(i.padTo=t),r&&(i.signDisplay=r),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){let r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(f,g)=>this.loc.extract(e,f,g),o=f=>e.isOffsetFixed&&e.offset===0&&f.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,f.format):"",a=()=>r?Li(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(f,g)=>r?Pi(e,f):s(g?{month:f}:{month:f,day:"numeric"},"month"),u=(f,g)=>r?Ri(e,f):s(g?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),c=f=>{let g=n.macroTokenToFormatOpts(f);return g?this.formatWithSystemDefault(e,g):f},m=f=>r?qi(e,f):s({era:f},"era"),d=f=>{switch(f){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(f)}};return Tn(n.parseFormat(t),d)}formatDurationFromString(e,t){let r=this.opts.signMode==="negativeLargestOnly"?-1:1,i=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=(c,m)=>d=>{let f=i(d);if(f){let g=m.isNegativeDuration&&f!==m.largestUnit?r:1,p;return this.opts.signMode==="negativeLargestOnly"&&f!==m.largestUnit?p="never":this.opts.signMode==="all"?p="always":p="auto",this.num(c.get(f)*g,d.length,p)}else return d},o=n.parseFormat(t),a=o.reduce((c,{literal:m,val:d})=>m?c:c.concat(d),[]),l=e.shiftTo(...a.map(i).filter(c=>c)),u={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return Tn(o,s(l,u))}},Sr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ye(...n){let e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function pe(...n){return e=>n.reduce(([t,r,i],s)=>{let[o,a,l]=s(e,i);return[{...t,...o},a||r,l]},[{},null,1]).slice(0,2)}function be(n,...e){if(n==null)return[null,null];for(let[t,r]of e){let i=t.exec(n);if(i)return r(i)}return[null,null]}function Tr(...n){return(e,t)=>{let r={},i;for(i=0;i<n.length;i++)r[n[i]]=G(e[t+i]);return[r,null,t+i]}}var kr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Bi=`(?:${kr.source}?(?:\\[(${Sr.source})\\])?)?`,_t=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,xr=RegExp(`${_t.source}${Bi}`),Zt=RegExp(`(?:[Tt]${xr.source})?`),$i=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,_i=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Zi=/(\d{4})-?(\d{3})/,Ui=Tr("weekYear","weekNumber","weekDay"),Yi=Tr("year","ordinal"),Hi=/(\d{4})-(\d\d)-(\d\d)/,Or=RegExp(`${_t.source} ?(?:${kr.source}|(${Sr.source}))?`),Gi=RegExp(`(?: ${Or.source})?`);function he(n,e,t){let r=n[e];return y(r)?t:G(r)}function ji(n,e){return[{year:he(n,e),month:he(n,e+1,1),day:he(n,e+2,1)},null,e+3]}function we(n,e){return[{hours:he(n,e,0),minutes:he(n,e+1,0),seconds:he(n,e+2,0),milliseconds:Bt(n[e+3])},null,e+4]}function Ie(n,e){let t=!n[e]&&!n[e+1],r=et(n[e+1],n[e+2]),i=t?null:P.instance(r);return[{},i,e+3]}function Ee(n,e){let t=n[e]?Q.create(n[e]):null;return[{},t,e+1]}var Ji=RegExp(`^T?${_t.source}$`),Xi=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Qi(n){let[e,t,r,i,s,o,a,l,u]=n,c=e[0]==="-",m=l&&l[0]==="-",d=(f,g=!1)=>f!==void 0&&(g||f&&c)?-f:f;return[{years:d(te(t)),months:d(te(r)),weeks:d(te(i)),days:d(te(s)),hours:d(te(o)),minutes:d(te(a)),seconds:d(te(l),l==="-0"),milliseconds:d(Bt(u),m)}]}var Ki={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ut(n,e,t,r,i,s,o){let a={year:e.length===2?Rt(G(e)):G(e),month:hr.indexOf(t)+1,day:G(r),hour:G(i),minute:G(s)};return o&&(a.second=G(o)),n&&(a.weekday=n.length>3?gr.indexOf(n)+1:yr.indexOf(n)+1),a}var es=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function ts(n){let[,e,t,r,i,s,o,a,l,u,c,m]=n,d=Ut(e,i,r,t,s,o,a),f;return l?f=Ki[l]:u?f=0:f=et(c,m),[d,new P(f)]}function ns(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var rs=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,is=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ss=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function kn(n){let[,e,t,r,i,s,o,a]=n;return[Ut(e,i,r,t,s,o,a),P.utcInstance]}function os(n){let[,e,t,r,i,s,o,a]=n;return[Ut(e,a,t,r,i,s,o),P.utcInstance]}var as=ye($i,Zt),ls=ye(_i,Zt),us=ye(Zi,Zt),cs=ye(xr),vr=pe(ji,we,Ie,Ee),fs=pe(Ui,we,Ie,Ee),ms=pe(Yi,we,Ie,Ee),hs=pe(we,Ie,Ee);function ds(n){return be(n,[as,vr],[ls,fs],[us,ms],[cs,hs])}function gs(n){return be(ns(n),[es,ts])}function ys(n){return be(n,[rs,kn],[is,kn],[ss,os])}function ps(n){return be(n,[Xi,Qi])}var bs=pe(we);function ws(n){return be(n,[Ji,bs])}var Ss=ye(Hi,Gi),Ts=ye(Or),ks=pe(we,Ie,Ee);function xs(n){return be(n,[Ss,vr],[Ts,ks])}var xn="Invalid Duration",Nr={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Os={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Nr},W=146097/400,le=146097/4800,vs={years:{quarters:4,months:12,weeks:W/7,days:W,hours:W*24,minutes:W*24*60,seconds:W*24*60*60,milliseconds:W*24*60*60*1e3},quarters:{months:3,weeks:W/28,days:W/4,hours:W*24/4,minutes:W*24*60/4,seconds:W*24*60*60/4,milliseconds:W*24*60*60*1e3/4},months:{weeks:le/7,days:le,hours:le*24,minutes:le*24*60,seconds:le*24*60*60,milliseconds:le*24*60*60*1e3},...Nr},re=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ns=re.slice(0).reverse();function Z(n,e,t=!1){let r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new D(r)}function Mr(n,e){let t=e.milliseconds??0;for(let r of Ns.slice(1))e[r]&&(t+=e[r]*n[r].milliseconds);return t}function On(n,e){let t=Mr(n,e)<0?-1:1;re.reduceRight((r,i)=>{if(y(e[i]))return r;if(r){let s=e[r]*t,o=n[i][r],a=Math.floor(s/o);e[i]+=a*t,e[r]-=a*o*t}return i},null),re.reduce((r,i)=>{if(y(e[i]))return r;if(r){let s=e[r]%1;e[r]-=s,e[i]+=s*n[r][i]}return i},null)}function vn(n){let e={};for(let[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}var D=class n{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,r=t?vs:Os;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||S.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return n.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new M(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new n({values:Je(e,n.normalizeUnit),loc:S.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(X(e))return n.fromMillis(e);if(n.isDuration(e))return e;if(typeof e=="object")return n.fromObject(e);throw new M(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[r]=ps(e);return r?n.fromObject(r,t):n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[r]=ws(e);return r?n.fromObject(r,t):n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new M("need to specify a reason the Duration is invalid");let r=e instanceof F?e:new F(e,t);if(x.throwOnInvalid)throw new kt(r);return new n({invalid:r})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Ue(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?E.create(this.loc,r).formatDurationFromString(this,e):xn}toHuman(e={}){if(!this.isValid)return xn;let t=e.showZeros!==!1,r=re.map(i=>{let s=this.values[i];return y(s)||s===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=$t(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},T.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Mr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=n.fromDurationLike(e),r={};for(let i of re)(ge(t.values,i)||ge(this.values,i))&&(r[i]=t.get(i)+this.get(i));return Z(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let t=n.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=mr(e(this.values[r],r));return Z(this,{values:t},!0)}get(e){return this[n.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...Je(e,n.normalizeUnit)};return Z(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:i}={}){let o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:r};return Z(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return On(this.matrix,e),Z(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=vn(this.normalize().shiftToAll().toObject());return Z(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>n.normalizeUnit(o));let t={},r={},i=this.toObject(),s;for(let o of re)if(e.indexOf(o)>=0){s=o;let a=0;for(let u in r)a+=this.matrix[u][o]*r[u],r[u]=0;X(i[o])&&(a+=i[o]);let l=Math.trunc(a);t[o]=l,r[o]=(a*1e3-l*1e3)/1e3}else X(i[o])&&(r[o]=i[o]);for(let o in r)r[o]!==0&&(t[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return On(this.matrix,t),Z(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Z(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=vn(this.values);return Z(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(let r of re)if(!t(this.values[r],e.values[r]))return!1;return!0}},ue="Invalid Interval";function Ms(n,e){return!n||!n.isValid?de.invalid("missing or invalid start"):!e||!e.isValid?de.invalid("missing or invalid end"):e<n?de.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}var de=class n{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new M("need to specify a reason the Interval is invalid");let r=e instanceof F?e:new F(e,t);if(x.throwOnInvalid)throw new Tt(r);return new n({invalid:r})}static fromDateTimes(e,t){let r=xe(e),i=xe(t),s=Ms(r,i);return s??new n({start:r,end:i})}static after(e,t){let r=D.fromDurationLike(t),i=xe(e);return n.fromDateTimes(i,i.plus(r))}static before(e,t){let r=D.fromDurationLike(t),i=xe(e);return n.fromDateTimes(i.minus(r),i)}static fromISO(e,t){let[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=T.fromISO(r,t),o=s.isValid}catch{o=!1}let a,l;try{a=T.fromISO(i,t),l=a.isValid}catch{l=!1}if(o&&l)return n.fromDateTimes(s,a);if(o){let u=D.fromISO(i,t);if(u.isValid)return n.after(s,u)}else if(l){let u=D.fromISO(r,t);if(u.isValid)return n.before(a,u)}}return n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;let r=this.start.startOf(e,t),i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:r.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(r,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?n.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(xe).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),r=[],{s:i}=this,s=0;for(;i<this.e;){let o=t[s]||this.e,a=+o>+this.e?this.e:o;r.push(n.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){let t=D.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,i=1,s,o=[];for(;r<this.e;){let a=this.start.plus(t.mapUnits(l=>l*i));s=+a>+this.e?this.e:a,o.push(n.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:n.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return n.fromDateTimes(t,r)}static merge(e){let[t,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0,i=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((l,u)=>l.time-u.time);for(let l of a)r+=l.type==="s"?1:-1,r===1?t=l.time:(t&&+t!=+l.time&&i.push(n.fromDateTimes(t,l.time)),t=null);return n.merge(i)}difference(...e){return n.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:ue}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ye,t={}){return this.isValid?E.create(this.s.loc.clone(t),e).formatInterval(this):ue}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ue}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ue}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ue}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ue}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):D.invalid(this.invalidReason)}mapEndpoints(e){return n.fromDateTimes(e(this.s),e(this.e))}},fe=class{static hasDST(e=x.defaultZone){let t=T.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Q.isValidZone(e)}static normalizeZone(e){return j(e,x.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||S.create(t,r,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||S.create(t,r,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||S.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||S.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return S.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return S.create(t,null,"gregory").eras(e)}static features(){return{relative:ur(),localeWeek:cr()}}};function Nn(n,e){let t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(D.fromMillis(r).as("days"))}function Ds(n,e,t){let r=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{let c=Nn(l,u);return(c-c%7)/7}],["days",Nn]],i={},s=n,o,a;for(let[l,u]of r)t.indexOf(l)>=0&&(o=l,i[l]=u(n,e),a=s.plus(i),a>e?(i[l]--,n=s.plus(i),n>e&&(a=n,i[l]--,n=s.plus(i))):n=a);return[n,i,a,o]}function Cs(n,e,t,r){let[i,s,o,a]=Ds(n,e,t),l=e-i,u=t.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);u.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));let c=D.fromObject(s,r);return u.length>0?D.fromMillis(l,r).shiftTo(...u).plus(c):c}var Is="missing Intl.DateTimeFormat.formatToParts support";function w(n,e=t=>t){return{regex:n,deser:([t])=>e(Si(t))}}var Es="\xA0",Dr=`[ ${Es}]`,Cr=new RegExp(Dr,"g");function Fs(n){return n.replace(/\./g,"\\.?").replace(Cr,Dr)}function Mn(n){return n.replace(/\./g,"").replace(Cr," ").toLowerCase()}function z(n,e){return n===null?null:{regex:RegExp(n.map(Fs).join("|")),deser:([t])=>n.findIndex(r=>Mn(t)===Mn(r))+e}}function Dn(n,e){return{regex:n,deser:([,t,r])=>et(t,r),groups:e}}function Ve(n){return{regex:n,deser:([e])=>e}}function As(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ws(n,e){let t=V(e),r=V(e,"{2}"),i=V(e,"{3}"),s=V(e,"{4}"),o=V(e,"{6}"),a=V(e,"{1,2}"),l=V(e,"{1,3}"),u=V(e,"{1,6}"),c=V(e,"{1,9}"),m=V(e,"{2,4}"),d=V(e,"{4,6}"),f=O=>({regex:RegExp(As(O.val)),deser:([N])=>N,literal:!0}),p=(O=>{if(n.literal)return f(O);switch(O.val){case"G":return z(e.eras("short"),0);case"GG":return z(e.eras("long"),0);case"y":return w(u);case"yy":return w(m,Rt);case"yyyy":return w(s);case"yyyyy":return w(d);case"yyyyyy":return w(o);case"M":return w(a);case"MM":return w(r);case"MMM":return z(e.months("short",!0),1);case"MMMM":return z(e.months("long",!0),1);case"L":return w(a);case"LL":return w(r);case"LLL":return z(e.months("short",!1),1);case"LLLL":return z(e.months("long",!1),1);case"d":return w(a);case"dd":return w(r);case"o":return w(l);case"ooo":return w(i);case"HH":return w(r);case"H":return w(a);case"hh":return w(r);case"h":return w(a);case"mm":return w(r);case"m":return w(a);case"q":return w(a);case"qq":return w(r);case"s":return w(a);case"ss":return w(r);case"S":return w(l);case"SSS":return w(i);case"u":return Ve(c);case"uu":return Ve(a);case"uuu":return w(t);case"a":return z(e.meridiems(),0);case"kkkk":return w(s);case"kk":return w(m,Rt);case"W":return w(a);case"WW":return w(r);case"E":case"c":return w(t);case"EEE":return z(e.weekdays("short",!1),1);case"EEEE":return z(e.weekdays("long",!1),1);case"ccc":return z(e.weekdays("short",!0),1);case"cccc":return z(e.weekdays("long",!0),1);case"Z":case"ZZ":return Dn(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Dn(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return Ve(/[a-z_+-/]{1,256}?/i);case" ":return Ve(/[^\S\n\r]/);default:return f(O)}})(n)||{invalidReason:Is};return p.token=n,p}var Ls={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Rs(n,e,t){let{type:r,value:i}=n;if(r==="literal"){let l=/^\s+$/.test(i);return{literal:!l,val:l?" ":i}}let s=e[r],o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let a=Ls[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function Ps(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function qs(n,e,t){let r=n.match(e);if(r){let i={},s=1;for(let o in t)if(ge(t,o)){let a=t[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+l))),s+=l}return[r,i]}else return[r,{}]}function Vs(n){let e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,r;return y(n.z)||(t=Q.create(n.z)),y(n.Z)||(t||(t=new P(n.Z)),r=n.Z),y(n.q)||(n.M=(n.q-1)*3+1),y(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),y(n.u)||(n.S=Bt(n.u)),[Object.keys(n).reduce((s,o)=>{let a=e(o);return a&&(s[a]=n[o]),s},{}),t,r]}var gt=null;function zs(){return gt||(gt=T.fromMillis(1555555555555)),gt}function Bs(n,e){if(n.literal)return n;let t=E.macroTokenToFormatOpts(n.val),r=Fr(t,e);return r==null||r.includes(void 0)?n:r}function Ir(n,e){return Array.prototype.concat(...n.map(t=>Bs(t,e)))}var Xe=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Ir(E.parseFormat(t),e),this.units=this.tokens.map(r=>Ws(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){let[r,i]=Ps(this.units);this.regex=RegExp(r,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){let[t,r]=qs(e,this.regex,this.handlers),[i,s,o]=r?Vs(r):[null,null,void 0];if(ge(r,"a")&&ge(r,"H"))throw new J("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:i,zone:s,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Er(n,e,t){return new Xe(n,t).explainFromTokens(e)}function $s(n,e,t){let{result:r,zone:i,specificOffset:s,invalidReason:o}=Er(n,e,t);return[r,i,s,o]}function Fr(n,e){if(!n)return null;let r=E.create(e,n).dtFormatter(zs()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>Rs(o,n,s))}var yt="Invalid DateTime",Cn=864e13;function ve(n){return new F("unsupported zone",`the zone "${n.name}" is not supported`)}function pt(n){return n.weekData===null&&(n.weekData=Ge(n.c)),n.weekData}function bt(n){return n.localWeekData===null&&(n.localWeekData=Ge(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ne(n,e){let t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new T({...t,...e,old:t})}function Ar(n,e,t){let r=n-e*60*1e3,i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;let s=t.offset(r);return i===s?[r,i]:[n-Math.min(i,s)*60*1e3,Math.max(i,s)]}function ze(n,e){n+=e*60*1e3;let t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function $e(n,e,t){return Ar(Ke(n),e,t)}function In(n,e){let t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:r,month:i,day:Math.min(n.c.day,je(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=D.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Ke(s),[l,u]=Ar(a,t,n.zone);return o!==0&&(l+=o,u=n.zone.offset(l)),{ts:l,o:u}}function ce(n,e,t,r,i,s){let{setZone:o,zone:a}=t;if(n&&Object.keys(n).length!==0||e){let l=e||a,u=T.fromObject(n,{...t,zone:l,specificOffset:s});return o?u:u.setZone(a)}else return T.invalid(new F("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Be(n,e,t=!0){return n.isValid?E.create(S.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function wt(n,e,t){let r=n.c.year>9999||n.c.year<0,i="";if(r&&n.c.year>=0&&(i+="+"),i+=v(n.c.year,r?6:4),t==="year")return i;if(e){if(i+="-",i+=v(n.c.month),t==="month")return i;i+="-"}else if(i+=v(n.c.month),t==="month")return i;return i+=v(n.c.day),i}function En(n,e,t,r,i,s,o){let a=!t||n.c.millisecond!==0||n.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=v(n.c.hour),o==="hour")break;if(e){if(l+=":",l+=v(n.c.minute),o==="minute")break;a&&(l+=":",l+=v(n.c.second))}else{if(l+=v(n.c.minute),o==="minute")break;a&&(l+=v(n.c.second))}if(o==="second")break;a&&(!r||n.c.millisecond!==0)&&(l+=".",l+=v(n.c.millisecond,3))}return i&&(n.isOffsetFixed&&n.offset===0&&!s?l+="Z":n.o<0?(l+="-",l+=v(Math.trunc(-n.o/60)),l+=":",l+=v(Math.trunc(-n.o%60))):(l+="+",l+=v(Math.trunc(n.o/60)),l+=":",l+=v(Math.trunc(n.o%60)))),s&&(l+="["+n.zone.ianaName+"]"),l}var Wr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},_s={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Zs={ordinal:1,hour:0,minute:0,second:0,millisecond:0},_e=["year","month","day","hour","minute","second","millisecond"],Us=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Ys=["year","ordinal","hour","minute","second","millisecond"];function Ze(n){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Ue(n);return e}function Fn(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Ze(n)}}function Hs(n){if(Ne===void 0&&(Ne=x.now()),n.type!=="iana")return n.offset(Ne);let e=n.name,t=Pt.get(e);return t===void 0&&(t=n.offset(Ne),Pt.set(e,t)),t}function An(n,e){let t=j(e.zone,x.defaultZone);if(!t.isValid)return T.invalid(ve(t));let r=S.fromObject(e),i,s;if(y(n.year))i=x.now();else{for(let l of _e)y(n[l])&&(n[l]=Wr[l]);let o=ar(n)||lr(n);if(o)return T.invalid(o);let a=Hs(t);[i,s]=$e(n,a,t)}return new T({ts:i,zone:t,loc:r,o:s})}function Wn(n,e,t){let r=y(t.round)?!0:t.round,i=y(t.rounding)?"trunc":t.rounding,s=(a,l)=>(a=$t(a,r||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(a,l)),o=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return s(o(t.unit),t.unit);for(let a of t.units){let l=o(a);if(Math.abs(l)>=1)return s(l,a)}return s(n>e?-0:0,t.units[t.units.length-1])}function Ln(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}var Ne,Pt=new Map,T=class n{constructor(e){let t=e.zone||x.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new F("invalid input"):null)||(t.isValid?null:ve(t));this.ts=y(e.ts)?x.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,s]=[e.old.c,e.old.o];else{let a=X(e.o)&&!e.old?e.o:t.offset(this.ts);i=ze(this.ts,a),r=Number.isNaN(i.year)?new F("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=t,this.loc=e.loc||S.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new n({})}static local(){let[e,t]=Ln(arguments),[r,i,s,o,a,l,u]=t;return An({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:u},e)}static utc(){let[e,t]=Ln(arguments),[r,i,s,o,a,l,u]=t;return e.zone=P.utcInstance,An({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:u},e)}static fromJSDate(e,t={}){let r=vi(e)?e.valueOf():NaN;if(Number.isNaN(r))return n.invalid("invalid input");let i=j(t.zone,x.defaultZone);return i.isValid?new n({ts:r,zone:i,loc:S.fromObject(t)}):n.invalid(ve(i))}static fromMillis(e,t={}){if(X(e))return e<-Cn||e>Cn?n.invalid("Timestamp out of range"):new n({ts:e,zone:j(t.zone,x.defaultZone),loc:S.fromObject(t)});throw new M(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(X(e))return new n({ts:e*1e3,zone:j(t.zone,x.defaultZone),loc:S.fromObject(t)});throw new M("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let r=j(t.zone,x.defaultZone);if(!r.isValid)return n.invalid(ve(r));let i=S.fromObject(t),s=Je(e,Fn),{minDaysInFirstWeek:o,startOfWeek:a}=bn(s,i),l=x.now(),u=y(t.specificOffset)?r.offset(l):t.specificOffset,c=!y(s.ordinal),m=!y(s.year),d=!y(s.month)||!y(s.day),f=m||d,g=s.weekYear||s.weekNumber;if((f||c)&&g)throw new J("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&c)throw new J("Can't mix ordinal dates with month/day");let p=g||s.weekday&&!f,O,N,k=ze(l,u);p?(O=Us,N=_s,k=Ge(k,o,a)):c?(O=Ys,N=Zs,k=dt(k)):(O=_e,N=Wr);let C=!1;for(let H of O){let Le=s[H];y(Le)?C?s[H]=N[H]:s[H]=k[H]:C=!0}let K=p?ki(s,o,a):c?xi(s):ar(s),ee=K||lr(s);if(ee)return n.invalid(ee);let ae=p?yn(s,o,a):c?pn(s):s,[Y,$]=$e(ae,u,r),q=new n({ts:Y,zone:r,o:$,loc:i});return s.weekday&&f&&e.weekday!==q.weekday?n.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${q.toISO()}`):q.isValid?q:n.invalid(q.invalid)}static fromISO(e,t={}){let[r,i]=ds(e);return ce(r,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[r,i]=gs(e);return ce(r,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[r,i]=ys(e);return ce(r,i,t,"HTTP",t)}static fromFormat(e,t,r={}){if(y(e)||y(t))throw new M("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=r,o=S.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,l,u,c]=$s(o,e,t);return c?n.invalid(c):ce(a,l,r,`format ${t}`,e,u)}static fromString(e,t,r={}){return n.fromFormat(e,t,r)}static fromSQL(e,t={}){let[r,i]=xs(e);return ce(r,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new M("need to specify a reason the DateTime is invalid");let r=e instanceof F?e:new F(e,t);if(x.throwOnInvalid)throw new St(r);return new n({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let r=Fr(e,S.fromObject(t));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return Ir(E.parseFormat(e),S.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Ne=void 0,Pt.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?pt(this).weekYear:NaN}get weekNumber(){return this.isValid?pt(this).weekNumber:NaN}get weekday(){return this.isValid?pt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?bt(this).weekday:NaN}get localWeekNumber(){return this.isValid?bt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?bt(this).weekYear:NaN}get ordinal(){return this.isValid?dt(this.c).ordinal:NaN}get monthShort(){return this.isValid?fe.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?fe.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?fe.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?fe.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,r=Ke(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*t),a=this.zone.offset(r-s*t);if(o===a)return[this];let l=r-o*t,u=r-a*t,c=ze(l,o),m=ze(u,a);return c.hour===m.hour&&c.minute===m.minute&&c.second===m.second&&c.millisecond===m.millisecond?[ne(this,{ts:l}),ne(this,{ts:u})]:[this]}get isInLeapYear(){return Ce(this.year)}get daysInMonth(){return je(this.year,this.month)}get daysInYear(){return this.isValid?me(this.year):NaN}get weeksInWeekYear(){return this.isValid?De(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?De(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:r,calendar:i}=E.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(P.instance(e),t)}toLocal(){return this.setZone(x.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=j(e,x.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||r){let s=e.offset(this.ts),o=this.toObject();[i]=$e(o,s,e)}return ne(this,{ts:i,zone:e})}else return n.invalid(ve(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){let i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return ne(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Je(e,Fn),{minDaysInFirstWeek:r,startOfWeek:i}=bn(t,this.loc),s=!y(t.weekYear)||!y(t.weekNumber)||!y(t.weekday),o=!y(t.ordinal),a=!y(t.year),l=!y(t.month)||!y(t.day),u=a||l,c=t.weekYear||t.weekNumber;if((u||o)&&c)throw new J("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new J("Can't mix ordinal dates with month/day");let m;s?m=yn({...Ge(this.c,r,i),...t},r,i):y(t.ordinal)?(m={...this.toObject(),...t},y(t.day)&&(m.day=Math.min(je(m.year,m.month),m.day))):m=pn({...dt(this.c),...t});let[d,f]=$e(m,this.o,this.zone);return ne(this,{ts:d,o:f})}plus(e){if(!this.isValid)return this;let t=D.fromDurationLike(e);return ne(this,In(this,t))}minus(e){if(!this.isValid)return this;let t=D.fromDurationLike(e).negate();return ne(this,In(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let r={},i=D.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(i==="weeks")if(t){let s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(r.weekNumber=this.weekNumber-1),r.weekday=s}else r.weekday=1;if(i==="quarters"){let s=Math.ceil(this.month/3);r.month=(s-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?E.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):yt}toLocaleString(e=Ye,t={}){return this.isValid?E.create(this.loc.clone(t),e).formatDateTime(this):yt}toLocaleParts(e={}){return this.isValid?E.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=Ze(o);let a=e==="extended",l=wt(this,a,o);return _e.indexOf(o)>=3&&(l+="T"),l+=En(this,a,t,r,i,s,o),l}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?wt(this,e==="extended",Ze(t)):null}toISOWeekDate(){return Be(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=Ze(a),(i&&_e.indexOf(a)>=3?"T":"")+En(this,o==="extended",t,e,r,s,a)):null}toRFC2822(){return Be(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Be(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?wt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(r&&(i+=" "),t?i+="z":e&&(i+="ZZ")),Be(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():yt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return D.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=Ni(t).map(D.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,u=Cs(a,l,s,i);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(n.now(),e,t)}until(e){return this.isValid?de.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;let i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,r)<=i&&i<=s.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||n.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),Wn(t,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?Wn(e.base||n.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(n.isDateTime))throw new M("min requires all arguments be DateTimes");return wn(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(n.isDateTime))throw new M("max requires all arguments be DateTimes");return wn(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){let{locale:i=null,numberingSystem:s=null}=r,o=S.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return Er(o,e,t)}static fromStringExplain(e,t,r={}){return n.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){let{locale:r=null,numberingSystem:i=null}=t,s=S.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return new Xe(s,e)}static fromFormatParser(e,t,r={}){if(y(e)||y(t))throw new M("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:s=null}=r,o=S.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(t.locale))throw new M(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);let{result:a,zone:l,specificOffset:u,invalidReason:c}=t.explainFromTokens(e);return c?n.invalid(c):ce(a,l,r,`format ${t.format}`,e,u)}static get DATE_SHORT(){return Ye}static get DATE_MED(){return Rn}static get DATE_MED_WITH_WEEKDAY(){return ri}static get DATE_FULL(){return Pn}static get DATE_HUGE(){return qn}static get TIME_SIMPLE(){return Vn}static get TIME_WITH_SECONDS(){return zn}static get TIME_WITH_SHORT_OFFSET(){return Bn}static get TIME_WITH_LONG_OFFSET(){return $n}static get TIME_24_SIMPLE(){return _n}static get TIME_24_WITH_SECONDS(){return Zn}static get TIME_24_WITH_SHORT_OFFSET(){return Un}static get TIME_24_WITH_LONG_OFFSET(){return Yn}static get DATETIME_SHORT(){return Hn}static get DATETIME_SHORT_WITH_SECONDS(){return Gn}static get DATETIME_MED(){return jn}static get DATETIME_MED_WITH_SECONDS(){return Jn}static get DATETIME_MED_WITH_WEEKDAY(){return ii}static get DATETIME_FULL(){return Xn}static get DATETIME_FULL_WITH_SECONDS(){return Qn}static get DATETIME_HUGE(){return Kn}static get DATETIME_HUGE_WITH_SECONDS(){return er}};function xe(n){if(T.isDateTime(n))return n;if(n&&n.valueOf&&X(n.valueOf()))return T.fromJSDate(n);if(n&&typeof n=="object")return T.fromObject(n);throw new M(`Unknown datetime argument: ${n}, of type ${typeof n}`)}function se(n,e){return n.length?typeof n[0]=="number"?n:n.map(e??(t=>t.close)):[]}function nt(n,e,t){let r=se(n,t),i=new Array(r.length),s=0,o=0;for(let a=0;a<r.length;a++){let l=r[a];if(isNaN(l)||(s+=l,o++),a>=e){let u=r[a-e];isNaN(u)||(s-=u,o--)}i[a]=o>=e?s/e:NaN}return i}function Fe(n,e,t){let r=se(n,t),i=2/(e+1),s=new Array(r.length),o=NaN;for(let a=0;a<r.length;a++){let l=r[a];o=isNaN(o)?l:l*i+o*(1-i),s[a]=o}return s}function rt(n,e,t){let r=se(n,t),i=new Array(r.length).fill(NaN),s=e*(e+1)/2;for(let o=e-1;o<r.length;o++){let a=0;for(let l=0;l<e;l++)a+=r[o-l]*(e-l);i[o]=a/s}return i}function Gs(n,e,t){let r=se(n,t),i=Math.floor(e/2),s=Math.round(Math.sqrt(e)),o=rt(r,i),a=rt(r,e),l=r.map((u,c)=>2*o[c]-a[c]);return rt(l,s)}function it(n,e,t){let r=se(n,t),i=new Array(r.length).fill(NaN),s=NaN;for(let o=0;o<r.length;o++){let a=r[o];if(isNaN(s)){if(o<e-1)continue;let l=0;for(let u=o-e+1;u<=o;u++)l+=r[u];s=l/e,i[o]=s}else s=(s*(e-1)+a)/e,i[o]=s}return i}function js(n,e,t){let r=se(n,t),i=new Array(r.length).fill(NaN);for(let s=e-1;s<r.length;s++){let o=0,a=0,l=0,u=0;for(let d=0;d<e;d++){let f=d,g=r[s-(e-1-d)];o+=f,a+=g,l+=f*g,u+=f*f}let c=e,m=(c*l-o*a)/(c*u-o*o);i[s]=(a-m*o)/c+m*(e-1)}return i}function Js(n,e=14){let t=n.length;if(t===0)return[];let r=new Array(t),i=new Array(t);r[0]=0,i[0]=0;for(let l=1;l<t;l++){let u=n[l].close-n[l-1].close;r[l]=u>0?u:0,i[l]=u<0?-u:0}let s=it(r,e),o=it(i,e),a=new Array(t);for(let l=0;l<t;l++)a[l]=isNaN(s[l])?NaN:o[l]===0?100:100-100/(1+s[l]/o[l]);return a}function Xs(n,e=14,t=3,r=3){function i(c,m){let d=new Array(c.length).fill(NaN),f=0,g=0;for(let p=0;p<c.length;p++)isNaN(c[p])||(f+=c[p],g++),p>=m&&!isNaN(c[p-m])&&(f-=c[p-m],g--),d[p]=g>0?f/g:NaN;return d}let s=n.length,o=Ae(n.map(c=>c.high),e),a=We(n.map(c=>c.low),e),l=new Array(s).fill(NaN);for(let c=e-1;c<s;c++){let m=o[c],d=a[c];l[c]=m===d?50:(n[c].close-d)/(m-d)*100}let u=i(l,r);return{k:u,d:i(u,t)}}function Qs(n,e=12,t=26,r=9){let i=Fe(n,e),s=Fe(n,t),o=n.length,a=new Array(o);for(let c=0;c<o;c++)a[c]=i[c]-s[c];let l=Fe(a,r),u=new Array(o);for(let c=0;c<o;c++)u[c]=a[c]-l[c];return{macd:a,signal:l,histogram:u}}function Yt(n,e=14){return it(Lr(n),e)}function Lr(n){let e=n.length,t=new Array(e);for(let r=0;r<e;r++){let i=n[r];if(r===0){t[r]=i.high-i.low;continue}let s=n[r-1].close;t[r]=Math.max(i.high-i.low,Math.abs(i.high-s),Math.abs(i.low-s))}return t}function Rr(n,e){let t=Array.isArray(e)?e:new Array(n.length).fill(e);return n.map((r,i)=>i>0&&r>t[i]&&n[i-1]<=t[i-1])}function Pr(n,e){let t=Array.isArray(e)?e:new Array(n.length).fill(e);return n.map((r,i)=>i>0&&r<t[i]&&n[i-1]>=t[i-1])}function Ks(n,e){let t=Rr(n,e),r=Pr(n,e);return t.map((i,s)=>i||r[s])}function eo(n,e=1){return n.map((t,r)=>{if(r<e)return!1;for(let i=1;i<=e;i++)if(n[r-i+1]<=n[r-i])return!1;return!0})}function to(n,e=1){return n.map((t,r)=>{if(r<e)return!1;for(let i=1;i<=e;i++)if(n[r-i+1]>=n[r-i])return!1;return!0})}function no(n,e=1){return n.map((t,r)=>r<e?NaN:t-n[r-e])}function ro(n){let e=NaN;return n.map((t,r)=>t?(e=r,0):isNaN(e)?NaN:r-e)}function io(n,e,t=0){let r=[];return n.map((i,s)=>{i&&r.push(s);let o=r.length-1-t;return o>=0?e[r[o]]:NaN})}function qr(n,e,t){let r=n.length,i=new Array(r).fill(NaN),s=new Array(r),o=0,a=0;for(let l=0;l<r;l++){let u=n[l];if(!isNaN(u)){for(;a>o;){let c=n[s[a-1]];if(t?c<=u:c>=u)a--;else break}s[a++]=l}for(;a>o&&s[o]<=l-e;)o++;l>=e-1&&(i[l]=a>o?n[s[o]]:t?-1/0:1/0)}return i}function Ae(n,e){return qr(n,e,!0)}function We(n,e){return qr(n,e,!1)}function so(n,e=5,t=5){let r=n.length,i=new Array(r).fill(NaN);for(let s=e;s<r-t;s++){let o=n[s].high,a=!0;for(let l=s-e;l<=s+t;l++)if(l!==s&&n[l].high>=o){a=!1;break}a&&(i[s]=o)}return i}function oo(n,e=5,t=5){let r=n.length,i=new Array(r).fill(NaN);for(let s=e;s<r-t;s++){let o=n[s].low,a=!0;for(let l=s-e;l<=s+t;l++)if(l!==s&&n[l].low<=o){a=!1;break}a&&(i[s]=o)}return i}function Vr(n,e=20,t=2,r=i=>i.close){let i=n.length,s=new Array(i).fill(NaN),o=new Array(i).fill(NaN),a=new Array(i).fill(NaN),l=new Array(i),u=0,c=0;for(let m=0;m<i;m++){let d=r(n[m]);if(l[m]=d,u+=d,c+=d*d,m>=e){let f=l[m-e];u-=f,c-=f*f}if(m>=e-1){let f=u/e,g=Math.sqrt(Math.max(0,c/e-f*f));s[m]=f,o[m]=f+t*g,a[m]=f-t*g}}return{upper:o,mid:s,lower:a}}function ao(n,e=20,t=2){let{upper:r,mid:i,lower:s}=Vr(n,e,t);return i.map((o,a)=>isNaN(o)||o===0?NaN:(r[a]-s[a])/o)}function lo(n,e=20){let t=Ae(n.map(i=>i.high),e),r=We(n.map(i=>i.low),e);return{upper:t,mid:t.map((i,s)=>(i+r[s])/2),lower:r}}function uo(n,e=20,t=10,r=1.5){let i=Fe(n,e),s=Yt(n,t);return{upper:i.map((o,a)=>o+r*s[a]),mid:i,lower:i.map((o,a)=>o-r*s[a])}}function co(n,e=0){let t=new Array(n.length).fill(NaN),r=864e5,i=0,s=0,o=NaN;for(let a=0;a<n.length;a++){let l=Number(n[a].ts/1000000n),u=Math.floor((l-e*36e5)/r);u!==o&&(i=0,s=0,o=u);let c=(n[a].high+n[a].low+n[a].close)/3;i+=c*n[a].volume,s+=n[a].volume,t[a]=s===0?NaN:i/s}return t}function fo(n){let e=n.map(t=>(t.high+t.low)/2);return{jaw:nt(e,13),teeth:nt(e,8),lips:nt(e,5)}}function zr(n,e,t){let r=se(n,t),i=r.length,s=new Array(i).fill(NaN),o=0,a=0;for(let l=0;l<i;l++)if(o+=r[l],a+=r[l]*r[l],l>=e&&(o-=r[l-e],a-=r[l-e]*r[l-e]),l>=e-1){let u=o/e;s[l]=Math.sqrt(Math.max(0,a/e-u*u))}return s}function mo(n,e,t){return zr(n,e,t).map(r=>r*r)}function ho(n,e){function t(i,s){let o=new Array(i.length).fill(NaN),a=0,l=0;for(let u=0;u<i.length;u++)isNaN(i[u])||(a+=i[u],l++),u>=s&&!isNaN(i[u-s])&&(a-=i[u-s],l--),o[u]=l>0?a/l:NaN;return o}let r=t(n,e);return n.map((i,s)=>Math.abs(i-r[s]))}function go(n,e,t){let r=new Array(n.length).fill(NaN),i=0,s=0;for(let o=0;o<n.length;o++){if(i+=n[o],s+=e[o],o>=t&&(i-=n[o-t],s-=e[o-t]),o<t-1)continue;let a=i/t,l=s/t,u=0,c=0,m=0;for(let f=o-t+1;f<=o;f++){let g=n[f]-a,p=e[f]-l;u+=g*p,c+=g*g,m+=p*p}let d=Math.sqrt(c*m);r[o]=d===0?0:u/d}return r}var yo=Ae,po=We;function bo(n,e){let t=new Array(n.length).fill(NaN);for(let r=e-1;r<n.length;r++){let i=n.slice(r-e+1,r+1).sort((o,a)=>o-a),s=Math.floor(e/2);t[r]=e%2===0?(i[s-1]+i[s])/2:i[s]}return t}function wo(n,e){let t=[];for(let r=0;r<n.length&&r<e.length;r++)!isNaN(e[r])&&isFinite(e[r])&&t.push({t:n[r],price:e[r]});return t}function So(n){return n[n.length-1]}function To(n,e=0){return n==null||isNaN(n)?e:n}function ko(n,e,t,r=[],i=!1){return{type:"line",pts:n,color:e,width:t,dash:r,connect:i}}function xo(n,e,t,r=[]){return{type:"hline",price:n,color:e,width:t,dash:r}}function Oo(n,e,t=0,r=.2){return{type:"histogram",pts:n,color:e,base:t,gap:r}}function vo(n,e,t,r,i=12,s=!1,o="left",a="middle",l=!1,u=99999){return{type:"label",text:n,x:e,y:t,color:r,fontSize:i,bold:s,horzAlign:o,vertAlign:a,anchored:l,maxWidth:u}}function No(n,e,t){return{type:"fill",pts1:n,pts2:e,opts:t}}function Mo(n,e,t,r,i={}){return{type:"rect",t1:n,t2:t,price1:e,price2:r,...i}}function Do(n,e,t,r={}){return{type:"circle",t:n,price:e,radius:t,...r}}function Co(n,e,t=1,r=[]){return{type:"vline",t:n,color:e,width:t,dash:r}}function Io(n,e,t,r,i=10,s="",o=""){return{type:"arrow",t:n,price:e,direction:t,color:r,size:i,label:s,labelColor:o||r}}function Eo(n,e,t,r,i,s=1,o=[],a="none"){return{type:"trendline",t1:n,price1:e,t2:t,price2:r,color:i,width:s,dash:o,extend:a}}function Fo(n,e,t,r="",i=1){return{type:"band",priceHigh:n,priceLow:e,fillColor:t,borderColor:r,borderWidth:i}}function Ao(n,e={}){return{type:"polygon",pts:n,...e}}function Wo(n,e,t=3){return{type:"dots",pts:n,color:e,radius:t}}function Lo(n,e,t,r,i,s={}){return{type:"badge",t:n,price:e,text:t,textColor:r,bgColor:i,...s}}function Ro(n){let e=new Array(n.length).fill(0);for(let t=1;t<n.length;t++){let r=n[t].close>n[t-1].close?n[t].volume:n[t].close<n[t-1].close?-n[t].volume:0;e[t]=e[t-1]+r}return e}function Po(n,e=14){let t=n.length,r=new Array(t).fill(NaN),i=n.map(u=>(u.high+u.low+u.close)/3),s=new Array(t).fill(0),o=new Array(t).fill(0);for(let u=1;u<t;u++){let c=i[u]*n[u].volume;i[u]>i[u-1]?s[u]=c:i[u]<i[u-1]&&(o[u]=c)}let a=0,l=0;for(let u=1;u<t;u++)a+=s[u],l+=o[u],u>e&&(a-=s[u-e],l-=o[u-e]),u>=e&&(r[u]=l===0?100:100-100/(1+a/l));return r}function qo(n,e=20){let t=n.length,r=new Array(t).fill(NaN),i=n.map(o=>(o.high+o.low+o.close)/3),s=0;for(let o=0;o<t;o++){if(s+=i[o],o>=e&&(s-=i[o-e]),o<e-1)continue;let a=s/e,l=0;for(let u=o-e+1;u<=o;u++)l+=Math.abs(i[u]-a);l/=e,r[o]=l===0?0:(i[o]-a)/(.015*l)}return r}function Vo(n,e=14){let t=n.length,r=new Array(t).fill(NaN),i=Ae(n.map(o=>o.high),e),s=We(n.map(o=>o.low),e);for(let o=e-1;o<t;o++){let a=i[o],l=s[o];r[o]=a===l?-50:(a-n[o].close)/(a-l)*-100}return r}function zo(n,e=10,t=3){let r=n.length,i=Yt(n,e),s=new Array(r).fill(NaN),o=new Array(r).fill(NaN),a=new Array(r).fill(1),l=e;if(r<=l)return{trend:a,upper:s,lower:o};s[l]=(n[l].high+n[l].low)/2+t*i[l],o[l]=(n[l].high+n[l].low)/2-t*i[l];for(let u=l+1;u<r;u++){let c=(n[u].high+n[u].low)/2,m=c+t*i[u],d=c-t*i[u],f=n[u-1].close;s[u]=m<s[u-1]||f>s[u-1]?m:s[u-1],o[u]=d>o[u-1]||f<o[u-1]?d:o[u-1],a[u-1]===-1&&n[u].close>s[u-1]?a[u]=1:a[u-1]===1&&n[u].close<o[u-1]?a[u]=-1:a[u]=a[u-1]}return{trend:a,upper:s,lower:o}}function Bo(n,e,t){if(n.length===0)return[];let r=[],i=new Array(n.length);for(let l=0;l<n.length;l++)i[l]=Number(n[l].ts/1000000n);let s=l=>{let u=0,c=i.length;for(;u<c;){let m=u+c>>>1;i[m]<l?u=m+1:c=m}return u},o=new Map,a=l=>{let u=o.get(l);if(u)return u;u=[];let c=-1/0;for(let m=0;m<i.length;m++){if(i[m]<c)continue;let d=T.fromMillis(i[m],{zone:l});u.push({year:d.year,month:d.month,day:d.day}),c=d.startOf("day").plus({days:1}).toMillis()}return o.set(l,u),u};for(let l of e){let u=l.tz??t?.tz??"UTC";for(let{year:c,month:m,day:d}of a(u)){let f=T.fromObject({year:c,month:m,day:d,hour:l.startHour,minute:l.startMinute,second:0,millisecond:0},{zone:u}),g=T.fromObject({year:c,month:m,day:d,hour:l.endHour,minute:l.endMinute,second:0,millisecond:0},{zone:u});g<=f&&(g=g.plus({days:1}));let p=f.toMillis(),O=g.toMillis(),N=-1/0,k=1/0;for(let C=s(p);C<i.length&&i[C]<O;C++)n[C].high>N&&(N=n[C].high),n[C].low<k&&(k=n[C].low);N===-1/0||k===1/0||r.push({startTs:BigInt(p)*1000000n,endTs:BigInt(O)*1000000n,high:N,low:k,label:l.label,color:l.color})}}return r.sort((l,u)=>l.startTs<u.startTs?-1:l.startTs>u.startTs?1:0),r}var oe={sma:nt,ema:Fe,wma:rt,hma:Gs,rma:it,linreg:js,rsi:Js,stoch:Xs,macd:Qs,atr:Yt,tr:Lr,crossover:Rr,crossunder:Pr,cross:Ks,rising:eo,falling:to,change:no,barssince:ro,valuewhen:io,highest:Ae,lowest:We,pivotHigh:so,pivotLow:oo,bb:Vr,bbw:ao,donchian:lo,keltner:uo,vwap:co,alligator:fo,stdev:zr,variance:mo,dev:ho,correlation:go,max:yo,min:po,median:bo,toPoints:wo,last:So,nz:To,obv:Ro,mfi:Po,cci:qo,williamsR:Vo,supertrend:zo,sessionBoundaries:Bo,drawLine:ko,drawHLine:xo,drawHistogram:Oo,drawLabel:vo,fillBetween:No,drawRect:Mo,drawCircle:Do,drawVLine:Co,drawArrow:Io,drawTrendLine:Eo,drawBand:Fo,drawPolygon:Ao,drawDots:Wo,drawBadge:Lo};var Ht=Object.freeze({indicator:"indicator",drawing:"drawing",chartType:"chart-type",dataSource:"data-source",extension:"extension",strategy:"strategy"}),Gt=Object.freeze({mbo:"l3",l3:"l3",l2:"l2",ohlcv:"ohlcv",tick:"tick"}),jt=Object.freeze({overlay:"overlay",pane:"pane"}),Jt=Object.freeze({signal:"signal",stop:"stop",target:"target",reverse:"reverse",endOfData:"end-of-data"}),Xt={PluginType:Ht,DataLevel:Gt,Layout:jt,ExitReason:Jt};var Qt={initialCapital:1e5,commission:0,slippageTicks:0,tickSize:.01,contractSize:1,pyramiding:1,allowReverse:!0,qtyStep:1};function $o(n){if(!n.length)return 0;let e=[...n].sort((r,i)=>r-i),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function _o(n){if(n.length<2)return 0;let e=0;for(let i of n)e+=i;e/=n.length;let t=0;for(let i of n)t+=(i-e)*(i-e);let r=Math.sqrt(t/(n.length-1));return r===0?0:Math.sqrt(n.length)*e/r}var st=class{constructor(e={}){I(this,"cfg");I(this,"pending",[]);I(this,"pos",null);I(this,"trades",[]);I(this,"equityCurve",[]);I(this,"realized");I(this,"peak");I(this,"nextOrderId",1);I(this,"index",-1);I(this,"barsInPosition",0);I(this,"barCount",0);I(this,"markPrice",0);I(this,"closeRequested",!1);I(this,"barNs",0n);I(this,"slippagePaid",0);this.cfg={...Qt,...e},this.realized=this.cfg.initialCapital,this.peak=this.cfg.initialCapital}setBarNs(e){this.barNs=e}beginBar(e,t){if(this.index=t,this.markPrice=e.close,this.closeRequested&&(this.closeRequested=!1,this.pos)){let r=this.cfg.slippageTicks*this.cfg.tickSize;this.exit(e,e.open+(this.pos.side==="long"?-r:r),"signal")}this.pending.length&&this.processPending(e),this.pos&&this.checkBrackets(e)}endBar(e){this.barCount++,this.markPrice=e.close,this.pos&&(this.barsInPosition++,this.trackExcursion(e));let t=this.equity;t>this.peak&&(this.peak=t),this.equityCurve.push({ts:e.ts,equity:t,drawdown:this.peak>0?(this.peak-t)/this.peak:0})}finish(e){if(!this.pos||!e)return;this.exit(e,e.close,"end-of-data");let t=this.equityCurve[this.equityCurve.length-1];if(!t)return;let r=this.equity;r>this.peak&&(this.peak=r),t.equity=r,t.drawdown=this.peak>0?(this.peak-r)/this.peak:0}get equity(){return this.realized+this.unrealized()}get result(){return{trades:this.trades,equity:this.equityCurve,stats:this.computeStats(),position:this.pos,openOrders:this.pending}}api(){let e=this;return{buy:(t=1,r={})=>e.place("buy",t,r),sell:(t=1,r={})=>e.place("sell",t,r),close:()=>{e.pos&&(e.closeRequested=!0)},cancelAll:()=>{e.pending=[]},get position(){return e.pos},get equity(){return e.equity},get cash(){return e.realized},get openOrders(){return e.pending}}}place(e,t,r){let i=this.roundQty(t),s={id:this.nextOrderId++,side:e,qty:i,kind:r.limit!=null?"limit":r.stop!=null?"stop":"market",price:r.limit??r.stop,sl:r.sl,tp:r.tp,tag:r.tag,placedIndex:this.index};return this.pending.push(s),s.id}processPending(e){let t=[];for(let r of this.pending){if(r.placedIndex>=this.index){t.push(r);continue}let i=this.fillPrice(r,e);if(i==null){t.push(r);continue}this.execute(r,i,e)}this.pending=t}fillPrice(e,t){let r=this.cfg.slippageTicks*this.cfg.tickSize;if(e.kind==="market")return e.side==="buy"?t.open+r:t.open-r;let i=e.price;return e.kind==="limit"?e.side==="buy"&&t.low<=i||e.side==="sell"&&t.high>=i?i:null:e.side==="buy"&&t.high>=i?Math.max(i,t.open)+r:e.side==="sell"&&t.low<=i?Math.min(i,t.open)-r:null}execute(e,t,r){let i=e.side==="buy"?"long":"short";if(this.pos&&this.pos.side!==i){let s=Math.min(this.pos.qty,e.qty),o=e.qty-s,a=o>0&&this.cfg.allowReverse;this.exit(r,t,a?"reverse":"signal",s),a&&this.enter(i,o,t,r,e);return}if(this.pos&&this.pos.side===i){if(this.pos.entries>=this.maxEntries())return;let s=this.pos.qty+e.qty;this.pos.avgPrice=(this.pos.avgPrice*this.pos.qty+t*e.qty)/s,this.pos.qty=s,this.pos.entries++,e.sl!=null&&(this.pos.sl=e.sl),e.tp!=null&&(this.pos.tp=e.tp);let o=this.commissionFor(e.qty);this.pos.entryFees+=o,this.realized-=o,this.slippagePaid+=this.slippageCost(e.qty);return}this.enter(i,e.qty,t,r,e)}maxEntries(){return Math.max(1,Math.floor(this.cfg.pyramiding))}roundQty(e){let t=this.cfg.qtyStep>0?this.cfg.qtyStep:1,r=Math.abs(e),i=Math.floor(r/t)*t,s=(String(t).split(".")[1]??"").length;return i>0?Number(i.toFixed(s)):t}enter(e,t,r,i,s){let o=this.commissionFor(t);this.pos={side:e,qty:t,avgPrice:r,entryTs:i.ts,entryIndex:this.index,sl:s.sl,tp:s.tp,tag:s.tag,entryFees:o,highWatermark:r,lowWatermark:r,mfeIndex:this.index,mfeTs:i.ts,maeIndex:this.index,maeTs:i.ts,initialRiskPerUnit:s.sl!=null?Math.abs(r-s.sl):void 0,entries:1},this.barsInPosition=0,this.realized-=o,this.slippagePaid+=this.slippageCost(t)}slippageCost(e){return this.cfg.slippageTicks*this.cfg.tickSize*e*this.cfg.contractSize}exit(e,t,r,i){let s=this.pos;if(!s)return;let o=i??s.qty,a=s.side==="long"?1:-1,l=(t-s.avgPrice)*a*o*this.cfg.contractSize,u=this.commissionFor(o),c=s.qty>0?s.entryFees*o/s.qty:0,m=c+u;s.entryFees-=c,this.realized+=l-u,this.slippagePaid+=this.slippageCost(o);let d=s.avgPrice*o*this.cfg.contractSize,f=s.side==="long",g=o*this.cfg.contractSize,p=Math.max(0,f?s.highWatermark-s.avgPrice:s.avgPrice-s.lowWatermark),O=Math.max(0,f?s.avgPrice-s.lowWatermark:s.highWatermark-s.avgPrice),N=s.initialRiskPerUnit,k=N!=null?N*g:void 0,C=l-m,K=k&&k>0?C/k:void 0,ee=k&&k>0?p*g/k:void 0,ae=k&&k>0?-(O*g)/k:void 0,Y=p>0?Math.max(0,f?t-s.avgPrice:s.avgPrice-t)/p:void 0,$=p*g,q=Math.max(0,$-(l-m));this.trades.push({id:this.trades.length+1,side:s.side,qty:o,entryTs:s.entryTs,entryPrice:s.avgPrice,exitTs:e.ts,exitPrice:t,pnl:C,pnlGross:l,pnlPct:d>0?C/d:0,fees:m,commission:m,slippage:this.slippageCost(o)*2,bars:this.index-s.entryIndex,durationNs:e.ts-s.entryTs,tag:s.tag,reason:r,maeAbs:O,mfeAbs:p,maePnl:O*g,mfePnl:p*g,mfeTs:s.mfeTs,maeTs:s.maeTs,barsToMfe:s.mfeIndex-s.entryIndex,initialRiskPerUnit:N,initialRiskTotal:k,realizedR:K,maxFavorableR:ee,maxAdverseR:ae,efficiency:Y,maxDrawdownAbs:q,maxDrawdownPct:$>0?q/$:0,sl:s.sl,tp:s.tp}),o>=s.qty?(this.pos=null,this.barsInPosition=0):s.qty-=o}checkBrackets(e){let t=this.pos;if(t.sl==null&&t.tp==null)return;let r=this.cfg.slippageTicks*this.cfg.tickSize,i=t.side==="long",s=t.sl!=null&&(i?e.low<=t.sl:e.high>=t.sl),o=t.tp!=null&&(i?e.high>=t.tp:e.low<=t.tp);if(s){let a=i?Math.min(t.sl,e.open):Math.max(t.sl,e.open);this.exit(e,i?a-r:a+r,"stop");return}o&&this.exit(e,t.tp,"target")}trackExcursion(e){let t=this.pos;e.high>t.highWatermark&&(t.highWatermark=e.high,t.side==="long"?(t.mfeIndex=this.index,t.mfeTs=e.ts):(t.maeIndex=this.index,t.maeTs=e.ts)),e.low<t.lowWatermark&&(t.lowWatermark=e.low,t.side==="long"?(t.maeIndex=this.index,t.maeTs=e.ts):(t.mfeIndex=this.index,t.mfeTs=e.ts))}commissionFor(e){return this.cfg.commission*e}unrealized(){if(!this.pos)return 0;let e=this.pos.side==="long"?1:-1;return(this.markPrice-this.pos.avgPrice)*e*this.pos.qty*this.cfg.contractSize}computeStats(){let e=this.trades,t=this.cfg.initialCapital,r=0,i=0,s=0,o=0,a=0,l=0,u=0,c=0,m=0,d=0,f=0,g=0,p=0,O=0,N=0,k=0,C=0,K=0,ee=0,ae=0,Y=0,$=0,q=0,H=0,Le=0,Kt=0,at=0,en=0;for(let b of e)b.pnl>0?(r+=b.pnl,s++,c+=b.bars,f++,g=0,b.pnl>l&&(l=b.pnl)):b.pnl<0?(i+=b.pnl,o++,m+=b.bars,g++,f=0,b.pnl<u&&(u=b.pnl)):(a++,f=0,g=0),f>p&&(p=f),g>O&&(O=g),d+=b.bars,ee+=b.maeAbs,ae+=b.mfeAbs,at+=b.commission,en+=b.pnlGross,b.realizedR!==void 0&&(N+=b.realizedR,k++),b.efficiency!==void 0&&(C+=b.efficiency,K++),b.side==="long"?(Y++,Le+=b.pnl,b.pnl>0&&q++):($++,Kt+=b.pnl,b.pnl>0&&H++);let Se=0,Te=0,tn=0;for(let b of this.equityCurve){let sn=this.peakAt(b)-b.equity;sn>Se&&(Se=sn),b.drawdown>Te&&(Te=b.drawdown),tn+=b.drawdown*b.drawdown}let nn=this.equityCurve.length?this.equityCurve[this.equityCurve.length-1].equity:t,lt=nn-t,jr=t>0?lt/t:0,Re=s?r/s:0,ke=o?i/o:0,ut=e.length?s/e.length:0,rn=e.map(b=>b.pnl),ct=this.runYears();return{netPnl:lt,grossProfit:r,grossLoss:i,profitFactor:i===0?r>0?1/0:0:r/-i,totalTrades:e.length,wins:s,losses:o,winRate:ut,avgWin:Re,avgLoss:ke,expectancy:e.length?(r+i)/e.length:0,maxDrawdown:Se,maxDrawdownPct:Te,sharpe:this.sharpe(),returnPct:jr,exposure:this.barCount?this.barsInPositionTotal()/this.barCount:0,finalEquity:nn,largestWin:l,largestLoss:u,medianPnl:$o(rn),payoffRatio:ke!==0?Re/Math.abs(ke):Re>0?1/0:0,breakEvens:a,maxWinStreak:p,maxLossStreak:O,currentStreak:f>0?f:-g,avgBarsHeld:e.length?d/e.length:0,avgWinBarsHeld:s?c/s:0,avgLossBarsHeld:o?m/o:0,totalBars:this.barCount,sortino:this.sortino(),calmar:Te>0&&ct>0?this.cagr(ct)/Te:0,recoveryFactor:Se>0?lt/Se:0,ulcerIndex:this.equityCurve.length?Math.sqrt(tn/this.equityCurve.length):0,sqn:_o(rn),kelly:ke!==0?ut-(1-ut)/(Re/Math.abs(ke)):0,cagr:this.cagr(ct),tradesWithRisk:k,avgR:k?N/k:0,totalR:N,avgEfficiency:K?C/K:0,avgMae:e.length?ee/e.length:0,avgMfe:e.length?ae/e.length:0,longTrades:Y,shortTrades:$,longWinRate:Y?q/Y:0,shortWinRate:$?H/$:0,longPnl:Le,shortPnl:Kt,totalFees:at,totalCommission:at,totalSlippage:this.slippagePaid,grossPnlBeforeCosts:en}}runYears(){let e=this.equityCurve;if(e.length<2)return 0;let t=e[e.length-1].ts-e[0].ts;return t>0n?Number(t)/31536e12:0}cagr(e){let t=this.cfg.initialCapital;if(e<=0||t<=0)return 0;let r=this.equityCurve.length?this.equityCurve[this.equityCurve.length-1].equity:t;return r<=0?-1:Math.pow(r/t,1/e)-1}sortino(){let e=this.barReturns();if(e.length<2||this.barNs<=0n)return 0;let t=0;for(let a of e)t+=a;t/=e.length;let r=0,i=0;for(let a of e)a<0&&(r+=a*a,i++);if(!i)return 0;let s=Math.sqrt(r/i);if(s===0)return 0;let o=Number(31536000000000000n/this.barNs);return t/s*Math.sqrt(o)}barReturns(){let e=this.equityCurve,t=[];for(let r=1;r<e.length;r++){let i=e[r-1].equity;i>0&&t.push((e[r].equity-i)/i)}return t}peakAt(e){return e.drawdown>=1?e.equity:e.equity/(1-e.drawdown)}barsInPositionTotal(){let e=0;for(let t of this.trades)e+=t.bars;return this.pos&&(e+=this.barsInPosition),e}sharpe(){let e=this.equityCurve;if(e.length<3||this.barNs<=0n)return 0;let t=[];for(let a=1;a<e.length;a++){let l=e[a-1].equity;l>0&&t.push((e[a].equity-l)/l)}if(t.length<2)return 0;let r=0;for(let a of t)r+=a;r/=t.length;let i=0;for(let a of t)i+=(a-r)*(a-r);let s=Math.sqrt(i/(t.length-1));if(s===0)return 0;let o=Number(31536000000000000n/this.barNs);return r/s*Math.sqrt(o)}};function ot(n){if("values"in n)return n.values;let{from:e,to:t,step:r}=n;if(!isFinite(e)||!isFinite(t))return[];let i=r>0?r:0;if(i===0||e===t)return[e];let s=Math.min(e,t),o=Math.max(e,t),a=[],l=Math.floor((o-s)/i+1e-9)+1,u=(String(i).split(".")[1]??"").length;for(let c=0;c<l;c++)a.push(Number((s+c*i).toFixed(u)));return a}function Br(n){let e=n.filter(r=>ot(r).length>0);if(!e.length)return[{}];let t=[{}];for(let r of e){let i=ot(r),s=[];for(let o of t)for(let a of i)s.push({...o,[r.param]:a});if(t=s,t.length>2e4)return t.slice(0,20001)}return t}function $r(n,e){let t=n*e,r={combos:n,bars:e,iterations:t,ok:!0};return n>2e4?{...r,ok:!1,reason:`${n.toLocaleString()} combinations is past the limit of ${2e4.toLocaleString()}. Widen the step, or sweep fewer parameters at once.`}:t>2e8?{...r,ok:!1,reason:`${n.toLocaleString()} combinations over ${e.toLocaleString()} bars is ${t.toLocaleString()} bar evaluations, past what this browser will run (${2e8.toLocaleString()}). Shorten the range, widen the step, or sweep fewer parameters.`}:r}function _r(n,e){if(!e||e<=0||e>=.9||n<100)return null;let t=Math.floor(n*(1-e));return t<50||n-t<50?null:t}function Zr(n,e){let t=Math.floor(e.windows),r=Math.max(1,Math.floor(e.isMultiple));if(t<1||n<200)return[];let i=Math.floor(n/(t+r)),s=i*r;if(i<50||s<50)return[];let o=[];for(let a=0;a<t;a++){let l=a*i+s,u=l+i;if(u>n)break;o.push({index:a,isFrom:e.anchored?0:a*i,isTo:l,oosFrom:l,oosTo:u})}return o}function Ur(n){let e=0,t=0,r=0,i=0;for(let a of n)e+=a.inSample.netPnl,t+=a.window.isTo-a.window.isFrom,r+=a.outOfSample.netPnl,i+=a.window.oosTo-a.window.oosFrom;if(!t||!i)return 0;let s=e/t,o=r/i;return s<=0?0:o/s}function Yr(n){if(!n.length)return[];let e=new Set;for(let r of n)for(let i of Object.keys(r.params))e.add(i);let t=[];for(let r of e){let i=[];for(let l of n){let u=l.params[r];typeof u=="number"&&Number.isFinite(u)&&i.push(u)}if(i.length<2)continue;let s=0;for(let l of i)s+=l;s/=i.length;let o=0;for(let l of i)o+=(l-s)*(l-s);let a=Math.sqrt(o/i.length);t.push({param:r,values:i,distinct:new Set(i).size,coefficientOfVariation:s!==0?a/Math.abs(s):a===0?0:1/0})}return t}function Hr(n,e,t=!0){let r=null,i=t?-1/0:1/0;for(let s of n){let o=e(s);o===void 0||!Number.isFinite(o)||(t?o>i:o<i)&&(i=o,r=s)}return r}function Gr(n){let e={...Xt,Math,console,plugin:n.plugin};for(let[t,r]of Object.entries(oe))e[t]=r;if(n.shadowNetwork&&(e.fetch=void 0,e.XMLHttpRequest=void 0,e.WebSocket=void 0,e.importScripts=void 0),n.extra)for(let[t,r]of Object.entries(n.extra))e[t]=r;return e}function Zo(n,e){let t=Gr(e),r=Object.keys(t);new Function(...r,`"use strict";
2
+ ${n}`)(...r.map(i=>t[i]))}function Uo(n,e){let t=n;if(!t)return[];if(e==="pane"){let s=(t.equity??[]).map(o=>({t:o.ts,price:o.equity}));return s.length?[oe.drawLine(s,"#38bdf8",1.5,[],!0)]:[]}let r=[],i=t.trades??[];for(let s of i){let o=s.side==="long";r.push(oe.drawArrow(s.entryTs,s.entryPrice,o?"up":"down",o?"#22c55e":"#ef4444",9)),r.push(oe.drawArrow(s.exitTs,s.exitPrice,o?"down":"up",s.pnl>=0?"#22c55e":"#ef4444",7))}return r}var Yo=(()=>{let n=Object.keys(oe).sort().join(","),e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")})();0&&(module.exports={DEFAULT_STRATEGY_CONFIG,DataLevel,ExitReason,Layout,PluginType,SCRIPT_DSL,STDLIB,STDLIB_SIGNATURE,StrategyEngine,axisValues,buildScriptScope,checkSweepBudget,defaultStrategyDraw,evalScriptInScope,expandGrid,parameterStability,pickBest,planWalkForward,splitIndex,walkForwardEfficiency});
@@ -0,0 +1,2 @@
1
+ var Br=Object.defineProperty;var $r=(n,e,t)=>e in n?Br(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var I=(n,e,t)=>$r(n,typeof e!="symbol"?e+"":e,t);var U=class extends Error{},pt=class extends U{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},bt=class extends U{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},wt=class extends U{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},J=class extends U{},Ze=class extends U{constructor(e){super(`Invalid unit ${e}`)}},M=class extends U{},_=class extends U{constructor(){super("Zone is an abstract class")}},h="numeric",B="short",A="long",Ue={year:h,month:h,day:h},Cn={year:h,month:B,day:h},_r={year:h,month:B,day:h,weekday:B},In={year:h,month:A,day:h},En={year:h,month:A,day:h,weekday:A},Fn={hour:h,minute:h},An={hour:h,minute:h,second:h},Wn={hour:h,minute:h,second:h,timeZoneName:B},Ln={hour:h,minute:h,second:h,timeZoneName:A},Rn={hour:h,minute:h,hourCycle:"h23"},Pn={hour:h,minute:h,second:h,hourCycle:"h23"},qn={hour:h,minute:h,second:h,hourCycle:"h23",timeZoneName:B},Vn={hour:h,minute:h,second:h,hourCycle:"h23",timeZoneName:A},zn={year:h,month:h,day:h,hour:h,minute:h},Bn={year:h,month:h,day:h,hour:h,minute:h,second:h},$n={year:h,month:B,day:h,hour:h,minute:h},_n={year:h,month:B,day:h,hour:h,minute:h,second:h},Zr={year:h,month:B,day:h,weekday:B,hour:h,minute:h},Zn={year:h,month:A,day:h,hour:h,minute:h,timeZoneName:B},Un={year:h,month:A,day:h,hour:h,minute:h,second:h,timeZoneName:B},Yn={year:h,month:A,day:h,weekday:A,hour:h,minute:h,timeZoneName:A},Hn={year:h,month:A,day:h,weekday:A,hour:h,minute:h,second:h,timeZoneName:A},ie=class{get type(){throw new _}get name(){throw new _}get ianaName(){return this.name}get isUniversal(){throw new _}offsetName(e,t){throw new _}formatOffset(e,t){throw new _}offset(e){throw new _}equals(e){throw new _}get isValid(){throw new _}},lt=null,Ye=class n extends ie{static get instance(){return lt===null&&(lt=new n),lt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return ir(e,t,r)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},St=new Map;function Ur(n){let e=St.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),St.set(n,e)),e}var Yr={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Hr(n,e){let t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,s,o,a,l,u,c]=r;return[o,i,s,a,l,u,c]}function Gr(n,e){let t=n.formatToParts(e),r=[];for(let i=0;i<t.length;i++){let{type:s,value:o}=t[i],a=Yr[s];s==="era"?r[a]=o:y(a)||(r[a]=parseInt(o,10))}return r}var ut=new Map,Q=class n extends ie{static create(e){let t=ut.get(e);return t===void 0&&ut.set(e,t=new n(e)),t}static resetCache(){ut.clear(),St.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=n.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return ir(e,t,r,this.name)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let r=Ur(this.name),[i,s,o,a,l,u,c]=r.formatToParts?Gr(r,t):Hr(r,t);a==="BC"&&(i=-Math.abs(i)+1);let d=Qe({year:i,month:s,day:o,hour:l===24?0:l,minute:u,second:c,millisecond:0}),f=+t,g=f%1e3;return f-=g>=0?g:1e3+g,(d-f)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},Qt={};function jr(n,e={}){let t=JSON.stringify([n,e]),r=Qt[t];return r||(r=new Intl.ListFormat(n,e),Qt[t]=r),r}var Tt=new Map;function kt(n,e={}){let t=JSON.stringify([n,e]),r=Tt.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),Tt.set(t,r)),r}var xt=new Map;function Jr(n,e={}){let t=JSON.stringify([n,e]),r=xt.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),xt.set(t,r)),r}var Ot=new Map;function Xr(n,e={}){let{base:t,...r}=e,i=JSON.stringify([n,r]),s=Ot.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(n,e),Ot.set(i,s)),s}var Oe=null;function Qr(){return Oe||(Oe=new Intl.DateTimeFormat().resolvedOptions().locale,Oe)}var vt=new Map;function Gn(n){let e=vt.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),vt.set(n,e)),e}var Nt=new Map;function Kr(n){let e=Nt.get(n);if(!e){let t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...jn,...e}),Nt.set(n,e)}return e}function ei(n){let e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));let t=n.indexOf("-u-");if(t===-1)return[n];{let r,i;try{r=kt(n).resolvedOptions(),i=n}catch{let l=n.substring(0,t);r=kt(l).resolvedOptions(),i=l}let{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function ti(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function ni(n){let e=[];for(let t=1;t<=12;t++){let r=T.utc(2009,t,1);e.push(n(r))}return e}function ri(n){let e=[];for(let t=1;t<=7;t++){let r=T.utc(2016,11,13+t);e.push(n(r))}return e}function Pe(n,e,t,r){let i=n.listingMode();return i==="error"?null:i==="en"?t(e):r(e)}function ii(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||Gn(n.locale).numberingSystem==="latn"}var Mt=class{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:i,floor:s,...o}=r;if(!t||Object.keys(o).length>0){let a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=Jr(e,a)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):Vt(e,3);return v(t,this.padTo)}}},Dt=class{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Q.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=kt(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Ct=class{constructor(e,t,r){this.opts={style:"long",...r},!t&&nr()&&(this.rtf=Xr(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):vi(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},jn={firstDay:1,minimalDays:4,weekend:[6,7]},S=class n{static fromOpts(e){return n.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,i,s=!1){let o=e||x.defaultLocale,a=o||(s?"en-US":Qr()),l=t||x.defaultNumberingSystem,u=r||x.defaultOutputCalendar,c=Ft(i)||x.defaultWeekSettings;return new n(a,l,u,c,o)}static resetCache(){Oe=null,Tt.clear(),xt.clear(),Ot.clear(),vt.clear(),Nt.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:i}={}){return n.create(e,t,r,i)}constructor(e,t,r,i,s){let[o,a,l]=ei(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=r||l||null,this.weekSettings=i,this.intl=ti(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=ii(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:n.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ft(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Pe(this,e,ar,()=>{let r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;let i=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";if(!this.monthsCache[s][e]){let o=r?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[s][e]=ni(o)}return this.monthsCache[s][e]})}weekdays(e,t=!1){return Pe(this,e,cr,()=>{let r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=ri(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Pe(this,void 0,()=>fr,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[T.utc(2016,11,13,9),T.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Pe(this,e,mr,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[T.utc(-40,1,1),T.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){let i=this.dtFormatter(e,t),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new Mt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Dt(e,this.intl,t)}relFormatter(e={}){return new Ct(this.intl,this.isEnglish(),e)}listFormatter(e={}){return jr(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||Gn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:rr()?Kr(this.locale):jn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},ct=null,P=class n extends ie{static get utcInstance(){return ct===null&&(ct=new n(0)),ct}static instance(e){return e===0?n.utcInstance:new n(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new n(Ke(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Me(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Me(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Me(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},It=class extends ie{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function j(n,e){if(y(n)||n===null)return e;if(n instanceof ie)return n;if(ci(n)){let t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Ye.instance:t==="utc"||t==="gmt"?P.utcInstance:P.parseSpecifier(t)||Q.create(n)}else return X(n)?P.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new It(n)}var Lt={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Kt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},si=Lt.hanidec.replace(/[\[|\]]/g,"").split("");function oi(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(n[t].search(Lt.hanidec)!==-1)e+=si.indexOf(n[t]);else for(let i in Kt){let[s,o]=Kt[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}var Et=new Map;function ai(){Et.clear()}function V({numberingSystem:n},e=""){let t=n||"latn",r=Et.get(t);r===void 0&&(r=new Map,Et.set(t,r));let i=r.get(e);return i===void 0&&(i=new RegExp(`${Lt[t]}${e}`),r.set(e,i)),i}var en=()=>Date.now(),tn="system",nn=null,rn=null,sn=null,on=60,an,ln=null,x=class{static get now(){return en}static set now(e){en=e}static set defaultZone(e){tn=e}static get defaultZone(){return j(tn,Ye.instance)}static get defaultLocale(){return nn}static set defaultLocale(e){nn=e}static get defaultNumberingSystem(){return rn}static set defaultNumberingSystem(e){rn=e}static get defaultOutputCalendar(){return sn}static set defaultOutputCalendar(e){sn=e}static get defaultWeekSettings(){return ln}static set defaultWeekSettings(e){ln=Ft(e)}static get twoDigitCutoffYear(){return on}static set twoDigitCutoffYear(e){on=e%100}static get throwOnInvalid(){return an}static set throwOnInvalid(e){an=e}static resetCaches(){S.resetCache(),Q.resetCache(),T.resetCache(),ai()}},F=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},Jn=[0,31,59,90,120,151,181,212,243,273,304,334],Xn=[0,31,60,91,121,152,182,213,244,274,305,335];function L(n,e){return new F("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Rt(n,e,t){let r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function Qn(n,e,t){return t+(Ce(n)?Xn:Jn)[e-1]}function Kn(n,e){let t=Ce(n)?Xn:Jn,r=t.findIndex(s=>s<e),i=e-t[r];return{month:r+1,day:i}}function Pt(n,e){return(n-e+7)%7+1}function He(n,e=4,t=1){let{year:r,month:i,day:s}=n,o=Qn(r,i,s),a=Pt(Rt(r,i,s),t),l=Math.floor((o-a+14-e)/7),u;return l<1?(u=r-1,l=De(u,e,t)):l>De(r,e,t)?(u=r+1,l=1):u=r,{weekYear:u,weekNumber:l,weekday:a,...et(n)}}function un(n,e=4,t=1){let{weekYear:r,weekNumber:i,weekday:s}=n,o=Pt(Rt(r,1,e),t),a=fe(r),l=i*7+s-o-7+e,u;l<1?(u=r-1,l+=fe(u)):l>a?(u=r+1,l-=fe(r)):u=r;let{month:c,day:m}=Kn(u,l);return{year:u,month:c,day:m,...et(n)}}function ft(n){let{year:e,month:t,day:r}=n,i=Qn(e,t,r);return{year:e,ordinal:i,...et(n)}}function cn(n){let{year:e,ordinal:t}=n,{month:r,day:i}=Kn(e,t);return{year:e,month:r,day:i,...et(n)}}function fn(n,e){if(!y(n.localWeekday)||!y(n.localWeekNumber)||!y(n.localWeekYear)){if(!y(n.weekday)||!y(n.weekNumber)||!y(n.weekYear))throw new J("Cannot mix locale-based week fields with ISO-based week fields");return y(n.localWeekday)||(n.weekday=n.localWeekday),y(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),y(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function li(n,e=4,t=1){let r=Xe(n.weekYear),i=R(n.weekNumber,1,De(n.weekYear,e,t)),s=R(n.weekday,1,7);return r?i?s?!1:L("weekday",n.weekday):L("week",n.weekNumber):L("weekYear",n.weekYear)}function ui(n){let e=Xe(n.year),t=R(n.ordinal,1,fe(n.year));return e?t?!1:L("ordinal",n.ordinal):L("year",n.year)}function er(n){let e=Xe(n.year),t=R(n.month,1,12),r=R(n.day,1,Ge(n.year,n.month));return e?t?r?!1:L("day",n.day):L("month",n.month):L("year",n.year)}function tr(n){let{hour:e,minute:t,second:r,millisecond:i}=n,s=R(e,0,23)||e===24&&t===0&&r===0&&i===0,o=R(t,0,59),a=R(r,0,59),l=R(i,0,999);return s?o?a?l?!1:L("millisecond",i):L("second",r):L("minute",t):L("hour",e)}function y(n){return typeof n>"u"}function X(n){return typeof n=="number"}function Xe(n){return typeof n=="number"&&n%1===0}function ci(n){return typeof n=="string"}function fi(n){return Object.prototype.toString.call(n)==="[object Date]"}function nr(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function rr(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function mi(n){return Array.isArray(n)?n:[n]}function mn(n,e,t){if(n.length!==0)return n.reduce((r,i)=>{let s=[e(i),i];return r&&t(r[0],s[0])===r[0]?r:s},null)[1]}function hi(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function de(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Ft(n){if(n==null)return null;if(typeof n!="object")throw new M("Week settings must be an object");if(!R(n.firstDay,1,7)||!R(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!R(e,1,7)))throw new M("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function R(n,e,t){return Xe(n)&&n>=e&&n<=t}function di(n,e){return n-e*Math.floor(n/e)}function v(n,e=2){let t=n<0,r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function G(n){if(!(y(n)||n===null||n===""))return parseInt(n,10)}function te(n){if(!(y(n)||n===null||n===""))return parseFloat(n)}function qt(n){if(!(y(n)||n===null||n==="")){let e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Vt(n,e,t="round"){let r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Ce(n){return n%4===0&&(n%100!==0||n%400===0)}function fe(n){return Ce(n)?366:365}function Ge(n,e){let t=di(e-1,12)+1,r=n+(e-t)/12;return t===2?Ce(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Qe(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function hn(n,e,t){return-Pt(Rt(n,1,e),t)+e-1}function De(n,e=4,t=1){let r=hn(n,e,t),i=hn(n+1,e,t);return(fe(n)-r+i)/7}function At(n){return n>99?n:n>x.twoDigitCutoffYear?1900+n:2e3+n}function ir(n,e,t,r=null){let i=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);let o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(t,o).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function Ke(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);let r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function sr(n){let e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new M(`Invalid unit value ${n}`);return e}function je(n,e){let t={};for(let r in n)if(de(n,r)){let i=n[r];if(i==null)continue;t[e(r)]=sr(i)}return t}function Me(n,e){let t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return`${i}${v(t,2)}:${v(r,2)}`;case"narrow":return`${i}${t}${r>0?`:${r}`:""}`;case"techie":return`${i}${v(t,2)}${v(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function et(n){return hi(n,["hour","minute","second","millisecond"])}var gi=["January","February","March","April","May","June","July","August","September","October","November","December"],or=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yi=["J","F","M","A","M","J","J","A","S","O","N","D"];function ar(n){switch(n){case"narrow":return[...yi];case"short":return[...or];case"long":return[...gi];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var lr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ur=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],pi=["M","T","W","T","F","S","S"];function cr(n){switch(n){case"narrow":return[...pi];case"short":return[...ur];case"long":return[...lr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var fr=["AM","PM"],bi=["Before Christ","Anno Domini"],wi=["BC","AD"],Si=["B","A"];function mr(n){switch(n){case"narrow":return[...Si];case"short":return[...wi];case"long":return[...bi];default:return null}}function Ti(n){return fr[n.hour<12?0:1]}function ki(n,e){return cr(e)[n.weekday-1]}function xi(n,e){return ar(e)[n.month-1]}function Oi(n,e){return mr(e)[n.year<0?0:1]}function vi(n,e,t="always",r=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){let m=n==="days";switch(e){case 1:return m?"tomorrow":`next ${i[n][0]}`;case-1:return m?"yesterday":`last ${i[n][0]}`;case 0:return m?"today":`this ${i[n][0]}`}}let o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,u=i[n],c=r?l?u[1]:u[2]||u[1]:l?i[n][0]:n;return o?`${a} ${c} ago`:`in ${a} ${c}`}function dn(n,e){let t="";for(let r of n)r.literal?t+=r.val:t+=e(r.val);return t}var Ni={D:Ue,DD:Cn,DDD:In,DDDD:En,t:Fn,tt:An,ttt:Wn,tttt:Ln,T:Rn,TT:Pn,TTT:qn,TTTT:Vn,f:zn,ff:$n,fff:Zn,ffff:Yn,F:Bn,FF:_n,FFF:Un,FFFF:Hn},E=class n{static create(e,t={}){return new n(e,t)}static parseFormat(e){let t=null,r="",i=!1,s=[];for(let o=0;o<e.length;o++){let a=e.charAt(o);a==="'"?((r.length>0||i)&&s.push({literal:i||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",i=!i):i||a===t?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,t=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return Ni[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return v(e,t);let i={...this.opts};return t>0&&(i.padTo=t),r&&(i.signDisplay=r),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){let r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(f,g)=>this.loc.extract(e,f,g),o=f=>e.isOffsetFixed&&e.offset===0&&f.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,f.format):"",a=()=>r?Ti(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(f,g)=>r?xi(e,f):s(g?{month:f}:{month:f,day:"numeric"},"month"),u=(f,g)=>r?ki(e,f):s(g?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),c=f=>{let g=n.macroTokenToFormatOpts(f);return g?this.formatWithSystemDefault(e,g):f},m=f=>r?Oi(e,f):s({era:f},"era"),d=f=>{switch(f){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(f)}};return dn(n.parseFormat(t),d)}formatDurationFromString(e,t){let r=this.opts.signMode==="negativeLargestOnly"?-1:1,i=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=(c,m)=>d=>{let f=i(d);if(f){let g=m.isNegativeDuration&&f!==m.largestUnit?r:1,p;return this.opts.signMode==="negativeLargestOnly"&&f!==m.largestUnit?p="never":this.opts.signMode==="all"?p="always":p="auto",this.num(c.get(f)*g,d.length,p)}else return d},o=n.parseFormat(t),a=o.reduce((c,{literal:m,val:d})=>m?c:c.concat(d),[]),l=e.shiftTo(...a.map(i).filter(c=>c)),u={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return dn(o,s(l,u))}},hr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ge(...n){let e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function ye(...n){return e=>n.reduce(([t,r,i],s)=>{let[o,a,l]=s(e,i);return[{...t,...o},a||r,l]},[{},null,1]).slice(0,2)}function pe(n,...e){if(n==null)return[null,null];for(let[t,r]of e){let i=t.exec(n);if(i)return r(i)}return[null,null]}function dr(...n){return(e,t)=>{let r={},i;for(i=0;i<n.length;i++)r[n[i]]=G(e[t+i]);return[r,null,t+i]}}var gr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Mi=`(?:${gr.source}?(?:\\[(${hr.source})\\])?)?`,zt=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,yr=RegExp(`${zt.source}${Mi}`),Bt=RegExp(`(?:[Tt]${yr.source})?`),Di=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ci=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Ii=/(\d{4})-?(\d{3})/,Ei=dr("weekYear","weekNumber","weekDay"),Fi=dr("year","ordinal"),Ai=/(\d{4})-(\d\d)-(\d\d)/,pr=RegExp(`${zt.source} ?(?:${gr.source}|(${hr.source}))?`),Wi=RegExp(`(?: ${pr.source})?`);function me(n,e,t){let r=n[e];return y(r)?t:G(r)}function Li(n,e){return[{year:me(n,e),month:me(n,e+1,1),day:me(n,e+2,1)},null,e+3]}function be(n,e){return[{hours:me(n,e,0),minutes:me(n,e+1,0),seconds:me(n,e+2,0),milliseconds:qt(n[e+3])},null,e+4]}function Ie(n,e){let t=!n[e]&&!n[e+1],r=Ke(n[e+1],n[e+2]),i=t?null:P.instance(r);return[{},i,e+3]}function Ee(n,e){let t=n[e]?Q.create(n[e]):null;return[{},t,e+1]}var Ri=RegExp(`^T?${zt.source}$`),Pi=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function qi(n){let[e,t,r,i,s,o,a,l,u]=n,c=e[0]==="-",m=l&&l[0]==="-",d=(f,g=!1)=>f!==void 0&&(g||f&&c)?-f:f;return[{years:d(te(t)),months:d(te(r)),weeks:d(te(i)),days:d(te(s)),hours:d(te(o)),minutes:d(te(a)),seconds:d(te(l),l==="-0"),milliseconds:d(qt(u),m)}]}var Vi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function $t(n,e,t,r,i,s,o){let a={year:e.length===2?At(G(e)):G(e),month:or.indexOf(t)+1,day:G(r),hour:G(i),minute:G(s)};return o&&(a.second=G(o)),n&&(a.weekday=n.length>3?lr.indexOf(n)+1:ur.indexOf(n)+1),a}var zi=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Bi(n){let[,e,t,r,i,s,o,a,l,u,c,m]=n,d=$t(e,i,r,t,s,o,a),f;return l?f=Vi[l]:u?f=0:f=Ke(c,m),[d,new P(f)]}function $i(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var _i=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Zi=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ui=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function gn(n){let[,e,t,r,i,s,o,a]=n;return[$t(e,i,r,t,s,o,a),P.utcInstance]}function Yi(n){let[,e,t,r,i,s,o,a]=n;return[$t(e,a,t,r,i,s,o),P.utcInstance]}var Hi=ge(Di,Bt),Gi=ge(Ci,Bt),ji=ge(Ii,Bt),Ji=ge(yr),br=ye(Li,be,Ie,Ee),Xi=ye(Ei,be,Ie,Ee),Qi=ye(Fi,be,Ie,Ee),Ki=ye(be,Ie,Ee);function es(n){return pe(n,[Hi,br],[Gi,Xi],[ji,Qi],[Ji,Ki])}function ts(n){return pe($i(n),[zi,Bi])}function ns(n){return pe(n,[_i,gn],[Zi,gn],[Ui,Yi])}function rs(n){return pe(n,[Pi,qi])}var is=ye(be);function ss(n){return pe(n,[Ri,is])}var os=ge(Ai,Wi),as=ge(pr),ls=ye(be,Ie,Ee);function us(n){return pe(n,[os,br],[as,ls])}var yn="Invalid Duration",wr={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},cs={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...wr},W=146097/400,ae=146097/4800,fs={years:{quarters:4,months:12,weeks:W/7,days:W,hours:W*24,minutes:W*24*60,seconds:W*24*60*60,milliseconds:W*24*60*60*1e3},quarters:{months:3,weeks:W/28,days:W/4,hours:W*24/4,minutes:W*24*60/4,seconds:W*24*60*60/4,milliseconds:W*24*60*60*1e3/4},months:{weeks:ae/7,days:ae,hours:ae*24,minutes:ae*24*60,seconds:ae*24*60*60,milliseconds:ae*24*60*60*1e3},...wr},re=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ms=re.slice(0).reverse();function Z(n,e,t=!1){let r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new D(r)}function Sr(n,e){let t=e.milliseconds??0;for(let r of ms.slice(1))e[r]&&(t+=e[r]*n[r].milliseconds);return t}function pn(n,e){let t=Sr(n,e)<0?-1:1;re.reduceRight((r,i)=>{if(y(e[i]))return r;if(r){let s=e[r]*t,o=n[i][r],a=Math.floor(s/o);e[i]+=a*t,e[r]-=a*o*t}return i},null),re.reduce((r,i)=>{if(y(e[i]))return r;if(r){let s=e[r]%1;e[r]-=s,e[i]+=s*n[r][i]}return i},null)}function bn(n){let e={};for(let[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}var D=class n{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,r=t?fs:cs;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||S.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return n.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new M(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new n({values:je(e,n.normalizeUnit),loc:S.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(X(e))return n.fromMillis(e);if(n.isDuration(e))return e;if(typeof e=="object")return n.fromObject(e);throw new M(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[r]=rs(e);return r?n.fromObject(r,t):n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[r]=ss(e);return r?n.fromObject(r,t):n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new M("need to specify a reason the Duration is invalid");let r=e instanceof F?e:new F(e,t);if(x.throwOnInvalid)throw new wt(r);return new n({invalid:r})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Ze(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?E.create(this.loc,r).formatDurationFromString(this,e):yn}toHuman(e={}){if(!this.isValid)return yn;let t=e.showZeros!==!1,r=re.map(i=>{let s=this.values[i];return y(s)||s===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Vt(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},T.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Sr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=n.fromDurationLike(e),r={};for(let i of re)(de(t.values,i)||de(this.values,i))&&(r[i]=t.get(i)+this.get(i));return Z(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let t=n.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=sr(e(this.values[r],r));return Z(this,{values:t},!0)}get(e){return this[n.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...je(e,n.normalizeUnit)};return Z(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:i}={}){let o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:r};return Z(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return pn(this.matrix,e),Z(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=bn(this.normalize().shiftToAll().toObject());return Z(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>n.normalizeUnit(o));let t={},r={},i=this.toObject(),s;for(let o of re)if(e.indexOf(o)>=0){s=o;let a=0;for(let u in r)a+=this.matrix[u][o]*r[u],r[u]=0;X(i[o])&&(a+=i[o]);let l=Math.trunc(a);t[o]=l,r[o]=(a*1e3-l*1e3)/1e3}else X(i[o])&&(r[o]=i[o]);for(let o in r)r[o]!==0&&(t[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return pn(this.matrix,t),Z(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Z(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=bn(this.values);return Z(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(let r of re)if(!t(this.values[r],e.values[r]))return!1;return!0}},le="Invalid Interval";function hs(n,e){return!n||!n.isValid?he.invalid("missing or invalid start"):!e||!e.isValid?he.invalid("missing or invalid end"):e<n?he.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}var he=class n{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new M("need to specify a reason the Interval is invalid");let r=e instanceof F?e:new F(e,t);if(x.throwOnInvalid)throw new bt(r);return new n({invalid:r})}static fromDateTimes(e,t){let r=xe(e),i=xe(t),s=hs(r,i);return s??new n({start:r,end:i})}static after(e,t){let r=D.fromDurationLike(t),i=xe(e);return n.fromDateTimes(i,i.plus(r))}static before(e,t){let r=D.fromDurationLike(t),i=xe(e);return n.fromDateTimes(i.minus(r),i)}static fromISO(e,t){let[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=T.fromISO(r,t),o=s.isValid}catch{o=!1}let a,l;try{a=T.fromISO(i,t),l=a.isValid}catch{l=!1}if(o&&l)return n.fromDateTimes(s,a);if(o){let u=D.fromISO(i,t);if(u.isValid)return n.after(s,u)}else if(l){let u=D.fromISO(r,t);if(u.isValid)return n.before(a,u)}}return n.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;let r=this.start.startOf(e,t),i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:r.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(r,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?n.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(xe).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),r=[],{s:i}=this,s=0;for(;i<this.e;){let o=t[s]||this.e,a=+o>+this.e?this.e:o;r.push(n.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){let t=D.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,i=1,s,o=[];for(;r<this.e;){let a=this.start.plus(t.mapUnits(l=>l*i));s=+a>+this.e?this.e:a,o.push(n.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:n.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return n.fromDateTimes(t,r)}static merge(e){let[t,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0,i=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((l,u)=>l.time-u.time);for(let l of a)r+=l.type==="s"?1:-1,r===1?t=l.time:(t&&+t!=+l.time&&i.push(n.fromDateTimes(t,l.time)),t=null);return n.merge(i)}difference(...e){return n.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:le}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ue,t={}){return this.isValid?E.create(this.s.loc.clone(t),e).formatInterval(this):le}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:le}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:le}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:le}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:le}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):D.invalid(this.invalidReason)}mapEndpoints(e){return n.fromDateTimes(e(this.s),e(this.e))}},ce=class{static hasDST(e=x.defaultZone){let t=T.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Q.isValidZone(e)}static normalizeZone(e){return j(e,x.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||S.create(t,r,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||S.create(t,r,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||S.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:i=null}={}){return(i||S.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return S.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return S.create(t,null,"gregory").eras(e)}static features(){return{relative:nr(),localeWeek:rr()}}};function wn(n,e){let t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(D.fromMillis(r).as("days"))}function ds(n,e,t){let r=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{let c=wn(l,u);return(c-c%7)/7}],["days",wn]],i={},s=n,o,a;for(let[l,u]of r)t.indexOf(l)>=0&&(o=l,i[l]=u(n,e),a=s.plus(i),a>e?(i[l]--,n=s.plus(i),n>e&&(a=n,i[l]--,n=s.plus(i))):n=a);return[n,i,a,o]}function gs(n,e,t,r){let[i,s,o,a]=ds(n,e,t),l=e-i,u=t.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);u.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));let c=D.fromObject(s,r);return u.length>0?D.fromMillis(l,r).shiftTo(...u).plus(c):c}var ys="missing Intl.DateTimeFormat.formatToParts support";function w(n,e=t=>t){return{regex:n,deser:([t])=>e(oi(t))}}var ps="\xA0",Tr=`[ ${ps}]`,kr=new RegExp(Tr,"g");function bs(n){return n.replace(/\./g,"\\.?").replace(kr,Tr)}function Sn(n){return n.replace(/\./g,"").replace(kr," ").toLowerCase()}function z(n,e){return n===null?null:{regex:RegExp(n.map(bs).join("|")),deser:([t])=>n.findIndex(r=>Sn(t)===Sn(r))+e}}function Tn(n,e){return{regex:n,deser:([,t,r])=>Ke(t,r),groups:e}}function qe(n){return{regex:n,deser:([e])=>e}}function ws(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ss(n,e){let t=V(e),r=V(e,"{2}"),i=V(e,"{3}"),s=V(e,"{4}"),o=V(e,"{6}"),a=V(e,"{1,2}"),l=V(e,"{1,3}"),u=V(e,"{1,6}"),c=V(e,"{1,9}"),m=V(e,"{2,4}"),d=V(e,"{4,6}"),f=O=>({regex:RegExp(ws(O.val)),deser:([N])=>N,literal:!0}),p=(O=>{if(n.literal)return f(O);switch(O.val){case"G":return z(e.eras("short"),0);case"GG":return z(e.eras("long"),0);case"y":return w(u);case"yy":return w(m,At);case"yyyy":return w(s);case"yyyyy":return w(d);case"yyyyyy":return w(o);case"M":return w(a);case"MM":return w(r);case"MMM":return z(e.months("short",!0),1);case"MMMM":return z(e.months("long",!0),1);case"L":return w(a);case"LL":return w(r);case"LLL":return z(e.months("short",!1),1);case"LLLL":return z(e.months("long",!1),1);case"d":return w(a);case"dd":return w(r);case"o":return w(l);case"ooo":return w(i);case"HH":return w(r);case"H":return w(a);case"hh":return w(r);case"h":return w(a);case"mm":return w(r);case"m":return w(a);case"q":return w(a);case"qq":return w(r);case"s":return w(a);case"ss":return w(r);case"S":return w(l);case"SSS":return w(i);case"u":return qe(c);case"uu":return qe(a);case"uuu":return w(t);case"a":return z(e.meridiems(),0);case"kkkk":return w(s);case"kk":return w(m,At);case"W":return w(a);case"WW":return w(r);case"E":case"c":return w(t);case"EEE":return z(e.weekdays("short",!1),1);case"EEEE":return z(e.weekdays("long",!1),1);case"ccc":return z(e.weekdays("short",!0),1);case"cccc":return z(e.weekdays("long",!0),1);case"Z":case"ZZ":return Tn(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Tn(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return qe(/[a-z_+-/]{1,256}?/i);case" ":return qe(/[^\S\n\r]/);default:return f(O)}})(n)||{invalidReason:ys};return p.token=n,p}var Ts={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function ks(n,e,t){let{type:r,value:i}=n;if(r==="literal"){let l=/^\s+$/.test(i);return{literal:!l,val:l?" ":i}}let s=e[r],o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let a=Ts[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function xs(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function Os(n,e,t){let r=n.match(e);if(r){let i={},s=1;for(let o in t)if(de(t,o)){let a=t[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+l))),s+=l}return[r,i]}else return[r,{}]}function vs(n){let e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,r;return y(n.z)||(t=Q.create(n.z)),y(n.Z)||(t||(t=new P(n.Z)),r=n.Z),y(n.q)||(n.M=(n.q-1)*3+1),y(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),y(n.u)||(n.S=qt(n.u)),[Object.keys(n).reduce((s,o)=>{let a=e(o);return a&&(s[a]=n[o]),s},{}),t,r]}var mt=null;function Ns(){return mt||(mt=T.fromMillis(1555555555555)),mt}function Ms(n,e){if(n.literal)return n;let t=E.macroTokenToFormatOpts(n.val),r=vr(t,e);return r==null||r.includes(void 0)?n:r}function xr(n,e){return Array.prototype.concat(...n.map(t=>Ms(t,e)))}var Je=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=xr(E.parseFormat(t),e),this.units=this.tokens.map(r=>Ss(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){let[r,i]=xs(this.units);this.regex=RegExp(r,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){let[t,r]=Os(e,this.regex,this.handlers),[i,s,o]=r?vs(r):[null,null,void 0];if(de(r,"a")&&de(r,"H"))throw new J("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:i,zone:s,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Or(n,e,t){return new Je(n,t).explainFromTokens(e)}function Ds(n,e,t){let{result:r,zone:i,specificOffset:s,invalidReason:o}=Or(n,e,t);return[r,i,s,o]}function vr(n,e){if(!n)return null;let r=E.create(e,n).dtFormatter(Ns()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>ks(o,n,s))}var ht="Invalid DateTime",kn=864e13;function ve(n){return new F("unsupported zone",`the zone "${n.name}" is not supported`)}function dt(n){return n.weekData===null&&(n.weekData=He(n.c)),n.weekData}function gt(n){return n.localWeekData===null&&(n.localWeekData=He(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ne(n,e){let t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new T({...t,...e,old:t})}function Nr(n,e,t){let r=n-e*60*1e3,i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;let s=t.offset(r);return i===s?[r,i]:[n-Math.min(i,s)*60*1e3,Math.max(i,s)]}function Ve(n,e){n+=e*60*1e3;let t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Be(n,e,t){return Nr(Qe(n),e,t)}function xn(n,e){let t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:r,month:i,day:Math.min(n.c.day,Ge(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=D.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Qe(s),[l,u]=Nr(a,t,n.zone);return o!==0&&(l+=o,u=n.zone.offset(l)),{ts:l,o:u}}function ue(n,e,t,r,i,s){let{setZone:o,zone:a}=t;if(n&&Object.keys(n).length!==0||e){let l=e||a,u=T.fromObject(n,{...t,zone:l,specificOffset:s});return o?u:u.setZone(a)}else return T.invalid(new F("unparsable",`the input "${i}" can't be parsed as ${r}`))}function ze(n,e,t=!0){return n.isValid?E.create(S.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function yt(n,e,t){let r=n.c.year>9999||n.c.year<0,i="";if(r&&n.c.year>=0&&(i+="+"),i+=v(n.c.year,r?6:4),t==="year")return i;if(e){if(i+="-",i+=v(n.c.month),t==="month")return i;i+="-"}else if(i+=v(n.c.month),t==="month")return i;return i+=v(n.c.day),i}function On(n,e,t,r,i,s,o){let a=!t||n.c.millisecond!==0||n.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=v(n.c.hour),o==="hour")break;if(e){if(l+=":",l+=v(n.c.minute),o==="minute")break;a&&(l+=":",l+=v(n.c.second))}else{if(l+=v(n.c.minute),o==="minute")break;a&&(l+=v(n.c.second))}if(o==="second")break;a&&(!r||n.c.millisecond!==0)&&(l+=".",l+=v(n.c.millisecond,3))}return i&&(n.isOffsetFixed&&n.offset===0&&!s?l+="Z":n.o<0?(l+="-",l+=v(Math.trunc(-n.o/60)),l+=":",l+=v(Math.trunc(-n.o%60))):(l+="+",l+=v(Math.trunc(n.o/60)),l+=":",l+=v(Math.trunc(n.o%60)))),s&&(l+="["+n.zone.ianaName+"]"),l}var Mr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Cs={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Is={ordinal:1,hour:0,minute:0,second:0,millisecond:0},$e=["year","month","day","hour","minute","second","millisecond"],Es=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Fs=["year","ordinal","hour","minute","second","millisecond"];function _e(n){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Ze(n);return e}function vn(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return _e(n)}}function As(n){if(Ne===void 0&&(Ne=x.now()),n.type!=="iana")return n.offset(Ne);let e=n.name,t=Wt.get(e);return t===void 0&&(t=n.offset(Ne),Wt.set(e,t)),t}function Nn(n,e){let t=j(e.zone,x.defaultZone);if(!t.isValid)return T.invalid(ve(t));let r=S.fromObject(e),i,s;if(y(n.year))i=x.now();else{for(let l of $e)y(n[l])&&(n[l]=Mr[l]);let o=er(n)||tr(n);if(o)return T.invalid(o);let a=As(t);[i,s]=Be(n,a,t)}return new T({ts:i,zone:t,loc:r,o:s})}function Mn(n,e,t){let r=y(t.round)?!0:t.round,i=y(t.rounding)?"trunc":t.rounding,s=(a,l)=>(a=Vt(a,r||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(a,l)),o=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return s(o(t.unit),t.unit);for(let a of t.units){let l=o(a);if(Math.abs(l)>=1)return s(l,a)}return s(n>e?-0:0,t.units[t.units.length-1])}function Dn(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}var Ne,Wt=new Map,T=class n{constructor(e){let t=e.zone||x.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new F("invalid input"):null)||(t.isValid?null:ve(t));this.ts=y(e.ts)?x.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,s]=[e.old.c,e.old.o];else{let a=X(e.o)&&!e.old?e.o:t.offset(this.ts);i=Ve(this.ts,a),r=Number.isNaN(i.year)?new F("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=t,this.loc=e.loc||S.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new n({})}static local(){let[e,t]=Dn(arguments),[r,i,s,o,a,l,u]=t;return Nn({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:u},e)}static utc(){let[e,t]=Dn(arguments),[r,i,s,o,a,l,u]=t;return e.zone=P.utcInstance,Nn({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:u},e)}static fromJSDate(e,t={}){let r=fi(e)?e.valueOf():NaN;if(Number.isNaN(r))return n.invalid("invalid input");let i=j(t.zone,x.defaultZone);return i.isValid?new n({ts:r,zone:i,loc:S.fromObject(t)}):n.invalid(ve(i))}static fromMillis(e,t={}){if(X(e))return e<-kn||e>kn?n.invalid("Timestamp out of range"):new n({ts:e,zone:j(t.zone,x.defaultZone),loc:S.fromObject(t)});throw new M(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(X(e))return new n({ts:e*1e3,zone:j(t.zone,x.defaultZone),loc:S.fromObject(t)});throw new M("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let r=j(t.zone,x.defaultZone);if(!r.isValid)return n.invalid(ve(r));let i=S.fromObject(t),s=je(e,vn),{minDaysInFirstWeek:o,startOfWeek:a}=fn(s,i),l=x.now(),u=y(t.specificOffset)?r.offset(l):t.specificOffset,c=!y(s.ordinal),m=!y(s.year),d=!y(s.month)||!y(s.day),f=m||d,g=s.weekYear||s.weekNumber;if((f||c)&&g)throw new J("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&c)throw new J("Can't mix ordinal dates with month/day");let p=g||s.weekday&&!f,O,N,k=Ve(l,u);p?(O=Es,N=Cs,k=He(k,o,a)):c?(O=Fs,N=Is,k=ft(k)):(O=$e,N=Mr);let C=!1;for(let H of O){let Le=s[H];y(Le)?C?s[H]=N[H]:s[H]=k[H]:C=!0}let K=p?li(s,o,a):c?ui(s):er(s),ee=K||tr(s);if(ee)return n.invalid(ee);let oe=p?un(s,o,a):c?cn(s):s,[Y,$]=Be(oe,u,r),q=new n({ts:Y,zone:r,o:$,loc:i});return s.weekday&&f&&e.weekday!==q.weekday?n.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${q.toISO()}`):q.isValid?q:n.invalid(q.invalid)}static fromISO(e,t={}){let[r,i]=es(e);return ue(r,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[r,i]=ts(e);return ue(r,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[r,i]=ns(e);return ue(r,i,t,"HTTP",t)}static fromFormat(e,t,r={}){if(y(e)||y(t))throw new M("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=r,o=S.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,l,u,c]=Ds(o,e,t);return c?n.invalid(c):ue(a,l,r,`format ${t}`,e,u)}static fromString(e,t,r={}){return n.fromFormat(e,t,r)}static fromSQL(e,t={}){let[r,i]=us(e);return ue(r,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new M("need to specify a reason the DateTime is invalid");let r=e instanceof F?e:new F(e,t);if(x.throwOnInvalid)throw new pt(r);return new n({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let r=vr(e,S.fromObject(t));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return xr(E.parseFormat(e),S.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Ne=void 0,Wt.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?dt(this).weekYear:NaN}get weekNumber(){return this.isValid?dt(this).weekNumber:NaN}get weekday(){return this.isValid?dt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?gt(this).weekday:NaN}get localWeekNumber(){return this.isValid?gt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?gt(this).weekYear:NaN}get ordinal(){return this.isValid?ft(this.c).ordinal:NaN}get monthShort(){return this.isValid?ce.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ce.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ce.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ce.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,r=Qe(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*t),a=this.zone.offset(r-s*t);if(o===a)return[this];let l=r-o*t,u=r-a*t,c=Ve(l,o),m=Ve(u,a);return c.hour===m.hour&&c.minute===m.minute&&c.second===m.second&&c.millisecond===m.millisecond?[ne(this,{ts:l}),ne(this,{ts:u})]:[this]}get isInLeapYear(){return Ce(this.year)}get daysInMonth(){return Ge(this.year,this.month)}get daysInYear(){return this.isValid?fe(this.year):NaN}get weeksInWeekYear(){return this.isValid?De(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?De(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:r,calendar:i}=E.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(P.instance(e),t)}toLocal(){return this.setZone(x.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=j(e,x.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||r){let s=e.offset(this.ts),o=this.toObject();[i]=Be(o,s,e)}return ne(this,{ts:i,zone:e})}else return n.invalid(ve(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){let i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return ne(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=je(e,vn),{minDaysInFirstWeek:r,startOfWeek:i}=fn(t,this.loc),s=!y(t.weekYear)||!y(t.weekNumber)||!y(t.weekday),o=!y(t.ordinal),a=!y(t.year),l=!y(t.month)||!y(t.day),u=a||l,c=t.weekYear||t.weekNumber;if((u||o)&&c)throw new J("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new J("Can't mix ordinal dates with month/day");let m;s?m=un({...He(this.c,r,i),...t},r,i):y(t.ordinal)?(m={...this.toObject(),...t},y(t.day)&&(m.day=Math.min(Ge(m.year,m.month),m.day))):m=cn({...ft(this.c),...t});let[d,f]=Be(m,this.o,this.zone);return ne(this,{ts:d,o:f})}plus(e){if(!this.isValid)return this;let t=D.fromDurationLike(e);return ne(this,xn(this,t))}minus(e){if(!this.isValid)return this;let t=D.fromDurationLike(e).negate();return ne(this,xn(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let r={},i=D.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(i==="weeks")if(t){let s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(r.weekNumber=this.weekNumber-1),r.weekday=s}else r.weekday=1;if(i==="quarters"){let s=Math.ceil(this.month/3);r.month=(s-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?E.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ht}toLocaleString(e=Ue,t={}){return this.isValid?E.create(this.loc.clone(t),e).formatDateTime(this):ht}toLocaleParts(e={}){return this.isValid?E.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=_e(o);let a=e==="extended",l=yt(this,a,o);return $e.indexOf(o)>=3&&(l+="T"),l+=On(this,a,t,r,i,s,o),l}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?yt(this,e==="extended",_e(t)):null}toISOWeekDate(){return ze(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=_e(a),(i&&$e.indexOf(a)>=3?"T":"")+On(this,o==="extended",t,e,r,s,a)):null}toRFC2822(){return ze(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ze(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?yt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(r&&(i+=" "),t?i+="z":e&&(i+="ZZ")),ze(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ht}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return D.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=mi(t).map(D.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,u=gs(a,l,s,i);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(n.now(),e,t)}until(e){return this.isValid?he.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;let i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,r)<=i&&i<=s.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||n.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),Mn(t,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?Mn(e.base||n.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(n.isDateTime))throw new M("min requires all arguments be DateTimes");return mn(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(n.isDateTime))throw new M("max requires all arguments be DateTimes");return mn(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){let{locale:i=null,numberingSystem:s=null}=r,o=S.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return Or(o,e,t)}static fromStringExplain(e,t,r={}){return n.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){let{locale:r=null,numberingSystem:i=null}=t,s=S.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return new Je(s,e)}static fromFormatParser(e,t,r={}){if(y(e)||y(t))throw new M("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:s=null}=r,o=S.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(t.locale))throw new M(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);let{result:a,zone:l,specificOffset:u,invalidReason:c}=t.explainFromTokens(e);return c?n.invalid(c):ue(a,l,r,`format ${t.format}`,e,u)}static get DATE_SHORT(){return Ue}static get DATE_MED(){return Cn}static get DATE_MED_WITH_WEEKDAY(){return _r}static get DATE_FULL(){return In}static get DATE_HUGE(){return En}static get TIME_SIMPLE(){return Fn}static get TIME_WITH_SECONDS(){return An}static get TIME_WITH_SHORT_OFFSET(){return Wn}static get TIME_WITH_LONG_OFFSET(){return Ln}static get TIME_24_SIMPLE(){return Rn}static get TIME_24_WITH_SECONDS(){return Pn}static get TIME_24_WITH_SHORT_OFFSET(){return qn}static get TIME_24_WITH_LONG_OFFSET(){return Vn}static get DATETIME_SHORT(){return zn}static get DATETIME_SHORT_WITH_SECONDS(){return Bn}static get DATETIME_MED(){return $n}static get DATETIME_MED_WITH_SECONDS(){return _n}static get DATETIME_MED_WITH_WEEKDAY(){return Zr}static get DATETIME_FULL(){return Zn}static get DATETIME_FULL_WITH_SECONDS(){return Un}static get DATETIME_HUGE(){return Yn}static get DATETIME_HUGE_WITH_SECONDS(){return Hn}};function xe(n){if(T.isDateTime(n))return n;if(n&&n.valueOf&&X(n.valueOf()))return T.fromJSDate(n);if(n&&typeof n=="object")return T.fromObject(n);throw new M(`Unknown datetime argument: ${n}, of type ${typeof n}`)}function se(n,e){return n.length?typeof n[0]=="number"?n:n.map(e??(t=>t.close)):[]}function tt(n,e,t){let r=se(n,t),i=new Array(r.length),s=0,o=0;for(let a=0;a<r.length;a++){let l=r[a];if(isNaN(l)||(s+=l,o++),a>=e){let u=r[a-e];isNaN(u)||(s-=u,o--)}i[a]=o>=e?s/e:NaN}return i}function Fe(n,e,t){let r=se(n,t),i=2/(e+1),s=new Array(r.length),o=NaN;for(let a=0;a<r.length;a++){let l=r[a];o=isNaN(o)?l:l*i+o*(1-i),s[a]=o}return s}function nt(n,e,t){let r=se(n,t),i=new Array(r.length).fill(NaN),s=e*(e+1)/2;for(let o=e-1;o<r.length;o++){let a=0;for(let l=0;l<e;l++)a+=r[o-l]*(e-l);i[o]=a/s}return i}function Ws(n,e,t){let r=se(n,t),i=Math.floor(e/2),s=Math.round(Math.sqrt(e)),o=nt(r,i),a=nt(r,e),l=r.map((u,c)=>2*o[c]-a[c]);return nt(l,s)}function rt(n,e,t){let r=se(n,t),i=new Array(r.length).fill(NaN),s=NaN;for(let o=0;o<r.length;o++){let a=r[o];if(isNaN(s)){if(o<e-1)continue;let l=0;for(let u=o-e+1;u<=o;u++)l+=r[u];s=l/e,i[o]=s}else s=(s*(e-1)+a)/e,i[o]=s}return i}function Ls(n,e,t){let r=se(n,t),i=new Array(r.length).fill(NaN);for(let s=e-1;s<r.length;s++){let o=0,a=0,l=0,u=0;for(let d=0;d<e;d++){let f=d,g=r[s-(e-1-d)];o+=f,a+=g,l+=f*g,u+=f*f}let c=e,m=(c*l-o*a)/(c*u-o*o);i[s]=(a-m*o)/c+m*(e-1)}return i}function Rs(n,e=14){let t=n.length;if(t===0)return[];let r=new Array(t),i=new Array(t);r[0]=0,i[0]=0;for(let l=1;l<t;l++){let u=n[l].close-n[l-1].close;r[l]=u>0?u:0,i[l]=u<0?-u:0}let s=rt(r,e),o=rt(i,e),a=new Array(t);for(let l=0;l<t;l++)a[l]=isNaN(s[l])?NaN:o[l]===0?100:100-100/(1+s[l]/o[l]);return a}function Ps(n,e=14,t=3,r=3){function i(c,m){let d=new Array(c.length).fill(NaN),f=0,g=0;for(let p=0;p<c.length;p++)isNaN(c[p])||(f+=c[p],g++),p>=m&&!isNaN(c[p-m])&&(f-=c[p-m],g--),d[p]=g>0?f/g:NaN;return d}let s=n.length,o=Ae(n.map(c=>c.high),e),a=We(n.map(c=>c.low),e),l=new Array(s).fill(NaN);for(let c=e-1;c<s;c++){let m=o[c],d=a[c];l[c]=m===d?50:(n[c].close-d)/(m-d)*100}let u=i(l,r);return{k:u,d:i(u,t)}}function qs(n,e=12,t=26,r=9){let i=Fe(n,e),s=Fe(n,t),o=n.length,a=new Array(o);for(let c=0;c<o;c++)a[c]=i[c]-s[c];let l=Fe(a,r),u=new Array(o);for(let c=0;c<o;c++)u[c]=a[c]-l[c];return{macd:a,signal:l,histogram:u}}function _t(n,e=14){return rt(Dr(n),e)}function Dr(n){let e=n.length,t=new Array(e);for(let r=0;r<e;r++){let i=n[r];if(r===0){t[r]=i.high-i.low;continue}let s=n[r-1].close;t[r]=Math.max(i.high-i.low,Math.abs(i.high-s),Math.abs(i.low-s))}return t}function Cr(n,e){let t=Array.isArray(e)?e:new Array(n.length).fill(e);return n.map((r,i)=>i>0&&r>t[i]&&n[i-1]<=t[i-1])}function Ir(n,e){let t=Array.isArray(e)?e:new Array(n.length).fill(e);return n.map((r,i)=>i>0&&r<t[i]&&n[i-1]>=t[i-1])}function Vs(n,e){let t=Cr(n,e),r=Ir(n,e);return t.map((i,s)=>i||r[s])}function zs(n,e=1){return n.map((t,r)=>{if(r<e)return!1;for(let i=1;i<=e;i++)if(n[r-i+1]<=n[r-i])return!1;return!0})}function Bs(n,e=1){return n.map((t,r)=>{if(r<e)return!1;for(let i=1;i<=e;i++)if(n[r-i+1]>=n[r-i])return!1;return!0})}function $s(n,e=1){return n.map((t,r)=>r<e?NaN:t-n[r-e])}function _s(n){let e=NaN;return n.map((t,r)=>t?(e=r,0):isNaN(e)?NaN:r-e)}function Zs(n,e,t=0){let r=[];return n.map((i,s)=>{i&&r.push(s);let o=r.length-1-t;return o>=0?e[r[o]]:NaN})}function Er(n,e,t){let r=n.length,i=new Array(r).fill(NaN),s=new Array(r),o=0,a=0;for(let l=0;l<r;l++){let u=n[l];if(!isNaN(u)){for(;a>o;){let c=n[s[a-1]];if(t?c<=u:c>=u)a--;else break}s[a++]=l}for(;a>o&&s[o]<=l-e;)o++;l>=e-1&&(i[l]=a>o?n[s[o]]:t?-1/0:1/0)}return i}function Ae(n,e){return Er(n,e,!0)}function We(n,e){return Er(n,e,!1)}function Us(n,e=5,t=5){let r=n.length,i=new Array(r).fill(NaN);for(let s=e;s<r-t;s++){let o=n[s].high,a=!0;for(let l=s-e;l<=s+t;l++)if(l!==s&&n[l].high>=o){a=!1;break}a&&(i[s]=o)}return i}function Ys(n,e=5,t=5){let r=n.length,i=new Array(r).fill(NaN);for(let s=e;s<r-t;s++){let o=n[s].low,a=!0;for(let l=s-e;l<=s+t;l++)if(l!==s&&n[l].low<=o){a=!1;break}a&&(i[s]=o)}return i}function Fr(n,e=20,t=2,r=i=>i.close){let i=n.length,s=new Array(i).fill(NaN),o=new Array(i).fill(NaN),a=new Array(i).fill(NaN),l=new Array(i),u=0,c=0;for(let m=0;m<i;m++){let d=r(n[m]);if(l[m]=d,u+=d,c+=d*d,m>=e){let f=l[m-e];u-=f,c-=f*f}if(m>=e-1){let f=u/e,g=Math.sqrt(Math.max(0,c/e-f*f));s[m]=f,o[m]=f+t*g,a[m]=f-t*g}}return{upper:o,mid:s,lower:a}}function Hs(n,e=20,t=2){let{upper:r,mid:i,lower:s}=Fr(n,e,t);return i.map((o,a)=>isNaN(o)||o===0?NaN:(r[a]-s[a])/o)}function Gs(n,e=20){let t=Ae(n.map(i=>i.high),e),r=We(n.map(i=>i.low),e);return{upper:t,mid:t.map((i,s)=>(i+r[s])/2),lower:r}}function js(n,e=20,t=10,r=1.5){let i=Fe(n,e),s=_t(n,t);return{upper:i.map((o,a)=>o+r*s[a]),mid:i,lower:i.map((o,a)=>o-r*s[a])}}function Js(n,e=0){let t=new Array(n.length).fill(NaN),r=864e5,i=0,s=0,o=NaN;for(let a=0;a<n.length;a++){let l=Number(n[a].ts/1000000n),u=Math.floor((l-e*36e5)/r);u!==o&&(i=0,s=0,o=u);let c=(n[a].high+n[a].low+n[a].close)/3;i+=c*n[a].volume,s+=n[a].volume,t[a]=s===0?NaN:i/s}return t}function Xs(n){let e=n.map(t=>(t.high+t.low)/2);return{jaw:tt(e,13),teeth:tt(e,8),lips:tt(e,5)}}function Ar(n,e,t){let r=se(n,t),i=r.length,s=new Array(i).fill(NaN),o=0,a=0;for(let l=0;l<i;l++)if(o+=r[l],a+=r[l]*r[l],l>=e&&(o-=r[l-e],a-=r[l-e]*r[l-e]),l>=e-1){let u=o/e;s[l]=Math.sqrt(Math.max(0,a/e-u*u))}return s}function Qs(n,e,t){return Ar(n,e,t).map(r=>r*r)}function Ks(n,e){function t(i,s){let o=new Array(i.length).fill(NaN),a=0,l=0;for(let u=0;u<i.length;u++)isNaN(i[u])||(a+=i[u],l++),u>=s&&!isNaN(i[u-s])&&(a-=i[u-s],l--),o[u]=l>0?a/l:NaN;return o}let r=t(n,e);return n.map((i,s)=>Math.abs(i-r[s]))}function eo(n,e,t){let r=new Array(n.length).fill(NaN),i=0,s=0;for(let o=0;o<n.length;o++){if(i+=n[o],s+=e[o],o>=t&&(i-=n[o-t],s-=e[o-t]),o<t-1)continue;let a=i/t,l=s/t,u=0,c=0,m=0;for(let f=o-t+1;f<=o;f++){let g=n[f]-a,p=e[f]-l;u+=g*p,c+=g*g,m+=p*p}let d=Math.sqrt(c*m);r[o]=d===0?0:u/d}return r}var to=Ae,no=We;function ro(n,e){let t=new Array(n.length).fill(NaN);for(let r=e-1;r<n.length;r++){let i=n.slice(r-e+1,r+1).sort((o,a)=>o-a),s=Math.floor(e/2);t[r]=e%2===0?(i[s-1]+i[s])/2:i[s]}return t}function io(n,e){let t=[];for(let r=0;r<n.length&&r<e.length;r++)!isNaN(e[r])&&isFinite(e[r])&&t.push({t:n[r],price:e[r]});return t}function so(n){return n[n.length-1]}function oo(n,e=0){return n==null||isNaN(n)?e:n}function ao(n,e,t,r=[],i=!1){return{type:"line",pts:n,color:e,width:t,dash:r,connect:i}}function lo(n,e,t,r=[]){return{type:"hline",price:n,color:e,width:t,dash:r}}function uo(n,e,t=0,r=.2){return{type:"histogram",pts:n,color:e,base:t,gap:r}}function co(n,e,t,r,i=12,s=!1,o="left",a="middle",l=!1,u=99999){return{type:"label",text:n,x:e,y:t,color:r,fontSize:i,bold:s,horzAlign:o,vertAlign:a,anchored:l,maxWidth:u}}function fo(n,e,t){return{type:"fill",pts1:n,pts2:e,opts:t}}function mo(n,e,t,r,i={}){return{type:"rect",t1:n,t2:t,price1:e,price2:r,...i}}function ho(n,e,t,r={}){return{type:"circle",t:n,price:e,radius:t,...r}}function go(n,e,t=1,r=[]){return{type:"vline",t:n,color:e,width:t,dash:r}}function yo(n,e,t,r,i=10,s="",o=""){return{type:"arrow",t:n,price:e,direction:t,color:r,size:i,label:s,labelColor:o||r}}function po(n,e,t,r,i,s=1,o=[],a="none"){return{type:"trendline",t1:n,price1:e,t2:t,price2:r,color:i,width:s,dash:o,extend:a}}function bo(n,e,t,r="",i=1){return{type:"band",priceHigh:n,priceLow:e,fillColor:t,borderColor:r,borderWidth:i}}function wo(n,e={}){return{type:"polygon",pts:n,...e}}function So(n,e,t=3){return{type:"dots",pts:n,color:e,radius:t}}function To(n,e,t,r,i,s={}){return{type:"badge",t:n,price:e,text:t,textColor:r,bgColor:i,...s}}function ko(n){let e=new Array(n.length).fill(0);for(let t=1;t<n.length;t++){let r=n[t].close>n[t-1].close?n[t].volume:n[t].close<n[t-1].close?-n[t].volume:0;e[t]=e[t-1]+r}return e}function xo(n,e=14){let t=n.length,r=new Array(t).fill(NaN),i=n.map(u=>(u.high+u.low+u.close)/3),s=new Array(t).fill(0),o=new Array(t).fill(0);for(let u=1;u<t;u++){let c=i[u]*n[u].volume;i[u]>i[u-1]?s[u]=c:i[u]<i[u-1]&&(o[u]=c)}let a=0,l=0;for(let u=1;u<t;u++)a+=s[u],l+=o[u],u>e&&(a-=s[u-e],l-=o[u-e]),u>=e&&(r[u]=l===0?100:100-100/(1+a/l));return r}function Oo(n,e=20){let t=n.length,r=new Array(t).fill(NaN),i=n.map(o=>(o.high+o.low+o.close)/3),s=0;for(let o=0;o<t;o++){if(s+=i[o],o>=e&&(s-=i[o-e]),o<e-1)continue;let a=s/e,l=0;for(let u=o-e+1;u<=o;u++)l+=Math.abs(i[u]-a);l/=e,r[o]=l===0?0:(i[o]-a)/(.015*l)}return r}function vo(n,e=14){let t=n.length,r=new Array(t).fill(NaN),i=Ae(n.map(o=>o.high),e),s=We(n.map(o=>o.low),e);for(let o=e-1;o<t;o++){let a=i[o],l=s[o];r[o]=a===l?-50:(a-n[o].close)/(a-l)*-100}return r}function No(n,e=10,t=3){let r=n.length,i=_t(n,e),s=new Array(r).fill(NaN),o=new Array(r).fill(NaN),a=new Array(r).fill(1),l=e;if(r<=l)return{trend:a,upper:s,lower:o};s[l]=(n[l].high+n[l].low)/2+t*i[l],o[l]=(n[l].high+n[l].low)/2-t*i[l];for(let u=l+1;u<r;u++){let c=(n[u].high+n[u].low)/2,m=c+t*i[u],d=c-t*i[u],f=n[u-1].close;s[u]=m<s[u-1]||f>s[u-1]?m:s[u-1],o[u]=d>o[u-1]||f<o[u-1]?d:o[u-1],a[u-1]===-1&&n[u].close>s[u-1]?a[u]=1:a[u-1]===1&&n[u].close<o[u-1]?a[u]=-1:a[u]=a[u-1]}return{trend:a,upper:s,lower:o}}function Mo(n,e,t){if(n.length===0)return[];let r=[],i=new Array(n.length);for(let l=0;l<n.length;l++)i[l]=Number(n[l].ts/1000000n);let s=l=>{let u=0,c=i.length;for(;u<c;){let m=u+c>>>1;i[m]<l?u=m+1:c=m}return u},o=new Map,a=l=>{let u=o.get(l);if(u)return u;u=[];let c=-1/0;for(let m=0;m<i.length;m++){if(i[m]<c)continue;let d=T.fromMillis(i[m],{zone:l});u.push({year:d.year,month:d.month,day:d.day}),c=d.startOf("day").plus({days:1}).toMillis()}return o.set(l,u),u};for(let l of e){let u=l.tz??t?.tz??"UTC";for(let{year:c,month:m,day:d}of a(u)){let f=T.fromObject({year:c,month:m,day:d,hour:l.startHour,minute:l.startMinute,second:0,millisecond:0},{zone:u}),g=T.fromObject({year:c,month:m,day:d,hour:l.endHour,minute:l.endMinute,second:0,millisecond:0},{zone:u});g<=f&&(g=g.plus({days:1}));let p=f.toMillis(),O=g.toMillis(),N=-1/0,k=1/0;for(let C=s(p);C<i.length&&i[C]<O;C++)n[C].high>N&&(N=n[C].high),n[C].low<k&&(k=n[C].low);N===-1/0||k===1/0||r.push({startTs:BigInt(p)*1000000n,endTs:BigInt(O)*1000000n,high:N,low:k,label:l.label,color:l.color})}}return r.sort((l,u)=>l.startTs<u.startTs?-1:l.startTs>u.startTs?1:0),r}var we={sma:tt,ema:Fe,wma:nt,hma:Ws,rma:rt,linreg:Ls,rsi:Rs,stoch:Ps,macd:qs,atr:_t,tr:Dr,crossover:Cr,crossunder:Ir,cross:Vs,rising:zs,falling:Bs,change:$s,barssince:_s,valuewhen:Zs,highest:Ae,lowest:We,pivotHigh:Us,pivotLow:Ys,bb:Fr,bbw:Hs,donchian:Gs,keltner:js,vwap:Js,alligator:Xs,stdev:Ar,variance:Qs,dev:Ks,correlation:eo,max:to,min:no,median:ro,toPoints:io,last:so,nz:oo,obv:ko,mfi:xo,cci:Oo,williamsR:vo,supertrend:No,sessionBoundaries:Mo,drawLine:ao,drawHLine:lo,drawHistogram:uo,drawLabel:co,fillBetween:fo,drawRect:mo,drawCircle:ho,drawVLine:go,drawArrow:yo,drawTrendLine:po,drawBand:bo,drawPolygon:wo,drawDots:So,drawBadge:To};var Wr=Object.freeze({indicator:"indicator",drawing:"drawing",chartType:"chart-type",dataSource:"data-source",extension:"extension",strategy:"strategy"}),Lr=Object.freeze({mbo:"l3",l3:"l3",l2:"l2",ohlcv:"ohlcv",tick:"tick"}),Rr=Object.freeze({overlay:"overlay",pane:"pane"}),Pr=Object.freeze({signal:"signal",stop:"stop",target:"target",reverse:"reverse",endOfData:"end-of-data"}),qr={PluginType:Wr,DataLevel:Lr,Layout:Rr,ExitReason:Pr};var Vr={initialCapital:1e5,commission:0,slippageTicks:0,tickSize:.01,contractSize:1,pyramiding:1,allowReverse:!0,qtyStep:1};function Do(n){if(!n.length)return 0;let e=[...n].sort((r,i)=>r-i),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function Co(n){if(n.length<2)return 0;let e=0;for(let i of n)e+=i;e/=n.length;let t=0;for(let i of n)t+=(i-e)*(i-e);let r=Math.sqrt(t/(n.length-1));return r===0?0:Math.sqrt(n.length)*e/r}var Zt=class{constructor(e={}){I(this,"cfg");I(this,"pending",[]);I(this,"pos",null);I(this,"trades",[]);I(this,"equityCurve",[]);I(this,"realized");I(this,"peak");I(this,"nextOrderId",1);I(this,"index",-1);I(this,"barsInPosition",0);I(this,"barCount",0);I(this,"markPrice",0);I(this,"closeRequested",!1);I(this,"barNs",0n);I(this,"slippagePaid",0);this.cfg={...Vr,...e},this.realized=this.cfg.initialCapital,this.peak=this.cfg.initialCapital}setBarNs(e){this.barNs=e}beginBar(e,t){if(this.index=t,this.markPrice=e.close,this.closeRequested&&(this.closeRequested=!1,this.pos)){let r=this.cfg.slippageTicks*this.cfg.tickSize;this.exit(e,e.open+(this.pos.side==="long"?-r:r),"signal")}this.pending.length&&this.processPending(e),this.pos&&this.checkBrackets(e)}endBar(e){this.barCount++,this.markPrice=e.close,this.pos&&(this.barsInPosition++,this.trackExcursion(e));let t=this.equity;t>this.peak&&(this.peak=t),this.equityCurve.push({ts:e.ts,equity:t,drawdown:this.peak>0?(this.peak-t)/this.peak:0})}finish(e){if(!this.pos||!e)return;this.exit(e,e.close,"end-of-data");let t=this.equityCurve[this.equityCurve.length-1];if(!t)return;let r=this.equity;r>this.peak&&(this.peak=r),t.equity=r,t.drawdown=this.peak>0?(this.peak-r)/this.peak:0}get equity(){return this.realized+this.unrealized()}get result(){return{trades:this.trades,equity:this.equityCurve,stats:this.computeStats(),position:this.pos,openOrders:this.pending}}api(){let e=this;return{buy:(t=1,r={})=>e.place("buy",t,r),sell:(t=1,r={})=>e.place("sell",t,r),close:()=>{e.pos&&(e.closeRequested=!0)},cancelAll:()=>{e.pending=[]},get position(){return e.pos},get equity(){return e.equity},get cash(){return e.realized},get openOrders(){return e.pending}}}place(e,t,r){let i=this.roundQty(t),s={id:this.nextOrderId++,side:e,qty:i,kind:r.limit!=null?"limit":r.stop!=null?"stop":"market",price:r.limit??r.stop,sl:r.sl,tp:r.tp,tag:r.tag,placedIndex:this.index};return this.pending.push(s),s.id}processPending(e){let t=[];for(let r of this.pending){if(r.placedIndex>=this.index){t.push(r);continue}let i=this.fillPrice(r,e);if(i==null){t.push(r);continue}this.execute(r,i,e)}this.pending=t}fillPrice(e,t){let r=this.cfg.slippageTicks*this.cfg.tickSize;if(e.kind==="market")return e.side==="buy"?t.open+r:t.open-r;let i=e.price;return e.kind==="limit"?e.side==="buy"&&t.low<=i||e.side==="sell"&&t.high>=i?i:null:e.side==="buy"&&t.high>=i?Math.max(i,t.open)+r:e.side==="sell"&&t.low<=i?Math.min(i,t.open)-r:null}execute(e,t,r){let i=e.side==="buy"?"long":"short";if(this.pos&&this.pos.side!==i){let s=Math.min(this.pos.qty,e.qty),o=e.qty-s,a=o>0&&this.cfg.allowReverse;this.exit(r,t,a?"reverse":"signal",s),a&&this.enter(i,o,t,r,e);return}if(this.pos&&this.pos.side===i){if(this.pos.entries>=this.maxEntries())return;let s=this.pos.qty+e.qty;this.pos.avgPrice=(this.pos.avgPrice*this.pos.qty+t*e.qty)/s,this.pos.qty=s,this.pos.entries++,e.sl!=null&&(this.pos.sl=e.sl),e.tp!=null&&(this.pos.tp=e.tp);let o=this.commissionFor(e.qty);this.pos.entryFees+=o,this.realized-=o,this.slippagePaid+=this.slippageCost(e.qty);return}this.enter(i,e.qty,t,r,e)}maxEntries(){return Math.max(1,Math.floor(this.cfg.pyramiding))}roundQty(e){let t=this.cfg.qtyStep>0?this.cfg.qtyStep:1,r=Math.abs(e),i=Math.floor(r/t)*t,s=(String(t).split(".")[1]??"").length;return i>0?Number(i.toFixed(s)):t}enter(e,t,r,i,s){let o=this.commissionFor(t);this.pos={side:e,qty:t,avgPrice:r,entryTs:i.ts,entryIndex:this.index,sl:s.sl,tp:s.tp,tag:s.tag,entryFees:o,highWatermark:r,lowWatermark:r,mfeIndex:this.index,mfeTs:i.ts,maeIndex:this.index,maeTs:i.ts,initialRiskPerUnit:s.sl!=null?Math.abs(r-s.sl):void 0,entries:1},this.barsInPosition=0,this.realized-=o,this.slippagePaid+=this.slippageCost(t)}slippageCost(e){return this.cfg.slippageTicks*this.cfg.tickSize*e*this.cfg.contractSize}exit(e,t,r,i){let s=this.pos;if(!s)return;let o=i??s.qty,a=s.side==="long"?1:-1,l=(t-s.avgPrice)*a*o*this.cfg.contractSize,u=this.commissionFor(o),c=s.qty>0?s.entryFees*o/s.qty:0,m=c+u;s.entryFees-=c,this.realized+=l-u,this.slippagePaid+=this.slippageCost(o);let d=s.avgPrice*o*this.cfg.contractSize,f=s.side==="long",g=o*this.cfg.contractSize,p=Math.max(0,f?s.highWatermark-s.avgPrice:s.avgPrice-s.lowWatermark),O=Math.max(0,f?s.avgPrice-s.lowWatermark:s.highWatermark-s.avgPrice),N=s.initialRiskPerUnit,k=N!=null?N*g:void 0,C=l-m,K=k&&k>0?C/k:void 0,ee=k&&k>0?p*g/k:void 0,oe=k&&k>0?-(O*g)/k:void 0,Y=p>0?Math.max(0,f?t-s.avgPrice:s.avgPrice-t)/p:void 0,$=p*g,q=Math.max(0,$-(l-m));this.trades.push({id:this.trades.length+1,side:s.side,qty:o,entryTs:s.entryTs,entryPrice:s.avgPrice,exitTs:e.ts,exitPrice:t,pnl:C,pnlGross:l,pnlPct:d>0?C/d:0,fees:m,commission:m,slippage:this.slippageCost(o)*2,bars:this.index-s.entryIndex,durationNs:e.ts-s.entryTs,tag:s.tag,reason:r,maeAbs:O,mfeAbs:p,maePnl:O*g,mfePnl:p*g,mfeTs:s.mfeTs,maeTs:s.maeTs,barsToMfe:s.mfeIndex-s.entryIndex,initialRiskPerUnit:N,initialRiskTotal:k,realizedR:K,maxFavorableR:ee,maxAdverseR:oe,efficiency:Y,maxDrawdownAbs:q,maxDrawdownPct:$>0?q/$:0,sl:s.sl,tp:s.tp}),o>=s.qty?(this.pos=null,this.barsInPosition=0):s.qty-=o}checkBrackets(e){let t=this.pos;if(t.sl==null&&t.tp==null)return;let r=this.cfg.slippageTicks*this.cfg.tickSize,i=t.side==="long",s=t.sl!=null&&(i?e.low<=t.sl:e.high>=t.sl),o=t.tp!=null&&(i?e.high>=t.tp:e.low<=t.tp);if(s){let a=i?Math.min(t.sl,e.open):Math.max(t.sl,e.open);this.exit(e,i?a-r:a+r,"stop");return}o&&this.exit(e,t.tp,"target")}trackExcursion(e){let t=this.pos;e.high>t.highWatermark&&(t.highWatermark=e.high,t.side==="long"?(t.mfeIndex=this.index,t.mfeTs=e.ts):(t.maeIndex=this.index,t.maeTs=e.ts)),e.low<t.lowWatermark&&(t.lowWatermark=e.low,t.side==="long"?(t.maeIndex=this.index,t.maeTs=e.ts):(t.mfeIndex=this.index,t.mfeTs=e.ts))}commissionFor(e){return this.cfg.commission*e}unrealized(){if(!this.pos)return 0;let e=this.pos.side==="long"?1:-1;return(this.markPrice-this.pos.avgPrice)*e*this.pos.qty*this.cfg.contractSize}computeStats(){let e=this.trades,t=this.cfg.initialCapital,r=0,i=0,s=0,o=0,a=0,l=0,u=0,c=0,m=0,d=0,f=0,g=0,p=0,O=0,N=0,k=0,C=0,K=0,ee=0,oe=0,Y=0,$=0,q=0,H=0,Le=0,Yt=0,it=0,Ht=0;for(let b of e)b.pnl>0?(r+=b.pnl,s++,c+=b.bars,f++,g=0,b.pnl>l&&(l=b.pnl)):b.pnl<0?(i+=b.pnl,o++,m+=b.bars,g++,f=0,b.pnl<u&&(u=b.pnl)):(a++,f=0,g=0),f>p&&(p=f),g>O&&(O=g),d+=b.bars,ee+=b.maeAbs,oe+=b.mfeAbs,it+=b.commission,Ht+=b.pnlGross,b.realizedR!==void 0&&(N+=b.realizedR,k++),b.efficiency!==void 0&&(C+=b.efficiency,K++),b.side==="long"?(Y++,Le+=b.pnl,b.pnl>0&&q++):($++,Yt+=b.pnl,b.pnl>0&&H++);let Se=0,Te=0,Gt=0;for(let b of this.equityCurve){let Xt=this.peakAt(b)-b.equity;Xt>Se&&(Se=Xt),b.drawdown>Te&&(Te=b.drawdown),Gt+=b.drawdown*b.drawdown}let jt=this.equityCurve.length?this.equityCurve[this.equityCurve.length-1].equity:t,st=jt-t,zr=t>0?st/t:0,Re=s?r/s:0,ke=o?i/o:0,ot=e.length?s/e.length:0,Jt=e.map(b=>b.pnl),at=this.runYears();return{netPnl:st,grossProfit:r,grossLoss:i,profitFactor:i===0?r>0?1/0:0:r/-i,totalTrades:e.length,wins:s,losses:o,winRate:ot,avgWin:Re,avgLoss:ke,expectancy:e.length?(r+i)/e.length:0,maxDrawdown:Se,maxDrawdownPct:Te,sharpe:this.sharpe(),returnPct:zr,exposure:this.barCount?this.barsInPositionTotal()/this.barCount:0,finalEquity:jt,largestWin:l,largestLoss:u,medianPnl:Do(Jt),payoffRatio:ke!==0?Re/Math.abs(ke):Re>0?1/0:0,breakEvens:a,maxWinStreak:p,maxLossStreak:O,currentStreak:f>0?f:-g,avgBarsHeld:e.length?d/e.length:0,avgWinBarsHeld:s?c/s:0,avgLossBarsHeld:o?m/o:0,totalBars:this.barCount,sortino:this.sortino(),calmar:Te>0&&at>0?this.cagr(at)/Te:0,recoveryFactor:Se>0?st/Se:0,ulcerIndex:this.equityCurve.length?Math.sqrt(Gt/this.equityCurve.length):0,sqn:Co(Jt),kelly:ke!==0?ot-(1-ot)/(Re/Math.abs(ke)):0,cagr:this.cagr(at),tradesWithRisk:k,avgR:k?N/k:0,totalR:N,avgEfficiency:K?C/K:0,avgMae:e.length?ee/e.length:0,avgMfe:e.length?oe/e.length:0,longTrades:Y,shortTrades:$,longWinRate:Y?q/Y:0,shortWinRate:$?H/$:0,longPnl:Le,shortPnl:Yt,totalFees:it,totalCommission:it,totalSlippage:this.slippagePaid,grossPnlBeforeCosts:Ht}}runYears(){let e=this.equityCurve;if(e.length<2)return 0;let t=e[e.length-1].ts-e[0].ts;return t>0n?Number(t)/31536e12:0}cagr(e){let t=this.cfg.initialCapital;if(e<=0||t<=0)return 0;let r=this.equityCurve.length?this.equityCurve[this.equityCurve.length-1].equity:t;return r<=0?-1:Math.pow(r/t,1/e)-1}sortino(){let e=this.barReturns();if(e.length<2||this.barNs<=0n)return 0;let t=0;for(let a of e)t+=a;t/=e.length;let r=0,i=0;for(let a of e)a<0&&(r+=a*a,i++);if(!i)return 0;let s=Math.sqrt(r/i);if(s===0)return 0;let o=Number(31536000000000000n/this.barNs);return t/s*Math.sqrt(o)}barReturns(){let e=this.equityCurve,t=[];for(let r=1;r<e.length;r++){let i=e[r-1].equity;i>0&&t.push((e[r].equity-i)/i)}return t}peakAt(e){return e.drawdown>=1?e.equity:e.equity/(1-e.drawdown)}barsInPositionTotal(){let e=0;for(let t of this.trades)e+=t.bars;return this.pos&&(e+=this.barsInPosition),e}sharpe(){let e=this.equityCurve;if(e.length<3||this.barNs<=0n)return 0;let t=[];for(let a=1;a<e.length;a++){let l=e[a-1].equity;l>0&&t.push((e[a].equity-l)/l)}if(t.length<2)return 0;let r=0;for(let a of t)r+=a;r/=t.length;let i=0;for(let a of t)i+=(a-r)*(a-r);let s=Math.sqrt(i/(t.length-1));if(s===0)return 0;let o=Number(31536000000000000n/this.barNs);return r/s*Math.sqrt(o)}};function Ut(n){if("values"in n)return n.values;let{from:e,to:t,step:r}=n;if(!isFinite(e)||!isFinite(t))return[];let i=r>0?r:0;if(i===0||e===t)return[e];let s=Math.min(e,t),o=Math.max(e,t),a=[],l=Math.floor((o-s)/i+1e-9)+1,u=(String(i).split(".")[1]??"").length;for(let c=0;c<l;c++)a.push(Number((s+c*i).toFixed(u)));return a}function Io(n){let e=n.filter(r=>Ut(r).length>0);if(!e.length)return[{}];let t=[{}];for(let r of e){let i=Ut(r),s=[];for(let o of t)for(let a of i)s.push({...o,[r.param]:a});if(t=s,t.length>2e4)return t.slice(0,20001)}return t}function Eo(n,e){let t=n*e,r={combos:n,bars:e,iterations:t,ok:!0};return n>2e4?{...r,ok:!1,reason:`${n.toLocaleString()} combinations is past the limit of ${2e4.toLocaleString()}. Widen the step, or sweep fewer parameters at once.`}:t>2e8?{...r,ok:!1,reason:`${n.toLocaleString()} combinations over ${e.toLocaleString()} bars is ${t.toLocaleString()} bar evaluations, past what this browser will run (${2e8.toLocaleString()}). Shorten the range, widen the step, or sweep fewer parameters.`}:r}function Fo(n,e){if(!e||e<=0||e>=.9||n<100)return null;let t=Math.floor(n*(1-e));return t<50||n-t<50?null:t}function Ao(n,e){let t=Math.floor(e.windows),r=Math.max(1,Math.floor(e.isMultiple));if(t<1||n<200)return[];let i=Math.floor(n/(t+r)),s=i*r;if(i<50||s<50)return[];let o=[];for(let a=0;a<t;a++){let l=a*i+s,u=l+i;if(u>n)break;o.push({index:a,isFrom:e.anchored?0:a*i,isTo:l,oosFrom:l,oosTo:u})}return o}function Wo(n){let e=0,t=0,r=0,i=0;for(let a of n)e+=a.inSample.netPnl,t+=a.window.isTo-a.window.isFrom,r+=a.outOfSample.netPnl,i+=a.window.oosTo-a.window.oosFrom;if(!t||!i)return 0;let s=e/t,o=r/i;return s<=0?0:o/s}function Lo(n){if(!n.length)return[];let e=new Set;for(let r of n)for(let i of Object.keys(r.params))e.add(i);let t=[];for(let r of e){let i=[];for(let l of n){let u=l.params[r];typeof u=="number"&&Number.isFinite(u)&&i.push(u)}if(i.length<2)continue;let s=0;for(let l of i)s+=l;s/=i.length;let o=0;for(let l of i)o+=(l-s)*(l-s);let a=Math.sqrt(o/i.length);t.push({param:r,values:i,distinct:new Set(i).size,coefficientOfVariation:s!==0?a/Math.abs(s):a===0?0:1/0})}return t}function Ro(n,e,t=!0){let r=null,i=t?-1/0:1/0;for(let s of n){let o=e(s);o===void 0||!Number.isFinite(o)||(t?o>i:o<i)&&(i=o,r=s)}return r}function Po(n){let e={...qr,Math,console,plugin:n.plugin};for(let[t,r]of Object.entries(we))e[t]=r;if(n.shadowNetwork&&(e.fetch=void 0,e.XMLHttpRequest=void 0,e.WebSocket=void 0,e.importScripts=void 0),n.extra)for(let[t,r]of Object.entries(n.extra))e[t]=r;return e}function jo(n,e){let t=Po(e),r=Object.keys(t);new Function(...r,`"use strict";
2
+ ${n}`)(...r.map(i=>t[i]))}function Jo(n,e){let t=n;if(!t)return[];if(e==="pane"){let s=(t.equity??[]).map(o=>({t:o.ts,price:o.equity}));return s.length?[we.drawLine(s,"#38bdf8",1.5,[],!0)]:[]}let r=[],i=t.trades??[];for(let s of i){let o=s.side==="long";r.push(we.drawArrow(s.entryTs,s.entryPrice,o?"up":"down",o?"#22c55e":"#ef4444",9)),r.push(we.drawArrow(s.exitTs,s.exitPrice,o?"down":"up",s.pnl>=0?"#22c55e":"#ef4444",7))}return r}var Xo=(()=>{let n=Object.keys(we).sort().join(","),e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")})();export{Vr as DEFAULT_STRATEGY_CONFIG,Lr as DataLevel,Pr as ExitReason,Rr as Layout,Wr as PluginType,qr as SCRIPT_DSL,we as STDLIB,Xo as STDLIB_SIGNATURE,Zt as StrategyEngine,Ut as axisValues,Po as buildScriptScope,Eo as checkSweepBudget,Jo as defaultStrategyDraw,jo as evalScriptInScope,Io as expandGrid,Lo as parameterStability,Ro as pickBest,Ao as planWalkForward,Fo as splitIndex,Wo as walkForwardEfficiency};