@joclaim/browser-extension-sdk 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,5 +19,5 @@ function Ot(e){return{hash:e,hmac:(t,...r)=>ut(e,t,function(...e){const t=new Ui
19
19
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
20
20
  const It=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),St=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),wt=BigInt(1),At=BigInt(2),Rt=(e,t)=>(e+t/At)/t;function Tt(e){const t=It,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=tt(l,r,t)*l%t,h=tt(f,r,t)*l%t,d=tt(h,At,t)*u%t,p=tt(d,o,t)*d%t,g=tt(p,i,t)*p%t,y=tt(g,a,t)*g%t,m=tt(y,c,t)*y%t,E=tt(m,a,t)*g%t,b=tt(E,r,t)*l%t,v=tt(b,s,t)*p%t,O=tt(v,n,t)*u%t,I=tt(O,At,t);if(!_t.eql(_t.sqr(I),e))throw new Error("Cannot find square root");return I}const _t=function(e,t,r=!1,n={}){if(e<=Ye)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=it(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=nt(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Me(o),ZERO:Ye,ONE:qe,create:t=>Ze(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return Ye<=t&&t<e},is0:e=>e===Ye,isOdd:e=>(e&qe)===qe,neg:t=>Ze(-t,e),eql:(e,t)=>e===t,sqr:t=>Ze(t*t,e),add:(t,r)=>Ze(t+r,e),sub:(t,r)=>Ze(t-r,e),mul:(t,r)=>Ze(t*r,e),pow:(e,t)=>function(e,t,r){if(r<Ye)throw new Error("Expected power > 0");if(r===Ye)return e.ONE;if(r===qe)return t;let n=e.ONE,o=t;for(;r>Ye;)r&qe&&(n=e.mul(n,o)),o=e.sqr(o),r>>=qe;return n}(a,e,t),div:(t,r)=>Ze(t*rt(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>rt(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n)),e.ONE),o=e.inv(n);return t.reduceRight((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n)),o),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?ke(e,i):Ge(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return r?xe(e):Ue(e)}});return Object.freeze(a)}(It,void 0,void 0,{sqrt:Tt}),Nt=function(e,t){const r=t=>vt({...e,...Ot(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:_t,n:St,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=St,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-wt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Rt(i*e,t),c=Rt(-n*e,t);let u=Ze(e-a*r-c*o,t),l=Ze(-a*n-c*i,t);const f=u>s,h=l>s;if(f&&(u=t-u),h&&(l=t-l),u>s||l>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:h,k2:l}}}},Re);BigInt(0);Nt.ProjectivePoint;const Ct=BigInt(0),Pt=BigInt(1),Lt=9007199254740991;function Dt(e,t){switch(typeof e){case"bigint":return e;case"number":return Z(Number.isInteger(e),"underflow",t||"value",e),Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(r){Z(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}Z(!1,"invalid BigNumberish value",t||"value",e)}function Ut(e,t){const r=Dt(e,t);return Q(r>=Ct,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const xt="0123456789abcdef";function Gt(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=xt[r>>4],t+=xt[15&r];return BigInt(t)}return Dt(e)}function kt(e,t){switch(typeof e){case"bigint":return Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),Number(e);case"number":return Z(Number.isInteger(e),"underflow",t||"value",e),Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return kt(BigInt(e),t)}catch(r){Z(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}Z(!1,"invalid numeric value",t||"value",e)}function Ft(e,t){let r=Ut(e,"value").toString(16);if(null==t)r.length%2&&(r="0"+r);else{const n=kt(t,"width");for(Q(2*n>=r.length,`value exceeds width (${n} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});r.length<2*n;)r="0"+r}return"0x"+r}function Bt(e){const t=Ut(e,"value");if(t===Ct)return new Uint8Array([]);let r=t.toString(16);r.length%2&&(r="0"+r);const n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++){const t=2*e;n[e]=parseInt(r.substring(t,t+2),16)}return n}const Mt="0x0000000000000000000000000000000000000000000000000000000000000000",jt=BigInt(0),Kt=BigInt(1),$t=BigInt(2),Vt=BigInt(27),Ht=BigInt(28),Yt=BigInt(35),qt={};function zt(e){return pe(Bt(e),32)}class Wt{#e;#t;#r;#n;get r(){return this.#e}set r(e){Z(32===fe(e),"invalid r","value",e),this.#e=ue(e)}get s(){return Z(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){Z(32===fe(e),"invalid s","value",e),this.#t=ue(e)}get _s(){return this.#t}isValid(){return parseInt(this.#t.substring(0,3))<8}get v(){return this.#r}set v(e){const t=kt(e,"value");Z(27===t||28===t,"invalid v","v",e),this.#r=t}get networkV(){return this.#n}get legacyChainId(){const e=this.networkV;return null==e?null:Wt.getChainId(e)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const e=oe(this.s);return this.yParity&&(e[0]|=128),ue(e)}get compactSerialized(){return le([this.r,this.yParityAndS])}get serialized(){return le([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,r,n){re(e,qt,"Signature"),this.#e=t,this.#t=r,this.#r=n,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Wt(qt,this.r,this._s,this.v);return this.networkV&&(e.#n=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:null!=e?e.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(e){const t=Dt(e,"v");return t==Vt||t==Ht?jt:(Z(t>=Yt,"invalid EIP-155 v","v",e),(t-Yt)/$t)}static getChainIdV(e,t){return Dt(e)*$t+BigInt(35+t-27)}static getNormalizedV(e){const t=Dt(e);return t===jt||t===Vt?27:t===Kt||t===Ht?28:(Z(t>=Yt,"invalid v","v",e),t&Kt?27:28)}static from(e){function t(t,r){Z(t,r,"signature",e)}if(null==e)return new Wt(qt,Mt,Mt,27);if("string"==typeof e){const r=oe(e,"signature");if(64===r.length){const e=ue(r.slice(0,32)),t=r.slice(32,64),n=128&t[0]?28:27;return t[0]&=127,new Wt(qt,e,ue(t),n)}if(65===r.length){const e=ue(r.slice(0,32)),t=ue(r.slice(32,64)),n=Wt.getNormalizedV(r[64]);return new Wt(qt,e,t,n)}t(!1,"invalid raw signature length")}if(e instanceof Wt)return e.clone();const r=e.r;t(null!=r,"missing r");const n=zt(r),o=function(e,r){if(null!=e)return zt(e);if(null!=r){t(se(r,32),"invalid yParityAndS");const e=oe(r);return e[0]&=127,ue(e)}t(!1,"missing s")}(e.s,e.yParityAndS),{networkV:i,v:s}=function(e,r,n){if(null!=e){const t=Dt(e);return{networkV:t>=Yt?t:void 0,v:Wt.getNormalizedV(t)}}if(null!=r)return t(se(r,32),"invalid yParityAndS"),{v:128&oe(r)[0]?28:27};if(null!=n){switch(kt(n,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),a=new Wt(qt,n,o,s);return i&&(a.#n=i),t(null==e.yParity||kt(e.yParity,"sig.yParity")===a.yParity,"yParity mismatch"),t(null==e.yParityAndS||e.yParityAndS===a.yParityAndS,"yParityAndS mismatch"),a}}class Jt{#o;constructor(e){Z(32===fe(e),"invalid private key","privateKey","[REDACTED]"),this.#o=ue(e)}get privateKey(){return this.#o}get publicKey(){return Jt.computePublicKey(this.#o)}get compressedPublicKey(){return Jt.computePublicKey(this.#o,!0)}sign(e){Z(32===fe(e),"invalid digest length","digest",e);const t=Nt.sign(ie(e),ie(this.#o),{lowS:!0});return Wt.from({r:Ft(t.r,32),s:Ft(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Jt.computePublicKey(e);return ue(Nt.getSharedSecret(ie(this.#o),oe(t),!1))}static computePublicKey(e,t){let r=oe(e,"key");if(32===r.length){return ue(Nt.getPublicKey(r,!!t))}if(64===r.length){const e=new Uint8Array(65);e[0]=4,e.set(r,1),r=e}return ue(Nt.ProjectivePoint.fromHex(r).toRawBytes(t))}static recoverPublicKey(e,t){Z(32===fe(e),"invalid digest length","digest",e);const r=Wt.from(t);let n=Nt.Signature.fromCompact(ie(le([r.r,r.s])));n=n.addRecoveryBit(r.yParity);const o=n.recoverPublicKey(ie(e));return Z(null!=o,"invalid signature for digest","signature",t),"0x"+o.toHex(!1)}static addPoints(e,t,r){const n=Nt.ProjectivePoint.fromHex(Jt.computePublicKey(e).substring(2)),o=Nt.ProjectivePoint.fromHex(Jt.computePublicKey(t).substring(2));return"0x"+n.add(o).toHex(!!r)}}const Xt=BigInt(0),Qt=BigInt(36);function Zt(e){const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=oe(Ee(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const er={};for(let e=0;e<10;e++)er[String(e)]=String(e);for(let e=0;e<26;e++)er[String.fromCharCode(65+e)]=String(10+e);function tr(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>er[e]).join("");for(;t.length>=15;){let e=t.substring(0,15);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}const rr=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function nr(e){if(Z("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=Zt(e);return Z(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,"bad address checksum","address",e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){Z(e.substring(2,4)===tr(e),"bad icap checksum","address",e);let t=function(e){e=e.toLowerCase();let t=Xt;for(let r=0;r<e.length;r++)t=t*Qt+rr[e[r]];return t}(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return Zt("0x"+t)}Z(!1,"invalid address","address",e)}async function or(e,t){const r=await t;return null!=r&&"0x0000000000000000000000000000000000000000"!==r||(Q("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),Z(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),nr(r)}function ir(e,t){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?nr(e):(Q(null!=t,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),or(e,t.resolveName(e))):(r=e)&&"function"==typeof r.getAddress?or(e,e.getAddress()):e&&"function"==typeof e.then?or(e,e):void Z(!1,"unsupported addressable value","target",e);var r}function sr(e,t,r,n,o){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return"OVERRUN"===e?r.length-t-1:0}Object.freeze({error:function(e,t,r,n,o){Z(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:sr,replace:function(e,t,r,n,o){return"OVERLONG"===e?(Z("number"==typeof o,"invalid bad code point for replacement","badCodepoint",o),n.push(o),0):(n.push(65533),sr(e,t,r))}});function ar(e,t){Z("string"==typeof e,"invalid string value","str",e),null!=t&&(te(t),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const o=e.charCodeAt(t);Z(t<e.length&&56320==(64512&o),"invalid surrogate pair","str",e);const i=65536+((1023&n)<<10)+(1023&o);r.push(i>>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(63&i|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return new Uint8Array(r)}function cr(e){return"string"==typeof e&&(e=ar(e)),Ee(le([ar("Ethereum Signed Message:\n"),ar(String(e.length)),e]))}function ur(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function lr(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(lr(e))}),t.length<=55)return t.unshift(192+t.length),t;const r=ur(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(oe(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=ur(t.length);return r.unshift(183+r.length),r.concat(t)}const fr="0123456789abcdef";function hr(e){let t="0x";for(const r of lr(e))t+=fr[r>>4],t+=fr[15&r];return t}function dr(e){return Z("string"==typeof e.address,"invalid address for hashAuthorization","auth.address",e),Ee(le(["0x05",hr([null!=e.chainId?Bt(e.chainId):"0x",nr(e.address),null!=e.nonce?Bt(e.nonce):"0x"])]))}function pr(e){return Ee(ar(e))}const gr=new Uint8Array(32);gr.fill(0);const yr=BigInt(-1),mr=BigInt(0),Er=BigInt(1),br=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const vr=Ft(Er,32),Or=Ft(mr,32),Ir={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Sr=["name","version","chainId","verifyingContract","salt"];function wr(e){return function(t){return Z("string"==typeof t,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Ar={name:wr("name"),version:wr("version"),chainId:function(e){const t=Dt(e,"domain.chainId");return Z(t>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(t)?Number(t):function(e){let t=ue(ae(e)?e:Bt(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}(t)},verifyingContract:function(e){try{return nr(e).toLowerCase()}catch(e){}Z(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const t=oe(e,"domain.salt");return Z(32===t.length,'invalid domain value "salt"',"domain.salt",e),ue(t)}};function Rr(e){{const t=e.match(/^(u?)int(\d+)$/);if(t){const r=""===t[1],n=parseInt(t[2]);Z(n%8==0&&0!==n&&n<=256&&t[2]===String(n),"invalid numeric width","type",e);const o=function(e,t){const r=Ut(e,"value"),n=BigInt(kt(t,"bits"));return r&(Pt<<n)-Pt}(br,r?n-1:n),i=r?(o+Er)*yr:mr;return function(t){const n=Dt(t,"value");return Z(n>=i&&n<=o,`value out-of-bounds for ${e}`,"value",n),Ft(r?function(e,t){let r=Dt(e,"value");const n=BigInt(kt(t,"width")),o=Pt<<n-Pt;if(r<Ct)return r=-r,Q(r<=o,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),(~r&(Pt<<n)-Pt)+Pt;return Q(r<o,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),r}(n,256):n,32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return Z(0!==r&&r<=32&&t[1]===String(r),"invalid bytes width","type",e),function(t){return Z(oe(t).length===r,`invalid length for ${e}`,"value",t),function(e){const t=oe(e),r=t.length%32;return r?le([t,gr.slice(r)]):ue(t)}(t)}}}switch(e){case"address":return function(e){return pe(nr(e),32)};case"bool":return function(e){return e?vr:Or};case"bytes":return function(e){return Ee(e)};case"string":return function(e){return pr(e)}}return null}function Tr(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}function _r(e){const t=e.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return t?{base:t[1],index:t[2]+t[4],array:{base:t[1],prefix:t[1]+t[2],count:t[5]?parseInt(t[5]):-1}}:{base:e}}class Nr{primaryType;#i;get types(){return JSON.parse(this.#i)}#s;#a;constructor(e){this.#s=new Map,this.#a=new Map;const t=new Map,r=new Map,n=new Map,o={};Object.keys(e).forEach(i=>{o[i]=e[i].map(({name:t,type:r})=>{let{base:n,index:o}=_r(r);return"int"!==n||e.int||(n="int256"),"uint"!==n||e.uint||(n="uint256"),{name:t,type:n+(o||"")}}),t.set(i,new Set),r.set(i,[]),n.set(i,new Set)}),this.#i=JSON.stringify(o);for(const n in o){const i=new Set;for(const s of o[n]){Z(!i.has(s.name),`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i.add(s.name);const o=_r(s.type).base;Z(o!==n,`circular type reference to ${JSON.stringify(o)}`,"types",e);Rr(o)||(Z(r.has(o),`unknown type ${JSON.stringify(o)}`,"types",e),r.get(o).push(n),t.get(n).add(o))}}const i=Array.from(r.keys()).filter(e=>0===r.get(e).length);Z(0!==i.length,"missing primary type","types",e),Z(1===i.length,`ambiguous primary types or unused types: ${i.map(e=>JSON.stringify(e)).join(", ")}`,"types",e),W(this,{primaryType:i[0]}),function o(i,s){Z(!s.has(i),`circular type reference to ${JSON.stringify(i)}`,"types",e),s.add(i);for(const e of t.get(i))if(r.has(e)){o(e,s);for(const t of s)n.get(t).add(e)}s.delete(i)}(this.primaryType,new Set);for(const[e,t]of n){const r=Array.from(t);r.sort(),this.#s.set(e,Tr(e,o[e])+r.map(e=>Tr(e,o[e])).join(""))}}getEncoder(e){let t=this.#a.get(e);return t||(t=this.#c(e),this.#a.set(e,t)),t}#c(e){{const t=Rr(e);if(t)return t}const t=_r(e).array;if(t){const e=t.prefix,r=this.getEncoder(e);return n=>{Z(-1===t.count||t.count===n.length,`array length mismatch; expected length ${t.count}`,"value",n);let o=n.map(r);return this.#s.has(e)&&(o=o.map(Ee)),Ee(le(o))}}const r=this.types[e];if(r){const t=pr(this.#s.get(e));return e=>{const n=r.map(({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this.#s.has(r)?Ee(n):n});return n.unshift(t),le(n)}}Z(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#s.get(e);return Z(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Ee(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Rr(e))return r(e,t);const n=_r(e).array;if(n)return Z(-1===n.count||n.count===t.length,`array length mismatch; expected length ${n.count}`,"value",t),t.map(e=>this._visit(n.prefix,e,r));const o=this.types[e];if(o)return o.reduce((e,{name:n,type:o})=>(e[n]=this._visit(o,t[n],r),e),{});Z(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Nr(e)}static getPrimaryType(e){return Nr.from(e).primaryType}static hashStruct(e,t,r){return Nr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(null==e[r])continue;const n=Ir[r];Z(n,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort((e,t)=>Sr.indexOf(e.name)-Sr.indexOf(t.name)),Nr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return le(["0x1901",Nr.hashDomain(e),Nr.from(t).hash(r)])}static hash(e,t,r){return Ee(Nr.encode(e,t,r))}static async resolveNames(e,t,r,n){e=Object.assign({},e);for(const t in e)null==e[t]&&delete e[t];const o={};e.verifyingContract&&!se(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const i=Nr.from(t);i.visit(r,(e,t)=>("address"!==e||se(t,20)||(o[t]="0x"),t));for(const e in o)o[e]=await n(e);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),{domain:e,value:r=i.visit(r,(e,t)=>"address"===e&&o[t]?o[t]:t)}}static getPayload(e,t,r){Nr.hashDomain(e);const n={},o=[];Sr.forEach(t=>{const r=e[t];null!=r&&(n[t]=Ar[t](r),o.push({name:t,type:Ir[t]}))});const i=Nr.from(t);t=i.types;const s=Object.assign({},t);return Z(null==s.EIP712Domain,"types must not contain EIP712Domain type","types.EIP712Domain",t),s.EIP712Domain=o,i.encode(r),{types:s,domain:n,primaryType:i.primaryType,message:i.visit(r,(e,t)=>{if(e.match(/^bytes(\d*)/))return ue(oe(t));if(e.match(/^u?int/))return Dt(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return Z("string"==typeof t,"invalid string","value",t),t}Z(!1,"unsupported type","type",e)})}}}const Cr="0x0000000000000000000000000000000000000000";function Pr(e,r,n,o){i(e);const s=T({dkLen:32,asyncTick:10},o),{c:a,dkLen:c,asyncTick:u}=s;if(t(a),t(c),t(u),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=w(r),f=w(n),h=new Uint8Array(c),d=ut.create(e,l),p=d._cloneInto().update(f);return{c:a,dkLen:c,asyncTick:u,DK:h,PRF:d,PRFSalt:p}}function Lr(e,t,r,n,o){return e.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),r}function Dr(e,t,r,n){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=Pr(e,t,r,n);let u;const l=new Uint8Array(4),f=v(l),h=new Uint8Array(a.outputLen);for(let e=1,t=0;t<i;e++,t+=a.outputLen){const r=s.subarray(t,t+a.outputLen);f.setInt32(0,e,!1),(u=c._cloneInto(u)).update(l).digestInto(h),r.set(h.subarray(0,r.length));for(let e=1;e<o;e++){a._cloneInto(u).update(h).digestInto(h);for(let e=0;e<r.length;e++)r[e]^=h[e]}}return Lr(a,c,s,u,h)}const[Ur,xr]=(()=>y.split(["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))))(),Gr=new Uint32Array(80),kr=new Uint32Array(80);class Fr extends be{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:f,Gh:h,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,g]}set(e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)Gr[r]=e.getUint32(t),kr[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Gr[e-15],r=0|kr[e-15],n=y.rotrSH(t,r,1)^y.rotrSH(t,r,8)^y.shrSH(t,r,7),o=y.rotrSL(t,r,1)^y.rotrSL(t,r,8)^y.shrSL(t,r,7),i=0|Gr[e-2],s=0|kr[e-2],a=y.rotrSH(i,s,19)^y.rotrBH(i,s,61)^y.shrSH(i,s,6),c=y.rotrSL(i,s,19)^y.rotrBL(i,s,61)^y.shrSL(i,s,6),u=y.add4L(o,c,kr[e-7],kr[e-16]),l=y.add4H(u,n,a,Gr[e-7],Gr[e-16]);Gr[e]=0|l,kr[e]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:f,Fh:h,Fl:d,Gh:p,Gl:g,Hh:m,Hl:E}=this;for(let e=0;e<80;e++){const t=y.rotrSH(l,f,14)^y.rotrSH(l,f,18)^y.rotrBH(l,f,41),b=y.rotrSL(l,f,14)^y.rotrSL(l,f,18)^y.rotrBL(l,f,41),v=l&h^~l&p,O=f&d^~f&g,I=y.add5L(E,b,O,xr[e],kr[e]),S=y.add5H(I,m,t,v,Ur[e],Gr[e]),w=0|I,A=y.rotrSH(r,n,28)^y.rotrBH(r,n,34)^y.rotrBH(r,n,39),R=y.rotrSL(r,n,28)^y.rotrBL(r,n,34)^y.rotrBL(r,n,39),T=r&o^r&s^o&s,_=n&i^n&a^i&a;m=0|p,E=0|g,p=0|h,g=0|d,h=0|l,d=0|f,({h:l,l:f}=y.add(0|c,0|u,0|S,0|w)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const N=y.add3L(w,R,_);r=y.add3H(N,S,A,T),n=0|N}({h:r,l:n}=y.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=y.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=y.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=y.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=y.add(0|this.Eh,0|this.El,0|l,0|f)),({h,l:d}=y.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:g}=y.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:E}=y.add(0|this.Hh,0|this.Hl,0|m,0|E)),this.set(r,n,o,i,s,a,c,u,l,f,h,d,p,g,m,E)}roundClean(){Gr.fill(0),kr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Br=_(()=>new Fr);const Mr=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}(),jr=Mr.crypto||Mr.msCrypto;function Kr(e){switch(e){case"sha256":return Re.create();case"sha512":return Br.create()}Z(!1,"invalid hashing algorithm name","algorithm",e)}const $r=function(e){return Kr("sha256").update(e).digest()},Vr=function(e){return Kr("sha512").update(e).digest()};let Hr=$r,Yr=Vr,qr=!1,zr=!1;function Wr(e){const t=oe(e,"data");return ue(Hr(t))}function Jr(e){const t=oe(e,"data");return ue(Yr(t))}function Xr(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function Qr(e,t,r){let n=0;for(let o=0;o<r;o++)n=256*n+e[t+o];return n}function Zr(e,t,r,n){const o=[];for(;r<t+1+n;){const i=en(e,r);o.push(i.result),Q((r+=i.consumed)<=t+1+n,"child data too short","BUFFER_OVERRUN",{buffer:e,length:n,offset:t})}return{consumed:1+n,result:o}}function en(e,t){Q(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{Q(t<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:t})};if(e[t]>=248){const n=e[t]-247;r(t+1+n);const o=Qr(e,t+1,n);return r(t+1+n+o),Zr(e,t,t+1+n,n+o)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),Zr(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const o=Qr(e,t+1,n);r(t+1+n+o);return{consumed:1+n+o,result:ue(e.slice(t+1+n,t+1+n+o))}}if(e[t]>=128){const n=e[t]-128;r(t+1+n);return{consumed:1+n,result:ue(e.slice(t+1,t+1+n))}}return{consumed:1,result:Xr(e[t])}}function tn(e){const t=oe(e,"data"),r=en(t,0);return Z(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function rn(e,t){return{address:nr(e),storageKeys:t.map((e,t)=>(Z(se(e,32),"invalid slot",`storageKeys[${t}]`,e),e.toLowerCase()))}}function nn(e){if(Array.isArray(e))return e.map((t,r)=>Array.isArray(t)?(Z(2===t.length,"invalid slot set",`value[${r}]`,t),rn(t[0],t[1])):(Z(null!=t&&"object"==typeof t,"invalid address-slot set","value",e),rn(t.address,t.storageKeys)));Z(null!=e&&"object"==typeof e,"invalid access list","value",e);const t=Object.keys(e).map(t=>{const r=e[t].reduce((e,t)=>(e[t]=!0,e),{});return rn(t,Object.keys(r).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function on(e){let t;return t="string"==typeof e?Jt.computePublicKey(e,!1):e.publicKey,nr(Ee("0x"+t.substring(4)).substring(26))}Wr._=$r,Wr.lock=function(){qr=!0},Wr.register=function(e){if(qr)throw new Error("sha256 is locked");Hr=e},Object.freeze(Wr),Jr._=Vr,Jr.lock=function(){zr=!0},Jr.register=function(e){if(zr)throw new Error("sha512 is locked");Yr=e},Object.freeze(Wr);const sn=BigInt(0),an=BigInt(2),cn=BigInt(27),un=BigInt(28),ln=BigInt(35),fn=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),hn=131072;function dn(e,t){let r=e.toString(16);for(;r.length<2;)r="0"+r;return r+=Wr(t).substring(4),"0x"+r}function pn(e){return"0x"===e?null:nr(e)}function gn(e,t){try{return nn(e)}catch(r){Z(!1,r.message,t,e)}}function yn(e,t){try{if(!Array.isArray(e))throw new Error("authorizationList: invalid array");const t=[];for(let r=0;r<e.length;r++){const n=e[r];if(!Array.isArray(n))throw new Error(`authorization[${r}]: invalid array`);if(6!==n.length)throw new Error(`authorization[${r}]: wrong length`);if(!n[1])throw new Error(`authorization[${r}]: null address`);t.push({address:pn(n[1]),nonce:En(n[2],"nonce"),chainId:En(n[0],"chainId"),signature:Wt.from({yParity:mn(n[3],"yParity"),r:pe(n[4],32),s:pe(n[5],32)})})}return t}catch(r){Z(!1,r.message,t,e)}}function mn(e,t){return"0x"===e?0:kt(e,t)}function En(e,t){if("0x"===e)return sn;const r=Dt(e,t);return Z(r<=fn,"value exceeds uint size",t,r),r}function bn(e,t){const r=Dt(e,"value"),n=Bt(r);return Z(n.length<=32,"value too large",`tx.${t}`,r),n}function vn(e){return nn(e).map(e=>[e.address,e.storageKeys])}function On(e,t){Z(Array.isArray(e),`invalid ${t}`,"value",e);for(let t=0;t<e.length;t++)Z(se(e[t],32),"invalid ${ param } hash",`value[${t}]`,e[t]);return e}function In(e,t){let r;try{if(r=mn(t[0],"yParity"),0!==r&&1!==r)throw new Error("bad yParity")}catch(e){Z(!1,"invalid yParity","yParity",t[0])}const n=pe(t[1],32),o=pe(t[2],32),i=Wt.from({r:n,s:o,yParity:r});e.signature=i}class Sn{#u;#l;#f;#h;#d;#p;#g;#y;#m;#E;#b;#v;#O;#I;#S;#w;#A;get type(){return this.#u}set type(e){switch(e){case null:this.#u=null;break;case 0:case"legacy":this.#u=0;break;case 1:case"berlin":case"eip-2930":this.#u=1;break;case 2:case"london":case"eip-1559":this.#u=2;break;case 3:case"cancun":case"eip-4844":this.#u=3;break;case 4:case"pectra":case"eip-7702":this.#u=4;break;default:Z(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=this.#l;return null==e&&3===this.type?Cr:e}set to(e){this.#l=null==e?null:nr(e)}get nonce(){return this.#h}set nonce(e){this.#h=kt(e,"value")}get gasLimit(){return this.#d}set gasLimit(e){this.#d=Dt(e)}get gasPrice(){const e=this.#p;return null!=e||0!==this.type&&1!==this.type?e:sn}set gasPrice(e){this.#p=null==e?null:Dt(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#g;return null==e?2===this.type||3===this.type?sn:null:e}set maxPriorityFeePerGas(e){this.#g=null==e?null:Dt(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#y;return null==e?2===this.type||3===this.type?sn:null:e}set maxFeePerGas(e){this.#y=null==e?null:Dt(e,"maxFeePerGas")}get data(){return this.#f}set data(e){this.#f=ue(e)}get value(){return this.#m}set value(e){this.#m=Dt(e,"value")}get chainId(){return this.#E}set chainId(e){this.#E=Dt(e)}get signature(){return this.#b||null}set signature(e){this.#b=null==e?null:Wt.from(e)}get accessList(){const e=this.#v||null;return null==e?1===this.type||2===this.type||3===this.type?[]:null:e}set accessList(e){this.#v=null==e?null:nn(e)}get authorizationList(){const e=this.#A||null;return null==e&&4===this.type?[]:e}set authorizationList(e){this.#A=null==e?null:e.map(e=>{return{address:nr((t=e).address),nonce:Dt(null!=t.nonce?t.nonce:0),chainId:Dt(null!=t.chainId?t.chainId:0),signature:Wt.from(t.signature)};var t})}get maxFeePerBlobGas(){const e=this.#O;return null==e&&3===this.type?sn:e}set maxFeePerBlobGas(e){this.#O=null==e?null:Dt(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#I;return null==e&&3===this.type?[]:e}set blobVersionedHashes(e){if(null!=e){Z(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)Z(se(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}this.#I=e}get blobs(){return null==this.#w?null:this.#w.map(e=>Object.assign({},e))}set blobs(e){if(null==e)return void(this.#w=null);const t=[],r=[];for(let n=0;n<e.length;n++){const o=e[n];if(ae(o)){Q(this.#S,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let e=oe(o);if(Z(e.length<=hn,"blob is too large",`blobs[${n}]`,o),e.length!==hn){const t=new Uint8Array(hn);t.set(e),e=t}const i=this.#S.blobToKzgCommitment(e),s=ue(this.#S.computeBlobKzgProof(e,i));t.push({data:ue(e),commitment:ue(i),proof:s}),r.push(dn(1,i))}else{const e=ue(o.commitment);t.push({data:ue(o.data),commitment:e,proof:ue(o.proof)}),r.push(dn(1,e))}}this.#w=t,this.#I=r}get kzg(){return this.#S}set kzg(e){this.#S=null==e?null:function(e){return{blobToKzgCommitment:t=>{if("computeBlobProof"in e){if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return oe(e.blobToKzgCommitment(ue(t)))}else if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return oe(e.blobToKzgCommitment(t));if("blobToKZGCommitment"in e&&"function"==typeof e.blobToKZGCommitment)return oe(e.blobToKZGCommitment(ue(t)));Z(!1,"unsupported KZG library","kzg",e)},computeBlobKzgProof:(t,r)=>"computeBlobProof"in e&&"function"==typeof e.computeBlobProof?oe(e.computeBlobProof(ue(t),ue(r))):"computeBlobKzgProof"in e&&"function"==typeof e.computeBlobKzgProof?e.computeBlobKzgProof(t,r):"computeBlobKZGProof"in e&&"function"==typeof e.computeBlobKZGProof?oe(e.computeBlobKZGProof(ue(t),ue(r))):void Z(!1,"unsupported KZG library","kzg",e)}}(e)}constructor(){this.#u=null,this.#l=null,this.#h=0,this.#d=sn,this.#p=null,this.#g=null,this.#y=null,this.#f="0x",this.#m=sn,this.#E=sn,this.#b=null,this.#v=null,this.#O=null,this.#I=null,this.#S=null,this.#w=null,this.#A=null}get hash(){return null==this.signature?null:Ee(this.#R(!0,!1))}get unsignedHash(){return Ee(this.unsignedSerialized)}get from(){return null==this.signature?null:(e=this.unsignedHash,t=this.signature,on(Jt.recoverPublicKey(e,t)));var e,t}get fromPublicKey(){return null==this.signature?null:Jt.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return null!=this.signature}#R(e,t){Q(!e||null!=this.signature,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return function(e,t){const r=[bn(e.nonce,"nonce"),bn(e.gasPrice||0,"gasPrice"),bn(e.gasLimit,"gasLimit"),e.to||"0x",bn(e.value,"value"),e.data];let n=sn;if(e.chainId!=sn)n=Dt(e.chainId,"tx.chainId"),Z(!t||null==t.networkV||t.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",t);else if(e.signature){const t=e.signature.legacyChainId;null!=t&&(n=t)}if(!t)return n!==sn&&(r.push(Bt(n)),r.push("0x"),r.push("0x")),hr(r);let o=BigInt(27+t.yParity);return n!==sn?o=Wt.getChainIdV(n,t.v):BigInt(t.v)!==o&&Z(!1,"tx.chainId/sig.v mismatch","sig",t),r.push(Bt(o)),r.push(Bt(t.r)),r.push(Bt(t.s)),hr(r)}(this,r);case 1:return function(e,t){const r=[bn(e.chainId,"chainId"),bn(e.nonce,"nonce"),bn(e.gasPrice||0,"gasPrice"),bn(e.gasLimit,"gasLimit"),e.to||"0x",bn(e.value,"value"),e.data,vn(e.accessList||[])];return t&&(r.push(bn(t.yParity,"recoveryParam")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x01",hr(r)])}(this,r);case 2:return function(e,t){const r=[bn(e.chainId,"chainId"),bn(e.nonce,"nonce"),bn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),bn(e.maxFeePerGas||0,"maxFeePerGas"),bn(e.gasLimit,"gasLimit"),e.to||"0x",bn(e.value,"value"),e.data,vn(e.accessList||[])];return t&&(r.push(bn(t.yParity,"yParity")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x02",hr(r)])}(this,r);case 3:return function(e,t,r){const n=[bn(e.chainId,"chainId"),bn(e.nonce,"nonce"),bn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),bn(e.maxFeePerGas||0,"maxFeePerGas"),bn(e.gasLimit,"gasLimit"),e.to||Cr,bn(e.value,"value"),e.data,vn(e.accessList||[]),bn(e.maxFeePerBlobGas||0,"maxFeePerBlobGas"),On(e.blobVersionedHashes||[],"blobVersionedHashes")];return t&&(n.push(bn(t.yParity,"yParity")),n.push(Bt(t.r)),n.push(Bt(t.s)),r)?le(["0x03",hr([n,r.map(e=>e.data),r.map(e=>e.commitment),r.map(e=>e.proof)])]):le(["0x03",hr(n)])}(this,r,t?this.blobs:null);case 4:return function(e,t){const r=[bn(e.chainId,"chainId"),bn(e.nonce,"nonce"),bn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),bn(e.maxFeePerGas||0,"maxFeePerGas"),bn(e.gasLimit,"gasLimit"),e.to||"0x",bn(e.value,"value"),e.data,vn(e.accessList||[]),(n=e.authorizationList||[],n.map(e=>[bn(e.chainId,"chainId"),e.address,bn(e.nonce,"nonce"),bn(e.signature.yParity,"yParity"),Bt(e.signature.r),Bt(e.signature.s)]))];var n;return t&&(r.push(bn(t.yParity,"yParity")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x04",hr(r)])}(this,r)}Q(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#R(!0,!0)}get unsignedSerialized(){return this.#R(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=null!=this.gasPrice,t=null!=this.maxFeePerGas||null!=this.maxPriorityFeePerGas,r=null!=this.accessList,n=null!=this.#O||this.#I;null!=this.maxFeePerGas&&null!=this.maxPriorityFeePerGas&&Q(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Q(!t||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Q(0!==this.type||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const o=[];return null!=this.type?o.push(this.type):this.authorizationList&&this.authorizationList.length?o.push(4):t?o.push(2):e?(o.push(1),r||o.push(0)):r?(o.push(1),o.push(2)):(n&&this.to||(o.push(0),o.push(1),o.push(2)),o.push(3)),o.sort(),o}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}clone(){return Sn.from(this)}toJSON(){const e=e=>null==e?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(null==e)return new Sn;if("string"==typeof e){const t=oe(e);if(t[0]>=127)return Sn.from(function(e){const t=tn(e);Z(Array.isArray(t)&&(9===t.length||6===t.length),"invalid field count for legacy transaction","data",e);const r={type:0,nonce:mn(t[0],"nonce"),gasPrice:En(t[1],"gasPrice"),gasLimit:En(t[2],"gasLimit"),to:pn(t[3]),value:En(t[4],"value"),data:ue(t[5]),chainId:sn};if(6===t.length)return r;const n=En(t[6],"v"),o=En(t[7],"r"),i=En(t[8],"s");if(o===sn&&i===sn)r.chainId=n;else{let e=(n-ln)/an;e<sn&&(e=sn),r.chainId=e,Z(e!==sn||n===cn||n===un,"non-canonical legacy v","v",t[6]),r.signature=Wt.from({r:pe(t[7],32),s:pe(t[8],32),v:n})}return r}(t));switch(t[0]){case 1:return Sn.from(function(e){const t=tn(oe(e).slice(1));Z(Array.isArray(t)&&(8===t.length||11===t.length),"invalid field count for transaction type: 1","data",ue(e));const r={type:1,chainId:En(t[0],"chainId"),nonce:mn(t[1],"nonce"),gasPrice:En(t[2],"gasPrice"),gasLimit:En(t[3],"gasLimit"),to:pn(t[4]),value:En(t[5],"value"),data:ue(t[6]),accessList:gn(t[7],"accessList")};return 8===t.length||In(r,t.slice(8)),r}(t));case 2:return Sn.from(function(e){const t=tn(oe(e).slice(1));Z(Array.isArray(t)&&(9===t.length||12===t.length),"invalid field count for transaction type: 2","data",ue(e));const r={type:2,chainId:En(t[0],"chainId"),nonce:mn(t[1],"nonce"),maxPriorityFeePerGas:En(t[2],"maxPriorityFeePerGas"),maxFeePerGas:En(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:En(t[4],"gasLimit"),to:pn(t[5]),value:En(t[6],"value"),data:ue(t[7]),accessList:gn(t[8],"accessList")};return 9===t.length||In(r,t.slice(9)),r}(t));case 3:return Sn.from(function(e){let t=tn(oe(e).slice(1)),r="3",n=null;if(4===t.length&&Array.isArray(t[0])){r="3 (network format)";const e=t[1],o=t[2],i=t[3];Z(Array.isArray(e),"invalid network format: blobs not an array","fields[1]",e),Z(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),Z(Array.isArray(i),"invalid network format: proofs not an array","fields[3]",i),Z(e.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",t),Z(e.length===i.length,"invalid network format: blobs/proofs length mismatch","fields",t),n=[];for(let r=0;r<t[1].length;r++)n.push({data:e[r],commitment:o[r],proof:i[r]});t=t[0]}Z(Array.isArray(t)&&(11===t.length||14===t.length),`invalid field count for transaction type: ${r}`,"data",ue(e));const o={type:3,chainId:En(t[0],"chainId"),nonce:mn(t[1],"nonce"),maxPriorityFeePerGas:En(t[2],"maxPriorityFeePerGas"),maxFeePerGas:En(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:En(t[4],"gasLimit"),to:pn(t[5]),value:En(t[6],"value"),data:ue(t[7]),accessList:gn(t[8],"accessList"),maxFeePerBlobGas:En(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10]};n&&(o.blobs=n),Z(null!=o.to,`invalid address for transaction type: ${r}`,"data",e),Z(Array.isArray(o.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",e);for(let t=0;t<o.blobVersionedHashes.length;t++)Z(se(o.blobVersionedHashes[t],32),`invalid blobVersionedHash at index ${t}: must be length 32`,"data",e);return 11===t.length||In(o,t.slice(11)),o}(t));case 4:return Sn.from(function(e){const t=tn(oe(e).slice(1));Z(Array.isArray(t)&&(10===t.length||13===t.length),"invalid field count for transaction type: 4","data",ue(e));const r={type:4,chainId:En(t[0],"chainId"),nonce:mn(t[1],"nonce"),maxPriorityFeePerGas:En(t[2],"maxPriorityFeePerGas"),maxFeePerGas:En(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:En(t[4],"gasLimit"),to:pn(t[5]),value:En(t[6],"value"),data:ue(t[7]),accessList:gn(t[8],"accessList"),authorizationList:yn(t[9],"authorizationList")};return 10===t.length||In(r,t.slice(10)),r}(t))}Q(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Sn;return null!=e.type&&(t.type=e.type),null!=e.to&&(t.to=e.to),null!=e.nonce&&(t.nonce=e.nonce),null!=e.gasLimit&&(t.gasLimit=e.gasLimit),null!=e.gasPrice&&(t.gasPrice=e.gasPrice),null!=e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),null!=e.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null!=e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),null!=e.data&&(t.data=e.data),null!=e.value&&(t.value=e.value),null!=e.chainId&&(t.chainId=e.chainId),null!=e.signature&&(t.signature=Wt.from(e.signature)),null!=e.accessList&&(t.accessList=e.accessList),null!=e.authorizationList&&(t.authorizationList=e.authorizationList),null!=e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),null!=e.kzg&&(t.kzg=e.kzg),null!=e.blobs&&(t.blobs=e.blobs),null!=e.hash&&(Z(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),Z(t.hash===e.hash,"hash mismatch","tx",e)),null!=e.from&&(Z(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),Z(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}BigInt(0);function wn(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=ue(e.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const n of r)n in e&&null!=e[n]&&(t[n]=Dt(e[n],`request.${n}`));const n="type,nonce".split(/,/);for(const r of n)r in e&&null!=e[r]&&(t[r]=kt(e[r],`request.${r}`));return e.accessList&&(t.accessList=nn(e.accessList)),e.authorizationList&&(t.authorizationList=e.authorizationList.slice()),"blockTag"in e&&(t.blockTag=e.blockTag),"enableCcipRead"in e&&(t.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(t.customData=e.customData),"blobVersionedHashes"in e&&e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.slice()),"kzg"in e&&(t.kzg=e.kzg),"blobs"in e&&e.blobs&&(t.blobs=e.blobs.map(e=>ae(e)?ue(e):Object.assign({},e))),t}Symbol.iterator;Symbol.iterator;function An(e,t){if(e.provider)return e.provider;Q(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Rn(e,t){let r=wn(t);if(null!=r.to&&(r.to=ir(r.to,e)),null!=r.from){const t=r.from;r.from=Promise.all([e.getAddress(),ir(t,e)]).then(([e,t])=>(Z(e.toLowerCase()===t.toLowerCase(),"transaction from mismatch","tx.from",t),e))}else r.from=e.getAddress();return await z(r)}class Tn{provider;constructor(e){W(this,{provider:e||null})}async getNonce(e){return An(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Rn(this,e)}async populateTransaction(e){const t=An(this,"populateTransaction"),r=await Rn(this,e);null==r.nonce&&(r.nonce=await this.getNonce("pending")),null==r.gasLimit&&(r.gasLimit=await this.estimateGas(r));const n=await this.provider.getNetwork();if(null!=r.chainId){Z(Dt(r.chainId)===n.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=n.chainId;const o=null!=r.maxFeePerGas||null!=r.maxPriorityFeePerGas;if(null==r.gasPrice||2!==r.type&&!o?0!==r.type&&1!==r.type||!o||Z(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e):Z(!1,"eip-1559 transaction do not support gasPrice","tx",e),2!==r.type&&null!=r.type||null==r.maxFeePerGas||null==r.maxPriorityFeePerGas)if(0===r.type||1===r.type){const e=await t.getFeeData();Q(null!=e.gasPrice,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice)}else{const e=await t.getFeeData();if(null==r.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,null!=r.gasPrice){const e=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=e,r.maxPriorityFeePerGas=e}else null==r.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(Q(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice),r.type=0):Q(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else 2!==r.type&&3!==r.type&&4!==r.type||(null==r.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else r.type=2;return await z(r)}async populateAuthorization(e){const t=Object.assign({},e);return null==t.chainId&&(t.chainId=(await An(this,"getNetwork").getNetwork()).chainId),null==t.nonce&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return An(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return An(this,"call").call(await this.populateCall(e))}async resolveName(e){const t=An(this,"resolveName");return await t.resolveName(e)}async sendTransaction(e){const t=An(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const n=Sn.from(r);return await t.broadcastTransaction(await this.signTransaction(n))}authorize(e){Q(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class _n extends Tn{address;constructor(e,t){super(t),W(this,{address:e})}async getAddress(){return this.address}connect(e){return new _n(this.address,e)}#T(e,t){Q(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:t})}async signTransaction(e){this.#T("transactions","signTransaction")}async signMessage(e){this.#T("messages","signMessage")}async signTypedData(e,t,r){this.#T("typed-data","signTypedData")}}class Nn extends Tn{address;#_;constructor(e,t){super(t),Z(e&&"function"==typeof e.sign,"invalid private key","privateKey","[ REDACTED ]"),this.#_=e;W(this,{address:on(this.signingKey.publicKey)})}get signingKey(){return this.#_}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new Nn(this.#_,e)}async signTransaction(e){e=wn(e);const{to:t,from:r}=await z({to:e.to?ir(e.to,this):void 0,from:e.from?ir(e.from,this):void 0});null!=t&&(e.to=t),null!=r&&(e.from=r),null!=e.from&&(Z(nr(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const n=Sn.from(e);return n.signature=this.signingKey.sign(n.unsignedHash),n.serialized}async signMessage(e){return this.signMessageSync(e)}signMessageSync(e){return this.signingKey.sign(cr(e)).serialized}authorizeSync(e){Z("string"==typeof e.address,"invalid address for authorizeSync","auth.address",e);const t=this.signingKey.sign(dr(e));return Object.assign({},{address:nr(e.address),nonce:Dt(e.nonce||0),chainId:Dt(e.chainId||0)},{signature:t})}async authorize(e){return e=Object.assign({},e,{address:await ir(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,t,r){const n=await Nr.resolveNames(e,t,r,async e=>{Q(null!=this.provider,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:e}});const t=await this.provider.resolveName(e);return Q(null!=t,"unconfigured ENS name","UNCONFIGURED_NAME",{value:e}),t});return this.signingKey.sign(Nr.hash(n.domain,t,n.value)).serialized}}let Cn=!1;const Pn=function(e,t,r){return function(e,t){const r={sha256:Re,sha512:Br}[e];return Z(null!=r,"invalid hmac algorithm","algorithm",e),ut.create(r,t)}(e,t).update(r).digest()};let Ln=Pn;function Dn(e,t,r){const n=oe(t,"key"),o=oe(r,"data");return ue(Ln(e,n,o))}Dn._=Pn,Dn.lock=function(){Cn=!0},Dn.register=function(e){if(Cn)throw new Error("computeHmac is locked");Ln=e},Object.freeze(Dn);const Un=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),xn=Uint8Array.from({length:16},(e,t)=>t);let Gn=[xn],kn=[xn.map(e=>(9*e+5)%16)];for(let e=0;e<4;e++)for(let t of[Gn,kn])t.push(t[e].map(e=>Un[e]));const Fn=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),Bn=Gn.map((e,t)=>e.map(e=>Fn[t][e])),Mn=kn.map((e,t)=>e.map(e=>Fn[t][e])),jn=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kn=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),$n=(e,t)=>e<<t|e>>>32-t;function Vn(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const Hn=new Uint32Array(16);class Yn extends be{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:o}=this;return[e,t,r,n,o]}set(e,t,r,n,o){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)Hn[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,i=o,s=0|this.h2,a=s,c=0|this.h3,u=c,l=0|this.h4,f=l;for(let e=0;e<5;e++){const t=4-e,h=jn[e],d=Kn[e],p=Gn[e],g=kn[e],y=Bn[e],m=Mn[e];for(let t=0;t<16;t++){const n=$n(r+Vn(e,o,s,c)+Hn[p[t]]+h,y[t])+l|0;r=l,l=c,c=0|$n(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=$n(n+Vn(t,i,a,u)+Hn[g[e]]+d,m[e])+f|0;n=f,f=u,u=0|$n(a,10),a=i,i=r}}this.set(this.h1+s+u|0,this.h2+c+f|0,this.h3+l+n|0,this.h4+r+i|0,this.h0+o+a|0)}roundClean(){Hn.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const qn=_(()=>new Yn);let zn=!1;const Wn=function(e){return qn(e)};let Jn=Wn;function Xn(e){const t=oe(e,"data");return ue(Jn(t))}Xn._=Wn,Xn.lock=function(){zn=!0},Xn.register=function(e){if(zn)throw new TypeError("ripemd160 is locked");Jn=e},Object.freeze(Xn);let Qn=!1;const Zn=function(e){return new Uint8Array(function(e){Q(null!=jr,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),Z(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);const t=new Uint8Array(e);return jr.getRandomValues(t),t}(e))};let eo=Zn;function to(e){return eo(e)}to._=Zn,to.lock=function(){Qn=!0},to.register=function(e){if(Qn)throw new Error("randomBytes is locked");eo=e},Object.freeze(to);const ro="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let no=null;function oo(e){if(null==no){no={};for(let e=0;e<58;e++)no[ro[e]]=BigInt(e)}const t=no[e];return Z(null!=t,"invalid base58 value","letter",e),t}const io=BigInt(0),so=BigInt(58);const ao=" !#$%&'()*+,-./<=>?@[]^_`{|}~",co=/^[a-z]*$/i;function uo(e,t){let r=97;return e.reduce((e,n)=>(n===t?r++:n.match(co)?e.push(String.fromCharCode(r)+n):(r=97,e.push(n)),e),[])}function lo(e){return Z("0"===e[0],"unsupported auwl data","data",e),function(e,t){for(let r=28;r>=0;r--)e=e.split(ao[r]).join(t.substring(2*r,2*r+2));const r=[],n=e.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(e,t,n,o)=>{if(n)for(let e=parseInt(n);e>=0;e--)r.push(";");else r.push(t.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return uo(uo(r,";"),":")}(e.substring(59),e.substring(1,59))}class fo{locale;constructor(e){W(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class ho extends fo{#f;#N;constructor(e,t,r){super(e),this.#f=t,this.#N=r,this.#C=null}get _data(){return this.#f}_decodeWords(){return lo(this.#f)}#C;#P(){if(null==this.#C){const e=this._decodeWords();if(pr(e.join("\n")+"\n")!==this.#N)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#C=e}return this.#C}getWord(e){const t=this.#P();return Z(e>=0&&e<t.length,`invalid word index: ${e}`,"index",e),t[e]}getWordIndex(e){return this.#P().indexOf(e)}}let po=null;class go extends ho{constructor(){super("en","0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN<aNn RRelyRga(R*lSeS-SketTt!3A^AnAutyCau'ComeEfF%eG(Ha=H(dLie=LowLtN^Nef./TrayTt Twe&Y#d3Cyc!DKeNdOlogyRdR`Tt _{AdeAmeAnketA,EakE[IndOodO[omOu'UeUrUsh_rdAtDyIlMbNeNusOkO,Rd R(gRrowSsTtomUn)XY_{etA(AndA[A=EadEezeI{Id+IefIghtIngIskOccoliOk&OnzeOomO` OwnUsh2Bb!DdyD+tFf$oIldLbLkL!tNd!Nk Rd&Rg R,SS(e[SyTt Y Zz:Bba+B(B!CtusGeKe~LmM aMpNN$N)lNdyNn#NoeNvasNy#Pab!P.$Pta(RRb#RdRgoRpetRryRtSeShS(o/!Su$TT$ogT^Teg%yTt!UghtU'Ut]Ve3Il(gL yM|NsusNturyRe$Rta(_irAlkAmp]An+AosApt Ar+A'AtEapE{Ee'EfErryE,I{&IefIldIm}yOi)Oo'R#-U{!UnkUrn0G?Nnam#Rc!Tiz&TyVil_imApArifyAwAyE<ErkEv I{I|IffImbIn-IpO{OgO'O`OudOwnUbUmpU, Ut^_^A,C#utDeFfeeIlInL!@L%LumnMb(eMeMf%tM-Mm#Mp<yNc tNdu@NfirmNg*[N}@Nsid NtrolNv()OkOlPp PyR$ReRnR*@/Tt#U^UntryUp!Ur'Us(V Yo>_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M<dMi'Ni$Nti,NyP?tP&dPos.P`PutyRi=ScribeS tSignSkSpair/royTailTe@VelopVi)Vo>3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-Eg<tEm|Eph<tEvat%I>Se0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-P<dPe@Pi*Pla(Po'P*[T&dTra0EEbrow:Br-CeCultyDeIntI`~L'MeMilyMousNNcyNtasyRmSh]TT$Th TigueUltV%.e3Atu*Bru?yD $EEdElMa!N)/iv$T^V W3B Ct]EldGu*LeLmLt N$NdNeNg NishReRmR,Sc$ShTT}[X_gAmeAshAtAv%EeIghtIpOatO{O%Ow UidUshY_mCusGIlLd~owOdOtR)Re,R+tRkRtu}RumRw?dSsil/ UndX_gi!AmeEqu|EshI&dIn+OgOntO,OwnOz&U.2ElNNnyRna)RyTu*:D+tInLaxy~ yMePRa+Rba+Rd&Rl-Rm|SSpTeTh U+Ze3N $NiusN*Nt!Nu(e/u*2O,0AntFtGg!Ng RaffeRlVe_dAn)A*A[IdeImp'ObeOomOryO=OwUe_tDde[LdOdO'RillaSpelSsipV nWn_bA)A(AntApeA[Av.yEatE&IdIefItOc yOupOwUnt_rdE[IdeIltIt?N3M:B.IrLfMm M, NdPpyRb%RdRshR=,TVeWkZ?d3AdAl`ArtAvyD+hogIght~oLmetLpNRo3Dd&Gh~NtPRe/%y5BbyCkeyLdLeLiday~owMeNeyOdPeRnRr%R'Sp.$/TelUrV 5BGeM<Mb!M%Nd*dNgryNtRd!RryRtSb<d3Brid:1EOn0EaEntifyLe2N%e4LLeg$L}[0A+Ita>M&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryF<tFl-tF%mHa!H .Iti$Je@JuryMa>N Noc|PutQuiryS<eSe@SideSpi*/$lTa@T e,ToVe,V.eVol=3On0L<dOla>Sue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurE<Tob 0Or1FF Fi)T&2L1Ay0DI=Ymp-0It0CeEI#L(eLy1EnEraIn]Po'T]1An+B.Ch?dD D(?yG<I|Ig($Ph<0Tr-h0H 0Tdo%T TputTside0AlEnEr0NN 0Yg&0/ 0O}:CtDd!GeIrLa)LmNdaNelN-N` P RadeR|RkRrotRtySsT^ThTi|TrolTt nU'VeYm|3A)AnutArAs<tL-<NN$tyNcilOp!Pp Rfe@Rm.Rs#T2O}OtoRa'Ys-$0AnoCn-Ctu*E)GGe#~LotNkO} Pe/olT^Zza_)A}tA,-A>AyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOg<OtOwUsh0AllArtI!OkeOo`0A{AkeApIffOw0ApCc Ci$CkDaFtL?Ldi LidLut]L=Me#eNgOnRryRtUlUndUpUr)U`0A)A*Ati$AwnEakEci$EedEllEndH eI)Id IkeInIr.L.OilOns%O#OrtOtRayReadR(gY0Ua*UeezeUir*l_b!AdiumAffA+AirsAmpAndArtA>AyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NN<tNnisNtRm/Xt_nkAtEmeEnE%yE*EyIngIsOughtReeRi=RowUmbUnd 0CketDeG LtMb MeNyPRedSsueT!5A,BaccoDayDdl EGe` I!tK&MatoM%rowNeNgueNightOlO`PP-Pp!R^RnadoRtoi'SsT$Uri,W?dW WnY_{AdeAff-Ag-A(Ansf ApAshA=lAyEatEeEndI$IbeI{Igg ImIpOphyOub!U{UeUlyUmpetU,U`Y2BeIt]Mb!NaN}lRkeyRnRt!1El=EntyI)InI,O1PeP-$:5Ly5B*lla0Ab!Awa*C!Cov D DoFairFoldHappyIf%mIqueItIv 'KnownLo{TilUsu$Veil1Da>GradeHoldOnP Set1B<Ge0A+EEdEfulE![U$0Il.y:C<tCuumGueLidL!yL=NNishP%Rious/Ult3H-!L=tNd%Ntu*NueRbRifyRs]RyS'lT <3Ab!Br<tCiousCt%yDeoEw~a+Nta+Ol(Rtu$RusSaS.Su$T$Vid5C$I)IdLc<oLumeTeYa+:GeG#ItLk~LnutNtRfa*RmRri%ShSp/eT VeY3Al`Ap#ArA'lA` BDd(gEk&dIrdLcome/T_!AtEatEelEnE*IpIsp 0DeD`FeLd~NNdowNeNgNkNn Nt ReSdomSeShT}[5LfM<Nd OdOlRdRkRldRryR`_pE{E,!I,I>Ong::Rd3Ar~ow9UUngU`:3BraRo9NeO","0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60")}static wordlist(){return null==po&&(po=new go),po}}let yo=!1;const mo=function(e,t,r,n,o){return function(e,t,r,n,o){const i={sha256:Re,sha512:Br}[o];return Z(null!=i,"invalid pbkdf2 algorithm","algorithm",o),Dr(i,e,t,{c:r,dkLen:n})}(e,t,r,n,o)};let Eo=mo;function bo(e,t,r,n,o){const i=oe(e,"password"),s=oe(t,"salt");return ue(Eo(i,s,r,n,o))}function vo(e){return(1<<e)-1<<8-e&255}function Oo(e){return(1<<e)-1&255}function Io(e,t){te("NFKD"),null==t&&(t=go.wordlist());const r=t.split(e);Z(r.length%3==0&&r.length>=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let o=0;for(let e=0;e<r.length;e++){let i=t.getWordIndex(r[e].normalize("NFKD"));Z(i>=0,`invalid mnemonic word at index ${e}`,"mnemonic","[ REDACTED ]");for(let e=0;e<11;e++)i&1<<10-e&&(n[o>>3]|=1<<7-o%8),o++}const i=32*r.length/3,s=vo(r.length/3);return Z((oe(Wr(n.slice(0,i/8)))[0]&s)===(n[n.length-1]&s),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ue(n.slice(0,i/8))}function So(e,t){Z(e.length%4==0&&e.length>=16&&e.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),null==t&&(t=go.wordlist());const r=[0];let n=11;for(let t=0;t<e.length;t++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&Oo(8-n)),n+=3);const o=e.length/4,i=parseInt(Wr(e).substring(2,4),16)&vo(o);return r[r.length-1]<<=o,r[r.length-1]|=i>>8-o,t.join(r.map(e=>t.getWord(e)))}bo._=mo,bo.lock=function(){yo=!0},bo.register=function(e){if(yo)throw new Error("pbkdf2 is locked");Eo=e},Object.freeze(bo);const wo={};class Ao{phrase;password;wordlist;entropy;constructor(e,t,r,n,o){null==n&&(n=""),null==o&&(o=go.wordlist()),re(e,wo,"Mnemonic"),W(this,{phrase:r,password:n,wordlist:o,entropy:t})}computeSeed(){const e=ar("mnemonic"+this.password,"NFKD");return bo(ar(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,t,r){const n=Io(e,r);return e=So(oe(n),r),new Ao(wo,n,e,t,r)}static fromEntropy(e,t,r){const n=oe(e,"entropy"),o=So(n,r);return new Ao(wo,ue(n),o,t,r)}static entropyToPhrase(e,t){return So(oe(e,"entropy"),t)}static phraseToEntropy(e,t){return Io(e,t)}static isValidMnemonic(e,t){try{return Io(e,t),!0}catch(e){}return!1}}
21
21
  /*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
22
- var Ro,To,_o,No=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Co=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r};const Po={16:10,24:12,32:14},Lo=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Do=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Uo=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],xo=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Go=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],ko=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Fo=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Bo=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Mo=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],jo=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ko=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],$o=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Vo=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ho=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Yo=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function qo(e){const t=[];for(let r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}class zo{get key(){return No(this,Ro,"f").slice()}constructor(e){if(Ro.set(this,void 0),To.set(this,void 0),_o.set(this,void 0),!(this instanceof zo))throw Error("AES must be instanitated with `new`");Co(this,Ro,new Uint8Array(e),"f");const t=Po[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");Co(this,_o,[],"f"),Co(this,To,[],"f");for(let e=0;e<=t;e++)No(this,_o,"f").push([0,0,0,0]),No(this,To,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=qo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,No(this,_o,"f")[i][e%4]=o[e],No(this,To,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=Do[s>>16&255]<<24^Do[s>>8&255]<<16^Do[255&s]<<8^Do[s>>24&255]^Lo[a]<<24,a+=1,8!=n)for(let e=1;e<n;e++)o[e]^=o[e-1];else{for(let e=1;e<n/2;e++)o[e]^=o[e-1];s=o[n/2-1],o[n/2]^=Do[255&s]^Do[s>>8&255]<<8^Do[s>>16&255]<<16^Do[s>>24&255]<<24;for(let e=n/2+1;e<n;e++)o[e]^=o[e-1]}let e,i,u=0;for(;u<n&&c<r;)e=c>>2,i=c%4,No(this,_o,"f")[e][i]=o[u],No(this,To,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=No(this,To,"f")[e][t],No(this,To,"f")[e][t]=$o[s>>24&255]^Vo[s>>16&255]^Ho[s>>8&255]^Yo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=No(this,_o,"f").length-1,r=[0,0,0,0];let n=qo(e);for(let e=0;e<4;e++)n[e]^=No(this,_o,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=xo[n[t]>>24&255]^Go[n[(t+1)%4]>>16&255]^ko[n[(t+2)%4]>>8&255]^Fo[255&n[(t+3)%4]]^No(this,_o,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=No(this,_o,"f")[t][e],o[4*e]=255&(Do[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Do[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(Do[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Do[255&n[(e+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=No(this,To,"f").length-1,r=[0,0,0,0];let n=qo(e);for(let e=0;e<4;e++)n[e]^=No(this,To,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Bo[n[t]>>24&255]^Mo[n[(t+3)%4]>>16&255]^jo[n[(t+2)%4]>>8&255]^Ko[255&n[(t+1)%4]]^No(this,To,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=No(this,To,"f")[t][e],o[4*e]=255&(Uo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Uo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Uo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Uo[255&n[(e+1)%4]]^i);return o}}Ro=new WeakMap,To=new WeakMap,_o=new WeakMap;class Wo{constructor(e,t,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new zo(t)},name:{enumerable:!0,value:e}})}}var Jo,Xo,Qo=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},Zo=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ei extends Wo{constructor(e,t){if(super("ECC",e,ei),Jo.set(this,void 0),Xo.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");Qo(this,Jo,new Uint8Array(t),"f")}else Qo(this,Jo,new Uint8Array(16),"f");Qo(this,Xo,this.iv,"f")}get iv(){return new Uint8Array(Zo(this,Jo,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let t=0;t<16;t++)Zo(this,Xo,"f")[t]^=e[r+t];Qo(this,Xo,this.aes.encrypt(Zo(this,Xo,"f")),"f"),t.set(Zo(this,Xo,"f"),r)}return t}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const n=this.aes.decrypt(e.subarray(r,r+16));for(let o=0;o<16;o++)t[r+o]=n[o]^Zo(this,Xo,"f")[o],Zo(this,Xo,"f")[o]=e[r+o]}return t}}Jo=new WeakMap,Xo=new WeakMap;var ti,ri=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,ti=new WeakMap,new WeakSet;var ni,oi,ii,si=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},ai=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ci extends Wo{constructor(e,t){super("CTR",e,ci),ni.set(this,void 0),oi.set(this,void 0),ii.set(this,void 0),si(this,ii,new Uint8Array(16),"f"),ai(this,ii,"f").fill(0),si(this,ni,ai(this,ii,"f"),"f"),si(this,oi,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(ai(this,ii,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let t=15;t>=0;--t)ai(this,ii,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");ai(this,ii,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==ai(this,ii,"f")[e]){ai(this,ii,"f")[e]++;break}ai(this,ii,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===ai(this,oi,"f")&&(si(this,ni,this.aes.encrypt(ai(this,ii,"f")),"f"),si(this,oi,0,"f"),this.increment()),n[e]^=ai(this,ni,"f")[(si(this,oi,(r=ai(this,oi,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ni=new WeakMap,oi=new WeakMap,ii=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const ui=(e,t)=>e<<t|e>>>32-t;function li(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],c=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],h=e[t++]^r[n++],d=e[t++]^r[n++],p=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],m=e[t++]^r[n++],E=e[t++]^r[n++],b=e[t++]^r[n++],v=e[t++]^r[n++],O=e[t++]^r[n++],I=s,S=a,w=c,A=u,R=l,T=f,_=h,N=d,C=p,P=g,L=y,D=m,U=E,x=b,G=v,k=O;for(let e=0;e<8;e+=2)R^=ui(I+U|0,7),C^=ui(R+I|0,9),U^=ui(C+R|0,13),I^=ui(U+C|0,18),P^=ui(T+S|0,7),x^=ui(P+T|0,9),S^=ui(x+P|0,13),T^=ui(S+x|0,18),G^=ui(L+_|0,7),w^=ui(G+L|0,9),_^=ui(w+G|0,13),L^=ui(_+w|0,18),A^=ui(k+D|0,7),N^=ui(A+k|0,9),D^=ui(N+A|0,13),k^=ui(D+N|0,18),S^=ui(I+A|0,7),w^=ui(S+I|0,9),A^=ui(w+S|0,13),I^=ui(A+w|0,18),_^=ui(T+R|0,7),N^=ui(_+T|0,9),R^=ui(N+_|0,13),T^=ui(R+N|0,18),D^=ui(L+P|0,7),C^=ui(D+L|0,9),P^=ui(C+D|0,13),L^=ui(P+C|0,18),U^=ui(k+G|0,7),x^=ui(U+k|0,9),G^=ui(x+U|0,13),k^=ui(G+x|0,18);o[i++]=s+I|0,o[i++]=a+S|0,o[i++]=c+w|0,o[i++]=u+A|0,o[i++]=l+R|0,o[i++]=f+T|0,o[i++]=h+_|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=g+P|0,o[i++]=y+L|0,o[i++]=m+D|0,o[i++]=E+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+k|0}function fi(e,t,r,n,o){let i=n+0,s=n+16*o;for(let n=0;n<16;n++)r[s+n]=e[t+16*(2*o-1)+n];for(let n=0;n<o;n++,i+=16,t+=16)li(r,s,e,t,r,i),n>0&&(s+=16),li(r,i,e,t+=16,r,s)}function hi(e,r,n){const o=T({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=o;if(t(i),t(s),t(a),t(c),t(u),t(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(i<=1||i&i-1||i>=2**(h/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>137438953440/h)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const p=h*(i+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const g=Dr(Re,e,r,{c:1,dkLen:h*a}),y=b(g),m=b(new Uint8Array(h*i)),E=b(new Uint8Array(h));let v=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;v=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:y,B:g,tmp:E,blockMixCb:v,asyncTick:u}}function di(e,t,r,n,o){const i=Dr(Re,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let pi=!1,gi=!1;const yi=async function(e,t,r,n,o,i,s){return await async function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h,asyncTick:d}=hi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await S(n-1,d,()=>{fi(c,r,c,r+=a,o),h()}),fi(c,(n-1)*a,u,t,o),h(),await S(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];fi(f,0,u,t,o),h()})}return di(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},mi=function(e,t,r,n,o,i){return function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h}=hi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];for(let e=0,t=0;e<n-1;e++)fi(c,t,c,t+=a,o),h();fi(c,(n-1)*a,u,t,o),h();for(let e=0;e<n;e++){const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];fi(f,0,u,t,o),h()}}return di(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let Ei=yi,bi=mi;async function vi(e,t,r,n,o,i,s){const a=oe(e,"passwd"),c=oe(t,"salt");return ue(await Ei(a,c,r,n,o,i,s))}function Oi(e,t,r,n,o,i){const s=oe(e,"passwd"),a=oe(t,"salt");return ue(bi(s,a,r,n,o,i))}function Ii(e){const t=oe(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=ue(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function Si(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ie(e)}function wi(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ai(e){return"string"==typeof e?ar(e,"NFKC"):ie(e)}function Ri(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Z(null!=r,"invalid path","path",t);const n=r[1],o=r[3],i="!"===r[4];let s=e;for(const e of n.toLowerCase().split(".")){if(Array.isArray(s)){if(!e.match(/^[0-9]+$/))break;s=s[parseInt(e)]}else if("object"==typeof s){let t=null;for(const r in s)if(r.toLowerCase()===e){t=s[r];break}s=t}else s=null;if(null==s)break}if(Z(!i||null!=s,"missing required value","path",n),o&&null!=s){if("int"===o){if("string"==typeof s&&s.match(/^-?[0-9]+$/))return parseInt(s);if(Number.isSafeInteger(s))return s}if("number"===o&&"string"==typeof s&&s.match(/^-?[0-9.]*$/))return parseFloat(s);if("data"===o&&"string"==typeof s)return Si(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;Z(!1,`wrong type found for ${o} `,"path",n)}return s}vi._=yi,vi.lock=function(){gi=!0},vi.register=function(e){if(gi)throw new Error("scrypt is locked");Ei=e},Object.freeze(vi),Oi._=mi,Oi.lock=function(){pi=!0},Oi.register=function(e){if(pi)throw new Error("scryptSync is locked");bi=e},Object.freeze(Oi);const Ti="m/44'/60'/0'/0/0";function _i(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ni(e,t){const r=oe(t),n=Ri(e,"crypto.ciphertext:data!");Z(ue(Ee(le([r.slice(16,32),n]))).substring(2)===Ri(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Ri(e,"crypto.cipher:string")){const n=Ri(e,"crypto.cipherparams.iv:data!");return ue(new ci(t,n).decrypt(r))}Q(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=on(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),Z(nr(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Ri(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Ri(e,"x-ethers.mnemonicCiphertext:data!"),o=Ri(e,"x-ethers.mnemonicCounter:data!"),i=new ci(t,o);s.mnemonic={path:Ri(e,"x-ethers.path:string")||Ti,locale:Ri(e,"x-ethers.locale:string")||"en",entropy:ue(oe(i.decrypt(n)))}}return s}function Ci(e){const t=Ri(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Ri(e,"crypto.kdfparams.salt:data!"),n=Ri(e,"crypto.kdfparams.n:int!"),o=Ri(e,"crypto.kdfparams.r:int!"),i=Ri(e,"crypto.kdfparams.p:int!");Z(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),Z(o>0&&i>0,"invalid kdf","kdf",t);const s=Ri(e,"crypto.kdfparams.dklen:int!");return Z(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Ri(e,"crypto.kdfparams.salt:data!"),r=Ri(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();Z("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Ri(e,"crypto.kdfparams.c:int!"),i=Ri(e,"crypto.kdfparams.dklen:int!");return Z(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}Z(!1,"unsupported key-derivation function","kdf",t)}function Pi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Li(e){const t=null!=e.salt?oe(e.salt,"options.salt"):to(32);let r=1<<17,n=8,o=1;return e.scrypt&&(e.scrypt.N&&(r=e.scrypt.N),e.scrypt.r&&(n=e.scrypt.r),e.scrypt.p&&(o=e.scrypt.p)),Z("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),Z("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),Z("number"==typeof o&&o>0&&Number.isSafeInteger(o),"invalid scrypt p parameter","options.p",o),{name:"scrypt",dkLen:32,salt:t,N:r,r:n,p:o}}function Di(e,t,r,n){const o=oe(r.privateKey,"privateKey"),i=null!=n.iv?oe(n.iv,"options.iv"):to(16);Z(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?oe(n.uuid,"options.uuid"):to(16);Z(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=oe(new ci(a,i).encrypt(o)),l=Ee(le([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ii(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ue(i).substring(2)},ciphertext:ue(u).substring(2),kdf:"scrypt",kdfparams:{salt:ue(t.salt).substring(2),n:t.N,dklen:32,p:t.p,r:t.r},mac:l.substring(2)}};if(r.mnemonic){const t=null!=n.client?n.client:`ethers/${Y}`,o=r.mnemonic.path||Ti,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=oe(r.mnemonic.entropy,"account.mnemonic.entropy"),c=to(16),u=oe(new ci(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+wi(l.getUTCMonth()+1,2)+"-"+wi(l.getUTCDate(),2)+"T"+wi(l.getUTCHours(),2)+"-"+wi(l.getUTCMinutes(),2)+"-"+wi(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:ue(c).substring(2),mnemonicCiphertext:ue(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Ui(e,t,r){null==r&&(r={});const n=Ai(t),o=Li(r);return Di(oe(Oi(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function xi(e,t,r){null==r&&(r={});const n=Ai(t),o=Li(r);return Di(oe(await vi(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const Gi="m/44'/60'/0'/0/0",ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Fi=2147483648,Bi=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Mi(e,t){let r="";for(;e;)r="0123456789abcdef"[e%16]+r,e=Math.trunc(e/16);for(;r.length<2*t;)r="0"+r;return"0x"+r}function ji(e){const t=oe(e);return function(e){const t=oe(e);let r=Gt(t),n="";for(;r;)n=ro[Number(r%so)]+n,r/=so;for(let e=0;e<t.length&&!t[e];e++)n=ro[0]+n;return n}(le([t,he(Wr(Wr(t)),0,4)]))}const Ki={};function $i(e,t,r,n){const o=new Uint8Array(37);e&Fi?(Q(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(oe(n),1)):o.set(oe(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=oe(Dn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Vi(e,t){const r=t.split("/");Z(r.length>0,"invalid path","path",t),"m"===r[0]&&(Z(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",t),r.shift());let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(t.match(/^[0-9]+'$/)){const r=parseInt(t.substring(0,t.length-1));Z(r<Fi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(Fi+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);Z(r<Fi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else Z(!1,"invalid path component",`path[${e}]`,t)}return n}class Hi extends Nn{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,Ki,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:he(Xn(Wr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Hi(Ki,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#L(){const e={address:this.address,privateKey:this.privateKey},t=this.mnemonic;return this.path&&t&&"en"===t.wordlist.locale&&""===t.password&&(e.mnemonic={path:this.path,locale:"en",entropy:t.entropy}),e}async encrypt(e,t){return await xi(this.#L(),e,{progressCallback:t})}encryptSync(e){return Ui(this.#L(),e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),ji(le(["0x0488ADE4",Mi(this.depth,1),this.parentFingerprint,Mi(this.index,4),this.chainCode,le(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Yi(Ki,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Fi&&(r+="'"));const{IR:n,IL:o}=$i(t,this.chainCode,this.publicKey,this.privateKey),i=new Jt(Ft((Gt(o)+BigInt(this.privateKey))%Bi,32));return new Hi(Ki,i,this.fingerprint,ue(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Vi(this,e)}static#D(e,t){Z(ae(e),"invalid seed","seed","[REDACTED]");const r=oe(e,"seed");Z(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=oe(Dn("sha512",ki,r)),o=new Jt(ue(n.slice(0,32)));return new Hi(Ki,o,"0x00000000",ue(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Bt(function(e){let t=io;for(let r=0;r<e.length;r++)t*=so,t+=oo(e[r]);return t}(e));Z(82===t.length||ji(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=ue(t.slice(5,9)),o=parseInt(ue(t.slice(9,13)).substring(2),16),i=ue(t.slice(13,45)),s=t.slice(45,78);switch(ue(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=ue(s);return new Yi(Ki,on(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Hi(Ki,new Jt(s.slice(1)),n,i,null,o,r,null,null)}Z(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=Gi),null==r&&(r=go.wordlist());const n=Ao.fromEntropy(to(16),e,r);return Hi.#D(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=Gi),Hi.#D(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=Gi),null==n&&(n=go.wordlist());const o=Ao.fromPhrase(e,t,n);return Hi.#D(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Hi.#D(e,null)}}class Yi extends _n{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,Ki,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:he(Xn(Wr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Yi(Ki,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),ji(le(["0x0488B21E",Mi(this.depth,1),this.parentFingerprint,Mi(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Fi&&(r+="'"));const{IR:n,IL:o}=$i(t,this.chainCode,this.publicKey,null),i=Jt.addPoints(o,this.publicKey,!0),s=on(i);return new Yi(Ki,s,i,this.fingerprint,ue(n),r,t,this.depth+1,this.provider)}derivePath(e){return Vi(this,e)}}function qi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function zi(e,t){const r=JSON.parse(e),n=Ai(t),o=nr(Ri(r,"ethaddr:string!")),i=Si(Ri(r,"encseed:string!"));Z(i&&i.length%16==0,"invalid encseed","json",e);const s=oe(bo(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),u=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const t=e[e.length-1];if(t>16)throw new TypeError("PKCS#7 padding byte out of range");const r=e.length-t;for(let n=0;n<t;n++)if(e[r+n]!==t)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(e.subarray(0,r))}(oe(new ei(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:pr(l)}}function Wi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class Ji extends Nn{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Jt(e):e,t)}connect(e){return new Ji(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await xi(r,e,{progressCallback:t})}encryptSync(e){return Ui({address:this.address,privateKey:this.privateKey},e)}static#U(e){if(Z(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Ao.fromEntropy(e.mnemonic.entropy),r=Hi.fromMnemonic(t,e.mnemonic.path);if(r.address===e.address&&r.privateKey===e.privateKey)return r;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const t=new Ji(e.privateKey);return Z(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return _i(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ai(t),i=Ci(n);if("pbkdf2"===i.name){r&&(r(0),await Pi(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=bo(o,e,t,s,a);return r&&(r(1),await Pi(0)),Ni(n,c)}Q("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ni(n,await vi(o,s,a,c,u,l,r))}(e,t,r):qi(e)&&(r&&(r(0),await Wi(0)),n=zi(e,t),r&&(r(1),await Wi(0))),Ji.#U(n)}static fromEncryptedJsonSync(e,t){let r=null;return _i(e)?r=function(e,t){const r=JSON.parse(e),n=Ai(t),o=Ci(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ni(r,bo(n,e,t,i,s))}Q("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ni(r,Oi(n,i,s,a,c,u))}(e,t):qi(e)?r=zi(e,t):Z(!1,"invalid JSON wallet","json","[ REDACTED ]"),Ji.#U(r)}static createRandom(e){const t=Hi.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Hi.fromPhrase(e);return t?r.connect(t):r}}var Xi=r(455),Qi=r(952),Zi=r(770);function es(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ts(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ts(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function rs(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return ns(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(ns(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ns(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,ns(f,"constructor",u),ns(u,"constructor",c),c.displayName="GeneratorFunction",ns(u,o,"GeneratorFunction"),ns(f),ns(f,o,"Generator"),ns(f,n,function(){return this}),ns(f,"toString",function(){return"[object Generator]"}),(rs=function(){return{w:i,m:h}})()}function ns(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ns=function(e,t,r,n){function i(t,r){ns(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},ns(e,t,r,n)}function os(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function is(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?os(Object(r),!0).forEach(function(t){ss(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):os(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ss(e,t,r){return(t=fs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function as(e){return as="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},as(e)}function cs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function us(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,fs(n.key),n)}}function ls(e,t,r){return t&&us(e.prototype,t),r&&us(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fs(e){var t=function(e,t){if("object"!=as(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=as(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==as(t)?t:t+""}function hs(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function ds(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){hs(i,n,o,s,a,"next",e)}function a(e){hs(i,n,o,s,a,"throw",e)}s(void 0)})}}var ps=[],gs=!1,ys="0.2.3";function ms(e){return new Promise(function(t,r){ps.push({task:e,resolve:t,reject:r}),Es()})}function Es(){return bs.apply(this,arguments)}function bs(){return(bs=ds(rs().m(function e(){var t,r,n;return rs().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!gs){e.n=1;break}return e.a(2);case 1:if(t=ps.shift()){e.n=2;break}return e.a(2);case 2:return gs=!0,e.p=3,e.n=4,t.task();case 4:r=e.v,t.resolve(r),e.n=6;break;case 5:e.p=5,n=e.v,t.reject(n);case 6:return e.p=6,gs=!1,Es(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var vs=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(cs(this,e),this.applicationId=t,this.providerId=r,this.sessionId="",this.signature="",this.timestamp=Date.now().toString(),this.parameters={},this.context={contextAddress:"0x0",contextMessage:"sample context"},this.redirectUrl="",this.sdkVersion="ext-".concat(ys),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return ls(e,[{key:"setAppCallbackUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"string"!=typeof e)throw new Error("callbackUrl must be a non-empty string");this.callbackUrl=e,this.jsonProofResponse=!!t}},{key:"setRedirectUrl",value:function(e){if(!e||"string"!=typeof e)throw new Error("redirectUrl must be a non-empty string");this.redirectUrl=e}},{key:"addContext",value:function(e,t){if(!e||!t)throw new Error("Both address and message are required");this.context={contextAddress:String(e),contextMessage:String(t)}}},{key:"setParams",value:function(e){if(!e||"object"!==as(e))throw new Error("params must be an object");this.parameters=is(is({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return Qi.Sn.STATUS_URL(this.sessionId)}},{key:"on",value:function(e,t){var r=this;if(!this._listeners[e])throw new Error("Unknown event: ".concat(e));return this._listeners[e].add(t),function(){return r.off(e,t)}}},{key:"off",value:function(e,t){this._listeners[e]&&this._listeners[e].delete(t)}},{key:"startVerification",value:(i=ds(rs().m(function e(){var t=this;return rs().w(function(e){for(;;)if(0===e.n)return e.a(2,ms(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=ds(rs().m(function e(){var t,r=this,n=arguments;return rs().w(function(e){for(;;)switch(e.n){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:5e3,this.sessionId){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(e){var n=!1,o=r.on("error",function(){n||(n=!0,o(),e(!0))});window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(o(),e(!1))},t)}))}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=ds(rs().m(function e(){var t,r,n=this;return rs().w(function(e){for(;;)switch(e.n){case 0:if(this.sessionId){e.n=1;break}throw new Error("Session not initialized");case 1:if(this.signature){e.n=2;break}throw new Error("Signature not set");case 2:return t={sessionId:this.sessionId,providerId:this.providerId,applicationId:this.applicationId,signature:this.signature,timestamp:this.timestamp,callbackUrl:this.callbackUrl||"",context:JSON.stringify(this.context||{}),parameters:this.parameters||{},redirectUrl:this.redirectUrl||"",acceptAiProviders:!!this.acceptAiProviders,sdkVersion:this.sdkVersion,providerVersion:this.providerVersion||"",resolvedProviderVersion:this.resolvedProviderVersion||"",jsonProofResponse:!!this.jsonProofResponse},r=this.sessionId,e.a(2,new Promise(function(e,o){var i=n.on("started",function(){}),s=n.on("completed",function(t){c(),e(t)}),a=n.on("error",function(e){c(),o(e)}),c=function(){i&&i(),s&&s(),a&&a()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.START_VERIFICATION,messageId:r,data:t,extensionID:n.extensionID},"*")}}))}},e,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e;if(window.removeEventListener("message",this._boundWindowListener),this._boundChromeHandler&&null!==(e=chrome)&&void 0!==e&&null!==(e=e.runtime)&&void 0!==e&&null!==(e=e.onMessage)&&void 0!==e&&e.removeListener)try{chrome.runtime.onMessage.removeListener(this._boundChromeHandler)}catch(e){}this._listeners.started.clear(),this._listeners.completed.clear(),this._listeners.error.clear(),this._listeners.progress.clear()}},{key:"_initSession",value:(r=ds(rs().m(function e(t){var r,n;return rs().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(Qi.fn,"/api/sdk/init/session/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 1:return r=e.v,e.n=2,r.json().catch(function(){return{}});case 2:if(n=e.v,r.ok){e.n=3;break}throw new Error((null==n?void 0:n.message)||"Failed to initialize session");case 3:return e.a(2,n)}},e)})),function(e){return r.apply(this,arguments)})},{key:"_emit",value:function(e,t){if(this._listeners[e]){var r,n=es(this._listeners[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{o(t)}catch(e){}}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_handleWindowMessage",value:function(e){if(e.source===window){var t=e.data||{},r=t.action,n=t.messageId,o=t.data,i=t.error;if(!this.sessionId||this.sessionId===n)if(r!==Qi.RECLAIM_SDK_ACTIONS.VERIFICATION_COMPLETED)r!==Qi.RECLAIM_SDK_ACTIONS.VERIFICATION_FAILED?r!==Qi.RECLAIM_SDK_ACTIONS.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",i||new Error("Verification failed"));else{var s=(null==o?void 0:o.proofs)||(null==o?void 0:o.formattedProofs)||o;this._emit("completed",s)}}}}],[{key:"init",value:(t=ds(rs().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return rs().w(function(t){for(;;)switch(t.n){case 0:if(i=h.length>3&&void 0!==h[3]?h[3]:{},r&&"string"==typeof r){t.n=1;break}throw new Error("applicationId must be a non-empty string");case 1:if(n&&"string"==typeof n){t.n=2;break}throw new Error("appSecret must be a non-empty string");case 2:if(o&&"string"==typeof o){t.n=3;break}throw new Error("providerId must be a non-empty string");case 3:return s=new e(r,o,i),a='{"providerId":"'.concat(o,'","timestamp":"').concat(s.timestamp,'"}'),c=Ee((new TextEncoder).encode(a)),u=new Ji(n),t.n=4,u.signMessage(oe(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?JSON.parse(e):e;return this.fromConfig(r,t)}},{key:"fromConfig",value:function(t){var r,n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!==as(t))throw new Error("invalid config");var a=new e(String(t.applicationId||""),String(t.providerId||""),s||{});return a.sessionId=String(t.sessionId||""),a.signature=String(t.signature||""),a.timestamp=String(t.timeStamp||t.timestamp||Date.now()),a.parameters=t.parameters||{},a.context=t.context||a.context,a.callbackUrl=String(t.appCallbackUrl||t.callbackUrl||""),a.jsonProofResponse=!!(null!==(r=t.jsonProofResponse)&&void 0!==r?r:a.jsonProofResponse),a.resolvedProviderVersion=String(t.resolvedProviderVersion||""),a.providerVersion=String(t.providerVersion||""),a.redirectUrl=String(t.redirectUrl||""),a.acceptAiProviders=!!(null!==(n=null!==(o=t.acceptAiProviders)&&void 0!==o?o:null===(i=t.options)||void 0===i?void 0:i.acceptAiProviders)&&void 0!==n?n:a.acceptAiProviders),null!=s&&s.extensionID&&(a.extensionID=String(s.extensionID)),a}}]);var t,r,n,o,i}(),Os=function(){return ls(function e(){var t;cs(this,e),this._backgroundInitialized=!1,this._ctx=null,this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(t=location)||void 0===t?void 0:t.protocol)?"extension":"web"},[{key:"initializeBackground",value:function(){if(this._backgroundInitialized)return this._ctx;try{var e=(0,Xi.A)();return this._backgroundInitialized=!0,this._ctx=e,e}catch(e){throw e}}},{key:"isExtensionInstalled",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extensionID,r=e.timeout,n=void 0===r?500:r;return new Promise(function(e){var r="reclaim-check-".concat(Date.now()),o=function(t){var n,i;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===Qi.RECLAIM_SDK_ACTIONS.EXTENSION_RESPONSE&&(null===(i=t.data)||void 0===i?void 0:i.messageId)===r&&(window.removeEventListener("message",o),e(!!t.data.installed))};window.addEventListener("message",o),window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return ys}},{key:"init",value:(e=ds(rs().m(function e(t,r,n){var o,i=arguments;return rs().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,vs.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vs.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){Zi.Ow.setConfig(e);try{var n;if("extension"===this._mode&&"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local){var o=r(859).LOG_CONFIG_STORAGE_KEY;return void chrome.storage.local.set(ss({},o,is(is({},Zi.Ow.config),e)))}}catch(e){}window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return Zi.Ow.config}}]);var e}(),Is=new Os;const Ss=Os})(),module.exports=n})();
22
+ var Ro,To,_o,No=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Co=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r};const Po={16:10,24:12,32:14},Lo=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Do=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Uo=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],xo=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Go=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],ko=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Fo=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Bo=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Mo=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],jo=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ko=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],$o=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Vo=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ho=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Yo=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function qo(e){const t=[];for(let r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}class zo{get key(){return No(this,Ro,"f").slice()}constructor(e){if(Ro.set(this,void 0),To.set(this,void 0),_o.set(this,void 0),!(this instanceof zo))throw Error("AES must be instanitated with `new`");Co(this,Ro,new Uint8Array(e),"f");const t=Po[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");Co(this,_o,[],"f"),Co(this,To,[],"f");for(let e=0;e<=t;e++)No(this,_o,"f").push([0,0,0,0]),No(this,To,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=qo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,No(this,_o,"f")[i][e%4]=o[e],No(this,To,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=Do[s>>16&255]<<24^Do[s>>8&255]<<16^Do[255&s]<<8^Do[s>>24&255]^Lo[a]<<24,a+=1,8!=n)for(let e=1;e<n;e++)o[e]^=o[e-1];else{for(let e=1;e<n/2;e++)o[e]^=o[e-1];s=o[n/2-1],o[n/2]^=Do[255&s]^Do[s>>8&255]<<8^Do[s>>16&255]<<16^Do[s>>24&255]<<24;for(let e=n/2+1;e<n;e++)o[e]^=o[e-1]}let e,i,u=0;for(;u<n&&c<r;)e=c>>2,i=c%4,No(this,_o,"f")[e][i]=o[u],No(this,To,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=No(this,To,"f")[e][t],No(this,To,"f")[e][t]=$o[s>>24&255]^Vo[s>>16&255]^Ho[s>>8&255]^Yo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=No(this,_o,"f").length-1,r=[0,0,0,0];let n=qo(e);for(let e=0;e<4;e++)n[e]^=No(this,_o,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=xo[n[t]>>24&255]^Go[n[(t+1)%4]>>16&255]^ko[n[(t+2)%4]>>8&255]^Fo[255&n[(t+3)%4]]^No(this,_o,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=No(this,_o,"f")[t][e],o[4*e]=255&(Do[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Do[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(Do[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Do[255&n[(e+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=No(this,To,"f").length-1,r=[0,0,0,0];let n=qo(e);for(let e=0;e<4;e++)n[e]^=No(this,To,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Bo[n[t]>>24&255]^Mo[n[(t+3)%4]>>16&255]^jo[n[(t+2)%4]>>8&255]^Ko[255&n[(t+1)%4]]^No(this,To,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=No(this,To,"f")[t][e],o[4*e]=255&(Uo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Uo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Uo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Uo[255&n[(e+1)%4]]^i);return o}}Ro=new WeakMap,To=new WeakMap,_o=new WeakMap;class Wo{constructor(e,t,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new zo(t)},name:{enumerable:!0,value:e}})}}var Jo,Xo,Qo=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},Zo=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ei extends Wo{constructor(e,t){if(super("ECC",e,ei),Jo.set(this,void 0),Xo.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");Qo(this,Jo,new Uint8Array(t),"f")}else Qo(this,Jo,new Uint8Array(16),"f");Qo(this,Xo,this.iv,"f")}get iv(){return new Uint8Array(Zo(this,Jo,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let t=0;t<16;t++)Zo(this,Xo,"f")[t]^=e[r+t];Qo(this,Xo,this.aes.encrypt(Zo(this,Xo,"f")),"f"),t.set(Zo(this,Xo,"f"),r)}return t}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const n=this.aes.decrypt(e.subarray(r,r+16));for(let o=0;o<16;o++)t[r+o]=n[o]^Zo(this,Xo,"f")[o],Zo(this,Xo,"f")[o]=e[r+o]}return t}}Jo=new WeakMap,Xo=new WeakMap;var ti,ri=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,ti=new WeakMap,new WeakSet;var ni,oi,ii,si=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},ai=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ci extends Wo{constructor(e,t){super("CTR",e,ci),ni.set(this,void 0),oi.set(this,void 0),ii.set(this,void 0),si(this,ii,new Uint8Array(16),"f"),ai(this,ii,"f").fill(0),si(this,ni,ai(this,ii,"f"),"f"),si(this,oi,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(ai(this,ii,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let t=15;t>=0;--t)ai(this,ii,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");ai(this,ii,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==ai(this,ii,"f")[e]){ai(this,ii,"f")[e]++;break}ai(this,ii,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===ai(this,oi,"f")&&(si(this,ni,this.aes.encrypt(ai(this,ii,"f")),"f"),si(this,oi,0,"f"),this.increment()),n[e]^=ai(this,ni,"f")[(si(this,oi,(r=ai(this,oi,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ni=new WeakMap,oi=new WeakMap,ii=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const ui=(e,t)=>e<<t|e>>>32-t;function li(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],c=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],h=e[t++]^r[n++],d=e[t++]^r[n++],p=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],m=e[t++]^r[n++],E=e[t++]^r[n++],b=e[t++]^r[n++],v=e[t++]^r[n++],O=e[t++]^r[n++],I=s,S=a,w=c,A=u,R=l,T=f,_=h,N=d,C=p,P=g,L=y,D=m,U=E,x=b,G=v,k=O;for(let e=0;e<8;e+=2)R^=ui(I+U|0,7),C^=ui(R+I|0,9),U^=ui(C+R|0,13),I^=ui(U+C|0,18),P^=ui(T+S|0,7),x^=ui(P+T|0,9),S^=ui(x+P|0,13),T^=ui(S+x|0,18),G^=ui(L+_|0,7),w^=ui(G+L|0,9),_^=ui(w+G|0,13),L^=ui(_+w|0,18),A^=ui(k+D|0,7),N^=ui(A+k|0,9),D^=ui(N+A|0,13),k^=ui(D+N|0,18),S^=ui(I+A|0,7),w^=ui(S+I|0,9),A^=ui(w+S|0,13),I^=ui(A+w|0,18),_^=ui(T+R|0,7),N^=ui(_+T|0,9),R^=ui(N+_|0,13),T^=ui(R+N|0,18),D^=ui(L+P|0,7),C^=ui(D+L|0,9),P^=ui(C+D|0,13),L^=ui(P+C|0,18),U^=ui(k+G|0,7),x^=ui(U+k|0,9),G^=ui(x+U|0,13),k^=ui(G+x|0,18);o[i++]=s+I|0,o[i++]=a+S|0,o[i++]=c+w|0,o[i++]=u+A|0,o[i++]=l+R|0,o[i++]=f+T|0,o[i++]=h+_|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=g+P|0,o[i++]=y+L|0,o[i++]=m+D|0,o[i++]=E+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+k|0}function fi(e,t,r,n,o){let i=n+0,s=n+16*o;for(let n=0;n<16;n++)r[s+n]=e[t+16*(2*o-1)+n];for(let n=0;n<o;n++,i+=16,t+=16)li(r,s,e,t,r,i),n>0&&(s+=16),li(r,i,e,t+=16,r,s)}function hi(e,r,n){const o=T({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=o;if(t(i),t(s),t(a),t(c),t(u),t(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(i<=1||i&i-1||i>=2**(h/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>137438953440/h)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const p=h*(i+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const g=Dr(Re,e,r,{c:1,dkLen:h*a}),y=b(g),m=b(new Uint8Array(h*i)),E=b(new Uint8Array(h));let v=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;v=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:y,B:g,tmp:E,blockMixCb:v,asyncTick:u}}function di(e,t,r,n,o){const i=Dr(Re,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let pi=!1,gi=!1;const yi=async function(e,t,r,n,o,i,s){return await async function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h,asyncTick:d}=hi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await S(n-1,d,()=>{fi(c,r,c,r+=a,o),h()}),fi(c,(n-1)*a,u,t,o),h(),await S(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];fi(f,0,u,t,o),h()})}return di(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},mi=function(e,t,r,n,o,i){return function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h}=hi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];for(let e=0,t=0;e<n-1;e++)fi(c,t,c,t+=a,o),h();fi(c,(n-1)*a,u,t,o),h();for(let e=0;e<n;e++){const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];fi(f,0,u,t,o),h()}}return di(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let Ei=yi,bi=mi;async function vi(e,t,r,n,o,i,s){const a=oe(e,"passwd"),c=oe(t,"salt");return ue(await Ei(a,c,r,n,o,i,s))}function Oi(e,t,r,n,o,i){const s=oe(e,"passwd"),a=oe(t,"salt");return ue(bi(s,a,r,n,o,i))}function Ii(e){const t=oe(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=ue(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function Si(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ie(e)}function wi(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ai(e){return"string"==typeof e?ar(e,"NFKC"):ie(e)}function Ri(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Z(null!=r,"invalid path","path",t);const n=r[1],o=r[3],i="!"===r[4];let s=e;for(const e of n.toLowerCase().split(".")){if(Array.isArray(s)){if(!e.match(/^[0-9]+$/))break;s=s[parseInt(e)]}else if("object"==typeof s){let t=null;for(const r in s)if(r.toLowerCase()===e){t=s[r];break}s=t}else s=null;if(null==s)break}if(Z(!i||null!=s,"missing required value","path",n),o&&null!=s){if("int"===o){if("string"==typeof s&&s.match(/^-?[0-9]+$/))return parseInt(s);if(Number.isSafeInteger(s))return s}if("number"===o&&"string"==typeof s&&s.match(/^-?[0-9.]*$/))return parseFloat(s);if("data"===o&&"string"==typeof s)return Si(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;Z(!1,`wrong type found for ${o} `,"path",n)}return s}vi._=yi,vi.lock=function(){gi=!0},vi.register=function(e){if(gi)throw new Error("scrypt is locked");Ei=e},Object.freeze(vi),Oi._=mi,Oi.lock=function(){pi=!0},Oi.register=function(e){if(pi)throw new Error("scryptSync is locked");bi=e},Object.freeze(Oi);const Ti="m/44'/60'/0'/0/0";function _i(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ni(e,t){const r=oe(t),n=Ri(e,"crypto.ciphertext:data!");Z(ue(Ee(le([r.slice(16,32),n]))).substring(2)===Ri(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Ri(e,"crypto.cipher:string")){const n=Ri(e,"crypto.cipherparams.iv:data!");return ue(new ci(t,n).decrypt(r))}Q(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=on(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),Z(nr(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Ri(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Ri(e,"x-ethers.mnemonicCiphertext:data!"),o=Ri(e,"x-ethers.mnemonicCounter:data!"),i=new ci(t,o);s.mnemonic={path:Ri(e,"x-ethers.path:string")||Ti,locale:Ri(e,"x-ethers.locale:string")||"en",entropy:ue(oe(i.decrypt(n)))}}return s}function Ci(e){const t=Ri(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Ri(e,"crypto.kdfparams.salt:data!"),n=Ri(e,"crypto.kdfparams.n:int!"),o=Ri(e,"crypto.kdfparams.r:int!"),i=Ri(e,"crypto.kdfparams.p:int!");Z(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),Z(o>0&&i>0,"invalid kdf","kdf",t);const s=Ri(e,"crypto.kdfparams.dklen:int!");return Z(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Ri(e,"crypto.kdfparams.salt:data!"),r=Ri(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();Z("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Ri(e,"crypto.kdfparams.c:int!"),i=Ri(e,"crypto.kdfparams.dklen:int!");return Z(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}Z(!1,"unsupported key-derivation function","kdf",t)}function Pi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Li(e){const t=null!=e.salt?oe(e.salt,"options.salt"):to(32);let r=1<<17,n=8,o=1;return e.scrypt&&(e.scrypt.N&&(r=e.scrypt.N),e.scrypt.r&&(n=e.scrypt.r),e.scrypt.p&&(o=e.scrypt.p)),Z("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),Z("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),Z("number"==typeof o&&o>0&&Number.isSafeInteger(o),"invalid scrypt p parameter","options.p",o),{name:"scrypt",dkLen:32,salt:t,N:r,r:n,p:o}}function Di(e,t,r,n){const o=oe(r.privateKey,"privateKey"),i=null!=n.iv?oe(n.iv,"options.iv"):to(16);Z(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?oe(n.uuid,"options.uuid"):to(16);Z(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=oe(new ci(a,i).encrypt(o)),l=Ee(le([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ii(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ue(i).substring(2)},ciphertext:ue(u).substring(2),kdf:"scrypt",kdfparams:{salt:ue(t.salt).substring(2),n:t.N,dklen:32,p:t.p,r:t.r},mac:l.substring(2)}};if(r.mnemonic){const t=null!=n.client?n.client:`ethers/${Y}`,o=r.mnemonic.path||Ti,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=oe(r.mnemonic.entropy,"account.mnemonic.entropy"),c=to(16),u=oe(new ci(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+wi(l.getUTCMonth()+1,2)+"-"+wi(l.getUTCDate(),2)+"T"+wi(l.getUTCHours(),2)+"-"+wi(l.getUTCMinutes(),2)+"-"+wi(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:ue(c).substring(2),mnemonicCiphertext:ue(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Ui(e,t,r){null==r&&(r={});const n=Ai(t),o=Li(r);return Di(oe(Oi(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function xi(e,t,r){null==r&&(r={});const n=Ai(t),o=Li(r);return Di(oe(await vi(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const Gi="m/44'/60'/0'/0/0",ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Fi=2147483648,Bi=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Mi(e,t){let r="";for(;e;)r="0123456789abcdef"[e%16]+r,e=Math.trunc(e/16);for(;r.length<2*t;)r="0"+r;return"0x"+r}function ji(e){const t=oe(e);return function(e){const t=oe(e);let r=Gt(t),n="";for(;r;)n=ro[Number(r%so)]+n,r/=so;for(let e=0;e<t.length&&!t[e];e++)n=ro[0]+n;return n}(le([t,he(Wr(Wr(t)),0,4)]))}const Ki={};function $i(e,t,r,n){const o=new Uint8Array(37);e&Fi?(Q(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(oe(n),1)):o.set(oe(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=oe(Dn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Vi(e,t){const r=t.split("/");Z(r.length>0,"invalid path","path",t),"m"===r[0]&&(Z(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",t),r.shift());let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(t.match(/^[0-9]+'$/)){const r=parseInt(t.substring(0,t.length-1));Z(r<Fi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(Fi+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);Z(r<Fi,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else Z(!1,"invalid path component",`path[${e}]`,t)}return n}class Hi extends Nn{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,Ki,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:he(Xn(Wr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Hi(Ki,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#L(){const e={address:this.address,privateKey:this.privateKey},t=this.mnemonic;return this.path&&t&&"en"===t.wordlist.locale&&""===t.password&&(e.mnemonic={path:this.path,locale:"en",entropy:t.entropy}),e}async encrypt(e,t){return await xi(this.#L(),e,{progressCallback:t})}encryptSync(e){return Ui(this.#L(),e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),ji(le(["0x0488ADE4",Mi(this.depth,1),this.parentFingerprint,Mi(this.index,4),this.chainCode,le(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Yi(Ki,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Fi&&(r+="'"));const{IR:n,IL:o}=$i(t,this.chainCode,this.publicKey,this.privateKey),i=new Jt(Ft((Gt(o)+BigInt(this.privateKey))%Bi,32));return new Hi(Ki,i,this.fingerprint,ue(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Vi(this,e)}static#D(e,t){Z(ae(e),"invalid seed","seed","[REDACTED]");const r=oe(e,"seed");Z(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=oe(Dn("sha512",ki,r)),o=new Jt(ue(n.slice(0,32)));return new Hi(Ki,o,"0x00000000",ue(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Bt(function(e){let t=io;for(let r=0;r<e.length;r++)t*=so,t+=oo(e[r]);return t}(e));Z(82===t.length||ji(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=ue(t.slice(5,9)),o=parseInt(ue(t.slice(9,13)).substring(2),16),i=ue(t.slice(13,45)),s=t.slice(45,78);switch(ue(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=ue(s);return new Yi(Ki,on(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Hi(Ki,new Jt(s.slice(1)),n,i,null,o,r,null,null)}Z(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=Gi),null==r&&(r=go.wordlist());const n=Ao.fromEntropy(to(16),e,r);return Hi.#D(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=Gi),Hi.#D(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=Gi),null==n&&(n=go.wordlist());const o=Ao.fromPhrase(e,t,n);return Hi.#D(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Hi.#D(e,null)}}class Yi extends _n{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,Ki,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:he(Xn(Wr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Yi(Ki,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),ji(le(["0x0488B21E",Mi(this.depth,1),this.parentFingerprint,Mi(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&Fi&&(r+="'"));const{IR:n,IL:o}=$i(t,this.chainCode,this.publicKey,null),i=Jt.addPoints(o,this.publicKey,!0),s=on(i);return new Yi(Ki,s,i,this.fingerprint,ue(n),r,t,this.depth+1,this.provider)}derivePath(e){return Vi(this,e)}}function qi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function zi(e,t){const r=JSON.parse(e),n=Ai(t),o=nr(Ri(r,"ethaddr:string!")),i=Si(Ri(r,"encseed:string!"));Z(i&&i.length%16==0,"invalid encseed","json",e);const s=oe(bo(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),u=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const t=e[e.length-1];if(t>16)throw new TypeError("PKCS#7 padding byte out of range");const r=e.length-t;for(let n=0;n<t;n++)if(e[r+n]!==t)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(e.subarray(0,r))}(oe(new ei(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:pr(l)}}function Wi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class Ji extends Nn{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Jt(e):e,t)}connect(e){return new Ji(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await xi(r,e,{progressCallback:t})}encryptSync(e){return Ui({address:this.address,privateKey:this.privateKey},e)}static#U(e){if(Z(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Ao.fromEntropy(e.mnemonic.entropy),r=Hi.fromMnemonic(t,e.mnemonic.path);if(r.address===e.address&&r.privateKey===e.privateKey)return r;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const t=new Ji(e.privateKey);return Z(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return _i(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ai(t),i=Ci(n);if("pbkdf2"===i.name){r&&(r(0),await Pi(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=bo(o,e,t,s,a);return r&&(r(1),await Pi(0)),Ni(n,c)}Q("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ni(n,await vi(o,s,a,c,u,l,r))}(e,t,r):qi(e)&&(r&&(r(0),await Wi(0)),n=zi(e,t),r&&(r(1),await Wi(0))),Ji.#U(n)}static fromEncryptedJsonSync(e,t){let r=null;return _i(e)?r=function(e,t){const r=JSON.parse(e),n=Ai(t),o=Ci(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ni(r,bo(n,e,t,i,s))}Q("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ni(r,Oi(n,i,s,a,c,u))}(e,t):qi(e)?r=zi(e,t):Z(!1,"invalid JSON wallet","json","[ REDACTED ]"),Ji.#U(r)}static createRandom(e){const t=Hi.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Hi.fromPhrase(e);return t?r.connect(t):r}}var Xi=r(455),Qi=r(952),Zi=r(770);function es(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ts(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ts(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function rs(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return ns(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(ns(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ns(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,ns(f,"constructor",u),ns(u,"constructor",c),c.displayName="GeneratorFunction",ns(u,o,"GeneratorFunction"),ns(f),ns(f,o,"Generator"),ns(f,n,function(){return this}),ns(f,"toString",function(){return"[object Generator]"}),(rs=function(){return{w:i,m:h}})()}function ns(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ns=function(e,t,r,n){function i(t,r){ns(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},ns(e,t,r,n)}function os(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function is(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?os(Object(r),!0).forEach(function(t){ss(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):os(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ss(e,t,r){return(t=fs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function as(e){return as="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},as(e)}function cs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function us(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,fs(n.key),n)}}function ls(e,t,r){return t&&us(e.prototype,t),r&&us(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fs(e){var t=function(e,t){if("object"!=as(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=as(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==as(t)?t:t+""}function hs(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function ds(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){hs(i,n,o,s,a,"next",e)}function a(e){hs(i,n,o,s,a,"throw",e)}s(void 0)})}}var ps=[],gs=!1,ys="0.2.4";function ms(e){return new Promise(function(t,r){ps.push({task:e,resolve:t,reject:r}),Es()})}function Es(){return bs.apply(this,arguments)}function bs(){return(bs=ds(rs().m(function e(){var t,r,n;return rs().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!gs){e.n=1;break}return e.a(2);case 1:if(t=ps.shift()){e.n=2;break}return e.a(2);case 2:return gs=!0,e.p=3,e.n=4,t.task();case 4:r=e.v,t.resolve(r),e.n=6;break;case 5:e.p=5,n=e.v,t.reject(n);case 6:return e.p=6,gs=!1,Es(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var vs=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(cs(this,e),this.applicationId=t,this.providerId=r,this.sessionId="",this.signature="",this.timestamp=Date.now().toString(),this.parameters={},this.context={contextAddress:"0x0",contextMessage:"sample context"},this.redirectUrl="",this.sdkVersion="ext-".concat(ys),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return ls(e,[{key:"setAppCallbackUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"string"!=typeof e)throw new Error("callbackUrl must be a non-empty string");this.callbackUrl=e,this.jsonProofResponse=!!t}},{key:"setRedirectUrl",value:function(e){if(!e||"string"!=typeof e)throw new Error("redirectUrl must be a non-empty string");this.redirectUrl=e}},{key:"addContext",value:function(e,t){if(!e||!t)throw new Error("Both address and message are required");this.context={contextAddress:String(e),contextMessage:String(t)}}},{key:"setParams",value:function(e){if(!e||"object"!==as(e))throw new Error("params must be an object");this.parameters=is(is({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return Qi.Sn.STATUS_URL(this.sessionId)}},{key:"on",value:function(e,t){var r=this;if(!this._listeners[e])throw new Error("Unknown event: ".concat(e));return this._listeners[e].add(t),function(){return r.off(e,t)}}},{key:"off",value:function(e,t){this._listeners[e]&&this._listeners[e].delete(t)}},{key:"startVerification",value:(i=ds(rs().m(function e(){var t=this;return rs().w(function(e){for(;;)if(0===e.n)return e.a(2,ms(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=ds(rs().m(function e(){var t,r=this,n=arguments;return rs().w(function(e){for(;;)switch(e.n){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:5e3,this.sessionId){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(e){var n=!1,o=r.on("error",function(){n||(n=!0,o(),e(!0))});window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(o(),e(!1))},t)}))}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=ds(rs().m(function e(){var t,r,n=this;return rs().w(function(e){for(;;)switch(e.n){case 0:if(this.sessionId){e.n=1;break}throw new Error("Session not initialized");case 1:if(this.signature){e.n=2;break}throw new Error("Signature not set");case 2:return t={sessionId:this.sessionId,providerId:this.providerId,applicationId:this.applicationId,signature:this.signature,timestamp:this.timestamp,callbackUrl:this.callbackUrl||"",context:JSON.stringify(this.context||{}),parameters:this.parameters||{},redirectUrl:this.redirectUrl||"",acceptAiProviders:!!this.acceptAiProviders,sdkVersion:this.sdkVersion,providerVersion:this.providerVersion||"",resolvedProviderVersion:this.resolvedProviderVersion||"",jsonProofResponse:!!this.jsonProofResponse},r=this.sessionId,e.a(2,new Promise(function(e,o){var i=n.on("started",function(){}),s=n.on("completed",function(t){c(),e(t)}),a=n.on("error",function(e){c(),o(e)}),c=function(){i&&i(),s&&s(),a&&a()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.START_VERIFICATION,messageId:r,data:t,extensionID:n.extensionID},"*")}}))}},e,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e;if(window.removeEventListener("message",this._boundWindowListener),this._boundChromeHandler&&null!==(e=chrome)&&void 0!==e&&null!==(e=e.runtime)&&void 0!==e&&null!==(e=e.onMessage)&&void 0!==e&&e.removeListener)try{chrome.runtime.onMessage.removeListener(this._boundChromeHandler)}catch(e){}this._listeners.started.clear(),this._listeners.completed.clear(),this._listeners.error.clear(),this._listeners.progress.clear()}},{key:"_initSession",value:(r=ds(rs().m(function e(t){var r,n;return rs().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(Qi.fn,"/api/sdk/init/session/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 1:return r=e.v,e.n=2,r.json().catch(function(){return{}});case 2:if(n=e.v,r.ok){e.n=3;break}throw new Error((null==n?void 0:n.message)||"Failed to initialize session");case 3:return e.a(2,n)}},e)})),function(e){return r.apply(this,arguments)})},{key:"_emit",value:function(e,t){if(this._listeners[e]){var r,n=es(this._listeners[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{o(t)}catch(e){}}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_handleWindowMessage",value:function(e){if(e.source===window){var t=e.data||{},r=t.action,n=t.messageId,o=t.data,i=t.error;if(!this.sessionId||this.sessionId===n)if(r!==Qi.RECLAIM_SDK_ACTIONS.VERIFICATION_COMPLETED)r!==Qi.RECLAIM_SDK_ACTIONS.VERIFICATION_FAILED?r!==Qi.RECLAIM_SDK_ACTIONS.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",i||new Error("Verification failed"));else{var s=(null==o?void 0:o.proofs)||(null==o?void 0:o.formattedProofs)||o;this._emit("completed",s)}}}}],[{key:"init",value:(t=ds(rs().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return rs().w(function(t){for(;;)switch(t.n){case 0:if(i=h.length>3&&void 0!==h[3]?h[3]:{},r&&"string"==typeof r){t.n=1;break}throw new Error("applicationId must be a non-empty string");case 1:if(n&&"string"==typeof n){t.n=2;break}throw new Error("appSecret must be a non-empty string");case 2:if(o&&"string"==typeof o){t.n=3;break}throw new Error("providerId must be a non-empty string");case 3:return s=new e(r,o,i),a='{"providerId":"'.concat(o,'","timestamp":"').concat(s.timestamp,'"}'),c=Ee((new TextEncoder).encode(a)),u=new Ji(n),t.n=4,u.signMessage(oe(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?JSON.parse(e):e;return this.fromConfig(r,t)}},{key:"fromConfig",value:function(t){var r,n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!==as(t))throw new Error("invalid config");var a=new e(String(t.applicationId||""),String(t.providerId||""),s||{});return a.sessionId=String(t.sessionId||""),a.signature=String(t.signature||""),a.timestamp=String(t.timeStamp||t.timestamp||Date.now()),a.parameters=t.parameters||{},a.context=t.context||a.context,a.callbackUrl=String(t.appCallbackUrl||t.callbackUrl||""),a.jsonProofResponse=!!(null!==(r=t.jsonProofResponse)&&void 0!==r?r:a.jsonProofResponse),a.resolvedProviderVersion=String(t.resolvedProviderVersion||""),a.providerVersion=String(t.providerVersion||""),a.redirectUrl=String(t.redirectUrl||""),a.acceptAiProviders=!!(null!==(n=null!==(o=t.acceptAiProviders)&&void 0!==o?o:null===(i=t.options)||void 0===i?void 0:i.acceptAiProviders)&&void 0!==n?n:a.acceptAiProviders),null!=s&&s.extensionID&&(a.extensionID=String(s.extensionID)),a}}]);var t,r,n,o,i}(),Os=function(){return ls(function e(){var t;cs(this,e),this._backgroundInitialized=!1,this._ctx=null,this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(t=location)||void 0===t?void 0:t.protocol)?"extension":"web"},[{key:"initializeBackground",value:function(){if(this._backgroundInitialized)return this._ctx;try{var e=(0,Xi.A)();return this._backgroundInitialized=!0,this._ctx=e,e}catch(e){throw e}}},{key:"isExtensionInstalled",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extensionID,r=e.timeout,n=void 0===r?500:r;return new Promise(function(e){var r="reclaim-check-".concat(Date.now()),o=function(t){var n,i;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===Qi.RECLAIM_SDK_ACTIONS.EXTENSION_RESPONSE&&(null===(i=t.data)||void 0===i?void 0:i.messageId)===r&&(window.removeEventListener("message",o),e(!!t.data.installed))};window.addEventListener("message",o),window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return ys}},{key:"init",value:(e=ds(rs().m(function e(t,r,n){var o,i=arguments;return rs().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,vs.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vs.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){Zi.Ow.setConfig(e);try{var n;if("extension"===this._mode&&"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local){var o=r(859).LOG_CONFIG_STORAGE_KEY;return void chrome.storage.local.set(ss({},o,is(is({},Zi.Ow.config),e)))}}catch(e){}window.postMessage({action:Qi.RECLAIM_SDK_ACTIONS.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return Zi.Ow.config}}]);var e}(),Is=new Os;const Ss=Os})(),module.exports=n})();
23
23
  //# sourceMappingURL=JoclaimExtensionSDK-mv2.bundle.js.map