@stacks/storage 4.3.9-pr.57188e3.0 → 4.3.9-pr.8b59774.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.
- package/dist/esm/fileContentLoader.d.ts +3 -4
- package/dist/esm/fileContentLoader.js +13 -14
- package/dist/esm/fileContentLoader.js.map +1 -1
- package/dist/esm/hub.d.ts +1 -2
- package/dist/esm/hub.js +11 -12
- package/dist/esm/hub.js.map +1 -1
- package/dist/esm/storage.d.ts +2 -3
- package/dist/esm/storage.js +27 -48
- package/dist/esm/storage.js.map +1 -1
- package/dist/fileContentLoader.d.ts +3 -4
- package/dist/fileContentLoader.js +12 -13
- package/dist/fileContentLoader.js.map +1 -1
- package/dist/hub.d.ts +1 -2
- package/dist/hub.js +9 -10
- package/dist/hub.js.map +1 -1
- package/dist/storage.d.ts +2 -3
- package/dist/storage.js +25 -46
- package/dist/storage.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.LICENSE.txt +0 -11
- package/dist/umd/index.js.map +1 -1
- package/package.json +10 -15
- package/src/fileContentLoader.ts +27 -21
- package/src/hub.ts +13 -14
- package/src/storage.ts +41 -50
- package/dist/polyfill/index.js +0 -16
- package/dist/polyfill/index.js.map +0 -1
package/dist/umd/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStorage=e():t.StacksStorage=e()}(this,(()=>(()=>{var t,e,r={525:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function n(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function i(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}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")}function a(t,e){i(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.output=e.exists=e.hash=e.bytes=e.bool=e.number=void 0,e.number=r,e.bool=n,e.bytes=i,e.hash=o,e.exists=s,e.output=a;const u={number:r,bool:n,bytes:i,hash:o,exists:s,output:a};e.default=u},350:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHA2=void 0;const n=r(525),i=r(64);class o extends i.Hash{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){n.default.exists(this);const{view:e,buffer:r,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let n=0;n<s;){const a=Math.min(o-this.pos,s-n);if(a!==o)r.set(t.subarray(n,n+a),this.pos),this.pos+=a,n+=a,this.pos===o&&(this.process(e,0),this.pos=0);else{const e=(0,i.createView)(t);for(;o<=s-n;n+=o)this.process(e,n)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){n.default.exists(this),n.default.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:o,isLE:s}=this;let{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(r,0),a=0);for(let t=a;t<o;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const u=(0,i.createView)(t);this.get().forEach(((t,e)=>u.setUint32(4*e,t,s)))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}e.SHA2=o},661:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},514:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=void 0;const n=r(525),i=r(64);class o extends i.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,n.default.hash(t);const r=(0,i.toBytes)(e);if(this.iHash=t.create(),!(this.iHash instanceof i.Hash))throw new TypeError("Expected instance of class which extends utils.Hash");const o=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const s=new Uint8Array(o);s.set(r.length>this.iHash.blockLen?t.create().update(r).digest():r);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(t){return n.default.exists(this),this.iHash.update(t),this}digestInto(t){n.default.exists(this),n.default.bytes(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:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.hmac=(t,e,r)=>new o(t,e).update(r).digest(),e.hmac.create=(t,e)=>new o(t,e)},53:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha256=void 0;const n=r(350),i=r(64),o=(t,e,r)=>t&e^t&r^e&r,s=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class c extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)u[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=u[t-15],r=u[t-2],n=(0,i.rotr)(e,7)^(0,i.rotr)(e,18)^e>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;u[t]=o+u[t-7]+n+u[t-16]|0}let{A:r,B:n,C:a,D:c,E:f,F:h,G:l,H:p}=this;for(let t=0;t<64;t++){const e=p+((0,i.rotr)(f,6)^(0,i.rotr)(f,11)^(0,i.rotr)(f,25))+((d=f)&h^~d&l)+s[t]+u[t]|0,y=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+o(r,n,a)|0;p=l,l=h,h=f,f=c+e|0,c=a,a=n,n=r,r=e+y|0}var d;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,c=c+this.D|0,f=f+this.E|0,h=h+this.F|0,l=l+this.G|0,p=p+this.H|0,this.set(r,n,a,c,f,h,l,p)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}e.sha256=(0,i.wrapConstructor)((()=>new c))},64:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const n=r(661);if(e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function o(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}function s(t){if("string"==typeof t&&(t=o(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}e.bytesToHex=function(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=i[t[r]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e},e.nextTick=async()=>{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o<t;o++){n(o);const t=Date.now()-i;t>=0&&t<r||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=o,e.toBytes=s,e.concatBytes=function(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r},e.Hash=class{clone(){return this._cloneInto()}},e.checkOpts=function(t,e){if(void 0!==e&&("object"!=typeof e||(r=e,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new TypeError("Options should be object or undefined");var r;return Object.assign(t,e)},e.wrapConstructor=function(t){const e=e=>t().update(s(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(s(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(n.crypto.web)return n.crypto.web.getRandomValues(new Uint8Array(t));if(n.crypto.node)return new Uint8Array(n.crypto.node.randomBytes(t).buffer);throw new Error("The environment doesn't have randomBytes function")}},698:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.schnorr=e.verify=e.signSync=e.sign=e.getSharedSecret=e.recoverPublicKey=e.getPublicKey=e.Signature=e.Point=e.CURVE=void 0;const n=r(695),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),u=BigInt(8),c=s**BigInt(256),f={a:i,b:BigInt(7),P:c-s**BigInt(32)-BigInt(977),n:c-BigInt("432420386565659656852420866394968145599"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function h(t){const{a:e,b:r}=f,n=T(t*t),i=T(n*t);return T(i+e*t+r)}e.CURVE=f;const l=f.a===i;class p{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof y))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new p(t.x,t.y,o)}static toAffineBatch(t){const e=function(t,e=f.P){const r=new Array(t.length),n=L(t.reduce(((t,n,o)=>n===i?t:(r[o]=t,T(t*n,e))),o),e);return t.reduceRight(((t,n,o)=>n===i?t:(r[o]=T(t*r[o],e),T(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return p.toAffineBatch(t).map(p.fromAffine)}equals(t){if(!(t instanceof p))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:a}=t,u=T(n**s),c=T(a**s),f=T(e*c),h=T(i*u),l=T(T(r*a)*c),d=T(T(o*n)*u);return f===h&&l===d}negate(){return new p(this.x,T(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=T(t**s),i=T(e**s),o=T(i**s),c=T(s*(T((t+i)**s)-n-o)),f=T(a*n),h=T(f**s),l=T(h-s*c),d=T(f*(c-l)-u*o),y=T(s*e*r);return new p(l,d,y)}add(t){if(!(t instanceof p))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:o,y:a,z:u}=t;if(o===i||a===i)return this;if(e===i||r===i)return t;const c=T(n**s),f=T(u**s),h=T(e*f),l=T(o*c),d=T(T(r*u)*f),y=T(T(a*n)*c),g=T(l-h),m=T(y-d);if(g===i)return m===i?this.double():p.ZERO;const b=T(g**s),w=T(g*b),v=T(h*b),E=T(m**s-w-s*v),x=T(m*(v-E)-d*w),A=T(n*u*g);return new p(E,x,A)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=p.ZERO;if("bigint"==typeof t&&t===i)return e;let r=I(t);if(r===o)return this;if(!l){let t=e,n=this;for(;r>i;)r&o&&(t=t.add(n)),n=n.double(),r>>=o;return t}let{k1neg:n,k1:s,k2neg:a,k2:u}=P(r),c=e,h=e,d=this;for(;s>i||u>i;)s&o&&(c=c.add(d)),u&o&&(h=h.add(d)),d=d.double(),s>>=o,u>>=o;return n&&(c=c.negate()),a&&(h=h.negate()),h=new p(T(h.x*f.beta),h.y,h.z),c.add(h)}precomputeWindow(t){const e=l?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(p.BASE)&&(e=y.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&d.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=p.normalizeZ(n),d.set(e,n)));let i=p.ZERO,s=p.ZERO;const a=1+(l?128/r:256/r),u=2**(r-1),c=BigInt(2**r-1),f=2**r,h=BigInt(r);for(let e=0;e<a;e++){const r=e*u;let a=Number(t&c);if(t>>=h,a>u&&(a-=f,t+=o),0===a){let t=n[r];e%2&&(t=t.negate()),s=s.add(t)}else{let t=n[r+Math.abs(a)-1];a<0&&(t=t.negate()),i=i.add(t)}}return{p:i,f:s}}multiply(t,e){let r,n,i=I(t);if(l){const{k1neg:t,k1:o,k2neg:s,k2:a}=P(i);let{p:u,f:c}=this.wNAF(o,e),{p:h,f:l}=this.wNAF(a,e);t&&(u=u.negate()),s&&(h=h.negate()),h=new p(T(h.x*f.beta),h.y,h.z),r=u.add(h),n=c.add(l)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return p.normalizeZ([r,n])[0]}toAffine(t=L(this.z)){const{x:e,y:r,z:n}=this,i=t,s=T(i*i),a=T(s*i),u=T(e*s),c=T(r*a);if(T(n*i)!==o)throw new Error("invZ was invalid");return new y(u,c)}}p.BASE=new p(f.Gx,f.Gy,o),p.ZERO=new p(i,o,i);const d=new WeakMap;class y{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,d.delete(this)}static fromCompressedHex(t){const e=32===t.length,r=O(e?t:t.subarray(1));if(!D(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=f,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),c=BigInt(88),h=t*t*t%e,l=h*h*t%e,p=j(l,a)*l%e,d=j(p,a)*l%e,y=j(d,s)*h%e,g=j(y,n)*y%e,m=j(g,i)*g%e,b=j(m,u)*m%e,w=j(b,c)*b%e,v=j(w,u)*m%e,E=j(v,a)*l%e,x=j(E,o)*g%e,A=j(x,r)*h%e;return j(A,s)}(h(r));const i=(n&o)===o;e?i&&(n=T(-n)):1==(1&t[0])!==i&&(n=T(-n));const u=new y(r,n);return u.assertValidity(),u}static fromUncompressedHex(t){const e=O(t.subarray(1,33)),r=O(t.subarray(33,65)),n=new y(e,r);return n.assertValidity(),n}static fromHex(t){const e=U(t),r=e.length,n=e[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(e);if(65===r&&4===n)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(t){return y.BASE.multiply(z(t))}static fromSignature(t,e,r){const n=R(t=U(t)),{r:i,s:o}=q(e);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&r?"03":"02",a=y.fromHex(s+A(i)),{n:u}=f,c=L(i,u),h=T(-n*c,u),l=T(o*c,u),p=y.BASE.multiplyAndAddUnsafe(a,h,l);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(t=!1){return k(this.toHex(t))}toHex(t=!1){const e=A(this.x);return t?`${this.y&o?"03":"02"}${e}`:`04${e}${A(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!D(e)||!D(r))throw new Error(t);const n=T(r*r);if(T(n-h(e))!==i)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new y(this.x,T(-this.y))}double(){return p.fromAffine(this).double().toAffine()}add(t){return p.fromAffine(this).add(p.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return p.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=p.fromAffine(this),s=e===i||e===o||this!==y.BASE?n.multiplyUnsafe(e):n.multiply(e),a=p.fromAffine(t).multiplyUnsafe(r),u=s.add(a);return u.equals(p.ZERO)?void 0:u.toAffine()}}function g(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function m(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${x(t)}`);const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:O(r),left:t.subarray(e+2)}}e.Point=y,y.BASE=new y(f.Gx,f.Gy),y.ZERO=new y(i,i);class b{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=v(t),r="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=e?x(t):t;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new b(B(n.slice(0,64)),B(n.slice(64,128)))}static fromDER(t){const e=v(t);if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${x(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=m(t.subarray(2)),{data:n,left:i}=m(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${x(i)}`);return{r:e,s:n}}(e?t:k(t));return new b(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!$(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!$(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=f.n>>o;return this.s>t}normalizeS(){return this.hasHighS()?new b(this.r,f.n-this.s):this}toDERRawBytes(t=!1){return k(this.toDERHex(t))}toDERHex(t=!1){const e=g(_(this.s));if(t)return e;const r=g(_(this.r)),n=_(r.length/2),i=_(e.length/2);return`30${_(r.length/2+e.length/2+4)}02${n}${r}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return k(this.toCompactHex())}toCompactHex(){return A(this.r)+A(this.s)}}function w(...t){if(!t.every(v))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}function v(t){return t instanceof Uint8Array}e.Signature=b;const E=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function x(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r<t.length;r++)e+=E[t[r]];return e}function A(t){if(t>c)throw new Error("Expected number < 2^256");return t.toString(16).padStart(64,"0")}function S(t){return k(A(t))}function _(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function B(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function k(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function O(t){return B(x(t))}function U(t){return t instanceof Uint8Array?Uint8Array.from(t):k(t)}function I(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&$(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function T(t,e=f.P){const r=t%e;return r>=i?r:e+r}function j(t,e){const{P:r}=f;let n=t;for(;e-- >i;)n*=n,n%=r;return n}function L(t,e=f.P){if(t===i||e<=i)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=T(t,e),n=e,s=i,a=o,u=o,c=i;for(;r!==i;){const t=n/r,e=n%r,i=s-u*t,o=a-c*t;n=r,r=e,s=u,a=c,u=i,c=o}if(n!==o)throw new Error("invert: does not exist");return T(s,e)}const F=(t,e)=>(t+e/s)/e,C=s**BigInt(128);function P(t){const{n:e}=f,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=F(s*t,e),u=F(-n*t,e);let c=T(t-a*r-u*i,e),h=T(-a*n-u*s,e);const l=c>C,p=h>C;if(l&&(c=e-c),p&&(h=e-h),c>C||h>C)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:p,k2:h}}function R(t){const{n:e}=f,r=8*t.length-256;let n=O(t);return r>0&&(n>>=BigInt(r)),n>=e&&(n-=e),n}class N{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...t){return e.utils.hmacSha256(this.k,...t)}hmacSync(...t){if("function"!=typeof e.utils.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const r=e.utils.hmacSha256Sync(this.k,...t);if(r instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return r}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function $(t){return i<t&&t<f.n}function D(t){return i<t&&t<f.P}function H(t,e,r){const n=O(t);if(!$(n))return;const{n:s}=f,a=y.BASE.multiply(n),u=T(a.x,s);if(u===i)return;const c=T(L(n,s)*T(e+r*u,s),s);if(c===i)return;const h=new b(u,c);return{sig:h,recovery:(a.x===h.r?0:2)|Number(a.y&o)}}function z(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=B(t)}else{if(!v(t))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=O(t)}if(!$(e))throw new Error("Expected private key: 0 < key < n");return e}function M(t){return t instanceof y?(t.assertValidity(),t):y.fromHex(t)}function q(t){if(t instanceof b)return t.assertValidity(),t;try{return b.fromDER(t)}catch(e){return b.fromCompact(t)}}function V(t){const e=v(t),r="string"==typeof t,n=(e||r)&&t.length;return e?33===n||65===n:r?66===n||130===n:t instanceof y}function G(t){return O(t.length>32?t.slice(0,32):t)}function K(t){const e=G(t),r=T(e,f.n);return J(r<i?e:r)}function J(t){if("bigint"!=typeof t)throw new Error("Expected bigint");return k(A(t))}function W(t,r,n){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const i=U(t),o=z(r),s=[J(o),K(i)];if(null!=n){!0===n&&(n=e.utils.randomBytes(32));const t=U(n);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(t)}return{seed:w(...s),m:G(i),d:o}}function Z(t,e){let{sig:r,recovery:n}=t;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},e);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=o?r.toDERRawBytes():r.toCompactRawBytes();return s?[a,n]:a}e.getPublicKey=function(t,e=!1){return y.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,r,n=!1){return y.fromSignature(t,e,r).toRawBytes(n)},e.getSharedSecret=function(t,e,r=!1){if(V(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!V(e))throw new TypeError("getSharedSecret: second arg must be public key");const n=M(e);return n.assertValidity(),n.multiply(z(t)).toRawBytes(r)},e.sign=async function(t,e,r={}){const{seed:n,m:i,d:o}=W(t,e,r.extraEntropy);let s;const a=new N;for(await a.reseed(n);!(s=H(await a.generate(),i,o));)await a.reseed();return Z(s,r)},e.signSync=function(t,e,r={}){const{seed:n,m:i,d:o}=W(t,e,r.extraEntropy);let s;const a=new N;for(a.reseedSync(n);!(s=H(a.generateSync(),i,o));)a.reseedSync();return Z(s,r)};const X={strict:!0};function Y(t){return T(O(t),f.n)}function Q(t){return(t.y&o)===i}e.verify=function(t,e,r,n=X){let i;try{i=q(t),e=U(e)}catch(t){return!1}const{r:o,s}=i;if(n.strict&&i.hasHighS())return!1;const a=R(e);let u;try{u=M(r)}catch(t){return!1}const{n:c}=f,h=L(s,c),l=T(a*h,c),p=T(o*h,c),d=y.BASE.multiplyAndAddUnsafe(u,l,p);return!!d&&T(d.x,c)===o};class tt{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=U(t);if(64!==e.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${e.length}`);const r=O(e.subarray(0,32)),n=O(e.subarray(32,64));return new tt(r,n)}assertValidity(){const{r:t,s:e}=this;if(!D(t)||!$(e))throw new Error("Invalid signature")}toHex(){return A(this.r)+A(this.s)}toRawBytes(){return k(this.toHex())}}function et(t,e,r){if(null==t)throw new TypeError(`sign: Expected valid message, not "${t}"`);const n=U(t),i=z(e),o=U(r);if(32!==o.length)throw new TypeError("sign: Expected 32 bytes of aux randomness");const s=y.fromPrivateKey(i),a=s.toRawX();return{m:n,P:s,px:a,d:Q(s)?i:f.n-i,rand:o}}function rt(t,e){return S(t^O(e))}function nt(t){const e=T(O(t),f.n);if(e===i)throw new Error("sign: Creation of signature failed. k is zero");const r=y.fromPrivateKey(e),n=r.toRawX();return{R:r,rx:n,k:Q(r)?e:f.n-e}}function it(t,e,r,n){return new tt(t.x,T(e+r*n,f.n)).toRawBytes()}function ot(t,e,r){const n=t instanceof tt,i=n?t:tt.fromHex(t);return n&&i.assertValidity(),{...i,m:U(e),P:M(r)}}function st(t,e,r,n){const i=y.BASE.multiplyAndAddUnsafe(e,z(r),T(-n,f.n));return!(!i||!Q(i)||i.x!==t)}async function at(t,r,n){try{const{r:i,s:o,m:s,P:a}=ot(t,r,n),u=Y(await e.utils.taggedHash(ft.challenge,S(i),a.toRawX(),s));return st(i,a,o,u)}catch(t){return!1}}function ut(t,r,n){try{const{r:i,s:o,m:s,P:a}=ot(t,r,n),u=Y(e.utils.taggedHashSync(ft.challenge,S(i),a.toRawX(),s));return st(i,a,o,u)}catch(t){return!1}}e.schnorr={Signature:tt,getPublicKey:function(t){return y.fromPrivateKey(t).toRawX()},sign:async function(t,r,n=e.utils.randomBytes()){const{m:i,px:o,d:s,rand:a}=et(t,r,n),u=rt(s,await e.utils.taggedHash(ft.aux,a)),{R:c,rx:f,k:h}=nt(await e.utils.taggedHash(ft.nonce,u,o,i)),l=it(c,h,Y(await e.utils.taggedHash(ft.challenge,f,o,i)),s);if(!await at(l,i,o))throw new Error("sign: Invalid signature produced");return l},verify:at,signSync:function(t,r,n=e.utils.randomBytes()){const{m:i,px:o,d:s,rand:a}=et(t,r,n),u=rt(s,e.utils.taggedHashSync(ft.aux,a)),{R:c,rx:f,k:h}=nt(e.utils.taggedHashSync(ft.nonce,u,o,i)),l=it(c,h,Y(e.utils.taggedHashSync(ft.challenge,f,o,i)),s);if(!ut(l,i,o))throw new Error("sign: Invalid signature produced");return l},verifySync:ut},y.BASE._setWindowSize(8);const ct={node:n,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},ft={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},ht={};e.utils={isValidPrivateKey(t){try{return z(t),!0}catch(t){return!1}},privateAdd:(t,e)=>S(T(z(t)+z(e),f.n)),privateNegate:t=>{const e=z(t);return S(f.n-e)},pointAddScalar:(t,e,r)=>{const n=y.fromHex(t),i=z(e),s=y.BASE.multiplyAndAddUnsafe(n,i,o);if(!s)throw new Error("Tweaked point at infinity");return s.toRawBytes(r)},pointMultiply:(t,e,r)=>{const n=y.fromHex(t),i=O(U(e));return n.multiply(i).toRawBytes(r)},hashToPrivateKey:t=>{if((t=U(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return S(T(O(t),f.n-o)+o)},randomBytes:(t=32)=>{if(ct.web)return ct.web.getRandomValues(new Uint8Array(t));if(ct.node){const{randomBytes:e}=ct.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.hashToPrivateKey(e.utils.randomBytes(40)),bytesToHex:x,hexToBytes:k,concatBytes:w,mod:T,invert:L,sha256:async(...t)=>{if(ct.web){const e=await ct.web.subtle.digest("SHA-256",w(...t));return new Uint8Array(e)}if(ct.node){const{createHash:e}=ct.node,r=e("sha256");return t.forEach((t=>r.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(ct.web){const r=await ct.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=w(...e),i=await ct.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(ct.node){const{createHmac:r}=ct.node,n=r("sha256",t);return e.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...r)=>{let n=ht[t];if(void 0===n){const r=await e.utils.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));n=w(r,r),ht[t]=n}return e.utils.sha256(n,...r)},taggedHashSync:(t,...r)=>{if("function"!=typeof e.utils.sha256Sync)throw new Error("utils.sha256Sync is undefined, you need to set it");let n=ht[t];if(void 0===n){const r=e.utils.sha256Sync(Uint8Array.from(t,(t=>t.charCodeAt(0))));n=w(r,r),ht[t]=n}return e.utils.sha256Sync(n,...r)},precompute(t=8,e=y.BASE){const r=e===y.BASE?e:new y(e.x,e.y);return r._setWindowSize(t),r.multiply(a),r}}},625:function(t,e,r){t=r.nmd(t);var n=r(406);!function(e){"use strict";function i(t,e){e|=0;for(var r=Math.max(t.length-e,0),n=Array(r),i=0;i<r;i++)n[i]=t[e+i];return n}var o=function(t){var e=i(arguments,1);return function(){var r=i(arguments);return t.apply(null,e.concat(r))}},s=function(t){return function(){var e=i(arguments),r=e.pop();t.call(this,e,r)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var u="function"==typeof setImmediate&&setImmediate,c="object"==typeof n&&"function"==typeof n.nextTick;function f(t){setTimeout(t,0)}function h(t){return function(e){var r=i(arguments,1);t((function(){e.apply(null,r)}))}}var l=h(u?setImmediate:c?n.nextTick:f);function p(t){return s((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}a(n)&&"function"==typeof n.then?n.then((function(t){d(r,null,t)}),(function(t){d(r,t.message?t:new Error(t))})):r(null,n)}))}function d(t,e,r){try{t(e,r)}catch(t){l(y,t)}}function y(t){throw t}var g="function"==typeof Symbol;function m(t){return g&&"AsyncFunction"===t[Symbol.toStringTag]}function b(t){return m(t)?p(t):t}function w(t){return function(e){var r=i(arguments,1),n=s((function(r,n){var i=this;return t(e,(function(t,e){b(t).apply(i,r.concat(e))}),n)}));return r.length?n.apply(this,r):n}}var v="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,E="object"==typeof self&&self&&self.Object===Object&&self,x=v||E||Function("return this")(),A=x.Symbol,S=Object.prototype,_=S.hasOwnProperty,B=S.toString,k=A?A.toStringTag:void 0;var O=Object.prototype.toString;var U=A?A.toStringTag:void 0;function I(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":U&&U in Object(t)?function(t){var e=_.call(t,k),r=t[k];try{t[k]=void 0;var n=!0}catch(t){}var i=B.call(t);return n&&(e?t[k]=r:delete t[k]),i}(t):function(t){return O.call(t)}(t)}function T(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function j(t){return null!=t&&T(t.length)&&!function(t){if(!a(t))return!1;var e=I(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var L={};function F(){}function C(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var P="function"==typeof Symbol&&Symbol.iterator;function R(t){return null!=t&&"object"==typeof t}function N(t){return R(t)&&"[object Arguments]"==I(t)}var $=Object.prototype,D=$.hasOwnProperty,H=$.propertyIsEnumerable,z=N(function(){return arguments}())?N:function(t){return R(t)&&D.call(t,"callee")&&!H.call(t,"callee")},M=Array.isArray;var q="object"==typeof e&&e&&!e.nodeType&&e,V=q&&t&&!t.nodeType&&t,G=V&&V.exports===q?x.Buffer:void 0,K=(G?G.isBuffer:void 0)||function(){return!1},J=/^(?:0|[1-9]\d*)$/;function W(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&J.test(t))&&t>-1&&t%1==0&&t<e}var Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0,Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=!1;var X,Y="object"==typeof e&&e&&!e.nodeType&&e,Q=Y&&t&&!t.nodeType&&t,tt=Q&&Q.exports===Y&&v.process,et=function(){try{return Q&&Q.require&&Q.require("util").types||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),rt=et&&et.isTypedArray,nt=rt?(X=rt,function(t){return X(t)}):function(t){return R(t)&&T(t.length)&&!!Z[I(t)]},it=Object.prototype.hasOwnProperty;function ot(t,e){var r=M(t),n=!r&&z(t),i=!r&&!n&&K(t),o=!r&&!n&&!i&&nt(t),s=r||n||i||o,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=a.length;for(var c in t)!e&&!it.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||W(c,u))||a.push(c);return a}var st=Object.prototype;var at=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),ut=Object.prototype.hasOwnProperty;function ct(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||st))return at(t);var e,r,n=[];for(var i in Object(t))ut.call(t,i)&&"constructor"!=i&&n.push(i);return n}function ft(t){return j(t)?ot(t):ct(t)}function ht(t){if(j(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e,r,n,i,o=function(t){return P&&t[P]&&t[P]()}(t);return o?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(o):(r=ft(e=t),n=-1,i=r.length,function t(){var o=r[++n];return"__proto__"===o?t():n<i?{value:e[o],key:o}:null})}function lt(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function pt(t){return function(e,r,n){if(n=C(n||F),t<=0||!e)return n(null);var i=ht(e),o=!1,s=0,a=!1;function u(t,e){if(s-=1,t)o=!0,n(t);else{if(e===L||o&&s<=0)return o=!0,n(null);a||c()}}function c(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&n(null));s+=1,r(e.value,e.key,lt(u))}a=!1}c()}}function dt(t,e,r,n){pt(e)(t,b(r),n)}function yt(t,e){return function(r,n,i){return t(r,e,n,i)}}function gt(t,e,r){r=C(r||F);var n=0,i=0,o=t.length;function s(t,e){t?r(t):++i!==o&&e!==L||r(null)}for(0===o&&r(null);n<o;n++)e(t[n],n,lt(s))}var mt=yt(dt,1/0),bt=function(t,e,r){(j(t)?gt:mt)(t,b(e),r)};function wt(t){return function(e,r,n){return t(bt,e,b(r),n)}}function vt(t,e,r,n){n=n||F,e=e||[];var i=[],o=0,s=b(r);t(e,(function(t,e,r){var n=o++;s(t,(function(t,e){i[n]=e,r(t)}))}),(function(t){n(t,i)}))}var Et=wt(vt),xt=w(Et);function At(t){return function(e,r,n,i){return t(pt(r),e,b(n),i)}}var St=At(vt),_t=yt(St,1),Bt=w(_t);function kt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var Ot,Ut=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),s=o.length;s--;){var a=o[Ot?s:++n];if(!1===e(i[a],a,i))break}return t};function It(t,e){return t&&Ut(t,e,ft)}function Tt(t){return t!=t}function jt(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):function(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Tt,r)}var Lt=function(t,e,r){"function"==typeof e&&(r=e,e=null),r=C(r||F);var n=ft(t).length;if(!n)return r(null);e||(e=n);var o={},s=0,a=!1,u=Object.create(null),c=[],f=[],h={};function l(t,e){c.push((function(){!function(t,e){if(!a){var n=lt((function(e,n){if(s--,arguments.length>2&&(n=i(arguments,1)),e){var c={};It(o,(function(t,e){c[e]=t})),c[t]=n,a=!0,u=Object.create(null),r(e,c)}else o[t]=n,d(t)}));s++;var c=b(e[e.length-1]);e.length>1?c(o,n):c(n)}}(t,e)}))}function p(){if(0===c.length&&0===s)return r(null,o);for(;c.length&&s<e;)c.shift()()}function d(t){kt(u[t]||[],(function(t){t()})),p()}function y(e){var r=[];return It(t,(function(t,n){M(t)&&jt(t,e,0)>=0&&r.push(n)})),r}It(t,(function(e,r){if(!M(e))return l(r,[e]),void f.push(r);var n=e.slice(0,e.length-1),i=n.length;if(0===i)return l(r,e),void f.push(r);h[r]=i,kt(n,(function(o){if(!t[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));var s,a,c;a=function(){0==--i&&l(r,e)},(c=u[s=o])||(c=u[s]=[]),c.push(a)}))})),function(){for(var t=0;f.length;)t++,kt(y(f.pop()),(function(t){0==--h[t]&&f.push(t)}));if(t!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p()};function Ft(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Ct=A?A.prototype:void 0,Pt=Ct?Ct.toString:void 0;function Rt(t){if("string"==typeof t)return t;if(M(t))return Ft(t,Rt)+"";if(function(t){return"symbol"==typeof t||R(t)&&"[object Symbol]"==I(t)}(t))return Pt?Pt.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Nt(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:function(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}(t,e,r)}var $t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Dt="[\\ud800-\\udfff]",Ht="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",zt="\\ud83c[\\udffb-\\udfff]",Mt="[^\\ud800-\\udfff]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",Gt="(?:"+Ht+"|"+zt+")?",Kt="[\\ufe0e\\ufe0f]?",Jt=Kt+Gt+("(?:\\u200d(?:"+[Mt,qt,Vt].join("|")+")"+Kt+Gt+")*"),Wt="(?:"+[Mt+Ht+"?",Ht,qt,Vt,Dt].join("|")+")",Zt=RegExp(zt+"(?="+zt+")|"+Wt+Jt,"g");function Xt(t){return function(t){return $t.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.split("")}(t)}var Yt=/^\s+|\s+$/g;function Qt(t,e,r){if((t=null==(n=t)?"":Rt(n))&&(r||void 0===e))return t.replace(Yt,"");var n;if(!t||!(e=Rt(e)))return t;var i=Xt(t),o=Xt(e);return Nt(i,function(t,e){for(var r=-1,n=t.length;++r<n&&jt(e,t[r],0)>-1;);return r}(i,o),function(t,e){for(var r=t.length;r--&&jt(e,t[r],0)>-1;);return r}(i,o)+1).join("")}var te=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ee=/,/,re=/(=.+)?(\s*)$/,ne=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ie(t,e){var r={};It(t,(function(t,e){var n,i=m(t),o=!i&&1===t.length||i&&0===t.length;if(M(t))n=t.slice(0,-1),t=t[t.length-1],r[e]=n.concat(n.length>0?s:t);else if(o)r[e]=t;else{if(n=function(t){return(t=(t=(t=t.toString().replace(ne,"")).match(te)[2].replace(" ",""))?t.split(ee):[]).map((function(t){return Qt(t.replace(re,""))}))}(t),0===t.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[e]=n.concat(s)}function s(e,r){var i=Ft(n,(function(t){return e[t]}));i.push(r),b(t).apply(null,i)}})),Lt(r,e)}function oe(){this.head=this.tail=null,this.length=0}function se(t,e){t.length=1,t.head=t.tail=e}function ae(t,e,r){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var n=b(t),i=0,o=[],s=!1;function a(t,e,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(f.started=!0,M(t)||(t=[t]),0===t.length&&f.idle())return l((function(){f.drain()}));for(var n=0,i=t.length;n<i;n++){var o={data:t[n],callback:r||F};e?f._tasks.unshift(o):f._tasks.push(o)}s||(s=!0,l((function(){s=!1,f.process()})))}function u(t){return function(e){i-=1;for(var r=0,n=t.length;r<n;r++){var s=t[r],a=jt(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&f.error(e,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var c=!1,f={_tasks:new oe,concurrency:e,payload:r,saturated:F,unsaturated:F,buffer:e/4,empty:F,drain:F,error:F,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){f.drain=F,f._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){f._tasks.remove(t)},process:function(){if(!c){for(c=!0;!f.paused&&i<f.concurrency&&f._tasks.length;){var t=[],e=[],r=f._tasks.length;f.payload&&(r=Math.min(r,f.payload));for(var s=0;s<r;s++){var a=f._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===f._tasks.length&&f.empty(),i===f.concurrency&&f.saturated();var h=lt(u(t));n(e,h)}c=!1}},length:function(){return f._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return f._tasks.length+i===0},pause:function(){f.paused=!0},resume:function(){!1!==f.paused&&(f.paused=!1,l(f.process))}};return f}function ue(t,e){return ae(t,1,e)}oe.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},oe.prototype.empty=function(){for(;this.head;)this.shift();return this},oe.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},oe.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},oe.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):se(this,t)},oe.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):se(this,t)},oe.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oe.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},oe.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,r=0;r<this.length;r++)t[r]=e.data,e=e.next;return t},oe.prototype.remove=function(t){for(var e=this.head;e;){var r=e.next;t(e)&&this.removeLink(e),e=r}return this};var ce=yt(dt,1);function fe(t,e,r,n){n=C(n||F);var i=b(r);ce(t,(function(t,r,n){i(e,t,(function(t,r){e=r,n(t)}))}),(function(t){n(t,e)}))}function he(){var t=Ft(arguments,b);return function(){var e=i(arguments),r=this,n=e[e.length-1];"function"==typeof n?e.pop():n=F,fe(t,e,(function(t,e,n){e.apply(r,t.concat((function(t){var e=i(arguments,1);n(t,e)})))}),(function(t,e){n.apply(r,[t].concat(e))}))}}var le=function(){return he.apply(null,i(arguments).reverse())},pe=Array.prototype.concat,de=function(t,e,r,n){n=n||F;var o=b(r);St(t,e,(function(t,e){o(t,(function(t){return t?e(t):e(null,i(arguments,1))}))}),(function(t,e){for(var r=[],i=0;i<e.length;i++)e[i]&&(r=pe.apply(r,e[i]));return n(t,r)}))},ye=yt(de,1/0),ge=yt(de,1),me=function(){var t=i(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function be(t){return t}function we(t,e){return function(r,n,i,o){o=o||F;var s,a=!1;r(n,(function(r,n,o){i(r,(function(n,i){n?o(n):t(i)&&!s?(a=!0,s=e(!0,r),o(null,L)):o()}))}),(function(t){t?o(t):o(null,a?s:e(!1))}))}}function ve(t,e){return e}var Ee=wt(we(be,ve)),xe=At(we(be,ve)),Ae=yt(xe,1);function Se(t){return function(e){var r=i(arguments,1);r.push((function(e){var r=i(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&kt(r,(function(e){console[t](e)})))})),b(e).apply(null,r)}}var _e=Se("dir");function Be(t,e,r){r=lt(r||F);var n=b(t),o=b(e);function s(t){if(t)return r(t);var e=i(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?r(t):e?void n(s):r(null)}a(null,!0)}function ke(t,e,r){r=lt(r||F);var n=b(t),o=function(t){if(t)return r(t);var s=i(arguments,1);if(e.apply(this,s))return n(o);r.apply(null,[null].concat(s))};n(o)}function Oe(t,e,r){ke(t,(function(){return!e.apply(this,arguments)}),r)}function Ue(t,e,r){r=lt(r||F);var n=b(e),i=b(t);function o(t){if(t)return r(t);i(s)}function s(t,e){return t?r(t):e?void n(o):r(null)}i(s)}function Ie(t){return function(e,r,n){return t(e,n)}}function Te(t,e,r){bt(t,Ie(b(e)),r)}function je(t,e,r,n){pt(e)(t,Ie(b(r)),n)}var Le=yt(je,1);function Fe(t){return m(t)?t:s((function(e,r){var n=!0;e.push((function(){var t=arguments;n?l((function(){r.apply(null,t)})):r.apply(null,t)})),t.apply(this,e),n=!1}))}function Ce(t){return!t}var Pe=wt(we(Ce,Ce)),Re=At(we(Ce,Ce)),Ne=yt(Re,1);function $e(t){return function(e){return null==e?void 0:e[t]}}function De(t,e,r,n){var i=new Array(e.length);t(e,(function(t,e,n){r(t,(function(t,r){i[e]=!!r,n(t)}))}),(function(t){if(t)return n(t);for(var r=[],o=0;o<e.length;o++)i[o]&&r.push(e[o]);n(null,r)}))}function He(t,e,r,n){var i=[];t(e,(function(t,e,n){r(t,(function(r,o){r?n(r):(o&&i.push({index:e,value:t}),n())}))}),(function(t){t?n(t):n(null,Ft(i.sort((function(t,e){return t.index-e.index})),$e("value")))}))}function ze(t,e,r,n){(j(e)?De:He)(t,e,b(r),n||F)}var Me=wt(ze),qe=At(ze),Ve=yt(qe,1);function Ge(t,e){var r=lt(e||F),n=b(Fe(t));!function t(e){if(e)return r(e);n(t)}()}var Ke=function(t,e,r,n){n=n||F;var i=b(r);St(t,e,(function(t,e){i(t,(function(r,n){return r?e(r):e(null,{key:n,val:t})}))}),(function(t,e){for(var r={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var s=e[o].key,a=e[o].val;i.call(r,s)?r[s].push(a):r[s]=[a]}return n(t,r)}))},Je=yt(Ke,1/0),We=yt(Ke,1),Ze=Se("log");function Xe(t,e,r,n){n=C(n||F);var i={},o=b(r);dt(t,e,(function(t,e,r){o(t,e,(function(t,n){if(t)return r(t);i[e]=n,r()}))}),(function(t){n(t,i)}))}var Ye=yt(Xe,1/0),Qe=yt(Xe,1);function tr(t,e){return e in t}function er(t,e){var r=Object.create(null),n=Object.create(null);e=e||be;var o=b(t),a=s((function(t,s){var a=e.apply(null,t);tr(r,a)?l((function(){s.apply(null,r[a])})):tr(n,a)?n[a].push(s):(n[a]=[s],o.apply(null,t.concat((function(){var t=i(arguments);r[a]=t;var e=n[a];delete n[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)}))))}));return a.memo=r,a.unmemoized=t,a}var rr=h(c?n.nextTick:u?setImmediate:f);function nr(t,e,r){r=r||F;var n=j(e)?[]:{};t(e,(function(t,e,r){b(t)((function(t,o){arguments.length>2&&(o=i(arguments,1)),n[e]=o,r(t)}))}),(function(t){r(t,n)}))}function ir(t,e){nr(bt,t,e)}function or(t,e,r){nr(pt(e),t,r)}var sr=function(t,e){var r=b(t);return ae((function(t,e){r(t[0],e)}),e,1)},ar=function(t,e){var r=sr(t,e);return r.push=function(t,e,n){if(null==n&&(n=F),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,M(t)||(t=[t]),0===t.length)return l((function(){r.drain()}));e=e||0;for(var i=r._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:n};i?r._tasks.insertBefore(i,a):r._tasks.push(a)}l(r.process)},delete r.unshift,r};function ur(t,e){if(e=C(e||F),!M(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var r=0,n=t.length;r<n;r++)b(t[r])(e)}function cr(t,e,r,n){fe(i(t).reverse(),e,r,n)}function fr(t){var e=b(t);return s((function(t,r){return t.push((function(t,e){var n;t?r(null,{error:t}):(n=arguments.length<=2?e:i(arguments,1),r(null,{value:n}))})),e.apply(this,t)}))}function hr(t){var e;return M(t)?e=Ft(t,fr):(e={},It(t,(function(t,r){e[r]=fr.call(this,t)}))),e}function lr(t,e,r,n){ze(t,e,(function(t,e){r(t,(function(t,r){e(t,!r)}))}),n)}var pr=wt(lr),dr=At(lr),yr=yt(dr,1);function gr(t){return function(){return t}}function mr(t,e,r){var n=5,i=0,o={times:n,intervalFunc:gr(i)};function s(t,e){if("object"==typeof e)t.times=+e.times||n,t.intervalFunc="function"==typeof e.interval?e.interval:gr(+e.interval||i),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||n}}if(arguments.length<3&&"function"==typeof t?(r=e||F,e=t):(s(o,t),r=r||F),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var a=b(e),u=1;function c(){a((function(t){t&&u++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(t))?setTimeout(c,o.intervalFunc(u)):r.apply(null,arguments)}))}c()}var br=function(t,e){e||(e=t,t=null);var r=b(e);return s((function(e,n){function i(t){r.apply(null,e.concat(t))}t?mr(t,i,n):mr(i,n)}))};function wr(t,e){nr(ce,t,e)}var vr=wt(we(Boolean,be)),Er=At(we(Boolean,be)),xr=yt(Er,1);function Ar(t,e,r){var n=b(e);function i(t,e){var r=t.criteria,n=e.criteria;return r<n?-1:r>n?1:0}Et(t,(function(t,e){n(t,(function(r,n){if(r)return e(r);e(null,{value:t,criteria:n})}))}),(function(t,e){if(t)return r(t);r(null,Ft(e.sort(i),$e("value")))}))}function Sr(t,e,r){var n=b(t);return s((function(i,o){var s,a=!1;i.push((function(){a||(o.apply(null,arguments),clearTimeout(s))})),s=setTimeout((function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)}),e),n.apply(null,i)}))}var _r=Math.ceil,Br=Math.max;function kr(t,e,r,n){var i=b(r);St(function(t,e,r,n){for(var i=-1,o=Br(_r((e-t)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=t,t+=r;return s}(0,t,1),e,i,n)}var Or=yt(kr,1/0),Ur=yt(kr,1);function Ir(t,e,r,n){arguments.length<=3&&(n=r,r=e,e=M(t)?[]:{}),n=C(n||F);var i=b(r);bt(t,(function(t,r,n){i(e,t,r,n)}),(function(t){n(t,e)}))}function Tr(t,e){var r,n=null;e=e||F,Le(t,(function(t,e){b(t)((function(t,o){r=arguments.length>2?i(arguments,1):o,n=t,e(!t)}))}),(function(){e(n,r)}))}function jr(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Lr(t,e,r){r=lt(r||F);var n=b(e);if(!t())return r(null);var o=function(e){if(e)return r(e);if(t())return n(o);var s=i(arguments,1);r.apply(null,[null].concat(s))};n(o)}function Fr(t,e,r){Lr((function(){return!t.apply(this,arguments)}),e,r)}var Cr=function(t,e){if(e=C(e||F),!M(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function n(e){var n=b(t[r++]);e.push(lt(o)),n.apply(null,e)}function o(o){if(o||r===t.length)return e.apply(null,arguments);n(i(arguments,1))}n([])},Pr={apply:o,applyEach:xt,applyEachSeries:Bt,asyncify:p,auto:Lt,autoInject:ie,cargo:ue,compose:le,concat:ye,concatLimit:de,concatSeries:ge,constant:me,detect:Ee,detectLimit:xe,detectSeries:Ae,dir:_e,doDuring:Be,doUntil:Oe,doWhilst:ke,during:Ue,each:Te,eachLimit:je,eachOf:bt,eachOfLimit:dt,eachOfSeries:ce,eachSeries:Le,ensureAsync:Fe,every:Pe,everyLimit:Re,everySeries:Ne,filter:Me,filterLimit:qe,filterSeries:Ve,forever:Ge,groupBy:Je,groupByLimit:Ke,groupBySeries:We,log:Ze,map:Et,mapLimit:St,mapSeries:_t,mapValues:Ye,mapValuesLimit:Xe,mapValuesSeries:Qe,memoize:er,nextTick:rr,parallel:ir,parallelLimit:or,priorityQueue:ar,queue:sr,race:ur,reduce:fe,reduceRight:cr,reflect:fr,reflectAll:hr,reject:pr,rejectLimit:dr,rejectSeries:yr,retry:mr,retryable:br,seq:he,series:wr,setImmediate:l,some:vr,someLimit:Er,someSeries:xr,sortBy:Ar,timeout:Sr,times:Or,timesLimit:kr,timesSeries:Ur,transform:Ir,tryEach:Tr,unmemoize:jr,until:Fr,waterfall:Cr,whilst:Lr,all:Pe,allLimit:Re,allSeries:Ne,any:vr,anyLimit:Er,anySeries:xr,find:Ee,findLimit:xe,findSeries:Ae,forEach:Te,forEachSeries:Le,forEachLimit:je,forEachOf:bt,forEachOfSeries:ce,forEachOfLimit:dt,inject:fe,foldl:fe,foldr:cr,select:Me,selectLimit:qe,selectSeries:Ve,wrapSync:p};e.default=Pr,e.apply=o,e.applyEach=xt,e.applyEachSeries=Bt,e.asyncify=p,e.auto=Lt,e.autoInject=ie,e.cargo=ue,e.compose=le,e.concat=ye,e.concatLimit=de,e.concatSeries=ge,e.constant=me,e.detect=Ee,e.detectLimit=xe,e.detectSeries=Ae,e.dir=_e,e.doDuring=Be,e.doUntil=Oe,e.doWhilst=ke,e.during=Ue,e.each=Te,e.eachLimit=je,e.eachOf=bt,e.eachOfLimit=dt,e.eachOfSeries=ce,e.eachSeries=Le,e.ensureAsync=Fe,e.every=Pe,e.everyLimit=Re,e.everySeries=Ne,e.filter=Me,e.filterLimit=qe,e.filterSeries=Ve,e.forever=Ge,e.groupBy=Je,e.groupByLimit=Ke,e.groupBySeries=We,e.log=Ze,e.map=Et,e.mapLimit=St,e.mapSeries=_t,e.mapValues=Ye,e.mapValuesLimit=Xe,e.mapValuesSeries=Qe,e.memoize=er,e.nextTick=rr,e.parallel=ir,e.parallelLimit=or,e.priorityQueue=ar,e.queue=sr,e.race=ur,e.reduce=fe,e.reduceRight=cr,e.reflect=fr,e.reflectAll=hr,e.reject=pr,e.rejectLimit=dr,e.rejectSeries=yr,e.retry=mr,e.retryable=br,e.seq=he,e.series=wr,e.setImmediate=l,e.some=vr,e.someLimit=Er,e.someSeries=xr,e.sortBy=Ar,e.timeout=Sr,e.times=Or,e.timesLimit=kr,e.timesSeries=Ur,e.transform=Ir,e.tryEach=Tr,e.unmemoize=jr,e.until=Fr,e.waterfall=Cr,e.whilst=Lr,e.all=Pe,e.allLimit=Re,e.allSeries=Ne,e.any=vr,e.anyLimit=Er,e.anySeries=xr,e.find=Ee,e.findLimit=xe,e.findSeries=Ae,e.forEach=Te,e.forEachSeries=Le,e.forEachLimit=je,e.forEachOf=bt,e.forEachOfSeries=ce,e.forEachOfLimit=dt,e.inject=fe,e.foldl=fe,e.foldr=cr,e.select=Me,e.selectLimit=qe,e.selectSeries=Ve,e.wrapSync=p,Object.defineProperty(e,"__esModule",{value:!0})}(e)},166:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var h=0,l=o-1;(0!==f||h<i)&&-1!==l;l--,h++)f+=s*c[l]>>>0,c[l]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=h,r++}for(var p=o-i;p!==o&&0===c[p];)p++;for(var d=new Uint8Array(n+(o-p)),y=n;p!==o;)d[y++]=c[p++];return d}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var h=e[i],l=0,p=u-1;(0!==h||l<n)&&-1!==p;p--,l++)h+=256*f[p]>>>0,f[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=l,i++}for(var d=u-n;d!==u&&0===f[d];)d++;for(var y=a.repeat(r);d<u;++d)y+=t.charAt(f[d]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},766:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),s=o[0],a=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),f=0,h=a>0?s-4:s;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[f++]=e>>16&255,c[f++]=e>>8&255,c[f++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[f++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},573:(t,e,r)=>{"use strict";var n=r(834).Buffer,i=r(329);function o(t,e){return void 0===e&&(e="utf8"),n.isBuffer(t)?a(t.toString("base64")):a(n.from(t,e).toString("base64"))}function s(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function a(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var u=o;u.encode=o,u.decode=function(t,e){return void 0===e&&(e="utf8"),n.from(s(t),"base64").toString(e)},u.toBase64=s,u.fromBase64=a,u.toBuffer=function(t){return n.from(s(t),"base64")},e.default=u},329:(t,e,r)=>{"use strict";var n=r(834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.length,r=e%4;if(!r)return t;var i=e,o=4-r,s=e+o,a=n.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}},487:(t,e,r)=>{t.exports=r(573).default,t.exports.default=t.exports},22:(t,e,r)=>{const n=r(166);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},834:(t,e,r)=>{"use strict";const n=r(766),i=r(333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=a(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return f(t),a(t<0?0:0|d(t))}function l(t){const e=t.length<0?0:0|d(t.length),r=a(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(t).length;default:if(i)return n?-1:G(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(t,o+n)!==c(e,n)){r=!1;break}if(r)return o}return-1}function v(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(Z(n))return s;t[r+s]=n}return s}function E(t,e,r,n){return J(G(e,t.length-r),t,r,n)}function x(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return J(K(e),t,r,n)}function S(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(W(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(W(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(n,i),f=t.slice(e,r);for(let t=0;t<a;++t)if(c[t]!==f[t]){o=c[t],s=f[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function O(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function U(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=X[t[n]];return i}function T(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function j(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function C(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return e=+e,r>>>=0,o||P(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,o){return e=+e,r>>>=0,o||P(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Y((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=Y((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||j(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||j(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Y((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=Y((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||j(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||j(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||j(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||j(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Y((function(t,e=0){return F(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Y((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Y((function(t,e=0){return F(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Y((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const $={};function D(t,e,r){$[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function H(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function z(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new $.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){M(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1))}(n,i,o)}function M(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,r){if(Math.floor(t)!==t)throw M(t,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Y(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},98:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;var n=r(392),i=r(950);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};var o={};o[0]=e.versions.mainnet.p2pkh,o[5]=e.versions.mainnet.p2sh,o[111]=e.versions.testnet.p2pkh,o[196]=e.versions.testnet.p2sh;var s={};function a(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return"S"+n.c32checkEncode(t,e)}function u(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return n.c32checkDecode(t.slice(1))}s[e.versions.mainnet.p2pkh]=0,s[e.versions.mainnet.p2sh]=5,s[e.versions.testnet.p2pkh]=111,s[e.versions.testnet.p2sh]=196,e.c32address=a,e.c32addressDecode=u,e.b58ToC32=function(t,e){void 0===e&&(e=-1);var r,n=i.decode(t),s=n.data.toString("hex"),u=parseInt(n.prefix.toString("hex"),16);return e<0?(r=u,void 0!==o[u]&&(r=o[u])):r=e,a(r,s)},e.c32ToB58=function(t,e){void 0===e&&(e=-1);var r,n=u(t),o=n[0],a=n[1];e<0?(r=o,void 0!==s[o]&&(r=s[o])):r=e;var c=r.toString(16);return 1===c.length&&(c="0"+c),i.encode(a,c)}},950:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;var n=r(131),i=r(926),o=r(805),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e,r){if(void 0===e&&(e="00"),void 0===r&&(r="hex"),"string"==typeof t&&(t=new n.Buffer(t,r)),!(t instanceof n.Buffer))throw new TypeError('"data" argument must be an Array of Buffers');e instanceof n.Buffer||(e=new n.Buffer(e,r));var a=n.Buffer.concat([e,t]);return a=i.hashSha256(a),a=i.hashSha256(a),a=n.Buffer.concat([e,t,a.slice(0,4)]),o(s).encode(a)},e.decode=function(t,e){var r=new n.Buffer(o(s).decode(t)),a=r.slice(0,1),u=r.slice(1,-4),c=n.Buffer.concat([a,u]);return c=i.hashSha256(c),c=i.hashSha256(c),r.slice(-4).forEach((function(t,e){if(t!==c[e])throw new Error("Invalid checksum")})),e&&(a=a.toString(e),u=u.toString(e)),{prefix:a,data:u}}},392:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;var n=r(131),i=r(103),o=r(926);function s(t){return o.hashSha256(o.hashSha256(n.Buffer.from(t,"hex"))).slice(0,4).toString("hex")}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e="0"+e);var r=t.toString(16);1===r.length&&(r="0"+r);var n=s(""+r+e),o=i.c32encode(""+e+n);return""+i.c32[t]+o},e.c32checkDecode=function(t){t=i.c32normalize(t);var e=i.c32decode(t.slice(1)),r=t[0],n=i.c32.indexOf(r),o=e.slice(-8),a=n.toString(16);if(1===a.length&&(a="0"+a),s(""+a+e.substring(0,e.length-8))!==o)throw new Error("Invalid c32check string: checksum mismatch");return[n,e.substring(0,e.length-8)]}},103:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;var n=r(131);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,r){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t="0"+t);for(var o=[],s=0,a=(t=t.toLowerCase()).length-1;a>=0;a--)if(s<4){var u=i.indexOf(t[a])>>s,c=0;0!==a&&(c=i.indexOf(t[a-1]));var f=1+s,h=c%(1<<f)<<5-f,l=e.c32[u+h];s=f,o.unshift(l)}else s=0;var p=0;for(a=0;a<o.length&&"0"===o[a];a++)p++;o=o.slice(p);var d=n.Buffer.from(t,"hex").toString().match(/^\u0000*/),y=d?d[0].length:0;for(a=0;a<y;a++)o.unshift(e.c32[0]);if(r){var g=r-o.length;for(a=0;a<g;a++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,r){if(!(t=o(t)).match("^["+e.c32+"]*$"))throw new Error("Not a c32-encoded string");for(var n=t.match("^"+e.c32[0]+"*"),s=n?n[0].length:0,a=[],u=0,c=0,f=t.length-1;f>=0;f--){4===c&&(a.unshift(i[u]),c=0,u=0);var h=(e.c32.indexOf(t[f])<<c)+u,l=i[h%16];if((u=h>>4)>1<<(c+=1))throw new Error("Panic error in decoding.");a.unshift(l)}a.unshift(i[u]),a.length%2==1&&a.unshift("0");var p=0;for(f=0;f<a.length&&"0"===a[f];f++)p++;var d=(a=a.slice(p-p%2)).join("");for(f=0;f<s;f++)d="00"+d;if(r){var y=2*r-d.length;for(f=0;f<y;f+=2)d="00"+d}return d}},870:(t,e,r)=>{"use strict";e.H4=void 0;r(103),r(392);var n=r(98);Object.defineProperty(e,"H4",{enumerable:!0,get:function(){return n.c32address}})},805:(t,e,r)=>{"use strict";var n=r(821).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,u=t.charAt(0),c=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var s=(t.length-r)*c+1>>>0,f=new Uint8Array(s);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var l=0,p=s-1;(0!==h||l<o)&&-1!==p;p--,l++)h+=a*f[p]>>>0,f[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=l,r++}for(var d=s-o;d!==s&&0===f[d];)d++;var y=n.allocUnsafe(i+(s-d));y.fill(0,0,i);for(var g=i;d!==s;)y[g++]=f[d++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var c=(s-o)*f+1>>>0,h=new Uint8Array(c);o!==s;){for(var l=e[o],p=0,d=c-1;(0!==l||p<i)&&-1!==d;d--,p++)l+=256*h[d]>>>0,h[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=p,o++}for(var y=c-i;y!==c&&0===h[y];)y++;for(var g=u.repeat(r);y<c;++y)g+=t.charAt(h[y]);return g},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},131:(t,e,r)=>{"use strict";var n=r(766),i=r(333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||z(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return f(t),a(t<0?0:0|d(t))}function l(t){for(var e=t.length<0?0:0|d(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(i)return n?-1:N(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var h=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){h=!1;break}if(h)return o}return-1}function v(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(z(a))return s;t[r+s]=a}return s}function E(t,e,r,n){return D(N(e,t.length-r),t,r,n)}function x(t,e,r,n){return D(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return D($(e),t,r,n)}function S(t,e,r,n){return D(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,c=t[i],f=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(H(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),H(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(H(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(H(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),f=t.slice(e,r),h=0;h<a;++h)if(c[h]!==f[h]){o=c[h],s=f[h];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=M[t[o]];return i}function T(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function j(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||F(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,o){return e=+e,r>>>=0,o||F(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||j(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||j(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||j(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||j(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var R=/[^+/0-9A-Za-z-_]/g;function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function D(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}var M=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},616:function(){!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=d(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=f(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function v(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function E(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},m.call(w.prototype),m.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];E.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,r){return new Promise((function(n,o){var s=new w(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new E(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=l,t.Request=w,t.Response=E),e.Headers=l,e.Request=w,e.Response=E,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},926:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256=e.sha256=e.sha256nodeCrypto=e.sha256js=void 0;var n=r(878),i=function(){function t(){this._blockSize=64,this._finalSize=56,this._len=0,this._w=new Array(64),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._block=n.Buffer.alloc(this._blockSize)}return t.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.Buffer.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a<o;){for(var u=s%i,c=Math.min(o-a,i-u),f=0;f<c;f++)r[u+f]=t[a+f];a+=c,(s+=c)%i==0&&this._update(r)}return this._len+=o,this},t.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,o=(r-i)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=n.Buffer.alloc(32);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s.writeInt32BE(this._h,28),t?s.toString(t):s},t.prototype.ch=function(t,e,r){return r^t&(e^r)},t.prototype.maj=function(t,e,r){return t&e|r&(t|e)},t.prototype.sigma0=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},t.prototype.sigma1=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},t.prototype.gamma0=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},t.prototype.gamma1=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10},t.prototype._update=function(e){for(var r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0|this._f,c=0|this._g,f=0|this._h,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<64;++h)r[h]=this.gamma1(r[h-2])+r[h-7]+this.gamma0(r[h-15])+r[h-16]|0;for(var l=0;l<64;++l){var p=f+this.sigma1(a)+this.ch(a,u,c)+t.K[l]+r[l]|0,d=this.sigma0(n)+this.maj(n,i,o)|0;f=c,c=u,u=a,a=s+p|0,s=o,o=i,i=n,n=p+d|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=c+this._g|0,this._h=f+this._h|0},t.K=[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],t}();e.sha256js=i;var o=function(){function t(){t.useCryptoModuleCache&&void 0!==t.nodeCryptoCreateHash||(t.nodeCryptoCreateHash=r(96).createHash),this.hash=t.nodeCryptoCreateHash("sha256")}return t.prototype.update=function(t,e){return this.hash.update(t,e),this},t.prototype.digest=function(t){return t?this.hash.digest(t):this.hash.digest()},t.useCryptoModuleCache=!0,t}();e.sha256nodeCrypto=o;var s=void 0,a=function(){function t(){!function(){if(o.useCryptoModuleCache&&void 0!==s)return s;var t=!1;try{var e=r(96);t=e&&"function"==typeof e.createHash}catch(t){}return s=t,t}()?this.instance=new i:this.instance=new o}return t.prototype.update=function(t,e){return this.instance.update(t,e),this},t.prototype.digest=function(t){return t?this.instance.digest(t):this.instance.digest()},t}();function u(t){return(new a).update(t).digest()}e.sha256=a,e.hashSha256=u,e.default=u},878:(t,e,r)=>{"use strict";var n=r(766),i=r(333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||z(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return f(t),a(t<0?0:0|d(t))}function l(t){for(var e=t.length<0?0:0|d(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(i)return n?-1:N(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var h=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){h=!1;break}if(h)return o}return-1}function v(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(z(a))return s;t[r+s]=a}return s}function E(t,e,r,n){return D(N(e,t.length-r),t,r,n)}function x(t,e,r,n){return D(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return D($(e),t,r,n)}function S(t,e,r,n){return D(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,c=t[i],f=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=k));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(H(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),H(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(H(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(H(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),f=t.slice(e,r),h=0;h<a;++h)if(c[h]!==f[h]){o=c[h],s=f[h];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=M[t[o]];return i}function T(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function j(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||F(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,o){return e=+e,r>>>=0,o||F(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||j(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||j(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||j(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||j(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var R=/[^+/0-9A-Za-z-_]/g;function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function D(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}var M=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},120:(t,e,r)=>{"use strict";var n=r(821).Buffer,i=r(221);function o(t){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(t,e,r){for(var n=0;e+n<r&&0===t[e+n];)++n;return t[e+n]>=128&&--n,n}t.exports={derToJose:function(t,e){t=o(t);var r=i(e),s=r+1,a=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var c=t[u++];if(129===c&&(c=t[u++]),a-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(a-u)+'" remaining');if(2!==t[u++])throw new Error('Could not find expected "int" for "r"');var f=t[u++];if(a-u-2<f)throw new Error('"r" specified length of "'+f+'", only "'+(a-u-2)+'" available');if(s<f)throw new Error('"r" specified length of "'+f+'", max of "'+s+'" is acceptable');var h=u;if(u+=f,2!==t[u++])throw new Error('Could not find expected "int" for "s"');var l=t[u++];if(a-u!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(a-u)+'"');if(s<l)throw new Error('"s" specified length of "'+l+'", max of "'+s+'" is acceptable');var p=u;if((u+=l)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-u)+'" bytes remain');var d=r-f,y=r-l,g=n.allocUnsafe(d+f+y+l);for(u=0;u<d;++u)g[u]=0;t.copy(g,u,h+Math.max(-d,0),h+f);for(var m=u=r;u<m+y;++u)g[u]=0;return t.copy(g,u,p+Math.max(-y,0),p+l),(g=g.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,e){t=o(t);var r=i(e),a=t.length;if(a!==2*r)throw new TypeError('"'+e+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var u=s(t,0,r),c=s(t,r,t.length),f=r-u,h=r-c,l=2+f+1+1+h,p=l<128,d=n.allocUnsafe((p?2:3)+l),y=0;return d[y++]=48,p?d[y++]=l:(d[y++]=129,d[y++]=255&l),d[y++]=2,d[y++]=f,u<0?(d[y++]=0,y+=t.copy(d,y,0,r)):y+=t.copy(d,y,u,r),d[y++]=2,d[y++]=h,c<0?(d[y++]=0,t.copy(d,y,r)):t.copy(d,y,r+c),d}}},221:t=>{"use strict";function e(t){return(t/8|0)+(t%8==0?0:1)}var r={ES256:e(256),ES384:e(384),ES512:e(521)};t.exports=function(t){var e=r[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}},333:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+p]=255&s,p+=d,s/=256,c-=8);t[r+p-d]|=128*y}},996:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoClients=e.SECP256K1Client=void 0;const n=r(869);Object.defineProperty(e,"SECP256K1Client",{enumerable:!0,get:function(){return n.SECP256K1Client}});const i={ES256K:n.SECP256K1Client};e.cryptoClients=i},869:(t,e,r)=>{"use strict";var n=r(834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.SECP256K1Client=void 0;const i=r(514),o=r(53),s=r(698),a=r(120),u=r(643);s.utils.hmacSha256Sync=(t,...e)=>{const r=i.hmac.create(o.sha256,t);return e.forEach((t=>r.update(t))),r.digest()};class c{static derivePublicKey(t,e=!0){return 66===t.length&&(t=t.slice(0,64)),t.length<64&&(t=t.padStart(64,"0")),n.from(s.getPublicKey(t,e)).toString("hex")}static signHash(t,e,r="jose"){if(!t||!e)throw new u.MissingParametersError("a signing input hash and private key are all required");const i=n.from(s.signSync(t,e.slice(0,64),{der:!0,canonical:!1}));if("der"===r)return i.toString("hex");if("jose"===r)return(0,a.derToJose)(i,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return(0,a.joseToDer)(t,"ES256")}static verifyHash(t,e,r){if(!t||!e||!r)throw new u.MissingParametersError("a signing input hash, der signature, and public key are all required");return s.verify(e,t,r,{strict:!1})}}e.SECP256K1Client=c,c.algorithmName="ES256K"},874:function(t,e,r){"use strict";var n=r(834).Buffer,i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256Async=e.hashSha256=void 0;const o=r(53);function s(t){return n.from((0,o.sha256)(t))}e.hashSha256=s,e.hashSha256Async=function(t){return i(this,void 0,void 0,(function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?n.from(t):t,r=yield crypto.subtle.digest("SHA-256",e);return n.from(r)}{const e=r(812);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(s(t))}}))}},917:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeToken=void 0;const n=r(487);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(n.default.decode(e[0])),payload:JSON.parse(n.default.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=n.default.decode(e));const r=[];return t.header.map((t=>{const e=JSON.parse(n.default.decode(t));r.push(e)})),{header:r,payload:JSON.parse(e),signature:t.signature}}}},643:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidTokenError=e.MissingParametersError=void 0;class r extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=r;class n extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=n},474:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(650),e),i(r(458),e),i(r(917),e),i(r(643),e),i(r(996),e)},650:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenSigner=e.createUnsecuredToken=void 0;const i=r(487),o=r(996),s=r(643),a=r(874);function u(t,e){const r=[],n=i.default.encode(JSON.stringify(e));r.push(n);const o=i.default.encode(JSON.stringify(t));return r.push(o),r.join(".")}e.createUnsecuredToken=function(t){return u(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new s.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,r={}){const n=this.header(r),i=u(t,n),o=(0,a.hashSha256)(i);return this.createWithSignedHash(t,e,n,i,o)}signAsync(t,e=!1,r={}){return n(this,void 0,void 0,(function*(){const n=this.header(r),i=u(t,n),o=yield(0,a.hashSha256Async)(i);return this.createWithSignedHash(t,e,n,i,o)}))}createWithSignedHash(t,e,r,n,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.default.encode(JSON.stringify(r))],payload:JSON.stringify(t),signature:[s]}:[n,s].join(".")}}},458:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenVerifier=void 0;const n=r(487),i=r(996),o=r(643),s=r(874);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t&&this.verifyExpanded(t,!1)}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const r=t.split("."),n=r[0]+"."+r[1],i=t=>{const e=this.cryptoClient.loadSignature(r[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return(0,s.hashSha256Async)(n).then((t=>i(t)));{const t=(0,s.hashSha256)(n);return i(t)}}verifyExpanded(t,e){const r=[t.header.join("."),n.default.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map((t=>{const r=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,r,this.rawPublicKey)||(i=!1)})),i);if(e)return(0,s.hashSha256Async)(r).then((t=>o(t)));{const t=(0,s.hashSha256)(r);return o(t)}}}},907:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",c="[object GeneratorFunction]",f="[object Map]",h="[object Number]",l="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",m="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",v="[object DataView]",E="[object Float32Array]",x="[object Float64Array]",A="[object Int8Array]",S="[object Int16Array]",_="[object Int32Array]",B="[object Uint8Array]",k="[object Uint8ClampedArray]",O="[object Uint16Array]",U="[object Uint32Array]",I=/\w*$/,T=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,L={};L[o]=L["[object Array]"]=L[w]=L[v]=L[s]=L[a]=L[E]=L[x]=L[A]=L[S]=L[_]=L[f]=L[h]=L[l]=L[d]=L[y]=L[g]=L[m]=L[B]=L[k]=L[O]=L[U]=!0,L["[object Error]"]=L[u]=L[b]=!1;var F="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,C="object"==typeof self&&self&&self.Object===Object&&self,P=F||C||Function("return this")(),R=e&&!e.nodeType&&e,N=R&&t&&!t.nodeType&&t,$=N&&N.exports===R;function D(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function z(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function M(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function q(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function V(t,e){return function(r){return t(e(r))}}function G(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var K,J=Array.prototype,W=Function.prototype,Z=Object.prototype,X=P["__core-js_shared__"],Y=(K=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",Q=W.toString,tt=Z.hasOwnProperty,et=Z.toString,rt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=$?P.Buffer:void 0,it=P.Symbol,ot=P.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ut=Z.propertyIsEnumerable,ct=J.splice,ft=Object.getOwnPropertySymbols,ht=nt?nt.isBuffer:void 0,lt=V(Object.keys,Object),pt=Pt(P,"DataView"),dt=Pt(P,"Map"),yt=Pt(P,"Promise"),gt=Pt(P,"Set"),mt=Pt(P,"WeakMap"),bt=Pt(Object,"create"),wt=Ht(pt),vt=Ht(dt),Et=Ht(yt),xt=Ht(gt),At=Ht(mt),St=it?it.prototype:void 0,_t=St?St.valueOf:void 0;function Bt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ut(t){this.__data__=new kt(t)}function It(t,e,r){var n=t[e];tt.call(t,e)&&zt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Tt(t,e){for(var r=t.length;r--;)if(zt(t[r][0],e))return r;return-1}function jt(t,e,r,n,i,p,b){var T;if(n&&(T=p?n(t,i,p,b):n(t)),void 0!==T)return T;if(!Kt(t))return t;var j=Mt(t);if(j){if(T=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,T)}else{var F=Nt(t),C=F==u||F==c;if(Vt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(F==l||F==o||C&&!p){if(M(t))return p?t:{};if(T=function(t){return"function"!=typeof t.constructor||Dt(t)?{}:Kt(e=st(t))?at(e):{};var e}(C?{}:t),!e)return function(t,e){return Ft(t,Rt(t),e)}(t,function(t,e){return t&&Ft(e,Jt(e),t)}(T,t))}else{if(!L[F])return p?t:{};T=function(t,e,r,n){var i,o=t.constructor;switch(e){case w:return Lt(t);case s:case a:return new o(+t);case v:return function(t,e){var r=e?Lt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case E:case x:case A:case S:case _:case B:case k:case O:case U:return function(t,e){var r=e?Lt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return z(e?r(q(t),!0):q(t),D,new t.constructor)}(t,n,r);case h:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,I.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,r){return z(e?r(G(t),!0):G(t),H,new t.constructor)}(t,n,r);case m:return i=t,_t?Object(_t.call(i)):{}}}(t,F,jt,e)}}b||(b=new Ut);var P=b.get(t);if(P)return P;if(b.set(t,T),!j)var R=r?function(t){return function(t,e,r){var n=e(t);return Mt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Jt,Rt)}(t):Jt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(R||t,(function(i,o){R&&(i=t[o=i]),It(T,o,jt(i,e,r,n,o,t,b))})),T}function Lt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ft(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=n?n(r[s],t[s],s,r,t):void 0;It(r,s,void 0===a?t[s]:a)}return r}function Ct(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Pt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Kt(t)||(e=t,Y&&Y in e))&&(Gt(t)||M(t)?rt:T).test(Ht(t));var e}(r)?r:void 0}Bt.prototype.clear=function(){this.__data__=bt?bt(null):{}},Bt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Bt.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},Bt.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},Bt.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},kt.prototype.clear=function(){this.__data__=[]},kt.prototype.delete=function(t){var e=this.__data__,r=Tt(e,t);return!(r<0||(r==e.length-1?e.pop():ct.call(e,r,1),0))},kt.prototype.get=function(t){var e=this.__data__,r=Tt(e,t);return r<0?void 0:e[r][1]},kt.prototype.has=function(t){return Tt(this.__data__,t)>-1},kt.prototype.set=function(t,e){var r=this.__data__,n=Tt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Ot.prototype.clear=function(){this.__data__={hash:new Bt,map:new(dt||kt),string:new Bt}},Ot.prototype.delete=function(t){return Ct(this,t).delete(t)},Ot.prototype.get=function(t){return Ct(this,t).get(t)},Ot.prototype.has=function(t){return Ct(this,t).has(t)},Ot.prototype.set=function(t,e){return Ct(this,t).set(t,e),this},Ut.prototype.clear=function(){this.__data__=new kt},Ut.prototype.delete=function(t){return this.__data__.delete(t)},Ut.prototype.get=function(t){return this.__data__.get(t)},Ut.prototype.has=function(t){return this.__data__.has(t)},Ut.prototype.set=function(t,e){var r=this.__data__;if(r instanceof kt){var n=r.__data__;if(!dt||n.length<199)return n.push([t,e]),this;r=this.__data__=new Ot(n)}return r.set(t,e),this};var Rt=ft?V(ft,Object):function(){return[]},Nt=function(t){return et.call(t)};function $t(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||j.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Z)}function Ht(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zt(t,e){return t===e||t!=t&&e!=e}(pt&&Nt(new pt(new ArrayBuffer(1)))!=v||dt&&Nt(new dt)!=f||yt&&Nt(yt.resolve())!=p||gt&&Nt(new gt)!=y||mt&&Nt(new mt)!=b)&&(Nt=function(t){var e=et.call(t),r=e==l?t.constructor:void 0,n=r?Ht(r):void 0;if(n)switch(n){case wt:return v;case vt:return f;case Et:return p;case xt:return y;case At:return b}return e});var Mt=Array.isArray;function qt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Gt(t)}var Vt=ht||function(){return!1};function Gt(t){var e=Kt(t)?et.call(t):"";return e==u||e==c}function Kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return qt(t)?function(t,e){var r=Mt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&qt(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||$t(s,n))||r.push(s);return r}(t):function(t){if(!Dt(t))return lt(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return jt(t,!0,!0)}},406:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,u=[],c=!1,f=-1;function h(){c&&a&&(c=!1,a.length?u=a.concat(u):f=-1,u.length&&l())}function l(){if(!c){var t=s(h);c=!0;for(var e=u.length;e;){for(a=u,u=[];++f<e;)a&&a[f].run();f=-1,e=u.length}a=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||s(l)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},821:(t,e,r)=>{var n=r(834),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},179:(t,e,r)=>{t.exports=r(224)},224:(t,e,r)=>{!function(){var e={};if(e.async=r(625),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var n=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),r=null,n=null;return e.forEach((function(e){if(e&&e.constructor===Object)for(r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]]})),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){u.array(t)||(t=[t]),t.forEach((function(t){delete this.custom[t]}),this)}}function a(t,e){var r=["@"];if(this._schema=t,this._custom={},null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._custom["$"+n]=e[n]);this._getDepth=function(){return r.length},this._dumpStack=function(){return r.map((function(t){return t.replace(/^\[/g,"")})).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return r.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return r.push("["+t+"]"),this},this._back=function(){return r.pop(),this}}var u={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&t.constructor!==Array&&null!=t},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function c(t,e){return"function"==typeof t?e instanceof t:u[t=t in u?t:"any"](e)}function f(t,e){for(var r=[],n=t.indexOf(e);-1!==n;)r.push(n),n=t.indexOf(e,n+1);return r}var h={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},l={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var r=u.array(t.type)?t.type:[t.type];r.some((function(t){return c(t,e)}))||(r=r.map((function(t){return"function"==typeof t?"an instance of "+t.name:t})),this.report("must be "+r.join(" or ")+", but is "+function(t){for(var e in u)if(c(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(u.array(e)||"string"==typeof e))for(var r=[],n=0;n<e.length;n++)if(!(r.indexOf(e[n])>=0)){var i=f(e,e[n]);i.length>1&&(r.push(e[n]),this.report("has value ["+e[n]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var r=t.pattern;if("string"==typeof e){var n=!1;u.array(r)||(r=[r]),r.forEach((function(t){"string"==typeof t&&t in h&&(t=h[t]),t instanceof RegExp&&t.test(e)&&(n=!0)})),n||this.report("must match ["+r.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.minLength);isNaN(r)||e.length<r&&this.report("must be longer than "+r+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.maxLength);isNaN(r)||e.length>r&&this.report("must be shorter than "+r+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.exactLength);isNaN(r)||e.length!==r&&this.report("must have exactly "+r+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var r=Number(t.lt);"number"!=typeof e||isNaN(r)||e>=r&&this.report("must be less than "+r+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var r=Number(t.lte);"number"!=typeof e||isNaN(r)||e>r&&this.report("must be less than or equal to "+r+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var r=Number(t.gt);"number"!=typeof e||isNaN(r)||e<=r&&this.report("must be greater than "+r+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var r=Number(t.gte);"number"!=typeof e||isNaN(r)||e<r&&this.report("must be greater than or equal to "+r+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var r=t.eq;if("number"==typeof r||"string"==typeof r||"boolean"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return;this.report("must be equal to ["+r.map((function(t){return'"'+t+'"'})).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==r&&this.report('must be equal to "'+r+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var r=t.ne;if("number"==typeof r||"string"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return void this.report('must not be equal to "'+r[n]+'"',null,"ne")}else e===r&&this.report('must not be equal to "'+r+'"',null,"ne")}},someKeys:function(t,e){var r=t.someKeys;u.object(e)&&(r.some((function(t){return t in e}))||this.report("must have at least key "+r.map((function(t){return'"'+t+'"'})).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&u.object(e)&&u.object(t.properties)&&void 0===t.properties["*"]){var r=Object.keys(e).filter((function(e){return void 0===t.properties[e]}));if(r.length>0){var n="should not contains "+(r.length>1?"properties":"property")+" ["+r.map((function(t){return'"'+t+'"'})).join(", ")+"]";this.report(n,null,"strict")}}},exec:function(t,e,r){var n=this;if("function"==typeof r)return this.asyncExec(t,e,r);(u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&r.call(n,t,e)}))},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(t.properties instanceof Object&&e instanceof Object){var n,i=t.properties;if(null!=i["*"])for(n in e)n in i||(this._deeperObject(n),this._validate(i["*"],e[n]),this._back());for(n in i)"*"!==n&&(this._deeperObject(n),this._validate(i[n],e[n]),this._back())}},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(t.items instanceof Object&&e instanceof Object){var n,i,o=t.items;if(u.array(o)&&u.array(e))for(n=0,i=o.length;n<i;n++)this._deeperArray(n),this._validate(o[n],e[n]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},p={asyncExec:function(t,e,r){var i=this;n.eachSeries(u.array(t.exec)?t.exec:[t.exec],(function(r,o){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,o);r.call(i,t,e)}n.nextTick(o)}),r)},asyncProperties:function(t,e,r){if(!(t.properties instanceof Object&&u.object(e)))return r();var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();n.eachSeries(Object.keys(e),(function(t,r){if(t in o)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o["*"],e[t],(function(t){i._back(),r(t)}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o[t],e[t],(function(t){i._back(),r(t)}))}),t)}],r)},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r();var i=this,o=t.items;u.array(o)&&u.array(e)?n.timesSeries(o.length,(function(t,r){i._deeperArray(t),i._asyncValidate(o[t],e[t],(function(t,e){i._back(),r(t,e)})),i._back()}),r):n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncValidate(o,e[t],(function(t,e){i._back(),r(t,e)}))}),r)}};function d(t,e){a.prototype.constructor.call(this,t,o(d.custom,e));var r=[];this._basicFields=Object.keys(l),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,n){var i={code:e||this.userCode||null,reason:n||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return r.push(i),this},this.result=function(){return{error:r,valid:0===r.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map((function(t){return"Property "+t.property+": "+t.message})).join("\n")}}}}i(d.prototype,l),i(d.prototype,p),i(d,new s),d.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return n.nextTick((function(){r._asyncValidate(r._schema,t,(function(t){r.origin=null,e(t,r.result())}))}))}return this._validate(this._schema,t).result()},d.prototype._validate=function(t,e,r){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||this[r](t,e)}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&this._custom[r].call(this,t,e)}),this),this},d.prototype._asyncValidate=function(t,e,r){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,n.series([function(r){n.eachSeries(Object.keys(l),(function(r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);i[r](t,e)}o()}))}),r)},function(r){n.eachSeries(Object.keys(i._custom),(function(r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);i._custom[r].call(i,t,e)}o()}))}),r)}],r)};var y={number:function(t,e){var r;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return r}else if(t instanceof Date)return+t;return null},integer:function(t,e){var r;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseInt(t.replace(/ /g,""),10)))return r}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():u.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var r=new Date(t);return isNaN(r.getTime())?null:r},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||u.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(u.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return u.array(t)?null:[t]}},g={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},m={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:u.object(t.properties)&&u.object(e)?(Object.keys(e).forEach((function(r){r in t.properties||delete e[r]})),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var r,n="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(r=y[t.type](e,t))&&!n||!r&&isNaN(r)||null===r&&"string"===t.type)&&(r=t.def):n||(r=t.def),(null!=r||void 0!==t.def&&t.def===r)&&r!==e?(this.report(),r):e},rules:function(t,e){var r=t.rules;if("string"!=typeof e||"string"!=typeof r&&!u.array(r))return e;var n=!1;return(u.array(r)?r:[r]).forEach((function(t){"function"==typeof g[t]&&(e=g[t](e),n=!0)})),n&&this.report(),e},min:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.min);return isNaN(n)?e:r<n?(this.report(),n):e},max:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.max);return isNaN(n)?e:r>n?(this.report(),n):e},minLength:function(t,e){var r=Number(t.minLength);if("string"!=typeof e||isNaN(r)||r<0)return e;var n="",i=r-e.length;if(i>0){for(var o=0;o<i;o++)n+="-";return this.report(),e+n}return e},maxLength:function(t,e){var r=Number(t.maxLength);return"string"!=typeof e||isNaN(r)||r<0?e:e.length>r?(this.report(),e.slice(0,r)):e},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(!e||"object"!=typeof e)return e;var n,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties["*"],e[i]))&&(e[i]=n),this._back());for(i in t.properties)"*"!==i&&(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties[i],e[i]))&&(e[i]=n),this._back());return e},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(!(t.items instanceof Object&&e instanceof Object))return e;var n;if(u.array(t.items)&&u.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(n=0;n<i;n++)this._deeperArray(n),e[n]=this._sanitize(t.items[n],e[n]),this._back()}else for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._deeperArray(n),e[n]=this._sanitize(t.items,e[n]),this._back());return e},exec:function(t,e,r){return"function"==typeof r?this.asyncExec(t,e,r):((u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&(e=r.call(this,t,e))}),this),e)}},b={asyncExec:function(t,e,r){var i=this,o=u.array(t.exec)?t.exec:[t.exec];n.eachSeries(o,(function(r,n){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,(function(t,r){if(t)return n(t);e=r,n()}));e=r.call(i,t,e)}n()}),(function(t){r(t,e)}))},asyncProperties:function(t,e,r){if(!e||"object"!=typeof e)return r(null,e);var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();var r=o["*"];n.eachSeries(Object.keys(e),(function(t,n){if(t in o)return n();i._deeperObject(t),i._asyncSanitize(r,e[t],(function(r,o){void 0!==o&&(e[t]=o),i._back(),n()}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return r();i._deeperObject(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);void 0!==o&&(e[t]=o),i._back(),r()}))}),t)}],(function(t){return r(t,e)}))},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r(null,e);var i=this,o=t.items;if(u.array(o)&&u.array(e)){var s=o.length<e.length?o.length:e.length;n.timesSeries(s,(function(t,r){i._deeperArray(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}))}else n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncSanitize(o,e[t],(function(n,o){if(n)return r();e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}));return e}};function w(t,e){a.prototype.constructor.call(this,t,o(w.custom,e));var r=[];this._basicFields=Object.keys(m),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};r.some((function(t){return t.property===e.property}))||r.push(e)},this.result=function(t){return{data:t,reporting:r,format:function(){return this.reporting.map((function(t){return"Property "+t.property+" "+t.message})).join("\n")}}}}i(w.prototype,m),i(w.prototype,b),i(w,new s),w.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return this._asyncSanitize(this._schema,t,(function(t,n){r.origin=null,e(t,r.result(n))}))}var n=this._sanitize(this._schema,t);return this.origin=null,this.result(n)},w.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||(e=this[r](t,e))}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&(e=this._custom[r].call(this,t,e))}),this),e},w.prototype._asyncSanitize=function(t,e,r){var i=this;this.userAlias=t.alias||null,n.waterfall([function(r){n.reduce(i._basicFields,e,(function(e,r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);e=i[r](t,e)}o(null,e)}))}),r)},function(e,r){n.reduce(i._customFields,e,(function(e,r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);e=i._custom[r].call(i,t,e)}o(null,e)}))}),r)}],r)};var v=2147483647,E={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},x={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var r="#";t<1&&(t=1);for(var n=0,i=E.int(t,e);n<i;n++)r+=E.fromList("0123456789abcdefABCDEF");return r},numeric:function(){return""+E.int(0,v)},integer:function(){return!0===E.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=E.int(t,e);n<i;n++)r+=E.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return r},alphaNumeric:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=E.int(t,e);n<i;n++)r+=E.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return r},alphaDash:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=E.int(t,e);n<i;n++)r+=E.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return r},javascript:function(t,e){for(var r=E.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),n=0,i=E.int(t,e-1);n<i;n++)r+=E.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return r}};function A(t){var e=-2147483648,r=v;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?r=t.lte:null!=t.lt&&(r=t.lt-1),{min:e,max:r}}var S={string:function(t){if(null!=t.eq)return t.eq;var e="",r=null!=t.minLength?t.minLength:0,n=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof x[t.pattern])return x[t.pattern](r,n);for(var i=null!=t.exactLength?t.exactLength:E.int(r,n),o=0;o<i;o++)e+=E.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=A(t),r=E.float(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=E.float(e.min,e.max);return r},integer:function(t){if(null!=t.eq)return t.eq;var e=A(t),r=E.int(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=E.int(e.min,e.max);return r},boolean:function(t){return null!=t.eq?t.eq:E.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},r=t.properties||{};for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(!0===r[n].optional&&!0===E.bool())continue;if("*"!==n)e[n]=this.generate(r[n]);else for(var i="__random_key_",o=i+0,s=E.int(1,9),a=1;a<=s;a++)o in r||(e[o]=this.generate(r[n])),o=i+a}return e},array:function(t){var e,r,n,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(u.array(o))for(n=o.length,null!=t.exactLength?n=t.exactLength:n<s?n=s:n>a&&(n=a),r=new Array(n),e=null,i=0;i<n;i++)e=o[i].type||"any",u.array(e)&&(e=e[E.int(0,e.length-1)]),r[i]=this[e](o[i]);else for(n=null!=t.exactLength?t.exactLength:E.int(s,a),r=new Array(n),e=o.type||"any",u.array(e)&&(e=e[E.int(0,e.length-1)]),i=0;i<n;i++)r[i]=this[e](o);return r},any:function(t){var e=Object.keys(S);return this[e[E.int(0,e.length-2)]](t)}};function _(){}i(_.prototype,S);var B=null;_.instance=function(){return B instanceof _||(B=new _),B},_.prototype.generate=function(t){var e=t.type||"any";return u.array(e)&&(e=e[E.int(0,e.length-1)]),this[e](t)};var k={};t.exports?t.exports=k:window.SchemaInspector=k,k.newSanitization=function(t,e){return new w(t,e)},k.newValidation=function(t,e){return new d(t,e)},k.Validation=d,k.Sanitization=w,k.sanitize=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new w(t,r).sanitize(e,n)},k.validate=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new d(t,r).validate(e,n)},k.generate=function(t,e){if("number"==typeof e){for(var r=new Array(e),n=0;n<e;n++)r[n]=_.instance().generate(t);return r}return _.instance().generate(t)}}()},377:(t,e,r)=>{"use strict";t.exports=r(613)},613:(t,e)=>{"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var r="";return void 0!==t&&(r+="$ORIGIN "+t),e.replace("{$origin}",r)}(t.$origin,e),e=function(t,e){var r="";return void 0!==t&&(r+="$TTL "+t),e.replace("{$ttl}",r)}(t.$ttl,e),e=function(t,e){var r=e;if(void 0!==t)for(var n in t.name=t.name||"@",t.ttl=t.ttl||"",t)r=r.replace("{"+n+"}",t[n]+"\t");return r}(t.soa,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",r)}(t.ns,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",r)}(t.a,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",r)}(t.aaaa,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",r)}(t.cname,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",r)}(t.mx,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",r)}(t.ptr,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tTXT\t";var a=s.txt;"string"==typeof a?r+='"'+a+'"':a instanceof Array&&(r+=a.map((function(t){return'"'+t+'"'})).join(" ")),r+="\n"}return e.replace("{txt}",r)}(t.txt,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tSRV\t"+s.priority+"\t",r+=s.weight+"\t",r+=s.port+"\t",r+=s.target+"\n"}return e.replace("{srv}",r)}(t.srv,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",r)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var r=Math.round(Date.now()/1e3);return e.replace("{time}",""+r)}(t,e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tURI\t"+s.priority+"\t",r+=s.weight+"\t",r+='"'+s.target+'"\n'}return e.replace("{uri}",r)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,r={},i=n(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var m=o.toUpperCase();/\s+TXT\s+/.test(m)?(r.txt=r.txt||[],r.txt.push(l(o))):0===m.indexOf("$ORIGIN")?r.$origin=o.split(/\s+/g)[1]:0===m.indexOf("$TTL")?r.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(m)?r.soa=s(o):/\s+NS\s+/.test(m)?(r.ns=r.ns||[],r.ns.push(a(o))):/\s+A\s+/.test(m)?(r.a=r.a||[],r.a.push(u(o,r.a))):/\s+AAAA\s+/.test(m)?(r.aaaa=r.aaaa||[],r.aaaa.push(c(o))):/\s+CNAME\s+/.test(m)?(r.cname=r.cname||[],r.cname.push(f(o))):/\s+MX\s+/.test(m)?(r.mx=r.mx||[],r.mx.push(h(o))):/\s+PTR\s+/.test(m)?(r.ptr=r.ptr||[],r.ptr.push(p(o,r.ptr,r.$origin))):/\s+SRV\s+/.test(m)?(r.srv=r.srv||[],r.srv.push(d(o))):/\s+SPF\s+/.test(m)?(r.spf=r.spf||[],r.spf.push(y(o))):/\s+URI\s+/.test(m)&&(r.uri=r.uri||[],r.uri.push(g(o)))}}return r}(t=function(t){for(var e=[],r=/\([\s\S]*?\)/gim,n=r.exec(t);null!==n;){var i=n[0].replace(/\s+/gm," ");e.push({match:n,replacement:i}),n=r.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var u=a[s],c=u.match;o.splice(c.index,c[0].length,u.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,(function(t,e){return e||""}))}(t)))}function s(t){var e={},r=t.trim().split(/\s+/g),n=r.length;return e.name=r[0],e.minimum=parseInt(r[n-1],10),e.expire=parseInt(r[n-2],10),e.retry=parseInt(r[n-3],10),e.refresh=parseInt(r[n-4],10),e.serial=parseInt(r[n-5],10),e.rname=r[n-6],e.mname=r[n-7],isNaN(r[1])||(e.ttl=parseInt(r[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),r={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function u(t,e){var r=t.trim().split(/\s+/g),n=t.trim().toUpperCase().split(/\s+/g),i={name:r[0],ip:r[r.length-1]};return 0===n.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function c(t){var e=t.trim().split(/\s+/g),r={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function f(t){var e=t.trim().split(/\s+/g),r={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],preference:parseInt(e[r-2],10),host:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var r,n=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}r=n-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[n-1]);var s={name:e[0],txt:r};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function p(t,e,r){var n=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&n.unshift(e[e.length-1].name);var i={name:n[0],fullname:n[0]+"."+r,host:n[n.length-1]};return isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function d(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1],priority:parseInt(e[r-4],10),weight:parseInt(e[r-3],10),port:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function y(t){for(var e=t.trim().split(/\s+/g),r={name:e[0],data:""},n=e.length;n-- >4;)r.data=e[n]+" "+r.data.trim();return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function g(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1].replace(/"/g,""),priority:parseInt(e[r-3],10),weight:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},314:()=>{},695:()=>{},96:()=>{},812:()=>{}},n={};function i(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={id:t,loaded:!1,exports:{}};return r[t].call(o.exports,o,o.exports,i),o.loaded=!0,o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&n&&r;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>r[t]));return s.default=()=>r,i.d(o,s),o},i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";i.r(o),i.d(o,{BLOCKSTACK_GAIA_HUB_LABEL:()=>Hr,GaiaHubConfig:()=>t.GaiaHubConfig,Storage:()=>Wr,connectToGaiaHub:()=>Gr,deleteFromGaiaHub:()=>Mr,getBucketUrl:()=>Kr,getFullReadUrl:()=>qr,getUserAppFileUrl:()=>Zr,uploadToGaiaHub:()=>zr});var t={};i.r(t),i.d(t,{Ne:()=>Hr,cc:()=>Gr,gZ:()=>Mr,CC:()=>Jr,JV:()=>Kr,J$:()=>qr,d_:()=>zr});var e=i(474);const r=["debug","info","warn","error","none"],n={},s={};for(let t=0;t<r.length;t++){const e=r[t];n[e]=t,s[t]=e}class a{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return n.debug<=n[t]}}var u=i(834),c=i(834).Buffer;const f=void 0!==c?c:u.Buffer;function h(t){return Number.isFinite(t)?Math.floor(1024*t*1024):0}function l(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))}function p(t,{throwIfUnavailable:e,usageDesc:r,returnEmptyObject:n}={}){let o;try{if(o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i.g)return i.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}(),o){const e=o[t];if(e)return e}}catch(e){a.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=function(t,e,r){return r?`Use of '${r}' requires \`${e}\` which is unavailable on the '${t}' object within the currently executing environment.`:`\`${e}\` is unavailable on the '${t}' object within the currently executing environment.`}(o,t.toString(),r);throw a.error(e),new Error(e)}if(n)return{}}const d=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function y(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(const r of t)e+=d[r];return e}function g(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function m(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}const b={number:g,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:m,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");g(t.outputLen),g(t.blockLen)},exists:function(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")},output:function(t,e){m(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}},w=("object"==typeof self&&"crypto"in self&&self.crypto,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),v=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function E(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));class x{clone(){return this._cloneInto()}}function A(t){const e=e=>t().update(E(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class S extends x{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,b.hash(t);const r=E(e);if(this.iHash=t.create(),!(this.iHash instanceof x))throw new TypeError("Expected instance of class which extends utils.Hash");const n=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const i=new Uint8Array(n);i.set(r.length>this.iHash.blockLen?t.create().update(r).digest():r);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 b.exists(this),this.iHash.update(t),this}digestInto(t){b.exists(this),b.bytes(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:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const _=(t,e,r)=>new S(t,e).update(r).digest();_.create=(t,e)=>new S(t,e);class B extends x{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=w(this.buffer)}update(t){b.exists(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=E(t)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=w(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){b.exists(this),b.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=w(t);this.get().forEach(((t,e)=>s.setUint32(4*e,t,i)))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const k=(t,e,r)=>t&e^t&r^e&r,O=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]),U=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),I=new Uint32Array(64);class T extends B{constructor(){super(64,32,8,!1),this.A=0|U[0],this.B=0|U[1],this.C=0|U[2],this.D=0|U[3],this.E=0|U[4],this.F=0|U[5],this.G=0|U[6],this.H=0|U[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)I[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=I[t-15],r=I[t-2],n=v(e,7)^v(e,18)^e>>>3,i=v(r,17)^v(r,19)^r>>>10;I[t]=i+I[t-7]+n+I[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(v(s,6)^v(s,11)^v(s,25))+((f=s)&a^~f&u)+O[t]+I[t]|0,h=(v(r,2)^v(r,13)^v(r,22))+k(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+h|0}var f;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){I.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const j=A((()=>new T));var L=i(314),F=i.t(L,2);const C=BigInt(0),P=BigInt(1),R=BigInt(2),N=BigInt(3),$=BigInt(8),D=R**BigInt(256),H={a:C,b:BigInt(7),P:D-R**BigInt(32)-BigInt(977),n:D-BigInt("432420386565659656852420866394968145599"),h:P,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function z(t){const{a:e,b:r}=H,n=ut(t*t),i=ut(n*t);return ut(i+e*t+r)}const M=H.a===C;class q{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof G))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new q(t.x,t.y,P)}static toAffineBatch(t){const e=function(t,e=H.P){const r=new Array(t.length),n=ft(t.reduce(((t,n,i)=>n===C?t:(r[i]=t,ut(t*n,e))),P),e);return t.reduceRight(((t,n,i)=>n===C?t:(r[i]=ut(t*r[i],e),ut(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return q.toAffineBatch(t).map(q.fromAffine)}equals(t){if(!(t instanceof q))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=ut(n**R),u=ut(s**R),c=ut(e*u),f=ut(i*a),h=ut(ut(r*s)*u),l=ut(ut(o*n)*a);return c===f&&h===l}negate(){return new q(this.x,ut(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=ut(t**R),i=ut(e**R),o=ut(i**R),s=ut(R*(ut((t+i)**R)-n-o)),a=ut(N*n),u=ut(a**R),c=ut(u-R*s),f=ut(a*(s-c)-$*o),h=ut(R*e*r);return new q(c,f,h)}add(t){if(!(t instanceof q))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t;if(i===C||o===C)return this;if(e===C||r===C)return t;const a=ut(n**R),u=ut(s**R),c=ut(e*u),f=ut(i*a),h=ut(ut(r*s)*u),l=ut(ut(o*n)*a),p=ut(f-c),d=ut(l-h);if(p===C)return d===C?this.double():q.ZERO;const y=ut(p**R),g=ut(p*y),m=ut(c*y),b=ut(d**R-g-R*m),w=ut(d*(m-b)-h*g),v=ut(n*s*p);return new q(b,w,v)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=q.ZERO;if("bigint"==typeof t&&t===C)return e;let r=at(t);if(r===P)return this;if(!M){let t=e,n=this;for(;r>C;)r&P&&(t=t.add(n)),n=n.double(),r>>=P;return t}let{k1neg:n,k1:i,k2neg:o,k2:s}=pt(r),a=e,u=e,c=this;for(;i>C||s>C;)i&P&&(a=a.add(c)),s&P&&(u=u.add(c)),c=c.double(),i>>=P,s>>=P;return n&&(a=a.negate()),o&&(u=u.negate()),u=new q(ut(u.x*H.beta),u.y,u.z),a.add(u)}precomputeWindow(t){const e=M?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(q.BASE)&&(e=G.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&V.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=q.normalizeZ(n),V.set(e,n)));let i=q.ZERO,o=q.ZERO;const s=1+(M?128/r:256/r),a=2**(r-1),u=BigInt(2**r-1),c=2**r,f=BigInt(r);for(let e=0;e<s;e++){const r=e*a;let s=Number(t&u);if(t>>=f,s>a&&(s-=c,t+=P),0===s){let t=n[r];e%2&&(t=t.negate()),o=o.add(t)}else{let t=n[r+Math.abs(s)-1];s<0&&(t=t.negate()),i=i.add(t)}}return{p:i,f:o}}multiply(t,e){let r,n,i=at(t);if(M){const{k1neg:t,k1:o,k2neg:s,k2:a}=pt(i);let{p:u,f:c}=this.wNAF(o,e),{p:f,f:h}=this.wNAF(a,e);t&&(u=u.negate()),s&&(f=f.negate()),f=new q(ut(f.x*H.beta),f.y,f.z),r=u.add(f),n=c.add(h)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return q.normalizeZ([r,n])[0]}toAffine(t=ft(this.z)){const{x:e,y:r,z:n}=this,i=t,o=ut(i*i),s=ut(o*i),a=ut(e*o),u=ut(r*s);if(ut(n*i)!==P)throw new Error("invZ was invalid");return new G(a,u)}}q.BASE=new q(H.Gx,H.Gy,P),q.ZERO=new q(C,P,C);const V=new WeakMap;class G{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,V.delete(this)}static fromCompressedHex(t){const e=32===t.length,r=ot(e?t:t.subarray(1));if(!mt(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=H,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=ct(c,N)*c%e,h=ct(f,N)*c%e,l=ct(h,R)*u%e,p=ct(l,n)*l%e,d=ct(p,i)*p%e,y=ct(d,s)*d%e,g=ct(y,a)*y%e,m=ct(g,s)*d%e,b=ct(m,N)*c%e,w=ct(b,o)*p%e,v=ct(w,r)*u%e;return ct(v,R)}(z(r));const i=(n&P)===P;e?i&&(n=ut(-n)):1==(1&t[0])!==i&&(n=ut(-n));const o=new G(r,n);return o.assertValidity(),o}static fromUncompressedHex(t){const e=ot(t.subarray(1,33)),r=ot(t.subarray(33,65)),n=new G(e,r);return n.assertValidity(),n}static fromHex(t){const e=st(t),r=e.length,n=e[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(e);if(65===r&&4===n)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(t){return G.BASE.multiply(wt(t))}static fromSignature(t,e,r){const n=dt(t=st(t)),{r:i,s:o}=vt(e);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&r?"03":"02",a=G.fromHex(s+tt(i)),{n:u}=H,c=ft(i,u),f=ut(-n*c,u),h=ut(o*c,u),l=G.BASE.multiplyAndAddUnsafe(a,f,h);if(!l)throw new Error("Cannot recover signature: point at infinify");return l.assertValidity(),l}toRawBytes(t=!1){return it(this.toHex(t))}toHex(t=!1){const e=tt(this.x);return t?`${this.y&P?"03":"02"}${e}`:`04${e}${tt(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!mt(e)||!mt(r))throw new Error(t);const n=ut(r*r);if(ut(n-z(e))!==C)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new G(this.x,ut(-this.y))}double(){return q.fromAffine(this).double().toAffine()}add(t){return q.fromAffine(this).add(q.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return q.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=q.fromAffine(this),i=e===C||e===P||this!==G.BASE?n.multiplyUnsafe(e):n.multiply(e),o=q.fromAffine(t).multiplyUnsafe(r),s=i.add(o);return s.equals(q.ZERO)?void 0:s.toAffine()}}function K(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function J(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${Q(t)}`);const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:ot(r),left:t.subarray(e+2)}}G.BASE=new G(H.Gx,H.Gy),G.ZERO=new G(C,C);class W{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=X(t),r="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=e?Q(t):t;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new W(nt(n.slice(0,64)),nt(n.slice(64,128)))}static fromDER(t){const e=X(t);if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${Q(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=J(t.subarray(2)),{data:n,left:i}=J(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${Q(i)}`);return{r:e,s:n}}(e?t:it(t));return new W(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!gt(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!gt(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=H.n>>P;return this.s>t}normalizeS(){return this.hasHighS()?new W(this.r,H.n-this.s):this}toDERRawBytes(t=!1){return it(this.toDERHex(t))}toDERHex(t=!1){const e=K(rt(this.s));if(t)return e;const r=K(rt(this.r)),n=rt(r.length/2),i=rt(e.length/2);return`30${rt(r.length/2+e.length/2+4)}02${n}${r}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return it(this.toCompactHex())}toCompactHex(){return tt(this.r)+tt(this.s)}}function Z(...t){if(!t.every(X))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}function X(t){return t instanceof Uint8Array}const Y=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Q(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r<t.length;r++)e+=Y[t[r]];return e}function tt(t){if(t>D)throw new Error("Expected number < 2^256");return t.toString(16).padStart(64,"0")}function et(t){return it(tt(t))}function rt(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function nt(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function it(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function ot(t){return nt(Q(t))}function st(t){return t instanceof Uint8Array?Uint8Array.from(t):it(t)}function at(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&>(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function ut(t,e=H.P){const r=t%e;return r>=C?r:e+r}function ct(t,e){const{P:r}=H;let n=t;for(;e-- >C;)n*=n,n%=r;return n}function ft(t,e=H.P){if(t===C||e<=C)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=C,o=P,s=P,a=C;for(;r!==C;){const t=n/r,e=n%r,u=i-s*t,c=o-a*t;n=r,r=e,i=s,o=a,s=u,a=c}if(n!==P)throw new Error("invert: does not exist");return ut(i,e)}const ht=(t,e)=>(t+e/R)/e,lt=R**BigInt(128);function pt(t){const{n:e}=H,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-P*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=ht(o*t,e),a=ht(-n*t,e);let u=ut(t-s*r-a*i,e),c=ut(-s*n-a*o,e);const f=u>lt,h=c>lt;if(f&&(u=e-u),h&&(c=e-c),u>lt||c>lt)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:h,k2:c}}function dt(t){const{n:e}=H,r=8*t.length-256;let n=ot(t);return r>0&&(n>>=BigInt(r)),n>=e&&(n-=e),n}class yt{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...t){return Ot.hmacSha256(this.k,...t)}hmacSync(...t){if("function"!=typeof Ot.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const e=Ot.hmacSha256Sync(this.k,...t);if(e instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return e}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function gt(t){return C<t&&t<H.n}function mt(t){return C<t&&t<H.P}function bt(t,e,r){const n=ot(t);if(!gt(n))return;const{n:i}=H,o=G.BASE.multiply(n),s=ut(o.x,i);if(s===C)return;const a=ut(ft(n,i)*ut(e+r*s,i),i);if(a===C)return;const u=new W(s,a);return{sig:u,recovery:(o.x===u.r?0:2)|Number(o.y&P)}}function wt(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=nt(t)}else{if(!X(t))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=ot(t)}if(!gt(e))throw new Error("Expected private key: 0 < key < n");return e}function vt(t){if(t instanceof W)return t.assertValidity(),t;try{return W.fromDER(t)}catch(e){return W.fromCompact(t)}}function Et(t){return ot(t.length>32?t.slice(0,32):t)}function xt(t){const e=Et(t),r=ut(e,H.n);return At(r<C?e:r)}function At(t){if("bigint"!=typeof t)throw new Error("Expected bigint");return it(tt(t))}function St(t,e,r={}){const{seed:n,m:i,d:o}=function(t,e,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const n=st(t),i=wt(e),o=[At(i),xt(n)];if(null!=r){!0===r&&(r=Ot.randomBytes(32));const t=st(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(t)}return{seed:Z(...o),m:Et(n),d:i}}(t,e,r.extraEntropy);let s;const a=new yt;for(a.reseedSync(n);!(s=bt(a.generateSync(),i,o));)a.reseedSync();return function(t,e){let{sig:r,recovery:n}=t;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},e);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=o?r.toDERRawBytes():r.toCompactRawBytes();return s?[a,n]:a}(s,r)}const _t={strict:!0};G.BASE._setWindowSize(8);const Bt={node:F,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},kt={},Ot={isValidPrivateKey(t){try{return wt(t),!0}catch(t){return!1}},privateAdd:(t,e)=>et(ut(wt(t)+wt(e),H.n)),privateNegate:t=>{const e=wt(t);return et(H.n-e)},pointAddScalar:(t,e,r)=>{const n=G.fromHex(t),i=wt(e),o=G.BASE.multiplyAndAddUnsafe(n,i,P);if(!o)throw new Error("Tweaked point at infinity");return o.toRawBytes(r)},pointMultiply:(t,e,r)=>{const n=G.fromHex(t),i=ot(st(e));return n.multiply(i).toRawBytes(r)},hashToPrivateKey:t=>{if((t=st(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return et(ut(ot(t),H.n-P)+P)},randomBytes:(t=32)=>{if(Bt.web)return Bt.web.getRandomValues(new Uint8Array(t));if(Bt.node){const{randomBytes:e}=Bt.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Ot.hashToPrivateKey(Ot.randomBytes(40)),bytesToHex:Q,hexToBytes:it,concatBytes:Z,mod:ut,invert:ft,sha256:async(...t)=>{if(Bt.web){const e=await Bt.web.subtle.digest("SHA-256",Z(...t));return new Uint8Array(e)}if(Bt.node){const{createHash:e}=Bt.node,r=e("sha256");return t.forEach((t=>r.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(Bt.web){const r=await Bt.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=Z(...e),i=await Bt.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(Bt.node){const{createHmac:r}=Bt.node,n=r("sha256",t);return e.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...e)=>{let r=kt[t];if(void 0===r){const e=await Ot.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=Z(e,e),kt[t]=r}return Ot.sha256(r,...e)},taggedHashSync:(t,...e)=>{if("function"!=typeof Ot.sha256Sync)throw new Error("utils.sha256Sync is undefined, you need to set it");let r=kt[t];if(void 0===r){const e=Ot.sha256Sync(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=Z(e,e),kt[t]=r}return Ot.sha256Sync(r,...e)},precompute(t=8,e=G.BASE){const r=e===G.BASE?e:new G(e.x,e.y);return r._setWindowSize(t),r.multiply(N),r}};var Ut,It,Tt,jt,Lt,Ft,Ct,Pt,Rt,Nt,$t,Dt,Ht,zt,Mt,qt,Vt,Gt,Kt,Jt,Wt=i(870);(It=Ut||(Ut={}))[It.Testnet=2147483648]="Testnet",It[It.Mainnet=1]="Mainnet",Ut.Mainnet,(Pt=Tt||(Tt={}))[Pt.Address=0]="Address",Pt[Pt.Principal=1]="Principal",Pt[Pt.LengthPrefixedString=2]="LengthPrefixedString",Pt[Pt.MemoString=3]="MemoString",Pt[Pt.AssetInfo=4]="AssetInfo",Pt[Pt.PostCondition=5]="PostCondition",Pt[Pt.PublicKey=6]="PublicKey",Pt[Pt.LengthPrefixedList=7]="LengthPrefixedList",Pt[Pt.Payload=8]="Payload",Pt[Pt.MessageSignature=9]="MessageSignature",Pt[Pt.StructuredDataSignature=10]="StructuredDataSignature",Pt[Pt.TransactionAuthField=11]="TransactionAuthField",function(t){t[t.TokenTransfer=0]="TokenTransfer",t[t.SmartContract=1]="SmartContract",t[t.ContractCall=2]="ContractCall",t[t.PoisonMicroblock=3]="PoisonMicroblock",t[t.Coinbase=4]="Coinbase"}(jt||(jt={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(Lt||(Lt={})),(Ct=Ft||(Ft={}))[Ct.Mainnet=0]="Mainnet",Ct[Ct.Testnet=128]="Testnet",Ft.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Rt||(Rt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(Nt||(Nt={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}($t||($t={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH"}(Dt||(Dt={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(Ht||(Ht={})),(Jt=zt||(zt={}))[Jt.Compressed=0]="Compressed",Jt[Jt.Uncompressed=1]="Uncompressed",function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(Mt||(Mt={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(qt||(qt={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(Vt||(Vt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(Gt||(Gt={})),function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.ServerFailureDatabase="ServerFailureDatabase",t.ServerFailureOther="ServerFailureOther"}(Kt||(Kt={}));const Zt=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Xt=Uint8Array.from({length:16},((t,e)=>e)),Yt=Xt.map((t=>(9*t+5)%16));let Qt=[Xt],te=[Yt];for(let t=0;t<4;t++)for(let e of[Qt,te])e.push(e[t].map((t=>Zt[t])));const ee=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((t=>new Uint8Array(t))),re=Qt.map(((t,e)=>t.map((t=>ee[e][t])))),ne=te.map(((t,e)=>t.map((t=>ee[e][t])))),ie=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),oe=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),se=(t,e)=>t<<e|t>>>32-e;function ae(t,e,r,n){return 0===t?e^r^n:1===t?e&r|~e&n:2===t?(e|~r)^n:3===t?e&n|r&~n:e^(r|~n)}const ue=new Uint32Array(16);class ce extends B{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:e,h2:r,h3:n,h4:i}=this;return[t,e,r,n,i]}set(t,e,r,n,i){this.h0=0|t,this.h1=0|e,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(t,e){for(let r=0;r<16;r++,e+=4)ue[r]=t.getUint32(e,!0);let r=0|this.h0,n=r,i=0|this.h1,o=i,s=0|this.h2,a=s,u=0|this.h3,c=u,f=0|this.h4,h=f;for(let t=0;t<5;t++){const e=4-t,l=ie[t],p=oe[t],d=Qt[t],y=te[t],g=re[t],m=ne[t];for(let e=0;e<16;e++){const n=se(r+ae(t,i,s,u)+ue[d[e]]+l,g[e])+f|0;r=f,f=u,u=0|se(s,10),s=i,i=n}for(let t=0;t<16;t++){const r=se(n+ae(e,o,a,c)+ue[y[t]]+p,m[t])+h|0;n=h,h=c,c=0|se(a,10),a=o,o=r}}this.set(this.h1+s+c|0,this.h2+u+h|0,this.h3+f+n|0,this.h4+r+o|0,this.h0+i+a|0)}roundClean(){ue.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const fe=A((()=>new ce)),he=BigInt(2**32-1),le=BigInt(32);function pe(t,e=!1){return e?{h:Number(t&he),l:Number(t>>le&he)}:{h:0|Number(t>>le&he),l:0|Number(t&he)}}const de=function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=pe(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},ye=(t,e,r)=>t>>>r,ge=(t,e,r)=>t<<32-r|e>>>r,me=(t,e,r)=>t>>>r|e<<32-r,be=(t,e,r)=>t<<32-r|e>>>r,we=(t,e,r)=>t<<64-r|e>>>r-32,ve=(t,e,r)=>t>>>r-32|e<<64-r,Ee=function(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},xe=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Ae=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Se=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),_e=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Be=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,ke=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),[Oe,Ue]=de(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))),Ie=new Uint32Array(80),Te=new Uint32Array(80);class je extends B{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:f,Fl:h,Gh:l,Gl:p,Hh:d,Hl:y}=this;return[t,e,r,n,i,o,s,a,u,c,f,h,l,p,d,y]}set(t,e,r,n,i,o,s,a,u,c,f,h,l,p,d,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|h,this.Gh=0|l,this.Gl=0|p,this.Hh=0|d,this.Hl=0|y}process(t,e){for(let r=0;r<16;r++,e+=4)Ie[r]=t.getUint32(e),Te[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Ie[t-15],r=0|Te[t-15],n=me(e,r,1)^me(e,r,8)^ye(e,r,7),i=be(e,r,1)^be(e,r,8)^ge(e,r,7),o=0|Ie[t-2],s=0|Te[t-2],a=me(o,s,19)^we(o,s,61)^ye(o,s,6),u=be(o,s,19)^ve(o,s,61)^ge(o,s,6),c=Se(i,u,Te[t-7],Te[t-16]),f=_e(c,n,a,Ie[t-7],Ie[t-16]);Ie[t]=0|f,Te[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:f,El:h,Fh:l,Fl:p,Gh:d,Gl:y,Hh:g,Hl:m}=this;for(let t=0;t<80;t++){const e=me(f,h,14)^me(f,h,18)^we(f,h,41),b=be(f,h,14)^be(f,h,18)^ve(f,h,41),w=f&l^~f&d,v=ke(m,b,h&p^~h&y,Ue[t],Te[t]),E=Be(v,g,e,w,Oe[t],Ie[t]),x=0|v,A=me(r,n,28)^we(r,n,34)^we(r,n,39),S=be(r,n,28)^ve(r,n,34)^ve(r,n,39),_=r&i^r&s^i&s,B=n&o^n&a^o&a;g=0|d,m=0|y,d=0|l,y=0|p,l=0|f,p=0|h,({h:f,l:h}=Ee(0|u,0|c,0|E,0|x)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const k=xe(x,S,B);r=Ae(k,E,A,_),n=0|k}({h:r,l:n}=Ee(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=Ee(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=Ee(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=Ee(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l:h}=Ee(0|this.Eh,0|this.El,0|f,0|h)),({h:l,l:p}=Ee(0|this.Fh,0|this.Fl,0|l,0|p)),({h:d,l:y}=Ee(0|this.Gh,0|this.Gl,0|d,0|y)),({h:g,l:m}=Ee(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(r,n,i,o,s,a,u,c,f,h,l,p,d,y,g,m)}roundClean(){Ie.fill(0),Te.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Le extends je{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class Fe extends je{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}A((()=>new je)),A((()=>new Le)),A((()=>new Fe)),i(907);function Ce(t,e=Ft.Mainnet){t="string"==typeof t?t:t.toString("hex");var r,n,i,o;return o=(r=function(t,e){switch(t){case Dt.SerializeP2PKH:switch(e){case Ft.Mainnet:return Ht.MainnetSingleSig;case Ft.Testnet:return Ht.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case Dt.SerializeP2SH:case Dt.SerializeP2WPKH:case Dt.SerializeP2WSH:switch(e){case Ft.Mainnet:return Ht.MainnetMultiSig;case Ft.Testnet:return Ht.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}(Dt.SerializeP2PKH,e),i=f.from(t,"hex"),n=(t=>f.from(fe(j(t))))(i).toString("hex"),{type:Tt.Address,version:r,hash160:n}),(0,Wt.H4)(o.version,o.hash160).toString()}function Pe(t,r=null){let n;n=r?function(t,r){const n=(0,e.decodeToken)(t),i=n.payload;if("string"==typeof i)throw new Error("Unexpected token payload type of string");if(!i.hasOwnProperty("subject")||!i.subject)throw new Error("Token doesn't have a subject");if(!i.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!i.hasOwnProperty("issuer")||!i.issuer)throw new Error("Token doesn't have an issuer");if(!i.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!i.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");const o=i.issuer.publicKey,s=Ce(o);if(r===o);else if(r!==s)throw new Error("Token issuer public key does not match the verifying value");const a=new e.TokenVerifier(n.header.alg,o);if(!a)throw new Error("Invalid token verifier");if(!a.verify(t))throw new Error("Token verification failed");return n}(t,r):(0,e.decodeToken)(t);let i={};if(n.hasOwnProperty("payload")){const t=n.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(i=t.claim)}return i}function Re(t,e){let r;return e.proof&&e.proof.url&&(r=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:r}}Ot.hmacSha256Sync=(t,...e)=>{const r=_.create(j,t);return e.forEach((t=>r.update(t))),r.digest()};var Ne=i(377),$e=i(179);i(616);const De={referrerPolicy:"origin"};async function He(t,e){const r={};return Object.assign(r,e,De),await fetch(t,r)}function ze(...t){const{fetchLib:e,middlewares:r}=function(t){let e=He,r=[];return t.length>0&&"function"==typeof t[0]&&(e=t.shift()),t.length>0&&(r=t),{fetchLib:e,middlewares:r}}(t);return async(t,n)=>{var i;let o={url:t,init:null!=n?n:{}};for(const t of r)if("function"==typeof t.pre){const r=await Promise.resolve(t.pre(Object.assign({fetch:e},o)));o=null!=r?r:o}let s=await e(o.url,o.init);for(const t of r)if("function"==typeof t.post){const r=await Promise.resolve(t.post({fetch:e,url:o.url,init:o.init,response:null!==(i=null==s?void 0:s.clone())&&void 0!==i?i:s}));s=null!=r?r:s}return s}}const Me={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class qe{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,r,n,i,o="ES256K",s=new Date,a=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==o)throw new Error("Signing algorithm not supported");const u=e.SECP256K1Client.derivePublicKey(r);n||(n={publicKey:u}),i||(i={publicKey:u});const c=new e.TokenSigner(o,r),f={jti:l(),iat:s.toISOString(),exp:a.toISOString(),subject:n,issuer:i,claim:t};return c.sign(f)}(this.toJSON(),t)}static validateSchema(t,e=!1){return Me.strict=e,$e.validate(Me,t)}static fromToken(t,e=null){const r=Pe(t,e);return new qe(r)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const r=e.split("://")[0],n=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:`${r}://${n[0]}${`/${n.slice(1).join("/")}`}`}]};return(0,Ne.makeZoneFile)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const Ve={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class Ge extends qe{constructor(t={}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return Ve.strict=e,$e.validate(Me,t)}static fromToken(t,e=null){const r=Pe(t,e);return new Ge(r)}static fromLegacyFormat(t){const e=function(t){const e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});const r=[];t.avatar&&t.avatar.url&&r.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&r.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),r.length&&(e.image=r),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);const n=[];t.bitcoin&&t.bitcoin.address&&n.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&n.push(Re("twitter",t.twitter)),t.facebook&&t.facebook.username&&n.push(Re("facebook",t.facebook)),t.github&&t.github.username&&n.push(Re("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&n.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&n.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=n}return e}(t);return new Ge(e)}toJSON(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=` ${t.familyName}`)),e}(this.profile())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map((t=>"avatar"===t.name?(e=t.contentUrl,e):null)),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const r=[];return t.hasOwnProperty("account")&&e&&t.account.map((t=>{let n=!1,i=null;return e.map((e=>(e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(n=!0,i=e.proofUrl,0))))),n?(t.proofUrl=i,r.push(t),t):null})),r}(this.profile(),t)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const r=[];t.address.hasOwnProperty("streetAddress")&&r.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&r.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&r.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&r.push(t.address.addressCountry),r.length&&(e=r.join(", "))}return e}(this.profile())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let r=null;if(t.hasOwnProperty("birthDate")){const n=new Date(t.birthDate);r=`${e[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`}return r}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}var Ke,Je;!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(Ke||(Ke={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(Je||(Je={}));const We=["mainnet","testnet"];class Ze{constructor(t){var e;this.version=Je.Mainnet,this.chainId=Ke.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.transactionFeeEstimateEndpoint="/v2/fees/transaction",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=()=>this.version===Je.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getTransactionFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,this.getAbiApiUrl=(t,e)=>`${this.coreApiUrl}${this.contractAbiEndpoint}/${t}/${e}`,this.getReadOnlyFunctionCallApiUrl=(t,e,r)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}/${t}/${e}/${encodeURIComponent(r)}`,this.getInfoUrl=()=>`${this.coreApiUrl}/v2/info`,this.getBlockTimeInfoUrl=()=>`${this.coreApiUrl}/extended/v1/info/network_block_times`,this.getPoxInfoUrl=()=>`${this.coreApiUrl}/v2/pox`,this.getRewardsUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getRewardsTotalUrl=t=>`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}/total`,this.getRewardHoldersUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/reward_slot_holders/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getStackerInfoUrl=(t,e)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}\n ${t}/${e}/get-stacker-info`,this.coreApiUrl=t.url,this.fetchFn=null!==(e=t.fetchFn)&&void 0!==e?e:ze()}getNameInfo(t){const e=`${this.bnsLookupUrl}/v1/names/${t}`;return this.fetchFn(e).then((t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()})).then((t=>t.address?Object.assign({},t,{address:t.address}):t))}}Ze.fromName=t=>{switch(t){case"mainnet":return new Xe;case"testnet":return new Ye;default:throw new Error(`Invalid network name provided. Must be one of the following: ${We.join(", ")}`)}},Ze.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:Ze.fromName(t);class Xe extends Ze{constructor(t){var e;super({url:null!==(e=null==t?void 0:t.url)&&void 0!==e?e:"https://stacks-node-api.mainnet.stacks.co",fetchFn:null==t?void 0:t.fetchFn}),this.version=Je.Mainnet,this.chainId=Ke.Mainnet}}class Ye extends Ze{constructor(t){var e;super({url:null!==(e=null==t?void 0:t.url)&&void 0!==e?e:"https://stacks-node-api.testnet.stacks.co",fetchFn:null==t?void 0:t.fetchFn}),this.version=Je.Testnet,this.chainId=Ke.Testnet}}const Qe={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(Qe);class tr extends Error{constructor(t){super();let e=t.message,r=`Error Code: ${t.code}`,n=this.stack;if(n)r+=`Stack Trace:\n${n}`;else try{throw new Error}catch(t){n=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${r}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class er extends tr{constructor(t){const e=`Failed to verify signature: ${t}`;super({code:Qe.SIGNATURE_VERIFICATION_ERROR,message:e}),this.message=e,this.name="SignatureVerificationError"}}class rr extends tr{constructor(t){super({code:Qe.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class nr extends tr{constructor(t,e){super(t),e&&(this.hubError={statusCode:e.status,statusText:e.statusText},"string"==typeof e.body?this.hubError.message=e.body:"object"==typeof e.body&&Object.assign(this.hubError,e.body))}}class ir extends nr{constructor(t,e){super({message:t,code:Qe.DOES_NOT_EXIST},e),this.name="DoesNotExist"}}class or extends nr{constructor(t,e){super({message:t,code:Qe.CONFLICT_ERROR},e),this.name="ConflictError"}}class sr extends nr{constructor(t,e){super({message:t,code:Qe.NOT_ENOUGH_PROOF_ERROR},e),this.name="NotEnoughProofError"}}class ar extends nr{constructor(t,e){super({message:t,code:Qe.BAD_PATH_ERROR},e),this.name="BadPathError"}}class ur extends nr{constructor(t,e){super({message:t,code:Qe.VALIDATION_ERROR},e),this.name="ValidationError"}}class cr extends nr{constructor(t,e,r){super({message:t,code:Qe.PAYLOAD_TOO_LARGE_ERROR},e),this.name="PayloadTooLargeError",this.maxUploadByteSize=r}}class fr extends nr{constructor(t,e){super({message:t,code:Qe.PRECONDITION_FAILED_ERROR},e),this.name="PreconditionFailedError"}}function hr(t){const e=f.isBuffer(t)?t:f.from(t,"hex");if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}var lr=i(22),pr=i.n(lr);const dr=new Array(16),yr=Tr([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),gr=Tr([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),mr=Tr([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),br=Tr([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),wr=Ir([0,1518500249,1859775393,2400959708,2840853838]),vr=Ir([1352829926,1548603684,1836072691,2053994217,0]);function Er(t,e){return t<<e|t>>>32-e}function xr(t,e,r,n,i,o,s,a){return Er(t+(e^r^n)+o+s|0,a)+i|0}function Ar(t,e,r,n,i,o,s,a){return Er(t+(e&r|~e&n)+o+s|0,a)+i|0}function Sr(t,e,r,n,i,o,s,a){return Er(t+((e|~r)^n)+o+s|0,a)+i|0}function _r(t,e,r,n,i,o,s,a){return Er(t+(e&n|r&~n)+o+s|0,a)+i|0}function Br(t,e,r,n,i,o,s,a){return Er(t+(e^(r|~n))+o+s|0,a)+i|0}function kr(t,e){return t[e>>>=0]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function Or(t,e,r){return e=+e,t[3+(r>>>=0)]=e>>>24,t[r+2]=e>>>16,t[r+1]=e>>>8,t[r]=255&e,r+4}function Ur(t,e,r){return e=+e,t[r>>>=0]=255&e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,r+4}function Ir(t){return"undefined"!=typeof Uint32Array?new Uint32Array(t):t}function Tr(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):t}function jr(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):new Array(t)}class Lr{digest(t){const e=new class{constructor(){this._block=jr(64),this._blockSize=64,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1,this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}update(t){if(this._finalized)throw new Error("Digest already called");const e=this._block;let r=0;for(;this._blockOffset+t.length-r>=this._blockSize;){for(let n=this._blockOffset;n<this._blockSize;)e[n++]=t[r++];this._update(),this._blockOffset=0}for(;r<t.length;)e[this._blockOffset++]=t[r++];for(let e=0,r=8*t.length;r>0;++e)this._length[e]+=r,r=this._length[e]/4294967296|0,r>0&&(this._length[e]-=4294967296*r);return this}_update(){const t=dr;for(let e=0;e<16;++e)t[e]=kr(this._block,4*e);let e=0|this._a,r=0|this._b,n=0|this._c,i=0|this._d,o=0|this._e,s=0|this._a,a=0|this._b,u=0|this._c,c=0|this._d,f=0|this._e;for(let h=0;h<80;h+=1){let l,p;h<16?(l=xr(e,r,n,i,o,t[yr[h]],wr[0],mr[h]),p=Br(s,a,u,c,f,t[gr[h]],vr[0],br[h])):h<32?(l=Ar(e,r,n,i,o,t[yr[h]],wr[1],mr[h]),p=_r(s,a,u,c,f,t[gr[h]],vr[1],br[h])):h<48?(l=Sr(e,r,n,i,o,t[yr[h]],wr[2],mr[h]),p=Sr(s,a,u,c,f,t[gr[h]],vr[2],br[h])):h<64?(l=_r(e,r,n,i,o,t[yr[h]],wr[3],mr[h]),p=Ar(s,a,u,c,f,t[gr[h]],vr[3],br[h])):(l=Br(e,r,n,i,o,t[yr[h]],wr[4],mr[h]),p=xr(s,a,u,c,f,t[gr[h]],vr[4],br[h])),e=o,o=i,i=Er(n,10),n=r,r=l,s=f,f=c,c=Er(u,10),u=a,a=p}const h=this._b+n+c|0;this._b=this._c+i+f|0,this._c=this._d+o+s|0,this._d=this._e+e+a|0,this._e=this._a+r+u|0,this._a=h}digest(){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),Or(this._block,this._length[0],56),Or(this._block,this._length[1],60),this._update();const t=jr(20);Ur(t,this._a,0),Ur(t,this._b,4),Ur(t,this._c,8),Ur(t,this._d,12),Ur(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let t=0;t<4;++t)this._length[t]=0;return t}};e.update(t);const r=e.digest();return Array.isArray(r)?f.from(r):f.from(r.buffer)}}function Fr(t){return f.from(j(t))}function Cr(t){return e=0,n=Fr(f.isBuffer(t)?t:f.from(t,"hex")),r=(new Lr).digest(n),function(t){const e=f.from(j(j(t)));return pr().encode(f.concat([t,e],t.length+4))}(f.from([e,...r].slice(0,21)));var e,r,n}function Pr(t){const e=hr(t);return f.from(function(t,e=!1){return G.fromPrivateKey(t).toRawBytes(e)}(e.slice(0,32),!0)).toString("hex")}var Rr;function Nr(t,e,r){const n=function(t){return t instanceof f?t:(ArrayBuffer,f.from(t))}(t);return function(t,e,r,n=_t){let i;try{i=vt(t),e=st(e)}catch(t){return!1}const{r:o,s}=i;if(n.strict&&i.hasHighS())return!1;const a=dt(e);let u;try{u=function(t){return t instanceof G?(t.assertValidity(),t):G.fromHex(t)}(r)}catch(t){return!1}const{n:c}=H,f=ft(s,c),h=ut(a*f,c),l=ut(o*f,c),p=G.BASE.multiplyAndAddUnsafe(u,h,l);return!!p&&ut(p.x,c)===o}(r,Fr(n),e,{strict:!1})}Ot.hmacSha256Sync=(t,...e)=>{const r=_.create(j,t);return e.forEach((t=>r.update(t))),r.digest()},Ot.hmacSha256Sync=(t,...e)=>{const r=_.create(j,t);return e.forEach((t=>r.update(t))),r.digest()},function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(Rr||(Rr={}));const $r=class{constructor(t,e){this.wasString="string"==typeof t,this.content=$r.normalizeContentDataType(t,e),this.contentType=e||this.detectContentType(),this.contentByteLength=this.detectContentLength()}static normalizeContentDataType(t,e){try{if("string"==typeof t){const r=(e||"").toLowerCase().replace("-","");if(r.includes("charset")&&!r.includes("charset=utf8")&&!r.includes("charset=ascii"))throw new Error(`Unable to determine byte length with charset: ${e}`);if("undefined"!=typeof TextEncoder){const e=(new TextEncoder).encode(t);return f.from(e.buffer)}return f.from(t)}if(f.isBuffer(t))return t;if(ArrayBuffer.isView(t))return f.from(t.buffer,t.byteOffset,t.byteLength);if("undefined"!=typeof Blob&&t instanceof Blob)return t;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return f.from(t);if(Array.isArray(t)){if(t.length>0&&(!Number.isInteger(t[0])||t[0]<0||t[0]>255))throw new Error(`Unexpected array values provided as file data: value "${t[0]}" at index 0 is not an octet number. ${this.supportedTypesMsg}`);return f.from(t)}{const e=Object.prototype.toString.call(t);throw new Error(`Unexpected type provided as file data: ${e}. ${this.supportedTypesMsg}`)}}catch(t){throw console.error(t),new Error(`Error processing data: ${t}`)}}detectContentType(){return this.wasString?"text/plain; charset=utf-8":"undefined"!=typeof Blob&&this.content instanceof Blob&&this.content.type?this.content.type:"application/octet-stream"}detectContentLength(){if(ArrayBuffer.isView(this.content)||f.isBuffer(this.content))return this.content.byteLength;if("undefined"!=typeof Blob&&this.content instanceof Blob)return this.content.size;const t=Object.prototype.toString.call(this.content),e=new Error(`Unexpected type "${t}" while detecting content length`);throw console.error(e),e}async loadContent(){try{if(f.isBuffer(this.content))return this.content;if(ArrayBuffer.isView(this.content))return f.from(this.content.buffer,this.content.byteOffset,this.content.byteLength);if("undefined"!=typeof Blob&&this.content instanceof Blob){const t=new FileReader,e=new Promise(((e,r)=>{t.onerror=t=>{r(t)},t.onload=()=>{const r=t.result;e(f.from(r))},t.readAsArrayBuffer(this.content)}));return await e}{const t=Object.prototype.toString.call(this.content);throw new Error(`Unexpected type ${t}`)}}catch(t){console.error(t);const e=new Error(`Error loading content: ${t}`);throw console.error(e),e}}load(){return void 0===this.loadedData&&(this.loadedData=this.loadContent()),this.loadedData}};let Dr=$r;Dr.supportedTypesMsg="Supported types are: `string` (to be UTF8 encoded), `Buffer`, `Blob`, `File`, `ArrayBuffer`, `UInt8Array` or any other typed array buffer. ";const Hr="blockstack-gaia-hub-config";async function zr(t,e,r,n="application/octet-stream",i=!0,o,s,u=ze()){a.debug(`uploadToGaiaHub: uploading ${t} to ${r.server}`);const c={"Content-Type":n,Authorization:`bearer ${r.token}`};s||(i?c["If-None-Match"]="*":o&&(c["If-Match"]=o));const f=await u(`${r.server}/store/${r.address}/${t}`,{method:"POST",headers:c,body:e});if(!f.ok)throw await Jr(f,"Error when uploading to Gaia hub.",r);const h=await f.text();return JSON.parse(h)}async function Mr(t,e,r=ze()){a.debug(`deleteFromGaiaHub: deleting ${t} from ${e.server}`);const n=await r(`${e.server}/delete/${e.address}/${t}`,{method:"DELETE",headers:{Authorization:`bearer ${e.token}`}});if(!n.ok)throw await Jr(n,"Error deleting file from Gaia hub.",e)}function qr(t,e){return Promise.resolve(`${e.url_prefix}${e.address}/${t}`)}function Vr(t,r,n,i){const o=t.challenge_text,s=t.latest_auth_version&&parseInt(t.latest_auth_version.slice(1),10)>=1,a=Pr(r);if(!s)return function(t,e){let r;try{r=JSON.parse(t)}catch(t){throw new Error("Failed in parsing legacy challenge text from the gaia hub.")}if("gaiahub"===r[0]&&"blockstack_storage_please_sign"===r[3]){const r=(n=Fr(f.from(t)),i=function(t){const e=hr(t);return 33==e.length?e:f.concat([e,f.from([1])])}(e),f.from(St(n,hr(i).slice(0,32),{der:!1}))),o=W.fromCompact(r.toString("hex")).toDERHex(),s=Pr(e);return f.from(JSON.stringify({publickey:s,signature:o})).toString("base64")}throw new Error("Failed to connect to legacy gaia hub. If you operate this hub, please update.");var n,i}(o,r);const u={gaiaChallenge:o,hubUrl:n,iss:a,salt:(16,f.from(Ot.randomBytes(16))).toString("hex"),associationToken:i};return`v1:${new e.TokenSigner("ES256K",r).sign(u)}`}async function Gr(t,e,r,n=ze()){a.debug(`connectToGaiaHub: ${t}/hub_info`);const i=await n(`${t}/hub_info`),o=await i.json(),s=o.read_url_prefix,u=Vr(o,e,t,r),c=Cr(Pr(e));return{url_prefix:s,max_file_upload_size_megabytes:o.max_file_upload_size_megabytes,address:c,token:u,server:t}}async function Kr(t,e,r=ze()){const n=await r(`${t}/hub_info`),i=await n.text();return`${JSON.parse(i).read_url_prefix}${Cr(Pr(e))}/`}async function Jr(t,e,r){if(t.ok)throw new Error("Cannot get a BlockstackError from a valid response.");const n=await async function(t){let e,r="";try{r=await t.text();try{e=JSON.parse(r)}catch(t){}}catch(t){a.debug(`Error getting bad http response text: ${t}`)}return{status:t.status,statusText:t.statusText,body:e||r}}(t);if(401===n.status)return new ur(e,n);if(402===n.status)return new sr(e,n);if(403===n.status)return new ar(e,n);if(404===n.status)throw new ir(e,n);if(409===n.status)return new or(e,n);if(412===n.status)return new fr(e,n);if(413===n.status){const t=r&&r.max_file_upload_size_megabytes?h(r.max_file_upload_size_megabytes):0;return new cr(e,n,t)}return new Error(e)}class Wr{constructor(t){this.userSession=t.userSession}async getFile(t,e){const r={decrypt:!0,verify:!1,app:p("location",{returnEmptyObject:!0}).origin},n=Object.assign({},r,e);if(n.verify&&!n.decrypt)return this.getFileSignedUnencrypted(t,n);const i=await this.getFileContents(t,n.app,n.username,n.zoneFileLookupURL,!!n.decrypt);if(null===i)return i;if(n.decrypt&&!n.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");if("string"==typeof n.decrypt){const t={privateKey:n.decrypt};return this.userSession.decryptContent(i,t)}return this.userSession.decryptContent(i)}if(n.decrypt&&n.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");let e;return"string"==typeof n.decrypt&&(e=n.decrypt),this.handleSignedEncryptedContents(t,i,n.app,e,n.username,n.zoneFileLookupURL)}if(n.verify||n.decrypt)throw new Error("Should be unreachable.");return i}async getUserAppFileUrl(t,e,r,n){const i=await function(t){if(!t.username)return Promise.reject(new Error("No username provided"));const e={network:new Xe},r=Object.assign(e,t),n=Ze.fromNameOrNetwork(r.network);let i;if(r.zoneFileLookupURL){const t=`${r.zoneFileLookupURL.replace(/\/$/,"")}/${r.username}`;i=n.fetchFn(t).then((t=>t.json()))}else i=n.getNameInfo(r.username);return i.then((t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return function(t,e,r=ze()){return new Promise(((n,i)=>{let o=null;try{o=(0,Ne.parseZoneFile)(t),o.hasOwnProperty("$origin")||(o=null)}catch(t){i(t)}let s=null;if(o&&Object.keys(o).length>0)s=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;const e=t.uri.filter((t=>t.hasOwnProperty("target")&&"_http._tcp"===t.name));if(e.length<1)return null;const r=e[0];if(!r.hasOwnProperty("target"))return null;let n=r.target;return n.startsWith("https")||n.startsWith("http")||(n=`https://${n}`),n}(o);else try{return n(Ge.fromLegacyFormat(JSON.parse(t)).profile())}catch(t){return i(t)}s?r(s).then((t=>t.text())).then((t=>JSON.parse(t))).then((t=>{const r=Pe(t[0].token,e);n(r)})).catch((t=>{a.error(`resolveZoneFileToProfile: error fetching token file ${s}: ${t}`),i(t)})):(a.debug("Token file url not found. Resolving to blank profile."),n({}))}))}(t.zonefile,t.address,n.fetchFn);throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")}))}({username:e,zoneFileLookupURL:n});let o;return i.hasOwnProperty("apps")&&i.apps.hasOwnProperty(r)&&(o=`${i.apps[r].replace(/\/?(\?|#|$)/,"/$1")}${t}`),o}async getGaiaAddress(t,e,r){const n=Xr(this.userSession,{app:t,username:e,zoneFileLookupURL:r});let i;if(e)i=await this.getUserAppFileUrl("/",n.username,n.app,n.zoneFileLookupURL);else{const t=await this.getOrSetLocalGaiaHubConnection();i=await qr("/",t)}const o=i.match(/([13][a-km-zA-HJ-NP-Z0-9]{26,35})/);if(!o)throw new Error("Failed to parse gaia address");return o[o.length-1]}async getFileUrl(t,e){const r=Xr(this.userSession,e);let n;if(r.username)n=await this.getUserAppFileUrl(t,r.username,r.app,r.zoneFileLookupURL);else{const e=await this.getOrSetLocalGaiaHubConnection();n=await qr(t,e)}if(n)return n;throw new Error("Missing readURL")}async getFileContents(t,e,r,n,i,o=ze()){const s={app:e,username:r,zoneFileLookupURL:n},a=await this.getFileUrl(t,s),u=await o(a);if(!u.ok)throw await Jr(u,`getFile ${t} failed.`,null);let c=u.headers.get("Content-Type");"string"==typeof c&&(c=c.toLowerCase());const f=u.headers.get("ETag");if(f){const e=this.userSession.store.getSessionData();e.etags[t]=f,this.userSession.store.setSessionData(e)}return i||null===c||c.startsWith("text")||c.startsWith("application/json")?u.text():u.arrayBuffer()}async getFileSignedUnencrypted(t,e){const r=`${t}.sig`;try{const[n,i,o]=await Promise.all([this.getFileContents(t,e.app,e.username,e.zoneFileLookupURL,!1),this.getFileContents(r,e.app,e.username,e.zoneFileLookupURL,!0),this.getGaiaAddress(e.app,e.username,e.zoneFileLookupURL)]);if(!n)return n;if(!o)throw new er(`Failed to get gaia address for verification of: ${t}`);if(!i||"string"!=typeof i)throw new er(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`);let s,a;try{const t=JSON.parse(i);s=t.signature,a=t.publicKey}catch(e){throw e instanceof SyntaxError?new Error(`Failed to parse signature content JSON (path: ${t}.sig) The content may be corrupted.`):e}const u=Cr(a);if(o!==u)throw new er(`Signer pubkey address (${u}) doesn't match gaia address (${o})`);if(Nr(n,a,s))return n;throw new er(`Contents do not match ECDSA signature: path: ${t}, signature: ${t}.sig`)}catch(e){throw e instanceof ir&&e.message.indexOf(r)>=0?new er(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`):e}}async handleSignedEncryptedContents(t,e,r,n,i,o){const s=Pr(n||this.userSession.loadUserData().appPrivateKey);let a,u;if(a=i?await this.getGaiaAddress(r,i,o):Cr(s),!a)throw new er(`Failed to get gaia address for verification of: ${t}`);try{u=JSON.parse(e)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted, signed content JSON. The content may not be encrypted. If using getFile, try passing { verify: false, decrypt: false }."):t}const c=u.signature,f=u.publicKey,h=u.cipherText,l=Cr(f);if(f&&h&&c){if(l!==a)throw new er(`Signer pubkey address (${l}) doesn't match gaia address (${a})`);if(Nr(h,f,c)){if("string"==typeof n){const t={privateKey:n};return this.userSession.decryptContent(h,t)}return this.userSession.decryptContent(h)}throw new er(`Contents do not match ECDSA signature in file: ${t}`)}throw new er(`Failed to get signature verification data from file: ${t}`)}async putFile(t,e,r){var n,i;const o=Object.assign({},{encrypt:!0,sign:!1,cipherTextEncoding:"hex",dangerouslyIgnoreEtag:!1},r),s=await this.getOrSetLocalGaiaHubConnection(),a=h(s.max_file_upload_size_megabytes),u=a>0,c=new Dr(e,o.contentType);let l,p=c.contentType;if(!o.encrypt&&u&&c.contentByteLength>a){const t=`The max file upload size for this hub is ${a} bytes, the given content is ${c.contentByteLength} bytes`,e=new cr(t,null,a);throw console.error(e),e}if(o.encrypt&&u){const t=function(t){const{payloadShell:e,payloadValuesLength:r}=function(t){const e={iv:"",ephemeralPK:"",mac:"",cipherText:"",wasString:!!t.wasString};return"base64"===t.cipherTextEncoding&&(e.cipherTextEncoding="base64"),{payloadValuesLength:162,payloadShell:JSON.stringify(e)}}(t),n=(i=t.contentLength,16*(Math.floor(i/16)+1));var i;let o;if(t.cipherTextEncoding&&"hex"!==t.cipherTextEncoding){if("base64"!==t.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${t.cipherTextEncoding}"`);o=function(t){return 4*Math.ceil(t/3)}(n)}else o=2*n;if(t.sign){const{signedPayloadShell:t,signedPayloadValuesLength:n}=function(t){const e={signature:"",publicKey:"",cipherText:t};return{signedPayloadValuesLength:210,signedPayloadShell:JSON.stringify(e)}}(e);return t.length+n+r+o}return e.length+r+o}({contentLength:c.contentByteLength,wasString:c.wasString,sign:!!o.sign,cipherTextEncoding:o.cipherTextEncoding});if(t>a){const e=new cr(`The max file upload size for this hub is ${a} bytes, the given content is ${t} bytes after encryption`,null,a);throw console.error(e),e}}let d=!0;const g=this.userSession.store.getSessionData();let m;if(o.dangerouslyIgnoreEtag||(null==(n=g.etags)?void 0:n[t])&&(d=!1,l=null==(i=g.etags)?void 0:i[t]),!o.encrypt&&o.sign){const e=await c.load();let r;r="string"==typeof o.sign?o.sign:this.userSession.loadUserData().appPrivateKey;const n=function(t,e){const r=e instanceof f?e:f.from(e),n=Pr(t);return{signature:y(St(Fr(r),t)),publicKey:n}}(r,e),i=JSON.stringify(n);m=async r=>{const n=(await Promise.all([zr(t,e,r,p,d,l,o.dangerouslyIgnoreEtag),zr(`${t}.sig`,i,r,"application/json")]))[0];return!o.dangerouslyIgnoreEtag&&n.etag&&(g.etags[t]=n.etag,this.userSession.store.setSessionData(g)),n.publicURL}}else{let e;if(o.encrypt||o.sign){let t;t="string"==typeof o.encrypt?o.encrypt:"string"==typeof o.sign?Pr(o.sign):Pr(this.userSession.loadUserData().appPrivateKey);const r=await c.load();e=await this.userSession.encryptContent(r,{publicKey:t,wasString:c.wasString,cipherTextEncoding:o.cipherTextEncoding,sign:o.sign}),p="application/json"}else e=c.content;m=async r=>{const n=await zr(t,e,r,p,d,l,o.dangerouslyIgnoreEtag);return n.etag&&(g.etags[t]=n.etag,this.userSession.store.setSessionData(g)),n.publicURL}}try{return await m(s)}catch(t){if(function(t){if(!t||!t.hubError||!t.hubError.statusCode)return!1;const e=t.hubError.statusCode;return 401===e||(409===e||e>=500&&e<=599)}(t)){console.error(t),console.error("Possible recoverable error during Gaia upload, retrying...");const e=await this.setLocalGaiaHubConnection();return await m(e)}throw t}}async deleteFile(t,e){const r=await this.getOrSetLocalGaiaHubConnection();if(Object.assign({},e).wasSigned)try{await Mr(t,r),await Mr(`${t}.sig`,r);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const n=await this.setLocalGaiaHubConnection();await Mr(t,n),await Mr(`${t}.sig`,r);const i=this.userSession.store.getSessionData();delete i.etags[t],this.userSession.store.setSessionData(i)}else try{await Mr(t,r);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const r=await this.setLocalGaiaHubConnection();await Mr(t,r);const n=this.userSession.store.getSessionData();delete n.etags[t],this.userSession.store.setSessionData(n)}}getAppBucketUrl(t,e){return Kr(t,e)}async listFilesLoop(t,e,r,n,i,o=ze()){if(r>65536)throw new Error("Too many entries to list");let s;t=t||await this.getOrSetLocalGaiaHubConnection();try{const r=JSON.stringify({page:e}),n={method:"POST",headers:{"Content-Type":"application/json","Content-Length":`${r.length}`,Authorization:`bearer ${t.token}`},body:r};if(s=await o(`${t.server}/list-files/${t.address}`,n),!s.ok)throw await Jr(s,"ListFiles failed.",t)}catch(t){if(0===r){const t=await this.setLocalGaiaHubConnection();return this.listFilesLoop(t,e,r+1,0,i)}throw t}const a=await s.text(),u=JSON.parse(a),c=u.entries,f=u.page;if(null==c)throw new Error("Bad listFiles response: no entries");let h=0;for(let t=0;t<c.length;t++)if(null!==c[t]&&(h++,!i(c[t])))return n+t;return f&&c.length>0?this.listFilesLoop(t,f,r+1,n+h,i):n+h}listFiles(t){return this.listFilesLoop(null,null,0,0,t)}async getOrSetLocalGaiaHubConnection(){const t=this.userSession.store.getSessionData().userData;if(!t)throw new rr("Missing userData");const e=t.gaiaHubConfig;return e?Promise.resolve(e):this.setLocalGaiaHubConnection()}async setLocalGaiaHubConnection(){const t=this.userSession.loadUserData();if(!t)throw new rr("Missing userData");t.hubUrl||(t.hubUrl="https://hub.blockstack.org");const e=await Gr(t.hubUrl,t.appPrivateKey,t.gaiaAssociationToken);t.gaiaHubConfig=e;const r=this.userSession.store.getSessionData();return r.userData.gaiaHubConfig=e,this.userSession.store.setSessionData(r),e}}function Zr(t){return new Wr({}).getUserAppFileUrl(t.path,t.username,t.appOrigin,t.zoneFileLookupURL)}function Xr(t,e){var r;const n=Object.assign({},e);if(n.username){if(!n.app){if(!t.appConfig)throw new rr("Missing AppConfig");n.app=t.appConfig.appDomain}if(!n.zoneFileLookupURL){if(!t.appConfig)throw new rr("Missing AppConfig");if(!t.store)throw new rr("Missing store UserSession");const e=(null==(r=t.store.getSessionData().userData)?void 0:r.coreNode)||t.appConfig.coreNode;e&&(n.zoneFileLookupURL=`${e}/v1/names`)}}return n}})(),o})()));
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStorage=e():t.StacksStorage=e()}(this,(()=>(()=>{var t,e,n={525:(t,e)=>{"use strict";function n(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function r(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function i(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(t.outputLen),n(t.blockLen)}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")}function a(t,e){i(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.output=e.exists=e.hash=e.bytes=e.bool=e.number=void 0,e.number=n,e.bool=r,e.bytes=i,e.hash=o,e.exists=s,e.output=a;const c={number:n,bool:r,bytes:i,hash:o,exists:s,output:a};e.default=c},350:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHA2=void 0;const r=n(525),i=n(64);class o extends i.Hash{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=(0,i.createView)(this.buffer)}update(t){r.default.exists(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let r=0;r<s;){const a=Math.min(o-this.pos,s-r);if(a!==o)n.set(t.subarray(r,r+a),this.pos),this.pos+=a,r+=a,this.pos===o&&(this.process(e,0),this.pos=0);else{const e=(0,i.createView)(t);for(;o<=s-r;r+=o)this.process(e,r)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){r.default.exists(this),r.default.output(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:o,isLE:s}=this;let{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let t=a;t<o;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;t.setUint32(e+c,s,r),t.setUint32(e+u,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const c=(0,i.createView)(t);this.get().forEach(((t,e)=>c.setUint32(4*e,t,s)))}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:i,destroyed:o,pos:s}=this;return t.length=r,t.pos=s,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}}e.SHA2=o},661:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},514:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=void 0;const r=n(525),i=n(64);class o extends i.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,r.default.hash(t);const n=(0,i.toBytes)(e);if(this.iHash=t.create(),!(this.iHash instanceof i.Hash))throw new TypeError("Expected instance of class which extends utils.Hash");const o=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const s=new Uint8Array(o);s.set(n.length>this.iHash.blockLen?t.create().update(n).digest():n);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(t){return r.default.exists(this),this.iHash.update(t),this}digestInto(t){r.default.exists(this),r.default.bytes(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:i,blockLen:o,outputLen:s}=this;return t.finished=r,t.destroyed=i,t.blockLen=o,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()}}e.hmac=(t,e,n)=>new o(t,e).update(n).digest(),e.hmac.create=(t,e)=>new o(t,e)},53:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha256=void 0;const r=n(350),i=n(64),o=(t,e,n)=>t&e^t&n^e&n,s=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends r.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)c[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=c[t-15],n=c[t-2],r=(0,i.rotr)(e,7)^(0,i.rotr)(e,18)^e>>>3,o=(0,i.rotr)(n,17)^(0,i.rotr)(n,19)^n>>>10;c[t]=o+c[t-7]+r+c[t-16]|0}let{A:n,B:r,C:a,D:u,E:f,F:l,G:h,H:p}=this;for(let t=0;t<64;t++){const e=p+((0,i.rotr)(f,6)^(0,i.rotr)(f,11)^(0,i.rotr)(f,25))+((d=f)&l^~d&h)+s[t]+c[t]|0,y=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+o(n,r,a)|0;p=h,h=l,l=f,f=u+e|0,u=a,a=r,r=n,n=e+y|0}var d;n=n+this.A|0,r=r+this.B|0,a=a+this.C|0,u=u+this.D|0,f=f+this.E|0,l=l+this.F|0,h=h+this.G|0,p=p+this.H|0,this.set(n,r,a,u,f,l,h,p)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}e.sha256=(0,i.wrapConstructor)((()=>new u))},64:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const r=n(661);if(e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function o(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}function s(t){if("string"==typeof t&&(t=o(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}e.bytesToHex=function(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=i[t[n]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e},e.nextTick=async()=>{},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=o,e.toBytes=s,e.concatBytes=function(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n},e.Hash=class{clone(){return this._cloneInto()}},e.checkOpts=function(t,e){if(void 0!==e&&("object"!=typeof e||(n=e,"[object Object]"!==Object.prototype.toString.call(n)||n.constructor!==Object)))throw new TypeError("Options should be object or undefined");var n;return Object.assign(t,e)},e.wrapConstructor=function(t){const e=e=>t().update(s(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,n)=>t(n).update(s(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(r.crypto.web)return r.crypto.web.getRandomValues(new Uint8Array(t));if(r.crypto.node)return new Uint8Array(r.crypto.node.randomBytes(t).buffer);throw new Error("The environment doesn't have randomBytes function")}},698:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.schnorr=e.verify=e.signSync=e.sign=e.getSharedSecret=e.recoverPublicKey=e.getPublicKey=e.Signature=e.Point=e.CURVE=void 0;const r=n(695),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(8),u=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});function f(t){const{a:e,b:n}=u,r=U(t*t),i=U(r*t);return U(i+e*t+n)}e.CURVE=u;const l=u.a===i;class h extends Error{constructor(t){super(t)}}class p{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof y))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new p(t.x,t.y,o)}static toAffineBatch(t){const e=function(t,e=u.P){const n=new Array(t.length),r=B(t.reduce(((t,r,o)=>r===i?t:(n[o]=t,U(t*r,e))),o),e);return t.reduceRight(((t,r,o)=>r===i?t:(n[o]=U(t*n[o],e),U(t*r,e))),r),n}(t.map((t=>t.z)));return t.map(((t,n)=>t.toAffine(e[n])))}static normalizeZ(t){return p.toAffineBatch(t).map(p.fromAffine)}equals(t){if(!(t instanceof p))throw new TypeError("JacobianPoint expected");const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=U(r*r),c=U(s*s),u=U(e*c),f=U(i*a),l=U(U(n*s)*c),h=U(U(o*r)*a);return u===f&&l===h}negate(){return new p(this.x,U(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this,r=U(t*t),i=U(e*e),o=U(i*i),u=t+i,f=U(s*(U(u*u)-r-o)),l=U(a*r),h=U(l*l),d=U(h-s*f),y=U(l*(f-d)-c*o),g=U(s*e*n);return new p(d,y,g)}add(t){if(!(t instanceof p))throw new TypeError("JacobianPoint expected");const{x:e,y:n,z:r}=this,{x:o,y:a,z:c}=t;if(o===i||a===i)return this;if(e===i||n===i)return t;const u=U(r*r),f=U(c*c),l=U(e*f),h=U(o*u),d=U(U(n*c)*f),y=U(U(a*r)*u),g=U(h-l),m=U(y-d);if(g===i)return m===i?this.double():p.ZERO;const b=U(g*g),w=U(g*b),v=U(l*b),x=U(m*m-w-s*v),E=U(m*(v-x)-d*w),S=U(r*c*g);return new p(x,E,S)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=p.ZERO;if("bigint"==typeof t&&t===i)return e;let n=F(t);if(n===o)return this;if(!l){let t=e,r=this;for(;n>i;)n&o&&(t=t.add(r)),r=r.double(),n>>=o;return t}let{k1neg:r,k1:s,k2neg:a,k2:c}=$(n),f=e,h=e,d=this;for(;s>i||c>i;)s&o&&(f=f.add(d)),c&o&&(h=h.add(d)),d=d.double(),s>>=o,c>>=o;return r&&(f=f.negate()),a&&(h=h.negate()),h=new p(U(h.x*u.beta),h.y,h.z),f.add(h)}precomputeWindow(t){const e=l?128/t+1:256/t+1,n=[];let r=this,i=r;for(let o=0;o<e;o++){i=r,n.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(t,e){!e&&this.equals(p.BASE)&&(e=y.BASE);const n=e&&e._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=e&&d.get(e);r||(r=this.precomputeWindow(n),e&&1!==n&&(r=p.normalizeZ(r),d.set(e,r)));let i=p.ZERO,s=p.ZERO;const a=1+(l?128/n:256/n),c=2**(n-1),u=BigInt(2**n-1),f=2**n,h=BigInt(n);for(let e=0;e<a;e++){const n=e*c;let a=Number(t&u);if(t>>=h,a>c&&(a-=f,t+=o),0===a){let t=r[n];e%2&&(t=t.negate()),s=s.add(t)}else{let t=r[n+Math.abs(a)-1];a<0&&(t=t.negate()),i=i.add(t)}}return{p:i,f:s}}multiply(t,e){let n,r,i=F(t);if(l){const{k1neg:t,k1:o,k2neg:s,k2:a}=$(i);let{p:c,f}=this.wNAF(o,e),{p:l,f:h}=this.wNAF(a,e);t&&(c=c.negate()),s&&(l=l.negate()),l=new p(U(l.x*u.beta),l.y,l.z),n=c.add(l),r=f.add(h)}else{const{p:t,f:o}=this.wNAF(i,e);n=t,r=o}return p.normalizeZ([n,r])[0]}toAffine(t=B(this.z)){const{x:e,y:n,z:r}=this,i=t,s=U(i*i),a=U(s*i),c=U(e*s),u=U(n*a);if(U(r*i)!==o)throw new Error("invZ was invalid");return new y(c,u)}}p.BASE=new p(u.Gx,u.Gy,o),p.ZERO=new p(i,o,i);const d=new WeakMap;class y{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,d.delete(this)}hasEvenY(){return this.y%s===i}static fromCompressedHex(t){const e=32===t.length,n=j(e?t:t.subarray(1));if(!z(n))throw new Error("Point is not on curve");let r=function(t){const{P:e}=u,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),c=BigInt(44),f=BigInt(88),l=t*t*t%e,h=l*l*t%e,p=I(h,a)*h%e,d=I(p,a)*h%e,y=I(d,s)*l%e,g=I(y,r)*y%e,m=I(g,i)*g%e,b=I(m,c)*m%e,w=I(b,f)*b%e,v=I(w,c)*m%e,x=I(v,a)*h%e,E=I(x,o)*g%e,S=I(E,n)*l%e;return I(S,s)}(f(n));const i=(r&o)===o;e?i&&(r=U(-r)):1==(1&t[0])!==i&&(r=U(-r));const c=new y(n,r);return c.assertValidity(),c}static fromUncompressedHex(t){const e=j(t.subarray(1,33)),n=j(t.subarray(33,65)),r=new y(e,n);return r.assertValidity(),r}static fromHex(t){const e=T(t),n=e.length,r=e[0];if(32===n||33===n&&(2===r||3===r))return this.fromCompressedHex(e);if(65===n&&4===r)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return y.BASE.multiply(q(t))}static fromSignature(t,e,n){const r=L(t=T(t)),{r:i,s:o}=G(e);if(0!==n&&1!==n)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&n?"03":"02",a=y.fromHex(s+S(i)),{n:c}=u,f=B(i,c),l=U(-r*f,c),h=U(o*f,c),p=y.BASE.multiplyAndAddUnsafe(a,l,h);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(t=!1){return O(this.toHex(t))}toHex(t=!1){const e=S(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${S(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:n}=this;if(!z(e)||!z(n))throw new Error(t);const r=U(n*n);if(U(r-f(e))!==i)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new y(this.x,U(-this.y))}double(){return p.fromAffine(this).double().toAffine()}add(t){return p.fromAffine(this).add(p.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return p.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,n){const r=p.fromAffine(this),s=e===i||e===o||this!==y.BASE?r.multiplyUnsafe(e):r.multiply(e),a=p.fromAffine(t).multiplyUnsafe(n),c=s.add(a);return c.equals(p.ZERO)?void 0:c.toAffine()}}function g(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function m(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${x(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:j(n),left:t.subarray(e+2)}}e.Point=y,y.BASE=new y(u.Gx,u.Gy),y.ZERO=new y(i,i);class b{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=e?x(t):t;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new b(k(r.slice(0,64)),k(r.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${x(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=m(t.subarray(2)),{data:r,left:i}=m(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${x(i)}`);return{r:e,s:r}}(e?t:O(t));return new b(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!R(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!R(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=u.n>>o;return this.s>t}normalizeS(){return this.hasHighS()?new b(this.r,u.n-this.s):this}toDERRawBytes(t=!1){return O(this.toDERHex(t))}toDERHex(t=!1){const e=g(_(this.s));if(t)return e;const n=g(_(this.r)),r=_(n.length/2),i=_(e.length/2);return`30${_(n.length/2+e.length/2+4)}02${r}${n}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return O(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}function w(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n}e.Signature=b;const v=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function x(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=v[t[n]];return e}const E=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function S(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(i<=t&&t<E))throw new Error("Expected number < 2^256");return t.toString(16).padStart(64,"0")}function A(t){const e=O(S(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function _(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function k(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function O(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}function j(t){return k(x(t))}function T(t){return t instanceof Uint8Array?Uint8Array.from(t):O(t)}function F(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&R(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function U(t,e=u.P){const n=t%e;return n>=i?n:e+n}function I(t,e){const{P:n}=u;let r=t;for(;e-- >i;)r*=r,r%=n;return r}function B(t,e=u.P){if(t===i||e<=i)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=U(t,e),r=e,s=i,a=o,c=o,f=i;for(;n!==i;){const t=r/n,e=r%n,i=s-c*t,o=a-f*t;r=n,n=e,s=c,a=f,c=i,f=o}if(r!==o)throw new Error("invert: does not exist");return U(s,e)}const N=(t,e)=>(t+e/s)/e,P={a1:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),b1:-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a2:BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),b2:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),POW_2_128:BigInt("0x100000000000000000000000000000000")};function $(t){const{n:e}=u,{a1:n,b1:r,a2:i,b2:o,POW_2_128:s}=P,a=N(o*t,e),c=N(-r*t,e);let f=U(t-a*n-c*i,e),l=U(-a*r-c*o,e);const h=f>s,p=l>s;if(h&&(f=e-f),p&&(l=e-l),f>s||l>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:h,k1:f,k2neg:p,k2:l}}function L(t){const{n:e}=u,n=8*t.length-256;let r=j(t);return n>0&&(r>>=BigInt(n)),r>=e&&(r-=e),r}let C,D;class H{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...t){return e.utils.hmacSha256(this.k,...t)}hmacSync(...t){return D(this.k,...t)}checkSync(){if("function"!=typeof D)throw new h("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.checkSync(),this.incr(),this.v=this.hmacSync(this.v),this.v}}function R(t){return i<t&&t<u.n}function z(t){return i<t&&t<u.P}function M(t,e,n){const r=j(t);if(!R(r))return;const{n:s}=u,a=y.BASE.multiply(r),c=U(a.x,s);if(c===i)return;const f=U(B(r,s)*U(e+n*c,s),s);if(f===i)return;const l=new b(c,f);return{sig:l,recovery:(a.x===l.r?0:2)|Number(a.y&o)}}function q(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=k(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=j(t)}if(!R(e))throw new Error("Expected private key: 0 < key < n");return e}function V(t){return t instanceof y?(t.assertValidity(),t):y.fromHex(t)}function G(t){if(t instanceof b)return t.assertValidity(),t;try{return b.fromDER(t)}catch(e){return b.fromCompact(t)}}function K(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?33===r||65===r:n?66===r||130===r:t instanceof y}function J(t){return j(t.length>32?t.slice(0,32):t)}function W(t){const e=J(t),n=U(e,u.n);return Z(n<i?e:n)}function Z(t){return A(t)}function X(t,n,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const i=T(t),o=q(n),s=[Z(o),W(i)];if(null!=r){!0===r&&(r=e.utils.randomBytes(32));const t=T(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(t)}return{seed:w(...s),m:J(i),d:o}}function Y(t,e){let{sig:n,recovery:r}=t;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},e);i&&n.hasHighS()&&(n=n.normalizeS(),r^=1);const a=o?n.toDERRawBytes():n.toCompactRawBytes();return s?[a,r]:a}e.getPublicKey=function(t,e=!1){return y.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,n,r=!1){return y.fromSignature(t,e,n).toRawBytes(r)},e.getSharedSecret=function(t,e,n=!1){if(K(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!K(e))throw new TypeError("getSharedSecret: second arg must be public key");const r=V(e);return r.assertValidity(),r.multiply(q(t)).toRawBytes(n)},e.sign=async function(t,e,n={}){const{seed:r,m:i,d:o}=X(t,e,n.extraEntropy);let s;const a=new H;for(await a.reseed(r);!(s=M(await a.generate(),i,o));)await a.reseed();return Y(s,n)},e.signSync=function(t,e,n={}){const{seed:r,m:i,d:o}=X(t,e,n.extraEntropy);let s;const a=new H;for(a.reseedSync(r);!(s=M(a.generateSync(),i,o));)a.reseedSync();return Y(s,n)};const Q={strict:!0};function tt(t){return U(j(t),u.n)}e.verify=function(t,e,n,r=Q){let i;try{i=G(t),e=T(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=L(e);let c;try{c=V(n)}catch(t){return!1}const{n:f}=u,l=B(s,f),h=U(a*l,f),p=U(o*l,f),d=y.BASE.multiplyAndAddUnsafe(c,h,p);return!!d&&U(d.x,f)===o};class et{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=T(t);if(64!==e.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${e.length}`);const n=j(e.subarray(0,32)),r=j(e.subarray(32,64));return new et(n,r)}assertValidity(){const{r:t,s:e}=this;if(!z(t)||!R(e))throw new Error("Invalid signature")}toHex(){return S(this.r)+S(this.s)}toRawBytes(){return O(this.toHex())}}class nt{constructor(t,n,r=e.utils.randomBytes()){if(null==t)throw new TypeError(`sign: Expected valid message, not "${t}"`);this.m=T(t);const{x:i,scalar:o}=this.getScalar(q(n));if(this.px=i,this.d=o,this.rand=T(r),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(t){const e=y.fromPrivateKey(t),n=e.hasEvenY()?t:u.n-t;return{point:e,scalar:n,x:e.toRawX()}}initNonce(t,e){return A(t^j(e))}finalizeNonce(t){const e=U(j(t),u.n);if(e===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:n,x:r,scalar:o}=this.getScalar(e);return{R:n,rx:r,k:o}}finalizeSig(t,e,n,r){return new et(t.x,U(e+n*r,u.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:t,d:n,px:r,rand:i}=this,o=e.utils.taggedHash,s=this.initNonce(n,await o(ct.aux,i)),{R:a,rx:c,k:u}=this.finalizeNonce(await o(ct.nonce,s,r,t)),f=tt(await o(ct.challenge,c,r,t)),l=this.finalizeSig(a,u,f,n);return await ot(l,t,r)||this.error(),l}calcSync(){const{m:t,d:n,px:r,rand:i}=this,o=e.utils.taggedHashSync,s=this.initNonce(n,o(ct.aux,i)),{R:a,rx:c,k:u}=this.finalizeNonce(o(ct.nonce,s,r,t)),f=tt(o(ct.challenge,c,r,t)),l=this.finalizeSig(a,u,f,n);return st(l,t,r)||this.error(),l}}function rt(t,e,n){const r=t instanceof et,i=r?t:et.fromHex(t);return r&&i.assertValidity(),{...i,m:T(e),P:V(n)}}function it(t,e,n,r){const i=y.BASE.multiplyAndAddUnsafe(e,q(n),U(-r,u.n));return!(!i||!i.hasEvenY()||i.x!==t)}async function ot(t,n,r){try{const{r:i,s:o,m:s,P:a}=rt(t,n,r),c=tt(await e.utils.taggedHash(ct.challenge,A(i),a.toRawX(),s));return it(i,a,o,c)}catch(t){return!1}}function st(t,n,r){try{const{r:i,s:o,m:s,P:a}=rt(t,n,r),c=tt(e.utils.taggedHashSync(ct.challenge,A(i),a.toRawX(),s));return it(i,a,o,c)}catch(t){if(t instanceof h)throw t;return!1}}e.schnorr={Signature:et,getPublicKey:function(t){return y.fromPrivateKey(t).toRawX()},sign:async function(t,e,n){return new nt(t,e,n).calc()},verify:ot,signSync:function(t,e,n){return new nt(t,e,n).calcSync()},verifySync:st},y.BASE._setWindowSize(8);const at={node:r,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},ct={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},ut={};e.utils={bytesToHex:x,hexToBytes:O,concatBytes:w,mod:U,invert:B,isValidPrivateKey(t){try{return q(t),!0}catch(t){return!1}},_bigintTo32Bytes:A,_normalizePrivateKey:q,hashToPrivateKey:t=>{if((t=T(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return A(U(j(t),u.n-o)+o)},randomBytes:(t=32)=>{if(at.web)return at.web.getRandomValues(new Uint8Array(t));if(at.node){const{randomBytes:e}=at.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.hashToPrivateKey(e.utils.randomBytes(40)),sha256:async(...t)=>{if(at.web){const e=await at.web.subtle.digest("SHA-256",w(...t));return new Uint8Array(e)}if(at.node){const{createHash:e}=at.node,n=e("sha256");return t.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(at.web){const n=await at.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=w(...e),i=await at.web.subtle.sign("HMAC",n,r);return new Uint8Array(i)}if(at.node){const{createHmac:n}=at.node,r=n("sha256",t);return e.forEach((t=>r.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...n)=>{let r=ut[t];if(void 0===r){const n=await e.utils.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=w(n,n),ut[t]=r}return e.utils.sha256(r,...n)},taggedHashSync:(t,...e)=>{if("function"!=typeof C)throw new h("sha256Sync is undefined, you need to set it");let n=ut[t];if(void 0===n){const e=C(Uint8Array.from(t,(t=>t.charCodeAt(0))));n=w(e,e),ut[t]=n}return C(n,...e)},precompute(t=8,e=y.BASE){const n=e===y.BASE?e:new y(e.x,e.y);return n._setWindowSize(t),n.multiply(a),n}},Object.defineProperties(e.utils,{sha256Sync:{configurable:!1,get:()=>C,set(t){C||(C=t)}},hmacSha256Sync:{configurable:!1,get:()=>D,set(t){D||(D=t)}}})},625:function(t,e,n){t=n.nmd(t);var r=n(406);!function(e){"use strict";function i(t,e){e|=0;for(var n=Math.max(t.length-e,0),r=Array(n),i=0;i<n;i++)r[i]=t[e+i];return r}var o=function(t){var e=i(arguments,1);return function(){var n=i(arguments);return t.apply(null,e.concat(n))}},s=function(t){return function(){var e=i(arguments),n=e.pop();t.call(this,e,n)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var c="function"==typeof setImmediate&&setImmediate,u="object"==typeof r&&"function"==typeof r.nextTick;function f(t){setTimeout(t,0)}function l(t){return function(e){var n=i(arguments,1);t((function(){e.apply(null,n)}))}}var h=l(c?setImmediate:u?r.nextTick:f);function p(t){return s((function(e,n){var r;try{r=t.apply(this,e)}catch(t){return n(t)}a(r)&&"function"==typeof r.then?r.then((function(t){d(n,null,t)}),(function(t){d(n,t.message?t:new Error(t))})):n(null,r)}))}function d(t,e,n){try{t(e,n)}catch(t){h(y,t)}}function y(t){throw t}var g="function"==typeof Symbol;function m(t){return g&&"AsyncFunction"===t[Symbol.toStringTag]}function b(t){return m(t)?p(t):t}function w(t){return function(e){var n=i(arguments,1),r=s((function(n,r){var i=this;return t(e,(function(t,e){b(t).apply(i,n.concat(e))}),r)}));return n.length?r.apply(this,n):r}}var v="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,x="object"==typeof self&&self&&self.Object===Object&&self,E=v||x||Function("return this")(),S=E.Symbol,A=Object.prototype,_=A.hasOwnProperty,k=A.toString,O=S?S.toStringTag:void 0;var j=Object.prototype.toString;var T=S?S.toStringTag:void 0;function F(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=_.call(t,O),n=t[O];try{t[O]=void 0;var r=!0}catch(t){}var i=k.call(t);return r&&(e?t[O]=n:delete t[O]),i}(t):function(t){return j.call(t)}(t)}function U(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function I(t){return null!=t&&U(t.length)&&!function(t){if(!a(t))return!1;var e=F(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var B={};function N(){}function P(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var $="function"==typeof Symbol&&Symbol.iterator;function L(t){return null!=t&&"object"==typeof t}function C(t){return L(t)&&"[object Arguments]"==F(t)}var D=Object.prototype,H=D.hasOwnProperty,R=D.propertyIsEnumerable,z=C(function(){return arguments}())?C:function(t){return L(t)&&H.call(t,"callee")&&!R.call(t,"callee")},M=Array.isArray;var q="object"==typeof e&&e&&!e.nodeType&&e,V=q&&t&&!t.nodeType&&t,G=V&&V.exports===q?E.Buffer:void 0,K=(G?G.isBuffer:void 0)||function(){return!1},J=/^(?:0|[1-9]\d*)$/;function W(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&J.test(t))&&t>-1&&t%1==0&&t<e}var Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0,Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=!1;var X,Y="object"==typeof e&&e&&!e.nodeType&&e,Q=Y&&t&&!t.nodeType&&t,tt=Q&&Q.exports===Y&&v.process,et=function(){try{return Q&&Q.require&&Q.require("util").types||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),nt=et&&et.isTypedArray,rt=nt?(X=nt,function(t){return X(t)}):function(t){return L(t)&&U(t.length)&&!!Z[F(t)]},it=Object.prototype.hasOwnProperty;function ot(t,e){var n=M(t),r=!n&&z(t),i=!n&&!r&&K(t),o=!n&&!r&&!i&&rt(t),s=n||r||i||o,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!it.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||W(u,c))||a.push(u);return a}var st=Object.prototype;var at=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),ct=Object.prototype.hasOwnProperty;function ut(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||st))return at(t);var e,n,r=[];for(var i in Object(t))ct.call(t,i)&&"constructor"!=i&&r.push(i);return r}function ft(t){return I(t)?ot(t):ut(t)}function lt(t){if(I(t))return function(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}(t);var e,n,r,i,o=function(t){return $&&t[$]&&t[$]()}(t);return o?function(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}(o):(n=ft(e=t),r=-1,i=n.length,function t(){var o=n[++r];return"__proto__"===o?t():r<i?{value:e[o],key:o}:null})}function ht(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function pt(t){return function(e,n,r){if(r=P(r||N),t<=0||!e)return r(null);var i=lt(e),o=!1,s=0,a=!1;function c(t,e){if(s-=1,t)o=!0,r(t);else{if(e===B||o&&s<=0)return o=!0,r(null);a||u()}}function u(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&r(null));s+=1,n(e.value,e.key,ht(c))}a=!1}u()}}function dt(t,e,n,r){pt(e)(t,b(n),r)}function yt(t,e){return function(n,r,i){return t(n,e,r,i)}}function gt(t,e,n){n=P(n||N);var r=0,i=0,o=t.length;function s(t,e){t?n(t):++i!==o&&e!==B||n(null)}for(0===o&&n(null);r<o;r++)e(t[r],r,ht(s))}var mt=yt(dt,1/0),bt=function(t,e,n){(I(t)?gt:mt)(t,b(e),n)};function wt(t){return function(e,n,r){return t(bt,e,b(n),r)}}function vt(t,e,n,r){r=r||N,e=e||[];var i=[],o=0,s=b(n);t(e,(function(t,e,n){var r=o++;s(t,(function(t,e){i[r]=e,n(t)}))}),(function(t){r(t,i)}))}var xt=wt(vt),Et=w(xt);function St(t){return function(e,n,r,i){return t(pt(n),e,b(r),i)}}var At=St(vt),_t=yt(At,1),kt=w(_t);function Ot(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}var jt,Tt=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),s=o.length;s--;){var a=o[jt?s:++r];if(!1===e(i[a],a,i))break}return t};function Ft(t,e){return t&&Tt(t,e,ft)}function Ut(t){return t!=t}function It(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Ut,n)}var Bt=function(t,e,n){"function"==typeof e&&(n=e,e=null),n=P(n||N);var r=ft(t).length;if(!r)return n(null);e||(e=r);var o={},s=0,a=!1,c=Object.create(null),u=[],f=[],l={};function h(t,e){u.push((function(){!function(t,e){if(!a){var r=ht((function(e,r){if(s--,arguments.length>2&&(r=i(arguments,1)),e){var u={};Ft(o,(function(t,e){u[e]=t})),u[t]=r,a=!0,c=Object.create(null),n(e,u)}else o[t]=r,d(t)}));s++;var u=b(e[e.length-1]);e.length>1?u(o,r):u(r)}}(t,e)}))}function p(){if(0===u.length&&0===s)return n(null,o);for(;u.length&&s<e;)u.shift()()}function d(t){Ot(c[t]||[],(function(t){t()})),p()}function y(e){var n=[];return Ft(t,(function(t,r){M(t)&&It(t,e,0)>=0&&n.push(r)})),n}Ft(t,(function(e,n){if(!M(e))return h(n,[e]),void f.push(n);var r=e.slice(0,e.length-1),i=r.length;if(0===i)return h(n,e),void f.push(n);l[n]=i,Ot(r,(function(o){if(!t[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+r.join(", "));var s,a,u;a=function(){0==--i&&h(n,e)},(u=c[s=o])||(u=c[s]=[]),u.push(a)}))})),function(){for(var t=0;f.length;)t++,Ot(y(f.pop()),(function(t){0==--l[t]&&f.push(t)}));if(t!==r)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p()};function Nt(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var Pt=S?S.prototype:void 0,$t=Pt?Pt.toString:void 0;function Lt(t){if("string"==typeof t)return t;if(M(t))return Nt(t,Lt)+"";if(function(t){return"symbol"==typeof t||L(t)&&"[object Symbol]"==F(t)}(t))return $t?$t.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Ct(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}(t,e,n)}var Dt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Ht="[\\ud800-\\udfff]",Rt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",zt="\\ud83c[\\udffb-\\udfff]",Mt="[^\\ud800-\\udfff]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",Gt="(?:"+Rt+"|"+zt+")?",Kt="[\\ufe0e\\ufe0f]?",Jt=Kt+Gt+("(?:\\u200d(?:"+[Mt,qt,Vt].join("|")+")"+Kt+Gt+")*"),Wt="(?:"+[Mt+Rt+"?",Rt,qt,Vt,Ht].join("|")+")",Zt=RegExp(zt+"(?="+zt+")|"+Wt+Jt,"g");function Xt(t){return function(t){return Dt.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.split("")}(t)}var Yt=/^\s+|\s+$/g;function Qt(t,e,n){if((t=null==(r=t)?"":Lt(r))&&(n||void 0===e))return t.replace(Yt,"");var r;if(!t||!(e=Lt(e)))return t;var i=Xt(t),o=Xt(e);return Ct(i,function(t,e){for(var n=-1,r=t.length;++n<r&&It(e,t[n],0)>-1;);return n}(i,o),function(t,e){for(var n=t.length;n--&&It(e,t[n],0)>-1;);return n}(i,o)+1).join("")}var te=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ee=/,/,ne=/(=.+)?(\s*)$/,re=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ie(t,e){var n={};Ft(t,(function(t,e){var r,i=m(t),o=!i&&1===t.length||i&&0===t.length;if(M(t))r=t.slice(0,-1),t=t[t.length-1],n[e]=r.concat(r.length>0?s:t);else if(o)n[e]=t;else{if(r=function(t){return(t=(t=(t=t.toString().replace(re,"")).match(te)[2].replace(" ",""))?t.split(ee):[]).map((function(t){return Qt(t.replace(ne,""))}))}(t),0===t.length&&!i&&0===r.length)throw new Error("autoInject task functions require explicit parameters.");i||r.pop(),n[e]=r.concat(s)}function s(e,n){var i=Nt(r,(function(t){return e[t]}));i.push(n),b(t).apply(null,i)}})),Bt(n,e)}function oe(){this.head=this.tail=null,this.length=0}function se(t,e){t.length=1,t.head=t.tail=e}function ae(t,e,n){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var r=b(t),i=0,o=[],s=!1;function a(t,e,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(f.started=!0,M(t)||(t=[t]),0===t.length&&f.idle())return h((function(){f.drain()}));for(var r=0,i=t.length;r<i;r++){var o={data:t[r],callback:n||N};e?f._tasks.unshift(o):f._tasks.push(o)}s||(s=!0,h((function(){s=!1,f.process()})))}function c(t){return function(e){i-=1;for(var n=0,r=t.length;n<r;n++){var s=t[n],a=It(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&f.error(e,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var u=!1,f={_tasks:new oe,concurrency:e,payload:n,saturated:N,unsaturated:N,buffer:e/4,empty:N,drain:N,error:N,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){f.drain=N,f._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){f._tasks.remove(t)},process:function(){if(!u){for(u=!0;!f.paused&&i<f.concurrency&&f._tasks.length;){var t=[],e=[],n=f._tasks.length;f.payload&&(n=Math.min(n,f.payload));for(var s=0;s<n;s++){var a=f._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===f._tasks.length&&f.empty(),i===f.concurrency&&f.saturated();var l=ht(c(t));r(e,l)}u=!1}},length:function(){return f._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return f._tasks.length+i===0},pause:function(){f.paused=!0},resume:function(){!1!==f.paused&&(f.paused=!1,h(f.process))}};return f}function ce(t,e){return ae(t,1,e)}oe.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},oe.prototype.empty=function(){for(;this.head;)this.shift();return this},oe.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},oe.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},oe.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):se(this,t)},oe.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):se(this,t)},oe.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oe.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},oe.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,n=0;n<this.length;n++)t[n]=e.data,e=e.next;return t},oe.prototype.remove=function(t){for(var e=this.head;e;){var n=e.next;t(e)&&this.removeLink(e),e=n}return this};var ue=yt(dt,1);function fe(t,e,n,r){r=P(r||N);var i=b(n);ue(t,(function(t,n,r){i(e,t,(function(t,n){e=n,r(t)}))}),(function(t){r(t,e)}))}function le(){var t=Nt(arguments,b);return function(){var e=i(arguments),n=this,r=e[e.length-1];"function"==typeof r?e.pop():r=N,fe(t,e,(function(t,e,r){e.apply(n,t.concat((function(t){var e=i(arguments,1);r(t,e)})))}),(function(t,e){r.apply(n,[t].concat(e))}))}}var he=function(){return le.apply(null,i(arguments).reverse())},pe=Array.prototype.concat,de=function(t,e,n,r){r=r||N;var o=b(n);At(t,e,(function(t,e){o(t,(function(t){return t?e(t):e(null,i(arguments,1))}))}),(function(t,e){for(var n=[],i=0;i<e.length;i++)e[i]&&(n=pe.apply(n,e[i]));return r(t,n)}))},ye=yt(de,1/0),ge=yt(de,1),me=function(){var t=i(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function be(t){return t}function we(t,e){return function(n,r,i,o){o=o||N;var s,a=!1;n(r,(function(n,r,o){i(n,(function(r,i){r?o(r):t(i)&&!s?(a=!0,s=e(!0,n),o(null,B)):o()}))}),(function(t){t?o(t):o(null,a?s:e(!1))}))}}function ve(t,e){return e}var xe=wt(we(be,ve)),Ee=St(we(be,ve)),Se=yt(Ee,1);function Ae(t){return function(e){var n=i(arguments,1);n.push((function(e){var n=i(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&Ot(n,(function(e){console[t](e)})))})),b(e).apply(null,n)}}var _e=Ae("dir");function ke(t,e,n){n=ht(n||N);var r=b(t),o=b(e);function s(t){if(t)return n(t);var e=i(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?n(t):e?void r(s):n(null)}a(null,!0)}function Oe(t,e,n){n=ht(n||N);var r=b(t),o=function(t){if(t)return n(t);var s=i(arguments,1);if(e.apply(this,s))return r(o);n.apply(null,[null].concat(s))};r(o)}function je(t,e,n){Oe(t,(function(){return!e.apply(this,arguments)}),n)}function Te(t,e,n){n=ht(n||N);var r=b(e),i=b(t);function o(t){if(t)return n(t);i(s)}function s(t,e){return t?n(t):e?void r(o):n(null)}i(s)}function Fe(t){return function(e,n,r){return t(e,r)}}function Ue(t,e,n){bt(t,Fe(b(e)),n)}function Ie(t,e,n,r){pt(e)(t,Fe(b(n)),r)}var Be=yt(Ie,1);function Ne(t){return m(t)?t:s((function(e,n){var r=!0;e.push((function(){var t=arguments;r?h((function(){n.apply(null,t)})):n.apply(null,t)})),t.apply(this,e),r=!1}))}function Pe(t){return!t}var $e=wt(we(Pe,Pe)),Le=St(we(Pe,Pe)),Ce=yt(Le,1);function De(t){return function(e){return null==e?void 0:e[t]}}function He(t,e,n,r){var i=new Array(e.length);t(e,(function(t,e,r){n(t,(function(t,n){i[e]=!!n,r(t)}))}),(function(t){if(t)return r(t);for(var n=[],o=0;o<e.length;o++)i[o]&&n.push(e[o]);r(null,n)}))}function Re(t,e,n,r){var i=[];t(e,(function(t,e,r){n(t,(function(n,o){n?r(n):(o&&i.push({index:e,value:t}),r())}))}),(function(t){t?r(t):r(null,Nt(i.sort((function(t,e){return t.index-e.index})),De("value")))}))}function ze(t,e,n,r){(I(e)?He:Re)(t,e,b(n),r||N)}var Me=wt(ze),qe=St(ze),Ve=yt(qe,1);function Ge(t,e){var n=ht(e||N),r=b(Ne(t));!function t(e){if(e)return n(e);r(t)}()}var Ke=function(t,e,n,r){r=r||N;var i=b(n);At(t,e,(function(t,e){i(t,(function(n,r){return n?e(n):e(null,{key:r,val:t})}))}),(function(t,e){for(var n={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var s=e[o].key,a=e[o].val;i.call(n,s)?n[s].push(a):n[s]=[a]}return r(t,n)}))},Je=yt(Ke,1/0),We=yt(Ke,1),Ze=Ae("log");function Xe(t,e,n,r){r=P(r||N);var i={},o=b(n);dt(t,e,(function(t,e,n){o(t,e,(function(t,r){if(t)return n(t);i[e]=r,n()}))}),(function(t){r(t,i)}))}var Ye=yt(Xe,1/0),Qe=yt(Xe,1);function tn(t,e){return e in t}function en(t,e){var n=Object.create(null),r=Object.create(null);e=e||be;var o=b(t),a=s((function(t,s){var a=e.apply(null,t);tn(n,a)?h((function(){s.apply(null,n[a])})):tn(r,a)?r[a].push(s):(r[a]=[s],o.apply(null,t.concat((function(){var t=i(arguments);n[a]=t;var e=r[a];delete r[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)}))))}));return a.memo=n,a.unmemoized=t,a}var nn=l(u?r.nextTick:c?setImmediate:f);function rn(t,e,n){n=n||N;var r=I(e)?[]:{};t(e,(function(t,e,n){b(t)((function(t,o){arguments.length>2&&(o=i(arguments,1)),r[e]=o,n(t)}))}),(function(t){n(t,r)}))}function on(t,e){rn(bt,t,e)}function sn(t,e,n){rn(pt(e),t,n)}var an=function(t,e){var n=b(t);return ae((function(t,e){n(t[0],e)}),e,1)},cn=function(t,e){var n=an(t,e);return n.push=function(t,e,r){if(null==r&&(r=N),"function"!=typeof r)throw new Error("task callback must be a function");if(n.started=!0,M(t)||(t=[t]),0===t.length)return h((function(){n.drain()}));e=e||0;for(var i=n._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:r};i?n._tasks.insertBefore(i,a):n._tasks.push(a)}h(n.process)},delete n.unshift,n};function un(t,e){if(e=P(e||N),!M(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var n=0,r=t.length;n<r;n++)b(t[n])(e)}function fn(t,e,n,r){fe(i(t).reverse(),e,n,r)}function ln(t){var e=b(t);return s((function(t,n){return t.push((function(t,e){var r;t?n(null,{error:t}):(r=arguments.length<=2?e:i(arguments,1),n(null,{value:r}))})),e.apply(this,t)}))}function hn(t){var e;return M(t)?e=Nt(t,ln):(e={},Ft(t,(function(t,n){e[n]=ln.call(this,t)}))),e}function pn(t,e,n,r){ze(t,e,(function(t,e){n(t,(function(t,n){e(t,!n)}))}),r)}var dn=wt(pn),yn=St(pn),gn=yt(yn,1);function mn(t){return function(){return t}}function bn(t,e,n){var r=5,i=0,o={times:r,intervalFunc:mn(i)};function s(t,e){if("object"==typeof e)t.times=+e.times||r,t.intervalFunc="function"==typeof e.interval?e.interval:mn(+e.interval||i),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||r}}if(arguments.length<3&&"function"==typeof t?(n=e||N,e=t):(s(o,t),n=n||N),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var a=b(e),c=1;function u(){a((function(t){t&&c++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(t))?setTimeout(u,o.intervalFunc(c)):n.apply(null,arguments)}))}u()}var wn=function(t,e){e||(e=t,t=null);var n=b(e);return s((function(e,r){function i(t){n.apply(null,e.concat(t))}t?bn(t,i,r):bn(i,r)}))};function vn(t,e){rn(ue,t,e)}var xn=wt(we(Boolean,be)),En=St(we(Boolean,be)),Sn=yt(En,1);function An(t,e,n){var r=b(e);function i(t,e){var n=t.criteria,r=e.criteria;return n<r?-1:n>r?1:0}xt(t,(function(t,e){r(t,(function(n,r){if(n)return e(n);e(null,{value:t,criteria:r})}))}),(function(t,e){if(t)return n(t);n(null,Nt(e.sort(i),De("value")))}))}function _n(t,e,n){var r=b(t);return s((function(i,o){var s,a=!1;i.push((function(){a||(o.apply(null,arguments),clearTimeout(s))})),s=setTimeout((function(){var e=t.name||"anonymous",r=new Error('Callback function "'+e+'" timed out.');r.code="ETIMEDOUT",n&&(r.info=n),a=!0,o(r)}),e),r.apply(null,i)}))}var kn=Math.ceil,On=Math.max;function jn(t,e,n,r){var i=b(n);At(function(t,e,n,r){for(var i=-1,o=On(kn((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}(0,t,1),e,i,r)}var Tn=yt(jn,1/0),Fn=yt(jn,1);function Un(t,e,n,r){arguments.length<=3&&(r=n,n=e,e=M(t)?[]:{}),r=P(r||N);var i=b(n);bt(t,(function(t,n,r){i(e,t,n,r)}),(function(t){r(t,e)}))}function In(t,e){var n,r=null;e=e||N,Be(t,(function(t,e){b(t)((function(t,o){n=arguments.length>2?i(arguments,1):o,r=t,e(!t)}))}),(function(){e(r,n)}))}function Bn(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Nn(t,e,n){n=ht(n||N);var r=b(e);if(!t())return n(null);var o=function(e){if(e)return n(e);if(t())return r(o);var s=i(arguments,1);n.apply(null,[null].concat(s))};r(o)}function Pn(t,e,n){Nn((function(){return!t.apply(this,arguments)}),e,n)}var $n=function(t,e){if(e=P(e||N),!M(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var n=0;function r(e){var r=b(t[n++]);e.push(ht(o)),r.apply(null,e)}function o(o){if(o||n===t.length)return e.apply(null,arguments);r(i(arguments,1))}r([])},Ln={apply:o,applyEach:Et,applyEachSeries:kt,asyncify:p,auto:Bt,autoInject:ie,cargo:ce,compose:he,concat:ye,concatLimit:de,concatSeries:ge,constant:me,detect:xe,detectLimit:Ee,detectSeries:Se,dir:_e,doDuring:ke,doUntil:je,doWhilst:Oe,during:Te,each:Ue,eachLimit:Ie,eachOf:bt,eachOfLimit:dt,eachOfSeries:ue,eachSeries:Be,ensureAsync:Ne,every:$e,everyLimit:Le,everySeries:Ce,filter:Me,filterLimit:qe,filterSeries:Ve,forever:Ge,groupBy:Je,groupByLimit:Ke,groupBySeries:We,log:Ze,map:xt,mapLimit:At,mapSeries:_t,mapValues:Ye,mapValuesLimit:Xe,mapValuesSeries:Qe,memoize:en,nextTick:nn,parallel:on,parallelLimit:sn,priorityQueue:cn,queue:an,race:un,reduce:fe,reduceRight:fn,reflect:ln,reflectAll:hn,reject:dn,rejectLimit:yn,rejectSeries:gn,retry:bn,retryable:wn,seq:le,series:vn,setImmediate:h,some:xn,someLimit:En,someSeries:Sn,sortBy:An,timeout:_n,times:Tn,timesLimit:jn,timesSeries:Fn,transform:Un,tryEach:In,unmemoize:Bn,until:Pn,waterfall:$n,whilst:Nn,all:$e,allLimit:Le,allSeries:Ce,any:xn,anyLimit:En,anySeries:Sn,find:xe,findLimit:Ee,findSeries:Se,forEach:Ue,forEachSeries:Be,forEachLimit:Ie,forEachOf:bt,forEachOfSeries:ue,forEachOfLimit:dt,inject:fe,foldl:fe,foldr:fn,select:Me,selectLimit:qe,selectSeries:Ve,wrapSync:p};e.default=Ln,e.apply=o,e.applyEach=Et,e.applyEachSeries=kt,e.asyncify=p,e.auto=Bt,e.autoInject=ie,e.cargo=ce,e.compose=he,e.concat=ye,e.concatLimit=de,e.concatSeries=ge,e.constant=me,e.detect=xe,e.detectLimit=Ee,e.detectSeries=Se,e.dir=_e,e.doDuring=ke,e.doUntil=je,e.doWhilst=Oe,e.during=Te,e.each=Ue,e.eachLimit=Ie,e.eachOf=bt,e.eachOfLimit=dt,e.eachOfSeries=ue,e.eachSeries=Be,e.ensureAsync=Ne,e.every=$e,e.everyLimit=Le,e.everySeries=Ce,e.filter=Me,e.filterLimit=qe,e.filterSeries=Ve,e.forever=Ge,e.groupBy=Je,e.groupByLimit=Ke,e.groupBySeries=We,e.log=Ze,e.map=xt,e.mapLimit=At,e.mapSeries=_t,e.mapValues=Ye,e.mapValuesLimit=Xe,e.mapValuesSeries=Qe,e.memoize=en,e.nextTick=nn,e.parallel=on,e.parallelLimit=sn,e.priorityQueue=cn,e.queue=an,e.race=un,e.reduce=fe,e.reduceRight=fn,e.reflect=ln,e.reflectAll=hn,e.reject=dn,e.rejectLimit=yn,e.rejectSeries=gn,e.retry=bn,e.retryable=wn,e.seq=le,e.series=vn,e.setImmediate=h,e.some=xn,e.someLimit=En,e.someSeries=Sn,e.sortBy=An,e.timeout=_n,e.times=Tn,e.timesLimit=jn,e.timesSeries=Fn,e.transform=Un,e.tryEach=In,e.unmemoize=Bn,e.until=Pn,e.waterfall=$n,e.whilst=Nn,e.all=$e,e.allLimit=Le,e.allSeries=Ce,e.any=xn,e.anyLimit=En,e.anySeries=Sn,e.find=xe,e.findLimit=Ee,e.findSeries=Se,e.forEach=Ue,e.forEachSeries=Be,e.forEachLimit=Ie,e.forEachOf=bt,e.forEachOfSeries=ue,e.forEachOfLimit=dt,e.inject=fe,e.foldl=fe,e.foldr=fn,e.select=Me,e.selectLimit=qe,e.selectSeries=Ve,e.wrapSync=p,Object.defineProperty(e,"__esModule",{value:!0})}(e)},166:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<t.length;r++){var i=t.charAt(r),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=r}var s=t.length,a=t.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var n=0,r=0,i=0;t[n]===a;)r++,n++;for(var o=(t.length-n)*c+1>>>0,u=new Uint8Array(o);t[n];){var f=e[t.charCodeAt(n)];if(255===f)return;for(var l=0,h=o-1;(0!==f||l<i)&&-1!==h;h--,l++)f+=s*u[h]>>>0,u[h]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=l,n++}for(var p=o-i;p!==o&&0===u[p];)p++;for(var d=new Uint8Array(r+(o-p)),y=r;p!==o;)d[y++]=u[p++];return d}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var c=(o-i)*u+1>>>0,f=new Uint8Array(c);i!==o;){for(var l=e[i],h=0,p=c-1;(0!==l||h<r)&&-1!==p;p--,h++)l+=256*f[p]>>>0,f[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,i++}for(var d=c-r;d!==c&&0===f[d];)d++;for(var y=a.repeat(n);d<c;++d)y+=t.charAt(f[d]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},766:(t,e)=>{"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=c(t),s=o[0],a=o[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),f=0,l=a>0?s-4:s;for(n=0;n<l;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===a&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[f++]=255&e),1===a&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;a<c;a+=s)o.push(u(t,a,a+s>c?c:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},22:(t,e,n)=>{const r=n(166);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},98:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;const r=n(392),i=n(716),o=n(64);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};const s={};s[0]=e.versions.mainnet.p2pkh,s[5]=e.versions.mainnet.p2sh,s[111]=e.versions.testnet.p2pkh,s[196]=e.versions.testnet.p2sh;const a={};function c(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return`S${(0,r.c32checkEncode)(t,e)}`}function u(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return(0,r.c32checkDecode)(t.slice(1))}a[e.versions.mainnet.p2pkh]=0,a[e.versions.mainnet.p2sh]=5,a[e.versions.testnet.p2pkh]=111,a[e.versions.testnet.p2sh]=196,e.c32address=c,e.c32addressDecode=u,e.b58ToC32=function(t,e=-1){const n=i.decode(t),r=(0,o.bytesToHex)(n.data),a=parseInt((0,o.bytesToHex)(n.prefix),16);let u;return e<0?(u=a,void 0!==s[a]&&(u=s[a])):u=e,c(u,r)},e.c32ToB58=function(t,e=-1){const n=u(t),r=n[0],o=n[1];let s;e<0?(s=r,void 0!==a[r]&&(s=a[r])):s=e;let c=s.toString(16);return 1===c.length&&(c=`0${c}`),i.encode(o,c)}},716:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;const r=n(53),i=n(64),o=n(166),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e="00"){const n="string"==typeof t?(0,i.hexToBytes)(t):t,a="string"==typeof e?(0,i.hexToBytes)(e):t;if(!(n instanceof Uint8Array&&a instanceof Uint8Array))throw new TypeError("Argument must be of type Uint8Array or string");const c=(0,r.sha256)((0,r.sha256)(new Uint8Array([...a,...n])));return o(s).encode([...a,...n,...c.slice(0,4)])},e.decode=function(t){const e=o(s).decode(t),n=e.slice(0,1),i=e.slice(1,-4),a=(0,r.sha256)((0,r.sha256)(new Uint8Array([...n,...i])));return e.slice(-4).forEach(((t,e)=>{if(t!==a[e])throw new Error("Invalid checksum")})),{prefix:n,data:i}}},392:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;const r=n(53),i=n(64),o=n(103);function s(t){const e=(0,r.sha256)((0,r.sha256)((0,i.hexToBytes)(t)));return(0,i.bytesToHex)(e.slice(0,4))}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e=`0${e}`);let n=t.toString(16);1===n.length&&(n=`0${n}`);const r=s(`${n}${e}`),i=(0,o.c32encode)(`${e}${r}`);return`${o.c32[t]}${i}`},e.c32checkDecode=function(t){t=(0,o.c32normalize)(t);const e=(0,o.c32decode)(t.slice(1)),n=t[0],r=o.c32.indexOf(n),i=e.slice(-8);let a=r.toString(16);if(1===a.length&&(a=`0${a}`),s(`${a}${e.substring(0,e.length-8)}`)!==i)throw new Error("Invalid c32check string: checksum mismatch");return[r,e.substring(0,e.length-8)]}},103:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;const r=n(64);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";const i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,n){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t=`0${t}`);let o=[],s=0;for(let n=(t=t.toLowerCase()).length-1;n>=0;n--)if(s<4){const r=i.indexOf(t[n])>>s;let a=0;0!==n&&(a=i.indexOf(t[n-1]));const c=1+s,u=a%(1<<c)<<5-c,f=e.c32[r+u];s=c,o.unshift(f)}else s=0;let a=0;for(let t=0;t<o.length&&"0"===o[t];t++)a++;o=o.slice(a);const c=(new TextDecoder).decode((0,r.hexToBytes)(t)).match(/^\u0000*/),u=c?c[0].length:0;for(let t=0;t<u;t++)o.unshift(e.c32[0]);if(n){const t=n-o.length;for(let n=0;n<t;n++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,n){if(!(t=o(t)).match(`^[${e.c32}]*$`))throw new Error("Not a c32-encoded string");const r=t.match(`^${e.c32[0]}*`),s=r?r[0].length:0;let a=[],c=0,u=0;for(let n=t.length-1;n>=0;n--){4===u&&(a.unshift(i[c]),u=0,c=0);const r=(e.c32.indexOf(t[n])<<u)+c,o=i[r%16];if(u+=1,c=r>>4,c>1<<u)throw new Error("Panic error in decoding.");a.unshift(o)}a.unshift(i[c]),a.length%2==1&&a.unshift("0");let f=0;for(let t=0;t<a.length&&"0"===a[t];t++)f++;a=a.slice(f-f%2);let l=a.join("");for(let t=0;t<s;t++)l=`00${l}`;if(n){const t=2*n-l.length;for(let e=0;e<t;e+=2)l=`00${l}`}return l}},870:(t,e,n)=>{"use strict";e.H4=void 0;n(103),n(392);const r=n(98);Object.defineProperty(e,"H4",{enumerable:!0,get:function(){return r.c32address}})},616:function(){!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function y(t){var e=new FileReader,n=d(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n,r=p(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,n=d(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=u(t),e=f(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},h.prototype.delete=function(t){delete this.map[u(t)]},h.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},h.prototype.set=function(t,e){this.map[u(t)]=f(e)},h.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),l(t)},h.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),l(t)},r&&(h.prototype[Symbol.iterator]=h.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,r,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new h(e.headers)),this.method=(r=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function v(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function x(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},m.call(w.prototype),m.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},x.error=function(){var t=new x(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];x.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new x(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function S(t,n){return new Promise((function(r,o){var s=new w(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new x(i,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=h,t.Request=w,t.Response=x),e.Headers=h,e.Request=w,e.Response=x,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},959:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=e.unescape=e.escape=e.pad=void 0;const r=n(766);function i(t){return`${t}${"=".repeat(4-(t.length%4||4))}`}function o(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function s(t){return i(t).replace(/-/g,"+").replace(/_/g,"/")}e.pad=i,e.escape=o,e.unescape=s,e.encode=function(t){return o((0,r.fromByteArray)((new TextEncoder).encode(t)))},e.decode=function(t){return(new TextDecoder).decode((0,r.toByteArray)(i(s(t))))}},996:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoClients=e.SECP256K1Client=void 0;const r=n(869);Object.defineProperty(e,"SECP256K1Client",{enumerable:!0,get:function(){return r.SECP256K1Client}});const i={ES256K:r.SECP256K1Client};e.cryptoClients=i},869:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SECP256K1Client=void 0;const r=n(514),i=n(53),o=n(698),s=n(575),a=n(643),c=n(64);o.utils.hmacSha256Sync=(t,...e)=>{const n=r.hmac.create(i.sha256,t);return e.forEach((t=>n.update(t))),n.digest()};class u{static derivePublicKey(t,e=!0){return 66===t.length&&(t=t.slice(0,64)),t.length<64&&(t=t.padStart(64,"0")),(0,c.bytesToHex)(o.getPublicKey(t,e))}static signHash(t,e,n="jose"){if(!t||!e)throw new a.MissingParametersError("a signing input hash and private key are all required");const r=o.signSync(t,e.slice(0,64),{der:!0,canonical:!1});if("der"===n)return(0,c.bytesToHex)(r);if("jose"===n)return(0,s.derToJose)(r,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return(0,s.joseToDer)(t,"ES256")}static verifyHash(t,e,n){if(!t||!e||!n)throw new a.MissingParametersError("a signing input hash, der signature, and public key are all required");return o.verify(e,t,n,{strict:!1})}}e.SECP256K1Client=u,u.algorithmName="ES256K"},874:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256Async=e.hashSha256=void 0;const i=n(53);function o(t){return(0,i.sha256)(t)}e.hashSha256=o,e.hashSha256Async=function(t){return r(this,void 0,void 0,(function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?(new TextEncoder).encode(t):t,n=yield crypto.subtle.digest("SHA-256",e);return new Uint8Array(n)}{const e=n(812);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(o(t))}}))}},917:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeToken=void 0;const r=n(959);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(r.decode(e[0])),payload:JSON.parse(r.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=r.decode(e));const n=[];return t.header.map((t=>{const e=JSON.parse(r.decode(t));n.push(e)})),{header:n,payload:JSON.parse(e),signature:t.signature}}}},575:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joseToDer=e.derToJose=void 0;const r=n(766),i=n(959);function o(t){return(t/8|0)+(t%8==0?0:1)}const s={ES256:o(256),ES384:o(384),ES512:o(521)};function a(t){const e=s[t];if(e)return e;throw new Error(`Unknown algorithm "${t}"`)}function c(t){if(t instanceof Uint8Array)return t;if("string"==typeof t)return(0,r.toByteArray)((0,i.pad)(t));throw new TypeError("ECDSA signature must be a Base64 string or a Uint8Array")}function u(t,e,n){let r=0;for(;e+r<n&&0===t[e+r];)++r;return t[e+r]>=128&&--r,r}e.derToJose=function(t,e){const n=c(t),o=a(e),s=o+1,u=n.length;let f=0;if(48!==n[f++])throw new Error('Could not find expected "seq"');let l=n[f++];if(129===l&&(l=n[f++]),u-f<l)throw new Error(`"seq" specified length of "${l}", only "${u-f}" remaining`);if(2!==n[f++])throw new Error('Could not find expected "int" for "r"');const h=n[f++];if(u-f-2<h)throw new Error(`"r" specified length of "${h}", only "${u-f-2}" available`);if(s<h)throw new Error(`"r" specified length of "${h}", max of "${s}" is acceptable`);const p=f;if(f+=h,2!==n[f++])throw new Error('Could not find expected "int" for "s"');const d=n[f++];if(u-f!==d)throw new Error(`"s" specified length of "${d}", expected "${u-f}"`);if(s<d)throw new Error(`"s" specified length of "${d}", max of "${s}" is acceptable`);const y=f;if(f+=d,f!==u)throw new Error(`Expected to consume entire array, but "${u-f}" bytes remain`);const g=o-h,m=o-d,b=new Uint8Array(g+h+m+d);for(f=0;f<g;++f)b[f]=0;b.set(n.subarray(p+Math.max(-g,0),p+h),f),f=o;for(const t=f;f<t+m;++f)b[f]=0;return b.set(n.subarray(y+Math.max(-m,0),y+d),f),(0,i.escape)((0,r.fromByteArray)(b))},e.joseToDer=function(t,e){t=c(t);const n=a(e),r=t.length;if(r!==2*n)throw new TypeError(`"${e}" signatures must be "${2*n}" bytes, saw "${r}"`);const i=u(t,0,n),o=u(t,n,t.length),s=n-i,f=n-o,l=2+s+1+1+f,h=l<128,p=new Uint8Array((h?2:3)+l);let d=0;return p[d++]=48,h?p[d++]=l:(p[d++]=129,p[d++]=255&l),p[d++]=2,p[d++]=s,i<0?(p[d++]=0,p.set(t.subarray(0,n),d),d+=n):(p.set(t.subarray(i,n),d),d+=n-i),p[d++]=2,p[d++]=f,o<0?(p[d++]=0,p.set(t.subarray(n),d)):p.set(t.subarray(n+o),d),p}},643:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidTokenError=e.MissingParametersError=void 0;class n extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=n;class r extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=r},474:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(650),e),i(n(458),e),i(n(917),e),i(n(643),e),i(n(996),e)},650:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenSigner=e.createUnsecuredToken=void 0;const i=n(959),o=n(996),s=n(643),a=n(874);function c(t,e){const n=[],r=i.encode(JSON.stringify(e));n.push(r);const o=i.encode(JSON.stringify(t));return n.push(o),n.join(".")}e.createUnsecuredToken=function(t){return c(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new s.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,n={}){const r=this.header(n),i=c(t,r),o=(0,a.hashSha256)(i);return this.createWithSignedHash(t,e,r,i,o)}signAsync(t,e=!1,n={}){return r(this,void 0,void 0,(function*(){const r=this.header(n),i=c(t,r),o=yield(0,a.hashSha256Async)(i);return this.createWithSignedHash(t,e,r,i,o)}))}createWithSignedHash(t,e,n,r,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.encode(JSON.stringify(n))],payload:JSON.stringify(t),signature:[s]}:[r,s].join(".")}}},458:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenVerifier=void 0;const r=n(959),i=n(996),o=n(643),s=n(874);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t&&this.verifyExpanded(t,!1)}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const n=t.split("."),r=n[0]+"."+n[1],i=t=>{const e=this.cryptoClient.loadSignature(n[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return(0,s.hashSha256Async)(r).then((t=>i(t)));{const t=(0,s.hashSha256)(r);return i(t)}}verifyExpanded(t,e){const n=[t.header.join("."),r.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map((t=>{const n=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,n,this.rawPublicKey)||(i=!1)})),i);if(e)return(0,s.hashSha256Async)(n).then((t=>o(t)));{const t=(0,s.hashSha256)(n);return o(t)}}}},907:(t,e,n)=>{t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",f="[object Map]",l="[object Number]",h="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",m="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",v="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",_="[object Int32Array]",k="[object Uint8Array]",O="[object Uint8ClampedArray]",j="[object Uint16Array]",T="[object Uint32Array]",F=/\w*$/,U=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,B={};B[o]=B["[object Array]"]=B[w]=B[v]=B[s]=B[a]=B[x]=B[E]=B[S]=B[A]=B[_]=B[f]=B[l]=B[h]=B[d]=B[y]=B[g]=B[m]=B[k]=B[O]=B[j]=B[T]=!0,B["[object Error]"]=B[c]=B[b]=!1;var N="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,P="object"==typeof self&&self&&self.Object===Object&&self,$=N||P||Function("return this")(),L=e&&!e.nodeType&&e,C=L&&t&&!t.nodeType&&t,D=C&&C.exports===L;function H(t,e){return t.set(e[0],e[1]),t}function R(t,e){return t.add(e),t}function z(t,e,n,r){var i=-1,o=t?t.length:0;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function M(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function q(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function V(t,e){return function(n){return t(e(n))}}function G(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var K,J=Array.prototype,W=Function.prototype,Z=Object.prototype,X=$["__core-js_shared__"],Y=(K=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",Q=W.toString,tt=Z.hasOwnProperty,et=Z.toString,nt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=D?$.Buffer:void 0,it=$.Symbol,ot=$.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ct=Z.propertyIsEnumerable,ut=J.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=$t($,"DataView"),dt=$t($,"Map"),yt=$t($,"Promise"),gt=$t($,"Set"),mt=$t($,"WeakMap"),bt=$t(Object,"create"),wt=Rt(pt),vt=Rt(dt),xt=Rt(yt),Et=Rt(gt),St=Rt(mt),At=it?it.prototype:void 0,_t=At?At.valueOf:void 0;function kt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ot(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){this.__data__=new Ot(t)}function Ft(t,e,n){var r=t[e];tt.call(t,e)&&zt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ut(t,e){for(var n=t.length;n--;)if(zt(t[n][0],e))return n;return-1}function It(t,e,n,r,i,p,b){var U;if(r&&(U=p?r(t,i,p,b):r(t)),void 0!==U)return U;if(!Kt(t))return t;var I=Mt(t);if(I){if(U=function(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!e)return function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(t,U)}else{var N=Ct(t),P=N==c||N==u;if(Vt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(N==h||N==o||P&&!p){if(M(t))return p?t:{};if(U=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:Kt(e=st(t))?at(e):{};var e}(P?{}:t),!e)return function(t,e){return Nt(t,Lt(t),e)}(t,function(t,e){return t&&Nt(e,Jt(e),t)}(U,t))}else{if(!B[N])return p?t:{};U=function(t,e,n,r){var i,o=t.constructor;switch(e){case w:return Bt(t);case s:case a:return new o(+t);case v:return function(t,e){var n=e?Bt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case x:case E:case S:case A:case _:case k:case O:case j:case T:return function(t,e){var n=e?Bt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case f:return function(t,e,n){return z(e?n(q(t),!0):q(t),H,new t.constructor)}(t,r,n);case l:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,F.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return z(e?n(G(t),!0):G(t),R,new t.constructor)}(t,r,n);case m:return i=t,_t?Object(_t.call(i)):{}}}(t,N,It,e)}}b||(b=new Tt);var $=b.get(t);if($)return $;if(b.set(t,U),!I)var L=n?function(t){return function(t,e,n){var r=e(t);return Mt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,Jt,Lt)}(t):Jt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(L||t,(function(i,o){L&&(i=t[o=i]),Ft(U,o,It(i,e,n,r,o,t,b))})),U}function Bt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Nt(t,e,n,r){n||(n={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=r?r(n[s],t[s],s,n,t):void 0;Ft(n,s,void 0===a?t[s]:a)}return n}function Pt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function $t(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Kt(t)||(e=t,Y&&Y in e))&&(Gt(t)||M(t)?nt:U).test(Rt(t));var e}(n)?n:void 0}kt.prototype.clear=function(){this.__data__=bt?bt(null):{}},kt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},kt.prototype.get=function(t){var e=this.__data__;if(bt){var n=e[t];return n===r?void 0:n}return tt.call(e,t)?e[t]:void 0},kt.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},kt.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,n=Ut(e,t);return!(n<0||(n==e.length-1?e.pop():ut.call(e,n,1),0))},Ot.prototype.get=function(t){var e=this.__data__,n=Ut(e,t);return n<0?void 0:e[n][1]},Ot.prototype.has=function(t){return Ut(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var n=this.__data__,r=Ut(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},jt.prototype.clear=function(){this.__data__={hash:new kt,map:new(dt||Ot),string:new kt}},jt.prototype.delete=function(t){return Pt(this,t).delete(t)},jt.prototype.get=function(t){return Pt(this,t).get(t)},jt.prototype.has=function(t){return Pt(this,t).has(t)},jt.prototype.set=function(t,e){return Pt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ot},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ot){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new jt(r)}return n.set(t,e),this};var Lt=ft?V(ft,Object):function(){return[]},Ct=function(t){return et.call(t)};function Dt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||I.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Z)}function Rt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zt(t,e){return t===e||t!=t&&e!=e}(pt&&Ct(new pt(new ArrayBuffer(1)))!=v||dt&&Ct(new dt)!=f||yt&&Ct(yt.resolve())!=p||gt&&Ct(new gt)!=y||mt&&Ct(new mt)!=b)&&(Ct=function(t){var e=et.call(t),n=e==h?t.constructor:void 0,r=n?Rt(n):void 0;if(r)switch(r){case wt:return v;case vt:return f;case xt:return p;case Et:return y;case St:return b}return e});var Mt=Array.isArray;function qt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Gt(t)}var Vt=lt||function(){return!1};function Gt(t){var e=Kt(t)?et.call(t):"";return e==c||e==u}function Kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return qt(t)?function(t,e){var n=Mt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&qt(t)}(t)&&tt.call(t,"callee")&&(!ct.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||Dt(s,r))||n.push(s);return n}(t):function(t){if(!Ht(t))return ht(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return It(t,!0,!0)}},406:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,c=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?c=a.concat(c):f=-1,c.length&&h())}function h(){if(!u){var t=s(l);u=!0;for(var e=c.length;e;){for(a=c,c=[];++f<e;)a&&a[f].run();f=-1,e=c.length}a=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||u||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=d,r.addListener=d,r.once=d,r.off=d,r.removeListener=d,r.removeAllListeners=d,r.emit=d,r.prependListener=d,r.prependOnceListener=d,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},179:(t,e,n)=>{t.exports=n(224)},224:(t,e,n)=>{!function(){var e={};if(e.async=n(625),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var r=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),n=null,r=null;return e.forEach((function(e){if(e&&e.constructor===Object)for(n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]})),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){c.array(t)||(t=[t]),t.forEach((function(t){delete this.custom[t]}),this)}}function a(t,e){var n=["@"];if(this._schema=t,this._custom={},null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._custom["$"+r]=e[r]);this._getDepth=function(){return n.length},this._dumpStack=function(){return n.map((function(t){return t.replace(/^\[/g,"")})).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return n.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return n.push("["+t+"]"),this},this._back=function(){return n.pop(),this}}var c={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&t.constructor!==Array&&null!=t},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function u(t,e){return"function"==typeof t?e instanceof t:c[t=t in c?t:"any"](e)}function f(t,e){for(var n=[],r=t.indexOf(e);-1!==r;)n.push(r),r=t.indexOf(e,r+1);return n}var l={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},h={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var n=c.array(t.type)?t.type:[t.type];n.some((function(t){return u(t,e)}))||(n=n.map((function(t){return"function"==typeof t?"an instance of "+t.name:t})),this.report("must be "+n.join(" or ")+", but is "+function(t){for(var e in c)if(u(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(c.array(e)||"string"==typeof e))for(var n=[],r=0;r<e.length;r++)if(!(n.indexOf(e[r])>=0)){var i=f(e,e[r]);i.length>1&&(n.push(e[r]),this.report("has value ["+e[r]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var n=t.pattern;if("string"==typeof e){var r=!1;c.array(n)||(n=[n]),n.forEach((function(t){"string"==typeof t&&t in l&&(t=l[t]),t instanceof RegExp&&t.test(e)&&(r=!0)})),r||this.report("must match ["+n.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.minLength);isNaN(n)||e.length<n&&this.report("must be longer than "+n+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.maxLength);isNaN(n)||e.length>n&&this.report("must be shorter than "+n+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.exactLength);isNaN(n)||e.length!==n&&this.report("must have exactly "+n+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var n=Number(t.lt);"number"!=typeof e||isNaN(n)||e>=n&&this.report("must be less than "+n+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var n=Number(t.lte);"number"!=typeof e||isNaN(n)||e>n&&this.report("must be less than or equal to "+n+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var n=Number(t.gt);"number"!=typeof e||isNaN(n)||e<=n&&this.report("must be greater than "+n+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var n=Number(t.gte);"number"!=typeof e||isNaN(n)||e<n&&this.report("must be greater than or equal to "+n+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var n=t.eq;if("number"==typeof n||"string"==typeof n||"boolean"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return;this.report("must be equal to ["+n.map((function(t){return'"'+t+'"'})).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==n&&this.report('must be equal to "'+n+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var n=t.ne;if("number"==typeof n||"string"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return void this.report('must not be equal to "'+n[r]+'"',null,"ne")}else e===n&&this.report('must not be equal to "'+n+'"',null,"ne")}},someKeys:function(t,e){var n=t.someKeys;c.object(e)&&(n.some((function(t){return t in e}))||this.report("must have at least key "+n.map((function(t){return'"'+t+'"'})).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&c.object(e)&&c.object(t.properties)&&void 0===t.properties["*"]){var n=Object.keys(e).filter((function(e){return void 0===t.properties[e]}));if(n.length>0){var r="should not contains "+(n.length>1?"properties":"property")+" ["+n.map((function(t){return'"'+t+'"'})).join(", ")+"]";this.report(r,null,"strict")}}},exec:function(t,e,n){var r=this;if("function"==typeof n)return this.asyncExec(t,e,n);(c.array(t.exec)?t.exec:[t.exec]).forEach((function(n){"function"==typeof n&&n.call(r,t,e)}))},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(t.properties instanceof Object&&e instanceof Object){var r,i=t.properties;if(null!=i["*"])for(r in e)r in i||(this._deeperObject(r),this._validate(i["*"],e[r]),this._back());for(r in i)"*"!==r&&(this._deeperObject(r),this._validate(i[r],e[r]),this._back())}},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(t.items instanceof Object&&e instanceof Object){var r,i,o=t.items;if(c.array(o)&&c.array(e))for(r=0,i=o.length;r<i;r++)this._deeperArray(r),this._validate(o[r],e[r]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},p={asyncExec:function(t,e,n){var i=this;r.eachSeries(c.array(t.exec)?t.exec:[t.exec],(function(n,o){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,o);n.call(i,t,e)}r.nextTick(o)}),n)},asyncProperties:function(t,e,n){if(!(t.properties instanceof Object&&c.object(e)))return n();var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();r.eachSeries(Object.keys(e),(function(t,n){if(t in o)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o["*"],e[t],(function(t){i._back(),n(t)}))}),t)},function(t){r.eachSeries(Object.keys(o),(function(t,n){if("*"===t)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o[t],e[t],(function(t){i._back(),n(t)}))}),t)}],n)},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n();var i=this,o=t.items;c.array(o)&&c.array(e)?r.timesSeries(o.length,(function(t,n){i._deeperArray(t),i._asyncValidate(o[t],e[t],(function(t,e){i._back(),n(t,e)})),i._back()}),n):r.eachSeries(Object.keys(e),(function(t,n){i._deeperArray(t),i._asyncValidate(o,e[t],(function(t,e){i._back(),n(t,e)}))}),n)}};function d(t,e){a.prototype.constructor.call(this,t,o(d.custom,e));var n=[];this._basicFields=Object.keys(h),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,r){var i={code:e||this.userCode||null,reason:r||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return n.push(i),this},this.result=function(){return{error:n,valid:0===n.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map((function(t){return"Property "+t.property+": "+t.message})).join("\n")}}}}i(d.prototype,h),i(d.prototype,p),i(d,new s),d.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return r.nextTick((function(){n._asyncValidate(n._schema,t,(function(t){n.origin=null,e(t,n.result())}))}))}return this._validate(this._schema,t).result()},d.prototype._validate=function(t,e,n){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach((function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||this[n](t,e)}),this),this._customFields.forEach((function(n){n in t&&"function"==typeof this._custom[n]&&this._custom[n].call(this,t,e)}),this),this},d.prototype._asyncValidate=function(t,e,n){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,r.series([function(n){r.eachSeries(Object.keys(h),(function(n,o){r.nextTick((function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);i[n](t,e)}o()}))}),n)},function(n){r.eachSeries(Object.keys(i._custom),(function(n,o){r.nextTick((function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);i._custom[n].call(i,t,e)}o()}))}),n)}],n)};var y={number:function(t,e){var n;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return n}else if(t instanceof Date)return+t;return null},integer:function(t,e){var n;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseInt(t.replace(/ /g,""),10)))return n}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():c.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var n=new Date(t);return isNaN(n.getTime())?null:n},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||c.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(c.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return c.array(t)?null:[t]}},g={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},m={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:c.object(t.properties)&&c.object(e)?(Object.keys(e).forEach((function(n){n in t.properties||delete e[n]})),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var n,r="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(n=y[t.type](e,t))&&!r||!n&&isNaN(n)||null===n&&"string"===t.type)&&(n=t.def):r||(n=t.def),(null!=n||void 0!==t.def&&t.def===n)&&n!==e?(this.report(),n):e},rules:function(t,e){var n=t.rules;if("string"!=typeof e||"string"!=typeof n&&!c.array(n))return e;var r=!1;return(c.array(n)?n:[n]).forEach((function(t){"function"==typeof g[t]&&(e=g[t](e),r=!0)})),r&&this.report(),e},min:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.min);return isNaN(r)?e:n<r?(this.report(),r):e},max:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.max);return isNaN(r)?e:n>r?(this.report(),r):e},minLength:function(t,e){var n=Number(t.minLength);if("string"!=typeof e||isNaN(n)||n<0)return e;var r="",i=n-e.length;if(i>0){for(var o=0;o<i;o++)r+="-";return this.report(),e+r}return e},maxLength:function(t,e){var n=Number(t.maxLength);return"string"!=typeof e||isNaN(n)||n<0?e:e.length>n?(this.report(),e.slice(0,n)):e},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(!e||"object"!=typeof e)return e;var r,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),void 0!==(r=this._sanitize(t.properties["*"],e[i]))&&(e[i]=r),this._back());for(i in t.properties)"*"!==i&&(this._deeperObject(i),void 0!==(r=this._sanitize(t.properties[i],e[i]))&&(e[i]=r),this._back());return e},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(!(t.items instanceof Object&&e instanceof Object))return e;var r;if(c.array(t.items)&&c.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(r=0;r<i;r++)this._deeperArray(r),e[r]=this._sanitize(t.items[r],e[r]),this._back()}else for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._deeperArray(r),e[r]=this._sanitize(t.items,e[r]),this._back());return e},exec:function(t,e,n){return"function"==typeof n?this.asyncExec(t,e,n):((c.array(t.exec)?t.exec:[t.exec]).forEach((function(n){"function"==typeof n&&(e=n.call(this,t,e))}),this),e)}},b={asyncExec:function(t,e,n){var i=this,o=c.array(t.exec)?t.exec:[t.exec];r.eachSeries(o,(function(n,r){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,(function(t,n){if(t)return r(t);e=n,r()}));e=n.call(i,t,e)}r()}),(function(t){n(t,e)}))},asyncProperties:function(t,e,n){if(!e||"object"!=typeof e)return n(null,e);var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();var n=o["*"];r.eachSeries(Object.keys(e),(function(t,r){if(t in o)return r();i._deeperObject(t),i._asyncSanitize(n,e[t],(function(n,o){void 0!==o&&(e[t]=o),i._back(),r()}))}),t)},function(t){r.eachSeries(Object.keys(o),(function(t,n){if("*"===t)return n();i._deeperObject(t),i._asyncSanitize(o[t],e[t],(function(r,o){if(r)return n(r);void 0!==o&&(e[t]=o),i._back(),n()}))}),t)}],(function(t){return n(t,e)}))},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n(null,e);var i=this,o=t.items;if(c.array(o)&&c.array(e)){var s=o.length<e.length?o.length:e.length;r.timesSeries(s,(function(t,n){i._deeperArray(t),i._asyncSanitize(o[t],e[t],(function(r,o){if(r)return n(r);e[t]=o,i._back(),n()}))}),(function(t){n(t,e)}))}else r.eachSeries(Object.keys(e),(function(t,n){i._deeperArray(t),i._asyncSanitize(o,e[t],(function(r,o){if(r)return n();e[t]=o,i._back(),n()}))}),(function(t){n(t,e)}));return e}};function w(t,e){a.prototype.constructor.call(this,t,o(w.custom,e));var n=[];this._basicFields=Object.keys(m),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};n.some((function(t){return t.property===e.property}))||n.push(e)},this.result=function(t){return{data:t,reporting:n,format:function(){return this.reporting.map((function(t){return"Property "+t.property+" "+t.message})).join("\n")}}}}i(w.prototype,m),i(w.prototype,b),i(w,new s),w.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return this._asyncSanitize(this._schema,t,(function(t,r){n.origin=null,e(t,n.result(r))}))}var r=this._sanitize(this._schema,t);return this.origin=null,this.result(r)},w.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach((function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||(e=this[n](t,e))}),this),this._customFields.forEach((function(n){n in t&&"function"==typeof this._custom[n]&&(e=this._custom[n].call(this,t,e))}),this),e},w.prototype._asyncSanitize=function(t,e,n){var i=this;this.userAlias=t.alias||null,r.waterfall([function(n){r.reduce(i._basicFields,e,(function(e,n,o){r.nextTick((function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);e=i[n](t,e)}o(null,e)}))}),n)},function(e,n){r.reduce(i._customFields,e,(function(e,n,o){r.nextTick((function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);e=i._custom[n].call(i,t,e)}o(null,e)}))}),n)}],n)};var v=2147483647,x={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},E={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var n="#";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("0123456789abcdefABCDEF");return n},numeric:function(){return""+x.int(0,v)},integer:function(){return!0===x.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return n},alphaNumeric:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return n},alphaDash:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return n},javascript:function(t,e){for(var n=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),r=0,i=x.int(t,e-1);r<i;r++)n+=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return n}};function S(t){var e=-2147483648,n=v;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?n=t.lte:null!=t.lt&&(n=t.lt-1),{min:e,max:n}}var A={string:function(t){if(null!=t.eq)return t.eq;var e="",n=null!=t.minLength?t.minLength:0,r=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof E[t.pattern])return E[t.pattern](n,r);for(var i=null!=t.exactLength?t.exactLength:x.int(n,r),o=0;o<i;o++)e+=x.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.float(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.float(e.min,e.max);return n},integer:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.int(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.int(e.min,e.max);return n},boolean:function(t){return null!=t.eq?t.eq:x.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},n=t.properties||{};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(!0===n[r].optional&&!0===x.bool())continue;if("*"!==r)e[r]=this.generate(n[r]);else for(var i="__random_key_",o=i+0,s=x.int(1,9),a=1;a<=s;a++)o in n||(e[o]=this.generate(n[r])),o=i+a}return e},array:function(t){var e,n,r,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(c.array(o))for(r=o.length,null!=t.exactLength?r=t.exactLength:r<s?r=s:r>a&&(r=a),n=new Array(r),e=null,i=0;i<r;i++)e=o[i].type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),n[i]=this[e](o[i]);else for(r=null!=t.exactLength?t.exactLength:x.int(s,a),n=new Array(r),e=o.type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),i=0;i<r;i++)n[i]=this[e](o);return n},any:function(t){var e=Object.keys(A);return this[e[x.int(0,e.length-2)]](t)}};function _(){}i(_.prototype,A);var k=null;_.instance=function(){return k instanceof _||(k=new _),k},_.prototype.generate=function(t){var e=t.type||"any";return c.array(e)&&(e=e[x.int(0,e.length-1)]),this[e](t)};var O={};t.exports?t.exports=O:window.SchemaInspector=O,O.newSanitization=function(t,e){return new w(t,e)},O.newValidation=function(t,e){return new d(t,e)},O.Validation=d,O.Sanitization=w,O.sanitize=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new w(t,n).sanitize(e,r)},O.validate=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new d(t,n).validate(e,r)},O.generate=function(t,e){if("number"==typeof e){for(var n=new Array(e),r=0;r<e;r++)n[r]=_.instance().generate(t);return n}return _.instance().generate(t)}}()},377:(t,e,n)=>{"use strict";t.exports=n(613)},613:(t,e)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var n="";return void 0!==t&&(n+="$ORIGIN "+t),e.replace("{$origin}",n)}(t.$origin,e),e=function(t,e){var n="";return void 0!==t&&(n+="$TTL "+t),e.replace("{$ttl}",n)}(t.$ttl,e),e=function(t,e){var n=e;if(void 0!==t)for(var r in t.name=t.name||"@",t.ttl=t.ttl||"",t)n=n.replace("{"+r+"}",t[r]+"\t");return n}(t.soa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",n)}(t.ns,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",n)}(t.a,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",n)}(t.aaaa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",n)}(t.cname,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",n)}(t.mx,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",n)}(t.ptr,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tTXT\t";var a=s.txt;"string"==typeof a?n+='"'+a+'"':a instanceof Array&&(n+=a.map((function(t){return'"'+t+'"'})).join(" ")),n+="\n"}return e.replace("{txt}",n)}(t.txt,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSRV\t"+s.priority+"\t",n+=s.weight+"\t",n+=s.port+"\t",n+=s.target+"\n"}return e.replace("{srv}",n)}(t.srv,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",n)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var n=Math.round(Date.now()/1e3);return e.replace("{time}",""+n)}(t,e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tURI\t"+s.priority+"\t",n+=s.weight+"\t",n+='"'+s.target+'"\n'}return e.replace("{uri}",n)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,n={},i=r(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var m=o.toUpperCase();/\s+TXT\s+/.test(m)?(n.txt=n.txt||[],n.txt.push(h(o))):0===m.indexOf("$ORIGIN")?n.$origin=o.split(/\s+/g)[1]:0===m.indexOf("$TTL")?n.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(m)?n.soa=s(o):/\s+NS\s+/.test(m)?(n.ns=n.ns||[],n.ns.push(a(o))):/\s+A\s+/.test(m)?(n.a=n.a||[],n.a.push(c(o,n.a))):/\s+AAAA\s+/.test(m)?(n.aaaa=n.aaaa||[],n.aaaa.push(u(o))):/\s+CNAME\s+/.test(m)?(n.cname=n.cname||[],n.cname.push(f(o))):/\s+MX\s+/.test(m)?(n.mx=n.mx||[],n.mx.push(l(o))):/\s+PTR\s+/.test(m)?(n.ptr=n.ptr||[],n.ptr.push(p(o,n.ptr,n.$origin))):/\s+SRV\s+/.test(m)?(n.srv=n.srv||[],n.srv.push(d(o))):/\s+SPF\s+/.test(m)?(n.spf=n.spf||[],n.spf.push(y(o))):/\s+URI\s+/.test(m)&&(n.uri=n.uri||[],n.uri.push(g(o)))}}return n}(t=function(t){for(var e=[],n=/\([\s\S]*?\)/gim,r=n.exec(t);null!==r;){var i=r[0].replace(/\s+/gm," ");e.push({match:r,replacement:i}),r=n.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var c=a[s],u=c.match;o.splice(u.index,u[0].length,c.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,(function(t,e){return e||""}))}(t)))}function s(t){var e={},n=t.trim().split(/\s+/g),r=n.length;return e.name=n[0],e.minimum=parseInt(n[r-1],10),e.expire=parseInt(n[r-2],10),e.retry=parseInt(n[r-3],10),e.refresh=parseInt(n[r-4],10),e.serial=parseInt(n[r-5],10),e.rname=n[r-6],e.mname=n[r-7],isNaN(n[1])||(e.ttl=parseInt(n[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),n={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function c(t,e){var n=t.trim().split(/\s+/g),r=t.trim().toUpperCase().split(/\s+/g),i={name:n[0],ip:n[n.length-1]};return 0===r.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function u(t){var e=t.trim().split(/\s+/g),n={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function f(t){var e=t.trim().split(/\s+/g),n={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],preference:parseInt(e[n-2],10),host:e[n-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var n,r=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}n=r-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[r-1]);var s={name:e[0],txt:n};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function p(t,e,n){var r=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&r.unshift(e[e.length-1].name);var i={name:r[0],fullname:r[0]+"."+n,host:r[r.length-1]};return isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function d(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1],priority:parseInt(e[n-4],10),weight:parseInt(e[n-3],10),port:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function y(t){for(var e=t.trim().split(/\s+/g),n={name:e[0],data:""},r=e.length;r-- >4;)n.data=e[r]+" "+n.data.trim();return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function g(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1].replace(/"/g,""),priority:parseInt(e[n-3],10),weight:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},314:()=>{},695:()=>{},812:()=>{}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={id:t,loaded:!1,exports:{}};return n[t].call(o.exports,o,o.exports,i),o.loaded=!0,o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&n;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>n[t]));return s.default=()=>n,i.d(o,s),o},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";i.r(o),i.d(o,{BLOCKSTACK_GAIA_HUB_LABEL:()=>_n,GaiaHubConfig:()=>t.GaiaHubConfig,Storage:()=>Bn,connectToGaiaHub:()=>Fn,deleteFromGaiaHub:()=>On,getBucketUrl:()=>Un,getFullReadUrl:()=>jn,getUserAppFileUrl:()=>Nn,uploadToGaiaHub:()=>kn});var t={};i.r(t),i.d(t,{Ne:()=>_n,cc:()=>Fn,gZ:()=>On,CC:()=>In,JV:()=>Un,J$:()=>jn,d_:()=>kn});var e=i(474);const n=["debug","info","warn","error","none"],r={},s={};for(let t=0;t<n.length;t++){const e=n[t];r[e]=t,s[t]=e}class a{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return r.debug<=r[t]}}function c(t){return Number.isFinite(t)?Math.floor(1024*t*1024):0}function u(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))}function f(t,{throwIfUnavailable:e,usageDesc:n,returnEmptyObject:r}={}){let o;try{if(o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i.g)return i.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}(),o){const e=o[t];if(e)return e}}catch(e){a.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=function(t,e,n){return n?`Use of '${n}' requires \`${e}\` which is unavailable on the '${t}' object within the currently executing environment.`:`\`${e}\` is unavailable on the '${t}' object within the currently executing environment.`}(o,t.toString(),n);throw a.error(e),new Error(e)}if(r)return{}}const l=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function h(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(const n of t)e+=l[n];return e}function p(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);const e=t.length%2?`0${t}`:t,n=new Uint8Array(e.length/2);for(let t=0;t<n.length;t++){const r=2*t,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[t]=o}return n}function d(t){return(new TextEncoder).encode(t)}function y(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n}function g(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function m(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}const b={number:g,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:m,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");g(t.outputLen),g(t.blockLen)},exists:function(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")},output:function(t,e){m(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},w=("object"==typeof self&&"crypto"in self&&self.crypto,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),v=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function x(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));class E{clone(){return this._cloneInto()}}function S(t){const e=e=>t().update(x(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class A extends E{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,b.hash(t);const n=x(e);if(this.iHash=t.create(),!(this.iHash instanceof E))throw new TypeError("Expected instance of class which extends utils.Hash");const r=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const i=new Uint8Array(r);i.set(n.length>this.iHash.blockLen?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 b.exists(this),this.iHash.update(t),this}digestInto(t){b.exists(this),b.bytes(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:i,blockLen:o,outputLen:s}=this;return t.finished=r,t.destroyed=i,t.blockLen=o,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 _=(t,e,n)=>new A(t,e).update(n).digest();_.create=(t,e)=>new A(t,e);class k extends E{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=w(this.buffer)}update(t){b.exists(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=x(t)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(e,0),this.pos=0);else{const e=w(t);for(;r<=i-o;o+=r)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){b.exists(this),b.output(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let t=o;t<r;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;t.setUint32(e+c,s,r),t.setUint32(e+u,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=w(t);this.get().forEach(((t,e)=>s.setUint32(4*e,t,i)))}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:i,destroyed:o,pos:s}=this;return t.length=r,t.pos=s,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}}const O=(t,e,n)=>t&e^t&n^e&n,j=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]),T=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),F=new Uint32Array(64);class U extends k{constructor(){super(64,32,8,!1),this.A=0|T[0],this.B=0|T[1],this.C=0|T[2],this.D=0|T[3],this.E=0|T[4],this.F=0|T[5],this.G=0|T[6],this.H=0|T[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)F[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=F[t-15],n=F[t-2],r=v(e,7)^v(e,18)^e>>>3,i=v(n,17)^v(n,19)^n>>>10;F[t]=i+F[t-7]+r+F[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let t=0;t<64;t++){const e=u+(v(s,6)^v(s,11)^v(s,25))+((f=s)&a^~f&c)+j[t]+F[t]|0,l=(v(n,2)^v(n,13)^v(n,22))+O(n,r,i)|0;u=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+l|0}var f;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,i,o,s,a,c,u)}roundClean(){F.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const I=S((()=>new U));var B=i(314),N=i.t(B,2);const P=BigInt(0),$=BigInt(1),L=BigInt(2),C=BigInt(3),D=BigInt(8),H=Object.freeze({a:P,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:$,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});function R(t){const{a:e,b:n}=H,r=ct(t*t),i=ct(r*t);return ct(i+e*t+n)}const z=H.a===P;class M extends Error{constructor(t){super(t)}}class q{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof G))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new q(t.x,t.y,$)}static toAffineBatch(t){const e=function(t,e=H.P){const n=new Array(t.length),r=ft(t.reduce(((t,r,i)=>r===P?t:(n[i]=t,ct(t*r,e))),$),e);return t.reduceRight(((t,r,i)=>r===P?t:(n[i]=ct(t*n[i],e),ct(t*r,e))),r),n}(t.map((t=>t.z)));return t.map(((t,n)=>t.toAffine(e[n])))}static normalizeZ(t){return q.toAffineBatch(t).map(q.fromAffine)}equals(t){if(!(t instanceof q))throw new TypeError("JacobianPoint expected");const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=ct(r*r),c=ct(s*s),u=ct(e*c),f=ct(i*a),l=ct(ct(n*s)*c),h=ct(ct(o*r)*a);return u===f&&l===h}negate(){return new q(this.x,ct(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this,r=ct(t*t),i=ct(e*e),o=ct(i*i),s=t+i,a=ct(L*(ct(s*s)-r-o)),c=ct(C*r),u=ct(c*c),f=ct(u-L*a),l=ct(c*(a-f)-D*o),h=ct(L*e*n);return new q(f,l,h)}add(t){if(!(t instanceof q))throw new TypeError("JacobianPoint expected");const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t;if(i===P||o===P)return this;if(e===P||n===P)return t;const a=ct(r*r),c=ct(s*s),u=ct(e*c),f=ct(i*a),l=ct(ct(n*s)*c),h=ct(ct(o*r)*a),p=ct(f-u),d=ct(h-l);if(p===P)return d===P?this.double():q.ZERO;const y=ct(p*p),g=ct(p*y),m=ct(u*y),b=ct(d*d-g-L*m),w=ct(d*(m-b)-l*g),v=ct(r*s*p);return new q(b,w,v)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=q.ZERO;if("bigint"==typeof t&&t===P)return e;let n=at(t);if(n===$)return this;if(!z){let t=e,r=this;for(;n>P;)n&$&&(t=t.add(r)),r=r.double(),n>>=$;return t}let{k1neg:r,k1:i,k2neg:o,k2:s}=pt(n),a=e,c=e,u=this;for(;i>P||s>P;)i&$&&(a=a.add(u)),s&$&&(c=c.add(u)),u=u.double(),i>>=$,s>>=$;return r&&(a=a.negate()),o&&(c=c.negate()),c=new q(ct(c.x*H.beta),c.y,c.z),a.add(c)}precomputeWindow(t){const e=z?128/t+1:256/t+1,n=[];let r=this,i=r;for(let o=0;o<e;o++){i=r,n.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(t,e){!e&&this.equals(q.BASE)&&(e=G.BASE);const n=e&&e._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=e&&V.get(e);r||(r=this.precomputeWindow(n),e&&1!==n&&(r=q.normalizeZ(r),V.set(e,r)));let i=q.ZERO,o=q.ZERO;const s=1+(z?128/n:256/n),a=2**(n-1),c=BigInt(2**n-1),u=2**n,f=BigInt(n);for(let e=0;e<s;e++){const n=e*a;let s=Number(t&c);if(t>>=f,s>a&&(s-=u,t+=$),0===s){let t=r[n];e%2&&(t=t.negate()),o=o.add(t)}else{let t=r[n+Math.abs(s)-1];s<0&&(t=t.negate()),i=i.add(t)}}return{p:i,f:o}}multiply(t,e){let n,r,i=at(t);if(z){const{k1neg:t,k1:o,k2neg:s,k2:a}=pt(i);let{p:c,f:u}=this.wNAF(o,e),{p:f,f:l}=this.wNAF(a,e);t&&(c=c.negate()),s&&(f=f.negate()),f=new q(ct(f.x*H.beta),f.y,f.z),n=c.add(f),r=u.add(l)}else{const{p:t,f:o}=this.wNAF(i,e);n=t,r=o}return q.normalizeZ([n,r])[0]}toAffine(t=ft(this.z)){const{x:e,y:n,z:r}=this,i=t,o=ct(i*i),s=ct(o*i),a=ct(e*o),c=ct(n*s);if(ct(r*i)!==$)throw new Error("invZ was invalid");return new G(a,c)}}q.BASE=new q(H.Gx,H.Gy,$),q.ZERO=new q(P,$,P);const V=new WeakMap;class G{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,V.delete(this)}hasEvenY(){return this.y%L===P}static fromCompressedHex(t){const e=32===t.length,n=ot(e?t:t.subarray(1));if(!wt(n))throw new Error("Point is not on curve");let r=function(t){const{P:e}=H,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),c=t*t*t%e,u=c*c*t%e,f=ut(u,C)*u%e,l=ut(f,C)*u%e,h=ut(l,L)*c%e,p=ut(h,r)*h%e,d=ut(p,i)*p%e,y=ut(d,s)*d%e,g=ut(y,a)*y%e,m=ut(g,s)*d%e,b=ut(m,C)*u%e,w=ut(b,o)*p%e,v=ut(w,n)*c%e;return ut(v,L)}(R(n));const i=(r&$)===$;e?i&&(r=ct(-r)):1==(1&t[0])!==i&&(r=ct(-r));const o=new G(n,r);return o.assertValidity(),o}static fromUncompressedHex(t){const e=ot(t.subarray(1,33)),n=ot(t.subarray(33,65)),r=new G(e,n);return r.assertValidity(),r}static fromHex(t){const e=st(t),n=e.length,r=e[0];if(32===n||33===n&&(2===r||3===r))return this.fromCompressedHex(e);if(65===n&&4===r)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return G.BASE.multiply(xt(t))}static fromSignature(t,e,n){const r=dt(t=st(t)),{r:i,s:o}=Et(e);if(0!==n&&1!==n)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&n?"03":"02",a=G.fromHex(s+tt(i)),{n:c}=H,u=ft(i,c),f=ct(-r*u,c),l=ct(o*u,c),h=G.BASE.multiplyAndAddUnsafe(a,f,l);if(!h)throw new Error("Cannot recover signature: point at infinify");return h.assertValidity(),h}toRawBytes(t=!1){return it(this.toHex(t))}toHex(t=!1){const e=tt(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${tt(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:n}=this;if(!wt(e)||!wt(n))throw new Error(t);const r=ct(n*n);if(ct(r-R(e))!==P)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new G(this.x,ct(-this.y))}double(){return q.fromAffine(this).double().toAffine()}add(t){return q.fromAffine(this).add(q.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return q.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,n){const r=q.fromAffine(this),i=e===P||e===$||this!==G.BASE?r.multiplyUnsafe(e):r.multiply(e),o=q.fromAffine(t).multiplyUnsafe(n),s=i.add(o);return s.equals(q.ZERO)?void 0:s.toAffine()}}function K(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function J(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${Y(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:ot(n),left:t.subarray(e+2)}}G.BASE=new G(H.Gx,H.Gy),G.ZERO=new G(P,P);class W{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=e?Y(t):t;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new W(rt(r.slice(0,64)),rt(r.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${Y(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=J(t.subarray(2)),{data:r,left:i}=J(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${Y(i)}`);return{r:e,s:r}}(e?t:it(t));return new W(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!bt(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!bt(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=H.n>>$;return this.s>t}normalizeS(){return this.hasHighS()?new W(this.r,H.n-this.s):this}toDERRawBytes(t=!1){return it(this.toDERHex(t))}toDERHex(t=!1){const e=K(nt(this.s));if(t)return e;const n=K(nt(this.r)),r=nt(n.length/2),i=nt(e.length/2);return`30${nt(n.length/2+e.length/2+4)}02${r}${n}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return it(this.toCompactHex())}toCompactHex(){return tt(this.r)+tt(this.s)}}function Z(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n}const X=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Y(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=X[t[n]];return e}const Q=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function tt(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(P<=t&&t<Q))throw new Error("Expected number < 2^256");return t.toString(16).padStart(64,"0")}function et(t){const e=it(tt(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function nt(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function rt(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function it(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}function ot(t){return rt(Y(t))}function st(t){return t instanceof Uint8Array?Uint8Array.from(t):it(t)}function at(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&bt(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function ct(t,e=H.P){const n=t%e;return n>=P?n:e+n}function ut(t,e){const{P:n}=H;let r=t;for(;e-- >P;)r*=r,r%=n;return r}function ft(t,e=H.P){if(t===P||e<=P)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ct(t,e),r=e,i=P,o=$,s=$,a=P;for(;n!==P;){const t=r/n,e=r%n,c=i-s*t,u=o-a*t;r=n,n=e,i=s,o=a,s=c,a=u}if(r!==$)throw new Error("invert: does not exist");return ct(i,e)}const lt=(t,e)=>(t+e/L)/e,ht={a1:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),b1:-$*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a2:BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),b2:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),POW_2_128:BigInt("0x100000000000000000000000000000000")};function pt(t){const{n:e}=H,{a1:n,b1:r,a2:i,b2:o,POW_2_128:s}=ht,a=lt(o*t,e),c=lt(-r*t,e);let u=ct(t-a*n-c*i,e),f=ct(-a*r-c*o,e);const l=u>s,h=f>s;if(l&&(u=e-u),h&&(f=e-f),u>s||f>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:l,k1:u,k2neg:h,k2:f}}function dt(t){const{n:e}=H,n=8*t.length-256;let r=ot(t);return n>0&&(r>>=BigInt(n)),r>=e&&(r-=e),r}let yt,gt;class mt{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...t){return Ft.hmacSha256(this.k,...t)}hmacSync(...t){return gt(this.k,...t)}checkSync(){if("function"!=typeof gt)throw new M("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.checkSync(),this.incr(),this.v=this.hmacSync(this.v),this.v}}function bt(t){return P<t&&t<H.n}function wt(t){return P<t&&t<H.P}function vt(t,e,n){const r=ot(t);if(!bt(r))return;const{n:i}=H,o=G.BASE.multiply(r),s=ct(o.x,i);if(s===P)return;const a=ct(ft(r,i)*ct(e+n*s,i),i);if(a===P)return;const c=new W(s,a);return{sig:c,recovery:(o.x===c.r?0:2)|Number(o.y&$)}}function xt(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=rt(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=ot(t)}if(!bt(e))throw new Error("Expected private key: 0 < key < n");return e}function Et(t){if(t instanceof W)return t.assertValidity(),t;try{return W.fromDER(t)}catch(e){return W.fromCompact(t)}}function St(t){return ot(t.length>32?t.slice(0,32):t)}function At(t){const e=St(t),n=ct(e,H.n);return _t(n<P?e:n)}function _t(t){return et(t)}function kt(t,e,n={}){const{seed:r,m:i,d:o}=function(t,e,n){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const r=st(t),i=xt(e),o=[_t(i),At(r)];if(null!=n){!0===n&&(n=Ft.randomBytes(32));const t=st(n);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(t)}return{seed:Z(...o),m:St(r),d:i}}(t,e,n.extraEntropy);let s;const a=new mt;for(a.reseedSync(r);!(s=vt(a.generateSync(),i,o));)a.reseedSync();return function(t,e){let{sig:n,recovery:r}=t;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},e);i&&n.hasHighS()&&(n=n.normalizeS(),r^=1);const a=o?n.toDERRawBytes():n.toCompactRawBytes();return s?[a,r]:a}(s,n)}const Ot={strict:!0};G.BASE._setWindowSize(8);const jt={node:N,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},Tt={},Ft={bytesToHex:Y,hexToBytes:it,concatBytes:Z,mod:ct,invert:ft,isValidPrivateKey(t){try{return xt(t),!0}catch(t){return!1}},_bigintTo32Bytes:et,_normalizePrivateKey:xt,hashToPrivateKey:t=>{if((t=st(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return et(ct(ot(t),H.n-$)+$)},randomBytes:(t=32)=>{if(jt.web)return jt.web.getRandomValues(new Uint8Array(t));if(jt.node){const{randomBytes:e}=jt.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Ft.hashToPrivateKey(Ft.randomBytes(40)),sha256:async(...t)=>{if(jt.web){const e=await jt.web.subtle.digest("SHA-256",Z(...t));return new Uint8Array(e)}if(jt.node){const{createHash:e}=jt.node,n=e("sha256");return t.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(jt.web){const n=await jt.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=Z(...e),i=await jt.web.subtle.sign("HMAC",n,r);return new Uint8Array(i)}if(jt.node){const{createHmac:n}=jt.node,r=n("sha256",t);return e.forEach((t=>r.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...e)=>{let n=Tt[t];if(void 0===n){const e=await Ft.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));n=Z(e,e),Tt[t]=n}return Ft.sha256(n,...e)},taggedHashSync:(t,...e)=>{if("function"!=typeof yt)throw new M("sha256Sync is undefined, you need to set it");let n=Tt[t];if(void 0===n){const e=yt(Uint8Array.from(t,(t=>t.charCodeAt(0))));n=Z(e,e),Tt[t]=n}return yt(n,...e)},precompute(t=8,e=G.BASE){const n=e===G.BASE?e:new G(e.x,e.y);return n._setWindowSize(t),n.multiply(C),n}};Object.defineProperties(Ft,{sha256Sync:{configurable:!1,get:()=>yt,set(t){yt||(yt=t)}},hmacSha256Sync:{configurable:!1,get:()=>gt,set(t){gt||(gt=t)}}});var Ut,It,Bt,Nt,Pt,$t,Lt,Ct,Dt,Ht,Rt,zt,Mt,qt,Vt,Gt,Kt,Jt,Wt,Zt,Xt=i(870);(It=Ut||(Ut={}))[It.Testnet=2147483648]="Testnet",It[It.Mainnet=1]="Mainnet",Ut.Mainnet,(Ct=Bt||(Bt={}))[Ct.Address=0]="Address",Ct[Ct.Principal=1]="Principal",Ct[Ct.LengthPrefixedString=2]="LengthPrefixedString",Ct[Ct.MemoString=3]="MemoString",Ct[Ct.AssetInfo=4]="AssetInfo",Ct[Ct.PostCondition=5]="PostCondition",Ct[Ct.PublicKey=6]="PublicKey",Ct[Ct.LengthPrefixedList=7]="LengthPrefixedList",Ct[Ct.Payload=8]="Payload",Ct[Ct.MessageSignature=9]="MessageSignature",Ct[Ct.StructuredDataSignature=10]="StructuredDataSignature",Ct[Ct.TransactionAuthField=11]="TransactionAuthField",function(t){t[t.TokenTransfer=0]="TokenTransfer",t[t.SmartContract=1]="SmartContract",t[t.ContractCall=2]="ContractCall",t[t.PoisonMicroblock=3]="PoisonMicroblock",t[t.Coinbase=4]="Coinbase"}(Nt||(Nt={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(Pt||(Pt={})),(Lt=$t||($t={}))[Lt.Mainnet=0]="Mainnet",Lt[Lt.Testnet=128]="Testnet",$t.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Dt||(Dt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(Ht||(Ht={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(Rt||(Rt={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH"}(zt||(zt={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(Mt||(Mt={})),(Zt=qt||(qt={}))[Zt.Compressed=0]="Compressed",Zt[Zt.Uncompressed=1]="Uncompressed",function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(Vt||(Vt={})),function(t){t[t.DoesNotSend=16]="DoesNotSend",t[t.Sends=17]="Sends"}(Gt||(Gt={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(Kt||(Kt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(Jt||(Jt={})),function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.ServerFailureDatabase="ServerFailureDatabase",t.ServerFailureOther="ServerFailureOther"}(Wt||(Wt={}));const Yt=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Qt=Uint8Array.from({length:16},((t,e)=>e)),te=Qt.map((t=>(9*t+5)%16));let ee=[Qt],ne=[te];for(let t=0;t<4;t++)for(let e of[ee,ne])e.push(e[t].map((t=>Yt[t])));const re=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((t=>new Uint8Array(t))),ie=ee.map(((t,e)=>t.map((t=>re[e][t])))),oe=ne.map(((t,e)=>t.map((t=>re[e][t])))),se=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),ae=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),ce=(t,e)=>t<<e|t>>>32-e;function ue(t,e,n,r){return 0===t?e^n^r:1===t?e&n|~e&r:2===t?(e|~n)^r:3===t?e&r|n&~r:e^(n|~r)}const fe=new Uint32Array(16);class le extends k{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:e,h2:n,h3:r,h4:i}=this;return[t,e,n,r,i]}set(t,e,n,r,i){this.h0=0|t,this.h1=0|e,this.h2=0|n,this.h3=0|r,this.h4=0|i}process(t,e){for(let n=0;n<16;n++,e+=4)fe[n]=t.getUint32(e,!0);let n=0|this.h0,r=n,i=0|this.h1,o=i,s=0|this.h2,a=s,c=0|this.h3,u=c,f=0|this.h4,l=f;for(let t=0;t<5;t++){const e=4-t,h=se[t],p=ae[t],d=ee[t],y=ne[t],g=ie[t],m=oe[t];for(let e=0;e<16;e++){const r=ce(n+ue(t,i,s,c)+fe[d[e]]+h,g[e])+f|0;n=f,f=c,c=0|ce(s,10),s=i,i=r}for(let t=0;t<16;t++){const n=ce(r+ue(e,o,a,u)+fe[y[t]]+p,m[t])+l|0;r=l,l=u,u=0|ce(a,10),a=o,o=n}}this.set(this.h1+s+u|0,this.h2+c+l|0,this.h3+f+r|0,this.h4+n+o|0,this.h0+i+a|0)}roundClean(){fe.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const he=S((()=>new le)),pe=BigInt(2**32-1),de=BigInt(32);function ye(t,e=!1){return e?{h:Number(t&pe),l:Number(t>>de&pe)}:{h:0|Number(t>>de&pe),l:0|Number(t&pe)}}const ge=function(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=ye(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]},me=(t,e,n)=>t>>>n,be=(t,e,n)=>t<<32-n|e>>>n,we=(t,e,n)=>t>>>n|e<<32-n,ve=(t,e,n)=>t<<32-n|e>>>n,xe=(t,e,n)=>t<<64-n|e>>>n-32,Ee=(t,e,n)=>t>>>n-32|e<<64-n,Se=function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},Ae=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),_e=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,ke=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),Oe=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,je=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,Te=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),[Fe,Ue]=ge(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))),Ie=new Uint32Array(80),Be=new Uint32Array(80);class Ne extends k{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:u,Fh:f,Fl:l,Gh:h,Gl:p,Hh:d,Hl:y}=this;return[t,e,n,r,i,o,s,a,c,u,f,l,h,p,d,y]}set(t,e,n,r,i,o,s,a,c,u,f,l,h,p,d,y){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|f,this.Fl=0|l,this.Gh=0|h,this.Gl=0|p,this.Hh=0|d,this.Hl=0|y}process(t,e){for(let n=0;n<16;n++,e+=4)Ie[n]=t.getUint32(e),Be[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Ie[t-15],n=0|Be[t-15],r=we(e,n,1)^we(e,n,8)^me(e,n,7),i=ve(e,n,1)^ve(e,n,8)^be(e,n,7),o=0|Ie[t-2],s=0|Be[t-2],a=we(o,s,19)^xe(o,s,61)^me(o,s,6),c=ve(o,s,19)^Ee(o,s,61)^be(o,s,6),u=ke(i,c,Be[t-7],Be[t-16]),f=Oe(u,r,a,Ie[t-7],Ie[t-16]);Ie[t]=0|f,Be[t]=0|u}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:l,Fh:h,Fl:p,Gh:d,Gl:y,Hh:g,Hl:m}=this;for(let t=0;t<80;t++){const e=we(f,l,14)^we(f,l,18)^xe(f,l,41),b=ve(f,l,14)^ve(f,l,18)^Ee(f,l,41),w=f&h^~f&d,v=Te(m,b,l&p^~l&y,Ue[t],Be[t]),x=je(v,g,e,w,Fe[t],Ie[t]),E=0|v,S=we(n,r,28)^xe(n,r,34)^xe(n,r,39),A=ve(n,r,28)^Ee(n,r,34)^Ee(n,r,39),_=n&i^n&s^i&s,k=r&o^r&a^o&a;g=0|d,m=0|y,d=0|h,y=0|p,h=0|f,p=0|l,({h:f,l}=Se(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const O=Ae(E,A,k);n=_e(O,x,S,_),r=0|O}({h:n,l:r}=Se(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=Se(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=Se(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=Se(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l}=Se(0|this.Eh,0|this.El,0|f,0|l)),({h,l:p}=Se(0|this.Fh,0|this.Fl,0|h,0|p)),({h:d,l:y}=Se(0|this.Gh,0|this.Gl,0|d,0|y)),({h:g,l:m}=Se(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(n,r,i,o,s,a,c,u,f,l,h,p,d,y,g,m)}roundClean(){Ie.fill(0),Be.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Pe extends Ne{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class $e extends Ne{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}S((()=>new Ne)),S((()=>new Pe)),S((()=>new $e)),i(907);function Le(t,e=$t.Mainnet){t="string"==typeof t?t:h(t);var n,r,i,o;return o=(n=function(t,e){switch(t){case zt.SerializeP2PKH:switch(e){case $t.Mainnet:return Mt.MainnetSingleSig;case $t.Testnet:return Mt.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case zt.SerializeP2SH:case zt.SerializeP2WPKH:case zt.SerializeP2WSH:switch(e){case $t.Mainnet:return Mt.MainnetMultiSig;case $t.Testnet:return Mt.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}(zt.SerializeP2PKH,e),i=p(t),r=h((t=>he(I(t)))(i)),{type:Bt.Address,version:n,hash160:r}),(0,Xt.H4)(o.version,o.hash160)}function Ce(t,n=null){let r;r=n?function(t,n){const r=(0,e.decodeToken)(t),i=r.payload;if("string"==typeof i)throw new Error("Unexpected token payload type of string");if(!i.hasOwnProperty("subject")||!i.subject)throw new Error("Token doesn't have a subject");if(!i.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!i.hasOwnProperty("issuer")||!i.issuer)throw new Error("Token doesn't have an issuer");if(!i.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!i.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");const o=i.issuer.publicKey,s=Le(o);if(n===o);else if(n!==s)throw new Error("Token issuer public key does not match the verifying value");const a=new e.TokenVerifier(r.header.alg,o);if(!a)throw new Error("Invalid token verifier");if(!a.verify(t))throw new Error("Token verification failed");return r}(t,n):(0,e.decodeToken)(t);let i={};if(r.hasOwnProperty("payload")){const t=r.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(i=t.claim)}return i}function De(t,e){let n;return e.proof&&e.proof.url&&(n=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:n}}Ft.hmacSha256Sync=(t,...e)=>{const n=_.create(I,t);return e.forEach((t=>n.update(t))),n.digest()};var He=i(377),Re=i(179);i(616);const ze={referrerPolicy:"origin"};async function Me(t,e){const n={};return Object.assign(n,e,ze),await fetch(t,n)}function qe(...t){const{fetchLib:e,middlewares:n}=function(t){let e=Me,n=[];return t.length>0&&"function"==typeof t[0]&&(e=t.shift()),t.length>0&&(n=t),{fetchLib:e,middlewares:n}}(t);return async(t,r)=>{var i;let o={url:t,init:null!=r?r:{}};for(const t of n)if("function"==typeof t.pre){const n=await Promise.resolve(t.pre(Object.assign({fetch:e},o)));o=null!=n?n:o}let s=await e(o.url,o.init);for(const t of n)if("function"==typeof t.post){const n=await Promise.resolve(t.post({fetch:e,url:o.url,init:o.init,response:null!==(i=null==s?void 0:s.clone())&&void 0!==i?i:s}));s=null!=n?n:s}return s}}const Ve={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class Ge{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,n,r,i,o="ES256K",s=new Date,a=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==o)throw new Error("Signing algorithm not supported");const c=e.SECP256K1Client.derivePublicKey(n);r||(r={publicKey:c}),i||(i={publicKey:c});const f=new e.TokenSigner(o,n),l={jti:u(),iat:s.toISOString(),exp:a.toISOString(),subject:r,issuer:i,claim:t};return f.sign(l)}(this.toJSON(),t)}static validateSchema(t,e=!1){return Ve.strict=e,Re.validate(Ve,t)}static fromToken(t,e=null){const n=Ce(t,e);return new Ge(n)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const n=e.split("://")[0],r=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:`${n}://${r[0]}${`/${r.slice(1).join("/")}`}`}]};return(0,He.makeZoneFile)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const Ke={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class Je extends Ge{constructor(t={}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return Ke.strict=e,Re.validate(Ve,t)}static fromToken(t,e=null){const n=Ce(t,e);return new Je(n)}static fromLegacyFormat(t){const e=function(t){const e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});const n=[];t.avatar&&t.avatar.url&&n.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&n.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),n.length&&(e.image=n),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);const r=[];t.bitcoin&&t.bitcoin.address&&r.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&r.push(De("twitter",t.twitter)),t.facebook&&t.facebook.username&&r.push(De("facebook",t.facebook)),t.github&&t.github.username&&r.push(De("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&r.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&r.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=r}return e}(t);return new Je(e)}toJSON(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=` ${t.familyName}`)),e}(this.profile())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map((t=>"avatar"===t.name?(e=t.contentUrl,e):null)),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const n=[];return t.hasOwnProperty("account")&&e&&t.account.map((t=>{let r=!1,i=null;return e.map((e=>(e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(r=!0,i=e.proofUrl,0))))),r?(t.proofUrl=i,n.push(t),t):null})),n}(this.profile(),t)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const n=[];t.address.hasOwnProperty("streetAddress")&&n.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&n.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&n.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&n.push(t.address.addressCountry),n.length&&(e=n.join(", "))}return e}(this.profile())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let n=null;if(t.hasOwnProperty("birthDate")){const r=new Date(t.birthDate);n=`${e[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`}return n}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}var We,Ze;!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(We||(We={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(Ze||(Ze={}));const Xe=["mainnet","testnet"];class Ye{constructor(t){var e;this.version=Ze.Mainnet,this.chainId=We.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.transactionFeeEstimateEndpoint="/v2/fees/transaction",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=()=>this.version===Ze.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getTransactionFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,this.getAbiApiUrl=(t,e)=>`${this.coreApiUrl}${this.contractAbiEndpoint}/${t}/${e}`,this.getReadOnlyFunctionCallApiUrl=(t,e,n)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}/${t}/${e}/${encodeURIComponent(n)}`,this.getInfoUrl=()=>`${this.coreApiUrl}/v2/info`,this.getBlockTimeInfoUrl=()=>`${this.coreApiUrl}/extended/v1/info/network_block_times`,this.getPoxInfoUrl=()=>`${this.coreApiUrl}/v2/pox`,this.getRewardsUrl=(t,e)=>{let n=`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}`;return e&&(n=`${n}?limit=${e.limit}&offset=${e.offset}`),n},this.getRewardsTotalUrl=t=>`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}/total`,this.getRewardHoldersUrl=(t,e)=>{let n=`${this.coreApiUrl}/extended/v1/burnchain/reward_slot_holders/${t}`;return e&&(n=`${n}?limit=${e.limit}&offset=${e.offset}`),n},this.getStackerInfoUrl=(t,e)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}\n ${t}/${e}/get-stacker-info`,this.coreApiUrl=t.url,this.fetchFn=null!==(e=t.fetchFn)&&void 0!==e?e:qe()}getNameInfo(t){const e=`${this.bnsLookupUrl}/v1/names/${t}`;return this.fetchFn(e).then((t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()})).then((t=>t.address?Object.assign({},t,{address:t.address}):t))}}Ye.fromName=t=>{switch(t){case"mainnet":return new Qe;case"testnet":return new tn;default:throw new Error(`Invalid network name provided. Must be one of the following: ${Xe.join(", ")}`)}},Ye.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:Ye.fromName(t);class Qe extends Ye{constructor(t){var e;super({url:null!==(e=null==t?void 0:t.url)&&void 0!==e?e:"https://stacks-node-api.mainnet.stacks.co",fetchFn:null==t?void 0:t.fetchFn}),this.version=Ze.Mainnet,this.chainId=We.Mainnet}}class tn extends Ye{constructor(t){var e;super({url:null!==(e=null==t?void 0:t.url)&&void 0!==e?e:"https://stacks-node-api.testnet.stacks.co",fetchFn:null==t?void 0:t.fetchFn}),this.version=Ze.Testnet,this.chainId=We.Testnet}}const en={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(en);class nn extends Error{constructor(t){super();let e=t.message,n=`Error Code: ${t.code}`,r=this.stack;if(r)n+=`Stack Trace:\n${r}`;else try{throw new Error}catch(t){r=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${n}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class rn extends nn{constructor(t){const e=`Failed to verify signature: ${t}`;super({code:en.SIGNATURE_VERIFICATION_ERROR,message:e}),this.message=e,this.name="SignatureVerificationError"}}class on extends nn{constructor(t){super({code:en.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class sn extends nn{constructor(t,e){super(t),e&&(this.hubError={statusCode:e.status,statusText:e.statusText},"string"==typeof e.body?this.hubError.message=e.body:"object"==typeof e.body&&Object.assign(this.hubError,e.body))}}class an extends sn{constructor(t,e){super({message:t,code:en.DOES_NOT_EXIST},e),this.name="DoesNotExist"}}class cn extends sn{constructor(t,e){super({message:t,code:en.CONFLICT_ERROR},e),this.name="ConflictError"}}class un extends sn{constructor(t,e){super({message:t,code:en.NOT_ENOUGH_PROOF_ERROR},e),this.name="NotEnoughProofError"}}class fn extends sn{constructor(t,e){super({message:t,code:en.BAD_PATH_ERROR},e),this.name="BadPathError"}}class ln extends sn{constructor(t,e){super({message:t,code:en.VALIDATION_ERROR},e),this.name="ValidationError"}}class hn extends sn{constructor(t,e,n){super({message:t,code:en.PAYLOAD_TOO_LARGE_ERROR},e),this.name="PayloadTooLargeError",this.maxUploadByteSize=n}}class pn extends sn{constructor(t,e){super({message:t,code:en.PRECONDITION_FAILED_ERROR},e),this.name="PreconditionFailedError"}}function dn(t){const e="string"==typeof t?p(t):t;if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}var yn=i(22),gn=i.n(yn);function mn(t){return I(t)}function bn(t,e=0){var n;return function(t,e){return function(t){const e=I(I(t));return gn().encode(y(t,e).slice(0,t.length+4))}(y(new Uint8Array([t]),e.slice(0,20)))}(e,(n=mn("string"==typeof t?p(t):t),he(n)))}function wn(t){return h(function(t,e=!1){return G.fromPrivateKey(t).toRawBytes(e)}(dn(t).slice(0,32),!0))}Ft.hmacSha256Sync=(t,...e)=>{const n=_.create(I,t);return e.forEach((t=>n.update(t))),n.digest()};var vn,xn=i(766);function En(t,e,n){return function(t,e,n,r=Ot){let i;try{i=Et(t),e=st(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=dt(e);let c;try{c=function(t){return t instanceof G?(t.assertValidity(),t):G.fromHex(t)}(n)}catch(t){return!1}const{n:u}=H,f=ft(s,u),l=ct(a*f,u),h=ct(o*f,u),p=G.BASE.multiplyAndAddUnsafe(c,l,h);return!!p&&ct(p.x,u)===o}(n,mn("string"==typeof t?d(t):t),e,{strict:!1})}Ft.hmacSha256Sync=(t,...e)=>{const n=_.create(I,t);return e.forEach((t=>n.update(t))),n.digest()},function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(vn||(vn={}));const Sn=class{constructor(t,e){this.wasString="string"==typeof t,this.content=Sn.normalizeContentDataType(t,e),this.contentType=e||this.detectContentType(),this.contentByteLength=this.detectContentLength()}static normalizeContentDataType(t,e){try{if("string"==typeof t){const n=(e||"").toLowerCase().replace("-","");if(n.includes("charset")&&!n.includes("charset=utf8")&&!n.includes("charset=ascii"))throw new Error(`Unable to determine byte length with charset: ${e}`);if("undefined"!=typeof TextEncoder){const e=(new TextEncoder).encode(t);return new Uint8Array(e.buffer)}return d(t)}if(t instanceof Uint8Array)return t;if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));if("undefined"!=typeof Blob&&t instanceof Blob)return t;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return new Uint8Array(t);if(Array.isArray(t)){if(t.length>0&&(!Number.isInteger(t[0])||t[0]<0||t[0]>255))throw new Error(`Unexpected array values provided as file data: value "${t[0]}" at index 0 is not an octet number. ${this.supportedTypesMsg}`);return new Uint8Array(t)}{const e=Object.prototype.toString.call(t);throw new Error(`Unexpected type provided as file data: ${e}. ${this.supportedTypesMsg}`)}}catch(t){throw console.error(t),new Error(`Error processing data: ${t}`)}}detectContentType(){return this.wasString?"text/plain; charset=utf-8":"undefined"!=typeof Blob&&this.content instanceof Blob&&this.content.type?this.content.type:"application/octet-stream"}detectContentLength(){if(ArrayBuffer.isView(this.content)||this.content instanceof Uint8Array)return this.content.byteLength;if("undefined"!=typeof Blob&&this.content instanceof Blob)return this.content.size;const t=Object.prototype.toString.call(this.content),e=new Error(`Unexpected type "${t}" while detecting content length`);throw console.error(e),e}async loadContent(){try{if(this.content instanceof Uint8Array)return this.content;if(ArrayBuffer.isView(this.content))return new Uint8Array(this.content.buffer,this.content.byteOffset,this.content.byteLength);if("undefined"!=typeof Blob&&this.content instanceof Blob){const t=new FileReader,e=new Promise(((e,n)=>{t.onerror=t=>{n(t)},t.onload=()=>{const n=t.result;e(new Uint8Array(n))},t.readAsArrayBuffer(this.content)}));return await e}{const t=Object.prototype.toString.call(this.content);throw new Error(`Unexpected type ${t}`)}}catch(t){console.error(t);const e=new Error(`Error loading content: ${t}`);throw console.error(e),e}}load(){return void 0===this.loadedData&&(this.loadedData=this.loadContent()),this.loadedData}};let An=Sn;An.supportedTypesMsg="Supported types are: `string` (to be UTF8 encoded), `Blob`, `File`, `ArrayBuffer`, `UInt8Array` or any other typed array buffer. ";const _n="blockstack-gaia-hub-config";async function kn(t,e,n,r="application/octet-stream",i=!0,o,s,c=qe()){a.debug(`uploadToGaiaHub: uploading ${t} to ${n.server}`);const u={"Content-Type":r,Authorization:`bearer ${n.token}`};s||(i?u["If-None-Match"]="*":o&&(u["If-Match"]=o));const f=await c(`${n.server}/store/${n.address}/${t}`,{method:"POST",headers:u,body:e});if(!f.ok)throw await In(f,"Error when uploading to Gaia hub.",n);const l=await f.text();return JSON.parse(l)}async function On(t,e,n=qe()){a.debug(`deleteFromGaiaHub: deleting ${t} from ${e.server}`);const r=await n(`${e.server}/delete/${e.address}/${t}`,{method:"DELETE",headers:{Authorization:`bearer ${e.token}`}});if(!r.ok)throw await In(r,"Error deleting file from Gaia hub.",e)}function jn(t,e){return Promise.resolve(`${e.url_prefix}${e.address}/${t}`)}function Tn(t,n,r,i){const o=t.challenge_text,s=t.latest_auth_version&&parseInt(t.latest_auth_version.slice(1),10)>=1,a=wn(n);if(!s)return function(t,e){let n;try{n=JSON.parse(t)}catch(t){throw new Error("Failed in parsing legacy challenge text from the gaia hub.")}if("gaiahub"===n[0]&&"blockstack_storage_please_sign"===n[3]){const n=(r=mn(d(t)),i=function(t){const e=dn(t);return 33==e.length?e:y(e,new Uint8Array([1]))}(e),kt(r,dn(i).slice(0,32),{der:!1})),o=W.fromCompact(h(n)).toDERHex(),s=wn(e);return(0,xn.fromByteArray)(d(JSON.stringify({publickey:s,signature:o})))}var r,i;throw new Error("Failed to connect to legacy gaia hub. If you operate this hub, please update.")}(o,n);const c={gaiaChallenge:o,hubUrl:r,iss:a,salt:h(((t=32)=>Ft.randomBytes(t))(16)),associationToken:i};return`v1:${new e.TokenSigner("ES256K",n).sign(c)}`}async function Fn(t,e,n,r=qe()){a.debug(`connectToGaiaHub: ${t}/hub_info`);const i=await r(`${t}/hub_info`),o=await i.json(),s=o.read_url_prefix,c=Tn(o,e,t,n),u=bn(wn(e));return{url_prefix:s,max_file_upload_size_megabytes:o.max_file_upload_size_megabytes,address:u,token:c,server:t}}async function Un(t,e,n=qe()){const r=await n(`${t}/hub_info`),i=await r.text();return`${JSON.parse(i).read_url_prefix}${bn(wn(e))}/`}async function In(t,e,n){if(t.ok)throw new Error("Cannot get a BlockstackError from a valid response.");const r=await async function(t){let e,n="";try{n=await t.text();try{e=JSON.parse(n)}catch(t){}}catch(t){a.debug(`Error getting bad http response text: ${t}`)}return{status:t.status,statusText:t.statusText,body:e||n}}(t);if(401===r.status)return new ln(e,r);if(402===r.status)return new un(e,r);if(403===r.status)return new fn(e,r);if(404===r.status)throw new an(e,r);if(409===r.status)return new cn(e,r);if(412===r.status)return new pn(e,r);if(413===r.status){const t=n&&n.max_file_upload_size_megabytes?c(n.max_file_upload_size_megabytes):0;return new hn(e,r,t)}return new Error(e)}class Bn{constructor(t){this.userSession=t.userSession}async getFile(t,e){const n={decrypt:!0,verify:!1,app:f("location",{returnEmptyObject:!0}).origin},r=Object.assign({},n,e);if(r.verify&&!r.decrypt)return this.getFileSignedUnencrypted(t,r);const i=await this.getFileContents(t,r.app,r.username,r.zoneFileLookupURL,!!r.decrypt);if(null===i)return i;if(r.decrypt&&!r.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");if("string"==typeof r.decrypt){const t={privateKey:r.decrypt};return this.userSession.decryptContent(i,t)}return this.userSession.decryptContent(i)}if(r.decrypt&&r.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");let e;return"string"==typeof r.decrypt&&(e=r.decrypt),this.handleSignedEncryptedContents(t,i,r.app,e,r.username,r.zoneFileLookupURL)}if(r.verify||r.decrypt)throw new Error("Should be unreachable.");return i}async getUserAppFileUrl(t,e,n,r){const i=await function(t){if(!t.username)return Promise.reject(new Error("No username provided"));const e={network:new Qe},n=Object.assign(e,t),r=Ye.fromNameOrNetwork(n.network);let i;if(n.zoneFileLookupURL){const t=`${n.zoneFileLookupURL.replace(/\/$/,"")}/${n.username}`;i=r.fetchFn(t).then((t=>t.json()))}else i=r.getNameInfo(n.username);return i.then((t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return function(t,e,n=qe()){return new Promise(((r,i)=>{let o=null;try{o=(0,He.parseZoneFile)(t),o.hasOwnProperty("$origin")||(o=null)}catch(t){i(t)}let s=null;if(o&&Object.keys(o).length>0)s=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;const e=t.uri.filter((t=>t.hasOwnProperty("target")&&"_http._tcp"===t.name));if(e.length<1)return null;const n=e[0];if(!n.hasOwnProperty("target"))return null;let r=n.target;return r.startsWith("https")||r.startsWith("http")||(r=`https://${r}`),r}(o);else try{return r(Je.fromLegacyFormat(JSON.parse(t)).profile())}catch(t){return i(t)}s?n(s).then((t=>t.text())).then((t=>JSON.parse(t))).then((t=>{const n=Ce(t[0].token,e);r(n)})).catch((t=>{a.error(`resolveZoneFileToProfile: error fetching token file ${s}: ${t}`),i(t)})):(a.debug("Token file url not found. Resolving to blank profile."),r({}))}))}(t.zonefile,t.address,r.fetchFn);throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")}))}({username:e,zoneFileLookupURL:r});let o;return i.hasOwnProperty("apps")&&i.apps.hasOwnProperty(n)&&(o=`${i.apps[n].replace(/\/?(\?|#|$)/,"/$1")}${t}`),o}async getGaiaAddress(t,e,n){const r=Pn(this.userSession,{app:t,username:e,zoneFileLookupURL:n});let i;if(e)i=await this.getUserAppFileUrl("/",r.username,r.app,r.zoneFileLookupURL);else{const t=await this.getOrSetLocalGaiaHubConnection();i=await jn("/",t)}const o=i.match(/([13][a-km-zA-HJ-NP-Z0-9]{26,35})/);if(!o)throw new Error("Failed to parse gaia address");return o[o.length-1]}async getFileUrl(t,e){const n=Pn(this.userSession,e);let r;if(n.username)r=await this.getUserAppFileUrl(t,n.username,n.app,n.zoneFileLookupURL);else{const e=await this.getOrSetLocalGaiaHubConnection();r=await jn(t,e)}if(r)return r;throw new Error("Missing readURL")}async getFileContents(t,e,n,r,i,o=qe()){const s={app:e,username:n,zoneFileLookupURL:r},a=await this.getFileUrl(t,s),c=await o(a);if(!c.ok)throw await In(c,`getFile ${t} failed.`,null);let u=c.headers.get("Content-Type");"string"==typeof u&&(u=u.toLowerCase());const f=c.headers.get("ETag");if(f){const e=this.userSession.store.getSessionData();e.etags[t]=f,this.userSession.store.setSessionData(e)}return i||null===u||u.startsWith("text")||u.startsWith("application/json")?c.text():c.arrayBuffer()}async getFileSignedUnencrypted(t,e){const n=`${t}.sig`;try{const[r,i,o]=await Promise.all([this.getFileContents(t,e.app,e.username,e.zoneFileLookupURL,!1),this.getFileContents(n,e.app,e.username,e.zoneFileLookupURL,!0),this.getGaiaAddress(e.app,e.username,e.zoneFileLookupURL)]);if(!r)return r;if(!o)throw new rn(`Failed to get gaia address for verification of: ${t}`);if(!i||"string"!=typeof i)throw new rn(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`);let s,a;try{const t=JSON.parse(i);s=t.signature,a=t.publicKey}catch(e){if(e instanceof SyntaxError)throw new Error(`Failed to parse signature content JSON (path: ${t}.sig) The content may be corrupted.`);throw e}const c=bn(a);if(o!==c)throw new rn(`Signer pubkey address (${c}) doesn't match gaia address (${o})`);if(!En("string"==typeof r?d(r):new Uint8Array(r),a,s))throw new rn(`Contents do not match ECDSA signature: path: ${t}, signature: ${t}.sig`);return r}catch(e){if(e instanceof an&&e.message.indexOf(n)>=0)throw new rn(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`);throw e}}async handleSignedEncryptedContents(t,e,n,r,i,o){const s=wn(r||this.userSession.loadUserData().appPrivateKey),a=i?await this.getGaiaAddress(n,i,o):bn(s);if(!a)throw new rn(`Failed to get gaia address for verification of: ${t}`);let c;try{c=JSON.parse(e)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted, signed content JSON. The content may not be encrypted. If using getFile, try passing { verify: false, decrypt: false }."):t}const u=c.signature,f=c.publicKey,l=c.cipherText,h=bn(f);if(f&&l&&u){if(h!==a)throw new rn(`Signer pubkey address (${h}) doesn't match gaia address (${a})`);if(En(l,f,u)){if("string"==typeof r){const t={privateKey:r};return this.userSession.decryptContent(l,t)}return this.userSession.decryptContent(l)}throw new rn(`Contents do not match ECDSA signature in file: ${t}`)}throw new rn(`Failed to get signature verification data from file: ${t}`)}async putFile(t,e,n){var r,i;const o=Object.assign({},{encrypt:!0,sign:!1,cipherTextEncoding:"hex",dangerouslyIgnoreEtag:!1},n),s=await this.getOrSetLocalGaiaHubConnection(),a=c(s.max_file_upload_size_megabytes),u=a>0,f=new An(e,o.contentType);let l,p=f.contentType;if(!o.encrypt&&u&&f.contentByteLength>a){const t=`The max file upload size for this hub is ${a} bytes, the given content is ${f.contentByteLength} bytes`,e=new hn(t,null,a);throw console.error(e),e}if(o.encrypt&&u){const t=function(t){const{payloadShell:e,payloadValuesLength:n}=function(t){const e={iv:"",ephemeralPK:"",mac:"",cipherText:"",wasString:!!t.wasString};return"base64"===t.cipherTextEncoding&&(e.cipherTextEncoding="base64"),{payloadValuesLength:162,payloadShell:JSON.stringify(e)}}(t),r=(i=t.contentLength,16*(Math.floor(i/16)+1));var i;let o;if(t.cipherTextEncoding&&"hex"!==t.cipherTextEncoding){if("base64"!==t.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${t.cipherTextEncoding}"`);o=function(t){return 4*Math.ceil(t/3)}(r)}else o=2*r;if(t.sign){const{signedPayloadShell:t,signedPayloadValuesLength:r}=function(t){const e={signature:"",publicKey:"",cipherText:t};return{signedPayloadValuesLength:210,signedPayloadShell:JSON.stringify(e)}}(e);return t.length+r+n+o}return e.length+n+o}({contentLength:f.contentByteLength,wasString:f.wasString,sign:!!o.sign,cipherTextEncoding:o.cipherTextEncoding});if(t>a){const e=new hn(`The max file upload size for this hub is ${a} bytes, the given content is ${t} bytes after encryption`,null,a);throw console.error(e),e}}let y=!0;const g=this.userSession.store.getSessionData();let m;if(o.dangerouslyIgnoreEtag||(null==(r=g.etags)?void 0:r[t])&&(y=!1,l=null==(i=g.etags)?void 0:i[t]),!o.encrypt&&o.sign){const e=await f.load();let n;n="string"==typeof o.sign?o.sign:this.userSession.loadUserData().appPrivateKey;const r=function(t,e){const n="string"==typeof e?d(e):e,r=wn(t);return{signature:h(kt(mn(n),t)),publicKey:r}}(n,e),i=JSON.stringify(r);m=async n=>{const r=(await Promise.all([kn(t,e,n,p,y,l,o.dangerouslyIgnoreEtag),kn(`${t}.sig`,i,n,"application/json")]))[0];return!o.dangerouslyIgnoreEtag&&r.etag&&(g.etags[t]=r.etag,this.userSession.store.setSessionData(g)),r.publicURL}}else{let e;if(o.encrypt||o.sign){let t;t="string"==typeof o.encrypt?o.encrypt:"string"==typeof o.sign?wn(o.sign):wn(this.userSession.loadUserData().appPrivateKey);const n=await f.load();e=await this.userSession.encryptContent(n,{publicKey:t,wasString:f.wasString,cipherTextEncoding:o.cipherTextEncoding,sign:o.sign}),p="application/json"}else e=f.content;m=async n=>{const r=await kn(t,e,n,p,y,l,o.dangerouslyIgnoreEtag);return r.etag&&(g.etags[t]=r.etag,this.userSession.store.setSessionData(g)),r.publicURL}}try{return await m(s)}catch(t){if(function(t){if(!t||!t.hubError||!t.hubError.statusCode)return!1;const e=t.hubError.statusCode;return 401===e||(409===e||e>=500&&e<=599)}(t)){console.error(t),console.error("Possible recoverable error during Gaia upload, retrying...");const e=await this.setLocalGaiaHubConnection();return await m(e)}throw t}}async deleteFile(t,e){const n=await this.getOrSetLocalGaiaHubConnection();if(Object.assign({},e).wasSigned)try{await On(t,n),await On(`${t}.sig`,n);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const r=await this.setLocalGaiaHubConnection();await On(t,r),await On(`${t}.sig`,n);const i=this.userSession.store.getSessionData();delete i.etags[t],this.userSession.store.setSessionData(i)}else try{await On(t,n);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const n=await this.setLocalGaiaHubConnection();await On(t,n);const r=this.userSession.store.getSessionData();delete r.etags[t],this.userSession.store.setSessionData(r)}}getAppBucketUrl(t,e){return Un(t,e)}async listFilesLoop(t,e,n,r,i,o=qe()){if(n>65536)throw new Error("Too many entries to list");let s;t=t||await this.getOrSetLocalGaiaHubConnection();try{const n=JSON.stringify({page:e}),r={method:"POST",headers:{"Content-Type":"application/json","Content-Length":`${n.length}`,Authorization:`bearer ${t.token}`},body:n};if(s=await o(`${t.server}/list-files/${t.address}`,r),!s.ok)throw await In(s,"ListFiles failed.",t)}catch(t){if(0===n){const t=await this.setLocalGaiaHubConnection();return this.listFilesLoop(t,e,n+1,0,i)}throw t}const a=await s.text(),c=JSON.parse(a),u=c.entries,f=c.page;if(null==u)throw new Error("Bad listFiles response: no entries");let l=0;for(let t=0;t<u.length;t++)if(null!==u[t]&&(l++,!i(u[t])))return r+t;return f&&u.length>0?this.listFilesLoop(t,f,n+1,r+l,i):r+l}listFiles(t){return this.listFilesLoop(null,null,0,0,t)}async getOrSetLocalGaiaHubConnection(){const t=this.userSession.store.getSessionData().userData;if(!t)throw new on("Missing userData");const e=t.gaiaHubConfig;return e?Promise.resolve(e):this.setLocalGaiaHubConnection()}async setLocalGaiaHubConnection(){const t=this.userSession.loadUserData();if(!t)throw new on("Missing userData");t.hubUrl||(t.hubUrl="https://hub.blockstack.org");const e=await Fn(t.hubUrl,t.appPrivateKey,t.gaiaAssociationToken);t.gaiaHubConfig=e;const n=this.userSession.store.getSessionData();return n.userData.gaiaHubConfig=e,this.userSession.store.setSessionData(n),e}}function Nn(t){return new Bn({}).getUserAppFileUrl(t.path,t.username,t.appOrigin,t.zoneFileLookupURL)}function Pn(t,e){var n;const r=Object.assign({},e);if(r.username){if(!r.app){if(!t.appConfig)throw new on("Missing AppConfig");r.app=t.appConfig.appDomain}if(!r.zoneFileLookupURL){if(!t.appConfig)throw new on("Missing AppConfig");if(!t.store)throw new on("Missing store UserSession");const e=(null==(n=t.store.getSessionData().userData)?void 0:n.coreNode)||t.appConfig.coreNode;e&&(r.zoneFileLookupURL=`${e}/v1/names`)}}return r}})(),o})()));
|
|
3
3
|
//# sourceMappingURL=index.js.map
|