jobsys-newbie
Version:
Enhanced component based on ant-design-vue
1 lines • 151 kB
JavaScript
const e=require(`./chunk-DMQnFFSv.cjs`);let t=require(`vue`),n=require(`ant-design-vue`),r=require(`dayjs`);r=e.a(r);let i=require(`lodash-es`),a=require(`axios`);a=e.a(a);const o=typeof globalThis==`object`&&`crypto`in globalThis?globalThis.crypto:void 0;function s(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function c(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function l(e,...t){if(!s(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function u(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.createHasher`);c(e.outputLen),c(e.blockLen)}function d(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function f(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var p=(()=>typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`)(),m=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function h(e){if(l(e),p)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=m[e[n]];return t}var g={_0:48,_9:57,A:65,F:70,a:97,f:102};function _(e){if(e>=g._0&&e<=g._9)return e-g._0;if(e>=g.A&&e<=g.F)return e-(g.A-10);if(e>=g.a&&e<=g.f)return e-(g.a-10)}function v(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);if(p)return Uint8Array.fromHex(e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=_(e.charCodeAt(i)),a=_(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function y(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function b(e){return new TextDecoder().decode(e)}function x(e){return typeof e==`string`&&(e=y(e)),l(e),e}function S(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];l(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}var C=class{};function w(e=32){if(o&&typeof o.getRandomValues==`function`)return o.getRandomValues(new Uint8Array(e));if(o&&typeof o.randomBytes==`function`)return Uint8Array.from(o.randomBytes(e));throw Error(`crypto.getRandomValues must be defined`)}var T=BigInt(0),E=BigInt(1);function D(e,t){if(typeof t!=`boolean`)throw Error(e+` boolean expected, got `+t)}function O(e,t=``){if(typeof e!=`boolean`){let n=t&&`"${t}"`;throw Error(n+`expected boolean, got type=`+typeof e)}return e}function ee(e,t,n=``){let r=s(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`;throw Error(o+`expected Uint8Array`+s+`, got `+c)}return e}function te(e){let t=e.toString(16);return t.length&1?`0`+t:t}function ne(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return e===``?T:BigInt(`0x`+e)}function re(e){return ne(h(e))}function ie(e){return l(e),ne(h(Uint8Array.from(e).reverse()))}function ae(e,t){return v(e.toString(16).padStart(t*2,`0`))}function oe(e,t){return ae(e,t).reverse()}function se(e){return v(te(e))}function k(e,t,n){let r;if(typeof t==`string`)try{r=v(t)}catch(t){throw Error(e+` must be hex string or Uint8Array, cause: `+t)}else if(s(t))r=Uint8Array.from(t);else throw Error(e+` must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(e+` of length `+n+` expected, got `+i);return r}function ce(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function le(e){return Uint8Array.from(e)}function ue(e){return Uint8Array.from(e,(t,n)=>{let r=t.charCodeAt(0);if(t.length!==1||r>127)throw Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}var de=e=>typeof e==`bigint`&&T<=e;function fe(e,t,n){return de(e)&&de(t)&&de(n)&&t<=e&&e<n}function pe(e,t,n,r){if(!fe(t,n,r))throw Error(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function me(e){let t;for(t=0;e>T;e>>=E,t+=1);return t}function he(e,t){return e>>BigInt(t)&E}function ge(e,t,n){return e|(n?E:T)<<BigInt(t)}const _e=e=>(E<<BigInt(e))-E;function ve(e,t,n){if(typeof e!=`number`||e<2)throw Error(`hashLen must be a number`);if(typeof t!=`number`||t<2)throw Error(`qByteLen must be a number`);if(typeof n!=`function`)throw Error(`hmacFn must be a function`);let r=e=>new Uint8Array(e),i=e=>Uint8Array.of(e),a=r(e),o=r(e),s=0,c=()=>{a.fill(1),o.fill(0),s=0},l=(...e)=>n(o,a,...e),u=(e=r(0))=>{o=l(i(0),e),a=l(),e.length!==0&&(o=l(i(1),e),a=l())},d=()=>{if(s++>=1e3)throw Error(`drbg: tried 1000 values`);let e=0,n=[];for(;e<t;){a=l();let t=a.slice();n.push(t),e+=a.length}return S(...n)};return(e,t)=>{c(),u(e);let n;for(;!(n=t(d()));)u();return c(),n}}var ye={bigint:e=>typeof e==`bigint`,function:e=>typeof e==`function`,boolean:e=>typeof e==`boolean`,string:e=>typeof e==`string`,stringOrUint8Array:e=>typeof e==`string`||s(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e==`function`&&Number.isSafeInteger(e.outputLen)};function be(e,t,n={}){let r=(t,n,r)=>{let i=ye[n];if(typeof i!=`function`)throw Error(`invalid validator function`);let a=e[t];if(!(r&&a===void 0)&&!i(a,e))throw Error(`param `+String(t)+` is invalid. Expected `+n+`, got `+a)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e}function xe(e){return typeof e==`function`&&Number.isSafeInteger(e.outputLen)}function Se(e,t,n={}){if(!e||typeof e!=`object`)throw Error(`expected valid options object`);function r(t,n,r){let i=e[t];if(r&&i===void 0)return;let a=typeof i;if(a!==n||i===null)throw Error(`param "${t}" is invalid: expected ${n}, got ${a}`)}Object.entries(t).forEach(([e,t])=>r(e,t,!1)),Object.entries(n).forEach(([e,t])=>r(e,t,!0))}const Ce=()=>{throw Error(`not implemented`)};function we(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e(n,...r);return t.set(n,a),a}}const Te=l,Ee=c,De=h,Oe=b,A=S,ke=v,Ae=s,je=w,Me=y,Ne=D,j=te,M=ne,Pe=re,Fe=ie,Ie=ae,Le=oe,Re=se,ze=k,Be=ce,Ve=le,He=ue,Ue=fe,We=pe,Ge=me,Ke=he,qe=ge,Je=_e,Ye=ve,Xe=Ce,Ze=we,Qe=be,$e=xe;var et=class extends C{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,u(e);let n=x(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),f(i)}update(e){return d(this),this.iHash.update(e),this}digestInto(e){d(this),l(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const tt=(e,t,n)=>new et(e,t).update(n).digest();tt.create=(e,t)=>new et(e,t);var N=BigInt(0),P=BigInt(1),nt=BigInt(2),rt=BigInt(3),it=BigInt(4),at=BigInt(5),ot=BigInt(7),st=BigInt(8),ct=BigInt(9),lt=BigInt(16);function ut(e,t){let n=e%t;return n>=N?n:t+n}function dt(e,t){if(e===N)throw Error(`invert: expected non-zero number`);if(t<=N)throw Error(`invert: expected positive modulus, got `+t);let n=ut(e,t),r=t,i=N,a=P,o=P,s=N;for(;n!==N;){let e=r/n,t=r%n,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}if(r!==P)throw Error(`invert: does not exist`);return ut(i,t)}function ft(e,t,n){if(!e.eql(e.sqr(t),n))throw Error(`Cannot find square root`)}function pt(e,t){let n=(e.ORDER+P)/it,r=e.pow(t,n);return ft(e,r,t),r}function mt(e,t){let n=(e.ORDER-at)/st,r=e.mul(t,nt),i=e.pow(r,n),a=e.mul(t,i),o=e.mul(e.mul(a,nt),i),s=e.mul(a,e.sub(o,e.ONE));return ft(e,s,t),s}function ht(e){let t=wt(e),n=gt(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),o=(e+ot)/lt;return(e,t)=>{let n=e.pow(t,o),s=e.mul(n,r),c=e.mul(n,i),l=e.mul(n,a),u=e.eql(e.sqr(s),t),d=e.eql(e.sqr(c),t);n=e.cmov(n,s,u),s=e.cmov(l,c,d);let f=e.eql(e.sqr(s),t),p=e.cmov(n,s,f);return ft(e,p,t),p}}function gt(e){if(e<rt)throw Error(`sqrt is not defined for small field`);let t=e-P,n=0;for(;t%nt===N;)t/=nt,n++;let r=nt,i=wt(e);for(;St(i,r)===1;)if(r++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(n===1)return pt;let a=i.pow(r,t),o=(t+P)/nt;return function(e,r){if(e.is0(r))return r;if(St(e,r)!==1)throw Error(`Cannot find square root`);let i=n,s=e.mul(e.ONE,a),c=e.pow(r,t),l=e.pow(r,o);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,n=e.sqr(c);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw Error(`Cannot find square root`);let r=P<<BigInt(i-t-1),a=e.pow(s,r);i=t,s=e.sqr(a),c=e.mul(c,s),l=e.mul(l,a)}return l}}function _t(e){return e%it===rt?pt:e%st===at?mt:e%lt===ct?ht(e):gt(e)}var vt=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function yt(e){return Se(e,vt.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`number`,BITS:`number`})),e}function bt(e,t,n){if(n<N)throw Error(`invalid exponent, negatives unsupported`);if(n===N)return e.ONE;if(n===P)return t;let r=e.ONE,i=t;for(;n>N;)n&P&&(r=e.mul(r,i)),i=e.sqr(i),n>>=P;return r}function xt(e,t,n=!1){let r=Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),a=e.inv(i);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),a),r}function St(e,t){let n=(e.ORDER-P)/nt,r=e.pow(t,n),i=e.eql(r,e.ONE),a=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!a&&!o)throw Error(`invalid Legendre symbol result`);return i?1:a?0:-1}function Ct(e,t){t!==void 0&&c(t);let n=t===void 0?e.toString(2).length:t;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function wt(e,t,n=!1,r={}){if(e<=N)throw Error(`invalid field: expected ORDER > 0, got `+e);let i,a,o=!1,s;if(typeof t==`object`&&t){if(r.sqrt||n)throw Error(`cannot specify opts in two arguments`);let e=t;e.BITS&&(i=e.BITS),e.sqrt&&(a=e.sqrt),typeof e.isLE==`boolean`&&(n=e.isLE),typeof e.modFromBytes==`boolean`&&(o=e.modFromBytes),s=e.allowedLengths}else typeof t==`number`&&(i=t),r.sqrt&&(a=r.sqrt);let{nBitLength:c,nByteLength:l}=Ct(e,i);if(l>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);let u,d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:l,MASK:_e(c),ZERO:N,ONE:P,allowedLengths:s,create:t=>ut(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`invalid field element: expected bigint, got `+typeof t);return N<=t&&t<e},is0:e=>e===N,isValidNot0:e=>!d.is0(e)&&d.isValid(e),isOdd:e=>(e&P)===P,neg:t=>ut(-t,e),eql:(e,t)=>e===t,sqr:t=>ut(t*t,e),add:(t,n)=>ut(t+n,e),sub:(t,n)=>ut(t-n,e),mul:(t,n)=>ut(t*n,e),pow:(e,t)=>bt(d,e,t),div:(t,n)=>ut(t*dt(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>dt(t,e),sqrt:a||(t=>(u||=_t(e),u(d,t))),toBytes:e=>n?oe(e,l):ae(e,l),fromBytes:(t,r=!0)=>{if(s){if(!s.includes(t.length)||t.length>l)throw Error(`Field.fromBytes: expected `+s+` bytes, got `+t.length);let e=new Uint8Array(l);e.set(t,n?0:e.length-t.length),t=e}if(t.length!==l)throw Error(`Field.fromBytes: expected `+l+` bytes, got `+t.length);let i=n?ie(t):re(t);if(o&&(i=ut(i,e)),!r&&!d.isValid(i))throw Error(`invalid field element: outside of range 0..ORDER`);return i},invertBatch:e=>xt(d,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(d)}function Tt(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);let t=e.toString(2).length;return Math.ceil(t/8)}function Et(e){let t=Tt(e);return t+Math.ceil(t/2)}function Dt(e,t,n=!1){let r=e.length,i=Tt(t),a=Et(t);if(r<16||r<a||r>1024)throw Error(`expected `+a+`-1024 bytes of input, got `+r);let o=ut(n?ie(e):re(e),t-P)+P;return n?oe(o,i):ae(o,i)}var Ot=BigInt(0),kt=BigInt(1);function At(e,t){let n=t.negate();return e?n:t}function jt(e,t){let n=xt(e.Fp,t.map(e=>e.Z));return t.map((t,r)=>e.fromAffine(t.toAffine(n[r])))}function Mt(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`invalid window size, expected [1..`+t+`], got W=`+e)}function Nt(e,t){Mt(e,t);let n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e;return{windows:n,windowSize:r,mask:_e(e),maxNumber:i,shiftBy:BigInt(e)}}function Pt(e,t,n){let{windowSize:r,mask:i,maxNumber:a,shiftBy:o}=n,s=Number(e&i),c=e>>o;s>r&&(s-=a,c+=kt);let l=t*r,u=l+Math.abs(s)-1,d=s===0,f=s<0,p=t%2!=0;return{nextN:c,offset:u,isZero:d,isNeg:f,isNegF:p,offsetF:l}}function Ft(e,t){if(!Array.isArray(e))throw Error(`array expected`);e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function It(e,t){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,n)=>{if(!t.isValid(e))throw Error(`invalid scalar at index `+n)})}var Lt=new WeakMap,Rt=new WeakMap;function zt(e){return Rt.get(e)||1}function Bt(e){if(e!==Ot)throw Error(`invalid wNAF`)}var Vt=class{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let r=e;for(;t>Ot;)t&kt&&(n=n.add(r)),r=r.double(),t>>=kt;return n}precomputeWindow(e,t){let{windows:n,windowSize:r}=Nt(t,this.bits),i=[],a=e,o=a;for(let e=0;e<n;e++){o=a,i.push(o);for(let e=1;e<r;e++)o=o.add(a),i.push(o);a=o.double()}return i}wNAF(e,t,n){if(!this.Fn.isValid(n))throw Error(`invalid scalar`);let r=this.ZERO,i=this.BASE,a=Nt(e,this.bits);for(let e=0;e<a.windows;e++){let{nextN:o,offset:s,isZero:c,isNeg:l,isNegF:u,offsetF:d}=Pt(n,e,a);n=o,c?i=i.add(At(u,t[d])):r=r.add(At(l,t[s]))}return Bt(n),{p:r,f:i}}wNAFUnsafe(e,t,n,r=this.ZERO){let i=Nt(e,this.bits);for(let e=0;e<i.windows&&n!==Ot;e++){let{nextN:a,offset:o,isZero:s,isNeg:c}=Pt(n,e,i);if(n=a,!s){let e=t[o];r=r.add(c?e.negate():e)}}return Bt(n),r}getPrecomputes(e,t,n){let r=Lt.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&(typeof n==`function`&&(r=n(r)),Lt.set(t,r))),r}cached(e,t,n){let r=zt(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)}unsafe(e,t,n,r){let i=zt(e);return i===1?this._unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)}createCache(e,t){Mt(t,this.bits),Rt.set(e,t),Lt.delete(e)}hasCache(e){return zt(e)!==1}};function Ht(e,t,n,r){let i=t,a=e.ZERO,o=e.ZERO;for(;n>Ot||r>Ot;)n&kt&&(a=a.add(i)),r&kt&&(o=o.add(i)),i=i.double(),n>>=kt,r>>=kt;return{p1:a,p2:o}}function Ut(e,t,n,r){Ft(n,e),It(r,t);let i=n.length,a=r.length;if(i!==a)throw Error(`arrays of points and scalars must have equal length`);let o=e.ZERO,s=me(BigInt(i)),c=1;s>12?c=s-3:s>4?c=s-2:s>0&&(c=2);let l=_e(c),u=Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c,f=o;for(let e=d;e>=0;e-=c){u.fill(o);for(let t=0;t<a;t++){let i=r[t],a=Number(i>>BigInt(e)&l);u[a]=u[a].add(n[t])}let t=o;for(let e=u.length-1,n=o;e>0;e--)n=n.add(u[e]),t=t.add(n);if(f=f.add(t),e!==0)for(let e=0;e<c;e++)f=f.double()}return f}function Wt(e,t,n){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return yt(t),t}else return wt(e,{isLE:n})}function Gt(e,t,n={},r){if(r===void 0&&(r=e===`edwards`),!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(typeof n==`bigint`&&n>Ot))throw Error(`CURVE.${e} must be positive bigint`)}let i=Wt(t.p,n.Fp,r),a=Wt(t.n,n.Fn,r),o=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of o)if(!i.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:a}}var Kt=(e,t)=>(e+(e>=0?t:-t)/en)/t;function qt(e,t,n){let[[r,i],[a,o]]=t,s=Kt(o*e,n),c=Kt(-i*e,n),l=e-s*r-c*a,u=-s*i-c*o,d=l<Qt,f=u<Qt;d&&(l=-l),f&&(u=-u);let p=_e(Math.ceil(me(n)/2))+$t;if(l<Qt||l>=p||u<Qt||u>=p)throw Error(`splitScalar (endomorphism): failed, k=`+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}function Jt(e){if(![`compact`,`recovered`,`der`].includes(e))throw Error(`Signature format must be "compact", "recovered", or "der"`);return e}function Yt(e,t){let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return O(n.lowS,`lowS`),O(n.prehash,`prehash`),n.format!==void 0&&Jt(n.format),n}var Xt=class extends Error{constructor(e=``){super(e)}};const Zt={Err:Xt,_tlv:{encode:(e,t)=>{let{Err:n}=Zt;if(e<0||e>256)throw new n(`tlv.encode: wrong tag`);if(t.length&1)throw new n(`tlv.encode: unpadded data`);let r=t.length/2,i=te(r);if(i.length/2&128)throw new n(`tlv.encode: long form length too big`);let a=r>127?te(i.length/2|128):``;return te(e)+a+i+t},decode(e,t){let{Err:n}=Zt,r=0;if(e<0||e>256)throw new n(`tlv.encode: wrong tag`);if(t.length<2||t[r++]!==e)throw new n(`tlv.decode: wrong tlv`);let i=t[r++],a=!!(i&128),o=0;if(!a)o=i;else{let e=i&127;if(!e)throw new n(`tlv.decode(long): indefinite length not supported`);if(e>4)throw new n(`tlv.decode(long): byte length is too big`);let a=t.subarray(r,r+e);if(a.length!==e)throw new n(`tlv.decode: length bytes not complete`);if(a[0]===0)throw new n(`tlv.decode(long): zero leftmost byte`);for(let e of a)o=o<<8|e;if(r+=e,o<128)throw new n(`tlv.decode(long): not minimal encoding`)}let s=t.subarray(r,r+o);if(s.length!==o)throw new n(`tlv.decode: wrong value length`);return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){let{Err:t}=Zt;if(e<Qt)throw new t(`integer: negative integers are not allowed`);let n=te(e);if(Number.parseInt(n[0],16)&8&&(n=`00`+n),n.length&1)throw new t(`unexpected DER parsing assertion: unpadded hex`);return n},decode(e){let{Err:t}=Zt;if(e[0]&128)throw new t(`invalid signature integer: negative`);if(e[0]===0&&!(e[1]&128))throw new t(`invalid signature integer: unnecessary leading zero`);return re(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=Zt,i=k(`signature`,e),{v:a,l:o}=r.decode(48,i);if(o.length)throw new t(`invalid signature: left bytes after parsing`);let{v:s,l:c}=r.decode(2,a),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t(`invalid signature: left bytes after parsing`);return{r:n.decode(s),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=Zt,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}};var Qt=BigInt(0),$t=BigInt(1),en=BigInt(2),tn=BigInt(3),nn=BigInt(4);function rn(e,t){let{BYTES:n}=e,r;if(typeof t==`bigint`)r=t;else{let i=k(`private key`,t);try{r=e.fromBytes(i)}catch{throw Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw Error(`invalid private key: out of range [1..N-1]`);return r}function an(e,t={}){let n=Gt(`weierstrass`,e,t),{Fp:r,Fn:i}=n,a=n.CURVE,{h:o,n:s}=a;Se(t,{},{allowInfinityPoint:`boolean`,clearCofactor:`function`,isTorsionFree:`function`,fromBytes:`function`,toBytes:`function`,endo:`object`,wrapPrivateKey:`boolean`});let{endo:c}=t;if(c&&(!r.is0(a.a)||typeof c.beta!=`bigint`||!Array.isArray(c.basises)))throw Error(`invalid endo: expected "beta": bigint and "basises": array`);let l=sn(r,i);function u(){if(!r.isOdd)throw Error(`compression is not supported: Field does not have .isOdd()`)}function d(e,t,n){let{x:i,y:a}=t.toAffine(),o=r.toBytes(i);return O(n,`isCompressed`),n?(u(),S(on(!r.isOdd(a)),o)):S(Uint8Array.of(4),o,r.toBytes(a))}function f(e){ee(e,void 0,`Point`);let{publicKey:t,publicKeyUncompressed:n}=l,i=e.length,a=e[0],o=e.subarray(1);if(i===t&&(a===2||a===3)){let e=r.fromBytes(o);if(!r.isValid(e))throw Error(`bad point: is not on curve, wrong x`);let t=g(e),n;try{n=r.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`bad point: is not on curve, sqrt error`+t)}u();let i=r.isOdd(n);return(a&1)==1!==i&&(n=r.neg(n)),{x:e,y:n}}else if(i===n&&a===4){let e=r.BYTES,t=r.fromBytes(o.subarray(0,e)),n=r.fromBytes(o.subarray(e,e*2));if(!_(t,n))throw Error(`bad point: is not on curve`);return{x:t,y:n}}else throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}let p=t.toBytes||d,m=t.fromBytes||f;function g(e){let t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,a.a)),a.b)}function _(e,t){let n=r.sqr(t),i=g(e);return r.eql(n,i)}if(!_(a.Gx,a.Gy))throw Error(`bad curve params: generator point`);let v=r.mul(r.pow(a.a,tn),nn),y=r.mul(r.sqr(a.b),BigInt(27));if(r.is0(r.add(v,y)))throw Error(`bad curve params: a or b`);function b(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw Error(`bad point coordinate ${e}`);return t}function x(e){if(!(e instanceof D))throw Error(`ProjectivePoint expected`)}function C(e){if(!c||!c.basises)throw Error(`no endo`);return qt(e,c.basises,i.ORDER)}let w=we((e,t)=>{let{X:n,Y:i,Z:a}=e;if(r.eql(a,r.ONE))return{x:n,y:i};let o=e.is0();t??=o?r.ONE:r.inv(a);let s=r.mul(n,t),c=r.mul(i,t),l=r.mul(a,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw Error(`invZ was invalid`);return{x:s,y:c}}),T=we(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.Y))return;throw Error(`bad point: ZERO`)}let{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw Error(`bad point: x or y not field elements`);if(!_(n,i))throw Error(`bad point: equation left != right`);if(!e.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`);return!0});function E(e,t,n,i,a){return n=new D(r.mul(n.X,e),n.Y,n.Z),t=At(i,t),n=At(a,n),t.add(n)}class D{constructor(e,t,n){this.X=b(`x`,e),this.Y=b(`y`,t,!0),this.Z=b(`z`,n),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw Error(`invalid affine point`);if(e instanceof D)throw Error(`projective point not allowed`);return r.is0(t)&&r.is0(n)?D.ZERO:new D(t,n,r.ONE)}static fromBytes(e){let t=D.fromAffine(m(ee(e,void 0,`point`)));return t.assertValidity(),t}static fromHex(e){return D.fromBytes(k(`pointHex`,e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return ne.createCache(this,e),t||this.multiply(tn),this}assertValidity(){T(this)}hasEvenY(){let{y:e}=this.toAffine();if(!r.isOdd)throw Error(`Field doesn't support isOdd`);return!r.isOdd(e)}equals(e){x(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.eql(r.mul(t,s),r.mul(a,i)),l=r.eql(r.mul(n,s),r.mul(o,i));return c&&l}negate(){return new D(this.X,r.neg(this.Y),this.Z)}double(){let{a:e,b:t}=a,n=r.mul(t,tn),{X:i,Y:o,Z:s}=this,c=r.ZERO,l=r.ZERO,u=r.ZERO,d=r.mul(i,i),f=r.mul(o,o),p=r.mul(s,s),m=r.mul(i,o);return m=r.add(m,m),u=r.mul(i,s),u=r.add(u,u),c=r.mul(e,u),l=r.mul(n,p),l=r.add(c,l),c=r.sub(f,l),l=r.add(f,l),l=r.mul(c,l),c=r.mul(m,c),u=r.mul(n,u),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,p),d=r.mul(d,m),l=r.add(l,d),p=r.mul(o,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),u=r.mul(p,f),u=r.add(u,u),u=r.add(u,u),new D(c,l,u)}add(e){x(e);let{X:t,Y:n,Z:i}=this,{X:o,Y:s,Z:c}=e,l=r.ZERO,u=r.ZERO,d=r.ZERO,f=a.a,p=r.mul(a.b,tn),m=r.mul(t,o),h=r.mul(n,s),g=r.mul(i,c),_=r.add(t,n),v=r.add(o,s);_=r.mul(_,v),v=r.add(m,h),_=r.sub(_,v),v=r.add(t,i);let y=r.add(o,c);return v=r.mul(v,y),y=r.add(m,g),v=r.sub(v,y),y=r.add(n,i),l=r.add(s,c),y=r.mul(y,l),l=r.add(h,g),y=r.sub(y,l),d=r.mul(f,v),l=r.mul(p,g),d=r.add(l,d),l=r.sub(h,d),d=r.add(h,d),u=r.mul(l,d),h=r.add(m,m),h=r.add(h,m),g=r.mul(f,g),v=r.mul(p,v),h=r.add(h,g),g=r.sub(m,g),g=r.mul(f,g),v=r.add(v,g),m=r.mul(h,v),u=r.add(u,m),m=r.mul(y,v),l=r.mul(_,l),l=r.sub(l,m),m=r.mul(_,h),d=r.mul(y,d),d=r.add(d,m),new D(l,u,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(D.ZERO)}multiply(e){let{endo:n}=t;if(!i.isValidNot0(e))throw Error(`invalid scalar: out of range`);let r,a,o=e=>ne.cached(this,e,e=>jt(D,e));if(n){let{k1neg:t,k1:i,k2neg:s,k2:c}=C(e),{p:l,f:u}=o(i),{p:d,f}=o(c);a=u.add(f),r=E(n.beta,l,d,t,s)}else{let{p:t,f:n}=o(e);r=t,a=n}return jt(D,[r,a])[0]}multiplyUnsafe(e){let{endo:n}=t,r=this;if(!i.isValid(e))throw Error(`invalid scalar: out of range`);if(e===Qt||r.is0())return D.ZERO;if(e===$t)return r;if(ne.hasCache(this))return this.multiply(e);if(n){let{k1neg:t,k1:i,k2neg:a,k2:o}=C(e),{p1:s,p2:c}=Ht(D,r,i,o);return E(n.beta,s,c,t,a)}else return ne.unsafe(r,e)}multiplyAndAddUnsafe(e,t,n){let r=this.multiplyUnsafe(t).add(e.multiplyUnsafe(n));return r.is0()?void 0:r}toAffine(e){return w(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return o===$t?!0:e?e(D,this):ne.unsafe(this,s).is0()}clearCofactor(){let{clearCofactor:e}=t;return o===$t?this:e?e(D,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(e=!0){return O(e,`isCompressed`),this.assertValidity(),p(D,this,e)}toHex(e=!0){return h(this.toBytes(e))}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return jt(D,e)}static msm(e,t){return Ut(D,i,e,t)}static fromPrivateKey(e){return D.BASE.multiply(rn(i,e))}}D.BASE=new D(a.Gx,a.Gy,r.ONE),D.ZERO=new D(r.ZERO,r.ONE,r.ZERO),D.Fp=r,D.Fn=i;let te=i.BITS,ne=new Vt(D,t.endo?Math.ceil(te/2):te);return D.BASE.precompute(8),D}function on(e){return Uint8Array.of(e?2:3)}function sn(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function cn(e,t={}){let{Fn:n}=e,r=t.randomBytes||w,i=Object.assign(sn(e.Fp,n),{seed:Et(n.ORDER)});function a(e){try{return!!rn(n,e)}catch{return!1}}function o(t,n){let{publicKey:r,publicKeyUncompressed:a}=i;try{let i=t.length;return n===!0&&i!==r||n===!1&&i!==a?!1:!!e.fromBytes(t)}catch{return!1}}function s(e=r(i.seed)){return Dt(ee(e,i.seed,`seed`),n.ORDER)}function c(t,r=!0){return e.BASE.multiply(rn(n,t)).toBytes(r)}function l(e){let t=s(e);return{secretKey:t,publicKey:c(t)}}function u(t){if(typeof t==`bigint`)return!1;if(t instanceof e)return!0;let{secretKey:r,publicKey:a,publicKeyUncompressed:o}=i;if(n.allowedLengths||r===a)return;let s=k(`key`,t).length;return s===a||s===o}function d(t,r,i=!0){if(u(t)===!0)throw Error(`first arg must be private key`);if(u(r)===!1)throw Error(`second arg must be public key`);let a=rn(n,t);return e.fromHex(r).multiply(a).toBytes(i)}let f={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:s,isValidPrivateKey:a,randomPrivateKey:s,normPrivateKeyToScalar:e=>rn(n,e),precompute(t=8,n=e.BASE){return n.precompute(t,!1)}};return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:l,Point:e,utils:f,lengths:i})}function ln(e,t,n={}){u(t),Se(n,{},{hmac:`function`,lowS:`boolean`,randomBytes:`function`,bits2int:`function`,bits2int_modN:`function`});let r=n.randomBytes||w,i=n.hmac||((e,...n)=>tt(t,e,S(...n))),{Fp:a,Fn:o}=e,{ORDER:c,BITS:l}=o,{keygen:d,getPublicKey:f,getSharedSecret:p,utils:m,lengths:g}=cn(e,n),_={prehash:!1,lowS:typeof n.lowS==`boolean`?n.lowS:!1,format:void 0,extraEntropy:!1},y=`compact`;function b(e){return e>c>>$t}function x(e,t){if(!o.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function C(e,t){Jt(t);let n=g.signature;return ee(e,t===`compact`?n:t===`recovered`?n+1:void 0,`${t} signature`)}class T{constructor(e,t,n){this.r=x(`r`,e),this.s=x(`s`,t),n!=null&&(this.recovery=n),Object.freeze(this)}static fromBytes(e,t=y){C(e,t);let n;if(t===`der`){let{r:t,s:n}=Zt.toSig(ee(e));return new T(t,n)}t===`recovered`&&(n=e[0],t=`compact`,e=e.subarray(1));let r=o.BYTES,i=e.subarray(0,r),a=e.subarray(r,r*2);return new T(o.fromBytes(i),o.fromBytes(a),n)}static fromHex(e,t){return this.fromBytes(v(e),t)}addRecoveryBit(e){return new T(this.r,this.s,e)}recoverPublicKey(t){let n=a.ORDER,{r,s:i,recovery:s}=this;if(s==null||![0,1,2,3].includes(s))throw Error(`recovery id invalid`);if(c*en<n&&s>1)throw Error(`recovery id is ambiguous for h>1 curve`);let l=s===2||s===3?r+c:r;if(!a.isValid(l))throw Error(`recovery id 2 or 3 invalid`);let u=a.toBytes(l),d=e.fromBytes(S(on((s&1)==0),u)),f=o.inv(l),p=D(k(`msgHash`,t)),m=o.create(-p*f),h=o.create(i*f),g=e.BASE.multiplyUnsafe(m).add(d.multiplyUnsafe(h));if(g.is0())throw Error(`point at infinify`);return g.assertValidity(),g}hasHighS(){return b(this.s)}toBytes(e=y){if(Jt(e),e===`der`)return v(Zt.hexFromSig(this));let t=o.toBytes(this.r),n=o.toBytes(this.s);if(e===`recovered`){if(this.recovery==null)throw Error(`recovery bit must be present`);return S(Uint8Array.of(this.recovery),t,n)}return S(t,n)}toHex(e){return h(this.toBytes(e))}assertValidity(){}static fromCompact(e){return T.fromBytes(k(`sig`,e),`compact`)}static fromDER(e){return T.fromBytes(k(`sig`,e),`der`)}normalizeS(){return this.hasHighS()?new T(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes(`der`)}toDERHex(){return h(this.toBytes(`der`))}toCompactRawBytes(){return this.toBytes(`compact`)}toCompactHex(){return h(this.toBytes(`compact`))}}let E=n.bits2int||function(e){if(e.length>8192)throw Error(`input is too large`);let t=re(e),n=e.length*8-l;return n>0?t>>BigInt(n):t},D=n.bits2int_modN||function(e){return o.create(E(e))},O=_e(l);function te(e){return pe(`num < 2^`+l,e,Qt,O),o.toBytes(e)}function ne(e,n){return ee(e,void 0,`message`),n?ee(t(e),void 0,`prehashed message`):e}function ie(t,n,i){if([`recovered`,`canonical`].some(e=>e in i))throw Error(`sign() legacy options not supported`);let{lowS:a,prehash:s,extraEntropy:c}=Yt(i,_);t=ne(t,s);let l=D(t),u=rn(o,n),d=[te(u),te(l)];if(c!=null&&c!==!1){let e=c===!0?r(g.secretKey):c;d.push(k(`extraEntropy`,e))}let f=S(...d),p=l;function m(t){let n=E(t);if(!o.isValidNot0(n))return;let r=o.inv(n),i=e.BASE.multiply(n).toAffine(),s=o.create(i.x);if(s===Qt)return;let c=o.create(r*o.create(p+s*u));if(c===Qt)return;let l=(i.x===s?0:2)|Number(i.y&$t),d=c;return a&&b(c)&&(d=o.neg(c),l^=1),new T(s,d,l)}return{seed:f,k2sig:m}}function ae(e,n,r={}){e=k(`message`,e);let{seed:a,k2sig:s}=ie(e,n,r);return ve(t.outputLen,o.BYTES,i)(a,s)}function oe(e){let t,n=typeof e==`string`||s(e),r=!n&&typeof e==`object`&&!!e&&typeof e.r==`bigint`&&typeof e.s==`bigint`;if(!n&&!r)throw Error(`invalid signature, expected Uint8Array, hex string or Signature instance`);if(r)t=new T(e.r,e.s);else if(n){try{t=T.fromBytes(k(`sig`,e),`der`)}catch(e){if(!(e instanceof Zt.Err))throw e}if(!t)try{t=T.fromBytes(k(`sig`,e),`compact`)}catch{return!1}}return t||!1}function se(t,n,r,i={}){let{lowS:a,prehash:s,format:c}=Yt(i,_);if(r=k(`publicKey`,r),n=ne(k(`message`,n),s),`strict`in i)throw Error(`options.strict was renamed to lowS`);let l=c===void 0?oe(t):T.fromBytes(k(`sig`,t),c);if(l===!1)return!1;try{let t=e.fromBytes(r);if(a&&l.hasHighS())return!1;let{r:i,s}=l,c=D(n),u=o.inv(s),d=o.create(c*u),f=o.create(i*u),p=e.BASE.multiplyUnsafe(d).add(t.multiplyUnsafe(f));return p.is0()?!1:o.create(p.x)===i}catch{return!1}}function ce(e,t,n={}){let{prehash:r}=Yt(n,_);return t=ne(t,r),T.fromBytes(e,`recovered`).recoverPublicKey(t).toBytes()}return Object.freeze({keygen:d,getPublicKey:f,getSharedSecret:p,utils:m,lengths:g,Point:e,sign:ae,verify:se,recoverPublicKey:ce,Signature:T,hash:t})}function un(e){let t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp,r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0;return{CURVE:t,curveOpts:{Fp:n,Fn:wt(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}function dn(e){let{CURVE:t,curveOpts:n}=un(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function fn(e,t){let n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Ct(n.Fn.ORDER,n.Fn.BITS))})}function pn(e){let{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=dn(e);return fn(e,ln(an(t,n),r,i))}function mn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function hn(e,...t){if(!mn(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function gn(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function _n(e,t){hn(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function vn(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function yn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function bn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function xn(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function Sn(e){if(typeof e==`string`)e=xn(e);else if(mn(e))e=wn(e);else throw Error(`Uint8Array expected, got `+typeof e);return e}function Cn(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function wn(e){return Uint8Array.from(e)}var Tn=16,En=new Uint8Array(16),Dn=vn(En),On=225,kn=(e,t,n,r)=>{let i=r&1;return{s3:n<<31|r>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^On<<24&-(i&1)}},An=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function jn(e){e.reverse();let t=e[15]&1,n=0;for(let t=0;t<e.length;t++){let r=e[t];e[t]=r>>>1|n,n=(r&1)<<7}return e[0]^=-t&225,e}var Mn=e=>e>64*1024?8:e>1024?4:2,Nn=class{constructor(e,t){this.blockLen=Tn,this.outputLen=Tn,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=Sn(e),hn(e,16);let n=bn(e),r=n.getUint32(0,!1),i=n.getUint32(4,!1),a=n.getUint32(8,!1),o=n.getUint32(12,!1),s=[];for(let e=0;e<128;e++)s.push({s0:An(r),s1:An(i),s2:An(a),s3:An(o)}),{s0:r,s1:i,s2:a,s3:o}=kn(r,i,a,o);let c=Mn(t||1024);if(![1,2,4,8].includes(c))throw Error(`ghash: invalid window size, expected 2, 4 or 8`);this.W=c;let l=128/c,u=this.windowSize=2**c,d=[];for(let e=0;e<l;e++)for(let t=0;t<u;t++){let n=0,r=0,i=0,a=0;for(let o=0;o<c;o++){if(!(t>>>c-o-1&1))continue;let{s0:l,s1:u,s2:d,s3:f}=s[c*e+o];n^=l,r^=u,i^=d,a^=f}d.push({s0:n,s1:r,s2:i,s3:a})}this.t=d}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;let{W:i,t:a,windowSize:o}=this,s=0,c=0,l=0,u=0,d=(1<<i)-1,f=0;for(let p of[e,t,n,r])for(let e=0;e<4;e++){let t=p>>>8*e&255;for(let e=8/i-1;e>=0;e--){let n=t>>>i*e&d,{s0:r,s1:p,s2:m,s3:h}=a[f*o+n];s^=r,c^=p,l^=m,u^=h,f+=1}}this.s0=s,this.s1=c,this.s2=l,this.s3=u}update(e){gn(this),e=Sn(e),hn(e);let t=vn(e),n=Math.floor(e.length/Tn),r=e.length%Tn;for(let e=0;e<n;e++)this._updateBlock(t[e*4+0],t[e*4+1],t[e*4+2],t[e*4+3]);return r&&(En.set(e.subarray(n*Tn)),this._updateBlock(Dn[0],Dn[1],Dn[2],Dn[3]),yn(Dn)),this}destroy(){let{t:e}=this;for(let t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){gn(this),_n(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,a=vn(e);return a[0]=t,a[1]=n,a[2]=r,a[3]=i,e}digest(){let e=new Uint8Array(Tn);return this.digestInto(e),this.destroy(),e}},Pn=class extends Nn{constructor(e,t){e=Sn(e),hn(e);let n=jn(wn(e));super(n,t),yn(n)}update(e){e=Sn(e),gn(this);let t=vn(e),n=e.length%Tn,r=Math.floor(e.length/Tn);for(let e=0;e<r;e++)this._updateBlock(An(t[e*4+3]),An(t[e*4+2]),An(t[e*4+1]),An(t[e*4+0]));return n&&(En.set(e.subarray(r*Tn)),this._updateBlock(An(Dn[3]),An(Dn[2]),An(Dn[1]),An(Dn[0])),yn(Dn)),this}digestInto(e){gn(this),_n(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,a=vn(e);return a[0]=t,a[1]=n,a[2]=r,a[3]=i,e.reverse()}};function Fn(e){let t=(t,n)=>e(n,t.length).update(Sn(t)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}const In=Fn((e,t)=>new Nn(e,t)),Ln=Fn((e,t)=>new Pn(e,t));var Rn=Object.defineProperty,zn=(e,t)=>{for(var n in t)Rn(e,n,{get:t[n],enumerable:!0})},Bn={};zn(Bn,{EmptyArray:()=>qr,arrayToHex:()=>Rr,arrayToUtf8:()=>zr,calculateSharedKey:()=>Gr,comparePublicKeyHex:()=>Vr,compressPublicKeyHex:()=>Ir,doDecrypt:()=>Xr,doEncrypt:()=>Jr,doSignature:()=>Zr,doVerifySignature:()=>Qr,generateKeyPairHex:()=>Fr,getHash:()=>ei,getPoint:()=>ri,getPublicKeyFromPrivateKey:()=>ni,getZ:()=>$r,hexToArray:()=>L,initRNGPool:()=>ar,leftPad:()=>I,precomputePublicKey:()=>ti,utf8ToHex:()=>Lr,verifyPublicKey:()=>Br});var Vn=BigInt(0),Hn=BigInt(1),Un=BigInt(2);function Wn(e){let t=e.toString(16);if(t[0]!==`-`)t.length%2==1?t=`0`+t:t.match(/^[0-7]/)||(t=`00`+t);else{t=t.substring(1);let n=t.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);let r=``;for(let e=0;e<n;e++)r+=`f`;t=((M(r)^e)+Hn).toString(16).replace(/^-/,``)}return t}var Gn=class{constructor(e=null,t=`00`,n=`00`,r=``){this.tlv=e,this.t=t,this.l=n,this.v=r}getEncodedHex(){return this.tlv||=(this.v=this.getValue(),this.l=this.getLength(),this.t+this.l+this.v),this.tlv}getLength(){let e=this.v.length/2,t=e.toString(16);return t.length%2==1&&(t=`0`+t),e<128?t:(128+t.length/2).toString(16)+t}getValue(){return``}},Kn=class extends Gn{constructor(e){super(),this.t=`02`,e&&(this.v=Wn(e))}getValue(){return this.v}},qn=class extends Gn{constructor(e){super(),this.s=e,this.t=`04`,e&&(this.v=e.toLowerCase())}hV=``;getValue(){return this.v}},Jn=class extends Gn{constructor(e){super(),this.asn1Array=e}t=`30`;getValue(){return this.v=this.asn1Array.map(e=>e.getEncodedHex()).join(``),this.v}};function Yn(e,t){if(+e[t+2]<8)return 1;let n=e.slice(t+2,t+6).slice(0,2);return(parseInt(n,16)-128)*2}function Xn(e,t){let n=Yn(e,t),r=e.substring(t+2,t+2+n*2);return r?+(+r[0]<8?M(r):M(r.substring(2))).toString():-1}function Zn(e,t){return t+(Yn(e,t)+1)*2}function Qn(e,t){return new Jn([new Kn(e),new Kn(t)]).getEncodedHex()}function $n(e,t,n,r){return new Jn([new Kn(e),new Kn(t),new qn(n),new qn(r)]).getEncodedHex()}function er(e){let t=Zn(e,0),n=Zn(e,t),r=Xn(e,t),i=e.substring(n,n+r*2),a=n+i.length,o=Zn(e,a),s=Xn(e,a),c=e.substring(o,o+s*2);return{r:M(i),s:M(c)}}function tr(e){function t(e,t){let n=Zn(e,t),r=Xn(e,t),i=e.substring(n,n+r*2);return{value:i,nextStart:n+i.length}}let{value:n,nextStart:r}=t(e,Zn(e,0)),{value:i,nextStart:a}=t(e,r),{value:o,nextStart:s}=t(e,a),{value:c}=t(e,s);return{x:M(n),y:M(i),hash:o,cipher:c}}var nr=16384,rr=new Uint8Array,ir;async function ar(){if(`crypto`in globalThis){ir=globalThis.crypto;return}if(!(rr.length>nr/2))if(`wx`in globalThis&&`getRandomValues`in globalThis.wx)rr=await new Promise(e=>{wx.getRandomValues({length:nr,success(t){e(new Uint8Array(t.randomValues))}})});else try{ir=globalThis.crypto?globalThis.crypto:(await Promise.resolve().then(()=>e.i(1)(require(`./__vite-browser-external-aYiy3g-2.cjs`)))).webcrypto;let t=new Uint8Array(nr);ir.getRandomValues(t),rr=t}catch{throw Error(`no available csprng, abort.`)}}ar();function or(e){if(rr.length>e){let t=rr.slice(0,e);return rr=rr.slice(e),ar(),t}else throw Error(`random number pool is not ready or insufficient, prevent getting too long random values or too often.`)}function sr(e=0){let t=new Uint8Array(e);return ir?ir.getRandomValues(t):or(e)}var cr=e=>e instanceof Uint8Array,lr=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw Error(`Non little-endian hardware is not supported`);var ur=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function dr(e){if(!cr(e))throw Error(`Uint8Array expected`);let t=``;for(let n=0;n<e.length;n++)t+=ur[e[n]];return t}function fr(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function pr(e){if(typeof e==`string`&&(e=fr(e)),!cr(e))throw Error(`expected Uint8Array, got ${typeof e}`);return e}var mr=class{clone(){return this._cloneInto()}};function hr(e){let t=t=>e().update(pr(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}var gr=(e,t,n)=>e&t|e&n|t&n,_r=(e,t,n)=>e^t^n,vr=(e,t,n)=>e&t|~e&n;function yr(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function br(e,t){let n=t&31;return e<<n|e>>>32-n}function xr(e){return e^br(e,9)^br(e,17)}function Sr(e){return e^br(e,15)^br(e,23)}var Cr=class extends mr{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=lr(this.buffer)}buffer;view;finished=!1;length=0;pos=0;destroyed=!1;update(e){let{view:t,buffer:n,blockLen:r}=this;e=pr(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=lr(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;yr(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=lr(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.length=r,e.pos=o,e.finished=i,e.destroyed=a,r%t&&e.buffer.set(n),e}},wr=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),Tr=new Uint32Array(68),Er=new Uint32Array(64),Dr=2043430169,Or=2055708042,kr=class extends Cr{A=wr[0]|0;B=wr[1]|0;C=wr[2]|0;D=wr[3]|0;E=wr[4]|0;F=wr[5]|0;G=wr[6]|0;H=wr[7]|0;constructor(){super(64,32,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)Tr[n]=e.getUint32(t,!1);for(let e=16;e<68;e++)Tr[e]=Sr(Tr[e-16]^Tr[e-9]^br(Tr[e-3],15))^br(Tr[e-13],7)^Tr[e-6];for(let e=0;e<64;e++)Er[e]=Tr[e]^Tr[e+4];let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=e>=0&&e<=15,u=t?Dr:Or,d=br(br(n,12)+o+br(u,e),7),f=d^br(n,12),p=(t?_r(n,r,i):gr(n,r,i))+a+f+Er[e]|0,m=(t?_r(o,s,c):vr(o,s,c))+l+d+Tr[e]|0;a=i,i=br(r,9),r=n,n=p,l=c,c=br(s,19),s=o,o=xr(m)}n=n^this.A|0,r=r^this.B|0,i=i^this.C|0,a=a^this.D|0,o=o^this.E|0,s=s^this.F|0,c=c^this.G|0,l=l^this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Tr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ar=hr(()=>new kr),jr=class extends mr{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){super();let n=pr(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return this.iHash.update(e),this}digestInto(e){this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Mr=(e,t,n)=>new jr(e,t).update(n).digest();Mr.create=(e,t)=>new jr(e,t);var Nr=wt(BigInt(`115792089210356248756420345214020892766250353991924191454421193933289684991999`)),F=pn({a:BigInt(`115792089210356248756420345214020892766250353991924191454421193933289684991996`),b:BigInt(`18505919022281880113072981827955639221458448578012075254857346196103069175443`),Fp:Nr,h:Hn,n:BigInt(`115792089210356248756420345214020892766061623724957744567843809356293439045923`),Gx:BigInt(`22963146547237050559479531362550074578802567295341616970375194840604139615431`),Gy:BigInt(`85132369209828568825618990617112496413088388631904505083283536607588877201568`),hash:Ar,hmac:(e,...t)=>Mr(Ar,e,A(...t)),randomBytes:sr}),Pr=wt(BigInt(F.CURVE.n));function Fr(e){let t=e?Ie(ut(BigInt(e),Hn)+Hn,32):F.utils.randomPrivateKey(),n=F.getPublicKey(t,!1);return{privateKey:I(De(t),64),publicKey:I(De(n),64)}}function Ir(e){if(e.length!==130)throw Error(`Invalid public key to compress`);let t=(e.length-2)/2,n=e.substring(2,2+t),r=M(e.substring(t+2,t+t+2)),i=`03`;return ut(r,Un)===Vn&&(i=`02`),i+n}function Lr(e){return De(Me(e))}function I(e,t){return e.length>=t?e:Array(t-e.length+1).join(`0`)+e}function Rr(e){return e.map(e=>{let t=e.toString(16);return t.length===1?`0`+t:t}).join(``)}function zr(e){let t=[];for(let n=0,r=e.length;n<r;n++)e[n]>=240&&e[n]<=247?(t.push(String.fromCodePoint(((e[n]&7)<<18)+((e[n+1]&63)<<12)+((e[n+2]&63)<<6)+(e[n+3]&63))),n+=3):e[n]>=224&&e[n]<=239?(t.push(String.fromCodePoint(((e[n]&15)<<12)+((e[n+1]&63)<<6)+(e[n+2]&63))),n+=2):e[n]>=192&&e[n]<=223?(t.push(String.fromCodePoint(((e[n]&31)<<6)+(e[n+1]&63))),n++):t.push(String.fromCodePoint(e[n]));return t.join(``)}function L(e){let t=e.length;t%2!=0&&(e=I(e,t+1)),t=e.length;let n=t/2,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=parseInt(e.substring(t*2,t*2+2),16);return r}function Br(e){let t=F.ProjectivePoint.fromHex(e);if(!t)return!1;try{return t.assertValidity(),!0}catch{return!1}}function Vr(e,t){let n=F.ProjectivePoint.fromHex(e);if(!n)return!1;let r=F.ProjectivePoint.fromHex(t);return r?n.equals(r):!1}var Hr=M(`80000000000000000000000000000000`),Ur=M(`7fffffffffffffffffffffffffffffff`);function Wr(e,t){let n=new Uint8Array(t),r=1,i=0,a=qr,o=new Uint8Array(4),s=()=>{o[0]=r>>24&255,o[1]=r>>16&255,o[2]=r>>8&255,o[3]=r&255,a=Ar(A(e,o)),r++,i=0};s();for(let e=0,t=n.length;e<t;e++)i===a.length&&s(),n[e]=a[i++]&255;return n}function Gr(e,t,n,r,i,a=!1,o=`1234567812345678`,s=`1234567812345678`){let c=F.ProjectivePoint.fromHex(t.publicKey),l=F.ProjectivePoint.fromHex(r),u=F.ProjectivePoint.fromHex(n),d=$r(e.publicKey,o),f=$r(n,s);a&&([d,f]=[f,d]);let p=M(t.privateKey),m=M(e.privateKey),h=Hr+(c.x&Ur),g=Pr.add(m,Pr.mulN(h,p)),_=l.x,v=Pr.add(Hr,_&Ur),y=l.multiply(v).add(u).multiply(g);return Wr(A(L(I(j(y.x),64)),L(I(j(y.y),64)),d,f),i)}var Kr=0,qr=new Uint8Array;function Jr(e,t,n=1,r){let i=typeof e==`string`?L(Lr(e)):Uint8Array.from(e),a=typeof t==`string`?F.ProjectivePoint.fromHex(t):t,o=Fr(),s=M(o.privateKey),c=o.publicKey;c.length>128&&(c=c.substring(c.length-128));let l=a.multiply(s),u=L(I(j(l.x),64)),d=L(I(j(l.y),64)),f=dr(Ar(A(u,i,d)));Yr(u,d,i);let p=dr(i);if(r?.asn1){let e=F.ProjectivePoint.fromHex(o.publicKey);return n===Kr?$n(e.x,e.y,p,f):$n(e.x,e.y,f,p)}return n===Kr?c+p+f:c+f+p}function Yr(e,t,n){let r=1,i=0,a=qr,o=new Uint8Array(4),s=()=>{o[0]=r>>24&255,o[1]=r>>16&255,o[2]=r>>8&255,o[3]=r&255,a=Ar(A(e,t,o)),r++,i=0};s();for(let e=0,t=n.length;e<t;e++)i===a.length&&s(),n[e]^=a[i++]&255}function Xr(e,t,n=1,{output:r=`string`,asn1:i=!1}={}){let a=M(t),o,s,c;if(i){let{x:t,y:r,cipher:i,hash:a}=tr(e);o=F.ProjectivePoint.fromAffine({x:t,y:r}),c=a,s=i,n===Kr&&([s,c]=[c,s])}else o=F.ProjectivePoint.fromHex(`04`+e.substring(0,128)),c=e.substring(128,192),s=e.substring(192),n===Kr&&(c=e.substring(e.length-64),s=e.substring(128,e.length-64));let l=L(s),u=o.multiply(a),d=L(I(j(u.x),64)),f=L(I(j(u.y),64));return Yr(d,f,l),Rr(Array.from(Ar(A(d,l,f))))===c.toLowerCase()?r===`array`?l:zr(l):r===`array`?[]:``}function Zr(e,t,n={}){let{pointPool:r,der:i,hash:a,publicKey:o,userId:s}=n,c=typeof e==`string`?Lr(e):Rr(Array.from(e));a&&(o||=ni(t),c=ei(c,o,s));let l=M(t),u=M(c),d=null,f=null,p=null;do{do{let e;e=r&&r.length?r.pop():ri(),d=e.k,f=Pr.add(u,e.x1)}while(f===Vn||f+d===F.CURVE.n);p=Pr.mul(Pr.inv(Pr.addN(l,Hn)),Pr.subN(d,Pr.mulN(f,l)))}while(p===Vn);return i?Qn(f,p):I(j(f),64)+I(j(p),64)}function Qr(e,t,n,r={}){let i,{hash:a,der:o,userId:s}=r,c=typeof n==`string`?n:n.toHex(!1);i=a?ei(typeof e==`string`?Lr(e):e,c,s):typeof e==`string`?Lr(e):Rr(Array.from(e));let l,u;if(o){let e=er(t);l=e.r,u=e.s}else l=M(t.substring(0,64)),u=M(t.substring(64));let d=typeof n==`string`?F.ProjectivePoint.fromHex(n):n,f=M(i),p=Pr.add(l,u);if(p===Vn)return!1;let m=F.ProjectivePoint.BASE.multiply(u).add(d.multiply(p)),h=Pr.add(f,m.x);return l===h}function $r(e,t=`1234567812345678`){t=Lr(t);let n=I(j(F.CURVE.a),64),r=I(j(F.CURVE.b),64),i=I(j(F.ProjectivePoint.BASE.x),64),a=I(j(F.ProjectivePoint.BASE.y),64),o,s;if(e.length===128)o=e.substring(0,64),s=e.substring(64,128);else{let t=F.ProjectivePoint.fromHex(e);o=I(j(t.x),64),s=I(j(t.y),64)}let c=L(t+n+r+i+a+o+s),l=t.length*4;return Ar(A(new Uint8Array([l>>8&255,l&255]),c))}function ei(e,t,n=`1234567812345678`){return dr(Ar(A($r(t,n),typeof e==`string`?L(e):e)))}function ti(e,t){let n=F.ProjectivePoint.fromHex(e);return F.utils.precompute(t,n)}function ni(e){return I(De(F.getPublicKey(e,!1)),64)}function ri(){let e=Fr(),t=F.ProjectivePoint.fromHex(e.publicKey),n=M(e.privateKey);return{...e,k:n,x1:t.x}}function ii(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.codePointAt(n);if(r<=127)t.push(r);else if(r<=2047)t.push(192|r>>>6),t.push(128|r&63);else if(r<=55295||r>=57344&&r<=65535)t.push(224|r>>>12),t.push(128|r>>>6&63),t.push(128|r&63);