@ar.io/sdk 1.2.0-alpha.3 → 1.2.0-alpha.4
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/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/common/contracts/ao-process.js +36 -19
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/contracts/ao-process.js +36 -19
- package/lib/esm/version.js +1 -1
- package/lib/types/common/contracts/ao-process.d.ts +2 -1
- package/lib/types/io.d.ts +6 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -228,7 +228,7 @@ ${C}`),A.pop(),`{${z}}`}case"number":return isFinite(T)?String(T):e?e(T):"null";
|
|
|
228
228
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let s=new this(e);return r.forEach(o=>s.set(o)),s}static accessor(e){let s=(this[q$]=this[q$]={accessors:{}}).accessors,o=this.prototype;function l(c){let d=jv(c);s[d]||(Zce(o,c),s[d]=!0)}return Kt.isArray(e)?e.forEach(l):l(e),this}};f1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Kt.reduceDescriptors(f1.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}});Kt.freezeMethods(f1);var eo=f1;function zv(t,e){let r=this||h1,s=e||r,o=eo.from(s.headers),l=s.data;return Kt.forEach(t,function(d){l=d.call(r,l,o.normalize(),e?e.status:void 0)}),o.normalize(),l}Se();Ae();Ee();function Wv(t){return!!(t&&t.__CANCEL__)}Se();Ae();Ee();function F$(t,e,r){Lr.call(this,t??"canceled",Lr.ERR_CANCELED,e,r),this.name="CanceledError"}Kt.inherits(F$,Lr,{__CANCEL__:!0});var bh=F$;Se();Ae();Ee();Se();Ae();Ee();Se();Ae();Ee();function Kv(t,e,r){let s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new Lr("Request failed with status code "+r.status,[Lr.ERR_BAD_REQUEST,Lr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}Se();Ae();Ee();function c9(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}Se();Ae();Ee();Se();Ae();Ee();function Jce(t,e){t=t||10;let r=new Array(t),s=new Array(t),o=0,l=0,c;return e=e!==void 0?e:1e3,function(b){let g=Date.now(),y=s[l];c||(c=g),r[o]=b,s[o]=g;let m=l,_=0;for(;m!==o;)_+=r[m++],m=m%t;if(o=(o+1)%t,o===l&&(l=(l+1)%t),g-c<e)return;let T=y&&g-y;return T?Math.round(_*1e3/T):void 0}}var j$=Jce;Se();Ae();Ee();function Xce(t,e){let r=0,s=1e3/e,o=null;return function(){let c=this===!0,d=Date.now();if(c||d-r>s)return o&&(clearTimeout(o),o=null),r=d,t.apply(null,arguments);o||(o=setTimeout(()=>(o=null,r=Date.now(),t.apply(null,arguments)),s-(d-r)))}}var z$=Xce;var c1=(t,e,r=3)=>{let s=0,o=j$(50,250);return z$(l=>{let c=l.loaded,d=l.lengthComputable?l.total:void 0,b=c-s,g=o(b),y=c<=d;s=c;let m={loaded:c,total:d,progress:d?c/d:void 0,bytes:b,rate:g||void 0,estimated:g&&d&&y?(d-c)/g:void 0,event:l,lengthComputable:d!=null};m[e?"download":"upload"]=!0,t(m)},r)};Se();Ae();Ee();Se();Ae();Ee();var W$=go.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),s;function o(l){let c=l;return e&&(r.setAttribute("href",c),c=r.href),r.setAttribute("href",c),{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 s=o(window.location.href),function(c){let d=Kt.isString(c)?o(c):c;return d.protocol===s.protocol&&d.host===s.host}}():function(){return function(){return!0}}();Se();Ae();Ee();var K$=go.hasStandardBrowserEnv?{write(t,e,r,s,o,l){let c=[t+"="+encodeURIComponent(e)];Kt.isNumber(r)&&c.push("expires="+new Date(r).toGMTString()),Kt.isString(s)&&c.push("path="+s),Kt.isString(o)&&c.push("domain="+o),l===!0&&c.push("secure"),document.cookie=c.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(){}};Se();Ae();Ee();Se();Ae();Ee();function l9(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}Se();Ae();Ee();function d9(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Hv(t,e){return t&&!l9(e)?d9(t,e):e}Se();Ae();Ee();var H$=t=>t instanceof eo?{...t}:t;function xu(t,e){e=e||{};let r={};function s(g,y,m){return Kt.isPlainObject(g)&&Kt.isPlainObject(y)?Kt.merge.call({caseless:m},g,y):Kt.isPlainObject(y)?Kt.merge({},y):Kt.isArray(y)?y.slice():y}function o(g,y,m){if(Kt.isUndefined(y)){if(!Kt.isUndefined(g))return s(void 0,g,m)}else return s(g,y,m)}function l(g,y){if(!Kt.isUndefined(y))return s(void 0,y)}function c(g,y){if(Kt.isUndefined(y)){if(!Kt.isUndefined(g))return s(void 0,g)}else return s(void 0,y)}function d(g,y,m){if(m in e)return s(g,y);if(m in t)return s(void 0,g)}let b={url:l,method:l,data:l,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(g,y)=>o(H$(g),H$(y),!0)};return Kt.forEach(Object.keys(Object.assign({},t,e)),function(y){let m=b[y]||o,_=m(t[y],e[y],y);Kt.isUndefined(_)&&m!==d||(r[y]=_)}),r}var _6=t=>{let e=xu({},t),{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:l,headers:c,auth:d}=e;e.headers=c=eo.from(c),e.url=Fv(Hv(e.baseURL,e.url),t.params,t.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let b;if(Kt.isFormData(r)){if(go.hasStandardBrowserEnv||go.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if((b=c.getContentType())!==!1){let[g,...y]=b?b.split(";").map(m=>m.trim()).filter(Boolean):[];c.setContentType([g||"multipart/form-data",...y].join("; "))}}if(go.hasStandardBrowserEnv&&(s&&Kt.isFunction(s)&&(s=s(e)),s||s!==!1&&W$(e.url))){let g=o&&l&&K$.read(l);g&&c.set(o,g)}return e};var Yce=typeof XMLHttpRequest<"u",G$=Yce&&function(t){return new Promise(function(r,s){let o=_6(t),l=o.data,c=eo.from(o.headers).normalize(),{responseType:d}=o,b;function g(){o.cancelToken&&o.cancelToken.unsubscribe(b),o.signal&&o.signal.removeEventListener("abort",b)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function m(){if(!y)return;let T=eo.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),R={data:!d||d==="text"||d==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:T,config:t,request:y};Kv(function(C){r(C),g()},function(C){s(C),g()},R),y=null}"onloadend"in y?y.onloadend=m:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(m)},y.onabort=function(){y&&(s(new Lr("Request aborted",Lr.ECONNABORTED,o,y)),y=null)},y.onerror=function(){s(new Lr("Network Error",Lr.ERR_NETWORK,o,y)),y=null},y.ontimeout=function(){let A=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",R=o.transitional||y6;o.timeoutErrorMessage&&(A=o.timeoutErrorMessage),s(new Lr(A,R.clarifyTimeoutError?Lr.ETIMEDOUT:Lr.ECONNABORTED,o,y)),y=null},l===void 0&&c.setContentType(null),"setRequestHeader"in y&&Kt.forEach(c.toJSON(),function(A,R){y.setRequestHeader(R,A)}),Kt.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),d&&d!=="json"&&(y.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&y.addEventListener("progress",c1(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",c1(o.onUploadProgress)),(o.cancelToken||o.signal)&&(b=T=>{y&&(s(!T||T.type?new bh(null,t,y):T),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(b),o.signal&&(o.signal.aborted?b():o.signal.addEventListener("abort",b)));let _=c9(o.url);if(_&&go.protocols.indexOf(_)===-1){s(new Lr("Unsupported protocol "+_+":",Lr.ERR_BAD_REQUEST,t));return}y.send(l||null)})};Se();Ae();Ee();Se();Ae();Ee();var Qce=(t,e)=>{let r=new AbortController,s,o=function(b){if(!s){s=!0,c();let g=b instanceof Error?b:this.reason;r.abort(g instanceof Lr?g:new bh(g instanceof Error?g.message:g))}},l=e&&setTimeout(()=>{o(new Lr(`timeout ${e} of ms exceeded`,Lr.ETIMEDOUT))},e),c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(b=>{b&&(b.removeEventListener?b.removeEventListener("abort",o):b.unsubscribe(o))}),t=null)};t.forEach(b=>b&&b.addEventListener&&b.addEventListener("abort",o));let{signal:d}=r;return d.unsubscribe=c,[d,()=>{l&&clearTimeout(l),l=null}]},V$=Qce;Se();Ae();Ee();var ele=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let s=0,o;for(;s<r;)o=s+e,yield t.slice(s,o),s=o},tle=async function*(t,e,r){for await(let s of t)yield*ele(ArrayBuffer.isView(s)?s:await r(String(s)),e)},p9=(t,e,r,s,o)=>{let l=tle(t,e,o),c=0;return new ReadableStream({type:"bytes",async pull(d){let{done:b,value:g}=await l.next();if(b){d.close(),s();return}let y=g.byteLength;r&&r(c+=y),d.enqueue(new Uint8Array(g))},cancel(d){return s(d),l.return()}},{highWaterMark:2})};var Z$=(t,e)=>{let r=t!=null;return s=>setTimeout(()=>e({lengthComputable:r,total:t,loaded:s}))},S6=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",X$=S6&&typeof ReadableStream=="function",v9=S6&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),rle=X$&&(()=>{let t=!1,e=new Request(go.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})(),J$=64*1024,g9=X$&&!!(()=>{try{return Kt.isReadableStream(new Response("").body)}catch{}})(),M6={stream:g9&&(t=>t.body)};S6&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!M6[e]&&(M6[e]=Kt.isFunction(t[e])?r=>r[e]():(r,s)=>{throw new Lr(`Response type '${e}' is not supported`,Lr.ERR_NOT_SUPPORT,s)})})})(new Response);var ile=async t=>{if(t==null)return 0;if(Kt.isBlob(t))return t.size;if(Kt.isSpecCompliantForm(t))return(await new Request(t).arrayBuffer()).byteLength;if(Kt.isArrayBufferView(t))return t.byteLength;if(Kt.isURLSearchParams(t)&&(t=t+""),Kt.isString(t))return(await v9(t)).byteLength},nle=async(t,e)=>{let r=Kt.toFiniteNumber(t.getContentLength());return r??ile(e)},Y$=S6&&(async t=>{let{url:e,method:r,data:s,signal:o,cancelToken:l,timeout:c,onDownloadProgress:d,onUploadProgress:b,responseType:g,headers:y,withCredentials:m="same-origin",fetchOptions:_}=_6(t);g=g?(g+"").toLowerCase():"text";let[T,A]=o||l||c?V$([o,l],c):[],R,B,C=()=>{!R&&setTimeout(()=>{T&&T.unsubscribe()}),R=!0},P;try{if(b&&rle&&r!=="get"&&r!=="head"&&(P=await nle(y,s))!==0){let J=new Request(e,{method:"POST",body:s,duplex:"half"}),F;Kt.isFormData(s)&&(F=J.headers.get("content-type"))&&y.setContentType(F),J.body&&(s=p9(J.body,J$,Z$(P,c1(b)),null,v9))}Kt.isString(m)||(m=m?"cors":"omit"),B=new Request(e,{..._,signal:T,method:r.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:"half",withCredentials:m});let N=await fetch(B),q=g9&&(g==="stream"||g==="response");if(g9&&(d||q)){let J={};["status","statusText","headers"].forEach(H=>{J[H]=N[H]});let F=Kt.toFiniteNumber(N.headers.get("content-length"));N=new Response(p9(N.body,J$,d&&Z$(F,c1(d,!0)),q&&C,v9),J)}g=g||"text";let z=await M6[Kt.findKey(M6,g)||"text"](N,t);return!q&&C(),A&&A(),await new Promise((J,F)=>{Kv(J,F,{data:z,headers:eo.from(N.headers),status:N.status,statusText:N.statusText,config:t,request:B})})}catch(N){throw C(),N&&N.name==="TypeError"&&/fetch/i.test(N.message)?Object.assign(new Lr("Network Error",Lr.ERR_NETWORK,t,B),{cause:N.cause||N}):Lr.from(N,N&&N.code,t,B)}});var m9={http:g6,xhr:G$,fetch:Y$};Kt.forEach(m9,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var Q$=t=>`- ${t}`,ole=t=>Kt.isFunction(t)||t===null||t===!1,E6={getAdapter:t=>{t=Kt.isArray(t)?t:[t];let{length:e}=t,r,s,o={};for(let l=0;l<e;l++){r=t[l];let c;if(s=r,!ole(r)&&(s=m9[(c=String(r)).toLowerCase()],s===void 0))throw new Lr(`Unknown adapter '${c}'`);if(s)break;o[c||"#"+l]=s}if(!s){let l=Object.entries(o).map(([d,b])=>`adapter ${d} `+(b===!1?"is not supported by the environment":"is not available in the build")),c=e?l.length>1?`since :
|
|
229
229
|
`+l.map(Q$).join(`
|
|
230
230
|
`):" "+Q$(l[0]):"as no adapter specified";throw new Lr("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s},adapters:m9};function y9(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bh(null,t)}function A6(t){return y9(t),t.headers=eo.from(t.headers),t.data=zv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),E6.getAdapter(t.adapter||h1.adapter)(t).then(function(s){return y9(t),s.data=zv.call(t,t.transformResponse,s),s.headers=eo.from(s.headers),s},function(s){return Wv(s)||(y9(t),s&&s.response&&(s.response.data=zv.call(t,t.transformResponse,s.response),s.response.headers=eo.from(s.response.headers))),Promise.reject(s)})}Se();Ae();Ee();Se();Ae();Ee();var T6="1.7.2";var b9={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{b9[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});var eU={};b9.transitional=function(e,r,s){function o(l,c){return"[Axios v"+T6+"] Transitional option '"+l+"'"+c+(s?". "+s:"")}return(l,c,d)=>{if(e===!1)throw new Lr(o(c," has been removed"+(r?" in "+r:"")),Lr.ERR_DEPRECATED);return r&&!eU[c]&&(eU[c]=!0,console.warn(o(c," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(l,c,d):!0}};function ale(t,e,r){if(typeof t!="object")throw new Lr("options must be an object",Lr.ERR_BAD_OPTION_VALUE);let s=Object.keys(t),o=s.length;for(;o-- >0;){let l=s[o],c=e[l];if(c){let d=t[l],b=d===void 0||c(d,l,t);if(b!==!0)throw new Lr("option "+l+" must be "+b,Lr.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Lr("Unknown option "+l,Lr.ERR_BAD_OPTION)}}var x6={assertOptions:ale,validators:b9};var Cc=x6.validators,l1=class{constructor(e){this.defaults=e,this.interceptors={request:new o9,response:new o9}}async request(e,r){try{return await this._request(e,r)}catch(s){if(s instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;let l=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?l&&!String(s.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
231
|
-
`+l):s.stack=l}catch{}}throw s}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=xu(this.defaults,r);let{transitional:s,paramsSerializer:o,headers:l}=r;s!==void 0&&x6.assertOptions(s,{silentJSONParsing:Cc.transitional(Cc.boolean),forcedJSONParsing:Cc.transitional(Cc.boolean),clarifyTimeoutError:Cc.transitional(Cc.boolean)},!1),o!=null&&(Kt.isFunction(o)?r.paramsSerializer={serialize:o}:x6.assertOptions(o,{encode:Cc.function,serialize:Cc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=l&&Kt.merge(l.common,l[r.method]);l&&Kt.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),r.headers=eo.concat(c,l);let d=[],b=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(b=b&&R.synchronous,d.unshift(R.fulfilled,R.rejected))});let g=[];this.interceptors.response.forEach(function(R){g.push(R.fulfilled,R.rejected)});let y,m=0,_;if(!b){let A=[A6.bind(this),void 0];for(A.unshift.apply(A,d),A.push.apply(A,g),_=A.length,y=Promise.resolve(r);m<_;)y=y.then(A[m++],A[m++]);return y}_=d.length;let T=r;for(m=0;m<_;){let A=d[m++],R=d[m++];try{T=A(T)}catch(B){R.call(this,B);break}}try{y=A6.call(this,T)}catch(A){return Promise.reject(A)}for(m=0,_=g.length;m<_;)y=y.then(g[m++],g[m++]);return y}getUri(e){e=xu(this.defaults,e);let r=Hv(e.baseURL,e.url);return Fv(r,e.params,e.paramsSerializer)}};Kt.forEach(["delete","get","head","options"],function(e){l1.prototype[e]=function(r,s){return this.request(xu(s||{},{method:e,url:r,data:(s||{}).data}))}});Kt.forEach(["post","put","patch"],function(e){function r(s){return function(l,c,d){return this.request(xu(d||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:l,data:c}))}}l1.prototype[e]=r(),l1.prototype[e+"Form"]=r(!0)});var Gv=l1;Se();Ae();Ee();var w9=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(l){r=l});let s=this;this.promise.then(o=>{if(!s._listeners)return;let l=s._listeners.length;for(;l-- >0;)s._listeners[l](o);s._listeners=null}),this.promise.then=o=>{let l,c=new Promise(d=>{s.subscribe(d),l=d}).then(o);return c.cancel=function(){s.unsubscribe(l)},c},e(function(l,c,d){s.reason||(s.reason=new bh(l,c,d),r(s.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(o){e=o}),cancel:e}}},tU=w9;Se();Ae();Ee();function _9(t){return function(r){return t.apply(null,r)}}Se();Ae();Ee();function M9(t){return Kt.isObject(t)&&t.isAxiosError===!0}Se();Ae();Ee();var S9={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(S9).forEach(([t,e])=>{S9[e]=t});var rU=S9;function iU(t){let e=new Gv(t),r=$v(Gv.prototype.request,e);return Kt.extend(r,Gv.prototype,e,{allOwnKeys:!0}),Kt.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return iU(xu(t,o))},r}var Vn=iU(h1);Vn.Axios=Gv;Vn.CanceledError=bh;Vn.CancelToken=tU;Vn.isCancel=Wv;Vn.VERSION=T6;Vn.toFormData=Oc;Vn.AxiosError=Lr;Vn.Cancel=Vn.CanceledError;Vn.all=function(e){return Promise.all(e)};Vn.spread=_9;Vn.isAxiosError=M9;Vn.mergeConfig=xu;Vn.AxiosHeaders=eo;Vn.formToJSON=t=>b6(Kt.isHTMLForm(t)?new FormData(t):t);Vn.getAdapter=E6.getAdapter;Vn.HttpStatusCode=rU;Vn.default=Vn;var R6=Vn;var{Axios:TFe,AxiosError:xFe,CanceledError:RFe,isCancel:kFe,CancelToken:IFe,VERSION:BFe,all:OFe,Cancel:CFe,isAxiosError:PFe,spread:NFe,toFormData:LFe,AxiosHeaders:DFe,HttpStatusCode:$Fe,formToJSON:UFe,getAdapter:qFe,mergeConfig:FFe}=R6;Se();Ae();Ee();var sU=Zl(oU(),1),E9="axios-retry";function uU(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,sU.default)(t)}var hU=["get","head","options"],ule=hU.concat(["put","delete"]);function A9(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function hle(t){return t.config?.method?A9(t)&&hU.indexOf(t.config.method)!==-1:!1}function fU(t){return t.config?.method?A9(t)&&ule.indexOf(t.config.method)!==-1:!1}function cU(t){return uU(t)||fU(t)}function lU(t=void 0){let e=t?.response?.headers["retry-after"];if(!e)return 0;let r=(Number(e)||0)*1e3;return r===0&&(r=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,r)}function fle(t=0,e=void 0){return Math.max(0,lU(e))}function cle(t=0,e=void 0,r=100){let s=2**t*r,o=Math.max(s,lU(e)),l=o*.2*Math.random();return o+l}var lle={retries:3,retryCondition:cU,retryDelay:fle,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function dle(t,e){return{...lle,...e,...t[E9]}}function aU(t,e){let r=dle(t,e||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),t[E9]=r,r}function ple(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function vle(t,e){let{retries:r,retryCondition:s}=t,o=(t.retryCount||0)<r&&s(e);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function gle(t,e,r,s){e.retryCount+=1;let{retryDelay:o,shouldResetTimeout:l,onRetry:c}=e,d=o(e.retryCount,r);if(ple(t,s),!l&&s.timeout&&e.lastRequestTime){let b=Date.now()-e.lastRequestTime,g=s.timeout-b-d;if(g<=0)return Promise.reject(r);s.timeout=g}return s.transformRequest=[b=>b],await c(e.retryCount,r,s),new Promise(b=>{setTimeout(()=>b(t(s)),d)})}async function mle(t,e){t.retryCount>=t.retries&&await t.onMaxRetryTimesExceeded(e,t.retryCount)}var Yl=(t,e)=>{let r=t.interceptors.request.use(o=>(aU(o,e),o[E9]?.validateResponse&&(o.validateStatus=()=>!1),o)),s=t.interceptors.response.use(null,async o=>{let{config:l}=o;if(!l)return Promise.reject(o);let c=aU(l,e);return o.response&&c.validateResponse?.(o.response)?o.response:await vle(c,o)?gle(t,c,o,l):(await mle(c,o),Promise.reject(o))});return{requestInterceptorId:r,responseInterceptorId:s}};Yl.isNetworkError=uU;Yl.isSafeRequestError=hle;Yl.isIdempotentRequestError=fU;Yl.isNetworkOrIdempotentRequestError=cU;Yl.exponentialDelay=cle;Yl.isRetryableError=A9;var k6=Yl;Se();Ae();Ee();var jM=Zl(EW(),1);Se();Ae();Ee();var z1="1.2.0-alpha.2";var Sa=class{logger;silent=!1;constructor({level:e="info"}={}){if(e==="none"){this.silent=!0;return}this.logger=jM.default.createLogger({level:e,name:"ar-io-sdk",version:z1,serializers:jM.default.stdSerializers})}info(e,...r){this.silent||this.logger.info(...r,e)}warn(e,...r){this.silent||this.logger.warn(...r,e)}error(e,...r){this.silent||this.logger.error(...r,e)}debug(e,...r){this.silent||this.logger.debug(...r,e)}setLogLevel(e){if(e==="none"){this.silent=!0;return}this.logger.level(e)}};var AW=({axiosConfig:t={},logger:e=new Sa,retryConfig:r={retries:5,retryDelay:k6.exponentialDelay,retryCondition:s=>k6.isRetryableError(s),onRetry(s,o,l){e.error(`Retrying request ${l.url} attempt ${s}`,o)}}}={})=>{let s=R6.create({...t,maxRedirects:0,headers:{...t.headers,"x-source-version":`${z1}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return k6(s,r),s};Se();Ae();Ee();Se();Ae();Ee();Se();Ae();Ee();var Cu=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},Ub=class extends Cu{},TW=class extends Cu{},w0=class extends Cu{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},qb=class extends Cu{},Fb=class extends Cu{},xW=class extends Cu{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Ka=class extends Cu{constructor(){super("Invalid contract configuration")}},RW=class extends Cu{constructor(){super("Invalid process configuration")}},zM=class extends Cu{};var jb=class{axios;logger;constructor({url:e,logger:r=new Sa}){this.logger=r,this.axios=AW({axiosConfig:{baseURL:e},logger:this.logger})}async get({endpoint:e,signal:r,allowedStatuses:s=[200,202],headers:o,params:l}){this.logger.debug(`Get request to endpoint: ${e} with params ${JSON.stringify(l,void 0,2)}`);let{status:c,statusText:d,data:b}=await this.axios.get(e,{headers:o,signal:r,params:l});if(this.logger.debug(`Response status: ${c} ${d}`),!s.includes(c))switch(c){case 404:throw new Ub(d);case 400:throw new w0(c,d);default:throw new qb(d)}return b}};var _0=class{logger;http;contractTxId;cacheUrl;constructor({cacheUrl:e="https://api.arns.app",contractTxId:r,logger:s=new Sa}){this.cacheUrl=e,this.contractTxId=r,this.logger=s,this.http=new jb({url:`${e}/v1/contract/${r}`})}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async getState({evaluationOptions:e}={}){this.logger.debug("Fetching contract state",{contractTxId:this.contractTxId,evaluationOptions:e});let{state:r}=await this.http.get({endpoint:"",params:{...e?.evalTo}});return r}async readInteraction({functionName:e,inputs:r,evaluationOptions:s}){this.logger.debug("Evaluating read interaction on contract",{functionName:e,inputs:r,evaluationOptions:s});let{result:o}=await this.http.get({endpoint:`/read/${e}`,params:{...s?.evalTo,...r}});return o}};var kW=class{static createWriteableContract(e){if(!e||Object.keys(e).length===0)return new Ea({contractTxId:f6});if(Ic(e))return e.contract instanceof Ea?e.contract:new Ea(e.contract.configuration());if(Bc(e))return new Ea({contractTxId:e.contractTxId});throw new Ka}static init(e){if(e&&e.signer!==void 0){let{signer:r,...s}=e,o=this.createWriteableContract(s);return new WM({signer:r,contract:o})}else return new zb(e)}},zb=class{contract;constructor(e){if(!e||e===void 0)this.contract=new _0({contractTxId:f6});else if(Ic(e))this.contract=e.contract;else if(Bc(e))this.contract=new _0({contractTxId:e.contractTxId});else throw new Ka}async getState(e={}){return await this.contract.getState(e)}async getArNSRecord({domain:e,evaluationOptions:r}){return(await this.getArNSRecords({evaluationOptions:r}))[e]}async getArNSRecords({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).records}async getArNSReservedNames({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).reserved}async getArNSReservedName({domain:e,evaluationOptions:r}){return(await this.getArNSReservedNames({evaluationOptions:r}))[e]}async getBalance({address:e,evaluationOptions:r}){return(await this.getBalances({evaluationOptions:r}))[e]||0}async getBalances({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).balances}async getGateway({address:e,evaluationOptions:r}){return this.contract.readInteraction({functionName:vo.GATEWAY,inputs:{target:e},evaluationOptions:r}).catch(()=>{})}async getGateways({evaluationOptions:e}={}){return this.contract.readInteraction({functionName:vo.GATEWAYS,evaluationOptions:e})}async getCurrentEpoch({evaluationOptions:e}={}){return this.contract.readInteraction({functionName:vo.EPOCH,evaluationOptions:e})}async getEpoch({blockHeight:e,evaluationOptions:r}){return this.contract.readInteraction({functionName:vo.EPOCH,inputs:{height:e},evaluationOptions:r})}async getPrescribedObservers({evaluationOptions:e}={}){return this.contract.readInteraction({functionName:vo.PRESCRIBED_OBSERVERS,evaluationOptions:e})}async getObservations({evaluationOptions:e}={}){let{observations:r}=await this.contract.getState({evaluationOptions:e});return r}async getDistributions({evaluationOptions:e}={}){let{distributions:r}=await this.contract.getState({evaluationOptions:e});return r}async getAuction({domain:e,type:r,evaluationOptions:s}){return this.contract.readInteraction({functionName:vo.AUCTION,inputs:{name:e,type:r},evaluationOptions:s})}async getAuctions({evaluationOptions:e}={}){let{auctions:r}=await this.contract.getState({evaluationOptions:e});return r}async getPriceForInteraction({interactionName:e,payload:r,evaluationOptions:s}){let{price:o}=await this.contract.readInteraction({functionName:vo.PRICE_FOR_INTERACTION,inputs:{interactionName:e,...r},evaluationOptions:s});return o}},WM=class extends zb{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({contract:new Ea({contractTxId:f6})}),this.signer=e;else if(Ic(r))super({contract:r.contract}),this.signer=e;else if(Bc(r))super({contract:new Ea({contractTxId:r.contractTxId})}),this.signer=e;else throw new Ka}async transfer({target:e,qty:r,denomination:s="IO"},o){let l=r;return s==="IO"&&typeof r=="number"&&(l=new Dv(r).toMIO()),this.contract.writeInteraction({functionName:vo.TRANSFER,inputs:{target:e,qty:l.valueOf()},signer:this.signer},o)}async joinNetwork({qty:e,allowDelegatedStaking:r,delegateRewardShareRatio:s,fqdn:o,label:l,minDelegatedStake:c,note:d,port:b,properties:g,protocol:y,autoStake:m,observerWallet:_},T){return this.contract.writeInteraction({functionName:vo.JOIN_NETWORK,inputs:{qty:e.valueOf(),allowDelegatedStaking:r,delegateRewardShareRatio:s,fqdn:o,label:l,minDelegatedStake:c.valueOf(),note:d,port:b,properties:g,protocol:y,autoStake:m,observerWallet:_},signer:this.signer},T)}async updateGatewaySettings({allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:s,label:o,minDelegatedStake:l,note:c,port:d,properties:b,protocol:g,autoStake:y,observerWallet:m},_){return this.contract.writeInteraction({functionName:vo.UPDATE_GATEWAY_SETTINGS,inputs:{allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:s,label:o,minDelegatedStake:l?.valueOf(),note:c,port:d,properties:b,protocol:g,autoStake:y,observerWallet:m},signer:this.signer},_)}async increaseDelegateStake(e,r){return this.contract.writeInteraction({functionName:vo.DELEGATE_STAKE,inputs:{target:e.target,qty:e.qty.valueOf()},signer:this.signer},r)}async decreaseDelegateStake(e,r){return this.contract.writeInteraction({functionName:vo.DECREASE_DELEGATE_STAKE,inputs:{target:e.target,qty:e.qty.valueOf()},signer:this.signer},r)}async increaseOperatorStake(e,r){return this.contract.writeInteraction({functionName:vo.INCREASE_OPERATOR_STAKE,inputs:{qty:e.qty.valueOf()},signer:this.signer},r)}async decreaseOperatorStake(e,r){return this.contract.writeInteraction({functionName:vo.DECREASE_OPERATOR_STAKE,inputs:{qty:e.qty.valueOf()},signer:this.signer},r)}async saveObservations(e,r){return this.contract.writeInteraction({functionName:vo.SAVE_OBSERVATIONS,inputs:{observerReportTxId:e.reportTxId,failedGateways:e.failedGateways},signer:this.signer},r)}async extendLease(e,r){return this.contract.writeInteraction({functionName:vo.EXTEND_RECORD,inputs:{name:e.domain,years:e.years},signer:this.signer},r)}async increaseUndernameLimit(e,r){return this.contract.writeInteraction({functionName:vo.INCREASE_UNDERNAME_COUNT,inputs:{name:e.domain,qty:e.qty},signer:this.signer},r)}};Se();Ae();Ee();var IW=class{static createWriteableContract(e){if(Ic(e))return e.contract instanceof Ea?e.contract:new Ea(e.contract.configuration());if(Bc(e))return new Ea({contractTxId:e.contractTxId});throw new Ka}static init({signer:e,...r}){if(e){let s=this.createWriteableContract(r);return new KM({signer:e,contract:s})}else return new Wb(r)}},Wb=class{contract;constructor(e){if(Ic(e))this.contract=e.contract;else if(Bc(e))this.contract=new _0({contractTxId:e.contractTxId});else throw new Ka}async getState({evaluationOptions:e}={}){return await this.contract.getState({evaluationOptions:e})}async getRecord({domain:e,evaluationOptions:r}){return(await this.getRecords({evaluationOptions:r}))[e]}async getRecords({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).records}async getOwner({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).owner}async getControllers({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).controllers}async getName({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).name}async getTicker({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).ticker}async getBalances({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).balances}async getBalance({address:e,evaluationOptions:r}){return(await this.getBalances({evaluationOptions:r}))[e]||0}},KM=class extends Wb{signer;constructor({signer:e,...r}){if(Ic(r))super({contract:r.contract}),this.signer=e;else if(Bc(r))super({contract:new Ea({contractTxId:r.contractTxId})}),this.signer=e;else throw new Ka}async transfer({target:e},r){return this.contract.writeInteraction({functionName:kc.TRANSFER,inputs:{target:e},signer:this.signer},r)}async setController({controller:e},r){return this.contract.writeInteraction({functionName:kc.SET_CONTROLLER,inputs:{target:e},signer:this.signer},r)}async removeController({controller:e},r){return this.contract.writeInteraction({functionName:kc.REMOVE_CONTROLLER,inputs:{target:e},signer:this.signer},r)}async setRecord({subDomain:e,transactionId:r,ttlSeconds:s},o){return this.contract.writeInteraction({functionName:kc.SET_RECORD,inputs:{subDomain:e,transactionId:r,ttlSeconds:s},signer:this.signer},o)}async removeRecord({subDomain:e},r){return this.contract.writeInteraction({functionName:kc.REMOVE_RECORD,inputs:{subDomain:e},signer:this.signer},r)}async setTicker({ticker:e},r){return this.contract.writeInteraction({functionName:kc.SET_TICKER,inputs:{ticker:e},signer:this.signer},r)}async setName({name:e},r){return this.contract.writeInteraction({functionName:kc.SET_NAME,inputs:{name:e},signer:this.signer},r)}};Se();Ae();Ee();var Jne=Zl(nI(),1);Se();Ae();Ee();Se();Ae();Ee();var W_e=Object.create,kI=Object.defineProperty,K_e=Object.getOwnPropertyDescriptor,Pie=Object.getOwnPropertyNames,H_e=Object.getPrototypeOf,G_e=Object.prototype.hasOwnProperty,is=(t,e)=>function(){return e||(0,t[Pie(t)[0]])((e={exports:{}}).exports,e),e.exports},Nie=(t,e)=>{for(var r in e)kI(t,r,{get:e[r],enumerable:!0})},V_e=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pie(e))!G_e.call(t,o)&&o!==r&&kI(t,o,{get:()=>e[o],enumerable:!(s=K_e(e,o))||s.enumerable});return t},II=(t,e,r)=>(r=t!=null?W_e(H_e(t)):{},V_e(e||!t||!t.__esModule?kI(r,"default",{value:t,enumerable:!0}):r,t)),Z_e=is({"node_modules/obliterator/iterator.js"(t,e){function r(s){if(typeof s!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=s}typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var s=arguments,o=s.length,l=0;return new r(function(){return l>=o?{done:!0}:{done:!1,value:s[l++]}})},r.empty=function(){var s=new r(function(){return{done:!0}});return s},r.fromSequence=function(s){var o=0,l=s.length;return new r(function(){return o>=l?{done:!0}:{done:!1,value:s[o++]}})},r.is=function(s){return s instanceof r?!0:typeof s=="object"&&s!==null&&typeof s.next=="function"},e.exports=r}}),J_e=is({"node_modules/obliterator/support.js"(t){t.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",t.SYMBOL_SUPPORT=typeof Symbol<"u"}}),BI=is({"node_modules/obliterator/foreach.js"(t,e){var r=J_e(),s=r.ARRAY_BUFFER_SUPPORT,o=r.SYMBOL_SUPPORT;e.exports=function(c,d){var b,g,y,m,_;if(!c)throw new Error("obliterator/forEach: invalid iterable.");if(typeof d!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(c)||s&&ArrayBuffer.isView(c)||typeof c=="string"||c.toString()==="[object Arguments]"){for(y=0,m=c.length;y<m;y++)d(c[y],y);return}if(typeof c.forEach=="function"){c.forEach(d);return}if(o&&Symbol.iterator in c&&typeof c.next!="function"&&(c=c[Symbol.iterator]()),typeof c.next=="function"){for(b=c,y=0;_=b.next(),_.done!==!0;)d(_.value,y),y++;return}for(g in c)c.hasOwnProperty(g)&&d(c[g],g)}}}),OI=is({"node_modules/mnemonist/utils/typed-arrays.js"(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,s=Math.pow(2,32)-1,o=Math.pow(2,7)-1,l=Math.pow(2,15)-1,c=Math.pow(2,31)-1;t.getPointerArray=function(b){var g=b-1;if(g<=e)return Uint8Array;if(g<=r)return Uint16Array;if(g<=s)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(b){var g=b-1;return g<=o?Int8Array:g<=l?Int16Array:g<=c?Int32Array:Float64Array},t.getNumberType=function(b){return b===(b|0)?Math.sign(b)===-1?b<=127&&b>=-128?Int8Array:b<=32767&&b>=-32768?Int16Array:Int32Array:b<=255?Uint8Array:b<=65535?Uint16Array:Uint32Array:Float64Array};var d={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(b,g){var y=null,m=0,_,T,A,R,B;for(R=0,B=b.length;R<B;R++)A=g?g(b[R]):b[R],T=t.getNumberType(A),_=d[T.name],_>m&&(m=_,y=T);return y},t.isTypedArray=function(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(b)},t.concat=function(){var b=0,g,y,m;for(g=0,m=arguments.length;g<m;g++)b+=arguments[g].length;var _=new arguments[0].constructor(b);for(g=0,y=0;g<m;g++)_.set(arguments[g],y),y+=arguments[g].length;return _},t.indices=function(b){for(var g=t.getPointerArray(b),y=new g(b),m=0;m<b;m++)y[m]=m;return y}}}),Lie=is({"node_modules/mnemonist/utils/iterables.js"(t){var e=BI(),r=OI();function s(d){return Array.isArray(d)||r.isTypedArray(d)}function o(d){if(typeof d.length=="number")return d.length;if(typeof d.size=="number")return d.size}function l(d){var b=o(d),g=typeof b=="number"?new Array(b):[],y=0;return e(d,function(m){g[y++]=m}),g}function c(d){var b=o(d),g=typeof b=="number"?r.getPointerArray(b):Array,y=typeof b=="number"?new Array(b):[],m=typeof b=="number"?new g(b):[],_=0;return e(d,function(T){y[_]=T,m[_]=_++}),[y,m]}t.isArrayLike=s,t.guessLength=o,t.toArray=l,t.toArrayWithIndices=c}}),X_e=is({"node_modules/mnemonist/lru-cache.js"(t,e){var r=Z_e(),s=BI(),o=OI(),l=Lie();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var y=o.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items={}}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},c.prototype.splayOnTop=function(d){var b=this.head;if(this.head===d)return this;var g=this.backward[d],y=this.forward[d];return this.tail===d?this.tail=g:this.backward[y]=g,this.forward[g]=y,this.backward[b]=d,this.head=d,this.forward[d]=b,this},c.prototype.set=function(d,b){var g=this.items[d];if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],delete this.items[this.K[g]]),this.items[d]=g,this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,m=this.items[d];return typeof m<"u"?(this.splayOnTop(m),g=this.V[m],this.V[m]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?m=this.size++:(m=this.tail,this.tail=this.backward[m],g=this.V[m],y=this.K[m],delete this.items[y]),this.items[d]=m,this.K[m]=d,this.V[m]=b,this.forward[m]=this.head,this.backward[this.head]=m,this.head=m,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return d in this.items},c.prototype.get=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.V[b]},c.prototype.forEach=function(d,b){b=arguments.length>1?b:this;for(var g=0,y=this.size,m=this.head,_=this.K,T=this.V,A=this.forward;g<y;)d.call(b,T[m],_[m],this),m=A[m],g++},c.prototype.keys=function(){var d=0,b=this.size,g=this.head,y=this.K,m=this.forward;return new r(function(){if(d>=b)return{done:!0};var _=y[g];return d++,d<b&&(g=m[g]),{done:!1,value:_}})},c.prototype.values=function(){var d=0,b=this.size,g=this.head,y=this.V,m=this.forward;return new r(function(){if(d>=b)return{done:!0};var _=y[g];return d++,d<b&&(g=m[g]),{done:!1,value:_}})},c.prototype.entries=function(){var d=0,b=this.size,g=this.head,y=this.K,m=this.V,_=this.forward;return new r(function(){if(d>=b)return{done:!0};var T=y[g],A=m[g];return d++,d<b&&(g=_[g]),{done:!1,value:[T,A]}})},typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=function(){for(var d=new Map,b=this.entries(),g;g=b.next(),!g.done;)d.set(g.value[0],g.value[1]);return Object.defineProperty(d,"constructor",{value:c,enumerable:!1}),d},typeof Symbol<"u"&&(c.prototype[Symbol.for("nodejs.util.inspect.custom")]=c.prototype.inspect),c.from=function(d,b,g,y){if(arguments.length<2){if(y=l.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var m=new c(b,g,y);return s(d,function(_,T){m.set(T,_)}),m},e.exports=c}}),Y_e=is({"node_modules/mnemonist/lru-map.js"(t,e){var r=X_e(),s=BI(),o=OI(),l=Lie();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var y=o.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items=new Map}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},c.prototype.set=function(d,b){var g=this.items.get(d);if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],this.items.delete(this.K[g])),this.items.set(d,g),this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,m=this.items.get(d);return typeof m<"u"?(this.splayOnTop(m),g=this.V[m],this.V[m]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?m=this.size++:(m=this.tail,this.tail=this.backward[m],g=this.V[m],y=this.K[m],this.items.delete(y)),this.items.set(d,m),this.K[m]=d,this.V[m]=b,this.forward[m]=this.head,this.backward[this.head]=m,this.head=m,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return this.items.has(d)},c.prototype.get=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.V[b]},c.prototype.splayOnTop=r.prototype.splayOnTop,c.prototype.forEach=r.prototype.forEach,c.prototype.keys=r.prototype.keys,c.prototype.values=r.prototype.values,c.prototype.entries=r.prototype.entries,typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=r.prototype.inspect,c.from=function(d,b,g,y){if(arguments.length<2){if(y=l.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var m=new c(b,g,y);return s(d,function(_,T){m.set(T,_)}),m},e.exports=c}}),Q_e=is({"node_modules/ms/index.js"(t,e){var r=1e3,s=r*60,o=s*60,l=o*24,c=l*7,d=l*365.25;e.exports=function(_,T){T=T||{};var A=typeof _;if(A==="string"&&_.length>0)return b(_);if(A==="number"&&isFinite(_))return T.long?y(_):g(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function b(_){if(_=String(_),!(_.length>100)){var T=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(T){var A=parseFloat(T[1]),R=(T[2]||"ms").toLowerCase();switch(R){case"years":case"year":case"yrs":case"yr":case"y":return A*d;case"weeks":case"week":case"w":return A*c;case"days":case"day":case"d":return A*l;case"hours":case"hour":case"hrs":case"hr":case"h":return A*o;case"minutes":case"minute":case"mins":case"min":case"m":return A*s;case"seconds":case"second":case"secs":case"sec":case"s":return A*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function g(_){var T=Math.abs(_);return T>=l?Math.round(_/l)+"d":T>=o?Math.round(_/o)+"h":T>=s?Math.round(_/s)+"m":T>=r?Math.round(_/r)+"s":_+"ms"}function y(_){var T=Math.abs(_);return T>=l?m(_,T,l,"day"):T>=o?m(_,T,o,"hour"):T>=s?m(_,T,s,"minute"):T>=r?m(_,T,r,"second"):_+" ms"}function m(_,T,A,R){var B=T>=A*1.5;return Math.round(_/A)+" "+R+(B?"s":"")}}}),eMe=is({"node_modules/debug/src/common.js"(t,e){function r(s){l.debug=l,l.default=l,l.coerce=m,l.disable=b,l.enable=d,l.enabled=g,l.humanize=Q_e(),l.destroy=_,Object.keys(s).forEach(T=>{l[T]=s[T]}),l.names=[],l.skips=[],l.formatters={};function o(T){let A=0;for(let R=0;R<T.length;R++)A=(A<<5)-A+T.charCodeAt(R),A|=0;return l.colors[Math.abs(A)%l.colors.length]}l.selectColor=o;function l(T){let A,R=null,B,C;function P(...N){if(!P.enabled)return;let q=P,z=Number(new Date),J=z-(A||z);q.diff=J,q.prev=A,q.curr=z,A=z,N[0]=l.coerce(N[0]),typeof N[0]!="string"&&N.unshift("%O");let F=0;N[0]=N[0].replace(/%([a-zA-Z%])/g,(Y,E)=>{if(Y==="%%")return"%";F++;let n=l.formatters[E];if(typeof n=="function"){let u=N[F];Y=n.call(q,u),N.splice(F,1),F--}return Y}),l.formatArgs.call(q,N),(q.log||l.log).apply(q,N)}return P.namespace=T,P.useColors=l.useColors(),P.color=l.selectColor(T),P.extend=c,P.destroy=l.destroy,Object.defineProperty(P,"enabled",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(B!==l.namespaces&&(B=l.namespaces,C=l.enabled(T)),C),set:N=>{R=N}}),typeof l.init=="function"&&l.init(P),P}function c(T,A){let R=l(this.namespace+(typeof A>"u"?":":A)+T);return R.log=this.log,R}function d(T){l.save(T),l.namespaces=T,l.names=[],l.skips=[];let A,R=(typeof T=="string"?T:"").split(/[\s,]+/),B=R.length;for(A=0;A<B;A++)R[A]&&(T=R[A].replace(/\*/g,".*?"),T[0]==="-"?l.skips.push(new RegExp("^"+T.slice(1)+"$")):l.names.push(new RegExp("^"+T+"$")))}function b(){let T=[...l.names.map(y),...l.skips.map(y).map(A=>"-"+A)].join(",");return l.enable(""),T}function g(T){if(T[T.length-1]==="*")return!0;let A,R;for(A=0,R=l.skips.length;A<R;A++)if(l.skips[A].test(T))return!1;for(A=0,R=l.names.length;A<R;A++)if(l.names[A].test(T))return!0;return!1}function y(T){return T.toString().substring(2,T.toString().length-2).replace(/\.\*\?$/,"*")}function m(T){return T instanceof Error?T.stack||T.message:T}function _(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return l.enable(l.load()),l}e.exports=r}}),tMe=is({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=s,t.save=o,t.load=l,t.useColors=r,t.storage=c(),t.destroy=(()=>{let b=!1;return()=>{b||(b=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let g="color: "+this.color;b.splice(1,0,g,"color: inherit");let y=0,m=0;b[0].replace(/%[a-zA-Z%]/g,_=>{_!=="%%"&&(y++,_==="%c"&&(m=y))}),b.splice(m,0,g)}t.log=console.debug||console.log||(()=>{});function o(b){try{b?t.storage.setItem("debug",b):t.storage.removeItem("debug")}catch{}}function l(){let b;try{b=t.storage.getItem("debug")}catch{}return!b&&typeof gt<"u"&&"env"in gt&&(b=gt.env.DEBUG),b}function c(){try{return localStorage}catch{}}e.exports=eMe()(t);var{formatters:d}=e.exports;d.j=function(b){try{return JSON.stringify(b)}catch(g){return"[UnexpectedJSONParseError]: "+g.message}}}}),rMe=is({"node_modules/base64-js/index.js"(t){"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=T;var e=[],r=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)e[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function d(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function b(A){var R=d(A),B=R[0],C=R[1];return(B+C)*3/4-C}function g(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=d(A),C=B[0],P=B[1],N=new s(g(A,C,P)),q=0,z=P>0?C-4:C,J;for(J=0;J<z;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function m(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function _(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(m(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,z=B-C;q<z;q+=N)P.push(_(A,q,q+N>z?z:q+N));return C===1?(R=A[B-1],P.push(e[R>>2]+e[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(e[R>>10]+e[R>>4&63]+e[R<<2&63]+"=")),P.join("")}}}),iMe=is({"node_modules/ieee754/index.js"(t){t.read=function(e,r,s,o,l){var c,d,b=l*8-o-1,g=(1<<b)-1,y=g>>1,m=-7,_=s?l-1:0,T=s?-1:1,A=e[r+_];for(_+=T,c=A&(1<<-m)-1,A>>=-m,m+=b;m>0;c=c*256+e[r+_],_+=T,m-=8);for(d=c&(1<<-m)-1,c>>=-m,m+=o;m>0;d=d*256+e[r+_],_+=T,m-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,o),c=c-y}return(A?-1:1)*d*Math.pow(2,c-o)},t.write=function(e,r,s,o,l,c){var d,b,g,y=c*8-l-1,m=(1<<y)-1,_=m>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=m):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+_>=1?r+=T/g:r+=T*Math.pow(2,1-_),r*g>=2&&(d++,g/=2),d+_>=m?(b=0,d=m):d+_>=1?(b=(r*g-1)*Math.pow(2,l),d=d+_):(b=r*Math.pow(2,_-1)*Math.pow(2,l),d=0));l>=8;e[s+A]=b&255,A+=R,b/=256,l-=8);for(d=d<<l|b,y+=l;y>0;e[s+A]=d&255,A+=R,d/=256,y-=8);e[s+A-R]|=B*128}}}),nMe=is({"node_modules/buffer/index.js"(t){"use strict";var e=rMe(),r=iMe(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=P,t.INSPECT_MAX_BYTES=50;var o=2147483647;t.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,d.prototype),O}function d(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(I)}return b(I,O,L)}d.poolSize=8192;function b(I,O,L){if(typeof I=="string")return _(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(ge(I,ArrayBuffer)||I&&ge(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(I,SharedArrayBuffer)||I&&ge(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return d.from(V,O,L);let se=B(I);if(se)return se;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return d.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}d.from=function(I,O,L){return b(I,O,L)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return g(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}d.alloc=function(I,O,L){return y(I,O,L)};function m(I){return g(I),c(I<0?0:C(I)|0)}d.allocUnsafe=function(I){return m(I)},d.allocUnsafeSlow=function(I){return m(I)};function _(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!d.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),se=V.write(I,O);return se!==L&&(V=V.slice(0,se)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(ge(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,d.prototype),V}function B(I){if(d.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||we(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),d.alloc(+I)}d.isBuffer=function(O){return O!=null&&O._isBuffer===!0&&O!==d.prototype},d.compare=function(O,L){if(ge(O,Uint8Array)&&(O=d.from(O,O.offset,O.byteLength)),ge(L,Uint8Array)&&(L=d.from(L,L.offset,L.byteLength)),!d.isBuffer(O)||!d.isBuffer(L))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(O===L)return 0;let V=O.length,se=L.length;for(let he=0,ue=Math.min(V,se);he<ue;++he)if(O[he]!==L[he]){V=O[he],se=L[he];break}return V<se?-1:se<V?1:0},d.isEncoding=function(O){switch(String(O).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(O,L){if(!Array.isArray(O))throw new TypeError('"list" argument must be an Array of Buffers');if(O.length===0)return d.alloc(0);let V;if(L===void 0)for(L=0,V=0;V<O.length;++V)L+=O[V].length;let se=d.allocUnsafe(L),he=0;for(V=0;V<O.length;++V){let ue=O[V];if(ge(ue,Uint8Array))he+ue.length>se.length?(d.isBuffer(ue)||(ue=d.from(ue)),ue.copy(se,he)):Uint8Array.prototype.set.call(se,ue,he);else if(d.isBuffer(ue))ue.copy(se,he);else throw new TypeError('"list" argument must be an Array of Buffers');he+=ue.length}return se};function N(I,O){if(d.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||ge(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let se=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return fe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return be(I).length;default:if(se)return V?-1:fe(I).length;O=(""+O).toLowerCase(),se=!0}}d.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return i(this,O,L);case"utf8":case"utf-8":return p(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return h(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}d.prototype._isBuffer=!0;function z(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}d.prototype.swap16=function(){let O=this.length;if(O%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let L=0;L<O;L+=2)z(this,L,L+1);return this},d.prototype.swap32=function(){let O=this.length;if(O%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let L=0;L<O;L+=4)z(this,L,L+3),z(this,L+1,L+2);return this},d.prototype.swap64=function(){let O=this.length;if(O%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let L=0;L<O;L+=8)z(this,L,L+7),z(this,L+1,L+6),z(this,L+2,L+5),z(this,L+3,L+4);return this},d.prototype.toString=function(){let O=this.length;return O===0?"":arguments.length===0?p(this,0,O):q.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(O){if(!d.isBuffer(O))throw new TypeError("Argument must be a Buffer");return this===O?!0:d.compare(this,O)===0},d.prototype.inspect=function(){let O="",L=t.INSPECT_MAX_BYTES;return O=this.toString("hex",0,L).replace(/(.{2})/g,"$1 ").trim(),this.length>L&&(O+=" ... "),"<Buffer "+O+">"},s&&(d.prototype[s]=d.prototype.inspect),d.prototype.compare=function(O,L,V,se,he){if(ge(O,Uint8Array)&&(O=d.from(O,O.offset,O.byteLength)),!d.isBuffer(O))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof O);if(L===void 0&&(L=0),V===void 0&&(V=O?O.length:0),se===void 0&&(se=0),he===void 0&&(he=this.length),L<0||V>O.length||se<0||he>this.length)throw new RangeError("out of range index");if(se>=he&&L>=V)return 0;if(se>=he)return-1;if(L>=V)return 1;if(L>>>=0,V>>>=0,se>>>=0,he>>>=0,this===O)return 0;let ue=he-se,xe=V-L,_e=Math.min(ue,xe),me=this.slice(se,he),Qe=O.slice(L,V);for(let Ie=0;Ie<_e;++Ie)if(me[Ie]!==Qe[Ie]){ue=me[Ie],xe=Qe[Ie];break}return ue<xe?-1:xe<ue?1:0};function J(I,O,L,V,se){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,we(L)&&(L=se?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(se)return-1;L=I.length-1}else if(L<0)if(se)L=0;else return-1;if(typeof O=="string"&&(O=d.from(O,V)),d.isBuffer(O))return O.length===0?-1:F(I,O,L,V,se);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?se?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,se);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,se){let he=1,ue=I.length,xe=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;he=2,ue/=2,xe/=2,L/=2}function _e(Qe,Ie){return he===1?Qe[Ie]:Qe.readUInt16BE(Ie*he)}let me;if(se){let Qe=-1;for(me=L;me<ue;me++)if(_e(I,me)===_e(O,Qe===-1?0:me-Qe)){if(Qe===-1&&(Qe=me),me-Qe+1===xe)return Qe*he}else Qe!==-1&&(me-=me-Qe),Qe=-1}else for(L+xe>ue&&(L=ue-xe),me=L;me>=0;me--){let Qe=!0;for(let Ie=0;Ie<xe;Ie++)if(_e(I,me+Ie)!==_e(O,Ie)){Qe=!1;break}if(Qe)return me}return-1}d.prototype.includes=function(O,L,V){return this.indexOf(O,L,V)!==-1},d.prototype.indexOf=function(O,L,V){return J(this,O,L,V,!0)},d.prototype.lastIndexOf=function(O,L,V){return J(this,O,L,V,!1)};function H(I,O,L,V){L=Number(L)||0;let se=I.length-L;V?(V=Number(V),V>se&&(V=se)):V=se;let he=O.length;V>he/2&&(V=he/2);let ue;for(ue=0;ue<V;++ue){let xe=parseInt(O.substr(ue*2,2),16);if(we(xe))return ue;I[L+ue]=xe}return ue}function Y(I,O,L,V){return le(fe(O,I.length-L),I,L,V)}function E(I,O,L,V){return le(pe(O),I,L,V)}function n(I,O,L,V){return le(be(O),I,L,V)}function u(I,O,L,V){return le(Te(O,I.length-L),I,L,V)}d.prototype.write=function(O,L,V,se){if(L===void 0)se="utf8",V=this.length,L=0;else if(V===void 0&&typeof L=="string")se=L,V=this.length,L=0;else if(isFinite(L))L=L>>>0,isFinite(V)?(V=V>>>0,se===void 0&&(se="utf8")):(se=V,V=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let he=this.length-L;if((V===void 0||V>he)&&(V=he),O.length>0&&(V<0||L<0)||L>this.length)throw new RangeError("Attempt to write outside buffer bounds");se||(se="utf8");let ue=!1;for(;;)switch(se){case"hex":return H(this,O,L,V);case"utf8":case"utf-8":return Y(this,O,L,V);case"ascii":case"latin1":case"binary":return E(this,O,L,V);case"base64":return n(this,O,L,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,O,L,V);default:if(ue)throw new TypeError("Unknown encoding: "+se);se=(""+se).toLowerCase(),ue=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function h(I,O,L){return O===0&&L===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(O,L))}function p(I,O,L){L=Math.min(I.length,L);let V=[],se=O;for(;se<L;){let he=I[se],ue=null,xe=he>239?4:he>223?3:he>191?2:1;if(se+xe<=L){let _e,me,Qe,Ie;switch(xe){case 1:he<128&&(ue=he);break;case 2:_e=I[se+1],(_e&192)===128&&(Ie=(he&31)<<6|_e&63,Ie>127&&(ue=Ie));break;case 3:_e=I[se+1],me=I[se+2],(_e&192)===128&&(me&192)===128&&(Ie=(he&15)<<12|(_e&63)<<6|me&63,Ie>2047&&(Ie<55296||Ie>57343)&&(ue=Ie));break;case 4:_e=I[se+1],me=I[se+2],Qe=I[se+3],(_e&192)===128&&(me&192)===128&&(Qe&192)===128&&(Ie=(he&15)<<18|(_e&63)<<12|(me&63)<<6|Qe&63,Ie>65535&&Ie<1114112&&(ue=Ie))}}ue===null?(ue=65533,xe=1):ue>65535&&(ue-=65536,V.push(ue>>>10&1023|55296),ue=56320|ue&1023),V.push(ue),se+=xe}return S(V)}var v=4096;function S(I){let O=I.length;if(O<=v)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=v));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]);return V}function i(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let se="";for(let he=O;he<L;++he)se+=Me[I[he]];return se}function f(I,O,L){let V=I.slice(O,L),se="";for(let he=0;he<V.length-1;he+=2)se+=String.fromCharCode(V[he]+V[he+1]*256);return se}d.prototype.slice=function(O,L){let V=this.length;O=~~O,L=L===void 0?V:~~L,O<0?(O+=V,O<0&&(O=0)):O>V&&(O=V),L<0?(L+=V,L<0&&(L=0)):L>V&&(L=V),L<O&&(L=O);let se=this.subarray(O,L);return Object.setPrototypeOf(se,d.prototype),se};function w(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=this[O],he=1,ue=0;for(;++ue<L&&(he*=256);)se+=this[O+ue]*he;return se},d.prototype.readUintBE=d.prototype.readUIntBE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=this[O+--L],he=1;for(;L>0&&(he*=256);)se+=this[O+--L]*he;return se},d.prototype.readUint8=d.prototype.readUInt8=function(O,L){return O=O>>>0,L||w(O,1,this.length),this[O]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(O,L){return O=O>>>0,L||w(O,2,this.length),this[O]|this[O+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(O,L){return O=O>>>0,L||w(O,2,this.length),this[O]<<8|this[O+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(O,L){return O=O>>>0,L||w(O,4,this.length),(this[O]|this[O+1]<<8|this[O+2]<<16)+this[O+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(O,L){return O=O>>>0,L||w(O,4,this.length),this[O]*16777216+(this[O+1]<<16|this[O+2]<<8|this[O+3])},d.prototype.readBigUInt64LE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=L+this[++O]*2**8+this[++O]*2**16+this[++O]*2**24,he=this[++O]+this[++O]*2**8+this[++O]*2**16+V*2**24;return BigInt(se)+(BigInt(he)<<BigInt(32))}),d.prototype.readBigUInt64BE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=L*2**24+this[++O]*2**16+this[++O]*2**8+this[++O],he=this[++O]*2**24+this[++O]*2**16+this[++O]*2**8+V;return(BigInt(se)<<BigInt(32))+BigInt(he)}),d.prototype.readIntLE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=this[O],he=1,ue=0;for(;++ue<L&&(he*=256);)se+=this[O+ue]*he;return he*=128,se>=he&&(se-=Math.pow(2,8*L)),se},d.prototype.readIntBE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=L,he=1,ue=this[O+--se];for(;se>0&&(he*=256);)ue+=this[O+--se]*he;return he*=128,ue>=he&&(ue-=Math.pow(2,8*L)),ue},d.prototype.readInt8=function(O,L){return O=O>>>0,L||w(O,1,this.length),this[O]&128?(255-this[O]+1)*-1:this[O]},d.prototype.readInt16LE=function(O,L){O=O>>>0,L||w(O,2,this.length);let V=this[O]|this[O+1]<<8;return V&32768?V|4294901760:V},d.prototype.readInt16BE=function(O,L){O=O>>>0,L||w(O,2,this.length);let V=this[O+1]|this[O]<<8;return V&32768?V|4294901760:V},d.prototype.readInt32LE=function(O,L){return O=O>>>0,L||w(O,4,this.length),this[O]|this[O+1]<<8|this[O+2]<<16|this[O+3]<<24},d.prototype.readInt32BE=function(O,L){return O=O>>>0,L||w(O,4,this.length),this[O]<<24|this[O+1]<<16|this[O+2]<<8|this[O+3]},d.prototype.readBigInt64LE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=this[O+4]+this[O+5]*2**8+this[O+6]*2**16+(V<<24);return(BigInt(se)<<BigInt(32))+BigInt(L+this[++O]*2**8+this[++O]*2**16+this[++O]*2**24)}),d.prototype.readBigInt64BE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=(L<<24)+this[++O]*2**16+this[++O]*2**8+this[++O];return(BigInt(se)<<BigInt(32))+BigInt(this[++O]*2**24+this[++O]*2**16+this[++O]*2**8+V)}),d.prototype.readFloatLE=function(O,L){return O=O>>>0,L||w(O,4,this.length),r.read(this,O,!0,23,4)},d.prototype.readFloatBE=function(O,L){return O=O>>>0,L||w(O,4,this.length),r.read(this,O,!1,23,4)},d.prototype.readDoubleLE=function(O,L){return O=O>>>0,L||w(O,8,this.length),r.read(this,O,!0,52,8)},d.prototype.readDoubleBE=function(O,L){return O=O>>>0,L||w(O,8,this.length),r.read(this,O,!1,52,8)};function M(I,O,L,V,se,he){if(!d.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>se||O<he)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(O,L,V,se){if(O=+O,L=L>>>0,V=V>>>0,!se){let xe=Math.pow(2,8*V)-1;M(this,O,L,V,xe,0)}let he=1,ue=0;for(this[L]=O&255;++ue<V&&(he*=256);)this[L+ue]=O/he&255;return L+V},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(O,L,V,se){if(O=+O,L=L>>>0,V=V>>>0,!se){let xe=Math.pow(2,8*V)-1;M(this,O,L,V,xe,0)}let he=V-1,ue=1;for(this[L+he]=O&255;--he>=0&&(ue*=256);)this[L+he]=O/ue&255;return L+V},d.prototype.writeUint8=d.prototype.writeUInt8=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,1,255,0),this[L]=O&255,L+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,65535,0),this[L]=O&255,this[L+1]=O>>>8,L+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,65535,0),this[L]=O>>>8,this[L+1]=O&255,L+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,4294967295,0),this[L+3]=O>>>24,this[L+2]=O>>>16,this[L+1]=O>>>8,this[L]=O&255,L+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,4294967295,0),this[L]=O>>>24,this[L+1]=O>>>16,this[L+2]=O>>>8,this[L+3]=O&255,L+4};function k(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,L}function $(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L+7]=he,he=he>>8,I[L+6]=he,he=he>>8,I[L+5]=he,he=he>>8,I[L+4]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ue,ue=ue>>8,I[L+2]=ue,ue=ue>>8,I[L+1]=ue,ue=ue>>8,I[L]=ue,L+8}d.prototype.writeBigUInt64LE=nt(function(O,L=0){return k(this,O,L,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=nt(function(O,L=0){return $(this,O,L,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(O,L,V,se){if(O=+O,L=L>>>0,!se){let _e=Math.pow(2,8*V-1);M(this,O,L,V,_e-1,-_e)}let he=0,ue=1,xe=0;for(this[L]=O&255;++he<V&&(ue*=256);)O<0&&xe===0&&this[L+he-1]!==0&&(xe=1),this[L+he]=(O/ue>>0)-xe&255;return L+V},d.prototype.writeIntBE=function(O,L,V,se){if(O=+O,L=L>>>0,!se){let _e=Math.pow(2,8*V-1);M(this,O,L,V,_e-1,-_e)}let he=V-1,ue=1,xe=0;for(this[L+he]=O&255;--he>=0&&(ue*=256);)O<0&&xe===0&&this[L+he+1]!==0&&(xe=1),this[L+he]=(O/ue>>0)-xe&255;return L+V},d.prototype.writeInt8=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,1,127,-128),O<0&&(O=255+O+1),this[L]=O&255,L+1},d.prototype.writeInt16LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,32767,-32768),this[L]=O&255,this[L+1]=O>>>8,L+2},d.prototype.writeInt16BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,32767,-32768),this[L]=O>>>8,this[L+1]=O&255,L+2},d.prototype.writeInt32LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,2147483647,-2147483648),this[L]=O&255,this[L+1]=O>>>8,this[L+2]=O>>>16,this[L+3]=O>>>24,L+4},d.prototype.writeInt32BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,2147483647,-2147483648),O<0&&(O=4294967295+O+1),this[L]=O>>>24,this[L+1]=O>>>16,this[L+2]=O>>>8,this[L+3]=O&255,L+4},d.prototype.writeBigInt64LE=nt(function(O,L=0){return k(this,O,L,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=nt(function(O,L=0){return $(this,O,L,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ie(I,O,L,V,se,he){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}d.prototype.writeFloatLE=function(O,L,V){return Z(this,O,L,!0,V)},d.prototype.writeFloatBE=function(O,L,V){return Z(this,O,L,!1,V)};function te(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}d.prototype.writeDoubleLE=function(O,L,V){return te(this,O,L,!0,V)},d.prototype.writeDoubleBE=function(O,L,V){return te(this,O,L,!1,V)},d.prototype.copy=function(O,L,V,se){if(!d.isBuffer(O))throw new TypeError("argument should be a Buffer");if(V||(V=0),!se&&se!==0&&(se=this.length),L>=O.length&&(L=O.length),L||(L=0),se>0&&se<V&&(se=V),se===V||O.length===0||this.length===0)return 0;if(L<0)throw new RangeError("targetStart out of bounds");if(V<0||V>=this.length)throw new RangeError("Index out of range");if(se<0)throw new RangeError("sourceEnd out of bounds");se>this.length&&(se=this.length),O.length-L<se-V&&(se=O.length-L+V);let he=se-V;return this===O&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(L,V,se):Uint8Array.prototype.set.call(O,this.subarray(V,se),L),he},d.prototype.fill=function(O,L,V,se){if(typeof O=="string"){if(typeof L=="string"?(se=L,L=0,V=this.length):typeof V=="string"&&(se=V,V=this.length),se!==void 0&&typeof se!="string")throw new TypeError("encoding must be a string");if(typeof se=="string"&&!d.isEncoding(se))throw new TypeError("Unknown encoding: "+se);if(O.length===1){let ue=O.charCodeAt(0);(se==="utf8"&&ue<128||se==="latin1")&&(O=ue)}}else typeof O=="number"?O=O&255:typeof O=="boolean"&&(O=Number(O));if(L<0||this.length<L||this.length<V)throw new RangeError("Out of range index");if(V<=L)return this;L=L>>>0,V=V===void 0?this.length:V>>>0,O||(O=0);let he;if(typeof O=="number")for(he=L;he<V;++he)this[he]=O;else{let ue=d.isBuffer(O)?O:d.from(O,se),xe=ue.length;if(xe===0)throw new TypeError('The value "'+O+'" is invalid for argument "value"');for(he=0;he<V-L;++he)this[he+L]=ue[he%xe]}return this};var Q={};function W(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(se){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:se,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),W("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,se=L;return Number.isInteger(L)&&Math.abs(L)>2**32?se=ee(String(L)):typeof L=="bigint"&&(se=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(se=ee(se)),se+="n"),V+=` It must be ${O}. Received ${se}`,V},RangeError);function ee(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&re(O,I.length-(L+1))}function U(I,O,L,V,se,he){if(I>L||I<O){let ue=typeof O=="bigint"?"n":"",xe;throw he>3?O===0||O===BigInt(0)?xe=`>= 0${ue} and < 2${ue} ** ${(he+1)*8}${ue}`:xe=`>= -(2${ue} ** ${(he+1)*8-1}${ue}) and < 2 ** ${(he+1)*8-1}${ue}`:xe=`>= ${O}${ue} and <= ${L}${ue}`,new Q.ERR_OUT_OF_RANGE("value",xe,I)}X(V,se,he)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function re(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var oe=/[^+/0-9A-Za-z-_]/g;function ce(I){if(I=I.split("=")[0],I=I.trim().replace(oe,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function fe(I,O){O=O||1/0;let L,V=I.length,se=null,he=[];for(let ue=0;ue<V;++ue){if(L=I.charCodeAt(ue),L>55295&&L<57344){if(!se){if(L>56319){(O-=3)>-1&&he.push(239,191,189);continue}else if(ue+1===V){(O-=3)>-1&&he.push(239,191,189);continue}se=L;continue}if(L<56320){(O-=3)>-1&&he.push(239,191,189),se=L;continue}L=(se-55296<<10|L-56320)+65536}else se&&(O-=3)>-1&&he.push(239,191,189);if(se=null,L<128){if((O-=1)<0)break;he.push(L)}else if(L<2048){if((O-=2)<0)break;he.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;he.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;he.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return he}function pe(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function Te(I,O){let L,V,se,he=[];for(let ue=0;ue<I.length&&!((O-=2)<0);++ue)L=I.charCodeAt(ue),V=L>>8,se=L%256,he.push(se),he.push(V);return he}function be(I){return e.toByteArray(ce(I))}function le(I,O,L,V){let se;for(se=0;se<V&&!(se+L>=O.length||se>=I.length);++se)O[se+L]=I[se];return se}function ge(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function we(I){return I!==I}var Me=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let se=0;se<16;++se)O[V+se]=I[L]+I[se]}return O}();function nt(I){return typeof BigInt>"u"?ne:I}function ne(){throw new Error("BigInt not supported")}}});function bn(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function la(t){return function e(r){return arguments.length===0||bn(r)?e:t.apply(this,arguments)}}function zn(t){return function e(r,s){switch(arguments.length){case 0:return e;case 1:return bn(r)?e:la(function(o){return t(r,o)});default:return bn(r)&&bn(s)?e:bn(r)?la(function(o){return t(o,s)}):bn(s)?la(function(o){return t(r,o)}):t(r,s)}}}function _4(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,s){return e.apply(this,arguments)};case 3:return function(r,s,o){return e.apply(this,arguments)};case 4:return function(r,s,o,l){return e.apply(this,arguments)};case 5:return function(r,s,o,l,c){return e.apply(this,arguments)};case 6:return function(r,s,o,l,c,d){return e.apply(this,arguments)};case 7:return function(r,s,o,l,c,d,b){return e.apply(this,arguments)};case 8:return function(r,s,o,l,c,d,b,g){return e.apply(this,arguments)};case 9:return function(r,s,o,l,c,d,b,g,y){return e.apply(this,arguments)};case 10:return function(r,s,o,l,c,d,b,g,y,m){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Die(t,e,r){return function(){for(var s=[],o=0,l=t,c=0,d=!1;c<e.length||o<arguments.length;){var b;c<e.length&&(!bn(e[c])||o>=arguments.length)?b=e[c]:(b=arguments[o],o+=1),s[c]=b,bn(b)?d=!0:l-=1,c+=1}return!d&&l<=0?r.apply(this,s):_4(Math.max(0,l),Die(t,s,r))}}var oMe=zn(function(t,e){return t===1?la(e):_4(t,Die(t,[],e))}),$ie=oMe;function CI(t){return function e(r,s,o){switch(arguments.length){case 0:return e;case 1:return bn(r)?e:zn(function(l,c){return t(r,l,c)});case 2:return bn(r)&&bn(s)?e:bn(r)?zn(function(l,c){return t(l,s,c)}):bn(s)?zn(function(l,c){return t(r,l,c)}):la(function(l){return t(r,s,l)});default:return bn(r)&&bn(s)&&bn(o)?e:bn(r)&&bn(s)?zn(function(l,c){return t(l,c,o)}):bn(r)&&bn(o)?zn(function(l,c){return t(l,s,c)}):bn(s)&&bn(o)?zn(function(l,c){return t(r,l,c)}):bn(r)?la(function(l){return t(l,s,o)}):bn(s)?la(function(l){return t(r,l,o)}):bn(o)?la(function(l){return t(r,s,l)}):t(r,s,o)}}}var PI=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function aMe(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function NI(t,e,r){return function(){if(arguments.length===0)return r();var s=arguments[arguments.length-1];if(!PI(s)){for(var o=0;o<t.length;){if(typeof s[t[o]]=="function")return s[t[o]].apply(s,Array.prototype.slice.call(arguments,0,-1));o+=1}if(aMe(s)){var l=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return l(s)}}return r.apply(this,arguments)}}function sMe(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}var Hm={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}};function cie(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function lie(t,e,r){for(var s=0,o=r.length;s<o;){if(t(e,r[s]))return!0;s+=1}return!1}function uMe(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function o4(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function hMe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var oI=typeof Object.is=="function"?Object.is:hMe,die=Object.prototype.toString,fMe=function(){return die.call(arguments)==="[object Arguments]"?function(t){return die.call(t)==="[object Arguments]"}:function(t){return o4("callee",t)}}(),cMe=fMe,lMe=!{toString:null}.propertyIsEnumerable("toString"),pie=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],vie=function(){"use strict";return arguments.propertyIsEnumerable("length")}(),dMe=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1},pMe=la(typeof Object.keys=="function"&&!vie?function(t){return Object(t)!==t?[]:Object.keys(t)}:function(t){if(Object(t)!==t)return[];var e,r,s=[],o=vie&&cMe(t);for(e in t)o4(e,t)&&(!o||e!=="length")&&(s[s.length]=e);if(lMe)for(r=pie.length-1;r>=0;)e=pie[r],o4(e,t)&&!dMe(s,e)&&(s[s.length]=e),r-=1;return s}),Bp=pMe,vMe=la(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),gie=vMe;function mie(t,e,r,s){var o=cie(t),l=cie(e);function c(d,b){return LI(d,b,r.slice(),s.slice())}return!lie(function(d,b){return!lie(c,b,d)},l,o)}function LI(t,e,r,s){if(oI(t,e))return!0;var o=gie(t);if(o!==gie(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(o){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&uMe(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&oI(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!oI(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var l=r.length-1;l>=0;){if(r[l]===t)return s[l]===e;l-=1}switch(o){case"Map":return t.size!==e.size?!1:mie(t.entries(),e.entries(),r.concat([t]),s.concat([e]));case"Set":return t.size!==e.size?!1:mie(t.values(),e.values(),r.concat([t]),s.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=Bp(t);if(c.length!==Bp(e).length)return!1;var d=r.concat([t]),b=s.concat([e]);for(l=c.length-1;l>=0;){var g=c[l];if(!(o4(g,e)&&LI(e[g],t[g],d,b)))return!1;l-=1}return!0}var gMe=zn(function(t,e){return LI(t,e,[],[])}),Uie=gMe;function mMe(t,e,r){var s,o;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(s=1/e;r<t.length;){if(o=t[r],o===0&&1/o===s)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(o=t[r],typeof o=="number"&&o!==o)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(Uie(t[r],e))return r;r+=1}return-1}function yMe(t,e){return mMe(e,t,0)>=0}function Wm(t,e){for(var r=0,s=e.length,o=Array(s);r<s;)o[r]=t(e[r]),r+=1;return o}function aI(t){var e=t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var $m=function(t){return(t<10?"0":"")+t},bMe=typeof Date.prototype.toISOString=="function"?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+$m(t.getUTCMonth()+1)+"-"+$m(t.getUTCDate())+"T"+$m(t.getUTCHours())+":"+$m(t.getUTCMinutes())+":"+$m(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},wMe=bMe;function _Me(t){return function(){return!t.apply(this,arguments)}}function qie(t,e,r){for(var s=0,o=r.length;s<o;)e=t(e,r[s]),s+=1;return e}function MMe(t,e){for(var r=0,s=e.length,o=[];r<s;)t(e[r])&&(o[o.length]=e[r]),r+=1;return o}function SMe(t){return Object.prototype.toString.call(t)==="[object Object]"}var EMe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Hm.init,t.prototype["@@transducer/result"]=Hm.result,t.prototype["@@transducer/step"]=function(e,r){return this.f(r)?this.xf["@@transducer/step"](e,r):e},t}();function AMe(t){return function(e){return new EMe(t,e)}}var TMe=zn(NI(["fantasy-land/filter","filter"],AMe,function(t,e){return SMe(e)?qie(function(r,s){return t(e[s])&&(r[s]=e[s]),r},{},Bp(e)):MMe(t,e)})),xMe=TMe,RMe=zn(function(t,e){return xMe(_Me(t),e)}),kMe=RMe;function Fie(t,e){var r=function(l){var c=e.concat([t]);return yMe(l,c)?"<Circular>":Fie(l,c)},s=function(l,c){return Wm(function(d){return aI(d)+": "+r(l[d])},c.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+Wm(r,t).join(", ")+"))";case"[object Array]":return"["+Wm(r,t).concat(s(t,kMe(function(l){return/^\d+$/.test(l)},Bp(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):aI(wMe(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":aI(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var o=t.toString();if(o!=="[object Object]")return o}return"{"+s(t,Bp(t)).join(", ")+"}"}}var IMe=la(function(t){return Fie(t,[])}),yie=IMe,BMe=zn(function(t,e){if(t===e)return e;function r(d,b){if(d>b!=b>d)return b>d?b:d}var s=r(t,e);if(s!==void 0)return s;var o=r(typeof t,typeof e);if(o!==void 0)return o===typeof t?t:e;var l=yie(t),c=r(l,yie(e));return c!==void 0&&c===l?t:e}),OMe=BMe,CMe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Hm.init,t.prototype["@@transducer/result"]=Hm.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),PMe=function(t){return function(e){return new CMe(t,e)}},NMe=PMe,LMe=zn(NI(["fantasy-land/map","map"],NMe,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return $ie(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return qie(function(r,s){return r[s]=t(e[s]),r},{},Bp(e));default:return Wm(t,e)}})),DMe=LMe,jie=Number.isInteger||function(t){return t<<0===t};function zie(t){return Object.prototype.toString.call(t)==="[object String]"}var $Me=zn(function(t,e){var r=t<0?e.length+t:t;return zie(e)?e.charAt(r):e[r]}),Wie=$Me,UMe=zn(function(t,e){if(e!=null)return jie(t)?Wie(t,e):e[t]}),M4=UMe,qMe=zn(function(t,e){return DMe(M4(t),e)}),FMe=qMe,jMe=la(function(t){return PI(t)?!0:!t||typeof t!="object"||zie(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),zMe=jMe,bie=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function WMe(t,e,r){return function(s,o,l){if(zMe(l))return t(s,o,l);if(l==null)return o;if(typeof l["fantasy-land/reduce"]=="function")return e(s,o,l,"fantasy-land/reduce");if(l[bie]!=null)return r(s,o,l[bie]());if(typeof l.next=="function")return r(s,o,l);if(typeof l.reduce=="function")return e(s,o,l,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function KMe(t,e,r){for(var s=0,o=r.length;s<o;){if(e=t["@@transducer/step"](e,r[s]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}s+=1}return t["@@transducer/result"](e)}var HMe=zn(function(t,e){return _4(t.length,function(){return t.apply(e,arguments)})}),GMe=HMe;function VMe(t,e,r){for(var s=r.next();!s.done;){if(e=t["@@transducer/step"](e,s.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}s=r.next()}return t["@@transducer/result"](e)}function ZMe(t,e,r,s){return t["@@transducer/result"](r[s](GMe(t["@@transducer/step"],t),e))}var JMe=WMe(KMe,ZMe,VMe),XMe=JMe,YMe=function(){function t(e){this.f=e}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(e){return e},t.prototype["@@transducer/step"]=function(e,r){return this.f(e,r)},t}();function QMe(t){return new YMe(t)}var eSe=CI(function(t,e,r){return XMe(typeof t=="function"?QMe(t):t,e,r)}),Kie=eSe;function tSe(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function Hie(t,e){return function(){var r=arguments.length;if(r===0)return e();var s=arguments[r-1];return PI(s)||typeof s[t]!="function"?e.apply(this,arguments):s[t].apply(s,Array.prototype.slice.call(arguments,0,r-1))}}var rSe=CI(Hie("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),iSe=rSe,nSe=la(Hie("tail",iSe(1,1/0))),oSe=nSe;function Gie(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return _4(arguments[0].length,Kie(tSe,arguments[0],oSe(arguments)))}var aSe=zn(function(t,e){return $ie(Kie(OMe,0,FMe("length",e)),function(){var r=arguments,s=this;return t.apply(s,Wm(function(o){return o.apply(s,r)},e))})}),sSe=aSe,uSe=zn(function(t,e){return e==null||e!==e?t:e}),dI=uSe,hSe=function(){function t(e,r){this.xf=r,this.f=e,this.found=!1}return t.prototype["@@transducer/init"]=Hm.init,t.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,r){return this.f(r)&&(this.found=!0,e=sMe(this.xf["@@transducer/step"](e,r))),e},t}();function fSe(t){return function(e){return new hSe(t,e)}}var cSe=zn(NI(["find"],fSe,function(t,e){for(var r=0,s=e.length;r<s;){if(t(e[r]))return e[r];r+=1}})),lSe=cSe,dSe=la(function(t){return sSe(function(){return Array.prototype.slice.call(arguments,0)},t)}),pSe=dSe,vSe=zn(function(t,e){return t.map(function(r){for(var s=e,o=0,l;o<r.length;){if(s==null)return;l=r[o],s=jie(l)?Wie(l,s):s[l],o+=1}return s})}),gSe=vSe,mSe=zn(function(t,e){return gSe([t],e)[0]}),Vie=mSe,ySe=CI(function(t,e,r){return Uie(t,M4(e,r))}),bSe=ySe,a4=class extends Error{name="InvalidSchedulerLocation"},wSe=class extends Error{name="SchedulerTagNotFound"},_Se=class extends Error{name="TransactionNotFound"},MSe="Url",SSe="Time-To-Live",ESe="Scheduler",pI=t=>Gie(dI([]),lSe(bSe(t,"name")),dI({}),M4("value")),Zie=t=>Gie(e=>{if(!e)throw new _Se(t);return e},M4("tags"),dI([]));function Jie({fetch:t,GRAPHQL_URL:e}){return async({query:r,variables:s})=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:s})}).then(o=>o.json())}function ASe({fetch:t,GRAPHQL_URL:e}){let r=Jie({fetch:t,GRAPHQL_URL:e}),s=Xie({fetch:t,GRAPHQL_URL:e}),o=`
|
|
231
|
+
`+l):s.stack=l}catch{}}throw s}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=xu(this.defaults,r);let{transitional:s,paramsSerializer:o,headers:l}=r;s!==void 0&&x6.assertOptions(s,{silentJSONParsing:Cc.transitional(Cc.boolean),forcedJSONParsing:Cc.transitional(Cc.boolean),clarifyTimeoutError:Cc.transitional(Cc.boolean)},!1),o!=null&&(Kt.isFunction(o)?r.paramsSerializer={serialize:o}:x6.assertOptions(o,{encode:Cc.function,serialize:Cc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=l&&Kt.merge(l.common,l[r.method]);l&&Kt.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),r.headers=eo.concat(c,l);let d=[],b=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(b=b&&R.synchronous,d.unshift(R.fulfilled,R.rejected))});let g=[];this.interceptors.response.forEach(function(R){g.push(R.fulfilled,R.rejected)});let y,m=0,_;if(!b){let A=[A6.bind(this),void 0];for(A.unshift.apply(A,d),A.push.apply(A,g),_=A.length,y=Promise.resolve(r);m<_;)y=y.then(A[m++],A[m++]);return y}_=d.length;let T=r;for(m=0;m<_;){let A=d[m++],R=d[m++];try{T=A(T)}catch(B){R.call(this,B);break}}try{y=A6.call(this,T)}catch(A){return Promise.reject(A)}for(m=0,_=g.length;m<_;)y=y.then(g[m++],g[m++]);return y}getUri(e){e=xu(this.defaults,e);let r=Hv(e.baseURL,e.url);return Fv(r,e.params,e.paramsSerializer)}};Kt.forEach(["delete","get","head","options"],function(e){l1.prototype[e]=function(r,s){return this.request(xu(s||{},{method:e,url:r,data:(s||{}).data}))}});Kt.forEach(["post","put","patch"],function(e){function r(s){return function(l,c,d){return this.request(xu(d||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:l,data:c}))}}l1.prototype[e]=r(),l1.prototype[e+"Form"]=r(!0)});var Gv=l1;Se();Ae();Ee();var w9=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(l){r=l});let s=this;this.promise.then(o=>{if(!s._listeners)return;let l=s._listeners.length;for(;l-- >0;)s._listeners[l](o);s._listeners=null}),this.promise.then=o=>{let l,c=new Promise(d=>{s.subscribe(d),l=d}).then(o);return c.cancel=function(){s.unsubscribe(l)},c},e(function(l,c,d){s.reason||(s.reason=new bh(l,c,d),r(s.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(o){e=o}),cancel:e}}},tU=w9;Se();Ae();Ee();function _9(t){return function(r){return t.apply(null,r)}}Se();Ae();Ee();function M9(t){return Kt.isObject(t)&&t.isAxiosError===!0}Se();Ae();Ee();var S9={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(S9).forEach(([t,e])=>{S9[e]=t});var rU=S9;function iU(t){let e=new Gv(t),r=$v(Gv.prototype.request,e);return Kt.extend(r,Gv.prototype,e,{allOwnKeys:!0}),Kt.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return iU(xu(t,o))},r}var Vn=iU(h1);Vn.Axios=Gv;Vn.CanceledError=bh;Vn.CancelToken=tU;Vn.isCancel=Wv;Vn.VERSION=T6;Vn.toFormData=Oc;Vn.AxiosError=Lr;Vn.Cancel=Vn.CanceledError;Vn.all=function(e){return Promise.all(e)};Vn.spread=_9;Vn.isAxiosError=M9;Vn.mergeConfig=xu;Vn.AxiosHeaders=eo;Vn.formToJSON=t=>b6(Kt.isHTMLForm(t)?new FormData(t):t);Vn.getAdapter=E6.getAdapter;Vn.HttpStatusCode=rU;Vn.default=Vn;var R6=Vn;var{Axios:TFe,AxiosError:xFe,CanceledError:RFe,isCancel:kFe,CancelToken:IFe,VERSION:BFe,all:OFe,Cancel:CFe,isAxiosError:PFe,spread:NFe,toFormData:LFe,AxiosHeaders:DFe,HttpStatusCode:$Fe,formToJSON:UFe,getAdapter:qFe,mergeConfig:FFe}=R6;Se();Ae();Ee();var sU=Zl(oU(),1),E9="axios-retry";function uU(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,sU.default)(t)}var hU=["get","head","options"],ule=hU.concat(["put","delete"]);function A9(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function hle(t){return t.config?.method?A9(t)&&hU.indexOf(t.config.method)!==-1:!1}function fU(t){return t.config?.method?A9(t)&&ule.indexOf(t.config.method)!==-1:!1}function cU(t){return uU(t)||fU(t)}function lU(t=void 0){let e=t?.response?.headers["retry-after"];if(!e)return 0;let r=(Number(e)||0)*1e3;return r===0&&(r=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,r)}function fle(t=0,e=void 0){return Math.max(0,lU(e))}function cle(t=0,e=void 0,r=100){let s=2**t*r,o=Math.max(s,lU(e)),l=o*.2*Math.random();return o+l}var lle={retries:3,retryCondition:cU,retryDelay:fle,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function dle(t,e){return{...lle,...e,...t[E9]}}function aU(t,e){let r=dle(t,e||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),t[E9]=r,r}function ple(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function vle(t,e){let{retries:r,retryCondition:s}=t,o=(t.retryCount||0)<r&&s(e);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function gle(t,e,r,s){e.retryCount+=1;let{retryDelay:o,shouldResetTimeout:l,onRetry:c}=e,d=o(e.retryCount,r);if(ple(t,s),!l&&s.timeout&&e.lastRequestTime){let b=Date.now()-e.lastRequestTime,g=s.timeout-b-d;if(g<=0)return Promise.reject(r);s.timeout=g}return s.transformRequest=[b=>b],await c(e.retryCount,r,s),new Promise(b=>{setTimeout(()=>b(t(s)),d)})}async function mle(t,e){t.retryCount>=t.retries&&await t.onMaxRetryTimesExceeded(e,t.retryCount)}var Yl=(t,e)=>{let r=t.interceptors.request.use(o=>(aU(o,e),o[E9]?.validateResponse&&(o.validateStatus=()=>!1),o)),s=t.interceptors.response.use(null,async o=>{let{config:l}=o;if(!l)return Promise.reject(o);let c=aU(l,e);return o.response&&c.validateResponse?.(o.response)?o.response:await vle(c,o)?gle(t,c,o,l):(await mle(c,o),Promise.reject(o))});return{requestInterceptorId:r,responseInterceptorId:s}};Yl.isNetworkError=uU;Yl.isSafeRequestError=hle;Yl.isIdempotentRequestError=fU;Yl.isNetworkOrIdempotentRequestError=cU;Yl.exponentialDelay=cle;Yl.isRetryableError=A9;var k6=Yl;Se();Ae();Ee();var jM=Zl(EW(),1);Se();Ae();Ee();var z1="1.2.0-alpha.3";var Sa=class{logger;silent=!1;constructor({level:e="info"}={}){if(e==="none"){this.silent=!0;return}this.logger=jM.default.createLogger({level:e,name:"ar-io-sdk",version:z1,serializers:jM.default.stdSerializers})}info(e,...r){this.silent||this.logger.info(...r,e)}warn(e,...r){this.silent||this.logger.warn(...r,e)}error(e,...r){this.silent||this.logger.error(...r,e)}debug(e,...r){this.silent||this.logger.debug(...r,e)}setLogLevel(e){if(e==="none"){this.silent=!0;return}this.logger.level(e)}};var AW=({axiosConfig:t={},logger:e=new Sa,retryConfig:r={retries:5,retryDelay:k6.exponentialDelay,retryCondition:s=>k6.isRetryableError(s),onRetry(s,o,l){e.error(`Retrying request ${l.url} attempt ${s}`,o)}}}={})=>{let s=R6.create({...t,maxRedirects:0,headers:{...t.headers,"x-source-version":`${z1}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return k6(s,r),s};Se();Ae();Ee();Se();Ae();Ee();Se();Ae();Ee();var Cu=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},Ub=class extends Cu{},TW=class extends Cu{},w0=class extends Cu{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},qb=class extends Cu{},Fb=class extends Cu{},xW=class extends Cu{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Ka=class extends Cu{constructor(){super("Invalid contract configuration")}},RW=class extends Cu{constructor(){super("Invalid process configuration")}},zM=class extends Cu{};var jb=class{axios;logger;constructor({url:e,logger:r=new Sa}){this.logger=r,this.axios=AW({axiosConfig:{baseURL:e},logger:this.logger})}async get({endpoint:e,signal:r,allowedStatuses:s=[200,202],headers:o,params:l}){this.logger.debug(`Get request to endpoint: ${e} with params ${JSON.stringify(l,void 0,2)}`);let{status:c,statusText:d,data:b}=await this.axios.get(e,{headers:o,signal:r,params:l});if(this.logger.debug(`Response status: ${c} ${d}`),!s.includes(c))switch(c){case 404:throw new Ub(d);case 400:throw new w0(c,d);default:throw new qb(d)}return b}};var _0=class{logger;http;contractTxId;cacheUrl;constructor({cacheUrl:e="https://api.arns.app",contractTxId:r,logger:s=new Sa}){this.cacheUrl=e,this.contractTxId=r,this.logger=s,this.http=new jb({url:`${e}/v1/contract/${r}`})}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async getState({evaluationOptions:e}={}){this.logger.debug("Fetching contract state",{contractTxId:this.contractTxId,evaluationOptions:e});let{state:r}=await this.http.get({endpoint:"",params:{...e?.evalTo}});return r}async readInteraction({functionName:e,inputs:r,evaluationOptions:s}){this.logger.debug("Evaluating read interaction on contract",{functionName:e,inputs:r,evaluationOptions:s});let{result:o}=await this.http.get({endpoint:`/read/${e}`,params:{...s?.evalTo,...r}});return o}};var kW=class{static createWriteableContract(e){if(!e||Object.keys(e).length===0)return new Ea({contractTxId:f6});if(Ic(e))return e.contract instanceof Ea?e.contract:new Ea(e.contract.configuration());if(Bc(e))return new Ea({contractTxId:e.contractTxId});throw new Ka}static init(e){if(e&&e.signer!==void 0){let{signer:r,...s}=e,o=this.createWriteableContract(s);return new WM({signer:r,contract:o})}else return new zb(e)}},zb=class{contract;constructor(e){if(!e||e===void 0)this.contract=new _0({contractTxId:f6});else if(Ic(e))this.contract=e.contract;else if(Bc(e))this.contract=new _0({contractTxId:e.contractTxId});else throw new Ka}async getState(e={}){return await this.contract.getState(e)}async getArNSRecord({domain:e,evaluationOptions:r}){return(await this.getArNSRecords({evaluationOptions:r}))[e]}async getArNSRecords({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).records}async getArNSReservedNames({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).reserved}async getArNSReservedName({domain:e,evaluationOptions:r}){return(await this.getArNSReservedNames({evaluationOptions:r}))[e]}async getBalance({address:e,evaluationOptions:r}){return(await this.getBalances({evaluationOptions:r}))[e]||0}async getBalances({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).balances}async getGateway({address:e,evaluationOptions:r}){return this.contract.readInteraction({functionName:vo.GATEWAY,inputs:{target:e},evaluationOptions:r}).catch(()=>{})}async getGateways({evaluationOptions:e}={}){return this.contract.readInteraction({functionName:vo.GATEWAYS,evaluationOptions:e})}async getCurrentEpoch({evaluationOptions:e}={}){return this.contract.readInteraction({functionName:vo.EPOCH,evaluationOptions:e})}async getEpoch({blockHeight:e,evaluationOptions:r}){return this.contract.readInteraction({functionName:vo.EPOCH,inputs:{height:e},evaluationOptions:r})}async getPrescribedObservers({evaluationOptions:e}={}){return this.contract.readInteraction({functionName:vo.PRESCRIBED_OBSERVERS,evaluationOptions:e})}async getObservations({evaluationOptions:e}={}){let{observations:r}=await this.contract.getState({evaluationOptions:e});return r}async getDistributions({evaluationOptions:e}={}){let{distributions:r}=await this.contract.getState({evaluationOptions:e});return r}async getAuction({domain:e,type:r,evaluationOptions:s}){return this.contract.readInteraction({functionName:vo.AUCTION,inputs:{name:e,type:r},evaluationOptions:s})}async getAuctions({evaluationOptions:e}={}){let{auctions:r}=await this.contract.getState({evaluationOptions:e});return r}async getPriceForInteraction({interactionName:e,payload:r,evaluationOptions:s}){let{price:o}=await this.contract.readInteraction({functionName:vo.PRICE_FOR_INTERACTION,inputs:{interactionName:e,...r},evaluationOptions:s});return o}},WM=class extends zb{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({contract:new Ea({contractTxId:f6})}),this.signer=e;else if(Ic(r))super({contract:r.contract}),this.signer=e;else if(Bc(r))super({contract:new Ea({contractTxId:r.contractTxId})}),this.signer=e;else throw new Ka}async transfer({target:e,qty:r,denomination:s="IO"},o){let l=r;return s==="IO"&&typeof r=="number"&&(l=new Dv(r).toMIO()),this.contract.writeInteraction({functionName:vo.TRANSFER,inputs:{target:e,qty:l.valueOf()},signer:this.signer},o)}async joinNetwork({qty:e,allowDelegatedStaking:r,delegateRewardShareRatio:s,fqdn:o,label:l,minDelegatedStake:c,note:d,port:b,properties:g,protocol:y,autoStake:m,observerWallet:_},T){return this.contract.writeInteraction({functionName:vo.JOIN_NETWORK,inputs:{qty:e.valueOf(),allowDelegatedStaking:r,delegateRewardShareRatio:s,fqdn:o,label:l,minDelegatedStake:c.valueOf(),note:d,port:b,properties:g,protocol:y,autoStake:m,observerWallet:_},signer:this.signer},T)}async updateGatewaySettings({allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:s,label:o,minDelegatedStake:l,note:c,port:d,properties:b,protocol:g,autoStake:y,observerWallet:m},_){return this.contract.writeInteraction({functionName:vo.UPDATE_GATEWAY_SETTINGS,inputs:{allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:s,label:o,minDelegatedStake:l?.valueOf(),note:c,port:d,properties:b,protocol:g,autoStake:y,observerWallet:m},signer:this.signer},_)}async increaseDelegateStake(e,r){return this.contract.writeInteraction({functionName:vo.DELEGATE_STAKE,inputs:{target:e.target,qty:e.qty.valueOf()},signer:this.signer},r)}async decreaseDelegateStake(e,r){return this.contract.writeInteraction({functionName:vo.DECREASE_DELEGATE_STAKE,inputs:{target:e.target,qty:e.qty.valueOf()},signer:this.signer},r)}async increaseOperatorStake(e,r){return this.contract.writeInteraction({functionName:vo.INCREASE_OPERATOR_STAKE,inputs:{qty:e.qty.valueOf()},signer:this.signer},r)}async decreaseOperatorStake(e,r){return this.contract.writeInteraction({functionName:vo.DECREASE_OPERATOR_STAKE,inputs:{qty:e.qty.valueOf()},signer:this.signer},r)}async saveObservations(e,r){return this.contract.writeInteraction({functionName:vo.SAVE_OBSERVATIONS,inputs:{observerReportTxId:e.reportTxId,failedGateways:e.failedGateways},signer:this.signer},r)}async extendLease(e,r){return this.contract.writeInteraction({functionName:vo.EXTEND_RECORD,inputs:{name:e.domain,years:e.years},signer:this.signer},r)}async increaseUndernameLimit(e,r){return this.contract.writeInteraction({functionName:vo.INCREASE_UNDERNAME_COUNT,inputs:{name:e.domain,qty:e.qty},signer:this.signer},r)}};Se();Ae();Ee();var IW=class{static createWriteableContract(e){if(Ic(e))return e.contract instanceof Ea?e.contract:new Ea(e.contract.configuration());if(Bc(e))return new Ea({contractTxId:e.contractTxId});throw new Ka}static init({signer:e,...r}){if(e){let s=this.createWriteableContract(r);return new KM({signer:e,contract:s})}else return new Wb(r)}},Wb=class{contract;constructor(e){if(Ic(e))this.contract=e.contract;else if(Bc(e))this.contract=new _0({contractTxId:e.contractTxId});else throw new Ka}async getState({evaluationOptions:e}={}){return await this.contract.getState({evaluationOptions:e})}async getRecord({domain:e,evaluationOptions:r}){return(await this.getRecords({evaluationOptions:r}))[e]}async getRecords({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).records}async getOwner({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).owner}async getControllers({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).controllers}async getName({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).name}async getTicker({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).ticker}async getBalances({evaluationOptions:e}={}){return(await this.contract.getState({evaluationOptions:e})).balances}async getBalance({address:e,evaluationOptions:r}){return(await this.getBalances({evaluationOptions:r}))[e]||0}},KM=class extends Wb{signer;constructor({signer:e,...r}){if(Ic(r))super({contract:r.contract}),this.signer=e;else if(Bc(r))super({contract:new Ea({contractTxId:r.contractTxId})}),this.signer=e;else throw new Ka}async transfer({target:e},r){return this.contract.writeInteraction({functionName:kc.TRANSFER,inputs:{target:e},signer:this.signer},r)}async setController({controller:e},r){return this.contract.writeInteraction({functionName:kc.SET_CONTROLLER,inputs:{target:e},signer:this.signer},r)}async removeController({controller:e},r){return this.contract.writeInteraction({functionName:kc.REMOVE_CONTROLLER,inputs:{target:e},signer:this.signer},r)}async setRecord({subDomain:e,transactionId:r,ttlSeconds:s},o){return this.contract.writeInteraction({functionName:kc.SET_RECORD,inputs:{subDomain:e,transactionId:r,ttlSeconds:s},signer:this.signer},o)}async removeRecord({subDomain:e},r){return this.contract.writeInteraction({functionName:kc.REMOVE_RECORD,inputs:{subDomain:e},signer:this.signer},r)}async setTicker({ticker:e},r){return this.contract.writeInteraction({functionName:kc.SET_TICKER,inputs:{ticker:e},signer:this.signer},r)}async setName({name:e},r){return this.contract.writeInteraction({functionName:kc.SET_NAME,inputs:{name:e},signer:this.signer},r)}};Se();Ae();Ee();var Jne=Zl(nI(),1);Se();Ae();Ee();Se();Ae();Ee();var W_e=Object.create,kI=Object.defineProperty,K_e=Object.getOwnPropertyDescriptor,Pie=Object.getOwnPropertyNames,H_e=Object.getPrototypeOf,G_e=Object.prototype.hasOwnProperty,is=(t,e)=>function(){return e||(0,t[Pie(t)[0]])((e={exports:{}}).exports,e),e.exports},Nie=(t,e)=>{for(var r in e)kI(t,r,{get:e[r],enumerable:!0})},V_e=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pie(e))!G_e.call(t,o)&&o!==r&&kI(t,o,{get:()=>e[o],enumerable:!(s=K_e(e,o))||s.enumerable});return t},II=(t,e,r)=>(r=t!=null?W_e(H_e(t)):{},V_e(e||!t||!t.__esModule?kI(r,"default",{value:t,enumerable:!0}):r,t)),Z_e=is({"node_modules/obliterator/iterator.js"(t,e){function r(s){if(typeof s!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=s}typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var s=arguments,o=s.length,l=0;return new r(function(){return l>=o?{done:!0}:{done:!1,value:s[l++]}})},r.empty=function(){var s=new r(function(){return{done:!0}});return s},r.fromSequence=function(s){var o=0,l=s.length;return new r(function(){return o>=l?{done:!0}:{done:!1,value:s[o++]}})},r.is=function(s){return s instanceof r?!0:typeof s=="object"&&s!==null&&typeof s.next=="function"},e.exports=r}}),J_e=is({"node_modules/obliterator/support.js"(t){t.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",t.SYMBOL_SUPPORT=typeof Symbol<"u"}}),BI=is({"node_modules/obliterator/foreach.js"(t,e){var r=J_e(),s=r.ARRAY_BUFFER_SUPPORT,o=r.SYMBOL_SUPPORT;e.exports=function(c,d){var b,g,y,m,_;if(!c)throw new Error("obliterator/forEach: invalid iterable.");if(typeof d!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(c)||s&&ArrayBuffer.isView(c)||typeof c=="string"||c.toString()==="[object Arguments]"){for(y=0,m=c.length;y<m;y++)d(c[y],y);return}if(typeof c.forEach=="function"){c.forEach(d);return}if(o&&Symbol.iterator in c&&typeof c.next!="function"&&(c=c[Symbol.iterator]()),typeof c.next=="function"){for(b=c,y=0;_=b.next(),_.done!==!0;)d(_.value,y),y++;return}for(g in c)c.hasOwnProperty(g)&&d(c[g],g)}}}),OI=is({"node_modules/mnemonist/utils/typed-arrays.js"(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,s=Math.pow(2,32)-1,o=Math.pow(2,7)-1,l=Math.pow(2,15)-1,c=Math.pow(2,31)-1;t.getPointerArray=function(b){var g=b-1;if(g<=e)return Uint8Array;if(g<=r)return Uint16Array;if(g<=s)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(b){var g=b-1;return g<=o?Int8Array:g<=l?Int16Array:g<=c?Int32Array:Float64Array},t.getNumberType=function(b){return b===(b|0)?Math.sign(b)===-1?b<=127&&b>=-128?Int8Array:b<=32767&&b>=-32768?Int16Array:Int32Array:b<=255?Uint8Array:b<=65535?Uint16Array:Uint32Array:Float64Array};var d={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(b,g){var y=null,m=0,_,T,A,R,B;for(R=0,B=b.length;R<B;R++)A=g?g(b[R]):b[R],T=t.getNumberType(A),_=d[T.name],_>m&&(m=_,y=T);return y},t.isTypedArray=function(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(b)},t.concat=function(){var b=0,g,y,m;for(g=0,m=arguments.length;g<m;g++)b+=arguments[g].length;var _=new arguments[0].constructor(b);for(g=0,y=0;g<m;g++)_.set(arguments[g],y),y+=arguments[g].length;return _},t.indices=function(b){for(var g=t.getPointerArray(b),y=new g(b),m=0;m<b;m++)y[m]=m;return y}}}),Lie=is({"node_modules/mnemonist/utils/iterables.js"(t){var e=BI(),r=OI();function s(d){return Array.isArray(d)||r.isTypedArray(d)}function o(d){if(typeof d.length=="number")return d.length;if(typeof d.size=="number")return d.size}function l(d){var b=o(d),g=typeof b=="number"?new Array(b):[],y=0;return e(d,function(m){g[y++]=m}),g}function c(d){var b=o(d),g=typeof b=="number"?r.getPointerArray(b):Array,y=typeof b=="number"?new Array(b):[],m=typeof b=="number"?new g(b):[],_=0;return e(d,function(T){y[_]=T,m[_]=_++}),[y,m]}t.isArrayLike=s,t.guessLength=o,t.toArray=l,t.toArrayWithIndices=c}}),X_e=is({"node_modules/mnemonist/lru-cache.js"(t,e){var r=Z_e(),s=BI(),o=OI(),l=Lie();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var y=o.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items={}}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},c.prototype.splayOnTop=function(d){var b=this.head;if(this.head===d)return this;var g=this.backward[d],y=this.forward[d];return this.tail===d?this.tail=g:this.backward[y]=g,this.forward[g]=y,this.backward[b]=d,this.head=d,this.forward[d]=b,this},c.prototype.set=function(d,b){var g=this.items[d];if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],delete this.items[this.K[g]]),this.items[d]=g,this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,m=this.items[d];return typeof m<"u"?(this.splayOnTop(m),g=this.V[m],this.V[m]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?m=this.size++:(m=this.tail,this.tail=this.backward[m],g=this.V[m],y=this.K[m],delete this.items[y]),this.items[d]=m,this.K[m]=d,this.V[m]=b,this.forward[m]=this.head,this.backward[this.head]=m,this.head=m,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return d in this.items},c.prototype.get=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.V[b]},c.prototype.forEach=function(d,b){b=arguments.length>1?b:this;for(var g=0,y=this.size,m=this.head,_=this.K,T=this.V,A=this.forward;g<y;)d.call(b,T[m],_[m],this),m=A[m],g++},c.prototype.keys=function(){var d=0,b=this.size,g=this.head,y=this.K,m=this.forward;return new r(function(){if(d>=b)return{done:!0};var _=y[g];return d++,d<b&&(g=m[g]),{done:!1,value:_}})},c.prototype.values=function(){var d=0,b=this.size,g=this.head,y=this.V,m=this.forward;return new r(function(){if(d>=b)return{done:!0};var _=y[g];return d++,d<b&&(g=m[g]),{done:!1,value:_}})},c.prototype.entries=function(){var d=0,b=this.size,g=this.head,y=this.K,m=this.V,_=this.forward;return new r(function(){if(d>=b)return{done:!0};var T=y[g],A=m[g];return d++,d<b&&(g=_[g]),{done:!1,value:[T,A]}})},typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=function(){for(var d=new Map,b=this.entries(),g;g=b.next(),!g.done;)d.set(g.value[0],g.value[1]);return Object.defineProperty(d,"constructor",{value:c,enumerable:!1}),d},typeof Symbol<"u"&&(c.prototype[Symbol.for("nodejs.util.inspect.custom")]=c.prototype.inspect),c.from=function(d,b,g,y){if(arguments.length<2){if(y=l.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var m=new c(b,g,y);return s(d,function(_,T){m.set(T,_)}),m},e.exports=c}}),Y_e=is({"node_modules/mnemonist/lru-map.js"(t,e){var r=X_e(),s=BI(),o=OI(),l=Lie();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var y=o.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items=new Map}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},c.prototype.set=function(d,b){var g=this.items.get(d);if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],this.items.delete(this.K[g])),this.items.set(d,g),this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,m=this.items.get(d);return typeof m<"u"?(this.splayOnTop(m),g=this.V[m],this.V[m]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?m=this.size++:(m=this.tail,this.tail=this.backward[m],g=this.V[m],y=this.K[m],this.items.delete(y)),this.items.set(d,m),this.K[m]=d,this.V[m]=b,this.forward[m]=this.head,this.backward[this.head]=m,this.head=m,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return this.items.has(d)},c.prototype.get=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.V[b]},c.prototype.splayOnTop=r.prototype.splayOnTop,c.prototype.forEach=r.prototype.forEach,c.prototype.keys=r.prototype.keys,c.prototype.values=r.prototype.values,c.prototype.entries=r.prototype.entries,typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=r.prototype.inspect,c.from=function(d,b,g,y){if(arguments.length<2){if(y=l.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var m=new c(b,g,y);return s(d,function(_,T){m.set(T,_)}),m},e.exports=c}}),Q_e=is({"node_modules/ms/index.js"(t,e){var r=1e3,s=r*60,o=s*60,l=o*24,c=l*7,d=l*365.25;e.exports=function(_,T){T=T||{};var A=typeof _;if(A==="string"&&_.length>0)return b(_);if(A==="number"&&isFinite(_))return T.long?y(_):g(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function b(_){if(_=String(_),!(_.length>100)){var T=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(T){var A=parseFloat(T[1]),R=(T[2]||"ms").toLowerCase();switch(R){case"years":case"year":case"yrs":case"yr":case"y":return A*d;case"weeks":case"week":case"w":return A*c;case"days":case"day":case"d":return A*l;case"hours":case"hour":case"hrs":case"hr":case"h":return A*o;case"minutes":case"minute":case"mins":case"min":case"m":return A*s;case"seconds":case"second":case"secs":case"sec":case"s":return A*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function g(_){var T=Math.abs(_);return T>=l?Math.round(_/l)+"d":T>=o?Math.round(_/o)+"h":T>=s?Math.round(_/s)+"m":T>=r?Math.round(_/r)+"s":_+"ms"}function y(_){var T=Math.abs(_);return T>=l?m(_,T,l,"day"):T>=o?m(_,T,o,"hour"):T>=s?m(_,T,s,"minute"):T>=r?m(_,T,r,"second"):_+" ms"}function m(_,T,A,R){var B=T>=A*1.5;return Math.round(_/A)+" "+R+(B?"s":"")}}}),eMe=is({"node_modules/debug/src/common.js"(t,e){function r(s){l.debug=l,l.default=l,l.coerce=m,l.disable=b,l.enable=d,l.enabled=g,l.humanize=Q_e(),l.destroy=_,Object.keys(s).forEach(T=>{l[T]=s[T]}),l.names=[],l.skips=[],l.formatters={};function o(T){let A=0;for(let R=0;R<T.length;R++)A=(A<<5)-A+T.charCodeAt(R),A|=0;return l.colors[Math.abs(A)%l.colors.length]}l.selectColor=o;function l(T){let A,R=null,B,C;function P(...N){if(!P.enabled)return;let q=P,z=Number(new Date),J=z-(A||z);q.diff=J,q.prev=A,q.curr=z,A=z,N[0]=l.coerce(N[0]),typeof N[0]!="string"&&N.unshift("%O");let F=0;N[0]=N[0].replace(/%([a-zA-Z%])/g,(Y,E)=>{if(Y==="%%")return"%";F++;let n=l.formatters[E];if(typeof n=="function"){let u=N[F];Y=n.call(q,u),N.splice(F,1),F--}return Y}),l.formatArgs.call(q,N),(q.log||l.log).apply(q,N)}return P.namespace=T,P.useColors=l.useColors(),P.color=l.selectColor(T),P.extend=c,P.destroy=l.destroy,Object.defineProperty(P,"enabled",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(B!==l.namespaces&&(B=l.namespaces,C=l.enabled(T)),C),set:N=>{R=N}}),typeof l.init=="function"&&l.init(P),P}function c(T,A){let R=l(this.namespace+(typeof A>"u"?":":A)+T);return R.log=this.log,R}function d(T){l.save(T),l.namespaces=T,l.names=[],l.skips=[];let A,R=(typeof T=="string"?T:"").split(/[\s,]+/),B=R.length;for(A=0;A<B;A++)R[A]&&(T=R[A].replace(/\*/g,".*?"),T[0]==="-"?l.skips.push(new RegExp("^"+T.slice(1)+"$")):l.names.push(new RegExp("^"+T+"$")))}function b(){let T=[...l.names.map(y),...l.skips.map(y).map(A=>"-"+A)].join(",");return l.enable(""),T}function g(T){if(T[T.length-1]==="*")return!0;let A,R;for(A=0,R=l.skips.length;A<R;A++)if(l.skips[A].test(T))return!1;for(A=0,R=l.names.length;A<R;A++)if(l.names[A].test(T))return!0;return!1}function y(T){return T.toString().substring(2,T.toString().length-2).replace(/\.\*\?$/,"*")}function m(T){return T instanceof Error?T.stack||T.message:T}function _(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return l.enable(l.load()),l}e.exports=r}}),tMe=is({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=s,t.save=o,t.load=l,t.useColors=r,t.storage=c(),t.destroy=(()=>{let b=!1;return()=>{b||(b=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let g="color: "+this.color;b.splice(1,0,g,"color: inherit");let y=0,m=0;b[0].replace(/%[a-zA-Z%]/g,_=>{_!=="%%"&&(y++,_==="%c"&&(m=y))}),b.splice(m,0,g)}t.log=console.debug||console.log||(()=>{});function o(b){try{b?t.storage.setItem("debug",b):t.storage.removeItem("debug")}catch{}}function l(){let b;try{b=t.storage.getItem("debug")}catch{}return!b&&typeof gt<"u"&&"env"in gt&&(b=gt.env.DEBUG),b}function c(){try{return localStorage}catch{}}e.exports=eMe()(t);var{formatters:d}=e.exports;d.j=function(b){try{return JSON.stringify(b)}catch(g){return"[UnexpectedJSONParseError]: "+g.message}}}}),rMe=is({"node_modules/base64-js/index.js"(t){"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=T;var e=[],r=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)e[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function d(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function b(A){var R=d(A),B=R[0],C=R[1];return(B+C)*3/4-C}function g(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=d(A),C=B[0],P=B[1],N=new s(g(A,C,P)),q=0,z=P>0?C-4:C,J;for(J=0;J<z;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function m(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function _(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(m(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,z=B-C;q<z;q+=N)P.push(_(A,q,q+N>z?z:q+N));return C===1?(R=A[B-1],P.push(e[R>>2]+e[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(e[R>>10]+e[R>>4&63]+e[R<<2&63]+"=")),P.join("")}}}),iMe=is({"node_modules/ieee754/index.js"(t){t.read=function(e,r,s,o,l){var c,d,b=l*8-o-1,g=(1<<b)-1,y=g>>1,m=-7,_=s?l-1:0,T=s?-1:1,A=e[r+_];for(_+=T,c=A&(1<<-m)-1,A>>=-m,m+=b;m>0;c=c*256+e[r+_],_+=T,m-=8);for(d=c&(1<<-m)-1,c>>=-m,m+=o;m>0;d=d*256+e[r+_],_+=T,m-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,o),c=c-y}return(A?-1:1)*d*Math.pow(2,c-o)},t.write=function(e,r,s,o,l,c){var d,b,g,y=c*8-l-1,m=(1<<y)-1,_=m>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=m):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+_>=1?r+=T/g:r+=T*Math.pow(2,1-_),r*g>=2&&(d++,g/=2),d+_>=m?(b=0,d=m):d+_>=1?(b=(r*g-1)*Math.pow(2,l),d=d+_):(b=r*Math.pow(2,_-1)*Math.pow(2,l),d=0));l>=8;e[s+A]=b&255,A+=R,b/=256,l-=8);for(d=d<<l|b,y+=l;y>0;e[s+A]=d&255,A+=R,d/=256,y-=8);e[s+A-R]|=B*128}}}),nMe=is({"node_modules/buffer/index.js"(t){"use strict";var e=rMe(),r=iMe(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=P,t.INSPECT_MAX_BYTES=50;var o=2147483647;t.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,d.prototype),O}function d(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(I)}return b(I,O,L)}d.poolSize=8192;function b(I,O,L){if(typeof I=="string")return _(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(ge(I,ArrayBuffer)||I&&ge(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(I,SharedArrayBuffer)||I&&ge(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return d.from(V,O,L);let se=B(I);if(se)return se;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return d.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}d.from=function(I,O,L){return b(I,O,L)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return g(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}d.alloc=function(I,O,L){return y(I,O,L)};function m(I){return g(I),c(I<0?0:C(I)|0)}d.allocUnsafe=function(I){return m(I)},d.allocUnsafeSlow=function(I){return m(I)};function _(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!d.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),se=V.write(I,O);return se!==L&&(V=V.slice(0,se)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(ge(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,d.prototype),V}function B(I){if(d.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||we(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),d.alloc(+I)}d.isBuffer=function(O){return O!=null&&O._isBuffer===!0&&O!==d.prototype},d.compare=function(O,L){if(ge(O,Uint8Array)&&(O=d.from(O,O.offset,O.byteLength)),ge(L,Uint8Array)&&(L=d.from(L,L.offset,L.byteLength)),!d.isBuffer(O)||!d.isBuffer(L))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(O===L)return 0;let V=O.length,se=L.length;for(let he=0,ue=Math.min(V,se);he<ue;++he)if(O[he]!==L[he]){V=O[he],se=L[he];break}return V<se?-1:se<V?1:0},d.isEncoding=function(O){switch(String(O).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(O,L){if(!Array.isArray(O))throw new TypeError('"list" argument must be an Array of Buffers');if(O.length===0)return d.alloc(0);let V;if(L===void 0)for(L=0,V=0;V<O.length;++V)L+=O[V].length;let se=d.allocUnsafe(L),he=0;for(V=0;V<O.length;++V){let ue=O[V];if(ge(ue,Uint8Array))he+ue.length>se.length?(d.isBuffer(ue)||(ue=d.from(ue)),ue.copy(se,he)):Uint8Array.prototype.set.call(se,ue,he);else if(d.isBuffer(ue))ue.copy(se,he);else throw new TypeError('"list" argument must be an Array of Buffers');he+=ue.length}return se};function N(I,O){if(d.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||ge(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let se=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return fe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return be(I).length;default:if(se)return V?-1:fe(I).length;O=(""+O).toLowerCase(),se=!0}}d.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return i(this,O,L);case"utf8":case"utf-8":return p(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return h(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}d.prototype._isBuffer=!0;function z(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}d.prototype.swap16=function(){let O=this.length;if(O%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let L=0;L<O;L+=2)z(this,L,L+1);return this},d.prototype.swap32=function(){let O=this.length;if(O%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let L=0;L<O;L+=4)z(this,L,L+3),z(this,L+1,L+2);return this},d.prototype.swap64=function(){let O=this.length;if(O%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let L=0;L<O;L+=8)z(this,L,L+7),z(this,L+1,L+6),z(this,L+2,L+5),z(this,L+3,L+4);return this},d.prototype.toString=function(){let O=this.length;return O===0?"":arguments.length===0?p(this,0,O):q.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(O){if(!d.isBuffer(O))throw new TypeError("Argument must be a Buffer");return this===O?!0:d.compare(this,O)===0},d.prototype.inspect=function(){let O="",L=t.INSPECT_MAX_BYTES;return O=this.toString("hex",0,L).replace(/(.{2})/g,"$1 ").trim(),this.length>L&&(O+=" ... "),"<Buffer "+O+">"},s&&(d.prototype[s]=d.prototype.inspect),d.prototype.compare=function(O,L,V,se,he){if(ge(O,Uint8Array)&&(O=d.from(O,O.offset,O.byteLength)),!d.isBuffer(O))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof O);if(L===void 0&&(L=0),V===void 0&&(V=O?O.length:0),se===void 0&&(se=0),he===void 0&&(he=this.length),L<0||V>O.length||se<0||he>this.length)throw new RangeError("out of range index");if(se>=he&&L>=V)return 0;if(se>=he)return-1;if(L>=V)return 1;if(L>>>=0,V>>>=0,se>>>=0,he>>>=0,this===O)return 0;let ue=he-se,xe=V-L,_e=Math.min(ue,xe),me=this.slice(se,he),Qe=O.slice(L,V);for(let Ie=0;Ie<_e;++Ie)if(me[Ie]!==Qe[Ie]){ue=me[Ie],xe=Qe[Ie];break}return ue<xe?-1:xe<ue?1:0};function J(I,O,L,V,se){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,we(L)&&(L=se?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(se)return-1;L=I.length-1}else if(L<0)if(se)L=0;else return-1;if(typeof O=="string"&&(O=d.from(O,V)),d.isBuffer(O))return O.length===0?-1:F(I,O,L,V,se);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?se?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,se);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,se){let he=1,ue=I.length,xe=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;he=2,ue/=2,xe/=2,L/=2}function _e(Qe,Ie){return he===1?Qe[Ie]:Qe.readUInt16BE(Ie*he)}let me;if(se){let Qe=-1;for(me=L;me<ue;me++)if(_e(I,me)===_e(O,Qe===-1?0:me-Qe)){if(Qe===-1&&(Qe=me),me-Qe+1===xe)return Qe*he}else Qe!==-1&&(me-=me-Qe),Qe=-1}else for(L+xe>ue&&(L=ue-xe),me=L;me>=0;me--){let Qe=!0;for(let Ie=0;Ie<xe;Ie++)if(_e(I,me+Ie)!==_e(O,Ie)){Qe=!1;break}if(Qe)return me}return-1}d.prototype.includes=function(O,L,V){return this.indexOf(O,L,V)!==-1},d.prototype.indexOf=function(O,L,V){return J(this,O,L,V,!0)},d.prototype.lastIndexOf=function(O,L,V){return J(this,O,L,V,!1)};function H(I,O,L,V){L=Number(L)||0;let se=I.length-L;V?(V=Number(V),V>se&&(V=se)):V=se;let he=O.length;V>he/2&&(V=he/2);let ue;for(ue=0;ue<V;++ue){let xe=parseInt(O.substr(ue*2,2),16);if(we(xe))return ue;I[L+ue]=xe}return ue}function Y(I,O,L,V){return le(fe(O,I.length-L),I,L,V)}function E(I,O,L,V){return le(pe(O),I,L,V)}function n(I,O,L,V){return le(be(O),I,L,V)}function u(I,O,L,V){return le(Te(O,I.length-L),I,L,V)}d.prototype.write=function(O,L,V,se){if(L===void 0)se="utf8",V=this.length,L=0;else if(V===void 0&&typeof L=="string")se=L,V=this.length,L=0;else if(isFinite(L))L=L>>>0,isFinite(V)?(V=V>>>0,se===void 0&&(se="utf8")):(se=V,V=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let he=this.length-L;if((V===void 0||V>he)&&(V=he),O.length>0&&(V<0||L<0)||L>this.length)throw new RangeError("Attempt to write outside buffer bounds");se||(se="utf8");let ue=!1;for(;;)switch(se){case"hex":return H(this,O,L,V);case"utf8":case"utf-8":return Y(this,O,L,V);case"ascii":case"latin1":case"binary":return E(this,O,L,V);case"base64":return n(this,O,L,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,O,L,V);default:if(ue)throw new TypeError("Unknown encoding: "+se);se=(""+se).toLowerCase(),ue=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function h(I,O,L){return O===0&&L===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(O,L))}function p(I,O,L){L=Math.min(I.length,L);let V=[],se=O;for(;se<L;){let he=I[se],ue=null,xe=he>239?4:he>223?3:he>191?2:1;if(se+xe<=L){let _e,me,Qe,Ie;switch(xe){case 1:he<128&&(ue=he);break;case 2:_e=I[se+1],(_e&192)===128&&(Ie=(he&31)<<6|_e&63,Ie>127&&(ue=Ie));break;case 3:_e=I[se+1],me=I[se+2],(_e&192)===128&&(me&192)===128&&(Ie=(he&15)<<12|(_e&63)<<6|me&63,Ie>2047&&(Ie<55296||Ie>57343)&&(ue=Ie));break;case 4:_e=I[se+1],me=I[se+2],Qe=I[se+3],(_e&192)===128&&(me&192)===128&&(Qe&192)===128&&(Ie=(he&15)<<18|(_e&63)<<12|(me&63)<<6|Qe&63,Ie>65535&&Ie<1114112&&(ue=Ie))}}ue===null?(ue=65533,xe=1):ue>65535&&(ue-=65536,V.push(ue>>>10&1023|55296),ue=56320|ue&1023),V.push(ue),se+=xe}return S(V)}var v=4096;function S(I){let O=I.length;if(O<=v)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=v));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]);return V}function i(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let se="";for(let he=O;he<L;++he)se+=Me[I[he]];return se}function f(I,O,L){let V=I.slice(O,L),se="";for(let he=0;he<V.length-1;he+=2)se+=String.fromCharCode(V[he]+V[he+1]*256);return se}d.prototype.slice=function(O,L){let V=this.length;O=~~O,L=L===void 0?V:~~L,O<0?(O+=V,O<0&&(O=0)):O>V&&(O=V),L<0?(L+=V,L<0&&(L=0)):L>V&&(L=V),L<O&&(L=O);let se=this.subarray(O,L);return Object.setPrototypeOf(se,d.prototype),se};function w(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=this[O],he=1,ue=0;for(;++ue<L&&(he*=256);)se+=this[O+ue]*he;return se},d.prototype.readUintBE=d.prototype.readUIntBE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=this[O+--L],he=1;for(;L>0&&(he*=256);)se+=this[O+--L]*he;return se},d.prototype.readUint8=d.prototype.readUInt8=function(O,L){return O=O>>>0,L||w(O,1,this.length),this[O]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(O,L){return O=O>>>0,L||w(O,2,this.length),this[O]|this[O+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(O,L){return O=O>>>0,L||w(O,2,this.length),this[O]<<8|this[O+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(O,L){return O=O>>>0,L||w(O,4,this.length),(this[O]|this[O+1]<<8|this[O+2]<<16)+this[O+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(O,L){return O=O>>>0,L||w(O,4,this.length),this[O]*16777216+(this[O+1]<<16|this[O+2]<<8|this[O+3])},d.prototype.readBigUInt64LE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=L+this[++O]*2**8+this[++O]*2**16+this[++O]*2**24,he=this[++O]+this[++O]*2**8+this[++O]*2**16+V*2**24;return BigInt(se)+(BigInt(he)<<BigInt(32))}),d.prototype.readBigUInt64BE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=L*2**24+this[++O]*2**16+this[++O]*2**8+this[++O],he=this[++O]*2**24+this[++O]*2**16+this[++O]*2**8+V;return(BigInt(se)<<BigInt(32))+BigInt(he)}),d.prototype.readIntLE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=this[O],he=1,ue=0;for(;++ue<L&&(he*=256);)se+=this[O+ue]*he;return he*=128,se>=he&&(se-=Math.pow(2,8*L)),se},d.prototype.readIntBE=function(O,L,V){O=O>>>0,L=L>>>0,V||w(O,L,this.length);let se=L,he=1,ue=this[O+--se];for(;se>0&&(he*=256);)ue+=this[O+--se]*he;return he*=128,ue>=he&&(ue-=Math.pow(2,8*L)),ue},d.prototype.readInt8=function(O,L){return O=O>>>0,L||w(O,1,this.length),this[O]&128?(255-this[O]+1)*-1:this[O]},d.prototype.readInt16LE=function(O,L){O=O>>>0,L||w(O,2,this.length);let V=this[O]|this[O+1]<<8;return V&32768?V|4294901760:V},d.prototype.readInt16BE=function(O,L){O=O>>>0,L||w(O,2,this.length);let V=this[O+1]|this[O]<<8;return V&32768?V|4294901760:V},d.prototype.readInt32LE=function(O,L){return O=O>>>0,L||w(O,4,this.length),this[O]|this[O+1]<<8|this[O+2]<<16|this[O+3]<<24},d.prototype.readInt32BE=function(O,L){return O=O>>>0,L||w(O,4,this.length),this[O]<<24|this[O+1]<<16|this[O+2]<<8|this[O+3]},d.prototype.readBigInt64LE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=this[O+4]+this[O+5]*2**8+this[O+6]*2**16+(V<<24);return(BigInt(se)<<BigInt(32))+BigInt(L+this[++O]*2**8+this[++O]*2**16+this[++O]*2**24)}),d.prototype.readBigInt64BE=nt(function(O){O=O>>>0,j(O,"offset");let L=this[O],V=this[O+7];(L===void 0||V===void 0)&&re(O,this.length-8);let se=(L<<24)+this[++O]*2**16+this[++O]*2**8+this[++O];return(BigInt(se)<<BigInt(32))+BigInt(this[++O]*2**24+this[++O]*2**16+this[++O]*2**8+V)}),d.prototype.readFloatLE=function(O,L){return O=O>>>0,L||w(O,4,this.length),r.read(this,O,!0,23,4)},d.prototype.readFloatBE=function(O,L){return O=O>>>0,L||w(O,4,this.length),r.read(this,O,!1,23,4)},d.prototype.readDoubleLE=function(O,L){return O=O>>>0,L||w(O,8,this.length),r.read(this,O,!0,52,8)},d.prototype.readDoubleBE=function(O,L){return O=O>>>0,L||w(O,8,this.length),r.read(this,O,!1,52,8)};function M(I,O,L,V,se,he){if(!d.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>se||O<he)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(O,L,V,se){if(O=+O,L=L>>>0,V=V>>>0,!se){let xe=Math.pow(2,8*V)-1;M(this,O,L,V,xe,0)}let he=1,ue=0;for(this[L]=O&255;++ue<V&&(he*=256);)this[L+ue]=O/he&255;return L+V},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(O,L,V,se){if(O=+O,L=L>>>0,V=V>>>0,!se){let xe=Math.pow(2,8*V)-1;M(this,O,L,V,xe,0)}let he=V-1,ue=1;for(this[L+he]=O&255;--he>=0&&(ue*=256);)this[L+he]=O/ue&255;return L+V},d.prototype.writeUint8=d.prototype.writeUInt8=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,1,255,0),this[L]=O&255,L+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,65535,0),this[L]=O&255,this[L+1]=O>>>8,L+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,65535,0),this[L]=O>>>8,this[L+1]=O&255,L+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,4294967295,0),this[L+3]=O>>>24,this[L+2]=O>>>16,this[L+1]=O>>>8,this[L]=O&255,L+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,4294967295,0),this[L]=O>>>24,this[L+1]=O>>>16,this[L+2]=O>>>8,this[L+3]=O&255,L+4};function k(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,L}function $(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L+7]=he,he=he>>8,I[L+6]=he,he=he>>8,I[L+5]=he,he=he>>8,I[L+4]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ue,ue=ue>>8,I[L+2]=ue,ue=ue>>8,I[L+1]=ue,ue=ue>>8,I[L]=ue,L+8}d.prototype.writeBigUInt64LE=nt(function(O,L=0){return k(this,O,L,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=nt(function(O,L=0){return $(this,O,L,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(O,L,V,se){if(O=+O,L=L>>>0,!se){let _e=Math.pow(2,8*V-1);M(this,O,L,V,_e-1,-_e)}let he=0,ue=1,xe=0;for(this[L]=O&255;++he<V&&(ue*=256);)O<0&&xe===0&&this[L+he-1]!==0&&(xe=1),this[L+he]=(O/ue>>0)-xe&255;return L+V},d.prototype.writeIntBE=function(O,L,V,se){if(O=+O,L=L>>>0,!se){let _e=Math.pow(2,8*V-1);M(this,O,L,V,_e-1,-_e)}let he=V-1,ue=1,xe=0;for(this[L+he]=O&255;--he>=0&&(ue*=256);)O<0&&xe===0&&this[L+he+1]!==0&&(xe=1),this[L+he]=(O/ue>>0)-xe&255;return L+V},d.prototype.writeInt8=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,1,127,-128),O<0&&(O=255+O+1),this[L]=O&255,L+1},d.prototype.writeInt16LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,32767,-32768),this[L]=O&255,this[L+1]=O>>>8,L+2},d.prototype.writeInt16BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,2,32767,-32768),this[L]=O>>>8,this[L+1]=O&255,L+2},d.prototype.writeInt32LE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,2147483647,-2147483648),this[L]=O&255,this[L+1]=O>>>8,this[L+2]=O>>>16,this[L+3]=O>>>24,L+4},d.prototype.writeInt32BE=function(O,L,V){return O=+O,L=L>>>0,V||M(this,O,L,4,2147483647,-2147483648),O<0&&(O=4294967295+O+1),this[L]=O>>>24,this[L+1]=O>>>16,this[L+2]=O>>>8,this[L+3]=O&255,L+4},d.prototype.writeBigInt64LE=nt(function(O,L=0){return k(this,O,L,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=nt(function(O,L=0){return $(this,O,L,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ie(I,O,L,V,se,he){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}d.prototype.writeFloatLE=function(O,L,V){return Z(this,O,L,!0,V)},d.prototype.writeFloatBE=function(O,L,V){return Z(this,O,L,!1,V)};function te(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}d.prototype.writeDoubleLE=function(O,L,V){return te(this,O,L,!0,V)},d.prototype.writeDoubleBE=function(O,L,V){return te(this,O,L,!1,V)},d.prototype.copy=function(O,L,V,se){if(!d.isBuffer(O))throw new TypeError("argument should be a Buffer");if(V||(V=0),!se&&se!==0&&(se=this.length),L>=O.length&&(L=O.length),L||(L=0),se>0&&se<V&&(se=V),se===V||O.length===0||this.length===0)return 0;if(L<0)throw new RangeError("targetStart out of bounds");if(V<0||V>=this.length)throw new RangeError("Index out of range");if(se<0)throw new RangeError("sourceEnd out of bounds");se>this.length&&(se=this.length),O.length-L<se-V&&(se=O.length-L+V);let he=se-V;return this===O&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(L,V,se):Uint8Array.prototype.set.call(O,this.subarray(V,se),L),he},d.prototype.fill=function(O,L,V,se){if(typeof O=="string"){if(typeof L=="string"?(se=L,L=0,V=this.length):typeof V=="string"&&(se=V,V=this.length),se!==void 0&&typeof se!="string")throw new TypeError("encoding must be a string");if(typeof se=="string"&&!d.isEncoding(se))throw new TypeError("Unknown encoding: "+se);if(O.length===1){let ue=O.charCodeAt(0);(se==="utf8"&&ue<128||se==="latin1")&&(O=ue)}}else typeof O=="number"?O=O&255:typeof O=="boolean"&&(O=Number(O));if(L<0||this.length<L||this.length<V)throw new RangeError("Out of range index");if(V<=L)return this;L=L>>>0,V=V===void 0?this.length:V>>>0,O||(O=0);let he;if(typeof O=="number")for(he=L;he<V;++he)this[he]=O;else{let ue=d.isBuffer(O)?O:d.from(O,se),xe=ue.length;if(xe===0)throw new TypeError('The value "'+O+'" is invalid for argument "value"');for(he=0;he<V-L;++he)this[he+L]=ue[he%xe]}return this};var Q={};function W(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(se){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:se,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),W("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,se=L;return Number.isInteger(L)&&Math.abs(L)>2**32?se=ee(String(L)):typeof L=="bigint"&&(se=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(se=ee(se)),se+="n"),V+=` It must be ${O}. Received ${se}`,V},RangeError);function ee(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&re(O,I.length-(L+1))}function U(I,O,L,V,se,he){if(I>L||I<O){let ue=typeof O=="bigint"?"n":"",xe;throw he>3?O===0||O===BigInt(0)?xe=`>= 0${ue} and < 2${ue} ** ${(he+1)*8}${ue}`:xe=`>= -(2${ue} ** ${(he+1)*8-1}${ue}) and < 2 ** ${(he+1)*8-1}${ue}`:xe=`>= ${O}${ue} and <= ${L}${ue}`,new Q.ERR_OUT_OF_RANGE("value",xe,I)}X(V,se,he)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function re(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var oe=/[^+/0-9A-Za-z-_]/g;function ce(I){if(I=I.split("=")[0],I=I.trim().replace(oe,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function fe(I,O){O=O||1/0;let L,V=I.length,se=null,he=[];for(let ue=0;ue<V;++ue){if(L=I.charCodeAt(ue),L>55295&&L<57344){if(!se){if(L>56319){(O-=3)>-1&&he.push(239,191,189);continue}else if(ue+1===V){(O-=3)>-1&&he.push(239,191,189);continue}se=L;continue}if(L<56320){(O-=3)>-1&&he.push(239,191,189),se=L;continue}L=(se-55296<<10|L-56320)+65536}else se&&(O-=3)>-1&&he.push(239,191,189);if(se=null,L<128){if((O-=1)<0)break;he.push(L)}else if(L<2048){if((O-=2)<0)break;he.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;he.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;he.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return he}function pe(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function Te(I,O){let L,V,se,he=[];for(let ue=0;ue<I.length&&!((O-=2)<0);++ue)L=I.charCodeAt(ue),V=L>>8,se=L%256,he.push(se),he.push(V);return he}function be(I){return e.toByteArray(ce(I))}function le(I,O,L,V){let se;for(se=0;se<V&&!(se+L>=O.length||se>=I.length);++se)O[se+L]=I[se];return se}function ge(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function we(I){return I!==I}var Me=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let se=0;se<16;++se)O[V+se]=I[L]+I[se]}return O}();function nt(I){return typeof BigInt>"u"?ne:I}function ne(){throw new Error("BigInt not supported")}}});function bn(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function la(t){return function e(r){return arguments.length===0||bn(r)?e:t.apply(this,arguments)}}function zn(t){return function e(r,s){switch(arguments.length){case 0:return e;case 1:return bn(r)?e:la(function(o){return t(r,o)});default:return bn(r)&&bn(s)?e:bn(r)?la(function(o){return t(o,s)}):bn(s)?la(function(o){return t(r,o)}):t(r,s)}}}function _4(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,s){return e.apply(this,arguments)};case 3:return function(r,s,o){return e.apply(this,arguments)};case 4:return function(r,s,o,l){return e.apply(this,arguments)};case 5:return function(r,s,o,l,c){return e.apply(this,arguments)};case 6:return function(r,s,o,l,c,d){return e.apply(this,arguments)};case 7:return function(r,s,o,l,c,d,b){return e.apply(this,arguments)};case 8:return function(r,s,o,l,c,d,b,g){return e.apply(this,arguments)};case 9:return function(r,s,o,l,c,d,b,g,y){return e.apply(this,arguments)};case 10:return function(r,s,o,l,c,d,b,g,y,m){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Die(t,e,r){return function(){for(var s=[],o=0,l=t,c=0,d=!1;c<e.length||o<arguments.length;){var b;c<e.length&&(!bn(e[c])||o>=arguments.length)?b=e[c]:(b=arguments[o],o+=1),s[c]=b,bn(b)?d=!0:l-=1,c+=1}return!d&&l<=0?r.apply(this,s):_4(Math.max(0,l),Die(t,s,r))}}var oMe=zn(function(t,e){return t===1?la(e):_4(t,Die(t,[],e))}),$ie=oMe;function CI(t){return function e(r,s,o){switch(arguments.length){case 0:return e;case 1:return bn(r)?e:zn(function(l,c){return t(r,l,c)});case 2:return bn(r)&&bn(s)?e:bn(r)?zn(function(l,c){return t(l,s,c)}):bn(s)?zn(function(l,c){return t(r,l,c)}):la(function(l){return t(r,s,l)});default:return bn(r)&&bn(s)&&bn(o)?e:bn(r)&&bn(s)?zn(function(l,c){return t(l,c,o)}):bn(r)&&bn(o)?zn(function(l,c){return t(l,s,c)}):bn(s)&&bn(o)?zn(function(l,c){return t(r,l,c)}):bn(r)?la(function(l){return t(l,s,o)}):bn(s)?la(function(l){return t(r,l,o)}):bn(o)?la(function(l){return t(r,s,l)}):t(r,s,o)}}}var PI=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function aMe(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function NI(t,e,r){return function(){if(arguments.length===0)return r();var s=arguments[arguments.length-1];if(!PI(s)){for(var o=0;o<t.length;){if(typeof s[t[o]]=="function")return s[t[o]].apply(s,Array.prototype.slice.call(arguments,0,-1));o+=1}if(aMe(s)){var l=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return l(s)}}return r.apply(this,arguments)}}function sMe(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}var Hm={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}};function cie(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function lie(t,e,r){for(var s=0,o=r.length;s<o;){if(t(e,r[s]))return!0;s+=1}return!1}function uMe(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function o4(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function hMe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var oI=typeof Object.is=="function"?Object.is:hMe,die=Object.prototype.toString,fMe=function(){return die.call(arguments)==="[object Arguments]"?function(t){return die.call(t)==="[object Arguments]"}:function(t){return o4("callee",t)}}(),cMe=fMe,lMe=!{toString:null}.propertyIsEnumerable("toString"),pie=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],vie=function(){"use strict";return arguments.propertyIsEnumerable("length")}(),dMe=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1},pMe=la(typeof Object.keys=="function"&&!vie?function(t){return Object(t)!==t?[]:Object.keys(t)}:function(t){if(Object(t)!==t)return[];var e,r,s=[],o=vie&&cMe(t);for(e in t)o4(e,t)&&(!o||e!=="length")&&(s[s.length]=e);if(lMe)for(r=pie.length-1;r>=0;)e=pie[r],o4(e,t)&&!dMe(s,e)&&(s[s.length]=e),r-=1;return s}),Bp=pMe,vMe=la(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),gie=vMe;function mie(t,e,r,s){var o=cie(t),l=cie(e);function c(d,b){return LI(d,b,r.slice(),s.slice())}return!lie(function(d,b){return!lie(c,b,d)},l,o)}function LI(t,e,r,s){if(oI(t,e))return!0;var o=gie(t);if(o!==gie(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(o){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&uMe(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&oI(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!oI(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var l=r.length-1;l>=0;){if(r[l]===t)return s[l]===e;l-=1}switch(o){case"Map":return t.size!==e.size?!1:mie(t.entries(),e.entries(),r.concat([t]),s.concat([e]));case"Set":return t.size!==e.size?!1:mie(t.values(),e.values(),r.concat([t]),s.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=Bp(t);if(c.length!==Bp(e).length)return!1;var d=r.concat([t]),b=s.concat([e]);for(l=c.length-1;l>=0;){var g=c[l];if(!(o4(g,e)&&LI(e[g],t[g],d,b)))return!1;l-=1}return!0}var gMe=zn(function(t,e){return LI(t,e,[],[])}),Uie=gMe;function mMe(t,e,r){var s,o;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(s=1/e;r<t.length;){if(o=t[r],o===0&&1/o===s)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(o=t[r],typeof o=="number"&&o!==o)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(Uie(t[r],e))return r;r+=1}return-1}function yMe(t,e){return mMe(e,t,0)>=0}function Wm(t,e){for(var r=0,s=e.length,o=Array(s);r<s;)o[r]=t(e[r]),r+=1;return o}function aI(t){var e=t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var $m=function(t){return(t<10?"0":"")+t},bMe=typeof Date.prototype.toISOString=="function"?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+$m(t.getUTCMonth()+1)+"-"+$m(t.getUTCDate())+"T"+$m(t.getUTCHours())+":"+$m(t.getUTCMinutes())+":"+$m(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},wMe=bMe;function _Me(t){return function(){return!t.apply(this,arguments)}}function qie(t,e,r){for(var s=0,o=r.length;s<o;)e=t(e,r[s]),s+=1;return e}function MMe(t,e){for(var r=0,s=e.length,o=[];r<s;)t(e[r])&&(o[o.length]=e[r]),r+=1;return o}function SMe(t){return Object.prototype.toString.call(t)==="[object Object]"}var EMe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Hm.init,t.prototype["@@transducer/result"]=Hm.result,t.prototype["@@transducer/step"]=function(e,r){return this.f(r)?this.xf["@@transducer/step"](e,r):e},t}();function AMe(t){return function(e){return new EMe(t,e)}}var TMe=zn(NI(["fantasy-land/filter","filter"],AMe,function(t,e){return SMe(e)?qie(function(r,s){return t(e[s])&&(r[s]=e[s]),r},{},Bp(e)):MMe(t,e)})),xMe=TMe,RMe=zn(function(t,e){return xMe(_Me(t),e)}),kMe=RMe;function Fie(t,e){var r=function(l){var c=e.concat([t]);return yMe(l,c)?"<Circular>":Fie(l,c)},s=function(l,c){return Wm(function(d){return aI(d)+": "+r(l[d])},c.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+Wm(r,t).join(", ")+"))";case"[object Array]":return"["+Wm(r,t).concat(s(t,kMe(function(l){return/^\d+$/.test(l)},Bp(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):aI(wMe(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":aI(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var o=t.toString();if(o!=="[object Object]")return o}return"{"+s(t,Bp(t)).join(", ")+"}"}}var IMe=la(function(t){return Fie(t,[])}),yie=IMe,BMe=zn(function(t,e){if(t===e)return e;function r(d,b){if(d>b!=b>d)return b>d?b:d}var s=r(t,e);if(s!==void 0)return s;var o=r(typeof t,typeof e);if(o!==void 0)return o===typeof t?t:e;var l=yie(t),c=r(l,yie(e));return c!==void 0&&c===l?t:e}),OMe=BMe,CMe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Hm.init,t.prototype["@@transducer/result"]=Hm.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),PMe=function(t){return function(e){return new CMe(t,e)}},NMe=PMe,LMe=zn(NI(["fantasy-land/map","map"],NMe,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return $ie(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return qie(function(r,s){return r[s]=t(e[s]),r},{},Bp(e));default:return Wm(t,e)}})),DMe=LMe,jie=Number.isInteger||function(t){return t<<0===t};function zie(t){return Object.prototype.toString.call(t)==="[object String]"}var $Me=zn(function(t,e){var r=t<0?e.length+t:t;return zie(e)?e.charAt(r):e[r]}),Wie=$Me,UMe=zn(function(t,e){if(e!=null)return jie(t)?Wie(t,e):e[t]}),M4=UMe,qMe=zn(function(t,e){return DMe(M4(t),e)}),FMe=qMe,jMe=la(function(t){return PI(t)?!0:!t||typeof t!="object"||zie(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),zMe=jMe,bie=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function WMe(t,e,r){return function(s,o,l){if(zMe(l))return t(s,o,l);if(l==null)return o;if(typeof l["fantasy-land/reduce"]=="function")return e(s,o,l,"fantasy-land/reduce");if(l[bie]!=null)return r(s,o,l[bie]());if(typeof l.next=="function")return r(s,o,l);if(typeof l.reduce=="function")return e(s,o,l,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function KMe(t,e,r){for(var s=0,o=r.length;s<o;){if(e=t["@@transducer/step"](e,r[s]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}s+=1}return t["@@transducer/result"](e)}var HMe=zn(function(t,e){return _4(t.length,function(){return t.apply(e,arguments)})}),GMe=HMe;function VMe(t,e,r){for(var s=r.next();!s.done;){if(e=t["@@transducer/step"](e,s.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}s=r.next()}return t["@@transducer/result"](e)}function ZMe(t,e,r,s){return t["@@transducer/result"](r[s](GMe(t["@@transducer/step"],t),e))}var JMe=WMe(KMe,ZMe,VMe),XMe=JMe,YMe=function(){function t(e){this.f=e}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(e){return e},t.prototype["@@transducer/step"]=function(e,r){return this.f(e,r)},t}();function QMe(t){return new YMe(t)}var eSe=CI(function(t,e,r){return XMe(typeof t=="function"?QMe(t):t,e,r)}),Kie=eSe;function tSe(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function Hie(t,e){return function(){var r=arguments.length;if(r===0)return e();var s=arguments[r-1];return PI(s)||typeof s[t]!="function"?e.apply(this,arguments):s[t].apply(s,Array.prototype.slice.call(arguments,0,r-1))}}var rSe=CI(Hie("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),iSe=rSe,nSe=la(Hie("tail",iSe(1,1/0))),oSe=nSe;function Gie(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return _4(arguments[0].length,Kie(tSe,arguments[0],oSe(arguments)))}var aSe=zn(function(t,e){return $ie(Kie(OMe,0,FMe("length",e)),function(){var r=arguments,s=this;return t.apply(s,Wm(function(o){return o.apply(s,r)},e))})}),sSe=aSe,uSe=zn(function(t,e){return e==null||e!==e?t:e}),dI=uSe,hSe=function(){function t(e,r){this.xf=r,this.f=e,this.found=!1}return t.prototype["@@transducer/init"]=Hm.init,t.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,r){return this.f(r)&&(this.found=!0,e=sMe(this.xf["@@transducer/step"](e,r))),e},t}();function fSe(t){return function(e){return new hSe(t,e)}}var cSe=zn(NI(["find"],fSe,function(t,e){for(var r=0,s=e.length;r<s;){if(t(e[r]))return e[r];r+=1}})),lSe=cSe,dSe=la(function(t){return sSe(function(){return Array.prototype.slice.call(arguments,0)},t)}),pSe=dSe,vSe=zn(function(t,e){return t.map(function(r){for(var s=e,o=0,l;o<r.length;){if(s==null)return;l=r[o],s=jie(l)?Wie(l,s):s[l],o+=1}return s})}),gSe=vSe,mSe=zn(function(t,e){return gSe([t],e)[0]}),Vie=mSe,ySe=CI(function(t,e,r){return Uie(t,M4(e,r))}),bSe=ySe,a4=class extends Error{name="InvalidSchedulerLocation"},wSe=class extends Error{name="SchedulerTagNotFound"},_Se=class extends Error{name="TransactionNotFound"},MSe="Url",SSe="Time-To-Live",ESe="Scheduler",pI=t=>Gie(dI([]),lSe(bSe(t,"name")),dI({}),M4("value")),Zie=t=>Gie(e=>{if(!e)throw new _Se(t);return e},M4("tags"),dI([]));function Jie({fetch:t,GRAPHQL_URL:e}){return async({query:r,variables:s})=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:s})}).then(o=>o.json())}function ASe({fetch:t,GRAPHQL_URL:e}){let r=Jie({fetch:t,GRAPHQL_URL:e}),s=Xie({fetch:t,GRAPHQL_URL:e}),o=`
|
|
232
232
|
query GetTransactions ($transactionIds: [ID!]!) {
|
|
233
233
|
transactions(ids: $transactionIds) {
|
|
234
234
|
edges {
|
|
@@ -283,7 +283,7 @@ ${C}`),A.pop(),`{${z}}`}case"number":return isFinite(T)?String(T):e?e(T):"null";
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
}`,o=Xt.object({data:Xt.object({transactions:Xt.object({edges:Xt.array(Xt.object({node:Xt.record(Xt.any())}))})})});return l=>di(l).chain(sn(c=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:s,variables:{transactionIds:[c]}})}).then(async d=>{if(d.ok)return d.json();throw r('Error Encountered when querying gateway for transaction "%s"',c),new Error(`${d.status}: ${await d.text()}`)}).then(o.parse).then(CAe(["data","transactions","edges","0","node"])))).toPromise()}var qTe=II(tMe(),1),Cne=(t="@permaweb/aoconnect")=>{let e=(0,qTe.default)(t);return e.child=r=>Cne(`${e.namespace}:${r}`),e.tap=(r,...s)=>qAe((...o)=>e(r,...s,...o)),e},Pne=({url:t,path:e})=>e?e.startsWith("/")?Pne({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function FTe(t){return Lp(x4([]),Np((e,r)=>Lp(LAe([],r.name),FI(r.value),uu(r.name,ec,e))(e),{}),A4(e=>e.length>1?e:e[0]))(t)}function au(t,e){return r=>ane(WEe([kie(t,"name"),zI(qI(e),kie(e,"value"),DI)]),r)}function Oie(t){return gne([[Km(String),kp(t)],[Km(Array),SAe(t)],[DI,QSe]])}function ld(t){let e;return Km(su,t)?(e=new Error(jTe(t)),e.stack+=t.stack):Km(Error,t)?e=t:wAe("message",t)?e=new Error(t.message):Km(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function jTe(t){return Lp(e=>function r(s,o,l){return Np((c,d)=>Lp(gne([[kp(mr.invalid_arguments),()=>r(d.argumentsError,422,"Invalid Arguments")],[kp(mr.invalid_return_type),()=>r(d.returnTypeError,500,"Invalid Return")],[kp(mr.invalid_union),()=>aAe(b=>r(b,400,"Invalid Union"),d.unionErrors)],[DI,()=>[{...d,status:o,contextCode:l}]]]),jI(c))(d.code),[],s.issues)}(e,400,""),e=>Np((r,s)=>{let{message:o,path:l,contextCode:c}=s,d=l[1]||l[0],b=c?`${c} `:"";return r.push(`${b}'${d}': ${o}.`),r},[],e),kAe(" | "))(t)}var zTe=Xt.object({id:Xt.string().min(1,{message:"message is required to be a message id"}),processId:Xt.string().min(1,{message:"process is required to be a process id"})});function WTe(){return t=>di(t).map(zTe.parse).map(()=>t)}var c2=Xt.object({name:Xt.string(),value:Xt.string()}),KTe=Xt.function().args(Xt.object({Id:Xt.string(),Target:Xt.string(),Owner:Xt.string(),Anchor:Xt.string().optional(),Data:Xt.any().default("1234"),Tags:Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}))})).returns(Xt.promise(Xt.any())),HTe=Xt.function().args(Xt.object({id:Xt.string().min(1,{message:"message id is required"}),processId:Xt.string().min(1,{message:"process id is required"})})).returns(Xt.promise(Xt.any())),GTe=Xt.function().args(Xt.object({process:Xt.string().min(1,{message:"process id is required"}),from:Xt.string().optional(),to:Xt.string().optional(),sort:Xt.enum(["ASC","DESC"]).default("ASC"),limit:Xt.number().optional()})).returns(Xt.promise(Xt.object({edges:Xt.array(Xt.object({cursor:Xt.string(),node:Xt.object({Output:Xt.any().optional(),Messages:Xt.array(Xt.any()).optional(),Spawns:Xt.array(Xt.any()).optional(),Error:Xt.any().optional()})}))}))),Nne=Xt.function().args(Xt.object({processId:Xt.string(),data:Xt.any(),tags:Xt.array(c2),anchor:Xt.string().optional(),signer:Xt.any()})).returns(Xt.promise(Xt.object({messageId:Xt.string()}).passthrough())),VTe=Xt.function().args(Xt.object({data:Xt.any(),tags:Xt.array(c2),signer:Xt.any()})).returns(Xt.promise(Xt.object({processId:Xt.string()}).passthrough())),ZTe=Xt.function().args(Xt.object({process:Xt.string(),message:Xt.string(),baseLayer:Xt.boolean().optional(),exclude:Xt.array(Xt.string()).optional()})).returns(Xt.promise(Xt.object({assignmentId:Xt.string()}).passthrough())),Lne=Nne,NYe=Xt.function().args(Xt.object({suUrl:Xt.string().url(),processId:Xt.string()})).returns(Xt.promise(Xt.object({tags:Xt.array(c2)}).passthrough())),LYe=Xt.function().args(Xt.string()).returns(Xt.promise(Xt.object({url:Xt.string()}))),JTe=Xt.function().args(Xt.string()).returns(Xt.promise(Xt.boolean())),XTe=Xt.function().args(Xt.string()).returns(Xt.promise(Xt.object({tags:Xt.array(c2)}).passthrough())),R4=Xt.function().args(Xt.object({data:Xt.any(),tags:Xt.array(c2),target:Xt.string().optional(),anchor:Xt.string().optional()})).returns(Xt.promise(Xt.object({id:Xt.string(),raw:Xt.any()})));function YTe({loadResult:t}){return t=sn(HTe.implement(t)),e=>di({id:e.id,processId:e.processId}).chain(t)}function QTe(t){let e=WTe(t),r=YTe(t);return({message:s,process:o})=>di({id:s,processId:o}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',s)).map(l=>l).bimap(ld,cd).toPromise()}var exe=Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}));function txe(){return t=>di(t.tags).map(x4([])).map(au("Data-Protocol","ao")).map(au("Variant")).map(au("Type")).map(au("SDK")).map(jI(ec,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(exe.parse).map(uu("tags",ec,t))}function rxe({logger:t}){return e=>di(e).chain(zI(qI(e.data),()=>ad(e),()=>ad(Math.random().toString().slice(-4)).map(uu("data",ec,e)).map(r=>Lp(fd("tags"),au("Content-Type"),FI({name:"Content-Type",value:"text/plain"}),uu("tags",ec,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function ixe(t){let e=txe(t),r=rxe(t),s=Nne.implement(t.deployMessage);return o=>di(o).chain(e).chain(r).chain(sn(({id:l,data:c,tags:d,anchor:b,signer:g})=>s({processId:l,data:c,tags:d,anchor:b,signer:R4.implement(g)}))).map(l=>uu("messageId",l.messageId,o))}function nxe(t){let e=ixe(t);return({process:r,data:s,tags:o,anchor:l,signer:c})=>di({id:r,data:s,tags:o,anchor:l,signer:c}).chain(e).map(d=>d.messageId).bimap(ld,cd).toPromise()}var qm=(t,e,r)=>s=>e(s[t])?ad(s):Sl(`Tag '${t}': ${r}`);function oxe({loadTransactionMeta:t,logger:e}){return t=sn(XTe.implement(t)),r=>di(r).chain(t).map(fd("tags")).map(FTe).chain(qm("Data-Protocol",Oie("ao"),"value 'ao' was not found on module")).chain(qm("Type",Oie("Module"),"value 'Module' was not found on module")).chain(qm("Module-Format",fI,"was not found on module")).chain(qm("Input-Encoding",fI,"was not found on module")).chain(qm("Output-Encoding",fI,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function axe({logger:t,validateScheduler:e}){return e=sn(JTe.implement(e)),r=>di(r).chain(s=>e(s).chain(o=>o?ad(s):Sl(`Valid Scheduler-Location owned by ${s} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function sxe({logger:t}){return e=>di(e).map(t.tap("Checking for signer")).chain(r=>r?ad(r):Sl("signer not found"))}function uxe(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=oxe(t),s=axe(t),o=sxe(t);return l=>di(l).chain(c=>r(c.module).map(()=>c)).chain(c=>s(c.scheduler)).map(()=>l).chain(c=>o(c.signer).map(()=>c)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var hxe=Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}));function fxe(){return t=>di(t).map(fd("tags")).map(x4([])).map(au("Data-Protocol","ao")).map(au("Variant")).map(au("Type")).map(au("Module")).map(au("Scheduler")).map(au("SDK")).map(jI(ec,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(hxe.parse).map(uu("tags",ec,t))}function cxe({logger:t}){return e=>di(e).chain(zI(qI(e.data),()=>ad(e),()=>ad(Math.random().toString().slice(-4)).map(uu("data",ec,e)).map(r=>Lp(fd("tags"),au("Content-Type"),FI({name:"Content-Type",value:"text/plain"}),uu("tags",ec,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function lxe(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=fxe(t),s=cxe(t),o=VTe.implement(t.deployProcess);return l=>di(l).chain(r).chain(s).chain(sn(({data:c,tags:d,signer:b})=>o({data:c,tags:d,signer:R4.implement(b)}))).map(c=>uu("processId",c.processId,l))}function dxe(t){let e=uxe(t),r=lxe(t);return({module:s,scheduler:o,signer:l,tags:c,data:d})=>di({module:s,scheduler:o,signer:l,tags:c,data:d}).chain(e).chain(r).map(b=>b.processId).bimap(ld,cd).toPromise()}function pxe(t){let e=Lne.implement(t.deployMonitor);return r=>di(r).chain(sn(({id:s,signer:o})=>e({processId:s,signer:R4.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(s=>uu("monitorId",s.messageId,r))}function vxe(t){let e=pxe(t);return({process:r,signer:s})=>di({id:r,signer:s}).chain(e).map(o=>o.monitorId).bimap(ld,cd).toPromise()}function gxe(t){let e=Lne.implement(t.deployUnmonitor);return r=>di(r).chain(sn(({id:s,signer:o})=>e({processId:s,signer:R4.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(s=>uu("monitorId",s.messageId,r))}function mxe(t){let e=gxe(t);return({process:r,signer:s})=>di({id:r,signer:s}).chain(e).map(o=>o.monitorId).bimap(ld,cd).toPromise()}var yxe=Xt.object({process:Xt.string().min(1,{message:"process identifier is required"}),from:Xt.string().optional(),to:Xt.string().optional(),sort:Xt.enum(["ASC","DESC"]).default("ASC"),limit:Xt.number().optional()});function bxe(){return t=>di(t).map(yxe.parse).map(()=>t)}function wxe({queryResults:t}){return t=sn(GTe.implement(t)),e=>di({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function _xe(t){let e=bxe(t),r=wxe(t);return({process:s,from:o,to:l,sort:c,limit:d})=>di({process:s,from:o,to:l,sort:c,limit:d}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',s)).map(b=>b).bimap(ld,cd).toPromise()}var Mxe=Xt.object({Id:Xt.string(),Target:Xt.string(),Owner:Xt.string(),Anchor:Xt.string().optional(),Data:Xt.any().default("1234"),Tags:Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}))});function Sxe(){return t=>di(t).map(Mxe.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function Exe({dryrunFetch:t}){return sn(KTe.implement(t))}function Axe(t){let e=Sxe(t),r=Exe(t);return s=>di(s).map(Txe).chain(e).chain(r).toPromise()}function Txe({process:t,data:e,tags:r,anchor:s,...o}){return{Id:"1234",Owner:"1234",...o,Target:t,Data:e||"1234",Tags:r||[],Anchor:s||"0"}}function xxe(t){let e=ZTe.implement(t.deployAssign);return r=>di(r).chain(sn(({process:s,message:o,baseLayer:l,exclude:c})=>e({process:s,message:o,baseLayer:l,exclude:c}))).map(s=>uu("assignmentId",s.assignmentId,r))}function Rxe(t){let e=xxe(t);return({process:r,message:s,baseLayer:o,exclude:l})=>di({process:r,message:s,baseLayer:o,exclude:l}).chain(e).map(c=>c.assignmentId).bimap(ld,cd).toPromise()}var kxe="https://arweave.net",Ixe="https://mu.ao-testnet.xyz",Bxe="https://cu.ao-testnet.xyz";function KI({GRAPHQL_URL:t,GATEWAY_URL:e=kxe,MU_URL:r=Ixe,CU_URL:s=Bxe}={}){let o=Cne();t||(t=Pne({url:e,path:"/graphql"}));let{validate:l}=rne({cacheSize:100,GRAPHQL_URL:t}),c=XSe({MAX_SIZE:25}),d=o.child("result"),b=QTe({loadResult:VSe({fetch,CU_URL:s,logger:d}),logger:d}),g=o.child("message"),y=nxe({loadProcessMeta:sI({fetch,cache:c,logger:g}),deployMessage:jSe({fetch,MU_URL:r,logger:g}),logger:g}),m=o.child("spawn"),_=dxe({loadTransactionMeta:UTe({fetch,GRAPHQL_URL:t,logger:m}),validateScheduler:l,deployProcess:zSe({fetch,MU_URL:r,logger:m}),logger:m}),T=o.child("monitor"),A=vxe({loadProcessMeta:sI({fetch,cache:c,logger:T}),deployMonitor:WSe({fetch,MU_URL:r,logger:T}),logger:T}),R=o.child("unmonitor"),B=mxe({loadProcessMeta:sI({fetch,cache:c,logger:R}),deployUnmonitor:KSe({fetch,MU_URL:r,logger:R}),logger:T}),C=o.child("results"),P=_xe({queryResults:ZSe({fetch,CU_URL:s,logger:C}),logger:C}),N=o.child("dryrun"),q=Axe({dryrunFetch:GSe({fetch,CU_URL:s,logger:N}),logger:N}),z=o.child("assign"),J=Rxe({deployAssign:HSe({fetch,MU_URL:r,logger:z}),logger:g});return{result:b,results:P,message:y,spawn:_,monitor:A,unmonitor:B,dryrun:q,assign:J}}var Dne={};Nie(Dne,{createDataItemSigner:()=>rRe});var $ne=II(nMe(),1),Une={};Nie(Une,{AVSCTap:()=>l2,ArweaveSigner:()=>VI,DataItem:()=>s2,MAX_TAG_BYTES:()=>k4,MIN_BINARY_SIZE:()=>XI,SIG_CONFIG:()=>qp,SignatureConfig:()=>ou,Signer:()=>zne,createData:()=>Gne,default:()=>Qxe,deserializeTags:()=>w4,indexToType:()=>ZI,serializeTags:()=>JI,tagsExceedLimit:()=>Hne,warparbundles:()=>eRe});var Oxe=Object.create,HI=Object.defineProperty,Cxe=Object.getOwnPropertyDescriptor,Pxe=Object.getOwnPropertyNames,Nxe=Object.getPrototypeOf,Lxe=Object.prototype.hasOwnProperty,rc=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dxe=(t,e)=>{for(var r in e)HI(t,r,{get:e[r],enumerable:!0})},$xe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pxe(e))!Lxe.call(t,o)&&o!==r&&HI(t,o,{get:()=>e[o],enumerable:!(s=Cxe(e,o))||s.enumerable});return t},dd=(t,e,r)=>(r=t!=null?Oxe(Nxe(t)):{},$xe(e||!t||!t.__esModule?HI(r,"default",{value:t,enumerable:!0}):r,t)),Uxe=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var s=4,o=r.length,l=o%s;if(!l)return r;var c=o,d=s-l,b=o+d,g=pt.alloc(b);for(g.write(r);d--;)g.write("=",c++);return g.toString()}t.default=e}),qxe=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Uxe();function r(b,g){return g===void 0&&(g="utf8"),pt.isBuffer(b)?l(b.toString("base64")):l(pt.from(b,g).toString("base64"))}function s(b,g){return g===void 0&&(g="utf8"),pt.from(o(b),"base64").toString(g)}function o(b){return b=b.toString(),e.default(b).replace(/\-/g,"+").replace(/_/g,"/")}function l(b){return b.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(b){return pt.from(o(b),"base64")}var d=r;d.encode=r,d.decode=s,d.toBase64=o,d.fromBase64=l,d.toBuffer=c,t.default=d}),GI=rc((t,e)=>{e.exports=qxe().default,e.exports.default=e.exports}),qne=rc(t=>{"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=T;var e=[],r=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)e[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function d(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function b(A){var R=d(A),B=R[0],C=R[1];return(B+C)*3/4-C}function g(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=d(A),C=B[0],P=B[1],N=new s(g(A,C,P)),q=0,z=P>0?C-4:C,J;for(J=0;J<z;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function m(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function _(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(m(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,z=B-C;q<z;q+=N)P.push(_(A,q,q+N>z?z:q+N));return C===1?(R=A[B-1],P.push(e[R>>2]+e[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(e[R>>10]+e[R>>4&63]+e[R<<2&63]+"=")),P.join("")}}),Fne=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=qne();function r(_){let T=0;for(let B=0;B<_.length;B++)T+=_[B].byteLength;let A=new Uint8Array(T),R=0;A.set(new Uint8Array(_[0]),R),R+=_[0].byteLength;for(let B=1;B<_.length;B++)A.set(new Uint8Array(_[B]),R),R+=_[B].byteLength;return A}t.concatBuffers=r;function s(_){let T=d(_);return o(T)}t.b64UrlToString=s;function o(_){return new TextDecoder("utf-8",{fatal:!0}).decode(_)}t.bufferToString=o;function l(_){return new TextEncoder().encode(_)}t.stringToBuffer=l;function c(_){return g(l(_))}t.stringToB64Url=c;function d(_){return new Uint8Array(e.toByteArray(m(_)))}t.b64UrlToBuffer=d;function b(_){return e.fromByteArray(new Uint8Array(_))}t.bufferTob64=b;function g(_){return y(b(_))}t.bufferTob64Url=g;function y(_){return _.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=y;function m(_){_=_.replace(/\-/g,"+").replace(/\_/g,"/");let T;return _.length%4==0?T=0:T=4-_.length%4,_.concat("=".repeat(T))}t.b64UrlDecode=m}),Fxe=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Fne(),r=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let s=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),o=await this.driver.exportKey("jwk",s.privateKey);return{kty:o.kty,e:o.e,n:o.n,d:o.d,p:o.p,q:o.q,dp:o.dp,dq:o.dq,qi:o.qi}}async sign(s,o,{saltLength:l}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(s),o);return new Uint8Array(c)}async hash(s,o="SHA-256"){let l=await this.driver.digest(o,s);return new Uint8Array(l)}async verify(s,o,l){let c={kty:"RSA",e:"AQAB",n:s},d=await this.jwkToPublicCryptoKey(c),b=await this.driver.digest("SHA-256",o),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},d,l,o),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},d,l,o),m=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((d.algorithm.modulusLength-1)/8)-b.byteLength-2},d,l,o);return g||y||m}async jwkToCryptoKey(s){return this.driver.importKey("jwk",s,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(s){return this.driver.importKey("jwk",s,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let s=crypto?.subtle;return s===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(o=>typeof s[o]=="function")}async encrypt(s,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?e.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:l?e.stringToBuffer(l):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let g=await this.driver.encrypt({name:"AES-CBC",iv:b},d,s);return e.concatBuffers([b,g])}async decrypt(s,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?e.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:l?e.stringToBuffer(l):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=s.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:b},d,s.slice(16));return e.concatBuffers([g])}};t.default=r}),jxe=rc(t=>{t.read=function(e,r,s,o,l){var c,d,b=l*8-o-1,g=(1<<b)-1,y=g>>1,m=-7,_=s?l-1:0,T=s?-1:1,A=e[r+_];for(_+=T,c=A&(1<<-m)-1,A>>=-m,m+=b;m>0;c=c*256+e[r+_],_+=T,m-=8);for(d=c&(1<<-m)-1,c>>=-m,m+=o;m>0;d=d*256+e[r+_],_+=T,m-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,o),c=c-y}return(A?-1:1)*d*Math.pow(2,c-o)},t.write=function(e,r,s,o,l,c){var d,b,g,y=c*8-l-1,m=(1<<y)-1,_=m>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=m):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+_>=1?r+=T/g:r+=T*Math.pow(2,1-_),r*g>=2&&(d++,g/=2),d+_>=m?(b=0,d=m):d+_>=1?(b=(r*g-1)*Math.pow(2,l),d=d+_):(b=r*Math.pow(2,_-1)*Math.pow(2,l),d=0));l>=8;e[s+A]=b&255,A+=R,b/=256,l-=8);for(d=d<<l|b,y+=l;y>0;e[s+A]=d&255,A+=R,d/=256,y-=8);e[s+A-R]|=B*128}}),xI=rc(t=>{"use strict";var e=qne(),r=jxe(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=P,t.INSPECT_MAX_BYTES=50;var o=2147483647;t.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,d.prototype),O}function d(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(I)}return b(I,O,L)}d.poolSize=8192;function b(I,O,L){if(typeof I=="string")return _(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(ge(I,ArrayBuffer)||I&&ge(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(I,SharedArrayBuffer)||I&&ge(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return d.from(V,O,L);let se=B(I);if(se)return se;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return d.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}d.from=function(I,O,L){return b(I,O,L)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return g(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}d.alloc=function(I,O,L){return y(I,O,L)};function m(I){return g(I),c(I<0?0:C(I)|0)}d.allocUnsafe=function(I){return m(I)},d.allocUnsafeSlow=function(I){return m(I)};function _(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!d.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),se=V.write(I,O);return se!==L&&(V=V.slice(0,se)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(ge(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,d.prototype),V}function B(I){if(d.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||we(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),d.alloc(+I)}d.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==d.prototype},d.compare=function(I,O){if(ge(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),ge(O,Uint8Array)&&(O=d.from(O,O.offset,O.byteLength)),!d.isBuffer(I)||!d.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let L=I.length,V=O.length;for(let se=0,he=Math.min(L,V);se<he;++se)if(I[se]!==O[se]){L=I[se],V=O[se];break}return L<V?-1:V<L?1:0},d.isEncoding=function(I){switch(String(I).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return d.alloc(0);let L;if(O===void 0)for(O=0,L=0;L<I.length;++L)O+=I[L].length;let V=d.allocUnsafe(O),se=0;for(L=0;L<I.length;++L){let he=I[L];if(ge(he,Uint8Array))se+he.length>V.length?(d.isBuffer(he)||(he=d.from(he)),he.copy(V,se)):Uint8Array.prototype.set.call(V,he,se);else if(d.isBuffer(he))he.copy(V,se);else throw new TypeError('"list" argument must be an Array of Buffers');se+=he.length}return V};function N(I,O){if(d.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||ge(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let se=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return fe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return be(I).length;default:if(se)return V?-1:fe(I).length;O=(""+O).toLowerCase(),se=!0}}d.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return i(this,O,L);case"utf8":case"utf-8":return p(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return h(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}d.prototype._isBuffer=!0;function z(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}d.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)z(this,O,O+1);return this},d.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)z(this,O,O+3),z(this,O+1,O+2);return this},d.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)z(this,O,O+7),z(this,O+1,O+6),z(this,O+2,O+5),z(this,O+3,O+4);return this},d.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?p(this,0,I):q.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(I){if(!d.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:d.compare(this,I)===0},d.prototype.inspect=function(){let I="",O=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},s&&(d.prototype[s]=d.prototype.inspect),d.prototype.compare=function(I,O,L,V,se){if(ge(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),!d.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),L===void 0&&(L=I?I.length:0),V===void 0&&(V=0),se===void 0&&(se=this.length),O<0||L>I.length||V<0||se>this.length)throw new RangeError("out of range index");if(V>=se&&O>=L)return 0;if(V>=se)return-1;if(O>=L)return 1;if(O>>>=0,L>>>=0,V>>>=0,se>>>=0,this===I)return 0;let he=se-V,ue=L-O,xe=Math.min(he,ue),_e=this.slice(V,se),me=I.slice(O,L);for(let Qe=0;Qe<xe;++Qe)if(_e[Qe]!==me[Qe]){he=_e[Qe],ue=me[Qe];break}return he<ue?-1:ue<he?1:0};function J(I,O,L,V,se){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,we(L)&&(L=se?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(se)return-1;L=I.length-1}else if(L<0)if(se)L=0;else return-1;if(typeof O=="string"&&(O=d.from(O,V)),d.isBuffer(O))return O.length===0?-1:F(I,O,L,V,se);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?se?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,se);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,se){let he=1,ue=I.length,xe=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;he=2,ue/=2,xe/=2,L/=2}function _e(Qe,Ie){return he===1?Qe[Ie]:Qe.readUInt16BE(Ie*he)}let me;if(se){let Qe=-1;for(me=L;me<ue;me++)if(_e(I,me)===_e(O,Qe===-1?0:me-Qe)){if(Qe===-1&&(Qe=me),me-Qe+1===xe)return Qe*he}else Qe!==-1&&(me-=me-Qe),Qe=-1}else for(L+xe>ue&&(L=ue-xe),me=L;me>=0;me--){let Qe=!0;for(let Ie=0;Ie<xe;Ie++)if(_e(I,me+Ie)!==_e(O,Ie)){Qe=!1;break}if(Qe)return me}return-1}d.prototype.includes=function(I,O,L){return this.indexOf(I,O,L)!==-1},d.prototype.indexOf=function(I,O,L){return J(this,I,O,L,!0)},d.prototype.lastIndexOf=function(I,O,L){return J(this,I,O,L,!1)};function H(I,O,L,V){L=Number(L)||0;let se=I.length-L;V?(V=Number(V),V>se&&(V=se)):V=se;let he=O.length;V>he/2&&(V=he/2);let ue;for(ue=0;ue<V;++ue){let xe=parseInt(O.substr(ue*2,2),16);if(we(xe))return ue;I[L+ue]=xe}return ue}function Y(I,O,L,V){return le(fe(O,I.length-L),I,L,V)}function E(I,O,L,V){return le(pe(O),I,L,V)}function n(I,O,L,V){return le(be(O),I,L,V)}function u(I,O,L,V){return le(Te(O,I.length-L),I,L,V)}d.prototype.write=function(I,O,L,V){if(O===void 0)V="utf8",L=this.length,O=0;else if(L===void 0&&typeof O=="string")V=O,L=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(L)?(L=L>>>0,V===void 0&&(V="utf8")):(V=L,L=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let se=this.length-O;if((L===void 0||L>se)&&(L=se),I.length>0&&(L<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let he=!1;for(;;)switch(V){case"hex":return H(this,I,O,L);case"utf8":case"utf-8":return Y(this,I,O,L);case"ascii":case"latin1":case"binary":return E(this,I,O,L);case"base64":return n(this,I,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,I,O,L);default:if(he)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),he=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function h(I,O,L){return O===0&&L===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(O,L))}function p(I,O,L){L=Math.min(I.length,L);let V=[],se=O;for(;se<L;){let he=I[se],ue=null,xe=he>239?4:he>223?3:he>191?2:1;if(se+xe<=L){let _e,me,Qe,Ie;switch(xe){case 1:he<128&&(ue=he);break;case 2:_e=I[se+1],(_e&192)===128&&(Ie=(he&31)<<6|_e&63,Ie>127&&(ue=Ie));break;case 3:_e=I[se+1],me=I[se+2],(_e&192)===128&&(me&192)===128&&(Ie=(he&15)<<12|(_e&63)<<6|me&63,Ie>2047&&(Ie<55296||Ie>57343)&&(ue=Ie));break;case 4:_e=I[se+1],me=I[se+2],Qe=I[se+3],(_e&192)===128&&(me&192)===128&&(Qe&192)===128&&(Ie=(he&15)<<18|(_e&63)<<12|(me&63)<<6|Qe&63,Ie>65535&&Ie<1114112&&(ue=Ie))}}ue===null?(ue=65533,xe=1):ue>65535&&(ue-=65536,V.push(ue>>>10&1023|55296),ue=56320|ue&1023),V.push(ue),se+=xe}return S(V)}var v=4096;function S(I){let O=I.length;if(O<=v)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=v));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]);return V}function i(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let se="";for(let he=O;he<L;++he)se+=Me[I[he]];return se}function f(I,O,L){let V=I.slice(O,L),se="";for(let he=0;he<V.length-1;he+=2)se+=String.fromCharCode(V[he]+V[he+1]*256);return se}d.prototype.slice=function(I,O){let L=this.length;I=~~I,O=O===void 0?L:~~O,I<0?(I+=L,I<0&&(I=0)):I>L&&(I=L),O<0?(O+=L,O<0&&(O=0)):O>L&&(O=L),O<I&&(O=I);let V=this.subarray(I,O);return Object.setPrototypeOf(V,d.prototype),V};function w(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=this[I],se=1,he=0;for(;++he<O&&(se*=256);)V+=this[I+he]*se;return V},d.prototype.readUintBE=d.prototype.readUIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=this[I+--O],se=1;for(;O>0&&(se*=256);)V+=this[I+--O]*se;return V},d.prototype.readUint8=d.prototype.readUInt8=function(I,O){return I=I>>>0,O||w(I,1,this.length),this[I]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||w(I,2,this.length),this[I]|this[I+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||w(I,2,this.length),this[I]<<8|this[I+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||w(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||w(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},d.prototype.readBigUInt64LE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,se=this[++I]+this[++I]*2**8+this[++I]*2**16+L*2**24;return BigInt(V)+(BigInt(se)<<BigInt(32))}),d.prototype.readBigUInt64BE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],se=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L;return(BigInt(V)<<BigInt(32))+BigInt(se)}),d.prototype.readIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=this[I],se=1,he=0;for(;++he<O&&(se*=256);)V+=this[I+he]*se;return se*=128,V>=se&&(V-=Math.pow(2,8*O)),V},d.prototype.readIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=O,se=1,he=this[I+--V];for(;V>0&&(se*=256);)he+=this[I+--V]*se;return se*=128,he>=se&&(he-=Math.pow(2,8*O)),he},d.prototype.readInt8=function(I,O){return I=I>>>0,O||w(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},d.prototype.readInt16LE=function(I,O){I=I>>>0,O||w(I,2,this.length);let L=this[I]|this[I+1]<<8;return L&32768?L|4294901760:L},d.prototype.readInt16BE=function(I,O){I=I>>>0,O||w(I,2,this.length);let L=this[I+1]|this[I]<<8;return L&32768?L|4294901760:L},d.prototype.readInt32LE=function(I,O){return I=I>>>0,O||w(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},d.prototype.readInt32BE=function(I,O){return I=I>>>0,O||w(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},d.prototype.readBigInt64LE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(L<<24);return(BigInt(V)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),d.prototype.readBigInt64BE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(V)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L)}),d.prototype.readFloatLE=function(I,O){return I=I>>>0,O||w(I,4,this.length),r.read(this,I,!0,23,4)},d.prototype.readFloatBE=function(I,O){return I=I>>>0,O||w(I,4,this.length),r.read(this,I,!1,23,4)},d.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||w(I,8,this.length),r.read(this,I,!0,52,8)},d.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||w(I,8,this.length),r.read(this,I,!1,52,8)};function M(I,O,L,V,se,he){if(!d.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>se||O<he)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ue=Math.pow(2,8*L)-1;M(this,I,O,L,ue,0)}let se=1,he=0;for(this[O]=I&255;++he<L&&(se*=256);)this[O+he]=I/se&255;return O+L},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ue=Math.pow(2,8*L)-1;M(this,I,O,L,ue,0)}let se=L-1,he=1;for(this[O+se]=I&255;--se>=0&&(he*=256);)this[O+se]=I/he&255;return O+L},d.prototype.writeUint8=d.prototype.writeUInt8=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,1,255,0),this[O]=I&255,O+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function k(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,L}function $(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L+7]=he,he=he>>8,I[L+6]=he,he=he>>8,I[L+5]=he,he=he>>8,I[L+4]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ue,ue=ue>>8,I[L+2]=ue,ue=ue>>8,I[L+1]=ue,ue=ue>>8,I[L]=ue,L+8}d.prototype.writeBigUInt64LE=nt(function(I,O=0){return k(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=nt(function(I,O=0){return $(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let xe=Math.pow(2,8*L-1);M(this,I,O,L,xe-1,-xe)}let se=0,he=1,ue=0;for(this[O]=I&255;++se<L&&(he*=256);)I<0&&ue===0&&this[O+se-1]!==0&&(ue=1),this[O+se]=(I/he>>0)-ue&255;return O+L},d.prototype.writeIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let xe=Math.pow(2,8*L-1);M(this,I,O,L,xe-1,-xe)}let se=L-1,he=1,ue=0;for(this[O+se]=I&255;--se>=0&&(he*=256);)I<0&&ue===0&&this[O+se+1]!==0&&(ue=1),this[O+se]=(I/he>>0)-ue&255;return O+L},d.prototype.writeInt8=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},d.prototype.writeInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},d.prototype.writeInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},d.prototype.writeInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},d.prototype.writeInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},d.prototype.writeBigInt64LE=nt(function(I,O=0){return k(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=nt(function(I,O=0){return $(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ie(I,O,L,V,se,he){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}d.prototype.writeFloatLE=function(I,O,L){return Z(this,I,O,!0,L)},d.prototype.writeFloatBE=function(I,O,L){return Z(this,I,O,!1,L)};function te(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}d.prototype.writeDoubleLE=function(I,O,L){return te(this,I,O,!0,L)},d.prototype.writeDoubleBE=function(I,O,L){return te(this,I,O,!1,L)},d.prototype.copy=function(I,O,L,V){if(!d.isBuffer(I))throw new TypeError("argument should be a Buffer");if(L||(L=0),!V&&V!==0&&(V=this.length),O>=I.length&&(O=I.length),O||(O=0),V>0&&V<L&&(V=L),V===L||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(L<0||L>=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),I.length-O<V-L&&(V=I.length-O+L);let se=V-L;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,L,V):Uint8Array.prototype.set.call(I,this.subarray(L,V),O),se},d.prototype.fill=function(I,O,L,V){if(typeof I=="string"){if(typeof O=="string"?(V=O,O=0,L=this.length):typeof L=="string"&&(V=L,L=this.length),V!==void 0&&typeof V!="string")throw new TypeError("encoding must be a string");if(typeof V=="string"&&!d.isEncoding(V))throw new TypeError("Unknown encoding: "+V);if(I.length===1){let he=I.charCodeAt(0);(V==="utf8"&&he<128||V==="latin1")&&(I=he)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<L)throw new RangeError("Out of range index");if(L<=O)return this;O=O>>>0,L=L===void 0?this.length:L>>>0,I||(I=0);let se;if(typeof I=="number")for(se=O;se<L;++se)this[se]=I;else{let he=d.isBuffer(I)?I:d.from(I,V),ue=he.length;if(ue===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(se=0;se<L-O;++se)this[se+O]=he[se%ue]}return this};var Q={};function W(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(V){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:V,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),W("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,se=L;return Number.isInteger(L)&&Math.abs(L)>2**32?se=ee(String(L)):typeof L=="bigint"&&(se=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(se=ee(se)),se+="n"),V+=` It must be ${O}. Received ${se}`,V},RangeError);function ee(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&re(O,I.length-(L+1))}function U(I,O,L,V,se,he){if(I>L||I<O){let ue=typeof O=="bigint"?"n":"",xe;throw he>3?O===0||O===BigInt(0)?xe=`>= 0${ue} and < 2${ue} ** ${(he+1)*8}${ue}`:xe=`>= -(2${ue} ** ${(he+1)*8-1}${ue}) and < 2 ** ${(he+1)*8-1}${ue}`:xe=`>= ${O}${ue} and <= ${L}${ue}`,new Q.ERR_OUT_OF_RANGE("value",xe,I)}X(V,se,he)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function re(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var oe=/[^+/0-9A-Za-z-_]/g;function ce(I){if(I=I.split("=")[0],I=I.trim().replace(oe,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function fe(I,O){O=O||1/0;let L,V=I.length,se=null,he=[];for(let ue=0;ue<V;++ue){if(L=I.charCodeAt(ue),L>55295&&L<57344){if(!se){if(L>56319){(O-=3)>-1&&he.push(239,191,189);continue}else if(ue+1===V){(O-=3)>-1&&he.push(239,191,189);continue}se=L;continue}if(L<56320){(O-=3)>-1&&he.push(239,191,189),se=L;continue}L=(se-55296<<10|L-56320)+65536}else se&&(O-=3)>-1&&he.push(239,191,189);if(se=null,L<128){if((O-=1)<0)break;he.push(L)}else if(L<2048){if((O-=2)<0)break;he.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;he.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;he.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return he}function pe(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function Te(I,O){let L,V,se,he=[];for(let ue=0;ue<I.length&&!((O-=2)<0);++ue)L=I.charCodeAt(ue),V=L>>8,se=L%256,he.push(se),he.push(V);return he}function be(I){return e.toByteArray(ce(I))}function le(I,O,L,V){let se;for(se=0;se<V&&!(se+L>=O.length||se>=I.length);++se)O[se+L]=I[se];return se}function ge(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function we(I){return I!==I}var Me=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let se=0;se<16;++se)O[V+se]=I[L]+I[se]}return O}();function nt(I){return typeof BigInt>"u"?ne:I}function ne(){throw new Error("BigInt not supported")}}),zxe=rc((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:xI().Buffer,Crypto:window.crypto}):e.exports={Buffer:xI().Buffer,Crypto:crypto}}),jne={};Dxe(jne,{AVSCTap:()=>l2,ArweaveSigner:()=>VI,DataItem:()=>s2,MAX_TAG_BYTES:()=>k4,MIN_BINARY_SIZE:()=>XI,SIG_CONFIG:()=>qp,SignatureConfig:()=>ou,Signer:()=>zne,createData:()=>Gne,deserializeTags:()=>w4,indexToType:()=>ZI,serializeTags:()=>JI,tagsExceedLimit:()=>Hne});var zne=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,s){throw new Error("You must implement verify method on child")}},Wxe=dd(GI(),1),ih=dd(Fne(),1);async function Wne(t){if(Array.isArray(t)){let o=(0,ih.concatBuffers)([(0,ih.stringToBuffer)("list"),(0,ih.stringToBuffer)(t.length.toString())]);return await Kne(t,await Yf().hash(o,"SHA-384"))}let e=t,r=(0,ih.concatBuffers)([(0,ih.stringToBuffer)("blob"),(0,ih.stringToBuffer)(e.byteLength.toString())]),s=(0,ih.concatBuffers)([await Yf().hash(r,"SHA-384"),await Yf().hash(e,"SHA-384")]);return await Yf().hash(s,"SHA-384")}async function Kne(t,e){if(t.length<1)return e;let r=(0,ih.concatBuffers)([e,await Wne(t[0])]),s=await Yf().hash(r,"SHA-384");return await Kne(t.slice(1),s)}var lI=dd(Fxe(),1),Kxe=lI.default.default?lI.default.default:lI.default,Hxe=class extends Kxe{getPublicKey(t){throw new Error("Unimplemented")}},Gxe;function Yf(){return Gxe??=new Hxe}var ou;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(ou||(ou={}));var qp={[ou.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[ou.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[ou.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[ou.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[ou.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[ou.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[ou.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},VI=class{signatureType=1;ownerLength=qp[1].pubLength;signatureLength=qp[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return Wxe.default.toBuffer(this.pk)}sign(t){return Yf().sign(this.jwk,t)}static async verify(t,e,r){return await Yf().verify(t,e,r)}},ZI={1:VI},Gh=dd(GI(),1);async function RI(t){return Wne([(0,ih.stringToBuffer)("dataitem"),(0,ih.stringToBuffer)("1"),(0,ih.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Vxe(t,e){let r=await RI(t),s=await e.sign(r),o=await Yf().hash(s);return{signature:pt.from(s),id:pt.from(o)}}async function Zxe(t,e){let{signature:r,id:s}=await Vxe(t,e);return t.getRaw().set(r,2),s}var l2=class{buf;pos;constructor(t=pt.alloc(k4),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;r<e;r++){let s=t[r];if(s?.name===void 0||s?.value===void 0)throw new Error(`Invalid tag format for ${s}, expected {name:string, value: string}`);this.writeString(s.name),this.writeString(s.value)}this.writeLong(0)}toBuffer(){let t=pt.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,s;if(t>=-1073741824&&t<1073741824){s=t>=0?t<<1:~t<<1|1;do e[this.pos]=s&127,s>>=7;while(s&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=pt.byteLength(t),r=this.buf;this.writeLong(e);let s=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let o,l,c,d;for(o=0,l=e;o<l;o++)c=t.charCodeAt(o),c<128?r[s++]=c:c<2048?(r[s++]=c>>6|192,r[s++]=c&63|128):(c&64512)===55296&&((d=t.charCodeAt(o+1))&64512)===56320?(c=65536+((c&1023)<<10)+(d&1023),o++,r[s++]=c>>18|240,r[s++]=c>>12&63|128,r[s++]=c>>6&63|128,r[s++]=c&63|128):(r[s++]=c>>12|224,r[s++]=c>>6&63|128,r[s++]=c&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,s,o,l,c;do s=r[this.pos++],o=s&128,t|=(s&127)<<e,e+=7;while(o&&e<28);if(o){l=t,c=268435456;do s=r[this.pos++],l+=(s&127)*c,c*=128;while(s&128);return(l%2?-(l+1):l)/2}return t>>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),s=this.readString();t.push({name:r,value:s})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function JI(t){let e=new l2;return e.writeTags(t),e.toBuffer()}function Hne(t){let e=new l2;return e.writeTags(t),e.tagsExceedLimit()}function w4(t){return new l2(t).readTags()}function bl(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function Jxe(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let s=t&255;e[r]=s,t=(t-s)/256}return Uint8Array.from(e)}function Cie(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let s=t&255;e[r]=s,t=(t-s)/256}return Uint8Array.from(e)}var Xxe=dd(zxe(),1),xp=dd(xI(),1),k4=4096,XI=80,s2=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=bl(this.binary.subarray(0,2));if(ou?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return s2.verify(this.binary)}get id(){return(async()=>Gh.default.encode(await this.rawId))()}set id(t){this._id=Gh.default.toBuffer(t)}get rawId(){return(async()=>xp.Buffer.from(await Xxe.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Gh.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return qp[this.signatureType].sigLength}get owner(){return Gh.default.encode(this.rawOwner)}get ownerLength(){return qp[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):xp.Buffer.alloc(0)}get target(){return Gh.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):xp.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=bl(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(bl(this.binary.subarray(t,t+8))==0)return[];let e=bl(this.binary.subarray(t+8,t+16));return w4(xp.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Gh.default.encode(t.name),value:Gh.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=bl(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=bl(e),s=t+16+r;return this.binary.subarray(s,this.binary.length)}get data(){return Gh.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Zxe(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=xp.Buffer.from(await Yf().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Gh.default.encode(t.name),value:Gh.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<XI)return!1;let e=new s2(t),r=e.signatureType,s=e.getTagsStart(),o=bl(t.subarray(s,s+8)),l=t.subarray(s+8,s+16),c=bl(l);if(c>k4)return!1;if(o>0)try{if(w4(xp.Buffer.from(t.subarray(s+16,s+16+c))).length!==o)return!1}catch{return!1}let d=ZI[r],b=await RI(e);return await d.verify(e.rawOwner,b,e.rawSignature)}async getSignatureData(){return RI(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),s=this.binary[r]==1;return r+=s?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},Yxe=dd(GI(),1);function Gne(t,e,r){let s=e.publicKey,o=r?.target?Yxe.default.toBuffer(r.target):null,l=1+(o?.byteLength??0),c=r?.anchor?pt.from(r.anchor):null,d=1+(c?.byteLength??0),b=(r?.tags?.length??0)>0?JI(r.tags):null,g=16+(b?b.byteLength:0),y=pt.from(t),m=y.byteLength,_=2+e.signatureLength+e.ownerLength+l+d+g+m,T=pt.alloc(_);if(T.set(Jxe(e.signatureType),0),T.set(new Uint8Array(e.signatureLength).fill(0),2),s.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${s.byteLength}`);T.set(s,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(T[A]=o?1:0,o){if(o.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${o.byteLength}`);T.set(o,A+1)}let R=A+l,B=R+1;if(T[R]=c?1:0,c){if(B+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");T.set(c,R+1)}T.set(Cie(r?.tags?.length??0),B);let C=Cie(b?.byteLength??0);T.set(C,B+8),b&&T.set(b,B+16);let P=B+g;return T.set(y,P),new s2(T)}var YI={...jne};globalThis.arbundles??=YI;var Qxe=YI,eRe=YI;globalThis.Buffer||(globalThis.Buffer=$ne.Buffer);var{DataItem:tRe}=Une;function rRe(t){return async({data:r,tags:s,target:o,anchor:l,createDataItem:c=d=>new tRe(d)})=>{let d=await t.signDataItem({data:r,tags:s,target:o,anchor:l}),b=c($ne.Buffer.from(d));return{id:await b.id,raw:await b.getRaw()}}}var iRe=globalThis.GATEWAY_URL||void 0,nRe=globalThis.MU_URL||void 0,oRe=globalThis.CU_URL||void 0,aRe=globalThis.GRAPHQL_URL||void 0,{result:DYe,results:$Ye,message:UYe,spawn:qYe,monitor:FYe,unmonitor:jYe,dryrun:zYe,assign:WYe}=KI({GATEWAY_URL:iRe,MU_URL:nRe,CU_URL:oRe,GRAPHQL_URL:aRe}),KYe=Dne.createDataItemSigner;var Vne=Zl(G7(),1);var pd=class{logger;processId;ao;constructor({processId:e,logger:r=new Sa({level:"info"})}){this.processId=e,this.logger=r,this.ao=KI()}async createAoSigner(e){return e.publicKey===void 0&&"setPublicKey"in e&&await e.setPublicKey(),async({data:s,tags:o,target:l,anchor:c})=>{let d=(0,Vne.createData)(s,e,{tags:o,target:l,anchor:c});return d.sign(e).then(async()=>({id:await d.id,raw:await d.getRaw()}))}}async read({tags:e}){this.logger.debug("Evaluating read interaction on contract",{tags:e});let r=await this.ao.dryrun({process:this.processId,tags:e});if(r.Error!==void 0)throw new Error(r.Error);if(r.Messages.length===0)throw new Error("Process does not support provided action.");return this.logger.debug("Read interaction result",{result:r.Messages[0].Data}),JSON.parse(r.Messages[0].Data)}async send({tags:e,data:r,signer:s}){this.logger.debug("Evaluating send interaction on contract",{tags:e,data:r,processId:this.processId});let o=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:z1}],data:JSON.stringify(r),signer:await this.createAoSigner(s)});this.logger.debug("Sent message to process",{messageId:o,processId:this.processId});let l=await this.ao.result({message:o,process:this.processId});if(this.logger.debug("Message result",{output:l,messageId:o,processId:this.processId}),l.Messages.length===0)return{id:o};let d=l.Messages[0].Tags.find(g=>g.name==="Error");if(d){let g=l.Messages[0].Data;throw new Error(`${d.Value}: ${g}`)}let b=JSON.parse(l.Messages[0].Data);return this.logger.debug("Message result data",{resultData:b,messageId:o,processId:this.processId}),{id:o,result:b}}};var Zne=class{static init(e){if(e&&e.signer){let{signer:r,...s}=e;return new QI({...s,signer:r})}return new I4(e)}},I4=class{process;arweave;constructor(e,r=Jne.default.init({})){if(!e)this.process=new pd({processId:V7});else if(Y7(e))this.process=e.process;else if(Q7(e))this.process=new pd({processId:e.processId,logger:new Sa({level:"info"})});else throw new Ka;this.arweave=r}async getEpoch(e){let s=[{name:"Action",value:"Epoch"},{name:"Timestamp",value:e.timestamp?.toString()??""},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:(await this.arweave.blocks.getCurrent()).timestamp.toString()}),this.process.read({tags:s})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(){return this.process.read({tags:[{name:"Action",value:"Records"}]})}async getArNSReservedNames(){return this.process.read({tags:[{name:"Action",value:"ReservedNames"}]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"ReservedName"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(){return this.process.read({tags:[{name:"Action",value:"Balances"}]})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGateways(){return this.process.read({tags:[{name:"Action",value:"Gateways"}]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"},{name:"Timestamp",value:`${Date.now()}`}]})}async getPrescribedObservers(e){let s=[{name:"Action",value:"EpochPrescribedObservers"},{name:"Timestamp",value:e.timestamp?.toString()},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:`${Date.now()}`}),this.process.read({tags:s})}async getPrescribedNames(e){let s=[{name:"Action",value:"EpochPrescribedNames"},{name:"Timestamp",value:e.timestamp?.toString()},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:`${Date.now()}`}),this.process.read({tags:s})}async getObservations(e){let s=[{name:"Action",value:"EpochObservations"},{name:"Timestamp",value:e.timestamp?.toString()},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:(await this.arweave.blocks.getCurrent()).timestamp.toString()}),this.process.read({tags:s})}async getDistributions(e){let s=[{name:"Action",value:"EpochDistributions"},{name:"Timestamp",value:e.timestamp?.toString()??""},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:(await this.arweave.blocks.getCurrent()).timestamp.toString()}),this.process.read({tags:s})}},QI=class extends I4{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({process:new pd({processId:V7})}),this.signer=e;else if(Y7(r))super({process:r.process}),this.signer=e;else if(Q7(r))super({process:new pd({processId:r.processId})}),this.signer=e;else throw new Ka}async transfer({target:e,qty:r},s){let{tags:o=[]}=s||{};return this.process.send({tags:[...o,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:r,delegateRewardShareRatio:s,fqdn:o,label:l,minDelegatedStake:c,note:d,port:b,properties:g,protocol:y,autoStake:m,observerAddress:_},T){let{tags:A=[]}=T||{},B=[...A,{name:"Action",value:"JoinNetwork"},{name:"OperatorStake",value:e.valueOf().toString()},{name:"AllowDelegatedStaking",value:r.toString()},{name:"DelegateRewardShareRatio",value:s.toString()},{name:"FQDN",value:o},{name:"Label",value:l},{name:"MinDelegatedStake",value:c.valueOf().toString()},{name:"Note",value:d},{name:"Port",value:b.toString()},{name:"Properties",value:g},{name:"Protocol",value:y},{name:"AutoStake",value:m.toString()},{name:"ObserverAddress",value:_}].filter(C=>C.value!==void 0);return this.process.send({signer:this.signer,tags:B})}async updateGatewaySettings({allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:s,label:o,minDelegatedStake:l,note:c,port:d,properties:b,protocol:g,autoStake:y,observerAddress:m},_){let{tags:T=[]}=_||{},R=[...T,{name:"Action",value:"UpdateGatewaySettings"},{name:"Label",value:o},{name:"Note",value:c},{name:"FQDN",value:s},{name:"Port",value:d?.toString()},{name:"Properties",value:b},{name:"Protocol",value:g},{name:"ObserverAddress",value:m},{name:"AllowDelegatedStaking",value:e?.toString()},{name:"DelegateRewardShareRatio",value:r?.toString()},{name:"MinDelegatedStake",value:l?.valueOf().toString()},{name:"AutoStake",value:y?.toString()}].filter(B=>B.value!==void 0);return this.process.send({signer:this.signer,tags:R})}async delegateStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"DelegateStake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"DecreaseDelegateStake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async increaseOperatorStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"IncreaseOperatorStake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"DecreaseOperatorStake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async saveObservations(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"SaveObservations"},{name:"ReportTxId",value:e.reportTxId},{name:"FailedGateways",value:e.failedGateways.join(",")}],data:{reportTxId:e.reportTxId,failedGateways:e.failedGateways}})}async buyRecord(e,r){let{tags:s=[]}=r||{},l=[...s,{name:"Action",value:"BuyRecord"},{name:"Name",value:e.name},{name:"Type",value:e.type},{name:"Years",value:e.years?.toString()},{name:"ProcessId",value:e.processId}].filter(c=>c.value!==void 0);return this.process.send({signer:this.signer,tags:l})}async extendLease(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"ExtendLease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()}]})}async increaseUndernameLimit(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"IncreaseUndernameLimit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()}]})}};Se();Ae();Ee();Se();Ae();Ee();var or=Zl(hhe(),1);var eft=or.default.AbortError,tft=or.default.AbstractContractHandler,rft=or.default.ArweaveContractDefinitionLoader,ift=or.default.ArweaveGatewayBundledContractDefinitionLoader,nft=or.default.ArweaveGatewayBundledInteractionLoader,oft=or.default.ArweaveGatewayInteractionsLoader,aft=or.default.ArweaveWrapper,sft=or.default.Benchmark,uft=or.default.CacheKey,hft=or.default.CacheableInteractionsLoader,fft=or.default.CacheableStateEvaluator,cft=or.default.ConsoleLogger,lft=or.default.ConsoleLoggerFactory,dft=or.default.ContractCache,pft=or.default.ContractCallRecord,vft=or.default.ContractError,gft=or.default.ContractInteractionState,mft=or.default.ContractMetadata,yft=or.default.CustomEvent,bft=or.default.DEFAULT_LEVEL_DB_LOCATION,wft=or.default.DefaultEvaluationOptions,_ft=or.default.DefaultStateEvaluator,Mft=or.default.EvalStateResult,Sft=or.default.EvaluationOptionsEvaluator,Eft=or.default.HandlerBasedContract,Aft=or.default.HandlerExecutorFactory,Tft=or.default.InnerWritesEvaluator,xft=or.default.InteractionCall,Rft=or.default.InteractionCompleteEvent,kft=or.default.InteractionInput,Ift=or.default.InteractionOutput,Bft=or.default.JsHandlerApi,Oft=or.default.KV,Cft=or.default.KnownErrors,Pft=or.default.LevelDbCache,Nft=or.default.LexicographicalInteractionsSorter,Lft=or.default.LogLevelOrder,fhe=or.default.LoggerFactory,Dft=or.default.MemCache,$ft=or.default.NetworkCommunicationError,Uft=or.default.NonWhitelistedSourceError,qft=or.default.PstContractImpl,Fft=or.default.REGISTER_PROVIDER,jft=or.default.SMART_WEAVE_TAGS,zft=or.default.SUPPORTED_SRC_CONTENT_TYPES,Wft=or.default.SWBlock,Kft=or.default.SWTransaction,Hft=or.default.SWVrf,che=or.default.Signature,Gft=or.default.SmartWeaveError,Vft=or.default.SmartWeaveErrorType,Zft=or.default.SmartWeaveGlobal,Jft=or.default.SortKeyCacheResult,Xft=or.default.SourceType,Yft=or.default.SrcCache,lhe=or.default.Tag,Qft=or.default.TagsParser,ect=or.default.Transaction,tct=or.default.WARP_GW_URL,rct=or.default.WARP_TAGS,ict=or.default.Warp,nct=or.default.WarpBuilder,dhe=or.default.WarpFactory,oct=or.default.WarpFetchWrapper,act=or.default.WarpGatewayContractDefinitionLoader,sct=or.default.WarpGatewayInteractionsLoader,uct=or.default.WasmHandlerApi,hct=or.default.WasmSrc,fct=or.default.arrayToHex,cct=or.default.asc,lct=or.default.ascS,dct=or.default.bufToBn,pct=or.default.bundledTxsFilter,vct=or.default.checkJsSrc,gct=or.default.createDummyTx,mct=or.default.createInteractionTagsList,yct=or.default.createInteractionTx,bct=or.default.deepCopy,wct=or.default.defaultArweaveMs,phe=or.default.defaultCacheOptions,_ct=or.default.defaultWarpGwOptions,Mct=or.default.desc,Sct=or.default.descS,Ect=or.default.emptyTransfer,Act=or.default.genesisSortKey,Tct=or.default.getJsonResponse,xct=or.default.indent,Rct=or.default.isBrowser,kct=or.default.isTxIdValid,Ict=or.default.knownWarpPlugins,Bct=or.default.knownWarpPluginsPartial,Oct=or.default.lastPossibleSortKey,Cct=or.default.lvlToOrder,Pct=or.default.mapReplacer,Nct=or.default.mapReviver,Lct=or.default.matchMutClosureDtor,Dct=or.default.normalizeContractSource,$ct=or.default.rustWasmImports,Uct=or.default.safeGet,qct=or.default.safeParseInt,Fct=or.default.sleep,jct=or.default.sortingFirst,zct=or.default.sortingLast,Wct=or.default.stripTrailingSlash,Kct=or.default.timeout;Se();Ae();Ee();Ok();var MPe="+",SPe="/",EPe="-",APe="_",TPe="=";function xPe(t){return t.replaceAll(MPe,EPe).replaceAll(SPe,APe).replaceAll(TPe,"")}function sy(t){let e=t.toString("base64");return xPe(e)}function vhe(t){return sy(Bk("sha256").update(t).digest())}Se();Ae();Ee();Se();Ae();Ee();var ghe=Zl(nI(),1),mhe=ghe.default.init({host:"arweave.net",port:443,protocol:"https"});var yhe=dhe.forMainnet({...phe,inMemory:!0},!0,mhe);fhe.INST.logLevel("error");var Ea=class{contract;contractTxId;cacheUrl;logger;warp;constructor({contractTxId:e,cacheUrl:r="https://api.arns.app",warp:s=yhe,logger:o=new Sa({level:"info"})}){this.contractTxId=e,this.contract=s.contract(e),this.cacheUrl=r,this.warp=s,this.logger=o}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async createWarpSigner(e){return e.publicKey===void 0&&"setPublicKey"in e&&await e.setPublicKey(),new che(this.warp,{signer:async s=>{s.setOwner(sy(e.publicKey));let o=await s.getSignatureData(),l=await e.sign(o),c=pt.from(l),d=vhe(c);s.setSignature({id:d,owner:sy(e.publicKey),signature:sy(c)})},type:"arweave"})}async getState({evaluationOptions:e={}}){await this.ensureContractInit();let r=e?.evalTo,s;r&&"sortKey"in r?s=r.sortKey:r&&"blockHeight"in r&&(s=r.blockHeight);let o=await this.contract.readState(s);if(!o.cachedValue.state)throw new w0(502,"Failed to evaluate contract state");return o.cachedValue.state}async ensureContractInit({signer:e}={}){this.logger.debug("Checking contract initialized",{contractTxId:this.contractTxId}),this.logger.debug("Fetching contract manifest",{contractTxId:this.contractTxId});let{evaluationOptions:r={}}=await y$({arweave:this.warp.arweave,contractTxId:this.contractTxId});this.contract.setEvaluationOptions(r),e&&this.contract.connect(await this.createWarpSigner(e)),this.cacheUrl!==void 0&&(this.logger.debug("Syncing contract state",{contractTxId:this.contractTxId,remoteCacheUrl:this.cacheUrl}),await this.contract.syncState(`${this.cacheUrl}/v1/contract/${this.contractTxId}`,{validity:!0}))}async readInteraction({functionName:e,inputs:r}){await this.ensureContractInit(),this.logger.debug(`Read interaction: ${e}`,{contractTxId:this.contractTxId,inputs:r});let s=await this.contract.viewState({function:e,...r});if(s.result===void 0)throw new w0(502,"Failed to evaluate contract read interaction: "+JSON.stringify({error:s.errorMessage,functionName:e,inputs:r},null,2));return this.logger.debug("Successfully evaluated contract read interaction",{contractTxId:this.contractTxId,result:s.result}),s.result}async writeInteraction({functionName:e,inputs:r,signer:s},o){try{this.logger.debug(`Write interaction: ${e}`,{contractTxId:this.contractTxId}),await this.ensureContractInit({signer:s});let l=await this.contract.dryWrite({function:e,...r});if(l.type!=="ok")throw new Error(`Failed to dry write contract interaction ${e}: ${l.errorMessage}`);let c=await this.contract.writeInteraction({function:e,...r},{disableBundling:!0,tags:o?.tags?.map(d=>new lhe(d.name,d.value))});if(!c?.interactionTx)throw new Error(`Failed to write contract interaction: ${e}`);return this.logger.debug("Successfully wrote contract interaction",{contractTxId:this.contractTxId,interactionTxId:c.originalTxId}),c.interactionTx}catch(l){throw this.logger.error(`Failed to write contract interaction: ${l.message}`,{contractTxId:this.contractTxId}),new Fb(l)}}};var export_ArconnectSigner=bhe.ArconnectSigner;var export_ArweaveSigner=bhe.ArweaveSigner;export{IW as ANT,Wb as ANTReadable,KM as ANTWritable,kc as ANT_CONTRACT_FUNCTIONS,pd as AOProcess,aNe as ARNS_DEVNET_REGISTRY_TX,f6 as ARNS_TESTNET_REGISTRY_TX,g$ as ARWEAVE_TX_REGEX,vo as AR_IO_CONTRACT_FUNCTIONS,zM as AbortError,kW as ArIO,zb as ArIOReadable,WM as ArIOWritable,export_ArconnectSigner as ArconnectSigner,export_ArweaveSigner as ArweaveSigner,TW as BadRequest,Cu as BaseError,v$ as DENOMINATIONS,Sa as DefaultLogger,oNe as FQDN_REGEX,w0 as FailedRequestError,Zne as IO,I4 as IOReadable,Dv as IOToken,QI as IOWriteable,Ka as InvalidContractConfigurationError,RW as InvalidProcessConfigurationError,xW as InvalidSignerError,Z7 as MIO_PER_IO,Ub as NotFound,_0 as RemoteContract,Zfe as SORT_KEY_REGEX,qb as UnknownError,Ea as WarpContract,Fb as WriteInteractionError,XPe as ioContractInteractions,Gfe as ioContractReadInteractions,Vfe as ioContractWriteInteractions,V7 as ioDevnetProcessId,Y7 as isProcessConfiguration,Q7 as isProcessIdConfiguration,X7 as mIOToken};
|
|
286
|
+
}`,o=Xt.object({data:Xt.object({transactions:Xt.object({edges:Xt.array(Xt.object({node:Xt.record(Xt.any())}))})})});return l=>di(l).chain(sn(c=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:s,variables:{transactionIds:[c]}})}).then(async d=>{if(d.ok)return d.json();throw r('Error Encountered when querying gateway for transaction "%s"',c),new Error(`${d.status}: ${await d.text()}`)}).then(o.parse).then(CAe(["data","transactions","edges","0","node"])))).toPromise()}var qTe=II(tMe(),1),Cne=(t="@permaweb/aoconnect")=>{let e=(0,qTe.default)(t);return e.child=r=>Cne(`${e.namespace}:${r}`),e.tap=(r,...s)=>qAe((...o)=>e(r,...s,...o)),e},Pne=({url:t,path:e})=>e?e.startsWith("/")?Pne({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function FTe(t){return Lp(x4([]),Np((e,r)=>Lp(LAe([],r.name),FI(r.value),uu(r.name,ec,e))(e),{}),A4(e=>e.length>1?e:e[0]))(t)}function au(t,e){return r=>ane(WEe([kie(t,"name"),zI(qI(e),kie(e,"value"),DI)]),r)}function Oie(t){return gne([[Km(String),kp(t)],[Km(Array),SAe(t)],[DI,QSe]])}function ld(t){let e;return Km(su,t)?(e=new Error(jTe(t)),e.stack+=t.stack):Km(Error,t)?e=t:wAe("message",t)?e=new Error(t.message):Km(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function jTe(t){return Lp(e=>function r(s,o,l){return Np((c,d)=>Lp(gne([[kp(mr.invalid_arguments),()=>r(d.argumentsError,422,"Invalid Arguments")],[kp(mr.invalid_return_type),()=>r(d.returnTypeError,500,"Invalid Return")],[kp(mr.invalid_union),()=>aAe(b=>r(b,400,"Invalid Union"),d.unionErrors)],[DI,()=>[{...d,status:o,contextCode:l}]]]),jI(c))(d.code),[],s.issues)}(e,400,""),e=>Np((r,s)=>{let{message:o,path:l,contextCode:c}=s,d=l[1]||l[0],b=c?`${c} `:"";return r.push(`${b}'${d}': ${o}.`),r},[],e),kAe(" | "))(t)}var zTe=Xt.object({id:Xt.string().min(1,{message:"message is required to be a message id"}),processId:Xt.string().min(1,{message:"process is required to be a process id"})});function WTe(){return t=>di(t).map(zTe.parse).map(()=>t)}var c2=Xt.object({name:Xt.string(),value:Xt.string()}),KTe=Xt.function().args(Xt.object({Id:Xt.string(),Target:Xt.string(),Owner:Xt.string(),Anchor:Xt.string().optional(),Data:Xt.any().default("1234"),Tags:Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}))})).returns(Xt.promise(Xt.any())),HTe=Xt.function().args(Xt.object({id:Xt.string().min(1,{message:"message id is required"}),processId:Xt.string().min(1,{message:"process id is required"})})).returns(Xt.promise(Xt.any())),GTe=Xt.function().args(Xt.object({process:Xt.string().min(1,{message:"process id is required"}),from:Xt.string().optional(),to:Xt.string().optional(),sort:Xt.enum(["ASC","DESC"]).default("ASC"),limit:Xt.number().optional()})).returns(Xt.promise(Xt.object({edges:Xt.array(Xt.object({cursor:Xt.string(),node:Xt.object({Output:Xt.any().optional(),Messages:Xt.array(Xt.any()).optional(),Spawns:Xt.array(Xt.any()).optional(),Error:Xt.any().optional()})}))}))),Nne=Xt.function().args(Xt.object({processId:Xt.string(),data:Xt.any(),tags:Xt.array(c2),anchor:Xt.string().optional(),signer:Xt.any()})).returns(Xt.promise(Xt.object({messageId:Xt.string()}).passthrough())),VTe=Xt.function().args(Xt.object({data:Xt.any(),tags:Xt.array(c2),signer:Xt.any()})).returns(Xt.promise(Xt.object({processId:Xt.string()}).passthrough())),ZTe=Xt.function().args(Xt.object({process:Xt.string(),message:Xt.string(),baseLayer:Xt.boolean().optional(),exclude:Xt.array(Xt.string()).optional()})).returns(Xt.promise(Xt.object({assignmentId:Xt.string()}).passthrough())),Lne=Nne,NYe=Xt.function().args(Xt.object({suUrl:Xt.string().url(),processId:Xt.string()})).returns(Xt.promise(Xt.object({tags:Xt.array(c2)}).passthrough())),LYe=Xt.function().args(Xt.string()).returns(Xt.promise(Xt.object({url:Xt.string()}))),JTe=Xt.function().args(Xt.string()).returns(Xt.promise(Xt.boolean())),XTe=Xt.function().args(Xt.string()).returns(Xt.promise(Xt.object({tags:Xt.array(c2)}).passthrough())),R4=Xt.function().args(Xt.object({data:Xt.any(),tags:Xt.array(c2),target:Xt.string().optional(),anchor:Xt.string().optional()})).returns(Xt.promise(Xt.object({id:Xt.string(),raw:Xt.any()})));function YTe({loadResult:t}){return t=sn(HTe.implement(t)),e=>di({id:e.id,processId:e.processId}).chain(t)}function QTe(t){let e=WTe(t),r=YTe(t);return({message:s,process:o})=>di({id:s,processId:o}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',s)).map(l=>l).bimap(ld,cd).toPromise()}var exe=Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}));function txe(){return t=>di(t.tags).map(x4([])).map(au("Data-Protocol","ao")).map(au("Variant")).map(au("Type")).map(au("SDK")).map(jI(ec,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(exe.parse).map(uu("tags",ec,t))}function rxe({logger:t}){return e=>di(e).chain(zI(qI(e.data),()=>ad(e),()=>ad(Math.random().toString().slice(-4)).map(uu("data",ec,e)).map(r=>Lp(fd("tags"),au("Content-Type"),FI({name:"Content-Type",value:"text/plain"}),uu("tags",ec,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function ixe(t){let e=txe(t),r=rxe(t),s=Nne.implement(t.deployMessage);return o=>di(o).chain(e).chain(r).chain(sn(({id:l,data:c,tags:d,anchor:b,signer:g})=>s({processId:l,data:c,tags:d,anchor:b,signer:R4.implement(g)}))).map(l=>uu("messageId",l.messageId,o))}function nxe(t){let e=ixe(t);return({process:r,data:s,tags:o,anchor:l,signer:c})=>di({id:r,data:s,tags:o,anchor:l,signer:c}).chain(e).map(d=>d.messageId).bimap(ld,cd).toPromise()}var qm=(t,e,r)=>s=>e(s[t])?ad(s):Sl(`Tag '${t}': ${r}`);function oxe({loadTransactionMeta:t,logger:e}){return t=sn(XTe.implement(t)),r=>di(r).chain(t).map(fd("tags")).map(FTe).chain(qm("Data-Protocol",Oie("ao"),"value 'ao' was not found on module")).chain(qm("Type",Oie("Module"),"value 'Module' was not found on module")).chain(qm("Module-Format",fI,"was not found on module")).chain(qm("Input-Encoding",fI,"was not found on module")).chain(qm("Output-Encoding",fI,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function axe({logger:t,validateScheduler:e}){return e=sn(JTe.implement(e)),r=>di(r).chain(s=>e(s).chain(o=>o?ad(s):Sl(`Valid Scheduler-Location owned by ${s} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function sxe({logger:t}){return e=>di(e).map(t.tap("Checking for signer")).chain(r=>r?ad(r):Sl("signer not found"))}function uxe(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=oxe(t),s=axe(t),o=sxe(t);return l=>di(l).chain(c=>r(c.module).map(()=>c)).chain(c=>s(c.scheduler)).map(()=>l).chain(c=>o(c.signer).map(()=>c)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var hxe=Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}));function fxe(){return t=>di(t).map(fd("tags")).map(x4([])).map(au("Data-Protocol","ao")).map(au("Variant")).map(au("Type")).map(au("Module")).map(au("Scheduler")).map(au("SDK")).map(jI(ec,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(hxe.parse).map(uu("tags",ec,t))}function cxe({logger:t}){return e=>di(e).chain(zI(qI(e.data),()=>ad(e),()=>ad(Math.random().toString().slice(-4)).map(uu("data",ec,e)).map(r=>Lp(fd("tags"),au("Content-Type"),FI({name:"Content-Type",value:"text/plain"}),uu("tags",ec,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function lxe(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=fxe(t),s=cxe(t),o=VTe.implement(t.deployProcess);return l=>di(l).chain(r).chain(s).chain(sn(({data:c,tags:d,signer:b})=>o({data:c,tags:d,signer:R4.implement(b)}))).map(c=>uu("processId",c.processId,l))}function dxe(t){let e=uxe(t),r=lxe(t);return({module:s,scheduler:o,signer:l,tags:c,data:d})=>di({module:s,scheduler:o,signer:l,tags:c,data:d}).chain(e).chain(r).map(b=>b.processId).bimap(ld,cd).toPromise()}function pxe(t){let e=Lne.implement(t.deployMonitor);return r=>di(r).chain(sn(({id:s,signer:o})=>e({processId:s,signer:R4.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(s=>uu("monitorId",s.messageId,r))}function vxe(t){let e=pxe(t);return({process:r,signer:s})=>di({id:r,signer:s}).chain(e).map(o=>o.monitorId).bimap(ld,cd).toPromise()}function gxe(t){let e=Lne.implement(t.deployUnmonitor);return r=>di(r).chain(sn(({id:s,signer:o})=>e({processId:s,signer:R4.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(s=>uu("monitorId",s.messageId,r))}function mxe(t){let e=gxe(t);return({process:r,signer:s})=>di({id:r,signer:s}).chain(e).map(o=>o.monitorId).bimap(ld,cd).toPromise()}var yxe=Xt.object({process:Xt.string().min(1,{message:"process identifier is required"}),from:Xt.string().optional(),to:Xt.string().optional(),sort:Xt.enum(["ASC","DESC"]).default("ASC"),limit:Xt.number().optional()});function bxe(){return t=>di(t).map(yxe.parse).map(()=>t)}function wxe({queryResults:t}){return t=sn(GTe.implement(t)),e=>di({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function _xe(t){let e=bxe(t),r=wxe(t);return({process:s,from:o,to:l,sort:c,limit:d})=>di({process:s,from:o,to:l,sort:c,limit:d}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',s)).map(b=>b).bimap(ld,cd).toPromise()}var Mxe=Xt.object({Id:Xt.string(),Target:Xt.string(),Owner:Xt.string(),Anchor:Xt.string().optional(),Data:Xt.any().default("1234"),Tags:Xt.array(Xt.object({name:Xt.string(),value:Xt.string()}))});function Sxe(){return t=>di(t).map(Mxe.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function Exe({dryrunFetch:t}){return sn(KTe.implement(t))}function Axe(t){let e=Sxe(t),r=Exe(t);return s=>di(s).map(Txe).chain(e).chain(r).toPromise()}function Txe({process:t,data:e,tags:r,anchor:s,...o}){return{Id:"1234",Owner:"1234",...o,Target:t,Data:e||"1234",Tags:r||[],Anchor:s||"0"}}function xxe(t){let e=ZTe.implement(t.deployAssign);return r=>di(r).chain(sn(({process:s,message:o,baseLayer:l,exclude:c})=>e({process:s,message:o,baseLayer:l,exclude:c}))).map(s=>uu("assignmentId",s.assignmentId,r))}function Rxe(t){let e=xxe(t);return({process:r,message:s,baseLayer:o,exclude:l})=>di({process:r,message:s,baseLayer:o,exclude:l}).chain(e).map(c=>c.assignmentId).bimap(ld,cd).toPromise()}var kxe="https://arweave.net",Ixe="https://mu.ao-testnet.xyz",Bxe="https://cu.ao-testnet.xyz";function KI({GRAPHQL_URL:t,GATEWAY_URL:e=kxe,MU_URL:r=Ixe,CU_URL:s=Bxe}={}){let o=Cne();t||(t=Pne({url:e,path:"/graphql"}));let{validate:l}=rne({cacheSize:100,GRAPHQL_URL:t}),c=XSe({MAX_SIZE:25}),d=o.child("result"),b=QTe({loadResult:VSe({fetch,CU_URL:s,logger:d}),logger:d}),g=o.child("message"),y=nxe({loadProcessMeta:sI({fetch,cache:c,logger:g}),deployMessage:jSe({fetch,MU_URL:r,logger:g}),logger:g}),m=o.child("spawn"),_=dxe({loadTransactionMeta:UTe({fetch,GRAPHQL_URL:t,logger:m}),validateScheduler:l,deployProcess:zSe({fetch,MU_URL:r,logger:m}),logger:m}),T=o.child("monitor"),A=vxe({loadProcessMeta:sI({fetch,cache:c,logger:T}),deployMonitor:WSe({fetch,MU_URL:r,logger:T}),logger:T}),R=o.child("unmonitor"),B=mxe({loadProcessMeta:sI({fetch,cache:c,logger:R}),deployUnmonitor:KSe({fetch,MU_URL:r,logger:R}),logger:T}),C=o.child("results"),P=_xe({queryResults:ZSe({fetch,CU_URL:s,logger:C}),logger:C}),N=o.child("dryrun"),q=Axe({dryrunFetch:GSe({fetch,CU_URL:s,logger:N}),logger:N}),z=o.child("assign"),J=Rxe({deployAssign:HSe({fetch,MU_URL:r,logger:z}),logger:g});return{result:b,results:P,message:y,spawn:_,monitor:A,unmonitor:B,dryrun:q,assign:J}}var Dne={};Nie(Dne,{createDataItemSigner:()=>rRe});var $ne=II(nMe(),1),Une={};Nie(Une,{AVSCTap:()=>l2,ArweaveSigner:()=>VI,DataItem:()=>s2,MAX_TAG_BYTES:()=>k4,MIN_BINARY_SIZE:()=>XI,SIG_CONFIG:()=>qp,SignatureConfig:()=>ou,Signer:()=>zne,createData:()=>Gne,default:()=>Qxe,deserializeTags:()=>w4,indexToType:()=>ZI,serializeTags:()=>JI,tagsExceedLimit:()=>Hne,warparbundles:()=>eRe});var Oxe=Object.create,HI=Object.defineProperty,Cxe=Object.getOwnPropertyDescriptor,Pxe=Object.getOwnPropertyNames,Nxe=Object.getPrototypeOf,Lxe=Object.prototype.hasOwnProperty,rc=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dxe=(t,e)=>{for(var r in e)HI(t,r,{get:e[r],enumerable:!0})},$xe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pxe(e))!Lxe.call(t,o)&&o!==r&&HI(t,o,{get:()=>e[o],enumerable:!(s=Cxe(e,o))||s.enumerable});return t},dd=(t,e,r)=>(r=t!=null?Oxe(Nxe(t)):{},$xe(e||!t||!t.__esModule?HI(r,"default",{value:t,enumerable:!0}):r,t)),Uxe=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var s=4,o=r.length,l=o%s;if(!l)return r;var c=o,d=s-l,b=o+d,g=pt.alloc(b);for(g.write(r);d--;)g.write("=",c++);return g.toString()}t.default=e}),qxe=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Uxe();function r(b,g){return g===void 0&&(g="utf8"),pt.isBuffer(b)?l(b.toString("base64")):l(pt.from(b,g).toString("base64"))}function s(b,g){return g===void 0&&(g="utf8"),pt.from(o(b),"base64").toString(g)}function o(b){return b=b.toString(),e.default(b).replace(/\-/g,"+").replace(/_/g,"/")}function l(b){return b.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(b){return pt.from(o(b),"base64")}var d=r;d.encode=r,d.decode=s,d.toBase64=o,d.fromBase64=l,d.toBuffer=c,t.default=d}),GI=rc((t,e)=>{e.exports=qxe().default,e.exports.default=e.exports}),qne=rc(t=>{"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=T;var e=[],r=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)e[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function d(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function b(A){var R=d(A),B=R[0],C=R[1];return(B+C)*3/4-C}function g(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=d(A),C=B[0],P=B[1],N=new s(g(A,C,P)),q=0,z=P>0?C-4:C,J;for(J=0;J<z;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function m(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function _(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(m(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,z=B-C;q<z;q+=N)P.push(_(A,q,q+N>z?z:q+N));return C===1?(R=A[B-1],P.push(e[R>>2]+e[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(e[R>>10]+e[R>>4&63]+e[R<<2&63]+"=")),P.join("")}}),Fne=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=qne();function r(_){let T=0;for(let B=0;B<_.length;B++)T+=_[B].byteLength;let A=new Uint8Array(T),R=0;A.set(new Uint8Array(_[0]),R),R+=_[0].byteLength;for(let B=1;B<_.length;B++)A.set(new Uint8Array(_[B]),R),R+=_[B].byteLength;return A}t.concatBuffers=r;function s(_){let T=d(_);return o(T)}t.b64UrlToString=s;function o(_){return new TextDecoder("utf-8",{fatal:!0}).decode(_)}t.bufferToString=o;function l(_){return new TextEncoder().encode(_)}t.stringToBuffer=l;function c(_){return g(l(_))}t.stringToB64Url=c;function d(_){return new Uint8Array(e.toByteArray(m(_)))}t.b64UrlToBuffer=d;function b(_){return e.fromByteArray(new Uint8Array(_))}t.bufferTob64=b;function g(_){return y(b(_))}t.bufferTob64Url=g;function y(_){return _.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=y;function m(_){_=_.replace(/\-/g,"+").replace(/\_/g,"/");let T;return _.length%4==0?T=0:T=4-_.length%4,_.concat("=".repeat(T))}t.b64UrlDecode=m}),Fxe=rc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Fne(),r=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let s=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),o=await this.driver.exportKey("jwk",s.privateKey);return{kty:o.kty,e:o.e,n:o.n,d:o.d,p:o.p,q:o.q,dp:o.dp,dq:o.dq,qi:o.qi}}async sign(s,o,{saltLength:l}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(s),o);return new Uint8Array(c)}async hash(s,o="SHA-256"){let l=await this.driver.digest(o,s);return new Uint8Array(l)}async verify(s,o,l){let c={kty:"RSA",e:"AQAB",n:s},d=await this.jwkToPublicCryptoKey(c),b=await this.driver.digest("SHA-256",o),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},d,l,o),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},d,l,o),m=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((d.algorithm.modulusLength-1)/8)-b.byteLength-2},d,l,o);return g||y||m}async jwkToCryptoKey(s){return this.driver.importKey("jwk",s,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(s){return this.driver.importKey("jwk",s,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let s=crypto?.subtle;return s===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(o=>typeof s[o]=="function")}async encrypt(s,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?e.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:l?e.stringToBuffer(l):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let g=await this.driver.encrypt({name:"AES-CBC",iv:b},d,s);return e.concatBuffers([b,g])}async decrypt(s,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?e.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:l?e.stringToBuffer(l):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=s.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:b},d,s.slice(16));return e.concatBuffers([g])}};t.default=r}),jxe=rc(t=>{t.read=function(e,r,s,o,l){var c,d,b=l*8-o-1,g=(1<<b)-1,y=g>>1,m=-7,_=s?l-1:0,T=s?-1:1,A=e[r+_];for(_+=T,c=A&(1<<-m)-1,A>>=-m,m+=b;m>0;c=c*256+e[r+_],_+=T,m-=8);for(d=c&(1<<-m)-1,c>>=-m,m+=o;m>0;d=d*256+e[r+_],_+=T,m-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,o),c=c-y}return(A?-1:1)*d*Math.pow(2,c-o)},t.write=function(e,r,s,o,l,c){var d,b,g,y=c*8-l-1,m=(1<<y)-1,_=m>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=m):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+_>=1?r+=T/g:r+=T*Math.pow(2,1-_),r*g>=2&&(d++,g/=2),d+_>=m?(b=0,d=m):d+_>=1?(b=(r*g-1)*Math.pow(2,l),d=d+_):(b=r*Math.pow(2,_-1)*Math.pow(2,l),d=0));l>=8;e[s+A]=b&255,A+=R,b/=256,l-=8);for(d=d<<l|b,y+=l;y>0;e[s+A]=d&255,A+=R,d/=256,y-=8);e[s+A-R]|=B*128}}),xI=rc(t=>{"use strict";var e=qne(),r=jxe(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=P,t.INSPECT_MAX_BYTES=50;var o=2147483647;t.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,d.prototype),O}function d(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(I)}return b(I,O,L)}d.poolSize=8192;function b(I,O,L){if(typeof I=="string")return _(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(ge(I,ArrayBuffer)||I&&ge(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(I,SharedArrayBuffer)||I&&ge(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return d.from(V,O,L);let se=B(I);if(se)return se;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return d.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}d.from=function(I,O,L){return b(I,O,L)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return g(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}d.alloc=function(I,O,L){return y(I,O,L)};function m(I){return g(I),c(I<0?0:C(I)|0)}d.allocUnsafe=function(I){return m(I)},d.allocUnsafeSlow=function(I){return m(I)};function _(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!d.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),se=V.write(I,O);return se!==L&&(V=V.slice(0,se)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(ge(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,d.prototype),V}function B(I){if(d.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||we(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),d.alloc(+I)}d.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==d.prototype},d.compare=function(I,O){if(ge(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),ge(O,Uint8Array)&&(O=d.from(O,O.offset,O.byteLength)),!d.isBuffer(I)||!d.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let L=I.length,V=O.length;for(let se=0,he=Math.min(L,V);se<he;++se)if(I[se]!==O[se]){L=I[se],V=O[se];break}return L<V?-1:V<L?1:0},d.isEncoding=function(I){switch(String(I).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return d.alloc(0);let L;if(O===void 0)for(O=0,L=0;L<I.length;++L)O+=I[L].length;let V=d.allocUnsafe(O),se=0;for(L=0;L<I.length;++L){let he=I[L];if(ge(he,Uint8Array))se+he.length>V.length?(d.isBuffer(he)||(he=d.from(he)),he.copy(V,se)):Uint8Array.prototype.set.call(V,he,se);else if(d.isBuffer(he))he.copy(V,se);else throw new TypeError('"list" argument must be an Array of Buffers');se+=he.length}return V};function N(I,O){if(d.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||ge(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let se=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return fe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return be(I).length;default:if(se)return V?-1:fe(I).length;O=(""+O).toLowerCase(),se=!0}}d.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return i(this,O,L);case"utf8":case"utf-8":return p(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return h(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}d.prototype._isBuffer=!0;function z(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}d.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)z(this,O,O+1);return this},d.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)z(this,O,O+3),z(this,O+1,O+2);return this},d.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)z(this,O,O+7),z(this,O+1,O+6),z(this,O+2,O+5),z(this,O+3,O+4);return this},d.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?p(this,0,I):q.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(I){if(!d.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:d.compare(this,I)===0},d.prototype.inspect=function(){let I="",O=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},s&&(d.prototype[s]=d.prototype.inspect),d.prototype.compare=function(I,O,L,V,se){if(ge(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),!d.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),L===void 0&&(L=I?I.length:0),V===void 0&&(V=0),se===void 0&&(se=this.length),O<0||L>I.length||V<0||se>this.length)throw new RangeError("out of range index");if(V>=se&&O>=L)return 0;if(V>=se)return-1;if(O>=L)return 1;if(O>>>=0,L>>>=0,V>>>=0,se>>>=0,this===I)return 0;let he=se-V,ue=L-O,xe=Math.min(he,ue),_e=this.slice(V,se),me=I.slice(O,L);for(let Qe=0;Qe<xe;++Qe)if(_e[Qe]!==me[Qe]){he=_e[Qe],ue=me[Qe];break}return he<ue?-1:ue<he?1:0};function J(I,O,L,V,se){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,we(L)&&(L=se?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(se)return-1;L=I.length-1}else if(L<0)if(se)L=0;else return-1;if(typeof O=="string"&&(O=d.from(O,V)),d.isBuffer(O))return O.length===0?-1:F(I,O,L,V,se);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?se?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,se);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,se){let he=1,ue=I.length,xe=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;he=2,ue/=2,xe/=2,L/=2}function _e(Qe,Ie){return he===1?Qe[Ie]:Qe.readUInt16BE(Ie*he)}let me;if(se){let Qe=-1;for(me=L;me<ue;me++)if(_e(I,me)===_e(O,Qe===-1?0:me-Qe)){if(Qe===-1&&(Qe=me),me-Qe+1===xe)return Qe*he}else Qe!==-1&&(me-=me-Qe),Qe=-1}else for(L+xe>ue&&(L=ue-xe),me=L;me>=0;me--){let Qe=!0;for(let Ie=0;Ie<xe;Ie++)if(_e(I,me+Ie)!==_e(O,Ie)){Qe=!1;break}if(Qe)return me}return-1}d.prototype.includes=function(I,O,L){return this.indexOf(I,O,L)!==-1},d.prototype.indexOf=function(I,O,L){return J(this,I,O,L,!0)},d.prototype.lastIndexOf=function(I,O,L){return J(this,I,O,L,!1)};function H(I,O,L,V){L=Number(L)||0;let se=I.length-L;V?(V=Number(V),V>se&&(V=se)):V=se;let he=O.length;V>he/2&&(V=he/2);let ue;for(ue=0;ue<V;++ue){let xe=parseInt(O.substr(ue*2,2),16);if(we(xe))return ue;I[L+ue]=xe}return ue}function Y(I,O,L,V){return le(fe(O,I.length-L),I,L,V)}function E(I,O,L,V){return le(pe(O),I,L,V)}function n(I,O,L,V){return le(be(O),I,L,V)}function u(I,O,L,V){return le(Te(O,I.length-L),I,L,V)}d.prototype.write=function(I,O,L,V){if(O===void 0)V="utf8",L=this.length,O=0;else if(L===void 0&&typeof O=="string")V=O,L=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(L)?(L=L>>>0,V===void 0&&(V="utf8")):(V=L,L=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let se=this.length-O;if((L===void 0||L>se)&&(L=se),I.length>0&&(L<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let he=!1;for(;;)switch(V){case"hex":return H(this,I,O,L);case"utf8":case"utf-8":return Y(this,I,O,L);case"ascii":case"latin1":case"binary":return E(this,I,O,L);case"base64":return n(this,I,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,I,O,L);default:if(he)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),he=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function h(I,O,L){return O===0&&L===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(O,L))}function p(I,O,L){L=Math.min(I.length,L);let V=[],se=O;for(;se<L;){let he=I[se],ue=null,xe=he>239?4:he>223?3:he>191?2:1;if(se+xe<=L){let _e,me,Qe,Ie;switch(xe){case 1:he<128&&(ue=he);break;case 2:_e=I[se+1],(_e&192)===128&&(Ie=(he&31)<<6|_e&63,Ie>127&&(ue=Ie));break;case 3:_e=I[se+1],me=I[se+2],(_e&192)===128&&(me&192)===128&&(Ie=(he&15)<<12|(_e&63)<<6|me&63,Ie>2047&&(Ie<55296||Ie>57343)&&(ue=Ie));break;case 4:_e=I[se+1],me=I[se+2],Qe=I[se+3],(_e&192)===128&&(me&192)===128&&(Qe&192)===128&&(Ie=(he&15)<<18|(_e&63)<<12|(me&63)<<6|Qe&63,Ie>65535&&Ie<1114112&&(ue=Ie))}}ue===null?(ue=65533,xe=1):ue>65535&&(ue-=65536,V.push(ue>>>10&1023|55296),ue=56320|ue&1023),V.push(ue),se+=xe}return S(V)}var v=4096;function S(I){let O=I.length;if(O<=v)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=v));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let se=O;se<L;++se)V+=String.fromCharCode(I[se]);return V}function i(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let se="";for(let he=O;he<L;++he)se+=Me[I[he]];return se}function f(I,O,L){let V=I.slice(O,L),se="";for(let he=0;he<V.length-1;he+=2)se+=String.fromCharCode(V[he]+V[he+1]*256);return se}d.prototype.slice=function(I,O){let L=this.length;I=~~I,O=O===void 0?L:~~O,I<0?(I+=L,I<0&&(I=0)):I>L&&(I=L),O<0?(O+=L,O<0&&(O=0)):O>L&&(O=L),O<I&&(O=I);let V=this.subarray(I,O);return Object.setPrototypeOf(V,d.prototype),V};function w(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=this[I],se=1,he=0;for(;++he<O&&(se*=256);)V+=this[I+he]*se;return V},d.prototype.readUintBE=d.prototype.readUIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=this[I+--O],se=1;for(;O>0&&(se*=256);)V+=this[I+--O]*se;return V},d.prototype.readUint8=d.prototype.readUInt8=function(I,O){return I=I>>>0,O||w(I,1,this.length),this[I]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||w(I,2,this.length),this[I]|this[I+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||w(I,2,this.length),this[I]<<8|this[I+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||w(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||w(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},d.prototype.readBigUInt64LE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,se=this[++I]+this[++I]*2**8+this[++I]*2**16+L*2**24;return BigInt(V)+(BigInt(se)<<BigInt(32))}),d.prototype.readBigUInt64BE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],se=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L;return(BigInt(V)<<BigInt(32))+BigInt(se)}),d.prototype.readIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=this[I],se=1,he=0;for(;++he<O&&(se*=256);)V+=this[I+he]*se;return se*=128,V>=se&&(V-=Math.pow(2,8*O)),V},d.prototype.readIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||w(I,O,this.length);let V=O,se=1,he=this[I+--V];for(;V>0&&(se*=256);)he+=this[I+--V]*se;return se*=128,he>=se&&(he-=Math.pow(2,8*O)),he},d.prototype.readInt8=function(I,O){return I=I>>>0,O||w(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},d.prototype.readInt16LE=function(I,O){I=I>>>0,O||w(I,2,this.length);let L=this[I]|this[I+1]<<8;return L&32768?L|4294901760:L},d.prototype.readInt16BE=function(I,O){I=I>>>0,O||w(I,2,this.length);let L=this[I+1]|this[I]<<8;return L&32768?L|4294901760:L},d.prototype.readInt32LE=function(I,O){return I=I>>>0,O||w(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},d.prototype.readInt32BE=function(I,O){return I=I>>>0,O||w(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},d.prototype.readBigInt64LE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(L<<24);return(BigInt(V)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),d.prototype.readBigInt64BE=nt(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&re(I,this.length-8);let V=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(V)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L)}),d.prototype.readFloatLE=function(I,O){return I=I>>>0,O||w(I,4,this.length),r.read(this,I,!0,23,4)},d.prototype.readFloatBE=function(I,O){return I=I>>>0,O||w(I,4,this.length),r.read(this,I,!1,23,4)},d.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||w(I,8,this.length),r.read(this,I,!0,52,8)},d.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||w(I,8,this.length),r.read(this,I,!1,52,8)};function M(I,O,L,V,se,he){if(!d.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>se||O<he)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ue=Math.pow(2,8*L)-1;M(this,I,O,L,ue,0)}let se=1,he=0;for(this[O]=I&255;++he<L&&(se*=256);)this[O+he]=I/se&255;return O+L},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ue=Math.pow(2,8*L)-1;M(this,I,O,L,ue,0)}let se=L-1,he=1;for(this[O+se]=I&255;--se>=0&&(he*=256);)this[O+se]=I/he&255;return O+L},d.prototype.writeUint8=d.prototype.writeUInt8=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,1,255,0),this[O]=I&255,O+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function k(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he,he=he>>8,I[L++]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,ue=ue>>8,I[L++]=ue,L}function $(I,O,L,V,se){U(O,V,se,I,L,7);let he=Number(O&BigInt(4294967295));I[L+7]=he,he=he>>8,I[L+6]=he,he=he>>8,I[L+5]=he,he=he>>8,I[L+4]=he;let ue=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ue,ue=ue>>8,I[L+2]=ue,ue=ue>>8,I[L+1]=ue,ue=ue>>8,I[L]=ue,L+8}d.prototype.writeBigUInt64LE=nt(function(I,O=0){return k(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=nt(function(I,O=0){return $(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let xe=Math.pow(2,8*L-1);M(this,I,O,L,xe-1,-xe)}let se=0,he=1,ue=0;for(this[O]=I&255;++se<L&&(he*=256);)I<0&&ue===0&&this[O+se-1]!==0&&(ue=1),this[O+se]=(I/he>>0)-ue&255;return O+L},d.prototype.writeIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let xe=Math.pow(2,8*L-1);M(this,I,O,L,xe-1,-xe)}let se=L-1,he=1,ue=0;for(this[O+se]=I&255;--se>=0&&(he*=256);)I<0&&ue===0&&this[O+se+1]!==0&&(ue=1),this[O+se]=(I/he>>0)-ue&255;return O+L},d.prototype.writeInt8=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},d.prototype.writeInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},d.prototype.writeInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},d.prototype.writeInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},d.prototype.writeInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||M(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},d.prototype.writeBigInt64LE=nt(function(I,O=0){return k(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=nt(function(I,O=0){return $(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ie(I,O,L,V,se,he){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}d.prototype.writeFloatLE=function(I,O,L){return Z(this,I,O,!0,L)},d.prototype.writeFloatBE=function(I,O,L){return Z(this,I,O,!1,L)};function te(I,O,L,V,se){return O=+O,L=L>>>0,se||ie(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}d.prototype.writeDoubleLE=function(I,O,L){return te(this,I,O,!0,L)},d.prototype.writeDoubleBE=function(I,O,L){return te(this,I,O,!1,L)},d.prototype.copy=function(I,O,L,V){if(!d.isBuffer(I))throw new TypeError("argument should be a Buffer");if(L||(L=0),!V&&V!==0&&(V=this.length),O>=I.length&&(O=I.length),O||(O=0),V>0&&V<L&&(V=L),V===L||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(L<0||L>=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),I.length-O<V-L&&(V=I.length-O+L);let se=V-L;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,L,V):Uint8Array.prototype.set.call(I,this.subarray(L,V),O),se},d.prototype.fill=function(I,O,L,V){if(typeof I=="string"){if(typeof O=="string"?(V=O,O=0,L=this.length):typeof L=="string"&&(V=L,L=this.length),V!==void 0&&typeof V!="string")throw new TypeError("encoding must be a string");if(typeof V=="string"&&!d.isEncoding(V))throw new TypeError("Unknown encoding: "+V);if(I.length===1){let he=I.charCodeAt(0);(V==="utf8"&&he<128||V==="latin1")&&(I=he)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<L)throw new RangeError("Out of range index");if(L<=O)return this;O=O>>>0,L=L===void 0?this.length:L>>>0,I||(I=0);let se;if(typeof I=="number")for(se=O;se<L;++se)this[se]=I;else{let he=d.isBuffer(I)?I:d.from(I,V),ue=he.length;if(ue===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(se=0;se<L-O;++se)this[se+O]=he[se%ue]}return this};var Q={};function W(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(V){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:V,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),W("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,se=L;return Number.isInteger(L)&&Math.abs(L)>2**32?se=ee(String(L)):typeof L=="bigint"&&(se=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(se=ee(se)),se+="n"),V+=` It must be ${O}. Received ${se}`,V},RangeError);function ee(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&re(O,I.length-(L+1))}function U(I,O,L,V,se,he){if(I>L||I<O){let ue=typeof O=="bigint"?"n":"",xe;throw he>3?O===0||O===BigInt(0)?xe=`>= 0${ue} and < 2${ue} ** ${(he+1)*8}${ue}`:xe=`>= -(2${ue} ** ${(he+1)*8-1}${ue}) and < 2 ** ${(he+1)*8-1}${ue}`:xe=`>= ${O}${ue} and <= ${L}${ue}`,new Q.ERR_OUT_OF_RANGE("value",xe,I)}X(V,se,he)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function re(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var oe=/[^+/0-9A-Za-z-_]/g;function ce(I){if(I=I.split("=")[0],I=I.trim().replace(oe,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function fe(I,O){O=O||1/0;let L,V=I.length,se=null,he=[];for(let ue=0;ue<V;++ue){if(L=I.charCodeAt(ue),L>55295&&L<57344){if(!se){if(L>56319){(O-=3)>-1&&he.push(239,191,189);continue}else if(ue+1===V){(O-=3)>-1&&he.push(239,191,189);continue}se=L;continue}if(L<56320){(O-=3)>-1&&he.push(239,191,189),se=L;continue}L=(se-55296<<10|L-56320)+65536}else se&&(O-=3)>-1&&he.push(239,191,189);if(se=null,L<128){if((O-=1)<0)break;he.push(L)}else if(L<2048){if((O-=2)<0)break;he.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;he.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;he.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return he}function pe(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function Te(I,O){let L,V,se,he=[];for(let ue=0;ue<I.length&&!((O-=2)<0);++ue)L=I.charCodeAt(ue),V=L>>8,se=L%256,he.push(se),he.push(V);return he}function be(I){return e.toByteArray(ce(I))}function le(I,O,L,V){let se;for(se=0;se<V&&!(se+L>=O.length||se>=I.length);++se)O[se+L]=I[se];return se}function ge(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function we(I){return I!==I}var Me=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let se=0;se<16;++se)O[V+se]=I[L]+I[se]}return O}();function nt(I){return typeof BigInt>"u"?ne:I}function ne(){throw new Error("BigInt not supported")}}),zxe=rc((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:xI().Buffer,Crypto:window.crypto}):e.exports={Buffer:xI().Buffer,Crypto:crypto}}),jne={};Dxe(jne,{AVSCTap:()=>l2,ArweaveSigner:()=>VI,DataItem:()=>s2,MAX_TAG_BYTES:()=>k4,MIN_BINARY_SIZE:()=>XI,SIG_CONFIG:()=>qp,SignatureConfig:()=>ou,Signer:()=>zne,createData:()=>Gne,deserializeTags:()=>w4,indexToType:()=>ZI,serializeTags:()=>JI,tagsExceedLimit:()=>Hne});var zne=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,s){throw new Error("You must implement verify method on child")}},Wxe=dd(GI(),1),ih=dd(Fne(),1);async function Wne(t){if(Array.isArray(t)){let o=(0,ih.concatBuffers)([(0,ih.stringToBuffer)("list"),(0,ih.stringToBuffer)(t.length.toString())]);return await Kne(t,await Yf().hash(o,"SHA-384"))}let e=t,r=(0,ih.concatBuffers)([(0,ih.stringToBuffer)("blob"),(0,ih.stringToBuffer)(e.byteLength.toString())]),s=(0,ih.concatBuffers)([await Yf().hash(r,"SHA-384"),await Yf().hash(e,"SHA-384")]);return await Yf().hash(s,"SHA-384")}async function Kne(t,e){if(t.length<1)return e;let r=(0,ih.concatBuffers)([e,await Wne(t[0])]),s=await Yf().hash(r,"SHA-384");return await Kne(t.slice(1),s)}var lI=dd(Fxe(),1),Kxe=lI.default.default?lI.default.default:lI.default,Hxe=class extends Kxe{getPublicKey(t){throw new Error("Unimplemented")}},Gxe;function Yf(){return Gxe??=new Hxe}var ou;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(ou||(ou={}));var qp={[ou.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[ou.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[ou.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[ou.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[ou.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[ou.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[ou.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},VI=class{signatureType=1;ownerLength=qp[1].pubLength;signatureLength=qp[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return Wxe.default.toBuffer(this.pk)}sign(t){return Yf().sign(this.jwk,t)}static async verify(t,e,r){return await Yf().verify(t,e,r)}},ZI={1:VI},Gh=dd(GI(),1);async function RI(t){return Wne([(0,ih.stringToBuffer)("dataitem"),(0,ih.stringToBuffer)("1"),(0,ih.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Vxe(t,e){let r=await RI(t),s=await e.sign(r),o=await Yf().hash(s);return{signature:pt.from(s),id:pt.from(o)}}async function Zxe(t,e){let{signature:r,id:s}=await Vxe(t,e);return t.getRaw().set(r,2),s}var l2=class{buf;pos;constructor(t=pt.alloc(k4),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;r<e;r++){let s=t[r];if(s?.name===void 0||s?.value===void 0)throw new Error(`Invalid tag format for ${s}, expected {name:string, value: string}`);this.writeString(s.name),this.writeString(s.value)}this.writeLong(0)}toBuffer(){let t=pt.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,s;if(t>=-1073741824&&t<1073741824){s=t>=0?t<<1:~t<<1|1;do e[this.pos]=s&127,s>>=7;while(s&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=pt.byteLength(t),r=this.buf;this.writeLong(e);let s=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let o,l,c,d;for(o=0,l=e;o<l;o++)c=t.charCodeAt(o),c<128?r[s++]=c:c<2048?(r[s++]=c>>6|192,r[s++]=c&63|128):(c&64512)===55296&&((d=t.charCodeAt(o+1))&64512)===56320?(c=65536+((c&1023)<<10)+(d&1023),o++,r[s++]=c>>18|240,r[s++]=c>>12&63|128,r[s++]=c>>6&63|128,r[s++]=c&63|128):(r[s++]=c>>12|224,r[s++]=c>>6&63|128,r[s++]=c&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,s,o,l,c;do s=r[this.pos++],o=s&128,t|=(s&127)<<e,e+=7;while(o&&e<28);if(o){l=t,c=268435456;do s=r[this.pos++],l+=(s&127)*c,c*=128;while(s&128);return(l%2?-(l+1):l)/2}return t>>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),s=this.readString();t.push({name:r,value:s})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function JI(t){let e=new l2;return e.writeTags(t),e.toBuffer()}function Hne(t){let e=new l2;return e.writeTags(t),e.tagsExceedLimit()}function w4(t){return new l2(t).readTags()}function bl(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function Jxe(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let s=t&255;e[r]=s,t=(t-s)/256}return Uint8Array.from(e)}function Cie(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let s=t&255;e[r]=s,t=(t-s)/256}return Uint8Array.from(e)}var Xxe=dd(zxe(),1),xp=dd(xI(),1),k4=4096,XI=80,s2=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=bl(this.binary.subarray(0,2));if(ou?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return s2.verify(this.binary)}get id(){return(async()=>Gh.default.encode(await this.rawId))()}set id(t){this._id=Gh.default.toBuffer(t)}get rawId(){return(async()=>xp.Buffer.from(await Xxe.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Gh.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return qp[this.signatureType].sigLength}get owner(){return Gh.default.encode(this.rawOwner)}get ownerLength(){return qp[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):xp.Buffer.alloc(0)}get target(){return Gh.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):xp.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=bl(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(bl(this.binary.subarray(t,t+8))==0)return[];let e=bl(this.binary.subarray(t+8,t+16));return w4(xp.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Gh.default.encode(t.name),value:Gh.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=bl(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=bl(e),s=t+16+r;return this.binary.subarray(s,this.binary.length)}get data(){return Gh.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Zxe(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=xp.Buffer.from(await Yf().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Gh.default.encode(t.name),value:Gh.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<XI)return!1;let e=new s2(t),r=e.signatureType,s=e.getTagsStart(),o=bl(t.subarray(s,s+8)),l=t.subarray(s+8,s+16),c=bl(l);if(c>k4)return!1;if(o>0)try{if(w4(xp.Buffer.from(t.subarray(s+16,s+16+c))).length!==o)return!1}catch{return!1}let d=ZI[r],b=await RI(e);return await d.verify(e.rawOwner,b,e.rawSignature)}async getSignatureData(){return RI(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),s=this.binary[r]==1;return r+=s?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},Yxe=dd(GI(),1);function Gne(t,e,r){let s=e.publicKey,o=r?.target?Yxe.default.toBuffer(r.target):null,l=1+(o?.byteLength??0),c=r?.anchor?pt.from(r.anchor):null,d=1+(c?.byteLength??0),b=(r?.tags?.length??0)>0?JI(r.tags):null,g=16+(b?b.byteLength:0),y=pt.from(t),m=y.byteLength,_=2+e.signatureLength+e.ownerLength+l+d+g+m,T=pt.alloc(_);if(T.set(Jxe(e.signatureType),0),T.set(new Uint8Array(e.signatureLength).fill(0),2),s.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${s.byteLength}`);T.set(s,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(T[A]=o?1:0,o){if(o.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${o.byteLength}`);T.set(o,A+1)}let R=A+l,B=R+1;if(T[R]=c?1:0,c){if(B+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");T.set(c,R+1)}T.set(Cie(r?.tags?.length??0),B);let C=Cie(b?.byteLength??0);T.set(C,B+8),b&&T.set(b,B+16);let P=B+g;return T.set(y,P),new s2(T)}var YI={...jne};globalThis.arbundles??=YI;var Qxe=YI,eRe=YI;globalThis.Buffer||(globalThis.Buffer=$ne.Buffer);var{DataItem:tRe}=Une;function rRe(t){return async({data:r,tags:s,target:o,anchor:l,createDataItem:c=d=>new tRe(d)})=>{let d=await t.signDataItem({data:r,tags:s,target:o,anchor:l}),b=c($ne.Buffer.from(d));return{id:await b.id,raw:await b.getRaw()}}}var iRe=globalThis.GATEWAY_URL||void 0,nRe=globalThis.MU_URL||void 0,oRe=globalThis.CU_URL||void 0,aRe=globalThis.GRAPHQL_URL||void 0,{result:DYe,results:$Ye,message:UYe,spawn:qYe,monitor:FYe,unmonitor:jYe,dryrun:zYe,assign:WYe}=KI({GATEWAY_URL:iRe,MU_URL:nRe,CU_URL:oRe,GRAPHQL_URL:aRe}),KYe=Dne.createDataItemSigner;var Vne=Zl(G7(),1);var pd=class{logger;processId;ao;constructor({processId:e,logger:r=new Sa({level:"info"})}){this.processId=e,this.logger=r,this.ao=KI()}async createAoSigner(e){return e.publicKey===void 0&&"setPublicKey"in e&&await e.setPublicKey(),async({data:s,tags:o,target:l,anchor:c})=>{let d=(0,Vne.createData)(s,e,{tags:o,target:l,anchor:c});return d.sign(e).then(async()=>({id:await d.id,raw:await d.getRaw()}))}}async read({tags:e,retries:r=3}){let s=0,o;for(;s<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:e});let l=await this.ao.dryrun({process:this.processId,tags:e});if(l.Error!==void 0)throw new Error(l.Error);if(l.Messages.length===0)throw new Error("Process does not support provided action.");return this.logger.debug("Read interaction result",{result:l.Messages[0].Data}),JSON.parse(l.Messages[0].Data)}catch(l){s++,this.logger.debug(`Read attempt ${s} failed`,{error:l,tags:e}),o=l,await new Promise(c=>setTimeout(c,2**s*1e3))}throw o}async send({tags:e,data:r,signer:s}){this.logger.debug("Evaluating send interaction on contract",{tags:e,data:r,processId:this.processId});let o=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:z1}],data:JSON.stringify(r),signer:await this.createAoSigner(s)});this.logger.debug("Sent message to process",{messageId:o,processId:this.processId});let l=await this.ao.result({message:o,process:this.processId});if(this.logger.debug("Message result",{output:l,messageId:o,processId:this.processId}),l.Messages.length===0)return{id:o};let d=l.Messages[0].Tags.find(g=>g.name==="Error");if(d){let g=l.Messages[0].Data;throw new Error(`${d.Value}: ${g}`)}let b=JSON.parse(l.Messages[0].Data);return this.logger.debug("Message result data",{resultData:b,messageId:o,processId:this.processId}),{id:o,result:b}}};var Zne=class{static init(e){if(e&&e.signer){let{signer:r,...s}=e;return new QI({...s,signer:r})}return new I4(e)}},I4=class{process;arweave;constructor(e,r=Jne.default.init({})){if(!e)this.process=new pd({processId:V7});else if(Y7(e))this.process=e.process;else if(Q7(e))this.process=new pd({processId:e.processId,logger:new Sa({level:"info"})});else throw new Ka;this.arweave=r}async getEpoch(e){let s=[{name:"Action",value:"Epoch"},{name:"Timestamp",value:e.timestamp?.toString()??""},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:(await this.arweave.blocks.getCurrent()).timestamp.toString()}),this.process.read({tags:s})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(){return this.process.read({tags:[{name:"Action",value:"Records"}]})}async getArNSReservedNames(){return this.process.read({tags:[{name:"Action",value:"ReservedNames"}]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"ReservedName"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(){return this.process.read({tags:[{name:"Action",value:"Balances"}]})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGateways(){return this.process.read({tags:[{name:"Action",value:"Gateways"}]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"},{name:"Timestamp",value:`${Date.now()}`}]})}async getPrescribedObservers(e){let s=[{name:"Action",value:"EpochPrescribedObservers"},{name:"Timestamp",value:e.timestamp?.toString()},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:`${Date.now()}`}),this.process.read({tags:s})}async getPrescribedNames(e){let s=[{name:"Action",value:"EpochPrescribedNames"},{name:"Timestamp",value:e.timestamp?.toString()},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:`${Date.now()}`}),this.process.read({tags:s})}async getObservations(e){let s=[{name:"Action",value:"EpochObservations"},{name:"Timestamp",value:e.timestamp?.toString()},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:(await this.arweave.blocks.getCurrent()).timestamp.toString()}),this.process.read({tags:s})}async getDistributions(e){let s=[{name:"Action",value:"EpochDistributions"},{name:"Timestamp",value:e.timestamp?.toString()??""},{name:"BlockHeight",value:e?.blockHeight?.toString()},{name:"EpochIndex",value:e?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return s.length===1&&s.push({name:"Timestamp",value:(await this.arweave.blocks.getCurrent()).timestamp.toString()}),this.process.read({tags:s})}},QI=class extends I4{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({process:new pd({processId:V7})}),this.signer=e;else if(Y7(r))super({process:r.process}),this.signer=e;else if(Q7(r))super({process:new pd({processId:r.processId})}),this.signer=e;else throw new Ka}async transfer({target:e,qty:r},s){let{tags:o=[]}=s||{};return this.process.send({tags:[...o,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:r,delegateRewardShareRatio:s,fqdn:o,label:l,minDelegatedStake:c,note:d,port:b,properties:g,protocol:y,autoStake:m,observerAddress:_},T){let{tags:A=[]}=T||{},B=[...A,{name:"Action",value:"JoinNetwork"},{name:"OperatorStake",value:e.valueOf().toString()},{name:"AllowDelegatedStaking",value:r.toString()},{name:"DelegateRewardShareRatio",value:s.toString()},{name:"FQDN",value:o},{name:"Label",value:l},{name:"MinDelegatedStake",value:c.valueOf().toString()},{name:"Note",value:d},{name:"Port",value:b.toString()},{name:"Properties",value:g},{name:"Protocol",value:y},{name:"AutoStake",value:m.toString()},{name:"ObserverAddress",value:_}].filter(C=>C.value!==void 0);return this.process.send({signer:this.signer,tags:B})}async updateGatewaySettings({allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:s,label:o,minDelegatedStake:l,note:c,port:d,properties:b,protocol:g,autoStake:y,observerAddress:m},_){let{tags:T=[]}=_||{},R=[...T,{name:"Action",value:"UpdateGatewaySettings"},{name:"Label",value:o},{name:"Note",value:c},{name:"FQDN",value:s},{name:"Port",value:d?.toString()},{name:"Properties",value:b},{name:"Protocol",value:g},{name:"ObserverAddress",value:m},{name:"AllowDelegatedStaking",value:e?.toString()},{name:"DelegateRewardShareRatio",value:r?.toString()},{name:"MinDelegatedStake",value:l?.valueOf().toString()},{name:"AutoStake",value:y?.toString()}].filter(B=>B.value!==void 0);return this.process.send({signer:this.signer,tags:R})}async delegateStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"DelegateStake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"DecreaseDelegateStake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async increaseOperatorStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"IncreaseOperatorStake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"DecreaseOperatorStake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async saveObservations(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"SaveObservations"},{name:"ReportTxId",value:e.reportTxId},{name:"FailedGateways",value:e.failedGateways.join(",")}],data:{reportTxId:e.reportTxId,failedGateways:e.failedGateways}})}async buyRecord(e,r){let{tags:s=[]}=r||{},l=[...s,{name:"Action",value:"BuyRecord"},{name:"Name",value:e.name},{name:"Type",value:e.type},{name:"Years",value:e.years?.toString()},{name:"ProcessId",value:e.processId}].filter(c=>c.value!==void 0);return this.process.send({signer:this.signer,tags:l})}async extendLease(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"ExtendLease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()}]})}async increaseUndernameLimit(e,r){let{tags:s=[]}=r||{};return this.process.send({signer:this.signer,tags:[...s,{name:"Action",value:"IncreaseUndernameLimit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()}]})}};Se();Ae();Ee();Se();Ae();Ee();var or=Zl(hhe(),1);var eft=or.default.AbortError,tft=or.default.AbstractContractHandler,rft=or.default.ArweaveContractDefinitionLoader,ift=or.default.ArweaveGatewayBundledContractDefinitionLoader,nft=or.default.ArweaveGatewayBundledInteractionLoader,oft=or.default.ArweaveGatewayInteractionsLoader,aft=or.default.ArweaveWrapper,sft=or.default.Benchmark,uft=or.default.CacheKey,hft=or.default.CacheableInteractionsLoader,fft=or.default.CacheableStateEvaluator,cft=or.default.ConsoleLogger,lft=or.default.ConsoleLoggerFactory,dft=or.default.ContractCache,pft=or.default.ContractCallRecord,vft=or.default.ContractError,gft=or.default.ContractInteractionState,mft=or.default.ContractMetadata,yft=or.default.CustomEvent,bft=or.default.DEFAULT_LEVEL_DB_LOCATION,wft=or.default.DefaultEvaluationOptions,_ft=or.default.DefaultStateEvaluator,Mft=or.default.EvalStateResult,Sft=or.default.EvaluationOptionsEvaluator,Eft=or.default.HandlerBasedContract,Aft=or.default.HandlerExecutorFactory,Tft=or.default.InnerWritesEvaluator,xft=or.default.InteractionCall,Rft=or.default.InteractionCompleteEvent,kft=or.default.InteractionInput,Ift=or.default.InteractionOutput,Bft=or.default.JsHandlerApi,Oft=or.default.KV,Cft=or.default.KnownErrors,Pft=or.default.LevelDbCache,Nft=or.default.LexicographicalInteractionsSorter,Lft=or.default.LogLevelOrder,fhe=or.default.LoggerFactory,Dft=or.default.MemCache,$ft=or.default.NetworkCommunicationError,Uft=or.default.NonWhitelistedSourceError,qft=or.default.PstContractImpl,Fft=or.default.REGISTER_PROVIDER,jft=or.default.SMART_WEAVE_TAGS,zft=or.default.SUPPORTED_SRC_CONTENT_TYPES,Wft=or.default.SWBlock,Kft=or.default.SWTransaction,Hft=or.default.SWVrf,che=or.default.Signature,Gft=or.default.SmartWeaveError,Vft=or.default.SmartWeaveErrorType,Zft=or.default.SmartWeaveGlobal,Jft=or.default.SortKeyCacheResult,Xft=or.default.SourceType,Yft=or.default.SrcCache,lhe=or.default.Tag,Qft=or.default.TagsParser,ect=or.default.Transaction,tct=or.default.WARP_GW_URL,rct=or.default.WARP_TAGS,ict=or.default.Warp,nct=or.default.WarpBuilder,dhe=or.default.WarpFactory,oct=or.default.WarpFetchWrapper,act=or.default.WarpGatewayContractDefinitionLoader,sct=or.default.WarpGatewayInteractionsLoader,uct=or.default.WasmHandlerApi,hct=or.default.WasmSrc,fct=or.default.arrayToHex,cct=or.default.asc,lct=or.default.ascS,dct=or.default.bufToBn,pct=or.default.bundledTxsFilter,vct=or.default.checkJsSrc,gct=or.default.createDummyTx,mct=or.default.createInteractionTagsList,yct=or.default.createInteractionTx,bct=or.default.deepCopy,wct=or.default.defaultArweaveMs,phe=or.default.defaultCacheOptions,_ct=or.default.defaultWarpGwOptions,Mct=or.default.desc,Sct=or.default.descS,Ect=or.default.emptyTransfer,Act=or.default.genesisSortKey,Tct=or.default.getJsonResponse,xct=or.default.indent,Rct=or.default.isBrowser,kct=or.default.isTxIdValid,Ict=or.default.knownWarpPlugins,Bct=or.default.knownWarpPluginsPartial,Oct=or.default.lastPossibleSortKey,Cct=or.default.lvlToOrder,Pct=or.default.mapReplacer,Nct=or.default.mapReviver,Lct=or.default.matchMutClosureDtor,Dct=or.default.normalizeContractSource,$ct=or.default.rustWasmImports,Uct=or.default.safeGet,qct=or.default.safeParseInt,Fct=or.default.sleep,jct=or.default.sortingFirst,zct=or.default.sortingLast,Wct=or.default.stripTrailingSlash,Kct=or.default.timeout;Se();Ae();Ee();Ok();var MPe="+",SPe="/",EPe="-",APe="_",TPe="=";function xPe(t){return t.replaceAll(MPe,EPe).replaceAll(SPe,APe).replaceAll(TPe,"")}function sy(t){let e=t.toString("base64");return xPe(e)}function vhe(t){return sy(Bk("sha256").update(t).digest())}Se();Ae();Ee();Se();Ae();Ee();var ghe=Zl(nI(),1),mhe=ghe.default.init({host:"arweave.net",port:443,protocol:"https"});var yhe=dhe.forMainnet({...phe,inMemory:!0},!0,mhe);fhe.INST.logLevel("error");var Ea=class{contract;contractTxId;cacheUrl;logger;warp;constructor({contractTxId:e,cacheUrl:r="https://api.arns.app",warp:s=yhe,logger:o=new Sa({level:"info"})}){this.contractTxId=e,this.contract=s.contract(e),this.cacheUrl=r,this.warp=s,this.logger=o}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async createWarpSigner(e){return e.publicKey===void 0&&"setPublicKey"in e&&await e.setPublicKey(),new che(this.warp,{signer:async s=>{s.setOwner(sy(e.publicKey));let o=await s.getSignatureData(),l=await e.sign(o),c=pt.from(l),d=vhe(c);s.setSignature({id:d,owner:sy(e.publicKey),signature:sy(c)})},type:"arweave"})}async getState({evaluationOptions:e={}}){await this.ensureContractInit();let r=e?.evalTo,s;r&&"sortKey"in r?s=r.sortKey:r&&"blockHeight"in r&&(s=r.blockHeight);let o=await this.contract.readState(s);if(!o.cachedValue.state)throw new w0(502,"Failed to evaluate contract state");return o.cachedValue.state}async ensureContractInit({signer:e}={}){this.logger.debug("Checking contract initialized",{contractTxId:this.contractTxId}),this.logger.debug("Fetching contract manifest",{contractTxId:this.contractTxId});let{evaluationOptions:r={}}=await y$({arweave:this.warp.arweave,contractTxId:this.contractTxId});this.contract.setEvaluationOptions(r),e&&this.contract.connect(await this.createWarpSigner(e)),this.cacheUrl!==void 0&&(this.logger.debug("Syncing contract state",{contractTxId:this.contractTxId,remoteCacheUrl:this.cacheUrl}),await this.contract.syncState(`${this.cacheUrl}/v1/contract/${this.contractTxId}`,{validity:!0}))}async readInteraction({functionName:e,inputs:r}){await this.ensureContractInit(),this.logger.debug(`Read interaction: ${e}`,{contractTxId:this.contractTxId,inputs:r});let s=await this.contract.viewState({function:e,...r});if(s.result===void 0)throw new w0(502,"Failed to evaluate contract read interaction: "+JSON.stringify({error:s.errorMessage,functionName:e,inputs:r},null,2));return this.logger.debug("Successfully evaluated contract read interaction",{contractTxId:this.contractTxId,result:s.result}),s.result}async writeInteraction({functionName:e,inputs:r,signer:s},o){try{this.logger.debug(`Write interaction: ${e}`,{contractTxId:this.contractTxId}),await this.ensureContractInit({signer:s});let l=await this.contract.dryWrite({function:e,...r});if(l.type!=="ok")throw new Error(`Failed to dry write contract interaction ${e}: ${l.errorMessage}`);let c=await this.contract.writeInteraction({function:e,...r},{disableBundling:!0,tags:o?.tags?.map(d=>new lhe(d.name,d.value))});if(!c?.interactionTx)throw new Error(`Failed to write contract interaction: ${e}`);return this.logger.debug("Successfully wrote contract interaction",{contractTxId:this.contractTxId,interactionTxId:c.originalTxId}),c.interactionTx}catch(l){throw this.logger.error(`Failed to write contract interaction: ${l.message}`,{contractTxId:this.contractTxId}),new Fb(l)}}};var export_ArconnectSigner=bhe.ArconnectSigner;var export_ArweaveSigner=bhe.ArweaveSigner;export{IW as ANT,Wb as ANTReadable,KM as ANTWritable,kc as ANT_CONTRACT_FUNCTIONS,pd as AOProcess,aNe as ARNS_DEVNET_REGISTRY_TX,f6 as ARNS_TESTNET_REGISTRY_TX,g$ as ARWEAVE_TX_REGEX,vo as AR_IO_CONTRACT_FUNCTIONS,zM as AbortError,kW as ArIO,zb as ArIOReadable,WM as ArIOWritable,export_ArconnectSigner as ArconnectSigner,export_ArweaveSigner as ArweaveSigner,TW as BadRequest,Cu as BaseError,v$ as DENOMINATIONS,Sa as DefaultLogger,oNe as FQDN_REGEX,w0 as FailedRequestError,Zne as IO,I4 as IOReadable,Dv as IOToken,QI as IOWriteable,Ka as InvalidContractConfigurationError,RW as InvalidProcessConfigurationError,xW as InvalidSignerError,Z7 as MIO_PER_IO,Ub as NotFound,_0 as RemoteContract,Zfe as SORT_KEY_REGEX,qb as UnknownError,Ea as WarpContract,Fb as WriteInteractionError,XPe as ioContractInteractions,Gfe as ioContractReadInteractions,Vfe as ioContractWriteInteractions,V7 as ioDevnetProcessId,Y7 as isProcessConfiguration,Q7 as isProcessIdConfiguration,X7 as mIOToken};
|
|
287
287
|
/*! Bundled license information:
|
|
288
288
|
|
|
289
289
|
@jspm/core/nodelibs/browser/buffer.js:
|
|
@@ -51,26 +51,43 @@ class AOProcess {
|
|
|
51
51
|
};
|
|
52
52
|
return aoSigner;
|
|
53
53
|
}
|
|
54
|
-
async read({ tags, }) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
async read({ tags, retries = 3, }) {
|
|
55
|
+
let attempts = 0;
|
|
56
|
+
let lastError;
|
|
57
|
+
while (attempts < retries) {
|
|
58
|
+
try {
|
|
59
|
+
this.logger.debug(`Evaluating read interaction on contract`, {
|
|
60
|
+
tags,
|
|
61
|
+
});
|
|
62
|
+
// map tags to inputs
|
|
63
|
+
const result = await this.ao.dryrun({
|
|
64
|
+
process: this.processId,
|
|
65
|
+
tags,
|
|
66
|
+
});
|
|
67
|
+
if (result.Error !== undefined) {
|
|
68
|
+
throw new Error(result.Error);
|
|
69
|
+
}
|
|
70
|
+
if (result.Messages.length === 0) {
|
|
71
|
+
throw new Error('Process does not support provided action.');
|
|
72
|
+
}
|
|
73
|
+
this.logger.debug(`Read interaction result`, {
|
|
74
|
+
result: result.Messages[0].Data,
|
|
75
|
+
});
|
|
76
|
+
const data = JSON.parse(result.Messages[0].Data);
|
|
77
|
+
return data;
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
attempts++;
|
|
81
|
+
this.logger.debug(`Read attempt ${attempts} failed`, {
|
|
82
|
+
error: e,
|
|
83
|
+
tags,
|
|
84
|
+
});
|
|
85
|
+
lastError = e;
|
|
86
|
+
// exponential backoff
|
|
87
|
+
await new Promise((resolve) => setTimeout(resolve, 2 ** attempts * 1000));
|
|
88
|
+
}
|
|
68
89
|
}
|
|
69
|
-
|
|
70
|
-
result: result.Messages[0].Data,
|
|
71
|
-
});
|
|
72
|
-
const data = JSON.parse(result.Messages[0].Data);
|
|
73
|
-
return data;
|
|
90
|
+
throw lastError;
|
|
74
91
|
}
|
|
75
92
|
async send({ tags, data, signer, }) {
|
|
76
93
|
this.logger.debug(`Evaluating send interaction on contract`, {
|
package/lib/cjs/version.js
CHANGED
|
@@ -48,26 +48,43 @@ export class AOProcess {
|
|
|
48
48
|
};
|
|
49
49
|
return aoSigner;
|
|
50
50
|
}
|
|
51
|
-
async read({ tags, }) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
async read({ tags, retries = 3, }) {
|
|
52
|
+
let attempts = 0;
|
|
53
|
+
let lastError;
|
|
54
|
+
while (attempts < retries) {
|
|
55
|
+
try {
|
|
56
|
+
this.logger.debug(`Evaluating read interaction on contract`, {
|
|
57
|
+
tags,
|
|
58
|
+
});
|
|
59
|
+
// map tags to inputs
|
|
60
|
+
const result = await this.ao.dryrun({
|
|
61
|
+
process: this.processId,
|
|
62
|
+
tags,
|
|
63
|
+
});
|
|
64
|
+
if (result.Error !== undefined) {
|
|
65
|
+
throw new Error(result.Error);
|
|
66
|
+
}
|
|
67
|
+
if (result.Messages.length === 0) {
|
|
68
|
+
throw new Error('Process does not support provided action.');
|
|
69
|
+
}
|
|
70
|
+
this.logger.debug(`Read interaction result`, {
|
|
71
|
+
result: result.Messages[0].Data,
|
|
72
|
+
});
|
|
73
|
+
const data = JSON.parse(result.Messages[0].Data);
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
attempts++;
|
|
78
|
+
this.logger.debug(`Read attempt ${attempts} failed`, {
|
|
79
|
+
error: e,
|
|
80
|
+
tags,
|
|
81
|
+
});
|
|
82
|
+
lastError = e;
|
|
83
|
+
// exponential backoff
|
|
84
|
+
await new Promise((resolve) => setTimeout(resolve, 2 ** attempts * 1000));
|
|
85
|
+
}
|
|
65
86
|
}
|
|
66
|
-
|
|
67
|
-
result: result.Messages[0].Data,
|
|
68
|
-
});
|
|
69
|
-
const data = JSON.parse(result.Messages[0].Data);
|
|
70
|
-
return data;
|
|
87
|
+
throw lastError;
|
|
71
88
|
}
|
|
72
89
|
async send({ tags, data, signer, }) {
|
|
73
90
|
this.logger.debug(`Evaluating send interaction on contract`, {
|
package/lib/esm/version.js
CHANGED
|
@@ -28,11 +28,12 @@ export declare class AOProcess implements AOContract {
|
|
|
28
28
|
id: string;
|
|
29
29
|
raw: ArrayBuffer;
|
|
30
30
|
}>>;
|
|
31
|
-
read<K>({ tags, }: {
|
|
31
|
+
read<K>({ tags, retries, }: {
|
|
32
32
|
tags?: Array<{
|
|
33
33
|
name: string;
|
|
34
34
|
value: string;
|
|
35
35
|
}>;
|
|
36
|
+
retries?: number;
|
|
36
37
|
}): Promise<K>;
|
|
37
38
|
send<I, K>({ tags, data, signer, }: {
|
|
38
39
|
tags: Array<{
|
package/lib/types/io.d.ts
CHANGED
|
@@ -37,8 +37,12 @@ export type EpochInput = {
|
|
|
37
37
|
timestamp: Timestamp;
|
|
38
38
|
} | undefined;
|
|
39
39
|
export interface AOContract {
|
|
40
|
-
read<K>({ tags }: {
|
|
41
|
-
tags
|
|
40
|
+
read<K>({ tags, retries, }: {
|
|
41
|
+
tags?: {
|
|
42
|
+
name: string;
|
|
43
|
+
value: string;
|
|
44
|
+
}[];
|
|
45
|
+
retries?: number;
|
|
42
46
|
}): Promise<K>;
|
|
43
47
|
send<I, K>({ tags, data, signer, }: {
|
|
44
48
|
tags: {
|
package/lib/types/version.d.ts
CHANGED