@skip-go/widget-web-component 3.12.11 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- export const __webpack_id__=352;export const __webpack_ids__=[352];export const __webpack_modules__={3205:()=>{},45423:()=>{}};
@@ -1,2 +0,0 @@
1
- /*! For license information please see 8226.index.js.LICENSE.txt */
2
- export const __webpack_id__=8226;export const __webpack_ids__=[8226];export const __webpack_modules__={48226:(t,e,n)=>{n.d(e,{secp256k1:()=>Zt});var r={};function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function i(t,...e){if(!((n=t)instanceof Uint8Array||ArrayBuffer.isView(n)&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}n.r(r),n.d(r,{aK:()=>j,e8:()=>R,DO:()=>O,dJ:()=>K,OG:()=>M,My:()=>L,Ph:()=>_,lX:()=>F,Id:()=>Z,fg:()=>Y,qj:()=>T,aT:()=>z,r4:()=>D,aY:()=>I,x:()=>X,lq:()=>P,z:()=>C,zW:()=>N,Q5:()=>Q});const f="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function a(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function c(t,e){return t<<32-e|t>>>e}function u(t){return"string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),i(t),t}class l{clone(){return this._cloneInto()}}function h(t){const e=e=>t().update(u(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function d(t=32){if(f&&"function"==typeof f.getRandomValues)return f.getRandomValues(new Uint8Array(t));if(f&&"function"==typeof f.randomBytes)return f.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function g(t,e,n){return t&e^t&n^e&n}class w extends l{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=a(this.buffer)}update(t){s(this);const{view:e,buffer:n,blockLen:r}=this,o=(t=u(t)).length;for(let i=0;i<o;){const s=Math.min(r-this.pos,o-i);if(s!==r)n.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===r&&(this.process(e,0),this.pos=0);else{const e=a(t);for(;r<=o-i;i+=r)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){s(this),function(t,e){i(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:o}=this;let{pos:f}=this;e[f++]=128,this.buffer.subarray(f).fill(0),this.padOffset>r-f&&(this.process(n,0),f=0);for(let t=f;t<r;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),f=Number(n&i),a=r?4:0,c=r?0:4;t.setUint32(e+a,s,r),t.setUint32(e+c,f,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const c=a(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<l;t++)c.setUint32(4*t,h[t],o)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:o,destroyed:i,pos:s}=this;return t.length=r,t.pos=s,t.finished=o,t.destroyed=i,r%e&&t.buffer.set(n),t}}const p=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),y=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m=new Uint32Array(64);class E extends w{constructor(){super(64,32,8,!1),this.A=0|y[0],this.B=0|y[1],this.C=0|y[2],this.D=0|y[3],this.E=0|y[4],this.F=0|y[5],this.G=0|y[6],this.H=0|y[7]}get(){const{A:t,B:e,C:n,D:r,E:o,F:i,G:s,H:f}=this;return[t,e,n,r,o,i,s,f]}set(t,e,n,r,o,i,s,f){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|f}process(t,e){for(let n=0;n<16;n++,e+=4)m[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=m[t-15],n=m[t-2],r=c(e,7)^c(e,18)^e>>>3,o=c(n,17)^c(n,19)^n>>>10;m[t]=o+m[t-7]+r+m[t-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:f,G:a,H:u}=this;for(let t=0;t<64;t++){const e=u+(c(s,6)^c(s,11)^c(s,25))+((l=s)&f^~l&a)+p[t]+m[t]|0,h=(c(n,2)^c(n,13)^c(n,22))+g(n,r,o)|0;u=a,a=f,f=s,s=i+e|0,i=o,o=r,r=n,n=e+h|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,f=f+this.F|0,a=a+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,f,a,u)}roundClean(){m.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const b=h((()=>new E));class B extends l{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");o(t.outputLen),o(t.blockLen)}(t);const n=u(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return s(this),this.iHash.update(t),this}digestInto(t){s(this),i(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=r,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const v=(t,e,n)=>new B(t,e).update(n).digest();v.create=(t,e)=>new B(t,e);const x=BigInt(0),A=BigInt(1),S=BigInt(2);function I(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function O(t){if(!I(t))throw new Error("Uint8Array expected")}function R(t,e){if("boolean"!=typeof e)throw new Error(t+" boolean expected, got "+e)}const q=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function L(t){O(t);let e="";for(let n=0;n<t.length;n++)e+=q[t[n]];return e}function N(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function U(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?x:BigInt("0x"+t)}const H={_0:48,_9:57,A:65,F:70,a:97,f:102};function k(t){return t>=H._0&&t<=H._9?t-H._0:t>=H.A&&t<=H.F?t-(H.A-10):t>=H.a&&t<=H.f?t-(H.a-10):void 0}function z(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,o=0;e<n;e++,o+=2){const n=k(t.charCodeAt(o)),i=k(t.charCodeAt(o+1));if(void 0===n||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}r[e]=16*n+i}return r}function _(t){return U(L(t))}function F(t){return O(t),U(L(Uint8Array.from(t).reverse()))}function P(t,e){return z(t.toString(16).padStart(2*e,"0"))}function C(t,e){return P(t,e).reverse()}function T(t,e,n){let r;if("string"==typeof e)try{r=z(e)}catch(e){throw new Error(t+" must be hex string or Uint8Array, cause: "+e)}else{if(!I(e))throw new Error(t+" must be hex string or Uint8Array");r=Uint8Array.from(e)}const o=r.length;if("number"==typeof n&&o!==n)throw new Error(t+" of length "+n+" expected, got "+o);return r}function Z(...t){let e=0;for(let n=0;n<t.length;n++){const r=t[n];O(r),e+=r.length}const n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const o=t[e];n.set(o,r),r+=o.length}return n}const V=t=>"bigint"==typeof t&&x<=t;function D(t,e,n){return V(t)&&V(e)&&V(n)&&e<=t&&t<n}function j(t,e,n,r){if(!D(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function K(t){let e;for(e=0;t>x;t>>=A,e+=1);return e}const M=t=>(S<<BigInt(t-1))-A,G=t=>new Uint8Array(t),W=t=>Uint8Array.from(t);function Y(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=G(t),o=G(t),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},f=(...t)=>n(o,r,...t),a=(t=G())=>{o=f(W([0]),t),r=f(),0!==t.length&&(o=f(W([1]),t),r=f())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t<e;){r=f();const e=r.slice();n.push(e),t+=r.length}return Z(...n)};return(t,e)=>{let n;for(s(),a(t);!(n=e(c()));)a();return s(),n}}const J={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||I(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function Q(t,e,n={}){const r=(e,n,r)=>{const o=J[n];if("function"!=typeof o)throw new Error("invalid validator function");const i=t[e];if(!(r&&void 0===i||o(i,t)))throw new Error("param "+String(e)+" is invalid. Expected "+n+", got "+i)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}function X(t){const e=new WeakMap;return(n,...r)=>{const o=e.get(n);if(void 0!==o)return o;const i=t(n,...r);return e.set(n,i),i}}const $=BigInt(0),tt=BigInt(1),et=BigInt(2),nt=BigInt(3),rt=BigInt(4),ot=BigInt(5),it=BigInt(8);function st(t,e){const n=t%e;return n>=$?n:e+n}function ft(t,e,n){if(e<$)throw new Error("invalid exponent, negatives unsupported");if(n<=$)throw new Error("invalid modulus");if(n===tt)return $;let r=tt;for(;e>$;)e&tt&&(r=r*t%n),t=t*t%n,e>>=tt;return r}function at(t,e,n){let r=t;for(;e-- >$;)r*=r,r%=n;return r}function ct(t,e){if(t===$)throw new Error("invert: expected non-zero number");if(e<=$)throw new Error("invert: expected positive modulus, got "+e);let n=st(t,e),r=e,o=$,i=tt,s=tt,f=$;for(;n!==$;){const t=r/n,e=r%n,a=o-s*t,c=i-f*t;r=n,n=e,o=s,i=f,s=a,f=c}if(r!==tt)throw new Error("invert: does not exist");return st(o,e)}const ut=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function lt(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function ht(t,e,n=!1,r={}){if(t<=$)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:o,nByteLength:i}=lt(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const f=Object.freeze({ORDER:t,isLE:n,BITS:o,BYTES:i,MASK:M(o),ZERO:$,ONE:tt,create:e=>st(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return $<=e&&e<t},is0:t=>t===$,isOdd:t=>(t&tt)===tt,neg:e=>st(-e,t),eql:(t,e)=>t===e,sqr:e=>st(e*e,t),add:(e,n)=>st(e+n,t),sub:(e,n)=>st(e-n,t),mul:(e,n)=>st(e*n,t),pow:(t,e)=>function(t,e,n){if(n<$)throw new Error("invalid exponent, negatives unsupported");if(n===$)return t.ONE;if(n===tt)return e;let r=t.ONE,o=e;for(;n>$;)n&tt&&(r=t.mul(r,o)),o=t.sqr(o),n>>=tt;return r}(f,t,e),div:(e,n)=>st(e*ct(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>ct(e,t),sqrt:r.sqrt||(e=>(s||(s=function(t){if(t%rt===nt){const e=(t+tt)/rt;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%it===ot){const e=(t-ot)/it;return function(t,n){const r=t.mul(n,et),o=t.pow(r,e),i=t.mul(n,o),s=t.mul(t.mul(i,et),o),f=t.mul(i,t.sub(s,t.ONE));if(!t.eql(t.sqr(f),n))throw new Error("Cannot find square root");return f}}return function(t){const e=(t-tt)/et;let n,r,o;for(n=t-tt,r=0;n%et===$;n/=et,r++);for(o=et;o<t&&ft(o,e,t)!==t-tt;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const e=(t+tt)/rt;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}const i=(n+tt)/et;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let f=r,a=t.pow(t.mul(t.ONE,o),n),c=t.pow(s,i),u=t.pow(s,n);for(;!t.eql(u,t.ONE);){if(t.eql(u,t.ZERO))return t.ZERO;let e=1;for(let n=t.sqr(u);e<f&&!t.eql(n,t.ONE);e++)n=t.sqr(n);const n=t.pow(a,tt<<BigInt(f-e-1));a=t.sqr(n),c=t.mul(c,n),u=t.mul(u,a),f=e}return c}}(t)}(t)),s(f,e))),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,o)=>t.is0(r)?e:(n[o]=e,t.mul(e,r))),t.ONE),o=t.inv(r);return e.reduceRight(((e,r,o)=>t.is0(r)?e:(n[o]=t.mul(e,n[o]),t.mul(e,r))),o),n}(f,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?C(t,i):P(t,i),fromBytes:t=>{if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);return n?F(t):_(t)}});return Object.freeze(f)}function dt(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function gt(t){const e=dt(t);return e+Math.ceil(e/2)}const wt=BigInt(0),pt=BigInt(1);function yt(t,e){const n=e.negate();return t?n:e}function mt(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Et(t,e){return mt(t,e),{windows:Math.ceil(e/t)+1,windowSize:2**(t-1)}}const bt=new WeakMap,Bt=new WeakMap;function vt(t){return Bt.get(t)||1}function xt(t){return Q(t.Fp,ut.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Q(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...lt(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function At(t){void 0!==t.lowS&&R("lowS",t.lowS),void 0!==t.prehash&&R("prehash",t.prehash)}const{Ph:St,aT:It}=r;class Ot extends Error{constructor(t=""){super(t)}}const Rt={Err:Ot,_tlv:{encode:(t,e)=>{const{Err:n}=Rt;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(1&e.length)throw new n("tlv.encode: unpadded data");const r=e.length/2,o=N(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?N(o.length/2|128):"";return N(t)+i+o+e},decode(t,e){const{Err:n}=Rt;let r=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new n("tlv.decode: wrong tlv");const o=e[r++];let i=0;if(128&o){const t=127&o;if(!t)throw new n("tlv.decode(long): indefinite length not supported");if(t>4)throw new n("tlv.decode(long): byte length is too big");const s=e.subarray(r,r+t);if(s.length!==t)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const t of s)i=i<<8|t;if(r+=t,i<128)throw new n("tlv.decode(long): not minimal encoding")}else i=o;const s=e.subarray(r,r+i);if(s.length!==i)throw new n("tlv.decode: wrong value length");return{v:s,l:e.subarray(r+i)}}},_int:{encode(t){const{Err:e}=Rt;if(t<qt)throw new e("integer: negative integers are not allowed");let n=N(t);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=Rt;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return St(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=Rt,o="string"==typeof t?It(t):t;O(o);const{v:i,l:s}=r.decode(48,o);if(s.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:a}=r.decode(2,i),{v:c,l:u}=r.decode(2,a);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(f),s:n.decode(c)}},hexFromSig(t){const{_tlv:e,_int:n}=Rt,r=e.encode(2,n.encode(t.r))+e.encode(2,n.encode(t.s));return e.encode(48,r)}},qt=BigInt(0),Lt=BigInt(1),Nt=(BigInt(2),BigInt(3));function Ut(t){const e=function(t){const e=xt(t);Q(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:o}=e;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=ht(e.n,e.nBitLength),o=e.toBytes||((t,e,r)=>{const o=e.toAffine();return Z(Uint8Array.from([4]),n.toBytes(o.x),n.toBytes(o.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function s(t){const{a:r,b:o}=e,i=n.sqr(t),s=n.mul(i,t);return n.add(n.add(s,n.mul(t,r)),o)}if(!n.eql(n.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function f(t){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:o,n:i}=e;if(n&&"bigint"!=typeof t){if(I(t)&&(t=L(t)),"string"!=typeof t||!n.includes(t.length))throw new Error("invalid private key");t=t.padStart(2*r,"0")}let s;try{s="bigint"==typeof t?t:_(T("private key",t,r))}catch(e){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof t)}return o&&(s=st(s,i)),j("private key",s,Lt,i),s}function a(t){if(!(t instanceof l))throw new Error("ProjectivePoint expected")}const c=X(((t,e)=>{const{px:r,py:o,pz:i}=t;if(n.eql(i,n.ONE))return{x:r,y:o};const s=t.is0();null==e&&(e=s?n.ONE:n.inv(i));const f=n.mul(r,e),a=n.mul(o,e),c=n.mul(i,e);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:f,y:a}})),u=X((t=>{if(t.is0()){if(e.allowInfinityPoint&&!n.is0(t.py))return;throw new Error("bad point: ZERO")}const{x:r,y:o}=t.toAffine();if(!n.isValid(r)||!n.isValid(o))throw new Error("bad point: x or y not FE");const i=n.sqr(o),f=s(r);if(!n.eql(i,f))throw new Error("bad point: equation left != right");if(!t.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class l{constructor(t,e,r){if(this.px=t,this.py=e,this.pz=r,null==t||!n.isValid(t))throw new Error("x required");if(null==e||!n.isValid(e))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");Object.freeze(this)}static fromAffine(t){const{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw new Error("invalid affine point");if(t instanceof l)throw new Error("projective point not allowed");const o=t=>n.eql(t,n.ZERO);return o(e)&&o(r)?l.ZERO:new l(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(l.fromAffine)}static fromHex(t){const e=l.fromAffine(i(T("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return l.BASE.multiply(f(t))}static msm(t,e){return function(t,e,n,r){if(function(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach(((t,n)=>{if(!(t instanceof e))throw new Error("invalid point at index "+n)}))}(n,t),function(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach(((t,n)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+n)}))}(r,e),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,i=K(BigInt(n.length)),s=i>12?i-3:i>4?i-2:i?2:1,f=(1<<s)-1,a=new Array(f+1).fill(o);let c=o;for(let t=Math.floor((e.BITS-1)/s)*s;t>=0;t-=s){a.fill(o);for(let e=0;e<r.length;e++){const o=r[e],i=Number(o>>BigInt(t)&BigInt(f));a[i]=a[i].add(n[e])}let e=o;for(let t=a.length-1,n=o;t>0;t--)n=n.add(a[t]),e=e.add(n);if(c=c.add(e),0!==t)for(let t=0;t<s;t++)c=c.double()}return c}(l,r,t,e)}_setWindowSize(t){d.setWindowSize(this,t)}assertValidity(){u(this)}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){a(t);const{px:e,py:r,pz:o}=this,{px:i,py:s,pz:f}=t,c=n.eql(n.mul(e,f),n.mul(i,o)),u=n.eql(n.mul(r,f),n.mul(s,o));return c&&u}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,o=n.mul(r,Nt),{px:i,py:s,pz:f}=this;let a=n.ZERO,c=n.ZERO,u=n.ZERO,h=n.mul(i,i),d=n.mul(s,s),g=n.mul(f,f),w=n.mul(i,s);return w=n.add(w,w),u=n.mul(i,f),u=n.add(u,u),a=n.mul(t,u),c=n.mul(o,g),c=n.add(a,c),a=n.sub(d,c),c=n.add(d,c),c=n.mul(a,c),a=n.mul(w,a),u=n.mul(o,u),g=n.mul(t,g),w=n.sub(h,g),w=n.mul(t,w),w=n.add(w,u),u=n.add(h,h),h=n.add(u,h),h=n.add(h,g),h=n.mul(h,w),c=n.add(c,h),g=n.mul(s,f),g=n.add(g,g),h=n.mul(g,w),a=n.sub(a,h),u=n.mul(g,d),u=n.add(u,u),u=n.add(u,u),new l(a,c,u)}add(t){a(t);const{px:r,py:o,pz:i}=this,{px:s,py:f,pz:c}=t;let u=n.ZERO,h=n.ZERO,d=n.ZERO;const g=e.a,w=n.mul(e.b,Nt);let p=n.mul(r,s),y=n.mul(o,f),m=n.mul(i,c),E=n.add(r,o),b=n.add(s,f);E=n.mul(E,b),b=n.add(p,y),E=n.sub(E,b),b=n.add(r,i);let B=n.add(s,c);return b=n.mul(b,B),B=n.add(p,m),b=n.sub(b,B),B=n.add(o,i),u=n.add(f,c),B=n.mul(B,u),u=n.add(y,m),B=n.sub(B,u),d=n.mul(g,b),u=n.mul(w,m),d=n.add(u,d),u=n.sub(y,d),d=n.add(y,d),h=n.mul(u,d),y=n.add(p,p),y=n.add(y,p),m=n.mul(g,m),b=n.mul(w,b),y=n.add(y,m),m=n.sub(p,m),m=n.mul(g,m),b=n.add(b,m),p=n.mul(y,b),h=n.add(h,p),p=n.mul(B,b),u=n.mul(E,u),u=n.sub(u,p),p=n.mul(E,y),d=n.mul(B,d),d=n.add(d,p),new l(u,h,d)}subtract(t){return this.add(t.negate())}is0(){return this.equals(l.ZERO)}wNAF(t){return d.wNAFCached(this,t,l.normalizeZ)}multiplyUnsafe(t){const{endo:r,n:o}=e;j("scalar",t,qt,o);const i=l.ZERO;if(t===qt)return i;if(this.is0()||t===Lt)return this;if(!r||d.hasPrecomputes(this))return d.wNAFCachedUnsafe(this,t,l.normalizeZ);let{k1neg:s,k1:f,k2neg:a,k2:c}=r.splitScalar(t),u=i,h=i,g=this;for(;f>qt||c>qt;)f&Lt&&(u=u.add(g)),c&Lt&&(h=h.add(g)),g=g.double(),f>>=Lt,c>>=Lt;return s&&(u=u.negate()),a&&(h=h.negate()),h=new l(n.mul(h.px,r.beta),h.py,h.pz),u.add(h)}multiply(t){const{endo:r,n:o}=e;let i,s;if(j("scalar",t,Lt,o),r){const{k1neg:e,k1:o,k2neg:f,k2:a}=r.splitScalar(t);let{p:c,f:u}=this.wNAF(o),{p:h,f:g}=this.wNAF(a);c=d.constTimeNegate(e,c),h=d.constTimeNegate(f,h),h=new l(n.mul(h.px,r.beta),h.py,h.pz),i=c.add(h),s=u.add(g)}else{const{p:e,f:n}=this.wNAF(t);i=e,s=n}return l.normalizeZ([i,s])[0]}multiplyAndAddUnsafe(t,e,n){const r=l.BASE,o=(t,e)=>e!==qt&&e!==Lt&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),i=o(this,e).add(o(t,n));return i.is0()?void 0:i}toAffine(t){return c(this,t)}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===Lt)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===Lt?this:n?n(l,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return R("isCompressed",t),this.assertValidity(),o(l,this,t)}toHex(t=!0){return R("isCompressed",t),L(this.toRawBytes(t))}}l.BASE=new l(e.Gx,e.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,d=(g=l,w=e.endo?Math.ceil(h/2):h,{constTimeNegate:yt,hasPrecomputes:t=>1!==vt(t),unsafeLadder(t,e,n=g.ZERO){let r=t;for(;e>wt;)e&pt&&(n=n.add(r)),r=r.double(),e>>=pt;return n},precomputeWindow(t,e){const{windows:n,windowSize:r}=Et(e,w),o=[];let i=t,s=i;for(let t=0;t<n;t++){s=i,o.push(s);for(let t=1;t<r;t++)s=s.add(i),o.push(s);i=s.double()}return o},wNAF(t,e,n){const{windows:r,windowSize:o}=Et(t,w);let i=g.ZERO,s=g.BASE;const f=BigInt(2**t-1),a=2**t,c=BigInt(t);for(let t=0;t<r;t++){const r=t*o;let u=Number(n&f);n>>=c,u>o&&(u-=a,n+=pt);const l=r,h=r+Math.abs(u)-1,d=t%2!=0,g=u<0;0===u?s=s.add(yt(d,e[l])):i=i.add(yt(g,e[h]))}return{p:i,f:s}},wNAFUnsafe(t,e,n,r=g.ZERO){const{windows:o,windowSize:i}=Et(t,w),s=BigInt(2**t-1),f=2**t,a=BigInt(t);for(let t=0;t<o;t++){const o=t*i;if(n===wt)break;let c=Number(n&s);if(n>>=a,c>i&&(c-=f,n+=pt),0===c)continue;let u=e[o+Math.abs(c)-1];c<0&&(u=u.negate()),r=r.add(u)}return r},getPrecomputes(t,e,n){let r=bt.get(e);return r||(r=this.precomputeWindow(e,t),1!==t&&bt.set(e,n(r))),r},wNAFCached(t,e,n){const r=vt(t);return this.wNAF(r,this.getPrecomputes(r,t,n),e)},wNAFCachedUnsafe(t,e,n,r){const o=vt(t);return 1===o?this.unsafeLadder(t,e,r):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),e,r)},setWindowSize(t,e){mt(e,w),Bt.set(t,e),bt.delete(t)}});var g,w;return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:s,isWithinCurveOrder:function(t){return D(t,Lt,e.n)}}}function Ht(t){const e=function(t){const e=xt(t);return Q(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,o=n.BYTES+1,i=2*n.BYTES+1;function s(t){return st(t,r)}function f(t){return ct(t,r)}const{ProjectivePoint:a,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:l}=Ut({...e,toBytes(t,e,r){const o=e.toAffine(),i=n.toBytes(o.x),s=Z;return R("isCompressed",r),r?s(Uint8Array.from([e.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,n.toBytes(o.y))},fromBytes(t){const e=t.length,r=t[0],s=t.subarray(1);if(e!==o||2!==r&&3!==r){if(e===i&&4===r)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw new Error("invalid Point, expected length of "+o+", or uncompressed "+i+", got "+e)}{const t=_(s);if(!D(t,Lt,n.ORDER))throw new Error("Point is not on curve");const e=u(t);let o;try{o=n.sqrt(e)}catch(t){const e=t instanceof Error?": "+t.message:"";throw new Error("Point is not on curve"+e)}return!(1&~r)!=((o&Lt)===Lt)&&(o=n.neg(o)),{x:t,y:o}}}}),h=t=>L(P(t,e.nByteLength));function d(t){return t>r>>Lt}const g=(t,e,n)=>_(t.slice(e,n));class w{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=T("compactSignature",t,2*n),new w(g(t,0,n),g(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Rt.toSig(T("DER",t));return new w(e,n)}assertValidity(){j("r",this.r,Lt,r),j("s",this.s,Lt,r)}addRecoveryBit(t){return new w(this.r,this.s,t)}recoverPublicKey(t){const{r,s:o,recovery:i}=this,c=E(T("msgHash",t));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const u=2===i||3===i?r+e.n:r;if(u>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=1&i?"03":"02",d=a.fromHex(l+h(u)),g=f(u),w=s(-c*g),p=s(o*g),y=a.BASE.multiplyAndAddUnsafe(d,w,p);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return z(this.toDERHex())}toDERHex(){return Rt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return z(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const p={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=gt(e.n);return function(t,e,n=!1){const r=t.length,o=dt(e),i=gt(e);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const s=st(n?F(t):_(t),e-tt)+tt;return n?C(s,o):P(s,o)}(e.randomBytes(t),e.n)},precompute:(t=8,e=a.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=I(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===o||r===i:n?r===2*o||r===2*i:t instanceof a}const m=e.bits2int||function(t){if(t.length>8192)throw new Error("input is too large");const n=_(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},E=e.bits2int_modN||function(t){return s(m(t))},b=M(e.nBitLength);function B(t){return j("num < 2^"+e.nBitLength,t,qt,b),P(t,e.nByteLength)}const v={lowS:e.lowS,prehash:!1},x={lowS:e.lowS,prehash:!1};return a.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return a.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return a.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,r,o=v){const{seed:i,k2sig:u}=function(t,r,o=v){if(["recovered","canonical"].some((t=>t in o)))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:u}=e;let{lowS:h,prehash:g,extraEntropy:p}=o;null==h&&(h=!0),t=T("msgHash",t),At(o),g&&(t=T("prehashed msgHash",i(t)));const y=E(t),b=c(r),x=[B(b),B(y)];if(null!=p&&!1!==p){const t=!0===p?u(n.BYTES):p;x.push(T("extraEntropy",t))}const A=Z(...x),S=y;return{seed:A,k2sig:function(t){const e=m(t);if(!l(e))return;const n=f(e),r=a.BASE.multiply(e).toAffine(),o=s(r.x);if(o===qt)return;const i=s(n*s(S+o*b));if(i===qt)return;let c=(r.x===o?0:2)|Number(r.y&Lt),u=i;return h&&d(i)&&(u=function(t){return d(t)?s(-t):t}(i),c^=1),new w(o,u,c)}}}(t,r,o),h=e;return Y(h.hash.outputLen,h.nByteLength,h.hmac)(i,u)},verify:function(t,n,r,o=x){const i=t;n=T("msgHash",n),r=T("publicKey",r);const{lowS:c,prehash:u,format:l}=o;if(At(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==l&&"compact"!==l&&"der"!==l)throw new Error("format must be compact or der");const h="string"==typeof i||I(i),d=!h&&!l&&"object"==typeof i&&null!==i&&"bigint"==typeof i.r&&"bigint"==typeof i.s;if(!h&&!d)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let g,p;try{if(d&&(g=new w(i.r,i.s)),h){try{"compact"!==l&&(g=w.fromDER(i))}catch(t){if(!(t instanceof Rt.Err))throw t}g||"der"===l||(g=w.fromCompact(i))}p=a.fromHex(r)}catch(t){return!1}if(!g)return!1;if(c&&g.hasHighS())return!1;u&&(n=e.hash(n));const{r:y,s:m}=g,b=E(n),B=f(m),v=s(b*B),A=s(y*B),S=a.BASE.multiplyAndAddUnsafe(p,v,A)?.toAffine();return!!S&&s(S.x)===y},ProjectivePoint:a,Signature:w,utils:p}}function kt(t){return{hash:t,hmac:(e,...n)=>v(t,e,function(...t){let e=0;for(let n=0;n<t.length;n++){const r=t[n];i(r),e+=r.length}const n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const o=t[e];n.set(o,r),r+=o.length}return n}(...n)),randomBytes:d}}BigInt(4);const zt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),_t=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ft=BigInt(1),Pt=BigInt(2),Ct=(t,e)=>(t+e/Pt)/e;const Tt=ht(zt,void 0,void 0,{sqrt:function(t){const e=zt,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),f=BigInt(44),a=BigInt(88),c=t*t*t%e,u=c*c*t%e,l=at(u,n,e)*u%e,h=at(l,n,e)*u%e,d=at(h,Pt,e)*c%e,g=at(d,o,e)*d%e,w=at(g,i,e)*g%e,p=at(w,f,e)*w%e,y=at(p,a,e)*p%e,m=at(y,f,e)*w%e,E=at(m,n,e)*u%e,b=at(E,s,e)*g%e,B=at(b,r,e)*c%e,v=at(B,Pt,e);if(!Tt.eql(Tt.sqr(v),t))throw new Error("Cannot find square root");return v}}),Zt=function(t,e){const n=e=>Ht({...t,...kt(e)});return{...n(e),create:n}}({a:BigInt(0),b:BigInt(7),Fp:Tt,n:_t,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=_t,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ft*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),f=Ct(i*t,e),a=Ct(-r*t,e);let c=st(t-f*n-a*o,e),u=st(-f*r-a*i,e);const l=c>s,h=u>s;if(l&&(c=e-c),h&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:h,k2:u}}}},b);BigInt(0),Zt.ProjectivePoint}};