@credenza3/contracts-lib-sui 0.2.7 → 0.2.8

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.
@@ -1,5 +1,5 @@
1
1
  (function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f()}else if("function"==typeof define && define.amd){define("CredenzaContractsSui_signer",f)}else {g["CredenzaContractsSui_signer"]=f()}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
2
- "use strict";var cs=Object.create;var He=Object.defineProperty;var as=Object.getOwnPropertyDescriptor;var fs=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,ls=Object.prototype.hasOwnProperty;var yo=e=>{throw TypeError(e)};var ds=(e,t,r)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Tr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hs=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},wo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fs(t))!ls.call(e,o)&&o!==r&&He(e,o,{get:()=>t[o],enumerable:!(n=as(t,o))||n.enumerable});return e};var ps=(e,t,r)=>(r=e!=null?cs(us(e)):{},wo(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),ms=e=>wo(He({},"__esModule",{value:!0}),e);var g=(e,t,r)=>ds(e,typeof t!="symbol"?t+"":t,r),vr=(e,t,r)=>t.has(e)||yo("Cannot "+r);var W=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),Ut=(e,t,r)=>t.has(e)?yo("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xt=(e,t,r,n)=>(vr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ur=(e,t,r)=>(vr(e,t,"access private method"),r);var $i=Tr(Br=>{"use strict";Br.byteLength=jc;Br.toByteArray=Zc;Br.fromByteArray=Kc;var kt=[],Bt=[],$c=typeof Uint8Array<"u"?Uint8Array:Array,no="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ye=0,Vi=no.length;ye<Vi;++ye)kt[ye]=no[ye],Bt[no.charCodeAt(ye)]=ye;var ye,Vi;Bt[45]=62;Bt[95]=63;function zi(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function jc(e){var t=zi(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Fc(e,t,r){return(t+r)*3/4-r}function Zc(e){var t,r=zi(e),n=r[0],o=r[1],i=new $c(Fc(e,n,o)),s=0,f=o>0?n-4:n,c;for(c=0;c<f;c+=4)t=Bt[e.charCodeAt(c)]<<18|Bt[e.charCodeAt(c+1)]<<12|Bt[e.charCodeAt(c+2)]<<6|Bt[e.charCodeAt(c+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=Bt[e.charCodeAt(c)]<<2|Bt[e.charCodeAt(c+1)]>>4,i[s++]=t&255),o===1&&(t=Bt[e.charCodeAt(c)]<<10|Bt[e.charCodeAt(c+1)]<<4|Bt[e.charCodeAt(c+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function Gc(e){return kt[e>>18&63]+kt[e>>12&63]+kt[e>>6&63]+kt[e&63]}function qc(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(Gc(n));return o.join("")}function Kc(e){for(var t,r=e.length,n=r%3,o=[],i=16383,s=0,f=r-n;s<f;s+=i)o.push(qc(e,s,s+i>f?f:s+i));return n===1?(t=e[r-1],o.push(kt[t>>2]+kt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(kt[t>>10]+kt[t>>4&63]+kt[t<<2&63]+"=")),o.join("")}});var ji=Tr(oo=>{oo.read=function(e,t,r,n,o){var i,s,f=o*8-n-1,c=(1<<f)-1,u=c>>1,d=-7,l=r?o-1:0,y=r?-1:1,w=e[t+l];for(l+=y,i=w&(1<<-d)-1,w>>=-d,d+=f;d>0;i=i*256+e[t+l],l+=y,d-=8);for(s=i&(1<<-d)-1,i>>=-d,d+=n;d>0;s=s*256+e[t+l],l+=y,d-=8);if(i===0)i=1-u;else{if(i===c)return s?NaN:(w?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-u}return(w?-1:1)*s*Math.pow(2,i-n)};oo.write=function(e,t,r,n,o,i){var s,f,c,u=i*8-o-1,d=(1<<u)-1,l=d>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,x=n?1:-1,U=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+l>=1?t+=y/c:t+=y*Math.pow(2,1-l),t*c>=2&&(s++,c/=2),s+l>=d?(f=0,s=d):s+l>=1?(f=(t*c-1)*Math.pow(2,o),s=s+l):(f=t*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;e[r+w]=f&255,w+=x,f/=256,o-=8);for(s=s<<o|f,u+=o;u>0;e[r+w]=s&255,w+=x,s/=256,u-=8);e[r+w-x]|=U*128}});var ss=Tr(Pe=>{"use strict";var io=$i(),Me=ji(),Fi=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pe.Buffer=p;Pe.SlowBuffer=ta;Pe.INSPECT_MAX_BYTES=50;var Sr=2147483647;Pe.kMaxLength=Sr;p.TYPED_ARRAY_SUPPORT=Yc();!p.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 Yc(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function jt(e){if(e>Sr)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return fo(e)}return Ki(e,t,r)}p.poolSize=8192;function Ki(e,t,r){if(typeof e=="string")return Xc(e,t);if(ArrayBuffer.isView(e))return Jc(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Mt(e,ArrayBuffer)||e&&Mt(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Mt(e,SharedArrayBuffer)||e&&Mt(e.buffer,SharedArrayBuffer)))return co(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return p.from(n,t,r);let o=Qc(e);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return p.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}p.from=function(e,t,r){return Ki(e,t,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function Yi(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Wc(e,t,r){return Yi(e),e<=0?jt(e):t!==void 0?typeof r=="string"?jt(e).fill(t,r):jt(e).fill(t):jt(e)}p.alloc=function(e,t,r){return Wc(e,t,r)};function fo(e){return Yi(e),jt(e<0?0:uo(e)|0)}p.allocUnsafe=function(e){return fo(e)};p.allocUnsafeSlow=function(e){return fo(e)};function Xc(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=Wi(e,t)|0,n=jt(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}function so(e){let t=e.length<0?0:uo(e.length)|0,r=jt(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function Jc(e){if(Mt(e,Uint8Array)){let t=new Uint8Array(e);return co(t.buffer,t.byteOffset,t.byteLength)}return so(e)}function co(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,p.prototype),n}function Qc(e){if(p.isBuffer(e)){let t=uo(e.length)|0,r=jt(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||ho(e.length)?jt(0):so(e);if(e.type==="Buffer"&&Array.isArray(e.data))return so(e.data)}function uo(e){if(e>=Sr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Sr.toString(16)+" bytes");return e|0}function ta(e){return+e!=e&&(e=0),p.alloc(+e)}p.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==p.prototype};p.compare=function(t,r){if(Mt(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),Mt(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(t)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,o=r.length;for(let i=0,s=Math.min(n,o);i<s;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return n<o?-1:o<n?1:0};p.isEncoding=function(t){switch(String(t).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}};p.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let o=p.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){let s=t[n];if(Mt(s,Uint8Array))i+s.length>o.length?(p.isBuffer(s)||(s=p.from(s)),s.copy(o,i)):Uint8Array.prototype.set.call(o,s,i);else if(p.isBuffer(s))s.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=s.length}return o};function Wi(e,t){if(p.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Mt(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ao(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return is(e).length;default:if(o)return n?-1:ao(e).length;t=(""+t).toLowerCase(),o=!0}}p.byteLength=Wi;function ea(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return la(this,t,r);case"utf8":case"utf-8":return Ji(this,t,r);case"ascii":return fa(this,t,r);case"latin1":case"binary":return ua(this,t,r);case"base64":return ca(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return da(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function we(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}p.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)we(this,r,r+1);return this};p.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)we(this,r,r+3),we(this,r+1,r+2);return this};p.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)we(this,r,r+7),we(this,r+1,r+6),we(this,r+2,r+5),we(this,r+3,r+4);return this};p.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Ji(this,0,t):ea.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(t){if(!p.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:p.compare(this,t)===0};p.prototype.inspect=function(){let t="",r=Pe.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Fi&&(p.prototype[Fi]=p.prototype.inspect);p.prototype.compare=function(t,r,n,o,i){if(Mt(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===t)return 0;let s=i-o,f=n-r,c=Math.min(s,f),u=this.slice(o,i),d=t.slice(r,n);for(let l=0;l<c;++l)if(u[l]!==d[l]){s=u[l],f=d[l];break}return s<f?-1:f<s?1:0};function Xi(e,t,r,n,o){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ho(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof t=="string"&&(t=p.from(t,n)),p.isBuffer(t))return t.length===0?-1:Zi(e,t,r,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Zi(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Zi(e,t,r,n,o){let i=1,s=e.length,f=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;i=2,s/=2,f/=2,r/=2}function c(d,l){return i===1?d[l]:d.readUInt16BE(l*i)}let u;if(o){let d=-1;for(u=r;u<s;u++)if(c(e,u)===c(t,d===-1?0:u-d)){if(d===-1&&(d=u),u-d+1===f)return d*i}else d!==-1&&(u-=u-d),d=-1}else for(r+f>s&&(r=s-f),u=r;u>=0;u--){let d=!0;for(let l=0;l<f;l++)if(c(e,u+l)!==c(t,l)){d=!1;break}if(d)return u}return-1}p.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};p.prototype.indexOf=function(t,r,n){return Xi(this,t,r,n,!0)};p.prototype.lastIndexOf=function(t,r,n){return Xi(this,t,r,n,!1)};function ra(e,t,r,n){r=Number(r)||0;let o=e.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let i=t.length;n>i/2&&(n=i/2);let s;for(s=0;s<n;++s){let f=parseInt(t.substr(s*2,2),16);if(ho(f))return s;e[r+s]=f}return s}function na(e,t,r,n){return Ar(ao(t,e.length-r),e,r,n)}function oa(e,t,r,n){return Ar(ga(t),e,r,n)}function ia(e,t,r,n){return Ar(is(t),e,r,n)}function sa(e,t,r,n){return Ar(ya(t,e.length-r),e,r,n)}p.prototype.write=function(t,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let s=!1;for(;;)switch(o){case"hex":return ra(this,t,r,n);case"utf8":case"utf-8":return na(this,t,r,n);case"ascii":case"latin1":case"binary":return oa(this,t,r,n);case"base64":return ia(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sa(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),s=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ca(e,t,r){return t===0&&r===e.length?io.fromByteArray(e):io.fromByteArray(e.slice(t,r))}function Ji(e,t,r){r=Math.min(e.length,r);let n=[],o=t;for(;o<r;){let i=e[o],s=null,f=i>239?4:i>223?3:i>191?2:1;if(o+f<=r){let c,u,d,l;switch(f){case 1:i<128&&(s=i);break;case 2:c=e[o+1],(c&192)===128&&(l=(i&31)<<6|c&63,l>127&&(s=l));break;case 3:c=e[o+1],u=e[o+2],(c&192)===128&&(u&192)===128&&(l=(i&15)<<12|(c&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:c=e[o+1],u=e[o+2],d=e[o+3],(c&192)===128&&(u&192)===128&&(d&192)===128&&(l=(i&15)<<18|(c&63)<<12|(u&63)<<6|d&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),o+=f}return aa(n)}var Gi=4096;function aa(e){let t=e.length;if(t<=Gi)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Gi));return r}function fa(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]&127);return n}function ua(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function la(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let i=t;i<r;++i)o+=wa[e[i]];return o}function da(e,t,r){let n=e.slice(t,r),o="";for(let i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}p.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let o=this.subarray(t,r);return Object.setPrototypeOf(o,p.prototype),o};function nt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=this[t],i=1,s=0;for(;++s<r&&(i*=256);)o+=this[t+s]*i;return o};p.prototype.readUintBE=p.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=this[t+--r],i=1;for(;r>0&&(i*=256);)o+=this[t+--r]*i;return o};p.prototype.readUint8=p.prototype.readUInt8=function(t,r){return t=t>>>0,r||nt(t,1,this.length),this[t]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||nt(t,2,this.length),this[t]|this[t+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||nt(t,2,this.length),this[t]<<8|this[t+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};p.prototype.readBigUInt64LE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,i=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(i)<<BigInt(32))});p.prototype.readBigUInt64BE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],i=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(i)});p.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=this[t],i=1,s=0;for(;++s<r&&(i*=256);)o+=this[t+s]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};p.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=r,i=1,s=this[t+--o];for(;o>0&&(i*=256);)s+=this[t+--o]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*r)),s};p.prototype.readInt8=function(t,r){return t=t>>>0,r||nt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};p.prototype.readInt16LE=function(t,r){t=t>>>0,r||nt(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(t,r){t=t>>>0,r||nt(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};p.prototype.readInt32BE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};p.prototype.readBigInt64LE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});p.prototype.readBigInt64BE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});p.prototype.readFloatLE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),Me.read(this,t,!0,23,4)};p.prototype.readFloatBE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),Me.read(this,t,!1,23,4)};p.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||nt(t,8,this.length),Me.read(this,t,!0,52,8)};p.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||nt(t,8,this.length),Me.read(this,t,!1,52,8)};function ht(e,t,r,n,o,i){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(t,r,n,o){if(t=+t,r=r>>>0,n=n>>>0,!o){let f=Math.pow(2,8*n)-1;ht(this,t,r,n,f,0)}let i=1,s=0;for(this[r]=t&255;++s<n&&(i*=256);)this[r+s]=t/i&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(t,r,n,o){if(t=+t,r=r>>>0,n=n>>>0,!o){let f=Math.pow(2,8*n)-1;ht(this,t,r,n,f,0)}let i=n-1,s=1;for(this[r+i]=t&255;--i>=0&&(s*=256);)this[r+i]=t/s&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,1,255,0),this[r]=t&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function Qi(e,t,r,n,o){os(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function ts(e,t,r,n,o){os(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i=i>>8,e[r+6]=i,i=i>>8,e[r+5]=i,i=i>>8,e[r+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}p.prototype.writeBigUInt64LE=re(function(t,r=0){return Qi(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=re(function(t,r=0){return ts(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(t,r,n,o){if(t=+t,r=r>>>0,!o){let c=Math.pow(2,8*n-1);ht(this,t,r,n,c-1,-c)}let i=0,s=1,f=0;for(this[r]=t&255;++i<n&&(s*=256);)t<0&&f===0&&this[r+i-1]!==0&&(f=1),this[r+i]=(t/s>>0)-f&255;return r+n};p.prototype.writeIntBE=function(t,r,n,o){if(t=+t,r=r>>>0,!o){let c=Math.pow(2,8*n-1);ht(this,t,r,n,c-1,-c)}let i=n-1,s=1,f=0;for(this[r+i]=t&255;--i>=0&&(s*=256);)t<0&&f===0&&this[r+i+1]!==0&&(f=1),this[r+i]=(t/s>>0)-f&255;return r+n};p.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};p.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};p.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};p.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};p.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};p.prototype.writeBigInt64LE=re(function(t,r=0){return Qi(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=re(function(t,r=0){return ts(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function es(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function rs(e,t,r,n,o){return t=+t,r=r>>>0,o||es(e,t,r,4,34028234663852886e22,-34028234663852886e22),Me.write(e,t,r,n,23,4),r+4}p.prototype.writeFloatLE=function(t,r,n){return rs(this,t,r,!0,n)};p.prototype.writeFloatBE=function(t,r,n){return rs(this,t,r,!1,n)};function ns(e,t,r,n,o){return t=+t,r=r>>>0,o||es(e,t,r,8,17976931348623157e292,-17976931348623157e292),Me.write(e,t,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(t,r,n){return ns(this,t,r,!0,n)};p.prototype.writeDoubleBE=function(t,r,n){return ns(this,t,r,!1,n)};p.prototype.copy=function(t,r,n,o){if(!p.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<n&&(o=n),o===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-n&&(o=t.length-r+n);let i=o-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(t,this.subarray(n,o),r),i};p.prototype.fill=function(t,r,n,o){if(typeof t=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!p.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(t.length===1){let s=t.charCodeAt(0);(o==="utf8"&&s<128||o==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let i;if(typeof t=="number")for(i=r;i<n;++i)this[i]=t;else{let s=p.isBuffer(t)?t:p.from(t,o),f=s.length;if(f===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=s[i%f]}return this};var ke={};function lo(e,t,r){ke[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}lo("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);lo("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);lo("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=qi(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=qi(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function qi(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function ha(e,t,r){Ne(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Qe(t,e.length-(r+1))}function os(e,t,r,n,o,i){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",f;throw i>3?t===0||t===BigInt(0)?f=`>= 0${s} and < 2${s} ** ${(i+1)*8}${s}`:f=`>= -(2${s} ** ${(i+1)*8-1}${s}) and < 2 ** ${(i+1)*8-1}${s}`:f=`>= ${t}${s} and <= ${r}${s}`,new ke.ERR_OUT_OF_RANGE("value",f,e)}ha(n,o,i)}function Ne(e,t){if(typeof e!="number")throw new ke.ERR_INVALID_ARG_TYPE(t,"number",e)}function Qe(e,t,r){throw Math.floor(e)!==e?(Ne(e,r),new ke.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new ke.ERR_BUFFER_OUT_OF_BOUNDS:new ke.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var pa=/[^+/0-9A-Za-z-_]/g;function ma(e){if(e=e.split("=")[0],e=e.trim().replace(pa,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ao(e,t){t=t||1/0;let r,n=e.length,o=null,i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function ga(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function ya(e,t){let r,n,o,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function is(e){return io.toByteArray(ma(e))}function Ar(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function Mt(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ho(e){return e!==e}var wa=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t})();function re(e){return typeof BigInt>"u"?xa:e}function xa(){throw new Error("BigInt not supported")}});var Ba={};hs(Ba,{CredenzaSuiSigner:()=>Ir,getCredenzaSuiSigner:()=>Ea});module.exports=ms(Ba);function ne(e){let t=BigInt(e),r=[],n=0;if(t===0n)return[0];for(;t>0;)r[n]=Number(t&127n),t>>=7n,t>0n&&(r[n]|=128),n+=1;return r}function xo(e){let t=0n,r=0n,n=0;for(;;){if(n>=e.length)throw new Error("ULEB decode error: buffer overflow");let o=e[n];if(n+=1,t+=BigInt(o&127)<<r,(o&128)===0)break;r+=7n}if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("ULEB decode error: value exceeds MAX_SAFE_INTEGER");return{value:Number(t),length:n}}var bo=class{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),t=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+t).toString(10)}read128(){let e=BigInt(this.read64()),t=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+t).toString(10)}read256(){let e=BigInt(this.read128()),t=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+t).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,{value:t,length:r}=xo(new Uint8Array(this.dataView.buffer,e));return this.shift(r),t}readVec(e){let t=this.readULEB(),r=[];for(let n=0;n<t;n++)r.push(e(this,n,t));return r}};function gs(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Bo(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(r=>typeof r=="string"):t.every(r=>Number.isSafeInteger(r)):!1}function Or(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function So(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Rr(e){if(!Array.isArray(e))throw new Error("array expected")}function Ao(e,t){if(!Bo(!0,t))throw new Error(`${e}: array of strings expected`)}function ys(e,t){if(!Bo(!1,t))throw new Error(`${e}: array of numbers expected`)}function ws(...e){let t=i=>i,r=(i,s)=>f=>i(s(f)),n=e.map(i=>i.encode).reduceRight(r,t),o=e.map(i=>i.decode).reduce(r,t);return{encode:n,decode:o}}function xs(e){let t=typeof e=="string"?e.split(""):e,r=t.length;Ao("alphabet",t);let n=new Map(t.map((o,i)=>[o,i]));return{encode:o=>(Rr(o),o.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:o=>(Rr(o),o.map(i=>{Or("alphabet.decode",i);let s=n.get(i);if(s===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return s}))}}function bs(e=""){return Or("join",e),{encode:t=>(Ao("join.decode",t),t.join(e)),decode:t=>(Or("join.decode",t),t.split(e))}}function Eo(e,t,r){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(Rr(e),!e.length)return[];let n=0,o=[],i=Array.from(e,f=>{if(So(f),f<0||f>=t)throw new Error(`invalid integer: ${f}`);return f}),s=i.length;for(;;){let f=0,c=!0;for(let u=n;u<s;u++){let d=i[u],l=t*f,y=l+d;if(!Number.isSafeInteger(y)||l/t!==f||y-d!==l)throw new Error("convertRadix: carry overflow");let w=y/r;f=y%r;let x=Math.floor(w);if(i[u]=x,!Number.isSafeInteger(x)||x*r+f!==y)throw new Error("convertRadix: carry overflow");if(c)x?c=!1:n=u;else continue}if(o.push(f),c)break}for(let f=0;f<e.length-1&&e[f]===0;f++)o.push(0);return o.reverse()}function Es(e){So(e);let t=2**8;return{encode:r=>{if(!gs(r))throw new Error("radix.encode input should be Uint8Array");return Eo(Array.from(r),t,e)},decode:r=>(ys("radix.decode",r),Uint8Array.from(Eo(r,e,t)))}}var Bs=e=>ws(Es(58),xs(e),bs("")),_r=Bs("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Ft=e=>_r.encode(e),Zt=e=>_r.decode(e);function q(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}var Lr=8192;function G(e){if(e.length<Lr)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=Lr){let n=e.slice(r,r+Lr);t+=String.fromCharCode(...n)}return btoa(t)}function oe(e){let t=e.startsWith("0x")?e.slice(2):e,r=t.length%2===0?t:`0${t}`,n=r.match(/[0-9a-fA-F]{2}/g)?.map(o=>parseInt(o,16))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function St(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}function Cr(e,t){switch(t){case"base58":return Ft(e);case"base64":return G(e);case"hex":return St(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Dr(e,t=["<",">"]){let[r,n]=t,o=[],i="",s=0;for(let f=0;f<e.length;f++){let c=e[f];if(c===r&&s++,c===n&&s--,s===0&&c===","){o.push(i.trim()),i="";continue}i+=c}return o.push(i.trim()),o}var Io=class{constructor({initialSize:e=1024,maxSize:t=1/0,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){let t=this.bytePosition+e;if(t>this.size){let r=Math.min(this.maxSize,Math.max(this.size+t,this.size+this.allocateSize));if(t>r)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=r;let n=new ArrayBuffer(this.size);new Uint8Array(n).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(n)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}writeBytes(e){this.ensureSizeOrGrow(e.length);for(let t=0;t<e.length;t++)this.dataView.setUint8(this.bytePosition+t,e[t]);return this.shift(e.length)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return kr(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return kr(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return kr(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return ne(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((r,n)=>t(this,r,n,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return Cr(this.toBytes(),e)}};function kr(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var ie,xe,be,mt=(be=class{constructor(t){Ut(this,ie);Ut(this,xe);this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),xt(this,ie,t.write),xt(this,xe,t.serialize??((r,n)=>{let o=new Io({initialSize:this.serializedSize(r)??void 0,...n});return W(this,ie).call(this,r,o),o.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),W(this,ie).call(this,t,r)}serialize(t,r){return this.validate(t),new As(this,W(this,xe).call(this,t,r))}parse(t){let r=new bo(t);return this.read(r)}fromHex(t){return this.parse(oe(t))}fromBase58(t){return this.parse(Zt(t))}fromBase64(t){return this.parse(q(t))}transform({name:t,input:r,output:n,validate:o}){return new be({name:t??this.name,read:i=>n?n(this.read(i)):this.read(i),write:(i,s)=>W(this,ie).call(this,r?r(i):i,s),serializedSize:i=>this.serializedSize(r?r(i):i),serialize:(i,s)=>W(this,xe).call(this,r?r(i):i,s),validate:i=>{o?.(i),this.validate(r?r(i):i)}})}},ie=new WeakMap,xe=new WeakMap,be),Ss=Symbol.for("@mysten/serialized-bcs");var Ve,Nt,To,As=(To=class{constructor(e,t){Ut(this,Ve);Ut(this,Nt);xt(this,Ve,e),xt(this,Nt,t)}get[Ss](){return!0}toBytes(){return W(this,Nt)}toHex(){return St(W(this,Nt))}toBase64(){return G(W(this,Nt))}toBase58(){return Ft(W(this,Nt))}parse(){return W(this,Ve).parse(W(this,Nt))}},Ve=new WeakMap,Nt=new WeakMap,To);function ze({size:e,...t}){return new mt({...t,serializedSize:()=>e})}function tr({readMethod:e,writeMethod:t,...r}){return ze({...r,read:n=>n[e](),write:(n,o)=>o[t](n),validate:n=>{if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);r.validate?.(n)}})}function er({readMethod:e,writeMethod:t,...r}){return ze({...r,read:n=>n[e](),write:(n,o)=>o[t](BigInt(n)),validate:n=>{let o=BigInt(n);if(o<0||o>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${o}. Expected value in range 0-${r.maxValue}`);r.validate?.(o)}})}function vo({serialize:e,...t}){let r=new mt({...t,serialize:e,write:(n,o)=>{for(let i of r.serialize(n).toBytes())o.write8(i)}});return r}function Uo({toBytes:e,fromBytes:t,...r}){return new mt({...r,read:n=>{let o=n.readULEB();return t(n.readBytes(o))},write:(n,o)=>{let i=e(n);o.writeULEB(i.length);for(let s=0;s<i.length;s++)o.write8(i[s])},serialize:n=>{let o=e(n),i=ne(o.length),s=new Uint8Array(i.length+o.length);return s.set(i,0),s.set(o,i.length),s},validate:n=>{if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);r.validate?.(n)}})}function Oo(e){let t=null;function r(){return t||(t=e()),t}return new mt({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,o)=>r().write(n,o),serialize:(n,o)=>r().serialize(n,o).toBytes()})}var Mr=class extends mt{constructor({name:e,fields:t,...r}){let n=Object.entries(t);super({name:e,serializedSize:o=>{let i=0;for(let[s,f]of n){let c=f.serializedSize(o[s]);if(c==null)return null;i+=c}return i},read:o=>{let i={};for(let[s,f]of n)i[s]=f.read(o);return i},write:(o,i)=>{for(let[s,f]of n)f.write(o[s],i)},...r,validate:o=>{if(r?.validate?.(o),typeof o!="object"||o==null)throw new TypeError(`Expected object, found ${typeof o}`)}})}},Nr=class extends mt{constructor({fields:e,...t}){let r=Object.entries(e);super({read:n=>{let o=n.readULEB(),i=r[o];if(!i)throw new TypeError(`Unknown value ${o} for enum ${t.name}`);let[s,f]=i;return{[s]:f?.read(n)??!0,$kind:s}},write:(n,o)=>{let[i,s]=Object.entries(n).filter(([f])=>Object.hasOwn(e,f))[0];for(let f=0;f<r.length;f++){let[c,u]=r[f];if(c===i){o.writeULEB(f),u?.write(s,o);return}}},...t,validate:n=>{if(t?.validate?.(n),typeof n!="object"||n==null)throw new TypeError(`Expected object, found ${typeof n}`);let o=Object.keys(n).filter(s=>n[s]!==void 0&&Object.hasOwn(e,s));if(o.length!==1)throw new TypeError(`Expected object with one key, but found ${o.length} for type ${t.name}}`);let[i]=o;if(!Object.hasOwn(e,i))throw new TypeError(`Invalid enum variant ${i}`)}})}},Pr=class extends mt{constructor({fields:e,name:t,...r}){super({name:t??`(${e.map(n=>n.name).join(", ")})`,serializedSize:n=>{let o=0;for(let i=0;i<e.length;i++){let s=e[i].serializedSize(n[i]);if(s==null)return null;o+=s}return o},read:n=>{let o=[];for(let i of e)o.push(i.read(n));return o},write:(n,o)=>{for(let i=0;i<e.length;i++)e[i].write(n[i],o)},...r,validate:n=>{if(r?.validate?.(n),!Array.isArray(n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${n.length}`)}})}};function Is(e,t,r){return new mt({read:n=>{let o=new Array(e);for(let i=0;i<e;i++)o[i]=t.read(n);return o},write:(n,o)=>{for(let i of n)t.write(i,o)},...r,name:r?.name??`${t.name}[${e}]`,validate:n=>{if(r?.validate?.(n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})}function Ts(e){return a.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>t.$kind==="Some"?t.Some:null})}function vs(e,t){return new mt({read:r=>{let n=r.readULEB(),o=new Array(n);for(let i=0;i<n;i++)o[i]=e.read(r);return o},write:(r,n)=>{n.writeULEB(r.length);for(let o of r)e.write(o,n)},...t,name:t?.name??`vector<${e.name}>`,validate:r=>{if(t?.validate?.(r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})}function Hr(e,t){for(let r=0;r<Math.min(e.length,t.length);r++)if(e[r]!==t[r])return e[r]-t[r];return e.length-t.length}function Us(e,t){return new mt({name:`Map<${e.name}, ${t.name}>`,read:r=>{let n=r.readULEB(),o=new Map;for(let i=0;i<n;i++)o.set(e.read(r),t.read(r));return o},write:(r,n)=>{let o=[...r.entries()].map(([i,s])=>[e.serialize(i).toBytes(),s]);o.sort(([i],[s])=>Hr(i,s)),n.writeULEB(o.length);for(let[i,s]of o)n.writeBytes(i),t.write(s,n)}})}var a={u8(e){return tr({readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e,name:e?.name??"u8"})},u16(e){return tr({readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e,name:e?.name??"u16"})},u32(e){return tr({readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e,name:e?.name??"u32"})},u64(e){return er({readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e,name:e?.name??"u64"})},u128(e){return er({readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e,name:e?.name??"u128"})},u256(e){return er({readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e,name:e?.name??"u256"})},bool(e){return ze({size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,name:e?.name??"bool",validate:t=>{if(e?.validate?.(t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return vo({read:t=>t.readULEB(),serialize:t=>Uint8Array.from(ne(t)),...e,name:e?.name??"uleb128"})},bytes(e,t){return ze({size:e,read:r=>r.readBytes(e),write:(r,n)=>{n.writeBytes(new Uint8Array(r))},...t,name:t?.name??`bytes[${e}]`,validate:r=>{if(t?.validate?.(r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},byteVector(e){return new mt({read:t=>{let r=t.readULEB();return t.readBytes(r)},write:(t,r)=>{let n=new Uint8Array(t);r.writeULEB(n.length),r.writeBytes(n)},...e,name:e?.name??"vector<u8>",serializedSize:t=>{let r="length"in t?t.length:null;return r==null?null:ne(r).length+r},validate:t=>{if(e?.validate?.(t),!t||typeof t!="object"||!("length"in t))throw new TypeError(`Expected array, found ${typeof t}`)}})},string(e){return Uo({toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e,name:e?.name??"string"})},fixedArray:Is,option:Ts,vector:vs,tuple(e,t){return new Pr({fields:e,...t})},struct(e,t,r){return new Mr({name:e,fields:t,...r})},enum(e,t,r){return new Nr({name:e,fields:t,...r})},map:Us,lazy(e){return Oo(e)}};var Gt=32;function Ro(e){return Os(e)&&Rs(e)===Gt}function Ot(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Gt*2,"0")}`}function Os(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function Rs(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var _s=/^vector<(.+)>$/,Ls=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/,Vr=class Ee{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};let n=t.match(_s);if(n)return{vector:Ee.parseFromStr(n[1],r)};let o=t.match(Ls);if(o)return{struct:{address:r?Ot(o[1]):o[1],module:o[2],name:o[3],typeParams:o[5]===void 0?[]:Ee.parseStructTypeArgs(o[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Dr(t).map(n=>Ee.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Ee.tagToString(t.vector)}>`;if("struct"in t){let r=t.struct,n=r.typeParams.map(Ee.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function Cs(e){return a.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function Ds(e){return a.enum("Option",{None:null,Some:e})}var F=a.bytes(Gt).transform({validate:e=>{let t=typeof e=="string"?e:St(e);if(!t||!Ro(Ot(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?oe(Ot(e)):e,output:e=>Ot(St(e))}),st=a.byteVector().transform({name:"ObjectDigest",input:e=>Zt(e),output:e=>Ft(new Uint8Array(e)),validate:e=>{if(Zt(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),ut=a.struct("SuiObjectRef",{objectId:F,version:a.u64(),digest:st}),zr=a.struct("SharedObjectRef",{objectId:F,initialSharedVersion:a.u64(),mutable:a.bool()}),$r=a.enum("ObjectArg",{ImmOrOwnedObject:ut,SharedObject:zr,Receiving:ut}),Rt=a.enum("Owner",{AddressOwner:F,ObjectOwner:F,Shared:a.struct("Shared",{initialSharedVersion:a.u64()}),Immutable:null,ConsensusAddressOwner:a.struct("ConsensusAddressOwner",{startVersion:a.u64(),owner:F})}),ks=a.enum("Reservation",{MaxAmountU64:a.u64()}),Ms=a.enum("WithdrawalType",{Balance:a.lazy(()=>qt)}),Ns=a.enum("WithdrawFrom",{Sender:null,Sponsor:null}),Ps=a.struct("FundsWithdrawal",{reservation:ks,typeArg:Ms,withdrawFrom:Ns}),jr=a.enum("CallArg",{Pure:a.struct("Pure",{bytes:a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))})}),Object:$r,FundsWithdrawal:Ps}),Fr=a.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:a.lazy(()=>Fr),struct:a.lazy(()=>rr),u16:null,u32:null,u256:null}),qt=Fr.transform({input:e=>typeof e=="string"?Vr.parseFromStr(e,!0):e,output:e=>Vr.tagToString(e)}),At=a.enum("Argument",{GasCoin:null,Input:a.u16(),Result:a.u16(),NestedResult:a.tuple([a.u16(),a.u16()])}),Zr=a.struct("ProgrammableMoveCall",{package:F,module:a.string(),function:a.string(),typeArguments:a.vector(qt),arguments:a.vector(At)}),Gr=a.enum("Command",{MoveCall:Zr,TransferObjects:a.struct("TransferObjects",{objects:a.vector(At),address:At}),SplitCoins:a.struct("SplitCoins",{coin:At,amounts:a.vector(At)}),MergeCoins:a.struct("MergeCoins",{destination:At,sources:a.vector(At)}),Publish:a.struct("Publish",{modules:a.vector(a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))})),dependencies:a.vector(F)}),MakeMoveVec:a.struct("MakeMoveVec",{type:Ds(qt).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:a.vector(At)}),Upgrade:a.struct("Upgrade",{modules:a.vector(a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))})),dependencies:a.vector(F),package:F,ticket:At})}),qr=a.struct("ProgrammableTransaction",{inputs:a.vector(jr),commands:a.vector(Gr)}),Kr=a.enum("TransactionKind",{ProgrammableTransaction:qr,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Hs=a.struct("ValidDuring",{minEpoch:a.option(a.u64()),maxEpoch:a.option(a.u64()),minTimestamp:a.option(a.u64()),maxTimestamp:a.option(a.u64()),chain:st,nonce:a.u32()}),Yr=a.enum("TransactionExpiration",{None:null,Epoch:Cs(),ValidDuring:Hs}),rr=a.struct("StructTag",{address:F,module:a.string(),name:a.string(),typeParams:a.vector(Fr)}),Wr=a.struct("GasData",{payment:a.vector(ut),owner:F,price:a.u64(),budget:a.u64()}),Xr=a.struct("TransactionDataV1",{kind:Kr,sender:F,gasData:Wr,expiration:Yr}),Jr=a.enum("TransactionData",{V1:Xr}),Qr=a.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),tn=a.enum("IntentVersion",{V0:null}),en=a.enum("AppId",{Sui:null}),rn=a.struct("Intent",{scope:Qr,version:tn,appId:en});function nn(e){return a.struct(`IntentMessage<${e.name}>`,{intent:rn,value:e})}var on=a.enum("CompressedSignature",{ED25519:a.bytes(64),Secp256k1:a.bytes(64),Secp256r1:a.bytes(64),ZkLogin:a.byteVector(),Passkey:a.byteVector()}),sn=a.enum("PublicKey",{ED25519:a.bytes(32),Secp256k1:a.bytes(33),Secp256r1:a.bytes(33),ZkLogin:a.byteVector(),Passkey:a.bytes(33)}),cn=a.struct("MultiSigPkMap",{pubKey:sn,weight:a.u8()}),an=a.struct("MultiSigPublicKey",{pk_map:a.vector(cn),threshold:a.u16()}),_o=a.struct("MultiSig",{sigs:a.vector(on),bitmap:a.u16(),multisig_pk:an}),Vs=a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))}),fn=a.struct("SenderSignedTransaction",{intentMessage:nn(Jr),txSignatures:a.vector(Vs)}),Lo=a.vector(fn,{name:"SenderSignedData"}),nr=a.struct("PasskeyAuthenticator",{authenticatorData:a.byteVector(),clientDataJson:a.string(),userSignature:a.byteVector()}),un=a.enum("MoveObjectType",{Other:rr,GasCoin:null,StakedSui:null,Coin:qt,AccumulatorBalanceWrapper:null}),ln=a.struct("TypeOrigin",{moduleName:a.string(),datatypeName:a.string(),package:F}),dn=a.struct("UpgradeInfo",{upgradedId:F,upgradedVersion:a.u64()}),hn=a.struct("MovePackage",{id:F,version:a.u64(),moduleMap:a.map(a.string(),a.byteVector()),typeOriginTable:a.vector(ln),linkageTable:a.map(F,dn)}),pn=a.struct("MoveObject",{type:un,hasPublicTransfer:a.bool(),version:a.u64(),contents:a.byteVector()}),mn=a.enum("Data",{Move:pn,Package:hn}),Co=a.struct("ObjectInner",{data:mn,owner:Rt,previousTransaction:st,storageRebate:a.u64()});var zs=a.enum("PackageUpgradeError",{UnableToFetchPackage:a.struct("UnableToFetchPackage",{packageId:F}),NotAPackage:a.struct("NotAPackage",{objectId:F}),IncompatibleUpgrade:null,DigestDoesNotMatch:a.struct("DigestDoesNotMatch",{digest:a.byteVector()}),UnknownUpgradePolicy:a.struct("UnknownUpgradePolicy",{policy:a.u8()}),PackageIDDoesNotMatch:a.struct("PackageIDDoesNotMatch",{packageId:F,ticketId:F})}),$s=a.struct("ModuleId",{address:F,name:a.string()}),Do=a.struct("MoveLocation",{module:$s,function:a.u16(),instruction:a.u16(),functionName:a.option(a.string())}),js=a.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:a.struct("IndexOutOfBounds",{idx:a.u16()}),SecondaryIndexOutOfBounds:a.struct("SecondaryIndexOutOfBounds",{resultIdx:a.u16(),secondaryIdx:a.u16()}),InvalidResultArity:a.struct("InvalidResultArity",{resultIdx:a.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null,InvalidArgumentArity:null,InvalidTransferObject:null,InvalidMakeMoveVecNonObjectArgument:null,ArgumentWithoutValue:null,CannotMoveBorrowedValue:null,CannotWriteToExtendedReference:null,InvalidReferenceArgument:null}),Fs=a.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),Zs=a.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:a.struct("MoveObjectTooBig",{objectSize:a.u64(),maxObjectSize:a.u64()}),MovePackageTooBig:a.struct("MovePackageTooBig",{objectSize:a.u64(),maxObjectSize:a.u64()}),CircularObjectOwnership:a.struct("CircularObjectOwnership",{object:F}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:a.option(Do),MoveAbort:a.tuple([Do,a.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:a.struct("CommandArgumentError",{argIdx:a.u16(),kind:js}),TypeArgumentError:a.struct("TypeArgumentError",{argumentIdx:a.u16(),kind:Fs}),UnusedValueWithoutDrop:a.struct("UnusedValueWithoutDrop",{resultIdx:a.u16(),secondaryIdx:a.u16()}),InvalidPublicFunctionReturnType:a.struct("InvalidPublicFunctionReturnType",{idx:a.u16()}),InvalidTransferObject:null,EffectsTooLarge:a.struct("EffectsTooLarge",{currentSize:a.u64(),maxSize:a.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:a.struct("PackageUpgradeError",{upgradeError:zs}),WrittenObjectsTooLarge:a.struct("WrittenObjectsTooLarge",{currentSize:a.u64(),maxSize:a.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:a.struct("ExecutionCancelledDueToSharedObjectCongestion",{congested_objects:a.vector(F)}),AddressDeniedForCoin:a.struct("AddressDeniedForCoin",{address:F,coinType:a.string()}),CoinTypeGlobalPause:a.struct("CoinTypeGlobalPause",{coinType:a.string()}),ExecutionCancelledDueToRandomnessUnavailable:null,MoveVectorElemTooBig:a.struct("MoveVectorElemTooBig",{valueSize:a.u64(),maxScaledSize:a.u64()}),MoveRawValueTooBig:a.struct("MoveRawValueTooBig",{valueSize:a.u64(),maxScaledSize:a.u64()}),InvalidLinkage:null,InsufficientBalanceForWithdraw:null,NonExclusiveWriteInputObjectModified:a.struct("NonExclusiveWriteInputObjectModified",{id:F})}),ko=a.enum("ExecutionStatus",{Success:null,Failure:a.struct("Failure",{error:Zs,command:a.option(a.u64())})}),Mo=a.struct("GasCostSummary",{computationCost:a.u64(),storageCost:a.u64(),storageRebate:a.u64(),nonRefundableStorageFee:a.u64()}),Gs=a.struct("TransactionEffectsV1",{status:ko,executedEpoch:a.u64(),gasUsed:Mo,modifiedAtVersions:a.vector(a.tuple([F,a.u64()])),sharedObjects:a.vector(ut),transactionDigest:st,created:a.vector(a.tuple([ut,Rt])),mutated:a.vector(a.tuple([ut,Rt])),unwrapped:a.vector(a.tuple([ut,Rt])),deleted:a.vector(ut),unwrappedThenDeleted:a.vector(ut),wrapped:a.vector(ut),gasObject:a.tuple([ut,Rt]),eventsDigest:a.option(st),dependencies:a.vector(st)}),gn=a.tuple([a.u64(),st]),qs=a.enum("ObjectIn",{NotExist:null,Exist:a.tuple([gn,Rt])}),Ks=a.struct("AccumulatorAddress",{address:F,ty:qt}),Ys=a.enum("AccumulatorOperation",{Merge:null,Split:null}),Ws=a.enum("AccumulatorValue",{Integer:a.u64(),IntegerTuple:a.tuple([a.u64(),a.u64()]),EventDigest:a.vector(a.tuple([a.u64(),st]))}),Xs=a.struct("AccumulatorWriteV1",{address:Ks,operation:Ys,value:Ws}),Js=a.enum("ObjectOut",{NotExist:null,ObjectWrite:a.tuple([st,Rt]),PackageWrite:gn,AccumulatorWriteV1:Xs}),Qs=a.enum("IDOperation",{None:null,Created:null,Deleted:null}),tc=a.struct("EffectsObjectChange",{inputState:qs,outputState:Js,idOperation:Qs}),ec=a.enum("UnchangedConsensusKind",{ReadOnlyRoot:gn,MutateConsensusStreamEnded:a.u64(),ReadConsensusStreamEnded:a.u64(),Cancelled:a.u64(),PerEpochConfig:null}),rc=a.struct("TransactionEffectsV2",{status:ko,executedEpoch:a.u64(),gasUsed:Mo,transactionDigest:st,gasObjectIndex:a.option(a.u32()),eventsDigest:a.option(st),dependencies:a.vector(st),lamportVersion:a.u64(),changedObjects:a.vector(a.tuple([F,tc])),unchangedConsensusObjects:a.vector(a.tuple([F,ec])),auxDataDigest:a.option(st)}),No=a.enum("TransactionEffects",{V1:Gs,V2:rc});var se={...a,U8:a.u8(),U16:a.u16(),U32:a.u32(),U64:a.u64(),U128:a.u128(),U256:a.u256(),ULEB128:a.uleb128(),Bool:a.bool(),String:a.string(),Address:F,AppId:en,Argument:At,CallArg:jr,Command:Gr,CompressedSignature:on,Data:mn,GasData:Wr,Intent:rn,IntentMessage:nn,IntentScope:Qr,IntentVersion:tn,MoveObject:pn,MoveObjectType:un,MovePackage:hn,MultiSig:_o,MultiSigPkMap:cn,MultiSigPublicKey:an,Object:Co,ObjectArg:$r,ObjectDigest:st,Owner:Rt,PasskeyAuthenticator:nr,ProgrammableMoveCall:Zr,ProgrammableTransaction:qr,PublicKey:sn,SenderSignedData:Lo,SenderSignedTransaction:fn,SharedObjectRef:zr,StructTag:rr,SuiObjectRef:ut,TransactionData:Jr,TransactionDataV1:Xr,TransactionEffects:No,TransactionExpiration:Yr,TransactionKind:Kr,TypeOrigin:ln,TypeTag:qt,UpgradeInfo:dn};function or(e,t){return se.IntentMessage(se.bytes(t.length)).serialize({intent:{scope:{[e]:!0},version:{V0:!0},appId:{Sui:!0}},value:t}).toBytes()}var _t={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},Po={ED25519:32,Secp256k1:33,Secp256r1:33,Passkey:33},ir={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function ce(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function lt(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new Error(`${r}expected integer >= 0, got ${e}`)}}function P(e,t,r=""){let n=ce(e),o=e?.length,i=t!==void 0;if(!n||i&&o!==t){let s=r&&`"${r}" `,f=i?` of length ${t}`:"",c=n?`length=${o}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+f+", got "+c)}return e}function sr(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");lt(e.outputLen),lt(e.blockLen)}function Ht(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function cr(e,t){P(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function $e(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function gt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ar(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function It(e,t){return e<<32-t|e>>>t}var Vo=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function zo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}var Lt=Vo?e=>e:e=>zo(e);function nc(e){for(let t=0;t<e.length;t++)e[t]=zo(e[t]);return e}var ae=Vo?e=>e:nc,$o=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",oc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function yt(e){if(P(e),$o)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=oc[e[r]];return t}var Pt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ho(e){if(e>=Pt._0&&e<=Pt._9)return e-Pt._0;if(e>=Pt.A&&e<=Pt.F)return e-(Pt.A-10);if(e>=Pt.a&&e<=Pt.f)return e-(Pt.a-10)}function Tt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if($o)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,i=0;o<r;o++,i+=2){let s=Ho(e.charCodeAt(i)),f=Ho(e.charCodeAt(i+1));if(s===void 0||f===void 0){let c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[o]=s*16+f}return n}function dt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];P(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let i=e[n];r.set(i,o),o+=i.length}return r}function je(e,t={}){let r=(o,i)=>e(i).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}function Be(e=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}var yn=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var jo=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);function Fo(e,t,r){return e&t^~e&r}function Zo(e,t,r){return e&t^e&r^t&r}var Fe=class{constructor(t,r,n,o){g(this,"blockLen");g(this,"outputLen");g(this,"padOffset");g(this,"isLE");g(this,"buffer");g(this,"view");g(this,"finished",!1);g(this,"length",0);g(this,"pos",0);g(this,"destroyed",!1);this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ar(this.buffer)}update(t){Ht(this),P(t);let{view:r,buffer:n,blockLen:o}=this,i=t.length;for(let s=0;s<i;){let f=Math.min(o-this.pos,i-s);if(f===o){let c=ar(t);for(;o<=i-s;s+=o)this.process(c,s);continue}n.set(t.subarray(s,s+f),this.pos),this.pos+=f,s+=f,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ht(this),cr(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:i}=this,{pos:s}=this;r[s++]=128,gt(this.buffer.subarray(s)),this.padOffset>o-s&&(this.process(n,0),s=0);for(let l=s;l<o;l++)r[l]=0;n.setBigUint64(o-8,BigInt(this.length*8),i),this.process(n,0);let f=ar(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)f.setUint32(4*l,d[l],i)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:i,destroyed:s,pos:f}=this;return t.destroyed=s,t.finished=i,t.length=o,t.pos=f,o%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},Vt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var it=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var fr=BigInt(4294967295),Go=BigInt(32);function wn(e,t=!1){return t?{h:Number(e&fr),l:Number(e>>Go&fr)}:{h:Number(e>>Go&fr)|0,l:Number(e&fr)|0}}function qo(e,t=!1){let r=e.length,n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){let{h:s,l:f}=wn(e[i],t);[n[i],o[i]]=[s,f]}return[n,o]}var xn=(e,t,r)=>e>>>r,bn=(e,t,r)=>e<<32-r|t>>>r,Ct=(e,t,r)=>e>>>r|t<<32-r,Dt=(e,t,r)=>e<<32-r|t>>>r,fe=(e,t,r)=>e<<64-r|t>>>r-32,ue=(e,t,r)=>e>>>r-32|t<<64-r,Ko=(e,t)=>t,Yo=(e,t)=>e;function wt(e,t,r,n){let o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:o|0}}var Ze=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),Ge=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,Wo=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),Xo=(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,Jo=(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0),Qo=(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0;var tt=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),S=new Uint32Array(32);function Kt(e,t,r,n,o,i){let s=o[i],f=o[i+1],c=S[2*e],u=S[2*e+1],d=S[2*t],l=S[2*t+1],y=S[2*r],w=S[2*r+1],x=S[2*n],U=S[2*n+1],E=Ze(c,d,s);u=Ge(E,u,l,f),c=E|0,{Dh:U,Dl:x}={Dh:U^u,Dl:x^c},{Dh:U,Dl:x}={Dh:Ko(U,x),Dl:Yo(U,x)},{h:w,l:y}=wt(w,y,U,x),{Bh:l,Bl:d}={Bh:l^w,Bl:d^y},{Bh:l,Bl:d}={Bh:Ct(l,d,24),Bl:Dt(l,d,24)},S[2*e]=c,S[2*e+1]=u,S[2*t]=d,S[2*t+1]=l,S[2*r]=y,S[2*r+1]=w,S[2*n]=x,S[2*n+1]=U}function Yt(e,t,r,n,o,i){let s=o[i],f=o[i+1],c=S[2*e],u=S[2*e+1],d=S[2*t],l=S[2*t+1],y=S[2*r],w=S[2*r+1],x=S[2*n],U=S[2*n+1],E=Ze(c,d,s);u=Ge(E,u,l,f),c=E|0,{Dh:U,Dl:x}={Dh:U^u,Dl:x^c},{Dh:U,Dl:x}={Dh:Ct(U,x,16),Dl:Dt(U,x,16)},{h:w,l:y}=wt(w,y,U,x),{Bh:l,Bl:d}={Bh:l^w,Bl:d^y},{Bh:l,Bl:d}={Bh:fe(l,d,63),Bl:ue(l,d,63)},S[2*e]=c,S[2*e+1]=u,S[2*t]=d,S[2*t+1]=l,S[2*r]=y,S[2*r+1]=w,S[2*n]=x,S[2*n+1]=U}function ic(e,t={},r,n,o){if(lt(r),e<0||e>r)throw new Error("outputLen bigger than keyLen");let{key:i,salt:s,personalization:f}=t;if(i!==void 0&&(i.length<1||i.length>r))throw new Error('"key" expected to be undefined or of length=1..'+r);s!==void 0&&P(s,n,"salt"),f!==void 0&&P(f,o,"personalization")}var En=class{constructor(t,r){g(this,"buffer");g(this,"buffer32");g(this,"finished",!1);g(this,"destroyed",!1);g(this,"length",0);g(this,"pos",0);g(this,"blockLen");g(this,"outputLen");lt(t),lt(r),this.blockLen=t,this.outputLen=r,this.buffer=new Uint8Array(t),this.buffer32=$e(this.buffer)}update(t){Ht(this),P(t);let{blockLen:r,buffer:n,buffer32:o}=this,i=t.length,s=t.byteOffset,f=t.buffer;for(let c=0;c<i;){this.pos===r&&(ae(o),this.compress(o,0,!1),ae(o),this.pos=0);let u=Math.min(r-this.pos,i-c),d=s+c;if(u===r&&!(d%4)&&c+u<i){let l=new Uint32Array(f,d,Math.floor((i-c)/4));ae(l);for(let y=0;c+r<i;y+=o.length,c+=r)this.length+=r,this.compress(l,y,!1);ae(l);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){Ht(this),cr(t,this);let{pos:r,buffer32:n}=this;this.finished=!0,gt(this.buffer.subarray(r)),ae(n),this.compress(n,0,!0),ae(n);let o=$e(t);this.get().forEach((i,s)=>o[s]=Lt(i))}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){let{buffer:r,length:n,finished:o,destroyed:i,outputLen:s,pos:f}=this;return t||(t=new this.constructor({dkLen:s})),t.set(...this.get()),t.buffer.set(r),t.destroyed=i,t.finished=o,t.length=n,t.pos=f,t.outputLen=s,t}clone(){return this._cloneInto()}},Bn=class extends En{constructor(r={}){let n=r.dkLen===void 0?64:r.dkLen;super(128,n);g(this,"v0l",tt[0]|0);g(this,"v0h",tt[1]|0);g(this,"v1l",tt[2]|0);g(this,"v1h",tt[3]|0);g(this,"v2l",tt[4]|0);g(this,"v2h",tt[5]|0);g(this,"v3l",tt[6]|0);g(this,"v3h",tt[7]|0);g(this,"v4l",tt[8]|0);g(this,"v4h",tt[9]|0);g(this,"v5l",tt[10]|0);g(this,"v5h",tt[11]|0);g(this,"v6l",tt[12]|0);g(this,"v6h",tt[13]|0);g(this,"v7l",tt[14]|0);g(this,"v7h",tt[15]|0);ic(n,r,64,16,16);let{key:o,personalization:i,salt:s}=r,f=0;if(o!==void 0&&(P(o,void 0,"key"),f=o.length),this.v0l^=this.outputLen|f<<8|65536|1<<24,s!==void 0){P(s,void 0,"salt");let c=$e(s);this.v4l^=Lt(c[0]),this.v4h^=Lt(c[1]),this.v5l^=Lt(c[2]),this.v5h^=Lt(c[3])}if(i!==void 0){P(i,void 0,"personalization");let c=$e(i);this.v6l^=Lt(c[0]),this.v6h^=Lt(c[1]),this.v7l^=Lt(c[2]),this.v7h^=Lt(c[3])}if(o!==void 0){let c=new Uint8Array(this.blockLen);c.set(o),this.update(c)}}get(){let{v0l:r,v0h:n,v1l:o,v1h:i,v2l:s,v2h:f,v3l:c,v3h:u,v4l:d,v4h:l,v5l:y,v5h:w,v6l:x,v6h:U,v7l:E,v7h:M}=this;return[r,n,o,i,s,f,c,u,d,l,y,w,x,U,E,M]}set(r,n,o,i,s,f,c,u,d,l,y,w,x,U,E,M){this.v0l=r|0,this.v0h=n|0,this.v1l=o|0,this.v1h=i|0,this.v2l=s|0,this.v2h=f|0,this.v3l=c|0,this.v3h=u|0,this.v4l=d|0,this.v4h=l|0,this.v5l=y|0,this.v5h=w|0,this.v6l=x|0,this.v6h=U|0,this.v7l=E|0,this.v7h=M|0}compress(r,n,o){this.get().forEach((u,d)=>S[d]=u),S.set(tt,16);let{h:i,l:s}=wn(BigInt(this.length));S[24]=tt[8]^s,S[25]=tt[9]^i,o&&(S[28]=~S[28],S[29]=~S[29]);let f=0,c=jo;for(let u=0;u<12;u++)Kt(0,4,8,12,r,n+2*c[f++]),Yt(0,4,8,12,r,n+2*c[f++]),Kt(1,5,9,13,r,n+2*c[f++]),Yt(1,5,9,13,r,n+2*c[f++]),Kt(2,6,10,14,r,n+2*c[f++]),Yt(2,6,10,14,r,n+2*c[f++]),Kt(3,7,11,15,r,n+2*c[f++]),Yt(3,7,11,15,r,n+2*c[f++]),Kt(0,5,10,15,r,n+2*c[f++]),Yt(0,5,10,15,r,n+2*c[f++]),Kt(1,6,11,12,r,n+2*c[f++]),Yt(1,6,11,12,r,n+2*c[f++]),Kt(2,7,8,13,r,n+2*c[f++]),Yt(2,7,8,13,r,n+2*c[f++]),Kt(3,4,9,14,r,n+2*c[f++]),Yt(3,4,9,14,r,n+2*c[f++]);this.v0l^=S[0]^S[16],this.v0h^=S[1]^S[17],this.v1l^=S[2]^S[18],this.v1h^=S[3]^S[19],this.v2l^=S[4]^S[20],this.v2h^=S[5]^S[21],this.v3l^=S[6]^S[22],this.v3h^=S[7]^S[23],this.v4l^=S[8]^S[24],this.v4h^=S[9]^S[25],this.v5l^=S[10]^S[26],this.v5h^=S[11]^S[27],this.v6l^=S[12]^S[28],this.v6h^=S[13]^S[29],this.v7l^=S[14]^S[30],this.v7h^=S[15]^S[31],gt(S)}destroy(){this.destroyed=!0,gt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},le=je(e=>new Bn(e));function Se(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var Ae=class{equals(e){return Se(this.toRawBytes(),e.toRawBytes())}toBase64(){return G(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){return G(this.toSuiBytes())}verifyWithIntent(e,t,r){let n=le(or(r,e),{dkLen:32});return this.verify(n,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(se.byteVector().serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}verifyAddress(e){return this.toSuiAddress()===e}toSuiBytes(){let e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return Ot(yt(le(this.toSuiBytes(),{dkLen:32})).slice(0,Gt*2))}};function ur(e){let t=q(e),r=ir[t[0]];switch(r){case"ED25519":case"Secp256k1":case"Secp256r1":let n=Po[r],o=t.slice(1,t.length-n);return{serializedSignature:e,signatureScheme:r,signature:o,publicKey:t.slice(1+o.length),bytes:t};default:throw new Error("Unsupported signature scheme")}}var sc=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wt=new Uint32Array(64),Sn=class extends Fe{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:n,D:o,E:i,F:s,G:f,H:c}=this;return[t,r,n,o,i,s,f,c]}set(t,r,n,o,i,s,f,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=f|0,this.H=c|0}process(t,r){for(let l=0;l<16;l++,r+=4)Wt[l]=t.getUint32(r,!1);for(let l=16;l<64;l++){let y=Wt[l-15],w=Wt[l-2],x=It(y,7)^It(y,18)^y>>>3,U=It(w,17)^It(w,19)^w>>>10;Wt[l]=U+Wt[l-7]+x+Wt[l-16]|0}let{A:n,B:o,C:i,D:s,E:f,F:c,G:u,H:d}=this;for(let l=0;l<64;l++){let y=It(f,6)^It(f,11)^It(f,25),w=d+y+Fo(f,c,u)+sc[l]+Wt[l]|0,U=(It(n,2)^It(n,13)^It(n,22))+Zo(n,o,i)|0;d=u,u=c,c=f,f=s+w|0,s=i,i=o,o=n,n=w+U|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,f=f+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,o,i,s,f,c,u,d)}roundClean(){gt(Wt)}destroy(){this.set(0,0,0,0,0,0,0,0),gt(this.buffer)}},An=class extends Sn{constructor(){super(32);g(this,"A",Vt[0]|0);g(this,"B",Vt[1]|0);g(this,"C",Vt[2]|0);g(this,"D",Vt[3]|0);g(this,"E",Vt[4]|0);g(this,"F",Vt[5]|0);g(this,"G",Vt[6]|0);g(this,"H",Vt[7]|0)}};var ei=qo(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),cc=ei[0],ac=ei[1],Xt=new Uint32Array(80),Jt=new Uint32Array(80),In=class extends Fe{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:r,Bh:n,Bl:o,Ch:i,Cl:s,Dh:f,Dl:c,Eh:u,El:d,Fh:l,Fl:y,Gh:w,Gl:x,Hh:U,Hl:E}=this;return[t,r,n,o,i,s,f,c,u,d,l,y,w,x,U,E]}set(t,r,n,o,i,s,f,c,u,d,l,y,w,x,U,E){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=s|0,this.Dh=f|0,this.Dl=c|0,this.Eh=u|0,this.El=d|0,this.Fh=l|0,this.Fl=y|0,this.Gh=w|0,this.Gl=x|0,this.Hh=U|0,this.Hl=E|0}process(t,r){for(let B=0;B<16;B++,r+=4)Xt[B]=t.getUint32(r),Jt[B]=t.getUint32(r+=4);for(let B=16;B<80;B++){let R=Xt[B-15]|0,V=Jt[B-15]|0,Z=Ct(R,V,1)^Ct(R,V,8)^xn(R,V,7),K=Dt(R,V,1)^Dt(R,V,8)^bn(R,V,7),I=Xt[B-2]|0,T=Jt[B-2]|0,N=Ct(I,T,19)^fe(I,T,61)^xn(I,T,6),j=Dt(I,T,19)^ue(I,T,61)^bn(I,T,6),C=Wo(K,j,Jt[B-7],Jt[B-16]),_=Xo(C,Z,N,Xt[B-7],Xt[B-16]);Xt[B]=_|0,Jt[B]=C|0}let{Ah:n,Al:o,Bh:i,Bl:s,Ch:f,Cl:c,Dh:u,Dl:d,Eh:l,El:y,Fh:w,Fl:x,Gh:U,Gl:E,Hh:M,Hl:A}=this;for(let B=0;B<80;B++){let R=Ct(l,y,14)^Ct(l,y,18)^fe(l,y,41),V=Dt(l,y,14)^Dt(l,y,18)^ue(l,y,41),Z=l&w^~l&U,K=y&x^~y&E,I=Jo(A,V,K,ac[B],Jt[B]),T=Qo(I,M,R,Z,cc[B],Xt[B]),N=I|0,j=Ct(n,o,28)^fe(n,o,34)^fe(n,o,39),C=Dt(n,o,28)^ue(n,o,34)^ue(n,o,39),_=n&i^n&f^i&f,m=o&s^o&c^s&c;M=U|0,A=E|0,U=w|0,E=x|0,w=l|0,x=y|0,{h:l,l:y}=wt(u|0,d|0,T|0,N|0),u=f|0,d=c|0,f=i|0,c=s|0,i=n|0,s=o|0;let h=Ze(N,C,m);n=Ge(h,T,j,_),o=h|0}({h:n,l:o}=wt(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:s}=wt(this.Bh|0,this.Bl|0,i|0,s|0),{h:f,l:c}=wt(this.Ch|0,this.Cl|0,f|0,c|0),{h:u,l:d}=wt(this.Dh|0,this.Dl|0,u|0,d|0),{h:l,l:y}=wt(this.Eh|0,this.El|0,l|0,y|0),{h:w,l:x}=wt(this.Fh|0,this.Fl|0,w|0,x|0),{h:U,l:E}=wt(this.Gh|0,this.Gl|0,U|0,E|0),{h:M,l:A}=wt(this.Hh|0,this.Hl|0,M|0,A|0),this.set(n,o,i,s,f,c,u,d,l,y,w,x,U,E,M,A)}roundClean(){gt(Xt,Jt)}destroy(){gt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Tn=class extends In{constructor(){super(64);g(this,"Ah",it[0]|0);g(this,"Al",it[1]|0);g(this,"Bh",it[2]|0);g(this,"Bl",it[3]|0);g(this,"Ch",it[4]|0);g(this,"Cl",it[5]|0);g(this,"Dh",it[6]|0);g(this,"Dl",it[7]|0);g(this,"Eh",it[8]|0);g(this,"El",it[9]|0);g(this,"Fh",it[10]|0);g(this,"Fl",it[11]|0);g(this,"Gh",it[12]|0);g(this,"Gl",it[13]|0);g(this,"Hh",it[14]|0);g(this,"Hl",it[15]|0)}};var lr=je(()=>new An,yn(1));var vn=je(()=>new Tn,yn(3));var On=BigInt(0),Un=BigInt(1);function zt(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new Error(r+"expected boolean, got type="+typeof e)}return e}function ri(e){if(typeof e=="bigint"){if(!dr(e))throw new Error("positive bigint expected, got "+e)}else lt(e);return e}function qe(e){let t=ri(e).toString(16);return t.length&1?"0"+t:t}function ni(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?On:BigInt("0x"+e)}function Ie(e){return ni(yt(e))}function de(e){return ni(yt(pr(P(e)).reverse()))}function hr(e,t){lt(t),e=ri(e);let r=Tt(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw new Error("number too large");return r}function Rn(e,t){return hr(e,t).reverse()}function pr(e){return Uint8Array.from(e)}var dr=e=>typeof e=="bigint"&&On<=e;function fc(e,t,r){return dr(e)&&dr(t)&&dr(r)&&t<=e&&e<r}function Ke(e,t,r,n){if(!fc(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function _n(e){let t;for(t=0;e>On;e>>=Un,t+=1);return t}var Ye=e=>(Un<<BigInt(e))-Un;function oi(e,t,r){if(lt(e,"hashLen"),lt(t,"qByteLen"),typeof r!="function")throw new Error("hmacFn must be a function");let n=E=>new Uint8Array(E),o=Uint8Array.of(),i=Uint8Array.of(0),s=Uint8Array.of(1),f=1e3,c=n(e),u=n(e),d=0,l=()=>{c.fill(1),u.fill(0),d=0},y=(...E)=>r(u,dt(c,...E)),w=(E=o)=>{u=y(i,E),c=y(),E.length!==0&&(u=y(s,E),c=y())},x=()=>{if(d++>=f)throw new Error("drbg: tried max amount of iterations");let E=0,M=[];for(;E<t;){c=y();let A=c.slice();M.push(A),E+=c.length}return dt(...M)};return(E,M)=>{l(),w(E);let A;for(;!(A=M(x()));)w();return l(),A}}function Qt(e,t={},r={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function n(i,s,f){let c=e[i];if(f&&c===void 0)return;let u=typeof c;if(u!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}let o=(i,s)=>Object.entries(i).forEach(([f,c])=>n(f,c,s));o(t,!1),o(r,!0)}function Te(e){let t=new WeakMap;return(r,...n)=>{let o=t.get(r);if(o!==void 0)return o;let i=e(r,...n);return t.set(r,i),i}}var ft=BigInt(0),et=BigInt(1),he=BigInt(2),ci=BigInt(3),ai=BigInt(4),fi=BigInt(5),uc=BigInt(7),ui=BigInt(8),lc=BigInt(9),li=BigInt(16);function J(e,t){let r=e%t;return r>=ft?r:t+r}function vt(e,t,r){let n=e;for(;t-- >ft;)n*=n,n%=r;return n}function ii(e,t){if(e===ft)throw new Error("invert: expected non-zero number");if(t<=ft)throw new Error("invert: expected positive modulus, got "+t);let r=J(e,t),n=t,o=ft,i=et,s=et,f=ft;for(;r!==ft;){let u=n/r,d=n%r,l=o-s*u,y=i-f*u;n=r,r=d,o=s,i=f,s=l,f=y}if(n!==et)throw new Error("invert: does not exist");return J(o,t)}function Cn(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function di(e,t){let r=(e.ORDER+et)/ai,n=e.pow(t,r);return Cn(e,n,t),n}function dc(e,t){let r=(e.ORDER-fi)/ui,n=e.mul(t,he),o=e.pow(n,r),i=e.mul(t,o),s=e.mul(e.mul(i,he),o),f=e.mul(i,e.sub(s,e.ONE));return Cn(e,f,t),f}function hc(e){let t=mr(e),r=hi(e),n=r(t,t.neg(t.ONE)),o=r(t,n),i=r(t,t.neg(n)),s=(e+uc)/li;return(f,c)=>{let u=f.pow(c,s),d=f.mul(u,n),l=f.mul(u,o),y=f.mul(u,i),w=f.eql(f.sqr(d),c),x=f.eql(f.sqr(l),c);u=f.cmov(u,d,w),d=f.cmov(y,l,x);let U=f.eql(f.sqr(d),c),E=f.cmov(u,d,U);return Cn(f,E,c),E}}function hi(e){if(e<ci)throw new Error("sqrt is not defined for small field");let t=e-et,r=0;for(;t%he===ft;)t/=he,r++;let n=he,o=mr(e);for(;si(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return di;let i=o.pow(n,t),s=(t+et)/he;return function(c,u){if(c.is0(u))return u;if(si(c,u)!==1)throw new Error("Cannot find square root");let d=r,l=c.mul(c.ONE,i),y=c.pow(u,t),w=c.pow(u,s);for(;!c.eql(y,c.ONE);){if(c.is0(y))return c.ZERO;let x=1,U=c.sqr(y);for(;!c.eql(U,c.ONE);)if(x++,U=c.sqr(U),x===d)throw new Error("Cannot find square root");let E=et<<BigInt(d-x-1),M=c.pow(l,E);d=x,l=c.sqr(M),y=c.mul(y,l),w=c.mul(w,M)}return w}}function pc(e){return e%ai===ci?di:e%ui===fi?dc:e%li===lc?hc(e):hi(e)}var pi=(e,t)=>(J(e,t)&et)===et,mc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dn(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=mc.reduce((n,o)=>(n[o]="function",n),t);return Qt(e,r),e}function gc(e,t,r){if(r<ft)throw new Error("invalid exponent, negatives unsupported");if(r===ft)return e.ONE;if(r===et)return t;let n=e.ONE,o=t;for(;r>ft;)r&et&&(n=e.mul(n,o)),o=e.sqr(o),r>>=et;return n}function We(e,t,r=!1){let n=new Array(t.length).fill(r?e.ZERO:void 0),o=t.reduce((s,f,c)=>e.is0(f)?s:(n[c]=s,e.mul(s,f)),e.ONE),i=e.inv(o);return t.reduceRight((s,f,c)=>e.is0(f)?s:(n[c]=e.mul(s,n[c]),e.mul(s,f)),i),n}function si(e,t){let r=(e.ORDER-et)/he,n=e.pow(t,r),o=e.eql(n,e.ONE),i=e.eql(n,e.ZERO),s=e.eql(n,e.neg(e.ONE));if(!o&&!i&&!s)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function yc(e,t){t!==void 0&&lt(t);let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}var Ln=class{constructor(t,r={}){g(this,"ORDER");g(this,"BITS");g(this,"BYTES");g(this,"isLE");g(this,"ZERO",ft);g(this,"ONE",et);g(this,"_lengths");g(this,"_sqrt");g(this,"_mod");if(t<=ft)throw new Error("invalid field: expected ORDER > 0, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&(this.sqrt=r.sqrt),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=r.allowedLengths?.slice()),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:o,nByteLength:i}=yc(t,n);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=o,this.BYTES=i,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return J(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return ft<=t&&t<this.ORDER}is0(t){return t===ft}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&et)===et}neg(t){return J(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return J(t*t,this.ORDER)}add(t,r){return J(t+r,this.ORDER)}sub(t,r){return J(t-r,this.ORDER)}mul(t,r){return J(t*r,this.ORDER)}pow(t,r){return gc(this,t,r)}div(t,r){return J(t*ii(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return ii(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=pc(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Rn(t,this.BYTES):hr(t,this.BYTES)}fromBytes(t,r=!1){P(t);let{_lengths:n,BYTES:o,isLE:i,ORDER:s,_mod:f}=this;if(n){if(!n.includes(t.length)||t.length>o)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let u=new Uint8Array(o);u.set(t,i?0:u.length-t.length),t=u}if(t.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);let c=i?de(t):Ie(t);if(f&&(c=J(c,s)),!r&&!this.isValid(c))throw new Error("invalid field element: outside of range 0..ORDER");return c}invertBatch(t){return We(this,t)}cmov(t,r,n){return n?r:t}};function mr(e,t={}){return new Ln(e,t)}function mi(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function kn(e){let t=mi(e);return t+Math.ceil(t/2)}function gi(e,t,r=!1){P(e);let n=e.length,o=mi(t),i=kn(t);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);let s=r?de(e):Ie(e),f=J(s,t-et)+et;return r?Rn(f,o):hr(f,o)}var ve=BigInt(0),pe=BigInt(1);function Xe(e,t){let r=t.negate();return e?r:t}function me(e,t){let r=We(e.Fp,t.map(n=>n.Z));return t.map((n,o)=>e.fromAffine(n.toAffine(r[o])))}function bi(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Mn(e,t){bi(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),o=2**e,i=Ye(e),s=BigInt(e);return{windows:r,windowSize:n,mask:i,maxNumber:o,shiftBy:s}}function yi(e,t,r){let{windowSize:n,mask:o,maxNumber:i,shiftBy:s}=r,f=Number(e&o),c=e>>s;f>n&&(f-=i,c+=pe);let u=t*n,d=u+Math.abs(f)-1,l=f===0,y=f<0,w=t%2!==0;return{nextN:c,offset:d,isZero:l,isNeg:y,isNegF:w,offsetF:u}}var Nn=new WeakMap,Ei=new WeakMap;function Pn(e){return Ei.get(e)||1}function wi(e){if(e!==ve)throw new Error("invalid wNAF")}var Ue=class{constructor(t,r){g(this,"BASE");g(this,"ZERO");g(this,"Fn");g(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,n=this.ZERO){let o=t;for(;r>ve;)r&pe&&(n=n.add(o)),o=o.double(),r>>=pe;return n}precomputeWindow(t,r){let{windows:n,windowSize:o}=Mn(r,this.bits),i=[],s=t,f=s;for(let c=0;c<n;c++){f=s,i.push(f);for(let u=1;u<o;u++)f=f.add(s),i.push(f);s=f.double()}return i}wNAF(t,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let o=this.ZERO,i=this.BASE,s=Mn(t,this.bits);for(let f=0;f<s.windows;f++){let{nextN:c,offset:u,isZero:d,isNeg:l,isNegF:y,offsetF:w}=yi(n,f,s);n=c,d?i=i.add(Xe(y,r[w])):o=o.add(Xe(l,r[u]))}return wi(n),{p:o,f:i}}wNAFUnsafe(t,r,n,o=this.ZERO){let i=Mn(t,this.bits);for(let s=0;s<i.windows&&n!==ve;s++){let{nextN:f,offset:c,isZero:u,isNeg:d}=yi(n,s,i);if(n=f,!u){let l=r[c];o=o.add(d?l.negate():l)}}return wi(n),o}getPrecomputes(t,r,n){let o=Nn.get(r);return o||(o=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(o=n(o)),Nn.set(r,o))),o}cached(t,r,n){let o=Pn(t);return this.wNAF(o,this.getPrecomputes(o,t,n),r)}unsafe(t,r,n,o){let i=Pn(t);return i===1?this._unsafeLadder(t,r,o):this.wNAFUnsafe(i,this.getPrecomputes(i,t,n),r,o)}createCache(t,r){bi(r,this.bits),Ei.set(t,r),Nn.delete(t)}hasCache(t){return Pn(t)!==1}};function Bi(e,t,r,n){let o=t,i=e.ZERO,s=e.ZERO;for(;r>ve||n>ve;)r&pe&&(i=i.add(o)),n&pe&&(s=s.add(o)),o=o.double(),r>>=pe,n>>=pe;return{p1:i,p2:s}}function xi(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Dn(t),t}else return mr(e,{isLE:r})}function gr(e,t,r={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let c of["p","n","h"]){let u=t[c];if(!(typeof u=="bigint"&&u>ve))throw new Error(`CURVE.${c} must be positive bigint`)}let o=xi(t.p,r.Fp,n),i=xi(t.n,r.Fn,n),f=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let c of f)if(!o.isValid(t[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:i}}function yr(e,t){return function(n){let o=e(n);return{secretKey:o,publicKey:t(o)}}}var wr=class{constructor(t,r){g(this,"oHash");g(this,"iHash");g(this,"blockLen");g(this,"outputLen");g(this,"finished",!1);g(this,"destroyed",!1);if(sr(t),P(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?t.create().update(r).digest():r);for(let i=0;i<o.length;i++)o[i]^=54;this.iHash.update(o),this.oHash=t.create();for(let i=0;i<o.length;i++)o[i]^=106;this.oHash.update(o),gt(o)}update(t){return Ht(this),this.iHash.update(t),this}digestInto(t){Ht(this),P(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:o,destroyed:i,blockLen:s,outputLen:f}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=f,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Hn=(e,t,r)=>new wr(e,t).update(r).digest();Hn.create=(e,t)=>new wr(e,t);var Si=(e,t)=>(e+(e>=0?t:-t)/Ai)/t;function wc(e,t,r){let[[n,o],[i,s]]=t,f=Si(s*e,r),c=Si(-o*e,r),u=e-f*n-c*i,d=-f*o-c*s,l=u<$t,y=d<$t;l&&(u=-u),y&&(d=-d);let w=Ye(Math.ceil(_n(r)/2))+Oe;if(u<$t||u>=w||d<$t||d>=w)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:l,k1:u,k2neg:y,k2:d}}function zn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Vn(e,t){let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return zt(r.lowS,"lowS"),zt(r.prehash,"prehash"),r.format!==void 0&&zn(r.format),r}var $n=class extends Error{constructor(t=""){super(t)}},te={Err:$n,_tlv:{encode:(e,t)=>{let{Err:r}=te;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,o=qe(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let i=n>127?qe(o.length/2|128):"";return qe(e)+i+o+t},decode(e,t){let{Err:r}=te,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let o=t[n++],i=!!(o&128),s=0;if(!i)s=o;else{let c=o&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)s=s<<8|d;if(n+=c,s<128)throw new r("tlv.decode(long): not minimal encoding")}let f=t.subarray(n,n+s);if(f.length!==s)throw new r("tlv.decode: wrong value length");return{v:f,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=te;if(e<$t)throw new t("integer: negative integers are not allowed");let r=qe(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=te;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ie(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=te,o=P(e,void 0,"signature"),{v:i,l:s}=n.decode(48,o);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:f,l:c}=n.decode(2,i),{v:u,l:d}=n.decode(2,c);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(f),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=te,n=t.encode(2,r.encode(e.r)),o=t.encode(2,r.encode(e.s)),i=n+o;return t.encode(48,i)}},$t=BigInt(0),Oe=BigInt(1),Ai=BigInt(2),xr=BigInt(3),xc=BigInt(4);function Ii(e,t={}){let r=gr("weierstrass",e,t),{Fp:n,Fn:o}=r,i=r.CURVE,{h:s,n:f}=i;Qt(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:c}=t;if(c&&(!n.is0(i.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let u=vi(n,o);function d(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(_,m,h){let{x:b,y:v}=m.toAffine(),L=n.toBytes(b);if(zt(h,"isCompressed"),h){d();let D=!n.isOdd(v);return dt(Ti(D),L)}else return dt(Uint8Array.of(4),L,n.toBytes(v))}function y(_){P(_,void 0,"Point");let{publicKey:m,publicKeyUncompressed:h}=u,b=_.length,v=_[0],L=_.subarray(1);if(b===m&&(v===2||v===3)){let D=n.fromBytes(L);if(!n.isValid(D))throw new Error("bad point: is not on curve, wrong x");let k=U(D),O;try{O=n.sqrt(k)}catch(Q){let Y=Q instanceof Error?": "+Q.message:"";throw new Error("bad point: is not on curve, sqrt error"+Y)}d();let H=n.isOdd(O);return(v&1)===1!==H&&(O=n.neg(O)),{x:D,y:O}}else if(b===h&&v===4){let D=n.BYTES,k=n.fromBytes(L.subarray(0,D)),O=n.fromBytes(L.subarray(D,D*2));if(!E(k,O))throw new Error("bad point: is not on curve");return{x:k,y:O}}else throw new Error(`bad point: got length ${b}, expected compressed=${m} or uncompressed=${h}`)}let w=t.toBytes||l,x=t.fromBytes||y;function U(_){let m=n.sqr(_),h=n.mul(m,_);return n.add(n.add(h,n.mul(_,i.a)),i.b)}function E(_,m){let h=n.sqr(m),b=U(_);return n.eql(h,b)}if(!E(i.Gx,i.Gy))throw new Error("bad curve params: generator point");let M=n.mul(n.pow(i.a,xr),xc),A=n.mul(n.sqr(i.b),BigInt(27));if(n.is0(n.add(M,A)))throw new Error("bad curve params: a or b");function B(_,m,h=!1){if(!n.isValid(m)||h&&n.is0(m))throw new Error(`bad point coordinate ${_}`);return m}function R(_){if(!(_ instanceof T))throw new Error("Weierstrass Point expected")}function V(_){if(!c||!c.basises)throw new Error("no endo");return wc(_,c.basises,o.ORDER)}let Z=Te((_,m)=>{let{X:h,Y:b,Z:v}=_;if(n.eql(v,n.ONE))return{x:h,y:b};let L=_.is0();m==null&&(m=L?n.ONE:n.inv(v));let D=n.mul(h,m),k=n.mul(b,m),O=n.mul(v,m);if(L)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:D,y:k}}),K=Te(_=>{if(_.is0()){if(t.allowInfinityPoint&&!n.is0(_.Y))return;throw new Error("bad point: ZERO")}let{x:m,y:h}=_.toAffine();if(!n.isValid(m)||!n.isValid(h))throw new Error("bad point: x or y not field elements");if(!E(m,h))throw new Error("bad point: equation left != right");if(!_.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function I(_,m,h,b,v){return h=new T(n.mul(h.X,_),h.Y,h.Z),m=Xe(b,m),h=Xe(v,h),m.add(h)}let C=class C{constructor(m,h,b){g(this,"X");g(this,"Y");g(this,"Z");this.X=B("x",m),this.Y=B("y",h,!0),this.Z=B("z",b),Object.freeze(this)}static CURVE(){return i}static fromAffine(m){let{x:h,y:b}=m||{};if(!m||!n.isValid(h)||!n.isValid(b))throw new Error("invalid affine point");if(m instanceof C)throw new Error("projective point not allowed");return n.is0(h)&&n.is0(b)?C.ZERO:new C(h,b,n.ONE)}static fromBytes(m){let h=C.fromAffine(x(P(m,void 0,"point")));return h.assertValidity(),h}static fromHex(m){return C.fromBytes(Tt(m))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,h=!0){return j.createCache(this,m),h||this.multiply(xr),this}assertValidity(){K(this)}hasEvenY(){let{y:m}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(m)}equals(m){R(m);let{X:h,Y:b,Z:v}=this,{X:L,Y:D,Z:k}=m,O=n.eql(n.mul(h,k),n.mul(L,v)),H=n.eql(n.mul(b,k),n.mul(D,v));return O&&H}negate(){return new C(this.X,n.neg(this.Y),this.Z)}double(){let{a:m,b:h}=i,b=n.mul(h,xr),{X:v,Y:L,Z:D}=this,k=n.ZERO,O=n.ZERO,H=n.ZERO,z=n.mul(v,v),Q=n.mul(L,L),Y=n.mul(D,D),$=n.mul(v,L);return $=n.add($,$),H=n.mul(v,D),H=n.add(H,H),k=n.mul(m,H),O=n.mul(b,Y),O=n.add(k,O),k=n.sub(Q,O),O=n.add(Q,O),O=n.mul(k,O),k=n.mul($,k),H=n.mul(b,H),Y=n.mul(m,Y),$=n.sub(z,Y),$=n.mul(m,$),$=n.add($,H),H=n.add(z,z),z=n.add(H,z),z=n.add(z,Y),z=n.mul(z,$),O=n.add(O,z),Y=n.mul(L,D),Y=n.add(Y,Y),z=n.mul(Y,$),k=n.sub(k,z),H=n.mul(Y,Q),H=n.add(H,H),H=n.add(H,H),new C(k,O,H)}add(m){R(m);let{X:h,Y:b,Z:v}=this,{X:L,Y:D,Z:k}=m,O=n.ZERO,H=n.ZERO,z=n.ZERO,Q=i.a,Y=n.mul(i.b,xr),$=n.mul(h,L),ot=n.mul(b,D),ct=n.mul(v,k),pt=n.add(h,b),X=n.add(L,D);pt=n.mul(pt,X),X=n.add($,ot),pt=n.sub(pt,X),X=n.add(h,v);let at=n.add(L,k);return X=n.mul(X,at),at=n.add($,ct),X=n.sub(X,at),at=n.add(b,v),O=n.add(D,k),at=n.mul(at,O),O=n.add(ot,ct),at=n.sub(at,O),z=n.mul(Q,X),O=n.mul(Y,ct),z=n.add(O,z),O=n.sub(ot,z),z=n.add(ot,z),H=n.mul(O,z),ot=n.add($,$),ot=n.add(ot,$),ct=n.mul(Q,ct),X=n.mul(Y,X),ot=n.add(ot,ct),ct=n.sub($,ct),ct=n.mul(Q,ct),X=n.add(X,ct),$=n.mul(ot,X),H=n.add(H,$),$=n.mul(at,X),O=n.mul(pt,O),O=n.sub(O,$),$=n.mul(pt,ot),z=n.mul(at,z),z=n.add(z,$),new C(O,H,z)}subtract(m){return this.add(m.negate())}is0(){return this.equals(C.ZERO)}multiply(m){let{endo:h}=t;if(!o.isValidNot0(m))throw new Error("invalid scalar: out of range");let b,v,L=D=>j.cached(this,D,k=>me(C,k));if(h){let{k1neg:D,k1:k,k2neg:O,k2:H}=V(m),{p:z,f:Q}=L(k),{p:Y,f:$}=L(H);v=Q.add($),b=I(h.beta,z,Y,D,O)}else{let{p:D,f:k}=L(m);b=D,v=k}return me(C,[b,v])[0]}multiplyUnsafe(m){let{endo:h}=t,b=this;if(!o.isValid(m))throw new Error("invalid scalar: out of range");if(m===$t||b.is0())return C.ZERO;if(m===Oe)return b;if(j.hasCache(this))return this.multiply(m);if(h){let{k1neg:v,k1:L,k2neg:D,k2:k}=V(m),{p1:O,p2:H}=Bi(C,b,L,k);return I(h.beta,O,H,v,D)}else return j.unsafe(b,m)}toAffine(m){return Z(this,m)}isTorsionFree(){let{isTorsionFree:m}=t;return s===Oe?!0:m?m(C,this):j.unsafe(this,f).is0()}clearCofactor(){let{clearCofactor:m}=t;return s===Oe?this:m?m(C,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(m=!0){return zt(m,"isCompressed"),this.assertValidity(),w(C,this,m)}toHex(m=!0){return yt(this.toBytes(m))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};g(C,"BASE",new C(i.Gx,i.Gy,n.ONE)),g(C,"ZERO",new C(n.ZERO,n.ONE,n.ZERO)),g(C,"Fp",n),g(C,"Fn",o);let T=C,N=o.BITS,j=new Ue(T,t.endo?Math.ceil(N/2):N);return T.BASE.precompute(8),T}function Ti(e){return Uint8Array.of(e?2:3)}function vi(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function bc(e,t={}){let{Fn:r}=e,n=t.randomBytes||Be,o=Object.assign(vi(e.Fp,r),{seed:kn(r.ORDER)});function i(w){try{let x=r.fromBytes(w);return r.isValidNot0(x)}catch{return!1}}function s(w,x){let{publicKey:U,publicKeyUncompressed:E}=o;try{let M=w.length;return x===!0&&M!==U||x===!1&&M!==E?!1:!!e.fromBytes(w)}catch{return!1}}function f(w=n(o.seed)){return gi(P(w,o.seed,"seed"),r.ORDER)}function c(w,x=!0){return e.BASE.multiply(r.fromBytes(w)).toBytes(x)}function u(w){let{secretKey:x,publicKey:U,publicKeyUncompressed:E}=o;if(!ce(w)||"_lengths"in r&&r._lengths||x===U)return;let M=P(w,void 0,"key").length;return M===U||M===E}function d(w,x,U=!0){if(u(w)===!0)throw new Error("first arg must be private key");if(u(x)===!1)throw new Error("second arg must be public key");let E=r.fromBytes(w);return e.fromBytes(x).multiply(E).toBytes(U)}let l={isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:f},y=yr(f,c);return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:y,Point:e,utils:l,lengths:o})}function Ui(e,t,r={}){sr(t),Qt(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes||Be,o=r.hmac||((m,h)=>Hn(t,m,h)),{Fp:i,Fn:s}=e,{ORDER:f,BITS:c}=s,{keygen:u,getPublicKey:d,getSharedSecret:l,utils:y,lengths:w}=bc(e,r),x={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},U=f*Ai<i.ORDER;function E(m){let h=f>>Oe;return m>h}function M(m,h){if(!s.isValidNot0(h))throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);return h}function A(){if(U)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function B(m,h){zn(h);let b=w.signature,v=h==="compact"?b:h==="recovered"?b+1:void 0;return P(m,v)}class R{constructor(h,b,v){g(this,"r");g(this,"s");g(this,"recovery");if(this.r=M("r",h),this.s=M("s",b),v!=null){if(A(),![0,1,2,3].includes(v))throw new Error("invalid recovery id");this.recovery=v}Object.freeze(this)}static fromBytes(h,b=x.format){B(h,b);let v;if(b==="der"){let{r:O,s:H}=te.toSig(P(h));return new R(O,H)}b==="recovered"&&(v=h[0],b="compact",h=h.subarray(1));let L=w.signature/2,D=h.subarray(0,L),k=h.subarray(L,L*2);return new R(s.fromBytes(D),s.fromBytes(k),v)}static fromHex(h,b){return this.fromBytes(Tt(h),b)}assertRecovery(){let{recovery:h}=this;if(h==null)throw new Error("invalid recovery id: must be present");return h}addRecoveryBit(h){return new R(this.r,this.s,h)}recoverPublicKey(h){let{r:b,s:v}=this,L=this.assertRecovery(),D=L===2||L===3?b+f:b;if(!i.isValid(D))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let k=i.toBytes(D),O=e.fromBytes(dt(Ti((L&1)===0),k)),H=s.inv(D),z=Z(P(h,void 0,"msgHash")),Q=s.create(-z*H),Y=s.create(v*H),$=e.BASE.multiplyUnsafe(Q).add(O.multiplyUnsafe(Y));if($.is0())throw new Error("invalid recovery: point at infinify");return $.assertValidity(),$}hasHighS(){return E(this.s)}toBytes(h=x.format){if(zn(h),h==="der")return Tt(te.hexFromSig(this));let{r:b,s:v}=this,L=s.toBytes(b),D=s.toBytes(v);return h==="recovered"?(A(),dt(Uint8Array.of(this.assertRecovery()),L,D)):dt(L,D)}toHex(h){return yt(this.toBytes(h))}}let V=r.bits2int||function(h){if(h.length>8192)throw new Error("input is too large");let b=Ie(h),v=h.length*8-c;return v>0?b>>BigInt(v):b},Z=r.bits2int_modN||function(h){return s.create(V(h))},K=Ye(c);function I(m){return Ke("num < 2^"+c,m,$t,K),s.toBytes(m)}function T(m,h){return P(m,void 0,"message"),h?P(t(m),void 0,"prehashed message"):m}function N(m,h,b){let{lowS:v,prehash:L,extraEntropy:D}=Vn(b,x);m=T(m,L);let k=Z(m),O=s.fromBytes(h);if(!s.isValidNot0(O))throw new Error("invalid private key");let H=[I(O),I(k)];if(D!=null&&D!==!1){let $=D===!0?n(w.secretKey):D;H.push(P($,void 0,"extraEntropy"))}let z=dt(...H),Q=k;function Y($){let ot=V($);if(!s.isValidNot0(ot))return;let ct=s.inv(ot),pt=e.BASE.multiply(ot).toAffine(),X=s.create(pt.x);if(X===$t)return;let at=s.create(ct*s.create(Q+X*O));if(at===$t)return;let mo=(pt.x===X?0:2)|Number(pt.y&Oe),go=at;return v&&E(at)&&(go=s.neg(at),mo^=1),new R(X,go,U?void 0:mo)}return{seed:z,k2sig:Y}}function j(m,h,b={}){let{seed:v,k2sig:L}=N(m,h,b);return oi(t.outputLen,s.BYTES,o)(v,L).toBytes(b.format)}function C(m,h,b,v={}){let{lowS:L,prehash:D,format:k}=Vn(v,x);if(b=P(b,void 0,"publicKey"),h=T(h,D),!ce(m)){let O=m instanceof R?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+O)}B(m,k);try{let O=R.fromBytes(m,k),H=e.fromBytes(b);if(L&&O.hasHighS())return!1;let{r:z,s:Q}=O,Y=Z(h),$=s.inv(Q),ot=s.create(Y*$),ct=s.create(z*$),pt=e.BASE.multiplyUnsafe(ot).add(H.multiplyUnsafe(ct));return pt.is0()?!1:s.create(pt.x)===z}catch{return!1}}function _(m,h,b={}){let{prehash:v}=Vn(b,x);return h=T(h,v),R.fromBytes(m,"recovered").recoverPublicKey(h).toBytes()}return Object.freeze({keygen:u,getPublicKey:d,getSharedSecret:l,utils:y,lengths:w,Point:e,sign:j,verify:C,recoverPublicKey:_,Signature:R,hash:t})}var Ec={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")};var Bc=Ii(Ec),Oi=Ui(Bc,lr);var jn=33;var Fn=64,Ou=new Uint8Array([48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0]),Re,Ru=(Re=class extends Ae{constructor(t){if(super(),typeof t=="string"?this.data=q(t):t instanceof Uint8Array?this.data=t:this.data=Uint8Array.from(t),this.data.length!==jn)throw new Error(`Invalid public key input. Expected ${jn} bytes, got ${this.data.length}`)}equals(t){return super.equals(t)}toRawBytes(){return this.data}flag(){return _t.Passkey}async verify(t,r){let n=Zn(r),o=JSON.parse(n.clientDataJson);if(o.type!=="webauthn.get"||!Se(t,q(o.challenge.replace(/-/g,"+").replace(/_/g,"/"))))return!1;let i=n.userSignature.slice(1+Fn);if(!Se(this.toRawBytes(),i))return!1;let s=new Uint8Array([...n.authenticatorData,...lr(new TextEncoder().encode(n.clientDataJson))]),f=n.userSignature.slice(1,Fn+1);return Oi.verify(f,s,i)}},Re.SIZE=jn,Re);function Zn(e){let t=typeof e=="string"?q(e):e;if(t[0]!==_t.Passkey)throw new Error("Invalid signature scheme");let r=nr.parse(t.slice(1));return{signatureScheme:"Passkey",serializedSignature:G(t),signature:t,authenticatorData:r.authenticatorData,clientDataJson:r.clientDataJson,userSignature:new Uint8Array(r.userSignature),publicKey:new Uint8Array(r.userSignature.slice(1+Fn))}}function Sc(e){for(let t=0;t<e.length;t++)if(e[t]!==0)return t;return-1}function br(e,t){return Tt(e.toString(16).padStart(t*2,"0").slice(-t*2))}function Gn(e,t){let r=br(e,t),n=Sc(r);return n===-1?new Uint8Array([0]):r.slice(n)}function Ri(e){return e==="accounts.google.com"?"https://accounts.google.com":e}function Ac(e){if(e.length!==1)throw new Error("Invalid base64Url character: "+e);let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(e);if(t===-1)throw new Error("Invalid base64Url character: "+e);let r=t.toString(2).padStart(6,"0");return Array.from(r).map(Number)}function Ic(e){let t=[];for(let r=0;r<e.length;r++){let n=Ac(e.charAt(r));t=t.concat(n)}return t}function Tc(e,t){if(e.length<2)throw new Error(`Input (s = ${e}) is not tightly packed because s.length < 2`);let r=Ic(e),n=t%4;if(n!==0)if(n===1)r=r.slice(2);else if(n===2)r=r.slice(4);else throw new Error(`Input (s = ${e}) is not tightly packed because i%4 = 3 (i = ${t}))`);let o=(t+e.length-1)%4;if(o!==3)if(o===2)r=r.slice(0,r.length-2);else if(o===1)r=r.slice(0,r.length-4);else throw new Error(`Input (s = ${e}) is not tightly packed because (i + s.length - 1)%4 = 0 (i = ${t}))`);if(r.length%8!==0)throw new Error("We should never reach here...");let i=new Uint8Array(Math.floor(r.length/8)),s=0;for(let f=0;f<r.length;f+=8){let c=r.slice(f,f+8),u=parseInt(c.join(""),2);i[s++]=u}return new TextDecoder().decode(i)}function vc(e){if(!(e.slice(-1)==="}"||e.slice(-1)===","))throw new Error("Invalid claim");let t=JSON.parse("{"+e.slice(0,-1)+"}");if(Object.keys(t).length!==1)throw new Error("Invalid claim");let r=Object.keys(t)[0];return[r,t[r]]}function qn(e,t){let[r,n]=vc(Tc(e.value,e.indexMod4));if(r!==t)throw new Error(`Invalid field name: found ${r} expected ${t}`);return n}var _i=a.struct("ZkLoginSignature",{inputs:a.struct("ZkLoginSignatureInputs",{proofPoints:a.struct("ZkLoginSignatureInputsProofPoints",{a:a.vector(a.string()),b:a.vector(a.vector(a.string())),c:a.vector(a.string())}),issBase64Details:a.struct("ZkLoginSignatureInputsClaim",{value:a.string(),indexMod4:a.u8()}),headerBase64:a.string(),addressSeed:a.string()}),maxEpoch:a.u64(),userSignature:a.byteVector()});function Li(e){return _i.parse(typeof e=="string"?q(e):e)}var bt,Le,Ce,Je,Kn,Et,Uc=(Et=class extends Ae{constructor(r,{client:n}={}){super();Ut(this,Je);Ut(this,bt);Ut(this,Le);Ut(this,Ce);xt(this,Le,n),typeof r=="string"?xt(this,bt,q(r)):r instanceof Uint8Array?xt(this,bt,r):xt(this,bt,Uint8Array.from(r)),xt(this,Ce,W(this,bt).length!==W(this,bt)[0]+1+32),W(this,Ce)&&xt(this,bt,_e(W(this,bt),!1))}static fromBytes(r,{client:n,address:o,legacyAddress:i}={}){let s;if(i===!0?s=new Et(_e(r,!0),{client:n}):i===!1?s=new Et(_e(r,!1),{client:n}):o?(s=new Et(_e(r,!1),{client:n}),s.toSuiAddress()!==o&&(s=new Et(_e(r,!0),{client:n}))):s=new Et(r,{client:n}),o&&s.toSuiAddress()!==o)throw new Error("Public key bytes do not match the provided address");return s}static fromProof(r,n){let{issBase64Details:o,addressSeed:i}=n,s=qn(o,"iss"),f=Yn(BigInt(i),s,{legacyAddress:!0});if(f.toSuiAddress()===r)return f;let c=Yn(BigInt(i),s,{legacyAddress:!1});if(c.toSuiAddress()!==r)throw new Error("Proof does not match address");return c}equals(r){return super.equals(r)}toSuiAddress(){return W(this,Ce)?Ur(this,Je,Kn).call(this):super.toSuiAddress()}toRawBytes(){return W(this,bt)}flag(){return _t.ZkLogin}async verify(r,n){throw Error("does not support")}verifyPersonalMessage(r,n){let o=Er(n);return Ci({address:new Et(o.publicKey).toSuiAddress(),bytes:G(r),signature:o.serializedSignature,intentScope:"PersonalMessage",client:W(this,Le)})}verifyTransaction(r,n){let o=Er(n);return Ci({address:new Et(o.publicKey).toSuiAddress(),bytes:G(r),signature:o.serializedSignature,intentScope:"TransactionData",client:W(this,Le)})}verifyAddress(r){return r===super.toSuiAddress()||r===Ur(this,Je,Kn).call(this)}},bt=new WeakMap,Le=new WeakMap,Ce=new WeakMap,Je=new WeakSet,Kn=function(){let r=_e(W(this,bt),!0),n=new Uint8Array(r.length+1);return n[0]=this.flag(),n.set(r,1),Ot(yt(le(n,{dkLen:32})).slice(0,Gt*2))},Et);function Yn(e,t,r){if(r.legacyAddress===void 0)throw new Error("legacyAddress parameter must be specified");let n=r.legacyAddress?Gn(e,32):br(e,32),o=new TextEncoder().encode(Ri(t)),i=new Uint8Array(1+o.length+n.length);return i.set([o.length],0),i.set(o,1),i.set(n,1+o.length),new Uc(i,r)}function _e(e,t){let r=e[0]+1,n=BigInt(`0x${St(e.slice(r))}`),o=t?Gn(n,32):br(n,32),i=new Uint8Array(r+o.length);return i.set(e.slice(0,r),0),i.set(o,r),i}async function Ci({address:e,bytes:t,signature:r,intentScope:n,client:o}){if(!o)throw new Error("A Sui Client (GRPC, GraphQL, or JSON RPC) is required to verify zkLogin signatures");let i=await o.core.verifyZkLoginSignature({bytes:t,signature:r,intentScope:n,address:e});return i.success===!0&&i.errors.length===0}function Er(e){let t=typeof e=="string"?q(e):e;if(t[0]!==_t.ZkLogin)throw new Error("Invalid signature scheme");let{inputs:r,maxEpoch:n,userSignature:o}=Li(t.slice(1)),{issBase64Details:i,addressSeed:s}=r,f=qn(i,"iss"),c=Yn(BigInt(s),f,{legacyAddress:!1});return{serializedSignature:G(t),signatureScheme:"ZkLogin",zkLogin:{inputs:r,maxEpoch:n,userSignature:o,iss:f,addressSeed:BigInt(s)},signature:t,publicKey:c.toRawBytes()}}function Wn({signature:e,signatureScheme:t,publicKey:r}){if(!r)throw new Error("`publicKey` is required");let n=r.toRawBytes(),o=new Uint8Array(1+e.length+n.length);return o.set([_t[t]]),o.set(e,1),o.set(n,1+e.length),G(o)}function Xn(e){let t=q(e),r=ir[t[0]];switch(r){case"Passkey":return Zn(e);case"MultiSig":return{serializedSignature:e,signatureScheme:r,multisig:se.MultiSig.parse(t.slice(1)),bytes:t,signature:void 0};case"ZkLogin":return Er(e);case"ED25519":case"Secp256k1":case"Secp256r1":return ur(e);default:throw new Error("Unsupported signature scheme")}}var Jn=class{async signWithIntent(e,t){let r=le(or(t,e),{dkLen:32});return{signature:Wn({signature:await this.sign(r),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:G(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){let{signature:t}=await this.signWithIntent(a.byteVector().serialize(e).toBytes(),"PersonalMessage");return{bytes:G(e),signature:t}}async signAndExecuteTransaction({transaction:e,client:t}){e.setSenderIfNotSet(this.toSuiAddress());let r=await e.build({client:t}),{signature:n}=await this.signTransaction(r);return t.core.executeTransaction({transaction:r,signatures:[n],include:{transaction:!0,effects:!0}})}toSuiAddress(){return this.getPublicKey().toSuiAddress()}};var ee=BigInt(0),rt=BigInt(1),Qn=BigInt(2),Oc=BigInt(8);function Rc(e,t,r,n){let o=e.sqr(r),i=e.sqr(n),s=e.add(e.mul(t.a,o),i),f=e.add(e.ONE,e.mul(t.d,e.mul(o,i)));return e.eql(s,f)}function Di(e,t={}){let r=gr("edwards",e,t,t.FpFnLE),{Fp:n,Fn:o}=r,i=r.CURVE,{h:s}=i;Qt(t,{},{uvRatio:"function"});let f=Qn<<BigInt(o.BYTES*8)-rt,c=M=>n.create(M),u=t.uvRatio||((M,A)=>{try{return{isValid:!0,value:n.sqrt(n.div(M,A))}}catch{return{isValid:!1,value:ee}}});if(!Rc(n,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function d(M,A,B=!1){let R=B?rt:ee;return Ke("coordinate "+M,A,R,f),A}function l(M){if(!(M instanceof x))throw new Error("EdwardsPoint expected")}let y=Te((M,A)=>{let{X:B,Y:R,Z:V}=M,Z=M.is0();A==null&&(A=Z?Oc:n.inv(V));let K=c(B*A),I=c(R*A),T=n.mul(V,A);if(Z)return{x:ee,y:rt};if(T!==rt)throw new Error("invZ was invalid");return{x:K,y:I}}),w=Te(M=>{let{a:A,d:B}=i;if(M.is0())throw new Error("bad point: ZERO");let{X:R,Y:V,Z,T:K}=M,I=c(R*R),T=c(V*V),N=c(Z*Z),j=c(N*N),C=c(I*A),_=c(N*c(C+T)),m=c(j+c(B*c(I*T)));if(_!==m)throw new Error("bad point: equation left != right (1)");let h=c(R*V),b=c(Z*K);if(h!==b)throw new Error("bad point: equation left != right (2)");return!0}),E=class E{constructor(A,B,R,V){g(this,"X");g(this,"Y");g(this,"Z");g(this,"T");this.X=d("x",A),this.Y=d("y",B),this.Z=d("z",R,!0),this.T=d("t",V),Object.freeze(this)}static CURVE(){return i}static fromAffine(A){if(A instanceof E)throw new Error("extended point not allowed");let{x:B,y:R}=A||{};return d("x",B),d("y",R),new E(B,R,rt,c(B*R))}static fromBytes(A,B=!1){let R=n.BYTES,{a:V,d:Z}=i;A=pr(P(A,R,"point")),zt(B,"zip215");let K=pr(A),I=A[R-1];K[R-1]=I&-129;let T=de(K),N=B?f:n.ORDER;Ke("point.y",T,ee,N);let j=c(T*T),C=c(j-rt),_=c(Z*j-V),{isValid:m,value:h}=u(C,_);if(!m)throw new Error("bad point: invalid y coordinate");let b=(h&rt)===rt,v=(I&128)!==0;if(!B&&h===ee&&v)throw new Error("bad point: x=0 and x_0=1");return v!==b&&(h=c(-h)),E.fromAffine({x:h,y:T})}static fromHex(A,B=!1){return E.fromBytes(Tt(A),B)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(A=8,B=!0){return U.createCache(this,A),B||this.multiply(Qn),this}assertValidity(){w(this)}equals(A){l(A);let{X:B,Y:R,Z:V}=this,{X:Z,Y:K,Z:I}=A,T=c(B*I),N=c(Z*V),j=c(R*I),C=c(K*V);return T===N&&j===C}is0(){return this.equals(E.ZERO)}negate(){return new E(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:A}=i,{X:B,Y:R,Z:V}=this,Z=c(B*B),K=c(R*R),I=c(Qn*c(V*V)),T=c(A*Z),N=B+R,j=c(c(N*N)-Z-K),C=T+K,_=C-I,m=T-K,h=c(j*_),b=c(C*m),v=c(j*m),L=c(_*C);return new E(h,b,L,v)}add(A){l(A);let{a:B,d:R}=i,{X:V,Y:Z,Z:K,T:I}=this,{X:T,Y:N,Z:j,T:C}=A,_=c(V*T),m=c(Z*N),h=c(I*R*C),b=c(K*j),v=c((V+Z)*(T+N)-_-m),L=b-h,D=b+h,k=c(m-B*_),O=c(v*L),H=c(D*k),z=c(v*k),Q=c(L*D);return new E(O,H,Q,z)}subtract(A){return this.add(A.negate())}multiply(A){if(!o.isValidNot0(A))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:B,f:R}=U.cached(this,A,V=>me(E,V));return me(E,[B,R])[0]}multiplyUnsafe(A,B=E.ZERO){if(!o.isValid(A))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return A===ee?E.ZERO:this.is0()||A===rt?this:U.unsafe(this,A,R=>me(E,R),B)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}isTorsionFree(){return U.unsafe(this,i.n).is0()}toAffine(A){return y(this,A)}clearCofactor(){return s===rt?this:this.multiplyUnsafe(s)}toBytes(){let{x:A,y:B}=this.toAffine(),R=n.toBytes(B);return R[R.length-1]|=A&rt?128:0,R}toHex(){return yt(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};g(E,"BASE",new E(i.Gx,i.Gy,rt,c(i.Gx*i.Gy))),g(E,"ZERO",new E(ee,rt,rt,ee)),g(E,"Fp",n),g(E,"Fn",o);let x=E,U=new Ue(x,o.BITS);return x.BASE.precompute(8),x}function ki(e,t,r={}){if(typeof t!="function")throw new Error('"hash" function param is required');Qt(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:o,Fp:i,Fn:s}=e,f=r.randomBytes||Be,c=r.adjustScalarBytes||(I=>I),u=r.domain||((I,T,N)=>{if(zt(N,"phflag"),T.length||N)throw new Error("Contexts/pre-hash are not supported");return I});function d(I){return s.create(de(I))}function l(I){let T=B.secretKey;P(I,B.secretKey,"secretKey");let N=P(t(I),2*T,"hashedSecretKey"),j=c(N.slice(0,T)),C=N.slice(T,2*T),_=d(j);return{head:j,prefix:C,scalar:_}}function y(I){let{head:T,prefix:N,scalar:j}=l(I),C=o.multiply(j),_=C.toBytes();return{head:T,prefix:N,scalar:j,point:C,pointBytes:_}}function w(I){return y(I).pointBytes}function x(I=Uint8Array.of(),...T){let N=dt(...T);return d(t(u(N,P(I,void 0,"context"),!!n)))}function U(I,T,N={}){I=P(I,void 0,"message"),n&&(I=n(I));let{prefix:j,scalar:C,pointBytes:_}=y(T),m=x(N.context,j,I),h=o.multiply(m).toBytes(),b=x(N.context,h,_,I),v=s.create(m+b*C);if(!s.isValid(v))throw new Error("sign failed: invalid s");let L=dt(h,s.toBytes(v));return P(L,B.signature,"result")}let E={zip215:!0};function M(I,T,N,j=E){let{context:C,zip215:_}=j,m=B.signature;I=P(I,m,"signature"),T=P(T,void 0,"message"),N=P(N,B.publicKey,"publicKey"),_!==void 0&&zt(_,"zip215"),n&&(T=n(T));let h=m/2,b=I.subarray(0,h),v=de(I.subarray(h,m)),L,D,k;try{L=e.fromBytes(N,_),D=e.fromBytes(b,_),k=o.multiplyUnsafe(v)}catch{return!1}if(!_&&L.isSmallOrder())return!1;let O=x(C,D.toBytes(),L.toBytes(),T);return D.add(L.multiplyUnsafe(O)).subtract(k).clearCofactor().is0()}let A=i.BYTES,B={secretKey:A,publicKey:A,signature:2*A,seed:A};function R(I=f(B.seed)){return P(I,B.seed,"seed")}function V(I){return ce(I)&&I.length===s.BYTES}function Z(I,T){try{return!!e.fromBytes(I,T)}catch{return!1}}let K={getExtendedPublicKey:y,randomSecretKey:R,isValidSecretKey:V,isValidPublicKey:Z,toMontgomery(I){let{y:T}=e.fromBytes(I),N=B.publicKey,j=N===32;if(!j&&N!==57)throw new Error("only defined for 25519 and 448");let C=j?i.div(rt+T,rt-T):i.div(T-rt,T+rt);return i.toBytes(C)},toMontgomerySecret(I){let T=B.secretKey;P(I,T);let N=t(I.subarray(0,T));return c(N).subarray(0,T)}};return Object.freeze({keygen:yr(R,w),getPublicKey:w,sign:U,verify:M,utils:K,Point:e,lengths:B})}var _c=BigInt(1),Mi=BigInt(2);var Lc=BigInt(5),Cc=BigInt(8),to=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Dc={p:to,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Cc,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function kc(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),o=BigInt(80),i=to,f=e*e%i*e%i,c=vt(f,Mi,i)*f%i,u=vt(c,_c,i)*e%i,d=vt(u,Lc,i)*u%i,l=vt(d,t,i)*d%i,y=vt(l,r,i)*l%i,w=vt(y,n,i)*y%i,x=vt(w,o,i)*w%i,U=vt(x,o,i)*w%i,E=vt(U,t,i)*d%i;return{pow_p_5_8:vt(E,Mi,i)*e%i,b2:f}}function Mc(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Ni=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Nc(e,t){let r=to,n=J(t*t*t,r),o=J(n*n*t,r),i=kc(e*o).pow_p_5_8,s=J(e*n*i,r),f=J(t*s*s,r),c=s,u=J(s*Ni,r),d=f===e,l=f===J(-e,r),y=f===J(-e*Ni,r);return d&&(s=c),(l||y)&&(s=u),pi(s,r)&&(s=J(-s,r)),{isValid:d||l,value:s}}var Pc=Di(Dc,{uvRatio:Nc});function Hc(e){return ki(Pc,vn,Object.assign({adjustScalarBytes:Mc},e))}var Pi=Hc({});var eo=32,De,ro=(De=class extends Ae{constructor(t){if(super(),typeof t=="string"?this.data=q(t):t instanceof Uint8Array?this.data=t:this.data=Uint8Array.from(t),this.data.length!==eo)throw new Error(`Invalid public key input. Expected ${eo} bytes, got ${this.data.length}`)}equals(t){return super.equals(t)}toRawBytes(){return this.data}flag(){return _t.ED25519}async verify(t,r){let n;if(typeof r=="string"){let o=ur(r);if(o.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!Se(this.toRawBytes(),o.publicKey))throw new Error("Signature does not match public key");n=o.signature}else n=r;return Pi.verify(n,t,this.toRawBytes())}},De.SIZE=eo,De);var ge=class extends Error{};ge.prototype.name="InvalidTokenError";function Vc(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function zc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Vc(t)}catch{return atob(t)}}function Hi(e,t){if(typeof e!="string")throw new ge("Invalid token specified: must be a string");t||(t={});let r=t.header===!0?0:1,n=e.split(".")[r];if(typeof n!="string")throw new ge(`Invalid token specified: missing part #${r+1}`);let o;try{o=zc(n)}catch(i){throw new ge(`Invalid token specified: invalid base64 for part #${r+1} (${i.message})`)}try{return JSON.parse(o)}catch(i){throw new ge(`Invalid token specified: invalid json for part #${r+1} (${i.message})`)}}var po=ps(ss()),ba="0xacaa82c63b33b31de03cc8e7d0a288a0abb4a29265c06d3c2a6e05dc6d7740c3",Ir=class extends Jn{constructor(r){super();this.isCredenzaSponsoredTransactions=!1;let n=Hi(r.accessToken);if(!n.iss)throw new Error("Invalid token");this.credenzaApiSuiUrl=n.iss.replace("accounts","sui"),this.credenzaApiSuiUrl.includes("localhost")&&(this.credenzaApiSuiUrl=this.credenzaApiSuiUrl.replace("8081","8083").replace("https","http")),r.sponsoredTransactions&&(this.isCredenzaSponsoredTransactions=!!r.sponsoredTransactions),this.credenzaAccessToken=r.accessToken}async initialize(){let r=await fetch(`${this.credenzaApiSuiUrl}/accounts/address?public_key=true`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.credenzaAccessToken}`}}),n=await r.json();if(!r.ok)throw new Error(`Cannot initialize signer: ${n.message}`);this.credenzaAccountSuiPublicKey=n.public_key}useSponsoredTransactions(r){this.isCredenzaSponsoredTransactions=r}getGasOwner(){return this.isCredenzaSponsoredTransactions?ba:this.toSuiAddress()}async sign(r){let n=await fetch(`${this.credenzaApiSuiUrl}/accounts/sign`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.credenzaAccessToken}`},body:JSON.stringify({method:"sign",param:po.Buffer.from(r).toString("base64")})}),o=await n.json();if(!n.ok)throw new Error(`Cannot sign: ${o.message}`);let i=Xn(o.signature);if(!i.signature)throw new Error("Cannot parse signature");return i.signature}async signTransaction(r){if(!this.isCredenzaSponsoredTransactions)return super.signTransaction(r);let n=await fetch(`${this.credenzaApiSuiUrl}/accounts/sign/sponsored`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.credenzaAccessToken}`},body:JSON.stringify({param:po.Buffer.from(r).toString("base64")})}),o=await n.json();if(!n.ok)throw new Error(`Cannot sign transaction: ${o.message}`);return o}getKeyScheme(){return"ED25519"}getPublicKey(){return new ro(this.credenzaAccountSuiPublicKey)}},Ea=async e=>{let t=new Ir(e);return await t.initialize(),t};
2
+ "use strict";var cs=Object.create;var He=Object.defineProperty;var as=Object.getOwnPropertyDescriptor;var fs=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,ls=Object.prototype.hasOwnProperty;var yo=e=>{throw TypeError(e)};var ds=(e,t,r)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Tr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hs=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},wo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fs(t))!ls.call(e,o)&&o!==r&&He(e,o,{get:()=>t[o],enumerable:!(n=as(t,o))||n.enumerable});return e};var ps=(e,t,r)=>(r=e!=null?cs(us(e)):{},wo(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),ms=e=>wo(He({},"__esModule",{value:!0}),e);var g=(e,t,r)=>ds(e,typeof t!="symbol"?t+"":t,r),vr=(e,t,r)=>t.has(e)||yo("Cannot "+r);var W=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),Ut=(e,t,r)=>t.has(e)?yo("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xt=(e,t,r,n)=>(vr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ur=(e,t,r)=>(vr(e,t,"access private method"),r);var $i=Tr(Br=>{"use strict";Br.byteLength=jc;Br.toByteArray=Zc;Br.fromByteArray=Kc;var kt=[],Bt=[],$c=typeof Uint8Array<"u"?Uint8Array:Array,no="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ye=0,Vi=no.length;ye<Vi;++ye)kt[ye]=no[ye],Bt[no.charCodeAt(ye)]=ye;var ye,Vi;Bt[45]=62;Bt[95]=63;function zi(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function jc(e){var t=zi(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Fc(e,t,r){return(t+r)*3/4-r}function Zc(e){var t,r=zi(e),n=r[0],o=r[1],i=new $c(Fc(e,n,o)),s=0,f=o>0?n-4:n,c;for(c=0;c<f;c+=4)t=Bt[e.charCodeAt(c)]<<18|Bt[e.charCodeAt(c+1)]<<12|Bt[e.charCodeAt(c+2)]<<6|Bt[e.charCodeAt(c+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=Bt[e.charCodeAt(c)]<<2|Bt[e.charCodeAt(c+1)]>>4,i[s++]=t&255),o===1&&(t=Bt[e.charCodeAt(c)]<<10|Bt[e.charCodeAt(c+1)]<<4|Bt[e.charCodeAt(c+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function Gc(e){return kt[e>>18&63]+kt[e>>12&63]+kt[e>>6&63]+kt[e&63]}function qc(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(Gc(n));return o.join("")}function Kc(e){for(var t,r=e.length,n=r%3,o=[],i=16383,s=0,f=r-n;s<f;s+=i)o.push(qc(e,s,s+i>f?f:s+i));return n===1?(t=e[r-1],o.push(kt[t>>2]+kt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(kt[t>>10]+kt[t>>4&63]+kt[t<<2&63]+"=")),o.join("")}});var ji=Tr(oo=>{oo.read=function(e,t,r,n,o){var i,s,f=o*8-n-1,c=(1<<f)-1,u=c>>1,d=-7,l=r?o-1:0,y=r?-1:1,w=e[t+l];for(l+=y,i=w&(1<<-d)-1,w>>=-d,d+=f;d>0;i=i*256+e[t+l],l+=y,d-=8);for(s=i&(1<<-d)-1,i>>=-d,d+=n;d>0;s=s*256+e[t+l],l+=y,d-=8);if(i===0)i=1-u;else{if(i===c)return s?NaN:(w?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-u}return(w?-1:1)*s*Math.pow(2,i-n)};oo.write=function(e,t,r,n,o,i){var s,f,c,u=i*8-o-1,d=(1<<u)-1,l=d>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,x=n?1:-1,U=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+l>=1?t+=y/c:t+=y*Math.pow(2,1-l),t*c>=2&&(s++,c/=2),s+l>=d?(f=0,s=d):s+l>=1?(f=(t*c-1)*Math.pow(2,o),s=s+l):(f=t*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;e[r+w]=f&255,w+=x,f/=256,o-=8);for(s=s<<o|f,u+=o;u>0;e[r+w]=s&255,w+=x,s/=256,u-=8);e[r+w-x]|=U*128}});var ss=Tr(Pe=>{"use strict";var io=$i(),Me=ji(),Fi=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pe.Buffer=p;Pe.SlowBuffer=ta;Pe.INSPECT_MAX_BYTES=50;var Sr=2147483647;Pe.kMaxLength=Sr;p.TYPED_ARRAY_SUPPORT=Yc();!p.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 Yc(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function jt(e){if(e>Sr)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return fo(e)}return Ki(e,t,r)}p.poolSize=8192;function Ki(e,t,r){if(typeof e=="string")return Xc(e,t);if(ArrayBuffer.isView(e))return Jc(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Mt(e,ArrayBuffer)||e&&Mt(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Mt(e,SharedArrayBuffer)||e&&Mt(e.buffer,SharedArrayBuffer)))return co(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return p.from(n,t,r);let o=Qc(e);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return p.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}p.from=function(e,t,r){return Ki(e,t,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function Yi(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Wc(e,t,r){return Yi(e),e<=0?jt(e):t!==void 0?typeof r=="string"?jt(e).fill(t,r):jt(e).fill(t):jt(e)}p.alloc=function(e,t,r){return Wc(e,t,r)};function fo(e){return Yi(e),jt(e<0?0:uo(e)|0)}p.allocUnsafe=function(e){return fo(e)};p.allocUnsafeSlow=function(e){return fo(e)};function Xc(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=Wi(e,t)|0,n=jt(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}function so(e){let t=e.length<0?0:uo(e.length)|0,r=jt(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function Jc(e){if(Mt(e,Uint8Array)){let t=new Uint8Array(e);return co(t.buffer,t.byteOffset,t.byteLength)}return so(e)}function co(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,p.prototype),n}function Qc(e){if(p.isBuffer(e)){let t=uo(e.length)|0,r=jt(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||ho(e.length)?jt(0):so(e);if(e.type==="Buffer"&&Array.isArray(e.data))return so(e.data)}function uo(e){if(e>=Sr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Sr.toString(16)+" bytes");return e|0}function ta(e){return+e!=e&&(e=0),p.alloc(+e)}p.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==p.prototype};p.compare=function(t,r){if(Mt(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),Mt(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(t)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,o=r.length;for(let i=0,s=Math.min(n,o);i<s;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return n<o?-1:o<n?1:0};p.isEncoding=function(t){switch(String(t).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}};p.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let o=p.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){let s=t[n];if(Mt(s,Uint8Array))i+s.length>o.length?(p.isBuffer(s)||(s=p.from(s)),s.copy(o,i)):Uint8Array.prototype.set.call(o,s,i);else if(p.isBuffer(s))s.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=s.length}return o};function Wi(e,t){if(p.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Mt(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ao(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return is(e).length;default:if(o)return n?-1:ao(e).length;t=(""+t).toLowerCase(),o=!0}}p.byteLength=Wi;function ea(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return la(this,t,r);case"utf8":case"utf-8":return Ji(this,t,r);case"ascii":return fa(this,t,r);case"latin1":case"binary":return ua(this,t,r);case"base64":return ca(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return da(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function we(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}p.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)we(this,r,r+1);return this};p.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)we(this,r,r+3),we(this,r+1,r+2);return this};p.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)we(this,r,r+7),we(this,r+1,r+6),we(this,r+2,r+5),we(this,r+3,r+4);return this};p.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Ji(this,0,t):ea.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(t){if(!p.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:p.compare(this,t)===0};p.prototype.inspect=function(){let t="",r=Pe.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Fi&&(p.prototype[Fi]=p.prototype.inspect);p.prototype.compare=function(t,r,n,o,i){if(Mt(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===t)return 0;let s=i-o,f=n-r,c=Math.min(s,f),u=this.slice(o,i),d=t.slice(r,n);for(let l=0;l<c;++l)if(u[l]!==d[l]){s=u[l],f=d[l];break}return s<f?-1:f<s?1:0};function Xi(e,t,r,n,o){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ho(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof t=="string"&&(t=p.from(t,n)),p.isBuffer(t))return t.length===0?-1:Zi(e,t,r,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Zi(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Zi(e,t,r,n,o){let i=1,s=e.length,f=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;i=2,s/=2,f/=2,r/=2}function c(d,l){return i===1?d[l]:d.readUInt16BE(l*i)}let u;if(o){let d=-1;for(u=r;u<s;u++)if(c(e,u)===c(t,d===-1?0:u-d)){if(d===-1&&(d=u),u-d+1===f)return d*i}else d!==-1&&(u-=u-d),d=-1}else for(r+f>s&&(r=s-f),u=r;u>=0;u--){let d=!0;for(let l=0;l<f;l++)if(c(e,u+l)!==c(t,l)){d=!1;break}if(d)return u}return-1}p.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};p.prototype.indexOf=function(t,r,n){return Xi(this,t,r,n,!0)};p.prototype.lastIndexOf=function(t,r,n){return Xi(this,t,r,n,!1)};function ra(e,t,r,n){r=Number(r)||0;let o=e.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let i=t.length;n>i/2&&(n=i/2);let s;for(s=0;s<n;++s){let f=parseInt(t.substr(s*2,2),16);if(ho(f))return s;e[r+s]=f}return s}function na(e,t,r,n){return Ar(ao(t,e.length-r),e,r,n)}function oa(e,t,r,n){return Ar(ga(t),e,r,n)}function ia(e,t,r,n){return Ar(is(t),e,r,n)}function sa(e,t,r,n){return Ar(ya(t,e.length-r),e,r,n)}p.prototype.write=function(t,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let s=!1;for(;;)switch(o){case"hex":return ra(this,t,r,n);case"utf8":case"utf-8":return na(this,t,r,n);case"ascii":case"latin1":case"binary":return oa(this,t,r,n);case"base64":return ia(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sa(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),s=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ca(e,t,r){return t===0&&r===e.length?io.fromByteArray(e):io.fromByteArray(e.slice(t,r))}function Ji(e,t,r){r=Math.min(e.length,r);let n=[],o=t;for(;o<r;){let i=e[o],s=null,f=i>239?4:i>223?3:i>191?2:1;if(o+f<=r){let c,u,d,l;switch(f){case 1:i<128&&(s=i);break;case 2:c=e[o+1],(c&192)===128&&(l=(i&31)<<6|c&63,l>127&&(s=l));break;case 3:c=e[o+1],u=e[o+2],(c&192)===128&&(u&192)===128&&(l=(i&15)<<12|(c&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:c=e[o+1],u=e[o+2],d=e[o+3],(c&192)===128&&(u&192)===128&&(d&192)===128&&(l=(i&15)<<18|(c&63)<<12|(u&63)<<6|d&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),o+=f}return aa(n)}var Gi=4096;function aa(e){let t=e.length;if(t<=Gi)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Gi));return r}function fa(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]&127);return n}function ua(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function la(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let i=t;i<r;++i)o+=wa[e[i]];return o}function da(e,t,r){let n=e.slice(t,r),o="";for(let i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}p.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let o=this.subarray(t,r);return Object.setPrototypeOf(o,p.prototype),o};function nt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=this[t],i=1,s=0;for(;++s<r&&(i*=256);)o+=this[t+s]*i;return o};p.prototype.readUintBE=p.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=this[t+--r],i=1;for(;r>0&&(i*=256);)o+=this[t+--r]*i;return o};p.prototype.readUint8=p.prototype.readUInt8=function(t,r){return t=t>>>0,r||nt(t,1,this.length),this[t]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||nt(t,2,this.length),this[t]|this[t+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||nt(t,2,this.length),this[t]<<8|this[t+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};p.prototype.readBigUInt64LE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,i=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(i)<<BigInt(32))});p.prototype.readBigUInt64BE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],i=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(i)});p.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=this[t],i=1,s=0;for(;++s<r&&(i*=256);)o+=this[t+s]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};p.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||nt(t,r,this.length);let o=r,i=1,s=this[t+--o];for(;o>0&&(i*=256);)s+=this[t+--o]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*r)),s};p.prototype.readInt8=function(t,r){return t=t>>>0,r||nt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};p.prototype.readInt16LE=function(t,r){t=t>>>0,r||nt(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(t,r){t=t>>>0,r||nt(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};p.prototype.readInt32BE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};p.prototype.readBigInt64LE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});p.prototype.readBigInt64BE=re(function(t){t=t>>>0,Ne(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Qe(t,this.length-8);let o=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});p.prototype.readFloatLE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),Me.read(this,t,!0,23,4)};p.prototype.readFloatBE=function(t,r){return t=t>>>0,r||nt(t,4,this.length),Me.read(this,t,!1,23,4)};p.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||nt(t,8,this.length),Me.read(this,t,!0,52,8)};p.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||nt(t,8,this.length),Me.read(this,t,!1,52,8)};function ht(e,t,r,n,o,i){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(t,r,n,o){if(t=+t,r=r>>>0,n=n>>>0,!o){let f=Math.pow(2,8*n)-1;ht(this,t,r,n,f,0)}let i=1,s=0;for(this[r]=t&255;++s<n&&(i*=256);)this[r+s]=t/i&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(t,r,n,o){if(t=+t,r=r>>>0,n=n>>>0,!o){let f=Math.pow(2,8*n)-1;ht(this,t,r,n,f,0)}let i=n-1,s=1;for(this[r+i]=t&255;--i>=0&&(s*=256);)this[r+i]=t/s&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,1,255,0),this[r]=t&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function Qi(e,t,r,n,o){os(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function ts(e,t,r,n,o){os(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i=i>>8,e[r+6]=i,i=i>>8,e[r+5]=i,i=i>>8,e[r+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}p.prototype.writeBigUInt64LE=re(function(t,r=0){return Qi(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=re(function(t,r=0){return ts(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(t,r,n,o){if(t=+t,r=r>>>0,!o){let c=Math.pow(2,8*n-1);ht(this,t,r,n,c-1,-c)}let i=0,s=1,f=0;for(this[r]=t&255;++i<n&&(s*=256);)t<0&&f===0&&this[r+i-1]!==0&&(f=1),this[r+i]=(t/s>>0)-f&255;return r+n};p.prototype.writeIntBE=function(t,r,n,o){if(t=+t,r=r>>>0,!o){let c=Math.pow(2,8*n-1);ht(this,t,r,n,c-1,-c)}let i=n-1,s=1,f=0;for(this[r+i]=t&255;--i>=0&&(s*=256);)t<0&&f===0&&this[r+i+1]!==0&&(f=1),this[r+i]=(t/s>>0)-f&255;return r+n};p.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};p.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};p.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};p.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};p.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||ht(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};p.prototype.writeBigInt64LE=re(function(t,r=0){return Qi(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=re(function(t,r=0){return ts(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function es(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function rs(e,t,r,n,o){return t=+t,r=r>>>0,o||es(e,t,r,4,34028234663852886e22,-34028234663852886e22),Me.write(e,t,r,n,23,4),r+4}p.prototype.writeFloatLE=function(t,r,n){return rs(this,t,r,!0,n)};p.prototype.writeFloatBE=function(t,r,n){return rs(this,t,r,!1,n)};function ns(e,t,r,n,o){return t=+t,r=r>>>0,o||es(e,t,r,8,17976931348623157e292,-17976931348623157e292),Me.write(e,t,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(t,r,n){return ns(this,t,r,!0,n)};p.prototype.writeDoubleBE=function(t,r,n){return ns(this,t,r,!1,n)};p.prototype.copy=function(t,r,n,o){if(!p.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<n&&(o=n),o===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-n&&(o=t.length-r+n);let i=o-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(t,this.subarray(n,o),r),i};p.prototype.fill=function(t,r,n,o){if(typeof t=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!p.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(t.length===1){let s=t.charCodeAt(0);(o==="utf8"&&s<128||o==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let i;if(typeof t=="number")for(i=r;i<n;++i)this[i]=t;else{let s=p.isBuffer(t)?t:p.from(t,o),f=s.length;if(f===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=s[i%f]}return this};var ke={};function lo(e,t,r){ke[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}lo("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);lo("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);lo("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=qi(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=qi(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function qi(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function ha(e,t,r){Ne(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Qe(t,e.length-(r+1))}function os(e,t,r,n,o,i){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",f;throw i>3?t===0||t===BigInt(0)?f=`>= 0${s} and < 2${s} ** ${(i+1)*8}${s}`:f=`>= -(2${s} ** ${(i+1)*8-1}${s}) and < 2 ** ${(i+1)*8-1}${s}`:f=`>= ${t}${s} and <= ${r}${s}`,new ke.ERR_OUT_OF_RANGE("value",f,e)}ha(n,o,i)}function Ne(e,t){if(typeof e!="number")throw new ke.ERR_INVALID_ARG_TYPE(t,"number",e)}function Qe(e,t,r){throw Math.floor(e)!==e?(Ne(e,r),new ke.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new ke.ERR_BUFFER_OUT_OF_BOUNDS:new ke.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var pa=/[^+/0-9A-Za-z-_]/g;function ma(e){if(e=e.split("=")[0],e=e.trim().replace(pa,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ao(e,t){t=t||1/0;let r,n=e.length,o=null,i=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function ga(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function ya(e,t){let r,n,o,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function is(e){return io.toByteArray(ma(e))}function Ar(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function Mt(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ho(e){return e!==e}var wa=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t})();function re(e){return typeof BigInt>"u"?xa:e}function xa(){throw new Error("BigInt not supported")}});var Ba={};hs(Ba,{CredenzaSuiSigner:()=>Ir,getCredenzaSuiSigner:()=>Ea});module.exports=ms(Ba);function ne(e){let t=BigInt(e),r=[],n=0;if(t===0n)return[0];for(;t>0;)r[n]=Number(t&127n),t>>=7n,t>0n&&(r[n]|=128),n+=1;return r}function xo(e){let t=0n,r=0n,n=0;for(;;){if(n>=e.length)throw new Error("ULEB decode error: buffer overflow");let o=e[n];if(n+=1,t+=BigInt(o&127)<<r,(o&128)===0)break;r+=7n}if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("ULEB decode error: value exceeds MAX_SAFE_INTEGER");return{value:Number(t),length:n}}var bo=class{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),t=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+t).toString(10)}read128(){let e=BigInt(this.read64()),t=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+t).toString(10)}read256(){let e=BigInt(this.read128()),t=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+t).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,{value:t,length:r}=xo(new Uint8Array(this.dataView.buffer,e));return this.shift(r),t}readVec(e){let t=this.readULEB(),r=[];for(let n=0;n<t;n++)r.push(e(this,n,t));return r}};function gs(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Bo(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(r=>typeof r=="string"):t.every(r=>Number.isSafeInteger(r)):!1}function Or(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function So(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Rr(e){if(!Array.isArray(e))throw new Error("array expected")}function Ao(e,t){if(!Bo(!0,t))throw new Error(`${e}: array of strings expected`)}function ys(e,t){if(!Bo(!1,t))throw new Error(`${e}: array of numbers expected`)}function ws(...e){let t=i=>i,r=(i,s)=>f=>i(s(f)),n=e.map(i=>i.encode).reduceRight(r,t),o=e.map(i=>i.decode).reduce(r,t);return{encode:n,decode:o}}function xs(e){let t=typeof e=="string"?e.split(""):e,r=t.length;Ao("alphabet",t);let n=new Map(t.map((o,i)=>[o,i]));return{encode:o=>(Rr(o),o.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:o=>(Rr(o),o.map(i=>{Or("alphabet.decode",i);let s=n.get(i);if(s===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return s}))}}function bs(e=""){return Or("join",e),{encode:t=>(Ao("join.decode",t),t.join(e)),decode:t=>(Or("join.decode",t),t.split(e))}}function Eo(e,t,r){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(Rr(e),!e.length)return[];let n=0,o=[],i=Array.from(e,f=>{if(So(f),f<0||f>=t)throw new Error(`invalid integer: ${f}`);return f}),s=i.length;for(;;){let f=0,c=!0;for(let u=n;u<s;u++){let d=i[u],l=t*f,y=l+d;if(!Number.isSafeInteger(y)||l/t!==f||y-d!==l)throw new Error("convertRadix: carry overflow");let w=y/r;f=y%r;let x=Math.floor(w);if(i[u]=x,!Number.isSafeInteger(x)||x*r+f!==y)throw new Error("convertRadix: carry overflow");if(c)x?c=!1:n=u;else continue}if(o.push(f),c)break}for(let f=0;f<e.length-1&&e[f]===0;f++)o.push(0);return o.reverse()}function Es(e){So(e);let t=2**8;return{encode:r=>{if(!gs(r))throw new Error("radix.encode input should be Uint8Array");return Eo(Array.from(r),t,e)},decode:r=>(ys("radix.decode",r),Uint8Array.from(Eo(r,e,t)))}}var Bs=e=>ws(Es(58),xs(e),bs("")),_r=Bs("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Ft=e=>_r.encode(e),Zt=e=>_r.decode(e);function q(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}var Lr=8192;function G(e){if(e.length<Lr)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=Lr){let n=e.slice(r,r+Lr);t+=String.fromCharCode(...n)}return btoa(t)}function oe(e){let t=e.startsWith("0x")?e.slice(2):e,r=t.length%2===0?t:`0${t}`,n=r.match(/[0-9a-fA-F]{2}/g)?.map(o=>parseInt(o,16))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function St(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}function Cr(e,t){switch(t){case"base58":return Ft(e);case"base64":return G(e);case"hex":return St(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Dr(e,t=["<",">"]){let[r,n]=t,o=[],i="",s=0;for(let f=0;f<e.length;f++){let c=e[f];if(c===r&&s++,c===n&&s--,s===0&&c===","){o.push(i.trim()),i="";continue}i+=c}return o.push(i.trim()),o}var Io=class{constructor({initialSize:e=1024,maxSize:t=1/0,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){let t=this.bytePosition+e;if(t>this.size){let r=Math.min(this.maxSize,Math.max(this.size+t,this.size+this.allocateSize));if(t>r)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=r;let n=new ArrayBuffer(this.size);new Uint8Array(n).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(n)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}writeBytes(e){this.ensureSizeOrGrow(e.length);for(let t=0;t<e.length;t++)this.dataView.setUint8(this.bytePosition+t,e[t]);return this.shift(e.length)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return kr(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return kr(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return kr(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return ne(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((r,n)=>t(this,r,n,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return Cr(this.toBytes(),e)}};function kr(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var ie,xe,be,mt=(be=class{constructor(t){Ut(this,ie);Ut(this,xe);this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),xt(this,ie,t.write),xt(this,xe,t.serialize??((r,n)=>{let o=new Io({initialSize:this.serializedSize(r)??void 0,...n});return W(this,ie).call(this,r,o),o.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),W(this,ie).call(this,t,r)}serialize(t,r){return this.validate(t),new As(this,W(this,xe).call(this,t,r))}parse(t){let r=new bo(t);return this.read(r)}fromHex(t){return this.parse(oe(t))}fromBase58(t){return this.parse(Zt(t))}fromBase64(t){return this.parse(q(t))}transform({name:t,input:r,output:n,validate:o}){return new be({name:t??this.name,read:i=>n?n(this.read(i)):this.read(i),write:(i,s)=>W(this,ie).call(this,r?r(i):i,s),serializedSize:i=>this.serializedSize(r?r(i):i),serialize:(i,s)=>W(this,xe).call(this,r?r(i):i,s),validate:i=>{o?.(i),this.validate(r?r(i):i)}})}},ie=new WeakMap,xe=new WeakMap,be),Ss=Symbol.for("@mysten/serialized-bcs");var Ve,Nt,To,As=(To=class{constructor(e,t){Ut(this,Ve);Ut(this,Nt);xt(this,Ve,e),xt(this,Nt,t)}get[Ss](){return!0}toBytes(){return W(this,Nt)}toHex(){return St(W(this,Nt))}toBase64(){return G(W(this,Nt))}toBase58(){return Ft(W(this,Nt))}parse(){return W(this,Ve).parse(W(this,Nt))}},Ve=new WeakMap,Nt=new WeakMap,To);function ze({size:e,...t}){return new mt({...t,serializedSize:()=>e})}function tr({readMethod:e,writeMethod:t,...r}){return ze({...r,read:n=>n[e](),write:(n,o)=>o[t](n),validate:n=>{if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);r.validate?.(n)}})}function er({readMethod:e,writeMethod:t,...r}){return ze({...r,read:n=>n[e](),write:(n,o)=>o[t](BigInt(n)),validate:n=>{let o=BigInt(n);if(o<0||o>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${o}. Expected value in range 0-${r.maxValue}`);r.validate?.(o)}})}function vo({serialize:e,...t}){let r=new mt({...t,serialize:e,write:(n,o)=>{for(let i of r.serialize(n).toBytes())o.write8(i)}});return r}function Uo({toBytes:e,fromBytes:t,...r}){return new mt({...r,read:n=>{let o=n.readULEB();return t(n.readBytes(o))},write:(n,o)=>{let i=e(n);o.writeULEB(i.length);for(let s=0;s<i.length;s++)o.write8(i[s])},serialize:n=>{let o=e(n),i=ne(o.length),s=new Uint8Array(i.length+o.length);return s.set(i,0),s.set(o,i.length),s},validate:n=>{if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);r.validate?.(n)}})}function Oo(e){let t=null;function r(){return t||(t=e()),t}return new mt({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,o)=>r().write(n,o),serialize:(n,o)=>r().serialize(n,o).toBytes()})}var Mr=class extends mt{constructor({name:e,fields:t,...r}){let n=Object.entries(t);super({name:e,serializedSize:o=>{let i=0;for(let[s,f]of n){let c=f.serializedSize(o[s]);if(c==null)return null;i+=c}return i},read:o=>{let i={};for(let[s,f]of n)i[s]=f.read(o);return i},write:(o,i)=>{for(let[s,f]of n)f.write(o[s],i)},...r,validate:o=>{if(r?.validate?.(o),typeof o!="object"||o==null)throw new TypeError(`Expected object, found ${typeof o}`)}})}},Nr=class extends mt{constructor({fields:e,...t}){let r=Object.entries(e);super({read:n=>{let o=n.readULEB(),i=r[o];if(!i)throw new TypeError(`Unknown value ${o} for enum ${t.name}`);let[s,f]=i;return{[s]:f?.read(n)??!0,$kind:s}},write:(n,o)=>{let[i,s]=Object.entries(n).filter(([f])=>Object.hasOwn(e,f))[0];for(let f=0;f<r.length;f++){let[c,u]=r[f];if(c===i){o.writeULEB(f),u?.write(s,o);return}}},...t,validate:n=>{if(t?.validate?.(n),typeof n!="object"||n==null)throw new TypeError(`Expected object, found ${typeof n}`);let o=Object.keys(n).filter(s=>n[s]!==void 0&&Object.hasOwn(e,s));if(o.length!==1)throw new TypeError(`Expected object with one key, but found ${o.length} for type ${t.name}}`);let[i]=o;if(!Object.hasOwn(e,i))throw new TypeError(`Invalid enum variant ${i}`)}})}},Pr=class extends mt{constructor({fields:e,name:t,...r}){super({name:t??`(${e.map(n=>n.name).join(", ")})`,serializedSize:n=>{let o=0;for(let i=0;i<e.length;i++){let s=e[i].serializedSize(n[i]);if(s==null)return null;o+=s}return o},read:n=>{let o=[];for(let i of e)o.push(i.read(n));return o},write:(n,o)=>{for(let i=0;i<e.length;i++)e[i].write(n[i],o)},...r,validate:n=>{if(r?.validate?.(n),!Array.isArray(n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${n.length}`)}})}};function Is(e,t,r){return new mt({read:n=>{let o=new Array(e);for(let i=0;i<e;i++)o[i]=t.read(n);return o},write:(n,o)=>{for(let i of n)t.write(i,o)},...r,name:r?.name??`${t.name}[${e}]`,validate:n=>{if(r?.validate?.(n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})}function Ts(e){return a.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>t.$kind==="Some"?t.Some:null})}function vs(e,t){return new mt({read:r=>{let n=r.readULEB(),o=new Array(n);for(let i=0;i<n;i++)o[i]=e.read(r);return o},write:(r,n)=>{n.writeULEB(r.length);for(let o of r)e.write(o,n)},...t,name:t?.name??`vector<${e.name}>`,validate:r=>{if(t?.validate?.(r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})}function Hr(e,t){for(let r=0;r<Math.min(e.length,t.length);r++)if(e[r]!==t[r])return e[r]-t[r];return e.length-t.length}function Us(e,t){return new mt({name:`Map<${e.name}, ${t.name}>`,read:r=>{let n=r.readULEB(),o=new Map;for(let i=0;i<n;i++)o.set(e.read(r),t.read(r));return o},write:(r,n)=>{let o=[...r.entries()].map(([i,s])=>[e.serialize(i).toBytes(),s]);o.sort(([i],[s])=>Hr(i,s)),n.writeULEB(o.length);for(let[i,s]of o)n.writeBytes(i),t.write(s,n)}})}var a={u8(e){return tr({readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e,name:e?.name??"u8"})},u16(e){return tr({readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e,name:e?.name??"u16"})},u32(e){return tr({readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e,name:e?.name??"u32"})},u64(e){return er({readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e,name:e?.name??"u64"})},u128(e){return er({readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e,name:e?.name??"u128"})},u256(e){return er({readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e,name:e?.name??"u256"})},bool(e){return ze({size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,name:e?.name??"bool",validate:t=>{if(e?.validate?.(t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return vo({read:t=>t.readULEB(),serialize:t=>Uint8Array.from(ne(t)),...e,name:e?.name??"uleb128"})},bytes(e,t){return ze({size:e,read:r=>r.readBytes(e),write:(r,n)=>{n.writeBytes(new Uint8Array(r))},...t,name:t?.name??`bytes[${e}]`,validate:r=>{if(t?.validate?.(r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},byteVector(e){return new mt({read:t=>{let r=t.readULEB();return t.readBytes(r)},write:(t,r)=>{let n=new Uint8Array(t);r.writeULEB(n.length),r.writeBytes(n)},...e,name:e?.name??"vector<u8>",serializedSize:t=>{let r="length"in t?t.length:null;return r==null?null:ne(r).length+r},validate:t=>{if(e?.validate?.(t),!t||typeof t!="object"||!("length"in t))throw new TypeError(`Expected array, found ${typeof t}`)}})},string(e){return Uo({toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e,name:e?.name??"string"})},fixedArray:Is,option:Ts,vector:vs,tuple(e,t){return new Pr({fields:e,...t})},struct(e,t,r){return new Mr({name:e,fields:t,...r})},enum(e,t,r){return new Nr({name:e,fields:t,...r})},map:Us,lazy(e){return Oo(e)}};var Gt=32;function Ro(e){return Os(e)&&Rs(e)===Gt}function Ot(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Gt*2,"0")}`}function Os(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function Rs(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var _s=/^vector<(.+)>$/,Ls=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/,Vr=class Ee{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};let n=t.match(_s);if(n)return{vector:Ee.parseFromStr(n[1],r)};let o=t.match(Ls);if(o)return{struct:{address:r?Ot(o[1]):o[1],module:o[2],name:o[3],typeParams:o[5]===void 0?[]:Ee.parseStructTypeArgs(o[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Dr(t).map(n=>Ee.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Ee.tagToString(t.vector)}>`;if("struct"in t){let r=t.struct,n=r.typeParams.map(Ee.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function Cs(e){return a.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function Ds(e){return a.enum("Option",{None:null,Some:e})}var F=a.bytes(Gt).transform({validate:e=>{let t=typeof e=="string"?e:St(e);if(!t||!Ro(Ot(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?oe(Ot(e)):e,output:e=>Ot(St(e))}),st=a.byteVector().transform({name:"ObjectDigest",input:e=>Zt(e),output:e=>Ft(new Uint8Array(e)),validate:e=>{if(Zt(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),ut=a.struct("SuiObjectRef",{objectId:F,version:a.u64(),digest:st}),zr=a.struct("SharedObjectRef",{objectId:F,initialSharedVersion:a.u64(),mutable:a.bool()}),$r=a.enum("ObjectArg",{ImmOrOwnedObject:ut,SharedObject:zr,Receiving:ut}),Rt=a.enum("Owner",{AddressOwner:F,ObjectOwner:F,Shared:a.struct("Shared",{initialSharedVersion:a.u64()}),Immutable:null,ConsensusAddressOwner:a.struct("ConsensusAddressOwner",{startVersion:a.u64(),owner:F})}),ks=a.enum("Reservation",{MaxAmountU64:a.u64()}),Ms=a.enum("WithdrawalType",{Balance:a.lazy(()=>qt)}),Ns=a.enum("WithdrawFrom",{Sender:null,Sponsor:null}),Ps=a.struct("FundsWithdrawal",{reservation:ks,typeArg:Ms,withdrawFrom:Ns}),jr=a.enum("CallArg",{Pure:a.struct("Pure",{bytes:a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))})}),Object:$r,FundsWithdrawal:Ps}),Fr=a.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:a.lazy(()=>Fr),struct:a.lazy(()=>rr),u16:null,u32:null,u256:null}),qt=Fr.transform({input:e=>typeof e=="string"?Vr.parseFromStr(e,!0):e,output:e=>Vr.tagToString(e)}),At=a.enum("Argument",{GasCoin:null,Input:a.u16(),Result:a.u16(),NestedResult:a.tuple([a.u16(),a.u16()])}),Zr=a.struct("ProgrammableMoveCall",{package:F,module:a.string(),function:a.string(),typeArguments:a.vector(qt),arguments:a.vector(At)}),Gr=a.enum("Command",{MoveCall:Zr,TransferObjects:a.struct("TransferObjects",{objects:a.vector(At),address:At}),SplitCoins:a.struct("SplitCoins",{coin:At,amounts:a.vector(At)}),MergeCoins:a.struct("MergeCoins",{destination:At,sources:a.vector(At)}),Publish:a.struct("Publish",{modules:a.vector(a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))})),dependencies:a.vector(F)}),MakeMoveVec:a.struct("MakeMoveVec",{type:Ds(qt).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:a.vector(At)}),Upgrade:a.struct("Upgrade",{modules:a.vector(a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))})),dependencies:a.vector(F),package:F,ticket:At})}),qr=a.struct("ProgrammableTransaction",{inputs:a.vector(jr),commands:a.vector(Gr)}),Kr=a.enum("TransactionKind",{ProgrammableTransaction:qr,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Hs=a.struct("ValidDuring",{minEpoch:a.option(a.u64()),maxEpoch:a.option(a.u64()),minTimestamp:a.option(a.u64()),maxTimestamp:a.option(a.u64()),chain:st,nonce:a.u32()}),Yr=a.enum("TransactionExpiration",{None:null,Epoch:Cs(),ValidDuring:Hs}),rr=a.struct("StructTag",{address:F,module:a.string(),name:a.string(),typeParams:a.vector(Fr)}),Wr=a.struct("GasData",{payment:a.vector(ut),owner:F,price:a.u64(),budget:a.u64()}),Xr=a.struct("TransactionDataV1",{kind:Kr,sender:F,gasData:Wr,expiration:Yr}),Jr=a.enum("TransactionData",{V1:Xr}),Qr=a.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),tn=a.enum("IntentVersion",{V0:null}),en=a.enum("AppId",{Sui:null}),rn=a.struct("Intent",{scope:Qr,version:tn,appId:en});function nn(e){return a.struct(`IntentMessage<${e.name}>`,{intent:rn,value:e})}var on=a.enum("CompressedSignature",{ED25519:a.bytes(64),Secp256k1:a.bytes(64),Secp256r1:a.bytes(64),ZkLogin:a.byteVector(),Passkey:a.byteVector()}),sn=a.enum("PublicKey",{ED25519:a.bytes(32),Secp256k1:a.bytes(33),Secp256r1:a.bytes(33),ZkLogin:a.byteVector(),Passkey:a.bytes(33)}),cn=a.struct("MultiSigPkMap",{pubKey:sn,weight:a.u8()}),an=a.struct("MultiSigPublicKey",{pk_map:a.vector(cn),threshold:a.u16()}),_o=a.struct("MultiSig",{sigs:a.vector(on),bitmap:a.u16(),multisig_pk:an}),Vs=a.byteVector().transform({input:e=>typeof e=="string"?q(e):e,output:e=>G(new Uint8Array(e))}),fn=a.struct("SenderSignedTransaction",{intentMessage:nn(Jr),txSignatures:a.vector(Vs)}),Lo=a.vector(fn,{name:"SenderSignedData"}),nr=a.struct("PasskeyAuthenticator",{authenticatorData:a.byteVector(),clientDataJson:a.string(),userSignature:a.byteVector()}),un=a.enum("MoveObjectType",{Other:rr,GasCoin:null,StakedSui:null,Coin:qt,AccumulatorBalanceWrapper:null}),ln=a.struct("TypeOrigin",{moduleName:a.string(),datatypeName:a.string(),package:F}),dn=a.struct("UpgradeInfo",{upgradedId:F,upgradedVersion:a.u64()}),hn=a.struct("MovePackage",{id:F,version:a.u64(),moduleMap:a.map(a.string(),a.byteVector()),typeOriginTable:a.vector(ln),linkageTable:a.map(F,dn)}),pn=a.struct("MoveObject",{type:un,hasPublicTransfer:a.bool(),version:a.u64(),contents:a.byteVector()}),mn=a.enum("Data",{Move:pn,Package:hn}),Co=a.struct("ObjectInner",{data:mn,owner:Rt,previousTransaction:st,storageRebate:a.u64()});var zs=a.enum("PackageUpgradeError",{UnableToFetchPackage:a.struct("UnableToFetchPackage",{packageId:F}),NotAPackage:a.struct("NotAPackage",{objectId:F}),IncompatibleUpgrade:null,DigestDoesNotMatch:a.struct("DigestDoesNotMatch",{digest:a.byteVector()}),UnknownUpgradePolicy:a.struct("UnknownUpgradePolicy",{policy:a.u8()}),PackageIDDoesNotMatch:a.struct("PackageIDDoesNotMatch",{packageId:F,ticketId:F})}),$s=a.struct("ModuleId",{address:F,name:a.string()}),Do=a.struct("MoveLocation",{module:$s,function:a.u16(),instruction:a.u16(),functionName:a.option(a.string())}),js=a.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:a.struct("IndexOutOfBounds",{idx:a.u16()}),SecondaryIndexOutOfBounds:a.struct("SecondaryIndexOutOfBounds",{resultIdx:a.u16(),secondaryIdx:a.u16()}),InvalidResultArity:a.struct("InvalidResultArity",{resultIdx:a.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null,InvalidArgumentArity:null,InvalidTransferObject:null,InvalidMakeMoveVecNonObjectArgument:null,ArgumentWithoutValue:null,CannotMoveBorrowedValue:null,CannotWriteToExtendedReference:null,InvalidReferenceArgument:null}),Fs=a.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),Zs=a.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:a.struct("MoveObjectTooBig",{objectSize:a.u64(),maxObjectSize:a.u64()}),MovePackageTooBig:a.struct("MovePackageTooBig",{objectSize:a.u64(),maxObjectSize:a.u64()}),CircularObjectOwnership:a.struct("CircularObjectOwnership",{object:F}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:a.option(Do),MoveAbort:a.tuple([Do,a.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:a.struct("CommandArgumentError",{argIdx:a.u16(),kind:js}),TypeArgumentError:a.struct("TypeArgumentError",{argumentIdx:a.u16(),kind:Fs}),UnusedValueWithoutDrop:a.struct("UnusedValueWithoutDrop",{resultIdx:a.u16(),secondaryIdx:a.u16()}),InvalidPublicFunctionReturnType:a.struct("InvalidPublicFunctionReturnType",{idx:a.u16()}),InvalidTransferObject:null,EffectsTooLarge:a.struct("EffectsTooLarge",{currentSize:a.u64(),maxSize:a.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:a.struct("PackageUpgradeError",{upgradeError:zs}),WrittenObjectsTooLarge:a.struct("WrittenObjectsTooLarge",{currentSize:a.u64(),maxSize:a.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:a.struct("ExecutionCancelledDueToSharedObjectCongestion",{congested_objects:a.vector(F)}),AddressDeniedForCoin:a.struct("AddressDeniedForCoin",{address:F,coinType:a.string()}),CoinTypeGlobalPause:a.struct("CoinTypeGlobalPause",{coinType:a.string()}),ExecutionCancelledDueToRandomnessUnavailable:null,MoveVectorElemTooBig:a.struct("MoveVectorElemTooBig",{valueSize:a.u64(),maxScaledSize:a.u64()}),MoveRawValueTooBig:a.struct("MoveRawValueTooBig",{valueSize:a.u64(),maxScaledSize:a.u64()}),InvalidLinkage:null,InsufficientBalanceForWithdraw:null,NonExclusiveWriteInputObjectModified:a.struct("NonExclusiveWriteInputObjectModified",{id:F})}),ko=a.enum("ExecutionStatus",{Success:null,Failure:a.struct("Failure",{error:Zs,command:a.option(a.u64())})}),Mo=a.struct("GasCostSummary",{computationCost:a.u64(),storageCost:a.u64(),storageRebate:a.u64(),nonRefundableStorageFee:a.u64()}),Gs=a.struct("TransactionEffectsV1",{status:ko,executedEpoch:a.u64(),gasUsed:Mo,modifiedAtVersions:a.vector(a.tuple([F,a.u64()])),sharedObjects:a.vector(ut),transactionDigest:st,created:a.vector(a.tuple([ut,Rt])),mutated:a.vector(a.tuple([ut,Rt])),unwrapped:a.vector(a.tuple([ut,Rt])),deleted:a.vector(ut),unwrappedThenDeleted:a.vector(ut),wrapped:a.vector(ut),gasObject:a.tuple([ut,Rt]),eventsDigest:a.option(st),dependencies:a.vector(st)}),gn=a.tuple([a.u64(),st]),qs=a.enum("ObjectIn",{NotExist:null,Exist:a.tuple([gn,Rt])}),Ks=a.struct("AccumulatorAddress",{address:F,ty:qt}),Ys=a.enum("AccumulatorOperation",{Merge:null,Split:null}),Ws=a.enum("AccumulatorValue",{Integer:a.u64(),IntegerTuple:a.tuple([a.u64(),a.u64()]),EventDigest:a.vector(a.tuple([a.u64(),st]))}),Xs=a.struct("AccumulatorWriteV1",{address:Ks,operation:Ys,value:Ws}),Js=a.enum("ObjectOut",{NotExist:null,ObjectWrite:a.tuple([st,Rt]),PackageWrite:gn,AccumulatorWriteV1:Xs}),Qs=a.enum("IDOperation",{None:null,Created:null,Deleted:null}),tc=a.struct("EffectsObjectChange",{inputState:qs,outputState:Js,idOperation:Qs}),ec=a.enum("UnchangedConsensusKind",{ReadOnlyRoot:gn,MutateConsensusStreamEnded:a.u64(),ReadConsensusStreamEnded:a.u64(),Cancelled:a.u64(),PerEpochConfig:null}),rc=a.struct("TransactionEffectsV2",{status:ko,executedEpoch:a.u64(),gasUsed:Mo,transactionDigest:st,gasObjectIndex:a.option(a.u32()),eventsDigest:a.option(st),dependencies:a.vector(st),lamportVersion:a.u64(),changedObjects:a.vector(a.tuple([F,tc])),unchangedConsensusObjects:a.vector(a.tuple([F,ec])),auxDataDigest:a.option(st)}),No=a.enum("TransactionEffects",{V1:Gs,V2:rc});var se={...a,U8:a.u8(),U16:a.u16(),U32:a.u32(),U64:a.u64(),U128:a.u128(),U256:a.u256(),ULEB128:a.uleb128(),Bool:a.bool(),String:a.string(),Address:F,AppId:en,Argument:At,CallArg:jr,Command:Gr,CompressedSignature:on,Data:mn,GasData:Wr,Intent:rn,IntentMessage:nn,IntentScope:Qr,IntentVersion:tn,MoveObject:pn,MoveObjectType:un,MovePackage:hn,MultiSig:_o,MultiSigPkMap:cn,MultiSigPublicKey:an,Object:Co,ObjectArg:$r,ObjectDigest:st,Owner:Rt,PasskeyAuthenticator:nr,ProgrammableMoveCall:Zr,ProgrammableTransaction:qr,PublicKey:sn,SenderSignedData:Lo,SenderSignedTransaction:fn,SharedObjectRef:zr,StructTag:rr,SuiObjectRef:ut,TransactionData:Jr,TransactionDataV1:Xr,TransactionEffects:No,TransactionExpiration:Yr,TransactionKind:Kr,TypeOrigin:ln,TypeTag:qt,UpgradeInfo:dn};function or(e,t){return se.IntentMessage(se.bytes(t.length)).serialize({intent:{scope:{[e]:!0},version:{V0:!0},appId:{Sui:!0}},value:t}).toBytes()}var _t={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},Po={ED25519:32,Secp256k1:33,Secp256r1:33,Passkey:33},ir={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function ce(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function lt(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new Error(`${r}expected integer >= 0, got ${e}`)}}function P(e,t,r=""){let n=ce(e),o=e?.length,i=t!==void 0;if(!n||i&&o!==t){let s=r&&`"${r}" `,f=i?` of length ${t}`:"",c=n?`length=${o}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+f+", got "+c)}return e}function sr(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");lt(e.outputLen),lt(e.blockLen)}function Ht(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function cr(e,t){P(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function $e(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function gt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ar(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function It(e,t){return e<<32-t|e>>>t}var Vo=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function zo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}var Lt=Vo?e=>e:e=>zo(e);function nc(e){for(let t=0;t<e.length;t++)e[t]=zo(e[t]);return e}var ae=Vo?e=>e:nc,$o=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",oc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function yt(e){if(P(e),$o)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=oc[e[r]];return t}var Pt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ho(e){if(e>=Pt._0&&e<=Pt._9)return e-Pt._0;if(e>=Pt.A&&e<=Pt.F)return e-(Pt.A-10);if(e>=Pt.a&&e<=Pt.f)return e-(Pt.a-10)}function Tt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if($o)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,i=0;o<r;o++,i+=2){let s=Ho(e.charCodeAt(i)),f=Ho(e.charCodeAt(i+1));if(s===void 0||f===void 0){let c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[o]=s*16+f}return n}function dt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];P(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let i=e[n];r.set(i,o),o+=i.length}return r}function je(e,t={}){let r=(o,i)=>e(i).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}function Be(e=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}var yn=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var jo=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);function Fo(e,t,r){return e&t^~e&r}function Zo(e,t,r){return e&t^e&r^t&r}var Fe=class{constructor(t,r,n,o){g(this,"blockLen");g(this,"outputLen");g(this,"padOffset");g(this,"isLE");g(this,"buffer");g(this,"view");g(this,"finished",!1);g(this,"length",0);g(this,"pos",0);g(this,"destroyed",!1);this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ar(this.buffer)}update(t){Ht(this),P(t);let{view:r,buffer:n,blockLen:o}=this,i=t.length;for(let s=0;s<i;){let f=Math.min(o-this.pos,i-s);if(f===o){let c=ar(t);for(;o<=i-s;s+=o)this.process(c,s);continue}n.set(t.subarray(s,s+f),this.pos),this.pos+=f,s+=f,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ht(this),cr(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:i}=this,{pos:s}=this;r[s++]=128,gt(this.buffer.subarray(s)),this.padOffset>o-s&&(this.process(n,0),s=0);for(let l=s;l<o;l++)r[l]=0;n.setBigUint64(o-8,BigInt(this.length*8),i),this.process(n,0);let f=ar(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)f.setUint32(4*l,d[l],i)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:i,destroyed:s,pos:f}=this;return t.destroyed=s,t.finished=i,t.length=o,t.pos=f,o%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},Vt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var it=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var fr=BigInt(4294967295),Go=BigInt(32);function wn(e,t=!1){return t?{h:Number(e&fr),l:Number(e>>Go&fr)}:{h:Number(e>>Go&fr)|0,l:Number(e&fr)|0}}function qo(e,t=!1){let r=e.length,n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){let{h:s,l:f}=wn(e[i],t);[n[i],o[i]]=[s,f]}return[n,o]}var xn=(e,t,r)=>e>>>r,bn=(e,t,r)=>e<<32-r|t>>>r,Ct=(e,t,r)=>e>>>r|t<<32-r,Dt=(e,t,r)=>e<<32-r|t>>>r,fe=(e,t,r)=>e<<64-r|t>>>r-32,ue=(e,t,r)=>e>>>r-32|t<<64-r,Ko=(e,t)=>t,Yo=(e,t)=>e;function wt(e,t,r,n){let o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:o|0}}var Ze=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),Ge=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,Wo=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),Xo=(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,Jo=(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0),Qo=(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0;var tt=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),S=new Uint32Array(32);function Kt(e,t,r,n,o,i){let s=o[i],f=o[i+1],c=S[2*e],u=S[2*e+1],d=S[2*t],l=S[2*t+1],y=S[2*r],w=S[2*r+1],x=S[2*n],U=S[2*n+1],E=Ze(c,d,s);u=Ge(E,u,l,f),c=E|0,{Dh:U,Dl:x}={Dh:U^u,Dl:x^c},{Dh:U,Dl:x}={Dh:Ko(U,x),Dl:Yo(U,x)},{h:w,l:y}=wt(w,y,U,x),{Bh:l,Bl:d}={Bh:l^w,Bl:d^y},{Bh:l,Bl:d}={Bh:Ct(l,d,24),Bl:Dt(l,d,24)},S[2*e]=c,S[2*e+1]=u,S[2*t]=d,S[2*t+1]=l,S[2*r]=y,S[2*r+1]=w,S[2*n]=x,S[2*n+1]=U}function Yt(e,t,r,n,o,i){let s=o[i],f=o[i+1],c=S[2*e],u=S[2*e+1],d=S[2*t],l=S[2*t+1],y=S[2*r],w=S[2*r+1],x=S[2*n],U=S[2*n+1],E=Ze(c,d,s);u=Ge(E,u,l,f),c=E|0,{Dh:U,Dl:x}={Dh:U^u,Dl:x^c},{Dh:U,Dl:x}={Dh:Ct(U,x,16),Dl:Dt(U,x,16)},{h:w,l:y}=wt(w,y,U,x),{Bh:l,Bl:d}={Bh:l^w,Bl:d^y},{Bh:l,Bl:d}={Bh:fe(l,d,63),Bl:ue(l,d,63)},S[2*e]=c,S[2*e+1]=u,S[2*t]=d,S[2*t+1]=l,S[2*r]=y,S[2*r+1]=w,S[2*n]=x,S[2*n+1]=U}function ic(e,t={},r,n,o){if(lt(r),e<0||e>r)throw new Error("outputLen bigger than keyLen");let{key:i,salt:s,personalization:f}=t;if(i!==void 0&&(i.length<1||i.length>r))throw new Error('"key" expected to be undefined or of length=1..'+r);s!==void 0&&P(s,n,"salt"),f!==void 0&&P(f,o,"personalization")}var En=class{constructor(t,r){g(this,"buffer");g(this,"buffer32");g(this,"finished",!1);g(this,"destroyed",!1);g(this,"length",0);g(this,"pos",0);g(this,"blockLen");g(this,"outputLen");lt(t),lt(r),this.blockLen=t,this.outputLen=r,this.buffer=new Uint8Array(t),this.buffer32=$e(this.buffer)}update(t){Ht(this),P(t);let{blockLen:r,buffer:n,buffer32:o}=this,i=t.length,s=t.byteOffset,f=t.buffer;for(let c=0;c<i;){this.pos===r&&(ae(o),this.compress(o,0,!1),ae(o),this.pos=0);let u=Math.min(r-this.pos,i-c),d=s+c;if(u===r&&!(d%4)&&c+u<i){let l=new Uint32Array(f,d,Math.floor((i-c)/4));ae(l);for(let y=0;c+r<i;y+=o.length,c+=r)this.length+=r,this.compress(l,y,!1);ae(l);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){Ht(this),cr(t,this);let{pos:r,buffer32:n}=this;this.finished=!0,gt(this.buffer.subarray(r)),ae(n),this.compress(n,0,!0),ae(n);let o=$e(t);this.get().forEach((i,s)=>o[s]=Lt(i))}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){let{buffer:r,length:n,finished:o,destroyed:i,outputLen:s,pos:f}=this;return t||(t=new this.constructor({dkLen:s})),t.set(...this.get()),t.buffer.set(r),t.destroyed=i,t.finished=o,t.length=n,t.pos=f,t.outputLen=s,t}clone(){return this._cloneInto()}},Bn=class extends En{constructor(r={}){let n=r.dkLen===void 0?64:r.dkLen;super(128,n);g(this,"v0l",tt[0]|0);g(this,"v0h",tt[1]|0);g(this,"v1l",tt[2]|0);g(this,"v1h",tt[3]|0);g(this,"v2l",tt[4]|0);g(this,"v2h",tt[5]|0);g(this,"v3l",tt[6]|0);g(this,"v3h",tt[7]|0);g(this,"v4l",tt[8]|0);g(this,"v4h",tt[9]|0);g(this,"v5l",tt[10]|0);g(this,"v5h",tt[11]|0);g(this,"v6l",tt[12]|0);g(this,"v6h",tt[13]|0);g(this,"v7l",tt[14]|0);g(this,"v7h",tt[15]|0);ic(n,r,64,16,16);let{key:o,personalization:i,salt:s}=r,f=0;if(o!==void 0&&(P(o,void 0,"key"),f=o.length),this.v0l^=this.outputLen|f<<8|65536|1<<24,s!==void 0){P(s,void 0,"salt");let c=$e(s);this.v4l^=Lt(c[0]),this.v4h^=Lt(c[1]),this.v5l^=Lt(c[2]),this.v5h^=Lt(c[3])}if(i!==void 0){P(i,void 0,"personalization");let c=$e(i);this.v6l^=Lt(c[0]),this.v6h^=Lt(c[1]),this.v7l^=Lt(c[2]),this.v7h^=Lt(c[3])}if(o!==void 0){let c=new Uint8Array(this.blockLen);c.set(o),this.update(c)}}get(){let{v0l:r,v0h:n,v1l:o,v1h:i,v2l:s,v2h:f,v3l:c,v3h:u,v4l:d,v4h:l,v5l:y,v5h:w,v6l:x,v6h:U,v7l:E,v7h:M}=this;return[r,n,o,i,s,f,c,u,d,l,y,w,x,U,E,M]}set(r,n,o,i,s,f,c,u,d,l,y,w,x,U,E,M){this.v0l=r|0,this.v0h=n|0,this.v1l=o|0,this.v1h=i|0,this.v2l=s|0,this.v2h=f|0,this.v3l=c|0,this.v3h=u|0,this.v4l=d|0,this.v4h=l|0,this.v5l=y|0,this.v5h=w|0,this.v6l=x|0,this.v6h=U|0,this.v7l=E|0,this.v7h=M|0}compress(r,n,o){this.get().forEach((u,d)=>S[d]=u),S.set(tt,16);let{h:i,l:s}=wn(BigInt(this.length));S[24]=tt[8]^s,S[25]=tt[9]^i,o&&(S[28]=~S[28],S[29]=~S[29]);let f=0,c=jo;for(let u=0;u<12;u++)Kt(0,4,8,12,r,n+2*c[f++]),Yt(0,4,8,12,r,n+2*c[f++]),Kt(1,5,9,13,r,n+2*c[f++]),Yt(1,5,9,13,r,n+2*c[f++]),Kt(2,6,10,14,r,n+2*c[f++]),Yt(2,6,10,14,r,n+2*c[f++]),Kt(3,7,11,15,r,n+2*c[f++]),Yt(3,7,11,15,r,n+2*c[f++]),Kt(0,5,10,15,r,n+2*c[f++]),Yt(0,5,10,15,r,n+2*c[f++]),Kt(1,6,11,12,r,n+2*c[f++]),Yt(1,6,11,12,r,n+2*c[f++]),Kt(2,7,8,13,r,n+2*c[f++]),Yt(2,7,8,13,r,n+2*c[f++]),Kt(3,4,9,14,r,n+2*c[f++]),Yt(3,4,9,14,r,n+2*c[f++]);this.v0l^=S[0]^S[16],this.v0h^=S[1]^S[17],this.v1l^=S[2]^S[18],this.v1h^=S[3]^S[19],this.v2l^=S[4]^S[20],this.v2h^=S[5]^S[21],this.v3l^=S[6]^S[22],this.v3h^=S[7]^S[23],this.v4l^=S[8]^S[24],this.v4h^=S[9]^S[25],this.v5l^=S[10]^S[26],this.v5h^=S[11]^S[27],this.v6l^=S[12]^S[28],this.v6h^=S[13]^S[29],this.v7l^=S[14]^S[30],this.v7h^=S[15]^S[31],gt(S)}destroy(){this.destroyed=!0,gt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},le=je(e=>new Bn(e));function Se(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var Ae=class{equals(e){return Se(this.toRawBytes(),e.toRawBytes())}toBase64(){return G(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){return G(this.toSuiBytes())}verifyWithIntent(e,t,r){let n=le(or(r,e),{dkLen:32});return this.verify(n,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(se.byteVector().serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}verifyAddress(e){return this.toSuiAddress()===e}toSuiBytes(){let e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return Ot(yt(le(this.toSuiBytes(),{dkLen:32})).slice(0,Gt*2))}};function ur(e){let t=q(e),r=ir[t[0]];switch(r){case"ED25519":case"Secp256k1":case"Secp256r1":let n=Po[r],o=t.slice(1,t.length-n);return{serializedSignature:e,signatureScheme:r,signature:o,publicKey:t.slice(1+o.length),bytes:t};default:throw new Error("Unsupported signature scheme")}}var sc=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wt=new Uint32Array(64),Sn=class extends Fe{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:n,D:o,E:i,F:s,G:f,H:c}=this;return[t,r,n,o,i,s,f,c]}set(t,r,n,o,i,s,f,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=f|0,this.H=c|0}process(t,r){for(let l=0;l<16;l++,r+=4)Wt[l]=t.getUint32(r,!1);for(let l=16;l<64;l++){let y=Wt[l-15],w=Wt[l-2],x=It(y,7)^It(y,18)^y>>>3,U=It(w,17)^It(w,19)^w>>>10;Wt[l]=U+Wt[l-7]+x+Wt[l-16]|0}let{A:n,B:o,C:i,D:s,E:f,F:c,G:u,H:d}=this;for(let l=0;l<64;l++){let y=It(f,6)^It(f,11)^It(f,25),w=d+y+Fo(f,c,u)+sc[l]+Wt[l]|0,U=(It(n,2)^It(n,13)^It(n,22))+Zo(n,o,i)|0;d=u,u=c,c=f,f=s+w|0,s=i,i=o,o=n,n=w+U|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,f=f+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,o,i,s,f,c,u,d)}roundClean(){gt(Wt)}destroy(){this.set(0,0,0,0,0,0,0,0),gt(this.buffer)}},An=class extends Sn{constructor(){super(32);g(this,"A",Vt[0]|0);g(this,"B",Vt[1]|0);g(this,"C",Vt[2]|0);g(this,"D",Vt[3]|0);g(this,"E",Vt[4]|0);g(this,"F",Vt[5]|0);g(this,"G",Vt[6]|0);g(this,"H",Vt[7]|0)}};var ei=qo(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),cc=ei[0],ac=ei[1],Xt=new Uint32Array(80),Jt=new Uint32Array(80),In=class extends Fe{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:r,Bh:n,Bl:o,Ch:i,Cl:s,Dh:f,Dl:c,Eh:u,El:d,Fh:l,Fl:y,Gh:w,Gl:x,Hh:U,Hl:E}=this;return[t,r,n,o,i,s,f,c,u,d,l,y,w,x,U,E]}set(t,r,n,o,i,s,f,c,u,d,l,y,w,x,U,E){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=s|0,this.Dh=f|0,this.Dl=c|0,this.Eh=u|0,this.El=d|0,this.Fh=l|0,this.Fl=y|0,this.Gh=w|0,this.Gl=x|0,this.Hh=U|0,this.Hl=E|0}process(t,r){for(let B=0;B<16;B++,r+=4)Xt[B]=t.getUint32(r),Jt[B]=t.getUint32(r+=4);for(let B=16;B<80;B++){let R=Xt[B-15]|0,V=Jt[B-15]|0,Z=Ct(R,V,1)^Ct(R,V,8)^xn(R,V,7),K=Dt(R,V,1)^Dt(R,V,8)^bn(R,V,7),I=Xt[B-2]|0,T=Jt[B-2]|0,N=Ct(I,T,19)^fe(I,T,61)^xn(I,T,6),j=Dt(I,T,19)^ue(I,T,61)^bn(I,T,6),C=Wo(K,j,Jt[B-7],Jt[B-16]),_=Xo(C,Z,N,Xt[B-7],Xt[B-16]);Xt[B]=_|0,Jt[B]=C|0}let{Ah:n,Al:o,Bh:i,Bl:s,Ch:f,Cl:c,Dh:u,Dl:d,Eh:l,El:y,Fh:w,Fl:x,Gh:U,Gl:E,Hh:M,Hl:A}=this;for(let B=0;B<80;B++){let R=Ct(l,y,14)^Ct(l,y,18)^fe(l,y,41),V=Dt(l,y,14)^Dt(l,y,18)^ue(l,y,41),Z=l&w^~l&U,K=y&x^~y&E,I=Jo(A,V,K,ac[B],Jt[B]),T=Qo(I,M,R,Z,cc[B],Xt[B]),N=I|0,j=Ct(n,o,28)^fe(n,o,34)^fe(n,o,39),C=Dt(n,o,28)^ue(n,o,34)^ue(n,o,39),_=n&i^n&f^i&f,m=o&s^o&c^s&c;M=U|0,A=E|0,U=w|0,E=x|0,w=l|0,x=y|0,{h:l,l:y}=wt(u|0,d|0,T|0,N|0),u=f|0,d=c|0,f=i|0,c=s|0,i=n|0,s=o|0;let h=Ze(N,C,m);n=Ge(h,T,j,_),o=h|0}({h:n,l:o}=wt(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:s}=wt(this.Bh|0,this.Bl|0,i|0,s|0),{h:f,l:c}=wt(this.Ch|0,this.Cl|0,f|0,c|0),{h:u,l:d}=wt(this.Dh|0,this.Dl|0,u|0,d|0),{h:l,l:y}=wt(this.Eh|0,this.El|0,l|0,y|0),{h:w,l:x}=wt(this.Fh|0,this.Fl|0,w|0,x|0),{h:U,l:E}=wt(this.Gh|0,this.Gl|0,U|0,E|0),{h:M,l:A}=wt(this.Hh|0,this.Hl|0,M|0,A|0),this.set(n,o,i,s,f,c,u,d,l,y,w,x,U,E,M,A)}roundClean(){gt(Xt,Jt)}destroy(){gt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Tn=class extends In{constructor(){super(64);g(this,"Ah",it[0]|0);g(this,"Al",it[1]|0);g(this,"Bh",it[2]|0);g(this,"Bl",it[3]|0);g(this,"Ch",it[4]|0);g(this,"Cl",it[5]|0);g(this,"Dh",it[6]|0);g(this,"Dl",it[7]|0);g(this,"Eh",it[8]|0);g(this,"El",it[9]|0);g(this,"Fh",it[10]|0);g(this,"Fl",it[11]|0);g(this,"Gh",it[12]|0);g(this,"Gl",it[13]|0);g(this,"Hh",it[14]|0);g(this,"Hl",it[15]|0)}};var lr=je(()=>new An,yn(1));var vn=je(()=>new Tn,yn(3));var On=BigInt(0),Un=BigInt(1);function zt(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new Error(r+"expected boolean, got type="+typeof e)}return e}function ri(e){if(typeof e=="bigint"){if(!dr(e))throw new Error("positive bigint expected, got "+e)}else lt(e);return e}function qe(e){let t=ri(e).toString(16);return t.length&1?"0"+t:t}function ni(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?On:BigInt("0x"+e)}function Ie(e){return ni(yt(e))}function de(e){return ni(yt(pr(P(e)).reverse()))}function hr(e,t){lt(t),e=ri(e);let r=Tt(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw new Error("number too large");return r}function Rn(e,t){return hr(e,t).reverse()}function pr(e){return Uint8Array.from(e)}var dr=e=>typeof e=="bigint"&&On<=e;function fc(e,t,r){return dr(e)&&dr(t)&&dr(r)&&t<=e&&e<r}function Ke(e,t,r,n){if(!fc(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function _n(e){let t;for(t=0;e>On;e>>=Un,t+=1);return t}var Ye=e=>(Un<<BigInt(e))-Un;function oi(e,t,r){if(lt(e,"hashLen"),lt(t,"qByteLen"),typeof r!="function")throw new Error("hmacFn must be a function");let n=E=>new Uint8Array(E),o=Uint8Array.of(),i=Uint8Array.of(0),s=Uint8Array.of(1),f=1e3,c=n(e),u=n(e),d=0,l=()=>{c.fill(1),u.fill(0),d=0},y=(...E)=>r(u,dt(c,...E)),w=(E=o)=>{u=y(i,E),c=y(),E.length!==0&&(u=y(s,E),c=y())},x=()=>{if(d++>=f)throw new Error("drbg: tried max amount of iterations");let E=0,M=[];for(;E<t;){c=y();let A=c.slice();M.push(A),E+=c.length}return dt(...M)};return(E,M)=>{l(),w(E);let A;for(;!(A=M(x()));)w();return l(),A}}function Qt(e,t={},r={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function n(i,s,f){let c=e[i];if(f&&c===void 0)return;let u=typeof c;if(u!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}let o=(i,s)=>Object.entries(i).forEach(([f,c])=>n(f,c,s));o(t,!1),o(r,!0)}function Te(e){let t=new WeakMap;return(r,...n)=>{let o=t.get(r);if(o!==void 0)return o;let i=e(r,...n);return t.set(r,i),i}}var ft=BigInt(0),et=BigInt(1),he=BigInt(2),ci=BigInt(3),ai=BigInt(4),fi=BigInt(5),uc=BigInt(7),ui=BigInt(8),lc=BigInt(9),li=BigInt(16);function J(e,t){let r=e%t;return r>=ft?r:t+r}function vt(e,t,r){let n=e;for(;t-- >ft;)n*=n,n%=r;return n}function ii(e,t){if(e===ft)throw new Error("invert: expected non-zero number");if(t<=ft)throw new Error("invert: expected positive modulus, got "+t);let r=J(e,t),n=t,o=ft,i=et,s=et,f=ft;for(;r!==ft;){let u=n/r,d=n%r,l=o-s*u,y=i-f*u;n=r,r=d,o=s,i=f,s=l,f=y}if(n!==et)throw new Error("invert: does not exist");return J(o,t)}function Cn(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function di(e,t){let r=(e.ORDER+et)/ai,n=e.pow(t,r);return Cn(e,n,t),n}function dc(e,t){let r=(e.ORDER-fi)/ui,n=e.mul(t,he),o=e.pow(n,r),i=e.mul(t,o),s=e.mul(e.mul(i,he),o),f=e.mul(i,e.sub(s,e.ONE));return Cn(e,f,t),f}function hc(e){let t=mr(e),r=hi(e),n=r(t,t.neg(t.ONE)),o=r(t,n),i=r(t,t.neg(n)),s=(e+uc)/li;return(f,c)=>{let u=f.pow(c,s),d=f.mul(u,n),l=f.mul(u,o),y=f.mul(u,i),w=f.eql(f.sqr(d),c),x=f.eql(f.sqr(l),c);u=f.cmov(u,d,w),d=f.cmov(y,l,x);let U=f.eql(f.sqr(d),c),E=f.cmov(u,d,U);return Cn(f,E,c),E}}function hi(e){if(e<ci)throw new Error("sqrt is not defined for small field");let t=e-et,r=0;for(;t%he===ft;)t/=he,r++;let n=he,o=mr(e);for(;si(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return di;let i=o.pow(n,t),s=(t+et)/he;return function(c,u){if(c.is0(u))return u;if(si(c,u)!==1)throw new Error("Cannot find square root");let d=r,l=c.mul(c.ONE,i),y=c.pow(u,t),w=c.pow(u,s);for(;!c.eql(y,c.ONE);){if(c.is0(y))return c.ZERO;let x=1,U=c.sqr(y);for(;!c.eql(U,c.ONE);)if(x++,U=c.sqr(U),x===d)throw new Error("Cannot find square root");let E=et<<BigInt(d-x-1),M=c.pow(l,E);d=x,l=c.sqr(M),y=c.mul(y,l),w=c.mul(w,M)}return w}}function pc(e){return e%ai===ci?di:e%ui===fi?dc:e%li===lc?hc(e):hi(e)}var pi=(e,t)=>(J(e,t)&et)===et,mc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dn(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=mc.reduce((n,o)=>(n[o]="function",n),t);return Qt(e,r),e}function gc(e,t,r){if(r<ft)throw new Error("invalid exponent, negatives unsupported");if(r===ft)return e.ONE;if(r===et)return t;let n=e.ONE,o=t;for(;r>ft;)r&et&&(n=e.mul(n,o)),o=e.sqr(o),r>>=et;return n}function We(e,t,r=!1){let n=new Array(t.length).fill(r?e.ZERO:void 0),o=t.reduce((s,f,c)=>e.is0(f)?s:(n[c]=s,e.mul(s,f)),e.ONE),i=e.inv(o);return t.reduceRight((s,f,c)=>e.is0(f)?s:(n[c]=e.mul(s,n[c]),e.mul(s,f)),i),n}function si(e,t){let r=(e.ORDER-et)/he,n=e.pow(t,r),o=e.eql(n,e.ONE),i=e.eql(n,e.ZERO),s=e.eql(n,e.neg(e.ONE));if(!o&&!i&&!s)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function yc(e,t){t!==void 0&&lt(t);let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}var Ln=class{constructor(t,r={}){g(this,"ORDER");g(this,"BITS");g(this,"BYTES");g(this,"isLE");g(this,"ZERO",ft);g(this,"ONE",et);g(this,"_lengths");g(this,"_sqrt");g(this,"_mod");if(t<=ft)throw new Error("invalid field: expected ORDER > 0, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&(this.sqrt=r.sqrt),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=r.allowedLengths?.slice()),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:o,nByteLength:i}=yc(t,n);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=o,this.BYTES=i,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return J(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return ft<=t&&t<this.ORDER}is0(t){return t===ft}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&et)===et}neg(t){return J(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return J(t*t,this.ORDER)}add(t,r){return J(t+r,this.ORDER)}sub(t,r){return J(t-r,this.ORDER)}mul(t,r){return J(t*r,this.ORDER)}pow(t,r){return gc(this,t,r)}div(t,r){return J(t*ii(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return ii(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=pc(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Rn(t,this.BYTES):hr(t,this.BYTES)}fromBytes(t,r=!1){P(t);let{_lengths:n,BYTES:o,isLE:i,ORDER:s,_mod:f}=this;if(n){if(!n.includes(t.length)||t.length>o)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let u=new Uint8Array(o);u.set(t,i?0:u.length-t.length),t=u}if(t.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);let c=i?de(t):Ie(t);if(f&&(c=J(c,s)),!r&&!this.isValid(c))throw new Error("invalid field element: outside of range 0..ORDER");return c}invertBatch(t){return We(this,t)}cmov(t,r,n){return n?r:t}};function mr(e,t={}){return new Ln(e,t)}function mi(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function kn(e){let t=mi(e);return t+Math.ceil(t/2)}function gi(e,t,r=!1){P(e);let n=e.length,o=mi(t),i=kn(t);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);let s=r?de(e):Ie(e),f=J(s,t-et)+et;return r?Rn(f,o):hr(f,o)}var ve=BigInt(0),pe=BigInt(1);function Xe(e,t){let r=t.negate();return e?r:t}function me(e,t){let r=We(e.Fp,t.map(n=>n.Z));return t.map((n,o)=>e.fromAffine(n.toAffine(r[o])))}function bi(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Mn(e,t){bi(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),o=2**e,i=Ye(e),s=BigInt(e);return{windows:r,windowSize:n,mask:i,maxNumber:o,shiftBy:s}}function yi(e,t,r){let{windowSize:n,mask:o,maxNumber:i,shiftBy:s}=r,f=Number(e&o),c=e>>s;f>n&&(f-=i,c+=pe);let u=t*n,d=u+Math.abs(f)-1,l=f===0,y=f<0,w=t%2!==0;return{nextN:c,offset:d,isZero:l,isNeg:y,isNegF:w,offsetF:u}}var Nn=new WeakMap,Ei=new WeakMap;function Pn(e){return Ei.get(e)||1}function wi(e){if(e!==ve)throw new Error("invalid wNAF")}var Ue=class{constructor(t,r){g(this,"BASE");g(this,"ZERO");g(this,"Fn");g(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,n=this.ZERO){let o=t;for(;r>ve;)r&pe&&(n=n.add(o)),o=o.double(),r>>=pe;return n}precomputeWindow(t,r){let{windows:n,windowSize:o}=Mn(r,this.bits),i=[],s=t,f=s;for(let c=0;c<n;c++){f=s,i.push(f);for(let u=1;u<o;u++)f=f.add(s),i.push(f);s=f.double()}return i}wNAF(t,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let o=this.ZERO,i=this.BASE,s=Mn(t,this.bits);for(let f=0;f<s.windows;f++){let{nextN:c,offset:u,isZero:d,isNeg:l,isNegF:y,offsetF:w}=yi(n,f,s);n=c,d?i=i.add(Xe(y,r[w])):o=o.add(Xe(l,r[u]))}return wi(n),{p:o,f:i}}wNAFUnsafe(t,r,n,o=this.ZERO){let i=Mn(t,this.bits);for(let s=0;s<i.windows&&n!==ve;s++){let{nextN:f,offset:c,isZero:u,isNeg:d}=yi(n,s,i);if(n=f,!u){let l=r[c];o=o.add(d?l.negate():l)}}return wi(n),o}getPrecomputes(t,r,n){let o=Nn.get(r);return o||(o=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(o=n(o)),Nn.set(r,o))),o}cached(t,r,n){let o=Pn(t);return this.wNAF(o,this.getPrecomputes(o,t,n),r)}unsafe(t,r,n,o){let i=Pn(t);return i===1?this._unsafeLadder(t,r,o):this.wNAFUnsafe(i,this.getPrecomputes(i,t,n),r,o)}createCache(t,r){bi(r,this.bits),Ei.set(t,r),Nn.delete(t)}hasCache(t){return Pn(t)!==1}};function Bi(e,t,r,n){let o=t,i=e.ZERO,s=e.ZERO;for(;r>ve||n>ve;)r&pe&&(i=i.add(o)),n&pe&&(s=s.add(o)),o=o.double(),r>>=pe,n>>=pe;return{p1:i,p2:s}}function xi(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Dn(t),t}else return mr(e,{isLE:r})}function gr(e,t,r={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let c of["p","n","h"]){let u=t[c];if(!(typeof u=="bigint"&&u>ve))throw new Error(`CURVE.${c} must be positive bigint`)}let o=xi(t.p,r.Fp,n),i=xi(t.n,r.Fn,n),f=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let c of f)if(!o.isValid(t[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:i}}function yr(e,t){return function(n){let o=e(n);return{secretKey:o,publicKey:t(o)}}}var wr=class{constructor(t,r){g(this,"oHash");g(this,"iHash");g(this,"blockLen");g(this,"outputLen");g(this,"finished",!1);g(this,"destroyed",!1);if(sr(t),P(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?t.create().update(r).digest():r);for(let i=0;i<o.length;i++)o[i]^=54;this.iHash.update(o),this.oHash=t.create();for(let i=0;i<o.length;i++)o[i]^=106;this.oHash.update(o),gt(o)}update(t){return Ht(this),this.iHash.update(t),this}digestInto(t){Ht(this),P(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:o,destroyed:i,blockLen:s,outputLen:f}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=f,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Hn=(e,t,r)=>new wr(e,t).update(r).digest();Hn.create=(e,t)=>new wr(e,t);var Si=(e,t)=>(e+(e>=0?t:-t)/Ai)/t;function wc(e,t,r){let[[n,o],[i,s]]=t,f=Si(s*e,r),c=Si(-o*e,r),u=e-f*n-c*i,d=-f*o-c*s,l=u<$t,y=d<$t;l&&(u=-u),y&&(d=-d);let w=Ye(Math.ceil(_n(r)/2))+Oe;if(u<$t||u>=w||d<$t||d>=w)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:l,k1:u,k2neg:y,k2:d}}function zn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Vn(e,t){let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return zt(r.lowS,"lowS"),zt(r.prehash,"prehash"),r.format!==void 0&&zn(r.format),r}var $n=class extends Error{constructor(t=""){super(t)}},te={Err:$n,_tlv:{encode:(e,t)=>{let{Err:r}=te;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,o=qe(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let i=n>127?qe(o.length/2|128):"";return qe(e)+i+o+t},decode(e,t){let{Err:r}=te,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let o=t[n++],i=!!(o&128),s=0;if(!i)s=o;else{let c=o&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)s=s<<8|d;if(n+=c,s<128)throw new r("tlv.decode(long): not minimal encoding")}let f=t.subarray(n,n+s);if(f.length!==s)throw new r("tlv.decode: wrong value length");return{v:f,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=te;if(e<$t)throw new t("integer: negative integers are not allowed");let r=qe(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=te;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ie(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=te,o=P(e,void 0,"signature"),{v:i,l:s}=n.decode(48,o);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:f,l:c}=n.decode(2,i),{v:u,l:d}=n.decode(2,c);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(f),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=te,n=t.encode(2,r.encode(e.r)),o=t.encode(2,r.encode(e.s)),i=n+o;return t.encode(48,i)}},$t=BigInt(0),Oe=BigInt(1),Ai=BigInt(2),xr=BigInt(3),xc=BigInt(4);function Ii(e,t={}){let r=gr("weierstrass",e,t),{Fp:n,Fn:o}=r,i=r.CURVE,{h:s,n:f}=i;Qt(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:c}=t;if(c&&(!n.is0(i.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let u=vi(n,o);function d(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(_,m,h){let{x:b,y:v}=m.toAffine(),L=n.toBytes(b);if(zt(h,"isCompressed"),h){d();let D=!n.isOdd(v);return dt(Ti(D),L)}else return dt(Uint8Array.of(4),L,n.toBytes(v))}function y(_){P(_,void 0,"Point");let{publicKey:m,publicKeyUncompressed:h}=u,b=_.length,v=_[0],L=_.subarray(1);if(b===m&&(v===2||v===3)){let D=n.fromBytes(L);if(!n.isValid(D))throw new Error("bad point: is not on curve, wrong x");let k=U(D),O;try{O=n.sqrt(k)}catch(Q){let Y=Q instanceof Error?": "+Q.message:"";throw new Error("bad point: is not on curve, sqrt error"+Y)}d();let H=n.isOdd(O);return(v&1)===1!==H&&(O=n.neg(O)),{x:D,y:O}}else if(b===h&&v===4){let D=n.BYTES,k=n.fromBytes(L.subarray(0,D)),O=n.fromBytes(L.subarray(D,D*2));if(!E(k,O))throw new Error("bad point: is not on curve");return{x:k,y:O}}else throw new Error(`bad point: got length ${b}, expected compressed=${m} or uncompressed=${h}`)}let w=t.toBytes||l,x=t.fromBytes||y;function U(_){let m=n.sqr(_),h=n.mul(m,_);return n.add(n.add(h,n.mul(_,i.a)),i.b)}function E(_,m){let h=n.sqr(m),b=U(_);return n.eql(h,b)}if(!E(i.Gx,i.Gy))throw new Error("bad curve params: generator point");let M=n.mul(n.pow(i.a,xr),xc),A=n.mul(n.sqr(i.b),BigInt(27));if(n.is0(n.add(M,A)))throw new Error("bad curve params: a or b");function B(_,m,h=!1){if(!n.isValid(m)||h&&n.is0(m))throw new Error(`bad point coordinate ${_}`);return m}function R(_){if(!(_ instanceof T))throw new Error("Weierstrass Point expected")}function V(_){if(!c||!c.basises)throw new Error("no endo");return wc(_,c.basises,o.ORDER)}let Z=Te((_,m)=>{let{X:h,Y:b,Z:v}=_;if(n.eql(v,n.ONE))return{x:h,y:b};let L=_.is0();m==null&&(m=L?n.ONE:n.inv(v));let D=n.mul(h,m),k=n.mul(b,m),O=n.mul(v,m);if(L)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:D,y:k}}),K=Te(_=>{if(_.is0()){if(t.allowInfinityPoint&&!n.is0(_.Y))return;throw new Error("bad point: ZERO")}let{x:m,y:h}=_.toAffine();if(!n.isValid(m)||!n.isValid(h))throw new Error("bad point: x or y not field elements");if(!E(m,h))throw new Error("bad point: equation left != right");if(!_.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function I(_,m,h,b,v){return h=new T(n.mul(h.X,_),h.Y,h.Z),m=Xe(b,m),h=Xe(v,h),m.add(h)}let C=class C{constructor(m,h,b){g(this,"X");g(this,"Y");g(this,"Z");this.X=B("x",m),this.Y=B("y",h,!0),this.Z=B("z",b),Object.freeze(this)}static CURVE(){return i}static fromAffine(m){let{x:h,y:b}=m||{};if(!m||!n.isValid(h)||!n.isValid(b))throw new Error("invalid affine point");if(m instanceof C)throw new Error("projective point not allowed");return n.is0(h)&&n.is0(b)?C.ZERO:new C(h,b,n.ONE)}static fromBytes(m){let h=C.fromAffine(x(P(m,void 0,"point")));return h.assertValidity(),h}static fromHex(m){return C.fromBytes(Tt(m))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,h=!0){return j.createCache(this,m),h||this.multiply(xr),this}assertValidity(){K(this)}hasEvenY(){let{y:m}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(m)}equals(m){R(m);let{X:h,Y:b,Z:v}=this,{X:L,Y:D,Z:k}=m,O=n.eql(n.mul(h,k),n.mul(L,v)),H=n.eql(n.mul(b,k),n.mul(D,v));return O&&H}negate(){return new C(this.X,n.neg(this.Y),this.Z)}double(){let{a:m,b:h}=i,b=n.mul(h,xr),{X:v,Y:L,Z:D}=this,k=n.ZERO,O=n.ZERO,H=n.ZERO,z=n.mul(v,v),Q=n.mul(L,L),Y=n.mul(D,D),$=n.mul(v,L);return $=n.add($,$),H=n.mul(v,D),H=n.add(H,H),k=n.mul(m,H),O=n.mul(b,Y),O=n.add(k,O),k=n.sub(Q,O),O=n.add(Q,O),O=n.mul(k,O),k=n.mul($,k),H=n.mul(b,H),Y=n.mul(m,Y),$=n.sub(z,Y),$=n.mul(m,$),$=n.add($,H),H=n.add(z,z),z=n.add(H,z),z=n.add(z,Y),z=n.mul(z,$),O=n.add(O,z),Y=n.mul(L,D),Y=n.add(Y,Y),z=n.mul(Y,$),k=n.sub(k,z),H=n.mul(Y,Q),H=n.add(H,H),H=n.add(H,H),new C(k,O,H)}add(m){R(m);let{X:h,Y:b,Z:v}=this,{X:L,Y:D,Z:k}=m,O=n.ZERO,H=n.ZERO,z=n.ZERO,Q=i.a,Y=n.mul(i.b,xr),$=n.mul(h,L),ot=n.mul(b,D),ct=n.mul(v,k),pt=n.add(h,b),X=n.add(L,D);pt=n.mul(pt,X),X=n.add($,ot),pt=n.sub(pt,X),X=n.add(h,v);let at=n.add(L,k);return X=n.mul(X,at),at=n.add($,ct),X=n.sub(X,at),at=n.add(b,v),O=n.add(D,k),at=n.mul(at,O),O=n.add(ot,ct),at=n.sub(at,O),z=n.mul(Q,X),O=n.mul(Y,ct),z=n.add(O,z),O=n.sub(ot,z),z=n.add(ot,z),H=n.mul(O,z),ot=n.add($,$),ot=n.add(ot,$),ct=n.mul(Q,ct),X=n.mul(Y,X),ot=n.add(ot,ct),ct=n.sub($,ct),ct=n.mul(Q,ct),X=n.add(X,ct),$=n.mul(ot,X),H=n.add(H,$),$=n.mul(at,X),O=n.mul(pt,O),O=n.sub(O,$),$=n.mul(pt,ot),z=n.mul(at,z),z=n.add(z,$),new C(O,H,z)}subtract(m){return this.add(m.negate())}is0(){return this.equals(C.ZERO)}multiply(m){let{endo:h}=t;if(!o.isValidNot0(m))throw new Error("invalid scalar: out of range");let b,v,L=D=>j.cached(this,D,k=>me(C,k));if(h){let{k1neg:D,k1:k,k2neg:O,k2:H}=V(m),{p:z,f:Q}=L(k),{p:Y,f:$}=L(H);v=Q.add($),b=I(h.beta,z,Y,D,O)}else{let{p:D,f:k}=L(m);b=D,v=k}return me(C,[b,v])[0]}multiplyUnsafe(m){let{endo:h}=t,b=this;if(!o.isValid(m))throw new Error("invalid scalar: out of range");if(m===$t||b.is0())return C.ZERO;if(m===Oe)return b;if(j.hasCache(this))return this.multiply(m);if(h){let{k1neg:v,k1:L,k2neg:D,k2:k}=V(m),{p1:O,p2:H}=Bi(C,b,L,k);return I(h.beta,O,H,v,D)}else return j.unsafe(b,m)}toAffine(m){return Z(this,m)}isTorsionFree(){let{isTorsionFree:m}=t;return s===Oe?!0:m?m(C,this):j.unsafe(this,f).is0()}clearCofactor(){let{clearCofactor:m}=t;return s===Oe?this:m?m(C,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(m=!0){return zt(m,"isCompressed"),this.assertValidity(),w(C,this,m)}toHex(m=!0){return yt(this.toBytes(m))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};g(C,"BASE",new C(i.Gx,i.Gy,n.ONE)),g(C,"ZERO",new C(n.ZERO,n.ONE,n.ZERO)),g(C,"Fp",n),g(C,"Fn",o);let T=C,N=o.BITS,j=new Ue(T,t.endo?Math.ceil(N/2):N);return T.BASE.precompute(8),T}function Ti(e){return Uint8Array.of(e?2:3)}function vi(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function bc(e,t={}){let{Fn:r}=e,n=t.randomBytes||Be,o=Object.assign(vi(e.Fp,r),{seed:kn(r.ORDER)});function i(w){try{let x=r.fromBytes(w);return r.isValidNot0(x)}catch{return!1}}function s(w,x){let{publicKey:U,publicKeyUncompressed:E}=o;try{let M=w.length;return x===!0&&M!==U||x===!1&&M!==E?!1:!!e.fromBytes(w)}catch{return!1}}function f(w=n(o.seed)){return gi(P(w,o.seed,"seed"),r.ORDER)}function c(w,x=!0){return e.BASE.multiply(r.fromBytes(w)).toBytes(x)}function u(w){let{secretKey:x,publicKey:U,publicKeyUncompressed:E}=o;if(!ce(w)||"_lengths"in r&&r._lengths||x===U)return;let M=P(w,void 0,"key").length;return M===U||M===E}function d(w,x,U=!0){if(u(w)===!0)throw new Error("first arg must be private key");if(u(x)===!1)throw new Error("second arg must be public key");let E=r.fromBytes(w);return e.fromBytes(x).multiply(E).toBytes(U)}let l={isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:f},y=yr(f,c);return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:y,Point:e,utils:l,lengths:o})}function Ui(e,t,r={}){sr(t),Qt(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes||Be,o=r.hmac||((m,h)=>Hn(t,m,h)),{Fp:i,Fn:s}=e,{ORDER:f,BITS:c}=s,{keygen:u,getPublicKey:d,getSharedSecret:l,utils:y,lengths:w}=bc(e,r),x={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},U=f*Ai<i.ORDER;function E(m){let h=f>>Oe;return m>h}function M(m,h){if(!s.isValidNot0(h))throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);return h}function A(){if(U)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function B(m,h){zn(h);let b=w.signature,v=h==="compact"?b:h==="recovered"?b+1:void 0;return P(m,v)}class R{constructor(h,b,v){g(this,"r");g(this,"s");g(this,"recovery");if(this.r=M("r",h),this.s=M("s",b),v!=null){if(A(),![0,1,2,3].includes(v))throw new Error("invalid recovery id");this.recovery=v}Object.freeze(this)}static fromBytes(h,b=x.format){B(h,b);let v;if(b==="der"){let{r:O,s:H}=te.toSig(P(h));return new R(O,H)}b==="recovered"&&(v=h[0],b="compact",h=h.subarray(1));let L=w.signature/2,D=h.subarray(0,L),k=h.subarray(L,L*2);return new R(s.fromBytes(D),s.fromBytes(k),v)}static fromHex(h,b){return this.fromBytes(Tt(h),b)}assertRecovery(){let{recovery:h}=this;if(h==null)throw new Error("invalid recovery id: must be present");return h}addRecoveryBit(h){return new R(this.r,this.s,h)}recoverPublicKey(h){let{r:b,s:v}=this,L=this.assertRecovery(),D=L===2||L===3?b+f:b;if(!i.isValid(D))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let k=i.toBytes(D),O=e.fromBytes(dt(Ti((L&1)===0),k)),H=s.inv(D),z=Z(P(h,void 0,"msgHash")),Q=s.create(-z*H),Y=s.create(v*H),$=e.BASE.multiplyUnsafe(Q).add(O.multiplyUnsafe(Y));if($.is0())throw new Error("invalid recovery: point at infinify");return $.assertValidity(),$}hasHighS(){return E(this.s)}toBytes(h=x.format){if(zn(h),h==="der")return Tt(te.hexFromSig(this));let{r:b,s:v}=this,L=s.toBytes(b),D=s.toBytes(v);return h==="recovered"?(A(),dt(Uint8Array.of(this.assertRecovery()),L,D)):dt(L,D)}toHex(h){return yt(this.toBytes(h))}}let V=r.bits2int||function(h){if(h.length>8192)throw new Error("input is too large");let b=Ie(h),v=h.length*8-c;return v>0?b>>BigInt(v):b},Z=r.bits2int_modN||function(h){return s.create(V(h))},K=Ye(c);function I(m){return Ke("num < 2^"+c,m,$t,K),s.toBytes(m)}function T(m,h){return P(m,void 0,"message"),h?P(t(m),void 0,"prehashed message"):m}function N(m,h,b){let{lowS:v,prehash:L,extraEntropy:D}=Vn(b,x);m=T(m,L);let k=Z(m),O=s.fromBytes(h);if(!s.isValidNot0(O))throw new Error("invalid private key");let H=[I(O),I(k)];if(D!=null&&D!==!1){let $=D===!0?n(w.secretKey):D;H.push(P($,void 0,"extraEntropy"))}let z=dt(...H),Q=k;function Y($){let ot=V($);if(!s.isValidNot0(ot))return;let ct=s.inv(ot),pt=e.BASE.multiply(ot).toAffine(),X=s.create(pt.x);if(X===$t)return;let at=s.create(ct*s.create(Q+X*O));if(at===$t)return;let mo=(pt.x===X?0:2)|Number(pt.y&Oe),go=at;return v&&E(at)&&(go=s.neg(at),mo^=1),new R(X,go,U?void 0:mo)}return{seed:z,k2sig:Y}}function j(m,h,b={}){let{seed:v,k2sig:L}=N(m,h,b);return oi(t.outputLen,s.BYTES,o)(v,L).toBytes(b.format)}function C(m,h,b,v={}){let{lowS:L,prehash:D,format:k}=Vn(v,x);if(b=P(b,void 0,"publicKey"),h=T(h,D),!ce(m)){let O=m instanceof R?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+O)}B(m,k);try{let O=R.fromBytes(m,k),H=e.fromBytes(b);if(L&&O.hasHighS())return!1;let{r:z,s:Q}=O,Y=Z(h),$=s.inv(Q),ot=s.create(Y*$),ct=s.create(z*$),pt=e.BASE.multiplyUnsafe(ot).add(H.multiplyUnsafe(ct));return pt.is0()?!1:s.create(pt.x)===z}catch{return!1}}function _(m,h,b={}){let{prehash:v}=Vn(b,x);return h=T(h,v),R.fromBytes(m,"recovered").recoverPublicKey(h).toBytes()}return Object.freeze({keygen:u,getPublicKey:d,getSharedSecret:l,utils:y,lengths:w,Point:e,sign:j,verify:C,recoverPublicKey:_,Signature:R,hash:t})}var Ec={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")};var Bc=Ii(Ec),Oi=Ui(Bc,lr);var jn=33;var Fn=64,Ou=new Uint8Array([48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0]),Re,Ru=(Re=class extends Ae{constructor(t){if(super(),typeof t=="string"?this.data=q(t):t instanceof Uint8Array?this.data=t:this.data=Uint8Array.from(t),this.data.length!==jn)throw new Error(`Invalid public key input. Expected ${jn} bytes, got ${this.data.length}`)}equals(t){return super.equals(t)}toRawBytes(){return this.data}flag(){return _t.Passkey}async verify(t,r){let n=Zn(r),o=JSON.parse(n.clientDataJson);if(o.type!=="webauthn.get"||!Se(t,q(o.challenge.replace(/-/g,"+").replace(/_/g,"/"))))return!1;let i=n.userSignature.slice(1+Fn);if(!Se(this.toRawBytes(),i))return!1;let s=new Uint8Array([...n.authenticatorData,...lr(new TextEncoder().encode(n.clientDataJson))]),f=n.userSignature.slice(1,Fn+1);return Oi.verify(f,s,i)}},Re.SIZE=jn,Re);function Zn(e){let t=typeof e=="string"?q(e):e;if(t[0]!==_t.Passkey)throw new Error("Invalid signature scheme");let r=nr.parse(t.slice(1));return{signatureScheme:"Passkey",serializedSignature:G(t),signature:t,authenticatorData:r.authenticatorData,clientDataJson:r.clientDataJson,userSignature:new Uint8Array(r.userSignature),publicKey:new Uint8Array(r.userSignature.slice(1+Fn))}}function Sc(e){for(let t=0;t<e.length;t++)if(e[t]!==0)return t;return-1}function br(e,t){return Tt(e.toString(16).padStart(t*2,"0").slice(-t*2))}function Gn(e,t){let r=br(e,t),n=Sc(r);return n===-1?new Uint8Array([0]):r.slice(n)}function Ri(e){return e==="accounts.google.com"?"https://accounts.google.com":e}function Ac(e){if(e.length!==1)throw new Error("Invalid base64Url character: "+e);let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(e);if(t===-1)throw new Error("Invalid base64Url character: "+e);let r=t.toString(2).padStart(6,"0");return Array.from(r).map(Number)}function Ic(e){let t=[];for(let r=0;r<e.length;r++){let n=Ac(e.charAt(r));t=t.concat(n)}return t}function Tc(e,t){if(e.length<2)throw new Error(`Input (s = ${e}) is not tightly packed because s.length < 2`);let r=Ic(e),n=t%4;if(n!==0)if(n===1)r=r.slice(2);else if(n===2)r=r.slice(4);else throw new Error(`Input (s = ${e}) is not tightly packed because i%4 = 3 (i = ${t}))`);let o=(t+e.length-1)%4;if(o!==3)if(o===2)r=r.slice(0,r.length-2);else if(o===1)r=r.slice(0,r.length-4);else throw new Error(`Input (s = ${e}) is not tightly packed because (i + s.length - 1)%4 = 0 (i = ${t}))`);if(r.length%8!==0)throw new Error("We should never reach here...");let i=new Uint8Array(Math.floor(r.length/8)),s=0;for(let f=0;f<r.length;f+=8){let c=r.slice(f,f+8),u=parseInt(c.join(""),2);i[s++]=u}return new TextDecoder().decode(i)}function vc(e){if(!(e.slice(-1)==="}"||e.slice(-1)===","))throw new Error("Invalid claim");let t=JSON.parse("{"+e.slice(0,-1)+"}");if(Object.keys(t).length!==1)throw new Error("Invalid claim");let r=Object.keys(t)[0];return[r,t[r]]}function qn(e,t){let[r,n]=vc(Tc(e.value,e.indexMod4));if(r!==t)throw new Error(`Invalid field name: found ${r} expected ${t}`);return n}var _i=a.struct("ZkLoginSignature",{inputs:a.struct("ZkLoginSignatureInputs",{proofPoints:a.struct("ZkLoginSignatureInputsProofPoints",{a:a.vector(a.string()),b:a.vector(a.vector(a.string())),c:a.vector(a.string())}),issBase64Details:a.struct("ZkLoginSignatureInputsClaim",{value:a.string(),indexMod4:a.u8()}),headerBase64:a.string(),addressSeed:a.string()}),maxEpoch:a.u64(),userSignature:a.byteVector()});function Li(e){return _i.parse(typeof e=="string"?q(e):e)}var bt,Le,Ce,Je,Kn,Et,Uc=(Et=class extends Ae{constructor(r,{client:n}={}){super();Ut(this,Je);Ut(this,bt);Ut(this,Le);Ut(this,Ce);xt(this,Le,n),typeof r=="string"?xt(this,bt,q(r)):r instanceof Uint8Array?xt(this,bt,r):xt(this,bt,Uint8Array.from(r)),xt(this,Ce,W(this,bt).length!==W(this,bt)[0]+1+32),W(this,Ce)&&xt(this,bt,_e(W(this,bt),!1))}static fromBytes(r,{client:n,address:o,legacyAddress:i}={}){let s;if(i===!0?s=new Et(_e(r,!0),{client:n}):i===!1?s=new Et(_e(r,!1),{client:n}):o?(s=new Et(_e(r,!1),{client:n}),s.toSuiAddress()!==o&&(s=new Et(_e(r,!0),{client:n}))):s=new Et(r,{client:n}),o&&s.toSuiAddress()!==o)throw new Error("Public key bytes do not match the provided address");return s}static fromProof(r,n){let{issBase64Details:o,addressSeed:i}=n,s=qn(o,"iss"),f=Yn(BigInt(i),s,{legacyAddress:!0});if(f.toSuiAddress()===r)return f;let c=Yn(BigInt(i),s,{legacyAddress:!1});if(c.toSuiAddress()!==r)throw new Error("Proof does not match address");return c}equals(r){return super.equals(r)}toSuiAddress(){return W(this,Ce)?Ur(this,Je,Kn).call(this):super.toSuiAddress()}toRawBytes(){return W(this,bt)}flag(){return _t.ZkLogin}async verify(r,n){throw Error("does not support")}verifyPersonalMessage(r,n){let o=Er(n);return Ci({address:new Et(o.publicKey).toSuiAddress(),bytes:G(r),signature:o.serializedSignature,intentScope:"PersonalMessage",client:W(this,Le)})}verifyTransaction(r,n){let o=Er(n);return Ci({address:new Et(o.publicKey).toSuiAddress(),bytes:G(r),signature:o.serializedSignature,intentScope:"TransactionData",client:W(this,Le)})}verifyAddress(r){return r===super.toSuiAddress()||r===Ur(this,Je,Kn).call(this)}},bt=new WeakMap,Le=new WeakMap,Ce=new WeakMap,Je=new WeakSet,Kn=function(){let r=_e(W(this,bt),!0),n=new Uint8Array(r.length+1);return n[0]=this.flag(),n.set(r,1),Ot(yt(le(n,{dkLen:32})).slice(0,Gt*2))},Et);function Yn(e,t,r){if(r.legacyAddress===void 0)throw new Error("legacyAddress parameter must be specified");let n=r.legacyAddress?Gn(e,32):br(e,32),o=new TextEncoder().encode(Ri(t)),i=new Uint8Array(1+o.length+n.length);return i.set([o.length],0),i.set(o,1),i.set(n,1+o.length),new Uc(i,r)}function _e(e,t){let r=e[0]+1,n=BigInt(`0x${St(e.slice(r))}`),o=t?Gn(n,32):br(n,32),i=new Uint8Array(r+o.length);return i.set(e.slice(0,r),0),i.set(o,r),i}async function Ci({address:e,bytes:t,signature:r,intentScope:n,client:o}){if(!o)throw new Error("A Sui Client (GRPC, GraphQL, or JSON RPC) is required to verify zkLogin signatures");let i=await o.core.verifyZkLoginSignature({bytes:t,signature:r,intentScope:n,address:e});return i.success===!0&&i.errors.length===0}function Er(e){let t=typeof e=="string"?q(e):e;if(t[0]!==_t.ZkLogin)throw new Error("Invalid signature scheme");let{inputs:r,maxEpoch:n,userSignature:o}=Li(t.slice(1)),{issBase64Details:i,addressSeed:s}=r,f=qn(i,"iss"),c=Yn(BigInt(s),f,{legacyAddress:!1});return{serializedSignature:G(t),signatureScheme:"ZkLogin",zkLogin:{inputs:r,maxEpoch:n,userSignature:o,iss:f,addressSeed:BigInt(s)},signature:t,publicKey:c.toRawBytes()}}function Wn({signature:e,signatureScheme:t,publicKey:r}){if(!r)throw new Error("`publicKey` is required");let n=r.toRawBytes(),o=new Uint8Array(1+e.length+n.length);return o.set([_t[t]]),o.set(e,1),o.set(n,1+e.length),G(o)}function Xn(e){let t=q(e),r=ir[t[0]];switch(r){case"Passkey":return Zn(e);case"MultiSig":return{serializedSignature:e,signatureScheme:r,multisig:se.MultiSig.parse(t.slice(1)),bytes:t,signature:void 0};case"ZkLogin":return Er(e);case"ED25519":case"Secp256k1":case"Secp256r1":return ur(e);default:throw new Error("Unsupported signature scheme")}}var Jn=class{async signWithIntent(e,t){let r=le(or(t,e),{dkLen:32});return{signature:Wn({signature:await this.sign(r),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:G(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){let{signature:t}=await this.signWithIntent(a.byteVector().serialize(e).toBytes(),"PersonalMessage");return{bytes:G(e),signature:t}}async signAndExecuteTransaction({transaction:e,client:t}){e.setSenderIfNotSet(this.toSuiAddress());let r=await e.build({client:t}),{signature:n}=await this.signTransaction(r);return t.core.executeTransaction({transaction:r,signatures:[n],include:{transaction:!0,effects:!0}})}toSuiAddress(){return this.getPublicKey().toSuiAddress()}};var ee=BigInt(0),rt=BigInt(1),Qn=BigInt(2),Oc=BigInt(8);function Rc(e,t,r,n){let o=e.sqr(r),i=e.sqr(n),s=e.add(e.mul(t.a,o),i),f=e.add(e.ONE,e.mul(t.d,e.mul(o,i)));return e.eql(s,f)}function Di(e,t={}){let r=gr("edwards",e,t,t.FpFnLE),{Fp:n,Fn:o}=r,i=r.CURVE,{h:s}=i;Qt(t,{},{uvRatio:"function"});let f=Qn<<BigInt(o.BYTES*8)-rt,c=M=>n.create(M),u=t.uvRatio||((M,A)=>{try{return{isValid:!0,value:n.sqrt(n.div(M,A))}}catch{return{isValid:!1,value:ee}}});if(!Rc(n,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function d(M,A,B=!1){let R=B?rt:ee;return Ke("coordinate "+M,A,R,f),A}function l(M){if(!(M instanceof x))throw new Error("EdwardsPoint expected")}let y=Te((M,A)=>{let{X:B,Y:R,Z:V}=M,Z=M.is0();A==null&&(A=Z?Oc:n.inv(V));let K=c(B*A),I=c(R*A),T=n.mul(V,A);if(Z)return{x:ee,y:rt};if(T!==rt)throw new Error("invZ was invalid");return{x:K,y:I}}),w=Te(M=>{let{a:A,d:B}=i;if(M.is0())throw new Error("bad point: ZERO");let{X:R,Y:V,Z,T:K}=M,I=c(R*R),T=c(V*V),N=c(Z*Z),j=c(N*N),C=c(I*A),_=c(N*c(C+T)),m=c(j+c(B*c(I*T)));if(_!==m)throw new Error("bad point: equation left != right (1)");let h=c(R*V),b=c(Z*K);if(h!==b)throw new Error("bad point: equation left != right (2)");return!0}),E=class E{constructor(A,B,R,V){g(this,"X");g(this,"Y");g(this,"Z");g(this,"T");this.X=d("x",A),this.Y=d("y",B),this.Z=d("z",R,!0),this.T=d("t",V),Object.freeze(this)}static CURVE(){return i}static fromAffine(A){if(A instanceof E)throw new Error("extended point not allowed");let{x:B,y:R}=A||{};return d("x",B),d("y",R),new E(B,R,rt,c(B*R))}static fromBytes(A,B=!1){let R=n.BYTES,{a:V,d:Z}=i;A=pr(P(A,R,"point")),zt(B,"zip215");let K=pr(A),I=A[R-1];K[R-1]=I&-129;let T=de(K),N=B?f:n.ORDER;Ke("point.y",T,ee,N);let j=c(T*T),C=c(j-rt),_=c(Z*j-V),{isValid:m,value:h}=u(C,_);if(!m)throw new Error("bad point: invalid y coordinate");let b=(h&rt)===rt,v=(I&128)!==0;if(!B&&h===ee&&v)throw new Error("bad point: x=0 and x_0=1");return v!==b&&(h=c(-h)),E.fromAffine({x:h,y:T})}static fromHex(A,B=!1){return E.fromBytes(Tt(A),B)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(A=8,B=!0){return U.createCache(this,A),B||this.multiply(Qn),this}assertValidity(){w(this)}equals(A){l(A);let{X:B,Y:R,Z:V}=this,{X:Z,Y:K,Z:I}=A,T=c(B*I),N=c(Z*V),j=c(R*I),C=c(K*V);return T===N&&j===C}is0(){return this.equals(E.ZERO)}negate(){return new E(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:A}=i,{X:B,Y:R,Z:V}=this,Z=c(B*B),K=c(R*R),I=c(Qn*c(V*V)),T=c(A*Z),N=B+R,j=c(c(N*N)-Z-K),C=T+K,_=C-I,m=T-K,h=c(j*_),b=c(C*m),v=c(j*m),L=c(_*C);return new E(h,b,L,v)}add(A){l(A);let{a:B,d:R}=i,{X:V,Y:Z,Z:K,T:I}=this,{X:T,Y:N,Z:j,T:C}=A,_=c(V*T),m=c(Z*N),h=c(I*R*C),b=c(K*j),v=c((V+Z)*(T+N)-_-m),L=b-h,D=b+h,k=c(m-B*_),O=c(v*L),H=c(D*k),z=c(v*k),Q=c(L*D);return new E(O,H,Q,z)}subtract(A){return this.add(A.negate())}multiply(A){if(!o.isValidNot0(A))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:B,f:R}=U.cached(this,A,V=>me(E,V));return me(E,[B,R])[0]}multiplyUnsafe(A,B=E.ZERO){if(!o.isValid(A))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return A===ee?E.ZERO:this.is0()||A===rt?this:U.unsafe(this,A,R=>me(E,R),B)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}isTorsionFree(){return U.unsafe(this,i.n).is0()}toAffine(A){return y(this,A)}clearCofactor(){return s===rt?this:this.multiplyUnsafe(s)}toBytes(){let{x:A,y:B}=this.toAffine(),R=n.toBytes(B);return R[R.length-1]|=A&rt?128:0,R}toHex(){return yt(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};g(E,"BASE",new E(i.Gx,i.Gy,rt,c(i.Gx*i.Gy))),g(E,"ZERO",new E(ee,rt,rt,ee)),g(E,"Fp",n),g(E,"Fn",o);let x=E,U=new Ue(x,o.BITS);return x.BASE.precompute(8),x}function ki(e,t,r={}){if(typeof t!="function")throw new Error('"hash" function param is required');Qt(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:o,Fp:i,Fn:s}=e,f=r.randomBytes||Be,c=r.adjustScalarBytes||(I=>I),u=r.domain||((I,T,N)=>{if(zt(N,"phflag"),T.length||N)throw new Error("Contexts/pre-hash are not supported");return I});function d(I){return s.create(de(I))}function l(I){let T=B.secretKey;P(I,B.secretKey,"secretKey");let N=P(t(I),2*T,"hashedSecretKey"),j=c(N.slice(0,T)),C=N.slice(T,2*T),_=d(j);return{head:j,prefix:C,scalar:_}}function y(I){let{head:T,prefix:N,scalar:j}=l(I),C=o.multiply(j),_=C.toBytes();return{head:T,prefix:N,scalar:j,point:C,pointBytes:_}}function w(I){return y(I).pointBytes}function x(I=Uint8Array.of(),...T){let N=dt(...T);return d(t(u(N,P(I,void 0,"context"),!!n)))}function U(I,T,N={}){I=P(I,void 0,"message"),n&&(I=n(I));let{prefix:j,scalar:C,pointBytes:_}=y(T),m=x(N.context,j,I),h=o.multiply(m).toBytes(),b=x(N.context,h,_,I),v=s.create(m+b*C);if(!s.isValid(v))throw new Error("sign failed: invalid s");let L=dt(h,s.toBytes(v));return P(L,B.signature,"result")}let E={zip215:!0};function M(I,T,N,j=E){let{context:C,zip215:_}=j,m=B.signature;I=P(I,m,"signature"),T=P(T,void 0,"message"),N=P(N,B.publicKey,"publicKey"),_!==void 0&&zt(_,"zip215"),n&&(T=n(T));let h=m/2,b=I.subarray(0,h),v=de(I.subarray(h,m)),L,D,k;try{L=e.fromBytes(N,_),D=e.fromBytes(b,_),k=o.multiplyUnsafe(v)}catch{return!1}if(!_&&L.isSmallOrder())return!1;let O=x(C,D.toBytes(),L.toBytes(),T);return D.add(L.multiplyUnsafe(O)).subtract(k).clearCofactor().is0()}let A=i.BYTES,B={secretKey:A,publicKey:A,signature:2*A,seed:A};function R(I=f(B.seed)){return P(I,B.seed,"seed")}function V(I){return ce(I)&&I.length===s.BYTES}function Z(I,T){try{return!!e.fromBytes(I,T)}catch{return!1}}let K={getExtendedPublicKey:y,randomSecretKey:R,isValidSecretKey:V,isValidPublicKey:Z,toMontgomery(I){let{y:T}=e.fromBytes(I),N=B.publicKey,j=N===32;if(!j&&N!==57)throw new Error("only defined for 25519 and 448");let C=j?i.div(rt+T,rt-T):i.div(T-rt,T+rt);return i.toBytes(C)},toMontgomerySecret(I){let T=B.secretKey;P(I,T);let N=t(I.subarray(0,T));return c(N).subarray(0,T)}};return Object.freeze({keygen:yr(R,w),getPublicKey:w,sign:U,verify:M,utils:K,Point:e,lengths:B})}var _c=BigInt(1),Mi=BigInt(2);var Lc=BigInt(5),Cc=BigInt(8),to=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Dc={p:to,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Cc,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function kc(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),o=BigInt(80),i=to,f=e*e%i*e%i,c=vt(f,Mi,i)*f%i,u=vt(c,_c,i)*e%i,d=vt(u,Lc,i)*u%i,l=vt(d,t,i)*d%i,y=vt(l,r,i)*l%i,w=vt(y,n,i)*y%i,x=vt(w,o,i)*w%i,U=vt(x,o,i)*w%i,E=vt(U,t,i)*d%i;return{pow_p_5_8:vt(E,Mi,i)*e%i,b2:f}}function Mc(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Ni=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Nc(e,t){let r=to,n=J(t*t*t,r),o=J(n*n*t,r),i=kc(e*o).pow_p_5_8,s=J(e*n*i,r),f=J(t*s*s,r),c=s,u=J(s*Ni,r),d=f===e,l=f===J(-e,r),y=f===J(-e*Ni,r);return d&&(s=c),(l||y)&&(s=u),pi(s,r)&&(s=J(-s,r)),{isValid:d||l,value:s}}var Pc=Di(Dc,{uvRatio:Nc});function Hc(e){return ki(Pc,vn,Object.assign({adjustScalarBytes:Mc},e))}var Pi=Hc({});var eo=32,De,ro=(De=class extends Ae{constructor(t){if(super(),typeof t=="string"?this.data=q(t):t instanceof Uint8Array?this.data=t:this.data=Uint8Array.from(t),this.data.length!==eo)throw new Error(`Invalid public key input. Expected ${eo} bytes, got ${this.data.length}`)}equals(t){return super.equals(t)}toRawBytes(){return this.data}flag(){return _t.ED25519}async verify(t,r){let n;if(typeof r=="string"){let o=ur(r);if(o.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!Se(this.toRawBytes(),o.publicKey))throw new Error("Signature does not match public key");n=o.signature}else n=r;return Pi.verify(n,t,this.toRawBytes())}},De.SIZE=eo,De);var ge=class extends Error{};ge.prototype.name="InvalidTokenError";function Vc(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function zc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Vc(t)}catch{return atob(t)}}function Hi(e,t){if(typeof e!="string")throw new ge("Invalid token specified: must be a string");t||(t={});let r=t.header===!0?0:1,n=e.split(".")[r];if(typeof n!="string")throw new ge(`Invalid token specified: missing part #${r+1}`);let o;try{o=zc(n)}catch(i){throw new ge(`Invalid token specified: invalid base64 for part #${r+1} (${i.message})`)}try{return JSON.parse(o)}catch(i){throw new ge(`Invalid token specified: invalid json for part #${r+1} (${i.message})`)}}var po=ps(ss()),ba="0x953cde026d2a36973476f4e43d7292c68278f718b1b47e5fc557d81040e804f4",Ir=class extends Jn{constructor(r){super();this.isCredenzaSponsoredTransactions=!1;let n=Hi(r.accessToken);if(!n.iss)throw new Error("Invalid token");this.credenzaApiSuiUrl=n.iss.replace("accounts","sui"),this.credenzaApiSuiUrl.includes("localhost")&&(this.credenzaApiSuiUrl=this.credenzaApiSuiUrl.replace("8081","8083").replace("https","http")),r.sponsoredTransactions&&(this.isCredenzaSponsoredTransactions=!!r.sponsoredTransactions),this.credenzaAccessToken=r.accessToken}async initialize(){let r=await fetch(`${this.credenzaApiSuiUrl}/accounts/address?public_key=true`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.credenzaAccessToken}`}}),n=await r.json();if(!r.ok)throw new Error(`Cannot initialize signer: ${n.message}`);this.credenzaAccountSuiPublicKey=n.public_key}useSponsoredTransactions(r){this.isCredenzaSponsoredTransactions=r}getGasOwner(){return this.isCredenzaSponsoredTransactions?ba:this.toSuiAddress()}async sign(r){let n=await fetch(`${this.credenzaApiSuiUrl}/accounts/sign`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.credenzaAccessToken}`},body:JSON.stringify({method:"sign",param:po.Buffer.from(r).toString("base64")})}),o=await n.json();if(!n.ok)throw new Error(`Cannot sign: ${o.message}`);let i=Xn(o.signature);if(!i.signature)throw new Error("Cannot parse signature");return i.signature}async signTransaction(r){if(!this.isCredenzaSponsoredTransactions)return super.signTransaction(r);let n=await fetch(`${this.credenzaApiSuiUrl}/accounts/sign/sponsored`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.credenzaAccessToken}`},body:JSON.stringify({param:po.Buffer.from(r).toString("base64")})}),o=await n.json();if(!n.ok)throw new Error(`Cannot sign transaction: ${o.message}`);return o}getKeyScheme(){return"ED25519"}getPublicKey(){return new ro(this.credenzaAccountSuiPublicKey)}},Ea=async e=>{let t=new Ir(e);return await t.initialize(),t};
3
3
  /*! Bundled license information:
4
4
 
5
5
  ieee754/index.js: