@ar.io/sdk 3.11.0-alpha.2 → 3.11.0-alpha.3
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 +1 -1
- package/lib/cjs/common/wayfinder/wayfinder.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/wayfinder/wayfinder.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/wayfinder/wayfinder.d.ts +2 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -209,7 +209,7 @@ nonce: bundlr`),Te.from(n))}};fe();he();ue();var o1=class{_publicKey;ownerLength
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
}`,n=kt.object({data:kt.object({transactions:kt.object({edges:kt.array(kt.object({node:kt.record(kt.any())}))})})});return h=>di(h).chain(gn(p=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:f,variables:{transactionIds:[p]}})}).then(async v=>{if(v.ok)return v.json();throw r('Error Encountered when querying gateway for transaction "%s"',p),new Error(`${v.status}: ${await v.text()}`)}).then(n.parse).then(ije(["data","transactions","edges","0","node"])))).toPromise()}var pze=Z$(MLe(),1),spe=(t="@permaweb/aoconnect")=>{let e=(0,pze.default)(t);return e.child=r=>spe(`${e.namespace}:${r}`),e.tap=(r,...f)=>hje((...n)=>e(r,...f,...n)),e},fpe=({url:t,path:e})=>e?e.startsWith("/")?fpe({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function vze(t){return sg(h_([]),og((e,r)=>sg(oje([],r.name),uL(r.value),nu(r.name,Rc,e))(e),{}),f_(e=>e.length>1?e:e[0]))(t)}function tu(t,e){return r=>Bde(vFe([O0e(t,"name"),lL(fL(e),O0e(e,"value"),aL)]),r)}function $0e(t){return Fde([[qy(String),Ym(t)],[qy(Array),VFe(t)],[aL,Eqe]])}function O1(t){let e;return qy(ru,t)?(e=new Error(mze(t)),e.stack+=t.stack):qy(Error,t)?e=t:WFe("message",t)?e=new Error(t.message):qy(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function mze(t){return sg(e=>function r(f,n,h){return og((p,v)=>sg(Fde([[Ym(Yt.invalid_arguments),()=>r(v.argumentsError,422,"Invalid Arguments")],[Ym(Yt.invalid_return_type),()=>r(v.returnTypeError,500,"Invalid Return")],[Ym(Yt.invalid_union),()=>BFe(w=>r(w,400,"Invalid Union"),v.unionErrors)],[aL,()=>[{...v,status:n,contextCode:h}]]]),hL(p))(v.code),[],f.issues)}(e,400,""),e=>og((r,f)=>{let{message:n,path:h,contextCode:p}=f,v=h[1]||h[0],w=p?`${p} `:"";return r.push(`${w}'${v}': ${n}.`),r},[],e),eje(" | "))(t)}var gze=kt.object({id:kt.string().min(1,{message:"message is required to be a message id"}),processId:kt.string().min(1,{message:"process is required to be a process id"})});function bze(){return t=>di(t).map(gze.parse).map(()=>t)}var x6=kt.object({name:kt.string(),value:kt.string()}),yze=kt.function().args(kt.object({Id:kt.string(),Target:kt.string(),Owner:kt.string(),Anchor:kt.string().optional(),Data:kt.any().default("1234"),Tags:kt.array(kt.object({name:kt.string(),value:kt.string()}))})).returns(kt.promise(kt.any())),wze=kt.function().args(kt.object({id:kt.string().min(1,{message:"message id is required"}),processId:kt.string().min(1,{message:"process id is required"})})).returns(kt.promise(kt.any())),_ze=kt.function().args(kt.object({process:kt.string().min(1,{message:"process id is required"}),from:kt.string().optional(),to:kt.string().optional(),sort:kt.enum(["ASC","DESC"]).default("ASC"),limit:kt.number().optional()})).returns(kt.promise(kt.object({edges:kt.array(kt.object({cursor:kt.string(),node:kt.object({Output:kt.any().optional(),Messages:kt.array(kt.any()).optional(),Spawns:kt.array(kt.any()).optional(),Error:kt.any().optional()})}))}))),upe=kt.function().args(kt.object({processId:kt.string(),data:kt.any(),tags:kt.array(x6),anchor:kt.string().optional(),signer:kt.any()})).returns(kt.promise(kt.object({messageId:kt.string()}).passthrough())),Mze=kt.function().args(kt.object({data:kt.any(),tags:kt.array(x6),signer:kt.any()})).returns(kt.promise(kt.object({processId:kt.string()}).passthrough())),xze=kt.function().args(kt.object({process:kt.string(),message:kt.string(),baseLayer:kt.boolean().optional(),exclude:kt.array(kt.string()).optional()})).returns(kt.promise(kt.object({assignmentId:kt.string()}).passthrough())),hpe=upe,K_t=kt.function().args(kt.object({suUrl:kt.string().url(),processId:kt.string()})).returns(kt.promise(kt.object({tags:kt.array(x6)}).passthrough())),Z_t=kt.function().args(kt.string()).returns(kt.promise(kt.object({url:kt.string()}))),Sze=kt.function().args(kt.string()).returns(kt.promise(kt.boolean())),Eze=kt.function().args(kt.string()).returns(kt.promise(kt.object({tags:kt.array(x6)}).passthrough())),l_=kt.function().args(kt.object({data:kt.any(),tags:kt.array(x6),target:kt.string().optional(),anchor:kt.string().optional()})).returns(kt.promise(kt.object({id:kt.string(),raw:kt.any()})));function Aze({loadResult:t}){return t=gn(wze.implement(t)),e=>di({id:e.id,processId:e.processId}).chain(t)}function Rze(t){let e=bze(t),r=Aze(t);return({message:f,process:n})=>di({id:f,processId:n}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',f)).map(h=>h).bimap(O1,P1).toPromise()}var Tze=kt.array(kt.object({name:kt.string(),value:kt.string()}));function Ize(){return t=>di(t.tags).map(h_([])).map(tu("Data-Protocol","ao")).map(tu("Variant")).map(tu("Type")).map(tu("SDK")).map(hL(Rc,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(Tze.parse).map(nu("tags",Rc,t))}function kze({logger:t}){return e=>di(e).chain(lL(fL(e.data),()=>T1(e),()=>T1(Math.random().toString().slice(-4)).map(nu("data",Rc,e)).map(r=>sg(B1("tags"),tu("Content-Type"),uL({name:"Content-Type",value:"text/plain"}),nu("tags",Rc,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function Bze(t){let e=Ize(t),r=kze(t),f=upe.implement(t.deployMessage);return n=>di(n).chain(e).chain(r).chain(gn(({id:h,data:p,tags:v,anchor:w,signer:g})=>f({processId:h,data:p,tags:v,anchor:w,signer:l_.implement(g)}))).map(h=>nu("messageId",h.messageId,n))}function Pze(t){let e=Bze(t);return({process:r,data:f,tags:n,anchor:h,signer:p})=>di({id:r,data:f,tags:n,anchor:h,signer:p}).chain(e).map(v=>v.messageId).bimap(O1,P1).toPromise()}var ky=(t,e,r)=>f=>e(f[t])?T1(f):gd(`Tag '${t}': ${r}`);function Oze({loadTransactionMeta:t,logger:e}){return t=gn(Eze.implement(t)),r=>di(r).chain(t).map(B1("tags")).map(vze).chain(ky("Data-Protocol",$0e("ao"),"value 'ao' was not found on module")).chain(ky("Type",$0e("Module"),"value 'Module' was not found on module")).chain(ky("Module-Format",b$,"was not found on module")).chain(ky("Input-Encoding",b$,"was not found on module")).chain(ky("Output-Encoding",b$,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function Nze({logger:t,validateScheduler:e}){return e=gn(Sze.implement(e)),r=>di(r).chain(f=>e(f).chain(n=>n?T1(f):gd(`Valid Scheduler-Location owned by ${f} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function Cze({logger:t}){return e=>di(e).map(t.tap("Checking for signer")).chain(r=>r?T1(r):gd("signer not found"))}function $ze(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=Oze(t),f=Nze(t),n=Cze(t);return h=>di(h).chain(p=>r(p.module).map(()=>p)).chain(p=>f(p.scheduler)).map(()=>h).chain(p=>n(p.signer).map(()=>p)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var Lze=kt.array(kt.object({name:kt.string(),value:kt.string()}));function Dze(){return t=>di(t).map(B1("tags")).map(h_([])).map(tu("Data-Protocol","ao")).map(tu("Variant")).map(tu("Type")).map(tu("Module")).map(tu("Scheduler")).map(tu("SDK")).map(hL(Rc,[{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(Lze.parse).map(nu("tags",Rc,t))}function Uze({logger:t}){return e=>di(e).chain(lL(fL(e.data),()=>T1(e),()=>T1(Math.random().toString().slice(-4)).map(nu("data",Rc,e)).map(r=>sg(B1("tags"),tu("Content-Type"),uL({name:"Content-Type",value:"text/plain"}),nu("tags",Rc,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function qze(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=Dze(t),f=Uze(t),n=Mze.implement(t.deployProcess);return h=>di(h).chain(r).chain(f).chain(gn(({data:p,tags:v,signer:w})=>n({data:p,tags:v,signer:l_.implement(w)}))).map(p=>nu("processId",p.processId,h))}function Fze(t){let e=$ze(t),r=qze(t);return({module:f,scheduler:n,signer:h,tags:p,data:v})=>di({module:f,scheduler:n,signer:h,tags:p,data:v}).chain(e).chain(r).map(w=>w.processId).bimap(O1,P1).toPromise()}function jze(t){let e=hpe.implement(t.deployMonitor);return r=>di(r).chain(gn(({id:f,signer:n})=>e({processId:f,signer:l_.implement(n),data:Math.random().toString().slice(-4),tags:[]}))).map(f=>nu("monitorId",f.messageId,r))}function zze(t){let e=jze(t);return({process:r,signer:f})=>di({id:r,signer:f}).chain(e).map(n=>n.monitorId).bimap(O1,P1).toPromise()}function Hze(t){let e=hpe.implement(t.deployUnmonitor);return r=>di(r).chain(gn(({id:f,signer:n})=>e({processId:f,signer:l_.implement(n),data:Math.random().toString().slice(-4),tags:[]}))).map(f=>nu("monitorId",f.messageId,r))}function Wze(t){let e=Hze(t);return({process:r,signer:f})=>di({id:r,signer:f}).chain(e).map(n=>n.monitorId).bimap(O1,P1).toPromise()}var Kze=kt.object({process:kt.string().min(1,{message:"process identifier is required"}),from:kt.string().optional(),to:kt.string().optional(),sort:kt.enum(["ASC","DESC"]).default("ASC"),limit:kt.number().optional()});function Zze(){return t=>di(t).map(Kze.parse).map(()=>t)}function Vze({queryResults:t}){return t=gn(_ze.implement(t)),e=>di({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function Gze(t){let e=Zze(t),r=Vze(t);return({process:f,from:n,to:h,sort:p,limit:v})=>di({process:f,from:n,to:h,sort:p,limit:v}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',f)).map(w=>w).bimap(O1,P1).toPromise()}var Yze=kt.object({Id:kt.string(),Target:kt.string(),Owner:kt.string(),Anchor:kt.string().optional(),Data:kt.any().default("1234"),Tags:kt.array(kt.object({name:kt.string(),value:kt.string()}))});function Jze(){return t=>di(t).map(Yze.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 Xze({dryrunFetch:t}){return gn(yze.implement(t))}function Qze(t){let e=Jze(t),r=Xze(t);return f=>di(f).map(eHe).chain(e).chain(r).toPromise()}function eHe({process:t,data:e,tags:r,anchor:f,...n}){return{Id:"1234",Owner:"1234",...n,Target:t,Data:e||"1234",Tags:r||[],Anchor:f||"0"}}function tHe(t){let e=xze.implement(t.deployAssign);return r=>di(r).chain(gn(({process:f,message:n,baseLayer:h,exclude:p})=>e({process:f,message:n,baseLayer:h,exclude:p}))).map(f=>nu("assignmentId",f.assignmentId,r))}function rHe(t){let e=tHe(t);return({process:r,message:f,baseLayer:n,exclude:h})=>di({process:r,message:f,baseLayer:n,exclude:h}).chain(e).map(p=>p.assignmentId).bimap(O1,P1).toPromise()}var iHe="https://arweave.net",nHe="https://mu.ao-testnet.xyz",aHe="https://cu.ao-testnet.xyz";function ou({GRAPHQL_URL:t,GATEWAY_URL:e=iHe,MU_URL:r=nHe,CU_URL:f=aHe}={}){let n=spe();t||(t=fpe({url:e,path:"/graphql"}));let{validate:h}=Rde({cacheSize:100,GRAPHQL_URL:t}),p=xqe({MAX_SIZE:25}),v=n.child("result"),w=Rze({loadResult:wqe({fetch,CU_URL:f,logger:v}),logger:v}),g=n.child("message"),b=Pze({loadProcessMeta:v$({fetch,cache:p,logger:g}),deployMessage:pqe({fetch,MU_URL:r,logger:g}),logger:g}),M=n.child("spawn"),x=Fze({loadTransactionMeta:dze({fetch,GRAPHQL_URL:t,logger:M}),validateScheduler:h,deployProcess:vqe({fetch,MU_URL:r,logger:M}),logger:M}),S=n.child("monitor"),A=zze({loadProcessMeta:v$({fetch,cache:p,logger:S}),deployMonitor:mqe({fetch,MU_URL:r,logger:S}),logger:S}),T=n.child("unmonitor"),k=Wze({loadProcessMeta:v$({fetch,cache:p,logger:T}),deployUnmonitor:gqe({fetch,MU_URL:r,logger:T}),logger:S}),B=n.child("results"),C=Gze({queryResults:_qe({fetch,CU_URL:f,logger:B}),logger:B}),N=n.child("dryrun"),W=Qze({dryrunFetch:yqe({fetch,CU_URL:f,logger:N}),logger:N}),H=n.child("assign"),J=rHe({deployAssign:bqe({fetch,MU_URL:r,logger:H}),logger:g});return{result:w,results:C,message:b,spawn:x,monitor:A,unmonitor:k,dryrun:W,assign:J}}var lpe={};U0e(lpe,{createDataItemSigner:()=>kHe});var cpe=Z$(ELe(),1),dpe={};U0e(dpe,{AVSCTap:()=>S6,ArweaveSigner:()=>mL,DataItem:()=>y6,MAX_TAG_BYTES:()=>c_,MIN_BINARY_SIZE:()=>yL,SIG_CONFIG:()=>cg,SignatureConfig:()=>eu,Signer:()=>gpe,createData:()=>_pe,default:()=>RHe,deserializeTags:()=>r_,indexToType:()=>gL,serializeTags:()=>bL,tagsExceedLimit:()=>wpe,warparbundles:()=>THe});var oHe=Object.create,pL=Object.defineProperty,sHe=Object.getOwnPropertyDescriptor,fHe=Object.getOwnPropertyNames,uHe=Object.getPrototypeOf,hHe=Object.prototype.hasOwnProperty,Ic=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lHe=(t,e)=>{for(var r in e)pL(t,r,{get:e[r],enumerable:!0})},cHe=(t,e,r,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of fHe(e))!hHe.call(t,n)&&n!==r&&pL(t,n,{get:()=>e[n],enumerable:!(f=sHe(e,n))||f.enumerable});return t},N1=(t,e,r)=>(r=t!=null?oHe(uHe(t)):{},cHe(e||!t||!t.__esModule?pL(r,"default",{value:t,enumerable:!0}):r,t)),dHe=Ic(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var f=4,n=r.length,h=n%f;if(!h)return r;var p=n,v=f-h,w=n+v,g=Te.alloc(w);for(g.write(r);v--;)g.write("=",p++);return g.toString()}t.default=e}),pHe=Ic(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=dHe();function r(w,g){return g===void 0&&(g="utf8"),Te.isBuffer(w)?h(w.toString("base64")):h(Te.from(w,g).toString("base64"))}function f(w,g){return g===void 0&&(g="utf8"),Te.from(n(w),"base64").toString(g)}function n(w){return w=w.toString(),e.default(w).replace(/\-/g,"+").replace(/_/g,"/")}function h(w){return w.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(w){return Te.from(n(w),"base64")}var v=r;v.encode=r,v.decode=f,v.toBase64=n,v.fromBase64=h,v.toBuffer=p,t.default=v}),vL=Ic((t,e)=>{e.exports=pHe().default,e.exports.default=e.exports}),ppe=Ic(t=>{"use strict";t.byteLength=w,t.toByteArray=b,t.fromByteArray=S;var e=[],r=[],f=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,p=n.length;h<p;++h)e[h]=n[h],r[n.charCodeAt(h)]=h;var h,p;r[45]=62,r[95]=63;function v(A){var T=A.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=A.indexOf("=");k===-1&&(k=T);var B=k===T?0:4-k%4;return[k,B]}function w(A){var T=v(A),k=T[0],B=T[1];return(k+B)*3/4-B}function g(A,T,k){return(T+k)*3/4-k}function b(A){var T,k=v(A),B=k[0],C=k[1],N=new f(g(A,B,C)),W=0,H=C>0?B-4:B,J;for(J=0;J<H;J+=4)T=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[W++]=T>>16&255,N[W++]=T>>8&255,N[W++]=T&255;return C===2&&(T=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[W++]=T&255),C===1&&(T=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[W++]=T>>8&255,N[W++]=T&255),N}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,T,k){for(var B,C=[],N=T;N<k;N+=3)B=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),C.push(M(B));return C.join("")}function S(A){for(var T,k=A.length,B=k%3,C=[],N=16383,W=0,H=k-B;W<H;W+=N)C.push(x(A,W,W+N>H?H:W+N));return B===1?(T=A[k-1],C.push(e[T>>2]+e[T<<4&63]+"==")):B===2&&(T=(A[k-2]<<8)+A[k-1],C.push(e[T>>10]+e[T>>4&63]+e[T<<2&63]+"=")),C.join("")}}),vpe=Ic(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=ppe();function r(x){let S=0;for(let k=0;k<x.length;k++)S+=x[k].byteLength;let A=new Uint8Array(S),T=0;A.set(new Uint8Array(x[0]),T),T+=x[0].byteLength;for(let k=1;k<x.length;k++)A.set(new Uint8Array(x[k]),T),T+=x[k].byteLength;return A}t.concatBuffers=r;function f(x){let S=v(x);return n(S)}t.b64UrlToString=f;function n(x){return new TextDecoder("utf-8",{fatal:!0}).decode(x)}t.bufferToString=n;function h(x){return new TextEncoder().encode(x)}t.stringToBuffer=h;function p(x){return g(h(x))}t.stringToB64Url=p;function v(x){return new Uint8Array(e.toByteArray(M(x)))}t.b64UrlToBuffer=v;function w(x){return e.fromByteArray(new Uint8Array(x))}t.bufferTob64=w;function g(x){return b(w(x))}t.bufferTob64Url=g;function b(x){return x.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=b;function M(x){x=x.replace(/\-/g,"+").replace(/\_/g,"/");let S;return x.length%4==0?S=0:S=4-x.length%4,x.concat("=".repeat(S))}t.b64UrlDecode=M}),vHe=Ic(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=vpe(),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 f=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),n=await this.driver.exportKey("jwk",f.privateKey);return{kty:n.kty,e:n.e,n:n.n,d:n.d,p:n.p,q:n.q,dp:n.dp,dq:n.dq,qi:n.qi}}async sign(f,n,{saltLength:h}={}){let p=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(f),n);return new Uint8Array(p)}async hash(f,n="SHA-256"){let h=await this.driver.digest(n,f);return new Uint8Array(h)}async verify(f,n,h){let p={kty:"RSA",e:"AQAB",n:f},v=await this.jwkToPublicCryptoKey(p),w=await this.driver.digest("SHA-256",n),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},v,h,n),b=await this.driver.verify({name:"RSA-PSS",saltLength:32},v,h,n),M=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((v.algorithm.modulusLength-1)/8)-w.byteLength-2},v,h,n);return g||b||M}async jwkToCryptoKey(f){return this.driver.importKey("jwk",f,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(f){return this.driver.importKey("jwk",f,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let f=crypto?.subtle;return f===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(n=>typeof f[n]=="function")}async encrypt(f,n,h){let p=await this.driver.importKey("raw",typeof n=="string"?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=new Uint8Array(16);crypto.getRandomValues(w);let g=await this.driver.encrypt({name:"AES-CBC",iv:w},v,f);return e.concatBuffers([w,g])}async decrypt(f,n,h){let p=await this.driver.importKey("raw",typeof n=="string"?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=f.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:w},v,f.slice(16));return e.concatBuffers([g])}};t.default=r}),mHe=Ic(t=>{t.read=function(e,r,f,n,h){var p,v,w=h*8-n-1,g=(1<<w)-1,b=g>>1,M=-7,x=f?h-1:0,S=f?-1:1,A=e[r+x];for(x+=S,p=A&(1<<-M)-1,A>>=-M,M+=w;M>0;p=p*256+e[r+x],x+=S,M-=8);for(v=p&(1<<-M)-1,p>>=-M,M+=n;M>0;v=v*256+e[r+x],x+=S,M-=8);if(p===0)p=1-b;else{if(p===g)return v?NaN:(A?-1:1)*(1/0);v=v+Math.pow(2,n),p=p-b}return(A?-1:1)*v*Math.pow(2,p-n)},t.write=function(e,r,f,n,h,p){var v,w,g,b=p*8-h-1,M=(1<<b)-1,x=M>>1,S=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:p-1,T=n?1:-1,k=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(w=isNaN(r)?1:0,v=M):(v=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-v))<1&&(v--,g*=2),v+x>=1?r+=S/g:r+=S*Math.pow(2,1-x),r*g>=2&&(v++,g/=2),v+x>=M?(w=0,v=M):v+x>=1?(w=(r*g-1)*Math.pow(2,h),v=v+x):(w=r*Math.pow(2,x-1)*Math.pow(2,h),v=0));h>=8;e[f+A]=w&255,A+=T,w/=256,h-=8);for(v=v<<h|w,b+=h;b>0;e[f+A]=v&255,A+=T,v/=256,b-=8);e[f+A-T]|=k*128}}),H$=Ic(t=>{"use strict";var e=ppe(),r=mHe(),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=v,t.SlowBuffer=C,t.INSPECT_MAX_BYTES=50;var n=2147483647;t.kMaxLength=n,v.TYPED_ARRAY_SUPPORT=h(),!v.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 h(){try{let P=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(P,O),P.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}}),Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function p(P){if(P>n)throw new RangeError('The value "'+P+'" is invalid for option "size"');let O=new Uint8Array(P);return Object.setPrototypeOf(O,v.prototype),O}function v(P,O,$){if(typeof P=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(P)}return w(P,O,$)}v.poolSize=8192;function w(P,O,$){if(typeof P=="string")return x(P,O);if(ArrayBuffer.isView(P))return A(P);if(P==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P);if(pt(P,ArrayBuffer)||P&&pt(P.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(pt(P,SharedArrayBuffer)||P&&pt(P.buffer,SharedArrayBuffer)))return T(P,O,$);if(typeof P=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let Z=P.valueOf&&P.valueOf();if(Z!=null&&Z!==P)return v.from(Z,O,$);let te=k(P);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof P[Symbol.toPrimitive]=="function")return v.from(P[Symbol.toPrimitive]("string"),O,$);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P)}v.from=function(P,O,$){return w(P,O,$)},Object.setPrototypeOf(v.prototype,Uint8Array.prototype),Object.setPrototypeOf(v,Uint8Array);function g(P){if(typeof P!="number")throw new TypeError('"size" argument must be of type number');if(P<0)throw new RangeError('The value "'+P+'" is invalid for option "size"')}function b(P,O,$){return g(P),P<=0?p(P):O!==void 0?typeof $=="string"?p(P).fill(O,$):p(P).fill(O):p(P)}v.alloc=function(P,O,$){return b(P,O,$)};function M(P){return g(P),p(P<0?0:B(P)|0)}v.allocUnsafe=function(P){return M(P)},v.allocUnsafeSlow=function(P){return M(P)};function x(P,O){if((typeof O!="string"||O==="")&&(O="utf8"),!v.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let $=N(P,O)|0,Z=p($),te=Z.write(P,O);return te!==$&&(Z=Z.slice(0,te)),Z}function S(P){let O=P.length<0?0:B(P.length)|0,$=p(O);for(let Z=0;Z<O;Z+=1)$[Z]=P[Z]&255;return $}function A(P){if(pt(P,Uint8Array)){let O=new Uint8Array(P);return T(O.buffer,O.byteOffset,O.byteLength)}return S(P)}function T(P,O,$){if(O<0||P.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(P.byteLength<O+($||0))throw new RangeError('"length" is outside of buffer bounds');let Z;return O===void 0&&$===void 0?Z=new Uint8Array(P):$===void 0?Z=new Uint8Array(P,O):Z=new Uint8Array(P,O,$),Object.setPrototypeOf(Z,v.prototype),Z}function k(P){if(v.isBuffer(P)){let O=B(P.length)|0,$=p(O);return $.length===0||P.copy($,0,0,O),$}if(P.length!==void 0)return typeof P.length!="number"||Me(P.length)?p(0):S(P);if(P.type==="Buffer"&&Array.isArray(P.data))return S(P.data)}function B(P){if(P>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return P|0}function C(P){return+P!=P&&(P=0),v.alloc(+P)}v.isBuffer=function(P){return P!=null&&P._isBuffer===!0&&P!==v.prototype},v.compare=function(P,O){if(pt(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),pt(O,Uint8Array)&&(O=v.from(O,O.offset,O.byteLength)),!v.isBuffer(P)||!v.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(P===O)return 0;let $=P.length,Z=O.length;for(let te=0,X=Math.min($,Z);te<X;++te)if(P[te]!==O[te]){$=P[te],Z=O[te];break}return $<Z?-1:Z<$?1:0},v.isEncoding=function(P){switch(String(P).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}},v.concat=function(P,O){if(!Array.isArray(P))throw new TypeError('"list" argument must be an Array of Buffers');if(P.length===0)return v.alloc(0);let $;if(O===void 0)for(O=0,$=0;$<P.length;++$)O+=P[$].length;let Z=v.allocUnsafe(O),te=0;for($=0;$<P.length;++$){let X=P[$];if(pt(X,Uint8Array))te+X.length>Z.length?(v.isBuffer(X)||(X=v.from(X)),X.copy(Z,te)):Uint8Array.prototype.set.call(Z,X,te);else if(v.isBuffer(X))X.copy(Z,te);else throw new TypeError('"list" argument must be an Array of Buffers');te+=X.length}return Z};function N(P,O){if(v.isBuffer(P))return P.length;if(ArrayBuffer.isView(P)||pt(P,ArrayBuffer))return P.byteLength;if(typeof P!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof P);let $=P.length,Z=arguments.length>2&&arguments[2]===!0;if(!Z&&$===0)return 0;let te=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return $;case"utf8":case"utf-8":return ie(P).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $*2;case"hex":return $>>>1;case"base64":return de(P).length;default:if(te)return Z?-1:ie(P).length;O=(""+O).toLowerCase(),te=!0}}v.byteLength=N;function W(P,O,$){let Z=!1;if((O===void 0||O<0)&&(O=0),O>this.length||(($===void 0||$>this.length)&&($=this.length),$<=0)||($>>>=0,O>>>=0,$<=O))return"";for(P||(P="utf8");;)switch(P){case"hex":return a(this,O,$);case"utf8":case"utf-8":return u(this,O,$);case"ascii":return _(this,O,$);case"latin1":case"binary":return c(this,O,$);case"base64":return s(this,O,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d(this,O,$);default:if(Z)throw new TypeError("Unknown encoding: "+P);P=(P+"").toLowerCase(),Z=!0}}v.prototype._isBuffer=!0;function H(P,O,$){let Z=P[O];P[O]=P[$],P[$]=Z}v.prototype.swap16=function(){let P=this.length;if(P%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<P;O+=2)H(this,O,O+1);return this},v.prototype.swap32=function(){let P=this.length;if(P%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<P;O+=4)H(this,O,O+3),H(this,O+1,O+2);return this},v.prototype.swap64=function(){let P=this.length;if(P%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<P;O+=8)H(this,O,O+7),H(this,O+1,O+6),H(this,O+2,O+5),H(this,O+3,O+4);return this},v.prototype.toString=function(){let P=this.length;return P===0?"":arguments.length===0?u(this,0,P):W.apply(this,arguments)},v.prototype.toLocaleString=v.prototype.toString,v.prototype.equals=function(P){if(!v.isBuffer(P))throw new TypeError("Argument must be a Buffer");return this===P?!0:v.compare(this,P)===0},v.prototype.inspect=function(){let P="",O=t.INSPECT_MAX_BYTES;return P=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(P+=" ... "),"<Buffer "+P+">"},f&&(v.prototype[f]=v.prototype.inspect),v.prototype.compare=function(P,O,$,Z,te){if(pt(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),!v.isBuffer(P))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof P);if(O===void 0&&(O=0),$===void 0&&($=P?P.length:0),Z===void 0&&(Z=0),te===void 0&&(te=this.length),O<0||$>P.length||Z<0||te>this.length)throw new RangeError("out of range index");if(Z>=te&&O>=$)return 0;if(Z>=te)return-1;if(O>=$)return 1;if(O>>>=0,$>>>=0,Z>>>=0,te>>>=0,this===P)return 0;let X=te-Z,ae=$-O,qe=Math.min(X,ae),ce=this.slice(Z,te),ge=P.slice(O,$);for(let xe=0;xe<qe;++xe)if(ce[xe]!==ge[xe]){X=ce[xe],ae=ge[xe];break}return X<ae?-1:ae<X?1:0};function J(P,O,$,Z,te){if(P.length===0)return-1;if(typeof $=="string"?(Z=$,$=0):$>2147483647?$=2147483647:$<-2147483648&&($=-2147483648),$=+$,Me($)&&($=te?0:P.length-1),$<0&&($=P.length+$),$>=P.length){if(te)return-1;$=P.length-1}else if($<0)if(te)$=0;else return-1;if(typeof O=="string"&&(O=v.from(O,Z)),v.isBuffer(O))return O.length===0?-1:U(P,O,$,Z,te);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(P,O,$):Uint8Array.prototype.lastIndexOf.call(P,O,$):U(P,[O],$,Z,te);throw new TypeError("val must be string, number or Buffer")}function U(P,O,$,Z,te){let X=1,ae=P.length,qe=O.length;if(Z!==void 0&&(Z=String(Z).toLowerCase(),Z==="ucs2"||Z==="ucs-2"||Z==="utf16le"||Z==="utf-16le")){if(P.length<2||O.length<2)return-1;X=2,ae/=2,qe/=2,$/=2}function ce(xe,be){return X===1?xe[be]:xe.readUInt16BE(be*X)}let ge;if(te){let xe=-1;for(ge=$;ge<ae;ge++)if(ce(P,ge)===ce(O,xe===-1?0:ge-xe)){if(xe===-1&&(xe=ge),ge-xe+1===qe)return xe*X}else xe!==-1&&(ge-=ge-xe),xe=-1}else for($+qe>ae&&($=ae-qe),ge=$;ge>=0;ge--){let xe=!0;for(let be=0;be<qe;be++)if(ce(P,ge+be)!==ce(O,be)){xe=!1;break}if(xe)return ge}return-1}v.prototype.includes=function(P,O,$){return this.indexOf(P,O,$)!==-1},v.prototype.indexOf=function(P,O,$){return J(this,P,O,$,!0)},v.prototype.lastIndexOf=function(P,O,$){return J(this,P,O,$,!1)};function j(P,O,$,Z){$=Number($)||0;let te=P.length-$;Z?(Z=Number(Z),Z>te&&(Z=te)):Z=te;let X=O.length;Z>X/2&&(Z=X/2);let ae;for(ae=0;ae<Z;++ae){let qe=parseInt(O.substr(ae*2,2),16);if(Me(qe))return ae;P[$+ae]=qe}return ae}function Y(P,O,$,Z){return ye(ie(O,P.length-$),P,$,Z)}function y(P,O,$,Z){return ye(oe(O),P,$,Z)}function i(P,O,$,Z){return ye(de(O),P,$,Z)}function o(P,O,$,Z){return ye(Pe(O,P.length-$),P,$,Z)}v.prototype.write=function(P,O,$,Z){if(O===void 0)Z="utf8",$=this.length,O=0;else if($===void 0&&typeof O=="string")Z=O,$=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite($)?($=$>>>0,Z===void 0&&(Z="utf8")):(Z=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let te=this.length-O;if(($===void 0||$>te)&&($=te),P.length>0&&($<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");Z||(Z="utf8");let X=!1;for(;;)switch(Z){case"hex":return j(this,P,O,$);case"utf8":case"utf-8":return Y(this,P,O,$);case"ascii":case"latin1":case"binary":return y(this,P,O,$);case"base64":return i(this,P,O,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o(this,P,O,$);default:if(X)throw new TypeError("Unknown encoding: "+Z);Z=(""+Z).toLowerCase(),X=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(P,O,$){return O===0&&$===P.length?e.fromByteArray(P):e.fromByteArray(P.slice(O,$))}function u(P,O,$){$=Math.min(P.length,$);let Z=[],te=O;for(;te<$;){let X=P[te],ae=null,qe=X>239?4:X>223?3:X>191?2:1;if(te+qe<=$){let ce,ge,xe,be;switch(qe){case 1:X<128&&(ae=X);break;case 2:ce=P[te+1],(ce&192)===128&&(be=(X&31)<<6|ce&63,be>127&&(ae=be));break;case 3:ce=P[te+1],ge=P[te+2],(ce&192)===128&&(ge&192)===128&&(be=(X&15)<<12|(ce&63)<<6|ge&63,be>2047&&(be<55296||be>57343)&&(ae=be));break;case 4:ce=P[te+1],ge=P[te+2],xe=P[te+3],(ce&192)===128&&(ge&192)===128&&(xe&192)===128&&(be=(X&15)<<18|(ce&63)<<12|(ge&63)<<6|xe&63,be>65535&&be<1114112&&(ae=be))}}ae===null?(ae=65533,qe=1):ae>65535&&(ae-=65536,Z.push(ae>>>10&1023|55296),ae=56320|ae&1023),Z.push(ae),te+=qe}return m(Z)}var l=4096;function m(P){let O=P.length;if(O<=l)return String.fromCharCode.apply(String,P);let $="",Z=0;for(;Z<O;)$+=String.fromCharCode.apply(String,P.slice(Z,Z+=l));return $}function _(P,O,$){let Z="";$=Math.min(P.length,$);for(let te=O;te<$;++te)Z+=String.fromCharCode(P[te]&127);return Z}function c(P,O,$){let Z="";$=Math.min(P.length,$);for(let te=O;te<$;++te)Z+=String.fromCharCode(P[te]);return Z}function a(P,O,$){let Z=P.length;(!O||O<0)&&(O=0),(!$||$<0||$>Z)&&($=Z);let te="";for(let X=O;X<$;++X)te+=Be[P[X]];return te}function d(P,O,$){let Z=P.slice(O,$),te="";for(let X=0;X<Z.length-1;X+=2)te+=String.fromCharCode(Z[X]+Z[X+1]*256);return te}v.prototype.slice=function(P,O){let $=this.length;P=~~P,O=O===void 0?$:~~O,P<0?(P+=$,P<0&&(P=0)):P>$&&(P=$),O<0?(O+=$,O<0&&(O=0)):O>$&&(O=$),O<P&&(O=P);let Z=this.subarray(P,O);return Object.setPrototypeOf(Z,v.prototype),Z};function R(P,O,$){if(P%1!==0||P<0)throw new RangeError("offset is not uint");if(P+O>$)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=this[P],te=1,X=0;for(;++X<O&&(te*=256);)Z+=this[P+X]*te;return Z},v.prototype.readUintBE=v.prototype.readUIntBE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=this[P+--O],te=1;for(;O>0&&(te*=256);)Z+=this[P+--O]*te;return Z},v.prototype.readUint8=v.prototype.readUInt8=function(P,O){return P=P>>>0,O||R(P,1,this.length),this[P]},v.prototype.readUint16LE=v.prototype.readUInt16LE=function(P,O){return P=P>>>0,O||R(P,2,this.length),this[P]|this[P+1]<<8},v.prototype.readUint16BE=v.prototype.readUInt16BE=function(P,O){return P=P>>>0,O||R(P,2,this.length),this[P]<<8|this[P+1]},v.prototype.readUint32LE=v.prototype.readUInt32LE=function(P,O){return P=P>>>0,O||R(P,4,this.length),(this[P]|this[P+1]<<8|this[P+2]<<16)+this[P+3]*16777216},v.prototype.readUint32BE=v.prototype.readUInt32BE=function(P,O){return P=P>>>0,O||R(P,4,this.length),this[P]*16777216+(this[P+1]<<16|this[P+2]<<8|this[P+3])},v.prototype.readBigUInt64LE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=O+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24,te=this[++P]+this[++P]*2**8+this[++P]*2**16+$*2**24;return BigInt(Z)+(BigInt(te)<<BigInt(32))}),v.prototype.readBigUInt64BE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=O*2**24+this[++P]*2**16+this[++P]*2**8+this[++P],te=this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+$;return(BigInt(Z)<<BigInt(32))+BigInt(te)}),v.prototype.readIntLE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=this[P],te=1,X=0;for(;++X<O&&(te*=256);)Z+=this[P+X]*te;return te*=128,Z>=te&&(Z-=Math.pow(2,8*O)),Z},v.prototype.readIntBE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=O,te=1,X=this[P+--Z];for(;Z>0&&(te*=256);)X+=this[P+--Z]*te;return te*=128,X>=te&&(X-=Math.pow(2,8*O)),X},v.prototype.readInt8=function(P,O){return P=P>>>0,O||R(P,1,this.length),this[P]&128?(255-this[P]+1)*-1:this[P]},v.prototype.readInt16LE=function(P,O){P=P>>>0,O||R(P,2,this.length);let $=this[P]|this[P+1]<<8;return $&32768?$|4294901760:$},v.prototype.readInt16BE=function(P,O){P=P>>>0,O||R(P,2,this.length);let $=this[P+1]|this[P]<<8;return $&32768?$|4294901760:$},v.prototype.readInt32LE=function(P,O){return P=P>>>0,O||R(P,4,this.length),this[P]|this[P+1]<<8|this[P+2]<<16|this[P+3]<<24},v.prototype.readInt32BE=function(P,O){return P=P>>>0,O||R(P,4,this.length),this[P]<<24|this[P+1]<<16|this[P+2]<<8|this[P+3]},v.prototype.readBigInt64LE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=this[P+4]+this[P+5]*2**8+this[P+6]*2**16+($<<24);return(BigInt(Z)<<BigInt(32))+BigInt(O+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24)}),v.prototype.readBigInt64BE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=(O<<24)+this[++P]*2**16+this[++P]*2**8+this[++P];return(BigInt(Z)<<BigInt(32))+BigInt(this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+$)}),v.prototype.readFloatLE=function(P,O){return P=P>>>0,O||R(P,4,this.length),r.read(this,P,!0,23,4)},v.prototype.readFloatBE=function(P,O){return P=P>>>0,O||R(P,4,this.length),r.read(this,P,!1,23,4)},v.prototype.readDoubleLE=function(P,O){return P=P>>>0,O||R(P,8,this.length),r.read(this,P,!0,52,8)},v.prototype.readDoubleBE=function(P,O){return P=P>>>0,O||R(P,8,this.length),r.read(this,P,!1,52,8)};function E(P,O,$,Z,te,X){if(!v.isBuffer(P))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>te||O<X)throw new RangeError('"value" argument is out of bounds');if($+Z>P.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(P,O,$,Z){if(P=+P,O=O>>>0,$=$>>>0,!Z){let ae=Math.pow(2,8*$)-1;E(this,P,O,$,ae,0)}let te=1,X=0;for(this[O]=P&255;++X<$&&(te*=256);)this[O+X]=P/te&255;return O+$},v.prototype.writeUintBE=v.prototype.writeUIntBE=function(P,O,$,Z){if(P=+P,O=O>>>0,$=$>>>0,!Z){let ae=Math.pow(2,8*$)-1;E(this,P,O,$,ae,0)}let te=$-1,X=1;for(this[O+te]=P&255;--te>=0&&(X*=256);)this[O+te]=P/X&255;return O+$},v.prototype.writeUint8=v.prototype.writeUInt8=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,1,255,0),this[O]=P&255,O+1},v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,65535,0),this[O]=P&255,this[O+1]=P>>>8,O+2},v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,65535,0),this[O]=P>>>8,this[O+1]=P&255,O+2},v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,4294967295,0),this[O+3]=P>>>24,this[O+2]=P>>>16,this[O+1]=P>>>8,this[O]=P&255,O+4},v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,4294967295,0),this[O]=P>>>24,this[O+1]=P>>>16,this[O+2]=P>>>8,this[O+3]=P&255,O+4};function I(P,O,$,Z,te){F(O,Z,te,P,$,7);let X=Number(O&BigInt(4294967295));P[$++]=X,X=X>>8,P[$++]=X,X=X>>8,P[$++]=X,X=X>>8,P[$++]=X;let ae=Number(O>>BigInt(32)&BigInt(4294967295));return P[$++]=ae,ae=ae>>8,P[$++]=ae,ae=ae>>8,P[$++]=ae,ae=ae>>8,P[$++]=ae,$}function D(P,O,$,Z,te){F(O,Z,te,P,$,7);let X=Number(O&BigInt(4294967295));P[$+7]=X,X=X>>8,P[$+6]=X,X=X>>8,P[$+5]=X,X=X>>8,P[$+4]=X;let ae=Number(O>>BigInt(32)&BigInt(4294967295));return P[$+3]=ae,ae=ae>>8,P[$+2]=ae,ae=ae>>8,P[$+1]=ae,ae=ae>>8,P[$]=ae,$+8}v.prototype.writeBigUInt64LE=gt(function(P,O=0){return I(this,P,O,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeBigUInt64BE=gt(function(P,O=0){return D(this,P,O,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeIntLE=function(P,O,$,Z){if(P=+P,O=O>>>0,!Z){let qe=Math.pow(2,8*$-1);E(this,P,O,$,qe-1,-qe)}let te=0,X=1,ae=0;for(this[O]=P&255;++te<$&&(X*=256);)P<0&&ae===0&&this[O+te-1]!==0&&(ae=1),this[O+te]=(P/X>>0)-ae&255;return O+$},v.prototype.writeIntBE=function(P,O,$,Z){if(P=+P,O=O>>>0,!Z){let qe=Math.pow(2,8*$-1);E(this,P,O,$,qe-1,-qe)}let te=$-1,X=1,ae=0;for(this[O+te]=P&255;--te>=0&&(X*=256);)P<0&&ae===0&&this[O+te+1]!==0&&(ae=1),this[O+te]=(P/X>>0)-ae&255;return O+$},v.prototype.writeInt8=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,1,127,-128),P<0&&(P=255+P+1),this[O]=P&255,O+1},v.prototype.writeInt16LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,32767,-32768),this[O]=P&255,this[O+1]=P>>>8,O+2},v.prototype.writeInt16BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,32767,-32768),this[O]=P>>>8,this[O+1]=P&255,O+2},v.prototype.writeInt32LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,2147483647,-2147483648),this[O]=P&255,this[O+1]=P>>>8,this[O+2]=P>>>16,this[O+3]=P>>>24,O+4},v.prototype.writeInt32BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,2147483647,-2147483648),P<0&&(P=4294967295+P+1),this[O]=P>>>24,this[O+1]=P>>>16,this[O+2]=P>>>8,this[O+3]=P&255,O+4},v.prototype.writeBigInt64LE=gt(function(P,O=0){return I(this,P,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),v.prototype.writeBigInt64BE=gt(function(P,O=0){return D(this,P,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function z(P,O,$,Z,te,X){if($+Z>P.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("Index out of range")}function re(P,O,$,Z,te){return O=+O,$=$>>>0,te||z(P,O,$,4,34028234663852886e22,-34028234663852886e22),r.write(P,O,$,Z,23,4),$+4}v.prototype.writeFloatLE=function(P,O,$){return re(this,P,O,!0,$)},v.prototype.writeFloatBE=function(P,O,$){return re(this,P,O,!1,$)};function Q(P,O,$,Z,te){return O=+O,$=$>>>0,te||z(P,O,$,8,17976931348623157e292,-17976931348623157e292),r.write(P,O,$,Z,52,8),$+8}v.prototype.writeDoubleLE=function(P,O,$){return Q(this,P,O,!0,$)},v.prototype.writeDoubleBE=function(P,O,$){return Q(this,P,O,!1,$)},v.prototype.copy=function(P,O,$,Z){if(!v.isBuffer(P))throw new TypeError("argument should be a Buffer");if($||($=0),!Z&&Z!==0&&(Z=this.length),O>=P.length&&(O=P.length),O||(O=0),Z>0&&Z<$&&(Z=$),Z===$||P.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(Z<0)throw new RangeError("sourceEnd out of bounds");Z>this.length&&(Z=this.length),P.length-O<Z-$&&(Z=P.length-O+$);let te=Z-$;return this===P&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,$,Z):Uint8Array.prototype.set.call(P,this.subarray($,Z),O),te},v.prototype.fill=function(P,O,$,Z){if(typeof P=="string"){if(typeof O=="string"?(Z=O,O=0,$=this.length):typeof $=="string"&&(Z=$,$=this.length),Z!==void 0&&typeof Z!="string")throw new TypeError("encoding must be a string");if(typeof Z=="string"&&!v.isEncoding(Z))throw new TypeError("Unknown encoding: "+Z);if(P.length===1){let X=P.charCodeAt(0);(Z==="utf8"&&X<128||Z==="latin1")&&(P=X)}}else typeof P=="number"?P=P&255:typeof P=="boolean"&&(P=Number(P));if(O<0||this.length<O||this.length<$)throw new RangeError("Out of range index");if($<=O)return this;O=O>>>0,$=$===void 0?this.length:$>>>0,P||(P=0);let te;if(typeof P=="number")for(te=O;te<$;++te)this[te]=P;else{let X=v.isBuffer(P)?P:v.from(P,Z),ae=X.length;if(ae===0)throw new TypeError('The value "'+P+'" is invalid for argument "value"');for(te=0;te<$-O;++te)this[te+O]=X[te%ae]}return this};var L={};function q(P,O,$){L[P]=class extends ${constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${P}]`,this.stack,delete this.name}get code(){return P}set code(Z){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Z,writable:!0})}toString(){return`${this.name} [${P}]: ${this.message}`}}}q("ERR_BUFFER_OUT_OF_BOUNDS",function(P){return P?`${P} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),q("ERR_INVALID_ARG_TYPE",function(P,O){return`The "${P}" argument must be of type number. Received type ${typeof O}`},TypeError),q("ERR_OUT_OF_RANGE",function(P,O,$){let Z=`The value of "${P}" is out of range.`,te=$;return Number.isInteger($)&&Math.abs($)>2**32?te=se(String($)):typeof $=="bigint"&&(te=String($),($>BigInt(2)**BigInt(32)||$<-(BigInt(2)**BigInt(32)))&&(te=se(te)),te+="n"),Z+=` It must be ${O}. Received ${te}`,Z},RangeError);function se(P){let O="",$=P.length,Z=P[0]==="-"?1:0;for(;$>=Z+4;$-=3)O=`_${P.slice($-3,$)}${O}`;return`${P.slice(0,$)}${O}`}function ee(P,O,$){K(O,"offset"),(P[O]===void 0||P[O+$]===void 0)&&G(O,P.length-($+1))}function F(P,O,$,Z,te,X){if(P>$||P<O){let ae=typeof O=="bigint"?"n":"",qe;throw X>3?O===0||O===BigInt(0)?qe=`>= 0${ae} and < 2${ae} ** ${(X+1)*8}${ae}`:qe=`>= -(2${ae} ** ${(X+1)*8-1}${ae}) and < 2 ** ${(X+1)*8-1}${ae}`:qe=`>= ${O}${ae} and <= ${$}${ae}`,new L.ERR_OUT_OF_RANGE("value",qe,P)}ee(Z,te,X)}function K(P,O){if(typeof P!="number")throw new L.ERR_INVALID_ARG_TYPE(O,"number",P)}function G(P,O,$){throw Math.floor(P)!==P?(K(P,$),new L.ERR_OUT_OF_RANGE($||"offset","an integer",P)):O<0?new L.ERR_BUFFER_OUT_OF_BOUNDS:new L.ERR_OUT_OF_RANGE($||"offset",`>= ${$?1:0} and <= ${O}`,P)}var ne=/[^+/0-9A-Za-z-_]/g;function Re(P){if(P=P.split("=")[0],P=P.trim().replace(ne,""),P.length<2)return"";for(;P.length%4!==0;)P=P+"=";return P}function ie(P,O){O=O||1/0;let $,Z=P.length,te=null,X=[];for(let ae=0;ae<Z;++ae){if($=P.charCodeAt(ae),$>55295&&$<57344){if(!te){if($>56319){(O-=3)>-1&&X.push(239,191,189);continue}else if(ae+1===Z){(O-=3)>-1&&X.push(239,191,189);continue}te=$;continue}if($<56320){(O-=3)>-1&&X.push(239,191,189),te=$;continue}$=(te-55296<<10|$-56320)+65536}else te&&(O-=3)>-1&&X.push(239,191,189);if(te=null,$<128){if((O-=1)<0)break;X.push($)}else if($<2048){if((O-=2)<0)break;X.push($>>6|192,$&63|128)}else if($<65536){if((O-=3)<0)break;X.push($>>12|224,$>>6&63|128,$&63|128)}else if($<1114112){if((O-=4)<0)break;X.push($>>18|240,$>>12&63|128,$>>6&63|128,$&63|128)}else throw new Error("Invalid code point")}return X}function oe(P){let O=[];for(let $=0;$<P.length;++$)O.push(P.charCodeAt($)&255);return O}function Pe(P,O){let $,Z,te,X=[];for(let ae=0;ae<P.length&&!((O-=2)<0);++ae)$=P.charCodeAt(ae),Z=$>>8,te=$%256,X.push(te),X.push(Z);return X}function de(P){return e.toByteArray(Re(P))}function ye(P,O,$,Z){let te;for(te=0;te<Z&&!(te+$>=O.length||te>=P.length);++te)O[te+$]=P[te];return te}function pt(P,O){return P instanceof O||P!=null&&P.constructor!=null&&P.constructor.name!=null&&P.constructor.name===O.name}function Me(P){return P!==P}var Be=function(){let P="0123456789abcdef",O=new Array(256);for(let $=0;$<16;++$){let Z=$*16;for(let te=0;te<16;++te)O[Z+te]=P[$]+P[te]}return O}();function gt(P){return typeof BigInt>"u"?V:P}function V(){throw new Error("BigInt not supported")}}),gHe=Ic((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:H$().Buffer,Crypto:window.crypto}):e.exports={Buffer:H$().Buffer,Crypto:crypto}}),mpe={};lHe(mpe,{AVSCTap:()=>S6,ArweaveSigner:()=>mL,DataItem:()=>y6,MAX_TAG_BYTES:()=>c_,MIN_BINARY_SIZE:()=>yL,SIG_CONFIG:()=>cg,SignatureConfig:()=>eu,Signer:()=>gpe,createData:()=>_pe,deserializeTags:()=>r_,indexToType:()=>gL,serializeTags:()=>bL,tagsExceedLimit:()=>wpe});var gpe=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,f){throw new Error("You must implement verify method on child")}},bHe=N1(vL(),1),th=N1(vpe(),1);async function bpe(t){if(Array.isArray(t)){let n=(0,th.concatBuffers)([(0,th.stringToBuffer)("list"),(0,th.stringToBuffer)(t.length.toString())]);return await ype(t,await Ec().hash(n,"SHA-384"))}let e=t,r=(0,th.concatBuffers)([(0,th.stringToBuffer)("blob"),(0,th.stringToBuffer)(e.byteLength.toString())]),f=(0,th.concatBuffers)([await Ec().hash(r,"SHA-384"),await Ec().hash(e,"SHA-384")]);return await Ec().hash(f,"SHA-384")}async function ype(t,e){if(t.length<1)return e;let r=(0,th.concatBuffers)([e,await bpe(t[0])]),f=await Ec().hash(r,"SHA-384");return await ype(t.slice(1),f)}var w$=N1(vHe(),1),yHe=w$.default.default?w$.default.default:w$.default,wHe=class extends yHe{getPublicKey(t){throw new Error("Unimplemented")}},_He;function Ec(){return _He??=new wHe}var eu;(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"})(eu||(eu={}));var cg={[eu.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[eu.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[eu.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[eu.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[eu.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[eu.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[eu.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},mL=class{signatureType=1;ownerLength=cg[1].pubLength;signatureLength=cg[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return bHe.default.toBuffer(this.pk)}sign(t){return Ec().sign(this.jwk,t)}static async verify(t,e,r){return await Ec().verify(t,e,r)}},gL={1:mL},cl=N1(vL(),1);async function W$(t){return bpe([(0,th.stringToBuffer)("dataitem"),(0,th.stringToBuffer)("1"),(0,th.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function MHe(t,e){let r=await W$(t),f=await e.sign(r),n=await Ec().hash(f);return{signature:Te.from(f),id:Te.from(n)}}async function xHe(t,e){let{signature:r,id:f}=await MHe(t,e);return t.getRaw().set(r,2),f}var S6=class{buf;pos;constructor(t=Te.alloc(c_),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 f=t[r];if(f?.name===void 0||f?.value===void 0)throw new Error(`Invalid tag format for ${f}, expected {name:string, value: string}`);this.writeString(f.name),this.writeString(f.value)}this.writeLong(0)}toBuffer(){let t=Te.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,f;if(t>=-1073741824&&t<1073741824){f=t>=0?t<<1:~t<<1|1;do e[this.pos]=f&127,f>>=7;while(f&&(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=Te.byteLength(t),r=this.buf;this.writeLong(e);let f=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let n,h,p,v;for(n=0,h=e;n<h;n++)p=t.charCodeAt(n),p<128?r[f++]=p:p<2048?(r[f++]=p>>6|192,r[f++]=p&63|128):(p&64512)===55296&&((v=t.charCodeAt(n+1))&64512)===56320?(p=65536+((p&1023)<<10)+(v&1023),n++,r[f++]=p>>18|240,r[f++]=p>>12&63|128,r[f++]=p>>6&63|128,r[f++]=p&63|128):(r[f++]=p>>12|224,r[f++]=p>>6&63|128,r[f++]=p&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,f,n,h,p;do f=r[this.pos++],n=f&128,t|=(f&127)<<e,e+=7;while(n&&e<28);if(n){h=t,p=268435456;do f=r[this.pos++],h+=(f&127)*p,p*=128;while(f&128);return(h%2?-(h+1):h)/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(),f=this.readString();t.push({name:r,value:f})}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 bL(t){let e=new S6;return e.writeTags(t),e.toBuffer()}function wpe(t){let e=new S6;return e.writeTags(t),e.tagsExceedLimit()}function r_(t){return new S6(t).readTags()}function fd(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function SHe(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let f=t&255;e[r]=f,t=(t-f)/256}return Uint8Array.from(e)}function L0e(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let f=t&255;e[r]=f,t=(t-f)/256}return Uint8Array.from(e)}var EHe=N1(gHe(),1),Km=N1(H$(),1),c_=4096,yL=80,y6=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=fd(this.binary.subarray(0,2));if(eu?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return y6.verify(this.binary)}get id(){return(async()=>cl.default.encode(await this.rawId))()}set id(t){this._id=cl.default.toBuffer(t)}get rawId(){return(async()=>Km.Buffer.from(await EHe.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 cl.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 cg[this.signatureType].sigLength}get owner(){return cl.default.encode(this.rawOwner)}get ownerLength(){return cg[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Km.Buffer.alloc(0)}get target(){return cl.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Km.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=fd(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(fd(this.binary.subarray(t,t+8))==0)return[];let e=fd(this.binary.subarray(t+8,t+16));return r_(Km.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:cl.default.encode(t.name),value:cl.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=fd(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=fd(e),f=t+16+r;return this.binary.subarray(f,this.binary.length)}get data(){return cl.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await xHe(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Km.Buffer.from(await Ec().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:cl.default.encode(t.name),value:cl.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<yL)return!1;let e=new y6(t),r=e.signatureType,f=e.getTagsStart(),n=fd(t.subarray(f,f+8)),h=t.subarray(f+8,f+16),p=fd(h);if(p>c_)return!1;if(n>0)try{if(r_(Km.Buffer.from(t.subarray(f+16,f+16+p))).length!==n)return!1}catch{return!1}let v=gL[r],w=await W$(e);return await v.verify(e.rawOwner,w,e.rawSignature)}async getSignatureData(){return W$(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),f=this.binary[r]==1;return r+=f?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}},AHe=N1(vL(),1);function _pe(t,e,r){let f=e.publicKey,n=r?.target?AHe.default.toBuffer(r.target):null,h=1+(n?.byteLength??0),p=r?.anchor?Te.from(r.anchor):null,v=1+(p?.byteLength??0),w=(r?.tags?.length??0)>0?bL(r.tags):null,g=16+(w?w.byteLength:0),b=Te.from(t),M=b.byteLength,x=2+e.signatureLength+e.ownerLength+h+v+g+M,S=Te.alloc(x);if(S.set(SHe(e.signatureType),0),S.set(new Uint8Array(e.signatureLength).fill(0),2),f.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${f.byteLength}`);S.set(f,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(S[A]=n?1:0,n){if(n.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${n.byteLength}`);S.set(n,A+1)}let T=A+h,k=T+1;if(S[T]=p?1:0,p){if(k+=p.byteLength,p.byteLength!==32)throw new Error("Anchor must be 32 bytes");S.set(p,T+1)}S.set(L0e(r?.tags?.length??0),k);let B=L0e(w?.byteLength??0);S.set(B,k+8),w&&S.set(w,k+16);let C=k+g;return S.set(b,C),new y6(S)}var wL={...mpe};globalThis.arbundles??=wL;var RHe=wL,THe=wL;globalThis.Buffer||(globalThis.Buffer=cpe.Buffer);var{DataItem:IHe}=dpe;function kHe(t){return async({data:r,tags:f,target:n,anchor:h,createDataItem:p=v=>new IHe(v)})=>{let v=await t.signDataItem({data:r,tags:f,target:n,anchor:h}),w=p(cpe.Buffer.from(v));return{id:await w.id,raw:await w.getRaw()}}}var BHe=globalThis.GATEWAY_URL||void 0,PHe=globalThis.MU_URL||void 0,OHe=globalThis.CU_URL||void 0,NHe=globalThis.GRAPHQL_URL||void 0,{result:V_t,results:G_t,message:Y_t,spawn:J_t,monitor:X_t,unmonitor:Q_t,dryrun:e9t,assign:t9t}=ou({GATEWAY_URL:BHe,MU_URL:PHe,CU_URL:OHe,GRAPHQL_URL:NHe}),Mpe=lpe.createDataItemSigner;fe();he();ue();var v1e=zi(p1e(),1),__=v1e.default.init({host:"arweave.net",port:443,protocol:"https"});fe();he();ue();fe();he();ue();var fh=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},m1e=class extends fh{},g1e=class extends fh{},b1e=class extends fh{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},y1e=class extends fh{},M_=class extends fh{},w1e=class extends fh{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},wl=class extends fh{constructor(){super("Invalid contract configuration")}},_1e=class extends fh{constructor(){super("Invalid process configuration")}},M1e=class extends fh{};fe();he();ue();var mh=zi(k6e(),1);fe();he();ue();var Lg="3.11.0-alpha.1";var ys=class t{logger;silent=!1;static default=new t;constructor({level:e="info"}={}){e==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,mh.createLogger)({level:e,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:Lg},format:mh.format.combine(mh.format.timestamp(),mh.format.json()),transports:[new mh.transports.Console({format:mh.format.combine(mh.format.timestamp(),mh.format.json())})]})}info(e,...r){this.silent||this.logger.info(e,...r)}warn(e,...r){this.silent||this.logger.warn(e,...r)}error(e,...r){this.silent||this.logger.error(e,...r)}debug(e,...r){this.silent||this.logger.debug(e,...r)}setLogLevel(e){this.silent=e==="none","silent"in this.logger&&(this.logger.silent=e==="none"),"level"in this.logger&&(this.logger.level=e)}};fe();he();ue();fe();he();ue();var B6e=t=>{let e=Object.entries(t).sort(([r,f],[n,h])=>r==="@"?-1:n==="@"?1:"priority"in f&&!("priority"in h)?-1:!("priority"in f)&&"priority"in h?1:f.priority!==void 0&&h.priority!==void 0?f.priority===h.priority?r<n?-1:r>n?1:0:f.priority-h.priority:r<n?-1:r>n?1:0);return Object.fromEntries(e.map(([r,f],n)=>[r,{...f,index:n}]))};fe();he();ue();function Al(t,e){let r=t.safeParse(e);if(!r.success)throw new Error(JSON.stringify(r.error.format(),null,2));return r}fe();he();ue();fe();he();ue();fe();he();ue();Cu();var P6e="+",O6e="/",N6e="-",C6e="_",$6e="=";function qat(t){let e=t.length%4;return e&&(t+=$6e.repeat(4-e)),t.replaceAll(N6e,P6e).replaceAll(C6e,O6e)}function Fat(t){return t.replaceAll(P6e,N6e).replaceAll(O6e,C6e).replaceAll($6e,"")}function TPt(t){let e=qat(t);return Te.from(e,"base64")}function Dg(t){let e=t.toString("base64");return Fat(e)}function IPt(t){return Dg(Nu("sha256").update(Uint8Array.from(t)).digest())}function L6e(t=32){let e=VB(t);return Array.from(e,r=>r.toString(16).padStart(2,"0")).join("").slice(0,t)}fe();he();ue();fe();he();ue();function Tq(t){try{return JSON.parse(t)}catch{return t}}fe();he();ue();fe();he();ue();var kq=zi(U6e(),1);fe();he();ue();var Hat=Object.defineProperty,Wat=(t,e,r)=>e in t?Hat(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b3=(t,e,r)=>(Wat(t,typeof e!="symbol"?e+"":e,r),r),Bq=class{constructor(e){b3(this,"value"),b3(this,"next"),this.value=e}},Pq=class{constructor(){b3(this,"head"),b3(this,"tail"),b3(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let r=new Bq(e);return this.head&&this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function q6e(t){if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new Pq,r=0,f=()=>{r--,e.size>0&&e.pop()()},n=async(v,w,g)=>{r++;let b=(async()=>v(...g))();w(b);try{await b}catch{}f()},h=(v,w,g)=>{e.push(n.bind(null,v,w,g)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.pop()()))()},p=(v,...w)=>new Promise(g=>{h(v,g,w)});return Object.defineProperties(p,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),p}fe();he();ue();var y3=class{static init(e){return e!==void 0&&"signer"in e?new Oq(e):new B9(e)}},B9=class{process;constructor(e){if(e===void 0||Object.keys(e).length===0)this.process=new oa({processId:Hm});else if(Ed(e))this.process=e.process;else if(Ad(e))this.process=new oa({processId:e.processId});else throw new wl}async accessControlList({address:e}){return this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:e}]})}},Oq=class extends B9{signer;constructor({signer:e,...r}){super(r),this.signer=Sd(e)}async register({processId:e}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:e}],signer:this.signer})}};fe();he();ue();fe();he();ue();var Kat="https://faucet.ario.permaweb.services";function Cq({arioInstance:t,faucetApiUrl:e=Kat}){let r=new Nq({faucetUrl:e,processId:t.process.processId});return new Proxy(t,{get(n,h){if(h==="faucet")return r;if(h in n){let p=n[h];return typeof p=="function"?p.bind(n):p}}})}var Nq=class{faucetUrl;processId;constructor({faucetUrl:e,processId:r}){this.faucetUrl=e,this.processId=r}async captchaUrl(){let e=await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`,{method:"GET"});if(!e.ok){let f=await e.json().catch(()=>({error:e.statusText}));throw new Error(f.error)}return await e.json()}async claimWithCaptchaResponse({captchaResponse:e,recipient:r,quantity:f}){let n=await fetch(`${this.faucetUrl}/api/claim/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,recipient:r,quantity:f,captchaResponse:e})});if(!n.ok){let p=await n.json().catch(()=>({error:n.statusText}));throw new Error(p.error)}return await n.json()}async requestAuthToken({captchaResponse:e}){let r=await fetch(`${this.faucetUrl}/api/captcha/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,captchaResponse:e})});if(!r.ok){let n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error)}return await r.json()}async claimWithAuthToken({authToken:e,recipient:r,quantity:f}){let n=await fetch(`${this.faucetUrl}/api/claim/async`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({recipient:r,qty:f,processId:this.processId})});if(!n.ok){let p=await n.json().catch(()=>({error:n.statusText}));throw new Error(p.error)}return await n.json()}async verifyAuthToken({authToken:e}){let r=await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!r.ok){let n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error)}return await r.json()}};fe();he();ue();fe();he();ue();fe();he();ue();var po=[];for(P9=0;P9<256;++P9)po.push((P9+256).toString(16).slice(1));var P9;function F6e(t,e=0){return(po[t[e+0]]+po[t[e+1]]+po[t[e+2]]+po[t[e+3]]+"-"+po[t[e+4]]+po[t[e+5]]+"-"+po[t[e+6]]+po[t[e+7]]+"-"+po[t[e+8]]+po[t[e+9]]+"-"+po[t[e+10]]+po[t[e+11]]+po[t[e+12]]+po[t[e+13]]+po[t[e+14]]+po[t[e+15]]).toLowerCase()}fe();he();ue();var O9,Zat=new Uint8Array(16);function $q(){if(!O9&&(O9=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O9))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O9(Zat)}fe();he();ue();fe();he();ue();var Vat=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Lq={randomUUID:Vat};function Gat(t,e,r){if(Lq.randomUUID&&!e&&!t)return Lq.randomUUID();t=t||{};var f=t.random||(t.rng||$q)();if(f[6]=f[6]&15|64,f[8]=f[8]&63|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=f[n];return e}return F6e(f)}var Dq=Gat;fe();he();ue();var Uq=class t{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new t(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new t(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},qq=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMARIO(){return new w3(Math.floor(this.value*u$))}toString(){return`${this.value}`}},w3=class t extends Uq{constructor(e){super(e)}multiply(e){let r=Math.floor(this.valueOf()*e.valueOf());return new t(r)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/e.valueOf());return new t(r)}plus(e){let r=super.plus(e);return new t(r.valueOf())}minus(e){let r=super.minus(e);return new t(r.valueOf())}toARIO(){return new qq(this.valueOf()/u$)}};fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();function _3(t,e){return function(){return t.apply(e,arguments)}}var{toString:Yat}=Object.prototype,{getPrototypeOf:jq}=Object,C9=(t=>e=>{let r=Yat.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),gh=t=>(t=t.toLowerCase(),e=>C9(e)===t),$9=t=>e=>typeof e===t,{isArray:Ug}=Array,M3=$9("undefined");function Jat(t){return t!==null&&!M3(t)&&t.constructor!==null&&!M3(t.constructor)&&Ys(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var z6e=gh("ArrayBuffer");function Xat(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&z6e(t.buffer),e}var Qat=$9("string"),Ys=$9("function"),H6e=$9("number"),L9=t=>t!==null&&typeof t=="object",eot=t=>t===!0||t===!1,N9=t=>{if(C9(t)!=="object")return!1;let e=jq(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},tot=gh("Date"),rot=gh("File"),iot=gh("Blob"),not=gh("FileList"),aot=t=>L9(t)&&Ys(t.pipe),oot=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ys(t.append)&&((e=C9(t))==="formdata"||e==="object"&&Ys(t.toString)&&t.toString()==="[object FormData]"))},sot=gh("URLSearchParams"),[fot,uot,hot,lot]=["ReadableStream","Request","Response","Headers"].map(gh),cot=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function x3(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let f,n;if(typeof t!="object"&&(t=[t]),Ug(t))for(f=0,n=t.length;f<n;f++)e.call(null,t[f],f,t);else{let h=r?Object.getOwnPropertyNames(t):Object.keys(t),p=h.length,v;for(f=0;f<p;f++)v=h[f],e.call(null,t[v],v,t)}}function W6e(t,e){e=e.toLowerCase();let r=Object.keys(t),f=r.length,n;for(;f-- >0;)if(n=r[f],e===n.toLowerCase())return n;return null}var Q1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,K6e=t=>!M3(t)&&t!==Q1;function Fq(){let{caseless:t}=K6e(this)&&this||{},e={},r=(f,n)=>{let h=t&&W6e(e,n)||n;N9(e[h])&&N9(f)?e[h]=Fq(e[h],f):N9(f)?e[h]=Fq({},f):Ug(f)?e[h]=f.slice():e[h]=f};for(let f=0,n=arguments.length;f<n;f++)arguments[f]&&x3(arguments[f],r);return e}var dot=(t,e,r,{allOwnKeys:f}={})=>(x3(e,(n,h)=>{r&&Ys(n)?t[h]=_3(n,r):t[h]=n},{allOwnKeys:f}),t),pot=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),vot=(t,e,r,f)=>{t.prototype=Object.create(e.prototype,f),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},mot=(t,e,r,f)=>{let n,h,p,v={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),h=n.length;h-- >0;)p=n[h],(!f||f(p,t,e))&&!v[p]&&(e[p]=t[p],v[p]=!0);t=r!==!1&&jq(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},got=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let f=t.indexOf(e,r);return f!==-1&&f===r},bot=t=>{if(!t)return null;if(Ug(t))return t;let e=t.length;if(!H6e(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},yot=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&jq(Uint8Array)),wot=(t,e)=>{let f=(t&&t[Symbol.iterator]).call(t),n;for(;(n=f.next())&&!n.done;){let h=n.value;e.call(t,h[0],h[1])}},_ot=(t,e)=>{let r,f=[];for(;(r=t.exec(e))!==null;)f.push(r);return f},Mot=gh("HTMLFormElement"),xot=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,f,n){return f.toUpperCase()+n}),j6e=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Sot=gh("RegExp"),Z6e=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),f={};x3(r,(n,h)=>{let p;(p=e(n,h,t))!==!1&&(f[h]=p||n)}),Object.defineProperties(t,f)},Eot=t=>{Z6e(t,(e,r)=>{if(Ys(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let f=t[r];if(Ys(f)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Aot=(t,e)=>{let r={},f=n=>{n.forEach(h=>{r[h]=!0})};return Ug(t)?f(t):f(String(t).split(e)),r},Rot=()=>{},Tot=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Iot(t){return!!(t&&Ys(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var kot=t=>{let e=new Array(10),r=(f,n)=>{if(L9(f)){if(e.indexOf(f)>=0)return;if(!("toJSON"in f)){e[n]=f;let h=Ug(f)?[]:{};return x3(f,(p,v)=>{let w=r(p,n+1);!M3(w)&&(h[v]=w)}),e[n]=void 0,h}}return f};return r(t,0)},Bot=gh("AsyncFunction"),Pot=t=>t&&(L9(t)||Ys(t))&&Ys(t.then)&&Ys(t.catch),V6e=((t,e)=>t?setImmediate:e?((r,f)=>(Q1.addEventListener("message",({source:n,data:h})=>{n===Q1&&h===r&&f.length&&f.shift()()},!1),n=>{f.push(n),Q1.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ys(Q1.postMessage)),Oot=typeof queueMicrotask<"u"?queueMicrotask.bind(Q1):typeof Le<"u"&&Le.nextTick||V6e,Tt={isArray:Ug,isArrayBuffer:z6e,isBuffer:Jat,isFormData:oot,isArrayBufferView:Xat,isString:Qat,isNumber:H6e,isBoolean:eot,isObject:L9,isPlainObject:N9,isReadableStream:fot,isRequest:uot,isResponse:hot,isHeaders:lot,isUndefined:M3,isDate:tot,isFile:rot,isBlob:iot,isRegExp:Sot,isFunction:Ys,isStream:aot,isURLSearchParams:sot,isTypedArray:yot,isFileList:not,forEach:x3,merge:Fq,extend:dot,trim:cot,stripBOM:pot,inherits:vot,toFlatObject:mot,kindOf:C9,kindOfTest:gh,endsWith:got,toArray:bot,forEachEntry:wot,matchAll:_ot,isHTMLForm:Mot,hasOwnProperty:j6e,hasOwnProp:j6e,reduceDescriptors:Z6e,freezeMethods:Eot,toObjectSet:Aot,toCamelCase:xot,noop:Rot,toFiniteNumber:Tot,findKey:W6e,global:Q1,isContextDefined:K6e,isSpecCompliantForm:Iot,toJSONObject:kot,isAsyncFn:Bot,isThenable:Pot,setImmediate:V6e,asap:Oot};fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();function qg(t,e,r,f,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),f&&(this.request=f),n&&(this.response=n,this.status=n.status?n.status:null)}Tt.inherits(qg,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Tt.toJSONObject(this.config),code:this.code,status:this.status}}});var G6e=qg.prototype,Y6e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Y6e[t]={value:t}});Object.defineProperties(qg,Y6e);Object.defineProperty(G6e,"isAxiosError",{value:!0});qg.from=(t,e,r,f,n,h)=>{let p=Object.create(G6e);return Tt.toFlatObject(t,p,function(w){return w!==Error.prototype},v=>v!=="isAxiosError"),qg.call(p,t.message,e,r,f,n),p.cause=t,p.name=t.name,h&&Object.assign(p,h),p};var Fr=qg;fe();he();ue();var D9=null;function zq(t){return Tt.isPlainObject(t)||Tt.isArray(t)}function X6e(t){return Tt.endsWith(t,"[]")?t.slice(0,-2):t}function J6e(t,e,r){return t?t.concat(e).map(function(n,h){return n=X6e(n),!r&&h?"["+n+"]":n}).join(r?".":""):e}function Not(t){return Tt.isArray(t)&&!t.some(zq)}var Cot=Tt.toFlatObject(Tt,{},null,function(e){return/^is[A-Z]/.test(e)});function $ot(t,e,r){if(!Tt.isObject(t))throw new TypeError("target must be an object");e=e||new(D9||FormData),r=Tt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,k){return!Tt.isUndefined(k[T])});let f=r.metaTokens,n=r.visitor||b,h=r.dots,p=r.indexes,w=(r.Blob||typeof Blob<"u"&&Blob)&&Tt.isSpecCompliantForm(e);if(!Tt.isFunction(n))throw new TypeError("visitor must be a function");function g(A){if(A===null)return"";if(Tt.isDate(A))return A.toISOString();if(!w&&Tt.isBlob(A))throw new Fr("Blob is not supported. Use a Buffer instead.");return Tt.isArrayBuffer(A)||Tt.isTypedArray(A)?w&&typeof Blob=="function"?new Blob([A]):Te.from(A):A}function b(A,T,k){let B=A;if(A&&!k&&typeof A=="object"){if(Tt.endsWith(T,"{}"))T=f?T:T.slice(0,-2),A=JSON.stringify(A);else if(Tt.isArray(A)&&Not(A)||(Tt.isFileList(A)||Tt.endsWith(T,"[]"))&&(B=Tt.toArray(A)))return T=X6e(T),B.forEach(function(N,W){!(Tt.isUndefined(N)||N===null)&&e.append(p===!0?J6e([T],W,h):p===null?T:T+"[]",g(N))}),!1}return zq(A)?!0:(e.append(J6e(k,T,h),g(A)),!1)}let M=[],x=Object.assign(Cot,{defaultVisitor:b,convertValue:g,isVisitable:zq});function S(A,T){if(!Tt.isUndefined(A)){if(M.indexOf(A)!==-1)throw Error("Circular reference detected in "+T.join("."));M.push(A),Tt.forEach(A,function(B,C){(!(Tt.isUndefined(B)||B===null)&&n.call(e,B,Tt.isString(C)?C.trim():C,T,x))===!0&&S(B,T?T.concat(C):[C])}),M.pop()}}if(!Tt.isObject(t))throw new TypeError("data must be an object");return S(t),e}var Rd=$ot;function Q6e(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(f){return e[f]})}function e3e(t,e){this._pairs=[],t&&Rd(t,this,e)}var t3e=e3e.prototype;t3e.append=function(e,r){this._pairs.push([e,r])};t3e.toString=function(e){let r=e?function(f){return e.call(this,f,Q6e)}:Q6e;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var U9=e3e;function Lot(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function S3(t,e,r){if(!e)return t;let f=r&&r.encode||Lot;Tt.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,h;if(n?h=n(e,r):h=Tt.isURLSearchParams(e)?e.toString():new U9(e,r).toString(f),h){let p=t.indexOf("#");p!==-1&&(t=t.slice(0,p)),t+=(t.indexOf("?")===-1?"?":"&")+h}return t}fe();he();ue();var Hq=class{constructor(){this.handlers=[]}use(e,r,f){return this.handlers.push({fulfilled:e,rejected:r,synchronous:f?f.synchronous:!1,runWhen:f?f.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Tt.forEach(this.handlers,function(f){f!==null&&e(f)})}},Wq=Hq;fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();var q9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();var r3e=typeof URLSearchParams<"u"?URLSearchParams:U9;fe();he();ue();var i3e=typeof FormData<"u"?FormData:null;fe();he();ue();var n3e=typeof Blob<"u"?Blob:null;var a3e={isBrowser:!0,classes:{URLSearchParams:r3e,FormData:i3e,Blob:n3e},protocols:["http","https","file","blob","url","data"]};var Vq={};$o(Vq,{hasBrowserEnv:()=>Zq,hasStandardBrowserEnv:()=>Dot,hasStandardBrowserWebWorkerEnv:()=>Uot,navigator:()=>Kq,origin:()=>qot});fe();he();ue();var Zq=typeof window<"u"&&typeof document<"u",Kq=typeof navigator=="object"&&navigator||void 0,Dot=Zq&&(!Kq||["ReactNative","NativeScript","NS"].indexOf(Kq.product)<0),Uot=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qot=Zq&&window.location.href||"http://localhost";var Kn={...Vq,...a3e};function Gq(t,e){return Rd(t,new Kn.classes.URLSearchParams,Object.assign({visitor:function(r,f,n,h){return Kn.isNode&&Tt.isBuffer(r)?(this.append(f,r.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)}},e))}fe();he();ue();function Fot(t){return Tt.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function jot(t){let e={},r=Object.keys(t),f,n=r.length,h;for(f=0;f<n;f++)h=r[f],e[h]=t[h];return e}function zot(t){function e(r,f,n,h){let p=r[h++];if(p==="__proto__")return!0;let v=Number.isFinite(+p),w=h>=r.length;return p=!p&&Tt.isArray(n)?n.length:p,w?(Tt.hasOwnProp(n,p)?n[p]=[n[p],f]:n[p]=f,!v):((!n[p]||!Tt.isObject(n[p]))&&(n[p]=[]),e(r,f,n[p],h)&&Tt.isArray(n[p])&&(n[p]=jot(n[p])),!v)}if(Tt.isFormData(t)&&Tt.isFunction(t.entries)){let r={};return Tt.forEachEntry(t,(f,n)=>{e(Fot(f),n,r,0)}),r}return null}var F9=zot;function Hot(t,e,r){if(Tt.isString(t))try{return(e||JSON.parse)(t),Tt.trim(t)}catch(f){if(f.name!=="SyntaxError")throw f}return(r||JSON.stringify)(t)}var Yq={transitional:q9,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let f=r.getContentType()||"",n=f.indexOf("application/json")>-1,h=Tt.isObject(e);if(h&&Tt.isHTMLForm(e)&&(e=new FormData(e)),Tt.isFormData(e))return n?JSON.stringify(F9(e)):e;if(Tt.isArrayBuffer(e)||Tt.isBuffer(e)||Tt.isStream(e)||Tt.isFile(e)||Tt.isBlob(e)||Tt.isReadableStream(e))return e;if(Tt.isArrayBufferView(e))return e.buffer;if(Tt.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let v;if(h){if(f.indexOf("application/x-www-form-urlencoded")>-1)return Gq(e,this.formSerializer).toString();if((v=Tt.isFileList(e))||f.indexOf("multipart/form-data")>-1){let w=this.env&&this.env.FormData;return Rd(v?{"files[]":e}:e,w&&new w,this.formSerializer)}}return h||n?(r.setContentType("application/json",!1),Hot(e)):e}],transformResponse:[function(e){let r=this.transitional||Yq.transitional,f=r&&r.forcedJSONParsing,n=this.responseType==="json";if(Tt.isResponse(e)||Tt.isReadableStream(e))return e;if(e&&Tt.isString(e)&&(f&&!this.responseType||n)){let p=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(v){if(p)throw v.name==="SyntaxError"?Fr.from(v,Fr.ERR_BAD_RESPONSE,this,null,this.response):v}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Kn.classes.FormData,Blob:Kn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Tt.forEach(["delete","get","head","post","put","patch"],t=>{Yq.headers[t]={}});var Fg=Yq;fe();he();ue();fe();he();ue();var Wot=Tt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),o3e=t=>{let e={},r,f,n;return t&&t.split(`
|
|
212
|
+
}`,n=kt.object({data:kt.object({transactions:kt.object({edges:kt.array(kt.object({node:kt.record(kt.any())}))})})});return h=>di(h).chain(gn(p=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:f,variables:{transactionIds:[p]}})}).then(async v=>{if(v.ok)return v.json();throw r('Error Encountered when querying gateway for transaction "%s"',p),new Error(`${v.status}: ${await v.text()}`)}).then(n.parse).then(ije(["data","transactions","edges","0","node"])))).toPromise()}var pze=Z$(MLe(),1),spe=(t="@permaweb/aoconnect")=>{let e=(0,pze.default)(t);return e.child=r=>spe(`${e.namespace}:${r}`),e.tap=(r,...f)=>hje((...n)=>e(r,...f,...n)),e},fpe=({url:t,path:e})=>e?e.startsWith("/")?fpe({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function vze(t){return sg(h_([]),og((e,r)=>sg(oje([],r.name),uL(r.value),nu(r.name,Rc,e))(e),{}),f_(e=>e.length>1?e:e[0]))(t)}function tu(t,e){return r=>Bde(vFe([O0e(t,"name"),lL(fL(e),O0e(e,"value"),aL)]),r)}function $0e(t){return Fde([[qy(String),Ym(t)],[qy(Array),VFe(t)],[aL,Eqe]])}function O1(t){let e;return qy(ru,t)?(e=new Error(mze(t)),e.stack+=t.stack):qy(Error,t)?e=t:WFe("message",t)?e=new Error(t.message):qy(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function mze(t){return sg(e=>function r(f,n,h){return og((p,v)=>sg(Fde([[Ym(Yt.invalid_arguments),()=>r(v.argumentsError,422,"Invalid Arguments")],[Ym(Yt.invalid_return_type),()=>r(v.returnTypeError,500,"Invalid Return")],[Ym(Yt.invalid_union),()=>BFe(w=>r(w,400,"Invalid Union"),v.unionErrors)],[aL,()=>[{...v,status:n,contextCode:h}]]]),hL(p))(v.code),[],f.issues)}(e,400,""),e=>og((r,f)=>{let{message:n,path:h,contextCode:p}=f,v=h[1]||h[0],w=p?`${p} `:"";return r.push(`${w}'${v}': ${n}.`),r},[],e),eje(" | "))(t)}var gze=kt.object({id:kt.string().min(1,{message:"message is required to be a message id"}),processId:kt.string().min(1,{message:"process is required to be a process id"})});function bze(){return t=>di(t).map(gze.parse).map(()=>t)}var x6=kt.object({name:kt.string(),value:kt.string()}),yze=kt.function().args(kt.object({Id:kt.string(),Target:kt.string(),Owner:kt.string(),Anchor:kt.string().optional(),Data:kt.any().default("1234"),Tags:kt.array(kt.object({name:kt.string(),value:kt.string()}))})).returns(kt.promise(kt.any())),wze=kt.function().args(kt.object({id:kt.string().min(1,{message:"message id is required"}),processId:kt.string().min(1,{message:"process id is required"})})).returns(kt.promise(kt.any())),_ze=kt.function().args(kt.object({process:kt.string().min(1,{message:"process id is required"}),from:kt.string().optional(),to:kt.string().optional(),sort:kt.enum(["ASC","DESC"]).default("ASC"),limit:kt.number().optional()})).returns(kt.promise(kt.object({edges:kt.array(kt.object({cursor:kt.string(),node:kt.object({Output:kt.any().optional(),Messages:kt.array(kt.any()).optional(),Spawns:kt.array(kt.any()).optional(),Error:kt.any().optional()})}))}))),upe=kt.function().args(kt.object({processId:kt.string(),data:kt.any(),tags:kt.array(x6),anchor:kt.string().optional(),signer:kt.any()})).returns(kt.promise(kt.object({messageId:kt.string()}).passthrough())),Mze=kt.function().args(kt.object({data:kt.any(),tags:kt.array(x6),signer:kt.any()})).returns(kt.promise(kt.object({processId:kt.string()}).passthrough())),xze=kt.function().args(kt.object({process:kt.string(),message:kt.string(),baseLayer:kt.boolean().optional(),exclude:kt.array(kt.string()).optional()})).returns(kt.promise(kt.object({assignmentId:kt.string()}).passthrough())),hpe=upe,K_t=kt.function().args(kt.object({suUrl:kt.string().url(),processId:kt.string()})).returns(kt.promise(kt.object({tags:kt.array(x6)}).passthrough())),Z_t=kt.function().args(kt.string()).returns(kt.promise(kt.object({url:kt.string()}))),Sze=kt.function().args(kt.string()).returns(kt.promise(kt.boolean())),Eze=kt.function().args(kt.string()).returns(kt.promise(kt.object({tags:kt.array(x6)}).passthrough())),l_=kt.function().args(kt.object({data:kt.any(),tags:kt.array(x6),target:kt.string().optional(),anchor:kt.string().optional()})).returns(kt.promise(kt.object({id:kt.string(),raw:kt.any()})));function Aze({loadResult:t}){return t=gn(wze.implement(t)),e=>di({id:e.id,processId:e.processId}).chain(t)}function Rze(t){let e=bze(t),r=Aze(t);return({message:f,process:n})=>di({id:f,processId:n}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',f)).map(h=>h).bimap(O1,P1).toPromise()}var Tze=kt.array(kt.object({name:kt.string(),value:kt.string()}));function Ize(){return t=>di(t.tags).map(h_([])).map(tu("Data-Protocol","ao")).map(tu("Variant")).map(tu("Type")).map(tu("SDK")).map(hL(Rc,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(Tze.parse).map(nu("tags",Rc,t))}function kze({logger:t}){return e=>di(e).chain(lL(fL(e.data),()=>T1(e),()=>T1(Math.random().toString().slice(-4)).map(nu("data",Rc,e)).map(r=>sg(B1("tags"),tu("Content-Type"),uL({name:"Content-Type",value:"text/plain"}),nu("tags",Rc,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function Bze(t){let e=Ize(t),r=kze(t),f=upe.implement(t.deployMessage);return n=>di(n).chain(e).chain(r).chain(gn(({id:h,data:p,tags:v,anchor:w,signer:g})=>f({processId:h,data:p,tags:v,anchor:w,signer:l_.implement(g)}))).map(h=>nu("messageId",h.messageId,n))}function Pze(t){let e=Bze(t);return({process:r,data:f,tags:n,anchor:h,signer:p})=>di({id:r,data:f,tags:n,anchor:h,signer:p}).chain(e).map(v=>v.messageId).bimap(O1,P1).toPromise()}var ky=(t,e,r)=>f=>e(f[t])?T1(f):gd(`Tag '${t}': ${r}`);function Oze({loadTransactionMeta:t,logger:e}){return t=gn(Eze.implement(t)),r=>di(r).chain(t).map(B1("tags")).map(vze).chain(ky("Data-Protocol",$0e("ao"),"value 'ao' was not found on module")).chain(ky("Type",$0e("Module"),"value 'Module' was not found on module")).chain(ky("Module-Format",b$,"was not found on module")).chain(ky("Input-Encoding",b$,"was not found on module")).chain(ky("Output-Encoding",b$,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function Nze({logger:t,validateScheduler:e}){return e=gn(Sze.implement(e)),r=>di(r).chain(f=>e(f).chain(n=>n?T1(f):gd(`Valid Scheduler-Location owned by ${f} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function Cze({logger:t}){return e=>di(e).map(t.tap("Checking for signer")).chain(r=>r?T1(r):gd("signer not found"))}function $ze(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=Oze(t),f=Nze(t),n=Cze(t);return h=>di(h).chain(p=>r(p.module).map(()=>p)).chain(p=>f(p.scheduler)).map(()=>h).chain(p=>n(p.signer).map(()=>p)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var Lze=kt.array(kt.object({name:kt.string(),value:kt.string()}));function Dze(){return t=>di(t).map(B1("tags")).map(h_([])).map(tu("Data-Protocol","ao")).map(tu("Variant")).map(tu("Type")).map(tu("Module")).map(tu("Scheduler")).map(tu("SDK")).map(hL(Rc,[{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(Lze.parse).map(nu("tags",Rc,t))}function Uze({logger:t}){return e=>di(e).chain(lL(fL(e.data),()=>T1(e),()=>T1(Math.random().toString().slice(-4)).map(nu("data",Rc,e)).map(r=>sg(B1("tags"),tu("Content-Type"),uL({name:"Content-Type",value:"text/plain"}),nu("tags",Rc,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function qze(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=Dze(t),f=Uze(t),n=Mze.implement(t.deployProcess);return h=>di(h).chain(r).chain(f).chain(gn(({data:p,tags:v,signer:w})=>n({data:p,tags:v,signer:l_.implement(w)}))).map(p=>nu("processId",p.processId,h))}function Fze(t){let e=$ze(t),r=qze(t);return({module:f,scheduler:n,signer:h,tags:p,data:v})=>di({module:f,scheduler:n,signer:h,tags:p,data:v}).chain(e).chain(r).map(w=>w.processId).bimap(O1,P1).toPromise()}function jze(t){let e=hpe.implement(t.deployMonitor);return r=>di(r).chain(gn(({id:f,signer:n})=>e({processId:f,signer:l_.implement(n),data:Math.random().toString().slice(-4),tags:[]}))).map(f=>nu("monitorId",f.messageId,r))}function zze(t){let e=jze(t);return({process:r,signer:f})=>di({id:r,signer:f}).chain(e).map(n=>n.monitorId).bimap(O1,P1).toPromise()}function Hze(t){let e=hpe.implement(t.deployUnmonitor);return r=>di(r).chain(gn(({id:f,signer:n})=>e({processId:f,signer:l_.implement(n),data:Math.random().toString().slice(-4),tags:[]}))).map(f=>nu("monitorId",f.messageId,r))}function Wze(t){let e=Hze(t);return({process:r,signer:f})=>di({id:r,signer:f}).chain(e).map(n=>n.monitorId).bimap(O1,P1).toPromise()}var Kze=kt.object({process:kt.string().min(1,{message:"process identifier is required"}),from:kt.string().optional(),to:kt.string().optional(),sort:kt.enum(["ASC","DESC"]).default("ASC"),limit:kt.number().optional()});function Zze(){return t=>di(t).map(Kze.parse).map(()=>t)}function Vze({queryResults:t}){return t=gn(_ze.implement(t)),e=>di({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function Gze(t){let e=Zze(t),r=Vze(t);return({process:f,from:n,to:h,sort:p,limit:v})=>di({process:f,from:n,to:h,sort:p,limit:v}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',f)).map(w=>w).bimap(O1,P1).toPromise()}var Yze=kt.object({Id:kt.string(),Target:kt.string(),Owner:kt.string(),Anchor:kt.string().optional(),Data:kt.any().default("1234"),Tags:kt.array(kt.object({name:kt.string(),value:kt.string()}))});function Jze(){return t=>di(t).map(Yze.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 Xze({dryrunFetch:t}){return gn(yze.implement(t))}function Qze(t){let e=Jze(t),r=Xze(t);return f=>di(f).map(eHe).chain(e).chain(r).toPromise()}function eHe({process:t,data:e,tags:r,anchor:f,...n}){return{Id:"1234",Owner:"1234",...n,Target:t,Data:e||"1234",Tags:r||[],Anchor:f||"0"}}function tHe(t){let e=xze.implement(t.deployAssign);return r=>di(r).chain(gn(({process:f,message:n,baseLayer:h,exclude:p})=>e({process:f,message:n,baseLayer:h,exclude:p}))).map(f=>nu("assignmentId",f.assignmentId,r))}function rHe(t){let e=tHe(t);return({process:r,message:f,baseLayer:n,exclude:h})=>di({process:r,message:f,baseLayer:n,exclude:h}).chain(e).map(p=>p.assignmentId).bimap(O1,P1).toPromise()}var iHe="https://arweave.net",nHe="https://mu.ao-testnet.xyz",aHe="https://cu.ao-testnet.xyz";function ou({GRAPHQL_URL:t,GATEWAY_URL:e=iHe,MU_URL:r=nHe,CU_URL:f=aHe}={}){let n=spe();t||(t=fpe({url:e,path:"/graphql"}));let{validate:h}=Rde({cacheSize:100,GRAPHQL_URL:t}),p=xqe({MAX_SIZE:25}),v=n.child("result"),w=Rze({loadResult:wqe({fetch,CU_URL:f,logger:v}),logger:v}),g=n.child("message"),b=Pze({loadProcessMeta:v$({fetch,cache:p,logger:g}),deployMessage:pqe({fetch,MU_URL:r,logger:g}),logger:g}),M=n.child("spawn"),x=Fze({loadTransactionMeta:dze({fetch,GRAPHQL_URL:t,logger:M}),validateScheduler:h,deployProcess:vqe({fetch,MU_URL:r,logger:M}),logger:M}),S=n.child("monitor"),A=zze({loadProcessMeta:v$({fetch,cache:p,logger:S}),deployMonitor:mqe({fetch,MU_URL:r,logger:S}),logger:S}),T=n.child("unmonitor"),k=Wze({loadProcessMeta:v$({fetch,cache:p,logger:T}),deployUnmonitor:gqe({fetch,MU_URL:r,logger:T}),logger:S}),B=n.child("results"),C=Gze({queryResults:_qe({fetch,CU_URL:f,logger:B}),logger:B}),N=n.child("dryrun"),W=Qze({dryrunFetch:yqe({fetch,CU_URL:f,logger:N}),logger:N}),H=n.child("assign"),J=rHe({deployAssign:bqe({fetch,MU_URL:r,logger:H}),logger:g});return{result:w,results:C,message:b,spawn:x,monitor:A,unmonitor:k,dryrun:W,assign:J}}var lpe={};U0e(lpe,{createDataItemSigner:()=>kHe});var cpe=Z$(ELe(),1),dpe={};U0e(dpe,{AVSCTap:()=>S6,ArweaveSigner:()=>mL,DataItem:()=>y6,MAX_TAG_BYTES:()=>c_,MIN_BINARY_SIZE:()=>yL,SIG_CONFIG:()=>cg,SignatureConfig:()=>eu,Signer:()=>gpe,createData:()=>_pe,default:()=>RHe,deserializeTags:()=>r_,indexToType:()=>gL,serializeTags:()=>bL,tagsExceedLimit:()=>wpe,warparbundles:()=>THe});var oHe=Object.create,pL=Object.defineProperty,sHe=Object.getOwnPropertyDescriptor,fHe=Object.getOwnPropertyNames,uHe=Object.getPrototypeOf,hHe=Object.prototype.hasOwnProperty,Ic=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lHe=(t,e)=>{for(var r in e)pL(t,r,{get:e[r],enumerable:!0})},cHe=(t,e,r,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of fHe(e))!hHe.call(t,n)&&n!==r&&pL(t,n,{get:()=>e[n],enumerable:!(f=sHe(e,n))||f.enumerable});return t},N1=(t,e,r)=>(r=t!=null?oHe(uHe(t)):{},cHe(e||!t||!t.__esModule?pL(r,"default",{value:t,enumerable:!0}):r,t)),dHe=Ic(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var f=4,n=r.length,h=n%f;if(!h)return r;var p=n,v=f-h,w=n+v,g=Te.alloc(w);for(g.write(r);v--;)g.write("=",p++);return g.toString()}t.default=e}),pHe=Ic(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=dHe();function r(w,g){return g===void 0&&(g="utf8"),Te.isBuffer(w)?h(w.toString("base64")):h(Te.from(w,g).toString("base64"))}function f(w,g){return g===void 0&&(g="utf8"),Te.from(n(w),"base64").toString(g)}function n(w){return w=w.toString(),e.default(w).replace(/\-/g,"+").replace(/_/g,"/")}function h(w){return w.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(w){return Te.from(n(w),"base64")}var v=r;v.encode=r,v.decode=f,v.toBase64=n,v.fromBase64=h,v.toBuffer=p,t.default=v}),vL=Ic((t,e)=>{e.exports=pHe().default,e.exports.default=e.exports}),ppe=Ic(t=>{"use strict";t.byteLength=w,t.toByteArray=b,t.fromByteArray=S;var e=[],r=[],f=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,p=n.length;h<p;++h)e[h]=n[h],r[n.charCodeAt(h)]=h;var h,p;r[45]=62,r[95]=63;function v(A){var T=A.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=A.indexOf("=");k===-1&&(k=T);var B=k===T?0:4-k%4;return[k,B]}function w(A){var T=v(A),k=T[0],B=T[1];return(k+B)*3/4-B}function g(A,T,k){return(T+k)*3/4-k}function b(A){var T,k=v(A),B=k[0],C=k[1],N=new f(g(A,B,C)),W=0,H=C>0?B-4:B,J;for(J=0;J<H;J+=4)T=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[W++]=T>>16&255,N[W++]=T>>8&255,N[W++]=T&255;return C===2&&(T=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[W++]=T&255),C===1&&(T=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[W++]=T>>8&255,N[W++]=T&255),N}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,T,k){for(var B,C=[],N=T;N<k;N+=3)B=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),C.push(M(B));return C.join("")}function S(A){for(var T,k=A.length,B=k%3,C=[],N=16383,W=0,H=k-B;W<H;W+=N)C.push(x(A,W,W+N>H?H:W+N));return B===1?(T=A[k-1],C.push(e[T>>2]+e[T<<4&63]+"==")):B===2&&(T=(A[k-2]<<8)+A[k-1],C.push(e[T>>10]+e[T>>4&63]+e[T<<2&63]+"=")),C.join("")}}),vpe=Ic(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=ppe();function r(x){let S=0;for(let k=0;k<x.length;k++)S+=x[k].byteLength;let A=new Uint8Array(S),T=0;A.set(new Uint8Array(x[0]),T),T+=x[0].byteLength;for(let k=1;k<x.length;k++)A.set(new Uint8Array(x[k]),T),T+=x[k].byteLength;return A}t.concatBuffers=r;function f(x){let S=v(x);return n(S)}t.b64UrlToString=f;function n(x){return new TextDecoder("utf-8",{fatal:!0}).decode(x)}t.bufferToString=n;function h(x){return new TextEncoder().encode(x)}t.stringToBuffer=h;function p(x){return g(h(x))}t.stringToB64Url=p;function v(x){return new Uint8Array(e.toByteArray(M(x)))}t.b64UrlToBuffer=v;function w(x){return e.fromByteArray(new Uint8Array(x))}t.bufferTob64=w;function g(x){return b(w(x))}t.bufferTob64Url=g;function b(x){return x.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=b;function M(x){x=x.replace(/\-/g,"+").replace(/\_/g,"/");let S;return x.length%4==0?S=0:S=4-x.length%4,x.concat("=".repeat(S))}t.b64UrlDecode=M}),vHe=Ic(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=vpe(),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 f=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),n=await this.driver.exportKey("jwk",f.privateKey);return{kty:n.kty,e:n.e,n:n.n,d:n.d,p:n.p,q:n.q,dp:n.dp,dq:n.dq,qi:n.qi}}async sign(f,n,{saltLength:h}={}){let p=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(f),n);return new Uint8Array(p)}async hash(f,n="SHA-256"){let h=await this.driver.digest(n,f);return new Uint8Array(h)}async verify(f,n,h){let p={kty:"RSA",e:"AQAB",n:f},v=await this.jwkToPublicCryptoKey(p),w=await this.driver.digest("SHA-256",n),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},v,h,n),b=await this.driver.verify({name:"RSA-PSS",saltLength:32},v,h,n),M=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((v.algorithm.modulusLength-1)/8)-w.byteLength-2},v,h,n);return g||b||M}async jwkToCryptoKey(f){return this.driver.importKey("jwk",f,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(f){return this.driver.importKey("jwk",f,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let f=crypto?.subtle;return f===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(n=>typeof f[n]=="function")}async encrypt(f,n,h){let p=await this.driver.importKey("raw",typeof n=="string"?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=new Uint8Array(16);crypto.getRandomValues(w);let g=await this.driver.encrypt({name:"AES-CBC",iv:w},v,f);return e.concatBuffers([w,g])}async decrypt(f,n,h){let p=await this.driver.importKey("raw",typeof n=="string"?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=f.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:w},v,f.slice(16));return e.concatBuffers([g])}};t.default=r}),mHe=Ic(t=>{t.read=function(e,r,f,n,h){var p,v,w=h*8-n-1,g=(1<<w)-1,b=g>>1,M=-7,x=f?h-1:0,S=f?-1:1,A=e[r+x];for(x+=S,p=A&(1<<-M)-1,A>>=-M,M+=w;M>0;p=p*256+e[r+x],x+=S,M-=8);for(v=p&(1<<-M)-1,p>>=-M,M+=n;M>0;v=v*256+e[r+x],x+=S,M-=8);if(p===0)p=1-b;else{if(p===g)return v?NaN:(A?-1:1)*(1/0);v=v+Math.pow(2,n),p=p-b}return(A?-1:1)*v*Math.pow(2,p-n)},t.write=function(e,r,f,n,h,p){var v,w,g,b=p*8-h-1,M=(1<<b)-1,x=M>>1,S=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:p-1,T=n?1:-1,k=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(w=isNaN(r)?1:0,v=M):(v=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-v))<1&&(v--,g*=2),v+x>=1?r+=S/g:r+=S*Math.pow(2,1-x),r*g>=2&&(v++,g/=2),v+x>=M?(w=0,v=M):v+x>=1?(w=(r*g-1)*Math.pow(2,h),v=v+x):(w=r*Math.pow(2,x-1)*Math.pow(2,h),v=0));h>=8;e[f+A]=w&255,A+=T,w/=256,h-=8);for(v=v<<h|w,b+=h;b>0;e[f+A]=v&255,A+=T,v/=256,b-=8);e[f+A-T]|=k*128}}),H$=Ic(t=>{"use strict";var e=ppe(),r=mHe(),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=v,t.SlowBuffer=C,t.INSPECT_MAX_BYTES=50;var n=2147483647;t.kMaxLength=n,v.TYPED_ARRAY_SUPPORT=h(),!v.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 h(){try{let P=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(P,O),P.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}}),Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function p(P){if(P>n)throw new RangeError('The value "'+P+'" is invalid for option "size"');let O=new Uint8Array(P);return Object.setPrototypeOf(O,v.prototype),O}function v(P,O,$){if(typeof P=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(P)}return w(P,O,$)}v.poolSize=8192;function w(P,O,$){if(typeof P=="string")return x(P,O);if(ArrayBuffer.isView(P))return A(P);if(P==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P);if(pt(P,ArrayBuffer)||P&&pt(P.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(pt(P,SharedArrayBuffer)||P&&pt(P.buffer,SharedArrayBuffer)))return T(P,O,$);if(typeof P=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let Z=P.valueOf&&P.valueOf();if(Z!=null&&Z!==P)return v.from(Z,O,$);let te=k(P);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof P[Symbol.toPrimitive]=="function")return v.from(P[Symbol.toPrimitive]("string"),O,$);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P)}v.from=function(P,O,$){return w(P,O,$)},Object.setPrototypeOf(v.prototype,Uint8Array.prototype),Object.setPrototypeOf(v,Uint8Array);function g(P){if(typeof P!="number")throw new TypeError('"size" argument must be of type number');if(P<0)throw new RangeError('The value "'+P+'" is invalid for option "size"')}function b(P,O,$){return g(P),P<=0?p(P):O!==void 0?typeof $=="string"?p(P).fill(O,$):p(P).fill(O):p(P)}v.alloc=function(P,O,$){return b(P,O,$)};function M(P){return g(P),p(P<0?0:B(P)|0)}v.allocUnsafe=function(P){return M(P)},v.allocUnsafeSlow=function(P){return M(P)};function x(P,O){if((typeof O!="string"||O==="")&&(O="utf8"),!v.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let $=N(P,O)|0,Z=p($),te=Z.write(P,O);return te!==$&&(Z=Z.slice(0,te)),Z}function S(P){let O=P.length<0?0:B(P.length)|0,$=p(O);for(let Z=0;Z<O;Z+=1)$[Z]=P[Z]&255;return $}function A(P){if(pt(P,Uint8Array)){let O=new Uint8Array(P);return T(O.buffer,O.byteOffset,O.byteLength)}return S(P)}function T(P,O,$){if(O<0||P.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(P.byteLength<O+($||0))throw new RangeError('"length" is outside of buffer bounds');let Z;return O===void 0&&$===void 0?Z=new Uint8Array(P):$===void 0?Z=new Uint8Array(P,O):Z=new Uint8Array(P,O,$),Object.setPrototypeOf(Z,v.prototype),Z}function k(P){if(v.isBuffer(P)){let O=B(P.length)|0,$=p(O);return $.length===0||P.copy($,0,0,O),$}if(P.length!==void 0)return typeof P.length!="number"||Me(P.length)?p(0):S(P);if(P.type==="Buffer"&&Array.isArray(P.data))return S(P.data)}function B(P){if(P>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return P|0}function C(P){return+P!=P&&(P=0),v.alloc(+P)}v.isBuffer=function(P){return P!=null&&P._isBuffer===!0&&P!==v.prototype},v.compare=function(P,O){if(pt(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),pt(O,Uint8Array)&&(O=v.from(O,O.offset,O.byteLength)),!v.isBuffer(P)||!v.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(P===O)return 0;let $=P.length,Z=O.length;for(let te=0,X=Math.min($,Z);te<X;++te)if(P[te]!==O[te]){$=P[te],Z=O[te];break}return $<Z?-1:Z<$?1:0},v.isEncoding=function(P){switch(String(P).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}},v.concat=function(P,O){if(!Array.isArray(P))throw new TypeError('"list" argument must be an Array of Buffers');if(P.length===0)return v.alloc(0);let $;if(O===void 0)for(O=0,$=0;$<P.length;++$)O+=P[$].length;let Z=v.allocUnsafe(O),te=0;for($=0;$<P.length;++$){let X=P[$];if(pt(X,Uint8Array))te+X.length>Z.length?(v.isBuffer(X)||(X=v.from(X)),X.copy(Z,te)):Uint8Array.prototype.set.call(Z,X,te);else if(v.isBuffer(X))X.copy(Z,te);else throw new TypeError('"list" argument must be an Array of Buffers');te+=X.length}return Z};function N(P,O){if(v.isBuffer(P))return P.length;if(ArrayBuffer.isView(P)||pt(P,ArrayBuffer))return P.byteLength;if(typeof P!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof P);let $=P.length,Z=arguments.length>2&&arguments[2]===!0;if(!Z&&$===0)return 0;let te=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return $;case"utf8":case"utf-8":return ie(P).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $*2;case"hex":return $>>>1;case"base64":return de(P).length;default:if(te)return Z?-1:ie(P).length;O=(""+O).toLowerCase(),te=!0}}v.byteLength=N;function W(P,O,$){let Z=!1;if((O===void 0||O<0)&&(O=0),O>this.length||(($===void 0||$>this.length)&&($=this.length),$<=0)||($>>>=0,O>>>=0,$<=O))return"";for(P||(P="utf8");;)switch(P){case"hex":return a(this,O,$);case"utf8":case"utf-8":return u(this,O,$);case"ascii":return _(this,O,$);case"latin1":case"binary":return c(this,O,$);case"base64":return s(this,O,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d(this,O,$);default:if(Z)throw new TypeError("Unknown encoding: "+P);P=(P+"").toLowerCase(),Z=!0}}v.prototype._isBuffer=!0;function H(P,O,$){let Z=P[O];P[O]=P[$],P[$]=Z}v.prototype.swap16=function(){let P=this.length;if(P%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<P;O+=2)H(this,O,O+1);return this},v.prototype.swap32=function(){let P=this.length;if(P%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<P;O+=4)H(this,O,O+3),H(this,O+1,O+2);return this},v.prototype.swap64=function(){let P=this.length;if(P%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<P;O+=8)H(this,O,O+7),H(this,O+1,O+6),H(this,O+2,O+5),H(this,O+3,O+4);return this},v.prototype.toString=function(){let P=this.length;return P===0?"":arguments.length===0?u(this,0,P):W.apply(this,arguments)},v.prototype.toLocaleString=v.prototype.toString,v.prototype.equals=function(P){if(!v.isBuffer(P))throw new TypeError("Argument must be a Buffer");return this===P?!0:v.compare(this,P)===0},v.prototype.inspect=function(){let P="",O=t.INSPECT_MAX_BYTES;return P=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(P+=" ... "),"<Buffer "+P+">"},f&&(v.prototype[f]=v.prototype.inspect),v.prototype.compare=function(P,O,$,Z,te){if(pt(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),!v.isBuffer(P))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof P);if(O===void 0&&(O=0),$===void 0&&($=P?P.length:0),Z===void 0&&(Z=0),te===void 0&&(te=this.length),O<0||$>P.length||Z<0||te>this.length)throw new RangeError("out of range index");if(Z>=te&&O>=$)return 0;if(Z>=te)return-1;if(O>=$)return 1;if(O>>>=0,$>>>=0,Z>>>=0,te>>>=0,this===P)return 0;let X=te-Z,ae=$-O,qe=Math.min(X,ae),ce=this.slice(Z,te),ge=P.slice(O,$);for(let xe=0;xe<qe;++xe)if(ce[xe]!==ge[xe]){X=ce[xe],ae=ge[xe];break}return X<ae?-1:ae<X?1:0};function J(P,O,$,Z,te){if(P.length===0)return-1;if(typeof $=="string"?(Z=$,$=0):$>2147483647?$=2147483647:$<-2147483648&&($=-2147483648),$=+$,Me($)&&($=te?0:P.length-1),$<0&&($=P.length+$),$>=P.length){if(te)return-1;$=P.length-1}else if($<0)if(te)$=0;else return-1;if(typeof O=="string"&&(O=v.from(O,Z)),v.isBuffer(O))return O.length===0?-1:U(P,O,$,Z,te);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(P,O,$):Uint8Array.prototype.lastIndexOf.call(P,O,$):U(P,[O],$,Z,te);throw new TypeError("val must be string, number or Buffer")}function U(P,O,$,Z,te){let X=1,ae=P.length,qe=O.length;if(Z!==void 0&&(Z=String(Z).toLowerCase(),Z==="ucs2"||Z==="ucs-2"||Z==="utf16le"||Z==="utf-16le")){if(P.length<2||O.length<2)return-1;X=2,ae/=2,qe/=2,$/=2}function ce(xe,be){return X===1?xe[be]:xe.readUInt16BE(be*X)}let ge;if(te){let xe=-1;for(ge=$;ge<ae;ge++)if(ce(P,ge)===ce(O,xe===-1?0:ge-xe)){if(xe===-1&&(xe=ge),ge-xe+1===qe)return xe*X}else xe!==-1&&(ge-=ge-xe),xe=-1}else for($+qe>ae&&($=ae-qe),ge=$;ge>=0;ge--){let xe=!0;for(let be=0;be<qe;be++)if(ce(P,ge+be)!==ce(O,be)){xe=!1;break}if(xe)return ge}return-1}v.prototype.includes=function(P,O,$){return this.indexOf(P,O,$)!==-1},v.prototype.indexOf=function(P,O,$){return J(this,P,O,$,!0)},v.prototype.lastIndexOf=function(P,O,$){return J(this,P,O,$,!1)};function j(P,O,$,Z){$=Number($)||0;let te=P.length-$;Z?(Z=Number(Z),Z>te&&(Z=te)):Z=te;let X=O.length;Z>X/2&&(Z=X/2);let ae;for(ae=0;ae<Z;++ae){let qe=parseInt(O.substr(ae*2,2),16);if(Me(qe))return ae;P[$+ae]=qe}return ae}function Y(P,O,$,Z){return ye(ie(O,P.length-$),P,$,Z)}function y(P,O,$,Z){return ye(oe(O),P,$,Z)}function i(P,O,$,Z){return ye(de(O),P,$,Z)}function o(P,O,$,Z){return ye(Pe(O,P.length-$),P,$,Z)}v.prototype.write=function(P,O,$,Z){if(O===void 0)Z="utf8",$=this.length,O=0;else if($===void 0&&typeof O=="string")Z=O,$=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite($)?($=$>>>0,Z===void 0&&(Z="utf8")):(Z=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let te=this.length-O;if(($===void 0||$>te)&&($=te),P.length>0&&($<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");Z||(Z="utf8");let X=!1;for(;;)switch(Z){case"hex":return j(this,P,O,$);case"utf8":case"utf-8":return Y(this,P,O,$);case"ascii":case"latin1":case"binary":return y(this,P,O,$);case"base64":return i(this,P,O,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o(this,P,O,$);default:if(X)throw new TypeError("Unknown encoding: "+Z);Z=(""+Z).toLowerCase(),X=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(P,O,$){return O===0&&$===P.length?e.fromByteArray(P):e.fromByteArray(P.slice(O,$))}function u(P,O,$){$=Math.min(P.length,$);let Z=[],te=O;for(;te<$;){let X=P[te],ae=null,qe=X>239?4:X>223?3:X>191?2:1;if(te+qe<=$){let ce,ge,xe,be;switch(qe){case 1:X<128&&(ae=X);break;case 2:ce=P[te+1],(ce&192)===128&&(be=(X&31)<<6|ce&63,be>127&&(ae=be));break;case 3:ce=P[te+1],ge=P[te+2],(ce&192)===128&&(ge&192)===128&&(be=(X&15)<<12|(ce&63)<<6|ge&63,be>2047&&(be<55296||be>57343)&&(ae=be));break;case 4:ce=P[te+1],ge=P[te+2],xe=P[te+3],(ce&192)===128&&(ge&192)===128&&(xe&192)===128&&(be=(X&15)<<18|(ce&63)<<12|(ge&63)<<6|xe&63,be>65535&&be<1114112&&(ae=be))}}ae===null?(ae=65533,qe=1):ae>65535&&(ae-=65536,Z.push(ae>>>10&1023|55296),ae=56320|ae&1023),Z.push(ae),te+=qe}return m(Z)}var l=4096;function m(P){let O=P.length;if(O<=l)return String.fromCharCode.apply(String,P);let $="",Z=0;for(;Z<O;)$+=String.fromCharCode.apply(String,P.slice(Z,Z+=l));return $}function _(P,O,$){let Z="";$=Math.min(P.length,$);for(let te=O;te<$;++te)Z+=String.fromCharCode(P[te]&127);return Z}function c(P,O,$){let Z="";$=Math.min(P.length,$);for(let te=O;te<$;++te)Z+=String.fromCharCode(P[te]);return Z}function a(P,O,$){let Z=P.length;(!O||O<0)&&(O=0),(!$||$<0||$>Z)&&($=Z);let te="";for(let X=O;X<$;++X)te+=Be[P[X]];return te}function d(P,O,$){let Z=P.slice(O,$),te="";for(let X=0;X<Z.length-1;X+=2)te+=String.fromCharCode(Z[X]+Z[X+1]*256);return te}v.prototype.slice=function(P,O){let $=this.length;P=~~P,O=O===void 0?$:~~O,P<0?(P+=$,P<0&&(P=0)):P>$&&(P=$),O<0?(O+=$,O<0&&(O=0)):O>$&&(O=$),O<P&&(O=P);let Z=this.subarray(P,O);return Object.setPrototypeOf(Z,v.prototype),Z};function R(P,O,$){if(P%1!==0||P<0)throw new RangeError("offset is not uint");if(P+O>$)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=this[P],te=1,X=0;for(;++X<O&&(te*=256);)Z+=this[P+X]*te;return Z},v.prototype.readUintBE=v.prototype.readUIntBE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=this[P+--O],te=1;for(;O>0&&(te*=256);)Z+=this[P+--O]*te;return Z},v.prototype.readUint8=v.prototype.readUInt8=function(P,O){return P=P>>>0,O||R(P,1,this.length),this[P]},v.prototype.readUint16LE=v.prototype.readUInt16LE=function(P,O){return P=P>>>0,O||R(P,2,this.length),this[P]|this[P+1]<<8},v.prototype.readUint16BE=v.prototype.readUInt16BE=function(P,O){return P=P>>>0,O||R(P,2,this.length),this[P]<<8|this[P+1]},v.prototype.readUint32LE=v.prototype.readUInt32LE=function(P,O){return P=P>>>0,O||R(P,4,this.length),(this[P]|this[P+1]<<8|this[P+2]<<16)+this[P+3]*16777216},v.prototype.readUint32BE=v.prototype.readUInt32BE=function(P,O){return P=P>>>0,O||R(P,4,this.length),this[P]*16777216+(this[P+1]<<16|this[P+2]<<8|this[P+3])},v.prototype.readBigUInt64LE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=O+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24,te=this[++P]+this[++P]*2**8+this[++P]*2**16+$*2**24;return BigInt(Z)+(BigInt(te)<<BigInt(32))}),v.prototype.readBigUInt64BE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=O*2**24+this[++P]*2**16+this[++P]*2**8+this[++P],te=this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+$;return(BigInt(Z)<<BigInt(32))+BigInt(te)}),v.prototype.readIntLE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=this[P],te=1,X=0;for(;++X<O&&(te*=256);)Z+=this[P+X]*te;return te*=128,Z>=te&&(Z-=Math.pow(2,8*O)),Z},v.prototype.readIntBE=function(P,O,$){P=P>>>0,O=O>>>0,$||R(P,O,this.length);let Z=O,te=1,X=this[P+--Z];for(;Z>0&&(te*=256);)X+=this[P+--Z]*te;return te*=128,X>=te&&(X-=Math.pow(2,8*O)),X},v.prototype.readInt8=function(P,O){return P=P>>>0,O||R(P,1,this.length),this[P]&128?(255-this[P]+1)*-1:this[P]},v.prototype.readInt16LE=function(P,O){P=P>>>0,O||R(P,2,this.length);let $=this[P]|this[P+1]<<8;return $&32768?$|4294901760:$},v.prototype.readInt16BE=function(P,O){P=P>>>0,O||R(P,2,this.length);let $=this[P+1]|this[P]<<8;return $&32768?$|4294901760:$},v.prototype.readInt32LE=function(P,O){return P=P>>>0,O||R(P,4,this.length),this[P]|this[P+1]<<8|this[P+2]<<16|this[P+3]<<24},v.prototype.readInt32BE=function(P,O){return P=P>>>0,O||R(P,4,this.length),this[P]<<24|this[P+1]<<16|this[P+2]<<8|this[P+3]},v.prototype.readBigInt64LE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=this[P+4]+this[P+5]*2**8+this[P+6]*2**16+($<<24);return(BigInt(Z)<<BigInt(32))+BigInt(O+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24)}),v.prototype.readBigInt64BE=gt(function(P){P=P>>>0,K(P,"offset");let O=this[P],$=this[P+7];(O===void 0||$===void 0)&&G(P,this.length-8);let Z=(O<<24)+this[++P]*2**16+this[++P]*2**8+this[++P];return(BigInt(Z)<<BigInt(32))+BigInt(this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+$)}),v.prototype.readFloatLE=function(P,O){return P=P>>>0,O||R(P,4,this.length),r.read(this,P,!0,23,4)},v.prototype.readFloatBE=function(P,O){return P=P>>>0,O||R(P,4,this.length),r.read(this,P,!1,23,4)},v.prototype.readDoubleLE=function(P,O){return P=P>>>0,O||R(P,8,this.length),r.read(this,P,!0,52,8)},v.prototype.readDoubleBE=function(P,O){return P=P>>>0,O||R(P,8,this.length),r.read(this,P,!1,52,8)};function E(P,O,$,Z,te,X){if(!v.isBuffer(P))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>te||O<X)throw new RangeError('"value" argument is out of bounds');if($+Z>P.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(P,O,$,Z){if(P=+P,O=O>>>0,$=$>>>0,!Z){let ae=Math.pow(2,8*$)-1;E(this,P,O,$,ae,0)}let te=1,X=0;for(this[O]=P&255;++X<$&&(te*=256);)this[O+X]=P/te&255;return O+$},v.prototype.writeUintBE=v.prototype.writeUIntBE=function(P,O,$,Z){if(P=+P,O=O>>>0,$=$>>>0,!Z){let ae=Math.pow(2,8*$)-1;E(this,P,O,$,ae,0)}let te=$-1,X=1;for(this[O+te]=P&255;--te>=0&&(X*=256);)this[O+te]=P/X&255;return O+$},v.prototype.writeUint8=v.prototype.writeUInt8=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,1,255,0),this[O]=P&255,O+1},v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,65535,0),this[O]=P&255,this[O+1]=P>>>8,O+2},v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,65535,0),this[O]=P>>>8,this[O+1]=P&255,O+2},v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,4294967295,0),this[O+3]=P>>>24,this[O+2]=P>>>16,this[O+1]=P>>>8,this[O]=P&255,O+4},v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,4294967295,0),this[O]=P>>>24,this[O+1]=P>>>16,this[O+2]=P>>>8,this[O+3]=P&255,O+4};function I(P,O,$,Z,te){F(O,Z,te,P,$,7);let X=Number(O&BigInt(4294967295));P[$++]=X,X=X>>8,P[$++]=X,X=X>>8,P[$++]=X,X=X>>8,P[$++]=X;let ae=Number(O>>BigInt(32)&BigInt(4294967295));return P[$++]=ae,ae=ae>>8,P[$++]=ae,ae=ae>>8,P[$++]=ae,ae=ae>>8,P[$++]=ae,$}function D(P,O,$,Z,te){F(O,Z,te,P,$,7);let X=Number(O&BigInt(4294967295));P[$+7]=X,X=X>>8,P[$+6]=X,X=X>>8,P[$+5]=X,X=X>>8,P[$+4]=X;let ae=Number(O>>BigInt(32)&BigInt(4294967295));return P[$+3]=ae,ae=ae>>8,P[$+2]=ae,ae=ae>>8,P[$+1]=ae,ae=ae>>8,P[$]=ae,$+8}v.prototype.writeBigUInt64LE=gt(function(P,O=0){return I(this,P,O,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeBigUInt64BE=gt(function(P,O=0){return D(this,P,O,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeIntLE=function(P,O,$,Z){if(P=+P,O=O>>>0,!Z){let qe=Math.pow(2,8*$-1);E(this,P,O,$,qe-1,-qe)}let te=0,X=1,ae=0;for(this[O]=P&255;++te<$&&(X*=256);)P<0&&ae===0&&this[O+te-1]!==0&&(ae=1),this[O+te]=(P/X>>0)-ae&255;return O+$},v.prototype.writeIntBE=function(P,O,$,Z){if(P=+P,O=O>>>0,!Z){let qe=Math.pow(2,8*$-1);E(this,P,O,$,qe-1,-qe)}let te=$-1,X=1,ae=0;for(this[O+te]=P&255;--te>=0&&(X*=256);)P<0&&ae===0&&this[O+te+1]!==0&&(ae=1),this[O+te]=(P/X>>0)-ae&255;return O+$},v.prototype.writeInt8=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,1,127,-128),P<0&&(P=255+P+1),this[O]=P&255,O+1},v.prototype.writeInt16LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,32767,-32768),this[O]=P&255,this[O+1]=P>>>8,O+2},v.prototype.writeInt16BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,2,32767,-32768),this[O]=P>>>8,this[O+1]=P&255,O+2},v.prototype.writeInt32LE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,2147483647,-2147483648),this[O]=P&255,this[O+1]=P>>>8,this[O+2]=P>>>16,this[O+3]=P>>>24,O+4},v.prototype.writeInt32BE=function(P,O,$){return P=+P,O=O>>>0,$||E(this,P,O,4,2147483647,-2147483648),P<0&&(P=4294967295+P+1),this[O]=P>>>24,this[O+1]=P>>>16,this[O+2]=P>>>8,this[O+3]=P&255,O+4},v.prototype.writeBigInt64LE=gt(function(P,O=0){return I(this,P,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),v.prototype.writeBigInt64BE=gt(function(P,O=0){return D(this,P,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function z(P,O,$,Z,te,X){if($+Z>P.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("Index out of range")}function re(P,O,$,Z,te){return O=+O,$=$>>>0,te||z(P,O,$,4,34028234663852886e22,-34028234663852886e22),r.write(P,O,$,Z,23,4),$+4}v.prototype.writeFloatLE=function(P,O,$){return re(this,P,O,!0,$)},v.prototype.writeFloatBE=function(P,O,$){return re(this,P,O,!1,$)};function Q(P,O,$,Z,te){return O=+O,$=$>>>0,te||z(P,O,$,8,17976931348623157e292,-17976931348623157e292),r.write(P,O,$,Z,52,8),$+8}v.prototype.writeDoubleLE=function(P,O,$){return Q(this,P,O,!0,$)},v.prototype.writeDoubleBE=function(P,O,$){return Q(this,P,O,!1,$)},v.prototype.copy=function(P,O,$,Z){if(!v.isBuffer(P))throw new TypeError("argument should be a Buffer");if($||($=0),!Z&&Z!==0&&(Z=this.length),O>=P.length&&(O=P.length),O||(O=0),Z>0&&Z<$&&(Z=$),Z===$||P.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(Z<0)throw new RangeError("sourceEnd out of bounds");Z>this.length&&(Z=this.length),P.length-O<Z-$&&(Z=P.length-O+$);let te=Z-$;return this===P&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,$,Z):Uint8Array.prototype.set.call(P,this.subarray($,Z),O),te},v.prototype.fill=function(P,O,$,Z){if(typeof P=="string"){if(typeof O=="string"?(Z=O,O=0,$=this.length):typeof $=="string"&&(Z=$,$=this.length),Z!==void 0&&typeof Z!="string")throw new TypeError("encoding must be a string");if(typeof Z=="string"&&!v.isEncoding(Z))throw new TypeError("Unknown encoding: "+Z);if(P.length===1){let X=P.charCodeAt(0);(Z==="utf8"&&X<128||Z==="latin1")&&(P=X)}}else typeof P=="number"?P=P&255:typeof P=="boolean"&&(P=Number(P));if(O<0||this.length<O||this.length<$)throw new RangeError("Out of range index");if($<=O)return this;O=O>>>0,$=$===void 0?this.length:$>>>0,P||(P=0);let te;if(typeof P=="number")for(te=O;te<$;++te)this[te]=P;else{let X=v.isBuffer(P)?P:v.from(P,Z),ae=X.length;if(ae===0)throw new TypeError('The value "'+P+'" is invalid for argument "value"');for(te=0;te<$-O;++te)this[te+O]=X[te%ae]}return this};var L={};function q(P,O,$){L[P]=class extends ${constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${P}]`,this.stack,delete this.name}get code(){return P}set code(Z){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Z,writable:!0})}toString(){return`${this.name} [${P}]: ${this.message}`}}}q("ERR_BUFFER_OUT_OF_BOUNDS",function(P){return P?`${P} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),q("ERR_INVALID_ARG_TYPE",function(P,O){return`The "${P}" argument must be of type number. Received type ${typeof O}`},TypeError),q("ERR_OUT_OF_RANGE",function(P,O,$){let Z=`The value of "${P}" is out of range.`,te=$;return Number.isInteger($)&&Math.abs($)>2**32?te=se(String($)):typeof $=="bigint"&&(te=String($),($>BigInt(2)**BigInt(32)||$<-(BigInt(2)**BigInt(32)))&&(te=se(te)),te+="n"),Z+=` It must be ${O}. Received ${te}`,Z},RangeError);function se(P){let O="",$=P.length,Z=P[0]==="-"?1:0;for(;$>=Z+4;$-=3)O=`_${P.slice($-3,$)}${O}`;return`${P.slice(0,$)}${O}`}function ee(P,O,$){K(O,"offset"),(P[O]===void 0||P[O+$]===void 0)&&G(O,P.length-($+1))}function F(P,O,$,Z,te,X){if(P>$||P<O){let ae=typeof O=="bigint"?"n":"",qe;throw X>3?O===0||O===BigInt(0)?qe=`>= 0${ae} and < 2${ae} ** ${(X+1)*8}${ae}`:qe=`>= -(2${ae} ** ${(X+1)*8-1}${ae}) and < 2 ** ${(X+1)*8-1}${ae}`:qe=`>= ${O}${ae} and <= ${$}${ae}`,new L.ERR_OUT_OF_RANGE("value",qe,P)}ee(Z,te,X)}function K(P,O){if(typeof P!="number")throw new L.ERR_INVALID_ARG_TYPE(O,"number",P)}function G(P,O,$){throw Math.floor(P)!==P?(K(P,$),new L.ERR_OUT_OF_RANGE($||"offset","an integer",P)):O<0?new L.ERR_BUFFER_OUT_OF_BOUNDS:new L.ERR_OUT_OF_RANGE($||"offset",`>= ${$?1:0} and <= ${O}`,P)}var ne=/[^+/0-9A-Za-z-_]/g;function Re(P){if(P=P.split("=")[0],P=P.trim().replace(ne,""),P.length<2)return"";for(;P.length%4!==0;)P=P+"=";return P}function ie(P,O){O=O||1/0;let $,Z=P.length,te=null,X=[];for(let ae=0;ae<Z;++ae){if($=P.charCodeAt(ae),$>55295&&$<57344){if(!te){if($>56319){(O-=3)>-1&&X.push(239,191,189);continue}else if(ae+1===Z){(O-=3)>-1&&X.push(239,191,189);continue}te=$;continue}if($<56320){(O-=3)>-1&&X.push(239,191,189),te=$;continue}$=(te-55296<<10|$-56320)+65536}else te&&(O-=3)>-1&&X.push(239,191,189);if(te=null,$<128){if((O-=1)<0)break;X.push($)}else if($<2048){if((O-=2)<0)break;X.push($>>6|192,$&63|128)}else if($<65536){if((O-=3)<0)break;X.push($>>12|224,$>>6&63|128,$&63|128)}else if($<1114112){if((O-=4)<0)break;X.push($>>18|240,$>>12&63|128,$>>6&63|128,$&63|128)}else throw new Error("Invalid code point")}return X}function oe(P){let O=[];for(let $=0;$<P.length;++$)O.push(P.charCodeAt($)&255);return O}function Pe(P,O){let $,Z,te,X=[];for(let ae=0;ae<P.length&&!((O-=2)<0);++ae)$=P.charCodeAt(ae),Z=$>>8,te=$%256,X.push(te),X.push(Z);return X}function de(P){return e.toByteArray(Re(P))}function ye(P,O,$,Z){let te;for(te=0;te<Z&&!(te+$>=O.length||te>=P.length);++te)O[te+$]=P[te];return te}function pt(P,O){return P instanceof O||P!=null&&P.constructor!=null&&P.constructor.name!=null&&P.constructor.name===O.name}function Me(P){return P!==P}var Be=function(){let P="0123456789abcdef",O=new Array(256);for(let $=0;$<16;++$){let Z=$*16;for(let te=0;te<16;++te)O[Z+te]=P[$]+P[te]}return O}();function gt(P){return typeof BigInt>"u"?V:P}function V(){throw new Error("BigInt not supported")}}),gHe=Ic((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:H$().Buffer,Crypto:window.crypto}):e.exports={Buffer:H$().Buffer,Crypto:crypto}}),mpe={};lHe(mpe,{AVSCTap:()=>S6,ArweaveSigner:()=>mL,DataItem:()=>y6,MAX_TAG_BYTES:()=>c_,MIN_BINARY_SIZE:()=>yL,SIG_CONFIG:()=>cg,SignatureConfig:()=>eu,Signer:()=>gpe,createData:()=>_pe,deserializeTags:()=>r_,indexToType:()=>gL,serializeTags:()=>bL,tagsExceedLimit:()=>wpe});var gpe=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,f){throw new Error("You must implement verify method on child")}},bHe=N1(vL(),1),th=N1(vpe(),1);async function bpe(t){if(Array.isArray(t)){let n=(0,th.concatBuffers)([(0,th.stringToBuffer)("list"),(0,th.stringToBuffer)(t.length.toString())]);return await ype(t,await Ec().hash(n,"SHA-384"))}let e=t,r=(0,th.concatBuffers)([(0,th.stringToBuffer)("blob"),(0,th.stringToBuffer)(e.byteLength.toString())]),f=(0,th.concatBuffers)([await Ec().hash(r,"SHA-384"),await Ec().hash(e,"SHA-384")]);return await Ec().hash(f,"SHA-384")}async function ype(t,e){if(t.length<1)return e;let r=(0,th.concatBuffers)([e,await bpe(t[0])]),f=await Ec().hash(r,"SHA-384");return await ype(t.slice(1),f)}var w$=N1(vHe(),1),yHe=w$.default.default?w$.default.default:w$.default,wHe=class extends yHe{getPublicKey(t){throw new Error("Unimplemented")}},_He;function Ec(){return _He??=new wHe}var eu;(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"})(eu||(eu={}));var cg={[eu.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[eu.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[eu.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[eu.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[eu.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[eu.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[eu.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},mL=class{signatureType=1;ownerLength=cg[1].pubLength;signatureLength=cg[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return bHe.default.toBuffer(this.pk)}sign(t){return Ec().sign(this.jwk,t)}static async verify(t,e,r){return await Ec().verify(t,e,r)}},gL={1:mL},cl=N1(vL(),1);async function W$(t){return bpe([(0,th.stringToBuffer)("dataitem"),(0,th.stringToBuffer)("1"),(0,th.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function MHe(t,e){let r=await W$(t),f=await e.sign(r),n=await Ec().hash(f);return{signature:Te.from(f),id:Te.from(n)}}async function xHe(t,e){let{signature:r,id:f}=await MHe(t,e);return t.getRaw().set(r,2),f}var S6=class{buf;pos;constructor(t=Te.alloc(c_),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 f=t[r];if(f?.name===void 0||f?.value===void 0)throw new Error(`Invalid tag format for ${f}, expected {name:string, value: string}`);this.writeString(f.name),this.writeString(f.value)}this.writeLong(0)}toBuffer(){let t=Te.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,f;if(t>=-1073741824&&t<1073741824){f=t>=0?t<<1:~t<<1|1;do e[this.pos]=f&127,f>>=7;while(f&&(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=Te.byteLength(t),r=this.buf;this.writeLong(e);let f=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let n,h,p,v;for(n=0,h=e;n<h;n++)p=t.charCodeAt(n),p<128?r[f++]=p:p<2048?(r[f++]=p>>6|192,r[f++]=p&63|128):(p&64512)===55296&&((v=t.charCodeAt(n+1))&64512)===56320?(p=65536+((p&1023)<<10)+(v&1023),n++,r[f++]=p>>18|240,r[f++]=p>>12&63|128,r[f++]=p>>6&63|128,r[f++]=p&63|128):(r[f++]=p>>12|224,r[f++]=p>>6&63|128,r[f++]=p&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,f,n,h,p;do f=r[this.pos++],n=f&128,t|=(f&127)<<e,e+=7;while(n&&e<28);if(n){h=t,p=268435456;do f=r[this.pos++],h+=(f&127)*p,p*=128;while(f&128);return(h%2?-(h+1):h)/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(),f=this.readString();t.push({name:r,value:f})}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 bL(t){let e=new S6;return e.writeTags(t),e.toBuffer()}function wpe(t){let e=new S6;return e.writeTags(t),e.tagsExceedLimit()}function r_(t){return new S6(t).readTags()}function fd(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function SHe(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let f=t&255;e[r]=f,t=(t-f)/256}return Uint8Array.from(e)}function L0e(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let f=t&255;e[r]=f,t=(t-f)/256}return Uint8Array.from(e)}var EHe=N1(gHe(),1),Km=N1(H$(),1),c_=4096,yL=80,y6=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=fd(this.binary.subarray(0,2));if(eu?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return y6.verify(this.binary)}get id(){return(async()=>cl.default.encode(await this.rawId))()}set id(t){this._id=cl.default.toBuffer(t)}get rawId(){return(async()=>Km.Buffer.from(await EHe.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 cl.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 cg[this.signatureType].sigLength}get owner(){return cl.default.encode(this.rawOwner)}get ownerLength(){return cg[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Km.Buffer.alloc(0)}get target(){return cl.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Km.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=fd(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(fd(this.binary.subarray(t,t+8))==0)return[];let e=fd(this.binary.subarray(t+8,t+16));return r_(Km.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:cl.default.encode(t.name),value:cl.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=fd(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=fd(e),f=t+16+r;return this.binary.subarray(f,this.binary.length)}get data(){return cl.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await xHe(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Km.Buffer.from(await Ec().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:cl.default.encode(t.name),value:cl.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<yL)return!1;let e=new y6(t),r=e.signatureType,f=e.getTagsStart(),n=fd(t.subarray(f,f+8)),h=t.subarray(f+8,f+16),p=fd(h);if(p>c_)return!1;if(n>0)try{if(r_(Km.Buffer.from(t.subarray(f+16,f+16+p))).length!==n)return!1}catch{return!1}let v=gL[r],w=await W$(e);return await v.verify(e.rawOwner,w,e.rawSignature)}async getSignatureData(){return W$(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),f=this.binary[r]==1;return r+=f?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}},AHe=N1(vL(),1);function _pe(t,e,r){let f=e.publicKey,n=r?.target?AHe.default.toBuffer(r.target):null,h=1+(n?.byteLength??0),p=r?.anchor?Te.from(r.anchor):null,v=1+(p?.byteLength??0),w=(r?.tags?.length??0)>0?bL(r.tags):null,g=16+(w?w.byteLength:0),b=Te.from(t),M=b.byteLength,x=2+e.signatureLength+e.ownerLength+h+v+g+M,S=Te.alloc(x);if(S.set(SHe(e.signatureType),0),S.set(new Uint8Array(e.signatureLength).fill(0),2),f.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${f.byteLength}`);S.set(f,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(S[A]=n?1:0,n){if(n.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${n.byteLength}`);S.set(n,A+1)}let T=A+h,k=T+1;if(S[T]=p?1:0,p){if(k+=p.byteLength,p.byteLength!==32)throw new Error("Anchor must be 32 bytes");S.set(p,T+1)}S.set(L0e(r?.tags?.length??0),k);let B=L0e(w?.byteLength??0);S.set(B,k+8),w&&S.set(w,k+16);let C=k+g;return S.set(b,C),new y6(S)}var wL={...mpe};globalThis.arbundles??=wL;var RHe=wL,THe=wL;globalThis.Buffer||(globalThis.Buffer=cpe.Buffer);var{DataItem:IHe}=dpe;function kHe(t){return async({data:r,tags:f,target:n,anchor:h,createDataItem:p=v=>new IHe(v)})=>{let v=await t.signDataItem({data:r,tags:f,target:n,anchor:h}),w=p(cpe.Buffer.from(v));return{id:await w.id,raw:await w.getRaw()}}}var BHe=globalThis.GATEWAY_URL||void 0,PHe=globalThis.MU_URL||void 0,OHe=globalThis.CU_URL||void 0,NHe=globalThis.GRAPHQL_URL||void 0,{result:V_t,results:G_t,message:Y_t,spawn:J_t,monitor:X_t,unmonitor:Q_t,dryrun:e9t,assign:t9t}=ou({GATEWAY_URL:BHe,MU_URL:PHe,CU_URL:OHe,GRAPHQL_URL:NHe}),Mpe=lpe.createDataItemSigner;fe();he();ue();var v1e=zi(p1e(),1),__=v1e.default.init({host:"arweave.net",port:443,protocol:"https"});fe();he();ue();fe();he();ue();var fh=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},m1e=class extends fh{},g1e=class extends fh{},b1e=class extends fh{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},y1e=class extends fh{},M_=class extends fh{},w1e=class extends fh{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},wl=class extends fh{constructor(){super("Invalid contract configuration")}},_1e=class extends fh{constructor(){super("Invalid process configuration")}},M1e=class extends fh{};fe();he();ue();var mh=zi(k6e(),1);fe();he();ue();var Lg="3.11.0-alpha.2";var ys=class t{logger;silent=!1;static default=new t;constructor({level:e="info"}={}){e==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,mh.createLogger)({level:e,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:Lg},format:mh.format.combine(mh.format.timestamp(),mh.format.json()),transports:[new mh.transports.Console({format:mh.format.combine(mh.format.timestamp(),mh.format.json())})]})}info(e,...r){this.silent||this.logger.info(e,...r)}warn(e,...r){this.silent||this.logger.warn(e,...r)}error(e,...r){this.silent||this.logger.error(e,...r)}debug(e,...r){this.silent||this.logger.debug(e,...r)}setLogLevel(e){this.silent=e==="none","silent"in this.logger&&(this.logger.silent=e==="none"),"level"in this.logger&&(this.logger.level=e)}};fe();he();ue();fe();he();ue();var B6e=t=>{let e=Object.entries(t).sort(([r,f],[n,h])=>r==="@"?-1:n==="@"?1:"priority"in f&&!("priority"in h)?-1:!("priority"in f)&&"priority"in h?1:f.priority!==void 0&&h.priority!==void 0?f.priority===h.priority?r<n?-1:r>n?1:0:f.priority-h.priority:r<n?-1:r>n?1:0);return Object.fromEntries(e.map(([r,f],n)=>[r,{...f,index:n}]))};fe();he();ue();function Al(t,e){let r=t.safeParse(e);if(!r.success)throw new Error(JSON.stringify(r.error.format(),null,2));return r}fe();he();ue();fe();he();ue();fe();he();ue();Cu();var P6e="+",O6e="/",N6e="-",C6e="_",$6e="=";function qat(t){let e=t.length%4;return e&&(t+=$6e.repeat(4-e)),t.replaceAll(N6e,P6e).replaceAll(C6e,O6e)}function Fat(t){return t.replaceAll(P6e,N6e).replaceAll(O6e,C6e).replaceAll($6e,"")}function TPt(t){let e=qat(t);return Te.from(e,"base64")}function Dg(t){let e=t.toString("base64");return Fat(e)}function IPt(t){return Dg(Nu("sha256").update(Uint8Array.from(t)).digest())}function L6e(t=32){let e=VB(t);return Array.from(e,r=>r.toString(16).padStart(2,"0")).join("").slice(0,t)}fe();he();ue();fe();he();ue();function Tq(t){try{return JSON.parse(t)}catch{return t}}fe();he();ue();fe();he();ue();var kq=zi(U6e(),1);fe();he();ue();var Hat=Object.defineProperty,Wat=(t,e,r)=>e in t?Hat(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b3=(t,e,r)=>(Wat(t,typeof e!="symbol"?e+"":e,r),r),Bq=class{constructor(e){b3(this,"value"),b3(this,"next"),this.value=e}},Pq=class{constructor(){b3(this,"head"),b3(this,"tail"),b3(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let r=new Bq(e);return this.head&&this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function q6e(t){if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new Pq,r=0,f=()=>{r--,e.size>0&&e.pop()()},n=async(v,w,g)=>{r++;let b=(async()=>v(...g))();w(b);try{await b}catch{}f()},h=(v,w,g)=>{e.push(n.bind(null,v,w,g)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.pop()()))()},p=(v,...w)=>new Promise(g=>{h(v,g,w)});return Object.defineProperties(p,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),p}fe();he();ue();var y3=class{static init(e){return e!==void 0&&"signer"in e?new Oq(e):new B9(e)}},B9=class{process;constructor(e){if(e===void 0||Object.keys(e).length===0)this.process=new oa({processId:Hm});else if(Ed(e))this.process=e.process;else if(Ad(e))this.process=new oa({processId:e.processId});else throw new wl}async accessControlList({address:e}){return this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:e}]})}},Oq=class extends B9{signer;constructor({signer:e,...r}){super(r),this.signer=Sd(e)}async register({processId:e}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:e}],signer:this.signer})}};fe();he();ue();fe();he();ue();var Kat="https://faucet.ario.permaweb.services";function Cq({arioInstance:t,faucetApiUrl:e=Kat}){let r=new Nq({faucetUrl:e,processId:t.process.processId});return new Proxy(t,{get(n,h){if(h==="faucet")return r;if(h in n){let p=n[h];return typeof p=="function"?p.bind(n):p}}})}var Nq=class{faucetUrl;processId;constructor({faucetUrl:e,processId:r}){this.faucetUrl=e,this.processId=r}async captchaUrl(){let e=await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`,{method:"GET"});if(!e.ok){let f=await e.json().catch(()=>({error:e.statusText}));throw new Error(f.error)}return await e.json()}async claimWithCaptchaResponse({captchaResponse:e,recipient:r,quantity:f}){let n=await fetch(`${this.faucetUrl}/api/claim/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,recipient:r,quantity:f,captchaResponse:e})});if(!n.ok){let p=await n.json().catch(()=>({error:n.statusText}));throw new Error(p.error)}return await n.json()}async requestAuthToken({captchaResponse:e}){let r=await fetch(`${this.faucetUrl}/api/captcha/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,captchaResponse:e})});if(!r.ok){let n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error)}return await r.json()}async claimWithAuthToken({authToken:e,recipient:r,quantity:f}){let n=await fetch(`${this.faucetUrl}/api/claim/async`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({recipient:r,qty:f,processId:this.processId})});if(!n.ok){let p=await n.json().catch(()=>({error:n.statusText}));throw new Error(p.error)}return await n.json()}async verifyAuthToken({authToken:e}){let r=await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!r.ok){let n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error)}return await r.json()}};fe();he();ue();fe();he();ue();fe();he();ue();var po=[];for(P9=0;P9<256;++P9)po.push((P9+256).toString(16).slice(1));var P9;function F6e(t,e=0){return(po[t[e+0]]+po[t[e+1]]+po[t[e+2]]+po[t[e+3]]+"-"+po[t[e+4]]+po[t[e+5]]+"-"+po[t[e+6]]+po[t[e+7]]+"-"+po[t[e+8]]+po[t[e+9]]+"-"+po[t[e+10]]+po[t[e+11]]+po[t[e+12]]+po[t[e+13]]+po[t[e+14]]+po[t[e+15]]).toLowerCase()}fe();he();ue();var O9,Zat=new Uint8Array(16);function $q(){if(!O9&&(O9=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O9))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O9(Zat)}fe();he();ue();fe();he();ue();var Vat=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Lq={randomUUID:Vat};function Gat(t,e,r){if(Lq.randomUUID&&!e&&!t)return Lq.randomUUID();t=t||{};var f=t.random||(t.rng||$q)();if(f[6]=f[6]&15|64,f[8]=f[8]&63|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=f[n];return e}return F6e(f)}var Dq=Gat;fe();he();ue();var Uq=class t{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new t(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new t(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},qq=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMARIO(){return new w3(Math.floor(this.value*u$))}toString(){return`${this.value}`}},w3=class t extends Uq{constructor(e){super(e)}multiply(e){let r=Math.floor(this.valueOf()*e.valueOf());return new t(r)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/e.valueOf());return new t(r)}plus(e){let r=super.plus(e);return new t(r.valueOf())}minus(e){let r=super.minus(e);return new t(r.valueOf())}toARIO(){return new qq(this.valueOf()/u$)}};fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();function _3(t,e){return function(){return t.apply(e,arguments)}}var{toString:Yat}=Object.prototype,{getPrototypeOf:jq}=Object,C9=(t=>e=>{let r=Yat.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),gh=t=>(t=t.toLowerCase(),e=>C9(e)===t),$9=t=>e=>typeof e===t,{isArray:Ug}=Array,M3=$9("undefined");function Jat(t){return t!==null&&!M3(t)&&t.constructor!==null&&!M3(t.constructor)&&Ys(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var z6e=gh("ArrayBuffer");function Xat(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&z6e(t.buffer),e}var Qat=$9("string"),Ys=$9("function"),H6e=$9("number"),L9=t=>t!==null&&typeof t=="object",eot=t=>t===!0||t===!1,N9=t=>{if(C9(t)!=="object")return!1;let e=jq(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},tot=gh("Date"),rot=gh("File"),iot=gh("Blob"),not=gh("FileList"),aot=t=>L9(t)&&Ys(t.pipe),oot=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ys(t.append)&&((e=C9(t))==="formdata"||e==="object"&&Ys(t.toString)&&t.toString()==="[object FormData]"))},sot=gh("URLSearchParams"),[fot,uot,hot,lot]=["ReadableStream","Request","Response","Headers"].map(gh),cot=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function x3(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let f,n;if(typeof t!="object"&&(t=[t]),Ug(t))for(f=0,n=t.length;f<n;f++)e.call(null,t[f],f,t);else{let h=r?Object.getOwnPropertyNames(t):Object.keys(t),p=h.length,v;for(f=0;f<p;f++)v=h[f],e.call(null,t[v],v,t)}}function W6e(t,e){e=e.toLowerCase();let r=Object.keys(t),f=r.length,n;for(;f-- >0;)if(n=r[f],e===n.toLowerCase())return n;return null}var Q1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,K6e=t=>!M3(t)&&t!==Q1;function Fq(){let{caseless:t}=K6e(this)&&this||{},e={},r=(f,n)=>{let h=t&&W6e(e,n)||n;N9(e[h])&&N9(f)?e[h]=Fq(e[h],f):N9(f)?e[h]=Fq({},f):Ug(f)?e[h]=f.slice():e[h]=f};for(let f=0,n=arguments.length;f<n;f++)arguments[f]&&x3(arguments[f],r);return e}var dot=(t,e,r,{allOwnKeys:f}={})=>(x3(e,(n,h)=>{r&&Ys(n)?t[h]=_3(n,r):t[h]=n},{allOwnKeys:f}),t),pot=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),vot=(t,e,r,f)=>{t.prototype=Object.create(e.prototype,f),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},mot=(t,e,r,f)=>{let n,h,p,v={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),h=n.length;h-- >0;)p=n[h],(!f||f(p,t,e))&&!v[p]&&(e[p]=t[p],v[p]=!0);t=r!==!1&&jq(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},got=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let f=t.indexOf(e,r);return f!==-1&&f===r},bot=t=>{if(!t)return null;if(Ug(t))return t;let e=t.length;if(!H6e(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},yot=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&jq(Uint8Array)),wot=(t,e)=>{let f=(t&&t[Symbol.iterator]).call(t),n;for(;(n=f.next())&&!n.done;){let h=n.value;e.call(t,h[0],h[1])}},_ot=(t,e)=>{let r,f=[];for(;(r=t.exec(e))!==null;)f.push(r);return f},Mot=gh("HTMLFormElement"),xot=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,f,n){return f.toUpperCase()+n}),j6e=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Sot=gh("RegExp"),Z6e=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),f={};x3(r,(n,h)=>{let p;(p=e(n,h,t))!==!1&&(f[h]=p||n)}),Object.defineProperties(t,f)},Eot=t=>{Z6e(t,(e,r)=>{if(Ys(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let f=t[r];if(Ys(f)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Aot=(t,e)=>{let r={},f=n=>{n.forEach(h=>{r[h]=!0})};return Ug(t)?f(t):f(String(t).split(e)),r},Rot=()=>{},Tot=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Iot(t){return!!(t&&Ys(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var kot=t=>{let e=new Array(10),r=(f,n)=>{if(L9(f)){if(e.indexOf(f)>=0)return;if(!("toJSON"in f)){e[n]=f;let h=Ug(f)?[]:{};return x3(f,(p,v)=>{let w=r(p,n+1);!M3(w)&&(h[v]=w)}),e[n]=void 0,h}}return f};return r(t,0)},Bot=gh("AsyncFunction"),Pot=t=>t&&(L9(t)||Ys(t))&&Ys(t.then)&&Ys(t.catch),V6e=((t,e)=>t?setImmediate:e?((r,f)=>(Q1.addEventListener("message",({source:n,data:h})=>{n===Q1&&h===r&&f.length&&f.shift()()},!1),n=>{f.push(n),Q1.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ys(Q1.postMessage)),Oot=typeof queueMicrotask<"u"?queueMicrotask.bind(Q1):typeof Le<"u"&&Le.nextTick||V6e,Tt={isArray:Ug,isArrayBuffer:z6e,isBuffer:Jat,isFormData:oot,isArrayBufferView:Xat,isString:Qat,isNumber:H6e,isBoolean:eot,isObject:L9,isPlainObject:N9,isReadableStream:fot,isRequest:uot,isResponse:hot,isHeaders:lot,isUndefined:M3,isDate:tot,isFile:rot,isBlob:iot,isRegExp:Sot,isFunction:Ys,isStream:aot,isURLSearchParams:sot,isTypedArray:yot,isFileList:not,forEach:x3,merge:Fq,extend:dot,trim:cot,stripBOM:pot,inherits:vot,toFlatObject:mot,kindOf:C9,kindOfTest:gh,endsWith:got,toArray:bot,forEachEntry:wot,matchAll:_ot,isHTMLForm:Mot,hasOwnProperty:j6e,hasOwnProp:j6e,reduceDescriptors:Z6e,freezeMethods:Eot,toObjectSet:Aot,toCamelCase:xot,noop:Rot,toFiniteNumber:Tot,findKey:W6e,global:Q1,isContextDefined:K6e,isSpecCompliantForm:Iot,toJSONObject:kot,isAsyncFn:Bot,isThenable:Pot,setImmediate:V6e,asap:Oot};fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();function qg(t,e,r,f,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),f&&(this.request=f),n&&(this.response=n,this.status=n.status?n.status:null)}Tt.inherits(qg,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Tt.toJSONObject(this.config),code:this.code,status:this.status}}});var G6e=qg.prototype,Y6e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Y6e[t]={value:t}});Object.defineProperties(qg,Y6e);Object.defineProperty(G6e,"isAxiosError",{value:!0});qg.from=(t,e,r,f,n,h)=>{let p=Object.create(G6e);return Tt.toFlatObject(t,p,function(w){return w!==Error.prototype},v=>v!=="isAxiosError"),qg.call(p,t.message,e,r,f,n),p.cause=t,p.name=t.name,h&&Object.assign(p,h),p};var Fr=qg;fe();he();ue();var D9=null;function zq(t){return Tt.isPlainObject(t)||Tt.isArray(t)}function X6e(t){return Tt.endsWith(t,"[]")?t.slice(0,-2):t}function J6e(t,e,r){return t?t.concat(e).map(function(n,h){return n=X6e(n),!r&&h?"["+n+"]":n}).join(r?".":""):e}function Not(t){return Tt.isArray(t)&&!t.some(zq)}var Cot=Tt.toFlatObject(Tt,{},null,function(e){return/^is[A-Z]/.test(e)});function $ot(t,e,r){if(!Tt.isObject(t))throw new TypeError("target must be an object");e=e||new(D9||FormData),r=Tt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,k){return!Tt.isUndefined(k[T])});let f=r.metaTokens,n=r.visitor||b,h=r.dots,p=r.indexes,w=(r.Blob||typeof Blob<"u"&&Blob)&&Tt.isSpecCompliantForm(e);if(!Tt.isFunction(n))throw new TypeError("visitor must be a function");function g(A){if(A===null)return"";if(Tt.isDate(A))return A.toISOString();if(!w&&Tt.isBlob(A))throw new Fr("Blob is not supported. Use a Buffer instead.");return Tt.isArrayBuffer(A)||Tt.isTypedArray(A)?w&&typeof Blob=="function"?new Blob([A]):Te.from(A):A}function b(A,T,k){let B=A;if(A&&!k&&typeof A=="object"){if(Tt.endsWith(T,"{}"))T=f?T:T.slice(0,-2),A=JSON.stringify(A);else if(Tt.isArray(A)&&Not(A)||(Tt.isFileList(A)||Tt.endsWith(T,"[]"))&&(B=Tt.toArray(A)))return T=X6e(T),B.forEach(function(N,W){!(Tt.isUndefined(N)||N===null)&&e.append(p===!0?J6e([T],W,h):p===null?T:T+"[]",g(N))}),!1}return zq(A)?!0:(e.append(J6e(k,T,h),g(A)),!1)}let M=[],x=Object.assign(Cot,{defaultVisitor:b,convertValue:g,isVisitable:zq});function S(A,T){if(!Tt.isUndefined(A)){if(M.indexOf(A)!==-1)throw Error("Circular reference detected in "+T.join("."));M.push(A),Tt.forEach(A,function(B,C){(!(Tt.isUndefined(B)||B===null)&&n.call(e,B,Tt.isString(C)?C.trim():C,T,x))===!0&&S(B,T?T.concat(C):[C])}),M.pop()}}if(!Tt.isObject(t))throw new TypeError("data must be an object");return S(t),e}var Rd=$ot;function Q6e(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(f){return e[f]})}function e3e(t,e){this._pairs=[],t&&Rd(t,this,e)}var t3e=e3e.prototype;t3e.append=function(e,r){this._pairs.push([e,r])};t3e.toString=function(e){let r=e?function(f){return e.call(this,f,Q6e)}:Q6e;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var U9=e3e;function Lot(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function S3(t,e,r){if(!e)return t;let f=r&&r.encode||Lot;Tt.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,h;if(n?h=n(e,r):h=Tt.isURLSearchParams(e)?e.toString():new U9(e,r).toString(f),h){let p=t.indexOf("#");p!==-1&&(t=t.slice(0,p)),t+=(t.indexOf("?")===-1?"?":"&")+h}return t}fe();he();ue();var Hq=class{constructor(){this.handlers=[]}use(e,r,f){return this.handlers.push({fulfilled:e,rejected:r,synchronous:f?f.synchronous:!1,runWhen:f?f.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Tt.forEach(this.handlers,function(f){f!==null&&e(f)})}},Wq=Hq;fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();var q9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};fe();he();ue();fe();he();ue();fe();he();ue();fe();he();ue();var r3e=typeof URLSearchParams<"u"?URLSearchParams:U9;fe();he();ue();var i3e=typeof FormData<"u"?FormData:null;fe();he();ue();var n3e=typeof Blob<"u"?Blob:null;var a3e={isBrowser:!0,classes:{URLSearchParams:r3e,FormData:i3e,Blob:n3e},protocols:["http","https","file","blob","url","data"]};var Vq={};$o(Vq,{hasBrowserEnv:()=>Zq,hasStandardBrowserEnv:()=>Dot,hasStandardBrowserWebWorkerEnv:()=>Uot,navigator:()=>Kq,origin:()=>qot});fe();he();ue();var Zq=typeof window<"u"&&typeof document<"u",Kq=typeof navigator=="object"&&navigator||void 0,Dot=Zq&&(!Kq||["ReactNative","NativeScript","NS"].indexOf(Kq.product)<0),Uot=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qot=Zq&&window.location.href||"http://localhost";var Kn={...Vq,...a3e};function Gq(t,e){return Rd(t,new Kn.classes.URLSearchParams,Object.assign({visitor:function(r,f,n,h){return Kn.isNode&&Tt.isBuffer(r)?(this.append(f,r.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)}},e))}fe();he();ue();function Fot(t){return Tt.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function jot(t){let e={},r=Object.keys(t),f,n=r.length,h;for(f=0;f<n;f++)h=r[f],e[h]=t[h];return e}function zot(t){function e(r,f,n,h){let p=r[h++];if(p==="__proto__")return!0;let v=Number.isFinite(+p),w=h>=r.length;return p=!p&&Tt.isArray(n)?n.length:p,w?(Tt.hasOwnProp(n,p)?n[p]=[n[p],f]:n[p]=f,!v):((!n[p]||!Tt.isObject(n[p]))&&(n[p]=[]),e(r,f,n[p],h)&&Tt.isArray(n[p])&&(n[p]=jot(n[p])),!v)}if(Tt.isFormData(t)&&Tt.isFunction(t.entries)){let r={};return Tt.forEachEntry(t,(f,n)=>{e(Fot(f),n,r,0)}),r}return null}var F9=zot;function Hot(t,e,r){if(Tt.isString(t))try{return(e||JSON.parse)(t),Tt.trim(t)}catch(f){if(f.name!=="SyntaxError")throw f}return(r||JSON.stringify)(t)}var Yq={transitional:q9,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let f=r.getContentType()||"",n=f.indexOf("application/json")>-1,h=Tt.isObject(e);if(h&&Tt.isHTMLForm(e)&&(e=new FormData(e)),Tt.isFormData(e))return n?JSON.stringify(F9(e)):e;if(Tt.isArrayBuffer(e)||Tt.isBuffer(e)||Tt.isStream(e)||Tt.isFile(e)||Tt.isBlob(e)||Tt.isReadableStream(e))return e;if(Tt.isArrayBufferView(e))return e.buffer;if(Tt.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let v;if(h){if(f.indexOf("application/x-www-form-urlencoded")>-1)return Gq(e,this.formSerializer).toString();if((v=Tt.isFileList(e))||f.indexOf("multipart/form-data")>-1){let w=this.env&&this.env.FormData;return Rd(v?{"files[]":e}:e,w&&new w,this.formSerializer)}}return h||n?(r.setContentType("application/json",!1),Hot(e)):e}],transformResponse:[function(e){let r=this.transitional||Yq.transitional,f=r&&r.forcedJSONParsing,n=this.responseType==="json";if(Tt.isResponse(e)||Tt.isReadableStream(e))return e;if(e&&Tt.isString(e)&&(f&&!this.responseType||n)){let p=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(v){if(p)throw v.name==="SyntaxError"?Fr.from(v,Fr.ERR_BAD_RESPONSE,this,null,this.response):v}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Kn.classes.FormData,Blob:Kn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Tt.forEach(["delete","get","head","post","put","patch"],t=>{Yq.headers[t]={}});var Fg=Yq;fe();he();ue();fe();he();ue();var Wot=Tt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),o3e=t=>{let e={},r,f,n;return t&&t.split(`
|
|
213
213
|
`).forEach(function(p){n=p.indexOf(":"),r=p.substring(0,n).trim().toLowerCase(),f=p.substring(n+1).trim(),!(!r||e[r]&&Wot[r])&&(r==="set-cookie"?e[r]?e[r].push(f):e[r]=[f]:e[r]=e[r]?e[r]+", "+f:f)}),e};var s3e=Symbol("internals");function E3(t){return t&&String(t).trim().toLowerCase()}function j9(t){return t===!1||t==null?t:Tt.isArray(t)?t.map(j9):String(t)}function Kot(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,f;for(;f=r.exec(t);)e[f[1]]=f[2];return e}var Zot=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Jq(t,e,r,f,n){if(Tt.isFunction(f))return f.call(this,e,r);if(n&&(e=r),!!Tt.isString(e)){if(Tt.isString(f))return e.indexOf(f)!==-1;if(Tt.isRegExp(f))return f.test(e)}}function Vot(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,f)=>r.toUpperCase()+f)}function Got(t,e){let r=Tt.toCamelCase(" "+e);["get","set","has"].forEach(f=>{Object.defineProperty(t,f+r,{value:function(n,h,p){return this[f].call(this,e,n,h,p)},configurable:!0})})}var jg=class{constructor(e){e&&this.set(e)}set(e,r,f){let n=this;function h(v,w,g){let b=E3(w);if(!b)throw new Error("header name must be a non-empty string");let M=Tt.findKey(n,b);(!M||n[M]===void 0||g===!0||g===void 0&&n[M]!==!1)&&(n[M||w]=j9(v))}let p=(v,w)=>Tt.forEach(v,(g,b)=>h(g,b,w));if(Tt.isPlainObject(e)||e instanceof this.constructor)p(e,r);else if(Tt.isString(e)&&(e=e.trim())&&!Zot(e))p(o3e(e),r);else if(Tt.isHeaders(e))for(let[v,w]of e.entries())h(w,v,f);else e!=null&&h(r,e,f);return this}get(e,r){if(e=E3(e),e){let f=Tt.findKey(this,e);if(f){let n=this[f];if(!r)return n;if(r===!0)return Kot(n);if(Tt.isFunction(r))return r.call(this,n,f);if(Tt.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=E3(e),e){let f=Tt.findKey(this,e);return!!(f&&this[f]!==void 0&&(!r||Jq(this,this[f],f,r)))}return!1}delete(e,r){let f=this,n=!1;function h(p){if(p=E3(p),p){let v=Tt.findKey(f,p);v&&(!r||Jq(f,f[v],v,r))&&(delete f[v],n=!0)}}return Tt.isArray(e)?e.forEach(h):h(e),n}clear(e){let r=Object.keys(this),f=r.length,n=!1;for(;f--;){let h=r[f];(!e||Jq(this,this[h],h,e,!0))&&(delete this[h],n=!0)}return n}normalize(e){let r=this,f={};return Tt.forEach(this,(n,h)=>{let p=Tt.findKey(f,h);if(p){r[p]=j9(n),delete r[h];return}let v=e?Vot(h):String(h).trim();v!==h&&delete r[h],r[v]=j9(n),f[v]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return Tt.forEach(this,(f,n)=>{f!=null&&f!==!1&&(r[n]=e&&Tt.isArray(f)?f.join(", "):f)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
214
214
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let f=new this(e);return r.forEach(n=>f.set(n)),f}static accessor(e){let f=(this[s3e]=this[s3e]={accessors:{}}).accessors,n=this.prototype;function h(p){let v=E3(p);f[v]||(Got(n,p),f[v]=!0)}return Tt.isArray(e)?e.forEach(h):h(e),this}};jg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Tt.reduceDescriptors(jg.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(f){this[r]=f}}});Tt.freezeMethods(jg);var Ca=jg;function A3(t,e){let r=this||Fg,f=e||r,n=Ca.from(f.headers),h=f.data;return Tt.forEach(t,function(v){h=v.call(r,h,n.normalize(),e?e.status:void 0)}),n.normalize(),h}fe();he();ue();function R3(t){return!!(t&&t.__CANCEL__)}fe();he();ue();function f3e(t,e,r){Fr.call(this,t??"canceled",Fr.ERR_CANCELED,e,r),this.name="CanceledError"}Tt.inherits(f3e,Fr,{__CANCEL__:!0});var Rl=f3e;fe();he();ue();fe();he();ue();fe();he();ue();function T3(t,e,r){let f=r.config.validateStatus;!r.status||!f||f(r.status)?t(r):e(new Fr("Request failed with status code "+r.status,[Fr.ERR_BAD_REQUEST,Fr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}fe();he();ue();function Xq(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}fe();he();ue();fe();he();ue();function Yot(t,e){t=t||10;let r=new Array(t),f=new Array(t),n=0,h=0,p;return e=e!==void 0?e:1e3,function(w){let g=Date.now(),b=f[h];p||(p=g),r[n]=w,f[n]=g;let M=h,x=0;for(;M!==n;)x+=r[M++],M=M%t;if(n=(n+1)%t,n===h&&(h=(h+1)%t),g-p<e)return;let S=b&&g-b;return S?Math.round(x*1e3/S):void 0}}var u3e=Yot;fe();he();ue();function Jot(t,e){let r=0,f=1e3/e,n,h,p=(g,b=Date.now())=>{r=b,n=null,h&&(clearTimeout(h),h=null),t.apply(null,g)};return[(...g)=>{let b=Date.now(),M=b-r;M>=f?p(g,b):(n=g,h||(h=setTimeout(()=>{h=null,p(n)},f-M)))},()=>n&&p(n)]}var h3e=Jot;var zg=(t,e,r=3)=>{let f=0,n=u3e(50,250);return h3e(h=>{let p=h.loaded,v=h.lengthComputable?h.total:void 0,w=p-f,g=n(w),b=p<=v;f=p;let M={loaded:p,total:v,progress:v?p/v:void 0,bytes:w,rate:g||void 0,estimated:g&&v&&b?(v-p)/g:void 0,event:h,lengthComputable:v!=null,[e?"download":"upload"]:!0};t(M)},r)},Qq=(t,e)=>{let r=t!=null;return[f=>e[0]({lengthComputable:r,total:t,loaded:f}),e[1]]},eF=t=>(...e)=>Tt.asap(()=>t(...e));fe();he();ue();fe();he();ue();var l3e=Kn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Kn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Kn.origin),Kn.navigator&&/(msie|trident)/i.test(Kn.navigator.userAgent)):()=>!0;fe();he();ue();var c3e=Kn.hasStandardBrowserEnv?{write(t,e,r,f,n,h){let p=[t+"="+encodeURIComponent(e)];Tt.isNumber(r)&&p.push("expires="+new Date(r).toGMTString()),Tt.isString(f)&&p.push("path="+f),Tt.isString(n)&&p.push("domain="+n),h===!0&&p.push("secure"),document.cookie=p.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(){}};fe();he();ue();fe();he();ue();function tF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}fe();he();ue();function rF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function I3(t,e,r){let f=!tF(e);return t&&(f||r==!1)?rF(t,e):e}fe();he();ue();var d3e=t=>t instanceof Ca?{...t}:t;function bh(t,e){e=e||{};let r={};function f(g,b,M,x){return Tt.isPlainObject(g)&&Tt.isPlainObject(b)?Tt.merge.call({caseless:x},g,b):Tt.isPlainObject(b)?Tt.merge({},b):Tt.isArray(b)?b.slice():b}function n(g,b,M,x){if(Tt.isUndefined(b)){if(!Tt.isUndefined(g))return f(void 0,g,M,x)}else return f(g,b,M,x)}function h(g,b){if(!Tt.isUndefined(b))return f(void 0,b)}function p(g,b){if(Tt.isUndefined(b)){if(!Tt.isUndefined(g))return f(void 0,g)}else return f(void 0,b)}function v(g,b,M){if(M in e)return f(g,b);if(M in t)return f(void 0,g)}let w={url:h,method:h,data:h,baseURL:p,transformRequest:p,transformResponse:p,paramsSerializer:p,timeout:p,timeoutMessage:p,withCredentials:p,withXSRFToken:p,adapter:p,responseType:p,xsrfCookieName:p,xsrfHeaderName:p,onUploadProgress:p,onDownloadProgress:p,decompress:p,maxContentLength:p,maxBodyLength:p,beforeRedirect:p,transport:p,httpAgent:p,httpsAgent:p,cancelToken:p,socketPath:p,responseEncoding:p,validateStatus:v,headers:(g,b,M)=>n(d3e(g),d3e(b),M,!0)};return Tt.forEach(Object.keys(Object.assign({},t,e)),function(b){let M=w[b]||n,x=M(t[b],e[b],b);Tt.isUndefined(x)&&M!==v||(r[b]=x)}),r}var z9=t=>{let e=bh({},t),{data:r,withXSRFToken:f,xsrfHeaderName:n,xsrfCookieName:h,headers:p,auth:v}=e;e.headers=p=Ca.from(p),e.url=S3(I3(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),v&&p.set("Authorization","Basic "+btoa((v.username||"")+":"+(v.password?unescape(encodeURIComponent(v.password)):"")));let w;if(Tt.isFormData(r)){if(Kn.hasStandardBrowserEnv||Kn.hasStandardBrowserWebWorkerEnv)p.setContentType(void 0);else if((w=p.getContentType())!==!1){let[g,...b]=w?w.split(";").map(M=>M.trim()).filter(Boolean):[];p.setContentType([g||"multipart/form-data",...b].join("; "))}}if(Kn.hasStandardBrowserEnv&&(f&&Tt.isFunction(f)&&(f=f(e)),f||f!==!1&&l3e(e.url))){let g=n&&h&&c3e.read(h);g&&p.set(n,g)}return e};var Xot=typeof XMLHttpRequest<"u",p3e=Xot&&function(t){return new Promise(function(r,f){let n=z9(t),h=n.data,p=Ca.from(n.headers).normalize(),{responseType:v,onUploadProgress:w,onDownloadProgress:g}=n,b,M,x,S,A;function T(){S&&S(),A&&A(),n.cancelToken&&n.cancelToken.unsubscribe(b),n.signal&&n.signal.removeEventListener("abort",b)}let k=new XMLHttpRequest;k.open(n.method.toUpperCase(),n.url,!0),k.timeout=n.timeout;function B(){if(!k)return;let N=Ca.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),H={data:!v||v==="text"||v==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:N,config:t,request:k};T3(function(U){r(U),T()},function(U){f(U),T()},H),k=null}"onloadend"in k?k.onloadend=B:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(B)},k.onabort=function(){k&&(f(new Fr("Request aborted",Fr.ECONNABORTED,t,k)),k=null)},k.onerror=function(){f(new Fr("Network Error",Fr.ERR_NETWORK,t,k)),k=null},k.ontimeout=function(){let W=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",H=n.transitional||q9;n.timeoutErrorMessage&&(W=n.timeoutErrorMessage),f(new Fr(W,H.clarifyTimeoutError?Fr.ETIMEDOUT:Fr.ECONNABORTED,t,k)),k=null},h===void 0&&p.setContentType(null),"setRequestHeader"in k&&Tt.forEach(p.toJSON(),function(W,H){k.setRequestHeader(H,W)}),Tt.isUndefined(n.withCredentials)||(k.withCredentials=!!n.withCredentials),v&&v!=="json"&&(k.responseType=n.responseType),g&&([x,A]=zg(g,!0),k.addEventListener("progress",x)),w&&k.upload&&([M,S]=zg(w),k.upload.addEventListener("progress",M),k.upload.addEventListener("loadend",S)),(n.cancelToken||n.signal)&&(b=N=>{k&&(f(!N||N.type?new Rl(null,t,k):N),k.abort(),k=null)},n.cancelToken&&n.cancelToken.subscribe(b),n.signal&&(n.signal.aborted?b():n.signal.addEventListener("abort",b)));let C=Xq(n.url);if(C&&Kn.protocols.indexOf(C)===-1){f(new Fr("Unsupported protocol "+C+":",Fr.ERR_BAD_REQUEST,t));return}k.send(h||null)})};fe();he();ue();fe();he();ue();var Qot=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let f=new AbortController,n,h=function(g){if(!n){n=!0,v();let b=g instanceof Error?g:this.reason;f.abort(b instanceof Fr?b:new Rl(b instanceof Error?b.message:b))}},p=e&&setTimeout(()=>{p=null,h(new Fr(`timeout ${e} of ms exceeded`,Fr.ETIMEDOUT))},e),v=()=>{t&&(p&&clearTimeout(p),p=null,t.forEach(g=>{g.unsubscribe?g.unsubscribe(h):g.removeEventListener("abort",h)}),t=null)};t.forEach(g=>g.addEventListener("abort",h));let{signal:w}=f;return w.unsubscribe=()=>Tt.asap(v),w}},v3e=Qot;fe();he();ue();var est=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let f=0,n;for(;f<r;)n=f+e,yield t.slice(f,n),f=n},tst=async function*(t,e){for await(let r of rst(t))yield*est(r,e)},rst=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:f}=await e.read();if(r)break;yield f}}finally{await e.cancel()}},iF=(t,e,r,f)=>{let n=tst(t,e),h=0,p,v=w=>{p||(p=!0,f&&f(w))};return new ReadableStream({async pull(w){try{let{done:g,value:b}=await n.next();if(g){v(),w.close();return}let M=b.byteLength;if(r){let x=h+=M;r(x)}w.enqueue(new Uint8Array(b))}catch(g){throw v(g),g}},cancel(w){return v(w),n.return()}},{highWaterMark:2})};var W9=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",g3e=W9&&typeof ReadableStream=="function",ist=W9&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),b3e=(t,...e)=>{try{return!!t(...e)}catch{return!1}},nst=g3e&&b3e(()=>{let t=!1,e=new Request(Kn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),m3e=64*1024,nF=g3e&&b3e(()=>Tt.isReadableStream(new Response("").body)),H9={stream:nF&&(t=>t.body)};W9&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!H9[e]&&(H9[e]=Tt.isFunction(t[e])?r=>r[e]():(r,f)=>{throw new Fr(`Response type '${e}' is not supported`,Fr.ERR_NOT_SUPPORT,f)})})})(new Response);var ast=async t=>{if(t==null)return 0;if(Tt.isBlob(t))return t.size;if(Tt.isSpecCompliantForm(t))return(await new Request(Kn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Tt.isArrayBufferView(t)||Tt.isArrayBuffer(t))return t.byteLength;if(Tt.isURLSearchParams(t)&&(t=t+""),Tt.isString(t))return(await ist(t)).byteLength},ost=async(t,e)=>{let r=Tt.toFiniteNumber(t.getContentLength());return r??ast(e)},y3e=W9&&(async t=>{let{url:e,method:r,data:f,signal:n,cancelToken:h,timeout:p,onDownloadProgress:v,onUploadProgress:w,responseType:g,headers:b,withCredentials:M="same-origin",fetchOptions:x}=z9(t);g=g?(g+"").toLowerCase():"text";let S=v3e([n,h&&h.toAbortSignal()],p),A,T=S&&S.unsubscribe&&(()=>{S.unsubscribe()}),k;try{if(w&&nst&&r!=="get"&&r!=="head"&&(k=await ost(b,f))!==0){let H=new Request(e,{method:"POST",body:f,duplex:"half"}),J;if(Tt.isFormData(f)&&(J=H.headers.get("content-type"))&&b.setContentType(J),H.body){let[U,j]=Qq(k,zg(eF(w)));f=iF(H.body,m3e,U,j)}}Tt.isString(M)||(M=M?"include":"omit");let B="credentials"in Request.prototype;A=new Request(e,{...x,signal:S,method:r.toUpperCase(),headers:b.normalize().toJSON(),body:f,duplex:"half",credentials:B?M:void 0});let C=await fetch(A),N=nF&&(g==="stream"||g==="response");if(nF&&(v||N&&T)){let H={};["status","statusText","headers"].forEach(Y=>{H[Y]=C[Y]});let J=Tt.toFiniteNumber(C.headers.get("content-length")),[U,j]=v&&Qq(J,zg(eF(v),!0))||[];C=new Response(iF(C.body,m3e,U,()=>{j&&j(),T&&T()}),H)}g=g||"text";let W=await H9[Tt.findKey(H9,g)||"text"](C,t);return!N&&T&&T(),await new Promise((H,J)=>{T3(H,J,{data:W,headers:Ca.from(C.headers),status:C.status,statusText:C.statusText,config:t,request:A})})}catch(B){throw T&&T(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new Fr("Network Error",Fr.ERR_NETWORK,t,A),{cause:B.cause||B}):Fr.from(B,B&&B.code,t,A)}});var aF={http:D9,xhr:p3e,fetch:y3e};Tt.forEach(aF,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var w3e=t=>`- ${t}`,sst=t=>Tt.isFunction(t)||t===null||t===!1,K9={getAdapter:t=>{t=Tt.isArray(t)?t:[t];let{length:e}=t,r,f,n={};for(let h=0;h<e;h++){r=t[h];let p;if(f=r,!sst(r)&&(f=aF[(p=String(r)).toLowerCase()],f===void 0))throw new Fr(`Unknown adapter '${p}'`);if(f)break;n[p||"#"+h]=f}if(!f){let h=Object.entries(n).map(([v,w])=>`adapter ${v} `+(w===!1?"is not supported by the environment":"is not available in the build")),p=e?h.length>1?`since :
|
|
215
215
|
`+h.map(w3e).join(`
|
|
@@ -69,7 +69,7 @@ const createWayfinderClient = ({ httpClient, resolveUrl, }) => {
|
|
|
69
69
|
// support direct calls: fetch('ar://…', options)
|
|
70
70
|
// axios() or got()
|
|
71
71
|
apply: (_target, _thisArg, argArray) => wayfinderRedirect(httpClient, argArray),
|
|
72
|
-
// support http clients that use
|
|
72
|
+
// support http clients that use functions like `got.get`, `got.post`, `axios.get`, etc. while still using the wayfinder redirect function
|
|
73
73
|
get: (target, prop, receiver) => {
|
|
74
74
|
const value = Reflect.get(target, prop, receiver);
|
|
75
75
|
if (typeof value === 'function') {
|
package/lib/cjs/version.js
CHANGED
|
@@ -65,7 +65,7 @@ export const createWayfinderClient = ({ httpClient, resolveUrl, }) => {
|
|
|
65
65
|
// support direct calls: fetch('ar://…', options)
|
|
66
66
|
// axios() or got()
|
|
67
67
|
apply: (_target, _thisArg, argArray) => wayfinderRedirect(httpClient, argArray),
|
|
68
|
-
// support http clients that use
|
|
68
|
+
// support http clients that use functions like `got.get`, `got.post`, `axios.get`, etc. while still using the wayfinder redirect function
|
|
69
69
|
get: (target, prop, receiver) => {
|
|
70
70
|
const value = Reflect.get(target, prop, receiver);
|
|
71
71
|
if (typeof value === 'function') {
|
package/lib/esm/version.js
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { WayfinderRouter } from '../../types/wayfinder.js';
|
|
17
|
-
type
|
|
17
|
+
type HttpClientArgs = [string | URL, ...unknown[]];
|
|
18
|
+
type HttpClientFunction = (...args: HttpClientArgs) => unknown;
|
|
18
19
|
type WayfinderHttpClient<T extends HttpClientFunction> = T;
|
|
19
20
|
export declare const arnsRegex: RegExp;
|
|
20
21
|
export declare const txIdRegex: RegExp;
|
package/lib/types/version.d.ts
CHANGED