@msafe/sui-app-store 0.0.14 → 0.0.15
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.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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[am]=this[am]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=mi(s);n[a]||(g1(i,s),n[a]=!0)}return v.isArray(e)?e.forEach(o):o(e),this}};mn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(mn.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});v.freezeMethods(mn);var He=mn;function hi(t,e){let r=this||dn,n=e||r,i=He.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 pi(t){return!!(t&&t.__CANCEL__)}function cm(t,e,r){Y.call(this,t??"canceled",Y.ERR_CANCELED,e,r),this.name="CanceledError"}v.inherits(cm,Y,{__CANCEL__:!0});var lr=cm;function i0(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 um=We.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 o0(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function s0(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function xi(t,e){return t&&!o0(e)?s0(t,e):e}var lm=We.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 a0(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function b1(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 fm=b1;function dm(t,e){let r=0,n=fm(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 w1=typeof XMLHttpRequest<"u",mm=w1&&function(t){return new Promise(function(r,n){let i=t.data,o=He.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(We.hasStandardBrowserEnv||We.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((u=o.getContentType())!==!1){let[x,...g]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([x||"multipart/form-data",...g].join("; "))}}let f=new XMLHttpRequest;if(t.auth){let x=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.set("Authorization","Basic "+btoa(x+":"+g))}let d=xi(t.baseURL,t.url);f.open(t.method.toUpperCase(),di(d,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function m(){if(!f)return;let x=He.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};i0(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 g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",p=t.transitional||js;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new Y(g,p.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,t,f)),f=null},We.hasStandardBrowserEnv&&(a&&v.isFunction(a)&&(a=a(t)),a||a!==!1&&lm(d))){let x=t.xsrfHeaderName&&t.xsrfCookieName&&um.read(t.xsrfCookieName);x&&o.set(t.xsrfHeaderName,x)}i===void 0&&o.setContentType(null),"setRequestHeader"in f&&v.forEach(o.toJSON(),function(g,p){f.setRequestHeader(p,g)}),v.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),s&&s!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",dm(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",dm(t.onUploadProgress)),(t.cancelToken||t.signal)&&(c=x=>{f&&(n(!x||x.type?new lr(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=a0(d);if(h&&We.protocols.indexOf(h)===-1){n(new Y("Unsupported protocol "+h+":",Y.ERR_BAD_REQUEST,t));return}f.send(i||null)})};var c0={http:Rs,xhr:mm};v.forEach(c0,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var hm=t=>`- ${t}`,E1=t=>v.isFunction(t)||t===null||t===!1,zs={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,!E1(r)&&(n=c0[(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(hm).join(`
|
|
9
9
|
`):" "+hm(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:c0};function u0(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new lr(null,t)}function Ws(t){return u0(t),t.headers=He.from(t.headers),t.data=hi.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),zs.getAdapter(t.adapter||dn.adapter)(t).then(function(n){return u0(t),n.data=hi.call(t,t.transformResponse,n),n.headers=He.from(n.headers),n},function(n){return pi(n)||(u0(t),n&&n.response&&(n.response.data=hi.call(t,t.transformResponse,n.response),n.response.headers=He.from(n.response.headers))),Promise.reject(n)})}var pm=t=>t instanceof He?t.toJSON():t;function $t(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(pm(l),pm(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 Hs="1.6.7";var l0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{l0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var xm={};l0.transitional=function(e,r,n){function i(o,s){return"[Axios v"+Hs+"] 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&&!xm[s]&&(xm[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 S1(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 $s={assertOptions:S1,validators:l0};var fr=$s.validators,hn=class{constructor(e){this.defaults=e,this.interceptors={request:new Qc,response:new Qc}}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=$t(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&$s.assertOptions(n,{silentJSONParsing:fr.transitional(fr.boolean),forcedJSONParsing:fr.transitional(fr.boolean),clarifyTimeoutError:fr.transitional(fr.boolean)},!1),i!=null&&(v.isFunction(i)?r.paramsSerializer={serialize:i}:$s.assertOptions(i,{encode:fr.function,serialize:fr.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=He.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=[Ws.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(g){x.call(this,g);break}}try{u=Ws.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=$t(this.defaults,e);let r=xi(e.baseURL,e.url);return di(r,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){hn.prototype[e]=function(r,n){return this.request($t(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($t(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}hn.prototype[e]=r(),hn.prototype[e+"Form"]=r(!0)});var yi=hn;var f0=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 lr(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}}},ym=f0;function d0(t){return function(r){return t.apply(null,r)}}function m0(t){return v.isObject(t)&&t.isAxiosError===!0}var h0={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(h0).forEach(([t,e])=>{h0[e]=t});var gm=h0;function bm(t){let e=new yi(t),r=ui(yi.prototype.request,e);return v.extend(r,yi.prototype,e,{allOwnKeys:!0}),v.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return bm($t(t,i))},r}var we=bm(dn);we.Axios=yi;we.CanceledError=lr;we.CancelToken=ym;we.isCancel=pi;we.VERSION=Hs;we.toFormData=ur;we.AxiosError=Y;we.Cancel=we.CanceledError;we.all=function(e){return Promise.all(e)};we.spread=d0;we.isAxiosError=m0;we.mergeConfig=$t;we.AxiosHeaders=He;we.formToJSON=t=>Us(v.isHTMLForm(t)?new FormData(t):t);we.getAdapter=zs.getAdapter;we.HttpStatusCode=gm;we.default=we;var qt=we;var{Axios:y8,AxiosError:wm,CanceledError:g8,isCancel:b8,CancelToken:w8,VERSION:E8,all:S8,Cancel:v8,isAxiosError:C8,spread:T8,toFormData:A8,AxiosHeaders:B8,HttpStatusCode:D8,formToJSON:I8,getAdapter:F8,mergeConfig:O8}=qt;var pn=class extends pe{constructor(e,r){super(10,e,{context:r})}};var qs=class t{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof wm)throw new pn(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new pn(e.data.code)}throw new pn(e.status.toString())}async getIncomingStreams(e,r){let n=await qt.post(`${this.apiURL}/stream`,{recipient:e,...r});return t.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await qt.post(`${this.apiURL}/stream`,{sender:e,...r});return t.parseResponseData(n)}async getStreamHistory(e){let r=await qt.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 qt.post(`${this.apiURL}/stream-info`,{address:e});return t.parseResponseData(r)}async getAllRecipients(e,r){let n=await qt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return t.parseResponseData(n)}async getAllSenders(e,r){let n=await qt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return t.parseResponseData(n)}};var xn=class t{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Is({url:e.rpc.url}),e.backend&&(this._backend=new qs(e.backend.url))}static new(e,r){let n=kd(e,r);return new t(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Fs;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 Os;return this.signer}async walletAddress(){return this.wallet.address()}};var Vt=class extends Error{},Vs=class extends Vt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Gs=class extends Vt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Zs=class extends Vt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Tt=class extends Vt{},yn=class extends Vt{constructor(e){super(`Invalid unit ${e}`)}},Ee=class extends Vt{},At=class extends Vt{constructor(){super("Zone is an abstract class")}};var j="numeric",Bt="short",Qe="long",dr={year:j,month:j,day:j},gi={year:j,month:Bt,day:j},p0={year:j,month:Bt,day:j,weekday:Bt},bi={year:j,month:Qe,day:j},wi={year:j,month:Qe,day:j,weekday:Qe},Ei={hour:j,minute:j},Si={hour:j,minute:j,second:j},vi={hour:j,minute:j,second:j,timeZoneName:Bt},Ci={hour:j,minute:j,second:j,timeZoneName:Qe},Ti={hour:j,minute:j,hourCycle:"h23"},Ai={hour:j,minute:j,second:j,hourCycle:"h23"},Bi={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Bt},Di={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Qe},Ii={year:j,month:j,day:j,hour:j,minute:j},Fi={year:j,month:j,day:j,hour:j,minute:j,second:j},Oi={year:j,month:Bt,day:j,hour:j,minute:j},ki={year:j,month:Bt,day:j,hour:j,minute:j,second:j},x0={year:j,month:Bt,day:j,weekday:Bt,hour:j,minute:j},_i={year:j,month:Qe,day:j,hour:j,minute:j,timeZoneName:Bt},Mi={year:j,month:Qe,day:j,hour:j,minute:j,second:j,timeZoneName:Bt},Ni={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,timeZoneName:Qe},Ri={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,second:j,timeZoneName:Qe};var Ze=class{get type(){throw new At}get name(){throw new At}get ianaName(){return this.name}get isUniversal(){throw new At}offsetName(e,r){throw new At}formatOffset(e,r){throw new At}offset(e){throw new At}equals(e){throw new At}get isValid(){throw new At}};var y0=null,mr=class t extends Ze{static get instance(){return y0===null&&(y0=new t),y0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Js(e,r,n)}formatOffset(e,r){return hr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Xs={};function v1(t){return Xs[t]||(Xs[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"})),Xs[t]}var C1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function T1(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 A1(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=C1[o];o==="era"?n[a]=s:H(a)||(n[a]=parseInt(s,10))}return n}var Ys={},Pe=class t extends Ze{static create(e){return Ys[e]||(Ys[e]=new t(e)),Ys[e]}static resetCache(){Ys={},Xs={}}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 Js(e,r,n,this.name)}formatOffset(e,r){return hr(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=v1(this.name),[i,o,s,a,c,l,u]=n.formatToParts?A1(n,r):T1(n,r);a==="BC"&&(i=-Math.abs(i)+1);let d=gn({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 Em={};function B1(t,e={}){let r=JSON.stringify([t,e]),n=Em[r];return n||(n=new Intl.ListFormat(t,e),Em[r]=n),n}var g0={};function b0(t,e={}){let r=JSON.stringify([t,e]),n=g0[r];return n||(n=new Intl.DateTimeFormat(t,e),g0[r]=n),n}var w0={};function D1(t,e={}){let r=JSON.stringify([t,e]),n=w0[r];return n||(n=new Intl.NumberFormat(t,e),w0[r]=n),n}var E0={};function I1(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=E0[i];return o||(o=new Intl.RelativeTimeFormat(t,e),E0[i]=o),o}var Pi=null;function F1(){return Pi||(Pi=new Intl.DateTimeFormat().resolvedOptions().locale,Pi)}var Sm={};function O1(t){let e=Sm[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Sm[t]=e}return e}function k1(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=b0(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=b0(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function _1(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function M1(t){let e=[];for(let r=1;r<=12;r++){let n=te.utc(2009,r,1);e.push(t(n))}return e}function N1(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 Qs(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function R1(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 S0=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=D1(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):bn(e,3);return ge(r,this.padTo)}}},v0=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&&Pe.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=b0(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()}},C0=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&ea()&&(this.rtf=I1(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):vm(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},P1={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":F1()),c=r||ne.defaultNumberingSystem,l=n||ne.defaultOutputCalendar,u=ji(i)||ne.defaultWeekSettings;return new t(a,c,l,u,s)}static resetCache(){Pi=null,g0={},w0={},E0={}}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]=k1(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=_1(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=R1(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,ji(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 Qs(this,e,T0,()=>{let n=r?{month:e,day:"numeric"}:{month:e},i=r?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=M1(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,r=!1){return Qs(this,e,A0,()=>{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]=N1(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Qs(this,void 0,()=>B0,()=>{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 Qs(this,e,D0,()=>{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 S0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new v0(e,this.intl,r)}relFormatter(e={}){return new C0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return B1(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:ta()?O1(this.locale):P1}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 F0=null,Ie=class t extends Ze{static get utcInstance(){return F0===null&&(F0=new t(0)),F0}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(Mr(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${hr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${hr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return hr(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 wn=class extends Ze{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 Dt(t,e){let r;if(H(t)||t===null)return e;if(t instanceof Ze)return t;if(Cm(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?mr.instance:n==="utc"||n==="gmt"?Ie.utcInstance:Ie.parseSpecifier(n)||Pe.create(t)}else return Mt(t)?Ie.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new wn(t)}var Tm=()=>Date.now(),Am="system",Bm=null,Dm=null,Im=null,Fm=60,Om,km=null,ne=class{static get now(){return Tm}static set now(e){Tm=e}static set defaultZone(e){Am=e}static get defaultZone(){return Dt(Am,mr.instance)}static get defaultLocale(){return Bm}static set defaultLocale(e){Bm=e}static get defaultNumberingSystem(){return Dm}static set defaultNumberingSystem(e){Dm=e}static get defaultOutputCalendar(){return Im}static set defaultOutputCalendar(e){Im=e}static get defaultWeekSettings(){return km}static set defaultWeekSettings(e){km=ji(e)}static get twoDigitCutoffYear(){return Fm}static set twoDigitCutoffYear(e){Fm=e%100}static get throwOnInvalid(){return Om}static set throwOnInvalid(e){Om=e}static resetCaches(){se.resetCache(),Pe.resetCache()}};var Fe=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var _m=[0,31,59,90,120,151,181,212,243,273,304,334],Mm=[0,31,60,91,121,152,182,213,244,274,305,335];function lt(t,e){return new Fe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function ra(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 Nm(t,e,r){return r+(Rr(t)?Mm:_m)[e-1]}function Rm(t,e){let r=Rr(t)?Mm:_m,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function na(t,e){return(t-e+7)%7+1}function Ui(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=Nm(n,i,o),a=na(ra(n,i,o),r),c=Math.floor((s-a+14-e)/7),l;return c<1?(l=n-1,c=Nr(l,e,r)):c>Nr(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...zi(t)}}function O0(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=na(ra(n,1,e),r),a=pr(n),c=i*7+o-s-7+e,l;c<1?(l=n-1,c+=pr(l)):c>a?(l=n+1,c-=pr(n)):l=n;let{month:u,day:f}=Rm(l,c);return{year:l,month:u,day:f,...zi(t)}}function ia(t){let{year:e,month:r,day:n}=t,i=Nm(e,r,n);return{year:e,ordinal:i,...zi(t)}}function k0(t){let{year:e,ordinal:r}=t,{month:n,day:i}=Rm(e,r);return{year:e,month:n,day:i,...zi(t)}}function _0(t,e){if(!H(t.localWeekday)||!H(t.localWeekNumber)||!H(t.localWeekYear)){if(!H(t.weekday)||!H(t.weekNumber)||!H(t.weekYear))throw new Tt("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 Pm(t,e=4,r=1){let n=Li(t.weekYear),i=et(t.weekNumber,1,Nr(t.weekYear,e,r)),o=et(t.weekday,1,7);return n?i?o?!1:lt("weekday",t.weekday):lt("week",t.weekNumber):lt("weekYear",t.weekYear)}function jm(t){let e=Li(t.year),r=et(t.ordinal,1,pr(t.year));return e?r?!1:lt("ordinal",t.ordinal):lt("year",t.year)}function M0(t){let e=Li(t.year),r=et(t.month,1,12),n=et(t.day,1,En(t.year,t.month));return e?r?n?!1:lt("day",t.day):lt("month",t.month):lt("year",t.year)}function N0(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=et(e,0,23)||e===24&&r===0&&n===0&&i===0,s=et(r,0,59),a=et(n,0,59),c=et(i,0,999);return o?s?a?c?!1:lt("millisecond",i):lt("second",n):lt("minute",r):lt("hour",e)}function H(t){return typeof t>"u"}function Mt(t){return typeof t=="number"}function Li(t){return typeof t=="number"&&t%1===0}function Cm(t){return typeof t=="string"}function Lm(t){return Object.prototype.toString.call(t)==="[object Date]"}function ea(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ta(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function zm(t){return Array.isArray(t)?t:[t]}function R0(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 Wm(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function xr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ji(t){if(t==null)return null;if(typeof t!="object")throw new Ee("Week settings must be an object");if(!et(t.firstDay,1,7)||!et(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!et(e,1,7)))throw new Ee("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function et(t,e,r){return Li(t)&&t>=e&&t<=r}function j1(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 Gt(t){if(!(H(t)||t===null||t===""))return parseInt(t,10)}function yr(t){if(!(H(t)||t===null||t===""))return parseFloat(t)}function Wi(t){if(!(H(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function bn(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function Rr(t){return t%4===0&&(t%100!==0||t%400===0)}function pr(t){return Rr(t)?366:365}function En(t,e){let r=j1(e-1,12)+1,n=t+(e-r)/12;return r===2?Rr(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function gn(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 Um(t,e,r){return-na(ra(t,1,e),r)+e-1}function Nr(t,e=4,r=1){let n=Um(t,e,r),i=Um(t+1,e,r);return(pr(t)-n+i)/7}function Hi(t){return t>99?t:t>ne.twoDigitCutoffYear?1900+t:2e3+t}function Js(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 Mr(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 P0(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ee(`Invalid unit value ${t}`);return e}function Sn(t,e){let r={};for(let n in t)if(xr(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=P0(i)}return r}function hr(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 zi(t){return Wm(t,["hour","minute","second","millisecond"])}var U1=["January","February","March","April","May","June","July","August","September","October","November","December"],j0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],L1=["J","F","M","A","M","J","J","A","S","O","N","D"];function T0(t){switch(t){case"narrow":return[...L1];case"short":return[...j0];case"long":return[...U1];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 U0=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],L0=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],z1=["M","T","W","T","F","S","S"];function A0(t){switch(t){case"narrow":return[...z1];case"short":return[...L0];case"long":return[...U0];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var B0=["AM","PM"],W1=["Before Christ","Anno Domini"],H1=["BC","AD"],$1=["B","A"];function D0(t){switch(t){case"narrow":return[...$1];case"short":return[...H1];case"long":return[...W1];default:return null}}function Hm(t){return B0[t.hour<12?0:1]}function $m(t,e){return A0(e)[t.weekday-1]}function qm(t,e){return T0(e)[t.month-1]}function Vm(t,e){return D0(e)[t.year<0?0:1]}function vm(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 Gm(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var q1={D:dr,DD:gi,DDD:bi,DDDD:wi,t:Ei,tt:Si,ttt:vi,tttt:Ci,T:Ti,TT:Ai,TTT:Bi,TTTT:Di,f:Ii,ff:Oi,fff:_i,ffff:Ni,F:Fi,FF:ki,FFF:Mi,FFFF:Ri},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 q1[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?Hm(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,h)=>n?qm(e,m):o(h?{month:m}:{month:m,day:"numeric"},"month"),l=(m,h)=>n?$m(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?Vm(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 Gm(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 Gm(o,i(a))}};var Km=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Cn(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Tn(...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 An(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 Jm(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=Gt(e[r+i]);return[n,null,r+i]}}var Ym=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,V1=`(?:${Ym.source}?(?:\\[(${Km.source})\\])?)?`,z0=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Xm=RegExp(`${z0.source}${V1}`),W0=RegExp(`(?:T${Xm.source})?`),G1=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Z1=/(\d{4})-?W(\d\d)(?:-?(\d))?/,K1=/(\d{4})-?(\d{3})/,J1=Jm("weekYear","weekNumber","weekDay"),Y1=Jm("year","ordinal"),X1=/(\d{4})-(\d\d)-(\d\d)/,Qm=RegExp(`${z0.source} ?(?:${Ym.source}|(${Km.source}))?`),Q1=RegExp(`(?: ${Qm.source})?`);function vn(t,e,r){let n=t[e];return H(n)?r:Gt(n)}function eb(t,e){return[{year:vn(t,e),month:vn(t,e+1,1),day:vn(t,e+2,1)},null,e+3]}function Bn(t,e){return[{hours:vn(t,e,0),minutes:vn(t,e+1,0),seconds:vn(t,e+2,0),milliseconds:Wi(t[e+3])},null,e+4]}function $i(t,e){let r=!t[e]&&!t[e+1],n=Mr(t[e+1],t[e+2]),i=r?null:Ie.instance(n);return[{},i,e+3]}function qi(t,e){let r=t[e]?Pe.create(t[e]):null;return[{},r,e+1]}var tb=RegExp(`^T?${z0.source}$`),rb=/^-?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 nb(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(yr(r)),months:d(yr(n)),weeks:d(yr(i)),days:d(yr(o)),hours:d(yr(s)),minutes:d(yr(a)),seconds:d(yr(c),c==="-0"),milliseconds:d(Wi(l),f)}]}var ib={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 H0(t,e,r,n,i,o,s){let a={year:e.length===2?Hi(Gt(e)):Gt(e),month:j0.indexOf(r)+1,day:Gt(n),hour:Gt(i),minute:Gt(o)};return s&&(a.second=Gt(s)),t&&(a.weekday=t.length>3?U0.indexOf(t)+1:L0.indexOf(t)+1),a}var ob=/^(?:(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 sb(t){let[,e,r,n,i,o,s,a,c,l,u,f]=t,d=H0(e,i,n,r,o,s,a),m;return c?m=ib[c]:l?m=0:m=Mr(u,f),[d,new Ie(m)]}function ab(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var cb=/^(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$/,ub=/^(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$/,lb=/^(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 Zm(t){let[,e,r,n,i,o,s,a]=t;return[H0(e,i,n,r,o,s,a),Ie.utcInstance]}function fb(t){let[,e,r,n,i,o,s,a]=t;return[H0(e,a,r,n,i,o,s),Ie.utcInstance]}var db=Cn(G1,W0),mb=Cn(Z1,W0),hb=Cn(K1,W0),pb=Cn(Xm),eh=Tn(eb,Bn,$i,qi),xb=Tn(J1,Bn,$i,qi),yb=Tn(Y1,Bn,$i,qi),gb=Tn(Bn,$i,qi);function th(t){return An(t,[db,eh],[mb,xb],[hb,yb],[pb,gb])}function rh(t){return An(ab(t),[ob,sb])}function nh(t){return An(t,[cb,Zm],[ub,Zm],[lb,fb])}function ih(t){return An(t,[rb,nb])}var bb=Tn(Bn);function oh(t){return An(t,[tb,bb])}var wb=Cn(X1,Q1),Eb=Cn(Qm),Sb=Tn(Bn,$i,qi);function sh(t){return An(t,[wb,eh],[Eb,Sb])}var ah="Invalid Duration",uh={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}},vb={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},...uh},ft=146097/400,Dn=146097/4800,Cb={years:{quarters:4,months:12,weeks:ft/7,days:ft,hours:ft*24,minutes:ft*24*60,seconds:ft*24*60*60,milliseconds:ft*24*60*60*1e3},quarters:{months:3,weeks:ft/28,days:ft/4,hours:ft*24/4,minutes:ft*24*60/4,seconds:ft*24*60*60/4,milliseconds:ft*24*60*60*1e3/4},months:{weeks:Dn/7,days:Dn,hours:Dn*24,minutes:Dn*24*60,seconds:Dn*24*60*60,milliseconds:Dn*24*60*60*1e3},...uh},Pr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Tb=Pr.slice(0).reverse();function gr(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 le(n)}function lh(t,e){let r=e.milliseconds??0;for(let n of Tb.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function ch(t,e){let r=lh(t,e)<0?-1:1;Pr.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),Pr.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 Ab(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var le=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?Cb:vb;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:Sn(e,t.normalizeUnit),loc:se.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Mt(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]=ih(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]=oh(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 Zs(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 yn(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):ah}toHuman(e={}){if(!this.isValid)return ah;let r=Pr.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+=bn(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?lh(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 Pr)(xr(r.values,i)||xr(this.values,i))&&(n[i]=r.get(i)+this.get(i));return gr(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]=P0(e(this.values[n],n));return gr(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Sn(e,t.normalizeUnit)};return gr(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 gr(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ch(this.matrix,e),gr(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Ab(this.normalize().shiftToAll().toObject());return gr(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 Pr)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;Mt(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else Mt(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 ch(this.matrix,r),gr(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 gr(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 Pr)if(!r(this.values[n],e.values[n]))return!1;return!0}};var In="Invalid Interval";function Bb(t,e){return!t||!t.isValid?Zt.invalid("missing or invalid start"):!e||!e.isValid?Zt.invalid("missing or invalid end"):e<t?Zt.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 Zt=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 Gs(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Fn(e),i=Fn(r),o=Bb(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=le.fromDurationLike(r),i=Fn(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=le.fromDurationLike(r),i=Fn(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=le.fromISO(i,r);if(l.isValid)return t.after(o,l)}else if(c){let l=le.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(Fn).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=le.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()})`:In}[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=dr,r={}){return this.isValid?Oe.create(this.s.loc.clone(r),e).formatInterval(this):In}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:In}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:In}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:In}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:In}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):le.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Kt=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 Pe.isValidZone(e)}static normalizeZone(e){return Dt(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:ea(),localeWeek:ta()}}};function fh(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(le.fromMillis(n).as("days"))}function Db(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=fh(c,l);return(u-u%7)/7}],["days",fh]],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 dh(t,e,r,n){let[i,o,s,a]=Db(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=le.fromObject(o,n);return l.length>0?le.fromMillis(c,n).shiftTo(...l).plus(u):u}var $0={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"},mh={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]},Ib=$0.hanidec.replace(/[\[|\]]/g,"").split("");function hh(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($0.hanidec)!==-1)e+=Ib.indexOf(t[r]);else for(let i in mh){let[o,s]=mh[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function dt({numberingSystem:t},e=""){return new RegExp(`${$0[t||"latn"]}${e}`)}var Fb="missing Intl.DateTimeFormat.formatToParts support";function ie(t,e=r=>r){return{regex:t,deser:([r])=>e(hh(r))}}var Ob="\xA0",yh=`[ ${Ob}]`,gh=new RegExp(yh,"g");function kb(t){return t.replace(/\./g,"\\.?").replace(gh,yh)}function ph(t){return t.replace(/\./g,"").replace(gh," ").toLowerCase()}function It(t,e){return t===null?null:{regex:RegExp(t.map(kb).join("|")),deser:([r])=>t.findIndex(n=>ph(r)===ph(n))+e}}function xh(t,e){return{regex:t,deser:([,r,n])=>Mr(r,n),groups:e}}function oa(t){return{regex:t,deser:([e])=>e}}function _b(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Mb(t,e){let r=dt(e),n=dt(e,"{2}"),i=dt(e,"{3}"),o=dt(e,"{4}"),s=dt(e,"{6}"),a=dt(e,"{1,2}"),c=dt(e,"{1,3}"),l=dt(e,"{1,6}"),u=dt(e,"{1,9}"),f=dt(e,"{2,4}"),d=dt(e,"{4,6}"),m=g=>({regex:RegExp(_b(g.val)),deser:([p])=>p,literal:!0}),x=(g=>{if(t.literal)return m(g);switch(g.val){case"G":return It(e.eras("short"),0);case"GG":return It(e.eras("long"),0);case"y":return ie(l);case"yy":return ie(f,Hi);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 It(e.months("short",!0),1);case"MMMM":return It(e.months("long",!0),1);case"L":return ie(a);case"LL":return ie(n);case"LLL":return It(e.months("short",!1),1);case"LLLL":return It(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 oa(u);case"uu":return oa(a);case"uuu":return ie(r);case"a":return It(e.meridiems(),0);case"kkkk":return ie(o);case"kk":return ie(f,Hi);case"W":return ie(a);case"WW":return ie(n);case"E":case"c":return ie(r);case"EEE":return It(e.weekdays("short",!1),1);case"EEEE":return It(e.weekdays("long",!1),1);case"ccc":return It(e.weekdays("short",!0),1);case"cccc":return It(e.weekdays("long",!0),1);case"Z":case"ZZ":return xh(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return xh(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return oa(/[a-z_+-/]{1,256}?/i);case" ":return oa(/[^\S\n\r]/);default:return m(g)}})(t)||{invalidReason:Fb};return x.token=t,x}var Nb={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 Rb(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=Nb[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function Pb(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function jb(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(xr(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 Ub(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=Pe.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=Wi(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var q0=null;function Lb(){return q0||(q0=te.fromMillis(1555555555555)),q0}function zb(t,e){if(t.literal)return t;let r=Oe.macroTokenToFormatOpts(t.val),n=Z0(r,e);return n==null||n.includes(void 0)?t:n}function V0(t,e){return Array.prototype.concat(...t.map(r=>zb(r,e)))}function G0(t,e,r){let n=V0(Oe.parseFormat(r),t),i=n.map(s=>Mb(s,t)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=Pb(i),c=RegExp(s,"i"),[l,u]=jb(e,c,a),[f,d,m]=u?Ub(u):[null,null,void 0];if(xr(u,"a")&&xr(u,"H"))throw new Tt("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 bh(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=G0(t,e,r);return[n,i,o,s]}function Z0(t,e){if(!t)return null;let n=Oe.create(e,t).dtFormatter(Lb()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>Rb(s,t,o))}var K0="Invalid DateTime",wh=864e13;function sa(t){return new Fe("unsupported zone",`the zone "${t.name}" is not supported`)}function J0(t){return t.weekData===null&&(t.weekData=Ui(t.c)),t.weekData}function Y0(t){return t.localWeekData===null&&(t.localWeekData=Ui(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function jr(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 Bh(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 aa(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 ua(t,e,r){return Bh(gn(t),e,r)}function Eh(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,En(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=le.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=gn(o),[c,l]=Bh(a,r,t.zone);return s!==0&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function Vi(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 ca(t,e,r=!0){return t.isValid?Oe.create(se.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function X0(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 Sh(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 Dh={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Wb={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Hb={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ih=["year","month","day","hour","minute","second","millisecond"],$b=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],qb=["year","ordinal","hour","minute","second","millisecond"];function Vb(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 yn(t);return e}function vh(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Vb(t)}}function Ch(t,e){let r=Dt(e.zone,ne.defaultZone),n=se.fromObject(e),i=ne.now(),o,s;if(H(t.year))o=i;else{for(let l of Ih)H(t[l])&&(t[l]=Dh[l]);let a=M0(t)||N0(t);if(a)return te.invalid(a);let c=r.offset(i);[o,s]=ua(t,c,r)}return new te({ts:o,zone:r,loc:n,o:s})}function Th(t,e,r){let n=H(r.round)?!0:r.round,i=(s,a)=>(s=bn(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 Ah(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:sa(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=aa(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]=Ah(arguments),[n,i,o,s,a,c,l]=r;return Ch({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static utc(){let[e,r]=Ah(arguments),[n,i,o,s,a,c,l]=r;return e.zone=Ie.utcInstance,Ch({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=Lm(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=Dt(r.zone,ne.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:se.fromObject(r)}):t.invalid(sa(i))}static fromMillis(e,r={}){if(Mt(e))return e<-wh||e>wh?t.invalid("Timestamp out of range"):new t({ts:e,zone:Dt(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(Mt(e))return new t({ts:e*1e3,zone:Dt(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Ee("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Dt(r.zone,ne.defaultZone);if(!n.isValid)return t.invalid(sa(n));let i=se.fromObject(r),o=Sn(e,vh),{minDaysInFirstWeek:s,startOfWeek:a}=_0(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 Tt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new Tt("Can't mix ordinal dates with month/day");let x=h||o.weekday&&!m,g,p,y=aa(c,l);x?(g=$b,p=Wb,y=Ui(y,s,a)):u?(g=qb,p=Hb,y=ia(y)):(g=Ih,p=Dh);let b=!1;for(let L of g){let A=o[L];H(A)?b?o[L]=p[L]:o[L]=y[L]:b=!0}let w=x?Pm(o,s,a):u?jm(o):M0(o),E=w||N0(o);if(E)return t.invalid(E);let S=x?O0(o,s,a):u?k0(o):o,[O,I]=ua(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]=th(e);return Vi(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=rh(e);return Vi(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=nh(e);return Vi(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]=bh(s,e,r);return u?t.invalid(u):Vi(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]=sh(e);return Vi(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 Vs(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Z0(e,se.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return V0(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?J0(this).weekYear:NaN}get weekNumber(){return this.isValid?J0(this).weekNumber:NaN}get weekday(){return this.isValid?J0(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Y0(this).weekday:NaN}get localWeekNumber(){return this.isValid?Y0(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Y0(this).weekYear:NaN}get ordinal(){return this.isValid?ia(this.c).ordinal:NaN}get monthShort(){return this.isValid?Kt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Kt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Kt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Kt.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=gn(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=aa(c,s),f=aa(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[jr(this,{ts:c}),jr(this,{ts:l})]:[this]}get isInLeapYear(){return Rr(this.year)}get daysInMonth(){return En(this.year,this.month)}get daysInYear(){return this.isValid?pr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Nr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Nr(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=Dt(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]=ua(s,o,e)}return jr(this,{ts:i,zone:e})}else return t.invalid(sa(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return jr(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Sn(e,vh),{minDaysInFirstWeek:n,startOfWeek:i}=_0(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 Tt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Tt("Can't mix ordinal dates with month/day");let f;o?f=O0({...Ui(this.c,n,i),...r},n,i):H(r.ordinal)?(f={...this.toObject(),...r},H(r.day)&&(f.day=Math.min(En(f.year,f.month),f.day))):f=k0({...ia(this.c),...r});let[d,m]=ua(f,this.o,this.zone);return jr(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e);return jr(this,Eh(this,r))}minus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e).negate();return jr(this,Eh(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=le.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):K0}toLocaleString(e=dr,r={}){return this.isValid?Oe.create(this.loc.clone(r),e).formatDateTime(this):K0}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=X0(this,s);return a+="T",a+=Sh(this,s,r,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?X0(this,e==="extended"):null}toISOWeekDate(){return ca(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":"")+Sh(this,s==="extended",r,e,n,o):null}toRFC2822(){return ca(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ca(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?X0(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")),ca(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():K0}[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 le.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=zm(r).map(le.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,l=dh(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?Zt.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),Th(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?Th(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 R0(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ee("max requires all arguments be DateTimes");return R0(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 G0(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return dr}static get DATE_MED(){return gi}static get DATE_MED_WITH_WEEKDAY(){return p0}static get DATE_FULL(){return bi}static get DATE_HUGE(){return wi}static get TIME_SIMPLE(){return Ei}static get TIME_WITH_SECONDS(){return Si}static get TIME_WITH_SHORT_OFFSET(){return vi}static get TIME_WITH_LONG_OFFSET(){return Ci}static get TIME_24_SIMPLE(){return Ti}static get TIME_24_WITH_SECONDS(){return Ai}static get TIME_24_WITH_SHORT_OFFSET(){return Bi}static get TIME_24_WITH_LONG_OFFSET(){return Di}static get DATETIME_SHORT(){return Ii}static get DATETIME_SHORT_WITH_SECONDS(){return Fi}static get DATETIME_MED(){return Oi}static get DATETIME_MED_WITH_SECONDS(){return ki}static get DATETIME_MED_WITH_WEEKDAY(){return x0}static get DATETIME_FULL(){return _i}static get DATETIME_FULL_WITH_SECONDS(){return Mi}static get DATETIME_HUGE(){return Ni}static get DATETIME_HUGE_WITH_SECONDS(){return Ri}};function Fn(t){if(te.isDateTime(t))return t;if(t&&t.valueOf&&Mt(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 Q0=50n,la=10000n,Fh=25n,eu=100000000n;var Nt=class{constructor(e){this.object=e}moveArg(e){return e.object(this.object)}},Gi=class{constructor(e){this.objects=e}moveArgs(e){return e.makeMoveVec({objects:this.objects.map(r=>e.object(r))})}},br=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 Zi=class extends pe{constructor(e,r){super(3,e,{context:r})}};var fa=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 Zi("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 Zi("Invalid contract return type.",{ctx:{expectType:"u64",gotType:i}});return Buffer.from(n).readBigInt64LE()}};var Se=class extends pe{constructor(e,r,n){super(2,`Invalid input: ${e}`,{context:{fieldKey:r,fieldValue:n}})}};var kh={groupId:"string",name:"string"},Gb=64;function _h(t){return Mh(t),ae.ser(kh,t).toString("base64")}function Ki(t){let e=ae.de(kh,t,"base64");return Mh(e),e}function Mh(t){if(!Oh(t.name))throw new Se("Invalid metadata: Name contains unknown character");if(!Oh(t.groupId))throw new Se("Invalid metadata: Group ID contains unknown character");if(t.name.length>Gb)throw new Se("Invalid metadata: Name exceed max length 64")}function Oh(t){return/^[\x00-\x7F]+$/.test(t)}function Nh(t,e){return oe(t)===oe(e)}function wr(t,e){return oe(t)===oe(e)}var Rh="txn.gas";function Ph(){return"nanoid()"}var Ur=class t{constructor(e,r,n){this.globals=e;this.feeContract=r;this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:_h({name:e.name,groupId:Ph()}),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 ue,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 br(d),flatFeeCoin:new br(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:Q0,denominator:la},claimFeePercent:{numerator:Fh,denominator:la},flatFeePerStream:eu}}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===Rh?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return Nh(n,Ft)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:Ft,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 eu}getStreamFeeLocal(e){return e*Q0/la}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new ue,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new fa(n).getU64()}get wallet(){return this.globals.wallet}};var jh="0x0000000000000000000000000000000000000000000000000000000000000006";var On=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(at.MoveCall({target:n,arguments:r.arguments.map(i=>i instanceof Gi?i.moveArgs(e):i instanceof Nt?i.moveArg(e):i instanceof br?i.moveArg():e.pure(i)),typeArguments:r.typeArgs})),e}addTransactionBlock(e,r,n=[],i=[]){e.add(at.MoveCall({target:r,arguments:n.map(o=>o instanceof Gi?o.moveArgs(e):o instanceof Nt?o.moveArg(e):o instanceof br?o.moveArg():e.pure(o)),typeArguments:i}))}makeObject(e){return typeof e=="string"?new Nt(e):e}vaultObject(){return new Nt(this.config.vaultObjId)}roleObject(){return new Nt(this.config.roleObjId)}feeObject(){return new Nt(this.config.feeObjId)}clockObject(){return new Nt(jh)}};var kn=class t extends On{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 Rt=class t extends On{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 _n=class{constructor(e){this.globals=e;let r=e.envConfig.contract;this.feeContract=new kn(r,e),this.streamContract=new Rt(r,e)}feeContract;streamContract;async createStreams(e){let r=Ur.convertCreateStreamInfoToInternal(e);return this.createStreamHelper().buildCreateStreamTransactionBlock(r)}createStreamHelper(){return new Ur(this.globals,this.feeContract,this.streamContract)}setAutoClaim(e,r,n){let i=new ue;return this.streamContract.setAutoClaim(i,{streamId:e,enabled:r,coinType:n})}claimStream(e,r){let n=new ue;return this.streamContract.claimStream(n,{streamId:e,coinType:r})}claimStreamByProxy(e,r){let n=new ue;return this.streamContract.claimStreamByProxy(n,{streamId:e,coinType:r})}cancelStream(e,r){let n=new ue;return this.streamContract.cancelStream(n,{streamId:e,coinType:r}),n}};var da=class extends pe{constructor(e,r){super(12,`Transaction failed: ${r}`,{context:{status:e,msg:r}})}};var Zb=1e3,ma=class{constructor(e){this.globals=e;this.coinMetaHelper=new tu(e.suiClient),this.createStreamHelper=new _n(e).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(e){if(e.effects?.status.status!=="success")throw new da(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(le.fromMillis(Number(r*e.steps))),i={timeStart:e.timeStart,timeEnd:n,interval:le.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()<Zb)throw new Se("Interval shall be at least 1 second","interval",e.interval)}},tu=class{constructor(e){this.suiClient=e;this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(e){let r=oe(e||Ft);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 ha=class extends pe{constructor(){super(7,"Connected wallet is not creator")}};var Ji=class extends pe{constructor(){super(8,"Connected wallet is not recipient")}};var Yi=class extends pe{constructor(e,r){super(6,e,{context:r})}};var $e=class extends pe{constructor(e,r={}){super(0,e,r)}};var pa=class extends pe{constructor(e){super(5,"Stream not found",{context:{streamId:e}})}};var Uh=(1n<<64n)-1n,xa=1e3;function ru(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/xa);return te.fromMillis(r*xa)}function nu(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/xa);return le.fromMillis(r*xa)}var Er=class t{constructor(e,r,n){this.globals=e;this.streamId=r;this.rawData=n;this.streamContract=new Rt(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 $e("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 ha;let e=new ue;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Ji;let e=new ue;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Ji;let r=new ue;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new ue;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 nu(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return Ki(e).groupId}get name(){let{metadata:e}=this.rawData.config;return Ki(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return ru(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return nu(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:ru((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===Uh?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 pa(e):new Yi(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new Yi("Unexpected object type",{gotType:n.dataType});let{typeParams:i}=Vn(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 Mn=class extends pe{constructor(e,r){super(9,`Invalid stream group: ${e}`,{context:r})}};async function Lh(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 iu=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)}},ya=class{constructor(e){this.requester=e;this.pager=new iu(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 Kb=25;async function su(t,e,r){let n=new Xi(e),i=new Qi(t,n,r);return await Lh(i)}var Xi=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]}},Qi=class extends ya{constructor(r,n,i){super(new ou(r,n,i));this.suiClient=r;this.idIter=n;this.options=i}},ou=class{constructor(e,r,n){this.suiClient=e;this.stringIter=r;this.options=n;this.filter=n?.filter,this.pageSize=n?.pageSize||Kb,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 ga=class t{constructor(e,r){this.globals=e;this.streams=r;if(r.length===0)throw new Mn("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 su(e.suiClient,r);return n.forEach(i=>{if(!i)throw new $e("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=>{Jb(n,o)||(i=!1)}),i}async refresh(){let e=await su(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)=>Er.fromObjectData(e,r[s],o)).filter(o=>!!o);if(new Set(i.map(o=>o.groupId)).size!==1)throw new Mn("Not same group ID");if(!this.checkStreamGroup(i))throw new Mn("Not same stream settings");return i}};function Jb(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 eo=class t{constructor(e,r){this.it=e;this.pageSize=r}static async newIncoming(e){let r=await ba.newIncoming(e);return new t(r,e.pageSize)}static async newOutgoing(e){let r=await ba.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}},ba=class t{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await wa.newIncomingQuery(e);return new t(r)}static async newOutgoing(e){let r=await wa.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 $e("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new $e("No more results");return e}},wa=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 Xi(n.flat().map(s=>s.streamId));this.objectIter=new Qi(e.suiClient,o)}current=0;objectIter;static async newIncomingQuery(e){let r=t2(e.query),n=await e.globals.walletAddress(),o=(await e.globals.backend.getIncomingStreams(n,r)).filter(a=>$(a.recipient)===$(n)),s=zh(o);return new t(e.globals,n,s,e.query)}static async newOutgoingQuery(e){let r=r2(e.query),n=await e.globals.walletAddress(),i=await e.globals.backend.getOutgoingStreams(n,r),o=zh(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 Qb(this.globals,e[0].streamId,this.objectIter);return this.current++,Wh(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await e2(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,Xb(r,this.query)?r:this.doNextRequest()}throw new $e("Stream group with no stream")}};function zh(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 Wh(t,e){if(e===void 0)return!0;let r=Yb(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 Yb(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function Xb(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{Wh(n,e)&&(r=!0)}),r}async function Qb(t,e,r){let n=await Hh(r,e);return Er.fromObjectData(t,e,n)}async function e2(t,e,r){let n=[];for(;n.length<e.length;){let i=await Hh(r,e[n.length]);n.push(i)}return ga.newFromObjectResponse(t,e,n)}async function Hh(t,e){if(!await t.hasNext())throw new $e("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new $e("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new $e("stream id not aligned");return r}function t2(t){return{status:au(t?.status),coinType:$h(t?.coinType),sender:qh(t?.sender)}}function r2(t){return{status:au(t?.status),coinType:$h(t?.coinType),recipient:qh(t?.recipient)}}function au(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=au(r);return!e||e===n?n:"all"},void 0):n2(t)}function n2(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 $h(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>oe(e)):void 0:oe(t)}function qh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>$(e)):void 0:$(t)}var cu=class{constructor(e){this.msafe=e}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(e){return this.msafe.requestCoins(e)}},Ea=class{globals;helper;constructor(e,r){this.globals=xn.new(e,r),this.helper=new ma(this.globals)}connectMSafeAccount(e){let r=new cu(e);this.globals.connectWallet(r)}async createStream(e){return this.builder().createStreams(e)}async getStream(e){return Er.new(this.globals,e)}async getIncomingStreams(e,r=10){return eo.newIncoming({globals:this.globals,query:e,pageSize:r})}async getOutgoingStreams(e,r=10){return eo.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 _n(this.globals)}};var Sa=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n}=r;return await new Ea(n==="sui:mainnet"?"prod":"dev").createStream(this.data)}static fromData(r){return new t(r)}};var Jt=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 va=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"&&wr(r.target,this.contract.createStreamTarget));if(e.length===0)throw new $e("No create stream transactions");return e.map(r=>new Jt(r,this.txb))}getCreationInfoFromMoveCall(e){let r=e.decodeInputString(4),{name:n,groupId:i}=Ki(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(Ft))return[i];let o=e.txArg(3),s=this.getCoinMergeFromNestedResult(o,oe(Ft),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=Jt.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 Jt.getOwnedObjectId(c)===o});return s?{primary:o,merged:s.sources.map(a=>{let c=this.getInputArg(a);return Jt.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 Rt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new kn(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Ur(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 Ca=class{constructor(e,r){this.globals=e;this.txb=r;this.contract=new Rt(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"&&wr(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new va(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 Jt(e,this.txb)}};var Ta=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(){return new ue}static fromData(r){return new t(r)}};var Aa=class{application="mpay";async deserialize(e){let{chain:r,transactionBlock:n}=e,i=xn.new(r==="sui:mainnet"?"prod":"dev"),s=new Ca(i,n).decode();if(console.log("\u{1F680} ~ MPayHelper ~ deserialize ~ input:",e,s),s.type==="CreateStream")return{txType:Wt.Other,txSubType:St.Create,intentionData:s.info};if(s.type==="Claim")return{txType:Wt.Other,txSubType:St.Claim,intentionData:{streamId:s.streamId}};if(s.type==="ClaimByProxy")return{txType:Wt.Other,txSubType:St.SetAutoClaim,intentionData:{streamId:s.streamId}};if(s.type==="SetAutoClaim")return{txType:Wt.Other,txSubType:St.SetAutoClaim,intentionData:{streamId:s.streamId,enabled:s.enabled}};if(s.type==="Cancel")return{txType:Wt.Other,txSubType:St.Cancel,intentionData:{streamId:s.streamId}};throw new Error(`Unknown transaction type: ${s}`)}async build(e){let{network:r,intentionData:n,suiClient:i,account:o}=e,s;switch(e.txSubType){case St.Create:s=Sa.fromData(n);break;case St.Claim:s=vs.fromData(n);break;case St.SetAutoClaim:s=Ta.fromData(n);break;case St.Cancel:s=Ss.fromData(n);break;default:throw new Error("not implemented")}return s.build({network:r,suiClient:i,account:o})}};var Ba=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Ad(n,this.data,i.address)}static fromData(r){return new t(r)}};var Da=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Bd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Ia=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{account:n}=r,i=ue.from(this.data.content);if(!jc(i.blockData.sender,n.address))throw new Error("Invalid sender address");return i}static fromData(r){return new t(r)}};var Fa=class{application;constructor(){this.application=Dd}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 sn.assets.coin.send:i=Ba.fromData(e.intentionData);break;case sn.assets.object.send:i=Da.fromData(e.intentionData);break;case sn.others.plain:i=Ia.fromData(e.intentionData);break;default:throw new Error("not implemented")}return i.build({suiClient:r,account:n})}};var Oa=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 o2=Sr(ii()),s2="msafe-plain-tx",a2=sn.others.plain;var ka=class{application;constructor(){this.application=s2}async deserialize(e){let{transactionBlock:r,suiClient:n}=e,i=await r.build({client:n});return{txType:Wt.Other,txSubType:a2,intentionData:{content:Ue(i)}}}async build(e){return ue.from(yt(e.intentionData.content))}};var c2=new Oa([new Fa,new Aa,new ka]);return fp(u2);})();
|
|
10
|
+
`+o):n.stack=o}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=$t(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&$s.assertOptions(n,{silentJSONParsing:fr.transitional(fr.boolean),forcedJSONParsing:fr.transitional(fr.boolean),clarifyTimeoutError:fr.transitional(fr.boolean)},!1),i!=null&&(v.isFunction(i)?r.paramsSerializer={serialize:i}:$s.assertOptions(i,{encode:fr.function,serialize:fr.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=He.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=[Ws.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(g){x.call(this,g);break}}try{u=Ws.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=$t(this.defaults,e);let r=xi(e.baseURL,e.url);return di(r,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){hn.prototype[e]=function(r,n){return this.request($t(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($t(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}hn.prototype[e]=r(),hn.prototype[e+"Form"]=r(!0)});var yi=hn;var f0=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 lr(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}}},ym=f0;function d0(t){return function(r){return t.apply(null,r)}}function m0(t){return v.isObject(t)&&t.isAxiosError===!0}var h0={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(h0).forEach(([t,e])=>{h0[e]=t});var gm=h0;function bm(t){let e=new yi(t),r=ui(yi.prototype.request,e);return v.extend(r,yi.prototype,e,{allOwnKeys:!0}),v.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return bm($t(t,i))},r}var we=bm(dn);we.Axios=yi;we.CanceledError=lr;we.CancelToken=ym;we.isCancel=pi;we.VERSION=Hs;we.toFormData=ur;we.AxiosError=Y;we.Cancel=we.CanceledError;we.all=function(e){return Promise.all(e)};we.spread=d0;we.isAxiosError=m0;we.mergeConfig=$t;we.AxiosHeaders=He;we.formToJSON=t=>Us(v.isHTMLForm(t)?new FormData(t):t);we.getAdapter=zs.getAdapter;we.HttpStatusCode=gm;we.default=we;var qt=we;var{Axios:y8,AxiosError:wm,CanceledError:g8,isCancel:b8,CancelToken:w8,VERSION:E8,all:S8,Cancel:v8,isAxiosError:C8,spread:T8,toFormData:A8,AxiosHeaders:B8,HttpStatusCode:D8,formToJSON:I8,getAdapter:F8,mergeConfig:O8}=qt;var pn=class extends pe{constructor(e,r){super(10,e,{context:r})}};var qs=class t{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof wm)throw new pn(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new pn(e.data.code)}throw new pn(e.status.toString())}async getIncomingStreams(e,r){let n=await qt.post(`${this.apiURL}/stream`,{recipient:e,...r});return t.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await qt.post(`${this.apiURL}/stream`,{sender:e,...r});return t.parseResponseData(n)}async getStreamHistory(e){let r=await qt.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 qt.post(`${this.apiURL}/stream-info`,{address:e});return t.parseResponseData(r)}async getAllRecipients(e,r){let n=await qt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return t.parseResponseData(n)}async getAllSenders(e,r){let n=await qt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return t.parseResponseData(n)}};var xn=class t{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Is({url:e.rpc.url}),e.backend&&(this._backend=new qs(e.backend.url))}static new(e,r){let n=kd(e,r);return new t(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Fs;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 Os;return this.signer}async walletAddress(){return this.wallet.address()}};var Vt=class extends Error{},Vs=class extends Vt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Gs=class extends Vt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Zs=class extends Vt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Tt=class extends Vt{},yn=class extends Vt{constructor(e){super(`Invalid unit ${e}`)}},Ee=class extends Vt{},At=class extends Vt{constructor(){super("Zone is an abstract class")}};var j="numeric",Bt="short",Qe="long",dr={year:j,month:j,day:j},gi={year:j,month:Bt,day:j},p0={year:j,month:Bt,day:j,weekday:Bt},bi={year:j,month:Qe,day:j},wi={year:j,month:Qe,day:j,weekday:Qe},Ei={hour:j,minute:j},Si={hour:j,minute:j,second:j},vi={hour:j,minute:j,second:j,timeZoneName:Bt},Ci={hour:j,minute:j,second:j,timeZoneName:Qe},Ti={hour:j,minute:j,hourCycle:"h23"},Ai={hour:j,minute:j,second:j,hourCycle:"h23"},Bi={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Bt},Di={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Qe},Ii={year:j,month:j,day:j,hour:j,minute:j},Fi={year:j,month:j,day:j,hour:j,minute:j,second:j},Oi={year:j,month:Bt,day:j,hour:j,minute:j},ki={year:j,month:Bt,day:j,hour:j,minute:j,second:j},x0={year:j,month:Bt,day:j,weekday:Bt,hour:j,minute:j},_i={year:j,month:Qe,day:j,hour:j,minute:j,timeZoneName:Bt},Mi={year:j,month:Qe,day:j,hour:j,minute:j,second:j,timeZoneName:Bt},Ni={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,timeZoneName:Qe},Ri={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,second:j,timeZoneName:Qe};var Ze=class{get type(){throw new At}get name(){throw new At}get ianaName(){return this.name}get isUniversal(){throw new At}offsetName(e,r){throw new At}formatOffset(e,r){throw new At}offset(e){throw new At}equals(e){throw new At}get isValid(){throw new At}};var y0=null,mr=class t extends Ze{static get instance(){return y0===null&&(y0=new t),y0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Js(e,r,n)}formatOffset(e,r){return hr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Xs={};function v1(t){return Xs[t]||(Xs[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"})),Xs[t]}var C1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function T1(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 A1(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=C1[o];o==="era"?n[a]=s:H(a)||(n[a]=parseInt(s,10))}return n}var Ys={},Pe=class t extends Ze{static create(e){return Ys[e]||(Ys[e]=new t(e)),Ys[e]}static resetCache(){Ys={},Xs={}}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 Js(e,r,n,this.name)}formatOffset(e,r){return hr(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=v1(this.name),[i,o,s,a,c,l,u]=n.formatToParts?A1(n,r):T1(n,r);a==="BC"&&(i=-Math.abs(i)+1);let d=gn({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 Em={};function B1(t,e={}){let r=JSON.stringify([t,e]),n=Em[r];return n||(n=new Intl.ListFormat(t,e),Em[r]=n),n}var g0={};function b0(t,e={}){let r=JSON.stringify([t,e]),n=g0[r];return n||(n=new Intl.DateTimeFormat(t,e),g0[r]=n),n}var w0={};function D1(t,e={}){let r=JSON.stringify([t,e]),n=w0[r];return n||(n=new Intl.NumberFormat(t,e),w0[r]=n),n}var E0={};function I1(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=E0[i];return o||(o=new Intl.RelativeTimeFormat(t,e),E0[i]=o),o}var Pi=null;function F1(){return Pi||(Pi=new Intl.DateTimeFormat().resolvedOptions().locale,Pi)}var Sm={};function O1(t){let e=Sm[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Sm[t]=e}return e}function k1(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=b0(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=b0(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function _1(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function M1(t){let e=[];for(let r=1;r<=12;r++){let n=te.utc(2009,r,1);e.push(t(n))}return e}function N1(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 Qs(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function R1(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 S0=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=D1(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):bn(e,3);return ge(r,this.padTo)}}},v0=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&&Pe.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=b0(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()}},C0=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&ea()&&(this.rtf=I1(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):vm(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},P1={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":F1()),c=r||ne.defaultNumberingSystem,l=n||ne.defaultOutputCalendar,u=ji(i)||ne.defaultWeekSettings;return new t(a,c,l,u,s)}static resetCache(){Pi=null,g0={},w0={},E0={}}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]=k1(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=_1(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=R1(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,ji(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 Qs(this,e,T0,()=>{let n=r?{month:e,day:"numeric"}:{month:e},i=r?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=M1(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,r=!1){return Qs(this,e,A0,()=>{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]=N1(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Qs(this,void 0,()=>B0,()=>{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 Qs(this,e,D0,()=>{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 S0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new v0(e,this.intl,r)}relFormatter(e={}){return new C0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return B1(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:ta()?O1(this.locale):P1}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 F0=null,Ie=class t extends Ze{static get utcInstance(){return F0===null&&(F0=new t(0)),F0}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(Mr(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${hr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${hr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return hr(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 wn=class extends Ze{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 Dt(t,e){let r;if(H(t)||t===null)return e;if(t instanceof Ze)return t;if(Cm(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?mr.instance:n==="utc"||n==="gmt"?Ie.utcInstance:Ie.parseSpecifier(n)||Pe.create(t)}else return Mt(t)?Ie.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new wn(t)}var Tm=()=>Date.now(),Am="system",Bm=null,Dm=null,Im=null,Fm=60,Om,km=null,ne=class{static get now(){return Tm}static set now(e){Tm=e}static set defaultZone(e){Am=e}static get defaultZone(){return Dt(Am,mr.instance)}static get defaultLocale(){return Bm}static set defaultLocale(e){Bm=e}static get defaultNumberingSystem(){return Dm}static set defaultNumberingSystem(e){Dm=e}static get defaultOutputCalendar(){return Im}static set defaultOutputCalendar(e){Im=e}static get defaultWeekSettings(){return km}static set defaultWeekSettings(e){km=ji(e)}static get twoDigitCutoffYear(){return Fm}static set twoDigitCutoffYear(e){Fm=e%100}static get throwOnInvalid(){return Om}static set throwOnInvalid(e){Om=e}static resetCaches(){se.resetCache(),Pe.resetCache()}};var Fe=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var _m=[0,31,59,90,120,151,181,212,243,273,304,334],Mm=[0,31,60,91,121,152,182,213,244,274,305,335];function lt(t,e){return new Fe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function ra(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 Nm(t,e,r){return r+(Rr(t)?Mm:_m)[e-1]}function Rm(t,e){let r=Rr(t)?Mm:_m,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function na(t,e){return(t-e+7)%7+1}function Ui(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=Nm(n,i,o),a=na(ra(n,i,o),r),c=Math.floor((s-a+14-e)/7),l;return c<1?(l=n-1,c=Nr(l,e,r)):c>Nr(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...zi(t)}}function O0(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=na(ra(n,1,e),r),a=pr(n),c=i*7+o-s-7+e,l;c<1?(l=n-1,c+=pr(l)):c>a?(l=n+1,c-=pr(n)):l=n;let{month:u,day:f}=Rm(l,c);return{year:l,month:u,day:f,...zi(t)}}function ia(t){let{year:e,month:r,day:n}=t,i=Nm(e,r,n);return{year:e,ordinal:i,...zi(t)}}function k0(t){let{year:e,ordinal:r}=t,{month:n,day:i}=Rm(e,r);return{year:e,month:n,day:i,...zi(t)}}function _0(t,e){if(!H(t.localWeekday)||!H(t.localWeekNumber)||!H(t.localWeekYear)){if(!H(t.weekday)||!H(t.weekNumber)||!H(t.weekYear))throw new Tt("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 Pm(t,e=4,r=1){let n=Li(t.weekYear),i=et(t.weekNumber,1,Nr(t.weekYear,e,r)),o=et(t.weekday,1,7);return n?i?o?!1:lt("weekday",t.weekday):lt("week",t.weekNumber):lt("weekYear",t.weekYear)}function jm(t){let e=Li(t.year),r=et(t.ordinal,1,pr(t.year));return e?r?!1:lt("ordinal",t.ordinal):lt("year",t.year)}function M0(t){let e=Li(t.year),r=et(t.month,1,12),n=et(t.day,1,En(t.year,t.month));return e?r?n?!1:lt("day",t.day):lt("month",t.month):lt("year",t.year)}function N0(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=et(e,0,23)||e===24&&r===0&&n===0&&i===0,s=et(r,0,59),a=et(n,0,59),c=et(i,0,999);return o?s?a?c?!1:lt("millisecond",i):lt("second",n):lt("minute",r):lt("hour",e)}function H(t){return typeof t>"u"}function Mt(t){return typeof t=="number"}function Li(t){return typeof t=="number"&&t%1===0}function Cm(t){return typeof t=="string"}function Lm(t){return Object.prototype.toString.call(t)==="[object Date]"}function ea(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ta(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function zm(t){return Array.isArray(t)?t:[t]}function R0(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 Wm(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function xr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ji(t){if(t==null)return null;if(typeof t!="object")throw new Ee("Week settings must be an object");if(!et(t.firstDay,1,7)||!et(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!et(e,1,7)))throw new Ee("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function et(t,e,r){return Li(t)&&t>=e&&t<=r}function j1(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 Gt(t){if(!(H(t)||t===null||t===""))return parseInt(t,10)}function yr(t){if(!(H(t)||t===null||t===""))return parseFloat(t)}function Wi(t){if(!(H(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function bn(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function Rr(t){return t%4===0&&(t%100!==0||t%400===0)}function pr(t){return Rr(t)?366:365}function En(t,e){let r=j1(e-1,12)+1,n=t+(e-r)/12;return r===2?Rr(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function gn(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 Um(t,e,r){return-na(ra(t,1,e),r)+e-1}function Nr(t,e=4,r=1){let n=Um(t,e,r),i=Um(t+1,e,r);return(pr(t)-n+i)/7}function Hi(t){return t>99?t:t>ne.twoDigitCutoffYear?1900+t:2e3+t}function Js(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 Mr(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 P0(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ee(`Invalid unit value ${t}`);return e}function Sn(t,e){let r={};for(let n in t)if(xr(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=P0(i)}return r}function hr(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 zi(t){return Wm(t,["hour","minute","second","millisecond"])}var U1=["January","February","March","April","May","June","July","August","September","October","November","December"],j0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],L1=["J","F","M","A","M","J","J","A","S","O","N","D"];function T0(t){switch(t){case"narrow":return[...L1];case"short":return[...j0];case"long":return[...U1];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 U0=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],L0=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],z1=["M","T","W","T","F","S","S"];function A0(t){switch(t){case"narrow":return[...z1];case"short":return[...L0];case"long":return[...U0];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var B0=["AM","PM"],W1=["Before Christ","Anno Domini"],H1=["BC","AD"],$1=["B","A"];function D0(t){switch(t){case"narrow":return[...$1];case"short":return[...H1];case"long":return[...W1];default:return null}}function Hm(t){return B0[t.hour<12?0:1]}function $m(t,e){return A0(e)[t.weekday-1]}function qm(t,e){return T0(e)[t.month-1]}function Vm(t,e){return D0(e)[t.year<0?0:1]}function vm(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 Gm(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var q1={D:dr,DD:gi,DDD:bi,DDDD:wi,t:Ei,tt:Si,ttt:vi,tttt:Ci,T:Ti,TT:Ai,TTT:Bi,TTTT:Di,f:Ii,ff:Oi,fff:_i,ffff:Ni,F:Fi,FF:ki,FFF:Mi,FFFF:Ri},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 q1[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?Hm(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,h)=>n?qm(e,m):o(h?{month:m}:{month:m,day:"numeric"},"month"),l=(m,h)=>n?$m(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?Vm(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 Gm(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 Gm(o,i(a))}};var Km=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Cn(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Tn(...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 An(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 Jm(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=Gt(e[r+i]);return[n,null,r+i]}}var Ym=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,V1=`(?:${Ym.source}?(?:\\[(${Km.source})\\])?)?`,z0=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Xm=RegExp(`${z0.source}${V1}`),W0=RegExp(`(?:T${Xm.source})?`),G1=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Z1=/(\d{4})-?W(\d\d)(?:-?(\d))?/,K1=/(\d{4})-?(\d{3})/,J1=Jm("weekYear","weekNumber","weekDay"),Y1=Jm("year","ordinal"),X1=/(\d{4})-(\d\d)-(\d\d)/,Qm=RegExp(`${z0.source} ?(?:${Ym.source}|(${Km.source}))?`),Q1=RegExp(`(?: ${Qm.source})?`);function vn(t,e,r){let n=t[e];return H(n)?r:Gt(n)}function eb(t,e){return[{year:vn(t,e),month:vn(t,e+1,1),day:vn(t,e+2,1)},null,e+3]}function Bn(t,e){return[{hours:vn(t,e,0),minutes:vn(t,e+1,0),seconds:vn(t,e+2,0),milliseconds:Wi(t[e+3])},null,e+4]}function $i(t,e){let r=!t[e]&&!t[e+1],n=Mr(t[e+1],t[e+2]),i=r?null:Ie.instance(n);return[{},i,e+3]}function qi(t,e){let r=t[e]?Pe.create(t[e]):null;return[{},r,e+1]}var tb=RegExp(`^T?${z0.source}$`),rb=/^-?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 nb(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(yr(r)),months:d(yr(n)),weeks:d(yr(i)),days:d(yr(o)),hours:d(yr(s)),minutes:d(yr(a)),seconds:d(yr(c),c==="-0"),milliseconds:d(Wi(l),f)}]}var ib={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 H0(t,e,r,n,i,o,s){let a={year:e.length===2?Hi(Gt(e)):Gt(e),month:j0.indexOf(r)+1,day:Gt(n),hour:Gt(i),minute:Gt(o)};return s&&(a.second=Gt(s)),t&&(a.weekday=t.length>3?U0.indexOf(t)+1:L0.indexOf(t)+1),a}var ob=/^(?:(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 sb(t){let[,e,r,n,i,o,s,a,c,l,u,f]=t,d=H0(e,i,n,r,o,s,a),m;return c?m=ib[c]:l?m=0:m=Mr(u,f),[d,new Ie(m)]}function ab(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var cb=/^(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$/,ub=/^(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$/,lb=/^(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 Zm(t){let[,e,r,n,i,o,s,a]=t;return[H0(e,i,n,r,o,s,a),Ie.utcInstance]}function fb(t){let[,e,r,n,i,o,s,a]=t;return[H0(e,a,r,n,i,o,s),Ie.utcInstance]}var db=Cn(G1,W0),mb=Cn(Z1,W0),hb=Cn(K1,W0),pb=Cn(Xm),eh=Tn(eb,Bn,$i,qi),xb=Tn(J1,Bn,$i,qi),yb=Tn(Y1,Bn,$i,qi),gb=Tn(Bn,$i,qi);function th(t){return An(t,[db,eh],[mb,xb],[hb,yb],[pb,gb])}function rh(t){return An(ab(t),[ob,sb])}function nh(t){return An(t,[cb,Zm],[ub,Zm],[lb,fb])}function ih(t){return An(t,[rb,nb])}var bb=Tn(Bn);function oh(t){return An(t,[tb,bb])}var wb=Cn(X1,Q1),Eb=Cn(Qm),Sb=Tn(Bn,$i,qi);function sh(t){return An(t,[wb,eh],[Eb,Sb])}var ah="Invalid Duration",uh={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}},vb={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},...uh},ft=146097/400,Dn=146097/4800,Cb={years:{quarters:4,months:12,weeks:ft/7,days:ft,hours:ft*24,minutes:ft*24*60,seconds:ft*24*60*60,milliseconds:ft*24*60*60*1e3},quarters:{months:3,weeks:ft/28,days:ft/4,hours:ft*24/4,minutes:ft*24*60/4,seconds:ft*24*60*60/4,milliseconds:ft*24*60*60*1e3/4},months:{weeks:Dn/7,days:Dn,hours:Dn*24,minutes:Dn*24*60,seconds:Dn*24*60*60,milliseconds:Dn*24*60*60*1e3},...uh},Pr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Tb=Pr.slice(0).reverse();function gr(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 le(n)}function lh(t,e){let r=e.milliseconds??0;for(let n of Tb.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function ch(t,e){let r=lh(t,e)<0?-1:1;Pr.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),Pr.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 Ab(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var le=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?Cb:vb;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:Sn(e,t.normalizeUnit),loc:se.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Mt(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]=ih(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]=oh(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 Zs(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 yn(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):ah}toHuman(e={}){if(!this.isValid)return ah;let r=Pr.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+=bn(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?lh(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 Pr)(xr(r.values,i)||xr(this.values,i))&&(n[i]=r.get(i)+this.get(i));return gr(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]=P0(e(this.values[n],n));return gr(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Sn(e,t.normalizeUnit)};return gr(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 gr(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ch(this.matrix,e),gr(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Ab(this.normalize().shiftToAll().toObject());return gr(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 Pr)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;Mt(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else Mt(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 ch(this.matrix,r),gr(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 gr(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 Pr)if(!r(this.values[n],e.values[n]))return!1;return!0}};var In="Invalid Interval";function Bb(t,e){return!t||!t.isValid?Zt.invalid("missing or invalid start"):!e||!e.isValid?Zt.invalid("missing or invalid end"):e<t?Zt.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 Zt=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 Gs(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Fn(e),i=Fn(r),o=Bb(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=le.fromDurationLike(r),i=Fn(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=le.fromDurationLike(r),i=Fn(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=le.fromISO(i,r);if(l.isValid)return t.after(o,l)}else if(c){let l=le.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(Fn).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=le.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()})`:In}[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=dr,r={}){return this.isValid?Oe.create(this.s.loc.clone(r),e).formatInterval(this):In}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:In}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:In}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:In}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:In}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):le.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Kt=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 Pe.isValidZone(e)}static normalizeZone(e){return Dt(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:ea(),localeWeek:ta()}}};function fh(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(le.fromMillis(n).as("days"))}function Db(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=fh(c,l);return(u-u%7)/7}],["days",fh]],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 dh(t,e,r,n){let[i,o,s,a]=Db(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=le.fromObject(o,n);return l.length>0?le.fromMillis(c,n).shiftTo(...l).plus(u):u}var $0={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"},mh={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]},Ib=$0.hanidec.replace(/[\[|\]]/g,"").split("");function hh(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($0.hanidec)!==-1)e+=Ib.indexOf(t[r]);else for(let i in mh){let[o,s]=mh[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function dt({numberingSystem:t},e=""){return new RegExp(`${$0[t||"latn"]}${e}`)}var Fb="missing Intl.DateTimeFormat.formatToParts support";function ie(t,e=r=>r){return{regex:t,deser:([r])=>e(hh(r))}}var Ob="\xA0",yh=`[ ${Ob}]`,gh=new RegExp(yh,"g");function kb(t){return t.replace(/\./g,"\\.?").replace(gh,yh)}function ph(t){return t.replace(/\./g,"").replace(gh," ").toLowerCase()}function It(t,e){return t===null?null:{regex:RegExp(t.map(kb).join("|")),deser:([r])=>t.findIndex(n=>ph(r)===ph(n))+e}}function xh(t,e){return{regex:t,deser:([,r,n])=>Mr(r,n),groups:e}}function oa(t){return{regex:t,deser:([e])=>e}}function _b(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Mb(t,e){let r=dt(e),n=dt(e,"{2}"),i=dt(e,"{3}"),o=dt(e,"{4}"),s=dt(e,"{6}"),a=dt(e,"{1,2}"),c=dt(e,"{1,3}"),l=dt(e,"{1,6}"),u=dt(e,"{1,9}"),f=dt(e,"{2,4}"),d=dt(e,"{4,6}"),m=g=>({regex:RegExp(_b(g.val)),deser:([p])=>p,literal:!0}),x=(g=>{if(t.literal)return m(g);switch(g.val){case"G":return It(e.eras("short"),0);case"GG":return It(e.eras("long"),0);case"y":return ie(l);case"yy":return ie(f,Hi);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 It(e.months("short",!0),1);case"MMMM":return It(e.months("long",!0),1);case"L":return ie(a);case"LL":return ie(n);case"LLL":return It(e.months("short",!1),1);case"LLLL":return It(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 oa(u);case"uu":return oa(a);case"uuu":return ie(r);case"a":return It(e.meridiems(),0);case"kkkk":return ie(o);case"kk":return ie(f,Hi);case"W":return ie(a);case"WW":return ie(n);case"E":case"c":return ie(r);case"EEE":return It(e.weekdays("short",!1),1);case"EEEE":return It(e.weekdays("long",!1),1);case"ccc":return It(e.weekdays("short",!0),1);case"cccc":return It(e.weekdays("long",!0),1);case"Z":case"ZZ":return xh(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return xh(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return oa(/[a-z_+-/]{1,256}?/i);case" ":return oa(/[^\S\n\r]/);default:return m(g)}})(t)||{invalidReason:Fb};return x.token=t,x}var Nb={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 Rb(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=Nb[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function Pb(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function jb(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(xr(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 Ub(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=Pe.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=Wi(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var q0=null;function Lb(){return q0||(q0=te.fromMillis(1555555555555)),q0}function zb(t,e){if(t.literal)return t;let r=Oe.macroTokenToFormatOpts(t.val),n=Z0(r,e);return n==null||n.includes(void 0)?t:n}function V0(t,e){return Array.prototype.concat(...t.map(r=>zb(r,e)))}function G0(t,e,r){let n=V0(Oe.parseFormat(r),t),i=n.map(s=>Mb(s,t)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=Pb(i),c=RegExp(s,"i"),[l,u]=jb(e,c,a),[f,d,m]=u?Ub(u):[null,null,void 0];if(xr(u,"a")&&xr(u,"H"))throw new Tt("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 bh(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=G0(t,e,r);return[n,i,o,s]}function Z0(t,e){if(!t)return null;let n=Oe.create(e,t).dtFormatter(Lb()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>Rb(s,t,o))}var K0="Invalid DateTime",wh=864e13;function sa(t){return new Fe("unsupported zone",`the zone "${t.name}" is not supported`)}function J0(t){return t.weekData===null&&(t.weekData=Ui(t.c)),t.weekData}function Y0(t){return t.localWeekData===null&&(t.localWeekData=Ui(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function jr(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 Bh(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 aa(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 ua(t,e,r){return Bh(gn(t),e,r)}function Eh(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,En(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=le.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=gn(o),[c,l]=Bh(a,r,t.zone);return s!==0&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function Vi(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 ca(t,e,r=!0){return t.isValid?Oe.create(se.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function X0(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 Sh(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 Dh={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Wb={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Hb={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ih=["year","month","day","hour","minute","second","millisecond"],$b=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],qb=["year","ordinal","hour","minute","second","millisecond"];function Vb(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 yn(t);return e}function vh(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Vb(t)}}function Ch(t,e){let r=Dt(e.zone,ne.defaultZone),n=se.fromObject(e),i=ne.now(),o,s;if(H(t.year))o=i;else{for(let l of Ih)H(t[l])&&(t[l]=Dh[l]);let a=M0(t)||N0(t);if(a)return te.invalid(a);let c=r.offset(i);[o,s]=ua(t,c,r)}return new te({ts:o,zone:r,loc:n,o:s})}function Th(t,e,r){let n=H(r.round)?!0:r.round,i=(s,a)=>(s=bn(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 Ah(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:sa(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=aa(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]=Ah(arguments),[n,i,o,s,a,c,l]=r;return Ch({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static utc(){let[e,r]=Ah(arguments),[n,i,o,s,a,c,l]=r;return e.zone=Ie.utcInstance,Ch({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=Lm(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=Dt(r.zone,ne.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:se.fromObject(r)}):t.invalid(sa(i))}static fromMillis(e,r={}){if(Mt(e))return e<-wh||e>wh?t.invalid("Timestamp out of range"):new t({ts:e,zone:Dt(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(Mt(e))return new t({ts:e*1e3,zone:Dt(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Ee("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Dt(r.zone,ne.defaultZone);if(!n.isValid)return t.invalid(sa(n));let i=se.fromObject(r),o=Sn(e,vh),{minDaysInFirstWeek:s,startOfWeek:a}=_0(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 Tt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new Tt("Can't mix ordinal dates with month/day");let x=h||o.weekday&&!m,g,p,y=aa(c,l);x?(g=$b,p=Wb,y=Ui(y,s,a)):u?(g=qb,p=Hb,y=ia(y)):(g=Ih,p=Dh);let b=!1;for(let L of g){let A=o[L];H(A)?b?o[L]=p[L]:o[L]=y[L]:b=!0}let w=x?Pm(o,s,a):u?jm(o):M0(o),E=w||N0(o);if(E)return t.invalid(E);let S=x?O0(o,s,a):u?k0(o):o,[O,I]=ua(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]=th(e);return Vi(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=rh(e);return Vi(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=nh(e);return Vi(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]=bh(s,e,r);return u?t.invalid(u):Vi(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]=sh(e);return Vi(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 Vs(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Z0(e,se.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return V0(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?J0(this).weekYear:NaN}get weekNumber(){return this.isValid?J0(this).weekNumber:NaN}get weekday(){return this.isValid?J0(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Y0(this).weekday:NaN}get localWeekNumber(){return this.isValid?Y0(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Y0(this).weekYear:NaN}get ordinal(){return this.isValid?ia(this.c).ordinal:NaN}get monthShort(){return this.isValid?Kt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Kt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Kt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Kt.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=gn(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=aa(c,s),f=aa(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[jr(this,{ts:c}),jr(this,{ts:l})]:[this]}get isInLeapYear(){return Rr(this.year)}get daysInMonth(){return En(this.year,this.month)}get daysInYear(){return this.isValid?pr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Nr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Nr(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=Dt(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]=ua(s,o,e)}return jr(this,{ts:i,zone:e})}else return t.invalid(sa(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return jr(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Sn(e,vh),{minDaysInFirstWeek:n,startOfWeek:i}=_0(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 Tt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Tt("Can't mix ordinal dates with month/day");let f;o?f=O0({...Ui(this.c,n,i),...r},n,i):H(r.ordinal)?(f={...this.toObject(),...r},H(r.day)&&(f.day=Math.min(En(f.year,f.month),f.day))):f=k0({...ia(this.c),...r});let[d,m]=ua(f,this.o,this.zone);return jr(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e);return jr(this,Eh(this,r))}minus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e).negate();return jr(this,Eh(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=le.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):K0}toLocaleString(e=dr,r={}){return this.isValid?Oe.create(this.loc.clone(r),e).formatDateTime(this):K0}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=X0(this,s);return a+="T",a+=Sh(this,s,r,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?X0(this,e==="extended"):null}toISOWeekDate(){return ca(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":"")+Sh(this,s==="extended",r,e,n,o):null}toRFC2822(){return ca(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ca(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?X0(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")),ca(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():K0}[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 le.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=zm(r).map(le.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,l=dh(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?Zt.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),Th(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?Th(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 R0(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ee("max requires all arguments be DateTimes");return R0(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 G0(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return dr}static get DATE_MED(){return gi}static get DATE_MED_WITH_WEEKDAY(){return p0}static get DATE_FULL(){return bi}static get DATE_HUGE(){return wi}static get TIME_SIMPLE(){return Ei}static get TIME_WITH_SECONDS(){return Si}static get TIME_WITH_SHORT_OFFSET(){return vi}static get TIME_WITH_LONG_OFFSET(){return Ci}static get TIME_24_SIMPLE(){return Ti}static get TIME_24_WITH_SECONDS(){return Ai}static get TIME_24_WITH_SHORT_OFFSET(){return Bi}static get TIME_24_WITH_LONG_OFFSET(){return Di}static get DATETIME_SHORT(){return Ii}static get DATETIME_SHORT_WITH_SECONDS(){return Fi}static get DATETIME_MED(){return Oi}static get DATETIME_MED_WITH_SECONDS(){return ki}static get DATETIME_MED_WITH_WEEKDAY(){return x0}static get DATETIME_FULL(){return _i}static get DATETIME_FULL_WITH_SECONDS(){return Mi}static get DATETIME_HUGE(){return Ni}static get DATETIME_HUGE_WITH_SECONDS(){return Ri}};function Fn(t){if(te.isDateTime(t))return t;if(t&&t.valueOf&&Mt(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 Q0=50n,la=10000n,Fh=25n,eu=100000000n;var Nt=class{constructor(e){this.object=e}moveArg(e){return e.object(this.object)}},Gi=class{constructor(e){this.objects=e}moveArgs(e){return e.makeMoveVec({objects:this.objects.map(r=>e.object(r))})}},br=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 Zi=class extends pe{constructor(e,r){super(3,e,{context:r})}};var fa=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 Zi("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 Zi("Invalid contract return type.",{ctx:{expectType:"u64",gotType:i}});return Buffer.from(n).readBigInt64LE()}};var Se=class extends pe{constructor(e,r,n){super(2,`Invalid input: ${e}`,{context:{fieldKey:r,fieldValue:n}})}};var kh={groupId:"string",name:"string"},Gb=64;function _h(t){return Mh(t),ae.ser(kh,t).toString("base64")}function Ki(t){let e=ae.de(kh,t,"base64");return Mh(e),e}function Mh(t){if(!Oh(t.name))throw new Se("Invalid metadata: Name contains unknown character");if(!Oh(t.groupId))throw new Se("Invalid metadata: Group ID contains unknown character");if(t.name.length>Gb)throw new Se("Invalid metadata: Name exceed max length 64")}function Oh(t){return/^[\x00-\x7F]+$/.test(t)}function Nh(t,e){return oe(t)===oe(e)}function wr(t,e){return oe(t)===oe(e)}var Rh="txn.gas";function Ph(){return"nanoid()"}var Ur=class t{constructor(e,r,n){this.globals=e;this.feeContract=r;this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:_h({name:e.name,groupId:Ph()}),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 ue,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 br(d),flatFeeCoin:new br(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:Q0,denominator:la},claimFeePercent:{numerator:Fh,denominator:la},flatFeePerStream:eu}}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===Rh?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return Nh(n,Ft)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:Ft,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 BigInt(e.amountPerEpoch)*BigInt(r)+BigInt(e.cliffAmount)}get flatSuiFee(){return eu}getStreamFeeLocal(e){return e*Q0/la}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new ue,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new fa(n).getU64()}get wallet(){return this.globals.wallet}};var jh="0x0000000000000000000000000000000000000000000000000000000000000006";var On=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(at.MoveCall({target:n,arguments:r.arguments.map(i=>i instanceof Gi?i.moveArgs(e):i instanceof Nt?i.moveArg(e):i instanceof br?i.moveArg():e.pure(i)),typeArguments:r.typeArgs})),e}addTransactionBlock(e,r,n=[],i=[]){e.add(at.MoveCall({target:r,arguments:n.map(o=>o instanceof Gi?o.moveArgs(e):o instanceof Nt?o.moveArg(e):o instanceof br?o.moveArg():e.pure(o)),typeArguments:i}))}makeObject(e){return typeof e=="string"?new Nt(e):e}vaultObject(){return new Nt(this.config.vaultObjId)}roleObject(){return new Nt(this.config.roleObjId)}feeObject(){return new Nt(this.config.feeObjId)}clockObject(){return new Nt(jh)}};var kn=class t extends On{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 Rt=class t extends On{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 _n=class{constructor(e){this.globals=e;let r=e.envConfig.contract;this.feeContract=new kn(r,e),this.streamContract=new Rt(r,e)}feeContract;streamContract;async createStreams(e){let r=Ur.convertCreateStreamInfoToInternal(e);return this.createStreamHelper().buildCreateStreamTransactionBlock(r)}createStreamHelper(){return new Ur(this.globals,this.feeContract,this.streamContract)}setAutoClaim(e,r,n){let i=new ue;return this.streamContract.setAutoClaim(i,{streamId:e,enabled:r,coinType:n})}claimStream(e,r){let n=new ue;return this.streamContract.claimStream(n,{streamId:e,coinType:r})}claimStreamByProxy(e,r){let n=new ue;return this.streamContract.claimStreamByProxy(n,{streamId:e,coinType:r})}cancelStream(e,r){let n=new ue;return this.streamContract.cancelStream(n,{streamId:e,coinType:r}),n}};var da=class extends pe{constructor(e,r){super(12,`Transaction failed: ${r}`,{context:{status:e,msg:r}})}};var Zb=1e3,ma=class{constructor(e){this.globals=e;this.coinMetaHelper=new tu(e.suiClient),this.createStreamHelper=new _n(e).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(e){if(e.effects?.status.status!=="success")throw new da(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(le.fromMillis(Number(r*e.steps))),i={timeStart:e.timeStart,timeEnd:n,interval:le.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()<Zb)throw new Se("Interval shall be at least 1 second","interval",e.interval)}},tu=class{constructor(e){this.suiClient=e;this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(e){let r=oe(e||Ft);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 ha=class extends pe{constructor(){super(7,"Connected wallet is not creator")}};var Ji=class extends pe{constructor(){super(8,"Connected wallet is not recipient")}};var Yi=class extends pe{constructor(e,r){super(6,e,{context:r})}};var $e=class extends pe{constructor(e,r={}){super(0,e,r)}};var pa=class extends pe{constructor(e){super(5,"Stream not found",{context:{streamId:e}})}};var Uh=(1n<<64n)-1n,xa=1e3;function ru(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/xa);return te.fromMillis(r*xa)}function nu(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/xa);return le.fromMillis(r*xa)}var Er=class t{constructor(e,r,n){this.globals=e;this.streamId=r;this.rawData=n;this.streamContract=new Rt(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 $e("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 ha;let e=new ue;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Ji;let e=new ue;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Ji;let r=new ue;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new ue;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 nu(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return Ki(e).groupId}get name(){let{metadata:e}=this.rawData.config;return Ki(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return ru(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return nu(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:ru((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===Uh?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 pa(e):new Yi(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new Yi("Unexpected object type",{gotType:n.dataType});let{typeParams:i}=Vn(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 Mn=class extends pe{constructor(e,r){super(9,`Invalid stream group: ${e}`,{context:r})}};async function Lh(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 iu=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)}},ya=class{constructor(e){this.requester=e;this.pager=new iu(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 Kb=25;async function su(t,e,r){let n=new Xi(e),i=new Qi(t,n,r);return await Lh(i)}var Xi=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]}},Qi=class extends ya{constructor(r,n,i){super(new ou(r,n,i));this.suiClient=r;this.idIter=n;this.options=i}},ou=class{constructor(e,r,n){this.suiClient=e;this.stringIter=r;this.options=n;this.filter=n?.filter,this.pageSize=n?.pageSize||Kb,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 ga=class t{constructor(e,r){this.globals=e;this.streams=r;if(r.length===0)throw new Mn("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 su(e.suiClient,r);return n.forEach(i=>{if(!i)throw new $e("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=>{Jb(n,o)||(i=!1)}),i}async refresh(){let e=await su(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)=>Er.fromObjectData(e,r[s],o)).filter(o=>!!o);if(new Set(i.map(o=>o.groupId)).size!==1)throw new Mn("Not same group ID");if(!this.checkStreamGroup(i))throw new Mn("Not same stream settings");return i}};function Jb(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 eo=class t{constructor(e,r){this.it=e;this.pageSize=r}static async newIncoming(e){let r=await ba.newIncoming(e);return new t(r,e.pageSize)}static async newOutgoing(e){let r=await ba.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}},ba=class t{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await wa.newIncomingQuery(e);return new t(r)}static async newOutgoing(e){let r=await wa.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 $e("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new $e("No more results");return e}},wa=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 Xi(n.flat().map(s=>s.streamId));this.objectIter=new Qi(e.suiClient,o)}current=0;objectIter;static async newIncomingQuery(e){let r=t2(e.query),n=await e.globals.walletAddress(),o=(await e.globals.backend.getIncomingStreams(n,r)).filter(a=>$(a.recipient)===$(n)),s=zh(o);return new t(e.globals,n,s,e.query)}static async newOutgoingQuery(e){let r=r2(e.query),n=await e.globals.walletAddress(),i=await e.globals.backend.getOutgoingStreams(n,r),o=zh(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 Qb(this.globals,e[0].streamId,this.objectIter);return this.current++,Wh(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await e2(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,Xb(r,this.query)?r:this.doNextRequest()}throw new $e("Stream group with no stream")}};function zh(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 Wh(t,e){if(e===void 0)return!0;let r=Yb(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 Yb(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function Xb(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{Wh(n,e)&&(r=!0)}),r}async function Qb(t,e,r){let n=await Hh(r,e);return Er.fromObjectData(t,e,n)}async function e2(t,e,r){let n=[];for(;n.length<e.length;){let i=await Hh(r,e[n.length]);n.push(i)}return ga.newFromObjectResponse(t,e,n)}async function Hh(t,e){if(!await t.hasNext())throw new $e("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new $e("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new $e("stream id not aligned");return r}function t2(t){return{status:au(t?.status),coinType:$h(t?.coinType),sender:qh(t?.sender)}}function r2(t){return{status:au(t?.status),coinType:$h(t?.coinType),recipient:qh(t?.recipient)}}function au(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=au(r);return!e||e===n?n:"all"},void 0):n2(t)}function n2(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 $h(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>oe(e)):void 0:oe(t)}function qh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>$(e)):void 0:$(t)}var cu=class{constructor(e){this.msafe=e}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(e){return this.msafe.requestCoins(e)}},Ea=class{globals;helper;constructor(e,r){this.globals=xn.new(e,r),this.helper=new ma(this.globals)}connectMSafeAccount(e){let r=new cu(e);this.globals.connectWallet(r)}async createStream(e){return this.builder().createStreams(e)}async getStream(e){return Er.new(this.globals,e)}async getIncomingStreams(e,r=10){return eo.newIncoming({globals:this.globals,query:e,pageSize:r})}async getOutgoingStreams(e,r=10){return eo.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 _n(this.globals)}};var Sa=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n}=r;return await new Ea(n==="sui:mainnet"?"prod":"dev").createStream(this.data)}static fromData(r){return new t(r)}};var Jt=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 va=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"&&wr(r.target,this.contract.createStreamTarget));if(e.length===0)throw new $e("No create stream transactions");return e.map(r=>new Jt(r,this.txb))}getCreationInfoFromMoveCall(e){let r=e.decodeInputString(4),{name:n,groupId:i}=Ki(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(Ft))return[i];let o=e.txArg(3),s=this.getCoinMergeFromNestedResult(o,oe(Ft),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=Jt.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 Jt.getOwnedObjectId(c)===o});return s?{primary:o,merged:s.sources.map(a=>{let c=this.getInputArg(a);return Jt.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 Rt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new kn(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Ur(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 Ca=class{constructor(e,r){this.globals=e;this.txb=r;this.contract=new Rt(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"&&wr(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&wr(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new va(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 Jt(e,this.txb)}};var Ta=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(){return new ue}static fromData(r){return new t(r)}};var Aa=class{application="mpay";async deserialize(e){let{chain:r,transactionBlock:n}=e,i=xn.new(r==="sui:mainnet"?"prod":"dev"),s=new Ca(i,n).decode();if(console.log("\u{1F680} ~ MPayHelper ~ deserialize ~ input:",e,s),s.type==="CreateStream")return{txType:Wt.Other,txSubType:St.Create,intentionData:s.info};if(s.type==="Claim")return{txType:Wt.Other,txSubType:St.Claim,intentionData:{streamId:s.streamId}};if(s.type==="ClaimByProxy")return{txType:Wt.Other,txSubType:St.SetAutoClaim,intentionData:{streamId:s.streamId}};if(s.type==="SetAutoClaim")return{txType:Wt.Other,txSubType:St.SetAutoClaim,intentionData:{streamId:s.streamId,enabled:s.enabled}};if(s.type==="Cancel")return{txType:Wt.Other,txSubType:St.Cancel,intentionData:{streamId:s.streamId}};throw new Error(`Unknown transaction type: ${s}`)}async build(e){let{network:r,intentionData:n,suiClient:i,account:o}=e,s;switch(e.txSubType){case St.Create:s=Sa.fromData(n);break;case St.Claim:s=vs.fromData(n);break;case St.SetAutoClaim:s=Ta.fromData(n);break;case St.Cancel:s=Ss.fromData(n);break;default:throw new Error("not implemented")}return s.build({network:r,suiClient:i,account:o})}};var Ba=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Ad(n,this.data,i.address)}static fromData(r){return new t(r)}};var Da=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Bd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Ia=class t extends Re{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{account:n}=r,i=ue.from(this.data.content);if(!jc(i.blockData.sender,n.address))throw new Error("Invalid sender address");return i}static fromData(r){return new t(r)}};var Fa=class{application;constructor(){this.application=Dd}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 sn.assets.coin.send:i=Ba.fromData(e.intentionData);break;case sn.assets.object.send:i=Da.fromData(e.intentionData);break;case sn.others.plain:i=Ia.fromData(e.intentionData);break;default:throw new Error("not implemented")}return i.build({suiClient:r,account:n})}};var Oa=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 o2=Sr(ii()),s2="msafe-plain-tx",a2=sn.others.plain;var ka=class{application;constructor(){this.application=s2}async deserialize(e){let{transactionBlock:r,suiClient:n}=e,i=await r.build({client:n});return{txType:Wt.Other,txSubType:a2,intentionData:{content:Ue(i)}}}async build(e){return ue.from(yt(e.intentionData.content))}};var c2=new Oa([new Fa,new Aa,new ka]);return fp(u2);})();
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
ieee754/index.js:
|