1/*! For license information please see 4241.44f767039db5083d.js.LICENSE.txt */ 2"use strict";(self.nfg=self.nfg||[]).push([[4241],{24241:(t,e,n)=>{n.d(e,{secp256k1:()=>ct});var r=n(79864),o=n(38628);class i extends o.Vw{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,o.sd)(t);const n=(0,o.ZJ)(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 o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),(0,o.uH)(i)}update(t){return(0,o.CC)(this),this.iHash.update(t),this}digestInto(t){(0,o.CC)(this),(0,o.DO)(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}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const s=(t,e,n)=>new i(t,e).update(n).digest();s.create=(t,e)=>new i(t,e);var a=n(81633);const f=BigInt(0),c=BigInt(1),u=BigInt(2),d=BigInt(3),l=BigInt(4),h=BigInt(5),w=BigInt(8);function p(t,e){const n=t%e;return n>=f?n:e+n}function g(t,e,n){let r=t;for(;e-- >f;)r*=r,r%=n;return r}function m(t,e){if(t===f)throw new Error("invert: expected non-zero number");if(e<=f)throw new Error("invert: expected positive modulus, got "+e);let n=p(t,e),r=e,o=f,i=c,s=c,a=f;for(;n!==f;){const t=r/n,e=r%n,f=o-s*t,c=i-a*t;r=n,n=e,o=s,i=a,s=f,a=c}if(r!==c)throw new Error("invert: does not exist");return p(o,e)}function y(t,e){const n=(t.ORDER+c)/l,r=t.pow(e,n);if(!t.eql(t.sqr(r),e))throw new Error("Cannot find square root");return r}function E(t,e){const n=(t.ORDER-h)/w,r=t.mul(e,u),o=t.pow(r,n),i=t.mul(e,o),s=t.mul(t.mul(i,u),o),a=t.mul(i,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function b(t){return t%l===d?y:t%w===h?E:function(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-c,n=0;for(;e%u===f;)e/=u,n++;let r=u;const o=I(t);for(;1===O(o,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===n)return y;let i=o.pow(r,e);const s=(e+c)/u;return function(t,r){if(t.is0(r))return r;if(1!==O(t,r))throw new Error("Cannot find square root");let o=n,a=t.mul(t.ONE,i),f=t.pow(r,e),u=t.pow(r,s);for(;!t.eql(f,t.ONE);){if(t.is0(f))return t.ZERO;let e=1,n=t.sqr(f);for(;!t.eql(n,t.ONE);)if(e++,n=t.sqr(n),e===o)throw new Error("Cannot find square root");const r=c<<BigInt(o-e-1),i=t.pow(a,r);o=e,a=t.sqr(i),f=t.mul(f,a),u=t.mul(u,i)}return u}}(t)}const v=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function B(t,e,n){if(n<f)throw new Error("invalid exponent, negatives unsupported");if(n===f)return t.ONE;if(n===c)return e;let r=t.ONE,o=e;for(;n>f;)n&c&&(r=t.mul(r,o)),o=t.sqr(o),n>>=c;return r}function x(t,e,n=!1){const r=new Array(e.length).fill(n?t.ZERO:void 0),o=e.reduce((e,n,o)=>t.is0(n)?e:(r[o]=e,t.mul(e,n)),t.ONE),i=t.inv(o);return e.reduceRight((e,n,o)=>t.is0(n)?e:(r[o]=t.mul(e,r[o]),t.mul(e,n)),i),r}function O(t,e){const n=(t.ORDER-c)/u,r=t.pow(e,n),o=t.eql(r,t.ONE),i=t.eql(r,t.ZERO),s=t.eql(r,t.neg(t.ONE));if(!o&&!i&&!s)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function S(t,e){void 0!==e&&(0,o.Fe)(e);const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function I(t,e,n=!1,r={}){if(t<=f)throw new Error("invalid field: expected ORDER > 0, got "+t);let o,i;if("object"==typeof e&&null!=e){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const t=e;
2t.BITS&&(o=t.BITS),t.sqrt&&(i=t.sqrt),"boolean"==typeof t.isLE&&(n=t.isLE)}else"number"==typeof e&&(o=e),r.sqrt&&(i=r.sqrt);const{nBitLength:s,nByteLength:u}=S(t,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let d;const l=Object.freeze({ORDER:t,isLE:n,BITS:s,BYTES:u,MASK:(0,a.OG)(s),ZERO:f,ONE:c,create:e=>p(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return f<=e&&e<t},is0:t=>t===f,isValidNot0:t=>!l.is0(t)&&l.isValid(t),isOdd:t=>(t&c)===c,neg:e=>p(-e,t),eql:(t,e)=>t===e,sqr:e=>p(e*e,t),add:(e,n)=>p(e+n,t),sub:(e,n)=>p(e-n,t),mul:(e,n)=>p(e*n,t),pow:(t,e)=>B(l,t,e),div:(e,n)=>p(e*m(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>m(e,t),sqrt:i||(e=>(d||(d=b(t)),d(l,e))),toBytes:t=>n?(0,a.z)(t,u):(0,a.lq)(t,u),fromBytes:t=>{if(t.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+t.length);return n?(0,a.lX)(t):(0,a.Ph)(t)},invertBatch:t=>x(l,t),cmov:(t,e,n)=>n?e:t});return Object.freeze(l)}function R(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 q(t){const e=R(t);return e+Math.ceil(e/2)}const N=BigInt(0),A=BigInt(1);function F(t,e){const n=e.negate();return t?n:e}function z(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function P(t,e){z(t,e);const n=2**t;return{windows:Math.ceil(e/t)+1,windowSize:2**(t-1),mask:(0,a.OG)(t),maxNumber:n,shiftBy:BigInt(t)}}function H(t,e,n){const{windowSize:r,mask:o,maxNumber:i,shiftBy:s}=n;let a=Number(t&o),f=t>>s;a>r&&(a-=i,f+=A);const c=e*r;return{nextN:f,offset:c+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:e%2!=0,offsetF:c}}function j(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)})}function C(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)})}const U=new WeakMap,V=new WeakMap;function Z(t){return V.get(t)||1}function k(t){if(t!==N)throw new Error("invalid wNAF")}function L(t,e){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(t){const e=v.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});(0,a.DS)(t,e)}(e),e}return I(t)}function T(t){void 0!==t.lowS&&(0,a.e8)("lowS",t.lowS),void 0!==t.prehash&&(0,a.e8)("prehash",t.prehash)}class D extends Error{constructor(t=""){super(t)}}const K={Err:D,_tlv:{encode:(t,e)=>{const{Err:n}=K;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=(0,a.zW)(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?(0,a.zW)(o.length/2|128):"";return(0,a.zW)(t)+i+o+e},decode(t,e){const{Err:n}=K;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 e of s)i=i<<8|e;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}=K;if(t<G)throw new e("integer: negative integers are not allowed");let n=(0,a.zW)(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}=K;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(0,a.Ph)(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=K,o=(0,a.qj)("signature",t),{v:i,l:s}=r.decode(48,o);if(s.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:c}=r.decode(2,i),{v:u,l:d}=r.decode(2,c);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(f),s:n.decode(u)}},hexFromSig(t){const{_tlv:e,_int:n}=K,r=e.encode(2,n.encode(t.r))+e.encode(2,n.encode(t.s));return e.encode(48,r)}},G=BigInt(0),M=BigInt(1),_=BigInt(2),W=BigInt(3),$=BigInt(4);function Y(t,e,n){return function(r){const o=t.sqr(r),i=t.mul(o,r);return t.add(t.add(i,t.mul(r,e)),n)}}function J(t,e,n){const{BYTES:r}=t;return function(o){let i;if("bigint"==typeof o)i=o;else{let n=(0,a.qj)("private key",o);if(e){if(!e.includes(2*n.length))throw new Error("invalid private key");const t=new Uint8Array(r);t.set(n,t.length-n.length),n=t}try{i=t.fromBytes(n)}catch(s){throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof o}`)}}if(n&&(i=t.create(i)),!t.isValidNot0(i))throw new Error("invalid private key: out of range [1..N-1]");return i}}function X(t,e={}){const{Fp:n,Fn:r}=function(t,e,n={}){if(!e||"object"!=typeof e)throw new Error(`expected valid ${t} CURVE object`);for(const s of["p","n","h"]){const t=e[s];if(!("bigint"==typeof t&&t>N))throw new Error(`CURVE.${s} must be positive bigint`)}const r=L(e.p,n.Fp),o=L(e.n,n.Fn),i=["Gx","Gy","a","weierstrass"===t?"b":"d"];for(const s of i)if(!r.isValid(e[s]))throw new Error(`CURVE.${s} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:o}}("weierstrass",t,e),{h:i,n:s}=t;(0,a.DS)(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});
2const{endo:f}=e;if(f&&(!n.is0(t.a)||"bigint"!=typeof f.beta||"function"!=typeof f.splitScalar))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function c(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const u=e.toBytes||function(t,e,r){const{x:i,y:s}=e.toAffine(),f=n.toBytes(i);if((0,a.e8)("isCompressed",r),r){c();const t=!n.isOdd(s);return(0,o.Id)(Q(t),f)}return(0,o.Id)(Uint8Array.of(4),f,n.toBytes(s))},d=e.fromBytes||function(t){(0,o.DO)(t);const e=n.BYTES,r=e+1,i=2*e+1,s=t.length,a=t[0],f=t.subarray(1);if(s!==r||2!==a&&3!==a){if(s===i&&4===a){const t=n.fromBytes(f.subarray(0*e,1*e)),r=n.fromBytes(f.subarray(1*e,2*e));if(!h(t,r))throw new Error("bad point: is not on curve");return{x:t,y:r}}throw new Error(`bad point: got length ${s}, expected compressed=${r} or uncompressed=${i}`)}{const t=n.fromBytes(f);if(!n.isValid(t))throw new Error("bad point: is not on curve, wrong x");const e=l(t);let r;try{r=n.sqrt(e)}catch(u){const t=u instanceof Error?": "+u.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}c();return!(1&~a)!==n.isOdd(r)&&(r=n.neg(r)),{x:t,y:r}}},l=Y(n,t.a,t.b);function h(t,e){const r=n.sqr(e),o=l(t);return n.eql(r,o)}if(!h(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const w=n.mul(n.pow(t.a,W),$),p=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(w,p)))throw new Error("bad curve params: a or b");function g(t,e,r=!1){if(!n.isValid(e)||r&&n.is0(e))throw new Error(`bad point coordinate ${t}`);return e}function m(t){if(!(t instanceof v))throw new Error("ProjectivePoint expected")}const y=(0,a.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 a=n.mul(r,e),f=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:a,y:f}}),E=(0,a.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 field elements");if(!h(r,o))throw new Error("bad point: equation left != right");if(!t.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function b(t,e,r,o,i){return r=new v(n.mul(r.px,t),r.py,r.pz),e=F(o,e),r=F(i,r),e.add(r)}class v{constructor(t,e,n){this.px=g("x",t),this.py=g("y",e,!0),this.pz=g("z",n),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 v)throw new Error("projective point not allowed");return n.is0(e)&&n.is0(r)?v.ZERO:new v(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){return function(t,e,n){const r="pz"===e?t=>t.pz:t=>t.ez,o=x(t.Fp,n.map(r));return n.map((t,e)=>t.toAffine(o[e])).map(t.fromAffine)}(v,"pz",t)}static fromBytes(t){return(0,o.DO)(t),v.fromHex(t)}static fromHex(t){const e=v.fromAffine(d((0,a.qj)("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){const n=J(r,e.allowedPrivateKeyLengths,e.wrapPrivateKey);return v.BASE.multiply(n(t))}static msm(t,e){return function(t,e,n,r){j(n,t),C(r,e);const o=n.length,i=r.length;if(o!==i)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,f=(0,a.dJ)(BigInt(o));let c=1;f>12?c=f-3:f>4?c=f-2:f>0&&(c=2);const u=(0,a.OG)(c),d=new Array(Number(u)+1).fill(s);let l=s;for(let a=Math.floor((e.BITS-1)/c)*c;a>=0;a-=c){d.fill(s);for(let e=0;e<i;e++){const t=r[e],o=Number(t>>BigInt(a)&u);d[o]=d[o].add(n[e])}let t=s;for(let e=d.length-1,n=s;e>0;e--)n=n.add(d[e]),t=t.add(n);if(l=l.add(t),0!==a)for(let e=0;e<c;e++)l=l.double()}return l}(v,r,t,e)}precompute(t=8,e=!0){return O.setWindowSize(this,t),e||this.multiply(W),this}_setWindowSize(t){this.precompute(t)}assertValidity(){E(this)}hasEvenY(){const{y:t}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(t)}equals(t){m(t);const{px:e,py:r,pz:o}=this,{px:i,py:s,pz:a}=t,f=n.eql(n.mul(e,a),n.mul(i,o)),c=n.eql(n.mul(r,a),n.mul(s,o));return f&&c}negate(){return new v(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,o=n.mul(r,W),{px:i,py:s,pz:a}=this;let f=n.ZERO,c=n.ZERO,u=n.ZERO,d=n.mul(i,i),l=n.mul(s,s),h=n.mul(a,a),w=n.mul(i,s);return w=n.add(w,w),u=n.mul(i,a),u=n.add(u,u),f=n.mul(e,u),c=n.mul(o,h),c=n.add(f,c),f=n.sub(l,c),c=n.add(l,c),c=n.mul(f,c),f=n.mul(w,f),u=n.mul(o,u),h=n.mul(e,h),w=n.sub(d,h),w=n.mul(e,w),w=n.add(w,u),u=n.add(d,d),d=n.add(u,d),d=n.add(d,h),d=n.mul(d,w),c=n.add(c,d),h=n.mul(s,a),h=n.add(h,h),d=n.mul(h,w),f=n.sub(f,d),u=n.mul(h,l),u=n.add(u,u),u=n.add(u,u),new v(f,c,u)}add(e){m(e);const{px:r,py:o,pz:i}=this,{px:s,py:a,pz:f}=e;let c=n.ZERO,u=n.ZERO,d=n.ZERO;const l=t.a,h=n.mul(t.b,W);let w=n.mul(r,s),p=n.mul(o,a),g=n.mul(i,f),y=n.add(r,o),E=n.add(s,a);y=n.mul(y,E),E=n.add(w,p),y=n.sub(y,E),E=n.add(r,i);let b=n.add(s,f);return E=n.mul(E,b),b=n.add(w,g),E=n.sub(E,b),b=n.add(o,i),c=n.add(a,f),b=n.mul(b,c),c=n.add(p,g),b=n.sub(b,c),d=n.mul(l,E),c=n.mul(h,g),d=n.add(c,d),c=n.sub(p,d),d=n.add(p,d),u=n.mul(c,d),p=n.add(w,w),p=n.add(p,w),g=n.mul(l,g),E=n.mul(h,E),p=n.add(p,g),g=n.sub(w,g),g=n.mul(l,g),E=n.add(E,g),w=n.mul(p,E),u=n.add(u,w),w=n.mul(b,E),c=n.mul(y,c),c=n.sub(c,w),w=n.mul(y,p),d=n.mul(b,d),d=n.add(d,w),new v(c,u,d)}subtract(t){return this.add(t.negate())}is0(){return this.equals(v.ZERO)}
vendor: 2,365 bytes, line 2
2multiply(t){const{endo:n}=e;if(!r.isValidNot0(t))throw new Error("invalid scalar: out of range");let o,i;const s=t=>O.wNAFCached(this,t,v.normalizeZ);if(n){const{k1neg:e,k1:r,k2neg:a,k2:f}=n.splitScalar(t),{p:c,f:u}=s(r),{p:d,f:l}=s(f);i=u.add(l),o=b(n.beta,c,d,e,a)}else{const{p:e,f:n}=s(t);o=e,i=n}return v.normalizeZ([o,i])[0]}multiplyUnsafe(t){const{endo:n}=e,o=this;if(!r.isValid(t))throw new Error("invalid scalar: out of range");if(t===G||o.is0())return v.ZERO;if(t===M)return o;if(O.hasPrecomputes(this))return this.multiply(t);if(n){const{k1neg:e,k1:r,k2neg:i,k2:s}=n.splitScalar(t),{p1:a,p2:f}=function(t,e,n,r){let o=e,i=t.ZERO,s=t.ZERO;for(;n>N||r>N;)n&A&&(i=i.add(o)),r&A&&(s=s.add(o)),o=o.double(),n>>=A,r>>=A;return{p1:i,p2:s}}(v,o,r,s);return b(n.beta,a,f,e,i)}return O.wNAFCachedUnsafe(o,t)}multiplyAndAddUnsafe(t,e,n){const r=this.multiplyUnsafe(e).add(t.multiplyUnsafe(n));return r.is0()?void 0:r}toAffine(t){return y(this,t)}isTorsionFree(){const{isTorsionFree:t}=e;return i===M||(t?t(v,this):O.wNAFCachedUnsafe(this,s).is0())}clearCofactor(){const{clearCofactor:t}=e;return i===M?this:t?t(v,this):this.multiplyUnsafe(i)}toBytes(t=!0){return(0,a.e8)("isCompressed",t),this.assertValidity(),u(v,this,t)}toRawBytes(t=!0){return this.toBytes(t)}toHex(t=!0){return(0,o.My)(this.toBytes(t))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}v.BASE=new v(t.Gx,t.Gy,n.ONE),v.ZERO=new v(n.ZERO,n.ONE,n.ZERO),v.Fp=n,v.Fn=r;const B=r.BITS,O=function(t,e){return{constTimeNegate:F,hasPrecomputes:t=>1!==Z(t),unsafeLadder(e,n,r=t.ZERO){let o=e;for(;n>N;)n&A&&(r=r.add(o)),o=o.double(),n>>=A;return r},precomputeWindow(t,n){const{windows:r,windowSize:o}=P(n,e),i=[];let s=t,a=s;for(let e=0;e<r;e++){a=s,i.push(a);for(let t=1;t<o;t++)a=a.add(s),i.push(a);s=a.double()}return i},wNAF(n,r,o){let i=t.ZERO,s=t.BASE;const a=P(n,e);for(let t=0;t<a.windows;t++){const{nextN:e,offset:n,isZero:f,isNeg:c,isNegF:u,offsetF:d}=H(o,t,a);o=e,f?s=s.add(F(u,r[d])):i=i.add(F(c,r[n]))}return k(o),{p:i,f:s}},wNAFUnsafe(n,r,o,i=t.ZERO){const s=P(n,e);for(let t=0;t<s.windows&&o!==N;t++){const{nextN:e,offset:n,isZero:a,isNeg:f}=H(o,t,s);if(o=e,!a){const t=r[n];i=i.add(f?t.negate():t)}}return k(o),i},getPrecomputes(t,e,n){let r=U.get(e);return r||(r=this.precomputeWindow(e,t),1!==t&&("function"==typeof n&&(r=n(r)),U.set(e,r))),r},wNAFCached(t,e,n){const r=Z(t);
2return this.wNAF(r,this.getPrecomputes(r,t,n),e)},wNAFCachedUnsafe(t,e,n,r){const o=Z(t);return 1===o?this.unsafeLadder(t,e,r):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),e,r)},setWindowSize(t,n){z(n,e),V.set(t,n),U.delete(t)}}}(v,e.endo?Math.ceil(B/2):B);return v}function Q(t){return Uint8Array.of(t?2:3)}function tt(t,e,n={}){(0,a.DS)(e,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=e.randomBytes||o.po,i=e.hmac||((t,...n)=>s(e.hash,t,(0,o.Id)(...n))),{Fp:f,Fn:u}=t,{ORDER:d,BITS:l}=u;function h(t){return t>d>>M}function w(t,e){if(!u.isValidNot0(e))throw new Error(`invalid signature ${t}: out of range 1..CURVE.n`)}class g{constructor(t,e,n){w("r",t),w("s",e),this.r=t,this.s=e,null!=n&&(this.recovery=n),Object.freeze(this)}static fromCompact(t){const e=u.BYTES,n=(0,a.qj)("compactSignature",t,2*e);return new g(u.fromBytes(n.subarray(0,e)),u.fromBytes(n.subarray(e,2*e)))}static fromDER(t){const{r:e,s:n}=K.toSig((0,a.qj)("DER",t));return new g(e,n)}assertValidity(){}addRecoveryBit(t){return new g(this.r,this.s,t)}recoverPublicKey(e){const n=f.ORDER,{r,s:i,recovery:s}=this;if(null==s||![0,1,2,3].includes(s))throw new Error("recovery id invalid");if(d*_<n&&s>1)throw new Error("recovery id is ambiguous for h>1 curve");const c=2===s||3===s?r+d:r;if(!f.isValid(c))throw new Error("recovery id 2 or 3 invalid");const l=f.toBytes(c),h=t.fromHex((0,o.Id)(Q(!(1&s)),l)),w=u.inv(c),p=v((0,a.qj)("msgHash",e)),g=u.create(-p*w),m=u.create(i*w),y=t.BASE.multiplyUnsafe(g).add(h.multiplyUnsafe(m));if(y.is0())throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,u.neg(this.s),this.recovery):this}toBytes(t){if("compact"===t)return(0,o.Id)(u.toBytes(this.r),u.toBytes(this.s));if("der"===t)return(0,o.aT)(K.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,o.My)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,o.My)(this.toBytes("compact"))}}const m=J(u,n.allowedPrivateKeyLengths,n.wrapPrivateKey),y={isValidPrivateKey(t){try{return m(t),!0}catch(e){return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const t=d;return function(t,e,n=!1){const r=t.length,o=R(e),i=q(e);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const s=p(n?(0,a.lX)(t):(0,a.Ph)(t),e-c)+c;return n?(0,a.z)(s,o):(0,a.lq)(s,o)}(r(q(t)),t)},precompute:(e=8,n=t.BASE)=>n.precompute(e,!1)};function E(e){if("bigint"==typeof e)return!1;if(e instanceof t)return!0;const r=(0,a.qj)("key",e).length,o=f.BYTES,i=o+1,s=2*o+1;return n.allowedPrivateKeyLengths||u.BYTES===i?void 0:r===i||r===s}const b=e.bits2int||function(t){if(t.length>8192)throw new Error("input is too large");const e=(0,a.Ph)(t),n=8*t.length-l;return n>0?e>>BigInt(n):e},v=e.bits2int_modN||function(t){return u.create(b(t))},B=(0,a.OG)(l);function x(t){return(0,a.aK)("num < 2^"+l,t,G,B),u.toBytes(t)}function O(n,i,s=S){if(["recovered","canonical"].some(t=>t in s))throw new Error("sign() legacy options not supported");const{hash:c}=e;let{lowS:d,prehash:l,extraEntropy:w}=s;null==d&&(d=!0),n=(0,a.qj)("msgHash",n),T(s),l&&(n=(0,a.qj)("prehashed msgHash",c(n)));const p=v(n),y=m(i),E=[x(y),x(p)];if(null!=w&&!1!==w){const t=!0===w?r(f.BYTES):w;E.push((0,a.qj)("extraEntropy",t))}const B=(0,o.Id)(...E),O=p;return{seed:B,k2sig:function(e){const n=b(e);if(!u.isValidNot0(n))return;const r=u.inv(n),o=t.BASE.multiply(n).toAffine(),i=u.create(o.x);if(i===G)return;const s=u.create(r*u.create(O+i*y));if(s===G)return;let a=(o.x===i?0:2)|Number(o.y&M),f=s;return d&&h(s)&&(f=function(t){return h(t)?u.neg(t):t}(s),a^=1),new g(i,f,a)}}}const S={lowS:e.lowS,prehash:!1},I={lowS:e.lowS,prehash:!1};return t.BASE.precompute(8),Object.freeze({getPublicKey:function(e,n=!0){return t.fromPrivateKey(e).toBytes(n)},getSharedSecret:function(e,n,r=!0){if(!0===E(e))throw new Error("first arg must be private key");if(!1===E(n))throw new Error("second arg must be public key");return t.fromHex(n).multiply(m(e)).toBytes(r)},sign:function(t,n,r=S){const{seed:o,k2sig:s}=O(t,n,r);return(0,a.fg)(e.hash.outputLen,u.BYTES,i)(o,s)},verify:function(n,r,i,s=I){const f=n;r=(0,a.qj)("msgHash",r),i=(0,a.qj)("publicKey",i),T(s);const{lowS:c,prehash:d,format:l}=s;if("strict"in s)throw new Error("options.strict was renamed to lowS");if(void 0!==l&&!["compact","der","js"].includes(l))throw new Error('format must be "compact", "der" or "js"');const h="string"==typeof f||(0,o.aY)(f),w=!h&&!l&&"object"==typeof f&&null!==f&&"bigint"==typeof f.r&&"bigint"==typeof f.s;if(!h&&!w)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let p,m;try{if(w){if(void 0!==l&&"js"!==l)throw new Error("invalid format");p=new g(f.r,f.s)}if(h){try{"compact"!==l&&(p=g.fromDER(f))}catch(R){if(!(R instanceof K.Err))throw R}p||"der"===l||(p=g.fromCompact(f))}m=t.fromHex(i)}catch(q){return!1}if(!p)return!1;if(c&&p.hasHighS())return!1;d&&(r=e.hash(r));const{r:y,s:E}=p,b=v(r),B=u.inv(E),x=u.create(b*B),O=u.create(y*B),S=t.BASE.multiplyUnsafe(x).add(m.multiplyUnsafe(O));return!S.is0()&&u.create(S.x)===y},utils:y,Point:t,Signature:g})}function et(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy};return{CURVE:e,curveOpts:{Fp:t.Fp,Fn:I(e.n,t.nBitLength),allowedPrivateKeyLengths:t.allowedPrivateKeyLengths,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,wrapPrivateKey:t.wrapPrivateKey,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes}}}function nt(t){const{CURVE:e,curveOpts:n,ecdsaOpts:r}=function(t){const{CURVE:e,curveOpts:n}=et(t);return{CURVE:e,curveOpts:n,ecdsaOpts:{hash:t.hash,hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN}}}(t);return function(t,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:t})}(t,tt(X(e,n),r,n))}const rt={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},ot=(BigInt(0),BigInt(1)),it=BigInt(2),st=(t,e)=>(t+e/it)/e;function at(t){const e=rt.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,d=g(u,n,e)*u%e,l=g(
2d,n,e)*u%e,h=g(l,it,e)*c%e,w=g(h,o,e)*h%e,p=g(w,i,e)*w%e,m=g(p,a,e)*p%e,y=g(m,f,e)*m%e,E=g(y,a,e)*p%e,b=g(E,n,e)*u%e,v=g(b,s,e)*w%e,B=g(v,r,e)*c%e,x=g(B,it,e);if(!ft.eql(ft.sqr(x),t))throw new Error("Cannot find square root");return x}const ft=I(rt.p,void 0,void 0,{sqrt:at}),ct=function(t,e){const n=e=>nt({...t,hash:e});return{...n(e),create:n}}({...rt,Fp:ft,lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=rt.n,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-ot*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),a=st(i*t,e),f=st(-r*t,e);let c=p(t-a*n-f*o,e),u=p(-a*r-f*i,e);const d=c>s,l=u>s;if(d&&(c=e-c),l&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:c,k2neg:l,k2:u}}}},r.sc)},81633:(t,e,n)=>{n.d(e,{DS:()=>b,OG:()=>y,Ph:()=>c,aK:()=>g,dJ:()=>m,e8:()=>s,ex:()=>w,fg:()=>E,lX:()=>u,lq:()=>d,qj:()=>h,x:()=>v,z:()=>l,zW:()=>a});var r=n(38628);const o=BigInt(0),i=BigInt(1);function s(t,e){if("boolean"!=typeof e)throw new Error(t+" boolean expected, got "+e)}function a(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function f(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?o:BigInt("0x"+t)}function c(t){return f((0,r.My)(t))}function u(t){return(0,r.DO)(t),f((0,r.My)(Uint8Array.from(t).reverse()))}function d(t,e){return(0,r.aT)(t.toString(16).padStart(2*e,"0"))}function l(t,e){return d(t,e).reverse()}function h(t,e,n){let o;if("string"==typeof e)try{o=(0,r.aT)(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else{if(!(0,r.aY)(e))throw new Error(t+" must be hex string or Uint8Array");o=Uint8Array.from(e)}const i=o.length;if("number"==typeof n&&i!==n)throw new Error(t+" of length "+n+" expected, got "+i);return o}function w(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return 0===n}const p=t=>"bigint"==typeof t&&o<=t;function g(t,e,n,r){if(!function(t,e,n){return p(t)&&p(e)&&p(n)&&e<=t&&t<n}(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function m(t){let e;for(e=0;t>o;t>>=i,e+=1);return e}const y=t=>(i<<BigInt(t))-i;function E(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");const o=t=>new Uint8Array(t),i=t=>Uint8Array.of(t);let s=o(t),a=o(t),f=0;const c=()=>{s.fill(1),a.fill(0),f=0},u=(...t)=>n(a,s,...t),d=(t=o(0))=>{a=u(i(0),t),s=u(),0!==t.length&&(a=u(i(1),t),s=u())},l=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t<e;){s=u();const e=s.slice();n.push(e),t+=s.length}return(0,r.Id)(...n)};return(t,e)=>{let n;for(c(),d(t);!(n=e(l()));)d();return c(),n}}function b(t,e,n={}){if(!t||"object"!=typeof t)throw new Error("expected valid options object");function r(e,n,r){const o=t[e];if(r&&void 0===o)return;const i=typeof o;if(i!==n||null===o)throw new Error(`param "${e}" is invalid: expected ${n}, got ${i}`)}Object.entries(e).forEach(([t,e])=>r(t,e,!1)),Object.entries(n).forEach(([t,e])=>r(t,e,!0))}function v(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}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.