@msafe/sui-app-store 0.0.11 → 0.0.12
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.
- package/dist/index.d.mts +7 -17
- package/dist/index.d.ts +7 -17
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
package/dist/index.global.js
CHANGED
|
@@ -7,7 +7,7 @@ Received: "${JSON.stringify(c)}"`);let f=Object.keys(c)[0];if(f===void 0)throw n
|
|
|
7
7
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[rm]=this[rm]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=ui(s);n[a]||(hy(i,s),n[a]=!0)}return v.isArray(e)?e.forEach(o):o(e),this}};ln.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(ln.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});v.freezeMethods(ln);var Le=ln;function li(t,e){let r=this||un,n=e||r,i=Le.from(n.headers),o=n.data;return v.forEach(t,function(a){o=a.call(r,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function fi(t){return!!(t&&t.__CANCEL__)}function nm(t,e,r){Y.call(this,t??"canceled",Y.ERR_CANCELED,e,r),this.name="CanceledError"}v.inherits(nm,Y,{__CANCEL__:!0});var cr=nm;function ec(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Y("Request failed with status code "+r.status,[Y.ERR_BAD_REQUEST,Y.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var im=Ue.hasStandardBrowserEnv?{write(t,e,r,n,i,o){let s=[t+"="+encodeURIComponent(e)];v.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),v.isString(n)&&s.push("path="+n),v.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function tc(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function rc(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function di(t,e){return t&&!tc(e)?rc(t,e):e}var om=Ue.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(o){let s=o;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(s){let a=v.isString(s)?i(s):s;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function nc(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function py(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,o=0,s;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=n[o];s||(s=l),r[i]=c,n[i]=l;let f=o,d=0;for(;f!==i;)d+=r[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),l-s<e)return;let m=u&&l-u;return m?Math.round(d*1e3/m):void 0}}var sm=py;function am(t,e){let r=0,n=sm(50,250);return i=>{let o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-r,c=n(a),l=o<=s;r=o;let u={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&l?(s-o)/c:void 0,event:i};u[e?"download":"upload"]=!0,t(u)}}var xy=typeof XMLHttpRequest<"u",cm=xy&&function(t){return new Promise(function(r,n){let i=t.data,o=Le.from(t.headers).normalize(),{responseType:s,withXSRFToken:a}=t,c;function l(){t.cancelToken&&t.cancelToken.unsubscribe(c),t.signal&&t.signal.removeEventListener("abort",c)}let u;if(v.isFormData(i)){if(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((u=o.getContentType())!==!1){let[x,...y]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([x||"multipart/form-data",...y].join("; "))}}let f=new XMLHttpRequest;if(t.auth){let x=t.auth.username||"",y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.set("Authorization","Basic "+btoa(x+":"+y))}let d=di(t.baseURL,t.url);f.open(t.method.toUpperCase(),ci(d,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function m(){if(!f)return;let x=Le.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),p={data:!s||s==="text"||s==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:x,config:t,request:f};ec(function(b){r(b),l()},function(b){n(b),l()},p),f=null}if("onloadend"in f?f.onloadend=m:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(m)},f.onabort=function(){f&&(n(new Y("Request aborted",Y.ECONNABORTED,t,f)),f=null)},f.onerror=function(){n(new Y("Network Error",Y.ERR_NETWORK,t,f)),f=null},f.ontimeout=function(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",p=t.transitional||Ns;t.timeoutErrorMessage&&(y=t.timeoutErrorMessage),n(new Y(y,p.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,t,f)),f=null},Ue.hasStandardBrowserEnv&&(a&&v.isFunction(a)&&(a=a(t)),a||a!==!1&&om(d))){let x=t.xsrfHeaderName&&t.xsrfCookieName&&im.read(t.xsrfCookieName);x&&o.set(t.xsrfHeaderName,x)}i===void 0&&o.setContentType(null),"setRequestHeader"in f&&v.forEach(o.toJSON(),function(y,p){f.setRequestHeader(p,y)}),v.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),s&&s!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",am(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",am(t.onUploadProgress)),(t.cancelToken||t.signal)&&(c=x=>{f&&(n(!x||x.type?new cr(null,t,f):x),f.abort(),f=null)},t.cancelToken&&t.cancelToken.subscribe(c),t.signal&&(t.signal.aborted?c():t.signal.addEventListener("abort",c)));let h=nc(d);if(h&&Ue.protocols.indexOf(h)===-1){n(new Y("Unsupported protocol "+h+":",Y.ERR_BAD_REQUEST,t));return}f.send(i||null)})};var ic={http:_s,xhr:cm};v.forEach(ic,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var um=t=>`- ${t}`,gy=t=>v.isFunction(t)||t===null||t===!1,js={getAdapter:t=>{t=v.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let o=0;o<e;o++){r=t[o];let s;if(n=r,!gy(r)&&(n=ic[(s=String(r)).toLowerCase()],n===void 0))throw new Y(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=e?o.length>1?`since :
|
|
8
8
|
`+o.map(um).join(`
|
|
9
9
|
`):" "+um(o[0]):"as no adapter specified";throw new Y("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:ic};function oc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new cr(null,t)}function Us(t){return oc(t),t.headers=Le.from(t.headers),t.data=li.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),js.getAdapter(t.adapter||un.adapter)(t).then(function(n){return oc(t),n.data=li.call(t,t.transformResponse,n),n.headers=Le.from(n.headers),n},function(n){return fi(n)||(oc(t),n&&n.response&&(n.response.data=li.call(t,t.transformResponse,n.response),n.response.headers=Le.from(n.response.headers))),Promise.reject(n)})}var lm=t=>t instanceof Le?t.toJSON():t;function zt(t,e){e=e||{};let r={};function n(l,u,f){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge.call({caseless:f},l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function i(l,u,f){if(v.isUndefined(u)){if(!v.isUndefined(l))return n(void 0,l,f)}else return n(l,u,f)}function o(l,u){if(!v.isUndefined(u))return n(void 0,u)}function s(l,u){if(v.isUndefined(u)){if(!v.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function a(l,u,f){if(f in e)return n(l,u);if(f in t)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,u)=>i(lm(l),lm(u),!0)};return v.forEach(Object.keys(Object.assign({},t,e)),function(u){let f=c[u]||i,d=f(t[u],e[u],u);v.isUndefined(d)&&f!==a||(r[u]=d)}),r}var Ls="1.6.7";var sc={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{sc[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var fm={};sc.transitional=function(e,r,n){function i(o,s){return"[Axios v"+Ls+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(e===!1)throw new Y(i(s," has been removed"+(r?" in "+r:"")),Y.ERR_DEPRECATED);return r&&!fm[s]&&(fm[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,s,a):!0}};function yy(t,e,r){if(typeof t!="object")throw new Y("options must be an object",Y.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let o=n[i],s=e[o];if(s){let a=t[o],c=a===void 0||s(a,o,t);if(c!==!0)throw new Y("option "+o+" must be "+c,Y.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Y("Unknown option "+o,Y.ERR_BAD_OPTION)}}var zs={assertOptions:yy,validators:sc};var ur=zs.validators,fn=class{constructor(e){this.defaults=e,this.interceptors={request:new K0,response:new K0}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
10
|
-
`+o):n.stack=o}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=zt(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&zs.assertOptions(n,{silentJSONParsing:ur.transitional(ur.boolean),forcedJSONParsing:ur.transitional(ur.boolean),clarifyTimeoutError:ur.transitional(ur.boolean)},!1),i!=null&&(v.isFunction(i)?r.paramsSerializer={serialize:i}:zs.assertOptions(i,{encode:ur.function,serialize:ur.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&v.merge(o.common,o[r.method]);o&&v.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),r.headers=Le.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(c=c&&x.synchronous,a.unshift(x.fulfilled,x.rejected))});let l=[];this.interceptors.response.forEach(function(x){l.push(x.fulfilled,x.rejected)});let u,f=0,d;if(!c){let h=[Us.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,l),d=h.length,u=Promise.resolve(r);f<d;)u=u.then(h[f++],h[f++]);return u}d=a.length;let m=r;for(f=0;f<d;){let h=a[f++],x=a[f++];try{m=h(m)}catch(y){x.call(this,y);break}}try{u=Us.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,d=l.length;f<d;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=zt(this.defaults,e);let r=di(e.baseURL,e.url);return ci(r,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){fn.prototype[e]=function(r,n){return this.request(zt(n||{},{method:e,url:r,data:(n||{}).data}))}});v.forEach(["post","put","patch"],function(e){function r(n){return function(o,s,a){return this.request(zt(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}fn.prototype[e]=r(),fn.prototype[e+"Form"]=r(!0)});var mi=fn;var ac=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new cr(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},dm=ac;function cc(t){return function(r){return t.apply(null,r)}}function uc(t){return v.isObject(t)&&t.isAxiosError===!0}var lc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lc).forEach(([t,e])=>{lc[e]=t});var mm=lc;function hm(t){let e=new mi(t),r=oi(mi.prototype.request,e);return v.extend(r,mi.prototype,e,{allOwnKeys:!0}),v.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return hm(zt(t,i))},r}var we=hm(un);we.Axios=mi;we.CanceledError=cr;we.CancelToken=dm;we.isCancel=fi;we.VERSION=Ls;we.toFormData=ar;we.AxiosError=Y;we.Cancel=we.CanceledError;we.all=function(e){return Promise.all(e)};we.spread=cc;we.isAxiosError=uc;we.mergeConfig=zt;we.AxiosHeaders=Le;we.formToJSON=t=>Rs(v.isHTMLForm(t)?new FormData(t):t);we.getAdapter=js.getAdapter;we.HttpStatusCode=mm;we.default=we;var Wt=we;var{Axios:rC,AxiosError:pm,CanceledError:nC,isCancel:iC,CancelToken:oC,VERSION:sC,all:aC,Cancel:cC,isAxiosError:uC,spread:lC,toFormData:fC,AxiosHeaders:dC,HttpStatusCode:mC,formToJSON:hC,getAdapter:pC,mergeConfig:xC}=Wt;var dn=class extends he{constructor(e,r){super(10,e,{context:r})}};var Ws=class t{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof pm)throw new dn(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new dn(e.data.code)}throw new dn(e.status.toString())}async getIncomingStreams(e,r){let n=await Wt.post(`${this.apiURL}/stream`,{recipient:e,...r});return t.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await Wt.post(`${this.apiURL}/stream`,{sender:e,...r});return t.parseResponseData(n)}async getStreamHistory(e){let r=await Wt.post(`${this.apiURL}/stream-events`,e),n=t.parseResponseData(r);return n.data.forEach(i=>{let o=i;return o.data.type==="create_stream"?o.data.balance=BigInt(o.data.balance):o.data.type==="cancel_stream"?o.data.withdrawAmount=BigInt(o.data.withdrawAmount):o.data.type==="claim"||o.data.type==="auto_claim"?o.data.claimAmount=BigInt(o.data.claimAmount):o.data.type==="set_auto_claim"&&(o.data.enabled=!!o.data.enabled),o.createdAt=new Date(o.createdAt),o}),n}async getAllCoinTypes(e){let r=await Wt.post(`${this.apiURL}/stream-info`,{address:e});return t.parseResponseData(r)}async getAllRecipients(e,r){let n=await Wt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return t.parseResponseData(n)}async getAllSenders(e,r){let n=await Wt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return t.parseResponseData(n)}};var mn=class t{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Ts({url:e.rpc.url}),e.backend&&(this._backend=new Ws(e.backend.url))}static new(e,r){let n=Bd(e,r);return new t(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Bs;return this._backend}set backend(e){this._backend=e}connectWallet(e){this.signer=e}disconnect(){this.signer=void 0}get wallet(){if(!this.signer)throw new Ds;return this.signer}async walletAddress(){return this.wallet.address()}};var xm=Lr(ys()),Ot=class{constructor(e){this.data=e}get application(){return"msafe-core"}serialize(){return JSON.stringify((0,xm.default)(this.data))}};var Ht=class extends Error{},Hs=class extends Ht{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},$s=class extends Ht{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},qs=class extends Ht{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},St=class extends Ht{},hn=class extends Ht{constructor(e){super(`Invalid unit ${e}`)}},Ee=class extends Ht{},vt=class extends Ht{constructor(){super("Zone is an abstract class")}};var j="numeric",Ct="short",Ye="long",lr={year:j,month:j,day:j},hi={year:j,month:Ct,day:j},fc={year:j,month:Ct,day:j,weekday:Ct},pi={year:j,month:Ye,day:j},xi={year:j,month:Ye,day:j,weekday:Ye},gi={hour:j,minute:j},yi={hour:j,minute:j,second:j},bi={hour:j,minute:j,second:j,timeZoneName:Ct},wi={hour:j,minute:j,second:j,timeZoneName:Ye},Ei={hour:j,minute:j,hourCycle:"h23"},Si={hour:j,minute:j,second:j,hourCycle:"h23"},vi={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Ct},Ci={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Ye},Ai={year:j,month:j,day:j,hour:j,minute:j},Ti={year:j,month:j,day:j,hour:j,minute:j,second:j},Bi={year:j,month:Ct,day:j,hour:j,minute:j},Di={year:j,month:Ct,day:j,hour:j,minute:j,second:j},dc={year:j,month:Ct,day:j,weekday:Ct,hour:j,minute:j},Ii={year:j,month:Ye,day:j,hour:j,minute:j,timeZoneName:Ct},Fi={year:j,month:Ye,day:j,hour:j,minute:j,second:j,timeZoneName:Ct},Oi={year:j,month:Ye,day:j,weekday:Ye,hour:j,minute:j,timeZoneName:Ye},ki={year:j,month:Ye,day:j,weekday:Ye,hour:j,minute:j,second:j,timeZoneName:Ye};var Ve=class{get type(){throw new vt}get name(){throw new vt}get ianaName(){return this.name}get isUniversal(){throw new vt}offsetName(e,r){throw new vt}formatOffset(e,r){throw new vt}offset(e){throw new vt}equals(e){throw new vt}get isValid(){throw new vt}};var mc=null,fr=class t extends Ve{static get instance(){return mc===null&&(mc=new t),mc}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Gs(e,r,n)}formatOffset(e,r){return dr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Ks={};function by(t){return Ks[t]||(Ks[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Ks[t]}var wy={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ey(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,o,s,a,c,l,u]=n;return[s,i,o,a,c,l,u]}function Sy(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=wy[o];o==="era"?n[a]=s:H(a)||(n[a]=parseInt(s,10))}return n}var Zs={},Ne=class t extends Ve{static create(e){return Zs[e]||(Zs[e]=new t(e)),Zs[e]}static resetCache(){Zs={},Ks={}}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=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Gs(e,r,n,this.name)}formatOffset(e,r){return dr(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=by(this.name),[i,o,s,a,c,l,u]=n.formatToParts?Sy(n,r):Ey(n,r);a==="BC"&&(i=-Math.abs(i)+1);let d=pn({year:i,month:o,day:s,hour:c===24?0:c,minute:l,second:u,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var gm={};function vy(t,e={}){let r=JSON.stringify([t,e]),n=gm[r];return n||(n=new Intl.ListFormat(t,e),gm[r]=n),n}var hc={};function pc(t,e={}){let r=JSON.stringify([t,e]),n=hc[r];return n||(n=new Intl.DateTimeFormat(t,e),hc[r]=n),n}var xc={};function Cy(t,e={}){let r=JSON.stringify([t,e]),n=xc[r];return n||(n=new Intl.NumberFormat(t,e),xc[r]=n),n}var gc={};function Ay(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=gc[i];return o||(o=new Intl.RelativeTimeFormat(t,e),gc[i]=o),o}var _i=null;function Ty(){return _i||(_i=new Intl.DateTimeFormat().resolvedOptions().locale,_i)}var ym={};function By(t){let e=ym[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,ym[t]=e}return e}function Dy(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,i;try{n=pc(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=pc(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function Iy(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Fy(t){let e=[];for(let r=1;r<=12;r++){let n=te.utc(2009,r,1);e.push(t(n))}return e}function Oy(t){let e=[];for(let r=1;r<=7;r++){let n=te.utc(2016,11,13+r);e.push(t(n))}return e}function Js(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function ky(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var yc=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!r||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=Cy(e,a)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):xn(e,3);return ge(r,this.padTo)}}},bc=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&Ne.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 o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=pc(r,o)}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(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},wc=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Ys()&&(this.rtf=Ay(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):bm(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},_y={firstDay:1,minimalDays:4,weekend:[6,7]},se=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,i,o=!1){let s=e||ne.defaultLocale,a=s||(o?"en-US":Ty()),c=r||ne.defaultNumberingSystem,l=n||ne.defaultOutputCalendar,u=Mi(i)||ne.defaultWeekSettings;return new t(a,c,l,u,s)}static resetCache(){_i=null,hc={},xc={},gc={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return t.create(e,r,n,i)}constructor(e,r,n,i,o){let[s,a,c]=Dy(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=Iy(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=ky(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Mi(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,r=!1){return Js(this,e,Ec,()=>{let n=r?{month:e,day:"numeric"}:{month:e},i=r?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=Fy(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,r=!1){return Js(this,e,Sc,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=r?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=Oy(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Js(this,void 0,()=>vc,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[te.utc(2016,11,13,9),te.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Js(this,e,Cc,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[te.utc(-40,1,1),te.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let i=this.dtFormatter(e,r),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new yc(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new bc(e,this.intl,r)}relFormatter(e={}){return new wc(this.intl,this.isEnglish(),e)}listFormatter(e={}){return vy(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Xs()?By(this.locale):_y}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}};var Tc=null,Ie=class t extends Ve{static get utcInstance(){return Tc===null&&(Tc=new t(0)),Tc}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Or(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${dr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${dr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return dr(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var gn=class extends Ve{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 At(t,e){let r;if(H(t)||t===null)return e;if(t instanceof Ve)return t;if(wm(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?fr.instance:n==="utc"||n==="gmt"?Ie.utcInstance:Ie.parseSpecifier(n)||Ne.create(t)}else return kt(t)?Ie.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new gn(t)}var Em=()=>Date.now(),Sm="system",vm=null,Cm=null,Am=null,Tm=60,Bm,Dm=null,ne=class{static get now(){return Em}static set now(e){Em=e}static set defaultZone(e){Sm=e}static get defaultZone(){return At(Sm,fr.instance)}static get defaultLocale(){return vm}static set defaultLocale(e){vm=e}static get defaultNumberingSystem(){return Cm}static set defaultNumberingSystem(e){Cm=e}static get defaultOutputCalendar(){return Am}static set defaultOutputCalendar(e){Am=e}static get defaultWeekSettings(){return Dm}static set defaultWeekSettings(e){Dm=Mi(e)}static get twoDigitCutoffYear(){return Tm}static set twoDigitCutoffYear(e){Tm=e%100}static get throwOnInvalid(){return Bm}static set throwOnInvalid(e){Bm=e}static resetCaches(){se.resetCache(),Ne.resetCache()}};var Fe=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Im=[0,31,59,90,120,151,181,212,243,273,304,334],Fm=[0,31,60,91,121,152,182,213,244,274,305,335];function ut(t,e){return new Fe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Qs(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function Om(t,e,r){return r+(_r(t)?Fm:Im)[e-1]}function km(t,e){let r=_r(t)?Fm:Im,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function ea(t,e){return(t-e+7)%7+1}function Ni(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=Om(n,i,o),a=ea(Qs(n,i,o),r),c=Math.floor((s-a+14-e)/7),l;return c<1?(l=n-1,c=kr(l,e,r)):c>kr(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...Pi(t)}}function Bc(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=ea(Qs(n,1,e),r),a=mr(n),c=i*7+o-s-7+e,l;c<1?(l=n-1,c+=mr(l)):c>a?(l=n+1,c-=mr(n)):l=n;let{month:u,day:f}=km(l,c);return{year:l,month:u,day:f,...Pi(t)}}function ta(t){let{year:e,month:r,day:n}=t,i=Om(e,r,n);return{year:e,ordinal:i,...Pi(t)}}function Dc(t){let{year:e,ordinal:r}=t,{month:n,day:i}=km(e,r);return{year:e,month:n,day:i,...Pi(t)}}function Ic(t,e){if(!H(t.localWeekday)||!H(t.localWeekNumber)||!H(t.localWeekYear)){if(!H(t.weekday)||!H(t.weekNumber)||!H(t.weekYear))throw new St("Cannot mix locale-based week fields with ISO-based week fields");return H(t.localWeekday)||(t.weekday=t.localWeekday),H(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),H(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function _m(t,e=4,r=1){let n=Ri(t.weekYear),i=Xe(t.weekNumber,1,kr(t.weekYear,e,r)),o=Xe(t.weekday,1,7);return n?i?o?!1:ut("weekday",t.weekday):ut("week",t.weekNumber):ut("weekYear",t.weekYear)}function Mm(t){let e=Ri(t.year),r=Xe(t.ordinal,1,mr(t.year));return e?r?!1:ut("ordinal",t.ordinal):ut("year",t.year)}function Fc(t){let e=Ri(t.year),r=Xe(t.month,1,12),n=Xe(t.day,1,yn(t.year,t.month));return e?r?n?!1:ut("day",t.day):ut("month",t.month):ut("year",t.year)}function Oc(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=Xe(e,0,23)||e===24&&r===0&&n===0&&i===0,s=Xe(r,0,59),a=Xe(n,0,59),c=Xe(i,0,999);return o?s?a?c?!1:ut("millisecond",i):ut("second",n):ut("minute",r):ut("hour",e)}function H(t){return typeof t>"u"}function kt(t){return typeof t=="number"}function Ri(t){return typeof t=="number"&&t%1===0}function wm(t){return typeof t=="string"}function Rm(t){return Object.prototype.toString.call(t)==="[object Date]"}function Ys(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Xs(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Pm(t){return Array.isArray(t)?t:[t]}function kc(t,e,r){if(t.length!==0)return t.reduce((n,i)=>{let o=[e(i),i];return n&&r(n[0],o[0])===n[0]?n:o},null)[1]}function jm(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function hr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Mi(t){if(t==null)return null;if(typeof t!="object")throw new Ee("Week settings must be an object");if(!Xe(t.firstDay,1,7)||!Xe(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Xe(e,1,7)))throw new Ee("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Xe(t,e,r){return Ri(t)&&t>=e&&t<=r}function My(t,e){return t-e*Math.floor(t/e)}function ge(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function $t(t){if(!(H(t)||t===null||t===""))return parseInt(t,10)}function pr(t){if(!(H(t)||t===null||t===""))return parseFloat(t)}function ji(t){if(!(H(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function xn(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function _r(t){return t%4===0&&(t%100!==0||t%400===0)}function mr(t){return _r(t)?366:365}function yn(t,e){let r=My(e-1,12)+1,n=t+(e-r)/12;return r===2?_r(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function pn(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Nm(t,e,r){return-ea(Qs(t,1,e),r)+e-1}function kr(t,e=4,r=1){let n=Nm(t,e,r),i=Nm(t+1,e,r);return(mr(t)-n+i)/7}function Ui(t){return t>99?t:t>ne.twoDigitCutoffYear?1900+t:2e3+t}function Gs(t,e,r,n=null){let i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(r,s).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Or(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function _c(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ee(`Invalid unit value ${t}`);return e}function bn(t,e){let r={};for(let n in t)if(hr(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=_c(i)}return r}function dr(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${ge(r,2)}:${ge(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${ge(r,2)}${ge(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Pi(t){return jm(t,["hour","minute","second","millisecond"])}var Ny=["January","February","March","April","May","June","July","August","September","October","November","December"],Mc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ry=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ec(t){switch(t){case"narrow":return[...Ry];case"short":return[...Mc];case"long":return[...Ny];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 Nc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Rc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Py=["M","T","W","T","F","S","S"];function Sc(t){switch(t){case"narrow":return[...Py];case"short":return[...Rc];case"long":return[...Nc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var vc=["AM","PM"],jy=["Before Christ","Anno Domini"],Uy=["BC","AD"],Ly=["B","A"];function Cc(t){switch(t){case"narrow":return[...Ly];case"short":return[...Uy];case"long":return[...jy];default:return null}}function Um(t){return vc[t.hour<12?0:1]}function Lm(t,e){return Sc(e)[t.weekday-1]}function zm(t,e){return Ec(e)[t.month-1]}function Wm(t,e){return Cc(e)[t.year<0?0:1]}function bm(t,e,r="always",n=!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."]},o=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&o){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`;default:}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,l=i[t],u=n?c?l[1]:l[2]||l[1]:c?i[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}function Hm(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var zy={D:lr,DD:hi,DDD:pi,DDDD:xi,t:gi,tt:yi,ttt:bi,tttt:wi,T:Ei,TT:Si,TTT:vi,TTTT:Ci,f:Ai,ff:Bi,fff:Ii,ffff:Oi,F:Ti,FF:Di,FFF:Fi,FFFF:ki},Oe=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",i=!1,o=[];for(let s=0;s<e.length;s++){let a=e.charAt(s);a==="'"?(n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return zy[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return ge(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(m,h)=>this.loc.extract(e,m,h),s=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",a=()=>n?Um(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,h)=>n?zm(e,m):o(h?{month:m}:{month:m,day:"numeric"},"month"),l=(m,h)=>n?Lm(e,m):o(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{let h=t.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},f=m=>n?Wm(e,m):o({era:m},"era"),d=m=>{switch(m){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 s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({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?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("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 u(m)}};return Hm(t.parseFormat(r),d)}formatDurationFromString(e,r){let n=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=c=>l=>{let u=n(l);return u?this.num(c.get(u),l.length):l},o=t.parseFormat(r),s=o.reduce((c,{literal:l,val:u})=>l?c:c.concat(u),[]),a=e.shiftTo(...s.map(n).filter(c=>c));return Hm(o,i(a))}};var qm=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function En(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Sn(...t){return e=>t.reduce(([r,n,i],o)=>{let[s,a,c]=o(e,i);return[{...r,...s},a||n,c]},[{},null,1]).slice(0,2)}function vn(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let i=r.exec(t);if(i)return n(i)}return[null,null]}function Vm(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=$t(e[r+i]);return[n,null,r+i]}}var Gm=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Wy=`(?:${Gm.source}?(?:\\[(${qm.source})\\])?)?`,Pc=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Zm=RegExp(`${Pc.source}${Wy}`),jc=RegExp(`(?:T${Zm.source})?`),Hy=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,$y=/(\d{4})-?W(\d\d)(?:-?(\d))?/,qy=/(\d{4})-?(\d{3})/,Vy=Vm("weekYear","weekNumber","weekDay"),Gy=Vm("year","ordinal"),Zy=/(\d{4})-(\d\d)-(\d\d)/,Km=RegExp(`${Pc.source} ?(?:${Gm.source}|(${qm.source}))?`),Ky=RegExp(`(?: ${Km.source})?`);function wn(t,e,r){let n=t[e];return H(n)?r:$t(n)}function Jy(t,e){return[{year:wn(t,e),month:wn(t,e+1,1),day:wn(t,e+2,1)},null,e+3]}function Cn(t,e){return[{hours:wn(t,e,0),minutes:wn(t,e+1,0),seconds:wn(t,e+2,0),milliseconds:ji(t[e+3])},null,e+4]}function Li(t,e){let r=!t[e]&&!t[e+1],n=Or(t[e+1],t[e+2]),i=r?null:Ie.instance(n);return[{},i,e+3]}function zi(t,e){let r=t[e]?Ne.create(t[e]):null;return[{},r,e+1]}var Yy=RegExp(`^T?${Pc.source}$`),Xy=/^-?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 Qy(t){let[e,r,n,i,o,s,a,c,l]=t,u=e[0]==="-",f=c&&c[0]==="-",d=(m,h=!1)=>m!==void 0&&(h||m&&u)?-m:m;return[{years:d(pr(r)),months:d(pr(n)),weeks:d(pr(i)),days:d(pr(o)),hours:d(pr(s)),minutes:d(pr(a)),seconds:d(pr(c),c==="-0"),milliseconds:d(ji(l),f)}]}var e2={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Uc(t,e,r,n,i,o,s){let a={year:e.length===2?Ui($t(e)):$t(e),month:Mc.indexOf(r)+1,day:$t(n),hour:$t(i),minute:$t(o)};return s&&(a.second=$t(s)),t&&(a.weekday=t.length>3?Nc.indexOf(t)+1:Rc.indexOf(t)+1),a}var t2=/^(?:(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 r2(t){let[,e,r,n,i,o,s,a,c,l,u,f]=t,d=Uc(e,i,n,r,o,s,a),m;return c?m=e2[c]:l?m=0:m=Or(u,f),[d,new Ie(m)]}function n2(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var i2=/^(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$/,o2=/^(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$/,s2=/^(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 $m(t){let[,e,r,n,i,o,s,a]=t;return[Uc(e,i,n,r,o,s,a),Ie.utcInstance]}function a2(t){let[,e,r,n,i,o,s,a]=t;return[Uc(e,a,r,n,i,o,s),Ie.utcInstance]}var c2=En(Hy,jc),u2=En($y,jc),l2=En(qy,jc),f2=En(Zm),Jm=Sn(Jy,Cn,Li,zi),d2=Sn(Vy,Cn,Li,zi),m2=Sn(Gy,Cn,Li,zi),h2=Sn(Cn,Li,zi);function Ym(t){return vn(t,[c2,Jm],[u2,d2],[l2,m2],[f2,h2])}function Xm(t){return vn(n2(t),[t2,r2])}function Qm(t){return vn(t,[i2,$m],[o2,$m],[s2,a2])}function eh(t){return vn(t,[Xy,Qy])}var p2=Sn(Cn);function th(t){return vn(t,[Yy,p2])}var x2=En(Zy,Ky),g2=En(Km),y2=Sn(Cn,Li,zi);function rh(t){return vn(t,[x2,Jm],[g2,y2])}var nh="Invalid Duration",oh={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},b2={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:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...oh},lt=146097/400,An=146097/4800,w2={years:{quarters:4,months:12,weeks:lt/7,days:lt,hours:lt*24,minutes:lt*24*60,seconds:lt*24*60*60,milliseconds:lt*24*60*60*1e3},quarters:{months:3,weeks:lt/28,days:lt/4,hours:lt*24/4,minutes:lt*24*60/4,seconds:lt*24*60*60/4,milliseconds:lt*24*60*60*1e3/4},months:{weeks:An/7,days:An,hours:An*24,minutes:An*24*60,seconds:An*24*60*60,milliseconds:An*24*60*60*1e3},...oh},Mr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],E2=Mr.slice(0).reverse();function xr(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ue(n)}function sh(t,e){let r=e.milliseconds??0;for(let n of E2.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function ih(t,e){let r=sh(t,e)<0?-1:1;Mr.reduceRight((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]*r,s=t[i][n],a=Math.floor(o/s);e[i]+=a*r,e[n]-=a*s*r}return i},null),Mr.reduce((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*t[n][i]}return i},null)}function S2(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var ue=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?w2:b2;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Ee(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:bn(e,t.normalizeUnit),loc:se.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(kt(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Ee(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=eh(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=th(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Ee("need to specify a reason the Duration is invalid");let n=e instanceof Fe?e:new Fe(e,r);if(ne.throwOnInvalid)throw new qs(n);return new t({invalid:n})}static normalizeUnit(e){let r={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(!r)throw new hn(e);return r}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,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Oe.create(this.loc,n).formatDurationFromString(this,e):nh}toHuman(e={}){if(!this.isValid)return nh;let r=Mr.map(n=>{let i=this.values[n];return H(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);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+=xn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},te.fromMillis(r,{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?sh(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let i of Mr)(hr(r.values,i)||hr(this.values,i))&&(n[i]=r.get(i)+this.get(i));return xr(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=_c(e(this.values[n],n));return xr(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...bn(e,t.normalizeUnit)};return xr(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:i,conversionAccuracy:n};return xr(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ih(this.matrix,e),xr(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=S2(this.normalize().shiftToAll().toObject());return xr(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},n={},i=this.toObject(),o;for(let s of Mr)if(e.indexOf(s)>=0){o=s;let a=0;for(let l in n)a+=this.matrix[l][s]*n[l],n[l]=0;kt(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else kt(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(r[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return ih(this.matrix,r),xr(this,{values:r},!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 r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return xr(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 r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of Mr)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Tn="Invalid Interval";function v2(t,e){return!t||!t.isValid?qt.invalid("missing or invalid start"):!e||!e.isValid?qt.invalid("missing or invalid end"):e<t?qt.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var qt=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Ee("need to specify a reason the Interval is invalid");let n=e instanceof Fe?e:new Fe(e,r);if(ne.throwOnInvalid)throw new $s(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Bn(e),i=Bn(r),o=v2(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=ue.fromDurationLike(r),i=Bn(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=ue.fromDurationLike(r),i=Bn(e);return t.fromDateTimes(i.minus(n),i)}static fromISO(e,r){let[n,i]=(e||"").split("/",2);if(n&&i){let o,s;try{o=te.fromISO(n,r),s=o.isValid}catch{s=!1}let a,c;try{a=te.fromISO(i,r),c=a.isValid}catch{c=!1}if(s&&c)return t.fromDateTimes(o,a);if(s){let l=ue.fromISO(i,r);if(l.isValid)return t.after(o,l)}else if(c){let l=ue.fromISO(n,r);if(l.isValid)return t.before(a,l)}}return t.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 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",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),i;return r?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,r),Math.floor(i.diff(n,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:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(Bn).filter(s=>this.contains(s)).sort((s,a)=>s.toMillis()-a.toMillis()),n=[],{s:i}=this,o=0;for(;i<this.e;){let s=r[o]||this.e,a=+s>+this.e?this.e:s;n.push(t.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let r=ue.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(c=>c*i));o=+a>+this.e?this.e:a,s.push(t.fromDateTimes(n,o)),n=o,i+=1}return s}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 r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,i=[],o=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((c,l)=>c.time-l.time);for(let c of a)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&i.push(t.fromDateTimes(r,c.time)),r=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Tn}[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=lr,r={}){return this.isValid?Oe.create(this.s.loc.clone(r),e).formatInterval(this):Tn}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Tn}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Tn}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Tn}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Tn}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):ue.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Vt=class{static hasDST(e=ne.defaultZone){let r=te.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return Ne.isValidZone(e)}static normalizeZone(e){return At(e,ne.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return se.create(r,null,"gregory").eras(e)}static features(){return{relative:Ys(),localeWeek:Xs()}}};function ah(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(ue.fromMillis(n).as("days"))}function C2(t,e,r){let n=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{let u=ah(c,l);return(u-u%7)/7}],["days",ah]],i={},o=t,s,a;for(let[c,l]of n)r.indexOf(c)>=0&&(s=c,i[c]=l(t,e),a=o.plus(i),a>e?(i[c]--,t=o.plus(i),t>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}function ch(t,e,r,n){let[i,o,s,a]=C2(t,e,r),c=e-i,l=r.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));let u=ue.fromObject(o,n);return l.length>0?ue.fromMillis(c,n).shiftTo(...l).plus(u):u}var Lc={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"},uh={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]},A2=Lc.hanidec.replace(/[\[|\]]/g,"").split("");function lh(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(Lc.hanidec)!==-1)e+=A2.indexOf(t[r]);else for(let i in uh){let[o,s]=uh[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function ft({numberingSystem:t},e=""){return new RegExp(`${Lc[t||"latn"]}${e}`)}var T2="missing Intl.DateTimeFormat.formatToParts support";function ie(t,e=r=>r){return{regex:t,deser:([r])=>e(lh(r))}}var B2="\xA0",mh=`[ ${B2}]`,hh=new RegExp(mh,"g");function D2(t){return t.replace(/\./g,"\\.?").replace(hh,mh)}function fh(t){return t.replace(/\./g,"").replace(hh," ").toLowerCase()}function Tt(t,e){return t===null?null:{regex:RegExp(t.map(D2).join("|")),deser:([r])=>t.findIndex(n=>fh(r)===fh(n))+e}}function dh(t,e){return{regex:t,deser:([,r,n])=>Or(r,n),groups:e}}function ra(t){return{regex:t,deser:([e])=>e}}function I2(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function F2(t,e){let r=ft(e),n=ft(e,"{2}"),i=ft(e,"{3}"),o=ft(e,"{4}"),s=ft(e,"{6}"),a=ft(e,"{1,2}"),c=ft(e,"{1,3}"),l=ft(e,"{1,6}"),u=ft(e,"{1,9}"),f=ft(e,"{2,4}"),d=ft(e,"{4,6}"),m=y=>({regex:RegExp(I2(y.val)),deser:([p])=>p,literal:!0}),x=(y=>{if(t.literal)return m(y);switch(y.val){case"G":return Tt(e.eras("short"),0);case"GG":return Tt(e.eras("long"),0);case"y":return ie(l);case"yy":return ie(f,Ui);case"yyyy":return ie(o);case"yyyyy":return ie(d);case"yyyyyy":return ie(s);case"M":return ie(a);case"MM":return ie(n);case"MMM":return Tt(e.months("short",!0),1);case"MMMM":return Tt(e.months("long",!0),1);case"L":return ie(a);case"LL":return ie(n);case"LLL":return Tt(e.months("short",!1),1);case"LLLL":return Tt(e.months("long",!1),1);case"d":return ie(a);case"dd":return ie(n);case"o":return ie(c);case"ooo":return ie(i);case"HH":return ie(n);case"H":return ie(a);case"hh":return ie(n);case"h":return ie(a);case"mm":return ie(n);case"m":return ie(a);case"q":return ie(a);case"qq":return ie(n);case"s":return ie(a);case"ss":return ie(n);case"S":return ie(c);case"SSS":return ie(i);case"u":return ra(u);case"uu":return ra(a);case"uuu":return ie(r);case"a":return Tt(e.meridiems(),0);case"kkkk":return ie(o);case"kk":return ie(f,Ui);case"W":return ie(a);case"WW":return ie(n);case"E":case"c":return ie(r);case"EEE":return Tt(e.weekdays("short",!1),1);case"EEEE":return Tt(e.weekdays("long",!1),1);case"ccc":return Tt(e.weekdays("short",!0),1);case"cccc":return Tt(e.weekdays("long",!0),1);case"Z":case"ZZ":return dh(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return dh(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return ra(/[a-z_+-/]{1,256}?/i);case" ":return ra(/[^\S\n\r]/);default:return m(y)}})(t)||{invalidReason:T2};return x.token=t,x}var O2={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 k2(t,e,r){let{type:n,value:i}=t;if(n==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let a=O2[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function _2(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function M2(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(hr(r,s)){let a=r[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+c))),o+=c}return[n,i]}else return[n,{}]}function N2(t){let e=o=>{switch(o){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}},r=null,n;return H(t.z)||(r=Ne.create(t.z)),H(t.Z)||(r||(r=new Ie(t.Z)),n=t.Z),H(t.q)||(t.M=(t.q-1)*3+1),H(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),H(t.u)||(t.S=ji(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var zc=null;function R2(){return zc||(zc=te.fromMillis(1555555555555)),zc}function P2(t,e){if(t.literal)return t;let r=Oe.macroTokenToFormatOpts(t.val),n=$c(r,e);return n==null||n.includes(void 0)?t:n}function Wc(t,e){return Array.prototype.concat(...t.map(r=>P2(r,e)))}function Hc(t,e,r){let n=Wc(Oe.parseFormat(r),t),i=n.map(s=>F2(s,t)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=_2(i),c=RegExp(s,"i"),[l,u]=M2(e,c,a),[f,d,m]=u?N2(u):[null,null,void 0];if(hr(u,"a")&&hr(u,"H"))throw new St("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:c,rawMatches:l,matches:u,result:f,zone:d,specificOffset:m}}}function ph(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=Hc(t,e,r);return[n,i,o,s]}function $c(t,e){if(!t)return null;let n=Oe.create(e,t).dtFormatter(R2()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>k2(s,t,o))}var qc="Invalid DateTime",xh=864e13;function na(t){return new Fe("unsupported zone",`the zone "${t.name}" is not supported`)}function Vc(t){return t.weekData===null&&(t.weekData=Ni(t.c)),t.weekData}function Gc(t){return t.localWeekData===null&&(t.localWeekData=Ni(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Nr(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new te({...r,...e,old:r})}function vh(t,e,r){let n=t-e*60*1e3,i=r.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=r.offset(n);return i===o?[n,i]:[t-Math.min(i,o)*60*1e3,Math.max(i,o)]}function ia(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function sa(t,e,r){return vh(pn(t),e,r)}function gh(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...t.c,year:n,month:i,day:Math.min(t.c.day,yn(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=ue.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=pn(o),[c,l]=vh(a,r,t.zone);return s!==0&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function Wi(t,e,r,n,i,o){let{setZone:s,zone:a}=r;if(t&&Object.keys(t).length!==0||e){let c=e||a,l=te.fromObject(t,{...r,zone:c,specificOffset:o});return s?l:l.setZone(a)}else return te.invalid(new Fe("unparsable",`the input "${i}" can't be parsed as ${n}`))}function oa(t,e,r=!0){return t.isValid?Oe.create(se.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Zc(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=ge(t.c.year,r?6:4),e?(n+="-",n+=ge(t.c.month),n+="-",n+=ge(t.c.day)):(n+=ge(t.c.month),n+=ge(t.c.day)),n}function yh(t,e,r,n,i,o){let s=ge(t.c.hour);return e?(s+=":",s+=ge(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=":")):s+=ge(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=ge(t.c.second),(t.c.millisecond!==0||!n)&&(s+=".",s+=ge(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!o?s+="Z":t.o<0?(s+="-",s+=ge(Math.trunc(-t.o/60)),s+=":",s+=ge(Math.trunc(-t.o%60))):(s+="+",s+=ge(Math.trunc(t.o/60)),s+=":",s+=ge(Math.trunc(t.o%60)))),o&&(s+="["+t.zone.ianaName+"]"),s}var Ch={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},j2={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},U2={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ah=["year","month","day","hour","minute","second","millisecond"],L2=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],z2=["year","ordinal","hour","minute","second","millisecond"];function W2(t){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"}[t.toLowerCase()];if(!e)throw new hn(t);return e}function bh(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return W2(t)}}function wh(t,e){let r=At(e.zone,ne.defaultZone),n=se.fromObject(e),i=ne.now(),o,s;if(H(t.year))o=i;else{for(let l of Ah)H(t[l])&&(t[l]=Ch[l]);let a=Fc(t)||Oc(t);if(a)return te.invalid(a);let c=r.offset(i);[o,s]=sa(t,c,r)}return new te({ts:o,zone:r,loc:n,o:s})}function Eh(t,e,r){let n=H(r.round)?!0:r.round,i=(s,a)=>(s=xn(s,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(s,a)),o=s=>r.calendary?e.hasSame(t,s)?0:e.startOf(s).diff(t.startOf(s),s).get(s):e.diff(t,s).get(s);if(r.unit)return i(o(r.unit),r.unit);for(let s of r.units){let a=o(s);if(Math.abs(a)>=1)return i(a,s)}return i(t>e?-0:0,r.units[r.units.length-1])}function Sh(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var te=class t{constructor(e){let r=e.zone||ne.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Fe("invalid input"):null)||(r.isValid?null:na(r));this.ts=H(e.ts)?ne.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[i,o]=[e.old.c,e.old.o];else{let a=r.offset(this.ts);i=ia(this.ts,a),n=Number.isNaN(i.year)?new Fe("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=r,this.loc=e.loc||se.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=Sh(arguments),[n,i,o,s,a,c,l]=r;return wh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static utc(){let[e,r]=Sh(arguments),[n,i,o,s,a,c,l]=r;return e.zone=Ie.utcInstance,wh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=Rm(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=At(r.zone,ne.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:se.fromObject(r)}):t.invalid(na(i))}static fromMillis(e,r={}){if(kt(e))return e<-xh||e>xh?t.invalid("Timestamp out of range"):new t({ts:e,zone:At(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Ee(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(kt(e))return new t({ts:e*1e3,zone:At(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Ee("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=At(r.zone,ne.defaultZone);if(!n.isValid)return t.invalid(na(n));let i=se.fromObject(r),o=bn(e,bh),{minDaysInFirstWeek:s,startOfWeek:a}=Ic(o,i),c=ne.now(),l=H(r.specificOffset)?n.offset(c):r.specificOffset,u=!H(o.ordinal),f=!H(o.year),d=!H(o.month)||!H(o.day),m=f||d,h=o.weekYear||o.weekNumber;if((m||u)&&h)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new St("Can't mix ordinal dates with month/day");let x=h||o.weekday&&!m,y,p,g=ia(c,l);x?(y=L2,p=j2,g=Ni(g,s,a)):u?(y=z2,p=U2,g=ta(g)):(y=Ah,p=Ch);let b=!1;for(let L of y){let T=o[L];H(T)?b?o[L]=p[L]:o[L]=g[L]:b=!0}let w=x?_m(o,s,a):u?Mm(o):Fc(o),E=w||Oc(o);if(E)return t.invalid(E);let S=x?Bc(o,s,a):u?Dc(o):o,[O,I]=sa(S,l,n),N=new t({ts:O,zone:n,o:I,loc:i});return o.weekday&&m&&e.weekday!==N.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${N.toISO()}`):N}static fromISO(e,r={}){let[n,i]=Ym(e);return Wi(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=Xm(e);return Wi(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=Qm(e);return Wi(n,i,r,"HTTP",r)}static fromFormat(e,r,n={}){if(H(e)||H(r))throw new Ee("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,c,l,u]=ph(s,e,r);return u?t.invalid(u):Wi(a,c,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,i]=rh(e);return Wi(n,i,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Ee("need to specify a reason the DateTime is invalid");let n=e instanceof Fe?e:new Fe(e,r);if(ne.throwOnInvalid)throw new Hs(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=$c(e,se.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return Wc(Oe.parseFormat(e),se.fromObject(r)).map(i=>i.val).join("")}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?Vc(this).weekYear:NaN}get weekNumber(){return this.isValid?Vc(this).weekNumber:NaN}get weekday(){return this.isValid?Vc(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Gc(this).weekday:NaN}get localWeekNumber(){return this.isValid?Gc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Gc(this).weekYear:NaN}get ordinal(){return this.isValid?ta(this.c).ordinal:NaN}get monthShort(){return this.isValid?Vt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Vt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Vt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Vt.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,r=6e4,n=pn(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*r),a=this.zone.offset(n-o*r);if(s===a)return[this];let c=n-s*r,l=n-a*r,u=ia(c,s),f=ia(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Nr(this,{ts:c}),Nr(this,{ts:l})]:[this]}get isInLeapYear(){return _r(this.year)}get daysInMonth(){return yn(this.year,this.month)}get daysInYear(){return this.isValid?mr(this.year):NaN}get weeksInWeekYear(){return this.isValid?kr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?kr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:i}=Oe.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(e=0,r={}){return this.setZone(Ie.instance(e),r)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=At(e,ne.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(r||n){let o=e.offset(this.ts),s=this.toObject();[i]=sa(s,o,e)}return Nr(this,{ts:i,zone:e})}else return t.invalid(na(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return Nr(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=bn(e,bh),{minDaysInFirstWeek:n,startOfWeek:i}=Ic(r,this.loc),o=!H(r.weekYear)||!H(r.weekNumber)||!H(r.weekday),s=!H(r.ordinal),a=!H(r.year),c=!H(r.month)||!H(r.day),l=a||c,u=r.weekYear||r.weekNumber;if((l||s)&&u)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new St("Can't mix ordinal dates with month/day");let f;o?f=Bc({...Ni(this.c,n,i),...r},n,i):H(r.ordinal)?(f={...this.toObject(),...r},H(r.day)&&(f.day=Math.min(yn(f.year,f.month),f.day))):f=Dc({...ta(this.c),...r});let[d,m]=sa(f,this.o,this.zone);return Nr(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e);return Nr(this,gh(this,r))}minus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e).negate();return Nr(this,gh(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=ue.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(i==="weeks")if(r){let o=this.loc.getStartOfWeek(),{weekday:s}=this;s<o&&(n.weekNumber=this.weekNumber-1),n.weekday=o}else n.weekday=1;if(i==="quarters"){let o=Math.ceil(this.month/3);n.month=(o-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?Oe.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):qc}toLocaleString(e=lr,r={}){return this.isValid?Oe.create(this.loc.clone(r),e).formatDateTime(this):qc}toLocaleParts(e={}){return this.isValid?Oe.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;let s=e==="extended",a=Zc(this,s);return a+="T",a+=yh(this,s,r,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?Zc(this,e==="extended"):null}toISOWeekDate(){return oa(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(i?"T":"")+yh(this,s==="extended",r,e,n,o):null}toRFC2822(){return oa(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return oa(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Zc(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||e)&&(n&&(i+=" "),r?i+="z":e&&(i+="ZZ")),oa(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():qc}[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 r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return ue.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=Pm(r).map(ue.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,l=ch(a,c,o,i);return s?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?qt.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let i=e.valueOf(),o=this.setZone(e.zone,{keepLocalTime:!0});return o.startOf(r,n)<=i&&i<=o.endOf(r,n)}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 r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],o=e.unit;return Array.isArray(e.unit)&&(i=e.unit,o=void 0),Eh(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?Eh(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Ee("min requires all arguments be DateTimes");return kc(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ee("max requires all arguments be DateTimes");return kc(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return Hc(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return lr}static get DATE_MED(){return hi}static get DATE_MED_WITH_WEEKDAY(){return fc}static get DATE_FULL(){return pi}static get DATE_HUGE(){return xi}static get TIME_SIMPLE(){return gi}static get TIME_WITH_SECONDS(){return yi}static get TIME_WITH_SHORT_OFFSET(){return bi}static get TIME_WITH_LONG_OFFSET(){return wi}static get TIME_24_SIMPLE(){return Ei}static get TIME_24_WITH_SECONDS(){return Si}static get TIME_24_WITH_SHORT_OFFSET(){return vi}static get TIME_24_WITH_LONG_OFFSET(){return Ci}static get DATETIME_SHORT(){return Ai}static get DATETIME_SHORT_WITH_SECONDS(){return Ti}static get DATETIME_MED(){return Bi}static get DATETIME_MED_WITH_SECONDS(){return Di}static get DATETIME_MED_WITH_WEEKDAY(){return dc}static get DATETIME_FULL(){return Ii}static get DATETIME_FULL_WITH_SECONDS(){return Fi}static get DATETIME_HUGE(){return Oi}static get DATETIME_HUGE_WITH_SECONDS(){return ki}};function Bn(t){if(te.isDateTime(t))return t;if(t&&t.valueOf&&kt(t.valueOf()))return te.fromJSDate(t);if(t&&typeof t=="object")return te.fromObject(t);throw new Ee(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var Kc=50n,aa=10000n,Th=25n,Jc=100000000n;var _t=class{constructor(e){this.object=e}moveArg(e){return e.object(this.object)}},Hi=class{constructor(e){this.objects=e}moveArgs(e){return e.makeMoveVec({objects:this.objects.map(r=>e.object(r))})}},gr=class t{constructor(e){this.result=e;return new Proxy(this,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(r,n){if(n in r)return Reflect.get(r,n);let i=s=>new t(r.result[s]);if(n===Symbol.iterator)return function*(){let s=0;for(;;)yield i(s),s++};if(typeof n=="symbol")return;let o=parseInt(n,10);if(!(Number.isNaN(o)||o<0))return i(o)}})}moveArg(){return this.result}};var $i=class extends he{constructor(e,r){super(3,e,{context:r})}};var ca=class{constructor(e){this.results=e}callResult(e){return this.results.results[e]}returnValue(e,r){return e.returnValues[r]}getValue(e=0,r=0){let n=this.callResult(e);return this.returnValue(n,r)}getAddress(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="address")throw new $i("Invalid contract return type.",{ctx:{expectType:"address",gotType:i}});return $(Buffer.from(n).toString("hex"))}getU64(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="u64")throw new $i("Invalid contract return type.",{ctx:{expectType:"u64",gotType:i}});return Buffer.from(n).readBigInt64LE()}};var Se=class extends he{constructor(e,r,n){super(2,`Invalid input: ${e}`,{context:{fieldKey:r,fieldValue:n}})}};var Dh={groupId:"string",name:"string"},H2=64;function Ih(t){return Fh(t),ae.ser(Dh,t).toString("base64")}function qi(t){let e=ae.de(Dh,t,"base64");return Fh(e),e}function Fh(t){if(!Bh(t.name))throw new Se("Invalid metadata: Name contains unknown character");if(!Bh(t.groupId))throw new Se("Invalid metadata: Group ID contains unknown character");if(t.name.length>H2)throw new Se("Invalid metadata: Name exceed max length 64")}function Bh(t){return/^[\x00-\x7F]+$/.test(t)}function Oh(t,e){return oe(t)===oe(e)}function yr(t,e){return oe(t)===oe(e)}var kh="txn.gas";function _h(){return"nanoid()"}var Rr=class t{constructor(e,r,n){this.globals=e;this.feeContract=r;this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:Ih({name:e.name,groupId:_h()}),coinType:oe(e.coinType),recipients:e.recipients.map(r=>({address:r.address,cliffAmount:r.cliffAmount,amountPerEpoch:r.amountPerStep})),epochInterval:e.interval,numberEpoch:e.steps,startTime:e.startTimeMs,cancelable:e.cancelable}}async buildCreateStreamTransactionBlock(e){let r=new be,n=this.calculateFeesInternal(e),i=this.getCreateStreamCoinRequests(e,n),o=await this.wallet.requestCoins(i),s=await this.addMergeCoins(r,o[0]),a;i.length>1?a=await this.addMergeCoins(r,o[1]):a=s;for(let c=0;c<e.recipients.length;c++){let l=e.recipients[c],u=this.amountForRecipient(l,e.numberEpoch),f=this.getStreamFeeLocal(u),[d]=r.splitCoins(s,[r.pure(u+f,"u64")]),[m]=r.splitCoins(a,[r.pure(this.flatSuiFee,"u64")]);this.streamContract.createStream(r,{paymentCoin:new gr(d),flatFeeCoin:new gr(m),metadata:e.metadata,recipient:l.address,timeStart:e.startTime,cliff:l.cliffAmount,epochInterval:e.epochInterval,numEpoch:e.numberEpoch,amountPerEpoch:l.amountPerEpoch,cancelable:e.cancelable,coinType:e.coinType})}return r}calculateCreateStreamFees(e){let r=t.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(r)}feeParams(){return{createFeePercent:{numerator:Kc,denominator:aa},claimFeePercent:{numerator:Th,denominator:aa},flatFeePerStream:Jc}}async addMergeCoins(e,r){let n;return r.mergedCoins&&r.mergedCoins.length?(e.mergeCoins(e.object(r.primaryCoin),r.mergedCoins.map(i=>e.object(i))),n=e.object(r.primaryCoin)):r.primaryCoin===kh?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return Oh(n,Bt)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:Bt,amount:r.flatFeeAmount}]}calculateFeesInternal(e){let r=e.recipients.reduce((i,o)=>{let s=this.amountForRecipient(o,e.numberEpoch),a=this.getStreamFeeLocal(s);return{totalAmount:i.totalAmount+s,streamFeeAmount:i.streamFeeAmount+a}},{totalAmount:0n,streamFeeAmount:0n});return{flatFeeAmount:BigInt(e.recipients.length)*this.flatSuiFee,...r}}amountForRecipient(e,r){return e.amountPerEpoch*r+e.cliffAmount}get flatSuiFee(){return Jc}getStreamFeeLocal(e){return e*Kc/aa}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new be,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new ca(n).getU64()}get wallet(){return this.globals.wallet}};var Mh="0x0000000000000000000000000000000000000000000000000000000000000006";var Dn=class{constructor(e,r,n){this.moduleName=e;this.config=r;this.globals=n}addContractCall(e,r){let n=`${this.config.contractId}::${this.moduleName}::${r.method}`;return e.add(st.MoveCall({target:n,arguments:r.arguments.map(i=>i instanceof Hi?i.moveArgs(e):i instanceof _t?i.moveArg(e):i instanceof gr?i.moveArg():e.pure(i)),typeArguments:r.typeArgs})),e}addTransactionBlock(e,r,n=[],i=[]){e.add(st.MoveCall({target:r,arguments:n.map(o=>o instanceof Hi?o.moveArgs(e):o instanceof _t?o.moveArg(e):o instanceof gr?o.moveArg():e.pure(o)),typeArguments:i}))}makeObject(e){return typeof e=="string"?new _t(e):e}vaultObject(){return new _t(this.config.vaultObjId)}roleObject(){return new _t(this.config.roleObjId)}feeObject(){return new _t(this.config.feeObjId)}clockObject(){return new _t(Mh)}};var In=class t extends Dn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="fee_module";static MethodName={set_streaming_fee:"set_streaming_fee",set_claim_fee:"set_claim_fee",set_streaming_flat_fee:"set_streaming_flat_fee",streaming_flat_fee:"streaming_flat_fee",streaming_fee:"streaming_fee",claim_fee:"claim_fee",fee_denominator:"fee_denominator"};setStreamingFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_fee,arguments:[i,o,n],typeArgs:[]})}setStreamingFlatFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_flat_fee,arguments:[i,o,n],typeArgs:[]})}setClaimFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_claim_fee,arguments:[i,o,n],typeArgs:[]})}streamingFee(r,n){let i=this.feeObject();return this.addContractCall(r,{method:t.MethodName.streaming_fee,arguments:[i,n],typeArgs:[]})}claimFee(r,n){return this.addContractCall(r,{method:t.MethodName.claim_fee,arguments:[this.feeObject(),n],typeArgs:[]})}feeDenominator(r){return this.addContractCall(r,{method:t.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}};var Mt=class t extends Dn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="stream";static MethodName={create_stream:"create_stream",set_auto_claim:"set_auto_claim",cancel_stream:"cancel_stream",claim_stream:"claim_stream",claim_stream_by_proxy:"claim_stream_by_proxy",stream_current_epoch:"stream_current_epoch",now_milli_seconds:"now_milli_seconds"};createStream(r,n){let i=this.feeObject(),o=this.vaultObject(),s=this.makeObject(n.paymentCoin),a=this.makeObject(n.flatFeeCoin),c=this.clockObject();return this.addContractCall(r,{method:t.MethodName.create_stream,arguments:[i,o,s,a,n.metadata,n.recipient,n.timeStart,n.cliff,n.epochInterval,n.numEpoch,n.amountPerEpoch,n.cancelable,c],typeArgs:[n.coinType]})}setAutoClaim(r,n){let i=this.makeObject(n.streamId);return this.addContractCall(r,{method:t.MethodName.set_auto_claim,arguments:[i,n.enabled],typeArgs:[n.coinType]})}cancelStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.cancel_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStreamByProxy(r,n){let i=this.makeObject(n.streamId),o=this.vaultObject(),s=this.feeObject(),a=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream_by_proxy,arguments:[i,o,s,a],typeArgs:[n.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream_by_proxy}`}};var Fn=class{constructor(e){this.globals=e;let r=e.envConfig.contract;this.feeContract=new In(r,e),this.streamContract=new Mt(r,e)}feeContract;streamContract;async createStreams(e){let r=Rr.convertCreateStreamInfoToInternal(e);return this.createStreamHelper().buildCreateStreamTransactionBlock(r)}createStreamHelper(){return new Rr(this.globals,this.feeContract,this.streamContract)}setAutoClaim(e,r,n){let i=new be;return this.streamContract.setAutoClaim(i,{streamId:e,enabled:r,coinType:n})}claimStream(e,r){let n=new be;return this.streamContract.claimStream(n,{streamId:e,coinType:r})}claimStreamByProxy(e,r){let n=new be;return this.streamContract.claimStreamByProxy(n,{streamId:e,coinType:r})}cancelStream(e,r){let n=new be;return this.streamContract.cancelStream(n,{streamId:e,coinType:r}),n}};var ua=class extends he{constructor(e,r){super(12,`Transaction failed: ${r}`,{context:{status:e,msg:r}})}};var $2=1e3,la=class{constructor(e){this.globals=e;this.coinMetaHelper=new Yc(e.suiClient),this.createStreamHelper=new Fn(e).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(e){if(e.effects?.status.status!=="success")throw new ua(e.effects?.status.status,e.effects?.status.error);return e.objectChanges.filter(r=>r.type==="created"&&r.objectType.startsWith(`${this.globals.envConfig.contract.contractId}::stream::Stream`)).map(r=>r.objectId)}calculateCreateStreamFees(e){return this.createStreamHelper.calculateCreateStreamFees(e)}feeParams(){return this.createStreamHelper.feeParams()}calculateStreamAmount(e){if(e.steps===0n)throw new Se("Invalid stream steps: 0");let r=e.cliff?e.cliff:{numerator:0n,denominator:100n},n=e.totalAmount*r.numerator/r.denominator,i=(e.totalAmount-n)/e.steps,s={realTotalAmount:i*e.steps+n,cliffAmount:n,amountPerStep:i};return this.validateStreamAmount(s,e.totalAmount),s}calculateTimelineByInterval(e){if(e.steps===0n)throw new Se("Invalid stream steps: 0");let r=e.timeStart.plus(e.interval.toMillis()*Number(e.steps)),n={timeStart:e.timeStart,timeEnd:r,interval:e.interval,steps:e.steps};return this.validateTimeline(n),n}calculateTimelineByTotalDuration(e){if(e.steps===0n)throw new Se("Invalid stream steps: 0");let r=BigInt(e.total.toMillis())/e.steps,n=e.timeStart.plus(ue.fromMillis(Number(r*e.steps))),i={timeStart:e.timeStart,timeEnd:n,interval:ue.fromMillis(Number(r)),steps:e.steps};return this.validateTimeline(i),i}async getBalance(e,r){let n=await this.globals.suiClient.getBalance({owner:e,coinType:r}),i=await this.getCoinMeta(r);return{...n,coinType:oe(n.coinType),coinMeta:i}}async getAllBalance(e){let r=await this.globals.suiClient.getAllBalances({owner:e}),n=await Promise.all(r.map(i=>this.getCoinMeta(i.coinType)));return r.map((i,o)=>({...i,coinType:oe(i.coinType),coinMeta:n[o]}))}async getCoinMeta(e){return this.coinMetaHelper.getCoinMeta(e)}async simulateTransactionBlock(e){return this.globals.suiClient.devInspectTransactionBlock({transactionBlock:e,sender:await this.globals.wallet.address()})}validateStreamAmount(e,r){if(e.amountPerStep===0n)throw new Se("Stream amount too small","totalAmount",r);if(e.cliffAmount>e.realTotalAmount)throw new Se("Invalid cliff settings")}validateTimeline(e){if(e.interval.toMillis()<$2)throw new Se("Interval shall be at least 1 second","interval",e.interval)}},Yc=class{constructor(e){this.suiClient=e;this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(e){let r=oe(e||Bt);if(this.coinMetaReg.has(r))return this.coinMetaReg.get(r);let n=await this.queryCoinMeta(r);return n&&this.coinMetaReg.set(r,n),n}async queryCoinMeta(e){return await this.suiClient.getCoinMetadata({coinType:e})||void 0}};var fa=class extends he{constructor(){super(7,"Connected wallet is not creator")}};var Vi=class extends he{constructor(){super(8,"Connected wallet is not recipient")}};var Gi=class extends he{constructor(e,r){super(6,e,{context:r})}};var ze=class extends he{constructor(e,r={}){super(0,e,r)}};var da=class extends he{constructor(e){super(5,"Stream not found",{context:{streamId:e}})}};var Nh=(1n<<64n)-1n,ma=1e3;function Xc(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ma);return te.fromMillis(r*ma)}function Qc(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ma);return ue.fromMillis(r*ma)}var br=class t{constructor(e,r,n){this.globals=e;this.streamId=r;this.rawData=n;this.streamContract=new Mt(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,r){let n=await t.fetchStreamData(e,r);return new t(e,r,n)}static fromObjectData(e,r,n){let i=t.parseRawStreamData(r,n);return new t(e,r,i)}get info(){return{name:this.name,creator:this.creator,coinType:this.coinType,totalAmount:this.totalAmount,start:this.timeStart,end:this.timeEnd,cancelable:this.cancelable,cliffAmount:this.cliff,duration:this.duration,interval:this.interval,steps:this.totalSteps,nextReleaseDate:this.nextReleaseDate,nextReleaseAmount:this.nextReleaseAmount,groupId:this.groupId,streamId:this.streamId,recipient:this.recipient,progress:this.progress,autoClaim:this.autoClaim}}get groupCommonInfo(){return{name:this.name,groupId:this.groupId,creator:this.creator,start:this.timeStart,interval:this.interval,steps:this.totalSteps,cancelable:this.cancelable}}async refresh(){this.rawData=await t.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new ze("Object Id does not align");this.rawData=t.parseRawStreamData(this.streamId,e)}async historyEvents(e){return this.globals.backend.getStreamHistory({streamId:this.streamId,pagination:e})}async cancel(){if(await this.globals.walletAddress()!==this.creator)throw new fa;let e=new be;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Vi;let e=new be;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Vi;let r=new be;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new be;return this.streamContract.claimStreamByProxy(e,{streamId:this.streamId,coinType:this.coinType}),e}get wallet(){return this.globals.wallet}get client(){return this.globals.suiClient}get coinType(){return oe(this.rawData.coinType)}get progress(){return{status:this.streamStatus,total:this.totalAmount,streamed:this.streamedAmount,claimed:this.claimedAmount,claimable:this.claimable,canceled:this.canceledAmount}}get balance(){return this.rawData.balance}get autoClaim(){return this.rawData.autoClaim}get amountPerEpoch(){return this.rawData.config.amountPerEpoch}get cancelable(){return this.rawData.config.cancelable}get cliff(){return this.rawData.config.cliff}get creator(){return this.rawData.config.creator}get interval(){return Qc(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return qi(e).groupId}get name(){let{metadata:e}=this.rawData.config;return qi(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return Xc(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return Qc(r)}get timeEnd(){return this.timeStart.plus(this.duration)}get totalSteps(){return this.rawData.config.totalEpoch}get claimable(){return this.streamedAmount-this.claimedAmount}get nextReleaseDate(){return this.currentEpoch===-1n?this.timeStart:this.currentEpoch>=this.totalSteps||this.isCanceled?null:Xc((this.currentEpoch+1n)*this.rawData.config.epochInterval+this.rawData.config.timeStart)}get nextReleaseAmount(){return this.currentEpoch===-1n?this.cliff:this.currentEpoch>=this.totalSteps||this.isCanceled?null:this.amountPerEpoch}get streamStatus(){let e=this.rawData.status.status;return e===16?"CANCELED":e===17?"SETTLED":e===1?"COMPLETED":this.currentEpoch>=this.totalSteps?"STREAMED":"STREAMING"}get streamedAmount(){return this.currentEpoch===-1n?0n:this.isCanceled?this.rawData.status.epochCanceled*this.amountPerEpoch+this.cliff:this.currentEpoch*this.amountPerEpoch+this.cliff}get claimedAmount(){return this.rawData.status.epochClaimed===Nh?0n:this.rawData.status.epochClaimed*this.amountPerEpoch+this.cliff}get currentEpoch(){let e=te.now().toMillis(),r=this.timeStart.toMillis();if(e<r)return-1n;let n=Math.floor((e-r)/Number(this.rawData.config.epochInterval));return BigInt(n)>Number(this.rawData.config.totalEpoch)?this.rawData.config.totalEpoch:BigInt(n)}get totalAmount(){let e=this.rawData.config;return e.amountPerEpoch*e.totalEpoch+e.cliff}get isCanceled(){let e=this.rawData.status.status;return e===16||e===17}get canceledAmount(){return this.isCanceled?this.totalAmount-this.streamedAmount:0n}static async fetchStreamData(e,r){let n=await e.suiClient.getObject({id:r,options:{showContent:!0,showType:!0}});return t.parseRawStreamData(r,n)}static parseRawStreamData(e,r){if(r.error)throw r.error.code==="notExists"?new da(e):new Gi(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new Gi("Unexpected object type",{gotType:n.dataType});let{typeParams:i}=Hn(n.type),o=oe(i[0]),s=n.fields,a=s.config.fields,c=s.status.fields;return{coinType:o,autoClaim:s.auto_claim,balance:BigInt(s.balance.fields.balance),config:{amountPerEpoch:BigInt(a.amount_per_epoch),cancelable:a.cancelable,cliff:BigInt(a.cliff),creator:a.creator,epochInterval:BigInt(a.epoch_interval),metadata:a.metadata,recipient:a.recipient,timeStart:BigInt(a.time_start),totalEpoch:BigInt(a.total_epoch)},status:{status:c.status,epochCanceled:BigInt(c.epoch_canceled),epochClaimed:BigInt(c.epoch_claimed)}}}};var On=class extends he{constructor(e,r){super(9,`Invalid stream group: ${e}`,{context:r})}};async function Rh(t){let e=[];for(;await t.hasNext();){let r=await t.next();e.push(r)}return e&&Array.isArray(e[0])?e.flat(1):e}var eu=class{constructor(e){this.requester=e;this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},ha=class{constructor(e){this.requester=e;this.pager=new eu(e),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}};var q2=25;async function ru(t,e,r){let n=new Zi(e),i=new Ki(t,n,r);return await Rh(i)}var Zi=class{constructor(e){this.ids=e;this.cursor=-1}cursor;async hasNext(){return this.cursor<this.ids.length-1}async next(){if(this.cursor+=1,this.cursor>=this.ids.length)throw new Error("invalid iterator implementation");return this.ids[this.cursor]}},Ki=class extends ha{constructor(r,n,i){super(new tu(r,n,i));this.suiClient=r;this.idIter=n;this.options=i}},tu=class{constructor(e,r,n){this.suiClient=e;this.stringIter=r;this.options=n;this.filter=n?.filter,this.pageSize=n?.pageSize||q2,this.objectOptions=n?.objectOptions||{showType:!0,showContent:!0}}filter;pageSize;objectOptions;async doNextRequest(){let e=[];for(;e.length<this.pageSize&&await this.stringIter.hasNext();){let o=await this.stringIter.next();o&&e.push(o)}let r=await this.suiClient.multiGetObjects({ids:e,options:this.objectOptions}),n;if(this.filter){let{filter:i}=this;n=r.filter(o=>i?.(o))}else n=r;return{data:n,hasNext:await this.stringIter.hasNext()}}};var pa=class t{constructor(e,r){this.globals=e;this.streams=r;if(r.length===0)throw new On("stream size 0");let n=r.map(o=>o.groupId);if(new Set(n).size!==1)throw new Se("Stream does not have same group ID")}type="StreamGroup";static async new(e,r){let n=await ru(e.suiClient,r);return n.forEach(i=>{if(!i)throw new ze("stream group object data undefined")}),t.newFromObjectResponse(e,r,n)}static async newFromObjectResponse(e,r,n){let i=await t.parseGroupStreams(e,r,n);return new t(e,i)}static checkStreamGroup(e){let r=e.map(o=>o.groupCommonInfo),n=r[0],i=!0;return r.forEach(o=>{V2(n,o)||(i=!1)}),i}async refresh(){let e=await ru(this.globals.suiClient,this.streams.map(r=>r.streamId));this.streams.forEach((r,n)=>{r.refreshWithData(e[n])})}get groupId(){return this.streams[0].groupId}get creator(){return this.streams[0].creator}get info(){return{groupId:this.groupId,streamIds:this.streams.map(e=>e.streamId),progress:this.progress,name:this.streams[0].name,creator:this.creator,coinType:this.streams[0].coinType,totalAmount:this.streams.reduce((e,r)=>e+r.totalAmount,0n),start:this.streams[0].timeStart,end:this.streams[0].timeEnd,cancelable:this.streams[0].cancelable,cliffAmount:this.streams.reduce((e,r)=>e+r.cliff,0n),duration:this.streams[0].duration,interval:this.streams[0].interval,steps:this.streams[0].totalSteps,nextReleaseAmount:this.streams.reduce((e,r)=>r.nextReleaseAmount===null?e:e+r.nextReleaseAmount,0n),nextReleaseDate:this.streams[0].nextReleaseDate}}get progress(){return{total:this.streams.reduce((e,r)=>e+r.totalAmount,0n),streamed:this.streams.reduce((e,r)=>e+r.streamedAmount,0n),claimed:this.streams.reduce((e,r)=>e+r.claimedAmount,0n),claimable:this.streams.reduce((e,r)=>e+r.claimable,0n),canceled:this.streams.reduce((e,r)=>e+r.canceledAmount,0n)}}async historyEvents(e){return this.globals.backend.getStreamHistory({groupId:this.groupId,pagination:e})}static async parseGroupStreams(e,r,n){let i=n.map((o,s)=>br.fromObjectData(e,r[s],o)).filter(o=>!!o);if(new Set(i.map(o=>o.groupId)).size!==1)throw new On("Not same group ID");if(!this.checkStreamGroup(i))throw new On("Not same stream settings");return i}};function V2(t,e){return t.name===e.name&&t.groupId===e.groupId&&t.creator===e.creator&&t.start.toMillis()===e.start.toMillis()&&t.interval.toMillis()===e.interval.toMillis()&&t.steps===e.steps&&t.cancelable===e.cancelable}var Ji=class t{constructor(e,r){this.it=e;this.pageSize=r}static async newIncoming(e){let r=await xa.newIncoming(e);return new t(r,e.pageSize)}static async newOutgoing(e){let r=await xa.newOutgoing(e);return new t(r,e.pageSize)}async hasNext(){return this.it.hasNext()}async next(){let e=[];for(;e.length<this.pageSize&&await this.it.hasNext();)e.push(await this.it.next());return e}},xa=class t{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await ga.newIncomingQuery(e);return new t(r)}static async newOutgoing(e){let r=await ga.newOutgoingQuery(e);return new t(r)}async hasNext(){return this.cachedNext===void 0&&(this.cachedNext=await this.requester.doNextRequest()),this.cachedNext!==null}async next(){if(this.cachedNext===void 0){let r=await this.requester.doNextRequest();if(r===null)throw new ze("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new ze("No more results");return e}},ga=class t{constructor(e,r,n,i){this.globals=e;this.recipient=r;this.groupRefs=n;this.query=i;this.current=0;let o=new Zi(n.flat().map(s=>s.streamId));this.objectIter=new Ki(e.suiClient,o)}current=0;objectIter;static async newIncomingQuery(e){let r=Y2(e.query),n=await e.globals.walletAddress(),o=(await e.globals.backend.getIncomingStreams(n,r)).filter(a=>$(a.recipient)===$(n)),s=Ph(o);return new t(e.globals,n,s,e.query)}static async newOutgoingQuery(e){let r=X2(e.query),n=await e.globals.walletAddress(),i=await e.globals.backend.getOutgoingStreams(n,r),o=Ph(i);return new t(e.globals,n,o,e.query)}async doNextRequest(){if(this.current>=this.groupRefs.length)return null;let e=this.groupRefs[this.current];if(e.length===1){let r=await K2(this.globals,e[0].streamId,this.objectIter);return this.current++,jh(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await J2(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,Z2(r,this.query)?r:this.doNextRequest()}throw new ze("Stream group with no stream")}};function Ph(t){let e=new Map;return t.forEach(r=>{let n=e.get(r.groupId);n?(n.push(r),e.set(r.groupId,n)):e.set(r.groupId,[r])}),Array.from(e.values()).sort((r,n)=>te.fromISO(n[0].createDate).toMillis()-te.fromISO(r[0].createDate).toMillis())}function jh(t,e){if(e===void 0)return!0;let r=G2(t,e.status);if(e&&"claimable"in e&&e.claimable!==void 0){let n=e.claimable?t.progress.claimable!==0n:t.progress.claimable===0n;return r&&n}return r}function G2(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function Z2(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{jh(n,e)&&(r=!0)}),r}async function K2(t,e,r){let n=await Uh(r,e);return br.fromObjectData(t,e,n)}async function J2(t,e,r){let n=[];for(;n.length<e.length;){let i=await Uh(r,e[n.length]);n.push(i)}return pa.newFromObjectResponse(t,e,n)}async function Uh(t,e){if(!await t.hasNext())throw new ze("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new ze("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new ze("stream id not aligned");return r}function Y2(t){return{status:nu(t?.status),coinType:Lh(t?.coinType),sender:zh(t?.sender)}}function X2(t){return{status:nu(t?.status),coinType:Lh(t?.coinType),recipient:zh(t?.recipient)}}function nu(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=nu(r);return!e||e===n?n:"all"},void 0):Q2(t)}function Q2(t){switch(t){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new Se("Unknown stream filtered status")}}function Lh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>oe(e)):void 0:oe(t)}function zh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>$(e)):void 0:$(t)}var iu=class{constructor(e){this.msafe=e}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(e){return this.msafe.requestCoins(e)}},ya=class{globals;helper;constructor(e,r){this.globals=mn.new(e,r),this.helper=new la(this.globals)}connectMSafeAccount(e){let r=new iu(e);this.globals.connectWallet(r)}async createStream(e){return this.builder().createStreams(e)}async getStream(e){return br.new(this.globals,e)}async getIncomingStreams(e,r=10){return Ji.newIncoming({globals:this.globals,query:e,pageSize:r})}async getOutgoingStreams(e,r=10){return Ji.newOutgoing({globals:this.globals,query:e,pageSize:r})}async getCoinTypesForStreamFilter(){let e=await this.wallet.address();return(await this.globals.backend.getAllCoinTypes(e)).map(n=>oe(n))}async getRecipientsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllRecipients(r,e)).map(i=>$(i))}async getCreatorsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllSenders(r,e)).map(i=>$(i))}get wallet(){return this.globals.wallet}builder(){return new Fn(this.globals)}};var ba=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n}=r;return await new ya(n==="sui:mainnet"?"prod":"dev").createStream(this.data)}static fromData(r){return new t(r)}};var Gt=class t{constructor(e,r){this.moveCall=e;this.txb=r}decodeSharedObjectId(e){let r=this.getInputParam(e);return t.getSharedObjectId(r)}decodeOwnedObjectId(e){let r=this.getInputParam(e);return t.getOwnedObjectId(r)}decodeInputU64(e){let r=this.decodePureArg(e,"u64");return BigInt(r)}decodeInputAddress(e){let r=this.decodePureArg(e,"address");return $(r)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,r){let n=this.getInputParam(e);return t.getPureInputValue(n,r)}getInputParam(e){let r=this.moveCall.arguments[e];if(r.kind!=="Input")throw new Error("not input type");return this.txb.blockData.inputs[r.index]}static getPureInputValue(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value=="object"&&"Pure"in e.value){let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}return e.value}static getOwnedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value=="object"){if(!("Object"in e.value)||!("ImmOrOwned"in e.value.Object))throw new Error("not ImmOrOwned");return $(e.value.Object.ImmOrOwned.objectId)}return $(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return $(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return $(e.value.Object.Shared.objectId)}static getPureInput(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value!="object")return e.value;if(!("Pure"in e.value))throw new Error("Pure not in value");let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}typeArg(e){return oe(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}};var wa=class{constructor(e,r){this.globals=e;this.txb=r}decode(){let e=this.decodeCreateStreamInfo(),r=this.createStreamHelper().calculateCreateStreamFees(e),n=this.getCoinMerges();return{type:"CreateStream",info:e,fees:r,coinMerges:n}}decodeCreateStreamInfo(){let r=this.createStreamTransactions().map(n=>this.getCreationInfoFromMoveCall(n));return this.aggregateGroupStreamInfo(r)}createStreamTransactions(){let e=this.transactions.filter(r=>r.kind==="MoveCall"&&yr(r.target,this.contract.createStreamTarget));if(e.length===0)throw new ze("No create stream transactions");return e.map(r=>new Gt(r,this.txb))}getCreationInfoFromMoveCall(e){let r=e.decodeInputString(4),{name:n,groupId:i}=qi(r),o=e.decodeInputAddress(5),s=e.decodeInputU64(6),a=e.decodeInputU64(7),c=e.decodeInputU64(8),l=e.decodeInputU64(9),u=e.decodeInputU64(10),f=e.decodeInputBool(11),d=e.typeArg(0);return{name:n,groupId:i,recipient:o,timeStart:s,cliff:a,epochInterval:c,totalEpoch:l,amountPerEpoch:u,cancelable:f,coinType:d}}aggregateGroupStreamInfo(e){if(new Set(e.map(i=>JSON.stringify({name:i.name,groupId:i.groupId,timeStart:String(i.timeStart),epochInterval:String(i.epochInterval),totalEpoch:String(i.totalEpoch),cancelable:i.cancelable,coinType:i.coinType}))).size!==1)throw new Se("Stream group not have common info");let n=e.map(i=>({address:i.recipient,amountPerStep:i.amountPerEpoch,cliffAmount:i.cliff}));return{name:e[0].name,coinType:e[0].coinType,recipients:n,interval:e[0].epochInterval,steps:e[0].totalEpoch,startTimeMs:e[0].timeStart,cancelable:e[0].cancelable}}getCoinMerges(){let e=this.createStreamTransactions()[0];return this.getCoinMergeForCreateStream(e)}getCoinMergeForCreateStream(e){let r=e.typeArg(0),n=e.txArg(2),i=this.getCoinMergeFromNestedResult(n,r,e);if(r===oe(Bt))return[i];let o=e.txArg(3),s=this.getCoinMergeFromNestedResult(o,oe(Bt),e);return[i,s]}getCoinMergeFromNestedResult(e,r,n){if(e.kind==="GasCoin")return{primary:"GAS",coinType:r};if(e.kind==="Input"){let i=this.getInputArg(e),o=Gt.getOwnedObjectId(i),s=this.transactions.find(a=>{if(a.kind!=="MergeCoins")return!1;if(a.destination.kind!=="Input")throw new Error("merge coin destination not Input type");let c=this.getInputArg(a.destination);return Gt.getOwnedObjectId(c)===o});return s?{primary:o,merged:s.sources.map(a=>{let c=this.getInputArg(a);return Gt.getOwnedObjectId(c)}),coinType:r}:{primary:o,coinType:r}}if(e.kind==="NestedResult"){let i=this.transactions[e.index];if(i.kind!=="SplitCoins")throw new Se(`Transaction type not expected. Expect SplitCoins, got ${i.kind}`);return this.getCoinMergeFromNestedResult(i.coin,r,n)}throw e.kind==="Result"?new Error("Result type not expected for coin inputs"):new Error("Unknown argument kind")}mergeCoinTransactions(){return this.transactions.filter(e=>e.kind==="MergeCoins")}get transactions(){return this.txb.blockData.transactions}get contract(){return new Mt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new In(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Rr(this.globals,this.feeContract,this.contract)}getInputArg(e){if(e.kind!=="Input")throw new Error("not input type");return"value"in e?e:this.txb.blockData.inputs[e.index]}};var Ea=class{constructor(e,r){this.globals=e;this.txb=r;this.contract=new Mt(e.envConfig.contract,e)}contract;decode(){if(this.isCreateStreamTransaction())return this.decodeCreateStreamTransaction();if(this.isClaimByProxyTransaction())return this.decodeClaimByProxyTransaction();if(this.isSetAutoClaimTransaction())return this.decodeSetAutoClaimTransaction();if(this.isCancelStreamTransaction())return this.decodeCancelStreamTransaction();if(this.isClaimStreamTransaction())return this.decodeClaimTransaction()}get transactions(){return this.txb.blockData.transactions}isCreateStreamTransaction(){return this.transactions.findIndex(r=>r.kind==="MoveCall"&&yr(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new wa(this.globals,this.txb).decode()}decodeSetAutoClaimTransaction(){let e=this.helper.decodeSharedObjectId(0),r=this.helper.decodeInputBool(1);return{type:"SetAutoClaim",streamId:e,enabled:r}}decodeClaimTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Claim",streamId:e}}decodeClaimByProxyTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"ClaimByProxy",streamId:e}}decodeCancelStreamTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Cancel",streamId:e}}get helper(){let e=this.transactions[0];return new Gt(e,this.txb)}};var Sa=class{application="mpay";deserialize(e){let{chain:r,transactionBlock:n}=e,i=mn.new(r==="sui:mainnet"?"prod":"dev"),s=new Ea(i,n).decode();if(console.log("\u{1F680} ~ MPayHelper ~ deserialize ~ input:",e,s),s.type==="CreateStream")return{txType:M0.Other,txSubType:ws.Create,intentionData:s.info};throw new Error(`Unknown transaction type: ${s.type}`)}async build(e){let{network:r,intentionData:n,suiClient:i,account:o}=e,s;switch(e.txSubType){case ws.Create:s=ba.fromData(n);break;default:throw new Error("not implemented")}return s.build({network:r,suiClient:i,account:o})}};var va=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Sd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Ca=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return vd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Aa=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{account:n}=r,i=be.from(this.data.content);if(!_0(i.blockData.sender,n.address))throw new Error("Invalid sender address");return i}static fromData(r){return new t(r)}};var Ta=class{application;constructor(){this.application=Cd}deserialize(){throw new Error("MSafe core transaction intention should be build from API")}async build(e){let{suiClient:r,account:n}=e,i;switch(e.txSubType){case bs.assets.coin.send:i=va.fromData(e.intentionData);break;case bs.assets.object.send:i=Ca.fromData(e.intentionData);break;case bs.others.plain:i=Aa.fromData(e.intentionData);break;default:throw new Error("not implemented")}return i.build({suiClient:r,account:n})}};var Ba=class{apps;constructor(e){this.apps=new Map(e.map(r=>[r.application,r]))}getAppHelper(e){let r=this.apps.get(e);if(!r)throw new Error(`${e} not registered`);return r}deserialize(e,r){return this.getAppHelper(e).deserialize(r)}build(e,r){return this.getAppHelper(e).build(r)}};var tb=new Ba([new Ta,new Sa]);return ap(rb);})();
|
|
10
|
+
`+o):n.stack=o}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=zt(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&zs.assertOptions(n,{silentJSONParsing:ur.transitional(ur.boolean),forcedJSONParsing:ur.transitional(ur.boolean),clarifyTimeoutError:ur.transitional(ur.boolean)},!1),i!=null&&(v.isFunction(i)?r.paramsSerializer={serialize:i}:zs.assertOptions(i,{encode:ur.function,serialize:ur.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&v.merge(o.common,o[r.method]);o&&v.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),r.headers=Le.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(c=c&&x.synchronous,a.unshift(x.fulfilled,x.rejected))});let l=[];this.interceptors.response.forEach(function(x){l.push(x.fulfilled,x.rejected)});let u,f=0,d;if(!c){let h=[Us.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,l),d=h.length,u=Promise.resolve(r);f<d;)u=u.then(h[f++],h[f++]);return u}d=a.length;let m=r;for(f=0;f<d;){let h=a[f++],x=a[f++];try{m=h(m)}catch(y){x.call(this,y);break}}try{u=Us.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,d=l.length;f<d;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=zt(this.defaults,e);let r=di(e.baseURL,e.url);return ci(r,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){fn.prototype[e]=function(r,n){return this.request(zt(n||{},{method:e,url:r,data:(n||{}).data}))}});v.forEach(["post","put","patch"],function(e){function r(n){return function(o,s,a){return this.request(zt(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}fn.prototype[e]=r(),fn.prototype[e+"Form"]=r(!0)});var mi=fn;var ac=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new cr(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},dm=ac;function cc(t){return function(r){return t.apply(null,r)}}function uc(t){return v.isObject(t)&&t.isAxiosError===!0}var lc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lc).forEach(([t,e])=>{lc[e]=t});var mm=lc;function hm(t){let e=new mi(t),r=oi(mi.prototype.request,e);return v.extend(r,mi.prototype,e,{allOwnKeys:!0}),v.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return hm(zt(t,i))},r}var we=hm(un);we.Axios=mi;we.CanceledError=cr;we.CancelToken=dm;we.isCancel=fi;we.VERSION=Ls;we.toFormData=ar;we.AxiosError=Y;we.Cancel=we.CanceledError;we.all=function(e){return Promise.all(e)};we.spread=cc;we.isAxiosError=uc;we.mergeConfig=zt;we.AxiosHeaders=Le;we.formToJSON=t=>Rs(v.isHTMLForm(t)?new FormData(t):t);we.getAdapter=js.getAdapter;we.HttpStatusCode=mm;we.default=we;var Wt=we;var{Axios:rC,AxiosError:pm,CanceledError:nC,isCancel:iC,CancelToken:oC,VERSION:sC,all:aC,Cancel:cC,isAxiosError:uC,spread:lC,toFormData:fC,AxiosHeaders:dC,HttpStatusCode:mC,formToJSON:hC,getAdapter:pC,mergeConfig:xC}=Wt;var dn=class extends he{constructor(e,r){super(10,e,{context:r})}};var Ws=class t{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof pm)throw new dn(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new dn(e.data.code)}throw new dn(e.status.toString())}async getIncomingStreams(e,r){let n=await Wt.post(`${this.apiURL}/stream`,{recipient:e,...r});return t.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await Wt.post(`${this.apiURL}/stream`,{sender:e,...r});return t.parseResponseData(n)}async getStreamHistory(e){let r=await Wt.post(`${this.apiURL}/stream-events`,e),n=t.parseResponseData(r);return n.data.forEach(i=>{let o=i;return o.data.type==="create_stream"?o.data.balance=BigInt(o.data.balance):o.data.type==="cancel_stream"?o.data.withdrawAmount=BigInt(o.data.withdrawAmount):o.data.type==="claim"||o.data.type==="auto_claim"?o.data.claimAmount=BigInt(o.data.claimAmount):o.data.type==="set_auto_claim"&&(o.data.enabled=!!o.data.enabled),o.createdAt=new Date(o.createdAt),o}),n}async getAllCoinTypes(e){let r=await Wt.post(`${this.apiURL}/stream-info`,{address:e});return t.parseResponseData(r)}async getAllRecipients(e,r){let n=await Wt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return t.parseResponseData(n)}async getAllSenders(e,r){let n=await Wt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return t.parseResponseData(n)}};var mn=class t{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Ts({url:e.rpc.url}),e.backend&&(this._backend=new Ws(e.backend.url))}static new(e,r){let n=Bd(e,r);return new t(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Bs;return this._backend}set backend(e){this._backend=e}connectWallet(e){this.signer=e}disconnect(){this.signer=void 0}get wallet(){if(!this.signer)throw new Ds;return this.signer}async walletAddress(){return this.wallet.address()}};var xm=Lr(ys()),Ot=class{constructor(e){this.data=e}get application(){return"msafe-core"}serialize(){return JSON.stringify((0,xm.default)(this.data))}};var Ht=class extends Error{},Hs=class extends Ht{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},$s=class extends Ht{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},qs=class extends Ht{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},St=class extends Ht{},hn=class extends Ht{constructor(e){super(`Invalid unit ${e}`)}},Ee=class extends Ht{},vt=class extends Ht{constructor(){super("Zone is an abstract class")}};var j="numeric",Ct="short",Ye="long",lr={year:j,month:j,day:j},hi={year:j,month:Ct,day:j},fc={year:j,month:Ct,day:j,weekday:Ct},pi={year:j,month:Ye,day:j},xi={year:j,month:Ye,day:j,weekday:Ye},gi={hour:j,minute:j},yi={hour:j,minute:j,second:j},bi={hour:j,minute:j,second:j,timeZoneName:Ct},wi={hour:j,minute:j,second:j,timeZoneName:Ye},Ei={hour:j,minute:j,hourCycle:"h23"},Si={hour:j,minute:j,second:j,hourCycle:"h23"},vi={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Ct},Ci={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Ye},Ai={year:j,month:j,day:j,hour:j,minute:j},Ti={year:j,month:j,day:j,hour:j,minute:j,second:j},Bi={year:j,month:Ct,day:j,hour:j,minute:j},Di={year:j,month:Ct,day:j,hour:j,minute:j,second:j},dc={year:j,month:Ct,day:j,weekday:Ct,hour:j,minute:j},Ii={year:j,month:Ye,day:j,hour:j,minute:j,timeZoneName:Ct},Fi={year:j,month:Ye,day:j,hour:j,minute:j,second:j,timeZoneName:Ct},Oi={year:j,month:Ye,day:j,weekday:Ye,hour:j,minute:j,timeZoneName:Ye},ki={year:j,month:Ye,day:j,weekday:Ye,hour:j,minute:j,second:j,timeZoneName:Ye};var Ve=class{get type(){throw new vt}get name(){throw new vt}get ianaName(){return this.name}get isUniversal(){throw new vt}offsetName(e,r){throw new vt}formatOffset(e,r){throw new vt}offset(e){throw new vt}equals(e){throw new vt}get isValid(){throw new vt}};var mc=null,fr=class t extends Ve{static get instance(){return mc===null&&(mc=new t),mc}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Gs(e,r,n)}formatOffset(e,r){return dr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Ks={};function by(t){return Ks[t]||(Ks[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Ks[t]}var wy={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ey(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,o,s,a,c,l,u]=n;return[s,i,o,a,c,l,u]}function Sy(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=wy[o];o==="era"?n[a]=s:H(a)||(n[a]=parseInt(s,10))}return n}var Zs={},Ne=class t extends Ve{static create(e){return Zs[e]||(Zs[e]=new t(e)),Zs[e]}static resetCache(){Zs={},Ks={}}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=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Gs(e,r,n,this.name)}formatOffset(e,r){return dr(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=by(this.name),[i,o,s,a,c,l,u]=n.formatToParts?Sy(n,r):Ey(n,r);a==="BC"&&(i=-Math.abs(i)+1);let d=pn({year:i,month:o,day:s,hour:c===24?0:c,minute:l,second:u,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var gm={};function vy(t,e={}){let r=JSON.stringify([t,e]),n=gm[r];return n||(n=new Intl.ListFormat(t,e),gm[r]=n),n}var hc={};function pc(t,e={}){let r=JSON.stringify([t,e]),n=hc[r];return n||(n=new Intl.DateTimeFormat(t,e),hc[r]=n),n}var xc={};function Cy(t,e={}){let r=JSON.stringify([t,e]),n=xc[r];return n||(n=new Intl.NumberFormat(t,e),xc[r]=n),n}var gc={};function Ay(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=gc[i];return o||(o=new Intl.RelativeTimeFormat(t,e),gc[i]=o),o}var _i=null;function Ty(){return _i||(_i=new Intl.DateTimeFormat().resolvedOptions().locale,_i)}var ym={};function By(t){let e=ym[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,ym[t]=e}return e}function Dy(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,i;try{n=pc(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=pc(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function Iy(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Fy(t){let e=[];for(let r=1;r<=12;r++){let n=te.utc(2009,r,1);e.push(t(n))}return e}function Oy(t){let e=[];for(let r=1;r<=7;r++){let n=te.utc(2016,11,13+r);e.push(t(n))}return e}function Js(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function ky(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var yc=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!r||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=Cy(e,a)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):xn(e,3);return ge(r,this.padTo)}}},bc=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&Ne.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 o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=pc(r,o)}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(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},wc=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Ys()&&(this.rtf=Ay(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):bm(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},_y={firstDay:1,minimalDays:4,weekend:[6,7]},se=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,i,o=!1){let s=e||ne.defaultLocale,a=s||(o?"en-US":Ty()),c=r||ne.defaultNumberingSystem,l=n||ne.defaultOutputCalendar,u=Mi(i)||ne.defaultWeekSettings;return new t(a,c,l,u,s)}static resetCache(){_i=null,hc={},xc={},gc={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return t.create(e,r,n,i)}constructor(e,r,n,i,o){let[s,a,c]=Dy(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=Iy(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=ky(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Mi(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,r=!1){return Js(this,e,Ec,()=>{let n=r?{month:e,day:"numeric"}:{month:e},i=r?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=Fy(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,r=!1){return Js(this,e,Sc,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=r?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=Oy(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Js(this,void 0,()=>vc,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[te.utc(2016,11,13,9),te.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Js(this,e,Cc,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[te.utc(-40,1,1),te.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let i=this.dtFormatter(e,r),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new yc(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new bc(e,this.intl,r)}relFormatter(e={}){return new wc(this.intl,this.isEnglish(),e)}listFormatter(e={}){return vy(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Xs()?By(this.locale):_y}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}};var Tc=null,Ie=class t extends Ve{static get utcInstance(){return Tc===null&&(Tc=new t(0)),Tc}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Or(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${dr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${dr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return dr(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var gn=class extends Ve{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 At(t,e){let r;if(H(t)||t===null)return e;if(t instanceof Ve)return t;if(wm(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?fr.instance:n==="utc"||n==="gmt"?Ie.utcInstance:Ie.parseSpecifier(n)||Ne.create(t)}else return kt(t)?Ie.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new gn(t)}var Em=()=>Date.now(),Sm="system",vm=null,Cm=null,Am=null,Tm=60,Bm,Dm=null,ne=class{static get now(){return Em}static set now(e){Em=e}static set defaultZone(e){Sm=e}static get defaultZone(){return At(Sm,fr.instance)}static get defaultLocale(){return vm}static set defaultLocale(e){vm=e}static get defaultNumberingSystem(){return Cm}static set defaultNumberingSystem(e){Cm=e}static get defaultOutputCalendar(){return Am}static set defaultOutputCalendar(e){Am=e}static get defaultWeekSettings(){return Dm}static set defaultWeekSettings(e){Dm=Mi(e)}static get twoDigitCutoffYear(){return Tm}static set twoDigitCutoffYear(e){Tm=e%100}static get throwOnInvalid(){return Bm}static set throwOnInvalid(e){Bm=e}static resetCaches(){se.resetCache(),Ne.resetCache()}};var Fe=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Im=[0,31,59,90,120,151,181,212,243,273,304,334],Fm=[0,31,60,91,121,152,182,213,244,274,305,335];function ut(t,e){return new Fe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Qs(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function Om(t,e,r){return r+(_r(t)?Fm:Im)[e-1]}function km(t,e){let r=_r(t)?Fm:Im,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function ea(t,e){return(t-e+7)%7+1}function Ni(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=Om(n,i,o),a=ea(Qs(n,i,o),r),c=Math.floor((s-a+14-e)/7),l;return c<1?(l=n-1,c=kr(l,e,r)):c>kr(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...Pi(t)}}function Bc(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=ea(Qs(n,1,e),r),a=mr(n),c=i*7+o-s-7+e,l;c<1?(l=n-1,c+=mr(l)):c>a?(l=n+1,c-=mr(n)):l=n;let{month:u,day:f}=km(l,c);return{year:l,month:u,day:f,...Pi(t)}}function ta(t){let{year:e,month:r,day:n}=t,i=Om(e,r,n);return{year:e,ordinal:i,...Pi(t)}}function Dc(t){let{year:e,ordinal:r}=t,{month:n,day:i}=km(e,r);return{year:e,month:n,day:i,...Pi(t)}}function Ic(t,e){if(!H(t.localWeekday)||!H(t.localWeekNumber)||!H(t.localWeekYear)){if(!H(t.weekday)||!H(t.weekNumber)||!H(t.weekYear))throw new St("Cannot mix locale-based week fields with ISO-based week fields");return H(t.localWeekday)||(t.weekday=t.localWeekday),H(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),H(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function _m(t,e=4,r=1){let n=Ri(t.weekYear),i=Xe(t.weekNumber,1,kr(t.weekYear,e,r)),o=Xe(t.weekday,1,7);return n?i?o?!1:ut("weekday",t.weekday):ut("week",t.weekNumber):ut("weekYear",t.weekYear)}function Mm(t){let e=Ri(t.year),r=Xe(t.ordinal,1,mr(t.year));return e?r?!1:ut("ordinal",t.ordinal):ut("year",t.year)}function Fc(t){let e=Ri(t.year),r=Xe(t.month,1,12),n=Xe(t.day,1,yn(t.year,t.month));return e?r?n?!1:ut("day",t.day):ut("month",t.month):ut("year",t.year)}function Oc(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=Xe(e,0,23)||e===24&&r===0&&n===0&&i===0,s=Xe(r,0,59),a=Xe(n,0,59),c=Xe(i,0,999);return o?s?a?c?!1:ut("millisecond",i):ut("second",n):ut("minute",r):ut("hour",e)}function H(t){return typeof t>"u"}function kt(t){return typeof t=="number"}function Ri(t){return typeof t=="number"&&t%1===0}function wm(t){return typeof t=="string"}function Rm(t){return Object.prototype.toString.call(t)==="[object Date]"}function Ys(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Xs(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Pm(t){return Array.isArray(t)?t:[t]}function kc(t,e,r){if(t.length!==0)return t.reduce((n,i)=>{let o=[e(i),i];return n&&r(n[0],o[0])===n[0]?n:o},null)[1]}function jm(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function hr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Mi(t){if(t==null)return null;if(typeof t!="object")throw new Ee("Week settings must be an object");if(!Xe(t.firstDay,1,7)||!Xe(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Xe(e,1,7)))throw new Ee("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Xe(t,e,r){return Ri(t)&&t>=e&&t<=r}function My(t,e){return t-e*Math.floor(t/e)}function ge(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function $t(t){if(!(H(t)||t===null||t===""))return parseInt(t,10)}function pr(t){if(!(H(t)||t===null||t===""))return parseFloat(t)}function ji(t){if(!(H(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function xn(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function _r(t){return t%4===0&&(t%100!==0||t%400===0)}function mr(t){return _r(t)?366:365}function yn(t,e){let r=My(e-1,12)+1,n=t+(e-r)/12;return r===2?_r(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function pn(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Nm(t,e,r){return-ea(Qs(t,1,e),r)+e-1}function kr(t,e=4,r=1){let n=Nm(t,e,r),i=Nm(t+1,e,r);return(mr(t)-n+i)/7}function Ui(t){return t>99?t:t>ne.twoDigitCutoffYear?1900+t:2e3+t}function Gs(t,e,r,n=null){let i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(r,s).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Or(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function _c(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ee(`Invalid unit value ${t}`);return e}function bn(t,e){let r={};for(let n in t)if(hr(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=_c(i)}return r}function dr(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${ge(r,2)}:${ge(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${ge(r,2)}${ge(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Pi(t){return jm(t,["hour","minute","second","millisecond"])}var Ny=["January","February","March","April","May","June","July","August","September","October","November","December"],Mc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ry=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ec(t){switch(t){case"narrow":return[...Ry];case"short":return[...Mc];case"long":return[...Ny];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 Nc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Rc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Py=["M","T","W","T","F","S","S"];function Sc(t){switch(t){case"narrow":return[...Py];case"short":return[...Rc];case"long":return[...Nc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var vc=["AM","PM"],jy=["Before Christ","Anno Domini"],Uy=["BC","AD"],Ly=["B","A"];function Cc(t){switch(t){case"narrow":return[...Ly];case"short":return[...Uy];case"long":return[...jy];default:return null}}function Um(t){return vc[t.hour<12?0:1]}function Lm(t,e){return Sc(e)[t.weekday-1]}function zm(t,e){return Ec(e)[t.month-1]}function Wm(t,e){return Cc(e)[t.year<0?0:1]}function bm(t,e,r="always",n=!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."]},o=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&o){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`;default:}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,l=i[t],u=n?c?l[1]:l[2]||l[1]:c?i[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}function Hm(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var zy={D:lr,DD:hi,DDD:pi,DDDD:xi,t:gi,tt:yi,ttt:bi,tttt:wi,T:Ei,TT:Si,TTT:vi,TTTT:Ci,f:Ai,ff:Bi,fff:Ii,ffff:Oi,F:Ti,FF:Di,FFF:Fi,FFFF:ki},Oe=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",i=!1,o=[];for(let s=0;s<e.length;s++){let a=e.charAt(s);a==="'"?(n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return zy[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return ge(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(m,h)=>this.loc.extract(e,m,h),s=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",a=()=>n?Um(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,h)=>n?zm(e,m):o(h?{month:m}:{month:m,day:"numeric"},"month"),l=(m,h)=>n?Lm(e,m):o(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{let h=t.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},f=m=>n?Wm(e,m):o({era:m},"era"),d=m=>{switch(m){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 s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({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?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("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 u(m)}};return Hm(t.parseFormat(r),d)}formatDurationFromString(e,r){let n=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=c=>l=>{let u=n(l);return u?this.num(c.get(u),l.length):l},o=t.parseFormat(r),s=o.reduce((c,{literal:l,val:u})=>l?c:c.concat(u),[]),a=e.shiftTo(...s.map(n).filter(c=>c));return Hm(o,i(a))}};var qm=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function En(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Sn(...t){return e=>t.reduce(([r,n,i],o)=>{let[s,a,c]=o(e,i);return[{...r,...s},a||n,c]},[{},null,1]).slice(0,2)}function vn(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let i=r.exec(t);if(i)return n(i)}return[null,null]}function Vm(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=$t(e[r+i]);return[n,null,r+i]}}var Gm=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Wy=`(?:${Gm.source}?(?:\\[(${qm.source})\\])?)?`,Pc=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Zm=RegExp(`${Pc.source}${Wy}`),jc=RegExp(`(?:T${Zm.source})?`),Hy=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,$y=/(\d{4})-?W(\d\d)(?:-?(\d))?/,qy=/(\d{4})-?(\d{3})/,Vy=Vm("weekYear","weekNumber","weekDay"),Gy=Vm("year","ordinal"),Zy=/(\d{4})-(\d\d)-(\d\d)/,Km=RegExp(`${Pc.source} ?(?:${Gm.source}|(${qm.source}))?`),Ky=RegExp(`(?: ${Km.source})?`);function wn(t,e,r){let n=t[e];return H(n)?r:$t(n)}function Jy(t,e){return[{year:wn(t,e),month:wn(t,e+1,1),day:wn(t,e+2,1)},null,e+3]}function Cn(t,e){return[{hours:wn(t,e,0),minutes:wn(t,e+1,0),seconds:wn(t,e+2,0),milliseconds:ji(t[e+3])},null,e+4]}function Li(t,e){let r=!t[e]&&!t[e+1],n=Or(t[e+1],t[e+2]),i=r?null:Ie.instance(n);return[{},i,e+3]}function zi(t,e){let r=t[e]?Ne.create(t[e]):null;return[{},r,e+1]}var Yy=RegExp(`^T?${Pc.source}$`),Xy=/^-?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 Qy(t){let[e,r,n,i,o,s,a,c,l]=t,u=e[0]==="-",f=c&&c[0]==="-",d=(m,h=!1)=>m!==void 0&&(h||m&&u)?-m:m;return[{years:d(pr(r)),months:d(pr(n)),weeks:d(pr(i)),days:d(pr(o)),hours:d(pr(s)),minutes:d(pr(a)),seconds:d(pr(c),c==="-0"),milliseconds:d(ji(l),f)}]}var e2={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Uc(t,e,r,n,i,o,s){let a={year:e.length===2?Ui($t(e)):$t(e),month:Mc.indexOf(r)+1,day:$t(n),hour:$t(i),minute:$t(o)};return s&&(a.second=$t(s)),t&&(a.weekday=t.length>3?Nc.indexOf(t)+1:Rc.indexOf(t)+1),a}var t2=/^(?:(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 r2(t){let[,e,r,n,i,o,s,a,c,l,u,f]=t,d=Uc(e,i,n,r,o,s,a),m;return c?m=e2[c]:l?m=0:m=Or(u,f),[d,new Ie(m)]}function n2(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var i2=/^(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$/,o2=/^(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$/,s2=/^(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 $m(t){let[,e,r,n,i,o,s,a]=t;return[Uc(e,i,n,r,o,s,a),Ie.utcInstance]}function a2(t){let[,e,r,n,i,o,s,a]=t;return[Uc(e,a,r,n,i,o,s),Ie.utcInstance]}var c2=En(Hy,jc),u2=En($y,jc),l2=En(qy,jc),f2=En(Zm),Jm=Sn(Jy,Cn,Li,zi),d2=Sn(Vy,Cn,Li,zi),m2=Sn(Gy,Cn,Li,zi),h2=Sn(Cn,Li,zi);function Ym(t){return vn(t,[c2,Jm],[u2,d2],[l2,m2],[f2,h2])}function Xm(t){return vn(n2(t),[t2,r2])}function Qm(t){return vn(t,[i2,$m],[o2,$m],[s2,a2])}function eh(t){return vn(t,[Xy,Qy])}var p2=Sn(Cn);function th(t){return vn(t,[Yy,p2])}var x2=En(Zy,Ky),g2=En(Km),y2=Sn(Cn,Li,zi);function rh(t){return vn(t,[x2,Jm],[g2,y2])}var nh="Invalid Duration",oh={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},b2={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:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...oh},lt=146097/400,An=146097/4800,w2={years:{quarters:4,months:12,weeks:lt/7,days:lt,hours:lt*24,minutes:lt*24*60,seconds:lt*24*60*60,milliseconds:lt*24*60*60*1e3},quarters:{months:3,weeks:lt/28,days:lt/4,hours:lt*24/4,minutes:lt*24*60/4,seconds:lt*24*60*60/4,milliseconds:lt*24*60*60*1e3/4},months:{weeks:An/7,days:An,hours:An*24,minutes:An*24*60,seconds:An*24*60*60,milliseconds:An*24*60*60*1e3},...oh},Mr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],E2=Mr.slice(0).reverse();function xr(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ue(n)}function sh(t,e){let r=e.milliseconds??0;for(let n of E2.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function ih(t,e){let r=sh(t,e)<0?-1:1;Mr.reduceRight((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]*r,s=t[i][n],a=Math.floor(o/s);e[i]+=a*r,e[n]-=a*s*r}return i},null),Mr.reduce((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*t[n][i]}return i},null)}function S2(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var ue=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?w2:b2;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Ee(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:bn(e,t.normalizeUnit),loc:se.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(kt(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Ee(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=eh(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=th(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Ee("need to specify a reason the Duration is invalid");let n=e instanceof Fe?e:new Fe(e,r);if(ne.throwOnInvalid)throw new qs(n);return new t({invalid:n})}static normalizeUnit(e){let r={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(!r)throw new hn(e);return r}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,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Oe.create(this.loc,n).formatDurationFromString(this,e):nh}toHuman(e={}){if(!this.isValid)return nh;let r=Mr.map(n=>{let i=this.values[n];return H(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);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+=xn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},te.fromMillis(r,{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?sh(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let i of Mr)(hr(r.values,i)||hr(this.values,i))&&(n[i]=r.get(i)+this.get(i));return xr(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=_c(e(this.values[n],n));return xr(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...bn(e,t.normalizeUnit)};return xr(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:i,conversionAccuracy:n};return xr(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ih(this.matrix,e),xr(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=S2(this.normalize().shiftToAll().toObject());return xr(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},n={},i=this.toObject(),o;for(let s of Mr)if(e.indexOf(s)>=0){o=s;let a=0;for(let l in n)a+=this.matrix[l][s]*n[l],n[l]=0;kt(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else kt(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(r[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return ih(this.matrix,r),xr(this,{values:r},!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 r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return xr(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 r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of Mr)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Tn="Invalid Interval";function v2(t,e){return!t||!t.isValid?qt.invalid("missing or invalid start"):!e||!e.isValid?qt.invalid("missing or invalid end"):e<t?qt.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var qt=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Ee("need to specify a reason the Interval is invalid");let n=e instanceof Fe?e:new Fe(e,r);if(ne.throwOnInvalid)throw new $s(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Bn(e),i=Bn(r),o=v2(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=ue.fromDurationLike(r),i=Bn(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=ue.fromDurationLike(r),i=Bn(e);return t.fromDateTimes(i.minus(n),i)}static fromISO(e,r){let[n,i]=(e||"").split("/",2);if(n&&i){let o,s;try{o=te.fromISO(n,r),s=o.isValid}catch{s=!1}let a,c;try{a=te.fromISO(i,r),c=a.isValid}catch{c=!1}if(s&&c)return t.fromDateTimes(o,a);if(s){let l=ue.fromISO(i,r);if(l.isValid)return t.after(o,l)}else if(c){let l=ue.fromISO(n,r);if(l.isValid)return t.before(a,l)}}return t.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 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",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),i;return r?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,r),Math.floor(i.diff(n,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:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(Bn).filter(s=>this.contains(s)).sort((s,a)=>s.toMillis()-a.toMillis()),n=[],{s:i}=this,o=0;for(;i<this.e;){let s=r[o]||this.e,a=+s>+this.e?this.e:s;n.push(t.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let r=ue.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(c=>c*i));o=+a>+this.e?this.e:a,s.push(t.fromDateTimes(n,o)),n=o,i+=1}return s}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 r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,i=[],o=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((c,l)=>c.time-l.time);for(let c of a)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&i.push(t.fromDateTimes(r,c.time)),r=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Tn}[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=lr,r={}){return this.isValid?Oe.create(this.s.loc.clone(r),e).formatInterval(this):Tn}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Tn}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Tn}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Tn}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Tn}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):ue.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Vt=class{static hasDST(e=ne.defaultZone){let r=te.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return Ne.isValidZone(e)}static normalizeZone(e){return At(e,ne.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return se.create(r,null,"gregory").eras(e)}static features(){return{relative:Ys(),localeWeek:Xs()}}};function ah(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(ue.fromMillis(n).as("days"))}function C2(t,e,r){let n=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{let u=ah(c,l);return(u-u%7)/7}],["days",ah]],i={},o=t,s,a;for(let[c,l]of n)r.indexOf(c)>=0&&(s=c,i[c]=l(t,e),a=o.plus(i),a>e?(i[c]--,t=o.plus(i),t>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}function ch(t,e,r,n){let[i,o,s,a]=C2(t,e,r),c=e-i,l=r.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));let u=ue.fromObject(o,n);return l.length>0?ue.fromMillis(c,n).shiftTo(...l).plus(u):u}var Lc={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"},uh={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]},A2=Lc.hanidec.replace(/[\[|\]]/g,"").split("");function lh(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(Lc.hanidec)!==-1)e+=A2.indexOf(t[r]);else for(let i in uh){let[o,s]=uh[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function ft({numberingSystem:t},e=""){return new RegExp(`${Lc[t||"latn"]}${e}`)}var T2="missing Intl.DateTimeFormat.formatToParts support";function ie(t,e=r=>r){return{regex:t,deser:([r])=>e(lh(r))}}var B2="\xA0",mh=`[ ${B2}]`,hh=new RegExp(mh,"g");function D2(t){return t.replace(/\./g,"\\.?").replace(hh,mh)}function fh(t){return t.replace(/\./g,"").replace(hh," ").toLowerCase()}function Tt(t,e){return t===null?null:{regex:RegExp(t.map(D2).join("|")),deser:([r])=>t.findIndex(n=>fh(r)===fh(n))+e}}function dh(t,e){return{regex:t,deser:([,r,n])=>Or(r,n),groups:e}}function ra(t){return{regex:t,deser:([e])=>e}}function I2(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function F2(t,e){let r=ft(e),n=ft(e,"{2}"),i=ft(e,"{3}"),o=ft(e,"{4}"),s=ft(e,"{6}"),a=ft(e,"{1,2}"),c=ft(e,"{1,3}"),l=ft(e,"{1,6}"),u=ft(e,"{1,9}"),f=ft(e,"{2,4}"),d=ft(e,"{4,6}"),m=y=>({regex:RegExp(I2(y.val)),deser:([p])=>p,literal:!0}),x=(y=>{if(t.literal)return m(y);switch(y.val){case"G":return Tt(e.eras("short"),0);case"GG":return Tt(e.eras("long"),0);case"y":return ie(l);case"yy":return ie(f,Ui);case"yyyy":return ie(o);case"yyyyy":return ie(d);case"yyyyyy":return ie(s);case"M":return ie(a);case"MM":return ie(n);case"MMM":return Tt(e.months("short",!0),1);case"MMMM":return Tt(e.months("long",!0),1);case"L":return ie(a);case"LL":return ie(n);case"LLL":return Tt(e.months("short",!1),1);case"LLLL":return Tt(e.months("long",!1),1);case"d":return ie(a);case"dd":return ie(n);case"o":return ie(c);case"ooo":return ie(i);case"HH":return ie(n);case"H":return ie(a);case"hh":return ie(n);case"h":return ie(a);case"mm":return ie(n);case"m":return ie(a);case"q":return ie(a);case"qq":return ie(n);case"s":return ie(a);case"ss":return ie(n);case"S":return ie(c);case"SSS":return ie(i);case"u":return ra(u);case"uu":return ra(a);case"uuu":return ie(r);case"a":return Tt(e.meridiems(),0);case"kkkk":return ie(o);case"kk":return ie(f,Ui);case"W":return ie(a);case"WW":return ie(n);case"E":case"c":return ie(r);case"EEE":return Tt(e.weekdays("short",!1),1);case"EEEE":return Tt(e.weekdays("long",!1),1);case"ccc":return Tt(e.weekdays("short",!0),1);case"cccc":return Tt(e.weekdays("long",!0),1);case"Z":case"ZZ":return dh(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return dh(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return ra(/[a-z_+-/]{1,256}?/i);case" ":return ra(/[^\S\n\r]/);default:return m(y)}})(t)||{invalidReason:T2};return x.token=t,x}var O2={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 k2(t,e,r){let{type:n,value:i}=t;if(n==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let a=O2[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function _2(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function M2(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(hr(r,s)){let a=r[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+c))),o+=c}return[n,i]}else return[n,{}]}function N2(t){let e=o=>{switch(o){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}},r=null,n;return H(t.z)||(r=Ne.create(t.z)),H(t.Z)||(r||(r=new Ie(t.Z)),n=t.Z),H(t.q)||(t.M=(t.q-1)*3+1),H(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),H(t.u)||(t.S=ji(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var zc=null;function R2(){return zc||(zc=te.fromMillis(1555555555555)),zc}function P2(t,e){if(t.literal)return t;let r=Oe.macroTokenToFormatOpts(t.val),n=$c(r,e);return n==null||n.includes(void 0)?t:n}function Wc(t,e){return Array.prototype.concat(...t.map(r=>P2(r,e)))}function Hc(t,e,r){let n=Wc(Oe.parseFormat(r),t),i=n.map(s=>F2(s,t)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=_2(i),c=RegExp(s,"i"),[l,u]=M2(e,c,a),[f,d,m]=u?N2(u):[null,null,void 0];if(hr(u,"a")&&hr(u,"H"))throw new St("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:c,rawMatches:l,matches:u,result:f,zone:d,specificOffset:m}}}function ph(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=Hc(t,e,r);return[n,i,o,s]}function $c(t,e){if(!t)return null;let n=Oe.create(e,t).dtFormatter(R2()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>k2(s,t,o))}var qc="Invalid DateTime",xh=864e13;function na(t){return new Fe("unsupported zone",`the zone "${t.name}" is not supported`)}function Vc(t){return t.weekData===null&&(t.weekData=Ni(t.c)),t.weekData}function Gc(t){return t.localWeekData===null&&(t.localWeekData=Ni(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Nr(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new te({...r,...e,old:r})}function vh(t,e,r){let n=t-e*60*1e3,i=r.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=r.offset(n);return i===o?[n,i]:[t-Math.min(i,o)*60*1e3,Math.max(i,o)]}function ia(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function sa(t,e,r){return vh(pn(t),e,r)}function gh(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...t.c,year:n,month:i,day:Math.min(t.c.day,yn(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=ue.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=pn(o),[c,l]=vh(a,r,t.zone);return s!==0&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function Wi(t,e,r,n,i,o){let{setZone:s,zone:a}=r;if(t&&Object.keys(t).length!==0||e){let c=e||a,l=te.fromObject(t,{...r,zone:c,specificOffset:o});return s?l:l.setZone(a)}else return te.invalid(new Fe("unparsable",`the input "${i}" can't be parsed as ${n}`))}function oa(t,e,r=!0){return t.isValid?Oe.create(se.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Zc(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=ge(t.c.year,r?6:4),e?(n+="-",n+=ge(t.c.month),n+="-",n+=ge(t.c.day)):(n+=ge(t.c.month),n+=ge(t.c.day)),n}function yh(t,e,r,n,i,o){let s=ge(t.c.hour);return e?(s+=":",s+=ge(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=":")):s+=ge(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=ge(t.c.second),(t.c.millisecond!==0||!n)&&(s+=".",s+=ge(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!o?s+="Z":t.o<0?(s+="-",s+=ge(Math.trunc(-t.o/60)),s+=":",s+=ge(Math.trunc(-t.o%60))):(s+="+",s+=ge(Math.trunc(t.o/60)),s+=":",s+=ge(Math.trunc(t.o%60)))),o&&(s+="["+t.zone.ianaName+"]"),s}var Ch={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},j2={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},U2={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ah=["year","month","day","hour","minute","second","millisecond"],L2=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],z2=["year","ordinal","hour","minute","second","millisecond"];function W2(t){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"}[t.toLowerCase()];if(!e)throw new hn(t);return e}function bh(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return W2(t)}}function wh(t,e){let r=At(e.zone,ne.defaultZone),n=se.fromObject(e),i=ne.now(),o,s;if(H(t.year))o=i;else{for(let l of Ah)H(t[l])&&(t[l]=Ch[l]);let a=Fc(t)||Oc(t);if(a)return te.invalid(a);let c=r.offset(i);[o,s]=sa(t,c,r)}return new te({ts:o,zone:r,loc:n,o:s})}function Eh(t,e,r){let n=H(r.round)?!0:r.round,i=(s,a)=>(s=xn(s,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(s,a)),o=s=>r.calendary?e.hasSame(t,s)?0:e.startOf(s).diff(t.startOf(s),s).get(s):e.diff(t,s).get(s);if(r.unit)return i(o(r.unit),r.unit);for(let s of r.units){let a=o(s);if(Math.abs(a)>=1)return i(a,s)}return i(t>e?-0:0,r.units[r.units.length-1])}function Sh(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var te=class t{constructor(e){let r=e.zone||ne.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Fe("invalid input"):null)||(r.isValid?null:na(r));this.ts=H(e.ts)?ne.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[i,o]=[e.old.c,e.old.o];else{let a=r.offset(this.ts);i=ia(this.ts,a),n=Number.isNaN(i.year)?new Fe("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=r,this.loc=e.loc||se.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=Sh(arguments),[n,i,o,s,a,c,l]=r;return wh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static utc(){let[e,r]=Sh(arguments),[n,i,o,s,a,c,l]=r;return e.zone=Ie.utcInstance,wh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=Rm(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=At(r.zone,ne.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:se.fromObject(r)}):t.invalid(na(i))}static fromMillis(e,r={}){if(kt(e))return e<-xh||e>xh?t.invalid("Timestamp out of range"):new t({ts:e,zone:At(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Ee(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(kt(e))return new t({ts:e*1e3,zone:At(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Ee("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=At(r.zone,ne.defaultZone);if(!n.isValid)return t.invalid(na(n));let i=se.fromObject(r),o=bn(e,bh),{minDaysInFirstWeek:s,startOfWeek:a}=Ic(o,i),c=ne.now(),l=H(r.specificOffset)?n.offset(c):r.specificOffset,u=!H(o.ordinal),f=!H(o.year),d=!H(o.month)||!H(o.day),m=f||d,h=o.weekYear||o.weekNumber;if((m||u)&&h)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new St("Can't mix ordinal dates with month/day");let x=h||o.weekday&&!m,y,p,g=ia(c,l);x?(y=L2,p=j2,g=Ni(g,s,a)):u?(y=z2,p=U2,g=ta(g)):(y=Ah,p=Ch);let b=!1;for(let L of y){let T=o[L];H(T)?b?o[L]=p[L]:o[L]=g[L]:b=!0}let w=x?_m(o,s,a):u?Mm(o):Fc(o),E=w||Oc(o);if(E)return t.invalid(E);let S=x?Bc(o,s,a):u?Dc(o):o,[O,I]=sa(S,l,n),N=new t({ts:O,zone:n,o:I,loc:i});return o.weekday&&m&&e.weekday!==N.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${N.toISO()}`):N}static fromISO(e,r={}){let[n,i]=Ym(e);return Wi(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=Xm(e);return Wi(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=Qm(e);return Wi(n,i,r,"HTTP",r)}static fromFormat(e,r,n={}){if(H(e)||H(r))throw new Ee("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,c,l,u]=ph(s,e,r);return u?t.invalid(u):Wi(a,c,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,i]=rh(e);return Wi(n,i,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Ee("need to specify a reason the DateTime is invalid");let n=e instanceof Fe?e:new Fe(e,r);if(ne.throwOnInvalid)throw new Hs(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=$c(e,se.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return Wc(Oe.parseFormat(e),se.fromObject(r)).map(i=>i.val).join("")}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?Vc(this).weekYear:NaN}get weekNumber(){return this.isValid?Vc(this).weekNumber:NaN}get weekday(){return this.isValid?Vc(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Gc(this).weekday:NaN}get localWeekNumber(){return this.isValid?Gc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Gc(this).weekYear:NaN}get ordinal(){return this.isValid?ta(this.c).ordinal:NaN}get monthShort(){return this.isValid?Vt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Vt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Vt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Vt.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,r=6e4,n=pn(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*r),a=this.zone.offset(n-o*r);if(s===a)return[this];let c=n-s*r,l=n-a*r,u=ia(c,s),f=ia(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Nr(this,{ts:c}),Nr(this,{ts:l})]:[this]}get isInLeapYear(){return _r(this.year)}get daysInMonth(){return yn(this.year,this.month)}get daysInYear(){return this.isValid?mr(this.year):NaN}get weeksInWeekYear(){return this.isValid?kr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?kr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:i}=Oe.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(e=0,r={}){return this.setZone(Ie.instance(e),r)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=At(e,ne.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(r||n){let o=e.offset(this.ts),s=this.toObject();[i]=sa(s,o,e)}return Nr(this,{ts:i,zone:e})}else return t.invalid(na(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return Nr(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=bn(e,bh),{minDaysInFirstWeek:n,startOfWeek:i}=Ic(r,this.loc),o=!H(r.weekYear)||!H(r.weekNumber)||!H(r.weekday),s=!H(r.ordinal),a=!H(r.year),c=!H(r.month)||!H(r.day),l=a||c,u=r.weekYear||r.weekNumber;if((l||s)&&u)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new St("Can't mix ordinal dates with month/day");let f;o?f=Bc({...Ni(this.c,n,i),...r},n,i):H(r.ordinal)?(f={...this.toObject(),...r},H(r.day)&&(f.day=Math.min(yn(f.year,f.month),f.day))):f=Dc({...ta(this.c),...r});let[d,m]=sa(f,this.o,this.zone);return Nr(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e);return Nr(this,gh(this,r))}minus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e).negate();return Nr(this,gh(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=ue.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(i==="weeks")if(r){let o=this.loc.getStartOfWeek(),{weekday:s}=this;s<o&&(n.weekNumber=this.weekNumber-1),n.weekday=o}else n.weekday=1;if(i==="quarters"){let o=Math.ceil(this.month/3);n.month=(o-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?Oe.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):qc}toLocaleString(e=lr,r={}){return this.isValid?Oe.create(this.loc.clone(r),e).formatDateTime(this):qc}toLocaleParts(e={}){return this.isValid?Oe.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;let s=e==="extended",a=Zc(this,s);return a+="T",a+=yh(this,s,r,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?Zc(this,e==="extended"):null}toISOWeekDate(){return oa(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(i?"T":"")+yh(this,s==="extended",r,e,n,o):null}toRFC2822(){return oa(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return oa(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Zc(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||e)&&(n&&(i+=" "),r?i+="z":e&&(i+="ZZ")),oa(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():qc}[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 r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return ue.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=Pm(r).map(ue.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,l=ch(a,c,o,i);return s?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?qt.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let i=e.valueOf(),o=this.setZone(e.zone,{keepLocalTime:!0});return o.startOf(r,n)<=i&&i<=o.endOf(r,n)}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 r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],o=e.unit;return Array.isArray(e.unit)&&(i=e.unit,o=void 0),Eh(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?Eh(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Ee("min requires all arguments be DateTimes");return kc(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ee("max requires all arguments be DateTimes");return kc(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return Hc(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return lr}static get DATE_MED(){return hi}static get DATE_MED_WITH_WEEKDAY(){return fc}static get DATE_FULL(){return pi}static get DATE_HUGE(){return xi}static get TIME_SIMPLE(){return gi}static get TIME_WITH_SECONDS(){return yi}static get TIME_WITH_SHORT_OFFSET(){return bi}static get TIME_WITH_LONG_OFFSET(){return wi}static get TIME_24_SIMPLE(){return Ei}static get TIME_24_WITH_SECONDS(){return Si}static get TIME_24_WITH_SHORT_OFFSET(){return vi}static get TIME_24_WITH_LONG_OFFSET(){return Ci}static get DATETIME_SHORT(){return Ai}static get DATETIME_SHORT_WITH_SECONDS(){return Ti}static get DATETIME_MED(){return Bi}static get DATETIME_MED_WITH_SECONDS(){return Di}static get DATETIME_MED_WITH_WEEKDAY(){return dc}static get DATETIME_FULL(){return Ii}static get DATETIME_FULL_WITH_SECONDS(){return Fi}static get DATETIME_HUGE(){return Oi}static get DATETIME_HUGE_WITH_SECONDS(){return ki}};function Bn(t){if(te.isDateTime(t))return t;if(t&&t.valueOf&&kt(t.valueOf()))return te.fromJSDate(t);if(t&&typeof t=="object")return te.fromObject(t);throw new Ee(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var Kc=50n,aa=10000n,Th=25n,Jc=100000000n;var _t=class{constructor(e){this.object=e}moveArg(e){return e.object(this.object)}},Hi=class{constructor(e){this.objects=e}moveArgs(e){return e.makeMoveVec({objects:this.objects.map(r=>e.object(r))})}},gr=class t{constructor(e){this.result=e;return new Proxy(this,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(r,n){if(n in r)return Reflect.get(r,n);let i=s=>new t(r.result[s]);if(n===Symbol.iterator)return function*(){let s=0;for(;;)yield i(s),s++};if(typeof n=="symbol")return;let o=parseInt(n,10);if(!(Number.isNaN(o)||o<0))return i(o)}})}moveArg(){return this.result}};var $i=class extends he{constructor(e,r){super(3,e,{context:r})}};var ca=class{constructor(e){this.results=e}callResult(e){return this.results.results[e]}returnValue(e,r){return e.returnValues[r]}getValue(e=0,r=0){let n=this.callResult(e);return this.returnValue(n,r)}getAddress(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="address")throw new $i("Invalid contract return type.",{ctx:{expectType:"address",gotType:i}});return $(Buffer.from(n).toString("hex"))}getU64(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="u64")throw new $i("Invalid contract return type.",{ctx:{expectType:"u64",gotType:i}});return Buffer.from(n).readBigInt64LE()}};var Se=class extends he{constructor(e,r,n){super(2,`Invalid input: ${e}`,{context:{fieldKey:r,fieldValue:n}})}};var Dh={groupId:"string",name:"string"},H2=64;function Ih(t){return Fh(t),ae.ser(Dh,t).toString("base64")}function qi(t){let e=ae.de(Dh,t,"base64");return Fh(e),e}function Fh(t){if(!Bh(t.name))throw new Se("Invalid metadata: Name contains unknown character");if(!Bh(t.groupId))throw new Se("Invalid metadata: Group ID contains unknown character");if(t.name.length>H2)throw new Se("Invalid metadata: Name exceed max length 64")}function Bh(t){return/^[\x00-\x7F]+$/.test(t)}function Oh(t,e){return oe(t)===oe(e)}function yr(t,e){return oe(t)===oe(e)}var kh="txn.gas";function _h(){return"nanoid()"}var Rr=class t{constructor(e,r,n){this.globals=e;this.feeContract=r;this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:Ih({name:e.name,groupId:_h()}),coinType:oe(e.coinType),recipients:e.recipients.map(r=>({address:r.address,cliffAmount:r.cliffAmount,amountPerEpoch:r.amountPerStep})),epochInterval:e.interval,numberEpoch:e.steps,startTime:e.startTimeMs,cancelable:e.cancelable}}async buildCreateStreamTransactionBlock(e){let r=new be,n=this.calculateFeesInternal(e),i=this.getCreateStreamCoinRequests(e,n),o=await this.wallet.requestCoins(i),s=await this.addMergeCoins(r,o[0]),a;i.length>1?a=await this.addMergeCoins(r,o[1]):a=s;for(let c=0;c<e.recipients.length;c++){let l=e.recipients[c],u=this.amountForRecipient(l,e.numberEpoch),f=this.getStreamFeeLocal(u),[d]=r.splitCoins(s,[r.pure(u+f,"u64")]),[m]=r.splitCoins(a,[r.pure(this.flatSuiFee,"u64")]);this.streamContract.createStream(r,{paymentCoin:new gr(d),flatFeeCoin:new gr(m),metadata:e.metadata,recipient:l.address,timeStart:e.startTime,cliff:l.cliffAmount,epochInterval:e.epochInterval,numEpoch:e.numberEpoch,amountPerEpoch:l.amountPerEpoch,cancelable:e.cancelable,coinType:e.coinType})}return r}calculateCreateStreamFees(e){let r=t.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(r)}feeParams(){return{createFeePercent:{numerator:Kc,denominator:aa},claimFeePercent:{numerator:Th,denominator:aa},flatFeePerStream:Jc}}async addMergeCoins(e,r){let n;return r.mergedCoins&&r.mergedCoins.length?(e.mergeCoins(e.object(r.primaryCoin),r.mergedCoins.map(i=>e.object(i))),n=e.object(r.primaryCoin)):r.primaryCoin===kh?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return Oh(n,Bt)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:Bt,amount:r.flatFeeAmount}]}calculateFeesInternal(e){let r=e.recipients.reduce((i,o)=>{let s=this.amountForRecipient(o,e.numberEpoch),a=this.getStreamFeeLocal(s);return{totalAmount:i.totalAmount+s,streamFeeAmount:i.streamFeeAmount+a}},{totalAmount:0n,streamFeeAmount:0n});return{flatFeeAmount:BigInt(e.recipients.length)*this.flatSuiFee,...r}}amountForRecipient(e,r){return e.amountPerEpoch*r+e.cliffAmount}get flatSuiFee(){return Jc}getStreamFeeLocal(e){return e*Kc/aa}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new be,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new ca(n).getU64()}get wallet(){return this.globals.wallet}};var Mh="0x0000000000000000000000000000000000000000000000000000000000000006";var Dn=class{constructor(e,r,n){this.moduleName=e;this.config=r;this.globals=n}addContractCall(e,r){let n=`${this.config.contractId}::${this.moduleName}::${r.method}`;return e.add(st.MoveCall({target:n,arguments:r.arguments.map(i=>i instanceof Hi?i.moveArgs(e):i instanceof _t?i.moveArg(e):i instanceof gr?i.moveArg():e.pure(i)),typeArguments:r.typeArgs})),e}addTransactionBlock(e,r,n=[],i=[]){e.add(st.MoveCall({target:r,arguments:n.map(o=>o instanceof Hi?o.moveArgs(e):o instanceof _t?o.moveArg(e):o instanceof gr?o.moveArg():e.pure(o)),typeArguments:i}))}makeObject(e){return typeof e=="string"?new _t(e):e}vaultObject(){return new _t(this.config.vaultObjId)}roleObject(){return new _t(this.config.roleObjId)}feeObject(){return new _t(this.config.feeObjId)}clockObject(){return new _t(Mh)}};var In=class t extends Dn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="fee_module";static MethodName={set_streaming_fee:"set_streaming_fee",set_claim_fee:"set_claim_fee",set_streaming_flat_fee:"set_streaming_flat_fee",streaming_flat_fee:"streaming_flat_fee",streaming_fee:"streaming_fee",claim_fee:"claim_fee",fee_denominator:"fee_denominator"};setStreamingFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_fee,arguments:[i,o,n],typeArgs:[]})}setStreamingFlatFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_flat_fee,arguments:[i,o,n],typeArgs:[]})}setClaimFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_claim_fee,arguments:[i,o,n],typeArgs:[]})}streamingFee(r,n){let i=this.feeObject();return this.addContractCall(r,{method:t.MethodName.streaming_fee,arguments:[i,n],typeArgs:[]})}claimFee(r,n){return this.addContractCall(r,{method:t.MethodName.claim_fee,arguments:[this.feeObject(),n],typeArgs:[]})}feeDenominator(r){return this.addContractCall(r,{method:t.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}};var Mt=class t extends Dn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="stream";static MethodName={create_stream:"create_stream",set_auto_claim:"set_auto_claim",cancel_stream:"cancel_stream",claim_stream:"claim_stream",claim_stream_by_proxy:"claim_stream_by_proxy",stream_current_epoch:"stream_current_epoch",now_milli_seconds:"now_milli_seconds"};createStream(r,n){let i=this.feeObject(),o=this.vaultObject(),s=this.makeObject(n.paymentCoin),a=this.makeObject(n.flatFeeCoin),c=this.clockObject();return this.addContractCall(r,{method:t.MethodName.create_stream,arguments:[i,o,s,a,n.metadata,n.recipient,n.timeStart,n.cliff,n.epochInterval,n.numEpoch,n.amountPerEpoch,n.cancelable,c],typeArgs:[n.coinType]})}setAutoClaim(r,n){let i=this.makeObject(n.streamId);return this.addContractCall(r,{method:t.MethodName.set_auto_claim,arguments:[i,n.enabled],typeArgs:[n.coinType]})}cancelStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.cancel_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStreamByProxy(r,n){let i=this.makeObject(n.streamId),o=this.vaultObject(),s=this.feeObject(),a=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream_by_proxy,arguments:[i,o,s,a],typeArgs:[n.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream_by_proxy}`}};var Fn=class{constructor(e){this.globals=e;let r=e.envConfig.contract;this.feeContract=new In(r,e),this.streamContract=new Mt(r,e)}feeContract;streamContract;async createStreams(e){let r=Rr.convertCreateStreamInfoToInternal(e);return this.createStreamHelper().buildCreateStreamTransactionBlock(r)}createStreamHelper(){return new Rr(this.globals,this.feeContract,this.streamContract)}setAutoClaim(e,r,n){let i=new be;return this.streamContract.setAutoClaim(i,{streamId:e,enabled:r,coinType:n})}claimStream(e,r){let n=new be;return this.streamContract.claimStream(n,{streamId:e,coinType:r})}claimStreamByProxy(e,r){let n=new be;return this.streamContract.claimStreamByProxy(n,{streamId:e,coinType:r})}cancelStream(e,r){let n=new be;return this.streamContract.cancelStream(n,{streamId:e,coinType:r}),n}};var ua=class extends he{constructor(e,r){super(12,`Transaction failed: ${r}`,{context:{status:e,msg:r}})}};var $2=1e3,la=class{constructor(e){this.globals=e;this.coinMetaHelper=new Yc(e.suiClient),this.createStreamHelper=new Fn(e).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(e){if(e.effects?.status.status!=="success")throw new ua(e.effects?.status.status,e.effects?.status.error);return e.objectChanges.filter(r=>r.type==="created"&&r.objectType.startsWith(`${this.globals.envConfig.contract.contractId}::stream::Stream`)).map(r=>r.objectId)}calculateCreateStreamFees(e){return this.createStreamHelper.calculateCreateStreamFees(e)}feeParams(){return this.createStreamHelper.feeParams()}calculateStreamAmount(e){if(e.steps===0n)throw new Se("Invalid stream steps: 0");let r=e.cliff?e.cliff:{numerator:0n,denominator:100n},n=e.totalAmount*r.numerator/r.denominator,i=(e.totalAmount-n)/e.steps,s={realTotalAmount:i*e.steps+n,cliffAmount:n,amountPerStep:i};return this.validateStreamAmount(s,e.totalAmount),s}calculateTimelineByInterval(e){if(e.steps===0n)throw new Se("Invalid stream steps: 0");let r=e.timeStart.plus(e.interval.toMillis()*Number(e.steps)),n={timeStart:e.timeStart,timeEnd:r,interval:e.interval,steps:e.steps};return this.validateTimeline(n),n}calculateTimelineByTotalDuration(e){if(e.steps===0n)throw new Se("Invalid stream steps: 0");let r=BigInt(e.total.toMillis())/e.steps,n=e.timeStart.plus(ue.fromMillis(Number(r*e.steps))),i={timeStart:e.timeStart,timeEnd:n,interval:ue.fromMillis(Number(r)),steps:e.steps};return this.validateTimeline(i),i}async getBalance(e,r){let n=await this.globals.suiClient.getBalance({owner:e,coinType:r}),i=await this.getCoinMeta(r);return{...n,coinType:oe(n.coinType),coinMeta:i}}async getAllBalance(e){let r=await this.globals.suiClient.getAllBalances({owner:e}),n=await Promise.all(r.map(i=>this.getCoinMeta(i.coinType)));return r.map((i,o)=>({...i,coinType:oe(i.coinType),coinMeta:n[o]}))}async getCoinMeta(e){return this.coinMetaHelper.getCoinMeta(e)}async simulateTransactionBlock(e){return this.globals.suiClient.devInspectTransactionBlock({transactionBlock:e,sender:await this.globals.wallet.address()})}validateStreamAmount(e,r){if(e.amountPerStep===0n)throw new Se("Stream amount too small","totalAmount",r);if(e.cliffAmount>e.realTotalAmount)throw new Se("Invalid cliff settings")}validateTimeline(e){if(e.interval.toMillis()<$2)throw new Se("Interval shall be at least 1 second","interval",e.interval)}},Yc=class{constructor(e){this.suiClient=e;this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(e){let r=oe(e||Bt);if(this.coinMetaReg.has(r))return this.coinMetaReg.get(r);let n=await this.queryCoinMeta(r);return n&&this.coinMetaReg.set(r,n),n}async queryCoinMeta(e){return await this.suiClient.getCoinMetadata({coinType:e})||void 0}};var fa=class extends he{constructor(){super(7,"Connected wallet is not creator")}};var Vi=class extends he{constructor(){super(8,"Connected wallet is not recipient")}};var Gi=class extends he{constructor(e,r){super(6,e,{context:r})}};var ze=class extends he{constructor(e,r={}){super(0,e,r)}};var da=class extends he{constructor(e){super(5,"Stream not found",{context:{streamId:e}})}};var Nh=(1n<<64n)-1n,ma=1e3;function Xc(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ma);return te.fromMillis(r*ma)}function Qc(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ma);return ue.fromMillis(r*ma)}var br=class t{constructor(e,r,n){this.globals=e;this.streamId=r;this.rawData=n;this.streamContract=new Mt(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,r){let n=await t.fetchStreamData(e,r);return new t(e,r,n)}static fromObjectData(e,r,n){let i=t.parseRawStreamData(r,n);return new t(e,r,i)}get info(){return{name:this.name,creator:this.creator,coinType:this.coinType,totalAmount:this.totalAmount,start:this.timeStart,end:this.timeEnd,cancelable:this.cancelable,cliffAmount:this.cliff,duration:this.duration,interval:this.interval,steps:this.totalSteps,nextReleaseDate:this.nextReleaseDate,nextReleaseAmount:this.nextReleaseAmount,groupId:this.groupId,streamId:this.streamId,recipient:this.recipient,progress:this.progress,autoClaim:this.autoClaim}}get groupCommonInfo(){return{name:this.name,groupId:this.groupId,creator:this.creator,start:this.timeStart,interval:this.interval,steps:this.totalSteps,cancelable:this.cancelable}}async refresh(){this.rawData=await t.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new ze("Object Id does not align");this.rawData=t.parseRawStreamData(this.streamId,e)}async historyEvents(e){return this.globals.backend.getStreamHistory({streamId:this.streamId,pagination:e})}async cancel(){if(await this.globals.walletAddress()!==this.creator)throw new fa;let e=new be;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Vi;let e=new be;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Vi;let r=new be;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new be;return this.streamContract.claimStreamByProxy(e,{streamId:this.streamId,coinType:this.coinType}),e}get wallet(){return this.globals.wallet}get client(){return this.globals.suiClient}get coinType(){return oe(this.rawData.coinType)}get progress(){return{status:this.streamStatus,total:this.totalAmount,streamed:this.streamedAmount,claimed:this.claimedAmount,claimable:this.claimable,canceled:this.canceledAmount}}get balance(){return this.rawData.balance}get autoClaim(){return this.rawData.autoClaim}get amountPerEpoch(){return this.rawData.config.amountPerEpoch}get cancelable(){return this.rawData.config.cancelable}get cliff(){return this.rawData.config.cliff}get creator(){return this.rawData.config.creator}get interval(){return Qc(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return qi(e).groupId}get name(){let{metadata:e}=this.rawData.config;return qi(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return Xc(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return Qc(r)}get timeEnd(){return this.timeStart.plus(this.duration)}get totalSteps(){return this.rawData.config.totalEpoch}get claimable(){return this.streamedAmount-this.claimedAmount}get nextReleaseDate(){return this.currentEpoch===-1n?this.timeStart:this.currentEpoch>=this.totalSteps||this.isCanceled?null:Xc((this.currentEpoch+1n)*this.rawData.config.epochInterval+this.rawData.config.timeStart)}get nextReleaseAmount(){return this.currentEpoch===-1n?this.cliff:this.currentEpoch>=this.totalSteps||this.isCanceled?null:this.amountPerEpoch}get streamStatus(){let e=this.rawData.status.status;return e===16?"CANCELED":e===17?"SETTLED":e===1?"COMPLETED":this.currentEpoch>=this.totalSteps?"STREAMED":"STREAMING"}get streamedAmount(){return this.currentEpoch===-1n?0n:this.isCanceled?this.rawData.status.epochCanceled*this.amountPerEpoch+this.cliff:this.currentEpoch*this.amountPerEpoch+this.cliff}get claimedAmount(){return this.rawData.status.epochClaimed===Nh?0n:this.rawData.status.epochClaimed*this.amountPerEpoch+this.cliff}get currentEpoch(){let e=te.now().toMillis(),r=this.timeStart.toMillis();if(e<r)return-1n;let n=Math.floor((e-r)/Number(this.rawData.config.epochInterval));return BigInt(n)>Number(this.rawData.config.totalEpoch)?this.rawData.config.totalEpoch:BigInt(n)}get totalAmount(){let e=this.rawData.config;return e.amountPerEpoch*e.totalEpoch+e.cliff}get isCanceled(){let e=this.rawData.status.status;return e===16||e===17}get canceledAmount(){return this.isCanceled?this.totalAmount-this.streamedAmount:0n}static async fetchStreamData(e,r){let n=await e.suiClient.getObject({id:r,options:{showContent:!0,showType:!0}});return t.parseRawStreamData(r,n)}static parseRawStreamData(e,r){if(r.error)throw r.error.code==="notExists"?new da(e):new Gi(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new Gi("Unexpected object type",{gotType:n.dataType});let{typeParams:i}=Hn(n.type),o=oe(i[0]),s=n.fields,a=s.config.fields,c=s.status.fields;return{coinType:o,autoClaim:s.auto_claim,balance:BigInt(s.balance.fields.balance),config:{amountPerEpoch:BigInt(a.amount_per_epoch),cancelable:a.cancelable,cliff:BigInt(a.cliff),creator:a.creator,epochInterval:BigInt(a.epoch_interval),metadata:a.metadata,recipient:a.recipient,timeStart:BigInt(a.time_start),totalEpoch:BigInt(a.total_epoch)},status:{status:c.status,epochCanceled:BigInt(c.epoch_canceled),epochClaimed:BigInt(c.epoch_claimed)}}}};var On=class extends he{constructor(e,r){super(9,`Invalid stream group: ${e}`,{context:r})}};async function Rh(t){let e=[];for(;await t.hasNext();){let r=await t.next();e.push(r)}return e&&Array.isArray(e[0])?e.flat(1):e}var eu=class{constructor(e){this.requester=e;this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},ha=class{constructor(e){this.requester=e;this.pager=new eu(e),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}};var q2=25;async function ru(t,e,r){let n=new Zi(e),i=new Ki(t,n,r);return await Rh(i)}var Zi=class{constructor(e){this.ids=e;this.cursor=-1}cursor;async hasNext(){return this.cursor<this.ids.length-1}async next(){if(this.cursor+=1,this.cursor>=this.ids.length)throw new Error("invalid iterator implementation");return this.ids[this.cursor]}},Ki=class extends ha{constructor(r,n,i){super(new tu(r,n,i));this.suiClient=r;this.idIter=n;this.options=i}},tu=class{constructor(e,r,n){this.suiClient=e;this.stringIter=r;this.options=n;this.filter=n?.filter,this.pageSize=n?.pageSize||q2,this.objectOptions=n?.objectOptions||{showType:!0,showContent:!0}}filter;pageSize;objectOptions;async doNextRequest(){let e=[];for(;e.length<this.pageSize&&await this.stringIter.hasNext();){let o=await this.stringIter.next();o&&e.push(o)}let r=await this.suiClient.multiGetObjects({ids:e,options:this.objectOptions}),n;if(this.filter){let{filter:i}=this;n=r.filter(o=>i?.(o))}else n=r;return{data:n,hasNext:await this.stringIter.hasNext()}}};var pa=class t{constructor(e,r){this.globals=e;this.streams=r;if(r.length===0)throw new On("stream size 0");let n=r.map(o=>o.groupId);if(new Set(n).size!==1)throw new Se("Stream does not have same group ID")}type="StreamGroup";static async new(e,r){let n=await ru(e.suiClient,r);return n.forEach(i=>{if(!i)throw new ze("stream group object data undefined")}),t.newFromObjectResponse(e,r,n)}static async newFromObjectResponse(e,r,n){let i=await t.parseGroupStreams(e,r,n);return new t(e,i)}static checkStreamGroup(e){let r=e.map(o=>o.groupCommonInfo),n=r[0],i=!0;return r.forEach(o=>{V2(n,o)||(i=!1)}),i}async refresh(){let e=await ru(this.globals.suiClient,this.streams.map(r=>r.streamId));this.streams.forEach((r,n)=>{r.refreshWithData(e[n])})}get groupId(){return this.streams[0].groupId}get creator(){return this.streams[0].creator}get info(){return{groupId:this.groupId,streamIds:this.streams.map(e=>e.streamId),progress:this.progress,name:this.streams[0].name,creator:this.creator,coinType:this.streams[0].coinType,totalAmount:this.streams.reduce((e,r)=>e+r.totalAmount,0n),start:this.streams[0].timeStart,end:this.streams[0].timeEnd,cancelable:this.streams[0].cancelable,cliffAmount:this.streams.reduce((e,r)=>e+r.cliff,0n),duration:this.streams[0].duration,interval:this.streams[0].interval,steps:this.streams[0].totalSteps,nextReleaseAmount:this.streams.reduce((e,r)=>r.nextReleaseAmount===null?e:e+r.nextReleaseAmount,0n),nextReleaseDate:this.streams[0].nextReleaseDate}}get progress(){return{total:this.streams.reduce((e,r)=>e+r.totalAmount,0n),streamed:this.streams.reduce((e,r)=>e+r.streamedAmount,0n),claimed:this.streams.reduce((e,r)=>e+r.claimedAmount,0n),claimable:this.streams.reduce((e,r)=>e+r.claimable,0n),canceled:this.streams.reduce((e,r)=>e+r.canceledAmount,0n)}}async historyEvents(e){return this.globals.backend.getStreamHistory({groupId:this.groupId,pagination:e})}static async parseGroupStreams(e,r,n){let i=n.map((o,s)=>br.fromObjectData(e,r[s],o)).filter(o=>!!o);if(new Set(i.map(o=>o.groupId)).size!==1)throw new On("Not same group ID");if(!this.checkStreamGroup(i))throw new On("Not same stream settings");return i}};function V2(t,e){return t.name===e.name&&t.groupId===e.groupId&&t.creator===e.creator&&t.start.toMillis()===e.start.toMillis()&&t.interval.toMillis()===e.interval.toMillis()&&t.steps===e.steps&&t.cancelable===e.cancelable}var Ji=class t{constructor(e,r){this.it=e;this.pageSize=r}static async newIncoming(e){let r=await xa.newIncoming(e);return new t(r,e.pageSize)}static async newOutgoing(e){let r=await xa.newOutgoing(e);return new t(r,e.pageSize)}async hasNext(){return this.it.hasNext()}async next(){let e=[];for(;e.length<this.pageSize&&await this.it.hasNext();)e.push(await this.it.next());return e}},xa=class t{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await ga.newIncomingQuery(e);return new t(r)}static async newOutgoing(e){let r=await ga.newOutgoingQuery(e);return new t(r)}async hasNext(){return this.cachedNext===void 0&&(this.cachedNext=await this.requester.doNextRequest()),this.cachedNext!==null}async next(){if(this.cachedNext===void 0){let r=await this.requester.doNextRequest();if(r===null)throw new ze("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new ze("No more results");return e}},ga=class t{constructor(e,r,n,i){this.globals=e;this.recipient=r;this.groupRefs=n;this.query=i;this.current=0;let o=new Zi(n.flat().map(s=>s.streamId));this.objectIter=new Ki(e.suiClient,o)}current=0;objectIter;static async newIncomingQuery(e){let r=Y2(e.query),n=await e.globals.walletAddress(),o=(await e.globals.backend.getIncomingStreams(n,r)).filter(a=>$(a.recipient)===$(n)),s=Ph(o);return new t(e.globals,n,s,e.query)}static async newOutgoingQuery(e){let r=X2(e.query),n=await e.globals.walletAddress(),i=await e.globals.backend.getOutgoingStreams(n,r),o=Ph(i);return new t(e.globals,n,o,e.query)}async doNextRequest(){if(this.current>=this.groupRefs.length)return null;let e=this.groupRefs[this.current];if(e.length===1){let r=await K2(this.globals,e[0].streamId,this.objectIter);return this.current++,jh(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await J2(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,Z2(r,this.query)?r:this.doNextRequest()}throw new ze("Stream group with no stream")}};function Ph(t){let e=new Map;return t.forEach(r=>{let n=e.get(r.groupId);n?(n.push(r),e.set(r.groupId,n)):e.set(r.groupId,[r])}),Array.from(e.values()).sort((r,n)=>te.fromISO(n[0].createDate).toMillis()-te.fromISO(r[0].createDate).toMillis())}function jh(t,e){if(e===void 0)return!0;let r=G2(t,e.status);if(e&&"claimable"in e&&e.claimable!==void 0){let n=e.claimable?t.progress.claimable!==0n:t.progress.claimable===0n;return r&&n}return r}function G2(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function Z2(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{jh(n,e)&&(r=!0)}),r}async function K2(t,e,r){let n=await Uh(r,e);return br.fromObjectData(t,e,n)}async function J2(t,e,r){let n=[];for(;n.length<e.length;){let i=await Uh(r,e[n.length]);n.push(i)}return pa.newFromObjectResponse(t,e,n)}async function Uh(t,e){if(!await t.hasNext())throw new ze("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new ze("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new ze("stream id not aligned");return r}function Y2(t){return{status:nu(t?.status),coinType:Lh(t?.coinType),sender:zh(t?.sender)}}function X2(t){return{status:nu(t?.status),coinType:Lh(t?.coinType),recipient:zh(t?.recipient)}}function nu(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=nu(r);return!e||e===n?n:"all"},void 0):Q2(t)}function Q2(t){switch(t){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new Se("Unknown stream filtered status")}}function Lh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>oe(e)):void 0:oe(t)}function zh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>$(e)):void 0:$(t)}var iu=class{constructor(e){this.msafe=e}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(e){return this.msafe.requestCoins(e)}},ya=class{globals;helper;constructor(e,r){this.globals=mn.new(e,r),this.helper=new la(this.globals)}connectMSafeAccount(e){let r=new iu(e);this.globals.connectWallet(r)}async createStream(e){return this.builder().createStreams(e)}async getStream(e){return br.new(this.globals,e)}async getIncomingStreams(e,r=10){return Ji.newIncoming({globals:this.globals,query:e,pageSize:r})}async getOutgoingStreams(e,r=10){return Ji.newOutgoing({globals:this.globals,query:e,pageSize:r})}async getCoinTypesForStreamFilter(){let e=await this.wallet.address();return(await this.globals.backend.getAllCoinTypes(e)).map(n=>oe(n))}async getRecipientsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllRecipients(r,e)).map(i=>$(i))}async getCreatorsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllSenders(r,e)).map(i=>$(i))}get wallet(){return this.globals.wallet}builder(){return new Fn(this.globals)}};var ba=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n}=r;return await new ya(n==="sui:mainnet"?"prod":"dev").createStream(this.data)}static fromData(r){return new t(r)}};var Gt=class t{constructor(e,r){this.moveCall=e;this.txb=r}decodeSharedObjectId(e){let r=this.getInputParam(e);return t.getSharedObjectId(r)}decodeOwnedObjectId(e){let r=this.getInputParam(e);return t.getOwnedObjectId(r)}decodeInputU64(e){let r=this.decodePureArg(e,"u64");return BigInt(r)}decodeInputAddress(e){let r=this.decodePureArg(e,"address");return $(r)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,r){let n=this.getInputParam(e);return t.getPureInputValue(n,r)}getInputParam(e){let r=this.moveCall.arguments[e];if(r.kind!=="Input")throw new Error("not input type");return this.txb.blockData.inputs[r.index]}static getPureInputValue(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value=="object"&&"Pure"in e.value){let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}return e.value}static getOwnedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value=="object"){if(!("Object"in e.value)||!("ImmOrOwned"in e.value.Object))throw new Error("not ImmOrOwned");return $(e.value.Object.ImmOrOwned.objectId)}return $(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return $(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return $(e.value.Object.Shared.objectId)}static getPureInput(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value!="object")return e.value;if(!("Pure"in e.value))throw new Error("Pure not in value");let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}typeArg(e){return oe(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}};var wa=class{constructor(e,r){this.globals=e;this.txb=r}decode(){let e=this.decodeCreateStreamInfo(),r=this.createStreamHelper().calculateCreateStreamFees(e),n=this.getCoinMerges();return{type:"CreateStream",info:e,fees:r,coinMerges:n}}decodeCreateStreamInfo(){let r=this.createStreamTransactions().map(n=>this.getCreationInfoFromMoveCall(n));return this.aggregateGroupStreamInfo(r)}createStreamTransactions(){let e=this.transactions.filter(r=>r.kind==="MoveCall"&&yr(r.target,this.contract.createStreamTarget));if(e.length===0)throw new ze("No create stream transactions");return e.map(r=>new Gt(r,this.txb))}getCreationInfoFromMoveCall(e){let r=e.decodeInputString(4),{name:n,groupId:i}=qi(r),o=e.decodeInputAddress(5),s=e.decodeInputU64(6),a=e.decodeInputU64(7),c=e.decodeInputU64(8),l=e.decodeInputU64(9),u=e.decodeInputU64(10),f=e.decodeInputBool(11),d=e.typeArg(0);return{name:n,groupId:i,recipient:o,timeStart:s,cliff:a,epochInterval:c,totalEpoch:l,amountPerEpoch:u,cancelable:f,coinType:d}}aggregateGroupStreamInfo(e){if(new Set(e.map(i=>JSON.stringify({name:i.name,groupId:i.groupId,timeStart:String(i.timeStart),epochInterval:String(i.epochInterval),totalEpoch:String(i.totalEpoch),cancelable:i.cancelable,coinType:i.coinType}))).size!==1)throw new Se("Stream group not have common info");let n=e.map(i=>({address:i.recipient,amountPerStep:i.amountPerEpoch,cliffAmount:i.cliff}));return{name:e[0].name,coinType:e[0].coinType,recipients:n,interval:e[0].epochInterval,steps:e[0].totalEpoch,startTimeMs:e[0].timeStart,cancelable:e[0].cancelable}}getCoinMerges(){let e=this.createStreamTransactions()[0];return this.getCoinMergeForCreateStream(e)}getCoinMergeForCreateStream(e){let r=e.typeArg(0),n=e.txArg(2),i=this.getCoinMergeFromNestedResult(n,r,e);if(r===oe(Bt))return[i];let o=e.txArg(3),s=this.getCoinMergeFromNestedResult(o,oe(Bt),e);return[i,s]}getCoinMergeFromNestedResult(e,r,n){if(e.kind==="GasCoin")return{primary:"GAS",coinType:r};if(e.kind==="Input"){let i=this.getInputArg(e),o=Gt.getOwnedObjectId(i),s=this.transactions.find(a=>{if(a.kind!=="MergeCoins")return!1;if(a.destination.kind!=="Input")throw new Error("merge coin destination not Input type");let c=this.getInputArg(a.destination);return Gt.getOwnedObjectId(c)===o});return s?{primary:o,merged:s.sources.map(a=>{let c=this.getInputArg(a);return Gt.getOwnedObjectId(c)}),coinType:r}:{primary:o,coinType:r}}if(e.kind==="NestedResult"){let i=this.transactions[e.index];if(i.kind!=="SplitCoins")throw new Se(`Transaction type not expected. Expect SplitCoins, got ${i.kind}`);return this.getCoinMergeFromNestedResult(i.coin,r,n)}throw e.kind==="Result"?new Error("Result type not expected for coin inputs"):new Error("Unknown argument kind")}mergeCoinTransactions(){return this.transactions.filter(e=>e.kind==="MergeCoins")}get transactions(){return this.txb.blockData.transactions}get contract(){return new Mt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new In(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Rr(this.globals,this.feeContract,this.contract)}getInputArg(e){if(e.kind!=="Input")throw new Error("not input type");return"value"in e?e:this.txb.blockData.inputs[e.index]}};var Ea=class{constructor(e,r){this.globals=e;this.txb=r;this.contract=new Mt(e.envConfig.contract,e)}contract;decode(){if(this.isCreateStreamTransaction())return this.decodeCreateStreamTransaction();if(this.isClaimByProxyTransaction())return this.decodeClaimByProxyTransaction();if(this.isSetAutoClaimTransaction())return this.decodeSetAutoClaimTransaction();if(this.isCancelStreamTransaction())return this.decodeCancelStreamTransaction();if(this.isClaimStreamTransaction())return this.decodeClaimTransaction()}get transactions(){return this.txb.blockData.transactions}isCreateStreamTransaction(){return this.transactions.findIndex(r=>r.kind==="MoveCall"&&yr(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&yr(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new wa(this.globals,this.txb).decode()}decodeSetAutoClaimTransaction(){let e=this.helper.decodeSharedObjectId(0),r=this.helper.decodeInputBool(1);return{type:"SetAutoClaim",streamId:e,enabled:r}}decodeClaimTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Claim",streamId:e}}decodeClaimByProxyTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"ClaimByProxy",streamId:e}}decodeCancelStreamTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Cancel",streamId:e}}get helper(){let e=this.transactions[0];return new Gt(e,this.txb)}};var Sa=class{application="mpay";async deserialize(e){let{chain:r,transactionBlock:n}=e,i=mn.new(r==="sui:mainnet"?"prod":"dev"),s=new Ea(i,n).decode();if(console.log("\u{1F680} ~ MPayHelper ~ deserialize ~ input:",e,s),s.type==="CreateStream")return{txType:M0.Other,txSubType:ws.Create,intentionData:s.info};throw new Error(`Unknown transaction type: ${s.type}`)}async build(e){let{network:r,intentionData:n,suiClient:i,account:o}=e,s;switch(e.txSubType){case ws.Create:s=ba.fromData(n);break;default:throw new Error("not implemented")}return s.build({network:r,suiClient:i,account:o})}};var va=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Sd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Ca=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return vd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Aa=class t extends Ot{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{account:n}=r,i=be.from(this.data.content);if(!_0(i.blockData.sender,n.address))throw new Error("Invalid sender address");return i}static fromData(r){return new t(r)}};var Ta=class{application;constructor(){this.application=Cd}deserialize(){throw new Error("MSafe core transaction intention should be build from API")}async build(e){let{suiClient:r,account:n}=e,i;switch(e.txSubType){case bs.assets.coin.send:i=va.fromData(e.intentionData);break;case bs.assets.object.send:i=Ca.fromData(e.intentionData);break;case bs.others.plain:i=Aa.fromData(e.intentionData);break;default:throw new Error("not implemented")}return i.build({suiClient:r,account:n})}};var Ba=class{apps;constructor(e){this.apps=new Map(e.map(r=>[r.application,r]))}getAppHelper(e){let r=this.apps.get(e);if(!r)throw new Error(`${e} not registered`);return r}};var tb=new Ba([new Ta,new Sa]);return ap(rb);})();
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
ieee754/index.js:
|