@onekeyfe/hd-web-sdk 0.3.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +0,0 @@
1
- /*! For license information please see iframe.d52c39c0a861b73374d7.js.LICENSE.txt */
2
- (()=>{var __webpack_modules__={3525:(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function i(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function n(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){n(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=r,t.bool=i,t.bytes=n,t.hash=s,t.exists=o,t.output=a;const u={number:r,bool:i,bytes:n,hash:s,exists:o,output:a};t.default=u},2686:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLAKE2=t.SIGMA=void 0;const i=r(3525),n=r(64);t.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class s extends n.Hash{constructor(e,t,r={},s,o,a){if(super(),this.blockLen=e,this.outputLen=t,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,i.default.number(e),i.default.number(t),i.default.number(s),t<0||t>s)throw new Error("Blake2: outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>s))throw new Error(`Key should be up 1..${s} byte long or undefined`);if(void 0!==r.salt&&r.salt.length!==o)throw new Error(`Salt should be ${o} byte long or undefined`);if(void 0!==r.personalization&&r.personalization.length!==a)throw new Error(`Personalization should be ${a} byte long or undefined`);this.buffer32=(0,n.u32)(this.buffer=new Uint8Array(e))}update(e){i.default.exists(this);const{blockLen:t,buffer:r,buffer32:s}=this,o=(e=(0,n.toBytes)(e)).length;for(let i=0;i<o;){this.pos===t&&(this.compress(s,0,!1),this.pos=0);const n=Math.min(t-this.pos,o-i),a=e.byteOffset+i;if(n!==t||a%4||!(i+n<o))r.set(e.subarray(i,i+n),this.pos),this.pos+=n,this.length+=n,i+=n;else{const r=new Uint32Array(e.buffer,a,Math.floor((o-i)/4));for(let e=0;i+t<o;e+=s.length,i+=t)this.length+=t,this.compress(r,e,!1)}}return this}digestInto(e){i.default.exists(this),i.default.output(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,this.buffer.subarray(t).fill(0),this.compress(r,0,!0);const s=(0,n.u32)(e);this.get().forEach(((e,t)=>s[t]=e))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:i,destroyed:n,outputLen:s,pos:o}=this;return e||(e=new this.constructor({dkLen:s})),e.set(...this.get()),e.length=r,e.finished=i,e.destroyed=n,e.outputLen=s,e.buffer.set(t),e.pos=o,e}}t.BLAKE2=s},9350:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const i=r(3525),n=r(64);class s extends n.Hash{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,n.createView)(this.buffer)}update(e){i.default.exists(this);const{view:t,buffer:r,blockLen:s}=this,o=(e=(0,n.toBytes)(e)).length;for(let i=0;i<o;){const a=Math.min(s-this.pos,o-i);if(a!==s)r.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(t,0),this.pos=0);else{const t=(0,n.createView)(e);for(;s<=o-i;i+=s)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){i.default.exists(this),i.default.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:o}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(r,0),a=0);for(let e=a;e<s;e++)t[e]=0;!function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),u=i?4:0,d=i?0:4;e.setUint32(t+u,o,i),e.setUint32(t+d,a,i)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);const u=(0,n.createView)(e);this.get().forEach(((e,t)=>u.setUint32(4*t,e,o)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}t.SHA2=s},1655:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),i=BigInt(32);function n(e,t=!1){return t?{h:Number(e&r),l:Number(e>>i&r)}:{h:0|Number(e>>i&r),l:0|Number(e&r)}}function s(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:a}=n(e[s],t);[r[s],i[s]]=[o,a]}return[r,i]}function o(e,t,r,i){const n=(t>>>0)+(i>>>0);return{h:e+r+(n/2**32|0)|0,l:0|n}}t.fromBig=n,t.split=s,t.toBig=(e,t)=>BigInt(e>>>0)<<i|BigInt(t>>>0),t.add=o;const a={fromBig:n,split:s,toBig:t.toBig,shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:o,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/2**32|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/2**32|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/2**32|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)};t.default=a},3806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake2b=void 0;const i=r(2686),n=r(1655),s=r(64),o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),a=new Uint32Array(32);function u(e,t,r,i,s,o){const u=s[o],d=s[o+1];let l=a[2*e],c=a[2*e+1],h=a[2*t],f=a[2*t+1],p=a[2*r],y=a[2*r+1],g=a[2*i],m=a[2*i+1],v=n.default.add3L(l,h,u);c=n.default.add3H(v,c,f,d),l=0|v,({Dh:m,Dl:g}={Dh:m^c,Dl:g^l}),({Dh:m,Dl:g}={Dh:n.default.rotr32H(m,g),Dl:n.default.rotr32L(m,g)}),({h:y,l:p}=n.default.add(y,p,m,g)),({Bh:f,Bl:h}={Bh:f^y,Bl:h^p}),({Bh:f,Bl:h}={Bh:n.default.rotrSH(f,h,24),Bl:n.default.rotrSL(f,h,24)}),a[2*e]=l,a[2*e+1]=c,a[2*t]=h,a[2*t+1]=f,a[2*r]=p,a[2*r+1]=y,a[2*i]=g,a[2*i+1]=m}function d(e,t,r,i,s,o){const u=s[o],d=s[o+1];let l=a[2*e],c=a[2*e+1],h=a[2*t],f=a[2*t+1],p=a[2*r],y=a[2*r+1],g=a[2*i],m=a[2*i+1],v=n.default.add3L(l,h,u);c=n.default.add3H(v,c,f,d),l=0|v,({Dh:m,Dl:g}={Dh:m^c,Dl:g^l}),({Dh:m,Dl:g}={Dh:n.default.rotrSH(m,g,16),Dl:n.default.rotrSL(m,g,16)}),({h:y,l:p}=n.default.add(y,p,m,g)),({Bh:f,Bl:h}={Bh:f^y,Bl:h^p}),({Bh:f,Bl:h}={Bh:n.default.rotrBH(f,h,63),Bl:n.default.rotrBL(f,h,63)}),a[2*e]=l,a[2*e+1]=c,a[2*t]=h,a[2*t+1]=f,a[2*r]=p,a[2*r+1]=y,a[2*i]=g,a[2*i+1]=m}class l extends i.BLAKE2{constructor(e={}){super(128,void 0===e.dkLen?64:e.dkLen,e,64,16,16),this.v0l=0|o[0],this.v0h=0|o[1],this.v1l=0|o[2],this.v1h=0|o[3],this.v2l=0|o[4],this.v2h=0|o[5],this.v3l=0|o[6],this.v3h=0|o[7],this.v4l=0|o[8],this.v4h=0|o[9],this.v5l=0|o[10],this.v5h=0|o[11],this.v6l=0|o[12],this.v6h=0|o[13],this.v7l=0|o[14],this.v7h=0|o[15];const t=e.key?e.key.length:0;if(this.v0l^=this.outputLen|t<<8|65536|1<<24,e.salt){const t=(0,s.u32)((0,s.toBytes)(e.salt));this.v4l^=t[0],this.v4h^=t[1],this.v5l^=t[2],this.v5h^=t[3]}if(e.personalization){const t=(0,s.u32)((0,s.toBytes)(e.personalization));this.v6l^=t[0],this.v6h^=t[1],this.v7l^=t[2],this.v7h^=t[3]}if(e.key){const t=new Uint8Array(this.blockLen);t.set((0,s.toBytes)(e.key)),this.update(t)}}get(){let{v0l:e,v0h:t,v1l:r,v1h:i,v2l:n,v2h:s,v3l:o,v3h:a,v4l:u,v4h:d,v5l:l,v5h:c,v6l:h,v6h:f,v7l:p,v7h:y}=this;return[e,t,r,i,n,s,o,a,u,d,l,c,h,f,p,y]}set(e,t,r,i,n,s,o,a,u,d,l,c,h,f,p,y){this.v0l=0|e,this.v0h=0|t,this.v1l=0|r,this.v1h=0|i,this.v2l=0|n,this.v2h=0|s,this.v3l=0|o,this.v3h=0|a,this.v4l=0|u,this.v4h=0|d,this.v5l=0|l,this.v5h=0|c,this.v6l=0|h,this.v6h=0|f,this.v7l=0|p,this.v7h=0|y}compress(e,t,r){this.get().forEach(((e,t)=>a[t]=e)),a.set(o,16);let{h:s,l}=n.default.fromBig(BigInt(this.length));a[24]=o[8]^l,a[25]=o[9]^s,r&&(a[28]=~a[28],a[29]=~a[29]);let c=0;const h=i.SIGMA;for(let r=0;r<12;r++)u(0,4,8,12,e,t+2*h[c++]),d(0,4,8,12,e,t+2*h[c++]),u(1,5,9,13,e,t+2*h[c++]),d(1,5,9,13,e,t+2*h[c++]),u(2,6,10,14,e,t+2*h[c++]),d(2,6,10,14,e,t+2*h[c++]),u(3,7,11,15,e,t+2*h[c++]),d(3,7,11,15,e,t+2*h[c++]),u(0,5,10,15,e,t+2*h[c++]),d(0,5,10,15,e,t+2*h[c++]),u(1,6,11,12,e,t+2*h[c++]),d(1,6,11,12,e,t+2*h[c++]),u(2,7,8,13,e,t+2*h[c++]),d(2,7,8,13,e,t+2*h[c++]),u(3,4,9,14,e,t+2*h[c++]),d(3,4,9,14,e,t+2*h[c++]);this.v0l^=a[0]^a[16],this.v0h^=a[1]^a[17],this.v1l^=a[2]^a[18],this.v1h^=a[3]^a[19],this.v2l^=a[4]^a[20],this.v2h^=a[5]^a[21],this.v3l^=a[6]^a[22],this.v3h^=a[7]^a[23],this.v4l^=a[8]^a[24],this.v4h^=a[9]^a[25],this.v5l^=a[10]^a[26],this.v5h^=a[11]^a[27],this.v6l^=a[12]^a[28],this.v6h^=a[13]^a[29],this.v7l^=a[14]^a[30],this.v7h^=a[15]^a[31],a.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.blake2b=(0,s.wrapConstructorWithOpts)((e=>new l(e)))},9467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake2s=t.compress=t.IV=void 0;const i=r(2686),n=r(1655),s=r(64);function o(e,t,r,i,n){return e=e+t+n|0,r=r+(i=(0,s.rotr)(i^e,16))|0,{a:e,b:t=(0,s.rotr)(t^r,12),c:r,d:i}}function a(e,t,r,i,n){return e=e+t+n|0,r=r+(i=(0,s.rotr)(i^e,8))|0,{a:e,b:t=(0,s.rotr)(t^r,7),c:r,d:i}}function u(e,t,r,i,n,s,u,d,l,c,h,f,p,y,g,m,v,b,_,w){let E=0;for(let S=0;S<i;S++)({a:n,b:l,c:p,d:v}=o(n,l,p,v,r[t+e[E++]])),({a:n,b:l,c:p,d:v}=a(n,l,p,v,r[t+e[E++]])),({a:s,b:c,c:y,d:b}=o(s,c,y,b,r[t+e[E++]])),({a:s,b:c,c:y,d:b}=a(s,c,y,b,r[t+e[E++]])),({a:u,b:h,c:g,d:_}=o(u,h,g,_,r[t+e[E++]])),({a:u,b:h,c:g,d:_}=a(u,h,g,_,r[t+e[E++]])),({a:d,b:f,c:m,d:w}=o(d,f,m,w,r[t+e[E++]])),({a:d,b:f,c:m,d:w}=a(d,f,m,w,r[t+e[E++]])),({a:n,b:c,c:g,d:w}=o(n,c,g,w,r[t+e[E++]])),({a:n,b:c,c:g,d:w}=a(n,c,g,w,r[t+e[E++]])),({a:s,b:h,c:m,d:v}=o(s,h,m,v,r[t+e[E++]])),({a:s,b:h,c:m,d:v}=a(s,h,m,v,r[t+e[E++]])),({a:u,b:f,c:p,d:b}=o(u,f,p,b,r[t+e[E++]])),({a:u,b:f,c:p,d:b}=a(u,f,p,b,r[t+e[E++]])),({a:d,b:l,c:y,d:_}=o(d,l,y,_,r[t+e[E++]])),({a:d,b:l,c:y,d:_}=a(d,l,y,_,r[t+e[E++]]));return{v0:n,v1:s,v2:u,v3:d,v4:l,v5:c,v6:h,v7:f,v8:p,v9:y,v10:g,v11:m,v12:v,v13:b,v14:_,v15:w}}t.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.compress=u;class d extends i.BLAKE2{constructor(e={}){super(64,void 0===e.dkLen?32:e.dkLen,e,32,8,8),this.v0=0|t.IV[0],this.v1=0|t.IV[1],this.v2=0|t.IV[2],this.v3=0|t.IV[3],this.v4=0|t.IV[4],this.v5=0|t.IV[5],this.v6=0|t.IV[6],this.v7=0|t.IV[7];const r=e.key?e.key.length:0;if(this.v0^=this.outputLen|r<<8|65536|1<<24,e.salt){const t=(0,s.u32)((0,s.toBytes)(e.salt));this.v4^=t[0],this.v5^=t[1]}if(e.personalization){const t=(0,s.u32)((0,s.toBytes)(e.personalization));this.v6^=t[0],this.v7^=t[1]}if(e.key){const t=new Uint8Array(this.blockLen);t.set((0,s.toBytes)(e.key)),this.update(t)}}get(){const{v0:e,v1:t,v2:r,v3:i,v4:n,v5:s,v6:o,v7:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.v0=0|e,this.v1=0|t,this.v2=0|r,this.v3=0|i,this.v4=0|n,this.v5=0|s,this.v6=0|o,this.v7=0|a}compress(e,r,s){const{h:o,l:a}=n.default.fromBig(BigInt(this.length)),{v0:d,v1:l,v2:c,v3:h,v4:f,v5:p,v6:y,v7:g,v8:m,v9:v,v10:b,v11:_,v12:w,v13:E,v14:S,v15:T}=u(i.SIGMA,r,e,10,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,t.IV[0],t.IV[1],t.IV[2],t.IV[3],a^t.IV[4],o^t.IV[5],s?~t.IV[6]:t.IV[6],t.IV[7]);this.v0^=d^m,this.v1^=l^v,this.v2^=c^b,this.v3^=h^_,this.v4^=f^w,this.v5^=p^E,this.v6^=y^S,this.v7^=g^T}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}}t.blake2s=(0,s.wrapConstructorWithOpts)((e=>new d(e)))},4661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},6053:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const i=r(9350),n=r(64),s=(e,t,r)=>e&t^e&r^t&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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class d extends i.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:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=u[e-15],r=u[e-2],i=(0,n.rotr)(t,7)^(0,n.rotr)(t,18)^t>>>3,s=(0,n.rotr)(r,17)^(0,n.rotr)(r,19)^r>>>10;u[e]=s+u[e-7]+i+u[e-16]|0}let{A:r,B:i,C:a,D:d,E:l,F:c,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,n.rotr)(l,6)^(0,n.rotr)(l,11)^(0,n.rotr)(l,25))+((p=l)&c^~p&h)+o[e]+u[e]|0,y=((0,n.rotr)(r,2)^(0,n.rotr)(r,13)^(0,n.rotr)(r,22))+s(r,i,a)|0;f=h,h=c,c=l,l=d+t|0,d=a,a=i,i=r,r=t+y|0}var p;r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,d=d+this.D|0,l=l+this.E|0,c=c+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,i,a,d,l,c,h,f)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.sha256=(0,n.wrapConstructor)((()=>new d))},125:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shake256=t.shake128=t.keccak_512=t.keccak_384=t.keccak_256=t.keccak_224=t.sha3_512=t.sha3_384=t.sha3_256=t.sha3_224=t.Keccak=t.keccakP=void 0;const i=r(3525),n=r(1655),s=r(64),[o,a,u]=[[],[],[]],d=BigInt(0),l=BigInt(1),c=BigInt(2),h=BigInt(7),f=BigInt(256),p=BigInt(113);for(let e=0,t=l,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],o.push(2*(5*i+r)),a.push((e+1)*(e+2)/2%64);let n=d;for(let e=0;e<7;e++)t=(t<<l^(t>>h)*p)%f,t&c&&(n^=l<<(l<<BigInt(e))-l);u.push(n)}const[y,g]=n.default.split(u,!0),m=(e,t,r)=>r>32?n.default.rotlBH(e,t,r):n.default.rotlSH(e,t,r),v=(e,t,r)=>r>32?n.default.rotlBL(e,t,r):n.default.rotlSL(e,t,r);function b(e,t=24){const r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=m(s,o,1)^r[i],u=v(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=u}let t=e[2],n=e[3];for(let r=0;r<24;r++){const i=a[r],s=m(t,n,i),u=v(t,n,i),d=o[r];t=e[d],n=e[d+1],e[d]=s,e[d+1]=u}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=y[i],e[1]^=g[i]}r.fill(0)}t.keccakP=b;class _ extends s.Hash{constructor(e,t,r,n=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,i.default.number(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,s.u32)(this.state)}keccak(){b(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){i.default.exists(this);const{blockLen:t,state:r}=this,n=(e=(0,s.toBytes)(e)).length;for(let i=0;i<n;){const s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,0!=(128&t)&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){i.default.exists(this,!1),i.default.bytes(e),this.finish();const t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return i.default.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(i.default.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new _(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}t.Keccak=_;const w=(e,t,r)=>(0,s.wrapConstructor)((()=>new _(t,e,r)));t.sha3_224=w(6,144,28),t.sha3_256=w(6,136,32),t.sha3_384=w(6,104,48),t.sha3_512=w(6,72,64),t.keccak_224=w(1,144,28),t.keccak_256=w(1,136,32),t.keccak_384=w(1,104,48),t.keccak_512=w(1,72,64);const E=(e,t,r)=>(0,s.wrapConstructorWithOpts)(((i={})=>new _(t,e,void 0===i.dkLen?r:i.dkLen,!0)));t.shake128=E(31,168,16),t.shake256=E(31,136,32)},64:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const i=r(4661);if(t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function s(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}function o(e){if("string"==typeof e&&(e=s(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}t.bytesToHex=function(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=n[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const i=2*r,n=e.slice(i,i+2),s=Number.parseInt(n,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t},t.nextTick=async()=>{},t.asyncLoop=async function(e,r,i){let n=Date.now();for(let s=0;s<e;s++){i(s);const e=Date.now()-n;e>=0&&e<r||(await(0,t.nextTick)(),n+=e)}},t.utf8ToBytes=s,t.toBytes=o,t.concatBytes=function(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r},t.Hash=class{clone(){return this._cloneInto()}},t.checkOpts=function(e,t){if(void 0!==t&&("object"!=typeof t||(r=t,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new TypeError("Options should be object or undefined");var r;return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(o(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(o(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(i.crypto.web)return i.crypto.web.getRandomValues(new Uint8Array(e));if(i.crypto.node)return new Uint8Array(i.crypto.node.randomBytes(e).buffer);throw new Error("The environment doesn't have randomBytes function")}},7408:(e,t,r)=>{"use strict";var i,n=r(6139).Promise,s="object"==typeof Reflect?Reflect:null,o=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,e.exports.once=function(e,t){return new n((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,n)}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var d=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function h(e,t,r,i){var n,s,o,a;if(l(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=c(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function y(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):m(n,n.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function v(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");d=e}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var d=u.length,l=m(u,d);for(r=0;r<d;++r)o(l[r],this,t)}return!0},u.prototype.addListener=function(e,t){return h(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return h(this,e,t,!0)},u.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},u.prototype.removeListener=function(e,t){var r,i,n,s,o;if(l(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},u.prototype.listeners=function(e){return y(this,e,!0)},u.prototype.rawListeners=function(e){return y(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},u.prototype.listenerCount=g,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},6781:(e,t,r)=>{"use strict";var i=r(6139).Promise;e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,s=2,o=!0;s<arguments.length;)r[n++]=arguments[s++];return new i((function(i,s){r[n]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,s(e))}}))}},7026:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),n=new Array(123),s=0;s<64;)n[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,r){for(var n,s=null,o=[],a=0,u=0;t<r;){var d=e[t++];switch(u){case 0:o[a++]=i[d>>2],n=(3&d)<<4,u=1;break;case 1:o[a++]=i[n|d>>4],n=(15&d)<<2,u=2;break;case 2:o[a++]=i[n|d>>6],o[a++]=i[63&d],u=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return u&&(o[a++]=i[n],o[a++]=61,1===u&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";r.decode=function(e,t,r){for(var i,s=r,a=0,u=0;u<e.length;){var d=e.charCodeAt(u++);if(61===d&&a>1)break;if(void 0===(d=n[d]))throw Error(o);switch(a){case 0:i=d,a=1;break;case 1:t[r++]=i<<2|(48&d)>>4,i=d,a=2;break;case 2:t[r++]=(15&i)<<4|(60&d)>>2,i=d,a=3;break;case 3:t[r++]=(3&i)<<6|d,a=0}}if(1===a)throw Error(o);return r-s},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},1706:e=>{"use strict";function t(e,r){"string"==typeof e&&(r=e,e=void 0);var i=[];function n(e){if("string"!=typeof e){var r=s();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var o=Object.keys(e),a=new Array(o.length+1),u=new Array(o.length),d=0;d<o.length;)a[d]=o[d],u[d]=e[o[d++]];return a[d]=r,Function.apply(null,a).apply(null,u)}return Function(r)()}for(var l=new Array(arguments.length-1),c=0;c<l.length;)l[c]=arguments[++c];if(c=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=l[c++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),c!==l.length)throw Error("parameter count mismatch");return i.push(e),n}function s(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+i.join("\n ")+"\n}"}return n.toString=s,n}e.exports=t,t.verbose=!1},5570:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],i=0;i<r.length;)r[i].fn===t?r.splice(i,1):++i;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,r)}return this}},4641:(e,t,r)=>{"use strict";e.exports=s;var i=r(6781),n=r(6116)("fs");function s(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&n&&n.readFile?n.readFile(e,(function(i,n){return i&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,r):i?r(i):r(null,t.binary?n:n.toString("utf8"))})):s.xhr(e,t,r):i(s,this,e,t)}s.xhr=function(e,t,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4===i.readyState){if(0!==i.status&&200!==i.status)return r(Error("status "+i.status));if(t.binary){var e=i.response;if(!e){e=[];for(var n=0;n<i.responseText.length;++n)e.push(255&i.responseText.charCodeAt(n))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,i.responseText)}},t.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}},5298:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),i=128===r[3];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3]}function s(e,i,n){t[0]=e,i[n]=r[3],i[n+1]=r[2],i[n+2]=r[1],i[n+3]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],t[0]}function a(e,i){return r[3]=e[i],r[2]=e[i+1],r[1]=e[i+2],r[0]=e[i+3],t[0]}e.writeFloatLE=i?n:s,e.writeFloatBE=i?s:n,e.readFloatLE=i?o:a,e.readFloatBE=i?a:o}():function(){function t(e,t,r,i){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,r,i);else if(isNaN(t))e(2143289344,r,i);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,r,i);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,r,i);else{var s=Math.floor(Math.log(t)/Math.LN2);e((n<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,i)}}function o(e,t,r){var i=e(t,r),n=2*(i>>31)+1,s=i>>>23&255,o=8388607&i;return 255===s?o?NaN:n*(1/0):0===s?1401298464324817e-60*n*o:n*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,i),e.readFloatLE=o.bind(null,n),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),i=128===r[7];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3],i[n+4]=r[4],i[n+5]=r[5],i[n+6]=r[6],i[n+7]=r[7]}function s(e,i,n){t[0]=e,i[n]=r[7],i[n+1]=r[6],i[n+2]=r[5],i[n+3]=r[4],i[n+4]=r[3],i[n+5]=r[2],i[n+6]=r[1],i[n+7]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],r[4]=e[i+4],r[5]=e[i+5],r[6]=e[i+6],r[7]=e[i+7],t[0]}function a(e,i){return r[7]=e[i],r[6]=e[i+1],r[5]=e[i+2],r[4]=e[i+3],r[3]=e[i+4],r[2]=e[i+5],r[1]=e[i+6],r[0]=e[i+7],t[0]}e.writeDoubleLE=i?n:s,e.writeDoubleBE=i?s:n,e.readDoubleLE=i?o:a,e.readDoubleBE=i?a:o}():function(){function t(e,t,r,i,n,s){var o=i<0?1:0;if(o&&(i=-i),0===i)e(0,n,s+t),e(1/i>0?0:2147483648,n,s+r);else if(isNaN(i))e(0,n,s+t),e(2146959360,n,s+r);else if(i>17976931348623157e292)e(0,n,s+t),e((o<<31|2146435072)>>>0,n,s+r);else{var a;if(i<22250738585072014e-324)e((a=i/5e-324)>>>0,n,s+t),e((o<<31|a/4294967296)>>>0,n,s+r);else{var u=Math.floor(Math.log(i)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(a=i*Math.pow(2,-u))>>>0,n,s+t),e((o<<31|u+1023<<20|1048576*a&1048575)>>>0,n,s+r)}}}function o(e,t,r,i,n){var s=e(i,n+t),o=e(i,n+r),a=2*(o>>31)+1,u=o>>>20&2047,d=4294967296*(1048575&o)+s;return 2047===u?d?NaN:a*(1/0):0===u?5e-324*a*d:a*Math.pow(2,u-1075)*(d+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,i,4,0),e.readDoubleLE=o.bind(null,n,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function i(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},6116:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},2659:(e,t)=>{"use strict";var r=t,i=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=i(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return n+t.join("/")};r.resolve=function(e,t,r){return r||(t=n(t)),i(t)?t:(r||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}},804:e=>{"use strict";e.exports=function(e,t,r){var i=r||8192,n=i>>>1,s=null,o=i;return function(r){if(r<1||r>n)return e(r);o+r>i&&(s=e(i),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},7958:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,i=0;i<e.length;++i)(r=e.charCodeAt(i))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var i,n=null,s=[],o=0;t<r;)(i=e[t++])<128?s[o++]=i:i>191&&i<224?s[o++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(i>>10),s[o++]=56320+(1023&i)):s[o++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0);return n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))},r.write=function(e,t,r){for(var i,n,s=r,o=0;o<e.length;++o)(i=e.charCodeAt(o))<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&56320==(64512&(n=e.charCodeAt(o+1)))?(i=65536+((1023&i)<<10)+(1023&n),++o,t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128);return r-s}},1696:(e,t,r)=>{"use strict";var i=r(4406),n=r(6139).Promise;function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}var o,a,u=r(7515).codes,d=u.ERR_AMBIGUOUS_ARGUMENT,l=u.ERR_INVALID_ARG_TYPE,c=u.ERR_INVALID_ARG_VALUE,h=u.ERR_INVALID_RETURN_VALUE,f=u.ERR_MISSING_ARGS,p=r(4082),y=r(3335).inspect,g=r(3335).types,m=g.isPromise,v=g.isRegExp,b=Object.assign?Object.assign:r(4956).assign,_=Object.is?Object.is:r(4679);function w(){var e=r(6796);o=e.isDeepEqual,a=e.isDeepStrictEqual}new Map;var E=!1,S=e.exports=R,T={};function A(e){if(e.message instanceof Error)throw e.message;throw new p(e)}function M(e,t,r,i){if(!r){var n=!1;if(0===t)n=!0,i="No value argument passed to `assert.ok()`";else if(i instanceof Error)throw i;var s=new p({actual:r,expected:!0,message:i,operator:"==",stackStartFn:e});throw s.generatedMessage=n,s}}function R(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];M.apply(void 0,[R,t.length].concat(t))}S.fail=function e(t,r,n,s,o){var a,u=arguments.length;if(0===u)a="Failed";else if(1===u)n=t,t=void 0;else{if(!1===E){E=!0;var d=i.emitWarning?i.emitWarning:console.warn.bind(console);d("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}2===u&&(s="!=")}if(n instanceof Error)throw n;var l={actual:t,expected:r,operator:void 0===s?"fail":s,stackStartFn:o||e};void 0!==n&&(l.message=n);var c=new p(l);throw a&&(c.message=a,c.generatedMessage=!0),c},S.AssertionError=p,S.ok=R,S.equal=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");t!=r&&A({actual:t,expected:r,message:i,operator:"==",stackStartFn:e})},S.notEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");t==r&&A({actual:t,expected:r,message:i,operator:"!=",stackStartFn:e})},S.deepEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");void 0===o&&w(),o(t,r)||A({actual:t,expected:r,message:i,operator:"deepEqual",stackStartFn:e})},S.notDeepEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");void 0===o&&w(),o(t,r)&&A({actual:t,expected:r,message:i,operator:"notDeepEqual",stackStartFn:e})},S.deepStrictEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");void 0===o&&w(),a(t,r)||A({actual:t,expected:r,message:i,operator:"deepStrictEqual",stackStartFn:e})},S.notDeepStrictEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");void 0===o&&w(),a(t,r)&&A({actual:t,expected:r,message:i,operator:"notDeepStrictEqual",stackStartFn:e})},S.strictEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");_(t,r)||A({actual:t,expected:r,message:i,operator:"strictEqual",stackStartFn:e})},S.notStrictEqual=function e(t,r,i){if(arguments.length<2)throw new f("actual","expected");_(t,r)&&A({actual:t,expected:r,message:i,operator:"notStrictEqual",stackStartFn:e})};var x=function e(t,r,i){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r.forEach((function(e){e in t&&(void 0!==i&&"string"==typeof i[e]&&v(t[e])&&t[e].test(i[e])?n[e]=i[e]:n[e]=t[e])}))};function k(e,t,r,i,n,s){if(!(r in e)||!a(e[r],t[r])){if(!i){var o=new x(e,n),u=new x(t,n,e),d=new p({actual:o,expected:u,operator:"deepStrictEqual",stackStartFn:s});throw d.actual=e,d.expected=t,d.operator=s.name,d}A({actual:e,expected:t,message:i,operator:s.name,stackStartFn:s})}}function O(e,t,r,i){if("function"!=typeof t){if(v(t))return t.test(e);if(2===arguments.length)throw new l("expected",["Function","RegExp"],t);if("object"!==s(e)||null===e){var n=new p({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:i});throw n.operator=i.name,n}var a=Object.keys(t);if(t instanceof Error)a.push("name","message");else if(0===a.length)throw new c("error",t,"may not be an empty object");return void 0===o&&w(),a.forEach((function(n){"string"==typeof e[n]&&v(t[n])&&t[n].test(e[n])||k(e,t,n,r,a,i)})),!0}return void 0!==t.prototype&&e instanceof t||!Error.isPrototypeOf(t)&&!0===t.call({},e)}function I(e){if("function"!=typeof e)throw new l("fn","Function",e);try{e()}catch(e){return e}return T}function C(e){return m(e)||null!==e&&"object"===s(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function P(e){return n.resolve().then((function(){var t;if("function"==typeof e){if(!C(t=e()))throw new h("instance of Promise","promiseFn",t)}else{if(!C(e))throw new l("promiseFn",["Function","Promise"],e);t=e}return n.resolve().then((function(){return t})).then((function(){return T})).catch((function(e){return e}))}))}function N(e,t,r,i){if("string"==typeof r){if(4===arguments.length)throw new l("error",["Object","Error","Function","RegExp"],r);if("object"===s(t)&&null!==t){if(t.message===r)throw new d("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new d("error/message",'The error "'.concat(t,'" is identical to the message.'));i=r,r=void 0}else if(null!=r&&"object"!==s(r)&&"function"!=typeof r)throw new l("error",["Object","Error","Function","RegExp"],r);if(t===T){var n="";r&&r.name&&(n+=" (".concat(r.name,")")),n+=i?": ".concat(i):".";var o="rejects"===e.name?"rejection":"exception";A({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(o).concat(n),stackStartFn:e})}if(r&&!O(t,r,i,e))throw t}function D(e,t,r,i){if(t!==T){if("string"==typeof r&&(i=r,r=void 0),!r||O(t,r)){var n=i?": ".concat(i):".",s="doesNotReject"===e.name?"rejection":"exception";A({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(s).concat(n,"\n")+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}function B(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];M.apply(void 0,[B,t.length].concat(t))}S.throws=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];N.apply(void 0,[e,I(t)].concat(i))},S.rejects=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return P(t).then((function(t){return N.apply(void 0,[e,t].concat(i))}))},S.doesNotThrow=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];D.apply(void 0,[e,I(t)].concat(i))},S.doesNotReject=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return P(t).then((function(t){return D.apply(void 0,[e,t].concat(i))}))},S.ifError=function e(t){if(null!=t){var r="ifError got unwanted exception: ";"object"===s(t)&&"string"==typeof t.message?0===t.message.length&&t.constructor?r+=t.constructor.name:r+=t.message:r+=y(t);var i=new p({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),n=t.stack;if("string"==typeof n){var o=n.split("\n");o.shift();for(var a=i.stack.split("\n"),u=0;u<o.length;u++){var d=a.indexOf(o[u]);if(-1!==d){a=a.slice(0,d);break}}i.stack="".concat(a.join("\n"),"\n").concat(o.join("\n"))}throw i}},S.strict=b(B,S,{equal:S.strictEqual,deepEqual:S.deepStrictEqual,notEqual:S.notStrictEqual,notDeepEqual:S.notDeepStrictEqual}),S.strict.strict=S.strict},4082:(e,t,r)=>{"use strict";var i=r(4406);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?a(e):t}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e){var t="function"==typeof Map?new Map:void 0;return u=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return l(e,arguments,h(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),c(i,e)},u(e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function l(e,t,r){return l=d()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var n=new(Function.bind.apply(e,i));return r&&c(n,r.prototype),n},l.apply(null,arguments)}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}var p=r(3335).inspect,y=r(7515).codes.ERR_INVALID_ARG_TYPE;function g(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}var m="",v="",b="",_="",w={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function E(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){r[t]=e[t]})),Object.defineProperty(r,"message",{value:e.message}),r}function S(e){return p(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var T=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),"object"!==f(e)||null===e)throw new y("options","Object",e);var n=e.message,s=e.operator,u=e.stackStartFn,d=e.actual,l=e.expected,c=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=n)r=o(this,h(t).call(this,String(n)));else if(i.stderr&&i.stderr.isTTY&&(i.stderr&&i.stderr.getColorDepth&&1!==i.stderr.getColorDepth()?(m="",v="",_="",b=""):(m="",v="",_="",b="")),"object"===f(d)&&null!==d&&"object"===f(l)&&null!==l&&"stack"in d&&d instanceof Error&&"stack"in l&&l instanceof Error&&(d=E(d),l=E(l)),"deepStrictEqual"===s||"strictEqual"===s)r=o(this,h(t).call(this,function(e,t,r){var n="",s="",o=0,a="",u=!1,d=S(e),l=d.split("\n"),c=S(t).split("\n"),h=0,p="";if("strictEqual"===r&&"object"===f(e)&&"object"===f(t)&&null!==e&&null!==t&&(r="strictEqualObject"),1===l.length&&1===c.length&&l[0]!==c[0]){var y=l[0].length+c[0].length;if(y<=10){if(!("object"===f(e)&&null!==e||"object"===f(t)&&null!==t||0===e&&0===t))return"".concat(w[r],"\n\n")+"".concat(l[0]," !== ").concat(c[0],"\n")}else if("strictEqualObject"!==r&&y<(i.stderr&&i.stderr.isTTY?i.stderr.columns:80)){for(;l[0][h]===c[0][h];)h++;h>2&&(p="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,r-e.length)}(" ",h),"^"),h=0)}}for(var E=l[l.length-1],T=c[c.length-1];E===T&&(h++<2?a="\n ".concat(E).concat(a):n=E,l.pop(),c.pop(),0!==l.length&&0!==c.length);)E=l[l.length-1],T=c[c.length-1];var A=Math.max(l.length,c.length);if(0===A){var M=d.split("\n");if(M.length>30)for(M[26]="".concat(m,"...").concat(_);M.length>27;)M.pop();return"".concat(w.notIdentical,"\n\n").concat(M.join("\n"),"\n")}h>3&&(a="\n".concat(m,"...").concat(_).concat(a),u=!0),""!==n&&(a="\n ".concat(n).concat(a),n="");var R=0,x=w[r]+"\n".concat(v,"+ actual").concat(_," ").concat(b,"- expected").concat(_),k=" ".concat(m,"...").concat(_," Lines skipped");for(h=0;h<A;h++){var O=h-o;if(l.length<h+1)O>1&&h>2&&(O>4?(s+="\n".concat(m,"...").concat(_),u=!0):O>3&&(s+="\n ".concat(c[h-2]),R++),s+="\n ".concat(c[h-1]),R++),o=h,n+="\n".concat(b,"-").concat(_," ").concat(c[h]),R++;else if(c.length<h+1)O>1&&h>2&&(O>4?(s+="\n".concat(m,"...").concat(_),u=!0):O>3&&(s+="\n ".concat(l[h-2]),R++),s+="\n ".concat(l[h-1]),R++),o=h,s+="\n".concat(v,"+").concat(_," ").concat(l[h]),R++;else{var I=c[h],C=l[h],P=C!==I&&(!g(C,",")||C.slice(0,-1)!==I);P&&g(I,",")&&I.slice(0,-1)===C&&(P=!1,C+=","),P?(O>1&&h>2&&(O>4?(s+="\n".concat(m,"...").concat(_),u=!0):O>3&&(s+="\n ".concat(l[h-2]),R++),s+="\n ".concat(l[h-1]),R++),o=h,s+="\n".concat(v,"+").concat(_," ").concat(C),n+="\n".concat(b,"-").concat(_," ").concat(I),R+=2):(s+=n,n="",1!==O&&0!==h||(s+="\n ".concat(C),R++))}if(R>20&&h<A-2)return"".concat(x).concat(k,"\n").concat(s,"\n").concat(m,"...").concat(_).concat(n,"\n")+"".concat(m,"...").concat(_)}return"".concat(x).concat(u?k:"","\n").concat(s).concat(n).concat(a).concat(p)}(d,l,s)));else if("notDeepStrictEqual"===s||"notStrictEqual"===s){var p=w[s],T=S(d).split("\n");if("notStrictEqual"===s&&"object"===f(d)&&null!==d&&(p=w.notStrictEqualObject),T.length>30)for(T[26]="".concat(m,"...").concat(_);T.length>27;)T.pop();r=1===T.length?o(this,h(t).call(this,"".concat(p," ").concat(T[0]))):o(this,h(t).call(this,"".concat(p,"\n\n").concat(T.join("\n"),"\n")))}else{var A=S(d),M="",R=w[s];"notDeepEqual"===s||"notEqual"===s?(A="".concat(w[s],"\n\n").concat(A)).length>1024&&(A="".concat(A.slice(0,1021),"...")):(M="".concat(S(l)),A.length>512&&(A="".concat(A.slice(0,509),"...")),M.length>512&&(M="".concat(M.slice(0,509),"...")),"deepEqual"===s||"equal"===s?A="".concat(R,"\n\n").concat(A,"\n\nshould equal\n\n"):M=" ".concat(s," ").concat(M)),r=o(this,h(t).call(this,"".concat(A).concat(M)))}return Error.stackTraceLimit=c,r.generatedMessage=!n,Object.defineProperty(a(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=d,r.expected=l,r.operator=s,Error.captureStackTrace&&Error.captureStackTrace(a(r),u),r.stack,r.name="AssertionError",o(r)}var r,u;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,e),r=t,u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:p.custom,value:function(e,t){return p(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),i.forEach((function(t){n(e,t,r[t])}))}return e}({},t,{customInspect:!1,depth:0}))}}],u&&s(r.prototype,u),t}(u(Error));e.exports=T},7515:(e,t,r)=>{"use strict";function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}var o,a,u={};function d(e,t,r){r||(r=Error);var o=function(r){function o(r,s,a){var u;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),u=function(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,n(o).call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,s,a))),u.code=e,u}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(o,r),o}(r);u[e]=o}function l(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}d("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),d("ERR_INVALID_ARG_TYPE",(function(e,t,n){var s,a,u,d,c;if(void 0===o&&(o=r(1696)),o("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(a="not ",t.substr(0,a.length)===a)?(s="must not be",t=t.replace(/^not /,"")):s="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))u="The ".concat(e," ").concat(s," ").concat(l(t,"type"));else{var h=("number"!=typeof c&&(c=0),c+".".length>(d=e).length||-1===d.indexOf(".",c)?"argument":"property");u='The "'.concat(e,'" ').concat(h," ").concat(s," ").concat(l(t,"type"))}return u+". Received type ".concat(i(n))}),TypeError),d("ERR_INVALID_ARG_VALUE",(function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===a&&(a=r(3335));var n=a.inspect(t);return n.length>128&&(n="".concat(n.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(i,". Received ").concat(n)}),TypeError,RangeError),d("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var n;return n=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(i(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(n,".")}),TypeError),d("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];void 0===o&&(o=r(1696)),o(t.length>0,"At least one arg needs to be specified");var n="The ",s=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),s){case 1:n+="".concat(t[0]," argument");break;case 2:n+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:n+=t.slice(0,s-1).join(", "),n+=", and ".concat(t[s-1]," arguments")}return"".concat(n," must be specified")}),TypeError),e.exports.codes=u},6796:(e,t,r)=>{"use strict";function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw s}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var s=void 0!==/a/g.flags,o=function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t},a=function(e){var t=[];return e.forEach((function(e,r){return t.push([r,e])})),t},u=Object.is?Object.is:r(4679),d=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},l=Number.isNaN?Number.isNaN:r(4782);function c(e){return e.call.bind(e)}var h=c(Object.prototype.hasOwnProperty),f=c(Object.prototype.propertyIsEnumerable),p=c(Object.prototype.toString),y=r(3335).types,g=y.isAnyArrayBuffer,m=y.isArrayBufferView,v=y.isDate,b=y.isMap,_=y.isRegExp,w=y.isSet,E=y.isNativeError,S=y.isBoxedPrimitive,T=y.isNumberObject,A=y.isStringObject,M=y.isBooleanObject,R=y.isBigIntObject,x=y.isSymbolObject,k=y.isFloat32Array,O=y.isFloat64Array;function I(e){if(0===e.length||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function C(e){return Object.keys(e).filter(I).concat(d(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function P(e,t){if(e===t)return 0;for(var r=e.length,i=t.length,n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0}function N(e,t,r,i){if(e===t)return 0!==e||!r||u(e,t);if(r){if("object"!==n(e))return"number"==typeof e&&l(e)&&l(t);if("object"!==n(t)||null===e||null===t)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(null===e||"object"!==n(e))return(null===t||"object"!==n(t))&&e==t;if(null===t||"object"!==n(t))return!1}var o,a,d,c,h=p(e);if(h!==p(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var f=C(e),y=C(t);return f.length===y.length&&B(e,t,r,i,1,f)}if("[object Object]"===h&&(!b(e)&&b(t)||!w(e)&&w(t)))return!1;if(v(e)){if(!v(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(_(e)){if(!_(t)||(d=e,c=t,!(s?d.source===c.source&&d.flags===c.flags:RegExp.prototype.toString.call(d)===RegExp.prototype.toString.call(c))))return!1}else if(E(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else{if(m(e)){if(r||!k(e)&&!O(e)){if(!function(e,t){return e.byteLength===t.byteLength&&0===P(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}(e,t))return!1}else if(!function(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(e,t))return!1;var I=C(e),N=C(t);return I.length===N.length&&B(e,t,r,i,0,I)}if(w(e))return!(!w(t)||e.size!==t.size)&&B(e,t,r,i,2);if(b(e))return!(!b(t)||e.size!==t.size)&&B(e,t,r,i,3);if(g(e)){if(a=t,(o=e).byteLength!==a.byteLength||0!==P(new Uint8Array(o),new Uint8Array(a)))return!1}else if(S(e)&&!function(e,t){return T(e)?T(t)&&u(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):A(e)?A(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):M(e)?M(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):R(e)?R(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):x(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}(e,t))return!1}return B(e,t,r,i,0)}function D(e,t){return t.filter((function(t){return f(e,t)}))}function B(e,t,r,i,n,s){if(5===arguments.length){s=Object.keys(e);var o=Object.keys(t);if(s.length!==o.length)return!1}for(var a=0;a<s.length;a++)if(!h(t,s[a]))return!1;if(r&&5===arguments.length){var u=d(e);if(0!==u.length){var l=0;for(a=0;a<u.length;a++){var c=u[a];if(f(e,c)){if(!f(t,c))return!1;s.push(c),l++}else if(f(t,c))return!1}var p=d(t);if(u.length!==p.length&&D(t,p).length!==l)return!1}else{var y=d(t);if(0!==y.length&&0!==D(t,y).length)return!1}}if(0===s.length&&(0===n||1===n&&0===e.length||0===e.size))return!0;if(void 0===i)i={val1:new Map,val2:new Map,position:0};else{var g=i.val1.get(e);if(void 0!==g){var m=i.val2.get(t);if(void 0!==m)return g===m}i.position++}i.val1.set(e,i.position),i.val2.set(t,i.position);var v=z(e,t,r,s,i,n);return i.val1.delete(e),i.val2.delete(t),v}function q(e,t,r,i){for(var n=o(e),s=0;s<n.length;s++){var a=n[s];if(N(t,a,r,i))return e.delete(a),!0}return!1}function L(e){switch(n(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(l(e))return!1}return!0}function j(e,t,r){var i=L(r);return null!=i?i:t.has(i)&&!e.has(i)}function F(e,t,r,i,n){var s=L(r);if(null!=s)return s;var o=t.get(s);return!(void 0===o&&!t.has(s)||!N(i,o,!1,n))&&!e.has(s)&&N(i,o,!1,n)}function U(e,t,r,i,n,s){for(var a=o(e),u=0;u<a.length;u++){var d=a[u];if(N(r,d,n,s)&&N(i,t.get(d),n,s))return e.delete(d),!0}return!1}function z(e,t,r,s,u,d){var l=0;if(2===d){if(!function(e,t,r,i){for(var s=null,a=o(e),u=0;u<a.length;u++){var d=a[u];if("object"===n(d)&&null!==d)null===s&&(s=new Set),s.add(d);else if(!t.has(d)){if(r)return!1;if(!j(e,t,d))return!1;null===s&&(s=new Set),s.add(d)}}if(null!==s){for(var l=o(t),c=0;c<l.length;c++){var h=l[c];if("object"===n(h)&&null!==h){if(!q(s,h,r,i))return!1}else if(!r&&!e.has(h)&&!q(s,h,r,i))return!1}return 0===s.size}return!0}(e,t,r,u))return!1}else if(3===d){if(!function(e,t,r,s){for(var o=null,u=a(e),d=0;d<u.length;d++){var l=i(u[d],2),c=l[0],h=l[1];if("object"===n(c)&&null!==c)null===o&&(o=new Set),o.add(c);else{var f=t.get(c);if(void 0===f&&!t.has(c)||!N(h,f,r,s)){if(r)return!1;if(!F(e,t,c,h,s))return!1;null===o&&(o=new Set),o.add(c)}}}if(null!==o){for(var p=a(t),y=0;y<p.length;y++){var g=i(p[y],2),m=(c=g[0],g[1]);if("object"===n(c)&&null!==c){if(!U(o,e,c,m,r,s))return!1}else if(!(r||e.has(c)&&N(e.get(c),m,!1,s)||U(o,e,c,m,!1,s)))return!1}return 0===o.size}return!0}(e,t,r,u))return!1}else if(1===d)for(;l<e.length;l++){if(!h(e,l)){if(h(t,l))return!1;for(var c=Object.keys(e);l<c.length;l++){var f=c[l];if(!h(t,f)||!N(e[f],t[f],r,u))return!1}return c.length===Object.keys(t).length}if(!h(t,l)||!N(e[l],t[l],r,u))return!1}for(l=0;l<s.length;l++){var p=s[l];if(!N(e[p],t[p],r,u))return!1}return!0}e.exports={isDeepEqual:function(e,t){return N(e,t,!1)},isDeepStrictEqual:function(e,t){return N(e,t,!0)}}},9644:(e,t,r)=>{e.exports=r(5644)},353:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(3044),s=r(6955),o=r(2233),a=r(8030),u=r(7948),d=r(1875),l=r(842),c=r(8560),h=r(1218),f=r(8047),p=r(738);e.exports=function(e){return new i((function(t,r){var i,y=e.data,g=e.headers,m=e.responseType;function v(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}n.isFormData(y)&&n.isStandardBrowserEnv()&&delete g["Content-Type"];var b=new XMLHttpRequest;if(e.auth){var _=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(_+":"+w)}var E=u(e.baseURL,e.url);function S(){if(b){var i="getAllResponseHeaders"in b?d(b.getAllResponseHeaders()):null,n={data:m&&"text"!==m&&"json"!==m?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:i,config:e,request:b};s((function(e){t(e),v()}),(function(e){r(e),v()}),n),b=null}}if(b.open(e.method.toUpperCase(),a(E,e.params,e.paramsSerializer),!0),b.timeout=e.timeout,"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(S)},b.onabort=function(){b&&(r(new h("Request aborted",h.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new h("Network Error",h.ERR_NETWORK,e,b,b)),b=null},b.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",i=e.transitional||c;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new h(t,i.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,e,b)),b=null},n.isStandardBrowserEnv()){var T=(e.withCredentials||l(E))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;T&&(g[e.xsrfHeaderName]=T)}"setRequestHeader"in b&&n.forEach(g,(function(e,t){void 0===y&&"content-type"===t.toLowerCase()?delete g[t]:b.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(b.withCredentials=!!e.withCredentials),m&&"json"!==m&&(b.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&b.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(i=function(e){b&&(r(!e||e&&e.type?new f:e),b.abort(),b=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i))),y||(y=null);var A=p(E);A&&-1===["http","https","file"].indexOf(A)?r(new h("Unsupported protocol "+A+":",h.ERR_BAD_REQUEST,e)):b.send(y)}))}},5644:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(3044),s=r(3644),o=r(2215),a=r(2937),u=function e(t){var r=new o(t),i=s(o.prototype.request,r);return n.extend(i,o.prototype,r),n.extend(i,r),i.create=function(r){return e(a(t,r))},i}(r(663));u.Axios=o,u.CanceledError=r(8047),u.CancelToken=r(4089),u.isCancel=r(8041),u.VERSION=r(9241).version,u.toFormData=r(9027),u.AxiosError=r(1218),u.Cancel=u.CanceledError,u.all=function(e){return i.all(e)},u.spread=r(783),u.isAxiosError=r(5587),e.exports=u,e.exports.default=u},4089:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(8047);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new i((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,i=r._listeners.length;for(t=0;t<i;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new i((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},8047:(e,t,r)=>{"use strict";var i=r(1218);function n(e){i.call(this,null==e?"canceled":e,i.ERR_CANCELED),this.name="CanceledError"}r(3044).inherits(n,i,{__CANCEL__:!0}),e.exports=n},8041:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},2215:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(3044),s=r(8030),o=r(946),a=r(6895),u=r(2937),d=r(7948),l=r(7525),c=l.validators;function h(e){this.defaults=e,this.interceptors={request:new o,response:new o}}h.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=u(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&l.assertOptions(r,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,d=[];if(this.interceptors.response.forEach((function(e){d.push(e.fulfilled,e.rejected)})),!s){var h=[a,void 0];for(Array.prototype.unshift.apply(h,n),h=h.concat(d),o=i.resolve(t);h.length;)o=o.then(h.shift(),h.shift());return o}for(var f=t;n.length;){var p=n.shift(),y=n.shift();try{f=p(f)}catch(e){y(e);break}}try{o=a(f)}catch(e){return i.reject(e)}for(;d.length;)o=o.then(d.shift(),d.shift());return o},h.prototype.getUri=function(e){e=u(this.defaults,e);var t=d(e.baseURL,e.url);return s(t,e.params,e.paramsSerializer)},n.forEach(["delete","get","head","options"],(function(e){h.prototype[e]=function(t,r){return this.request(u(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(u(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}h.prototype[e]=t(),h.prototype[e+"Form"]=t(!0)})),e.exports=h},1218:(e,t,r)=>{"use strict";var i=r(3044);function n(e,t,r,i,n){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}i.inherits(n,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var s=n.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){o[e]={value:e}})),Object.defineProperties(n,o),Object.defineProperty(s,"isAxiosError",{value:!0}),n.from=function(e,t,r,o,a,u){var d=Object.create(s);return i.toFlatObject(e,d,(function(e){return e!==Error.prototype})),n.call(d,e.message,t,r,o,a),d.name=e.name,u&&Object.assign(d,u),d},e.exports=n},946:(e,t,r)=>{"use strict";var i=r(3044);function n(){this.handlers=[]}n.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},7948:(e,t,r)=>{"use strict";var i=r(9192),n=r(8762);e.exports=function(e,t){return e&&!i(t)?n(e,t):t}},6895:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(3044),s=r(8556),o=r(8041),a=r(663),u=r(8047);function d(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new u}e.exports=function(e){return d(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return d(e),t.data=s.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(d(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,e.transformResponse))),i.reject(t)}))}},2937:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){t=t||{};var r={};function n(e,t){return i.isPlainObject(e)&&i.isPlainObject(t)?i.merge(e,t):i.isPlainObject(t)?i.merge({},t):i.isArray(t)?t.slice():t}function s(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!i.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function u(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var d={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return i.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=d[e]||s,n=t(e);i.isUndefined(n)&&t!==u||(r[e]=n)})),r}},6955:(e,t,r)=>{"use strict";var i=r(1218);e.exports=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new i("Request failed with status code "+r.status,[i.ERR_BAD_REQUEST,i.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}},8556:(e,t,r)=>{"use strict";var i=r(3044),n=r(663);e.exports=function(e,t,r){var s=this||n;return i.forEach(r,(function(r){e=r.call(s,e,t)})),e}},663:(e,t,r)=>{"use strict";var i=r(4406),n=r(3044),s=r(8868),o=r(1218),a=r(8560),u=r(9027),d={"Content-Type":"application/x-www-form-urlencoded"};function l(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,h={transitional:a,adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==i&&"[object process]"===Object.prototype.toString.call(i))&&(c=r(353)),c),transformRequest:[function(e,t){if(s(t,"Accept"),s(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e))return e;if(n.isArrayBufferView(e))return e.buffer;if(n.isURLSearchParams(e))return l(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,i=n.isObject(e),o=t&&t["Content-Type"];if((r=n.isFileList(e))||i&&"multipart/form-data"===o){var a=this.env&&this.env.FormData;return u(r?{"files[]":e}:e,a&&new a)}return i||"application/json"===o?(l(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||h.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||i&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o.from(e,o.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:r(4684)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){h.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){h.headers[e]=n.merge(d)})),e.exports=h},8560:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},9241:e=>{e.exports={version:"0.27.2"}},3644:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return e.apply(t,r)}}},8030:(e,t,r)=>{"use strict";var i=r(3044);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(i.isURLSearchParams(t))s=t.toString();else{var o=[];i.forEach(t,(function(e,t){null!=e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,(function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),o.push(n(t)+"="+n(e))})))})),s=o.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},8762:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},2233:(e,t,r)=>{"use strict";var i=r(3044);e.exports=i.isStandardBrowserEnv()?{write:function(e,t,r,n,s,o){var a=[];a.push(e+"="+encodeURIComponent(t)),i.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),i.isString(n)&&a.push("path="+n),i.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9192:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},5587:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e){return i.isObject(e)&&!0===e.isAxiosError}},842:(e,t,r)=>{"use strict";var i=r(3044);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var i=e;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=i.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},8868:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){i.forEach(e,(function(r,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[i])}))}},4684:e=>{e.exports=null},1875:(e,t,r)=>{"use strict";var i=r(3044),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,o={};return e?(i.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=i.trim(e.substr(0,s)).toLowerCase(),r=i.trim(e.substr(s+1)),t){if(o[t]&&n.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o}},738:e=>{"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},783:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},9027:(e,t,r)=>{"use strict";var i=r(8834).Buffer,n=r(3044);e.exports=function(e,t){t=t||new FormData;var r=[];function s(e){return null===e?"":n.isDate(e)?e.toISOString():n.isArrayBuffer(e)||n.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):i.from(e):e}return function e(i,o){if(n.isPlainObject(i)||n.isArray(i)){if(-1!==r.indexOf(i))throw Error("Circular reference detected in "+o);r.push(i),n.forEach(i,(function(r,i){if(!n.isUndefined(r)){var a,u=o?o+"."+i:i;if(r&&!o&&"object"==typeof r)if(n.endsWith(i,"{}"))r=JSON.stringify(r);else if(n.endsWith(i,"[]")&&(a=n.toArray(r)))return void a.forEach((function(e){!n.isUndefined(e)&&t.append(u,s(e))}));e(r,u)}})),r.pop()}else t.append(o,s(i))}(e),t}},7525:(e,t,r)=>{"use strict";var i=r(9241).version,n=r(1218),s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};s.transitional=function(e,t,r){function s(e,t){return"[Axios v"+i+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,a){if(!1===e)throw new n(s(i," has been removed"+(t?" in "+t:"")),n.ERR_DEPRECATED);return t&&!o[i]&&(o[i]=!0,console.warn(s(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new n("options must be an object",n.ERR_BAD_OPTION_VALUE);for(var i=Object.keys(e),s=i.length;s-- >0;){var o=i[s],a=t[o];if(a){var u=e[o],d=void 0===u||a(u,o,e);if(!0!==d)throw new n("option "+o+" must be "+d,n.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new n("Unknown option "+o,n.ERR_BAD_OPTION)}},validators:s}},3044:(e,t,r)=>{"use strict";var i,n=r(3644),s=Object.prototype.toString,o=(i=Object.create(null),function(e){var t=s.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function u(e){return Array.isArray(e)}function d(e){return void 0===e}var l=a("ArrayBuffer");function c(e){return null!==e&&"object"==typeof e}function h(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var f=a("Date"),p=a("File"),y=a("Blob"),g=a("FileList");function m(e){return"[object Function]"===s.call(e)}var v=a("URLSearchParams");function b(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),u(e))for(var r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}var _,w=(_="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return _&&e instanceof _});e.exports={isArray:u,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||s.call(e)===t||m(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:h,isUndefined:d,isDate:f,isFile:p,isBlob:y,isFunction:m,isStream:function(e){return c(e)&&m(e.pipe)},isURLSearchParams:v,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:b,merge:function e(){var t={};function r(r,i){h(t[i])&&h(r)?t[i]=e(t[i],r):h(r)?t[i]=e({},r):u(r)?t[i]=r.slice():t[i]=r}for(var i=0,n=arguments.length;i<n;i++)b(arguments[i],r);return t},extend:function(e,t,r){return b(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,i){e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var i,n,s,o={};t=t||{};do{for(n=(i=Object.getOwnPropertyNames(e)).length;n-- >0;)o[s=i[n]]||(t[s]=e[s],o[s]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var i=e.indexOf(t,r);return-1!==i&&i===r},toArray:function(e){if(!e)return null;var t=e.length;if(d(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:w,isFileList:g}},5514:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(8834).Buffer,s=r(7699),o=r(1464),a=r(9644),u=r(9396),d=r(6391),l=r(64),c=r(9467),h=r(1780),f=r(6053),p=r(1297),y=r(125),g=r(7346),m=r(3806),v=r(8834);function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=b(s),w=b(a),E=b(u),S=b(d),T=b(p);var A,M={exports:{}},R="object"==typeof Reflect?Reflect:null,x=R&&"function"==typeof R.apply?R.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};A=R&&"function"==typeof R.ownKeys?R.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var k=Number.isNaN||function(e){return e!=e};function O(){O.init.call(this)}M.exports=O,M.exports.once=function(e,t){return new i((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}F(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&F(e,"error",t,{once:!0})}(e,n)}))},O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var I=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function P(e){return void 0===e._maxListeners?O.defaultMaxListeners:e._maxListeners}function N(e,t,r,i){var n,s,o,a;if(C(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=P(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function D(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function B(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=D.bind(i);return n.listener=r,i.wrapFn=n,n}function q(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):j(n,n.length)}function L(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function j(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function F(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(e){if("number"!=typeof e||e<0||k(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");I=e}}),O.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||k(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},O.prototype.getMaxListeners=function(){return P(this)},O.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)x(a,this,t);else{var u=a.length,d=j(a,u);for(r=0;r<u;++r)x(d[r],this,t)}return!0},O.prototype.addListener=function(e,t){return N(this,e,t,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(e,t){return N(this,e,t,!0)},O.prototype.once=function(e,t){return C(t),this.on(e,B(this,e,t)),this},O.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,B(this,e,t)),this},O.prototype.removeListener=function(e,t){var r,i,n,s,o;if(C(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},O.prototype.listeners=function(e){return q(this,e,!0)},O.prototype.rawListeners=function(e){return q(this,e,!1)},O.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):L.call(e,t)},O.prototype.listenerCount=L,O.prototype.eventNames=function(){return this._eventsCount>0?A(this._events):[]};new M.exports;function U(e,t,r,n){return new(r||(r=i))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}function z(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new i((function(n,s){!function(e,t,r,n){i.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,s,(t=e[r](t)).done,t.value)}))}}}const H=2147483648,G=e=>(e|H)>>>0,$=e=>(2147483647&e)>>>0,W=o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Not a valid path"),V=o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Path cannot contain negative values"),K=e=>{if(!Array.isArray(e)||e.length<1)return"SPENDADDRESS";switch($(e[0])){case 48:return"SPENDMULTISIG";case 49:return"SPENDP2SHWITNESS";case 84:return"SPENDWITNESS";case 86:case 10025:return"SPENDTAPROOT";default:return"SPENDADDRESS"}},Y=e=>`m/${e.map((e=>e&H?(2147483647&e)+"'":e)).join("/")}`,Z=(e,t=0,r=!1)=>{let i;if(i="string"==typeof e?(e=>{const t=e.toLowerCase().split("/");if("m"!==t[0])throw W;return t.filter((e=>"m"!==e&&""!==e)).map((e=>{let t=!1;"'"===e.substr(e.length-1)&&(t=!0,e=e.substr(0,e.length-1));let r=parseInt(e);if(Number.isNaN(r))throw W;if(r<0)throw V;return t&&(r=G(r)),r}))})(e):Array.isArray(e)?e.map((e=>{const t=parseInt(e);if(Number.isNaN(t))throw W;if(t<0)throw V;return t})):void 0,!i)throw W;if(t>0&&i.length<t)throw W;return r?i.splice(0,3):i},X=e=>e&&"object"==typeof e&&e.model?"1"===e.model?"model_mini":"model_touch":"model_mini",J=e=>{if(!e||"object"!=typeof e||!e.serial_no)return"classic";const t=e.serial_no.slice(0,2);return"mi"===t.toLowerCase()?"mini":"tc"===t.toLowerCase()?"touch":"classic"},Q=e=>{var t,r;return"classic"===J(e)?null!==(t=e.onekey_serial)&&void 0!==t?t:"":null!==(r=e.serial_no)&&void 0!==r?r:""},ee=e=>{const t=J(e);return"string"==typeof e.label?e.label:`My OneKey ${t.charAt(0).toUpperCase()+t.slice(1)}`},te=e=>e?e.onekey_version?e.onekey_version.split("."):[e.major_version,e.minor_version,e.patch_version]:[0,0,0],re=e=>e.ble_ver&&_.default.valid(e.ble_ver)?e.ble_ver.split("."):null,ie=e=>e.bootloader_version?_.default.valid(e.bootloader_version)?e.bootloader_version.split("."):[0,0,0]:e.bootloader_mode?[e.major_version,e.minor_version,e.patch_version]:[0,0,0],ne=e=>{if(!e)return{support:!1};if("touch"===J(e))return{support:!1};const t=te(e).join(".");return{support:_.default.gte(t,"2.3.0"),require:"2.3.0"}},se=(e,t)=>U(void 0,void 0,void 0,(function*(){if(!e)return!1;const{message:r,type:i}=yield t.typedCall("GetAddress","Address",{address_n:[G(44),G(1),G(0),0,0],coin_name:"Testnet",script_type:"SPENDADDRESS",show_display:!1});if("CallMethodError"===i)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Get the passphrase state error");return r.address})),oe=e=>{if(!e)return!1;const t=te(e).join("."),r=J(e);return"touch"===r||"pro"===r?_.default.gte(t,"3.1.0"):_.default.gte(t,"2.6.0")},ae=e=>{if(!e)return{support:!1};const t=te(e).join("."),r=J(e);return"classic"===r||"mini"===r?{support:!0}:{support:_.default.gte(t,"3.4.0")}},ue=(e,t)=>{const r=J(e),i=te(e);return"ble"===t?"ble":"classic"===r||"mini"===r?"firmware-v2":"touch"===r?_.default.lt(i.join("."),"3.4.0")?"firmware":"firmware-v3":"firmware"};const de=(e,t)=>((e,t="text")=>U(void 0,void 0,void 0,(function*(){const r={};e.indexOf("ngrok-free.app")>-1&&(r["ngrok-skip-browser-warning"]=!0);const i=yield w.default.request({url:e,withCredentials:!1,responseType:"binary"===t?"arraybuffer":"json",headers:r});if(200==+i.status)return i.data;throw new Error(`httpRequest error: ${e} ${i.statusText}`)})))(e,t),le=()=>(new Date).getTime();new RegExp(/^[0-9]{1,3}(\.[0-9]{1,3}){0,2}$/);const ce=`https://jssdk.onekey.so/${r(2391).version}/`,he={configSrc:"./data/config.json",version:"",debug:!1,priority:2,trustedHost:!1,connectSrc:ce,iframeSrc:`${ce}iframe.html`,parentOrigin:"undefined"!=typeof window&&window.location?window.location.origin:"",supportedBrowser:"undefined"==typeof navigator||!/Trident|MSIE|Edge/.test(navigator.userAgent),env:"web",lazyLoad:!1,timestamp:(new Date).getTime()};function fe(e){if("touch"!==J(e))return!1;const t=te(e).join("."),r=ie(e).join("."),i=xe.getBootloaderTargetVersion(e);return!!i&&_.default.gte(t,"3.2.0")&&_.default.gte(t,"4.1.0")&&_.default.lte(r,i.join("."))}const pe="log-output";let ye;class ge{constructor(e,t){this.prefix=e,this.enabled=t,this.messages=[]}addMessage(e,t,...r){this.messages.push({level:e,prefix:t,message:r,timestamp:(new Date).getTime()}),this.messages.length>500&&this.messages.shift()}log(...e){this.addMessage("log",this.prefix,...e),be(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}error(...e){this.addMessage("error",this.prefix,...e),be(this.prefix,...e),this.enabled&&console.error(this.prefix,...e)}warn(...e){this.addMessage("warn",this.prefix,...e),be(this.prefix,...e),this.enabled&&console.warn(this.prefix,...e)}debug(...e){this.addMessage("debug",this.prefix,...e),be(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}}const me={},ve=(e,t)=>{const r=new ge(e,!!t);return me[e]=r,r},be=(e,...t)=>{var r,i;null==ye||ye((r=pe,i=((...e)=>e.map((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e?e:"object"==typeof e?JSON.stringify(e,(()=>{const e=new WeakSet;return(t,r)=>{if("object"==typeof r&&null!==r){if(e.has(r))return;e.add(r)}return r}})()):e)))(e,...t),{event:"LOG_EVENT",type:r,payload:i}))};var _e;t.d0=void 0,(_e=t.d0||(t.d0={})).Core="Core",_e.Transport="Transport",_e.Device="Device",_e.DeviceCommands="DeviceCommands",_e.DeviceConnector="DeviceConnector",_e.DeviceList="DeviceList",_e.DevicePool="DevicePool",_e.HdCommonConnectSdk="@onekey/common-connect-sdk",_e.HdBleSdk="@onekey/hd-ble-sdk",_e.HdTransportHttp="@onekey/hd-transport-http",_e.HdBleTransport="@onekey/hd-ble-transport",_e.Connect="@onekey/connect",_e.Iframe="IFrame",_e.SendMessage="[SendMessage]",_e.Method="[Method]";const we={[t.d0.Core]:ve(t.d0.Core),[t.d0.Transport]:ve(t.d0.Transport),[t.d0.Device]:ve(t.d0.Device),[t.d0.DeviceCommands]:ve(t.d0.DeviceCommands),[t.d0.DeviceConnector]:ve(t.d0.DeviceConnector),[t.d0.DeviceList]:ve(t.d0.DeviceList),[t.d0.DevicePool]:ve(t.d0.DevicePool),[t.d0.HdBleSdk]:ve(t.d0.HdBleSdk),[t.d0.HdTransportHttp]:ve(t.d0.HdTransportHttp),[t.d0.HdBleTransport]:ve(t.d0.HdBleTransport),[t.d0.Connect]:ve(t.d0.Connect),[t.d0.Iframe]:ve(t.d0.Iframe),[t.d0.SendMessage]:ve(t.d0.SendMessage),[t.d0.Method]:ve(t.d0.Method),[t.d0.HdCommonConnectSdk]:ve(t.d0.Method)},Ee=e=>we[e],Se=e=>new i((t=>{setTimeout(t,e)})),Te=(e,t)=>{const r=e.filter((e=>_.default.gt(e.version.join("."),t)));return 0===r.length?"valid":r.some((e=>e.required))?"required":"outdated"},Ae=(e,t)=>e.filter((e=>_.default.gt(e.version.join("."),t))).map((e=>e.changelog)),Me=e=>{let t=e[0];return e.forEach((e=>{_.default.gt(e.version.join("."),t.version.join("."))&&(t=e)})),t};var Re;class xe{static load(e){return U(this,void 0,void 0,(function*(){this.settings=e;try{const t=e.preRelease?"https://data.onekey.so/pre-config.json":"https://data.onekey.so/config.json",{data:r}=yield w.default.get(`${t}?noCache=${le()}`,{timeout:7e3});this.deviceMap={classic:r.classic,mini:r.mini,touch:r.touch,pro:r.pro},this.assets={bridge:r.bridge}}catch(e){}}))}static checkAndReloadData(){return U(this,void 0,void 0,(function*(){le()-this.lastCheckTimestamp>108e5&&(yield this.load(this.settings).then((()=>{this.lastCheckTimestamp=le()})))}))}static getProtobufMessages(){return this.messages.default}static getSettings(e){return this.settings?"string"==typeof e?this.settings[e]:this.settings:null}}Re=xe,xe.deviceMap={classic:{firmware:[],ble:[]},mini:{firmware:[],ble:[]},touch:{firmware:[],ble:[]},pro:{firmware:[],ble:[]}},xe.assets=null,xe.messages={default:{nested:{AlgorandGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:3}}},AlgorandAddress:{fields:{address:{type:"string",id:1}}},AlgorandSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},AlgorandSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},AptosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},AptosAddress:{fields:{address:{type:"string",id:1}}},AptosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},AptosSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},AptosSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},payload:{rule:"required",type:"AptosMessagePayload",id:2}},nested:{AptosMessagePayload:{fields:{address:{type:"string",id:2},chain_id:{type:"string",id:3},application:{type:"string",id:4},nonce:{rule:"required",type:"string",id:5},message:{rule:"required",type:"string",id:6}}}}},AptosMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},address:{rule:"required",type:"string",id:2}}},BinanceGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},BinanceAddress:{fields:{address:{rule:"required",type:"string",id:1}}},BinanceGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},BinancePublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},BinanceSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},msg_count:{type:"uint32",id:2},account_number:{type:"sint64",id:3},chain_id:{type:"string",id:4},memo:{type:"string",id:5},sequence:{type:"sint64",id:6},source:{type:"sint64",id:7}}},BinanceTxRequest:{fields:{}},BinanceTransferMsg:{fields:{inputs:{rule:"repeated",type:"BinanceInputOutput",id:1},outputs:{rule:"repeated",type:"BinanceInputOutput",id:2}},nested:{BinanceInputOutput:{fields:{address:{type:"string",id:1},coins:{rule:"repeated",type:"BinanceCoin",id:2}}},BinanceCoin:{fields:{amount:{type:"sint64",id:1},denom:{type:"string",id:2}}}}},BinanceOrderMsg:{fields:{id:{type:"string",id:1},ordertype:{type:"BinanceOrderType",id:2},price:{type:"sint64",id:3},quantity:{type:"sint64",id:4},sender:{type:"string",id:5},side:{type:"BinanceOrderSide",id:6},symbol:{type:"string",id:7},timeinforce:{type:"BinanceTimeInForce",id:8}},nested:{BinanceOrderType:{values:{OT_UNKNOWN:0,MARKET:1,LIMIT:2,OT_RESERVED:3}},BinanceOrderSide:{values:{SIDE_UNKNOWN:0,BUY:1,SELL:2}},BinanceTimeInForce:{values:{TIF_UNKNOWN:0,GTE:1,TIF_RESERVED:2,IOC:3}}}},BinanceCancelMsg:{fields:{refid:{type:"string",id:1},sender:{type:"string",id:2},symbol:{type:"string",id:3}}},BinanceSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},public_key:{rule:"required",type:"bytes",id:2}}},InputScriptType:{values:{SPENDADDRESS:0,SPENDMULTISIG:1,EXTERNAL:2,SPENDWITNESS:3,SPENDP2SHWITNESS:4,SPENDTAPROOT:5}},OutputScriptType:{values:{PAYTOADDRESS:0,PAYTOSCRIPTHASH:1,PAYTOMULTISIG:2,PAYTOOPRETURN:3,PAYTOWITNESS:4,PAYTOP2SHWITNESS:5,PAYTOTAPROOT:6}},DecredStakingSpendType:{values:{SSGen:0,SSRTX:1}},AmountUnit:{values:{BITCOIN:0,MILLIBITCOIN:1,MICROBITCOIN:2,SATOSHI:3}},MultisigRedeemScriptType:{fields:{pubkeys:{rule:"repeated",type:"HDNodePathType",id:1},signatures:{rule:"repeated",type:"bytes",id:2},m:{rule:"required",type:"uint32",id:3},nodes:{rule:"repeated",type:"HDNodeType",id:4},address_n:{rule:"repeated",type:"uint32",id:5,options:{packed:!1}}},nested:{HDNodePathType:{fields:{node:{rule:"required",type:"HDNodeType",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}}}},GetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},ecdsa_curve_name:{type:"string",id:2},show_display:{type:"bool",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}}},PublicKey:{fields:{node:{rule:"required",type:"HDNodeType",id:1},xpub:{rule:"required",type:"string",id:2},root_fingerprint:{type:"uint32",id:3}}},GetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},show_display:{type:"bool",id:3},multisig:{type:"MultisigRedeemScriptType",id:4},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}}},Address:{fields:{address:{rule:"required",type:"string",id:1}}},GetOwnershipId:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},multisig:{type:"MultisigRedeemScriptType",id:3},script_type:{type:"InputScriptType",id:4,options:{default:"SPENDADDRESS"}}}},OwnershipId:{fields:{ownership_id:{rule:"required",type:"bytes",id:1}}},SignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2},coin_name:{type:"string",id:3,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:4,options:{default:"SPENDADDRESS"}},no_script_type:{type:"bool",id:5}}},MessageSignature:{fields:{address:{rule:"required",type:"string",id:1},signature:{rule:"required",type:"bytes",id:2}}},VerifyMessage:{fields:{address:{rule:"required",type:"string",id:1},signature:{rule:"required",type:"bytes",id:2},message:{rule:"required",type:"bytes",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}}}},SignTx:{fields:{outputs_count:{rule:"required",type:"uint32",id:1},inputs_count:{rule:"required",type:"uint32",id:2},coin_name:{type:"string",id:3,options:{default:"Bitcoin"}},version:{type:"uint32",id:4,options:{default:1}},lock_time:{type:"uint32",id:5,options:{default:0}},expiry:{type:"uint32",id:6},overwintered:{type:"bool",id:7,options:{deprecated:!0}},version_group_id:{type:"uint32",id:8},timestamp:{type:"uint32",id:9},branch_id:{type:"uint32",id:10},amount_unit:{type:"AmountUnit",id:11,options:{default:"BITCOIN"}},decred_staking_ticket:{type:"bool",id:12,options:{default:!1}}}},TxRequest:{fields:{request_type:{type:"RequestType",id:1},details:{type:"TxRequestDetailsType",id:2},serialized:{type:"TxRequestSerializedType",id:3}},nested:{RequestType:{values:{TXINPUT:0,TXOUTPUT:1,TXMETA:2,TXFINISHED:3,TXEXTRADATA:4,TXORIGINPUT:5,TXORIGOUTPUT:6}},TxRequestDetailsType:{fields:{request_index:{type:"uint32",id:1},tx_hash:{type:"bytes",id:2},extra_data_len:{type:"uint32",id:3},extra_data_offset:{type:"uint32",id:4}}},TxRequestSerializedType:{fields:{signature_index:{type:"uint32",id:1},signature:{type:"bytes",id:2},serialized_tx:{type:"bytes",id:3}}}}},TxAck:{options:{deprecated:!0},fields:{tx:{type:"TransactionType",id:1}},nested:{TransactionType:{fields:{version:{type:"uint32",id:1},inputs:{rule:"repeated",type:"TxInputType",id:2},bin_outputs:{rule:"repeated",type:"TxOutputBinType",id:3},lock_time:{type:"uint32",id:4},outputs:{rule:"repeated",type:"TxOutputType",id:5},inputs_cnt:{type:"uint32",id:6},outputs_cnt:{type:"uint32",id:7},extra_data:{type:"bytes",id:8},extra_data_len:{type:"uint32",id:9},expiry:{type:"uint32",id:10},overwintered:{type:"bool",id:11,options:{deprecated:!0}},version_group_id:{type:"uint32",id:12},timestamp:{type:"uint32",id:13},branch_id:{type:"uint32",id:14}},nested:{TxInputType:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{type:"bytes",id:4},sequence:{type:"uint32",id:5,options:{default:4294967295}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:7},amount:{type:"uint64",id:8},decred_tree:{type:"uint32",id:9},witness:{type:"bytes",id:13},ownership_proof:{type:"bytes",id:14},commitment_data:{type:"bytes",id:15},orig_hash:{type:"bytes",id:16},orig_index:{type:"uint32",id:17},decred_staking_spend:{type:"DecredStakingSpendType",id:18},script_pubkey:{type:"bytes",id:19}}},TxOutputBinType:{fields:{amount:{rule:"required",type:"uint64",id:1},script_pubkey:{rule:"required",type:"bytes",id:2},decred_script_version:{type:"uint32",id:3}}},TxOutputType:{fields:{address:{type:"string",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:3},script_type:{type:"OutputScriptType",id:4,options:{default:"PAYTOADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:5},op_return_data:{type:"bytes",id:6},orig_hash:{type:"bytes",id:10},orig_index:{type:"uint32",id:11}}}}}}},TxInput:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{type:"bytes",id:4},sequence:{type:"uint32",id:5,options:{default:4294967295}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:7},amount:{rule:"required",type:"uint64",id:8},decred_tree:{type:"uint32",id:9},witness:{type:"bytes",id:13},ownership_proof:{type:"bytes",id:14},commitment_data:{type:"bytes",id:15},orig_hash:{type:"bytes",id:16},orig_index:{type:"uint32",id:17},decred_staking_spend:{type:"DecredStakingSpendType",id:18},script_pubkey:{type:"bytes",id:19}}},TxOutput:{fields:{address:{type:"string",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:3},script_type:{type:"OutputScriptType",id:4,options:{default:"PAYTOADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:5},op_return_data:{type:"bytes",id:6},orig_hash:{type:"bytes",id:10},orig_index:{type:"uint32",id:11}}},PrevTx:{fields:{version:{rule:"required",type:"uint32",id:1},lock_time:{rule:"required",type:"uint32",id:4},inputs_count:{rule:"required",type:"uint32",id:6},outputs_count:{rule:"required",type:"uint32",id:7},extra_data_len:{type:"uint32",id:9,options:{default:0}},expiry:{type:"uint32",id:10},version_group_id:{type:"uint32",id:12},timestamp:{type:"uint32",id:13},branch_id:{type:"uint32",id:14}}},PrevInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{rule:"required",type:"bytes",id:4},sequence:{rule:"required",type:"uint32",id:5},decred_tree:{type:"uint32",id:9}}},PrevOutput:{fields:{amount:{rule:"required",type:"uint64",id:1},script_pubkey:{rule:"required",type:"bytes",id:2},decred_script_version:{type:"uint32",id:3}}},TxAckInput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckInputWrapper",id:1}},nested:{TxAckInputWrapper:{fields:{input:{rule:"required",type:"TxInput",id:2}}}}},TxAckOutput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckOutputWrapper",id:1}},nested:{TxAckOutputWrapper:{fields:{output:{rule:"required",type:"TxOutput",id:5}}}}},TxAckPrevMeta:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"PrevTx",id:1}}},TxAckPrevInput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevInputWrapper",id:1}},nested:{TxAckPrevInputWrapper:{fields:{input:{rule:"required",type:"PrevInput",id:2}}}}},TxAckPrevOutput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevOutputWrapper",id:1}},nested:{TxAckPrevOutputWrapper:{fields:{output:{rule:"required",type:"PrevOutput",id:3}}}}},TxAckPrevExtraData:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevExtraDataWrapper",id:1}},nested:{TxAckPrevExtraDataWrapper:{fields:{extra_data_chunk:{rule:"required",type:"bytes",id:8}}}}},GetOwnershipProof:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:3,options:{default:"SPENDWITNESS"}},multisig:{type:"MultisigRedeemScriptType",id:4},user_confirmation:{type:"bool",id:5,options:{default:!1}},ownership_ids:{rule:"repeated",type:"bytes",id:6},commitment_data:{type:"bytes",id:7,options:{default:""}}}},OwnershipProof:{fields:{ownership_proof:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},AuthorizeCoinJoin:{options:{"(unstable)":!0},fields:{coordinator:{rule:"required",type:"string",id:1},max_total_fee:{rule:"required",type:"uint64",id:2},fee_per_anonymity:{type:"uint32",id:3,options:{default:0}},address_n:{rule:"repeated",type:"uint32",id:4,options:{packed:!1}},coin_name:{type:"string",id:5,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},amount_unit:{type:"AmountUnit",id:11,options:{default:"BITCOIN"}}}},GetPublicKeyMultiple:{fields:{addresses:{rule:"repeated",type:"BIP32Address",id:1},ecdsa_curve_name:{type:"string",id:2},show_display:{type:"bool",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}},nested:{BIP32Address:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}}}},PublicKeyMultiple:{fields:{xpubs:{rule:"repeated",type:"string",id:1}}},FirmwareErase:{fields:{length:{type:"uint32",id:1}}},FirmwareRequest:{fields:{offset:{type:"uint32",id:1},length:{type:"uint32",id:2}}},FirmwareUpload:{fields:{payload:{rule:"required",type:"bytes",id:1},hash:{type:"bytes",id:2}}},SelfTest:{fields:{payload:{type:"bytes",id:1}}},FirmwareErase_ex:{fields:{length:{type:"uint32",id:1}}},RebootType:{values:{Normal:0,Boardloader:1,BootLoader:2}},Reboot:{fields:{reboot_type:{rule:"required",type:"RebootType",id:1}}},FirmwareUpdateEmmc:{fields:{path:{rule:"required",type:"string",id:1},reboot_on_success:{type:"bool",id:2}}},CardanoDerivationType:{values:{LEDGER:0,ICARUS:1,ICARUS_TREZOR:2}},CardanoAddressType:{values:{BASE:0,BASE_SCRIPT_KEY:1,BASE_KEY_SCRIPT:2,BASE_SCRIPT_SCRIPT:3,POINTER:4,POINTER_SCRIPT:5,ENTERPRISE:6,ENTERPRISE_SCRIPT:7,BYRON:8,REWARD:14,REWARD_SCRIPT:15}},CardanoNativeScriptType:{values:{PUB_KEY:0,ALL:1,ANY:2,N_OF_K:3,INVALID_BEFORE:4,INVALID_HEREAFTER:5}},CardanoNativeScriptHashDisplayFormat:{values:{HIDE:0,BECH32:1,POLICY_ID:2}},CardanoTxOutputSerializationFormat:{values:{ARRAY_LEGACY:0,MAP_BABBAGE:1}},CardanoCertificateType:{values:{STAKE_REGISTRATION:0,STAKE_DEREGISTRATION:1,STAKE_DELEGATION:2,STAKE_POOL_REGISTRATION:3}},CardanoPoolRelayType:{values:{SINGLE_HOST_IP:0,SINGLE_HOST_NAME:1,MULTIPLE_HOST_NAME:2}},CardanoTxAuxiliaryDataSupplementType:{values:{NONE:0,GOVERNANCE_REGISTRATION_SIGNATURE:1}},CardanoGovernanceRegistrationFormat:{values:{CIP15:0,CIP36:1}},CardanoTxSigningMode:{values:{ORDINARY_TRANSACTION:0,POOL_REGISTRATION_AS_OWNER:1,MULTISIG_TRANSACTION:2,PLUTUS_TRANSACTION:3}},CardanoTxWitnessType:{values:{BYRON_WITNESS:0,SHELLEY_WITNESS:1}},CardanoBlockchainPointerType:{fields:{block_index:{rule:"required",type:"uint32",id:1},tx_index:{rule:"required",type:"uint32",id:2},certificate_index:{rule:"required",type:"uint32",id:3}}},CardanoNativeScript:{fields:{type:{rule:"required",type:"CardanoNativeScriptType",id:1},scripts:{rule:"repeated",type:"CardanoNativeScript",id:2},key_hash:{type:"bytes",id:3},key_path:{rule:"repeated",type:"uint32",id:4,options:{packed:!1}},required_signatures_count:{type:"uint32",id:5},invalid_before:{type:"uint64",id:6},invalid_hereafter:{type:"uint64",id:7}}},CardanoGetNativeScriptHash:{fields:{script:{rule:"required",type:"CardanoNativeScript",id:1},display_format:{rule:"required",type:"CardanoNativeScriptHashDisplayFormat",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3}}},CardanoNativeScriptHash:{fields:{script_hash:{rule:"required",type:"bytes",id:1}}},CardanoAddressParametersType:{fields:{address_type:{rule:"required",type:"CardanoAddressType",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},address_n_staking:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},staking_key_hash:{type:"bytes",id:4},certificate_pointer:{type:"CardanoBlockchainPointerType",id:5},script_payment_hash:{type:"bytes",id:6},script_staking_hash:{type:"bytes",id:7}}},CardanoGetAddress:{fields:{show_display:{type:"bool",id:2,options:{default:!1}},protocol_magic:{rule:"required",type:"uint32",id:3},network_id:{rule:"required",type:"uint32",id:4},address_parameters:{rule:"required",type:"CardanoAddressParametersType",id:5},derivation_type:{rule:"required",type:"CardanoDerivationType",id:6}}},CardanoAddress:{fields:{address:{rule:"required",type:"string",id:1}}},CardanoGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3}}},CardanoPublicKey:{fields:{xpub:{rule:"required",type:"string",id:1},node:{rule:"required",type:"HDNodeType",id:2}}},CardanoSignTxInit:{fields:{signing_mode:{rule:"required",type:"CardanoTxSigningMode",id:1},protocol_magic:{rule:"required",type:"uint32",id:2},network_id:{rule:"required",type:"uint32",id:3},inputs_count:{rule:"required",type:"uint32",id:4},outputs_count:{rule:"required",type:"uint32",id:5},fee:{rule:"required",type:"uint64",id:6},ttl:{type:"uint64",id:7},certificates_count:{rule:"required",type:"uint32",id:8},withdrawals_count:{rule:"required",type:"uint32",id:9},has_auxiliary_data:{rule:"required",type:"bool",id:10},validity_interval_start:{type:"uint64",id:11},witness_requests_count:{rule:"required",type:"uint32",id:12},minting_asset_groups_count:{rule:"required",type:"uint32",id:13},derivation_type:{rule:"required",type:"CardanoDerivationType",id:14},include_network_id:{type:"bool",id:15,options:{default:!1}},script_data_hash:{type:"bytes",id:16},collateral_inputs_count:{rule:"required",type:"uint32",id:17},required_signers_count:{rule:"required",type:"uint32",id:18},has_collateral_return:{type:"bool",id:19,options:{default:!1}},total_collateral:{type:"uint64",id:20},reference_inputs_count:{type:"uint32",id:21,options:{default:0}}}},CardanoTxInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:1},prev_index:{rule:"required",type:"uint32",id:2}}},CardanoTxOutput:{fields:{address:{type:"string",id:1},address_parameters:{type:"CardanoAddressParametersType",id:2},amount:{rule:"required",type:"uint64",id:3},asset_groups_count:{rule:"required",type:"uint32",id:4},datum_hash:{type:"bytes",id:5},format:{type:"CardanoTxOutputSerializationFormat",id:6,options:{default:"ARRAY_LEGACY"}},inline_datum_size:{type:"uint32",id:7,options:{default:0}},reference_script_size:{type:"uint32",id:8,options:{default:0}}}},CardanoAssetGroup:{fields:{policy_id:{rule:"required",type:"bytes",id:1},tokens_count:{rule:"required",type:"uint32",id:2}}},CardanoToken:{fields:{asset_name_bytes:{rule:"required",type:"bytes",id:1},amount:{type:"uint64",id:2},mint_amount:{type:"sint64",id:3}}},CardanoTxInlineDatumChunk:{fields:{data:{rule:"required",type:"bytes",id:1}}},CardanoTxReferenceScriptChunk:{fields:{data:{rule:"required",type:"bytes",id:1}}},CardanoPoolOwner:{fields:{staking_key_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},staking_key_hash:{type:"bytes",id:2}}},CardanoPoolRelayParameters:{fields:{type:{rule:"required",type:"CardanoPoolRelayType",id:1},ipv4_address:{type:"bytes",id:2},ipv6_address:{type:"bytes",id:3},host_name:{type:"string",id:4},port:{type:"uint32",id:5}}},CardanoPoolMetadataType:{fields:{url:{rule:"required",type:"string",id:1},hash:{rule:"required",type:"bytes",id:2}}},CardanoPoolParametersType:{fields:{pool_id:{rule:"required",type:"bytes",id:1},vrf_key_hash:{rule:"required",type:"bytes",id:2},pledge:{rule:"required",type:"uint64",id:3},cost:{rule:"required",type:"uint64",id:4},margin_numerator:{rule:"required",type:"uint64",id:5},margin_denominator:{rule:"required",type:"uint64",id:6},reward_account:{rule:"required",type:"string",id:7},metadata:{type:"CardanoPoolMetadataType",id:10},owners_count:{rule:"required",type:"uint32",id:11},relays_count:{rule:"required",type:"uint32",id:12}}},CardanoTxCertificate:{fields:{type:{rule:"required",type:"CardanoCertificateType",id:1},path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},pool:{type:"bytes",id:3},pool_parameters:{type:"CardanoPoolParametersType",id:4},script_hash:{type:"bytes",id:5},key_hash:{type:"bytes",id:6}}},CardanoTxWithdrawal:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:2},script_hash:{type:"bytes",id:3},key_hash:{type:"bytes",id:4}}},CardanoGovernanceRegistrationDelegation:{fields:{voting_public_key:{rule:"required",type:"bytes",id:1},weight:{rule:"required",type:"uint32",id:2}}},CardanoGovernanceRegistrationParametersType:{fields:{voting_public_key:{type:"bytes",id:1},staking_path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},reward_address_parameters:{rule:"required",type:"CardanoAddressParametersType",id:3},nonce:{rule:"required",type:"uint64",id:4},format:{type:"CardanoGovernanceRegistrationFormat",id:5,options:{default:"CIP15"}},delegations:{rule:"repeated",type:"CardanoGovernanceRegistrationDelegation",id:6},voting_purpose:{type:"uint64",id:7}}},CardanoTxAuxiliaryData:{fields:{governance_registration_parameters:{type:"CardanoGovernanceRegistrationParametersType",id:1},hash:{type:"bytes",id:2}}},CardanoTxMint:{fields:{asset_groups_count:{rule:"required",type:"uint32",id:1}}},CardanoTxCollateralInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:1},prev_index:{rule:"required",type:"uint32",id:2}}},CardanoTxRequiredSigner:{fields:{key_hash:{type:"bytes",id:1},key_path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}},CardanoTxReferenceInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:1},prev_index:{rule:"required",type:"uint32",id:2}}},CardanoTxItemAck:{fields:{}},CardanoTxAuxiliaryDataSupplement:{fields:{type:{rule:"required",type:"CardanoTxAuxiliaryDataSupplementType",id:1},auxiliary_data_hash:{type:"bytes",id:2},governance_signature:{type:"bytes",id:3}}},CardanoTxWitnessRequest:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},CardanoTxWitnessResponse:{fields:{type:{rule:"required",type:"CardanoTxWitnessType",id:1},pub_key:{rule:"required",type:"bytes",id:2},signature:{rule:"required",type:"bytes",id:3},chain_code:{type:"bytes",id:4}}},CardanoTxHostAck:{fields:{}},CardanoTxBodyHash:{fields:{tx_hash:{rule:"required",type:"bytes",id:1}}},CardanoSignTxFinished:{fields:{}},CardanoSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3},network_id:{rule:"required",type:"uint32",id:4}}},CardanoMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},key:{rule:"required",type:"bytes",id:2}}},Success:{fields:{message:{type:"string",id:1,options:{default:""}}}},Failure:{fields:{code:{type:"FailureType",id:1},message:{type:"string",id:2}},nested:{FailureType:{values:{Failure_UnexpectedMessage:1,Failure_ButtonExpected:2,Failure_DataError:3,Failure_ActionCancelled:4,Failure_PinExpected:5,Failure_PinCancelled:6,Failure_PinInvalid:7,Failure_InvalidSignature:8,Failure_ProcessError:9,Failure_NotEnoughFunds:10,Failure_NotInitialized:11,Failure_PinMismatch:12,Failure_WipeCodeMismatch:13,Failure_InvalidSession:14,Failure_FirmwareError:99}}}},ButtonRequest:{fields:{code:{type:"ButtonRequestType",id:1},pages:{type:"uint32",id:2}},nested:{ButtonRequestType:{values:{ButtonRequest_Other:1,ButtonRequest_FeeOverThreshold:2,ButtonRequest_ConfirmOutput:3,ButtonRequest_ResetDevice:4,ButtonRequest_ConfirmWord:5,ButtonRequest_WipeDevice:6,ButtonRequest_ProtectCall:7,ButtonRequest_SignTx:8,ButtonRequest_FirmwareCheck:9,ButtonRequest_Address:10,ButtonRequest_PublicKey:11,ButtonRequest_MnemonicWordCount:12,ButtonRequest_MnemonicInput:13,_Deprecated_ButtonRequest_PassphraseType:14,ButtonRequest_UnknownDerivationPath:15,ButtonRequest_RecoveryHomepage:16,ButtonRequest_Success:17,ButtonRequest_Warning:18,ButtonRequest_PassphraseEntry:19,ButtonRequest_PinEntry:20}}}},ButtonAck:{fields:{}},PinMatrixRequest:{fields:{type:{type:"PinMatrixRequestType",id:1}},nested:{PinMatrixRequestType:{values:{PinMatrixRequestType_Current:1,PinMatrixRequestType_NewFirst:2,PinMatrixRequestType_NewSecond:3,PinMatrixRequestType_WipeCodeFirst:4,PinMatrixRequestType_WipeCodeSecond:5,PinMatrixRequestType_BackupFirst:6,PinMatrixRequestType_BackupSecond:7}}}},PinMatrixAck:{fields:{pin:{rule:"required",type:"string",id:1},new_pin:{type:"string",id:2}}},PassphraseRequest:{fields:{_on_device:{type:"bool",id:1,options:{deprecated:!0}}}},PassphraseAck:{fields:{passphrase:{type:"string",id:1},_state:{type:"bytes",id:2,options:{deprecated:!0}},on_device:{type:"bool",id:3}}},Deprecated_PassphraseStateRequest:{options:{deprecated:!0},fields:{state:{type:"bytes",id:1}}},Deprecated_PassphraseStateAck:{options:{deprecated:!0},fields:{}},HDNodeType:{fields:{depth:{rule:"required",type:"uint32",id:1},fingerprint:{rule:"required",type:"uint32",id:2},child_num:{rule:"required",type:"uint32",id:3},chain_code:{rule:"required",type:"bytes",id:4},private_key:{type:"bytes",id:5},public_key:{rule:"required",type:"bytes",id:6}}},BixinPinInputOnDevice:{fields:{}},ConfluxGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},chain_id:{type:"uint32",id:3}}},ConfluxAddress:{fields:{address:{type:"string",id:1}}},ConfluxSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{type:"bytes",id:2},gas_price:{type:"bytes",id:3},gas_limit:{type:"bytes",id:4},to:{type:"string",id:5},value:{type:"bytes",id:6},epoch_height:{type:"bytes",id:7},storage_limit:{type:"bytes",id:8},data_initial_chunk:{type:"bytes",id:9},data_length:{type:"uint32",id:10},chain_id:{type:"uint32",id:11}}},ConfluxTxRequest:{fields:{data_length:{type:"uint32",id:1},signature_v:{type:"uint32",id:2},signature_r:{type:"bytes",id:3},signature_s:{type:"bytes",id:4}}},ConfluxTxAck:{fields:{data_chunk:{type:"bytes",id:1}}},ConfluxSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{type:"bytes",id:2}}},ConfluxMessageSignature:{fields:{signature:{type:"bytes",id:2},address:{type:"string",id:3}}},ConfluxSignMessageCIP23:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_hash:{type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},CosmosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},hrp:{type:"string",id:2},show_display:{type:"bool",id:3}}},CosmosAddress:{fields:{address:{type:"string",id:1}}},CosmosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},CosmosSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},CipherKeyValue:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},key:{rule:"required",type:"string",id:2},value:{rule:"required",type:"bytes",id:3},encrypt:{type:"bool",id:4},ask_on_encrypt:{type:"bool",id:5},ask_on_decrypt:{type:"bool",id:6},iv:{type:"bytes",id:7}}},CipheredKeyValue:{fields:{value:{rule:"required",type:"bytes",id:1}}},IdentityType:{fields:{proto:{type:"string",id:1},user:{type:"string",id:2},host:{type:"string",id:3},port:{type:"string",id:4},path:{type:"string",id:5},index:{type:"uint32",id:6,options:{default:0}}}},SignIdentity:{fields:{identity:{rule:"required",type:"IdentityType",id:1},challenge_hidden:{type:"bytes",id:2,options:{default:""}},challenge_visual:{type:"string",id:3,options:{default:""}},ecdsa_curve_name:{type:"string",id:4}}},SignedIdentity:{fields:{address:{type:"string",id:1},public_key:{rule:"required",type:"bytes",id:2},signature:{rule:"required",type:"bytes",id:3}}},GetECDHSessionKey:{fields:{identity:{rule:"required",type:"IdentityType",id:1},peer_public_key:{rule:"required",type:"bytes",id:2},ecdsa_curve_name:{type:"string",id:3}}},ECDHSessionKey:{fields:{session_key:{rule:"required",type:"bytes",id:1},public_key:{type:"bytes",id:2}}},CosiCommit:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},data:{type:"bytes",id:2}}},CosiCommitment:{fields:{commitment:{type:"bytes",id:1},pubkey:{type:"bytes",id:2}}},CosiSign:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},data:{type:"bytes",id:2},global_commitment:{type:"bytes",id:3},global_pubkey:{type:"bytes",id:4}}},CosiSignature:{fields:{signature:{rule:"required",type:"bytes",id:1}}},BatchGetPublickeys:{fields:{ecdsa_curve_name:{type:"string",id:1,options:{default:"ed25519"}},paths:{rule:"repeated",type:"Path",id:2}},nested:{Path:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}}}},EcdsaPublicKeys:{fields:{public_keys:{rule:"repeated",type:"bytes",id:1}}},DebugLinkDecision:{fields:{yes_no:{type:"bool",id:1},swipe:{type:"DebugSwipeDirection",id:2},input:{type:"string",id:3},x:{type:"uint32",id:4},y:{type:"uint32",id:5},wait:{type:"bool",id:6},hold_ms:{type:"uint32",id:7}},nested:{DebugSwipeDirection:{values:{UP:0,DOWN:1,LEFT:2,RIGHT:3}}}},DebugLinkLayout:{fields:{lines:{rule:"repeated",type:"string",id:1}}},DebugLinkReseedRandom:{fields:{value:{type:"uint32",id:1}}},DebugLinkRecordScreen:{fields:{target_directory:{type:"string",id:1}}},DebugLinkGetState:{fields:{wait_word_list:{type:"bool",id:1},wait_word_pos:{type:"bool",id:2},wait_layout:{type:"bool",id:3}}},DebugLinkState:{fields:{layout:{type:"bytes",id:1},pin:{type:"string",id:2},matrix:{type:"string",id:3},mnemonic_secret:{type:"bytes",id:4},node:{type:"HDNodeType",id:5},passphrase_protection:{type:"bool",id:6},reset_word:{type:"string",id:7},reset_entropy:{type:"bytes",id:8},recovery_fake_word:{type:"string",id:9},recovery_word_pos:{type:"uint32",id:10},reset_word_pos:{type:"uint32",id:11},mnemonic_type:{type:"BackupType",id:12},layout_lines:{rule:"repeated",type:"string",id:13}}},DebugLinkStop:{fields:{}},DebugLinkLog:{fields:{level:{type:"uint32",id:1},bucket:{type:"string",id:2},text:{type:"string",id:3}}},DebugLinkMemoryRead:{fields:{address:{type:"uint32",id:1},length:{type:"uint32",id:2}}},DebugLinkMemory:{fields:{memory:{type:"bytes",id:1}}},DebugLinkMemoryWrite:{fields:{address:{type:"uint32",id:1},memory:{type:"bytes",id:2},flash:{type:"bool",id:3}}},DebugLinkFlashErase:{fields:{sector:{type:"uint32",id:1}}},DebugLinkEraseSdCard:{fields:{format:{type:"bool",id:1}}},DebugLinkWatchLayout:{fields:{watch:{type:"bool",id:1}}},EmmcFixPermission:{fields:{}},EmmcPath:{fields:{exist:{rule:"required",type:"bool",id:1},size:{rule:"required",type:"uint64",id:2},year:{rule:"required",type:"uint32",id:3},month:{rule:"required",type:"uint32",id:4},day:{rule:"required",type:"uint32",id:5},hour:{rule:"required",type:"uint32",id:6},minute:{rule:"required",type:"uint32",id:7},second:{rule:"required",type:"uint32",id:8},readonly:{rule:"required",type:"bool",id:9},hidden:{rule:"required",type:"bool",id:10},system:{rule:"required",type:"bool",id:11},archive:{rule:"required",type:"bool",id:12},directory:{rule:"required",type:"bool",id:13}}},EmmcPathInfo:{fields:{path:{rule:"required",type:"string",id:1}}},EmmcFile:{fields:{path:{rule:"required",type:"string",id:1},offset:{rule:"required",type:"uint32",id:2},len:{rule:"required",type:"uint32",id:3},data:{type:"bytes",id:4},data_hash:{type:"uint32",id:5},processed_byte:{type:"uint32",id:6}}},EmmcFileRead:{fields:{file:{rule:"required",type:"EmmcFile",id:1},ui_percentage:{type:"uint32",id:2}}},EmmcFileWrite:{fields:{file:{rule:"required",type:"EmmcFile",id:1},overwrite:{rule:"required",type:"bool",id:2},append:{rule:"required",type:"bool",id:3},ui_percentage:{type:"uint32",id:4}}},EmmcFileDelete:{fields:{path:{rule:"required",type:"string",id:1}}},EmmcDir:{fields:{path:{rule:"required",type:"string",id:1},child_dirs:{type:"string",id:2},child_files:{type:"string",id:3}}},EmmcDirList:{fields:{path:{rule:"required",type:"string",id:1}}},EmmcDirMake:{fields:{path:{rule:"required",type:"string",id:1}}},EmmcDirRemove:{fields:{path:{rule:"required",type:"string",id:1}}},EosGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EosPublicKey:{fields:{wif_public_key:{rule:"required",type:"string",id:1},raw_public_key:{rule:"required",type:"bytes",id:2}}},EosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},chain_id:{type:"bytes",id:2},header:{type:"EosTxHeader",id:3},num_actions:{type:"uint32",id:4}},nested:{EosTxHeader:{fields:{expiration:{rule:"required",type:"uint32",id:1},ref_block_num:{rule:"required",type:"uint32",id:2},ref_block_prefix:{rule:"required",type:"uint32",id:3},max_net_usage_words:{rule:"required",type:"uint32",id:4},max_cpu_usage_ms:{rule:"required",type:"uint32",id:5},delay_sec:{rule:"required",type:"uint32",id:6}}}}},EosTxActionRequest:{fields:{data_size:{type:"uint32",id:1}}},EosTxActionAck:{fields:{common:{type:"EosActionCommon",id:1},transfer:{type:"EosActionTransfer",id:2},delegate:{type:"EosActionDelegate",id:3},undelegate:{type:"EosActionUndelegate",id:4},refund:{type:"EosActionRefund",id:5},buy_ram:{type:"EosActionBuyRam",id:6},buy_ram_bytes:{type:"EosActionBuyRamBytes",id:7},sell_ram:{type:"EosActionSellRam",id:8},vote_producer:{type:"EosActionVoteProducer",id:9},update_auth:{type:"EosActionUpdateAuth",id:10},delete_auth:{type:"EosActionDeleteAuth",id:11},link_auth:{type:"EosActionLinkAuth",id:12},unlink_auth:{type:"EosActionUnlinkAuth",id:13},new_account:{type:"EosActionNewAccount",id:14},unknown:{type:"EosActionUnknown",id:15}},nested:{EosAsset:{fields:{amount:{type:"sint64",id:1},symbol:{type:"uint64",id:2}}},EosPermissionLevel:{fields:{actor:{type:"uint64",id:1},permission:{type:"uint64",id:2}}},EosAuthorizationKey:{fields:{type:{rule:"required",type:"uint32",id:1},key:{type:"bytes",id:2},address_n:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},weight:{rule:"required",type:"uint32",id:4}}},EosAuthorizationAccount:{fields:{account:{type:"EosPermissionLevel",id:1},weight:{type:"uint32",id:2}}},EosAuthorizationWait:{fields:{wait_sec:{type:"uint32",id:1},weight:{type:"uint32",id:2}}},EosAuthorization:{fields:{threshold:{type:"uint32",id:1},keys:{rule:"repeated",type:"EosAuthorizationKey",id:2},accounts:{rule:"repeated",type:"EosAuthorizationAccount",id:3},waits:{rule:"repeated",type:"EosAuthorizationWait",id:4}}},EosActionCommon:{fields:{account:{type:"uint64",id:1},name:{type:"uint64",id:2},authorization:{rule:"repeated",type:"EosPermissionLevel",id:3}}},EosActionTransfer:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},quantity:{type:"EosAsset",id:3},memo:{type:"string",id:4}}},EosActionDelegate:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},net_quantity:{type:"EosAsset",id:3},cpu_quantity:{type:"EosAsset",id:4},transfer:{type:"bool",id:5}}},EosActionUndelegate:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},net_quantity:{type:"EosAsset",id:3},cpu_quantity:{type:"EosAsset",id:4}}},EosActionRefund:{fields:{owner:{type:"uint64",id:1}}},EosActionBuyRam:{fields:{payer:{type:"uint64",id:1},receiver:{type:"uint64",id:2},quantity:{type:"EosAsset",id:3}}},EosActionBuyRamBytes:{fields:{payer:{type:"uint64",id:1},receiver:{type:"uint64",id:2},bytes:{type:"uint32",id:3}}},EosActionSellRam:{fields:{account:{type:"uint64",id:1},bytes:{type:"uint64",id:2}}},EosActionVoteProducer:{fields:{voter:{type:"uint64",id:1},proxy:{type:"uint64",id:2},producers:{rule:"repeated",type:"uint64",id:3,options:{packed:!1}}}},EosActionUpdateAuth:{fields:{account:{type:"uint64",id:1},permission:{type:"uint64",id:2},parent:{type:"uint64",id:3},auth:{type:"EosAuthorization",id:4}}},EosActionDeleteAuth:{fields:{account:{type:"uint64",id:1},permission:{type:"uint64",id:2}}},EosActionLinkAuth:{fields:{account:{type:"uint64",id:1},code:{type:"uint64",id:2},type:{type:"uint64",id:3},requirement:{type:"uint64",id:4}}},EosActionUnlinkAuth:{fields:{account:{type:"uint64",id:1},code:{type:"uint64",id:2},type:{type:"uint64",id:3}}},EosActionNewAccount:{fields:{creator:{type:"uint64",id:1},name:{type:"uint64",id:2},owner:{type:"EosAuthorization",id:3},active:{type:"EosAuthorization",id:4}}},EosActionUnknown:{fields:{data_size:{rule:"required",type:"uint32",id:1},data_chunk:{type:"bytes",id:2}}}}},EosSignedTx:{fields:{signature:{rule:"required",type:"string",id:1}}},EthereumSignTypedData:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},primary_type:{rule:"required",type:"string",id:2},metamask_v4_compat:{type:"bool",id:3,options:{default:!0}},chain_id:{type:"uint64",id:4}}},EthereumTypedDataStructRequest:{fields:{name:{rule:"required",type:"string",id:1}}},EthereumTypedDataStructAck:{fields:{members:{rule:"repeated",type:"EthereumStructMember",id:1}},nested:{EthereumStructMember:{fields:{type:{rule:"required",type:"EthereumFieldType",id:1},name:{rule:"required",type:"string",id:2}}},EthereumFieldType:{fields:{data_type:{rule:"required",type:"EthereumDataType",id:1},size:{type:"uint32",id:2},entry_type:{type:"EthereumFieldType",id:3},struct_name:{type:"string",id:4}}},EthereumDataType:{values:{UINT:1,INT:2,BYTES:3,STRING:4,BOOL:5,ADDRESS:6,ARRAY:7,STRUCT:8}}}},EthereumTypedDataValueRequest:{fields:{member_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},EthereumTypedDataValueAck:{fields:{value:{rule:"required",type:"bytes",id:1}}},EthereumGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},chain_id:{type:"uint64",id:3}}},EthereumPublicKey:{fields:{node:{rule:"required",type:"HDNodeType",id:1},xpub:{rule:"required",type:"string",id:2}}},EthereumGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},chain_id:{type:"uint64",id:3}}},EthereumAddress:{fields:{_old_address:{type:"bytes",id:1,options:{deprecated:!0}},address:{type:"string",id:2}}},EthereumSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{type:"bytes",id:2,options:{default:""}},gas_price:{rule:"required",type:"bytes",id:3},gas_limit:{rule:"required",type:"bytes",id:4},to:{type:"string",id:11,options:{default:""}},value:{type:"bytes",id:6,options:{default:""}},data_initial_chunk:{type:"bytes",id:7,options:{default:""}},data_length:{type:"uint32",id:8,options:{default:0}},chain_id:{rule:"required",type:"uint64",id:9},tx_type:{type:"uint32",id:10}}},EthereumSignTxEIP1559:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{rule:"required",type:"bytes",id:2},max_gas_fee:{rule:"required",type:"bytes",id:3},max_priority_fee:{rule:"required",type:"bytes",id:4},gas_limit:{rule:"required",type:"bytes",id:5},to:{type:"string",id:6,options:{default:""}},value:{rule:"required",type:"bytes",id:7},data_initial_chunk:{type:"bytes",id:8,options:{default:""}},data_length:{rule:"required",type:"uint32",id:9},chain_id:{rule:"required",type:"uint64",id:10},access_list:{rule:"repeated",type:"EthereumAccessList",id:11}},nested:{EthereumAccessList:{fields:{address:{rule:"required",type:"string",id:1},storage_keys:{rule:"repeated",type:"bytes",id:2}}}}},EthereumTxRequest:{fields:{data_length:{type:"uint32",id:1},signature_v:{type:"uint32",id:2},signature_r:{type:"bytes",id:3},signature_s:{type:"bytes",id:4}}},EthereumTxAck:{fields:{data_chunk:{rule:"required",type:"bytes",id:1}}},EthereumSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2},chain_id:{type:"uint64",id:3}}},EthereumMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:2},address:{rule:"required",type:"string",id:3}}},EthereumVerifyMessage:{fields:{signature:{rule:"required",type:"bytes",id:2},message:{rule:"required",type:"bytes",id:3},address:{rule:"required",type:"string",id:4},chain_id:{type:"uint64",id:5}}},EthereumSignMessageEIP712:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_hash:{type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},EthereumSignTypedHash:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_separator_hash:{rule:"required",type:"bytes",id:2},message_hash:{type:"bytes",id:3},chain_id:{type:"uint64",id:4}}},EthereumTypedDataSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},address:{rule:"required",type:"string",id:2}}},FilecoinGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},testnet:{type:"bool",id:3}}},FilecoinAddress:{fields:{address:{type:"string",id:1}}},FilecoinSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2},testnet:{type:"bool",id:3}}},FilecoinSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},KaspaGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},prefix:{type:"string",id:3,options:{default:"kaspa"}},scheme:{type:"string",id:4,options:{default:"schnorr"}}}},KaspaAddress:{fields:{address:{rule:"required",type:"string",id:1}}},KaspaSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_message:{rule:"required",type:"bytes",id:2},scheme:{type:"string",id:3,options:{default:"schnorr"}},prefix:{type:"string",id:4,options:{default:"kaspa"}},input_count:{type:"uint32",id:5,options:{default:1}}}},KaspaTxInputRequest:{fields:{request_index:{rule:"required",type:"uint32",id:1},signature:{type:"bytes",id:2}}},KaspaTxInputAck:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_message:{rule:"required",type:"bytes",id:2}}},KaspaSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:2}}},BackupType:{values:{Bip39:0,Slip39_Basic:1,Slip39_Advanced:2}},SafetyCheckLevel:{values:{Strict:0,PromptAlways:1,PromptTemporarily:2}},Initialize:{fields:{session_id:{type:"bytes",id:1},_skip_passphrase:{type:"bool",id:2,options:{deprecated:!0}},derive_cardano:{type:"bool",id:3}}},GetFeatures:{fields:{}},Features:{fields:{vendor:{type:"string",id:1},major_version:{rule:"required",type:"uint32",id:2},minor_version:{rule:"required",type:"uint32",id:3},patch_version:{rule:"required",type:"uint32",id:4},bootloader_mode:{type:"bool",id:5},device_id:{type:"string",id:6},pin_protection:{type:"bool",id:7},passphrase_protection:{type:"bool",id:8},language:{type:"string",id:9},label:{type:"string",id:10},initialized:{type:"bool",id:12},revision:{type:"bytes",id:13},bootloader_hash:{type:"bytes",id:14},imported:{type:"bool",id:15},unlocked:{type:"bool",id:16},_passphrase_cached:{type:"bool",id:17,options:{deprecated:!0}},firmware_present:{type:"bool",id:18},needs_backup:{type:"bool",id:19},flags:{type:"uint32",id:20},model:{type:"string",id:21},fw_major:{type:"uint32",id:22},fw_minor:{type:"uint32",id:23},fw_patch:{type:"uint32",id:24},fw_vendor:{type:"string",id:25},fw_vendor_keys:{type:"bytes",id:26},unfinished_backup:{type:"bool",id:27},no_backup:{type:"bool",id:28},recovery_mode:{type:"bool",id:29},capabilities:{rule:"repeated",type:"Capability",id:30,options:{packed:!1}},backup_type:{type:"BackupType",id:31},sd_card_present:{type:"bool",id:32},sd_protection:{type:"bool",id:33},wipe_code_protection:{type:"bool",id:34},session_id:{type:"bytes",id:35},passphrase_always_on_device:{type:"bool",id:36},safety_checks:{type:"SafetyCheckLevel",id:37},auto_lock_delay_ms:{type:"uint32",id:38},display_rotation:{type:"uint32",id:39},experimental_features:{type:"bool",id:40},offset:{type:"uint32",id:500},ble_name:{type:"string",id:501},ble_ver:{type:"string",id:502},ble_enable:{type:"bool",id:503},se_enable:{type:"bool",id:504},se_ver:{type:"string",id:506},backup_only:{type:"bool",id:507},onekey_version:{type:"string",id:508},onekey_serial:{type:"string",id:509},bootloader_version:{type:"string",id:510},serial_no:{type:"string",id:511},spi_flash:{type:"string",id:512},initstates:{type:"uint32",id:513},NFT_voucher:{type:"bytes",id:514},cpu_info:{type:"string",id:515},pre_firmware:{type:"string",id:516},coin_switch:{type:"uint32",id:517},build_id:{type:"string",id:518},battery_level:{type:"uint32",id:520}},nested:{Capability:{options:{"(has_bitcoin_only_values)":!0},values:{Capability_Bitcoin:1,Capability_Bitcoin_like:2,Capability_Binance:3,Capability_Cardano:4,Capability_Crypto:5,Capability_EOS:6,Capability_Ethereum:7,Capability_Lisk:8,Capability_Monero:9,Capability_NEM:10,Capability_Ripple:11,Capability_Stellar:12,Capability_Tezos:13,Capability_U2F:14,Capability_Shamir:15,Capability_ShamirGroups:16,Capability_PassphraseEntry:17}}}},LockDevice:{fields:{}},EndSession:{fields:{}},ApplySettings:{fields:{language:{type:"string",id:1},label:{type:"string",id:2},use_passphrase:{type:"bool",id:3},homescreen:{type:"bytes",id:4},_passphrase_source:{type:"uint32",id:5,options:{deprecated:!0}},auto_lock_delay_ms:{type:"uint32",id:6},display_rotation:{type:"uint32",id:7},passphrase_always_on_device:{type:"bool",id:8},safety_checks:{type:"SafetyCheckLevel",id:9},experimental_features:{type:"bool",id:10},use_ble:{type:"bool",id:100},use_se:{type:"bool",id:101},is_bixinapp:{type:"bool",id:102},fastpay_pin:{type:"bool",id:103},fastpay_confirm:{type:"bool",id:104},fastpay_money_limit:{type:"uint64",id:105},fastpay_times:{type:"uint32",id:106}},nested:{ExportType:{values:{SeedEncExportType_NO:0,SeedEncExportType_YES:1,MnemonicPlainExportType_YES:2}}}},ApplyFlags:{fields:{flags:{rule:"required",type:"uint32",id:1}}},ChangePin:{fields:{remove:{type:"bool",id:1}}},ChangeWipeCode:{fields:{remove:{type:"bool",id:1}}},SdProtect:{fields:{operation:{rule:"required",type:"SdProtectOperationType",id:1}},nested:{SdProtectOperationType:{values:{DISABLE:0,ENABLE:1,REFRESH:2}}}},Ping:{fields:{message:{type:"string",id:1,options:{default:""}},button_protection:{type:"bool",id:2}}},Cancel:{fields:{}},GetEntropy:{fields:{size:{rule:"required",type:"uint32",id:1}}},Entropy:{fields:{entropy:{rule:"required",type:"bytes",id:1}}},WipeDevice:{fields:{}},LoadDevice:{fields:{mnemonics:{rule:"repeated",type:"string",id:1},pin:{type:"string",id:3},passphrase_protection:{type:"bool",id:4},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},skip_checksum:{type:"bool",id:7},u2f_counter:{type:"uint32",id:8},needs_backup:{type:"bool",id:9},no_backup:{type:"bool",id:10}}},ResetDevice:{fields:{display_random:{type:"bool",id:1},strength:{type:"uint32",id:2,options:{default:256}},passphrase_protection:{type:"bool",id:3},pin_protection:{type:"bool",id:4},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},u2f_counter:{type:"uint32",id:7},skip_backup:{type:"bool",id:8},no_backup:{type:"bool",id:9},backup_type:{type:"BackupType",id:10,options:{default:"Bip39"}}}},BackupDevice:{fields:{}},EntropyRequest:{fields:{}},EntropyAck:{fields:{entropy:{rule:"required",type:"bytes",id:1}}},RecoveryDevice:{fields:{word_count:{type:"uint32",id:1},passphrase_protection:{type:"bool",id:2},pin_protection:{type:"bool",id:3},language:{type:"string",id:4},label:{type:"string",id:5},enforce_wordlist:{type:"bool",id:6},type:{type:"RecoveryDeviceType",id:8},u2f_counter:{type:"uint32",id:9},dry_run:{type:"bool",id:10}},nested:{RecoveryDeviceType:{values:{RecoveryDeviceType_ScrambledWords:0,RecoveryDeviceType_Matrix:1}}}},WordRequest:{fields:{type:{rule:"required",type:"WordRequestType",id:1}},nested:{WordRequestType:{values:{WordRequestType_Plain:0,WordRequestType_Matrix9:1,WordRequestType_Matrix6:2}}}},WordAck:{fields:{word:{rule:"required",type:"string",id:1}}},SetU2FCounter:{fields:{u2f_counter:{rule:"required",type:"uint32",id:1}}},GetNextU2FCounter:{fields:{}},NextU2FCounter:{fields:{u2f_counter:{rule:"required",type:"uint32",id:1}}},DoPreauthorized:{fields:{}},PreauthorizedRequest:{fields:{}},CancelAuthorization:{fields:{}},BixinSeedOperate:{fields:{type:{rule:"required",type:"SeedRequestType",id:1},seed_importData:{type:"bytes",id:2}},nested:{SeedRequestType:{values:{SeedRequestType_Gen:0,SeedRequestType_EncExport:1,SeedRequestType_EncImport:2}}}},BixinMessageSE:{fields:{inputmessage:{rule:"required",type:"bytes",id:1}}},BixinOutMessageSE:{fields:{outmessage:{type:"bytes",id:1}}},DeviceBackToBoot:{fields:{}},BixinBackupRequest:{fields:{}},BixinBackupAck:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinRestoreRequest:{fields:{data:{rule:"required",type:"bytes",id:1},language:{type:"string",id:2},label:{type:"string",id:3},passphrase_protection:{type:"bool",id:4}}},BixinRestoreAck:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinVerifyDeviceRequest:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinVerifyDeviceAck:{fields:{cert:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},BixinWhiteListRequest:{fields:{type:{rule:"required",type:"WL_OperationType",id:1},addr_in:{type:"string",id:2}},nested:{WL_OperationType:{values:{WL_OperationType_Add:0,WL_OperationType_Delete:1,WL_OperationType_Inquire:2}}}},BixinWhiteListAck:{fields:{address:{rule:"repeated",type:"string",id:1}}},BixinLoadDevice:{fields:{mnemonics:{rule:"required",type:"string",id:1},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},skip_checksum:{type:"bool",id:7}}},BixinBackupDevice:{fields:{}},BixinBackupDeviceAck:{fields:{mnemonics:{rule:"required",type:"string",id:1}}},DeviceInfoSettings:{fields:{serial_no:{type:"string",id:1},cpu_info:{type:"string",id:2},pre_firmware:{type:"string",id:3}}},GetDeviceInfo:{fields:{}},DeviceInfo:{fields:{serial_no:{type:"string",id:1},spiFlash_info:{type:"string",id:2},SE_info:{type:"string",id:3},NFT_voucher:{type:"bytes",id:4},cpu_info:{type:"string",id:5},pre_firmware:{type:"string",id:6}}},ReadSEPublicKey:{fields:{}},SEPublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},WriteSEPublicCert:{fields:{public_cert:{rule:"required",type:"bytes",id:1}}},ReadSEPublicCert:{fields:{}},SEPublicCert:{fields:{public_cert:{rule:"required",type:"bytes",id:1}}},SpiFlashWrite:{fields:{address:{rule:"required",type:"uint32",id:1},data:{rule:"required",type:"bytes",id:2}}},SpiFlashRead:{fields:{address:{rule:"required",type:"uint32",id:1},len:{rule:"required",type:"uint32",id:2}}},SpiFlashData:{fields:{data:{rule:"required",type:"bytes",id:1}}},SESignMessage:{fields:{message:{rule:"required",type:"bytes",id:1}}},SEMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1}}},ResourceUpload:{fields:{extension:{rule:"required",type:"string",id:1},data_length:{rule:"required",type:"uint32",id:2},res_type:{rule:"required",type:"ResourceType",id:3},nft_meta_data:{type:"bytes",id:4},zoom_data_length:{rule:"required",type:"uint32",id:5},file_name_no_ext:{type:"string",id:6}},nested:{ResourceType:{values:{WallPaper:0,Nft:1}}}},ZoomRequest:{fields:{offset:{type:"uint32",id:1},data_length:{rule:"required",type:"uint32",id:2}}},ResourceRequest:{fields:{offset:{type:"uint32",id:1},data_length:{rule:"required",type:"uint32",id:2}}},ResourceAck:{fields:{data_chunk:{rule:"required",type:"bytes",id:1},hash:{type:"bytes",id:2}}},ResourceUpdate:{fields:{file_name:{rule:"required",type:"string",id:1},data_length:{rule:"required",type:"uint32",id:2},initial_data_chunk:{rule:"required",type:"bytes",id:3},hash:{type:"bytes",id:4}}},NFTWriteInfo:{fields:{index:{rule:"required",type:"uint32",id:1},width:{rule:"required",type:"uint32",id:2},height:{rule:"required",type:"uint32",id:3},name_zh:{type:"string",id:4},name_en:{type:"string",id:5}}},NFTWriteData:{fields:{index:{rule:"required",type:"uint32",id:1},data:{rule:"required",type:"bytes",id:2},offset:{rule:"required",type:"uint32",id:3}}},RebootToBootloader:{fields:{}},RebootToBoardloader:{fields:{}},ListResDir:{fields:{path:{rule:"required",type:"string",id:1}}},FileInfoList:{fields:{files:{rule:"repeated",type:"FileInfo",id:1}},nested:{FileInfo:{fields:{name:{rule:"required",type:"string",id:1},size:{rule:"required",type:"uint64",id:2}}}}},DeviceEraseSector:{fields:{sector:{rule:"required",type:"uint32",id:1}}},MoneroTransactionSourceEntry:{fields:{outputs:{rule:"repeated",type:"MoneroOutputEntry",id:1},real_output:{type:"uint64",id:2},real_out_tx_key:{type:"bytes",id:3},real_out_additional_tx_keys:{rule:"repeated",type:"bytes",id:4},real_output_in_tx_index:{type:"uint64",id:5},amount:{type:"uint64",id:6},rct:{type:"bool",id:7},mask:{type:"bytes",id:8},multisig_kLRki:{type:"MoneroMultisigKLRki",id:9},subaddr_minor:{type:"uint32",id:10}},nested:{MoneroOutputEntry:{fields:{idx:{type:"uint64",id:1},key:{type:"MoneroRctKeyPublic",id:2}},nested:{MoneroRctKeyPublic:{fields:{dest:{type:"bytes",id:1},commitment:{type:"bytes",id:2}}}}},MoneroMultisigKLRki:{fields:{K:{type:"bytes",id:1},L:{type:"bytes",id:2},R:{type:"bytes",id:3},ki:{type:"bytes",id:4}}}}},MoneroTransactionDestinationEntry:{fields:{amount:{type:"uint64",id:1},addr:{type:"MoneroAccountPublicAddress",id:2},is_subaddress:{type:"bool",id:3},original:{type:"bytes",id:4},is_integrated:{type:"bool",id:5}},nested:{MoneroAccountPublicAddress:{fields:{spend_public_key:{type:"bytes",id:1},view_public_key:{type:"bytes",id:2}}}}},MoneroTransactionRsigData:{fields:{rsig_type:{type:"uint32",id:1},offload_type:{type:"uint32",id:2},grouping:{rule:"repeated",type:"uint64",id:3,options:{packed:!1}},mask:{type:"bytes",id:4},rsig:{type:"bytes",id:5},rsig_parts:{rule:"repeated",type:"bytes",id:6},bp_version:{type:"uint32",id:7}}},MoneroGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},network_type:{type:"uint32",id:3},account:{type:"uint32",id:4},minor:{type:"uint32",id:5},payment_id:{type:"bytes",id:6}}},MoneroAddress:{fields:{address:{type:"bytes",id:1}}},MoneroGetWatchKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2}}},MoneroWatchKey:{fields:{watch_key:{type:"bytes",id:1},address:{type:"bytes",id:2}}},MoneroTransactionInitRequest:{fields:{version:{type:"uint32",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},network_type:{type:"uint32",id:3},tsx_data:{type:"MoneroTransactionData",id:4}},nested:{MoneroTransactionData:{fields:{version:{type:"uint32",id:1},payment_id:{type:"bytes",id:2},unlock_time:{type:"uint64",id:3},outputs:{rule:"repeated",type:"MoneroTransactionDestinationEntry",id:4},change_dts:{type:"MoneroTransactionDestinationEntry",id:5},num_inputs:{type:"uint32",id:6},mixin:{type:"uint32",id:7},fee:{type:"uint64",id:8},account:{type:"uint32",id:9},minor_indices:{rule:"repeated",type:"uint32",id:10,options:{packed:!1}},rsig_data:{type:"MoneroTransactionRsigData",id:11},integrated_indices:{rule:"repeated",type:"uint32",id:12,options:{packed:!1}},client_version:{type:"uint32",id:13},hard_fork:{type:"uint32",id:14},monero_version:{type:"bytes",id:15}}}}},MoneroTransactionInitAck:{fields:{hmacs:{rule:"repeated",type:"bytes",id:1},rsig_data:{type:"MoneroTransactionRsigData",id:2}}},MoneroTransactionSetInputRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1}}},MoneroTransactionSetInputAck:{fields:{vini:{type:"bytes",id:1},vini_hmac:{type:"bytes",id:2},pseudo_out:{type:"bytes",id:3},pseudo_out_hmac:{type:"bytes",id:4},pseudo_out_alpha:{type:"bytes",id:5},spend_key:{type:"bytes",id:6}}},MoneroTransactionInputsPermutationRequest:{fields:{perm:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},MoneroTransactionInputsPermutationAck:{fields:{}},MoneroTransactionInputViniRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1},vini:{type:"bytes",id:2},vini_hmac:{type:"bytes",id:3},pseudo_out:{type:"bytes",id:4},pseudo_out_hmac:{type:"bytes",id:5},orig_idx:{type:"uint32",id:6}}},MoneroTransactionInputViniAck:{fields:{}},MoneroTransactionAllInputsSetRequest:{fields:{}},MoneroTransactionAllInputsSetAck:{fields:{rsig_data:{type:"MoneroTransactionRsigData",id:1}}},MoneroTransactionSetOutputRequest:{fields:{dst_entr:{type:"MoneroTransactionDestinationEntry",id:1},dst_entr_hmac:{type:"bytes",id:2},rsig_data:{type:"MoneroTransactionRsigData",id:3},is_offloaded_bp:{type:"bool",id:4}}},MoneroTransactionSetOutputAck:{fields:{tx_out:{type:"bytes",id:1},vouti_hmac:{type:"bytes",id:2},rsig_data:{type:"MoneroTransactionRsigData",id:3},out_pk:{type:"bytes",id:4},ecdh_info:{type:"bytes",id:5}}},MoneroTransactionAllOutSetRequest:{fields:{rsig_data:{type:"MoneroTransactionRsigData",id:1}}},MoneroTransactionAllOutSetAck:{fields:{extra:{type:"bytes",id:1},tx_prefix_hash:{type:"bytes",id:2},rv:{type:"MoneroRingCtSig",id:4},full_message_hash:{type:"bytes",id:5}},nested:{MoneroRingCtSig:{fields:{txn_fee:{type:"uint64",id:1},message:{type:"bytes",id:2},rv_type:{type:"uint32",id:3}}}}},MoneroTransactionSignInputRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1},vini:{type:"bytes",id:2},vini_hmac:{type:"bytes",id:3},pseudo_out:{type:"bytes",id:4},pseudo_out_hmac:{type:"bytes",id:5},pseudo_out_alpha:{type:"bytes",id:6},spend_key:{type:"bytes",id:7},orig_idx:{type:"uint32",id:8}}},MoneroTransactionSignInputAck:{fields:{signature:{type:"bytes",id:1},pseudo_out:{type:"bytes",id:2}}},MoneroTransactionFinalRequest:{fields:{}},MoneroTransactionFinalAck:{fields:{cout_key:{type:"bytes",id:1},salt:{type:"bytes",id:2},rand_mult:{type:"bytes",id:3},tx_enc_keys:{type:"bytes",id:4},opening_key:{type:"bytes",id:5}}},MoneroKeyImageExportInitRequest:{fields:{num:{type:"uint64",id:1},hash:{type:"bytes",id:2},address_n:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},network_type:{type:"uint32",id:4},subs:{rule:"repeated",type:"MoneroSubAddressIndicesList",id:5}},nested:{MoneroSubAddressIndicesList:{fields:{account:{type:"uint32",id:1},minor_indices:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}}}},MoneroKeyImageExportInitAck:{fields:{}},MoneroKeyImageSyncStepRequest:{fields:{tdis:{rule:"repeated",type:"MoneroTransferDetails",id:1}},nested:{MoneroTransferDetails:{fields:{out_key:{type:"bytes",id:1},tx_pub_key:{type:"bytes",id:2},additional_tx_pub_keys:{rule:"repeated",type:"bytes",id:3},internal_output_index:{type:"uint64",id:4},sub_addr_major:{type:"uint32",id:5},sub_addr_minor:{type:"uint32",id:6}}}}},MoneroKeyImageSyncStepAck:{fields:{kis:{rule:"repeated",type:"MoneroExportedKeyImage",id:1}},nested:{MoneroExportedKeyImage:{fields:{iv:{type:"bytes",id:1},blob:{type:"bytes",id:3}}}}},MoneroKeyImageSyncFinalRequest:{fields:{}},MoneroKeyImageSyncFinalAck:{fields:{enc_key:{type:"bytes",id:1}}},MoneroGetTxKeyRequest:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2},salt1:{type:"bytes",id:3},salt2:{type:"bytes",id:4},tx_enc_keys:{type:"bytes",id:5},tx_prefix_hash:{type:"bytes",id:6},reason:{type:"uint32",id:7},view_public_key:{type:"bytes",id:8}}},MoneroGetTxKeyAck:{fields:{salt:{type:"bytes",id:1},tx_keys:{type:"bytes",id:2},tx_derivations:{type:"bytes",id:3}}},MoneroLiveRefreshStartRequest:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2}}},MoneroLiveRefreshStartAck:{fields:{}},MoneroLiveRefreshStepRequest:{fields:{out_key:{type:"bytes",id:1},recv_deriv:{type:"bytes",id:2},real_out_idx:{type:"uint64",id:3},sub_addr_major:{type:"uint32",id:4},sub_addr_minor:{type:"uint32",id:5}}},MoneroLiveRefreshStepAck:{fields:{salt:{type:"bytes",id:1},key_image:{type:"bytes",id:2}}},MoneroLiveRefreshFinalRequest:{fields:{}},MoneroLiveRefreshFinalAck:{fields:{}},DebugMoneroDiagRequest:{fields:{ins:{type:"uint64",id:1},p1:{type:"uint64",id:2},p2:{type:"uint64",id:3},pd:{rule:"repeated",type:"uint64",id:4,options:{packed:!1}},data1:{type:"bytes",id:5},data2:{type:"bytes",id:6}}},DebugMoneroDiagAck:{fields:{ins:{type:"uint64",id:1},p1:{type:"uint64",id:2},p2:{type:"uint64",id:3},pd:{rule:"repeated",type:"uint64",id:4,options:{packed:!1}},data1:{type:"bytes",id:5},data2:{type:"bytes",id:6}}},NearGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},NearAddress:{fields:{address:{type:"string",id:1}}},NearSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},NearSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},NEMGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},show_display:{type:"bool",id:3}}},NEMAddress:{fields:{address:{rule:"required",type:"string",id:1}}},NEMSignTx:{fields:{transaction:{type:"NEMTransactionCommon",id:1},multisig:{type:"NEMTransactionCommon",id:2},transfer:{type:"NEMTransfer",id:3},cosigning:{type:"bool",id:4},provision_namespace:{type:"NEMProvisionNamespace",id:5},mosaic_creation:{type:"NEMMosaicCreation",id:6},supply_change:{type:"NEMMosaicSupplyChange",id:7},aggregate_modification:{type:"NEMAggregateModification",id:8},importance_transfer:{type:"NEMImportanceTransfer",id:9}},nested:{NEMTransactionCommon:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},timestamp:{type:"uint32",id:3},fee:{type:"uint64",id:4},deadline:{type:"uint32",id:5},signer:{type:"bytes",id:6}}},NEMTransfer:{fields:{recipient:{type:"string",id:1},amount:{type:"uint64",id:2},payload:{type:"bytes",id:3},public_key:{type:"bytes",id:4},mosaics:{rule:"repeated",type:"NEMMosaic",id:5}},nested:{NEMMosaic:{fields:{namespace:{type:"string",id:1},mosaic:{type:"string",id:2},quantity:{type:"uint64",id:3}}}}},NEMProvisionNamespace:{fields:{namespace:{type:"string",id:1},parent:{type:"string",id:2},sink:{type:"string",id:3},fee:{type:"uint64",id:4}}},NEMMosaicCreation:{fields:{definition:{type:"NEMMosaicDefinition",id:1},sink:{type:"string",id:2},fee:{type:"uint64",id:3}},nested:{NEMMosaicDefinition:{fields:{name:{type:"string",id:1},ticker:{type:"string",id:2},namespace:{type:"string",id:3},mosaic:{type:"string",id:4},divisibility:{type:"uint32",id:5},levy:{type:"NEMMosaicLevy",id:6},fee:{type:"uint64",id:7},levy_address:{type:"string",id:8},levy_namespace:{type:"string",id:9},levy_mosaic:{type:"string",id:10},supply:{type:"uint64",id:11},mutable_supply:{type:"bool",id:12},transferable:{type:"bool",id:13},description:{type:"string",id:14},networks:{rule:"repeated",type:"uint32",id:15,options:{packed:!1}}},nested:{NEMMosaicLevy:{values:{MosaicLevy_Absolute:1,MosaicLevy_Percentile:2}}}}}},NEMMosaicSupplyChange:{fields:{namespace:{type:"string",id:1},mosaic:{type:"string",id:2},type:{type:"NEMSupplyChangeType",id:3},delta:{type:"uint64",id:4}},nested:{NEMSupplyChangeType:{values:{SupplyChange_Increase:1,SupplyChange_Decrease:2}}}},NEMAggregateModification:{fields:{modifications:{rule:"repeated",type:"NEMCosignatoryModification",id:1},relative_change:{type:"sint32",id:2}},nested:{NEMCosignatoryModification:{fields:{type:{type:"NEMModificationType",id:1},public_key:{type:"bytes",id:2}},nested:{NEMModificationType:{values:{CosignatoryModification_Add:1,CosignatoryModification_Delete:2}}}}}},NEMImportanceTransfer:{fields:{mode:{type:"NEMImportanceTransferMode",id:1},public_key:{type:"bytes",id:2}},nested:{NEMImportanceTransferMode:{values:{ImportanceTransfer_Activate:1,ImportanceTransfer_Deactivate:2}}}}}},NEMSignedTx:{fields:{data:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},NEMDecryptMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},public_key:{type:"bytes",id:3},payload:{type:"bytes",id:4}}},NEMDecryptedMessage:{fields:{payload:{rule:"required",type:"bytes",id:1}}},PolkadotGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prefix:{rule:"required",type:"uint32",id:2},network:{rule:"required",type:"string",id:3},show_display:{type:"bool",id:4}}},PolkadotAddress:{fields:{address:{type:"string",id:1},public_key:{type:"string",id:2}}},PolkadotSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2},network:{rule:"required",type:"string",id:3}}},PolkadotSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},RippleGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},RippleAddress:{fields:{address:{rule:"required",type:"string",id:1}}},RippleSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},fee:{type:"uint64",id:2},flags:{type:"uint32",id:3},sequence:{type:"uint32",id:4},last_ledger_sequence:{type:"uint32",id:5},payment:{type:"RipplePayment",id:6}},nested:{RipplePayment:{fields:{amount:{rule:"required",type:"uint64",id:1},destination:{rule:"required",type:"string",id:2},destination_tag:{type:"uint32",id:3}}}}},RippleSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},serialized_tx:{rule:"required",type:"bytes",id:2}}},SolanaGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},SolanaAddress:{fields:{address:{type:"string",id:1}}},SolanaSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},SolanaSignedTx:{fields:{signature:{type:"bytes",id:1}}},StarcoinGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StarcoinAddress:{fields:{address:{type:"string",id:1}}},StarcoinGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StarcoinPublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},StarcoinSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{type:"bytes",id:2}}},StarcoinSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},StarcoinSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{type:"bytes",id:2}}},StarcoinMessageSignature:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},StarcoinVerifyMessage:{fields:{public_key:{type:"bytes",id:1},signature:{type:"bytes",id:2},message:{type:"bytes",id:3}}},StellarAssetType:{values:{NATIVE:0,ALPHANUM4:1,ALPHANUM12:2}},StellarAsset:{fields:{type:{rule:"required",type:"StellarAssetType",id:1},code:{type:"string",id:2},issuer:{type:"string",id:3}}},StellarGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StellarAddress:{fields:{address:{rule:"required",type:"string",id:1}}},StellarSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},network_passphrase:{rule:"required",type:"string",id:3},source_account:{rule:"required",type:"string",id:4},fee:{rule:"required",type:"uint32",id:5},sequence_number:{rule:"required",type:"uint64",id:6},timebounds_start:{rule:"required",type:"uint32",id:8},timebounds_end:{rule:"required",type:"uint32",id:9},memo_type:{rule:"required",type:"StellarMemoType",id:10},memo_text:{type:"string",id:11},memo_id:{type:"uint64",id:12},memo_hash:{type:"bytes",id:13},num_operations:{rule:"required",type:"uint32",id:14}},nested:{StellarMemoType:{values:{NONE:0,TEXT:1,ID:2,HASH:3,RETURN:4}}}},StellarTxOpRequest:{fields:{}},StellarPaymentOp:{fields:{source_account:{type:"string",id:1},destination_account:{rule:"required",type:"string",id:2},asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4}}},StellarCreateAccountOp:{fields:{source_account:{type:"string",id:1},new_account:{rule:"required",type:"string",id:2},starting_balance:{rule:"required",type:"sint64",id:3}}},StellarPathPaymentStrictReceiveOp:{fields:{source_account:{type:"string",id:1},send_asset:{rule:"required",type:"StellarAsset",id:2},send_max:{rule:"required",type:"sint64",id:3},destination_account:{rule:"required",type:"string",id:4},destination_asset:{rule:"required",type:"StellarAsset",id:5},destination_amount:{rule:"required",type:"sint64",id:6},paths:{rule:"repeated",type:"StellarAsset",id:7}}},StellarPathPaymentStrictSendOp:{fields:{source_account:{type:"string",id:1},send_asset:{rule:"required",type:"StellarAsset",id:2},send_amount:{rule:"required",type:"sint64",id:3},destination_account:{rule:"required",type:"string",id:4},destination_asset:{rule:"required",type:"StellarAsset",id:5},destination_min:{rule:"required",type:"sint64",id:6},paths:{rule:"repeated",type:"StellarAsset",id:7}}},StellarManageSellOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6},offer_id:{rule:"required",type:"uint64",id:7}}},StellarManageBuyOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6},offer_id:{rule:"required",type:"uint64",id:7}}},StellarCreatePassiveSellOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6}}},StellarSetOptionsOp:{fields:{source_account:{type:"string",id:1},inflation_destination_account:{type:"string",id:2},clear_flags:{type:"uint32",id:3},set_flags:{type:"uint32",id:4},master_weight:{type:"uint32",id:5},low_threshold:{type:"uint32",id:6},medium_threshold:{type:"uint32",id:7},high_threshold:{type:"uint32",id:8},home_domain:{type:"string",id:9},signer_type:{type:"StellarSignerType",id:10},signer_key:{type:"bytes",id:11},signer_weight:{type:"uint32",id:12}},nested:{StellarSignerType:{values:{ACCOUNT:0,PRE_AUTH:1,HASH:2}}}},StellarChangeTrustOp:{fields:{source_account:{type:"string",id:1},asset:{rule:"required",type:"StellarAsset",id:2},limit:{rule:"required",type:"uint64",id:3}}},StellarAllowTrustOp:{fields:{source_account:{type:"string",id:1},trusted_account:{rule:"required",type:"string",id:2},asset_type:{rule:"required",type:"StellarAssetType",id:3},asset_code:{type:"string",id:4},is_authorized:{rule:"required",type:"bool",id:5}}},StellarAccountMergeOp:{fields:{source_account:{type:"string",id:1},destination_account:{rule:"required",type:"string",id:2}}},StellarManageDataOp:{fields:{source_account:{type:"string",id:1},key:{rule:"required",type:"string",id:2},value:{type:"bytes",id:3}}},StellarBumpSequenceOp:{fields:{source_account:{type:"string",id:1},bump_to:{rule:"required",type:"uint64",id:2}}},StellarSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},SuiGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},SuiAddress:{fields:{address:{type:"string",id:1}}},SuiSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},SuiSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},TezosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TezosAddress:{fields:{address:{rule:"required",type:"string",id:1}}},TezosGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TezosPublicKey:{fields:{public_key:{rule:"required",type:"string",id:1}}},TezosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},branch:{rule:"required",type:"bytes",id:2},reveal:{type:"TezosRevealOp",id:3},transaction:{type:"TezosTransactionOp",id:4},origination:{type:"TezosOriginationOp",id:5},delegation:{type:"TezosDelegationOp",id:6},proposal:{type:"TezosProposalOp",id:7},ballot:{type:"TezosBallotOp",id:8}},nested:{TezosContractID:{fields:{tag:{rule:"required",type:"TezosContractType",id:1},hash:{rule:"required",type:"bytes",id:2}},nested:{TezosContractType:{values:{Implicit:0,Originated:1}}}},TezosRevealOp:{fields:{source:{rule:"required",type:"bytes",id:7},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},public_key:{rule:"required",type:"bytes",id:6}}},TezosTransactionOp:{fields:{source:{rule:"required",type:"bytes",id:9},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},amount:{rule:"required",type:"uint64",id:6},destination:{rule:"required",type:"TezosContractID",id:7},parameters:{type:"bytes",id:8},parameters_manager:{type:"TezosParametersManager",id:10}},nested:{TezosParametersManager:{fields:{set_delegate:{type:"bytes",id:1},cancel_delegate:{type:"bool",id:2},transfer:{type:"TezosManagerTransfer",id:3}},nested:{TezosManagerTransfer:{fields:{destination:{type:"TezosContractID",id:1},amount:{type:"uint64",id:2}}}}}}},TezosOriginationOp:{fields:{source:{rule:"required",type:"bytes",id:12},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},manager_pubkey:{type:"bytes",id:6},balance:{rule:"required",type:"uint64",id:7},spendable:{type:"bool",id:8},delegatable:{type:"bool",id:9},delegate:{type:"bytes",id:10},script:{rule:"required",type:"bytes",id:11}}},TezosDelegationOp:{fields:{source:{rule:"required",type:"bytes",id:7},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},delegate:{rule:"required",type:"bytes",id:6}}},TezosProposalOp:{fields:{source:{type:"bytes",id:1},period:{type:"uint64",id:2},proposals:{rule:"repeated",type:"bytes",id:4}}},TezosBallotOp:{fields:{source:{type:"bytes",id:1},period:{type:"uint64",id:2},proposal:{type:"bytes",id:3},ballot:{type:"TezosBallotType",id:4}},nested:{TezosBallotType:{values:{Yay:0,Nay:1,Pass:2}}}}}},TezosSignedTx:{fields:{signature:{rule:"required",type:"string",id:1},sig_op_contents:{rule:"required",type:"bytes",id:2},operation_hash:{rule:"required",type:"string",id:3}}},TronGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TronAddress:{fields:{address:{type:"string",id:1}}},TronSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},ref_block_bytes:{rule:"required",type:"bytes",id:2},ref_block_hash:{rule:"required",type:"bytes",id:3},expiration:{rule:"required",type:"uint64",id:4},data:{type:"string",id:5},contract:{rule:"required",type:"TronContract",id:6},timestamp:{rule:"required",type:"uint64",id:7},fee_limit:{type:"uint64",id:8}},nested:{TronContract:{fields:{transfer_contract:{type:"TronTransferContract",id:2},freeze_balance_contract:{type:"TronFreezeBalanceContract",id:11},unfreeze_balance_contract:{type:"TronUnfreezeBalanceContract",id:12},withdraw_balance_contract:{type:"TronWithdrawBalanceContract",id:13},trigger_smart_contract:{type:"TronTriggerSmartContract",id:31},freeze_balance_v2_contract:{type:"TronFreezeBalanceV2Contract",id:54},unfreeze_balance_v2_contract:{type:"TronUnfreezeBalanceV2Contract",id:55},withdraw_expire_unfreeze_contract:{type:"TronWithdrawExpireUnfreezeContract",id:56},delegate_resource_contract:{type:"TronDelegateResourceContract",id:57},undelegate_resource_contract:{type:"TronUnDelegateResourceContract",id:58}},nested:{TronTransferContract:{fields:{to_address:{type:"string",id:2},amount:{type:"uint64",id:3}}},TronTriggerSmartContract:{fields:{contract_address:{type:"string",id:2},call_value:{type:"uint64",id:3},data:{type:"bytes",id:4},call_token_value:{type:"uint64",id:5},asset_id:{type:"uint64",id:6}}},TronResourceCode:{values:{BANDWIDTH:0,ENERGY:1}},TronFreezeBalanceContract:{fields:{frozen_balance:{type:"uint64",id:1},frozen_duration:{type:"uint64",id:2},resource:{type:"TronResourceCode",id:3},receiver_address:{type:"string",id:4}}},TronUnfreezeBalanceContract:{fields:{resource:{type:"TronResourceCode",id:1},receiver_address:{type:"string",id:2}}},TronWithdrawBalanceContract:{fields:{owner_address:{type:"bytes",id:1}}},TronFreezeBalanceV2Contract:{fields:{frozen_balance:{type:"uint64",id:2},resource:{type:"TronResourceCode",id:3}}},TronUnfreezeBalanceV2Contract:{fields:{unfreeze_balance:{type:"uint64",id:2},resource:{type:"TronResourceCode",id:3}}},TronWithdrawExpireUnfreezeContract:{fields:{}},TronDelegateResourceContract:{fields:{resource:{type:"TronResourceCode",id:2},balance:{type:"uint64",id:3},receiver_address:{type:"string",id:4},lock:{type:"bool",id:5}}},TronUnDelegateResourceContract:{fields:{resource:{type:"TronResourceCode",id:2},balance:{type:"uint64",id:3},receiver_address:{type:"string",id:4}}}}}}},TronSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},serialized_tx:{type:"bytes",id:2}}},TronSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2}}},TronMessageSignature:{fields:{address:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},WebAuthnListResidentCredentials:{fields:{}},WebAuthnAddResidentCredential:{fields:{credential_id:{type:"bytes",id:1}}},WebAuthnRemoveResidentCredential:{fields:{index:{type:"uint32",id:1}}},WebAuthnCredentials:{fields:{credentials:{rule:"repeated",type:"WebAuthnCredential",id:1}},nested:{WebAuthnCredential:{fields:{index:{type:"uint32",id:1},id:{type:"bytes",id:2},rp_id:{type:"string",id:3},rp_name:{type:"string",id:4},user_id:{type:"bytes",id:5},user_name:{type:"string",id:6},user_display_name:{type:"string",id:7},creation_time:{type:"uint32",id:8},hmac_secret:{type:"bool",id:9},use_sign_count:{type:"bool",id:10},algorithm:{type:"sint32",id:11},curve:{type:"sint32",id:12}}}}},wire_in:{type:"bool",id:50002,extend:"google.protobuf.EnumValueOptions"},wire_out:{type:"bool",id:50003,extend:"google.protobuf.EnumValueOptions"},wire_debug_in:{type:"bool",id:50004,extend:"google.protobuf.EnumValueOptions"},wire_debug_out:{type:"bool",id:50005,extend:"google.protobuf.EnumValueOptions"},wire_tiny:{type:"bool",id:50006,extend:"google.protobuf.EnumValueOptions"},wire_bootloader:{type:"bool",id:50007,extend:"google.protobuf.EnumValueOptions"},wire_no_fsm:{type:"bool",id:50008,extend:"google.protobuf.EnumValueOptions"},facotry:{type:"bool",id:50501,extend:"google.protobuf.EnumValueOptions"},bitcoin_only:{type:"bool",id:6e4,extend:"google.protobuf.EnumValueOptions"},has_bitcoin_only_values:{type:"bool",id:51001,extend:"google.protobuf.EnumOptions"},unstable:{type:"bool",id:52001,extend:"google.protobuf.MessageOptions"},wire_type:{type:"uint32",id:52002,extend:"google.protobuf.MessageOptions"},experimental:{type:"bool",id:53001,extend:"google.protobuf.FieldOptions"},include_in_bitcoin_only:{type:"bool",id:6e4,extend:"google.protobuf.FileOptions"},CommandFlags:{values:{Default:0,Factory_Only:1}},MessageType:{options:{"(has_bitcoin_only_values)":!0},values:{MessageType_Initialize:0,MessageType_Ping:1,MessageType_Success:2,MessageType_Failure:3,MessageType_ChangePin:4,MessageType_WipeDevice:5,MessageType_GetEntropy:9,MessageType_Entropy:10,MessageType_LoadDevice:13,MessageType_ResetDevice:14,MessageType_Features:17,MessageType_PinMatrixRequest:18,MessageType_PinMatrixAck:19,MessageType_Cancel:20,MessageType_LockDevice:24,MessageType_ApplySettings:25,MessageType_ButtonRequest:26,MessageType_ButtonAck:27,MessageType_ApplyFlags:28,MessageType_BackupDevice:34,MessageType_EntropyRequest:35,MessageType_EntropyAck:36,MessageType_PassphraseRequest:41,MessageType_PassphraseAck:42,MessageType_RecoveryDevice:45,MessageType_WordRequest:46,MessageType_WordAck:47,MessageType_GetFeatures:55,MessageType_SdProtect:79,MessageType_ChangeWipeCode:82,MessageType_EndSession:83,MessageType_DoPreauthorized:84,MessageType_PreauthorizedRequest:85,MessageType_CancelAuthorization:86,MessageType_RebootToBootloader:87,MessageType_SetU2FCounter:63,MessageType_GetNextU2FCounter:80,MessageType_NextU2FCounter:81,MessageType_Deprecated_PassphraseStateRequest:77,MessageType_Deprecated_PassphraseStateAck:78,MessageType_FirmwareErase:6,MessageType_FirmwareErase_ex:16,MessageType_FirmwareUpload:7,MessageType_FirmwareRequest:8,MessageType_SelfTest:32,MessageType_Reboot:3e4,MessageType_FirmwareUpdateEmmc:30001,MessageType_GetPublicKey:11,MessageType_PublicKey:12,MessageType_SignTx:15,MessageType_TxRequest:21,MessageType_TxAck:22,MessageType_GetAddress:29,MessageType_Address:30,MessageType_SignMessage:38,MessageType_VerifyMessage:39,MessageType_MessageSignature:40,MessageType_GetOwnershipId:43,MessageType_OwnershipId:44,MessageType_GetOwnershipProof:49,MessageType_OwnershipProof:50,MessageType_AuthorizeCoinJoin:51,MessageType_CipherKeyValue:23,MessageType_CipheredKeyValue:48,MessageType_SignIdentity:53,MessageType_SignedIdentity:54,MessageType_GetECDHSessionKey:61,MessageType_ECDHSessionKey:62,MessageType_CosiCommit:71,MessageType_CosiCommitment:72,MessageType_CosiSign:73,MessageType_CosiSignature:74,MessageType_BatchGetPublickeys:10016,MessageType_EcdsaPublicKeys:10017,MessageType_DebugLinkDecision:100,MessageType_DebugLinkGetState:101,MessageType_DebugLinkState:102,MessageType_DebugLinkStop:103,MessageType_DebugLinkLog:104,MessageType_DebugLinkMemoryRead:110,MessageType_DebugLinkMemory:111,MessageType_DebugLinkMemoryWrite:112,MessageType_DebugLinkFlashErase:113,MessageType_DebugLinkLayout:9001,MessageType_DebugLinkReseedRandom:9002,MessageType_DebugLinkRecordScreen:9003,MessageType_DebugLinkEraseSdCard:9005,MessageType_DebugLinkWatchLayout:9006,MessageType_EmmcFixPermission:30100,MessageType_EmmcPath:30101,MessageType_EmmcPathInfo:30102,MessageType_EmmcFile:30103,MessageType_EmmcFileRead:30104,MessageType_EmmcFileWrite:30105,MessageType_EmmcFileDelete:30106,MessageType_EmmcDir:30107,MessageType_EmmcDirList:30108,MessageType_EmmcDirMake:30109,MessageType_EmmcDirRemove:30110,MessageType_EthereumGetPublicKey:450,MessageType_EthereumPublicKey:451,MessageType_EthereumGetAddress:56,MessageType_EthereumAddress:57,MessageType_EthereumSignTx:58,MessageType_EthereumSignTxEIP1559:452,MessageType_EthereumTxRequest:59,MessageType_EthereumTxAck:60,MessageType_EthereumSignMessage:64,MessageType_EthereumVerifyMessage:65,MessageType_EthereumMessageSignature:66,MessageType_EthereumSignTypedData:464,MessageType_EthereumTypedDataStructRequest:465,MessageType_EthereumTypedDataStructAck:466,MessageType_EthereumTypedDataValueRequest:467,MessageType_EthereumTypedDataValueAck:468,MessageType_EthereumTypedDataSignature:469,MessageType_EthereumSignTypedHash:470,MessageType_NEMGetAddress:67,MessageType_NEMAddress:68,MessageType_NEMSignTx:69,MessageType_NEMSignedTx:70,MessageType_NEMDecryptMessage:75,MessageType_NEMDecryptedMessage:76,MessageType_TezosGetAddress:150,MessageType_TezosAddress:151,MessageType_TezosSignTx:152,MessageType_TezosSignedTx:153,MessageType_TezosGetPublicKey:154,MessageType_TezosPublicKey:155,MessageType_StellarSignTx:202,MessageType_StellarTxOpRequest:203,MessageType_StellarGetAddress:207,MessageType_StellarAddress:208,MessageType_StellarCreateAccountOp:210,MessageType_StellarPaymentOp:211,MessageType_StellarPathPaymentStrictReceiveOp:212,MessageType_StellarManageSellOfferOp:213,MessageType_StellarCreatePassiveSellOfferOp:214,MessageType_StellarSetOptionsOp:215,MessageType_StellarChangeTrustOp:216,MessageType_StellarAllowTrustOp:217,MessageType_StellarAccountMergeOp:218,MessageType_StellarManageDataOp:220,MessageType_StellarBumpSequenceOp:221,MessageType_StellarManageBuyOfferOp:222,MessageType_StellarPathPaymentStrictSendOp:223,MessageType_StellarSignedTx:230,MessageType_CardanoGetPublicKey:305,MessageType_CardanoPublicKey:306,MessageType_CardanoGetAddress:307,MessageType_CardanoAddress:308,MessageType_CardanoTxItemAck:313,MessageType_CardanoTxAuxiliaryDataSupplement:314,MessageType_CardanoTxWitnessRequest:315,MessageType_CardanoTxWitnessResponse:316,MessageType_CardanoTxHostAck:317,MessageType_CardanoTxBodyHash:318,MessageType_CardanoSignTxFinished:319,MessageType_CardanoSignTxInit:320,MessageType_CardanoTxInput:321,MessageType_CardanoTxOutput:322,MessageType_CardanoAssetGroup:323,MessageType_CardanoToken:324,MessageType_CardanoTxCertificate:325,MessageType_CardanoTxWithdrawal:326,MessageType_CardanoTxAuxiliaryData:327,MessageType_CardanoPoolOwner:328,MessageType_CardanoPoolRelayParameters:329,MessageType_CardanoGetNativeScriptHash:330,MessageType_CardanoNativeScriptHash:331,MessageType_CardanoTxMint:332,MessageType_CardanoTxCollateralInput:333,MessageType_CardanoTxRequiredSigner:334,MessageType_CardanoTxInlineDatumChunk:335,MessageType_CardanoTxReferenceScriptChunk:336,MessageType_CardanoTxReferenceInput:337,MessageType_CardanoSignMessage:350,MessageType_CardanoMessageSignature:351,MessageType_RippleGetAddress:400,MessageType_RippleAddress:401,MessageType_RippleSignTx:402,MessageType_RippleSignedTx:403,MessageType_MoneroTransactionInitRequest:501,MessageType_MoneroTransactionInitAck:502,MessageType_MoneroTransactionSetInputRequest:503,MessageType_MoneroTransactionSetInputAck:504,MessageType_MoneroTransactionInputsPermutationRequest:505,MessageType_MoneroTransactionInputsPermutationAck:506,MessageType_MoneroTransactionInputViniRequest:507,MessageType_MoneroTransactionInputViniAck:508,MessageType_MoneroTransactionAllInputsSetRequest:509,MessageType_MoneroTransactionAllInputsSetAck:510,MessageType_MoneroTransactionSetOutputRequest:511,MessageType_MoneroTransactionSetOutputAck:512,MessageType_MoneroTransactionAllOutSetRequest:513,MessageType_MoneroTransactionAllOutSetAck:514,MessageType_MoneroTransactionSignInputRequest:515,MessageType_MoneroTransactionSignInputAck:516,MessageType_MoneroTransactionFinalRequest:517,MessageType_MoneroTransactionFinalAck:518,MessageType_MoneroKeyImageExportInitRequest:530,MessageType_MoneroKeyImageExportInitAck:531,MessageType_MoneroKeyImageSyncStepRequest:532,MessageType_MoneroKeyImageSyncStepAck:533,MessageType_MoneroKeyImageSyncFinalRequest:534,MessageType_MoneroKeyImageSyncFinalAck:535,MessageType_MoneroGetAddress:540,MessageType_MoneroAddress:541,MessageType_MoneroGetWatchKey:542,MessageType_MoneroWatchKey:543,MessageType_DebugMoneroDiagRequest:546,MessageType_DebugMoneroDiagAck:547,MessageType_MoneroGetTxKeyRequest:550,MessageType_MoneroGetTxKeyAck:551,MessageType_MoneroLiveRefreshStartRequest:552,MessageType_MoneroLiveRefreshStartAck:553,MessageType_MoneroLiveRefreshStepRequest:554,MessageType_MoneroLiveRefreshStepAck:555,MessageType_MoneroLiveRefreshFinalRequest:556,MessageType_MoneroLiveRefreshFinalAck:557,MessageType_EosGetPublicKey:600,MessageType_EosPublicKey:601,MessageType_EosSignTx:602,MessageType_EosTxActionRequest:603,MessageType_EosTxActionAck:604,MessageType_EosSignedTx:605,MessageType_BinanceGetAddress:700,MessageType_BinanceAddress:701,MessageType_BinanceGetPublicKey:702,MessageType_BinancePublicKey:703,MessageType_BinanceSignTx:704,MessageType_BinanceTxRequest:705,MessageType_BinanceTransferMsg:706,MessageType_BinanceOrderMsg:707,MessageType_BinanceCancelMsg:708,MessageType_BinanceSignedTx:709,MessageType_SolanaGetAddress:10100,MessageType_SolanaAddress:10101,MessageType_SolanaSignTx:10102,MessageType_SolanaSignedTx:10103,MessageType_StarcoinGetAddress:10300,MessageType_StarcoinAddress:10301,MessageType_StarcoinGetPublicKey:10302,MessageType_StarcoinPublicKey:10303,MessageType_StarcoinSignTx:10304,MessageType_StarcoinSignedTx:10305,MessageType_StarcoinSignMessage:10306,MessageType_StarcoinMessageSignature:10307,MessageType_StarcoinVerifyMessage:10308,MessageType_AptosGetAddress:10600,MessageType_AptosAddress:10601,MessageType_AptosSignTx:10602,MessageType_AptosSignedTx:10603,MessageType_AptosSignMessage:10604,MessageType_AptosMessageSignature:10605,MessageType_WebAuthnListResidentCredentials:800,MessageType_WebAuthnCredentials:801,MessageType_WebAuthnAddResidentCredential:802,MessageType_WebAuthnRemoveResidentCredential:803,MessageType_BixinSeedOperate:901,MessageType_BixinMessageSE:902,MessageType_BixinOutMessageSE:904,MessageType_BixinBackupRequest:905,MessageType_BixinBackupAck:906,MessageType_BixinRestoreRequest:907,MessageType_BixinRestoreAck:908,MessageType_BixinVerifyDeviceRequest:909,MessageType_BixinVerifyDeviceAck:910,MessageType_BixinWhiteListRequest:911,MessageType_BixinWhiteListAck:912,MessageType_BixinLoadDevice:913,MessageType_BixinBackupDevice:914,MessageType_BixinBackupDeviceAck:915,MessageType_BixinPinInputOnDevice:1e4,MessageType_EthereumSignMessageEIP712:10200,MessageType_GetPublicKeyMultiple:10210,MessageType_PublicKeyMultiple:10211,MessageType_ConfluxGetAddress:10112,MessageType_ConfluxAddress:10113,MessageType_ConfluxSignTx:10114,MessageType_ConfluxTxRequest:10115,MessageType_ConfluxTxAck:10116,MessageType_ConfluxSignMessage:10117,MessageType_ConfluxSignMessageCIP23:10118,MessageType_ConfluxMessageSignature:10119,MessageType_TronGetAddress:10501,MessageType_TronAddress:10502,MessageType_TronSignTx:10503,MessageType_TronSignedTx:10504,MessageType_TronSignMessage:10505,MessageType_TronMessageSignature:10506,MessageType_NearGetAddress:10701,MessageType_NearAddress:10702,MessageType_NearSignTx:10703,MessageType_NearSignedTx:10704,MessageType_CosmosGetAddress:10800,MessageType_CosmosAddress:10801,MessageType_CosmosSignTx:10802,MessageType_CosmosSignedTx:10803,MessageType_AlgorandGetAddress:10900,MessageType_AlgorandAddress:10901,MessageType_AlgorandSignTx:10902,MessageType_AlgorandSignedTx:10903,MessageType_PolkadotGetAddress:11e3,MessageType_PolkadotAddress:11001,MessageType_PolkadotSignTx:11002,MessageType_PolkadotSignedTx:11003,MessageType_SuiGetAddress:11100,MessageType_SuiAddress:11101,MessageType_SuiSignTx:11102,MessageType_SuiSignedTx:11103,MessageType_FilecoinGetAddress:11200,MessageType_FilecoinAddress:11201,MessageType_FilecoinSignTx:11202,MessageType_FilecoinSignedTx:11203,MessageType_KaspaGetAddress:11300,MessageType_KaspaAddress:11301,MessageType_KaspaSignTx:11302,MessageType_KaspaSignedTx:11303,MessageType_KaspaTxInputRequest:11304,MessageType_KaspaTxInputAck:11305,MessageType_DeviceBackToBoot:903,MessageType_DeviceInfoSettings:10001,MessageType_GetDeviceInfo:10002,MessageType_DeviceInfo:10003,MessageType_ReadSEPublicKey:10004,MessageType_SEPublicKey:10005,MessageType_WriteSEPublicCert:10006,MessageType_ReadSEPublicCert:10007,MessageType_SEPublicCert:10008,MessageType_SpiFlashWrite:10009,MessageType_SpiFlashRead:10010,MessageType_SpiFlashData:10011,MessageType_SESignMessage:10012,MessageType_SEMessageSignature:10013,MessageType_NFTWriteInfo:10014,MessageType_NFTWriteData:10015,MessageType_ResourceUpload:10018,MessageType_ZoomRequest:10019,MessageType_ResourceRequest:10020,MessageType_ResourceAck:10021,MessageType_ResourceUpdate:10022,MessageType_ListResDir:10023,MessageType_FileInfoList:10024,MessageType_RebootToBoardloader:10025,MessageType_DeviceEraseSector:10026}},google:{nested:{protobuf:{nested:{FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},public_dependency:{rule:"repeated",type:"int32",id:10,options:{packed:!1}},weak_dependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},message_type:{rule:"repeated",type:"DescriptorProto",id:4},enum_type:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},source_code_info:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12}}},DescriptorProto:{fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nested_type:{rule:"repeated",type:"DescriptorProto",id:3},enum_type:{rule:"repeated",type:"EnumDescriptorProto",id:4},extension_range:{rule:"repeated",type:"ExtensionRange",id:5},oneof_decl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reserved_range:{rule:"repeated",type:"ReservedRange",id:9},reserved_name:{rule:"repeated",type:"string",id:10}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},type_name:{type:"string",id:6},extendee:{type:"string",id:2},default_value:{type:"string",id:7},oneof_index:{type:"int32",id:9},json_name:{type:"string",id:10},options:{type:"FieldOptions",id:8}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{fields:{name:{type:"string",id:1},input_type:{type:"string",id:2},output_type:{type:"string",id:3},options:{type:"MethodOptions",id:4},client_streaming:{type:"bool",id:5},server_streaming:{type:"bool",id:6}}},FileOptions:{fields:{java_package:{type:"string",id:1},java_outer_classname:{type:"string",id:8},java_multiple_files:{type:"bool",id:10},java_generate_equals_and_hash:{type:"bool",id:20,options:{deprecated:!0}},java_string_check_utf8:{type:"bool",id:27},optimize_for:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},go_package:{type:"string",id:11},cc_generic_services:{type:"bool",id:16},java_generic_services:{type:"bool",id:17},py_generic_services:{type:"bool",id:18},deprecated:{type:"bool",id:23},cc_enable_arenas:{type:"bool",id:31},objc_class_prefix:{type:"string",id:36},csharp_namespace:{type:"string",id:37},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{message_set_wire_format:{type:"bool",id:1},no_standard_descriptor_accessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},map_entry:{type:"bool",id:7},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allow_alias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{fields:{name:{rule:"repeated",type:"NamePart",id:2},identifier_value:{type:"string",id:3},positive_int_value:{type:"uint64",id:4},negative_int_value:{type:"int64",id:5},double_value:{type:"double",id:6},string_value:{type:"bytes",id:7},aggregate_value:{type:"string",id:8}},nested:{NamePart:{fields:{name_part:{rule:"required",type:"string",id:1},is_extension:{rule:"required",type:"bool",id:2}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leading_comments:{type:"string",id:3},trailing_comments:{type:"string",id:4},leading_detached_comments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},source_file:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}}}}}}}}},xe.lastCheckTimestamp=0,xe.getFirmwareStatus=e=>{var t,r;const i=J(e),n=te(e);if(!1===e.firmware_present)return"none";if("classic"===i&&e.bootloader_mode)return"unknown";const s=ue(e,"firmware"),o=null!==(r=null===(t=Re.deviceMap[i])||void 0===t?void 0:t[s])&&void 0!==r?r:[],a=n.join(".");return Te(o,a)},xe.getSysResourcesLatestRelease=(e,t)=>{var r,i,n;const s=J(e),o=te(e);if("pro"!==s&&"touch"!==s)return;const a=ue(e,"firmware"),u=null!==(i=null===(r=Re.deviceMap[s])||void 0===r?void 0:r[a])&&void 0!==i?i:[],d=o.join("."),l=u.filter((e=>(t||_.default.gt(e.version.join("."),d))&&!!e.resource));return null===(n=Me(l))||void 0===n?void 0:n.resource},xe.getSysFullResource=e=>{var t,r,i;const n=J(e);if("pro"!==n&&"touch"!==n)return;const s=ue(e,"firmware"),o=(null!==(r=null===(t=Re.deviceMap[n])||void 0===t?void 0:t[s])&&void 0!==r?r:[]).filter((e=>!!e.fullResource));return null===(i=Me(o))||void 0===i?void 0:i.fullResource},xe.getBootloaderResource=e=>{var t,r,i;const n=J(e);if("pro"!==n&&"touch"!==n)return;const s=ue(e,"firmware"),o=(null!==(r=null===(t=Re.deviceMap[n])||void 0===t?void 0:t[s])&&void 0!==r?r:[]).filter((e=>!!e.bootloaderResource));return null===(i=Me(o))||void 0===i?void 0:i.bootloaderResource},xe.getBootloaderTargetVersion=e=>{var t,r,i,n;const s=J(e),o=ue(e,"firmware"),a=(null!==(r=null===(t=Re.deviceMap[s])||void 0===t?void 0:t[o])&&void 0!==r?r:[]).filter((e=>!!e.bootloaderResource));return null!==(n=null===(i=null==a?void 0:a[0])||void 0===i?void 0:i.bootloaderVersion)&&void 0!==n?n:void 0},xe.getBootloaderRelatedFirmwareVersion=e=>{var t,r,i,n;const s=J(e);if("classic"!==s&&"mini"!==s)return;const o=ue(e,"firmware"),a=(null!==(r=null===(t=Re.deviceMap[s])||void 0===t?void 0:t[o])&&void 0!==r?r:[]).filter((e=>!!e.bootloaderRelatedFirmwareVersion));return null!==(n=null===(i=null==a?void 0:a[0])||void 0===i?void 0:i.bootloaderRelatedFirmwareVersion)&&void 0!==n?n:void 0},xe.getFirmwareChangelog=e=>{var t,r;const i=J(e),n=te(e);if(!1===e.firmware_present||"classic"===i&&e.bootloader_mode)return[];const s=ue(e,"firmware"),o=null!==(r=null===(t=Re.deviceMap[i])||void 0===t?void 0:t[s])&&void 0!==r?r:[],a=n.join(".");return Ae(o,a)},xe.getFirmwareLatestRelease=e=>{var t,r;const i=J(e),n=ue(e,"firmware"),s=null!==(r=null===(t=Re.deviceMap[i])||void 0===t?void 0:t[n])&&void 0!==r?r:[],o=Me(s);if(!o)return o;if(!o.resource){const t=Re.getSysResourcesLatestRelease(e);return Object.assign(Object.assign({},o),{resource:t})}return o},xe.getBLEFirmwareStatus=e=>{var t,r;const i=J(e),n=re(e);if(!n)return"none";const s=null!==(r=null===(t=Re.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return Te(s,o)},xe.getBleFirmwareChangelog=e=>{var t,r;const i=J(e),n=re(e);if(!n)return[];const s=null!==(r=null===(t=Re.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return Ae(s,o)},xe.getBleFirmwareLatestRelease=e=>{var t,r;const i=J(e),n=null!==(r=null===(t=Re.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[];return Me(n)},xe.getTransportStatus=e=>{var t,r;const i=null===(r=null===(t=Re.assets)||void 0===t?void 0:t.bridge)||void 0===r?void 0:r.version;return i?_.default.gte(e,i.join("."))?"valid":"outdated":"valid"};const ke="CORE_EVENT",Oe="UI_EVENT",Ie="ui-request_pin",Ce="ui-button",Pe="ui-request_passphrase",Ne="ui-request_passphrase_on_device",De="ui-close_window",Be="ui-bluetooth_permission",qe="ui-location_permission",Le="ui-location_service_permission",je="ui-firmware-progress",Fe="ui-firmware-tip",Ue="ui-device_not_in_bootloader_mode",ze=(e,t)=>({event:Oe,type:e,payload:t}),He={INIT:"iframe-init",INIT_BRIDGE:"iframe-init-bridge",CALL:"iframe-call",CANCEL:"iframe-cancel"},Ge="RESPONSE_EVENT",$e=(e,t,r)=>({event:Ge,type:Ge,id:e,success:t,payload:t?r:o.serializeError(r)}),We="ui-receive_pin",Ve="ui-receive_passphrase",Ke="device-connect",Ye="device-disconnect",Ze="button",Xe="pin",Je="passphrase",Qe="passphrase_on_device",et="support_features",tt="features",rt=(e,t)=>({event:"DEVICE_EVENT",type:e,payload:t}),it="firmware-release-info",nt="ble-firmware-release-info",st=(e,t)=>({event:"FIRMWARE_EVENT",type:e,payload:t}),ot=Ee(t.d0.DevicePool);class at extends M.exports{static setConnector(e){this.connector=e}static getDevices(e,t,r){var i,n,s,o;return U(this,void 0,void 0,(function*(){const a={},u=[];if(t){const i=this.devicesCache[t];if(i){const n=e.find((e=>e.path===i.originalDescriptor.path));if(n)return i.updateDescriptor(n,!0),a[t]=i,u.push(i),yield this._checkDevicePool(r),{devices:a,deviceList:u};ot.debug("found device in cache, but path is different: ",t)}}try{for(i=z(e);!(n=yield i.next()).done;){const e=n.value,t=yield this._createDevice(e,r);if(t.features){const r=Q(t.features);this.devicesCache[r]&&this.devicesCache[r].updateDescriptor(e,!0),this.devicesCache[r]=t,a[r]=t}u.push(t)}}catch(e){s={error:e}}finally{try{n&&!n.done&&(o=i.return)&&(yield o.call(i))}finally{if(s)throw s.error}}return yield this._checkDevicePool(r),{devices:a,deviceList:u}}))}static clearDeviceCache(e){e&&delete this.devicesCache[e]}static _createDevice(e,t){return U(this,void 0,void 0,(function*(){let r=this.getDeviceByPath(e.path);return r||(r=_t.fromDescriptor(e),r.deviceConnector=this.connector,yield r.connect(),yield r.initialize(t),yield r.release()),r}))}static _checkDevicePool(e){return U(this,void 0,void 0,(function*(){yield this._sendConnectMessage(e),this._sendDisconnectMessage()}))}static _sendConnectMessage(e){return U(this,void 0,void 0,(function*(){for(let t=this.connectedPool.length-1;t>=0;t--){const r=this.connectedPool[t],i=yield this._createDevice(r,e);ot.debug("emit DEVICE.CONNECT: ",i),this.emitter.emit(Ke,i),this.connectedPool.splice(t,1)}}))}static _sendDisconnectMessage(){for(let e=this.disconnectPool.length-1;e>=0;e--){const t=this.connectedPool[e],r=(null==t?void 0:t.path)?this.getDeviceByPath(t.path):null;r&&this.emitter.emit(Ye,r),this.disconnectPool.splice(e,1)}}static reportDeviceChange(e){const t=((e,t)=>{const r=t.filter((t=>void 0===e.find((e=>e.path===t.path)))),i=e.filter((e=>void 0===t.find((t=>t.path===e.path)))),n=t.filter((t=>{const r=e.find((e=>e.path===t.path));return!!r&&r.session!==t.session})),s=n.filter((e=>"string"==typeof e.session)),o=n.filter((e=>"string"!=typeof e.session)),a=t.filter((t=>{const r=e.find((e=>e.path===t.path));return!!r&&r.debugSession!==t.debugSession})),u=n.filter((e=>"string"==typeof e.debugSession)),d=n.filter((e=>"string"!=typeof e.debugSession));return{connected:r,disconnected:i,changedSessions:n,acquired:s,released:o,changedDebugSessions:a,debugAcquired:u,debugReleased:d,didUpdate:r.length+i.length+n.length+a.length>0,descriptors:t}})(this.current||[],e);this.upcoming=e,this.current=this.upcoming,console.log("device pool -> current: ",this.current),console.log("device pool -> upcomming: ",this.upcoming),console.log("DeviceCache.reportDeviceChange diff: ",t),t.didUpdate&&(t.connected.forEach((e=>{const t=this.getDeviceByPath(e.path);t?(ot.debug("emit DEVICE.CONNECT: ",t),this.emitter.emit(Ke,t)):this._addConnectedDeviceToPool(e)})),t.disconnected.forEach((e=>{this._removeDeviceFromConnectedPool(e.path);const t=this.getDeviceByPath(e.path);t?(ot.debug("emit DEVICE.DISCONNECT: ",t),this.emitter.emit(Ye,t)):this._addDisconnectedDeviceToPool(e)})))}static getDeviceByPath(e){return Object.values(this.devicesCache).find((t=>t.originalDescriptor.path===e))}static _addConnectedDeviceToPool(e){const t=this.connectedPool.findIndex((t=>t.path===e.path));t>-1?this.connectedPool.splice(t,1,e):this.connectedPool.push(e)}static _removeDeviceFromConnectedPool(e){const t=this.connectedPool.findIndex((t=>t.path===e));t>-1&&this.connectedPool.splice(t,1)}static _addDisconnectedDeviceToPool(e){const t=this.disconnectPool.findIndex((t=>t.path===e.path));t>-1?this.disconnectPool.splice(t,1,e):this.disconnectPool.push(e)}}at.current=null,at.upcoming=[],at.connectedPool=[],at.disconnectPool=[],at.devicesCache={},at.emitter=new M.exports;const ut=Ee(t.d0.Transport),dt=Ee(t.d0.HdBleTransport),lt=Ee(t.d0.HdTransportHttp);class ct{static load(){ut.debug("transport manager load"),this.defaultMessages=xe.getProtobufMessages(),this.currentMessages=this.defaultMessages}static configure(){return U(this,void 0,void 0,(function*(){try{const e=xe.getSettings("env");ut.debug("Initializing transports"),"react-native"===e?this.reactNativeInit?ut.debug("React Native Do Not Initializing transports"):(yield this.transport.init(dt,at.emitter),this.reactNativeInit=!0):yield this.transport.init(lt),ut.debug("Configuring transports"),yield this.transport.configure(JSON.stringify(this.defaultMessages)),ut.debug("Configuring transports done")}catch(e){if(ut.debug("Initializing transports error: ",e),"ECONNABORTED"===e.code)throw o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError)}}))}static reconfigure(e){return U(this,void 0,void 0,(function*(){if(Array.isArray(e)&&(e=xe.getProtobufMessages()),this.currentMessages!==e&&e)try{yield this.transport.configure(JSON.stringify(e)),this.currentMessages=e}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.TransportInvalidProtobuf,`Transport_InvalidProtobuf: ${e.message}`)}}))}static setTransport(e){const t=xe.getSettings("env");this.transport="react-native"===t?new e({scanTimeout:3e3}):new e,ut.debug("set transport: ",this.transport)}static getTransport(){return this.transport}static getDefaultMessages(){return this.defaultMessages}static getCurrentMessages(){return this.currentMessages}}ct.reactNativeInit=!1;const ht=Ee(t.d0.DeviceCommands);class ft{constructor(e,t){this.device=e,this.mainId=t,this.transport=ct.getTransport(),this.disposed=!1}dispose(e){var t,r;return U(this,void 0,void 0,(function*(){this.disposed=!0,e&&this._cancelableRequest&&this._cancelableRequest(),this._cancelableRequest=void 0,yield null===(r=(t=this.transport).cancel)||void 0===r?void 0:r.call(t)}))}call(e,t={}){var r,i,n,s,a,u,d;return U(this,void 0,void 0,(function*(){ht.debug("[DeviceCommands] [call] Sending",e);try{const r=this.transport.call(this.mainId,e,t);this.callPromise=r;const i=yield r;return ht.debug("[DeviceCommands] [call] Received",i.type),i}catch(e){if(ht.debug("[DeviceCommands] [call] Received error",e),e.errorCode===o.HardwareErrorCode.BleDeviceBondError)return{type:"BleDeviceBondError",message:{error:null==e?void 0:e.message}};if((null===(r=e.response)||void 0===r?void 0:r.data)&&ht.debug("error response",null==e?void 0:e.response.data),"device disconnected during action"===(null===(n=null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.data)||void 0===n?void 0:n.error))return{type:"BridgeNetworkError",message:{}};if(-1!==(null===(u=null===(a=null===(s=null==e?void 0:e.response)||void 0===s?void 0:s.data)||void 0===a?void 0:a.error)||void 0===u?void 0:u.indexOf("Request failed with status code")))return{type:"CallMethodError",message:{error:null!==(d=null==e?void 0:e.response.data)&&void 0!==d?d:""}};throw e}}))}typedCall(e,t,r){return U(this,void 0,void 0,(function*(){if(this.disposed)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"typedCall: DeviceCommands already disposed");const i=yield this._commonCall(e,r);try{((e,t)=>{if(!(Array.isArray(t)?t:t.split("|")).includes(e.type))throw o.ERRORS.TypedError(o.HardwareErrorCode.ResponseUnexpectTypeError,`assertType: Response of unexpected type: ${e.type}. Should be ${t}`)})(i,t)}catch(e){if(ht.debug("DeviceCommands typedcall error: ",e),!(e instanceof o.HardwareError))throw e;if(e.errorCode===o.HardwareErrorCode.ResponseUnexpectTypeError){if(e.message.indexOf("BridgeNetworkError")>-1)throw o.ERRORS.TypedError(o.HardwareErrorCode.BridgeNetworkError);if(e.message.indexOf("BleDeviceBondError")>-1)throw o.ERRORS.TypedError(o.HardwareErrorCode.BleDeviceBondError)}}return i}))}_commonCall(e,t){return U(this,void 0,void 0,(function*(){const r=yield this.call(e,t);return this._filterCommonTypes(r,e)}))}_filterCommonTypes(e,t){try{"react-native"===xe.getSettings("env")?ht.debug("_filterCommonTypes: ",JSON.stringify(e)):ht.debug("_filterCommonTypes: ",e)}catch(e){}if("Failure"===e.type){const{code:r,message:n}=e.message;let s=null;return"Failure_FirmwareError"!==r||n||(s=o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareError)),"Failure_ActionCancelled"===r&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.ActionCancelled)),"Failure_PinInvalid"===r&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.PinInvalid,n)),"Failure_PinCancelled"===r&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.PinCancelled)),"Failure_DataError"===r&&("Please confirm the BlindSign enabled"===n&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.BlindSignDisabled)),"File already exists"===n&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.FileAlreadyExists))),"Failure_UnexpectedMessage"===r&&("PassphraseAck"===t&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.UnexpectPassphrase)),"Not in Signing mode"===n&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.NotInSigningMode))),s?i.reject(s):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`${r||"Failure_UnknownCode"},${n||"Failure_UnknownMessage"}`))}if("Features"===e.type)return i.resolve(("Features"!==(r=e).type||r.message.major_version<1&&(r.message.major_version=1),r));var r;if("ButtonRequest"===e.type)return"ButtonRequest_PassphraseEntry"===e.message.code?this.device.emit(Qe,this.device):this.device.emit(Ze,this.device,e.message),this._commonCall("ButtonAck",{});e.type;const n="webusb"===xe.getSettings("env");return"PinMatrixRequest"===e.type?n?i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Please unlock your device")):this._promptPin(e.message.type).then((e=>"@@ONEKEY_INPUT_PIN_IN_DEVICE"===e?this._commonCall("BixinPinInputOnDevice"):this._commonCall("PinMatrixAck",{pin:e})),(()=>this._commonCall("Cancel",{}))):"PassphraseRequest"===e.type?this._promptPassphrase().then((e=>{const{passphrase:t,passphraseOnDevice:r}=e;return r?this._commonCall("PassphraseAck",{on_device:!0}):this._commonCall("PassphraseAck",{passphrase:t})})):(e.type,e.type,i.resolve(e))}_promptPin(e){return new i(((t,r)=>{this.device.listenerCount(Xe)>0?(this._cancelableRequest=r,this.device.emit(Xe,this.device,e,((e,i)=>{this._cancelableRequest=void 0,e?r(e):t(i)}))):(console.warn("[DeviceCommands] [call] PIN callback not configured, cancelling request"),r(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"_promptPin: PIN callback not configured")))}))}_promptPassphrase(){return new i(((e,t)=>{this.device.listenerCount(Je)>0?(this._cancelableRequest=t,this.device.emit(Je,this.device,((r,i)=>{this._cancelableRequest=void 0,i?t(i):e(r)}))):(ht.error("[DeviceCommands] [call] Passphrase callback not configured, cancelling request"),t(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"_promptPassphrase: Passphrase callback not configured")))}))}}const pt="ui-device_bootloader_mode",yt="ui-device_not_initialized",gt="ui-device_seedless",mt="ui-firmware-tip",vt=Ee(t.d0.Device),bt={};class _t extends M.exports{constructor(e){super(),this.deviceConnector=null,this.features=void 0,this.featuresNeedsReload=!1,this.externalState=[],this.unavailableCapabilities={},this.instance=0,this.internalState=[],this.needReloadDevice=!1,this.keepSession=!1,this.passphraseState=void 0,this.originalDescriptor=e}static fromDescriptor(e){const t=Object.assign({},e);return new _t(t)}toMessageObject(){return this.isUnacquired()||!this.features?null:{connectId:"react-native"===xe.getSettings("env")?this.mainId||null:Q(this.features),uuid:Q(this.features),deviceType:this.features.bootloader_mode?(e=this.features,J(e)):J(this.features),deviceId:this.features.device_id||null,path:this.originalDescriptor.path,name:this.features.ble_name||this.features.label||`OneKey ${J(this.features).toUpperCase()}`,label:ee(this.features),mode:this.getMode(),features:this.features,firmwareVersion:this.getFirmwareVersion(),bleFirmwareVersion:this.getBLEFirmwareVersion(),unavailableCapabilities:this.unavailableCapabilities};var e}connect(){const e=xe.getSettings("env");return new i((t=>U(this,void 0,void 0,(function*(){if("react-native"!==e)if(!this.mainId||!this.isUsedHere()&&this.originalDescriptor)try{yield this.acquire(),t(!0)}catch(e){t(e)}else this.isUsedHere()?t(!0):t(!1);else try{yield this.acquire(),t(!0)}catch(e){t(e)}}))))}acquire(){var e,t,r,i;return U(this,void 0,void 0,(function*(){const n=xe.getSettings("env"),s="react-native"===n?"id":"session";try{if("react-native"===n){const r=yield null===(e=this.deviceConnector)||void 0===e?void 0:e.acquire(this.originalDescriptor.id);this.mainId=null!==(t=r.uuid)&&void 0!==t?t:"",vt.debug("Expected uuid:",this.mainId)}else this.mainId=yield null===(r=this.deviceConnector)||void 0===r?void 0:r.acquire(this.originalDescriptor.path,this.originalDescriptor.session),vt.debug("Expected session id:",this.mainId);this.updateDescriptor({[s]:this.mainId}),this.commands&&(yield this.commands.dispose(!1)),this.commands=new ft(this,null!==(i=this.mainId)&&void 0!==i?i:"")}catch(e){if(!this.runPromise)throw e;this.runPromise.reject(e),this.runPromise=null}}))}release(){var e;return U(this,void 0,void 0,(function*(){const t=xe.getSettings("env");if(this.isUsedHere()&&!this.keepSession&&this.mainId||this.mainId&&"react-native"===t){if(this.commands&&(this.commands.dispose(!1),this.commands.callPromise))try{yield this.commands.callPromise}catch(e){this.commands.callPromise=void 0}try{yield null===(e=this.deviceConnector)||void 0===e?void 0:e.release(this.mainId,!1),this.updateDescriptor({session:null})}catch(e){vt.error("[Device] release error: ",e)}finally{this.needReloadDevice=!0}}}))}getCommands(){return this.commands}generateStateKey(e,t){return t?`${e}@${t}`:e}getInternalState(e){var t,r;vt.debug("getInternalState session param: ",`device_id: ${e}`,`features.device_id: ${null===(t=this.features)||void 0===t?void 0:t.device_id}`,`passphraseState: ${this.passphraseState}`),vt.debug("getInternalState session cache: ",bt);const i=e||(null===(r=this.features)||void 0===r?void 0:r.device_id);if(!i)return;if(!this.passphraseState)return;const n=this.generateStateKey(i,this.passphraseState);return bt[n]}tryFixInternalState(e,t,r=null){vt.debug("tryFixInternalState session param: ",`device_id: ${t}`,`passphraseState: ${e}`,`sessionId: ${r}`);const i=`${t}`,n=bt[i];n?(bt[this.generateStateKey(t,e)]=n,delete bt[i]):r&&(bt[this.generateStateKey(t,e)]=r),vt.debug("tryFixInternalState session cache: ",bt)}setInternalState(e,t){var r,i;if(vt.debug("setInternalState session param: ",`state: ${e}`,`initSession: ${t}`,`device_id: ${null===(r=this.features)||void 0===r?void 0:r.device_id}`,`passphraseState: ${this.passphraseState}`),!this.features)return;if(!this.passphraseState&&!t)return;const n=null===(i=this.features)||void 0===i?void 0:i.device_id;if(!n)return;const s=this.generateStateKey(n,this.passphraseState);e&&(bt[s]=e),vt.debug("setInternalState done session cache: ",bt)}clearInternalState(e){var t;vt.debug("clearInternalState param: ",e);const r=e||(null===(t=this.features)||void 0===t?void 0:t.device_id);if(r&&(delete bt[`${r}`],this.passphraseState)){const e=this.generateStateKey(r,this.passphraseState);delete bt[e]}}initialize(e){return U(this,void 0,void 0,(function*(){vt.debug("initialize param:",e),this.passphraseState=null==e?void 0:e.passphraseState,(null==e?void 0:e.initSession)&&this.clearInternalState(null==e?void 0:e.deviceId);const t=this.getInternalState(null==e?void 0:e.deviceId),r={};t&&(r.session_id=t),(null==e?void 0:e.deriveCardano)&&(r.derive_cardano=!0),vt.debug("initialize payload:",r);const{message:i}=yield this.commands.typedCall("Initialize","Features",r);this._updateFeatures(i,null==e?void 0:e.initSession)}))}getFeatures(){return U(this,void 0,void 0,(function*(){const{message:e}=yield this.commands.typedCall("GetFeatures","Features",{});this._updateFeatures(e)}))}_updateFeatures(e,t){this.features&&this.features.session_id&&!e.session_id&&(e.session_id=this.features.session_id),this.features&&this.features.device_id&&e.session_id&&this.setInternalState(e.session_id,t),e.unlocked=e.unlocked||!0,this.features=e,this.featuresNeedsReload=!1,this.emit(tt,this,e)}updateDescriptor(e,t=!1){if("react-native"===xe.getSettings("env"))return;const r=this.originalDescriptor.session,i=e.session;r!==i&&(this.originalDescriptor.session=i),t&&(this.originalDescriptor=e)}updateFromCache(e){this.mainId=e.mainId,this.commands=e.commands,this.updateDescriptor(e.originalDescriptor,!0),e.features&&this._updateFeatures(e.features)}run(e,t){return U(this,void 0,void 0,(function*(){return this.runPromise&&(yield this.interruptionFromOutside(),vt.debug("[Device] run error:","Device is running, but will cancel previous operate")),t=(e=>(e||(e={}),e))(t),this.runPromise=o.createDeferred(this._runInner.bind(this,e,t)),this.runPromise.promise}))}_runInner(e,t){return U(this,void 0,void 0,(function*(){if((!this.isUsedHere()||this.commands.disposed)&&"react-native"!==xe.getSettings("env")){yield this.acquire();try{e&&(yield this.initialize(t))}catch(e){return this.runPromise=null,e instanceof o.HardwareError?i.reject(e):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceInitializeFailed,`Initialize failed: ${e.message}, code: ${e.code}`))}}if(t.keepSession&&(this.keepSession=!0),e)try{yield e()}catch(e){return this.runPromise&&this.runPromise.reject(e),void(this.runPromise=null)}(!this.keepSession&&"boolean"!=typeof t.keepSession||!1===t.keepSession)&&(this.keepSession=!1,yield this.release(),vt.debug("release device, mainId: ",this.mainId)),this.runPromise&&this.runPromise.resolve(),this.runPromise=null}))}interruptionFromOutside(){return U(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!1)),this.runPromise&&this.runPromise.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceInterruptedFromOutside))}))}interruptionFromUser(){return U(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!0)),this.runPromise&&this.runPromise.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceInterruptedFromUser))}))}getMode(){var e,t,r;return(null===(e=this.features)||void 0===e?void 0:e.bootloader_mode)?"bootloader":(null===(t=this.features)||void 0===t?void 0:t.initialized)?(null===(r=this.features)||void 0===r?void 0:r.no_backup)?"seedless":"normal":"initialize"}getFirmwareVersion(){return this.features?te(this.features):null}getBLEFirmwareVersion(){return this.features?re(this.features):null}isUsed(){return"string"==typeof this.originalDescriptor.session}isUsedHere(){return"react-native"!==xe.getSettings("env")&&this.isUsed()&&this.originalDescriptor.session===this.mainId}isUsedElsewhere(){return this.isUsed()&&!this.isUsedHere()}isBootloader(){return this.features&&!!this.features.bootloader_mode}isInitialized(){return this.features&&!!this.features.initialized}isSeedless(){return this.features&&!!this.features.no_backup}isUnacquired(){return void 0===this.features}hasUnexpectedMode(e,t){if(this.features){if(this.isBootloader()&&!e.includes(pt))return pt;if(!this.isInitialized()&&!e.includes(yt))return yt;if(this.isSeedless()&&!e.includes(gt))return gt;if(!this.isBootloader()&&t.includes(pt))return"ui-device_not_in_bootloader_mode"}return null}hasUsePassphrase(){var e;const t=("touch"===J(this.features)||"pro"===J(this.features))&&!0===(null===(e=this.features)||void 0===e?void 0:e.unlocked);return this.features&&(!!this.features.passphrase_protection||t)}checkDeviceId(e){return!!this.features&&this.features.device_id===e}checkPassphraseState(){var e;return U(this,void 0,void 0,(function*(){if(!this.features)return!1;const t=!0===(null===(e=this.features)||void 0===e?void 0:e.unlocked),r="touch"===J(this.features)||"pro"===J(this.features),i=yield se(this.features,this.commands);return r&&t&&(yield this.getFeatures()),this.passphraseState&&this.passphraseState!==i?(this.clearInternalState(),i):void 0}))}}class wt extends M.exports{constructor(){super(...arguments),this.devices={}}getDeviceLists(e,t){var r,i;return U(this,void 0,void 0,(function*(){const n=yield null===(r=this.connector)||void 0===r?void 0:r.enumerate(),s=null!==(i=null==n?void 0:n.descriptors)&&void 0!==i?i:[];this.devices={};const{deviceList:o,devices:a}=yield at.getDevices(s,e,t);return this.devices=a,o}))}allDevices(){return Object.keys(this.devices).map((e=>this.devices[e]))}getDevice(e){return this.devices[e]}}const Et=e=>({status:xe.getFirmwareStatus(e),changelog:xe.getFirmwareChangelog(e),release:xe.getFirmwareLatestRelease(e)}),St=e=>({status:xe.getBLEFirmwareStatus(e),changelog:xe.getBleFirmwareChangelog(e),release:xe.getBleFirmwareLatestRelease(e)}),Tt=Ee(t.d0.Method);class At{constructor(e){this.shouldEnsureConnected=!0,this.checkDeviceId=!1,this.useDevicePassphraseState=!0,this.skipForceUpdateCheck=!1,this.postPreviousAddressMessage=e=>{this.postMessage(ze("ui-previous_address_result",{device:this.device.toMessageObject(),data:e}))};const{payload:t}=e;this.name=t.method,this.payload=t,this.responseID=e.id||0,this.connectId=t.connectId||"",this.deviceId=t.deviceId||"",this.useDevice=!0,this.notAllowDeviceMode=[yt],this.requireDeviceMode=[]}getVersionRange(){return{}}setDevice(e){this.device=e,this.connectId=e.originalDescriptor.path}checkFirmwareRelease(){if(!this.device||!this.device.features)return;const e=Et(this.device.features);this.postMessage(st(it,Object.assign(Object.assign({},e),{features:this.device.features})));const t=St(this.device.features);this.postMessage(st(nt,Object.assign(Object.assign({},t),{features:this.device.features})))}checkDeviceSupportFeature(){if(!this.device||!this.device.features)return;const e=ne(this.device.features),t=ae(this.device.features);this.postMessage(rt(et,{inputPinOnSoftware:e,modifyHomescreen:t,device:this.device.toMessageObject()}))}checkSafetyLevelOnTestNet(){var e,t,r;return U(this,void 0,void 0,(function*(){let i=!1;"evmSignTransaction"===this.name&&[3,4,5,42].includes(Number(null===(t=null===(e=this.payload)||void 0===e?void 0:e.transaction)||void 0===t?void 0:t.chainId))&&(i=!0),i&&"Strict"===(null===(r=this.device.features)||void 0===r?void 0:r.safety_checks)&&(Tt.debug("will change safety_checks level"),yield this.device.commands.typedCall("ApplySettings","Success",{safety_checks:"PromptTemporarily"}))}))}dispose(){}}const Mt="2.2.0",Rt="4.3.0",xt="3.1.0",kt=e=>"0x"===e.slice(0,2).toLowerCase(),Ot=e=>kt(e)?e.slice(2):e,It=e=>{for(;/^00/.test(e);)e=e.slice(2);return e},Ct=e=>{if("string"==typeof e){let t=Ot(e);return t.length%2!=0&&(t=`0${t}`),t}return Array.isArray(e)?e.map(Ct):"object"==typeof e?(t=e,r=e=>Ct(e),Object.fromEntries(Object.entries(t).map((([e,t])=>[e,r(t)])))):e;var t,r},Pt=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Nt(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Pt[e[r]];return t}function Dt(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const i=2*r,n=e.slice(i,i+2),s=Number.parseInt(n,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}const Bt=e=>o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,e),qt=(e,t)=>{t.forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t.name)&&t.required)throw Bt(`Missing required parameter: ${t.name}`);const r=e[t.name];if(r&&t.type)switch(t.type){case"array":if(!Array.isArray(r))throw Bt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);if(!t.allowEmpty&&r.length<1)throw Bt(`Parameter "${t.name}" is empty.`);break;case"uint":if("string"!=typeof r&&"number"!=typeof r)throw Bt(`Parameter [${t.name}] has invalid type. "string|number" expected.`);if("number"==typeof r&&!Number.isSafeInteger(r)||!/^(?:[1-9]\d*|\d)$/.test(r.toString().replace(/^-/,t.allowNegative?"":"-")))throw Bt(`Parameter [${t.name}] has invalid value "${r}". Integer representation expected.`);break;case"bigNumber":if("string"!=typeof r)throw Bt(`Parameter [${t.name}] is of type invalid and should be [string].`);try{if(new S.default(r).toFixed(0)!==r)throw new Error("")}catch(e){throw Bt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}break;case"buffer":if(void 0===r||"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))throw Bt(`Parameter [${t.name}] is of type invalid and should be [buffer].`);break;case"hexString":if("string"!=typeof r||!((e,t)=>!("string"!=typeof e||!e.match(/^(0x|0X)?[0-9A-Fa-f]*$/)))((i=r,kt(i)?i:`0x${i}`)))throw Bt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);break;default:if(typeof r!==t.type)throw Bt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}var i}))},Lt=e=>{throw e instanceof o.HardwareError?e:"ERR_NETWORK"===e.code?o.ERRORS.TypedError(o.HardwareErrorCode.BridgeNotInstalled):"ECONNABORTED"===e.code?o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError):o.ERRORS.TypedError(e)},jt=({features:e,updateType:t,version:r,isUpdateBootloader:i})=>U(void 0,void 0,void 0,(function*(){const n=Ut({features:e,updateType:t,targetVersion:null==r?void 0:r.join(".")});if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"no firmware found for this device");if(r&&!_.default.eq(n.version.join("."),r.join("."))&&("touch"!==J(e)||e.onekey_version))throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"firmware version mismatch");const s="ble"===t?n.webUpdate:i?n.bootloaderResource:n.url;let a;try{a=yield de(s,"binary")}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return Object.assign(Object.assign({},n),{binary:a})})),Ft=e=>U(void 0,void 0,void 0,(function*(){let t;try{t=yield de(e,"binary")}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return{binary:t}})),Ut=({features:e,updateType:t,targetVersion:r})=>{var i,n;const s=J(e),{deviceMap:o}=xe;let a=ue(e,t);"touch"===s&&r&&(_.default.eq(r,"4.0.0")?a="firmware-v2":_.default.gt(r,"4.0.0")&&(a="firmware-v3")),console.log("=====>>>getInfo: ",a);const u=null!==(n=null===(i=null==o?void 0:o[s])||void 0===i?void 0:i[a])&&void 0!==n?n:[];return Me(u)},zt="session not found",Ht=e=>{var t;(null===(t=e.features)||void 0===t?void 0:t.firmware_present)&&e.emit(Ze,e,{code:"ButtonRequest_FirmwareUpdate"})},Gt=(e,t,r)=>{r(ze(je,{device:e.toMessageObject(),progress:t}))},$t=(e,t,r)=>{r(ze(Fe,{device:e.toMessageObject(),data:{message:t}}))},Wt=e=>U(void 0,void 0,void 0,(function*(){"ble"===e&&(yield Se(1e4))})),Vt=(e,t,r,i,{payload:n})=>U(void 0,void 0,void 0,(function*(){const s=X(i.features);if("model_mini"===s){Ht(i),$t(i,"ConfirmOnDevice",r);const s="firmware"===e?"FirmwareErase":"FirmwareErase_ex";if("Success"!==(yield t(s,"Success",{})).type)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"erase firmware error");$t(i,"FirmwareEraseSuccess",r),Gt(i,0,r);const{message:a,type:u}=yield t("FirmwareUpload","Success",{payload:n});if(Gt(i,100,r),yield Wt(e),"Success"!==u)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"install firmware error");return a}if("model_touch"===s){if(i.features){const t=ie(i.features);if(_.default.gte(t.join("."),"2.4.5"))return(yield Kt(e,r,i,{payload:n})).message}Ht(i),$t(i,"ConfirmOnDevice",r);const s=n.byteLength;let a=yield t("FirmwareErase",["FirmwareRequest","Success"],{length:s});for($t(i,"FirmwareEraseSuccess",r);"Success"!==a.type;){const e=a.message.offset,u=a.message.offset+a.message.length,d=n.slice(e,u);if(e>0&&Gt(i,Math.round(e/s*100),r),a=yield t("FirmwareUpload",["FirmwareRequest","Success"],{payload:d}),"CallMethodError"===a.type)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"upload firmware error")}return Gt(i,100,r),yield Wt(e),a.message}throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"uploadFirmware: unknown device model")})),Kt=(e,t,r,{payload:i})=>U(void 0,void 0,void 0,(function*(){let n=r.getCommands().typedCall.bind(r.getCommands());$t(r,"StartTransferData",t);const s=`0:${"ble"===e?"ble-":""}firmware.bin`,o=1024*("react-native"===xe.getSettings("env")?16:128),a=Math.ceil(i.byteLength/o);let u=0;for(let e=0;e<a;e++){const n=e*o,d=Math.min(n+o,i.byteLength),l=d-n,c=i.slice(n,d),h=0===e,f=Math.round((e+1)/a*100);u+=(yield Yt(r,s,l,u,c,h,f)).message.processed_byte,Gt(r,f,t)}return Ht(r),$t(r,"ConfirmOnDevice",t),$t(r,"InstallingFirmware",t),n=r.getCommands().typedCall.bind(r.getCommands()),yield n("FirmwareUpdateEmmc","Success",{path:s,reboot_on_success:!0})})),Yt=(e,t,r,i,n,s,a)=>U(void 0,void 0,void 0,(function*(){var u,d,l,c,h,f;let p=10;for(;p>0;)try{return yield U(void 0,void 0,void 0,(function*(){var u;const d=e.getCommands().typedCall.bind(e.getCommands()),l=yield d("EmmcFileWrite","EmmcFile",{file:{path:t,len:r,offset:i,data:n},overwrite:s,append:0!==i,ui_percentage:a});if("EmmcFile"!==l.type){if("CallMethodError"===l.type&&(null!==(u=l.message.error)&&void 0!==u?u:"").indexOf(zt)>-1)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,zt);throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"emmc file write chunk once error")}return l}))}catch(t){if(console.error("emmcWrite error: ",t),p--,0===p)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"emmc file write firmware error");if("react-native"===xe.getSettings("env"))yield Se(3e3),yield null===(u=e.deviceConnector)||void 0===u?void 0:u.acquire(e.originalDescriptor.id,null,!0),yield e.initialize();else if(t.message.indexOf(zt)>-1){const t=yield null===(d=e.deviceConnector)||void 0===d?void 0:d.enumerate(),r=null!==(l=null==t?void 0:t.descriptors)&&void 0!==l?l:[],{deviceList:i}=yield at.getDevices(r,void 0);1===i.length&&(null===(h=null===(c=i[0])||void 0===c?void 0:c.features)||void 0===h?void 0:h.bootloader_mode)&&(e.updateFromCache(i[0]),yield e.acquire(),e.getCommands().mainId=null!==(f=e.mainId)&&void 0!==f?f:"")}yield Se(3e3)}})),Zt=(e,t,r)=>U(void 0,void 0,void 0,(function*(){if("Success"===t.type)return t.message;const{offset:i,data_length:n}=t.message;if(void 0===i)throw new Error("offset is undefined");const s=new Uint8Array(r.slice(i,Math.min(i+n,r.byteLength))),o=c.blake2s(s),a={data_chunk:Nt(s),hash:Nt(o)},u=yield e("ResourceAck",["ResourceRequest","Success"],Object.assign({},a));return Zt(e,u,r)})),Xt=(e,t,r)=>U(void 0,void 0,void 0,(function*(){const i=new Uint8Array(r.slice(0,Math.min(16384,r.byteLength))),n=c.blake2s(i),s=yield e("ResourceUpdate",["ResourceRequest","Success"],{file_name:t,data_length:r.byteLength,initial_data_chunk:Nt(i),hash:Nt(n)});return Zt(e,s,r)})),Jt=(e,t,r,i)=>U(void 0,void 0,void 0,(function*(){$t(r,"UpdateSysResource",t);const n=yield T.default.loadAsync(i),s=Object.entries(n.files);let o=0;const a=100/s.length;for(const[i,n]of s){const s=i.split("/").pop();if(!n.dir&&-1===i.indexOf("__MACOSX")&&s){const t=yield n.async("arraybuffer");yield Xt(e,s,t)}o+=a,Gt(r,Math.floor(o),t)}return Gt(r,100,t),$t(r,"UpdateSysResourceSuccess",t),!0})),Qt=Ee(t.d0.Method),er=Ee(t.d0.Method);var tr=[{name:"Bitcoin",label:"BTC",slip44:0},{name:"Regtest",label:"REGTEST",slip44:1},{name:"Testnet",label:"TEST",slip44:1},{name:"Actinium",label:"ACM",slip44:228},{name:"Axe",label:"AXE",slip44:4242},{name:"Bcash",label:"BCH",slip44:145},{name:"Bitcore",label:"BTX",slip44:160},{name:"Dash",label:"DASH",slip44:5},{name:"Dash Testnet",label:"tDASH",slip44:1},{name:"Decred",label:"DCR",slip44:42},{name:"Decred Testnet",label:"TDCR",slip44:1},{name:"DigiByte",label:"DGB",slip44:20},{name:"Dogecoin",label:"DOGE",slip44:3},{name:"Feathercoin",label:"FTC",slip44:8},{name:"Firo",label:"FIRO",slip44:136},{name:"Firo Testnet",label:"tFIRO",slip44:1},{name:"Fujicoin",label:"FJC",slip44:75},{name:"GameCredits",label:"GAME",slip44:101},{name:"Komodo",label:"KMD",slip44:141},{name:"Koto",label:"KOTO",slip44:510},{name:"Litecoin",label:"LTC",slip44:2},{name:"Litecoin Testnet",label:"tLTC",slip44:1},{name:"Monacoin",label:"MONA",slip44:22},{name:"MonetaryUnit",label:"MUE",slip44:31},{name:"NIX",label:"NIX",slip44:400},{name:"Namecoin",label:"NMC",slip44:7},{name:"Peercoin",label:"PPC",slip44:6},{name:"Peercoin Testnet",label:"tPPC",slip44:1},{name:"Polis",label:"POLIS",slip44:1997},{name:"Primecoin",label:"XPM",slip44:24},{name:"Ravencoin",label:"RVN",slip44:175},{name:"Ritocoin",label:"RITO",slip44:19169},{name:"Stakenet",label:"XSN",slip44:199},{name:"Syscoin",label:"SYS",slip44:57},{name:"Unobtanium",label:"UNO",slip44:92},{name:"Verge",label:"XVG",slip44:77},{name:"Vertcoin",label:"VTC",slip44:28},{name:"Viacoin",label:"VIA",slip44:14},{name:"ZCore",label:"ZCR",slip44:428},{name:"Zcash",label:"ZEC",slip44:133},{name:"Zcash Testnet",label:"TAZ",slip44:1}];const rr=(e,t)=>{let r;if(t){const e=t.toLowerCase();r=tr.find((t=>t.name.toLowerCase()===e||t.label.toLowerCase()===e))}else if(e){const t=$(e[1]);r=tr.find((e=>e.slip44===t))}if(!r)throw t?o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Invalid coin name: ${t}`):e?o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Invalid path: ${e[0]}`):o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter);return r},ir=e=>U(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:n,serialized_tx:s}=r;if(s&&e.push(s),"number"==typeof i){if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=n}})(u,d,r.serialized),"TXFINISHED"===r.request_type)return i.resolve({signatures:d,serializedTx:u.join("")});const{message:l}=yield(e=>{const{tx_hash:t}=e.txRequest.details;return t?(({typedCall:e,txRequest:{request_type:t,details:r},refTxs:i})=>{const{tx_hash:n}=r;if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const s=i[n.toLowerCase()];if(!s)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${n}`);if("TXINPUT"===t){if(!s.bin_outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXINPUT: ${n}`);return e("TxAckPrevInput","TxRequest",{tx:{input:s.inputs[r.request_index]}})}if("TXOUTPUT"===t){if(!s.bin_outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXOUTPUT: ${n}`);return e("TxAckPrevOutput","TxRequest",{tx:{output:s.bin_outputs[r.request_index]}})}if("TXORIGINPUT"===t){if(!s.outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGINPUT: ${n}`);return e("TxAckInput","TxRequest",{tx:{input:s.inputs[r.request_index]}})}if("TXORIGOUTPUT"===t){if(!s.outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGOUTPUT: ${n}`);return e("TxAckOutput","TxRequest",{tx:{output:s.outputs[r.request_index]}})}if("TXEXTRADATA"===t){if("number"!=typeof r.extra_data_len)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof r.extra_data_offset)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof s.extra_data)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${s.hash}`);const t=s.extra_data,i=r.extra_data_len,n=r.extra_data_offset;return e("TxAckPrevExtraData","TxRequest",{tx:{extra_data_chunk:t.substring(2*n,2*(n+i))}})}if("TXMETA"===t){const t=s.extra_data;return e("TxAckPrevMeta","TxRequest",{tx:{version:s.version,lock_time:s.lock_time,inputs_count:s.inputs.length,outputs_count:s.outputs?s.outputs.length:s.bin_outputs.length,timestamp:s.timestamp,version_group_id:s.version_group_id,expiry:s.expiry,branch_id:s.branch_id,extra_data_len:t?t.length/2:void 0}})}throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${t}`)})(e):(({typedCall:e,txRequest:{request_type:t,details:r},inputs:i,outputs:n})=>{if("TXINPUT"===t)return e("TxAckInput","TxRequest",{tx:{input:i[r.request_index]}});if("TXOUTPUT"===t)return e("TxAckOutput","TxRequest",{tx:{output:n[r.request_index]}});if("TXMETA"===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${t}`)})(e)})(e);return ir({typedCall:t,txRequest:l,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d})}));var nr=(e,t,r,i,n,s)=>U(void 0,void 0,void 0,(function*(){const o={};i.forEach((e=>{o[e.hash.toLowerCase()]=e}));const{message:a}=yield e("SignTx","TxRequest",Object.assign(Object.assign({},n),{inputs_count:t.length,outputs_count:r.length,coin_name:s}));return ir({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const sr=e=>U(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:n,serialized_tx:s}=r;if(s&&e.push(s),"number"==typeof i){if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in oneKey:TxRequestSerialized signature.");t[i]=n}})(u,d,r.serialized),"TXFINISHED"===r.request_type)return i.resolve({signatures:d,serializedTx:u.join("")});const l=(e=>{const{tx_hash:t}=e.txRequest.details;return t?(({txRequest:{request_type:e,details:t},refTxs:r})=>{const{tx_hash:i}=t;if(!i)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const n=r[i.toLowerCase()];if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${i}`);if(!n.bin_outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: bin_outputs not set tx: ${i}`);if("TXINPUT"===e)return{inputs:[n.inputs[t.request_index]]};if("TXOUTPUT"===e)return{bin_outputs:[n.bin_outputs[t.request_index]]};if("TXEXTRADATA"===e){if("number"!=typeof t.extra_data_len)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof t.extra_data_offset)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof n.extra_data)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${n.hash}`);const e=n.extra_data,r=t.extra_data_len,i=t.extra_data_offset;return{extra_data:e.substring(2*i,2*(i+r))}}if("TXMETA"===e){const e=n.extra_data,t={version:n.version,lock_time:n.lock_time,inputs_cnt:n.inputs.length,outputs_cnt:n.bin_outputs.length,timestamp:n.timestamp,version_group_id:n.version_group_id,expiry:n.expiry,branch_id:n.branch_id};return"string"==typeof e&&0!==e.length?Object.assign(Object.assign({},t),{extra_data_len:e.length/2}):t}throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${e}`)})(e):(({txRequest:{request_type:e,details:t},inputs:r,outputs:i})=>{if("TXINPUT"===e)return{inputs:[r[t.request_index]]};if("TXOUTPUT"===e)return{outputs:[i[t.request_index]]};if("TXMETA"===e)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===e)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${e}`)})(e)})(e),{message:c}=yield t("TxAck","TxRequest",{tx:l});return sr({typedCall:t,txRequest:c,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d})}));var or=(e,t,r,i,n,s)=>U(void 0,void 0,void 0,(function*(){const o={};i.forEach((e=>{o[e.hash.toLowerCase()]=e}));const{message:a}=yield e("SignTx","TxRequest",Object.assign(Object.assign({},n),{inputs_count:t.length,outputs_count:r.length,coin_name:s}));return sr({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const ar=(e,t)=>e?[e.slice(0,t),e.slice(t)]:["",""],ur=new RegExp(/^(.*)\[([0-9]*)\]$/),dr=new RegExp(/^bytes([0-9]*)$/),lr=new RegExp(/^(u?int)([0-9]*)$/),cr=e=>{const t=ur.exec(e);if(null===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`typename ${e} could not be parsed as an EIP-712 array`);const[r,i,n]=t;return{entryTypeName:i,arraySize:parseInt(n,10)||null}},hr=(e,t)=>{if(dr.test(e)||"address"===e)return Ct(t);if("string"===e)return n.from(t,"utf-8").toString("hex");const r=lr.exec(e);if(r){const[e,i,n]=r;return((e,t,r)=>{let i=new S.default(e);if(r&&(i=((e,t)=>{if(t<1||t>32)throw o.ERRORS.TypedError("Runtime","Int byte size must be between 1 and 32 (8 and 256 bits)");const r=new S.default(2).exponentiatedBy(8*t-1).negated(),i=r.negated().minus(1),n=new S.default(e);if(n.isGreaterThan(i)||n.isLessThan(r))throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return n.isPositive()?n:n.minus(r).minus(r)})(i,t)),i.isNegative())throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Cannot convert negative number to unsigned interger: ${e.toString()}`);const n=i.toString(16),s=2*t;if(n.length>s)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return n.padStart(2*t,"0")})(t,Math.ceil(parseInt(n,10)/8),"int"===i)}if("bool"===e)return t?"01":"00";throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Unsupported data type for direct field encoding: ${e}`)},fr={string:h.EthereumDataType.STRING,bool:h.EthereumDataType.BOOL,address:h.EthereumDataType.ADDRESS},pr=(e,t)=>{const r=ur.exec(e);if(r){const[e,i,n]=r,s=pr(i,t);return{data_type:h.EthereumDataType.ARRAY,size:parseInt(n,10)||void 0,entry_type:s}}const i=lr.exec(e);if(i){const[e,t,r]=i;return{data_type:"uint"===t?h.EthereumDataType.UINT:h.EthereumDataType.INT,size:Math.floor(parseInt(r,10)/8)}}const n=dr.exec(e);if(n){const[e,t]=n;return{data_type:h.EthereumDataType.BYTES,size:parseInt(t,10)||void 0}}const s=fr[e];if(s)return{data_type:s};if(e in t)return{data_type:h.EthereumDataType.STRUCT,size:t[e].length,struct_name:e};throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`No type definition specified: ${e}`)};function yr(e){const t=new Uint8Array(33);return t.set([0]),t.set(l.hexToBytes(e),1),function(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(64,"0")}`.toLowerCase()}(l.bytesToHex(m.blake2b(t,{dkLen:32})).slice(0,64))}const gr=e=>{qt(e,[{name:"addressType",type:"number",required:!0},{name:"stakingKeyHash",type:"string"},{name:"paymentScriptHash",type:"string"},{name:"stakingScriptHash",type:"string"}]),e.path&&Z(e.path),e.stakingPath&&Z(e.stakingPath),e.certificatePointer&&qt(e.certificatePointer,[{name:"blockIndex",type:"number",required:!0},{name:"txIndex",type:"number",required:!0},{name:"certificateIndex",type:"number",required:!0}])},mr=e=>{let t=[];e.path&&(t=Z(e.path,3));let r,i=[];return e.stakingPath&&(i=Z(e.stakingPath,3)),e.certificatePointer&&(r={block_index:e.certificatePointer.blockIndex,tx_index:e.certificatePointer.txIndex,certificate_index:e.certificatePointer.certificateIndex}),{address_type:e.addressType,address_n:t,address_n_staking:i,staking_key_hash:e.stakingKeyHash,certificate_pointer:r,script_payment_hash:e.paymentScriptHash,script_staking_hash:e.stakingScriptHash}},vr=e=>{let t;return e.certificate_pointer&&(t={blockIndex:e.certificate_pointer.block_index,txIndex:e.certificate_pointer.tx_index,certificateIndex:e.certificate_pointer.certificate_index}),{addressType:e.address_type,path:e.address_n,stakingPath:e.address_n_staking,stakingKeyHash:e.staking_key_hash,certificatePointer:t}},br=e=>(qt(e,[{name:"prev_hash",type:"string",required:!0},{name:"prev_index",type:"number",required:!0}]),{input:{prev_hash:e.prev_hash,prev_index:e.prev_index},path:e.path?Z(e.path,5):void 0}),_r=e=>(qt(e,[{name:"prev_hash",type:"string",required:!0},{name:"prev_index",type:"number",required:!0}]),{collateralInput:{prev_hash:e.prev_hash,prev_index:e.prev_index},path:e.path?Z(e.path,5):void 0}),wr=e=>(qt(e,[{name:"prev_hash",type:"string",required:!0},{name:"prev_index",type:"number",required:!0}]),{prev_hash:e.prev_hash,prev_index:e.prev_index}),Er=e=>((e=>{e.forEach((e=>{qt(e,[{name:"policyId",type:"string",required:!0},{name:"tokenAmounts",type:"array",required:!0}]),e.tokenAmounts.forEach((e=>{qt(e,[{name:"assetNameBytes",type:"string",required:!0},{name:"amount",type:"uint"},{name:"mintAmount",type:"uint",allowNegative:!0}])}))}))})(e),e.map((e=>({policyId:e.policyId,tokens:Sr(e.tokenAmounts)})))),Sr=e=>e.map((e=>({asset_name_bytes:e.assetNameBytes,amount:e.amount,mint_amount:e.mintAmount}))),Tr=e=>e.length/2,Ar=(e,t,r,i)=>U(void 0,void 0,void 0,(function*(){let n=0;for(;n<t.length;){const s=t.slice(n,n+r);yield e(i,"CardanoTxItemAck",{data:s}),n+=r}})),Mr=e=>{qt(e,[{name:"address",type:"string"},{name:"amount",type:"uint",required:!0},{name:"tokenBundle",type:"array",allowEmpty:!0},{name:"datumHash",type:"string"},{name:"format",type:"number"},{name:"inlineDatum",type:"string"},{name:"referenceScript",type:"string"}]);const t={output:{amount:e.amount,asset_groups_count:0,datum_hash:e.datumHash,format:e.format,inline_datum_size:e.inlineDatum?Tr(e.inlineDatum):void 0,reference_script_size:e.referenceScript?Tr(e.referenceScript):void 0},inlineDatum:e.inlineDatum,referenceScript:e.referenceScript};return e.addressParameters?(gr(e.addressParameters),t.output.address_parameters=mr(e.addressParameters)):t.output.address=e.address,e.tokenBundle?(t.tokenBundle=Er(e.tokenBundle),t.output.asset_groups_count=t.tokenBundle.length):t.output.asset_groups_count=0,t},Rr=(e,t)=>U(void 0,void 0,void 0,(function*(){const{output:r,tokenBundle:i,inlineDatum:n,referenceScript:s}=t;if(yield e("CardanoTxOutput","CardanoTxItemAck",r),i)for(const t of i){yield e("CardanoAssetGroup","CardanoTxItemAck",{policy_id:t.policyId,tokens_count:t.tokens.length});for(const r of t.tokens)yield e("CardanoToken","CardanoTxItemAck",r)}n&&(yield Ar(e,n,2048,"CardanoTxInlineDatumChunk")),s&&(yield Ar(e,s,2048,"CardanoTxReferenceScriptChunk"))})),xr=e=>{if(qt(e,[{name:"type",type:"number",required:!0}]),e.type===h.Messages.CardanoPoolRelayType.SINGLE_HOST_IP){const t=[{name:"port",type:"number",required:!0}];if(e.ipv4Address&&t.push({name:"ipv4Address",type:"string",required:!1}),e.ipv6Address&&t.push({name:"ipv6Address",type:"string",required:!1}),qt(e,t),!e.ipv4Address&&!e.ipv6Address)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Either ipv4Address or ipv6Address must be supplied")}else e.type===h.Messages.CardanoPoolRelayType.SINGLE_HOST_NAME?qt(e,[{name:"hostName",type:"string",required:!0},{name:"port",type:"number",required:!0}]):e.type===h.Messages.CardanoPoolRelayType.MULTIPLE_HOST_NAME&&qt(e,[{name:"hostName",type:"string",required:!0}])},kr=e=>{const t=[{name:"type",type:"number",required:!0}];e.type!==h.Messages.CardanoCertificateType.STAKE_POOL_REGISTRATION&&(t.push({name:"scriptHash",type:"string"}),t.push({name:"keyHash",type:"string"})),e.type===h.Messages.CardanoCertificateType.STAKE_DELEGATION&&t.push({name:"pool",type:"string",required:!0}),e.type===h.Messages.CardanoCertificateType.STAKE_POOL_REGISTRATION&&t.push({name:"poolParameters",type:"object",required:!0}),qt(e,t);const{poolParameters:r,poolOwners:i,poolRelays:s}=(e=>e?((e=>{var t,r;qt(e,[{name:"poolId",type:"string",required:!0},{name:"vrfKeyHash",type:"string",required:!0},{name:"pledge",type:"string",required:!0},{name:"cost",type:"string",required:!0},{name:"margin",type:"object",required:!0},{name:"rewardAccount",type:"string",required:!0},{name:"owners",type:"array",required:!0},{name:"relays",type:"array",required:!0,allowEmpty:!0},{name:"metadata",type:"object"}]),t=e.margin,qt(t,[{name:"numerator",type:"string",required:!0},{name:"denominator",type:"string",required:!0}]),(e=>{if(e.forEach((e=>{if(e.stakingKeyHash&&qt(e,[{name:"stakingKeyHash",type:"string",required:!e.stakingKeyPath}]),e.stakingKeyPath&&Z(e.stakingKeyPath,5),!e.stakingKeyHash&&!e.stakingKeyPath)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Either stakingKeyHash or stakingKeyPath must be supplied")})),1!==e.filter((e=>!!e.stakingKeyPath)).length)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Exactly one pool owner must be given as a path")})(e.owners),e.relays.forEach(xr),e.metadata&&(r=e.metadata,qt(r,[{name:"url",type:"string",required:!0},{name:"hash",type:"string",required:!0}]))})(e),{poolParameters:{pool_id:e.poolId,vrf_key_hash:e.vrfKeyHash,pledge:e.pledge,cost:e.cost,margin_numerator:e.margin.numerator,margin_denominator:e.margin.denominator,reward_account:e.rewardAccount,metadata:e.metadata,owners_count:e.owners.length,relays_count:e.relays.length},poolOwners:e.owners.map((e=>({staking_key_hash:e.stakingKeyHash,staking_key_path:e.stakingKeyPath?Z(e.stakingKeyPath,5):void 0}))),poolRelays:e.relays.map((e=>{return{type:e.type,ipv4_address:e.ipv4Address?(r=e.ipv4Address,n.from(r.split(".").map((e=>parseInt(e,10)))).toString("hex")):void 0,ipv6_address:e.ipv6Address?(t=e.ipv6Address,t.split(":").join("")):void 0,host_name:e.hostName,port:e.port};var t,r}))}):{poolParameters:void 0,poolOwners:[],poolRelays:[]})(e.poolParameters);return{certificate:{type:e.type,path:e.path?Z(e.path,5):void 0,script_hash:e.scriptHash,key_hash:e.keyHash,pool:e.pool,pool_parameters:r},poolOwners:i,poolRelays:s}},Or=e=>(qt(e,[{name:"votingPublicKey",type:"string",required:!0},{name:"weight",type:"uint",required:!0}]),{voting_public_key:e.votingPublicKey,weight:e.weight}),Ir=(e,t,r,i,n,s,o)=>{const a=new Map;function u(e){const t=JSON.stringify(e);a.set(t,e)}return o!==h.Messages.CardanoTxSigningMode.MULTISIG_TRANSACTION&&(e.forEach((({path:e})=>{e&&u(e)})),t.forEach((({certificate:e,poolOwners:t})=>{!e.path||e.type!==h.Messages.CardanoCertificateType.STAKE_DELEGATION&&e.type!==h.Messages.CardanoCertificateType.STAKE_DEREGISTRATION||u(e.path),t.forEach((e=>{e.staking_key_path&&u(e.staking_key_path)}))})),r.forEach((({path:e})=>{e&&u(e)}))),o===h.Messages.CardanoTxSigningMode.PLUTUS_TRANSACTION&&i.forEach((({path:e})=>{e&&u(e)})),n.forEach((({key_path:e})=>{e&&u(e)})),s.forEach((e=>{u(e)})),Array.from(a.values())};var Cr;function Pr(e){return v.Buffer.isBuffer(e)||e instanceof Uint8Array}function Nr(e,t){const r=e.toString(16).padStart(2*t.size,"0");return v.Buffer.from(r,"hex")}!function(e){e[e.SIGHASH_ALL=1]="SIGHASH_ALL",e[e.SIGHASH_NONE=2]="SIGHASH_NONE",e[e.SIGHASH_SINGLE=3]="SIGHASH_SINGLE",e[e.SIGHASH_FORKID=64]="SIGHASH_FORKID",e[e.SIGHASH_ANYONECANPAY=128]="SIGHASH_ANYONECANPAY"}(Cr||(Cr={}));class Dr{constructor(e){this.bufLen=0,e?this.set(e):this.bufs=[]}set(e){return this.bufs=e.bufs||this.bufs||[],this.bufLen=this.bufs.reduce(((e,t)=>e+t.length),0),this}toBuffer(){return this.concat()}concat(){return v.Buffer.concat(this.bufs,this.bufLen)}write(e){if(!Pr(e))throw new Error("BufferWriter.write: Invalid type");return this.bufs.push(e),this.bufLen+=e.length,this}writeReverse(e){if(!Pr(e))throw new Error("BufferWriter.write: Invalid type");return this.bufs.push(e.reverse()),this.bufLen+=e.length,this}writeVarBytes(e){if(!Pr(e))throw new Error("BufferWriter.write: Invalid type");return this.writeUInt64LE(new S.default(e.length)),this.write(e),this}writeUInt8(e){const t=v.Buffer.alloc(1);return t.writeUInt8(e,0),this.write(t),this}writeUInt16BE(e){const t=v.Buffer.alloc(2);return t.writeUInt16BE(e,0),this.write(t),this}writeUInt16LE(e){const t=v.Buffer.alloc(2);return t.writeUInt16LE(e,0),this.write(t),this}writeUInt32BE(e){const t=v.Buffer.alloc(4);return t.writeUInt32BE(e,0),this.write(t),this}writeInt32LE(e){const t=v.Buffer.alloc(4);return t.writeInt32LE(e,0),this.write(t),this}writeUInt32LE(e){const t=v.Buffer.alloc(4);return t.writeUInt32LE(e,0),this.write(t),this}writeUInt64BEBN(e){const t=Nr(e,{size:8});return this.write(t),this}writeUInt64LE(e){const t=Nr(e,{size:8});return this.writeReverse(t),this}writeVarintNum(e){const t=Dr.varintBufNum(e);return this.write(t),this}writeVarintBN(e){const t=Dr.varintBufBN(e);return this.write(t),this}static varintBufNum(e){let t;return e<253?(t=v.Buffer.alloc(1),t.writeUInt8(e,0)):e<65536?(t=v.Buffer.alloc(3),t.writeUInt8(253,0),t.writeUInt16LE(e,1)):e<4294967296?(t=v.Buffer.alloc(5),t.writeUInt8(254,0),t.writeUInt32LE(e,1)):(t=v.Buffer.alloc(9),t.writeUInt8(255,0),t.writeInt32LE(-1&e,1),t.writeUInt32LE(Math.floor(e/4294967296),5)),t}static varintBufBN(e){let t;const r=e.toNumber();if(r<253)t=v.Buffer.alloc(1),t.writeUInt8(r,0);else if(r<65536)t=v.Buffer.alloc(3),t.writeUInt8(253,0),t.writeUInt16LE(r,1);else if(r<4294967296)t=v.Buffer.alloc(5),t.writeUInt8(254,0),t.writeUInt32LE(r,1);else{const r=new Dr;r.writeUInt8(255),r.writeUInt64LE(e),t=r.concat()}return t}}const Br=n.from("TransactionSigningHash");class qr{constructor(){this.bw=new Dr,this.blake2b=m.blake2b.create({dkLen:32,key:Br}),this.hash={update:e=>{this.bw.write(e),this.blake2b.update(e)},digest:()=>n.from(this.blake2b.digest())}}writeUInt8(e){const t=new Dr;t.writeUInt8(e),this.hash.update(t.toBuffer())}writeUInt16LE(e){const t=new Dr;t.writeUInt16LE(e),this.hash.update(t.toBuffer())}writeUInt32LE(e){const t=new Dr;t.writeUInt32LE(e),this.hash.update(t.toBuffer())}writeUInt64LE(e){const t=new Dr;t.writeUInt64LE(new S.default(e)),this.hash.update(t.toBuffer())}writeVarBytes(e){this.writeUInt64LE(e.length),this.hash.update(e)}writeHash(e){this.hash.update(e)}finalize(){return this.hash.digest()}toBuffer(){return this.bw.toBuffer()}}function Lr(){return n.alloc(32)}function jr(){return n.alloc(20)}function Fr(e){return(e&Cr.SIGHASH_ANYONECANPAY)===Cr.SIGHASH_ANYONECANPAY}function Ur(e){return(31&e)===Cr.SIGHASH_SINGLE}function zr(e){return(31&e)===Cr.SIGHASH_NONE}function Hr(e,t){e.writeHash(n.from(t.prevTxId,"hex")),e.writeUInt32LE(t.outputIndex)}function Gr(e,t){var r;const i=new qr;i.writeUInt16LE(e.version),i.writeHash(function(e,t){if(Fr(t))return Lr();const r=new qr;return e.inputs.forEach((e=>Hr(r,e))),r.finalize()}(e,e.sigHashType)),i.writeHash(function(e,t){if(Ur(t)||Fr(t)||zr(t))return Lr();const r=new qr;return e.inputs.forEach((e=>r.writeUInt64LE(e.sequenceNumber))),r.finalize()}(e,e.sigHashType)),i.writeHash(function(e,t){if(Fr(t))return Lr();const r=new qr;return e.inputs.forEach((e=>r.writeUInt8(e.sigOpCount))),r.finalize()}(e,e.sigHashType));const s=e.inputs[t];return Hr(i,s),i.writeUInt16LE(0),i.writeVarBytes(n.from(s.output.script,"hex")),i.writeUInt64LE(s.output.satoshis),i.writeUInt64LE(s.sequenceNumber),i.writeUInt8(null!==(r=e.sigOpCount)&&void 0!==r?r:1),i.writeHash(function(e,t,r){if(zr(r))return Lr();if(Ur(r))return t>=e.outputs.length?Lr():(new qr).finalize();const i=new qr;return e.outputs.forEach((e=>function(e,t){e.writeUInt64LE(t.satoshis),e.writeUInt16LE(0),e.writeVarBytes(n.from(t.script,"hex"))}(i,e))),i.finalize()}(e,t,e.sigHashType)),i.writeUInt64LE(e.lockTime),i.writeHash(jr()),i.writeUInt64LE(0),i.writeHash(Lr()),i.writeUInt8(e.sigHashType),{hash:i.finalize(),raw:i.toBuffer()}}var $r=Object.freeze({__proto__:null,searchDevices:class extends At{init(){this.useDevice=!1,this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){var e,t;return U(this,void 0,void 0,(function*(){yield ct.configure();const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),i=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[];if("react-native"===xe.getSettings("env"))return i.map((e=>{var t,r;return Object.assign(Object.assign({},e),{connectId:e.id,deviceType:(r=null!==(t=e.name)&&void 0!==t?t:"",r?r.startsWith("MI")?"mini":r.startsWith("T")?"touch":"classic":"classic")})}));const{deviceList:n}=yield at.getDevices(i);return n.map((e=>e.toMessageObject()))}))}},getFeatures:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt,pt],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return i.resolve(this.device.features)}},getPassphraseState:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.useDevicePassphraseState=!1}run(){var e,t;return U(this,void 0,void 0,(function*(){if(!this.device.features)return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceInitializeFailed));let{features:r}=this.device;const n=!0===(null===(t=null===(e=this.device)||void 0===e?void 0:e.features)||void 0===t?void 0:t.unlocked),s=yield se(this.device.features,this.device.commands);if(("touch"===J(r)||"pro"===J(r))&&n){const{message:e}=yield this.device.commands.typedCall("GetFeatures","Features",{});r=e}return r&&!0===r.passphrase_protection?(s&&r.device_id&&this.device.tryFixInternalState(s,r.device_id,r.session_id),i.resolve(s)):i.resolve(void 0)}))}},getLogs:class extends At{init(){this.useDevice=!1,this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return U(this,void 0,void 0,(function*(){const e=(()=>{let e=[];return Object.keys(me).forEach((t=>{e=e.concat(me[t].messages)})),e.sort(((e,t)=>e.timestamp-t.timestamp)),e})();return i.resolve(e)}))}},checkFirmwareRelease:class extends At{init(){this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){if(this.device.features){const e=Et(this.device.features);return i.resolve(e)}return i.resolve(null)}},checkBLEFirmwareRelease:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,pt],this.checkDeviceId=!0,this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){if(this.device.features){const e=St(this.device.features);return i.resolve(e)}return i.resolve(null)}},checkTransportRelease:class extends At{init(){this.useDevice=!1,this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return U(this,void 0,void 0,(function*(){const e=ct.getTransport(),t=yield e.init(),r=xe.getTransportStatus(t);return i.resolve(r)}))}},checkBridgeStatus:class extends At{init(){this.useDevice=!1,this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return U(this,void 0,void 0,(function*(){return new i(((e,t)=>{w.default.request({url:"http://localhost:21320",method:"POST",withCredentials:!1,timeout:3e3}).then((()=>e(!0))).catch((r=>{"ECONNABORTED"===r.code?t(o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError)):e(!1)}))}))}))}},checkBridgeRelease:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,pt],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return U(this,void 0,void 0,(function*(){if(!this.device.features)return null;try{const{data:e}=yield w.default.request({url:"http://localhost:21320",method:"POST",withCredentials:!1,timeout:3e3}),{version:t="0.0.0"}=e,{willUpdateFirmwareVersion:r}=this.payload,{features:i}=this.device,n=J(i),s=te(i).join("."),o=_.default.lt(t,Mt);let a=!1;return"touch"===n&&(_.default.gte(r,Rt)&&o&&(a=!0),_.default.gte(s,Rt)&&o&&(a=!0)),"classic"!==n&&"mini"!==n||(_.default.gte(r,xt)&&o&&(a=!0),_.default.gte(s,xt)&&o&&(a=!0)),{shouldUpdate:a,status:a?"outdated":"valid",releaseVersion:Mt}}catch(e){return"ECONNABORTED"===e.code?i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError)):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.BridgeNotInstalled))}}))}},checkBootloaderRelease:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,pt],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return U(this,void 0,void 0,(function*(){if(!this.device.features)return null;const{features:e}=this.device,t=J(e);let r=!1;"classic"===t||"mini"===t?r=!!function(e,t){const r=J(e);if("classic"!==r&&"mini"!==r)return!1;if(!t)return!1;const i=te(e).join("."),n=ie(e).join("."),s=xe.getBootloaderTargetVersion(e);if(s&&_.default.gte(n,s.join(".")))return!1;const o=xe.getBootloaderRelatedFirmwareVersion(e);return!!o&&(_.default.lte(t,o.join("."))||_.default.gte(i,o.join("."))&&s&&_.default.lt(n,s.join(".")))}(e,this.payload.willUpdateFirmwareVersion):"touch"===t&&(r=fe(e));const n=xe.getBootloaderResource(e);return i.resolve({shouldUpdate:r,status:r?"outdated":"valid",release:n})}))}},deviceBackup:class extends At{init(){this.useDevicePassphraseState=!1}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("BackupDevice","Success");return i.resolve(e.message)}))}},deviceChangePin:class extends At{init(){this.useDevicePassphraseState=!1,qt(this.payload,[{name:"remove",type:"boolean"}]),this.params={remove:this.payload.remove}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ChangePin","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceFlags:class extends At{init(){this.useDevicePassphraseState=!1,qt(this.payload,[{name:"flags",type:"number"}]),this.params={flags:this.payload.flags}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplyFlags","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceRebootToBootloader:class extends At{init(){this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}getVersionRange(){return{classic:{min:"2.1.11"},mini:{min:"2.1.11"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RebootToBootloader","Success");return i.resolve(e.message)}))}},deviceRebootToBoardloader:class extends At{init(){this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}getVersionRange(){return{classic:{min:"2.1.11"},mini:{min:"2.1.11"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("BixinOutMessageSE","Success");return i.resolve(e.message)}))}},deviceRecovery:class extends At{init(){this.useDevicePassphraseState=!1,qt(this.payload,[{name:"wordCount",type:"number"},{name:"passphraseProtection",type:"boolean"},{name:"pinProtection",type:"boolean"},{name:"language",type:"string"},{name:"label",type:"string"},{name:"enforceWordlist",type:"boolean"},{name:"type",type:"object"},{name:"u2fCounter",type:"number"},{name:"dryRun",type:"boolean"}]),this.params={word_count:this.payload.wordCount,passphrase_protection:this.payload.passphraseProtection,pin_protection:this.payload.pinProtection,language:this.payload.language,label:this.payload.label,enforce_wordlist:this.payload.enforceWordlist,type:this.payload.type,u2f_counter:this.payload.u2fCounter||Math.floor(Date.now()/1e3),dry_run:this.payload.dryRun}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RecoveryDevice","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceReset:class extends At{init(){this.useDevicePassphraseState=!1,qt(this.payload,[{name:"displayRandom",type:"boolean"},{name:"strength",type:"number"},{name:"passphraseProtection",type:"boolean"},{name:"pinProtection",type:"boolean"},{name:"language",type:"string"},{name:"label",type:"string"},{name:"u2fCounter",type:"number"},{name:"skipBackup",type:"boolean"},{name:"noBackup",type:"boolean"},{name:"backupType"}]),this.params={display_random:this.payload.displayRandom,strength:this.payload.strength||256,passphrase_protection:this.payload.passphraseProtection,pin_protection:this.payload.pinProtection,language:this.payload.language,label:this.payload.label,u2f_counter:this.payload.u2fCounter||Math.floor(Date.now()/1e3),skip_backup:this.payload.skipBackup,no_backup:this.payload.noBackup,backup_type:this.payload.backupType}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResetDevice","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceSettings:class extends At{init(){this.useDevicePassphraseState=!1,qt(this.payload,[{name:"language",type:"string"},{name:"label",type:"string"},{name:"usePassphrase",type:"boolean"},{name:"homescreen",type:"string"},{name:"passphraseSource",type:"number"},{name:"autoLockDelayMs",type:"number"},{name:"displayRotation",type:"number"},{name:"passphraseAlwaysOnDevice",type:"boolean"},{name:"safetyChecks",type:"number"},{name:"experimentalFeatures",type:"boolean"}]),this.params={language:this.payload.language,label:this.payload.label,use_passphrase:this.payload.usePassphrase,homescreen:this.payload.homescreen,_passphrase_source:this.payload.passphraseSource,auto_lock_delay_ms:this.payload.autoLockDelayMs,display_rotation:this.payload.displayRotation,passphrase_always_on_device:this.payload.passphraseAlwaysOnDevice,safety_checks:this.payload.safetyChecks,experimental_features:this.payload.experimentalFeatures}}getVersionRange(){return this.payload.usePassphrase?{model_mini:{min:"2.4.0"}}:{}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplySettings","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceUpdateReboot:class extends At{init(){this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("DeviceBackToBoot","Success");return i.resolve(e.message)}))}},deviceUploadResource:class extends At{constructor(){super(...arguments),this.paramsData={data:new Uint8Array,thumbnailData:new Uint8Array},this.processResourceRequest=e=>U(this,void 0,void 0,(function*(){if("Success"===e.type)return e.message;const{offset:t,data_length:r}=e.message,{data:i,thumbnailData:n}=this.paramsData;if(void 0===t)throw new Error("offset is undefined");let s;s="ResourceRequest"===e.type?new Uint8Array(i.slice(t,Math.min(t+r,i.byteLength))):new Uint8Array(n.slice(t,Math.min(t+r,n.byteLength)));const o=c.blake2s(s),a={data_chunk:l.bytesToHex(s),hash:l.bytesToHex(o)},u=yield this.device.commands.typedCall("ResourceAck",["ResourceRequest","ZoomRequest","Success"],a);return this.processResourceRequest(u)}))}getVersionRange(){return{model_touch:{min:"3.2.0"}}}checkUploadNFTSupport(){const e=J(this.device.features),t=te(this.device.features).join(".");if("touch"!==e)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodError,"Device Not Support Upload NFT");if(_.default.lt(t,"4.1.0"))throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodNeedUpgradeFirmware,"Device firmware version is too low, please update to 4.1.0",{current:t,require:"4.1.0"})}init(){this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0,qt(this.payload,[{name:"suffix",type:"string",required:!0},{name:"dataHex",type:"string",required:!0},{name:"thumbnailDataHex",type:"string",required:!0},{name:"resType",type:"number",required:!0},{name:"nftMetaData",type:"string"},{name:"file_name_no_ext",type:"boolean"}]);const{suffix:e,dataHex:t,thumbnailDataHex:r,resType:i,nftMetaData:n}=this.payload;this.paramsData={data:Dt(t),thumbnailData:Dt(r)};const s=`${0===i?"wp":"nft"}-${l.bytesToHex(c.blake2s(this.payload.dataHex)).slice(0,8)}-${Math.floor(Date.now()/1e3)}`;this.params={extension:e,data_length:this.paramsData.data.byteLength,zoom_data_length:this.paramsData.thumbnailData.byteLength,res_type:i,nft_meta_data:n,file_name_no_ext:s}}run(){return U(this,void 0,void 0,(function*(){this.payload.resType===h.Messages.ResourceType.Nft&&this.checkUploadNFTSupport();const e=yield this.device.commands.typedCall("ResourceUpload",["ResourceRequest","ZoomRequest","Success"],this.params);return this.postMessage(ze(De)),this.processResourceRequest(e)}))}},deviceSupportFeatures:class extends At{init(){this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){if(!this.device.features)return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Device not initialized"));const e=ne(this.device.features),t=ae(this.device.features);return i.resolve({inputPinOnSoftware:e,modifyHomescreen:t,device:this.device.toMessageObject()})}},deviceVerify:class extends At{init(){this.useDevicePassphraseState=!1,qt(this.payload,[{name:"dataHex",type:"hexString"}]),this.params={data:Ct(this.payload.dataHex)}}run(){return U(this,void 0,void 0,(function*(){let e;if("classic"===J(this.device.features))e=(yield this.device.commands.typedCall("BixinVerifyDeviceRequest","BixinVerifyDeviceAck",Object.assign(Object.assign({},this.params),{data:l.bytesToHex(f.sha256(this.params.data))}))).message;else{const t=yield this.device.commands.typedCall("SESignMessage","SEMessageSignature",{message:this.params.data});e={cert:(yield this.device.commands.typedCall("ReadSEPublicCert","SEPublicCert")).message.public_cert,signature:t.message.signature}}return e?i.resolve(e):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Device not support verify"))}))}},deviceWipe:class extends At{init(){this.useDevicePassphraseState=!1}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("WipeDevice","Success");return i.resolve(e.message)}))}},deviceFullyUploadResource:class extends At{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(ze(mt,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.notAllowDeviceMode=[pt,yt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}isSupportResourceUpdate(e,t){if("firmware"!==t)return!1;const r=J(e),i="touch"===r||"pro"===r,n=te(e).join(".");return i&&_.default.gte(n,"3.4.0")}run(){return U(this,void 0,void 0,(function*(){const{device:e}=this,{features:t}=e;if(!(null==t?void 0:t.bootloader_mode)&&t&&t){this.postTipMessage("CheckLatestUiResource");const r=xe.getSysFullResource(t);if(r){this.postTipMessage("DownloadLatestUiResource");const t=yield Ft(r);this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield Jt(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,e,t.binary))}}}))}},deviceUpdateBootloader:class extends At{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(ze(mt,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.notAllowDeviceMode=[pt,yt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}updateTouchBootloader(e,t){return U(this,void 0,void 0,(function*(){if(t&&!t.bootloader_mode&&t&&fe(t)){this.postTipMessage("CheckLatestUiResource");const r=xe.getBootloaderResource(t);if(r){this.postTipMessage("DownloadLatestBootloaderResource");const t=yield Ft(r);if(this.postTipMessage("DownloadLatestBootloaderResourceSuccess"),t){if(!function(e){const t=new Uint8Array(e.slice(0,Math.min(16384,e.byteLength))),r=E.default.wrap(t,void 0,void 0,!0);r.LE(),r.readByte(),r.readByte(),r.readByte(),r.readByte();const i=r.readUint32();return r.readUint32(),i+r.readUint32()===e.byteLength}(t.binary))throw o.ERRORS.TypedError(o.HardwareErrorCode.CheckDownloadFileError);return yield((e,t,r,i)=>U(void 0,void 0,void 0,(function*(){return $t(r,"UpdateBootloader",t),Gt(r,Math.floor(0),t),yield Xt(e,"bootloader.bin",i),Gt(r,Math.floor(100),t),$t(r,"UpdateBootloaderSuccess",t),!0})))(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,e,t.binary),i.resolve(!0)}}}return i.resolve(!0)}))}run(){return U(this,void 0,void 0,(function*(){const{device:e}=this,{features:t}=e;return"touch"===J(t)?this.updateTouchBootloader(e,t):i.resolve(!0)}))}},firmwareUpdate:class extends At{init(){this.notAllowDeviceMode=[pt,yt],this.requireDeviceMode=[pt],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0;const{payload:e}=this;if(qt(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"}]),!e.updateType)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"updateType is required");this.params={updateType:e.updateType},"version"in e&&(this.params=Object.assign(Object.assign({},this.params),{version:e.version})),"binary"in e&&(this.params=Object.assign(Object.assign({},this.params),{binary:e.binary}))}run(){var e;return U(this,void 0,void 0,(function*(){const{device:t,params:r}=this;let i;try{if(r.binary)i=this.params.binary;else{if(!t.features)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"no features found for this device");i=(yield jt({features:t.features,version:r.version,updateType:r.updateType})).binary}}catch(t){throw o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(e=t.message)&&void 0!==e?e:t)}return Vt(r.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,t,{payload:i})}))}},firmwareUpdateV2:class extends At{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(ze(mt,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.notAllowDeviceMode=[pt,yt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0;const{payload:e}=this;if(qt(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"},{name:"forcedUpdateRes",type:"boolean"},{name:"platform",type:"string",required:!0}]),!e.updateType)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"updateType is required");this.params={updateType:e.updateType,forcedUpdateRes:e.forcedUpdateRes,isUpdateBootloader:e.isUpdateBootloader},"version"in e&&(this.params=Object.assign(Object.assign({},this.params),{version:e.version})),"binary"in e&&(this.params=Object.assign(Object.assign({},this.params),{binary:e.binary}))}checkDeviceToBootloader(e){this.checkPromise=o.createDeferred();const t=xe.getSettings("env"),r=e&&"react-native"===t;Qt.log("FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ",r);const i=setInterval((()=>U(this,void 0,void 0,(function*(){var t,n,s,o,a,u,d,l;if(r)try{yield null===(t=this.device.deviceConnector)||void 0===t?void 0:t.acquire(this.device.originalDescriptor.id,null,!0),yield this.device.initialize(),(null===(n=this.device.features)||void 0===n?void 0:n.bootloader_mode)&&(clearInterval(i),null===(s=this.checkPromise)||void 0===s||s.resolve(!0))}catch(e){Qt.log("catch Bluetooth error when device is restarting: ",e)}else{const t=yield null===(o=this.device.deviceConnector)||void 0===o?void 0:o.enumerate(),r=null!==(a=null==t?void 0:t.descriptors)&&void 0!==a?a:[],{deviceList:n}=yield at.getDevices(r,e);1===n.length&&(null===(d=null===(u=n[0])||void 0===u?void 0:u.features)||void 0===d?void 0:d.bootloader_mode)&&(this.device.updateFromCache(n[0]),this.device.commands.disposed=!1,clearInterval(i),null===(l=this.checkPromise)||void 0===l||l.resolve(!0))}}))),r?3e3:2e3);setTimeout((()=>{this.checkPromise&&(clearInterval(i),this.checkPromise.reject(new Error))}),3e4)}isEnteredManuallyBoot(e){const t=J(e),r="mini"===t,i="firmware"===this.params.updateType&&"classic"===t&&"1.8.3"===e.bootloader_version;return r||i}isSupportResourceUpdate(e,t){if("firmware"!==t)return!1;const r=J(e),i="touch"===r||"pro"===r,n=te(e).join(".");return i&&_.default.gte(n,"3.2.0")}checkVersionForCopyTouchResource(e){var t;if(!e)return;const r=J(e),i=te(e).join("."),n=null===(t=this.params.version)||void 0===t?void 0:t.join("."),{updateType:s}=this.params,a=Ut({features:e,updateType:s});if(!a)return;const{fullResourceRange:u}=a;if(!u)return;const[d,l]=u;if("touch"===r&&"firmware"===s&&n&&_.default.lt(i,d)&&_.default.gte(n,l)&&"desktop"!==this.payload.platform)throw o.ERRORS.TypedError(o.HardwareErrorCode.UseDesktopToUpdateFirmware)}run(){var e,t;return U(this,void 0,void 0,(function*(){const{device:r,params:n}=this,{features:s,commands:a}=r,u=J(s);if(this.checkVersionForCopyTouchResource(s),!(null==s?void 0:s.bootloader_mode)&&s){const t=Q(s);if(this.isEnteredManuallyBoot(s))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateManuallyEnterBoot));if(s&&this.isSupportResourceUpdate(s,n.updateType)){this.postTipMessage("CheckLatestUiResource");const e=xe.getSysResourcesLatestRelease(s,n.forcedUpdateRes);if(e){this.postTipMessage("DownloadLatestUiResource");const t=yield Ft(e);this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield Jt(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,t.binary))}}try{if(this.postTipMessage("AutoRebootToBootloader"),"CallMethodError"===(yield a.typedCall("DeviceBackToBoot","Success")).type)throw o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure);this.postTipMessage("GoToBootloaderSuccess"),this.checkDeviceToBootloader(this.payload.connectId),"classic"===u&&at.clearDeviceCache(t),delete at.devicesCache[""],yield null===(e=this.checkPromise)||void 0===e?void 0:e.promise,this.checkPromise=null,yield Se(1500)}catch(e){return e instanceof o.HardwareError?i.reject(e):(console.log("auto go to bootloader mode failed: ",e),i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure)))}}let d;try{if(n.binary)d=this.params.binary;else{if(!r.features)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"no features found for this device");this.postTipMessage("DownloadFirmware"),d=(yield jt({features:r.features,version:n.version,updateType:n.updateType,isUpdateBootloader:n.isUpdateBootloader})).binary,this.postTipMessage("DownloadFirmwareSuccess")}}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(t=e.message)&&void 0!==t?t:e)}return yield this.device.acquire(),Vt(n.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,{payload:d})}))}},requestWebUsbDevice:class extends At{init(){this.useDevice=!1,this.useDevicePassphraseState=!1,this.skipForceUpdateCheck=!0}run(){var e,t;return U(this,void 0,void 0,(function*(){if(yield ct.configure(),"webusb"!==xe.getSettings("env"))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Not webusb environment"));try{const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),n=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[],{deviceList:s}=yield at.getDevices(n);return s.length>0?{device:s[0].toMessageObject()}:yield i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}catch(e){return er.debug(e),i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}}))}},cipherKeyValue:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=Z(e.path);qt(e,[{name:"path",required:!0},{name:"key",type:"string"},{name:"value",type:"hexString"},{name:"encrypt",type:"boolean"},{name:"askOnEncrypt",type:"boolean"},{name:"askOnDecrypt",type:"boolean"},{name:"iv",type:"hexString"}]),this.params.push({address_n:t,key:e.key,value:Ct(e.value),encrypt:e.encrypt,ask_on_encrypt:e.askOnEncrypt,ask_on_decrypt:e.askOnDecrypt,iv:Ct(e.iv)})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("CipherKeyValue","CipheredKeyValue",Object.assign({},r));e.push(Object.assign({path:Y(r.address_n)},i.message))}return i.resolve(this.hasBundle?e:e[0])}))}},btcGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=Object.prototype.hasOwnProperty.call(this.payload,"bundle");const e=this.hasBundle?this.payload:{bundle:[this.payload]};qt(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=Z(e.path,1);qt(e,[{name:"path",required:!0},{name:"coin",type:"string"},{name:"showOnOneKey",type:"boolean"},{name:"multisig",type:"object"},{name:"scriptType",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{multisig:n,coin:s}=e;let{scriptType:o}=e;o||(o=K(r),"SPENDMULTISIG"!==o||n||(o="SPENDADDRESS"));const a=rr(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,multisig:n,script_type:o||"SPENDADDRESS"})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("GetAddress","Address",Object.assign({},r)),n=Y(r.address_n);e.push(Object.assign({path:n},i.message)),this.postPreviousAddressMessage({address:i.message.address,path:n})}return i.resolve(this.hasBundle?e:e[0])}))}},btcGetPublicKey:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=Object.prototype.hasOwnProperty.call(this.payload,"bundle");const e=this.hasBundle?this.payload:{bundle:[this.payload]};qt(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=Z(e.path,1);qt(e,[{name:"path",required:!0},{name:"coin",type:"string"},{name:"showOnOneKey",type:"boolean"},{name:"scriptType",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{multisig:n,coin:s}=e;let{scriptType:o}=e;o||(o=K(r),"SPENDMULTISIG"!==o||n||(o="SPENDADDRESS"));const a=rr(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,script_type:o||"SPENDADDRESS"})}))}isBtcNetwork(e){return"Testnet"===e.coin_name||"Bitcoin"===e.coin_name}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let r=0;r<this.params.length;r++){const i=this.params[r],n=yield this.device.commands.typedCall("GetPublicKey","PublicKey",Object.assign({},i)),s=Object.assign(Object.assign({path:Y(i.address_n)},n.message),{xpubSegwit:n.message.xpub});if(this.isBtcNetwork(i)&&(t=i.address_n,Array.isArray(t)&&(t[0]===G(86)||t[0]===G(10025)))){const e=`${Number(s.root_fingerprint||0).toString(16).padStart(8,"0")}${s.path.substring(1)}`;s.xpubSegwit=`tr([${e}]${s.xpub}/<0;1>/*)`}e.push(s)}var t;return i.resolve(this.hasBundle?e:e[0])}))}},btcSignMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"coin",type:"string"}]);const{path:e,messageHex:t,coin:r}=this.payload,i=Z(e),{coinName:n,scriptType:s}=((e,t,r)=>{const i=rr(e,t).name;let n=r;void 0===n&&(n=(e=>Array.isArray(e)&&e[0]===G(48))(e));let s=K(e);return"SPENDMULTISIG"!==s||n||(s="SPENDADDRESS"),{coinName:i,scriptType:null!=s?s:"SPENDADDRESS"}})(i,r,!1);this.params={address_n:i,message:Ct(t),coin_name:n,script_type:s}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("SignMessage","MessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},btcSignTransaction:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"coin",type:"string",required:!0},{name:"inputs",type:"array",required:!0},{name:"outputs",type:"array",required:!0},{name:"refTxs",type:"array",required:!0,allowEmpty:!0},{name:"locktime",type:"number"},{name:"version",type:"number"},{name:"expiry",type:"number"},{name:"overwintered",type:"boolean"},{name:"versionGroupId",type:"number"},{name:"branchId",type:"number"},{name:"timestamp",type:"number"}]),this.payload.refTxs.forEach((e=>{qt(e,[{name:"hash",type:"hexString",required:!0},{name:"inputs",type:"array",required:!0},{name:"bin_outputs",type:"array",required:!Array.isArray(e.outputs)},{name:"outputs",type:"array"},{name:"version",type:"number",required:!0},{name:"lock_time",type:"number",required:!0},{name:"extra_data",type:"string"},{name:"timestamp",type:"number"},{name:"version_group_id",type:"number"}])})),this.payload.inputs.forEach((e=>{Z(e.address_n);const t=(r=e.address_n,Array.isArray(r)&&r[0]===G(49));var r;qt(e,[{name:"prev_hash",type:"hexString",required:!0},{name:"prev_index",type:"number",required:!0},{name:"script_type",type:"string"},{name:"amount",type:"string",required:t},{name:"sequence",type:"number"},{name:"multisig",type:"object"}])})),this.payload.outputs.forEach((e=>{if(qt(e,[{name:"address_n",type:"array"},{name:"address",type:"string"},{name:"amount",type:"string"},{name:"op_return_data",type:"string"},{name:"multisig",type:"object"}]),Object.prototype.hasOwnProperty.call(e,"address_n")&&Object.prototype.hasOwnProperty.call(e,"address"))throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Cannot use address and address_n in one output");if(e.address_n){const t=(e=>{if(!Array.isArray(e)||e.length<1)return"PAYTOADDRESS";if(49===e[0])return"PAYTOP2SHWITNESS";switch($(e[0])){case 48:return"PAYTOMULTISIG";case 49:return"PAYTOP2SHWITNESS";case 84:return"PAYTOWITNESS";case 86:case 10025:return"PAYTOTAPROOT";default:return"PAYTOADDRESS"}})(e.address_n);if(e.script_type!==t)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Output change script_type should be set to ${t}`)}}));const{inputs:e,outputs:t,refTxs:r,account:i,coin:n}=this.payload,s=rr(void 0,n).name;this.params={inputs:e,outputs:t,refTxs:r,addresses:i?i.addresses:void 0,options:{lock_time:this.payload.locktime,timestamp:this.payload.timestamp,version:this.payload.version,expiry:this.payload.expiry,overwintered:this.payload.overwintered,version_group_id:this.payload.versionGroupId,branch_id:this.payload.branchId},coinName:s}}run(){return U(this,void 0,void 0,(function*(){const{device:e,params:t}=this,r=e.unavailableCapabilities.replaceTransaction,{refTxs:i}=t,n=r?or:nr;return yield n(e.commands.typedCall.bind(e.commands),t.inputs,t.outputs,i,t.options,t.coinName)}))}},btcVerifyMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"address",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0},{name:"coin",type:"string",required:!0}]);const{coin:e}=this.payload,{address:t,messageHex:r,signature:i}=Ct(this.payload),n=rr(void 0,e).name;this.params={address:t,message:r,signature:i,coin_name:n}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("VerifyMessage","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},confluxGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"chainId",type:"number"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,chain_id:e.chainId,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("ConfluxGetAddress","ConfluxAddress",Object.assign({},r)),n=Y(r.address_n);e.push(Object.assign({path:n},i.message)),this.postPreviousAddressMessage({path:n,address:i.message.address})}return i.resolve(this.hasBundle?e:e[0])}))}},confluxSignMessage:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=Z(e,3);this.params={address_n:r,message:Ct(t)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessage","ConfluxMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},confluxSignMessageCIP23:class extends At{init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{path:e,domainHash:t,messageHash:r}=this.payload,i=Z(e,3);this.params={address_n:i,domain_hash:Ct(t),message_hash:Ct(r)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessageCIP23","ConfluxMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},confluxSignTransaction:class extends At{constructor(){super(...arguments),this.addressN=[],this.processTxRequest=(e,t)=>U(this,void 0,void 0,(function*(){if(!e.data_length){const t=e.signature_v,r=e.signature_r,n=e.signature_s;if(null==t||null==r||null==n)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodError,"sign transaction failed");return i.resolve({v:`0x${t.toString(16)}`,r:`0x${r}`,s:`0x${n}`})}const[r,n]=ar(t,2*e.data_length),s=yield this.device.commands.typedCall("ConfluxTxAck","ConfluxTxRequest",{data_chunk:r});return this.processTxRequest(s.message,n)})),this.evmSignTx=(e,t)=>U(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:u,epochHeight:d,storageLimit:l}=t,c=null==a?0:a.length/2,[h,f]=ar(a,2048);let p={address_n:e,nonce:It(o),gas_price:It(n),gas_limit:It(s),to:r,value:It(i),epoch_height:It(d),storage_limit:It(l),chain_id:u};0!==c&&(p=Object.assign(Object.assign({},p),{data_length:c,data_initial_chunk:h}));const y=yield this.device.commands.typedCall("ConfluxSignTx","ConfluxTxRequest",p);return this.processTxRequest(y.message,f)}))}init(){this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload;this.addressN=Z(e,3);const r=t;qt(r,[{name:"to",type:"hexString",required:!0},{name:"value",type:"hexString",required:!0},{name:"gasLimit",type:"hexString",required:!0},{name:"gasPrice",type:"hexString",required:!0},{name:"nonce",type:"hexString",required:!0},{name:"epochHeight",type:"hexString",required:!0},{name:"storageLimit",type:"hexString",required:!0},{name:"chainId",type:"number",required:!0},{name:"data",type:"hexString"}]),this.formattedTx=Ct(r)}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return U(this,void 0,void 0,(function*(){const{addressN:e,formattedTx:t}=this;if(null==t)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"ConfluxSignTransaction: format tx error");const r=yield this.evmSignTx(e,t);return i.resolve(r)}))}},evmGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"},{name:"chainId",type:"number"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i,chain_id:e.chainId})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("EthereumGetAddress","EthereumAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},evmGetPublicKey:class extends At{constructor(){super(...arguments),this.hasBundle=!1,this.useBatch=!1}init(){var e,t;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle),this.useBatch=!!(null===(t=this.payload)||void 0===t?void 0:t.useBatch);const r=this.hasBundle?this.payload:{bundle:[this.payload]};qt(r,[{name:"bundle",type:"array"}]),this.params=[],r.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"},{name:"chainId",type:"number"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i,chain_id:e.chainId})}))}run(){var e;return U(this,void 0,void 0,(function*(){const t=[];if(this.useBatch&&this.hasBundle&&oe(null===(e=this.device)||void 0===e?void 0:e.features)){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"secp256k1"})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e})));return i.resolve(e)}for(let e=0;e<this.params.length;e++){const r=this.params[e],i=yield this.device.commands.typedCall("EthereumGetPublicKey","EthereumPublicKey",Object.assign({},r));t.push(Object.assign({path:Y(r.address_n),publicKey:i.message.node.public_key},i.message))}return i.resolve(this.hasBundle?t:t[0])}))}},evmSignMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"chainId",type:"number"}]);const{path:e,messageHex:t,chainId:r}=this.payload,i=Z(e,3);this.params={address_n:i,message:Ct(t),chain_id:r}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessage","EthereumMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},evmSignMessageEIP712:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{path:e,domainHash:t,messageHash:r}=this.payload,i=Z(e,3);this.params={address_n:i,domain_hash:Ct(t),message_hash:Ct(r)}}getVersionRange(){return{model_mini:{min:"2.1.9"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},evmSignTransaction:class extends At{constructor(){super(...arguments),this.addressN=[],this.isEIP1559=!1,this.processTxRequest=(e,t,r)=>U(this,void 0,void 0,(function*(){if(!e.data_length){let t=e.signature_v;const n=e.signature_r,s=e.signature_s;if(null==t||null==n||null==s)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"processTxRequest: Unexpected request");return r&&t<=1&&(t+=2*r+35),i.resolve({v:`0x${t.toString(16)}`,r:`0x${n}`,s:`0x${s}`})}const[n,s]=ar(t,2*e.data_length),a=yield this.device.commands.typedCall("EthereumTxAck","EthereumTxRequest",{data_chunk:n});return this.processTxRequest(a.message,s,r)})),this.evmSignTx=(e,t)=>U(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:u,txType:d}=t,l=null==a?0:a.length/2,[c,h]=ar(a,2048);let f={address_n:e,nonce:It(o),gas_price:It(n),gas_limit:It(s),to:r,value:It(i),chain_id:u};0!==l&&(f=Object.assign(Object.assign({},f),{data_length:l,data_initial_chunk:c})),null!==d&&(f=Object.assign(Object.assign({},f),{tx_type:d}));const p=yield this.device.commands.typedCall("EthereumSignTx","EthereumTxRequest",f);return this.processTxRequest(p.message,h,u)})),this.evmSignTxEip1559=(e,t)=>U(this,void 0,void 0,(function*(){const{to:r,value:i,gasLimit:n,nonce:s,data:o,chainId:a,maxFeePerGas:u,maxPriorityFeePerGas:d,accessList:l}=t,c=null==o?0:o.length/2,[h,f]=ar(o,2048),p={address_n:e,nonce:It(s),max_gas_fee:It(u),max_priority_fee:It(d),gas_limit:It(n),to:r,value:It(i),data_length:c,data_initial_chunk:h,chain_id:a,access_list:(l||[]).map((e=>({address:e.address,storage_keys:e.storageKeys})))},y=yield this.device.commands.typedCall("EthereumSignTxEIP1559","EthereumTxRequest",p);return this.processTxRequest(y.message,f)}))}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload;this.addressN=Z(e,3);const r=t;this.isEIP1559=!!r.maxFeePerGas&&!!r.maxPriorityFeePerGas;const i=[{name:"to",type:"hexString",required:!0},{name:"value",type:"hexString",required:!0},{name:"gasLimit",type:"hexString",required:!0},{name:"nonce",type:"hexString",required:!0},{name:"chainId",type:"number",required:!0},{name:"data",type:"hexString"}];this.isEIP1559?(i.push({name:"maxFeePerGas",type:"hexString",required:!0}),i.push({name:"maxPriorityFeePerGas",type:"hexString",required:!0})):(i.push({name:"gasPrice",type:"hexString",required:!0}),i.push({name:"txType",type:"number"})),qt(r,i),this.formattedTx=Ct(r)}getVersionRange(){return this.isEIP1559?{model_mini:{min:"2.1.11"}}:{model_mini:{min:"1.0.0"}}}run(){return U(this,void 0,void 0,(function*(){const{addressN:e,isEIP1559:t,formattedTx:r}=this,n=yield t?this.evmSignTxEip1559(e,r):this.evmSignTx(e,r);return i.resolve(n)}))}},evmSignTypedData:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"metamaskV4Compat",type:"boolean"},{name:"data",type:"object"},{name:"domainHash",type:"hexString"},{name:"messageHash",type:"hexString"},{name:"chainId",type:"number"}]);const{path:e,data:t,metamaskV4Compat:r,domainHash:i,messageHash:n,chainId:s}=this.payload,a=Z(e,3);if(this.params={addressN:a,metamaskV4Compat:r,data:t,chainId:s},i)if(this.params.domainHash=Ct(i),n)this.params.messageHash=Ct(n);else if(t&&(!t.primaryType||"EIP712Domain"!==t.primaryType))throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"message_hash should only be empty when data.primaryType=EIP712Domain")}signTypedData(){return U(this,void 0,void 0,(function*(){const{commands:e}=this.device,{addressN:t,data:r,metamaskV4Compat:i,chainId:n}=this.params,{types:s,primaryType:a,domain:u,message:d}=r;let l=yield e.typedCall("EthereumSignTypedData",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{address_n:t,primary_type:a,metamask_v4_compat:i,chain_id:n});for(;"EthereumTypedDataStructRequest"===l.type;){const{name:t}=l.message,r=s[t];if(void 0===r)throw o.ERRORS.TypedError("Runtime",`Type ${t} was not defined in types object`);const i={members:r.map((({name:e,type:t})=>({name:e,type:pr(t,s)})))};l=yield e.typedCall("EthereumTypedDataStructAck",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],i)}for(;"EthereumTypedDataValueRequest"===l.type;){const{member_path:t}=l.message;let r,i;const[n,...c]=t;switch(n){case 0:r=u,i="EIP712Domain";break;case 1:r=d,i=a;break;default:throw o.ERRORS.TypedError("Runtime","Root index can only be 0 or 1")}for(const e of c)if(Array.isArray(r))i=cr(i).entryTypeName,r=r[e];else if("object"==typeof r&&null!==r){const t=s[i][e];i=t.type,r=r[t.name]}let h;h=Array.isArray(r)?hr("uint16",r.length):hr(i,r),l=yield e.typedCall("EthereumTypedDataValueAck",["EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{value:h})}if("EthereumTypedDataSignature"!==l.type)throw o.ERRORS.TypedError("Runtime","Unexpected response type");const{address:c,signature:h}=l.message;return{address:c,signature:h}}))}getVersionRange(){return{model_mini:{min:"2.1.9"}}}hasNestedArrays(e){if(!e)return!1;if(Array.isArray(e))for(const t of e){if(Array.isArray(t))return!0;if("object"==typeof t&&null!==t&&this.hasNestedArrays(t))return!0}else if("object"==typeof e&&null!==e)for(const t in e)if(this.hasNestedArrays(e[t]))return!0;return!1}supportSignTyped(){const e=J(this.device.features);if("classic"===e||"mini"===e){const e=te(this.device.features).join("."),t="2.2.0";if(_.default.lt(e,t))return!1}return!0}run(){return U(this,void 0,void 0,(function*(){if(!this.device.features)throw o.ERRORS.TypedError("Device_InitializeFailed","Device initialization failed. Please try again.");const{addressN:e,chainId:t}=this.params,r=J(this.device.features);if("classic"===r||"mini"===r){qt(this.params,[{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{domainHash:r,messageHash:n}=this.params;let s;return s=this.supportSignTyped()?yield this.device.commands.typedCall("EthereumSignTypedHash","EthereumTypedDataSignature",{address_n:e,domain_separator_hash:null!=r?r:"",message_hash:n,chain_id:t}):yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",{address_n:e,domain_hash:null!=r?r:"",message_hash:null!=n?n:""}),i.resolve(s.message)}const n=te(this.device.features).join(".");if(this.hasNestedArrays(this.params.data)){const r="4.2.0";if(_.default.gte(n,r)){qt(this.params,[{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{domainHash:r,messageHash:n}=this.params,s=yield this.device.commands.typedCall("EthereumSignTypedHash","EthereumTypedDataSignature",{address_n:e,domain_separator_hash:null!=r?r:"",message_hash:n,chain_id:t});return i.resolve(s.message)}throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodNeedUpgradeFirmware,`Device firmware version is too low, please update to ${r}`,{current:n,require:r})}return this.signTypedData()}))}},evmVerifyMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"address",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0},{name:"chainId",type:"number"}]);const{address:e,messageHex:t,signature:r}=Ct(this.payload);this.params={address:e,message:t,signature:r,chain_id:this.payload.chainId}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumVerifyMessage","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},starcoinGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StarcoinGetAddress","StarcoinAddress",Object.assign({},r)),n=Y(r.address_n);e.push(Object.assign({path:n},i.message)),this.postPreviousAddressMessage({path:n,address:i.message.address})}return i.resolve(this.hasBundle?e:e[0])}))}},starcoinGetPublicKey:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StarcoinGetPublicKey","StarcoinPublicKey",Object.assign({},r));e.push(Object.assign({path:Y(r.address_n)},i.message))}return i.resolve(this.hasBundle?e:e[0])}))}},starcoinSignMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=Z(e,3);this.params={address_n:r,message:Ct(t)}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignMessage","StarcoinMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},starcoinSignTransaction:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=Z(e,3);this.params={address_n:r,raw_tx:Ct(t)}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignTx","StarcoinSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},starcoinVerifyMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"publicKey",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0}]);const{publicKey:e,messageHex:t,signature:r}=Ct(this.payload);this.params={public_key:e,message:t,signature:r}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinVerifyMessage","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},nemGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"network",type:"number"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,network:e.network||104,show_display:i})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("NEMGetAddress","NEMAddress",Object.assign({},r)),n=Y(r.address_n);e.push(Object.assign({path:n},i.message)),this.postPreviousAddressMessage({path:n,address:i.message.address})}return i.resolve(this.hasBundle?e:e[0])}))}},nemSignTransaction:class extends At{constructor(){super(...arguments),this.NEM_MOSAIC_LEVY_TYPES={1:"MosaicLevy_Absolute",2:"MosaicLevy_Percentile"},this.NEM_SUPPLY_CHANGE_TYPES={1:"SupplyChange_Increase",2:"SupplyChange_Decrease"},this.NEM_AGGREGATE_MODIFICATION_TYPES={1:"CosignatoryModification_Add",2:"CosignatoryModification_Delete"},this.NEM_IMPORTANCE_TRANSFER_MODES={1:"ImportanceTransfer_Activate",2:"ImportanceTransfer_Deactivate"},this.getCommon=(e,t)=>{var r;return{address_n:t,network:e.version>>24&255,timestamp:e.timeStamp,fee:e.fee,deadline:null!==(r=e.deadline)&&void 0!==r?r:0,signer:t?void 0:e.signer}},this.transferMessage=e=>{const t=e.mosaics?e.mosaics.map((e=>({namespace:e.mosaicId.namespaceId,mosaic:e.mosaicId.name,quantity:e.quantity}))):void 0;return{recipient:e.recipient,amount:e.amount,payload:e.message?e.message.payload:void 0,public_key:e.message&&2===e.message.type?e.message.publicKey:void 0,mosaics:t}},this.importanceTransferMessage=e=>({mode:this.NEM_IMPORTANCE_TRANSFER_MODES[e.importanceTransfer.mode],public_key:e.importanceTransfer.publicKey}),this.aggregateModificationMessage=e=>({modifications:e.modifications?e.modifications.map((e=>({type:this.NEM_AGGREGATE_MODIFICATION_TYPES[e.modificationType],public_key:e.cosignatoryAccount}))):void 0,relative_change:e.minCosignatories.relativeChange}),this.provisionNamespaceMessage=e=>{var t,r,i;return{namespace:null!==(t=e.newPart)&&void 0!==t?t:"",parent:e.parent||void 0,sink:null!==(r=e.rentalFeeSink)&&void 0!==r?r:"",fee:null!==(i=e.rentalFee)&&void 0!==i?i:0}},this.mosaicCreationMessage=e=>{var t,r;const{levy:i}=e.mosaicDefinition,n={namespace:e.mosaicDefinition.id.namespaceId,mosaic:e.mosaicDefinition.id.name,levy:i&&i.type?this.NEM_MOSAIC_LEVY_TYPES[i.type]:void 0,fee:i&&i.fee,levy_address:i&&i.recipient,levy_namespace:i&&i.mosaicId&&i.mosaicId.namespaceId,levy_mosaic:i&&i.mosaicId&&i.mosaicId.name,description:e.mosaicDefinition.description},{properties:s}=e.mosaicDefinition;return Array.isArray(s)&&s.forEach((e=>{const{name:t,value:r}=e;switch(t){case"divisibility":n.divisibility=parseInt(r);break;case"initialSupply":n.supply=parseInt(r);break;case"supplyMutable":n.mutable_supply="true"===r;break;case"transferable":n.transferable="true"===r}})),{definition:n,sink:null!==(t=e.creationFeeSink)&&void 0!==t?t:"",fee:null!==(r=e.creationFee)&&void 0!==r?r:0}},this.supplyChangeMessage=e=>{var t;return{namespace:e.mosaicId.namespaceId,mosaic:e.mosaicId.name,type:this.NEM_SUPPLY_CHANGE_TYPES[e.supplyType],delta:null!==(t=e.delta)&&void 0!==t?t:0}},this.parseTx=(e,t)=>{let r=e;const i={transaction:this.getCommon(e,t),transfer:void 0,importance_transfer:void 0,aggregate_modification:void 0,provision_namespace:void 0,mosaic_creation:void 0,supply_change:void 0};switch(258!==e.type&&4100!==e.type&&4098!==e.type||(i.cosigning=258===e.type||4098===e.type,r=e.otherTrans,i.multisig=this.getCommon(r)),r.type){case 257:i.transfer=this.transferMessage(r);break;case 2049:i.importance_transfer=this.importanceTransferMessage(r);break;case 4097:i.aggregate_modification=this.aggregateModificationMessage(r);break;case 8193:i.provision_namespace=this.provisionNamespaceMessage(r);break;case 16385:i.mosaic_creation=this.mosaicCreationMessage(r);break;case 16386:i.supply_change=this.supplyChangeMessage(r);break;default:throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Unknown transaction type")}return i}}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=Z(e,3);this.params=this.parseTx(t,r)}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NEMSignTx","NEMSignedTx",Object.assign({},this.params));return i.resolve(e)}))}},solGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("SolanaGetAddress","SolanaAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},solSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]),this.params.push({address_n:t,raw_tx:Ct(e.rawTx)})}))}getVersionRange(){return{classic:{min:"2.1.9"},mini:{min:"2.1.9"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("SolanaSignTx","SolanaSignedTx",Object.assign({},r)),{signature:n}=i.message;e.push({path:Y(r.address_n),signature:n})}return i.resolve(this.hasBundle?e:e[0])}))}},stellarGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StellarGetAddress","StellarAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},stellarSignTransaction:class extends At{constructor(){super(...arguments),this.operations=[],this.parseOperation=e=>{switch(e.type){case"createAccount":return qt(e,[{name:"destination",type:"string",required:!0},{name:"startingBalance",type:"bigNumber",required:!0}]),{type:"StellarCreateAccountOp",source_account:e.source,new_account:e.destination,starting_balance:e.startingBalance};case"payment":return qt(e,[{name:"destination",type:"string",required:!0},{name:"amount",type:"bigNumber",required:!0},{name:"asset",required:!0}]),{type:"StellarPaymentOp",source_account:e.source,destination_account:e.destination,asset:e.asset,amount:e.amount};case"pathPayment":return qt(e,[{name:"destAmount",type:"bigNumber",required:!0}]),{type:"StellarPathPaymentOp",source_account:e.source,send_asset:e.sendAsset,send_max:e.sendMax,destination_account:e.destination,destination_asset:e.destAsset,destination_amount:e.destAmount,paths:e.path};case"createPassiveOffer":return qt(e,[{name:"amount",type:"bigNumber",required:!0}]),{type:"StellarCreatePassiveOfferOp",source_account:e.source,buying_asset:e.buying,selling_asset:e.selling,amount:e.amount,price_n:e.price.n,price_d:e.price.d};case"manageOffer":return qt(e,[{name:"amount",type:"bigNumber",required:!0}]),{type:"StellarManageOfferOp",source_account:e.source,buying_asset:e.buying,selling_asset:e.selling,amount:e.amount,offer_id:e.offerId,price_n:e.price.n,price_d:e.price.d};case"setOptions":{const t=e.signer?{signer_type:e.signer.type,signer_key:e.signer.key,signer_weight:e.signer.weight}:void 0;return Object.assign({type:"StellarSetOptionsOp",source_account:e.source,clear_flags:e.clearFlags,set_flags:e.setFlags,master_weight:e.masterWeight,low_threshold:e.lowThreshold,medium_threshold:e.medThreshold,high_threshold:e.highThreshold,home_domain:e.homeDomain,inflation_destination_account:e.inflationDest},t)}case"changeTrust":return qt(e,[{name:"limit",type:"bigNumber"}]),{type:"StellarChangeTrustOp",source_account:e.source,asset:e.line,limit:e.limit};case"allowTrust":return{type:"StellarAllowTrustOp",source_account:e.source,trusted_account:e.trustor,asset_type:e.assetType,asset_code:e.assetCode,is_authorized:e.authorize?1:0};case"accountMerge":return{type:"StellarAccountMergeOp",source_account:e.source,destination_account:e.destination};case"manageData":return{type:"StellarManageDataOp",source_account:e.source,key:e.name,value:e.value};case"bumpSequence":return{type:"StellarBumpSequenceOp",source_account:e.source,bump_to:e.bumpTo};default:return{}}},this.processTxRequest=(e,t)=>U(this,void 0,void 0,(function*(){const r=t+1>=e.length,i=e[t],{type:n}=i,s=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(i,["type"]);return r?(yield this.device.commands.typedCall(n,"StellarSignedTx",s)).message:(yield this.device.commands.typedCall(n,"StellarTxOpRequest",s),this.processTxRequest(e,t+1))}))}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"networkPassphrase",type:"string",required:!0},{name:"transaction",type:"object",required:!0}]);const{transaction:e,networkPassphrase:t}=this.payload;if(!e.timebounds)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"timebounds is required");const r=Z(this.payload.path,3);this.params={address_n:r,network_passphrase:t,source_account:e.source,fee:e.fee,sequence_number:e.sequence,num_operations:e.operations.length,memo_type:h.StellarMemoType.NONE,timebounds_start:e.timebounds.minTime,timebounds_end:e.timebounds.maxTime},e.memo&&(this.params.memo_type=e.memo.type,this.params.memo_text=e.memo.text,this.params.memo_id=e.memo.id,this.params.memo_hash=e.memo.hash),e.operations.forEach((e=>{const t=this.parseOperation(e);t&&this.operations.push(t)})),console.log("StellarSignTransactionParams",this.params),console.log("StellarSignTransactionOperations",this.operations)}run(){return U(this,void 0,void 0,(function*(){return yield this.device.commands.typedCall("StellarSignTx","StellarTxOpRequest",Object.assign({},this.params)),this.processTxRequest(this.operations,0)}))}},tronGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("TronGetAddress","TronAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},tronSignMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=Z(e,3);this.params={address_n:r,message:Ot(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignMessage","TronMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},tronSignTransaction:class extends At{parseTx(e,t){const r={address_n:t,data:e.data,timestamp:e.timestamp,fee_limit:e.feeLimit,ref_block_bytes:e.refBlockBytes,ref_block_hash:e.refBlockHash,expiration:e.expiration,contract:{}};return e.contract&&(e.contract.transferContract&&(r.contract={transfer_contract:{to_address:e.contract.transferContract.toAddress,amount:e.contract.transferContract.amount}}),e.contract.triggerSmartContract&&(r.contract={trigger_smart_contract:{contract_address:e.contract.triggerSmartContract.contractAddress,call_value:e.contract.triggerSmartContract.callValue,data:e.contract.triggerSmartContract.data,call_token_value:e.contract.triggerSmartContract.callTokenValue,asset_id:e.contract.triggerSmartContract.assetId}}),e.contract.freezeBalanceV2Contract&&(r.contract={freeze_balance_v2_contract:{frozen_balance:e.contract.freezeBalanceV2Contract.frozenBalance,resource:e.contract.freezeBalanceV2Contract.resource}}),e.contract.unfreezeBalanceV2Contract&&(r.contract={unfreeze_balance_v2_contract:{unfreeze_balance:e.contract.unfreezeBalanceV2Contract.unfreezeBalance,resource:e.contract.unfreezeBalanceV2Contract.resource}}),e.contract.delegateResourceContract&&(r.contract={delegate_resource_contract:{resource:e.contract.delegateResourceContract.resource,balance:e.contract.delegateResourceContract.balance,receiver_address:e.contract.delegateResourceContract.receiverAddress,lock:e.contract.delegateResourceContract.lock}}),e.contract.unDelegateResourceContract&&(r.contract={undelegate_resource_contract:{resource:e.contract.unDelegateResourceContract.resource,balance:e.contract.unDelegateResourceContract.balance,receiver_address:e.contract.unDelegateResourceContract.receiverAddress}}),e.contract.withdrawExpireUnfreezeContract&&(r.contract={withdraw_expire_unfreeze_contract:{}}),e.contract.withdrawBalanceContract&&(r.contract={withdraw_balance_contract:{owner_address:e.contract.withdrawBalanceContract.ownerAddress}})),r}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=Z(e,3);qt(t,[{name:"refBlockBytes",type:"hexString",required:!0},{name:"refBlockHash",type:"hexString",required:!0},{name:"expiration",type:"number",required:!0},{name:"timestamp",type:"number",required:!0},{name:"contract",type:"object",required:!0}]),this.params=this.parseTx(Ct(t),r)}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignTx","TronSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},nearGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("NearGetAddress","NearAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},nearSignTransaction:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=Z(e,3);this.params={address_n:r,raw_tx:Ct(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NearSignTx","NearSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},aptosGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1,this.shouldConfirm=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};this.shouldConfirm=!!this.hasBundle&&this.payload.bundle.some((e=>!!e.showOnOneKey)),qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}publicKeyToAddress(e){const t=y.sha3_256.create();return t.update(Dt(e)),t.update("\0"),`0x${l.bytesToHex(t.digest())}`}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){var e;return U(this,void 0,void 0,(function*(){if(this.hasBundle&&oe(null===(e=this.device)||void 0===e?void 0:e.features)&&!this.shouldConfirm){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e,address:this.publicKeyToAddress(e)})));return i.resolve(e)}const t=[];for(let e=0;e<this.params.length;e++){const r=this.params[e],i=yield this.device.commands.typedCall("AptosGetAddress","AptosAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:null==n?void 0:n.toLowerCase()};t.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?t:t[0])}))}},aptosGetPublicKey:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e})));return i.resolve(this.hasBundle?e:e[0])}))}},aptosSignTransaction:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=Z(e,3);this.params={address_n:r,raw_tx:Ct(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AptosSignTx","AptosSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},aptosSignMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"payload",type:"object",required:!0}]);const{path:e,payload:t}=this.payload,r=Z(e,3);qt(t,[{name:"address",type:"string"},{name:"chainId",type:"string"},{name:"application",type:"string"},{name:"nonce",type:"string",required:!0},{name:"message",type:"string",required:!0}]),this.params={address_n:r,payload:{address:t.address,chain_id:t.chainId,application:t.application,nonce:t.nonce,message:t.message}}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return U(this,void 0,void 0,(function*(){let e="APTOS\n";this.params.payload.address&&(e+=`address: ${this.params.payload.address}\n`),this.params.payload.application&&(e+=`application: ${this.params.payload.application}\n`),this.params.payload.chain_id&&(e+=`chainId: ${this.params.payload.chain_id}\n`),e+=`message: ${this.params.payload.message}\n`,e+=`nonce: ${this.params.payload.nonce}`;const t=yield this.device.commands.typedCall("AptosSignMessage","AptosMessageSignature",Object.assign({},this.params)),{address:r,signature:n}=t.message;return i.resolve({path:Y(this.params.address_n),address:r,signature:n,fullMessage:e})}))}},algoGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("AlgorandGetAddress","AlgorandAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},algoSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=Z(e,3);this.params={address_n:r,raw_tx:Ct(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AlgorandSignTx","AlgorandSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:Y(this.params.address_n),signature:t}}))}},cosmosGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"hrp",type:"string"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{hrp:n}=e;this.params.push({address_n:r,hrp:n,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.10.0"},model_touch:{min:"4.0.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("CosmosGetAddress","CosmosAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},cosmosGetPublicKey:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};if(qt(t,[{name:"bundle",type:"array"}]),0===t.bundle.length)throw new Error("Bundle is empty");this.params=[],t.bundle.forEach((e=>{var t,r;const i=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"curve",type:"string"},{name:"showOnOneKey",type:"boolean"}]);const n=null===(t=e.showOnOneKey)||void 0===t||t,s=null!==(r=e.curve)&&void 0!==r?r:"secp256k1";if("secp256k1"!==s)throw new Error("Curve name is not supported");this.params.push({address_n:i,curve:s,show_display:n})}))}getVersionRange(){return{model_mini:{min:"2.10.0"},model_touch:{min:"4.0.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:this.params[0].curve})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e})));return i.resolve(this.hasBundle?e:e[0])}))}},cosmosSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=Z(e,3);this.params={address_n:r,raw_tx:Ct(t)}}getVersionRange(){return{model_mini:{min:"2.10.0"},model_touch:{min:"4.0.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("CosmosSignTx","CosmosSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:Y(this.params.address_n),signature:t}}))}},xrpGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1,this.shouldConfirm=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};this.shouldConfirm=!!this.hasBundle&&this.payload.bundle.some((e=>!!e.showOnOneKey)),qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.9.0"}}}run(){var e,t,r;return U(this,void 0,void 0,(function*(){if(this.hasBundle&&oe(null===(e=this.device)||void 0===e?void 0:e.features)&&!this.shouldConfirm){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"secp256k1"})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e,address:g.deriveAddress(e)})));return i.resolve(e)}const n=[];for(let e=0;e<this.params.length;e++){const i=this.params[e],s=yield this.device.commands.typedCall("RippleGetAddress","RippleAddress",Object.assign({},i)),o=yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:[{address_n:i.address_n}],ecdsa_curve_name:"secp256k1"}),{address:a}=s.message,u=Y(i.address_n);n.push({path:u,address:a,publicKey:null===(r=null===(t=o.message)||void 0===t?void 0:t.public_keys)||void 0===r?void 0:r[0]}),this.postPreviousAddressMessage({path:u,address:a})}return i.resolve(this.hasBundle?n:n[0])}))}},xrpSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt];const{payload:e}=this;qt(e,[{name:"path",required:!0},{name:"transaction",required:!0}]);const t=Z(e.path,5),{transaction:r}=e;qt(r,[{name:"fee",type:"string"},{name:"flags",type:"number"},{name:"sequence",type:"number"},{name:"maxLedgerVersion",type:"number"},{name:"payment",type:"object"}]),qt(r.payment,[{name:"amount",type:"number",required:!0},{name:"destination",type:"string",required:!0},{name:"destinationTag",type:"number"}]),this.params={address_n:t,fee:r.fee,flags:r.flags,sequence:r.sequence,last_ledger_sequence:r.maxLedgerVersion,payment:{amount:r.payment.amount,destination:r.payment.destination,destination_tag:r.payment.destinationTag}}}getVersionRange(){return{model_mini:{min:"2.9.0"}}}run(){return U(this,void 0,void 0,(function*(){const{message:e}=yield this.device.commands.typedCall("RippleSignTx","RippleSignedTx",this.params);return{serializedTx:e.serialized_tx,signature:e.signature}}))}},suiGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1,this.shouldConfirm=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};this.shouldConfirm=!!this.hasBundle&&this.payload.bundle.some((e=>!!e.showOnOneKey)),qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}run(){var e;return U(this,void 0,void 0,(function*(){if(this.hasBundle&&oe(null===(e=this.device)||void 0===e?void 0:e.features)&&!this.shouldConfirm){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e,address:yr(e)})));return i.resolve(e)}const t=[];for(let e=0;e<this.params.length;e++){const r=this.params[e],i=yield this.device.commands.typedCall("SuiGetAddress","SuiAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:null==n?void 0:n.toLowerCase()};t.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?t:t[0])}))}},suiGetPublicKey:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:Y(this.params[t].address_n),publicKey:e})));return i.resolve(this.hasBundle?e:e[0])}))}},suiSignTransaction:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=Z(e,3);this.params={address_n:r,raw_tx:Ct(t)}}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("SuiSignTx","SuiSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},cardanoGetAddress:class extends At{init(){var e,t,r;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle),this.isCheck=this.hasBundle?!!(null===(t=this.payload)||void 0===t?void 0:t.bundle.every((e=>!!e.isCheck))):!!(null===(r=this.payload)||void 0===r?void 0:r.isCheck);const i=this.hasBundle?this.payload:{bundle:[this.payload]};this.params=i.bundle.map((e=>(qt(e,[{name:"addressParameters",type:"object",required:!0},{name:"networkId",type:"number",required:!0},{name:"protocolMagic",type:"number",required:!0},{name:"derivationType",type:"number"},{name:"address",type:"string"},{name:"showOnOneKey",type:"boolean"}]),gr(e.addressParameters),{address_parameters:mr(e.addressParameters),address:e.address,protocol_magic:e.protocolMagic,network_id:e.networkId,derivation_type:void 0!==e.derivationType?e.derivationType:h.Messages.CardanoDerivationType.ICARUS,show_display:"boolean"!=typeof e.showOnOneKey||!!e.showOnOneKey})))}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.1.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(const t of this.params){const{address_parameters:r,protocol_magic:i,network_id:n,derivation_type:s,show_display:o}=t,a=yield this.device.commands.typedCall("CardanoGetAddress","CardanoAddress",{address_parameters:r,protocol_magic:i,network_id:n,derivation_type:s,show_display:o});let u,d;r.address_type!==h.Messages.CardanoAddressType.BASE||this.isCheck||(u=(yield this.device.commands.typedCall("CardanoGetPublicKey","CardanoPublicKey",{address_n:r.address_n.slice(0,3),derivation_type:s,show_display:!1})).message.xpub,d=(yield this.device.commands.typedCall("CardanoGetAddress","CardanoAddress",{address_parameters:{address_type:h.Messages.CardanoAddressType.REWARD,address_n:[],address_n_staking:r.address_n_staking},protocol_magic:i,network_id:n,derivation_type:s,show_display:!1})).message.address);const l=Y(t.address_parameters.address_n);e.push({addressParameters:vr(t.address_parameters),protocolMagic:t.protocol_magic,networkId:t.network_id,serializedPath:l,serializedStakingPath:Y(t.address_parameters.address_n_staking),address:a.message.address,xpub:u,stakeAddress:d}),this.postPreviousAddressMessage({path:l,address:a.message.address})}return this.hasBundle?e:e[0]}))}},cardanoGetPublicKey:class extends At{init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=t.bundle.map((e=>(qt(e,[{name:"path",required:!0},{name:"derivationType",type:"number"},{name:"showOnOneKey",type:"boolean"}]),{address_n:Z(e.path,3),derivation_type:void 0!==e.derivationType?e.derivationType:h.Messages.CardanoDerivationType.ICARUS,show_display:"boolean"==typeof e.showOnOneKey&&e.showOnOneKey})))}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.1.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[],t=this.device.getCommands();for(let r=0;r<this.params.length;r++){const i=this.params[r],{message:n}=yield t.typedCall("CardanoGetPublicKey","CardanoPublicKey",i);e.push({path:i.address_n,serializedPath:Y(i.address_n),publicKey:n.xpub,node:n.node})}return this.hasBundle?e:e[0]}))}},cardanoSignTransaction:class extends At{getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.1.0"}}}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const{payload:t}=this;qt(t,[{name:"signingMode",type:"number",required:!0},{name:"inputs",type:"array",required:!0},{name:"outputs",type:"array",required:!0,allowEmpty:!0},{name:"fee",type:"uint",required:!0},{name:"ttl",type:"uint"},{name:"certificates",type:"array",allowEmpty:!0},{name:"withdrawals",type:"array",allowEmpty:!0},{name:"mint",type:"array",allowEmpty:!0},{name:"validityIntervalStart",type:"uint"},{name:"scriptDataHash",type:"string"},{name:"collateralInputs",type:"array",allowEmpty:!0},{name:"requiredSigners",type:"array",allowEmpty:!0},{name:"totalCollateral",type:"uint"},{name:"referenceInputs",type:"array",allowEmpty:!0},{name:"protocolMagic",type:"number",required:!0},{name:"networkId",type:"number",required:!0},{name:"additionalWitnessRequests",type:"array",allowEmpty:!0},{name:"derivationType",type:"number"},{name:"includeNetworkId",type:"boolean"}]);const r=t.inputs.map(br),i=t.outputs.map(Mr);let n=[];t.certificates&&(n=t.certificates.map(kr));let s=[];t.withdrawals&&(s=t.withdrawals.map((e=>(qt(e,[{name:"amount",type:"uint",required:!0},{name:"scriptHash",type:"string"},{name:"keyHash",type:"string"}]),{path:e.path?Z(e.path,5):void 0,amount:e.amount,script_hash:e.scriptHash,key_hash:e.keyHash}))));let a,u=[];t.mint&&(u=Er(t.mint)),t.auxiliaryData&&(a=(e=>{let t;return qt(e,[{name:"hash",type:"string"}]),e.governanceRegistrationParameters&&(t=(e=>{qt(e,[{name:"votingPublicKey",type:"string"},{name:"stakingPath",required:!0},{name:"nonce",type:"uint",required:!0},{name:"format",type:"number"},{name:"delegations",type:"array",allowEmpty:!0},{name:"votingPurpose",type:"uint"}]),gr(e.rewardAddressParameters);const{delegations:t}=e;if(t&&t.length>32)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"At most 32 delegations are allowed in a governance registration");return{voting_public_key:e.votingPublicKey,staking_path:Z(e.stakingPath,3),reward_address_parameters:mr(e.rewardAddressParameters),nonce:e.nonce,format:e.format,delegations:null==t?void 0:t.map(Or),voting_purpose:e.votingPurpose}})(e.governanceRegistrationParameters)),{hash:e.hash,governance_registration_parameters:t}})(t.auxiliaryData));let d=[];t.additionalWitnessRequests&&(d=t.additionalWitnessRequests.map((e=>Z(e,3))));let l=[];t.collateralInputs&&(l=t.collateralInputs.map(_r));let c=[];t.requiredSigners&&(c=t.requiredSigners.map((e=>(qt(e,[{name:"keyHash",type:"string"}]),{key_path:e.keyPath?Z(e.keyPath,3):void 0,key_hash:e.keyHash}))));const f=t.collateralReturn?Mr(t.collateralReturn):void 0;let p=[];t.referenceInputs&&(p=t.referenceInputs.map(wr)),this.params={signingMode:t.signingMode,inputsWithPath:r,outputsWithData:i,fee:t.fee,ttl:t.ttl,certificatesWithPoolOwnersAndRelays:n,withdrawals:s,mint:u,auxiliaryData:a,validityIntervalStart:t.validityIntervalStart,scriptDataHash:t.scriptDataHash,collateralInputsWithPath:l,requiredSigners:c,collateralReturnWithData:f,totalCollateral:t.totalCollateral,referenceInputs:p,protocolMagic:t.protocolMagic,networkId:t.networkId,witnessPaths:Ir(r,n,s,l,c,d,t.signingMode),additionalWitnessRequests:d,derivationType:void 0!==t.derivationType?t.derivationType:h.Messages.CardanoDerivationType.ICARUS,includeNetworkId:t.includeNetworkId}}signTx(){return U(this,void 0,void 0,(function*(){const e=this.device.getCommands().typedCall.bind(this.device.getCommands()),t=!!this.params.auxiliaryData,r={signing_mode:this.params.signingMode,protocol_magic:this.params.protocolMagic,network_id:this.params.networkId,inputs_count:this.params.inputsWithPath.length,outputs_count:this.params.outputsWithData.length,fee:this.params.fee,ttl:this.params.ttl,certificates_count:this.params.certificatesWithPoolOwnersAndRelays.length,withdrawals_count:this.params.withdrawals.length,has_auxiliary_data:t,validity_interval_start:this.params.validityIntervalStart,witness_requests_count:this.params.witnessPaths.length,minting_asset_groups_count:this.params.mint.length,script_data_hash:this.params.scriptDataHash,collateral_inputs_count:this.params.collateralInputsWithPath.length,required_signers_count:this.params.requiredSigners.length,has_collateral_return:null!=this.params.collateralReturnWithData,total_collateral:this.params.totalCollateral,reference_inputs_count:this.params.referenceInputs.length,derivation_type:this.params.derivationType,include_network_id:this.params.includeNetworkId};yield e("CardanoSignTxInit","CardanoTxItemAck",r);for(const{input:t}of this.params.inputsWithPath)yield e("CardanoTxInput","CardanoTxItemAck",t);for(const t of this.params.outputsWithData)yield Rr(e,t);for(const{certificate:t,poolOwners:r,poolRelays:i}of this.params.certificatesWithPoolOwnersAndRelays){yield e("CardanoTxCertificate","CardanoTxItemAck",t);for(const t of r)yield e("CardanoPoolOwner","CardanoTxItemAck",t);for(const t of i)yield e("CardanoPoolRelayParameters","CardanoTxItemAck",t)}for(const t of this.params.withdrawals)yield e("CardanoTxWithdrawal","CardanoTxItemAck",t);let i;if(this.params.auxiliaryData){const{catalyst_registration_parameters:t}=this.params.auxiliaryData;t&&(this.params.auxiliaryData=(e=>{const{governance_registration_parameters:t}=e;return t?(t.reward_address_parameters=(e=>{if(e.address_type===h.Messages.CardanoAddressType.REWARD){let{address_n:t,address_n_staking:r}=e;if(t.length>0&&r.length>0)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Only stakingPath is allowed for CardanoAddressType.REWARD");return t.length>0&&(r=t,t=[]),Object.assign(Object.assign({},e),{address_n:t,address_n_staking:r})}return e})(t.reward_address_parameters),Object.assign(Object.assign({},e),{governance_registration_parameters:t})):e})(this.params.auxiliaryData));const{message:r}=yield e("CardanoTxAuxiliaryData","CardanoTxAuxiliaryDataSupplement",this.params.auxiliaryData),n=h.Messages.CardanoTxAuxiliaryDataSupplementType[r.type];n!==h.Messages.CardanoTxAuxiliaryDataSupplementType.NONE&&(i={type:n,auxiliaryDataHash:r.auxiliary_data_hash,governanceSignature:r.governance_signature,catalystSignature:r.governance_signature}),yield e("CardanoTxHostAck","CardanoTxItemAck")}if(this.params.mint.length>0){yield e("CardanoTxMint","CardanoTxItemAck",{asset_groups_count:this.params.mint.length});for(const t of this.params.mint){yield e("CardanoAssetGroup","CardanoTxItemAck",{policy_id:t.policyId,tokens_count:t.tokens.length});for(const r of t.tokens)yield e("CardanoToken","CardanoTxItemAck",r)}}for(const{collateralInput:t}of this.params.collateralInputsWithPath)yield e("CardanoTxCollateralInput","CardanoTxItemAck",t);for(const t of this.params.requiredSigners)yield e("CardanoTxRequiredSigner","CardanoTxItemAck",t);this.params.collateralReturnWithData&&(yield Rr(e,this.params.collateralReturnWithData));for(const t of this.params.referenceInputs)yield e("CardanoTxReferenceInput","CardanoTxItemAck",t);const n=[];for(const t of this.params.witnessPaths){const{message:r}=yield e("CardanoTxWitnessRequest","CardanoTxWitnessResponse",{path:t});n.push({type:h.Messages.CardanoTxWitnessType[r.type],pubKey:r.pub_key,signature:r.signature,chainCode:r.chain_code})}const{message:s}=yield e("CardanoTxHostAck","CardanoTxBodyHash");return yield e("CardanoTxHostAck","CardanoSignTxFinished"),{hash:s.tx_hash,witnesses:n,auxiliaryDataSupplement:i}}))}run(){return this.signTx()}},cardanoSignMessage:class extends At{init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt];const{payload:e}=this;qt(e,[{name:"path",type:"string",required:!0},{name:"message",type:"string",required:!0},{name:"derivationType",type:"number"},{name:"networkId",type:"number",required:!0}]);const t=Z(e.path,3);this.params={address_n:t,message:e.message,derivation_type:void 0!==e.derivationType?e.derivationType:h.Messages.CardanoDerivationType.ICARUS,network_id:e.networkId}}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.1.0"}}}run(){return U(this,void 0,void 0,(function*(){return(yield this.device.commands.typedCall("CardanoSignMessage","CardanoMessageSignature",this.params)).message}))}},filecoinGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"},{name:"isTestnet",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i,testnet:e.isTestnet})}))}getVersionRange(){return{model_mini:{min:"2.10.0"},model_touch:{min:"3.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("FilecoinGetAddress","FilecoinAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},filecoinSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],qt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0},{name:"isTestnet",type:"boolean"}]);const{path:e,rawTx:t,isTestnet:r}=this.payload,i=Z(e,3);this.params={address_n:i,raw_tx:Ct(t),testnet:r}}getVersionRange(){return{model_mini:{min:"2.10.0"},model_touch:{min:"3.5.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("FilecoinSignTx","FilecoinSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:Y(this.params.address_n),signature:t}}))}},polkadotGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"prefix",required:!0},{name:"network",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{prefix:n,network:s}=e;this.params.push({address_n:r,prefix:n,network:s,show_display:i})}))}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("PolkadotGetAddress","PolkadotAddress",Object.assign({},r)),{address:n,public_key:s}=i.message,o=Y(r.address_n);e.push({path:o,address:n,publicKey:null!=s?s:""}),this.postPreviousAddressMessage({path:o,address:n})}return i.resolve(this.hasBundle?e:e[0])}))}},polkadotSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode],qt(this.payload,[{name:"path",required:!0},{name:"network",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t,network:r}=this.payload,i=Z(e,3);this.params={address_n:i,network:r,raw_tx:Ct(t)}}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("PolkadotSignTx","PolkadotSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:Y(this.params.address_n),signature:t}}))}},kaspaGetAddress:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};qt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=Z(e.path,3);qt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"},{name:"prefix",type:"string"},{name:"scheme",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i,prefix:e.prefix,scheme:e.scheme})}))}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}run(){return U(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("KaspaGetAddress","KaspaAddress",Object.assign({},r)),{address:n}=i.message,s={path:Y(r.address_n),address:n};e.push(s),this.postPreviousAddressMessage(s)}return i.resolve(this.hasBundle?e:e[0])}))}},kaspaSignTransaction:class extends At{constructor(){super(...arguments),this.hasBundle=!1}init(){var e,t,r,i,n;this.checkDeviceId=!0,this.notAllowDeviceMode=[...this.notAllowDeviceMode,yt];const s=this.payload;qt(s,[{name:"version",type:"number"},{name:"sigHashType",type:"number",required:!0},{name:"inputs",type:"array",required:!0},{name:"outputs",type:"array",required:!0},{name:"lockTime",required:!0},{name:"sigOpCount",type:"number"},{name:"subNetworkID",type:"string"}]);const o=s.inputs.map((e=>{var t;qt(e,[{name:"path",type:"string",required:!0},{name:"prevTxId",type:"string",required:!0},{name:"outputIndex",type:"number",required:!0},{name:"sequenceNumber",required:!0}]);const r=Z(e.path,3);return Object.assign(Object.assign({},e),{path:r,sigOpCount:null!==(t=e.sigOpCount)&&void 0!==t?t:1})})),a=s.outputs.map((e=>{var t;return qt(e,[{name:"satoshis",required:!0},{name:"script",type:"string",required:!0},{name:"scriptVersion",type:"number"}]),Object.assign(Object.assign({},e),{scriptVersion:null!==(t=e.scriptVersion)&&void 0!==t?t:0})}));this.params=Object.assign(Object.assign({},s),{inputs:o,outputs:a,scheme:null!==(e=s.scheme)&&void 0!==e?e:"schnorr",prefix:null!==(t=s.prefix)&&void 0!==t?t:"kaspa",sigHashType:null!==(r=s.sigHashType)&&void 0!==r?r:Cr.SIGHASH_ALL|Cr.SIGHASH_FORKID,sigOpCount:null!==(i=s.sigOpCount)&&void 0!==i?i:1,subNetworkID:null!==(n=s.subNetworkID)&&void 0!==n?n:l.bytesToHex(jr())})}getVersionRange(){return{model_mini:{min:"3.0.0"},model_touch:{min:"4.3.0"}}}processTxRequest(e,t,r,i){var n;return U(this,void 0,void 0,(function*(){if("KaspaSignedTx"===t.type)return i.push({index:r,signature:t.message.signature}),i;if("KaspaTxInputRequest"===t.type){i.push({index:r,signature:null!==(n=t.message.signature)&&void 0!==n?n:""});const s=t.message.request_index,{raw:o}=Gr(this.params,s),a=this.params.inputs[s],u=yield e("KaspaTxInputAck",["KaspaTxInputRequest","KaspaSignedTx"],{address_n:a.path,raw_message:l.bytesToHex(o)});return this.processTxRequest(e,u,s,i)}return i}))}run(){return U(this,void 0,void 0,(function*(){const{raw:e}=Gr(this.params,0),t=this.params.inputs[0],{device:r,params:i}=this,n=yield r.commands.typedCall("KaspaSignTx",["KaspaTxInputRequest","KaspaSignedTx"],{address_n:t.path,raw_message:l.bytesToHex(e),scheme:i.scheme,prefix:i.prefix,input_count:i.inputs.length});return this.processTxRequest(r.commands.typedCall.bind(r.commands),n,0,[])}))}}});const Wr=Ee(t.d0.DeviceConnector);class Vr{constructor(){this.listenTimestamp=0,this.current=null,this.upcoming=[],this.listening=!1,ct.load(),this.transport=ct.getTransport(),at.setConnector(this)}enumerate(){return U(this,void 0,void 0,(function*(){try{const e=yield this.transport.enumerate();return this.upcoming=e,this._reportDevicesChange(),{descriptors:e}}catch(e){Lt(e)}}))}listen(){return U(this,void 0,void 0,(function*(){const e=null!==this.current,t=this.current||[];let r;this.listening=!0;try{if(Wr.debug("Start listening",t),this.listenTimestamp=(new Date).getTime(),r=e?yield this.transport.listen(t):yield this.transport.enumerate(),!this.listening)return;this.upcoming=r,Wr.debug("Listen result",r),this._reportDevicesChange(),this.listening&&this.listen()}catch(e){const t=(new Date).getTime()-this.listenTimestamp;Wr.debug("Listen error","timestamp",t,typeof e),t>1100?(yield(1e3,null,new i((e=>{setTimeout(e,1e3,null)}))),this.listening&&this.listen()):Wr.warn("Transport error")}}))}stop(){this.listening=!1}acquire(e,t,r){return U(this,void 0,void 0,(function*(){Wr.debug("acquire",e,t);const i=xe.getSettings("env");try{let n;return n="react-native"===i?yield this.transport.acquire({uuid:e,forceCleanRunPromise:r}):yield this.transport.acquire({path:e,previous:null!=t?t:null}),n}catch(e){Wr.debug("acquire error: ",e.message),Lt(e)}}))}release(e,t){return U(this,void 0,void 0,(function*(){try{return yield this.transport.release(e,t)}catch(e){Lt(e)}}))}_reportDevicesChange(){at.reportDeviceChange(this.upcoming)}}const Kr=Ee(t.d0.Core),Yr=e=>{var t;return{initSession:null==e?void 0:e.payload.initSession,passphraseState:null==e?void 0:e.payload.passphraseState,deviceId:null==e?void 0:e.payload.deviceId,deriveCardano:(null==e?void 0:e.name.startsWith("cardano"))||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.deriveCardano)}};let Zr,Xr,Jr,Qr,ei=[];const ti=[],ri=new Map;let ii=1;const ni={};let si={passphraseState:void 0};function oi(e){if(!Xr)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceListNotInitialized);let t;const r=Xr.allDevices();if(e.connectId)t=Xr.getDevice(e.connectId);else if(1===r.length)[t]=r;else if(r.length>1)throw o.ERRORS.TypedError("firmwareUpdateV2"===e.name?o.HardwareErrorCode.FirmwareUpdateLimitOneDevice:o.HardwareErrorCode.SelectDevice);if(!t)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotFound);return t.deviceConnector=Jr,t}function ai(e){if(!e.connectId&&!Xr)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceListNotInitialized);if(!e.connectId)return oi(e);let t;return ri.has(e.connectId)?t=ri.get(e.connectId):(t=_t.fromDescriptor({id:e.connectId}),ri.set(e.connectId,t)),t.deviceConnector=Jr,t}let ui=0;function di(e,t){return U(this,void 0,void 0,(function*(){try{yield t.acquire(),yield t.initialize(Yr(e))}catch(r){if(!(r.errorCode===o.HardwareErrorCode.BleTimeoutError&&ui<=5))throw r;ui+=1,Kr.debug(`Bletooth connect timeout and will retry, retry count: ${ui}`),yield Se(3e3),yield di(e,t)}}))}const li=(e,t)=>U(void 0,void 0,void 0,(function*(){let r=0;const n=e.payload&&e.payload.retryCount||5,s=e.payload&&e.payload.pollIntervalTime||1e3,a=e.payload&&e.payload.timeout||1e4;let u=null;Kr.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${n}, POLL_INTERVAL_TIME=${s} `);const d=(n=s)=>U(void 0,void 0,void 0,(function*(){return new i(((i,s)=>U(void 0,void 0,void 0,(function*(){if(!ni[t])return Kr.debug("EnsureConnected function stop, polling id: ",t),void s(o.ERRORS.TypedError(o.HardwareErrorCode.PollingStop));u&&clearTimeout(u),u=setTimeout((()=>{s(o.ERRORS.TypedError(o.HardwareErrorCode.PollingTimeout))}),a),r+=1,Kr.debug("EnsureConnected function try count: ",r," poll interval time: ",n);try{yield function(e){return U(this,void 0,void 0,(function*(){"react-native"===xe.getSettings("env")&&e.connectId?yield ct.configure():(Xr||(Xr=new wt,yield ct.configure(),Xr.connector=Jr),yield Xr.getDeviceLists(e.connectId,Yr(e)))}))}(e)}catch(e){if(Kr.debug("device list error: ",e),[o.HardwareErrorCode.BridgeNotInstalled,o.HardwareErrorCode.BridgeTimeoutError].includes(e.errorCode))return Xr=void 0,void s(e);e.errorCode===o.HardwareErrorCode.TransportNotConfigured&&(yield ct.configure())}const l=xe.getSettings("env");let c;try{if(c="react-native"===l?ai(e):oi(e),c)return u&&clearTimeout(u),"react-native"===l&&(ui=0,yield di(e,c)),void i(c)}catch(e){if(Kr.debug("device error: ",e),[o.HardwareErrorCode.BlePermissionError,o.HardwareErrorCode.BleLocationError,o.HardwareErrorCode.BleLocationServicesDisabled,o.HardwareErrorCode.BleDeviceNotBonded,o.HardwareErrorCode.BleDeviceBondError,o.HardwareErrorCode.BleCharacteristicNotifyError,o.HardwareErrorCode.BleTimeoutError,o.HardwareErrorCode.BleWriteCharacteristicError,o.HardwareErrorCode.BleAlreadyConnected,o.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(e.errorCode))return void s(e)}return r>5?(u&&clearTimeout(u),Kr.debug("EnsureConnected get to max try count, will return: ",r),void s(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotFound))):setTimeout((()=>i(d(1.5*n))),n)}))))}));return ni[t]=!0,d()})),ci=(e,t)=>{if(e.useDevicePassphraseState){if(!0===(null==t?void 0:t.passphrase_protection)&&(null==e.payload.passphraseState||""===e.payload.passphraseState)&&!e.payload.useEmptyPassphrase)throw at.clearDeviceCache(e.payload.connectId),o.ERRORS.TypedError(o.HardwareErrorCode.DeviceOpenedPassphrase);if(!1===(null==t?void 0:t.passphrase_protection)&&e.payload.passphraseState)throw at.clearDeviceCache(e.payload.connectId),o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotOpenedPassphrase)}},hi=()=>{ei=[],Kr.debug("Cleanup...")},fi=e=>{e.removeAllListeners(),at.emitter.removeAllListeners(Ke)},pi=()=>{Si(ze(De))},yi=e=>{const t="react-native"===xe.getSettings("env")?e:e.toMessageObject();Si(rt(Ke,{device:t}))},gi=e=>{const t="react-native"===xe.getSettings("env")?e:e.toMessageObject();Si(rt(Ye,{device:t}))},mi=(...[e,t,r])=>U(void 0,void 0,void 0,(function*(){Kr.debug("onDevicePinHandler");const i=Ti(We,e);Si(ze(Ie,{device:e.toMessageObject(),type:t}));const n=yield i.promise;r(null,n.payload)})),vi=(...[e,t])=>{Si(rt(Ze,Object.assign(Object.assign({},t),{device:e.toMessageObject()}))),"ButtonRequest_PinEntry"===t.code?Si(ze(Ie,{device:e.toMessageObject(),type:"ButtonRequest_PinEntry"})):Si(ze(Ce,{device:e.toMessageObject()}))},bi=(...[e,t])=>{Si(rt(tt,Object.assign({},t)))},_i=(...[e,t])=>U(void 0,void 0,void 0,(function*(){Kr.debug("onDevicePassphraseHandler");const r=Ti(Ve,e);Si(ze(Pe,{device:e.toMessageObject(),passphraseState:e.passphraseState}));const i=yield r.promise,{value:n,passphraseOnDevice:s,save:o}=i.payload;t({passphrase:n.normalize("NFKD"),passphraseOnDevice:s,cache:o})})),wi=(...[e,t])=>{Kr.debug("onEmptyPassphraseHandler"),t({passphrase:""})},Ei=(...[e])=>{Si(ze(Ne,{device:e.toMessageObject(),passphraseState:e.passphraseState}))},Si=e=>{Zr.emit(ke,e)},Ti=(e,t)=>{const r=o.createDeferred(e,t);return ei.push(r),r};class Ai extends M.exports{handleMessage(e){var t,r,n,s;return U(this,void 0,void 0,(function*(){switch(e.type){case We:case Ve:{const t=(u=e.type,ei.find((e=>e.id===u)));t&&(t.resolve(e),a=t,ei=ei.filter((e=>e!==a)));break}case Be:case qe:case Le:Si(e);break;case He.CALL:{const a=yield(e=>U(void 0,void 0,void 0,(function*(){var t;if(!e.id||!e.payload||e.type!==He.CALL)return i.reject(o.ERRORS.TypedError("on call: message.id or message.payload is missing"));let r,n;try{r=function(e){const{method:t}=e.payload;if("string"!=typeof t)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Method is not set");const r=$r[t];if(r)return new r(e);throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Method ${t} is not set`)}(e),r.connector=Jr,r.postMessage=Si,r.init()}catch(e){return i.reject(e)}if(at.emitter.on(Ke,yi),!r.useDevice)try{const e=yield r.run();return $e(r.responseID,!0,e)}catch(e){return $e(r.responseID,!1,{error:e})}ti.push(r),ti.length>1&&Kr.debug("should cancel the previous method execution: ",ti.map((e=>e.name)));const s=si.passphraseState!==r.payload.passphraseState;let a;si={passphraseState:r.payload.passphraseState},(s||r.payload.initSession)&&(Kr.debug("passphrase state change, clear device cache"),at.clearDeviceCache(r.payload.connectId)),ni[ii]&&(ni[ii]=!1),ii+=1;try{a=yield li(r,ii)}catch(e){return $e(r.responseID,!1,{error:e})}Kr.debug("Call API - setDevice: ",a.mainId),null===(t=r.setDevice)||void 0===t||t.call(r,a),a.on(Xe,mi),a.on(Ze,vi),a.on(Je,e.payload.useEmptyPassphrase?wi:_i),a.on(Qe,Ei),a.on(tt,bi);try{const e=()=>U(void 0,void 0,void 0,(function*(){const e=J(a.features),t=X(a.features),s=r.getVersionRange()[e],u=r.getVersionRange()[t],d=null!=s?s:u;if(a.features){yield xe.checkAndReloadData();const e=xe.getFirmwareStatus(a.features),t=xe.getBLEFirmwareStatus(a.features);if(("required"===e||"required"===t)&&!1===r.skipForceUpdateCheck)throw o.ERRORS.TypedError(o.HardwareErrorCode.NewFirmwareForceUpdate,"Device firmware version is too low, please update to the latest version",{connectId:r.connectId,deviceId:r.deviceId});if(d){const t=te(a.features).join(".");if(_.default.valid(d.min)&&_.default.lt(t,d.min)){if("none"===e||"valid"===e)throw o.ERRORS.TypedError(o.HardwareErrorCode.NewFirmwareUnRelease);return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodNeedUpgradeFirmware,`Device firmware version is too low, please update to ${d.min}`,{current:t,require:d.min}))}if(d.max&&_.default.valid(d.max)&&_.default.gte(t,d.max))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodDeprecated,`Device firmware version is too high, this method has been deprecated in ${d.max}`,{current:t,deprecated:d.max}))}}const l=a.hasUnexpectedMode(r.notAllowDeviceMode,r.requireDeviceMode);if(l)return l===Ue?i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceUnexpectedBootloaderMode)):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceUnexpectedMode,l));if(r.deviceId&&r.checkDeviceId&&!a.checkDeviceId(r.deviceId))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceCheckDeviceIdError));if(r.checkFirmwareRelease(),r.checkDeviceSupportFeature(),Xr&&(yield ct.reconfigure(a.getFirmwareVersion())),ci(r,a.features),a.hasUsePassphrase()&&r.useDevicePassphraseState){const e=(e=>{if(!e)return{support:!1};const t=J(e);if("touch"===t||"pro"===t)return{support:!0};const r=te(e).join(".");return{support:_.default.gte(r,"2.4.0"),require:"2.4.0"}})(a.features);if(!e.support)return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotSupportPassphrase,`Device not support passphrase, please update to ${e.require}`,{require:e.require}));const t=yield a.checkPassphraseState();if(ci(r,a.features),t)return at.clearDeviceCache(r.payload.connectId),i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceCheckPassphraseStateError))}try{yield r.checkSafetyLevelOnTestNet()}catch(e){const t=e instanceof o.HardwareError?e:o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"open safety check failed.");return n=$e(r.responseID,!1,{error:t}),void(null==Qr||Qr.resolve(n))}try{const e=yield r.run();Kr.debug("Call API - Inner Method Run: "),n=$e(r.responseID,!0,e),null==Qr||Qr.resolve(n)}catch(e){Kr.debug("Call API - Inner Method Run Error: ",e),n=$e(r.responseID,!1,{error:e}),null==Qr||Qr.resolve(n)}}));Kr.debug("Call API - Device Run: ",a.mainId);const t=Object.assign({keepSession:r.payload.keepSession},Yr(r)),s=()=>a.run(e,t);Qr=o.createDeferred(s);try{return yield Qr.promise}catch(e){return Kr.debug("Device Run Error: ",e),$e(r.responseID,!1,{error:e})}}catch(e){n=$e(r.responseID,!1,{error:e}),null==Qr||Qr.reject(o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodError,e.message)),Kr.debug("Call API - Run Error: ",e)}finally{n&&r&&r.dispose();const e=r.responseID?ti.findIndex((e=>e.responseID===r.responseID)):-1;e>-1&&(ti.splice(e,1),Kr.debug("Remove the finished method from the queue: ",ti.map((e=>e.name)))),pi(),hi(),fi(a)}})))(e),{success:u,payload:d}=a;return u?a:Object.assign(Object.assign({},a),{payload:Object.assign(Object.assign({},d),{connectId:null!==(r=null===(t=e.payload)||void 0===t?void 0:t.connectId)&&void 0!==r?r:"",deviceId:null!==(s=null===(n=e.payload)||void 0===n?void 0:n.deviceId)&&void 0!==s?s:""})})}case He.CANCEL:(e=>{const t=xe.getSettings("env");try{if(e){let r;r="react-native"===t?ai({connectId:e}):oi({connectId:e}),null==r||r.interruptionFromUser()}}catch(e){Kr.error("Cancel API Error: ",e)}hi(),pi()})(e.payload.connectId)}var a,u;return i.resolve(e)}))}dispose(){}}t.WE=ke,t.hm=xe,t.Bg=He,t.xG=e=>{let t={error:e.message,code:e.code};return e instanceof o.HardwareError&&(t={error:e.message,code:e.errorCode}),{success:!1,payload:t}},t.Tl=(e,t)=>({event:Oe,type:e,payload:t}),t.jl=Ee,t.S0=(e,t)=>U(void 0,void 0,void 0,(function*(){try{try{yield xe.load(e),(e=>{ct.setTransport(e)})(t)}catch(e){Kr.error("DataManager.load error")}return r=xe.getSettings("debug"),Object.keys(me).forEach((e=>{me[e].enabled=!!r})),"react-native"!==xe.getSettings("env")&&(ye=Si),Zr=new Ai,Jr=new Vr,at.emitter.on(Ye,gi),Zr}catch(e){Kr.error("core init",e)}var r})),t._4=(e={})=>{const t=Object.assign({},he);let i;Object.prototype.hasOwnProperty.call(e,"debug")&&(t.debug=e.debug),e.isFrame&&(t.parentOrigin=e.parentOrigin),"string"==typeof e.connectSrc&&(t.connectSrc=e.connectSrc),"undefined"!=typeof window?i=window.ONEKEY_CONNECT_SRC:void 0!==r.g&&(i=r.g.ONEKEY_CONNECT_SRC),"string"==typeof i&&(t.connectSrc=(e=>{if("string"==typeof e)return e.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*onekey\.so\//)||e.match(/^https?:\/\/localhost:[58][0-9]{3}\//),e})(i),t.debug=!0);const n=t.connectSrc||ce;return t.iframeSrc=`${n}iframe.html`,e.transportReconnect&&(t.transportReconnect=e.transportReconnect),e.lazyLoad&&(t.lazyLoad=e.lazyLoad),"string"==typeof e.env?t.env=e.env:t.env=(()=>{if("undefined"!=typeof chrome&&chrome.runtime&&void 0!==chrome.runtime.onConnect)return"webextension";if("undefined"!=typeof navigator){if("string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return"react-native";if(navigator.userAgent.toLowerCase().indexOf(" electron/")>-1)return"electron"}return"web"})(),e.timestamp&&(t.timestamp=e.timestamp),e.preRelease&&(t.preRelease=e.preRelease),t},t.kW=e=>{const{data:t}=e,r={event:t.event,type:t.type,payload:t.payload};return"number"==typeof e.id&&(r.id=e.id),"boolean"==typeof r.success&&(r.success=t.success),r}},426:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(1780),s=r(1464),o=r(9644);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(n),d=a(o);function l(e,t,r,n){return new(r||(r=i))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}function c(e){return"string"==typeof e?"text/plain":"application/json"}function h(e){try{const t=JSON.parse(e);if("object"!=typeof t)throw new Error("Invalid response");return t}catch(t){return e}}function f(e){var t;return l(this,void 0,void 0,(function*(){const r={url:e.url,method:e.method,data:(i=e.body,"string"==typeof i?i:JSON.stringify(i)),withCredentials:!1,headers:{"Content-Type":c(null==e.body?"":e.body)},timeout:null!==(t=e.timeout)&&void 0!==t?t:void 0,transformResponse:e=>e};var i;const n=yield d.default.request(r);if(200==+n.status)return h(n.data);const o=h(n.data);throw"object"==typeof o&&null!=o&&null!=o.error?new s.HardwareError({errorCode:s.HardwareErrorCode.NetworkError,message:o.error}):new s.HardwareError({errorCode:s.HardwareErrorCode.NetworkError,message:n.data})}))}d.default.interceptors.request.use((e=>{var t,r;return"undefined"!=typeof window||(null===(t=e.url)||void 0===t?void 0:t.startsWith("http://localhost:21320"))&&((null===(r=null==e?void 0:e.headers)||void 0===r?void 0:r.Origin)||(console.log("set node request origin"),e.headers=Object.assign(Object.assign({},e.headers),{Origin:"https://jssdk.onekey.so"}))),e}));const{check:p,buildOne:y,receiveOne:g,parseConfigure:m}=u.default;e.exports=class{constructor(e){this.configured=!1,this.stopped=!1,this.url=null==e?"http://localhost:21320":e}_post(e){return this.stopped?i.reject(s.ERRORS.TypedError("Transport stopped.")):f(Object.assign(Object.assign({},e),{method:"POST",url:this.url+e.url}))}init(e){return l(this,void 0,void 0,(function*(){return this.Log=e,yield this._silentInit()}))}_silentInit(){return l(this,void 0,void 0,(function*(){const e=yield f({url:this.url,method:"POST",timeout:3e3});return p.info(e).version}))}configure(e){const t=m(e);this.configured=!0,this._messages=t}listen(e){return l(this,void 0,void 0,(function*(){if(null===e)throw s.ERRORS.TypedError("Http-Transport does not support listen without previous.");const t=yield this._post({url:"/listen",body:e});return p.devices(t)}))}enumerate(){return l(this,void 0,void 0,(function*(){const e=yield this._post({url:"/enumerate"});return p.devices(e)}))}_acquireMixed(e){const t=null==e.previous?"null":e.previous,r=`/acquire/${e.path}/${t}`;return this._post({url:r})}acquire(e){return l(this,void 0,void 0,(function*(){const t=yield this._acquireMixed(e);return p.acquire(t)}))}release(e,t){return l(this,void 0,void 0,(function*(){const r=this._post({url:`/release/${e}`});t||(yield r)}))}call(e,t,r){return l(this,void 0,void 0,(function*(){if(null==this._messages)throw s.ERRORS.TypedError(s.HardwareErrorCode.TransportNotConfigured);const i=this._messages;this.Log.debug("call-"," name: ",t," data: ",r);const n=y(i,t,r).toString("hex"),o=yield this._post({url:`/call/${e}`,body:n,timeout:"Initialize"===t?1e4:void 0});if("string"!=typeof o)throw s.ERRORS.TypedError(s.HardwareErrorCode.NetworkError,"Returning data is not string.");const a=g(i,o);return p.call(a)}))}post(e,t,r){return l(this,void 0,void 0,(function*(){if(null==this._messages)throw s.ERRORS.TypedError(s.HardwareErrorCode.TransportNotConfigured);const i=this._messages,n=y(i,t,r).toString("hex");yield this._post({url:`/post/${e}`,body:n})}))}read(e){return l(this,void 0,void 0,(function*(){if(null==this._messages)throw s.ERRORS.TypedError(s.HardwareErrorCode.TransportNotConfigured);const t=this._messages,r=yield this._post({url:`/read/${e}`});if("string"!=typeof r)throw s.ERRORS.TypedError(s.HardwareErrorCode.NetworkError,"Returning data is not string.");const i=g(t,r);return p.call(i)}))}requestDevice(){return i.reject()}stop(){this.stopped=!0}cancel(){this.Log.debug("canceled")}}},5016:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(8834).Buffer,s=r(1780),o=r(1464),a=r(9396);function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(s),l=u(a);function c(e,t,r,n){return new(r||(r=i))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}const{parseConfigure:h,buildEncodeBuffers:f,decodeProtocol:p,receiveOne:y,check:g}=d.default,m=[{vendorId:4617,productId:21440},{vendorId:4617,productId:21441}];e.exports=class{constructor(){this.stopped=!1,this.configured=!1,this._lastDevices=[],this.configurationId=1,this.endpointId=1,this.interfaceId=0}init(e){this.Log=e;const{usb:t}=navigator;if(!t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"WebUSB is not supported by current browsers");this.usb=t}configure(e){const t=h(e);this.configured=!0,this._messages=t}enumerate(){return c(this,void 0,void 0,(function*(){return yield this._getDeviceList()}))}_getDeviceList(){return c(this,void 0,void 0,(function*(){if(!this.usb)return[];const e=(yield this.usb.getDevices()).filter((e=>{const t=m.some((t=>e.vendorId===t.vendorId&&e.productId===t.productId)),r="string"==typeof e.serialNumber&&e.serialNumber.length>0;return t&&r}));return this._lastDevices=e.map((e=>({path:e.serialNumber,device:e}))),this._lastDevices}))}acquire(e){var t;return c(this,void 0,void 0,(function*(){if(e.path)try{return yield this.connect(null!==(t=e.path)&&void 0!==t?t:"",!0),yield i.resolve(e.path)}catch(e){throw this.Log.debug("acquire error: ",e),e}}))}_findDevice(e){const t=this._lastDevices.find((t=>t.path===e));if(null==t)throw new Error("Action was interrupted.");return t.device}connect(e,t){return c(this,void 0,void 0,(function*(){for(let r=0;r<5;r++){r>0&&(yield new i((e=>setTimeout((()=>e(void 0)),200*r))));try{return yield this._connectIn(e,t)}catch(e){if(4===r)throw e}}}))}_connectIn(e,t){return c(this,void 0,void 0,(function*(){const r=yield this._findDevice(e);if(yield r.open(),t){yield r.selectConfiguration(this.configurationId);try{yield r.reset()}catch(e){}}yield r.claimInterface(this.interfaceId)}))}call(e,t,r){return c(this,void 0,void 0,(function*(){if(null==this._messages)throw o.ERRORS.TypedError(o.HardwareErrorCode.TransportNotConfigured);const i=yield this._findDevice(e);if(!i)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotFound);const n=this._messages;this.Log.debug("call-"," name: ",t," data: ",r);const s=f(n,t,r);for(const t of s){const r=new Uint8Array(64);r[0]=63,r.set(new Uint8Array(t),1),i.opened||(yield this.connect(e,!1)),yield i.transferOut(this.endpointId,r)}const a=yield this._receive(e);if("string"!=typeof a)throw o.ERRORS.TypedError(o.HardwareErrorCode.NetworkError,"Returning data is not string.");const u=y(n,a);return g.call(u)}))}_receive(e){var t;return c(this,void 0,void 0,(function*(){const r=yield this._findDevice(e);r.opened||(yield this.connect(e,!1));const i=yield r.transferIn(this.endpointId,64),s=null===(t=i.data)||void 0===t?void 0:t.buffer.slice(1),{length:o,typeId:a,restBuffer:u}=p.decodeChunked(s),d=Number(o+6),c=new l.default(d);for(c.writeUint16(a),c.writeUint32(o),o&&c.append(u);c.offset<d;){const e=yield r.transferIn(this.endpointId,64);if(!e.data)throw new Error("no data");0===e.data.byteLength&&console.warn("empty data");const t=e.data.buffer.slice(1);d-c.offset>=64?c.append(t):c.append(t.slice(0,d-c.offset))}c.reset();const h=c.toBuffer();return n.from(h).toString("hex")}))}release(e){return c(this,void 0,void 0,(function*(){const t=yield this._findDevice(e);yield t.releaseInterface(this.interfaceId),yield t.close()}))}requestDevice(){return c(this,void 0,void 0,(function*(){if(this.usb)try{return yield this.usb.requestDevice({filters:m})}catch(e){this.Log.debug("requestDevice error: ",e)}}))}}},1780:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3448),n=r(7808),s=r(9396),o=r(8834);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=u(i),l=u(n),c=a(s);const h=["bool","string","bytes","int32","int64","uint32","uint64","sint32","sint64","fixed32","fixed64","sfixed32","sfixed64","double","float"],f=e=>h.includes(e),p=(e,t)=>e.optional&&void 0===t?null:"bytes"===e.type?c.default.wrap(t).toString("hex"):e.long?Number.isSafeInteger(t.toNumber())?t.toNumber():t.toString():t;function y(e,t){const r=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,[]),i={};return Object.keys(t).forEach((e=>{const n=t[e],s=r[e];if(n.repeated)if(f(n.type))i[e]=s.map((e=>p(n,e)));else if("valuesById"in n.resolvedType)i[e]=s;else{if(!("fields"in n.resolvedType))throw new Error(`case not handled for repeated key: ${e}`);i[e]=s.map((e=>y(e,n.resolvedType.fields)))}else if(f(n.type))i[e]=p(n,s);else if("valuesById"in n.resolvedType)i[e]=n.resolvedType.valuesById[s];else{if(!n.resolvedType.fields)throw new Error(`case not handled: ${e}`);i[e]=y(s,n.resolvedType.fields)}})),i}const g=(e,t)=>{if("bytes"===e)return"string"!=typeof t||t?o.Buffer.from(t,"hex"):t;if("number"==typeof t&&!Number.isSafeInteger(t))throw new RangeError("field value is not within safe integer range");return t};function m(e,t){const r={};return e.fields?(Object.keys(e.fields).forEach((i=>{const n=e.fields[i],s=t[i];if(void 0!==s)if(f(n.type))n.repeated?r[i]=s.map((e=>g(n.type,e))):r[i]=g(n.type,s);else if(n.repeated){const t=e.lookupTypeOrEnum(n.type);r[i]=s.map((e=>m(t,e)))}else if("object"==typeof s&&null!==s){const t=e.lookupType(n.type);r[i]=m(t,s)}else if("number"==typeof s){const t=e.lookupEnum(n.type);r[i]=t.values[s]}else r[i]=s})),r):r}const v=(e,t)=>{const r=m(e,t),i=e.fromObject(r),n=e.encode(i).finish(),s=new c.default(n.byteLength);return s.append(n),s.reset(),s},b=(e,t)=>{const r=e.lookupType(t);let i=e.lookupEnum("MessageType").values[`MessageType_${t}`];return!i&&r.options&&(i=r.options["(wire_type)"]),{Message:r,messageType:i}},_=e=>{const{typeId:t}=(e=>({typeId:e.readUint16(),length:e.readUint32()}))(e);return{typeId:t,buffer:e}};var w=Object.freeze({__proto__:null,decode:_,decodeChunked:e=>{const t=c.default.wrap(e,void 0,void 0,!0),{sharp1:r,sharp2:i,typeId:n,length:s}=(e=>({sharp1:e.readByte(),sharp2:e.readByte(),typeId:e.readUint16(),length:e.readUint32()}))(t);if(35!==r||35!==i)throw new Error("Didn't receive expected header signature.");return{length:s,typeId:n,restBuffer:t}}});function E(e,t){const{addTrezorHeaders:r,chunked:i,messageType:n}=t,s=(r?8:6)+e.limit,o=new c.default(s);if(r&&(o.writeByte(35),o.writeByte(35)),o.writeUint16(n),o.writeUint32(e.limit),o.append(e.buffer),o.reset(),!1===i)return o;const a=[],u=Math.floor((o.limit-1)/63)+1||1;for(let e=0;e<u;e++){const t=63*e,r=Math.min(63*(e+1),o.limit),i=o.slice(t,r);i.compact(),a.push(i.buffer)}return a}const S=(e,t,r)=>{const{Message:i,messageType:n}=b(e,t);return E(v(i,r),{addTrezorHeaders:!0,chunked:!0,messageType:n})},T="Wrong result type.";function A(e){if(null==e)return null;if("string"!=typeof e)throw new Error(T);return e}var M,R,x,k,O,I,C,P,N,D,B,q,L,j,F,U,z,H,G,$,W,V,K,Y,Z,X,J,Q,ee,te,re,ie,ne,se,oe,ae,ue,de,le,ce,he,fe,pe,ye,ge,me=Object.freeze({__proto__:null,info:function(e){if("object"!=typeof e||null==e)throw new Error("Wrong result type.");const{version:t}=e;if("string"!=typeof t)throw new Error(T);return{version:t,configured:!!e.configured}},version:function(e){if("string"!=typeof e)throw new Error(T);return e.trim()},devices:function(e){if("object"!=typeof e)throw new Error(T);if(!(e instanceof Array))throw new Error(T);return e.map((e=>{if("object"!=typeof e||null==e)throw new Error(T);const{path:t}=e;if("string"!=typeof t)throw new Error(T);return{path:t.toString(),session:A(e.session),debugSession:A(e.debugSession),product:e.product,vendor:e.vendor,debug:!!e.debug}}))},acquire:function(e){if("object"!=typeof e||null==e)throw new Error(T);const{session:t}=e;if("string"!=typeof t&&"number"!=typeof t)throw new Error(T);return t.toString()},call:function(e){if("object"!=typeof e||null==e)throw new Error(T);const{type:t}=e;if("string"!=typeof t)throw new Error(T);const{message:r}=e;if("object"!=typeof r||null==r)throw new Error(T);return{type:t,message:r}}});t.BinanceOrderType=void 0,(M=t.BinanceOrderType||(t.BinanceOrderType={}))[M.OT_UNKNOWN=0]="OT_UNKNOWN",M[M.MARKET=1]="MARKET",M[M.LIMIT=2]="LIMIT",M[M.OT_RESERVED=3]="OT_RESERVED",t.BinanceOrderSide=void 0,(R=t.BinanceOrderSide||(t.BinanceOrderSide={}))[R.SIDE_UNKNOWN=0]="SIDE_UNKNOWN",R[R.BUY=1]="BUY",R[R.SELL=2]="SELL",t.BinanceTimeInForce=void 0,(x=t.BinanceTimeInForce||(t.BinanceTimeInForce={}))[x.TIF_UNKNOWN=0]="TIF_UNKNOWN",x[x.GTE=1]="GTE",x[x.TIF_RESERVED=2]="TIF_RESERVED",x[x.IOC=3]="IOC",t.Enum_InputScriptType=void 0,(k=t.Enum_InputScriptType||(t.Enum_InputScriptType={}))[k.SPENDADDRESS=0]="SPENDADDRESS",k[k.SPENDMULTISIG=1]="SPENDMULTISIG",k[k.EXTERNAL=2]="EXTERNAL",k[k.SPENDWITNESS=3]="SPENDWITNESS",k[k.SPENDP2SHWITNESS=4]="SPENDP2SHWITNESS",k[k.SPENDTAPROOT=5]="SPENDTAPROOT",t.Enum_OutputScriptType=void 0,(O=t.Enum_OutputScriptType||(t.Enum_OutputScriptType={}))[O.PAYTOADDRESS=0]="PAYTOADDRESS",O[O.PAYTOSCRIPTHASH=1]="PAYTOSCRIPTHASH",O[O.PAYTOMULTISIG=2]="PAYTOMULTISIG",O[O.PAYTOOPRETURN=3]="PAYTOOPRETURN",O[O.PAYTOWITNESS=4]="PAYTOWITNESS",O[O.PAYTOP2SHWITNESS=5]="PAYTOP2SHWITNESS",O[O.PAYTOTAPROOT=6]="PAYTOTAPROOT",t.DecredStakingSpendType=void 0,(I=t.DecredStakingSpendType||(t.DecredStakingSpendType={}))[I.SSGen=0]="SSGen",I[I.SSRTX=1]="SSRTX",t.AmountUnit=void 0,(C=t.AmountUnit||(t.AmountUnit={}))[C.BITCOIN=0]="BITCOIN",C[C.MILLIBITCOIN=1]="MILLIBITCOIN",C[C.MICROBITCOIN=2]="MICROBITCOIN",C[C.SATOSHI=3]="SATOSHI",t.Enum_RequestType=void 0,(P=t.Enum_RequestType||(t.Enum_RequestType={}))[P.TXINPUT=0]="TXINPUT",P[P.TXOUTPUT=1]="TXOUTPUT",P[P.TXMETA=2]="TXMETA",P[P.TXFINISHED=3]="TXFINISHED",P[P.TXEXTRADATA=4]="TXEXTRADATA",P[P.TXORIGINPUT=5]="TXORIGINPUT",P[P.TXORIGOUTPUT=6]="TXORIGOUTPUT",t.RebootType=void 0,(N=t.RebootType||(t.RebootType={}))[N.Normal=0]="Normal",N[N.Boardloader=1]="Boardloader",N[N.BootLoader=2]="BootLoader",t.CardanoDerivationType=void 0,(D=t.CardanoDerivationType||(t.CardanoDerivationType={}))[D.LEDGER=0]="LEDGER",D[D.ICARUS=1]="ICARUS",D[D.ICARUS_TREZOR=2]="ICARUS_TREZOR",t.CardanoAddressType=void 0,(B=t.CardanoAddressType||(t.CardanoAddressType={}))[B.BASE=0]="BASE",B[B.BASE_SCRIPT_KEY=1]="BASE_SCRIPT_KEY",B[B.BASE_KEY_SCRIPT=2]="BASE_KEY_SCRIPT",B[B.BASE_SCRIPT_SCRIPT=3]="BASE_SCRIPT_SCRIPT",B[B.POINTER=4]="POINTER",B[B.POINTER_SCRIPT=5]="POINTER_SCRIPT",B[B.ENTERPRISE=6]="ENTERPRISE",B[B.ENTERPRISE_SCRIPT=7]="ENTERPRISE_SCRIPT",B[B.BYRON=8]="BYRON",B[B.REWARD=14]="REWARD",B[B.REWARD_SCRIPT=15]="REWARD_SCRIPT",t.CardanoNativeScriptType=void 0,(q=t.CardanoNativeScriptType||(t.CardanoNativeScriptType={}))[q.PUB_KEY=0]="PUB_KEY",q[q.ALL=1]="ALL",q[q.ANY=2]="ANY",q[q.N_OF_K=3]="N_OF_K",q[q.INVALID_BEFORE=4]="INVALID_BEFORE",q[q.INVALID_HEREAFTER=5]="INVALID_HEREAFTER",t.CardanoNativeScriptHashDisplayFormat=void 0,(L=t.CardanoNativeScriptHashDisplayFormat||(t.CardanoNativeScriptHashDisplayFormat={}))[L.HIDE=0]="HIDE",L[L.BECH32=1]="BECH32",L[L.POLICY_ID=2]="POLICY_ID",t.CardanoTxOutputSerializationFormat=void 0,(j=t.CardanoTxOutputSerializationFormat||(t.CardanoTxOutputSerializationFormat={}))[j.ARRAY_LEGACY=0]="ARRAY_LEGACY",j[j.MAP_BABBAGE=1]="MAP_BABBAGE",t.CardanoCertificateType=void 0,(F=t.CardanoCertificateType||(t.CardanoCertificateType={}))[F.STAKE_REGISTRATION=0]="STAKE_REGISTRATION",F[F.STAKE_DEREGISTRATION=1]="STAKE_DEREGISTRATION",F[F.STAKE_DELEGATION=2]="STAKE_DELEGATION",F[F.STAKE_POOL_REGISTRATION=3]="STAKE_POOL_REGISTRATION",t.CardanoPoolRelayType=void 0,(U=t.CardanoPoolRelayType||(t.CardanoPoolRelayType={}))[U.SINGLE_HOST_IP=0]="SINGLE_HOST_IP",U[U.SINGLE_HOST_NAME=1]="SINGLE_HOST_NAME",U[U.MULTIPLE_HOST_NAME=2]="MULTIPLE_HOST_NAME",t.CardanoTxAuxiliaryDataSupplementType=void 0,(z=t.CardanoTxAuxiliaryDataSupplementType||(t.CardanoTxAuxiliaryDataSupplementType={}))[z.NONE=0]="NONE",z[z.GOVERNANCE_REGISTRATION_SIGNATURE=1]="GOVERNANCE_REGISTRATION_SIGNATURE",t.CardanoGovernanceRegistrationFormat=void 0,(H=t.CardanoGovernanceRegistrationFormat||(t.CardanoGovernanceRegistrationFormat={}))[H.CIP15=0]="CIP15",H[H.CIP36=1]="CIP36",t.CardanoTxSigningMode=void 0,(G=t.CardanoTxSigningMode||(t.CardanoTxSigningMode={}))[G.ORDINARY_TRANSACTION=0]="ORDINARY_TRANSACTION",G[G.POOL_REGISTRATION_AS_OWNER=1]="POOL_REGISTRATION_AS_OWNER",G[G.MULTISIG_TRANSACTION=2]="MULTISIG_TRANSACTION",G[G.PLUTUS_TRANSACTION=3]="PLUTUS_TRANSACTION",t.CardanoTxWitnessType=void 0,($=t.CardanoTxWitnessType||(t.CardanoTxWitnessType={}))[$.BYRON_WITNESS=0]="BYRON_WITNESS",$[$.SHELLEY_WITNESS=1]="SHELLEY_WITNESS",t.FailureType=void 0,(W=t.FailureType||(t.FailureType={}))[W.Failure_UnexpectedMessage=1]="Failure_UnexpectedMessage",W[W.Failure_ButtonExpected=2]="Failure_ButtonExpected",W[W.Failure_DataError=3]="Failure_DataError",W[W.Failure_ActionCancelled=4]="Failure_ActionCancelled",W[W.Failure_PinExpected=5]="Failure_PinExpected",W[W.Failure_PinCancelled=6]="Failure_PinCancelled",W[W.Failure_PinInvalid=7]="Failure_PinInvalid",W[W.Failure_InvalidSignature=8]="Failure_InvalidSignature",W[W.Failure_ProcessError=9]="Failure_ProcessError",W[W.Failure_NotEnoughFunds=10]="Failure_NotEnoughFunds",W[W.Failure_NotInitialized=11]="Failure_NotInitialized",W[W.Failure_PinMismatch=12]="Failure_PinMismatch",W[W.Failure_WipeCodeMismatch=13]="Failure_WipeCodeMismatch",W[W.Failure_InvalidSession=14]="Failure_InvalidSession",W[W.Failure_FirmwareError=99]="Failure_FirmwareError",t.Enum_ButtonRequestType=void 0,(V=t.Enum_ButtonRequestType||(t.Enum_ButtonRequestType={}))[V.ButtonRequest_Other=1]="ButtonRequest_Other",V[V.ButtonRequest_FeeOverThreshold=2]="ButtonRequest_FeeOverThreshold",V[V.ButtonRequest_ConfirmOutput=3]="ButtonRequest_ConfirmOutput",V[V.ButtonRequest_ResetDevice=4]="ButtonRequest_ResetDevice",V[V.ButtonRequest_ConfirmWord=5]="ButtonRequest_ConfirmWord",V[V.ButtonRequest_WipeDevice=6]="ButtonRequest_WipeDevice",V[V.ButtonRequest_ProtectCall=7]="ButtonRequest_ProtectCall",V[V.ButtonRequest_SignTx=8]="ButtonRequest_SignTx",V[V.ButtonRequest_FirmwareCheck=9]="ButtonRequest_FirmwareCheck",V[V.ButtonRequest_Address=10]="ButtonRequest_Address",V[V.ButtonRequest_PublicKey=11]="ButtonRequest_PublicKey",V[V.ButtonRequest_MnemonicWordCount=12]="ButtonRequest_MnemonicWordCount",V[V.ButtonRequest_MnemonicInput=13]="ButtonRequest_MnemonicInput",V[V._Deprecated_ButtonRequest_PassphraseType=14]="_Deprecated_ButtonRequest_PassphraseType",V[V.ButtonRequest_UnknownDerivationPath=15]="ButtonRequest_UnknownDerivationPath",V[V.ButtonRequest_RecoveryHomepage=16]="ButtonRequest_RecoveryHomepage",V[V.ButtonRequest_Success=17]="ButtonRequest_Success",V[V.ButtonRequest_Warning=18]="ButtonRequest_Warning",V[V.ButtonRequest_PassphraseEntry=19]="ButtonRequest_PassphraseEntry",V[V.ButtonRequest_PinEntry=20]="ButtonRequest_PinEntry",t.Enum_PinMatrixRequestType=void 0,(K=t.Enum_PinMatrixRequestType||(t.Enum_PinMatrixRequestType={}))[K.PinMatrixRequestType_Current=1]="PinMatrixRequestType_Current",K[K.PinMatrixRequestType_NewFirst=2]="PinMatrixRequestType_NewFirst",K[K.PinMatrixRequestType_NewSecond=3]="PinMatrixRequestType_NewSecond",K[K.PinMatrixRequestType_WipeCodeFirst=4]="PinMatrixRequestType_WipeCodeFirst",K[K.PinMatrixRequestType_WipeCodeSecond=5]="PinMatrixRequestType_WipeCodeSecond",K[K.PinMatrixRequestType_BackupFirst=6]="PinMatrixRequestType_BackupFirst",K[K.PinMatrixRequestType_BackupSecond=7]="PinMatrixRequestType_BackupSecond",t.EthereumDataType=void 0,(Y=t.EthereumDataType||(t.EthereumDataType={}))[Y.UINT=1]="UINT",Y[Y.INT=2]="INT",Y[Y.BYTES=3]="BYTES",Y[Y.STRING=4]="STRING",Y[Y.BOOL=5]="BOOL",Y[Y.ADDRESS=6]="ADDRESS",Y[Y.ARRAY=7]="ARRAY",Y[Y.STRUCT=8]="STRUCT",t.Enum_BackupType=void 0,(Z=t.Enum_BackupType||(t.Enum_BackupType={}))[Z.Bip39=0]="Bip39",Z[Z.Slip39_Basic=1]="Slip39_Basic",Z[Z.Slip39_Advanced=2]="Slip39_Advanced",t.Enum_SafetyCheckLevel=void 0,(X=t.Enum_SafetyCheckLevel||(t.Enum_SafetyCheckLevel={}))[X.Strict=0]="Strict",X[X.PromptAlways=1]="PromptAlways",X[X.PromptTemporarily=2]="PromptTemporarily",t.Enum_Capability=void 0,(J=t.Enum_Capability||(t.Enum_Capability={}))[J.Capability_Bitcoin=1]="Capability_Bitcoin",J[J.Capability_Bitcoin_like=2]="Capability_Bitcoin_like",J[J.Capability_Binance=3]="Capability_Binance",J[J.Capability_Cardano=4]="Capability_Cardano",J[J.Capability_Crypto=5]="Capability_Crypto",J[J.Capability_EOS=6]="Capability_EOS",J[J.Capability_Ethereum=7]="Capability_Ethereum",J[J.Capability_Lisk=8]="Capability_Lisk",J[J.Capability_Monero=9]="Capability_Monero",J[J.Capability_NEM=10]="Capability_NEM",J[J.Capability_Ripple=11]="Capability_Ripple",J[J.Capability_Stellar=12]="Capability_Stellar",J[J.Capability_Tezos=13]="Capability_Tezos",J[J.Capability_U2F=14]="Capability_U2F",J[J.Capability_Shamir=15]="Capability_Shamir",J[J.Capability_ShamirGroups=16]="Capability_ShamirGroups",J[J.Capability_PassphraseEntry=17]="Capability_PassphraseEntry",t.ExportType=void 0,(Q=t.ExportType||(t.ExportType={}))[Q.SeedEncExportType_NO=0]="SeedEncExportType_NO",Q[Q.SeedEncExportType_YES=1]="SeedEncExportType_YES",Q[Q.MnemonicPlainExportType_YES=2]="MnemonicPlainExportType_YES",t.SdProtectOperationType=void 0,(ee=t.SdProtectOperationType||(t.SdProtectOperationType={}))[ee.DISABLE=0]="DISABLE",ee[ee.ENABLE=1]="ENABLE",ee[ee.REFRESH=2]="REFRESH",t.RecoveryDeviceType=void 0,(te=t.RecoveryDeviceType||(t.RecoveryDeviceType={}))[te.RecoveryDeviceType_ScrambledWords=0]="RecoveryDeviceType_ScrambledWords",te[te.RecoveryDeviceType_Matrix=1]="RecoveryDeviceType_Matrix",t.Enum_WordRequestType=void 0,(re=t.Enum_WordRequestType||(t.Enum_WordRequestType={}))[re.WordRequestType_Plain=0]="WordRequestType_Plain",re[re.WordRequestType_Matrix9=1]="WordRequestType_Matrix9",re[re.WordRequestType_Matrix6=2]="WordRequestType_Matrix6",t.SeedRequestType=void 0,(ie=t.SeedRequestType||(t.SeedRequestType={}))[ie.SeedRequestType_Gen=0]="SeedRequestType_Gen",ie[ie.SeedRequestType_EncExport=1]="SeedRequestType_EncExport",ie[ie.SeedRequestType_EncImport=2]="SeedRequestType_EncImport",t.WL_OperationType=void 0,(ne=t.WL_OperationType||(t.WL_OperationType={}))[ne.WL_OperationType_Add=0]="WL_OperationType_Add",ne[ne.WL_OperationType_Delete=1]="WL_OperationType_Delete",ne[ne.WL_OperationType_Inquire=2]="WL_OperationType_Inquire",t.ResourceType=void 0,(se=t.ResourceType||(t.ResourceType={}))[se.WallPaper=0]="WallPaper",se[se.Nft=1]="Nft",t.NEMMosaicLevy=void 0,(oe=t.NEMMosaicLevy||(t.NEMMosaicLevy={}))[oe.MosaicLevy_Absolute=1]="MosaicLevy_Absolute",oe[oe.MosaicLevy_Percentile=2]="MosaicLevy_Percentile",t.NEMSupplyChangeType=void 0,(ae=t.NEMSupplyChangeType||(t.NEMSupplyChangeType={}))[ae.SupplyChange_Increase=1]="SupplyChange_Increase",ae[ae.SupplyChange_Decrease=2]="SupplyChange_Decrease",t.NEMModificationType=void 0,(ue=t.NEMModificationType||(t.NEMModificationType={}))[ue.CosignatoryModification_Add=1]="CosignatoryModification_Add",ue[ue.CosignatoryModification_Delete=2]="CosignatoryModification_Delete",t.NEMImportanceTransferMode=void 0,(de=t.NEMImportanceTransferMode||(t.NEMImportanceTransferMode={}))[de.ImportanceTransfer_Activate=1]="ImportanceTransfer_Activate",de[de.ImportanceTransfer_Deactivate=2]="ImportanceTransfer_Deactivate",t.StellarAssetType=void 0,(le=t.StellarAssetType||(t.StellarAssetType={}))[le.NATIVE=0]="NATIVE",le[le.ALPHANUM4=1]="ALPHANUM4",le[le.ALPHANUM12=2]="ALPHANUM12",t.StellarMemoType=void 0,(ce=t.StellarMemoType||(t.StellarMemoType={}))[ce.NONE=0]="NONE",ce[ce.TEXT=1]="TEXT",ce[ce.ID=2]="ID",ce[ce.HASH=3]="HASH",ce[ce.RETURN=4]="RETURN",t.StellarSignerType=void 0,(he=t.StellarSignerType||(t.StellarSignerType={}))[he.ACCOUNT=0]="ACCOUNT",he[he.PRE_AUTH=1]="PRE_AUTH",he[he.HASH=2]="HASH",t.TezosContractType=void 0,(fe=t.TezosContractType||(t.TezosContractType={}))[fe.Implicit=0]="Implicit",fe[fe.Originated=1]="Originated",t.TezosBallotType=void 0,(pe=t.TezosBallotType||(t.TezosBallotType={}))[pe.Yay=0]="Yay",pe[pe.Nay=1]="Nay",pe[pe.Pass=2]="Pass",t.TronResourceCode=void 0,(ye=t.TronResourceCode||(t.TronResourceCode={}))[ye.BANDWIDTH=0]="BANDWIDTH",ye[ye.ENERGY=1]="ENERGY",t.CommandFlags=void 0,(ge=t.CommandFlags||(t.CommandFlags={}))[ge.Default=0]="Default",ge[ge.Factory_Only=1]="Factory_Only";var ve=Object.freeze({__proto__:null,get BinanceOrderType(){return t.BinanceOrderType},get BinanceOrderSide(){return t.BinanceOrderSide},get BinanceTimeInForce(){return t.BinanceTimeInForce},get Enum_InputScriptType(){return t.Enum_InputScriptType},get Enum_OutputScriptType(){return t.Enum_OutputScriptType},get DecredStakingSpendType(){return t.DecredStakingSpendType},get AmountUnit(){return t.AmountUnit},get Enum_RequestType(){return t.Enum_RequestType},get RebootType(){return t.RebootType},get CardanoDerivationType(){return t.CardanoDerivationType},get CardanoAddressType(){return t.CardanoAddressType},get CardanoNativeScriptType(){return t.CardanoNativeScriptType},get CardanoNativeScriptHashDisplayFormat(){return t.CardanoNativeScriptHashDisplayFormat},get CardanoTxOutputSerializationFormat(){return t.CardanoTxOutputSerializationFormat},get CardanoCertificateType(){return t.CardanoCertificateType},get CardanoPoolRelayType(){return t.CardanoPoolRelayType},get CardanoTxAuxiliaryDataSupplementType(){return t.CardanoTxAuxiliaryDataSupplementType},get CardanoGovernanceRegistrationFormat(){return t.CardanoGovernanceRegistrationFormat},get CardanoTxSigningMode(){return t.CardanoTxSigningMode},get CardanoTxWitnessType(){return t.CardanoTxWitnessType},get FailureType(){return t.FailureType},get Enum_ButtonRequestType(){return t.Enum_ButtonRequestType},get Enum_PinMatrixRequestType(){return t.Enum_PinMatrixRequestType},get EthereumDataType(){return t.EthereumDataType},get Enum_BackupType(){return t.Enum_BackupType},get Enum_SafetyCheckLevel(){return t.Enum_SafetyCheckLevel},get Enum_Capability(){return t.Enum_Capability},get ExportType(){return t.ExportType},get SdProtectOperationType(){return t.SdProtectOperationType},get RecoveryDeviceType(){return t.RecoveryDeviceType},get Enum_WordRequestType(){return t.Enum_WordRequestType},get SeedRequestType(){return t.SeedRequestType},get WL_OperationType(){return t.WL_OperationType},get ResourceType(){return t.ResourceType},get NEMMosaicLevy(){return t.NEMMosaicLevy},get NEMSupplyChangeType(){return t.NEMSupplyChangeType},get NEMModificationType(){return t.NEMModificationType},get NEMImportanceTransferMode(){return t.NEMImportanceTransferMode},get StellarAssetType(){return t.StellarAssetType},get StellarMemoType(){return t.StellarMemoType},get StellarSignerType(){return t.StellarSignerType},get TezosContractType(){return t.TezosContractType},get TezosBallotType(){return t.TezosBallotType},get TronResourceCode(){return t.TronResourceCode},get CommandFlags(){return t.CommandFlags}});d.util.Long=l,d.configure();var be={check:me,buildOne:function(e,t,r){const{Message:i,messageType:n}=b(e,t);return E(v(i,r),{addTrezorHeaders:!1,chunked:!1,messageType:n})},buildBuffers:(e,t,r)=>{const i=S(e,t,r),n=[];for(const e of i){const t=new c.default(64);t.writeByte(63),t.append(e),t.reset(),n.push(t)}return n},buildEncodeBuffers:S,receiveOne:function(e,t){const r=c.default.wrap(t,"hex"),{typeId:i,buffer:n}=_(r),{Message:s,messageName:o}=((e,t)=>{const r=e.lookupEnum("MessageType").valuesById[t].replace("MessageType_","");return{Message:e.lookupType(r),messageName:r}})(e,i),a=((e,t)=>{const r=t.toBuffer(),i=new Uint8Array(r),n=e.decode(i);return y(n,n.$type.fields)})(s,n);return{message:a,type:o}},parseConfigure:function(e){return"string"==typeof e?d.Root.fromJSON(JSON.parse(e)):d.Root.fromJSON(e)},decodeProtocol:w};t.BUFFER_SIZE=63,t.COMMON_HEADER_SIZE=6,t.HEADER_SIZE=8,t.MESSAGE_HEADER_BYTE=35,t.MESSAGE_TOP_CHAR=63,t.Messages=ve,t.default=be},1464:(e,t,r)=>{"use strict";var i=r(6139).Promise;Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){var t;super(),this.errorCode=s.UnknownError,this.message="",this.params={};const r=o;if(this.message=r[s.UnknownError],"string"==typeof e)this.errorCode=s.UnknownError,this.message=e;else{const s=null!==(t=e.message||r[e.errorCode])&&void 0!==t?t:"";s&&(this.message=(n=e,"string"!=typeof(i=s)?i:i.replace(/\{([^}]+)\}/g,((e,t)=>n[t]||"?")))),this.params=e.params,this.errorCode=e.errorCode}var i,n;this.name="HardwareError"}}const s={UnknownError:0,DeviceFwException:101,DeviceUnexpectedMode:102,DeviceListNotInitialized:103,SelectDevice:104,DeviceNotFound:105,DeviceInitializeFailed:106,DeviceInterruptedFromOutside:107,DeviceUnexpectedBootloaderMode:108,DeviceInterruptedFromUser:109,DeviceCheckDeviceIdError:110,DeviceNotSupportPassphrase:111,DeviceCheckPassphraseStateError:112,DeviceNotOpenedPassphrase:113,DeviceOpenedPassphrase:114,NotInitialized:200,IFrameNotInitialized:300,IFrameAleradyInitialized:301,IFrameLoadFail:302,IframeTimeout:303,IframeBlocked:304,CallMethodError:400,CallMethodNotResponse:404,CallMethodInvalidParameter:405,FirmwareUpdateDownloadFailed:406,CallMethodNeedUpgradeFirmware:407,CallMethodDeprecated:408,FirmwareUpdateLimitOneDevice:409,FirmwareUpdateManuallyEnterBoot:410,FirmwareUpdateAutoEnterBootFailure:411,NewFirmwareUnRelease:412,UseDesktopToUpdateFirmware:413,NewFirmwareForceUpdate:414,NetworkError:500,TransportNotConfigured:600,TransportCallInProgress:601,TransportNotFound:602,TransportInvalidProtobuf:603,BleScanError:700,BlePermissionError:701,BleLocationError:702,BleRequiredUUID:703,BleConnectedError:704,BleDeviceNotBonded:705,BleServiceNotFound:706,BleCharacteristicNotFound:707,BleMonitorError:708,BleCharacteristicNotifyError:709,BleWriteCharacteristicError:710,BleAlreadyConnected:711,BleLocationServicesDisabled:712,BleTimeoutError:713,BleForceCleanRunPromise:714,BleDeviceBondError:715,RuntimeError:800,PinInvalid:801,PinCancelled:802,ActionCancelled:803,FirmwareError:804,ResponseUnexpectTypeError:805,BridgeNetworkError:806,BridgeTimeoutError:807,BridgeNotInstalled:808,PollingTimeout:809,PollingStop:810,BlindSignDisabled:811,UnexpectPassphrase:812,FileAlreadyExists:813,CheckDownloadFileError:814,NotInSigningMode:815},o={[s.UnknownError]:"Unknown error occurred. Check message property.",[s.DeviceFwException]:"Firmware version mismatch",[s.DeviceUnexpectedMode]:"Device unexpected mode",[s.DeviceListNotInitialized]:"Device list is not initialized",[s.SelectDevice]:"Please select the connected device",[s.DeviceNotFound]:"Device not found",[s.DeviceInitializeFailed]:"Device initialization failed",[s.DeviceInterruptedFromOutside]:"Device interrupted",[s.DeviceInterruptedFromUser]:"Device interrupted",[s.DeviceUnexpectedBootloaderMode]:"Device should be in bootloader mode",[s.DeviceCheckDeviceIdError]:"Device Id in the features is not same.",[s.DeviceNotSupportPassphrase]:"Device not support passphrase",[s.DeviceCheckPassphraseStateError]:"Device passphrase state error",[s.DeviceNotOpenedPassphrase]:"Device not opened passphrase",[s.DeviceOpenedPassphrase]:"Device opened passphrase",[s.NotInitialized]:"Not initialized",[s.IFrameNotInitialized]:"IFrame not initialized",[s.IFrameAleradyInitialized]:"IFrame alerady initialized",[s.IFrameLoadFail]:"IFrame load fail",[s.IframeTimeout]:"init iframe time out",[s.IframeBlocked]:"IFrame blocked",[s.CallMethodError]:"Runtime errors during method execution",[s.CallMethodNotResponse]:"Method does not responding",[s.CallMethodInvalidParameter]:"Call method invalid parameter",[s.FirmwareUpdateDownloadFailed]:"Firmware update download failed",[s.CallMethodNeedUpgradeFirmware]:"Call method need upgrade firmware",[s.CallMethodDeprecated]:"Call method is deprecated",[s.FirmwareUpdateLimitOneDevice]:"Only one device can be connected during firmware upgrade",[s.FirmwareUpdateManuallyEnterBoot]:"You need to manually enter boot",[s.FirmwareUpdateAutoEnterBootFailure]:"Description Failed to automatically enter boot",[s.NewFirmwareUnRelease]:"new firmware has not been released yet",[s.NewFirmwareForceUpdate]:"new firmware has been released, please update",[s.UseDesktopToUpdateFirmware]:"Please use OneKey desktop client to update the firmware",[s.NetworkError]:"Network request error",[s.TransportNotConfigured]:"Transport not configured",[s.TransportCallInProgress]:"Transport call in progress",[s.TransportNotFound]:"Transport not found",[s.TransportInvalidProtobuf]:"Transport invalid protobuf",[s.BleScanError]:"BLE scan error",[s.BlePermissionError]:"Bluetooth required to be turned on",[s.BleLocationError]:"Location permissions for the application are not available",[s.BleRequiredUUID]:"uuid is required",[s.BleConnectedError]:"connected error is always runtime error",[s.BleDeviceNotBonded]:"device is not bonded",[s.BleServiceNotFound]:"BLEServiceNotFound: service not found",[s.BleCharacteristicNotFound]:"BLEServiceNotFound: service not found",[s.BleMonitorError]:"Monitor Error: characteristic not found",[s.BleCharacteristicNotifyError]:"Characteristic Notify Error",[s.BleWriteCharacteristicError]:"Write Characteristic Error",[s.BleAlreadyConnected]:"Already connected to device",[s.BleLocationServicesDisabled]:"Location Services disabled",[s.BleTimeoutError]:"The connection has timed out unexpectedly.",[s.BleForceCleanRunPromise]:"Force clean Bluetooth run promise",[s.BleDeviceBondError]:"Bluetooth pairing failed",[s.RuntimeError]:"Runtime error",[s.PinInvalid]:"Pin invalid",[s.PinCancelled]:"Pin cancelled",[s.ActionCancelled]:"Action cancelled by user",[s.FirmwareError]:"Firmware installation failed",[s.ResponseUnexpectTypeError]:"Response type is not expected",[s.BridgeNetworkError]:"Bridge network error",[s.BridgeTimeoutError]:"Bridge network timeout",[s.BridgeNotInstalled]:"Bridge not installed",[s.PollingTimeout]:"Polling timeout",[s.PollingStop]:"Polling stop",[s.BlindSignDisabled]:"Please confirm the BlindSign enabled",[s.UnexpectPassphrase]:"Unexpect passphrase",[s.FileAlreadyExists]:"File already exists",[s.CheckDownloadFileError]:"Check download file error",[s.NotInSigningMode]:"not in signing mode"},a=(e,t,r)=>new n("string"==typeof e?e:{errorCode:e,message:null!=t?t:"",params:r}),u=e=>e&&e.error instanceof n?{error:e.error.message,code:e.error.errorCode,params:e.error.params}:e&&e.error instanceof Error?{error:e.error.message,code:e.error.code}:e,d=e=>{for(const t of Object.values(s))if(o[t]===e)return a(t);return new n(e)};var l=Object.freeze({__proto__:null,HardwareError:n,HardwareErrorCode:s,HardwareErrorCodeMessage:o,TypedError:a,serializeError:u,CreateErrorByMessage:d});t.CreateErrorByMessage=d,t.ERRORS=l,t.HardwareError=n,t.HardwareErrorCode=s,t.HardwareErrorCodeMessage=o,t.TypedError=a,t.createDeferred=function(e,t){let r,n=e=>{},s=e=>{};const o=new i(((t,o)=>{return a=this,u=void 0,l=function*(){if(n=t,s=o,"function"==typeof e)try{yield e()}catch(e){o(e)}"string"==typeof e&&(r=e)},new((d=void 0)||(d=i))((function(e,t){function r(e){try{n(l.next(e))}catch(e){t(e)}}function i(e){try{n(l.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):(n=t.value,n instanceof d?n:new d((function(e){e(n)}))).then(r,i)}n((l=l.apply(a,u||[])).next())}));var a,u,d,l}));return{id:r,data:t,resolve:n,reject:s,promise:o}},t.serializeError=u},8166:(e,t,r)=>{"use strict";var i=r(7834).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw new TypeError(s+" is ambiguous");t[o]=n}var a=e.length,u=e.charAt(0),d=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function c(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,s=0;e[r]===u;)n++,r++;for(var o=(e.length-r)*d+1>>>0,l=new Uint8Array(o);e[r];){var c=t[e.charCodeAt(r)];if(255===c)return;for(var h=0,f=o-1;(0!==c||h<s)&&-1!==f;f--,h++)c+=a*l[f]>>>0,l[f]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");s=h,r++}for(var p=o-s;p!==o&&0===l[p];)p++;var y=i.allocUnsafe(n+(o-p));y.fill(0,0,n);for(var g=n;p!==o;)y[g++]=l[p++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var d=(o-s)*l+1>>>0,c=new Uint8Array(d);s!==o;){for(var h=t[s],f=0,p=d-1;(0!==h||f<n)&&-1!==p;p--,f++)h+=256*c[p]>>>0,c[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=f,s++}for(var y=d-n;y!==d&&0===c[y];)y++;for(var g=u.repeat(r);y<d;++y)g+=e.charAt(c[y]);return g},decodeUnsafe:c,decode:function(e){var t=c(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},5766:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,s=u(e),o=s[0],a=s[1],d=new n(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),l=0,c=a>0?o-4:o;for(r=0;r<c;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],d[l++]=t>>16&255,d[l++]=t>>8&255,d[l++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,d[l++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,d[l++]=t>>8&255,d[l++]=255&t),d},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],o=16383,a=0,u=i-n;a<u;a+=o)s.push(d(e,a,a+o>u?u:a+o));return 1===n?(t=e[i-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function d(e,t,i){for(var n,s,o=[],a=t;a<i;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(s=n)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},6391:function(e,t,r){var i;!function(n){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,d="[BigNumber Error] ",l=d+"Number primitive has more than 15 significant digits: ",c=1e14,h=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,i=1,n=e.length,s=e[0]+"";i<n;){for(t=e[i++]+"",r=h-t.length;r--;t="0"+t);s+=t}for(n=s.length;48===s.charCodeAt(--n););return s.slice(0,n+1||1)}function b(e,t){var r,i,n=e.c,s=t.c,o=e.s,a=t.s,u=e.e,d=t.e;if(!o||!a)return null;if(r=n&&!n[0],i=s&&!s[0],r||i)return r?i?0:-a:o;if(o!=a)return o;if(r=o<0,i=u==d,!n||!s)return i?0:!n^r?1:-1;if(!i)return u>d^r?1:-1;for(a=(u=n.length)<(d=s.length)?u:d,o=0;o<a;o++)if(n[o]!=s[o])return n[o]>s[o]^r?1:-1;return u==d?0:u>d^r?1:-1}function _(e,t,r,i){if(e<t||e>r||e!==u(e))throw Error(d+(i||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return m(e.e/h)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var i,n;if(t<0){for(n=r+".";++t;n+=r);e=n+e}else if(++t>(i=e.length)){for(n=r,t-=i;--t;n+=r);e+=n}else t<i&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var r,i,n,s,T,A,M,R,x,k,O=G.prototype={constructor:G,toString:null,valueOf:null},I=new G(1),C=20,P=4,N=-7,D=21,B=-1e7,q=1e7,L=!1,j=1,F=0,U={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function G(e,t){var r,s,a,d,c,p,y,g,m=this;if(!(m instanceof G))return new G(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>q?m.c=m.e=null:e.e<B?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((p="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(d=0,c=e;c>=10;c/=10,d++);return void(d>q?m.c=m.e=null:(m.e=d,m.c=[e]))}g=String(e)}else{if(!o.test(g=String(e)))return n(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(d=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(d<0&&(d=c),d+=+g.slice(c+1),g=g.substring(0,c)):d<0&&(d=g.length)}else{if(_(t,2,z.length,"Base"),10==t&&H)return K(m=new G(e),C+m.e+1,P);if(g=String(e),p="number"==typeof e){if(0*e!=0)return n(m,g,p,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,G.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=z.slice(0,t),d=c=0,y=g.length;c<y;c++)if(r.indexOf(s=g.charAt(c))<0){if("."==s){if(c>d){d=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,d=0;continue}return n(m,String(e),p,t)}p=!1,(d=(g=i(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):d=g.length}for(c=0;48===g.charCodeAt(c);c++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(c,++y)){if(y-=c,p&&G.DEBUG&&y>15&&(e>f||e!==u(e)))throw Error(l+m.s*e);if((d=d-c-1)>q)m.c=m.e=null;else if(d<B)m.c=[m.e=0];else{if(m.e=d,m.c=[],c=(d+1)%h,d<0&&(c+=h),c<y){for(c&&m.c.push(+g.slice(0,c)),y-=h;c<y;)m.c.push(+g.slice(c,c+=h));c=h-(g=g.slice(c)).length}else c-=y;for(;c--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function $(e,t,r,i){var n,s,o,a,u;if(null==r?r=P:_(r,0,8),!e.c)return e.toString();if(n=e.c[0],o=e.e,null==t)u=v(e.c),u=1==i||2==i&&(o<=N||o>=D)?E(u,o):S(u,o,"0");else if(s=(e=K(new G(e),t,r)).e,a=(u=v(e.c)).length,1==i||2==i&&(t<=s||s<=N)){for(;a<t;u+="0",a++);u=E(u,s)}else if(t-=o,u=S(u,s,"0"),s+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-a)>0)for(s+1==a&&(u+=".");t--;u+="0");return e.s<0&&n?"-"+u:u}function W(e,t){for(var r,i=1,n=new G(e[0]);i<e.length;i++){if(!(r=new G(e[i])).s){n=r;break}t.call(n,r)&&(n=r)}return n}function V(e,t,r){for(var i=1,n=t.length;!t[--n];t.pop());for(n=t[0];n>=10;n/=10,i++);return(r=i+r*h-1)>q?e.c=e.e=null:r<B?e.c=[e.e=0]:(e.e=r,e.c=t),e}function K(e,t,r,i){var n,s,o,d,l,f,y,g=e.c,m=p;if(g){e:{for(n=1,d=g[0];d>=10;d/=10,n++);if((s=t-n)<0)s+=h,o=t,y=(l=g[f=0])/m[n-o-1]%10|0;else if((f=a((s+1)/h))>=g.length){if(!i)break e;for(;g.length<=f;g.push(0));l=y=0,n=1,o=(s%=h)-h+1}else{for(l=d=g[f],n=1;d>=10;d/=10,n++);y=(o=(s%=h)-h+n)<0?0:l/m[n-o-1]%10|0}if(i=i||t<0||null!=g[f+1]||(o<0?l:l%m[n-o-1]),i=r<4?(y||i)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||i||6==r&&(s>0?o>0?l/m[n-o]:0:g[f-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,i?(t-=e.e+1,g[0]=m[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==s?(g.length=f,d=1,f--):(g.length=f+1,d=m[h-s],g[f]=o>0?u(l/m[n-o]%m[o])*d:0),i)for(;;){if(0==f){for(s=1,o=g[0];o>=10;o/=10,s++);for(o=g[0]+=d,d=1;o>=10;o/=10,d++);s!=d&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[f]+=d,g[f]!=c)break;g[f--]=0,d=1}for(s=g.length;0===g[--s];g.pop());}e.e>q?e.c=e.e=null:e.e<B&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=N||r>=D?E(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return G.clone=e,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(d+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,g,t),C=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),P=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-g,0,t),_(r[1],0,g,t),N=r[0],D=r[1]):(_(r,-g,g,t),N=-(D=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-g,-1,t),_(r[1],1,g,t),B=r[0],q=r[1];else{if(_(r,-g,g,t),!r)throw Error(d+t+" cannot be zero: "+r);B=-(q=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(d+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(d+"crypto unavailable");L=r}else L=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),j=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,g,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(d+t+" not an object: "+r);U=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(d+t+" invalid: "+r);H="0123456789"==r.slice(0,10),z=r}}return{DECIMAL_PLACES:C,ROUNDING_MODE:P,EXPONENTIAL_AT:[N,D],RANGE:[B,q],CRYPTO:L,MODULO_MODE:j,POW_PRECISION:F,FORMAT:U,ALPHABET:z}},G.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!G.DEBUG)return!0;var t,r,i=e.c,n=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-g&&n<=g&&n===u(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break e}if((t=(n+1)%h)<1&&(t+=h),String(i[0]).length==t){for(t=0;t<i.length;t++)if((r=i[t])<0||r>=c||r!==u(r))break e;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(d+"Invalid BigNumber: "+e)},G.maximum=G.max=function(){return W(arguments,O.lt)},G.minimum=G.min=function(){return W(arguments,O.gt)},G.random=(s=9007199254740992,T=Math.random()*s&2097151?function(){return u(Math.random()*s)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,i,n,s,o=0,l=[],c=new G(I);if(null==e?e=C:_(e,0,g),n=a(e/h),L)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(n*=2));o<n;)(s=131072*t[o]+(t[o+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[o]=r[0],t[o+1]=r[1]):(l.push(s%1e14),o+=2);o=n/2}else{if(!crypto.randomBytes)throw L=!1,Error(d+"crypto unavailable");for(t=crypto.randomBytes(n*=7);o<n;)(s=281474976710656*(31&t[o])+1099511627776*t[o+1]+4294967296*t[o+2]+16777216*t[o+3]+(t[o+4]<<16)+(t[o+5]<<8)+t[o+6])>=9e15?crypto.randomBytes(7).copy(t,o):(l.push(s%1e14),o+=7);o=n/7}if(!L)for(;o<n;)(s=T())<9e15&&(l[o++]=s%1e14);for(n=l[--o],e%=h,n&&e&&(s=p[h-e],l[o]=u(n/s)*s);0===l[o];l.pop(),o--);if(o<0)l=[i=0];else{for(i=-1;0===l[0];l.splice(0,1),i-=h);for(o=1,s=l[0];s>=10;s/=10,o++);o<h&&(i-=h-o)}return c.e=i,c.c=l,c}),G.sum=function(){for(var e=1,t=arguments,r=new G(t[0]);e<t.length;)r=r.plus(t[e++]);return r},i=function(){var e="0123456789";function t(e,t,r,i){for(var n,s,o=[0],a=0,u=e.length;a<u;){for(s=o.length;s--;o[s]*=t);for(o[0]+=i.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(i,n,s,o,a){var u,d,l,c,h,f,p,y,g=i.indexOf("."),m=C,b=P;for(g>=0&&(c=F,F=0,i=i.replace(".",""),f=(y=new G(n)).pow(i.length-g),F=c,y.c=t(S(v(f.c),f.e,"0"),10,s,e),y.e=y.c.length),l=c=(p=t(i,n,s,a?(u=z,e):(u=e,z))).length;0==p[--c];p.pop());if(!p[0])return u.charAt(0);if(g<0?--l:(f.c=p,f.e=l,f.s=o,p=(f=r(f,y,m,b,s)).c,h=f.r,l=f.e),g=p[d=l+m+1],c=s/2,h=h||d<0||null!=p[d+1],h=b<4?(null!=g||h)&&(0==b||b==(f.s<0?3:2)):g>c||g==c&&(4==b||h||6==b&&1&p[d-1]||b==(f.s<0?8:7)),d<1||!p[0])i=h?S(u.charAt(1),-m,u.charAt(0)):u.charAt(0);else{if(p.length=d,h)for(--s;++p[--d]>s;)p[d]=0,d||(++l,p=[1].concat(p));for(c=p.length;!p[--c];);for(g=0,i="";g<=c;i+=u.charAt(p[g++]));i=S(i,l,u.charAt(0))}return i}}(),r=function(){function e(e,t,r){var i,n,s,o,a=0,u=e.length,d=t%y,l=t/y|0;for(e=e.slice();u--;)a=((n=d*(s=e[u]%y)+(i=l*s+(o=e[u]/y|0)*d)%y*y+a)/r|0)+(i/y|0)+l*o,e[u]=n%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;n<r;n++)if(e[n]!=t[n]){s=e[n]>t[n]?1:-1;break}return s}function r(e,t,r,i){for(var n=0;r--;)e[r]-=n,n=e[r]<t[r]?1:0,e[r]=n*i+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,n,s,o,a){var d,l,f,p,y,g,v,b,_,w,E,S,T,A,M,R,x,k=i.s==n.s?1:-1,O=i.c,I=n.c;if(!(O&&O[0]&&I&&I[0]))return new G(i.s&&n.s&&(O?!I||O[0]!=I[0]:I)?O&&0==O[0]||!I?0*k:k/0:NaN);for(_=(b=new G(k)).c=[],k=s+(l=i.e-n.e)+1,a||(a=c,l=m(i.e/h)-m(n.e/h),k=k/h|0),f=0;I[f]==(O[f]||0);f++);if(I[f]>(O[f]||0)&&l--,k<0)_.push(1),p=!0;else{for(A=O.length,R=I.length,f=0,k+=2,(y=u(a/(I[0]+1)))>1&&(I=e(I,y,a),O=e(O,y,a),R=I.length,A=O.length),T=R,E=(w=O.slice(0,R)).length;E<R;w[E++]=0);x=I.slice(),x=[0].concat(x),M=I[0],I[1]>=a/2&&M++;do{if(y=0,(d=t(I,w,R,E))<0){if(S=w[0],R!=E&&(S=S*a+(w[1]||0)),(y=u(S/M))>1)for(y>=a&&(y=a-1),v=(g=e(I,y,a)).length,E=w.length;1==t(g,w,v,E);)y--,r(g,R<v?x:I,v,a),v=g.length,d=1;else 0==y&&(d=y=1),v=(g=I.slice()).length;if(v<E&&(g=[0].concat(g)),r(w,g,E,a),E=w.length,-1==d)for(;t(I,w,R,E)<1;)y++,r(w,R<E?x:I,E,a),E=w.length}else 0===d&&(y++,w=[0]);_[f++]=y,w[0]?w[E++]=O[T]||0:(w=[O[T]],E=1)}while((T++<A||null!=w[0])&&k--);p=null!=w[0],_[0]||_.splice(0,1)}if(a==c){for(f=1,k=_[0];k>=10;k/=10,f++);K(b,s+(b.e=f+l*h-1)+1,o,p)}else b.e=l,b.r=+p;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,R=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,k=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,i){var n,s=r?t:t.replace(k,"");if(x.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(function(e,t,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?e:t})),i&&(n=i,s=s.replace(M,"$1").replace(R,"0.$1")),t!=s))return new G(s,n);if(G.DEBUG)throw Error(d+"Not a"+(i?" base "+i:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new G(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return b(this,new G(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,i,n,s=this;if(null!=e)return _(e,0,g),null==t?t=P:_(t,0,8),K(new G(s),e+s.e+1,t);if(!(r=s.c))return null;if(i=((n=r.length-1)-m(this.e/h))*h,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},O.dividedBy=O.div=function(e,t){return r(this,new G(e,t),C,P)},O.dividedToIntegerBy=O.idiv=function(e,t){return r(this,new G(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,i,n,s,o,l,c,f,p=this;if((e=new G(e)).c&&!e.isInteger())throw Error(d+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new G(t)),o=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return f=new G(Math.pow(+Y(p),o?2-w(e):+Y(e))),t?f.mod(t):f;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new G(NaN);(i=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||o&&p.c[1]>=24e7:p.c[0]<8e13||o&&p.c[0]<=9999975e7)))return s=p.s<0&&w(e)?-0:0,p.e>-1&&(s=1/s),new G(l?1/s:s);F&&(s=a(F/h+2))}for(o?(r=new G(.5),l&&(e.s=1),c=w(e)):c=(n=Math.abs(+Y(e)))%2,f=new G(I);;){if(c){if(!(f=f.times(p)).c)break;s?f.c.length>s&&(f.c.length=s):i&&(f=f.mod(t))}if(n){if(0===(n=u(n/2)))break;c=n%2}else if(K(e=e.times(r),e.e+1,1),e.e>14)c=w(e);else{if(0==(n=+Y(e)))break;c=n%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):i&&(p=p.mod(t))}return i?f:(l&&(f=I.div(f)),t?f.mod(t):s?K(f,F,P,void 0):f)},O.integerValue=function(e){var t=new G(this);return null==e?e=P:_(e,0,8),K(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===b(this,new G(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return b(this,new G(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=b(this,new G(e,t)))||0===t},O.isInteger=function(){return!!this.c&&m(this.e/h)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return b(this,new G(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=b(this,new G(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,i,n,s,o=this,a=o.s;if(t=(e=new G(e,t)).s,!a||!t)return new G(NaN);if(a!=t)return e.s=-t,o.plus(e);var u=o.e/h,d=e.e/h,l=o.c,f=e.c;if(!u||!d){if(!l||!f)return l?(e.s=-t,e):new G(f?o:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new G(l[0]?o:3==P?-0:0)}if(u=m(u),d=m(d),l=l.slice(),a=u-d){for((s=a<0)?(a=-a,n=l):(d=u,n=f),n.reverse(),t=a;t--;n.push(0));n.reverse()}else for(i=(s=(a=l.length)<(t=f.length))?a:t,a=t=0;t<i;t++)if(l[t]!=f[t]){s=l[t]<f[t];break}if(s&&(n=l,l=f,f=n,e.s=-e.s),(t=(i=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=c-1;i>a;){if(l[--i]<f[i]){for(r=i;r&&!l[--r];l[r]=t);--l[r],l[i]+=c}l[i]-=f[i]}for(;0==l[0];l.splice(0,1),--d);return l[0]?V(e,l,d):(e.s=3==P?-1:1,e.c=[e.e=0],e)},O.modulo=O.mod=function(e,t){var i,n,s=this;return e=new G(e,t),!s.c||!e.s||e.c&&!e.c[0]?new G(NaN):!e.c||s.c&&!s.c[0]?new G(s):(9==j?(n=e.s,e.s=1,i=r(s,e,0,3),e.s=n,i.s*=n):i=r(s,e,0,j),(e=s.minus(i.times(e))).c[0]||1!=j||(e.s=s.s),e)},O.multipliedBy=O.times=function(e,t){var r,i,n,s,o,a,u,d,l,f,p,g,v,b,_,w=this,E=w.c,S=(e=new G(e,t)).c;if(!(E&&S&&E[0]&&S[0]))return!w.s||!e.s||E&&!E[0]&&!S||S&&!S[0]&&!E?e.c=e.e=e.s=null:(e.s*=w.s,E&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=m(w.e/h)+m(e.e/h),e.s*=w.s,(u=E.length)<(f=S.length)&&(v=E,E=S,S=v,n=u,u=f,f=n),n=u+f,v=[];n--;v.push(0));for(b=c,_=y,n=f;--n>=0;){for(r=0,p=S[n]%_,g=S[n]/_|0,s=n+(o=u);s>n;)r=((d=p*(d=E[--o]%_)+(a=g*d+(l=E[o]/_|0)*p)%_*_+v[s]+r)/b|0)+(a/_|0)+g*l,v[s--]=d%b;v[s]=r}return r?++i:v.splice(0,1),V(e,v,i)},O.negated=function(){var e=new G(this);return e.s=-e.s||null,e},O.plus=function(e,t){var r,i=this,n=i.s;if(t=(e=new G(e,t)).s,!n||!t)return new G(NaN);if(n!=t)return e.s=-t,i.minus(e);var s=i.e/h,o=e.e/h,a=i.c,u=e.c;if(!s||!o){if(!a||!u)return new G(n/0);if(!a[0]||!u[0])return u[0]?e:new G(a[0]?i:0*n)}if(s=m(s),o=m(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=u):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(t=u.length)<0&&(r=u,u=a,a=r,t=n),n=0;t;)n=(a[--t]=a[t]+u[t]+n)/c|0,a[t]=c===a[t]?0:a[t]%c;return n&&(a=[n].concat(a),++o),V(e,a,o)},O.precision=O.sd=function(e,t){var r,i,n,s=this;if(null!=e&&e!==!!e)return _(e,1,g),null==t?t=P:_(t,0,8),K(new G(s),e,t);if(!(r=s.c))return null;if(i=(n=r.length-1)*h+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return e&&s.e+1>i&&(i=s.e+1),i},O.shiftedBy=function(e){return _(e,-9007199254740991,f),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,i,n,s,o=this,a=o.c,u=o.s,d=o.e,l=C+4,c=new G("0.5");if(1!==u||!a||!a[0])return new G(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+Y(o)))||u==1/0?(((t=v(a)).length+d)%2==0&&(t+="0"),u=Math.sqrt(+t),d=m((d+1)/2)-(d<0||d%2),i=new G(t=u==1/0?"5e"+d:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+d)):i=new G(u+""),i.c[0])for((u=(d=i.e)+l)<3&&(u=0);;)if(s=i,i=c.times(s.plus(r(o,s,l,1))),v(s.c).slice(0,u)===(t=v(i.c)).slice(0,u)){if(i.e<d&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(K(i,i.e+C+2,1),e=!i.times(i).eq(o));break}if(!n&&(K(s,s.e+C+2,0),s.times(s).eq(o))){i=s;break}l+=4,u+=4,n=1}return K(i,i.e+C+1,P,e)},O.toExponential=function(e,t){return null!=e&&(_(e,0,g),e++),$(this,e,t,1)},O.toFixed=function(e,t){return null!=e&&(_(e,0,g),e=e+this.e+1),$(this,e,t)},O.toFormat=function(e,t,r){var i,n=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=U;else if("object"!=typeof r)throw Error(d+"Argument not an object: "+r);if(i=n.toFixed(e,t),n.c){var s,o=i.split("."),a=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",c=o[0],h=o[1],f=n.s<0,p=f?c.slice(1):c,y=p.length;if(u&&(s=a,a=u,u=s,y-=s),a>0&&y>0){for(s=y%a||a,c=p.substr(0,s);s<y;s+=a)c+=l+p.substr(s,a);u>0&&(c+=l+p.slice(s)),f&&(c="-"+c)}i=h?c+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):c}return(r.prefix||"")+i+(r.suffix||"")},O.toFraction=function(e){var t,i,n,s,o,a,u,l,c,f,y,g,m=this,b=m.c;if(null!=e&&(!(u=new G(e)).isInteger()&&(u.c||1!==u.s)||u.lt(I)))throw Error(d+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+Y(u));if(!b)return new G(m);for(t=new G(I),c=i=new G(I),n=l=new G(I),g=v(b),o=t.e=g.length-m.e-1,t.c[0]=p[(a=o%h)<0?h+a:a],e=!e||u.comparedTo(t)>0?o>0?t:c:u,a=q,q=1/0,u=new G(g),l.c[0]=0;f=r(u,t,0,1),1!=(s=i.plus(f.times(n))).comparedTo(e);)i=n,n=s,c=l.plus(f.times(s=c)),l=s,t=u.minus(f.times(s=t)),u=s;return s=r(e.minus(i),n,0,1),l=l.plus(s.times(c)),i=i.plus(s.times(n)),l.s=c.s=m.s,y=r(c,n,o*=2,P).minus(m).abs().comparedTo(r(l,i,o,P).minus(m).abs())<1?[c,n]:[l,i],q=a,y},O.toNumber=function(){return+Y(this)},O.toPrecision=function(e,t){return null!=e&&_(e,1,g),$(this,e,t,2)},O.toString=function(e){var t,r=this,n=r.s,s=r.e;return null===s?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=s<=N||s>=D?E(v(r.c),s):S(v(r.c),s,"0"):10===e&&H?t=S(v((r=K(new G(r),C+s+1,P)).c),r.e,"0"):(_(e,2,z.length,"Base"),t=i(S(v(r.c),s,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return Y(this)},O._isBigNumber=!0,null!=t&&G.set(t),G}(),s.default=s.BigNumber=s,void 0===(i=function(){return s}.call(t,r,t,e))||(e.exports=i)}()},2197:function(e,t,r){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3196).Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(e,t,r){var i=a(e,r);return r-1>=t&&(i|=a(e,r-1)<<4),i}function d(e,t,r,i){for(var n=0,s=Math.min(e.length,r),o=t;o<s;o++){var a=e.charCodeAt(o)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===r)for(n=e.length-1,s=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,s=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,u=0,l=r;l<a;l+=i)u=d(e,l,l+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var c=1;for(u=d(e,l,e.length,t),l=0;l<o;l++)c*=t;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},s.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var d=1;d<i;d++){for(var l=u>>>26,c=67108863&u,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;l+=(o=(n=0|e.words[p])*(s=0|t.words[f])+c)/67108864|0,c=67108863&o}r.words[d]=0|c,u=0|l}return 0!==u?r.words[d]=0|u:r.length--,r.strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<n|s)).toString(16);r=0!=(s=a>>>24-n&16777215)||o!==this.length-1?l[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?y+r:l[d-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return i(void 0!==o),this.toArrayLike(o,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0"),this.strip();var o,a,u="le"===t,d=new e(s),l=this.clone();if(u){for(a=0;!l.isZero();a++)o=l.andln(255),l.iushrn(8),d[a]=o;for(;a<s;a++)d[a]=0}else{for(a=0;a<s-n;a++)d[a]=0;for(a=0;!l.isZero();a++)o=l.andln(255),l.iushrn(8),d[s-a-1]=o}return d},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},s.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},s.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},s.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,s=0;s<i.length;s++)t=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&t,n=t>>>26;for(;0!==n&&s<r.length;s++)t=(0|r.words[s])+n,this.words[s]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var s=0,o=0;o<i.length;o++)s=(t=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var i,n,s,o=e.words,a=t.words,u=r.words,d=0,l=0|o[0],c=8191&l,h=l>>>13,f=0|o[1],p=8191&f,y=f>>>13,g=0|o[2],m=8191&g,v=g>>>13,b=0|o[3],_=8191&b,w=b>>>13,E=0|o[4],S=8191&E,T=E>>>13,A=0|o[5],M=8191&A,R=A>>>13,x=0|o[6],k=8191&x,O=x>>>13,I=0|o[7],C=8191&I,P=I>>>13,N=0|o[8],D=8191&N,B=N>>>13,q=0|o[9],L=8191&q,j=q>>>13,F=0|a[0],U=8191&F,z=F>>>13,H=0|a[1],G=8191&H,$=H>>>13,W=0|a[2],V=8191&W,K=W>>>13,Y=0|a[3],Z=8191&Y,X=Y>>>13,J=0|a[4],Q=8191&J,ee=J>>>13,te=0|a[5],re=8191&te,ie=te>>>13,ne=0|a[6],se=8191&ne,oe=ne>>>13,ae=0|a[7],ue=8191&ae,de=ae>>>13,le=0|a[8],ce=8191&le,he=le>>>13,fe=0|a[9],pe=8191&fe,ye=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(d+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(h,U)|0))<<13)|0;d=((s=Math.imul(h,z))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,U),n=(n=Math.imul(p,z))+Math.imul(y,U)|0,s=Math.imul(y,z);var me=(d+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,$)|0)+Math.imul(h,G)|0))<<13)|0;d=((s=s+Math.imul(h,$)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,z))+Math.imul(v,U)|0,s=Math.imul(v,z),i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(y,G)|0,s=s+Math.imul(y,$)|0;var ve=(d+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(h,V)|0))<<13)|0;d=((s=s+Math.imul(h,K)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,z))+Math.imul(w,U)|0,s=Math.imul(w,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,$)|0)+Math.imul(v,G)|0,s=s+Math.imul(v,$)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(y,V)|0,s=s+Math.imul(y,K)|0;var be=(d+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,X)|0)+Math.imul(h,Z)|0))<<13)|0;d=((s=s+Math.imul(h,X)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(S,U),n=(n=Math.imul(S,z))+Math.imul(T,U)|0,s=Math.imul(T,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,$)|0)+Math.imul(w,G)|0,s=s+Math.imul(w,$)|0,i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(v,V)|0,s=s+Math.imul(v,K)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(y,Z)|0,s=s+Math.imul(y,X)|0;var _e=(d+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,ee)|0)+Math.imul(h,Q)|0))<<13)|0;d=((s=s+Math.imul(h,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(M,U),n=(n=Math.imul(M,z))+Math.imul(R,U)|0,s=Math.imul(R,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,$)|0)+Math.imul(T,G)|0,s=s+Math.imul(T,$)|0,i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(w,V)|0,s=s+Math.imul(w,K)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(v,Z)|0,s=s+Math.imul(v,X)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,s=s+Math.imul(y,ee)|0;var we=(d+(i=i+Math.imul(c,re)|0)|0)+((8191&(n=(n=n+Math.imul(c,ie)|0)+Math.imul(h,re)|0))<<13)|0;d=((s=s+Math.imul(h,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(k,U),n=(n=Math.imul(k,z))+Math.imul(O,U)|0,s=Math.imul(O,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(R,G)|0,s=s+Math.imul(R,$)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Z)|0,s=s+Math.imul(w,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,s=s+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(y,re)|0,s=s+Math.imul(y,ie)|0;var Ee=(d+(i=i+Math.imul(c,se)|0)|0)+((8191&(n=(n=n+Math.imul(c,oe)|0)+Math.imul(h,se)|0))<<13)|0;d=((s=s+Math.imul(h,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,z))+Math.imul(P,U)|0,s=Math.imul(P,z),i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(O,G)|0,s=s+Math.imul(O,$)|0,i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,K)|0)+Math.imul(R,V)|0,s=s+Math.imul(R,K)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,s=s+Math.imul(w,ee)|0,i=i+Math.imul(m,re)|0,n=(n=n+Math.imul(m,ie)|0)+Math.imul(v,re)|0,s=s+Math.imul(v,ie)|0,i=i+Math.imul(p,se)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(y,se)|0,s=s+Math.imul(y,oe)|0;var Se=(d+(i=i+Math.imul(c,ue)|0)|0)+((8191&(n=(n=n+Math.imul(c,de)|0)+Math.imul(h,ue)|0))<<13)|0;d=((s=s+Math.imul(h,de)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,z))+Math.imul(B,U)|0,s=Math.imul(B,z),i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,$)|0)+Math.imul(P,G)|0,s=s+Math.imul(P,$)|0,i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,K)|0,i=i+Math.imul(M,Z)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,s=s+Math.imul(w,ie)|0,i=i+Math.imul(m,se)|0,n=(n=n+Math.imul(m,oe)|0)+Math.imul(v,se)|0,s=s+Math.imul(v,oe)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(y,ue)|0,s=s+Math.imul(y,de)|0;var Te=(d+(i=i+Math.imul(c,ce)|0)|0)+((8191&(n=(n=n+Math.imul(c,he)|0)+Math.imul(h,ce)|0))<<13)|0;d=((s=s+Math.imul(h,he)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,U),n=(n=Math.imul(L,z))+Math.imul(j,U)|0,s=Math.imul(j,z),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,$)|0)+Math.imul(B,G)|0,s=s+Math.imul(B,$)|0,i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,K)|0,i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(O,Z)|0,s=s+Math.imul(O,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(R,Q)|0,s=s+Math.imul(R,ee)|0,i=i+Math.imul(S,re)|0,n=(n=n+Math.imul(S,ie)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ie)|0,i=i+Math.imul(_,se)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(w,se)|0,s=s+Math.imul(w,oe)|0,i=i+Math.imul(m,ue)|0,n=(n=n+Math.imul(m,de)|0)+Math.imul(v,ue)|0,s=s+Math.imul(v,de)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,he)|0)+Math.imul(y,ce)|0,s=s+Math.imul(y,he)|0;var Ae=(d+(i=i+Math.imul(c,pe)|0)|0)+((8191&(n=(n=n+Math.imul(c,ye)|0)+Math.imul(h,pe)|0))<<13)|0;d=((s=s+Math.imul(h,ye)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,$))+Math.imul(j,G)|0,s=Math.imul(j,$),i=i+Math.imul(D,V)|0,n=(n=n+Math.imul(D,K)|0)+Math.imul(B,V)|0,s=s+Math.imul(B,K)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,X)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,X)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,ee)|0,i=i+Math.imul(M,re)|0,n=(n=n+Math.imul(M,ie)|0)+Math.imul(R,re)|0,s=s+Math.imul(R,ie)|0,i=i+Math.imul(S,se)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(w,ue)|0,s=s+Math.imul(w,de)|0,i=i+Math.imul(m,ce)|0,n=(n=n+Math.imul(m,he)|0)+Math.imul(v,ce)|0,s=s+Math.imul(v,he)|0;var Me=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;d=((s=s+Math.imul(y,ye)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,K))+Math.imul(j,V)|0,s=Math.imul(j,K),i=i+Math.imul(D,Z)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(B,Z)|0,s=s+Math.imul(B,X)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(O,re)|0,s=s+Math.imul(O,ie)|0,i=i+Math.imul(M,se)|0,n=(n=n+Math.imul(M,oe)|0)+Math.imul(R,se)|0,s=s+Math.imul(R,oe)|0,i=i+Math.imul(S,ue)|0,n=(n=n+Math.imul(S,de)|0)+Math.imul(T,ue)|0,s=s+Math.imul(T,de)|0,i=i+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,he)|0)+Math.imul(w,ce)|0,s=s+Math.imul(w,he)|0;var Re=(d+(i=i+Math.imul(m,pe)|0)|0)+((8191&(n=(n=n+Math.imul(m,ye)|0)+Math.imul(v,pe)|0))<<13)|0;d=((s=s+Math.imul(v,ye)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,Z),n=(n=Math.imul(L,X))+Math.imul(j,Z)|0,s=Math.imul(j,X),i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(B,Q)|0,s=s+Math.imul(B,ee)|0,i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(P,re)|0,s=s+Math.imul(P,ie)|0,i=i+Math.imul(k,se)|0,n=(n=n+Math.imul(k,oe)|0)+Math.imul(O,se)|0,s=s+Math.imul(O,oe)|0,i=i+Math.imul(M,ue)|0,n=(n=n+Math.imul(M,de)|0)+Math.imul(R,ue)|0,s=s+Math.imul(R,de)|0,i=i+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,he)|0)+Math.imul(T,ce)|0,s=s+Math.imul(T,he)|0;var xe=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,ye)|0)+Math.imul(w,pe)|0))<<13)|0;d=((s=s+Math.imul(w,ye)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(j,Q)|0,s=Math.imul(j,ee),i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(B,re)|0,s=s+Math.imul(B,ie)|0,i=i+Math.imul(C,se)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,se)|0,s=s+Math.imul(P,oe)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,de)|0)+Math.imul(O,ue)|0,s=s+Math.imul(O,de)|0,i=i+Math.imul(M,ce)|0,n=(n=n+Math.imul(M,he)|0)+Math.imul(R,ce)|0,s=s+Math.imul(R,he)|0;var ke=(d+(i=i+Math.imul(S,pe)|0)|0)+((8191&(n=(n=n+Math.imul(S,ye)|0)+Math.imul(T,pe)|0))<<13)|0;d=((s=s+Math.imul(T,ye)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(j,re)|0,s=Math.imul(j,ie),i=i+Math.imul(D,se)|0,n=(n=n+Math.imul(D,oe)|0)+Math.imul(B,se)|0,s=s+Math.imul(B,oe)|0,i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,de)|0)+Math.imul(P,ue)|0,s=s+Math.imul(P,de)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,he)|0)+Math.imul(O,ce)|0,s=s+Math.imul(O,he)|0;var Oe=(d+(i=i+Math.imul(M,pe)|0)|0)+((8191&(n=(n=n+Math.imul(M,ye)|0)+Math.imul(R,pe)|0))<<13)|0;d=((s=s+Math.imul(R,ye)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,se),n=(n=Math.imul(L,oe))+Math.imul(j,se)|0,s=Math.imul(j,oe),i=i+Math.imul(D,ue)|0,n=(n=n+Math.imul(D,de)|0)+Math.imul(B,ue)|0,s=s+Math.imul(B,de)|0,i=i+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,he)|0)+Math.imul(P,ce)|0,s=s+Math.imul(P,he)|0;var Ie=(d+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,ye)|0)+Math.imul(O,pe)|0))<<13)|0;d=((s=s+Math.imul(O,ye)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,de))+Math.imul(j,ue)|0,s=Math.imul(j,de),i=i+Math.imul(D,ce)|0,n=(n=n+Math.imul(D,he)|0)+Math.imul(B,ce)|0,s=s+Math.imul(B,he)|0;var Ce=(d+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,ye)|0)+Math.imul(P,pe)|0))<<13)|0;d=((s=s+Math.imul(P,ye)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(L,ce),n=(n=Math.imul(L,he))+Math.imul(j,ce)|0,s=Math.imul(j,he);var Pe=(d+(i=i+Math.imul(D,pe)|0)|0)+((8191&(n=(n=n+Math.imul(D,ye)|0)+Math.imul(B,pe)|0))<<13)|0;d=((s=s+Math.imul(B,ye)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(d+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,ye))+Math.imul(j,pe)|0))<<13)|0;return d=((s=Math.imul(j,ye))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=me,u[2]=ve,u[3]=be,u[4]=_e,u[5]=we,u[6]=Ee,u[7]=Se,u[8]=Te,u[9]=Ae,u[10]=Me,u[11]=Re,u[12]=xe,u[13]=ke,u[14]=Oe,u[15]=Ie,u[16]=Ce,u[17]=Pe,u[18]=Ne,0!==d&&(u[19]=d,r.length++),r};function y(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=f),s.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):i<63?f(this,e,t):i<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,u=Math.min(s,t.length-1),d=Math.max(0,s-e.length+1);d<=u;d++){var l=s-d,c=(0|e.words[l])*(0|t.words[d]),h=67108863&c;a=67108863&(h=h+a|0),n+=(o=(o=o+(c/67108864|0)|0)+(h>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,e,t):y(this,e,t),r},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},g.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},g.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o<s;o++)i[o]=t[e[o]],n[o]=r[e[o]]},g.prototype.transform=function(e,t,r,i,n,s){this.permute(s,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),d=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var c=u,h=d,f=0;f<o;f++){var p=r[l+f],y=i[l+f],g=r[l+f+o],m=i[l+f+o],v=c*g-h*m;m=c*m+h*g,g=v,r[l+f]=p+g,i[l+f]=y+m,r[l+f+o]=p-g,i[l+f+o]=y-m,f!==a&&(v=u*c-d*h,h=u*h+d*c,c=v)}},g.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},g.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},g.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},g.prototype.convert13b=function(e,t,r,n){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===s),i(0==(-8192&s))},g.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},g.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),s=this.stub(i),o=new Array(i),a=new Array(i),u=new Array(i),d=new Array(i),l=new Array(i),c=new Array(i),h=r.words;h.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,d,i),this.transform(o,s,a,u,i,n),this.transform(d,s,l,c,i,n);for(var f=0;f<i;f++){var p=a[f]*l[f]-u[f]*c[f];u[f]=a[f]*c[f]+u[f]*l[f],a[f]=p}return this.conjugate(a,u,i),this.transform(a,u,h,s,i,n),this.conjugate(h,s,i),this.normalize13b(h,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),y(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,s=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=s>>>26,this.words[r]=67108863&s}return 0!==t&&(this.words[r]=t,this.length++),this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,u=(0|this.words[t])-a<<r;this.words[t]=u|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,u=r;if(n-=o,n=Math.max(0,n),u){for(var d=0;d<o;d++)u.words[d]=this.words[d];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,d=0;d<this.length;d++)this.words[d]=this.words[d+o];else this.words[0]=0,this.length=1;var l=0;for(d=this.length-1;d>=0&&(0!==l||d>=n);d--){var c=0|this.words[d];this.words[d]=l<<26-s|c>>>s,l=c&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r||!(this.words[r]&n))},s.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var n,s,o=e.length+r;this._expand(o);var a=0;for(n=0;n<e.length;n++){s=(0|this.words[n+r])+a;var u=(0|e.words[n])*t;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==t){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var d=0;d<a.length;d++)a.words[d]=0}var l=i.clone()._ishlnsubmul(n,1,u);0===l.negative&&(i=l,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var h=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(h=Math.min(h/o|0,67108863),i._ishlnsubmul(n,h,c);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=h)}return a&&a.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},s.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var l=r.clone(),c=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(c)),a.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(u)):(r.isub(t),a.isub(n),u.isub(o))}return{a,b:u,gcd:r.iushln(d)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new s(1),a=new s(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,l=1;0==(t.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(t.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(n=0===t.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(e),n},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new S(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(b,v),b.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[n-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(w,v),n(E,v),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new _;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return m[e]=t,t},S.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),d=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);0!==this.pow(l,d).cmp(u);)l.redIAdd(u);for(var c=this.pow(l,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=o;0!==f.cmp(a);){for(var y=f,g=0;0!==y.cmp(a);g++)y=y.redSqr();i(g<p);var m=this.pow(c,new s(1).iushln(p-g-1));h=h.redMul(m),c=m.redSqr(),f=f.redMul(c),p=g}return h},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],l=u-1;l>=0;l--){var c=d>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4==++a||0===i&&0===l)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}u=26}return n},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new T(e)},n(T,S),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},2745:(e,t,r)=>{var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var s=r(8087);if("function"!=typeof s.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return s.randomBytes(e)}}catch(e){}},8834:(e,t,r)=>{"use strict";const i=r(5766),n=r(2333),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return d(e,t,r)}function d(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let i=a(r);const n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return u.from(i,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,u.prototype),i}function p(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(n)return i?-1:W(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return M(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function v(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,i,n){let s,o=1,a=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,r/=2}function d(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){let i=-1;for(s=r;s<a;s++)if(d(e,s)===d(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===u)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){let r=!0;for(let i=0;i<u;i++)if(d(e,s+i)!==d(t,i)){r=!1;break}if(r)return s}return-1}function _(e,t,r,i){r=Number(r)||0;const n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(Z(i))return o;e[r+o]=i}return o}function w(e,t,r,i){return K(W(t,e.length-r),e,r,i)}function E(e,t,r,i){return K(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function S(e,t,r,i){return K(V(t),e,r,i)}function T(e,t,r,i){return K(function(e,t){let r,i,n;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function A(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function M(e,t,r){r=Math.min(e.length,r);const i=[];let n=t;for(;n<r;){const t=e[n];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(n+o<=r){let r,i,a,u;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(s=u));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(u=(15&t)<<12|(63&r)<<6|63&i,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(u=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,u>65535&&u<1114112&&(s=u))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=R));return r}(i)}t.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){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(e,t,r){return d(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},u.allocUnsafe=function(e){return c(e)},u.allocUnsafeSlow=function(e){return c(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},u.isEncoding=function(e){switch(String(e).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(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const i=u.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))n+t.length>i.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?M(this,0,e):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(u.prototype[s]=u.prototype.inspect),u.prototype.compare=function(e,t,r,i,n){if(Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0);const a=Math.min(s,o),d=this.slice(i,n),l=e.slice(t,r);for(let e=0;e<a;++e)if(d[e]!==l[e]){s=d[e],o=l[e];break}return s<o?-1:o<s?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},u.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function x(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function k(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function O(e,t,r){const i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i<r;++i)n+=X[e[i]];return n}function I(e,t,r){const i=e.slice(t,r);let n="";for(let e=0;e<i.length-1;e+=2)n+=String.fromCharCode(i[e]+256*i[e+1]);return n}function C(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,i,n,s){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function N(e,t,r,i,n){z(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function D(e,t,r,i,n){z(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function B(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function q(e,t,r,i,s){return t=+t,r>>>=0,s||B(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function L(e,t,r,i,s){return t=+t,r>>>=0,s||B(e,0,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,u.prototype),i},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return i},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),u.prototype.readBigUInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let i=t,n=1,s=this[e+--i];for(;i>0&&(n*=256);)s+=this[e+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||P(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||P(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}let n=0,s=1,o=0;for(this[t]=255&e;++n<r&&(s*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return q(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return q(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,i){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);const n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},u.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const s=u.isBuffer(e)?e:u.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%o]}return this};const j={};function F(e,t,r){j[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function U(e){let t="",r=e.length;const i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function z(e,t,r,i,n,s){if(e>r||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new j.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(i,n,s)}function H(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw H(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=U(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=U(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i}),RangeError);const $=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const i=e.length;let n=null;const s=[];for(let o=0;o<i;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const X=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function J(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},9396:function(e,t,r){var i,n,s;n=[r(6874)],i=function(e){"use strict";var t=function(e,r,n){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===r&&(r=t.DEFAULT_ENDIAN),void 0===n&&(n=t.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");r=!!r,n=!!n}this.buffer=0===e?i:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=r,this.noAssert=n};t.VERSION="5.0.1",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var r=t.prototype;r.__isByteBuffer__,Object.defineProperty(r,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var i=new ArrayBuffer(0),n=String.fromCharCode;function s(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function o(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+n.apply(String,e);e.length+arguments.length>1024&&(t.push(n.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,r,i,n){var s,o,a=8*n-i-1,u=(1<<a)-1,d=u>>1,l=-7,c=r?n-1:0,h=r?-1:1,f=e[t+c];for(c+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+c],c+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+c],c+=h,l-=8);if(0===s)s=1-d;else{if(s===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),s-=d}return(f?-1:1)*o*Math.pow(2,s-i)}function u(e,t,r,i,n,s){var o,a,u,d=8*s-n-1,l=(1<<d)-1,c=l>>1,h=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*u-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,d+=n;d>0;e[r+f]=255&o,f+=p,o/=256,d-=8);e[r+f-p]|=128*y}t.accessor=function(){return Uint8Array},t.allocate=function(e,r,i){return new t(e,r,i)},t.concat=function(e,r,i,n){"boolean"!=typeof r&&"string"==typeof r||(n=i,i=r,r=void 0);for(var s,o=0,a=0,u=e.length;a<u;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],r)),(s=e[a].limit-e[a].offset)>0&&(o+=s);if(0===o)return new t(0,i,n);var d,l=new t(o,i,n);for(a=0;a<u;)(s=(d=e[a++]).limit-d.offset)<=0||(l.view.set(d.view.subarray(d.offset,d.limit),l.offset),l.offset+=s);return l.limit=l.offset,l.offset=0,l},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,i,n,s){if("string"!=typeof i&&(s=n,n=i,i=void 0),"string"==typeof e)switch(void 0===i&&(i="utf8"),i){case"base64":return t.fromBase64(e,n);case"hex":return t.fromHex(e,n);case"binary":return t.fromBinary(e,n);case"utf8":return t.fromUTF8(e,n);case"debug":return t.fromDebug(e,n);default:throw Error("Unsupported encoding: "+i)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var o;if(t.isByteBuffer(e))return(o=r.clone.call(e)).markedOffset=-1,o;if(e instanceof Uint8Array)o=new t(0,n,s),e.length>0&&(o.buffer=e.buffer,o.offset=e.byteOffset,o.limit=e.byteOffset+e.byteLength,o.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)o=new t(0,n,s),e.byteLength>0&&(o.buffer=e,o.offset=0,o.limit=e.byteLength,o.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");(o=new t(e.length,n,s)).limit=e.length;for(var a=0;a<e.length;++a)o.view[a]=e[a]}return o},r.writeBitSet=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,n=t,s=e.length,o=s>>3,a=0;for(t+=this.writeVarint32(s,t);o--;)i=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(i,t++);if(a<s){var u=0;for(i=0;a<s;)i|=(1&!!e[a++])<<u++;this.writeByte(i,t++)}return r?(this.offset=t,this):t-n},r.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var r,i=this.readVarint32(e),n=i.value,s=n>>3,o=0,a=[];for(e+=i.length;s--;)r=this.readByte(e++),a[o++]=!!(1&r),a[o++]=!!(2&r),a[o++]=!!(4&r),a[o++]=!!(8&r),a[o++]=!!(16&r),a[o++]=!!(32&r),a[o++]=!!(64&r),a[o++]=!!(128&r);if(o<n){var u=0;for(r=this.readByte(e++);o<n;)a[o++]=!!(r>>u++&1)}return t&&(this.offset=e),a},r.readBytes=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var i=this.slice(t,t+e);return r&&(this.offset+=e),i},r.writeBytes=r.append,r.writeInt8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeByte=r.writeInt8,r.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return 128==(128&r)&&(r=-(255-r+1)),t&&(this.offset+=1),r},r.readByte=r.readInt8,r.writeUint8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeUInt8=r.writeUint8,r.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return t&&(this.offset+=1),r},r.readUInt8=r.readUint8,r.writeInt16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeShort=r.writeInt16,r.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),32768==(32768&r)&&(r=-(65535-r+1)),t&&(this.offset+=2),r},r.readShort=r.readInt16,r.writeUint16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeUInt16=r.writeUint16,r.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),t&&(this.offset+=2),r},r.readUInt16=r.readUint16,r.writeInt32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeInt=r.writeInt32,r.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),r|=0,t&&(this.offset+=4),r},r.readInt=r.readInt32,r.writeUint32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeUInt32=r.writeUint32,r.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),t&&(this.offset+=4),r},r.readUInt32=r.readUint32,e&&(r.writeInt64=function(t,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var n=this.buffer.byteLength;r>n&&this.resize((n*=2)>r?n:r),r-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[r+3]=s>>>24&255,this.view[r+2]=s>>>16&255,this.view[r+1]=s>>>8&255,this.view[r]=255&s,r+=4,this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o):(this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o,r+=4,this.view[r]=s>>>24&255,this.view[r+1]=s>>>16&255,this.view[r+2]=s>>>8&255,this.view[r+3]=255&s),i&&(this.offset+=8),this},r.writeLong=r.writeInt64,r.readInt64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var i=0,n=0;this.littleEndian?(i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0);var s=new e(i,n,!1);return r&&(this.offset+=8),s},r.readLong=r.readInt64,r.writeUint64=function(t,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var n=this.buffer.byteLength;r>n&&this.resize((n*=2)>r?n:r),r-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[r+3]=s>>>24&255,this.view[r+2]=s>>>16&255,this.view[r+1]=s>>>8&255,this.view[r]=255&s,r+=4,this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o):(this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o,r+=4,this.view[r]=s>>>24&255,this.view[r+1]=s>>>16&255,this.view[r+2]=s>>>8&255,this.view[r+3]=255&s),i&&(this.offset+=8),this},r.writeUInt64=r.writeUint64,r.readUint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var i=0,n=0;this.littleEndian?(i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0);var s=new e(i,n,!0);return r&&(this.offset+=8),s},r.readUInt64=r.readUint64),r.writeFloat32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,u(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},r.writeFloat=r.writeFloat32,r.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=a(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),r},r.readFloat=r.readFloat32,r.writeFloat64=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=8,u(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},r.writeDouble=r.writeFloat64,r.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var r=a(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),r},r.readDouble=r.readFloat64,t.MAX_VARINT32_BYTES=5,t.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},t.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},t.zigZagDecode32=function(e){return e>>>1^-(1&e)|0},r.writeVarint32=function(e,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,s=t.calculateVarint32(e);r+=s;var o=this.buffer.byteLength;for(r>o&&this.resize((o*=2)>r?o:r),r-=s,e>>>=0;e>=128;)n=127&e|128,this.view[r++]=n,e>>>=7;return this.view[r++]=e,i?(this.offset=r,this):s},r.writeVarint32ZigZag=function(e,r){return this.writeVarint32(t.zigZagEncode32(e),r)},r.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=0,n=0;do{if(!this.noAssert&&e>this.limit){var s=Error("Truncated");throw s.truncated=!0,s}r=this.view[e++],i<5&&(n|=(127&r)<<7*i),++i}while(0!=(128&r));return n|=0,t?(this.offset=e,n):{value:n,length:i}},r.readVarint32ZigZag=function(e){var r=this.readVarint32(e);return"object"==typeof r?r.value=t.zigZagDecode32(r.value):r=t.zigZagDecode32(r),r},e&&(t.MAX_VARINT64_BYTES=10,t.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var r=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,n=t.shiftRightUnsigned(56).toInt()>>>0;return 0==n?0==i?r<16384?r<128?1:2:r<1<<21?3:4:i<16384?i<128?5:6:i<1<<21?7:8:n<128?9:10},t.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},t.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},r.writeVarint64=function(r,i){var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"==typeof r)r=e.fromNumber(r);else if("string"==typeof r)r=e.fromString(r);else if(!(r&&r instanceof e))throw TypeError("Illegal value: "+r+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof r?r=e.fromNumber(r,!1):"string"==typeof r?r=e.fromString(r,!1):!1!==r.unsigned&&(r=r.toSigned());var s=t.calculateVarint64(r),o=r.toInt()>>>0,a=r.shiftRightUnsigned(28).toInt()>>>0,u=r.shiftRightUnsigned(56).toInt()>>>0;i+=s;var d=this.buffer.byteLength;switch(i>d&&this.resize((d*=2)>i?d:i),i-=s,s){case 10:this.view[i+9]=u>>>7&1;case 9:this.view[i+8]=9!==s?128|u:127&u;case 8:this.view[i+7]=8!==s?a>>>21|128:a>>>21&127;case 7:this.view[i+6]=7!==s?a>>>14|128:a>>>14&127;case 6:this.view[i+5]=6!==s?a>>>7|128:a>>>7&127;case 5:this.view[i+4]=5!==s?128|a:127&a;case 4:this.view[i+3]=4!==s?o>>>21|128:o>>>21&127;case 3:this.view[i+2]=3!==s?o>>>14|128:o>>>14&127;case 2:this.view[i+1]=2!==s?o>>>7|128:o>>>7&127;case 1:this.view[i]=1!==s?128|o:127&o}return n?(this.offset+=s,this):s},r.writeVarint64ZigZag=function(e,r){return this.writeVarint64(t.zigZagEncode64(e),r)},r.readVarint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var i=t,n=0,s=0,o=0,a=0;if(n=127&(a=this.view[t++]),128&a&&(n|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(s=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(o=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(o|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");var u=e.fromBits(n|s<<28,s>>>4|o<<24,!1);return r?(this.offset=t,u):{value:u,length:t-i}},r.readVarint64ZigZag=function(r){var i=this.readVarint64(r);return i&&i.value instanceof e?i.value=t.zigZagDecode64(i.value):i=t.zigZagDecode64(i),i}),r.writeCString=function(e,t){var r=void 0===t;r&&(t=this.offset);var i,n=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;i<n;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}n=l.calculateUTF16asUTF8(s(e))[1],t+=n+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=n+1,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,r?(this.offset=t,this):n},r.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=e,n=-1;return l.decodeUTF8toUTF16(function(){if(0===n)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(n=this.view[e++])?null:n}.bind(this),r=o(),!0),t?(this.offset=e,r()):{string:r(),length:e-i}},r.writeIString=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,n=t;i=l.calculateUTF16asUTF8(s(e),this.noAssert)[1],t+=4+i;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+i,this.littleEndian?(this.view[t+3]=i>>>24&255,this.view[t+2]=i>>>16&255,this.view[t+1]=i>>>8&255,this.view[t]=255&i):(this.view[t]=i>>>24&255,this.view[t+1]=i>>>16&255,this.view[t+2]=i>>>8&255,this.view[t+3]=255&i),t+=4,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),t!==n+4+i)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+i));return r?(this.offset=t,this):t-n},r.readIString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=e,n=this.readUint32(e),s=this.readUTF8String(n,t.METRICS_BYTES,e+=4);return e+=s.length,r?(this.offset=e,s.string):{string:s.string,length:e-i}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",r.writeUTF8String=function(e,t){var r,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n=t;r=l.calculateUTF16asUTF8(s(e))[1],t+=r;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=r,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),i?(this.offset=t,this):t-n},r.writeString=r.writeUTF8String,t.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(s(e))[0]},t.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(s(e))[1]},t.calculateString=t.calculateUTF8Bytes,r.readUTF8String=function(e,r,i){"number"==typeof r&&(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),void 0===r&&(r=t.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var s,a=0,u=i;if(r===t.METRICS_CHARS){if(s=o(),l.decodeUTF8(function(){return a<e&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++a,l.UTF8toUTF16(e,s)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return n?(this.offset=i,s()):{string:s(),length:i-u}}if(r===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}var d=i+e;if(l.decodeUTF8toUTF16(function(){return i<d?this.view[i++]:null}.bind(this),s=o(),this.noAssert),i!==d)throw RangeError("Illegal range: Truncated data, "+i+" == "+d);return n?(this.offset=i,s()):{string:s(),length:i-u}}throw TypeError("Unsupported metrics: "+r)},r.readString=r.readUTF8String,r.writeVString=function(e,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,o,a=r;n=l.calculateUTF16asUTF8(s(e),this.noAssert)[1],o=t.calculateVarint32(n),r+=o+n;var u=this.buffer.byteLength;if(r>u&&this.resize((u*=2)>r?u:r),r-=o+n,r+=this.writeVarint32(n,r),l.encodeUTF16toUTF8(s(e),function(e){this.view[r++]=e}.bind(this)),r!==a+n+o)throw RangeError("Illegal range: Truncated data, "+r+" == "+(r+n+o));return i?(this.offset=r,this):r-a},r.readVString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=e,n=this.readVarint32(e),s=this.readUTF8String(n.value,t.METRICS_BYTES,e+=n.length);return e+=s.length,r?(this.offset=e,s.string):{string:s.string,length:e-i}},r.append=function(e,r,i){"number"!=typeof r&&"string"==typeof r||(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var s=e.limit-e.offset;if(s<=0)return this;i+=s;var o=this.buffer.byteLength;return i>o&&this.resize((o*=2)>i?o:i),i-=s,this.view.set(e.view.subarray(e.offset,e.limit),i),e.offset+=s,n&&(this.offset+=s),this},r.appendTo=function(e,t){return e.append(this,t),this},r.assert=function(e){return this.noAssert=!e,this},r.capacity=function(){return this.buffer.byteLength},r.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},r.clone=function(e){var r=new t(0,this.littleEndian,this.noAssert);return e?(r.buffer=new ArrayBuffer(this.buffer.byteLength),r.view=new Uint8Array(r.buffer)):(r.buffer=this.buffer,r.view=this.view),r.offset=this.offset,r.markedOffset=this.markedOffset,r.limit=this.limit,r},r.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var r=t-e;if(0===r)return this.buffer=i,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var n=new ArrayBuffer(r),s=new Uint8Array(n);return s.set(this.view.subarray(e,t)),this.buffer=n,this.view=s,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=r,this},r.copy=function(e,r){if(void 0===e&&(e=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,e<0||e>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}if(e===r)return new t(0,this.littleEndian,this.noAssert);var i=r-e,n=new t(i,this.littleEndian,this.noAssert);return n.offset=0,n.limit=i,n.markedOffset>=0&&(n.markedOffset-=e),this.copyTo(n,0,e,r),n},r.copyTo=function(e,r,i,n){var s,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(r=(o=void 0===r)?e.offset:0|r,i=(s=void 0===i)?this.offset:0|i,n=void 0===n?this.limit:0|n,r<0||r>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+r+" <= "+e.buffer.byteLength);if(i<0||n>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+i+" <= "+this.buffer.byteLength);var a=n-i;return 0===a?e:(e.ensureCapacity(r+a),e.view.set(this.view.subarray(i,n),r),s&&(this.offset+=a),o&&(e.offset+=a),this)},r.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},r.fill=function(e,t,r){var i=void 0===t;if(i&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(t>=r)return this;for(;t<r;)this.view[t++]=e;return i&&(this.offset=t),this},r.flip=function(){return this.limit=this.offset,this.offset=0,this},r.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},r.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},r.LE=function(e){return this.littleEndian=void 0===e||!!e,this},r.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},r.prepend=function(e,r,i){"number"!=typeof r&&"string"==typeof r||(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var s=e.limit-e.offset;if(s<=0)return this;var o=s-i;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),u=new Uint8Array(a);u.set(this.view.subarray(i,this.buffer.byteLength),s),this.buffer=a,this.view=u,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,i+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),i-s),e.offset=e.limit,n&&(this.offset-=s),this},r.prependTo=function(e,t){return e.prepend(this,t),this},r.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},r.remaining=function(){return this.limit-this.offset},r.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},r.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),r=new Uint8Array(t);r.set(this.view),this.buffer=t,this.view=r}return this},r.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},r.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},r.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r=this.clone();return r.offset=e,r.limit=t,r},r.toBuffer=function(e){var t=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(!e&&0===t&&r===this.buffer.byteLength)return this.buffer;if(t===r)return i;var n=new ArrayBuffer(r-t);return new Uint8Array(n).set(new Uint8Array(this.buffer).subarray(t,r),0),n},r.toArrayBuffer=r.toBuffer,r.toString=function(e,t,r){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(r=t=e="utf8"),e){case"utf8":return this.toUTF8(t,r);case"base64":return this.toBase64(t,r);case"hex":return this.toHex(t,r);case"binary":return this.toBinary(t,r);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var d=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[],i=0,n=t.length;i<n;++i)r[t[i]]=i;return e.encode=function(e,r){for(var i,n;null!==(i=e());)r(t[i>>2&63]),n=(3&i)<<4,null!==(i=e())?(r(t[63&((n|=i>>4&15)|i>>4&15)]),n=(15&i)<<2,null!==(i=e())?(r(t[63&(n|i>>6&3)]),r(t[63&i])):(r(t[63&n]),r(61))):(r(t[63&n]),r(61),r(61))},e.decode=function(e,t){var i,n,s;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(i=e());)if(void 0===(n=r[i])&&o(i),null!==(i=e())&&(void 0===(s=r[i])&&o(i),t(n<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(n=r[i])){if(61===i)break;o(i)}if(t((15&s)<<4>>>0|(60&n)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;o(i)}t((3&n)<<6>>>0|s)}}},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},e}();r.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return d.encode(function(){return e<t?this.view[e++]:null}.bind(this),r=o()),r()},t.fromBase64=function(e,r){if("string"!=typeof e)throw TypeError("str");var i=new t(e.length/4*3,r),n=0;return d.decode(s(e),(function(e){i.view[n++]=e})),i.limit=n,i},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},r.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var r=[],i=[];e<t;)r.push(this.view[e++]),r.length>=1024&&(i.push(String.fromCharCode.apply(String,r)),r=[]);return i.join("")+String.fromCharCode.apply(String,r)},t.fromBinary=function(e,r){if("string"!=typeof e)throw TypeError("str");for(var i,n=0,s=e.length,o=new t(s,r);n<s;){if((i=e.charCodeAt(n))>255)throw RangeError("illegal char code: "+i);o.view[n++]=i}return o.limit=s,o},r.toDebug=function(e){for(var t,r=-1,i=this.buffer.byteLength,n="",s="",o="";r<i;){if(-1!==r&&(n+=(t=this.view[r])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++r,e&&r>0&&r%16==0&&r!==i){for(;n.length<51;)n+=" ";o+=n+s+"\n",n=s=""}r===this.offset&&r===this.limit?n+=r===this.markedOffset?"!":"|":r===this.offset?n+=r===this.markedOffset?"[":"<":r===this.limit?n+=r===this.markedOffset?"]":">":n+=r===this.markedOffset?"'":e||0!==r&&r!==i?" ":""}if(e&&" "!==n){for(;n.length<51;)n+=" ";o+=n+s+"\n"}return e?o:n},t.fromDebug=function(e,r,i){for(var n,s,o=e.length,a=new t((o+1)/3|0,r,i),u=0,d=0,l=!1,c=!1,h=!1,f=!1,p=!1;u<o;){switch(n=e.charAt(u++)){case"!":if(!i){if(c||h||f){p=!0;break}c=h=f=!0}a.offset=a.markedOffset=a.limit=d,l=!1;break;case"|":if(!i){if(c||f){p=!0;break}c=f=!0}a.offset=a.limit=d,l=!1;break;case"[":if(!i){if(c||h){p=!0;break}c=h=!0}a.offset=a.markedOffset=d,l=!1;break;case"<":if(!i){if(c){p=!0;break}c=!0}a.offset=d,l=!1;break;case"]":if(!i){if(f||h){p=!0;break}f=h=!0}a.limit=a.markedOffset=d,l=!1;break;case">":if(!i){if(f){p=!0;break}f=!0}a.limit=d,l=!1;break;case"'":if(!i){if(h){p=!0;break}h=!0}a.markedOffset=d,l=!1;break;case" ":l=!1;break;default:if(!i&&l){p=!0;break}if(s=parseInt(n+e.charAt(u++),16),!i&&(isNaN(s)||s<0||s>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[d++]=s,l=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+u)}if(!i){if(!c||!f)throw TypeError("Illegal str: Missing offset or limit");if(d<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+d+" < "+o)}return a},r.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var r,i=new Array(t-e);e<t;)(r=this.view[e++])<16?i.push("0",r.toString(16)):i.push(r.toString(16));return i.join("")},t.fromHex=function(e,r,i){if(!i){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var n,s=e.length,o=new t(s/2|0,r),a=0,u=0;a<s;a+=2){if(n=parseInt(e.substring(a,a+2),16),!i&&(!isFinite(n)||n<0||n>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[u++]=n}return o.limit=u,o};var l=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<128?t(127&r):r<2048?(t(r>>6&31|192),t(63&r|128)):r<65536?(t(r>>12&15|224),t(r>>6&63|128),t(63&r|128)):(t(r>>18&7|240),t(r>>12&63|128),t(r>>6&63|128),t(63&r|128)),r=null},decodeUTF8:function(e,t){for(var r,i,n,s,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(r=e());)if(0==(128&r))t(r);else if(192==(224&r))null===(i=e())&&o([r,i]),t((31&r)<<6|63&i);else if(224==(240&r))(null===(i=e())||null===(n=e()))&&o([r,i,n]),t((15&r)<<12|(63&i)<<6|63&n);else{if(240!=(248&r))throw RangeError("Illegal starting byte: "+r);(null===(i=e())||null===(n=e())||null===(s=e()))&&o([r,i,n,s]),t((7&r)<<18|(63&i)<<12|(63&n)<<6|63&s)}},UTF16toUTF8:function(e,t){for(var r,i=null;null!==(r=null!==i?i:e());)r>=55296&&r<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(r-55296)+i-56320+65536),i=null):t(r);null!==i&&t(i)},UTF8toUTF16:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<=65535?t(r):(t(55296+((r-=65536)>>10)),t(r%1024+56320)),r=null},encodeUTF16toUTF8:function(t,r){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,r)}))},decodeUTF8toUTF16:function(t,r){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,r)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,r=0;null!==(t=e());)r+=t<128?1:t<2048?2:t<65536?3:4;return r},calculateUTF16asUTF8:function(t){var r=0,i=0;return e.UTF16toUTF8(t,(function(e){++r,i+=e<128?1:e<2048?2:e<65536?3:4})),[r,i]}};return e}();return r.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),r=o())}catch(r){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},t.fromUTF8=function(e,r,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var n=new t(l.calculateUTF16asUTF8(s(e),!0)[1],r,i),o=0;return l.encodeUTF16toUTF8(s(e),(function(e){n.view[o++]=e})),n.limit=o,n},t},void 0===(s=i.apply(t,n))||(e.exports=s)},6874:function(e,t){var r,i;void 0===(i="function"==typeof(r=function(){"use strict";function e(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function t(e){return!0===(e&&e.__isLong__)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var r={},i={};function n(e,t){var n,s,a;return t?(a=0<=(e>>>=0)&&e<256)&&(s=i[e])?s:(n=o(e,(0|e)<0?-1:0,!0),a&&(i[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(s=r[e])?s:(n=o(e,e<0?-1:0,!1),a&&(r[e]=n),n)}function s(e,t){if(isNaN(e)||!isFinite(e))return t?y:p;if(t){if(e<0)return y;if(e>=c)return _}else{if(e<=-h)return w;if(e+1>=h)return b}return e<0?s(-e,t).neg():o(e%l|0,e/l|0,t)}function o(t,r,i){return new e(t,r,i)}e.fromInt=n,e.fromNumber=s,e.fromBits=o;var a=Math.pow;function u(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return u(e.substring(1),t,r).neg();for(var n=s(a(r,8)),o=p,d=0;d<e.length;d+=8){var l=Math.min(8,e.length-d),c=parseInt(e.substring(d,d+l),r);if(l<8){var h=s(a(r,l));o=o.mul(h).add(s(c))}else o=(o=o.mul(n)).add(s(c))}return o.unsigned=t,o}function d(t){return t instanceof e?t:"number"==typeof t?s(t):"string"==typeof t?u(t):o(t.low,t.high,t.unsigned)}e.fromString=u,e.fromValue=d;var l=4294967296,c=l*l,h=c/2,f=n(1<<24),p=n(0);e.ZERO=p;var y=n(0,!0);e.UZERO=y;var g=n(1);e.ONE=g;var m=n(1,!0);e.UONE=m;var v=n(-1);e.NEG_ONE=v;var b=o(-1,2147483647,!1);e.MAX_VALUE=b;var _=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var w=o(0,-2147483648,!1);e.MIN_VALUE=w;var E=e.prototype;return E.toInt=function(){return this.unsigned?this.low>>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},E.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(w)){var t=s(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=s(a(e,6),this.unsigned),o=this,u="";;){var d=o.div(n),l=(o.sub(d.mul(n)).toInt()>>>0).toString(e);if((o=d).isZero())return l+u;for(;l.length<6;)l="0"+l;u=""+l+u}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},E.isZero=function(){return 0===this.high&&0===this.low},E.isNegative=function(){return!this.unsigned&&this.high<0},E.isPositive=function(){return this.unsigned||this.high>=0},E.isOdd=function(){return 1==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(e){return t(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},E.eq=E.equals,E.notEquals=function(e){return!this.eq(e)},E.neq=E.notEquals,E.lessThan=function(e){return this.comp(e)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(e){return this.comp(e)<=0},E.lte=E.lessThanOrEqual,E.greaterThan=function(e){return this.comp(e)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(e){return this.comp(e)>=0},E.gte=E.greaterThanOrEqual,E.compare=function(e){if(t(e)||(e=d(e)),this.eq(e))return 0;var r=this.isNegative(),i=e.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},E.neg=E.negate,E.add=function(e){t(e)||(e=d(e));var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,l=e.low>>>16,c=0,h=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,h+=(f+=n+l)>>>16,c+=(h+=i+u)>>>16,c+=r+a,o((f&=65535)<<16|(p&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},E.subtract=function(e){return t(e)||(e=d(e)),this.add(e.neg())},E.sub=E.subtract,E.multiply=function(e){if(this.isZero())return p;if(t(e)||(e=d(e)),e.isZero())return p;if(this.eq(w))return e.isOdd()?w:p;if(e.eq(w))return this.isOdd()?w:p;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(f)&&e.lt(f))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,c=e.low>>>16,h=65535&e.low,y=0,g=0,m=0,v=0;return m+=(v+=a*h)>>>16,g+=(m+=n*h)>>>16,m&=65535,g+=(m+=a*c)>>>16,y+=(g+=i*h)>>>16,g&=65535,y+=(g+=n*c)>>>16,g&=65535,y+=(g+=a*l)>>>16,y+=r*h+i*c+n*l+a*u,o((m&=65535)<<16|(v&=65535),(y&=65535)<<16|(g&=65535),this.unsigned)},E.mul=E.multiply,E.divide=function(e){if(t(e)||(e=d(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:p;var r,i,n;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return m;n=y}else{if(this.eq(w))return e.eq(g)||e.eq(v)?w:e.eq(w)?g:(r=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?g:v:(i=this.sub(e.mul(r)),n=r.add(i.div(e)));if(e.eq(w))return this.unsigned?y:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=p}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),u=o<=48?1:a(2,o-48),l=s(r),c=l.mul(e);c.isNegative()||c.gt(i);)c=(l=s(r-=u,this.unsigned)).mul(e);l.isZero()&&(l=g),n=n.add(l),i=i.sub(c)}return n},E.div=E.divide,E.modulo=function(e){return t(e)||(e=d(e)),this.sub(this.div(e).mul(e))},E.mod=E.modulo,E.not=function(){return o(~this.low,~this.high,this.unsigned)},E.and=function(e){return t(e)||(e=d(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},E.or=function(e){return t(e)||(e=d(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},E.xor=function(e){return t(e)||(e=d(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},E.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):o(0,this.low<<e-32,this.unsigned)},E.shl=E.shiftLeft,E.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):o(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0==(e&=63))return this;var r=this.high;return e<32?o(this.low>>>e|r<<32-e,r>>>e,this.unsigned):o(32===e?r:r>>>e-32,0,this.unsigned)},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},E.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},E.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},E.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})?r.apply(t,[]):r)||(e.exports=i)},2680:(e,t,r)=>{"use strict";var i=r(6672),n=r(9429),s=n(i("String.prototype.indexOf"));e.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&s(e,".prototype.")>-1?n(r):r}},9429:(e,t,r)=>{"use strict";var i=r(4090),n=r(6672),s=n("%Function.prototype.apply%"),o=n("%Function.prototype.call%"),a=n("%Reflect.apply%",!0)||i.call(o,s),u=n("%Object.getOwnPropertyDescriptor%",!0),d=n("%Object.defineProperty%",!0),l=n("%Math.max%");if(d)try{d({},"a",{value:1})}catch(e){d=null}e.exports=function(e){var t=a(i,o,arguments);if(u&&d){var r=u(t,"length");r.configurable&&d(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var c=function(){return a(i,s,arguments)};d?d(e.exports,"apply",{value:c}):e.exports.apply=c},6672:(e,t,r)=>{"use strict";var i,n=r(6139).Promise,s=SyntaxError,o=Function,a=TypeError,u=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(e){d=null}var l=function(){throw new a},c=d?function(){try{return l}catch(e){try{return d(arguments,"callee").get}catch(e){return l}}}():l,h=r(2636)(),f=Object.getPrototypeOf||function(e){return e.__proto__},p={},y="undefined"==typeof Uint8Array?i:f(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":void 0===n?i:n,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):i,"%Symbol%":h?Symbol:i,"%SyntaxError%":s,"%ThrowTypeError%":c,"%TypedArray%":y,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet},m=function e(t){var r;if("%AsyncFunction%"===t)r=u("async function () {}");else if("%GeneratorFunction%"===t)r=u("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=u("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&(r=f(n.prototype))}return g[t]=r,r},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(4090),_=r(3198),w=b.call(Function.call,Array.prototype.concat),E=b.call(Function.apply,Array.prototype.splice),S=b.call(Function.call,String.prototype.replace),T=b.call(Function.call,String.prototype.slice),A=b.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,R=/\\(\\)?/g,x=function(e){var t=T(e,0,1),r=T(e,-1);if("%"===t&&"%"!==r)throw new s("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new s("invalid intrinsic syntax, expected opening `%`");var i=[];return S(e,M,(function(e,t,r,n){i[i.length]=r?S(n,R,"$1"):t||e})),i},k=function(e,t){var r,i=e;if(_(v,i)&&(i="%"+(r=v[i])[0]+"%"),_(g,i)){var n=g[i];if(n===p&&(n=m(i)),void 0===n&&!t)throw new a("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new s("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');if(null===A(/^%?[^%]*%?$/g,e))throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=x(e),i=r.length>0?r[0]:"",n=k("%"+i+"%",t),o=n.name,u=n.value,l=!1,c=n.alias;c&&(i=c[0],E(r,w([0,1],c)));for(var h=1,f=!0;h<r.length;h+=1){var p=r[h],y=T(p,0,1),m=T(p,-1);if(('"'===y||"'"===y||"`"===y||'"'===m||"'"===m||"`"===m)&&y!==m)throw new s("property names with quotes must have matching quotes");if("constructor"!==p&&f||(l=!0),_(g,o="%"+(i+="."+p)+"%"))u=g[o];else if(null!=u){if(!(p in u)){if(!t)throw new a("base intrinsic for "+e+" exists, but the property is not available.");return}if(d&&h+1>=r.length){var v=d(u,p);u=(f=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:u[p]}else f=_(u,p),u=u[p];f&&!l&&(g[o]=u)}}return u}},3973:(e,t,r)=>{var i=r(7834).Buffer,n=r(4851).Transform,s=r(3974).s;function o(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(1285)(o,n),o.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{r(i)}},o.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},o.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},o.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new s(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i},e.exports=o},6162:(e,t,r)=>{"use strict";var i=r(1285),n=r(7993),s=r(1445),o=r(9065),a=r(3973);function u(e){a.call(this,"digest"),this._hash=e}i(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new s:new u(o(e))}},4926:(e,t,r)=>{"use strict";var i=r(3464),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),s=Object.prototype.toString,o=Array.prototype.concat,a=Object.defineProperty,u=r(1181)(),d=a&&u,l=function(e,t,r,i){var n;(!(t in e)||"function"==typeof(n=i)&&"[object Function]"===s.call(n)&&i())&&(d?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},c=function(e,t){var r=arguments.length>2?arguments[2]:{},s=i(t);n&&(s=o.call(s,Object.getOwnPropertySymbols(t)));for(var a=0;a<s.length;a+=1)l(e,s[a],t[s[a]],r[s[a]])};c.supportsDescriptors=!!d,e.exports=c},7554:(e,t,r)=>{"use strict";var i=t;i.version=r(763).i8,i.utils=r(8288),i.rand=r(2745),i.curve=r(8610),i.curves=r(1479),i.ec=r(8596),i.eddsa=r(9208)},8919:(e,t,r)=>{"use strict";var i=r(2197),n=r(8288),s=n.getNAF,o=n.getJSF,a=n.assert;function u(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function d(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),i=s(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,u,d=[];for(o=0;o<i.length;o+=r.step){u=0;for(var l=o+r.step-1;l>=o;l--)u=(u<<1)+i[l];d.push(u)}for(var c=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=n;f>0;f--){for(o=0;o<d.length;o++)(u=d[o])===f?h=h.mixedAdd(r.points[o]):u===-f&&(h=h.mixedAdd(r.points[o].neg()));c=c.add(h)}return c.toP()},u.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=s(t,r,this._bitLength),u=this.jpoint(null,null,null),d=o.length-1;d>=0;d--){for(var l=0;d>=0&&0===o[d];d--)l++;if(d>=0&&l++,u=u.dblp(l),d<0)break;var c=o[d];a(0!==c),u="affine"===e.type?c>0?u.mixedAdd(n[c-1>>1]):u.mixedAdd(n[-c-1>>1].neg()):c>0?u.add(n[c-1>>1]):u.add(n[-c-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,i,n){var a,u,d,l=this._wnafT1,c=this._wnafT2,h=this._wnafT3,f=0;for(a=0;a<i;a++){var p=(d=t[a])._getNAFPoints(e);l[a]=p.wnd,c[a]=p.points}for(a=i-1;a>=1;a-=2){var y=a-1,g=a;if(1===l[y]&&1===l[g]){var m=[t[y],null,null,t[g]];0===t[y].y.cmp(t[g].y)?(m[1]=t[y].add(t[g]),m[2]=t[y].toJ().mixedAdd(t[g].neg())):0===t[y].y.cmp(t[g].y.redNeg())?(m[1]=t[y].toJ().mixedAdd(t[g]),m[2]=t[y].add(t[g].neg())):(m[1]=t[y].toJ().mixedAdd(t[g]),m[2]=t[y].toJ().mixedAdd(t[g].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],b=o(r[y],r[g]);for(f=Math.max(b[0].length,f),h[y]=new Array(f),h[g]=new Array(f),u=0;u<f;u++){var _=0|b[0][u],w=0|b[1][u];h[y][u]=v[3*(_+1)+(w+1)],h[g][u]=0,c[y]=m}}else h[y]=s(r[y],l[y],this._bitLength),h[g]=s(r[g],l[g],this._bitLength),f=Math.max(h[y].length,f),f=Math.max(h[g].length,f)}var E=this.jpoint(null,null,null),S=this._wnafT4;for(a=f;a>=0;a--){for(var T=0;a>=0;){var A=!0;for(u=0;u<i;u++)S[u]=0|h[u][a],0!==S[u]&&(A=!1);if(!A)break;T++,a--}if(a>=0&&T++,E=E.dblp(T),a<0)break;for(u=0;u<i;u++){var M=S[u];0!==M&&(M>0?d=c[u][M-1>>1]:M<0&&(d=c[u][-M-1>>1].neg()),E="affine"===d.type?E.mixedAdd(d):E.add(d))}}for(a=0;a<i;a++)c[a]=null;return n?E:E.toP()},u.BasePoint=d,d.prototype.eq=function(){throw new Error("Not implemented")},d.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=n.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?a(e[e.length-1]%2==0):7===e[0]&&a(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},d.prototype.encodeCompressed=function(e){return this.encode(e,!0)},d.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},d.prototype.encode=function(e,t){return n.encode(this._encode(t),e)},d.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},d.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},d.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var s=0;s<e;s++)i=i.dbl();r.push(i)}return{step:e,points:r}},d.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},d.prototype._getBeta=function(){return null},d.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},8416:(e,t,r)=>{"use strict";var i=r(8288),n=r(2197),s=r(1285),o=r(8919),a=i.assert;function u(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new n(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function d(e,t,r,i,s){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(t,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(u,o),e.exports=u,u.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},u.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},u.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(t&&!u||!t&&u)&&(a=a.redNeg()),this.point(e,a)},u.prototype.pointFromY=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},u.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},s(d,o.BasePoint),u.prototype.pointFromJSON=function(e){return d.fromJSON(this,e)},u.prototype.point=function(e,t,r,i){return new d(this,e,t,r,i)},d.fromJSON=function(e,t){return new d(e,t[0],t[1],t[2])},d.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},d.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},d.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=i.redAdd(t),o=s.redSub(r),a=i.redSub(t),u=n.redMul(o),d=s.redMul(a),l=n.redMul(a),c=o.redMul(s);return this.curve.point(u,d,c,l)},d.prototype._projDbl=function(){var e,t,r,i,n,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var d=(i=this.curve._mulA(a)).redAdd(u);this.zOne?(e=o.redSub(a).redSub(u).redMul(d.redSub(this.curve.two)),t=d.redMul(i.redSub(u)),r=d.redSqr().redSub(d).redSub(d)):(n=this.z.redSqr(),s=d.redSub(n).redISub(n),e=o.redSub(a).redISub(u).redMul(s),t=d.redMul(i.redSub(u)),r=d.redMul(s))}else i=a.redAdd(u),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),e=this.curve._mulC(o.redISub(i)).redMul(s),t=this.curve._mulC(i).redMul(a.redISub(u)),r=i.redMul(s);return this.curve.point(e,t,r)},d.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},d.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),s=r.redSub(t),o=n.redSub(i),a=n.redAdd(i),u=r.redAdd(t),d=s.redMul(o),l=a.redMul(u),c=s.redMul(u),h=o.redMul(a);return this.curve.point(d,l,h,c)},d.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(s).redMul(o),u=n.redSub(a),d=n.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),c=i.redMul(u).redMul(l);return this.curve.twisted?(t=i.redMul(d).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(d)):(t=i.redMul(d).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(d)),this.curve.point(c,t,r)},d.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},d.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},d.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},d.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},d.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},d.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},d.prototype.getX=function(){return this.normalize(),this.x.fromRed()},d.prototype.getY=function(){return this.normalize(),this.y.fromRed()},d.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},d.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},d.prototype.toP=d.prototype.normalize,d.prototype.mixedAdd=d.prototype.add},8610:(e,t,r)=>{"use strict";var i=t;i.base=r(8919),i.short=r(7715),i.mont=r(5125),i.edwards=r(8416)},5125:(e,t,r)=>{"use strict";var i=r(2197),n=r(1285),s=r(8919),o=r(8288);function a(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,s),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(u,s.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},a.prototype.point=function(e,t){return new u(this,e,t)},a.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),s=e.x.redSub(e.z).redMul(r),o=n.redMul(i),a=t.z.redMul(s.redAdd(o).redSqr()),u=t.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},7715:(e,t,r)=>{"use strict";var i=r(8288),n=r(2197),s=r(1285),o=r(8919),a=i.assert;function u(e){o.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function d(e,t,r,i){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,i){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(u,o),e.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new n(e.a,16),b:new n(e.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),s=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,i,s,o,a,u,d,l,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,f=this.n.clone(),p=new n(1),y=new n(0),g=new n(0),m=new n(1),v=0;0!==h.cmpn(0);){var b=f.div(h);d=f.sub(b.mul(h)),l=g.sub(b.mul(p));var _=m.sub(b.mul(y));if(!i&&d.cmp(c)<0)t=u.neg(),r=p,i=d.neg(),s=l;else if(i&&2==++v)break;u=d,f=h,h=d,g=p,p=l,m=y,y=_}o=d.neg(),a=l;var w=i.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=t,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),u=n.mul(r.b),d=s.mul(i.b);return{k1:e.sub(o).sub(a),k2:u.add(d).neg()}},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],u=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),i[2*s]=a,i[2*s+1]=u,n[2*s]=o.k1,n[2*s+1]=o.k2}for(var d=this._wnafMulAdd(1,i,n,2*s,r),l=0;l<2*s;l++)i[l]=null,n[l]=null;return d},s(d,o.BasePoint),u.prototype.point=function(e,t,r){return new d(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return d.fromJSON(this,e,t)},d.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},d.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},d.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var s=t[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},d.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},d.prototype.isInfinity=function(){return this.inf},d.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},d.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},d.prototype.getX=function(){return this.x.fromRed()},d.prototype.getY=function(){return this.y.fromRed()},d.prototype.mul=function(e){return e=new n(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},d.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},d.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},d.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},d.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},d.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(l,o.BasePoint),u.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=i.redSub(n),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=a.redSqr(),l=d.redMul(a),c=i.redMul(d),h=u.redSqr().redIAdd(l).redISub(c).redISub(c),f=u.redMul(c.redISub(h)).redISub(s.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),d=u.redMul(o),l=r.redMul(u),c=a.redSqr().redIAdd(d).redISub(l).redISub(l),h=a.redMul(l.redISub(c)).redISub(n.redMul(d)),f=this.z.redMul(o);return this.curve.jpoint(c,h,f)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,u=a.redSqr().redSqr(),d=o.redAdd(o);for(t=0;t<e;t++){var l=s.redSqr(),c=d.redSqr(),h=c.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(u)),p=s.redMul(c),y=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(y),m=f.redMul(g);m=m.redIAdd(m).redISub(h);var v=d.redMul(a);t+1<e&&(u=u.redMul(h)),s=y,a=v,d=m}return this.curve.jpoint(s,d.redMul(n),a)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),u=a.redSqr().redISub(o).redISub(o),d=s.redIAdd(s);d=(d=d.redIAdd(d)).redIAdd(d),e=u,t=a.redMul(o.redISub(u)).redISub(d),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),c=this.y.redSqr(),h=c.redSqr(),f=this.x.redAdd(c).redSqr().redISub(l).redISub(h);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=y.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},l.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),u=a.redSqr().redISub(o).redISub(o);e=u;var d=s.redIAdd(s);d=(d=d.redIAdd(d)).redIAdd(d),t=a.redMul(o.redISub(u)).redISub(d),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),c=this.y.redSqr(),h=this.x.redMul(c),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),y=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(l);var g=c.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=f.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(n)),u=t.redAdd(t),d=(u=u.redIAdd(u)).redMul(o),l=a.redSqr().redISub(d.redAdd(d)),c=d.redISub(l),h=o.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(c).redISub(h),p=r.redAdd(r).redMul(i);return this.curve.jpoint(l,f,p)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),s=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),u=i.redIAdd(i);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var d=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(u),l=t.redMul(d);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.x.redMul(a).redISub(l);c=(c=c.redIAdd(c)).redIAdd(c);var h=this.y.redMul(d.redMul(u.redISub(d)).redISub(o.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,h,f)},l.prototype.mul=function(e,t){return e=new n(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},l.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1479:(e,t,r)=>{"use strict";var i,n=t,s=r(4485),o=r(8610),a=r(8288).assert;function u(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function d(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,d("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),d("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),d("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),d("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),d("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),d("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),d("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(7983)}catch(e){i=void 0}d("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},8596:(e,t,r)=>{"use strict";var i=r(2197),n=r(8873),s=r(8288),o=r(1479),a=r(2745),u=s.assert,d=r(2307),l=r(1798);function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=c,c.prototype.keyPair=function(e){return new d(this,e)},c.prototype.keyFromPrivate=function(e,t){return d.fromPrivate(this,e,t)},c.prototype.keyFromPublic=function(e,t){return d.fromPublic(this,e,t)},c.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var o=new i(t.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},c.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},c.prototype.sign=function(e,t,r,s){"object"==typeof r&&(s=r,r=null),s||(s={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new i(e,16));for(var o=this.n.byteLength(),a=t.getPrivate().toArray("be",o),u=e.toArray("be",o),d=new n({hash:this.hash,entropy:a,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),c=this.n.sub(new i(1)),h=0;;h++){var f=s.k?s.k(h):new i(d.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var y=p.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var m=f.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==y.cmp(g)?2:0);return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),v^=1),new l({r:g,s:m,recoveryParam:v})}}}}}},c.prototype.verify=function(e,t,r,n){e=this._truncateToN(new i(e,16)),r=this.keyFromPublic(r,n);var s=(t=new l(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,u=o.invm(this.n),d=u.mul(e).umod(this.n),c=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(d,r.getPublic(),c)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(d,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},c.prototype.recoverPubKey=function(e,t,r,n){u((3&r)===r,"The recovery param is more than two bits"),t=new l(t,n);var s=this.n,o=new i(e),a=t.r,d=t.s,c=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var f=t.r.invm(s),p=s.sub(o).mul(f).umod(s),y=d.mul(f).umod(s);return this.g.mulAdd(p,a,y)},c.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new l(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(e,t,n)}catch(e){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},2307:(e,t,r)=>{"use strict";var i=r(2197),n=r(8288).assert;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function(e,t,r){return t instanceof s?t:new s(e,{pub:t,pubEnc:r})},s.fromPrivate=function(e,t,r){return t instanceof s?t:new s(e,{priv:t,privEnc:r})},s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},s.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},s.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},s.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},s.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},1798:(e,t,r)=>{"use strict";var i=r(2197),n=r(8288),s=n.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,s=0,o=t.place;s<i;s++,o++)n<<=8,n|=e[o],n>>>=0;return!(n<=127)&&(t.place=o,n)}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function l(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=o,o.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var s=u(e,r);if(!1===s)return!1;if(s+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;var d=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var l=u(e,r);if(!1===l)return!1;if(e.length!==l+r.place)return!1;var c=e.slice(r.place,l+r.place);if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new i(d),this.s=new i(c),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];l(i,t.length),(i=i.concat(t)).push(2),l(i,r.length);var s=i.concat(r),o=[48];return l(o,s.length),o=o.concat(s),n.encode(o,e)}},9208:(e,t,r)=>{"use strict";var i=r(4485),n=r(1479),s=r(8288),o=s.assert,a=s.parseBytes,u=r(851),d=r(6117);function l(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),e).mul(r.priv()),u=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:s})},l.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),s=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(s)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return s.intFromLE(e.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},l.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},l.prototype.makeSignature=function(e){return e instanceof d?e:new d(this,e)},l.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},l.prototype.decodePoint=function(e){var t=(e=s.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=s.intFromLE(r);return this.curve.pointFromY(n,i)},l.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(e){return s.intFromLE(e)},l.prototype.isPoint=function(e){return e instanceof this.pointClass}},851:(e,t,r)=>{"use strict";var i=r(8288),n=i.assert,s=i.parseBytes,o=i.cachedProperty;function a(e,t){this.eddsa=e,this._secret=s(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=s(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},o(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),o(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},a.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=a},6117:(e,t,r)=>{"use strict";var i=r(2197),n=r(8288),s=n.assert,o=n.cachedProperty,a=n.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),s(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}o(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},7983:e=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},8288:(e,t,r)=>{"use strict";var i=t,n=r(2197),s=r(9561),o=r(3022);i.assert=s,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(e,t,r){var i=new Array(Math.max(e.bitLength(),r)+1);i.fill(0);for(var n=1<<t+1,s=e.clone(),o=0;o<i.length;o++){var a,u=s.andln(n-1);s.isOdd()?(a=u>(n>>1)-1?(n>>1)-u:u,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i},i.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,s=0;e.cmpn(-n)>0||t.cmpn(-s)>0;){var o,a,u=e.andln(3)+n&3,d=t.andln(3)+s&3;3===u&&(u=-1),3===d&&(d=-1),o=0==(1&u)?0:3!=(i=e.andln(7)+n&7)&&5!==i||2!==d?u:-u,r[0].push(o),a=0==(1&d)?0:3!=(i=t.andln(7)+s&7)&&5!==i||2!==u?d:-d,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return r},i.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new n(e,"hex","le")}},4956:e=>{"use strict";function t(e,t){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var r=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var s=Object.keys(Object(n)),o=0,a=s.length;o<a;o++){var u=s[o],d=Object.getOwnPropertyDescriptor(n,u);void 0!==d&&d.enumerable&&(r[u]=n[u])}}return r}e.exports={assign:t,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:t})}}},6139:function(e,t,r){var i=r(4406);e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,s=void 0,o=void 0,a=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(y):_())};var u="undefined"!=typeof window?window:void 0,d=u||{},l=d.MutationObserver||d.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==i&&"[object process]"==={}.toString.call(i),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var e=setTimeout;return function(){return e(y,1)}}var p=new Array(1e3);function y(){for(var e=0;e<n;e+=2)(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0;n=0}var g,m,v,b,_=void 0;function w(e,t){var r=this,i=new this.constructor(T);void 0===i[S]&&D(i);var n=r._state;if(n){var s=arguments[n-1];a((function(){return P(n,i,s,r._result)}))}else I(r,i,e,t);return i}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(T);return R(t,e),t}_=c?function(){return i.nextTick(y)}:l?(m=0,v=new l(y),b=document.createTextNode(""),v.observe(b,{characterData:!0}),function(){b.data=m=++m%2}):h?((g=new MessageChannel).port1.onmessage=y,function(){return g.port2.postMessage(0)}):void 0===u?function(){try{var e=Function("return this")().require("vertx");return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(y)}:f()}catch(e){return f()}}():f();var S=Math.random().toString(36).substring(2);function T(){}var A=void 0;function M(t,r,i){r.constructor===t.constructor&&i===w&&r.constructor.resolve===E?function(e,t){1===t._state?k(e,t._result):2===t._state?O(e,t._result):I(t,void 0,(function(t){return R(e,t)}),(function(t){return O(e,t)}))}(t,r):void 0===i?k(t,r):e(i)?function(e,t,r){a((function(e){var i=!1,n=function(e,t,r,i){try{e.call(t,r,i)}catch(e){return e}}(r,t,(function(r){i||(i=!0,t!==r?R(e,r):k(e,r))}),(function(t){i||(i=!0,O(e,t))}),e._label);!i&&n&&(i=!0,O(e,n))}),e)}(t,r,i):k(t,r)}function R(e,t){if(e===t)O(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(i=t),null===i||"object"!==n&&"function"!==n)k(e,t);else{var r=void 0;try{r=t.then}catch(t){return void O(e,t)}M(e,t,r)}var i,n}function x(e){e._onerror&&e._onerror(e._result),C(e)}function k(e,t){e._state===A&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(C,e))}function O(e,t){e._state===A&&(e._state=2,e._result=t,a(x,e))}function I(e,t,r,i){var n=e._subscribers,s=n.length;e._onerror=null,n[s]=t,n[s+1]=r,n[s+2]=i,0===s&&e._state&&a(C,e)}function C(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i=void 0,n=void 0,s=e._result,o=0;o<t.length;o+=3)i=t[o],n=t[o+r],i?P(r,i,n,s):n(s);e._subscribers.length=0}}function P(t,r,i,n){var s=e(i),o=void 0,a=void 0,u=!0;if(s){try{o=i(n)}catch(e){u=!1,a=e}if(r===o)return void O(r,new TypeError("A promises callback cannot return that same promise."))}else o=n;r._state!==A||(s&&u?R(r,o):!1===u?O(r,a):1===t?k(r,o):2===t&&O(r,o))}var N=0;function D(e){e[S]=N++,e._state=void 0,e._result=void 0,e._subscribers=[]}var B=function(){function e(e,r){this._instanceConstructor=e,this.promise=new e(T),this.promise[S]||D(this.promise),t(r)?(this.length=r.length,this._remaining=r.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(r),0===this._remaining&&k(this.promise,this._result))):O(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===A&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,i=r.resolve;if(i===E){var n=void 0,s=void 0,o=!1;try{n=e.then}catch(e){o=!0,s=e}if(n===w&&e._state!==A)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(r===q){var a=new r(T);o?O(a,s):M(a,e,n),this._willSettleAt(a,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,r){var i=this.promise;i._state===A&&(this._remaining--,2===e?O(i,r):this._result[t]=r),0===this._remaining&&k(i,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;I(e,void 0,(function(e){return r._settledAt(1,t,e)}),(function(e){return r._settledAt(2,t,e)}))},e}();var q=function(){function t(e){this[S]=N++,this._result=this._state=void 0,this._subscribers=[],T!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){R(e,t)}),(function(t){O(e,t)}))}catch(t){O(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var r=this,i=r.constructor;return e(t)?r.then((function(e){return i.resolve(t()).then((function(){return e}))}),(function(e){return i.resolve(t()).then((function(){throw e}))})):r.then(t,t)},t}();return q.prototype.then=w,q.all=function(e){return new B(this,e).promise},q.race=function(e){var r=this;return t(e)?new r((function(t,i){for(var n=e.length,s=0;s<n;s++)r.resolve(e[s]).then(t,i)})):new r((function(e,t){return t(new TypeError("You must pass an array to race."))}))},q.resolve=E,q.reject=function(e){var t=new this(T);return O(t,e),t},q._setScheduler=function(e){o=e},q._setAsap=function(e){a=e},q._asap=a,q.polyfill=function(){var e=void 0;if(void 0!==r.g)e=r.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=q},q.Promise=q,q}()},2699:(e,t,r)=>{"use strict";var i,n=r(6139).Promise,s="object"==typeof Reflect?Reflect:null,o=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,e.exports.once=function(e,t){return new n((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,n)}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var d=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function h(e,t,r,i){var n,s,o,a;if(l(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=c(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function y(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):m(n,n.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function v(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");d=e}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var d=u.length,l=m(u,d);for(r=0;r<d;++r)o(l[r],this,t)}return!0},u.prototype.addListener=function(e,t){return h(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return h(this,e,t,!0)},u.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},u.prototype.removeListener=function(e,t){var r,i,n,s,o;if(l(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},u.prototype.listeners=function(e){return y(this,e,!0)},u.prototype.rawListeners=function(e){return y(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},u.prototype.listenerCount=g,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},6920:e=>{e.exports=o,o.default=o,o.stable=l,o.stableStringify=l;var t="[...]",r="[Circular]",i=[],n=[];function s(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function o(e,t,r,o){var a;void 0===o&&(o=s()),u(e,"",0,[],void 0,0,o);try{a=0===n.length?JSON.stringify(e,t,r):JSON.stringify(e,h(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var d=i.pop();4===d.length?Object.defineProperty(d[0],d[1],d[3]):d[0][d[1]]=d[2]}}return a}function a(e,t,r,s){var o=Object.getOwnPropertyDescriptor(s,r);void 0!==o.get?o.configurable?(Object.defineProperty(s,r,{value:e}),i.push([s,r,t,o])):n.push([t,r,e]):(s[r]=e,i.push([s,r,t]))}function u(e,i,n,s,o,d,l){var c;if(d+=1,"object"==typeof e&&null!==e){for(c=0;c<s.length;c++)if(s[c]===e)return void a(r,e,i,o);if(void 0!==l.depthLimit&&d>l.depthLimit)return void a(t,e,i,o);if(void 0!==l.edgesLimit&&n+1>l.edgesLimit)return void a(t,e,i,o);if(s.push(e),Array.isArray(e))for(c=0;c<e.length;c++)u(e[c],c,c,s,e,d,l);else{var h=Object.keys(e);for(c=0;c<h.length;c++){var f=h[c];u(e[f],f,c,s,e,d,l)}}s.pop()}}function d(e,t){return e<t?-1:e>t?1:0}function l(e,t,r,o){void 0===o&&(o=s());var a,u=c(e,"",0,[],void 0,0,o)||e;try{a=0===n.length?JSON.stringify(u,t,r):JSON.stringify(u,h(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var d=i.pop();4===d.length?Object.defineProperty(d[0],d[1],d[3]):d[0][d[1]]=d[2]}}return a}function c(e,n,s,o,u,l,h){var f;if(l+=1,"object"==typeof e&&null!==e){for(f=0;f<o.length;f++)if(o[f]===e)return void a(r,e,n,u);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==h.depthLimit&&l>h.depthLimit)return void a(t,e,n,u);if(void 0!==h.edgesLimit&&s+1>h.edgesLimit)return void a(t,e,n,u);if(o.push(e),Array.isArray(e))for(f=0;f<e.length;f++)c(e[f],f,f,o,e,l,h);else{var p={},y=Object.keys(e).sort(d);for(f=0;f<y.length;f++){var g=y[f];c(e[g],g,f,o,e,l,h),p[g]=e[g]}if(void 0===u)return p;i.push([u,n,e]),u[n]=p}o.pop()}}function h(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var i=0;i<n.length;i++){var s=n[i];if(s[1]===t&&s[0]===r){r=s[2],n.splice(i,1);break}}return e.call(this,t,r)}}},3243:(e,t,r)=>{"use strict";var i=r(9680),n=Object.prototype.toString,s=Object.prototype.hasOwnProperty,o=function(e,t,r){for(var i=0,n=e.length;i<n;i++)s.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))},a=function(e,t,r){for(var i=0,n=e.length;i<n;i++)null==r?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},u=function(e,t,r){for(var i in e)s.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))};e.exports=function(e,t,r){if(!i(t))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=r),"[object Array]"===n.call(e)?o(e,t,s):"string"==typeof e?a(e,t,s):u(e,t,s)}},7795:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,i=Object.prototype.toString,n="[object Function]";e.exports=function(e){var s=this;if("function"!=typeof s||i.call(s)!==n)throw new TypeError(t+s);for(var o,a=r.call(arguments,1),u=function(){if(this instanceof o){var t=s.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return s.apply(e,a.concat(r.call(arguments)))},d=Math.max(0,s.length-a.length),l=[],c=0;c<d;c++)l.push("$"+c);if(o=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(u),s.prototype){var h=function(){};h.prototype=s.prototype,o.prototype=new h,h.prototype=null}return o}},4090:(e,t,r)=>{"use strict";var i=r(7795);e.exports=Function.prototype.bind||i},7286:(e,t,r)=>{"use strict";var i,n=r(6139).Promise,s=SyntaxError,o=Function,a=TypeError,u=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(e){d=null}var l=function(){throw new a},c=d?function(){try{return l}catch(e){try{return d(arguments,"callee").get}catch(e){return l}}}():l,h=r(2636)(),f=Object.getPrototypeOf||function(e){return e.__proto__},p={},y="undefined"==typeof Uint8Array?i:f(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":void 0===n?i:n,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):i,"%Symbol%":h?Symbol:i,"%SyntaxError%":s,"%ThrowTypeError%":c,"%TypedArray%":y,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet},m=function e(t){var r;if("%AsyncFunction%"===t)r=u("async function () {}");else if("%GeneratorFunction%"===t)r=u("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=u("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&(r=f(n.prototype))}return g[t]=r,r},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(4090),_=r(3198),w=b.call(Function.call,Array.prototype.concat),E=b.call(Function.apply,Array.prototype.splice),S=b.call(Function.call,String.prototype.replace),T=b.call(Function.call,String.prototype.slice),A=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,M=/\\(\\)?/g,R=function(e){var t=T(e,0,1),r=T(e,-1);if("%"===t&&"%"!==r)throw new s("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new s("invalid intrinsic syntax, expected opening `%`");var i=[];return S(e,A,(function(e,t,r,n){i[i.length]=r?S(n,M,"$1"):t||e})),i},x=function(e,t){var r,i=e;if(_(v,i)&&(i="%"+(r=v[i])[0]+"%"),_(g,i)){var n=g[i];if(n===p&&(n=m(i)),void 0===n&&!t)throw new a("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new s("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');var r=R(e),i=r.length>0?r[0]:"",n=x("%"+i+"%",t),o=n.name,u=n.value,l=!1,c=n.alias;c&&(i=c[0],E(r,w([0,1],c)));for(var h=1,f=!0;h<r.length;h+=1){var p=r[h],y=T(p,0,1),m=T(p,-1);if(('"'===y||"'"===y||"`"===y||'"'===m||"'"===m||"`"===m)&&y!==m)throw new s("property names with quotes must have matching quotes");if("constructor"!==p&&f||(l=!0),_(g,o="%"+(i+="."+p)+"%"))u=g[o];else if(null!=u){if(!(p in u)){if(!t)throw new a("base intrinsic for "+e+" exists, but the property is not available.");return}if(d&&h+1>=r.length){var v=d(u,p);u=(f=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:u[p]}else f=_(u,p),u=u[p];f&&!l&&(g[o]=u)}}return u}},1181:(e,t,r)=>{"use strict";var i=r(7286)("%Object.defineProperty%",!0),n=function(){if(i)try{return i({},"a",{value:1}),!0}catch(e){return!1}return!1};n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},2636:(e,t,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(6679);e.exports=function(){return"function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&n()}},6679:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},7226:(e,t,r)=>{"use strict";var i=r(6679);e.exports=function(){return i()&&!!Symbol.toStringTag}},3198:(e,t,r)=>{"use strict";var i=r(4090);e.exports=i.call(Function.call,Object.prototype.hasOwnProperty)},5232:(e,t,r)=>{"use strict";var i=r(7834).Buffer,n=r(696).Transform;function s(e){n.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(1285)(s,n),s.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},s.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},s.prototype.update=function(e,t){if(function(e,t){if(!i.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");i.isBuffer(e)||(e=i.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var s=this._blockOffset;s<this._blockSize;)r[s++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var o=0,a=8*e.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},s.prototype._update=function(){throw new Error("_update is not implemented")},s.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},s.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=s},4485:(e,t,r)=>{var i=t;i.utils=r(212),i.common=r(4495),i.sha=r(5530),i.ripemd=r(1396),i.hmac=r(5047),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},4495:(e,t,r)=>{"use strict";var i=r(212),n=r(9561);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},s.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},s.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i}},5047:(e,t,r)=>{"use strict";var i=r(212),n=r(9561);function s(e,t,r){if(!(this instanceof s))return new s(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}e.exports=s,s.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},s.prototype.update=function(e,t){return this.inner.update(e,t),this},s.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},1396:(e,t,r)=>{"use strict";var i=r(212),n=r(4495),s=i.rotl32,o=i.sum32,a=i.sum32_3,u=i.sum32_4,d=n.BlockHash;function l(){if(!(this instanceof l))return new l;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function f(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(l,d),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],d=this.h[3],l=this.h[4],v=r,b=i,_=n,w=d,E=l,S=0;S<80;S++){var T=o(s(u(r,c(S,i,n,d),e[p[S]+t],h(S)),g[S]),l);r=l,l=d,d=s(n,10),n=i,i=T,T=o(s(u(v,c(79-S,b,_,w),e[y[S]+t],f(S)),m[S]),E),v=E,E=w,w=s(_,10),_=b,b=T}T=a(this.h[1],n,w),this.h[1]=a(this.h[2],d,E),this.h[2]=a(this.h[3],l,v),this.h[3]=a(this.h[4],r,b),this.h[4]=a(this.h[0],i,_),this.h[0]=T},l.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[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],y=[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],g=[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],m=[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]},5530:(e,t,r)=>{"use strict";t.sha1=r(5079),t.sha224=r(3823),t.sha256=r(8032),t.sha384=r(5328),t.sha512=r(168)},5079:(e,t,r)=>{"use strict";var i=r(212),n=r(4495),s=r(713),o=i.rotl32,a=i.sum32,u=i.sum32_5,d=s.ft_1,l=n.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(h,l),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=o(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],l=this.h[2],h=this.h[3],f=this.h[4];for(i=0;i<r.length;i++){var p=~~(i/20),y=u(o(n,5),d(p,s,l,h),f,r[i],c[p]);f=h,h=l,l=o(s,30),s=n,n=y}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],l),this.h[3]=a(this.h[3],h),this.h[4]=a(this.h[4],f)},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},3823:(e,t,r)=>{"use strict";var i=r(212),n=r(8032);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(s,n),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},8032:(e,t,r)=>{"use strict";var i=r(212),n=r(4495),s=r(713),o=r(9561),a=i.sum32,u=i.sum32_4,d=i.sum32_5,l=s.ch32,c=s.maj32,h=s.s0_256,f=s.s1_256,p=s.g0_256,y=s.g1_256,g=n.BlockHash,m=[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];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}i.inherits(v,g),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=u(y(r[i-2]),r[i-7],p(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],g=this.h[2],m=this.h[3],v=this.h[4],b=this.h[5],_=this.h[6],w=this.h[7];for(o(this.k.length===r.length),i=0;i<r.length;i++){var E=d(w,f(v),l(v,b,_),this.k[i],r[i]),S=a(h(n),c(n,s,g));w=_,_=b,b=v,v=a(m,E),m=g,g=s,s=n,n=a(E,S)}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],g),this.h[3]=a(this.h[3],m),this.h[4]=a(this.h[4],v),this.h[5]=a(this.h[5],b),this.h[6]=a(this.h[6],_),this.h[7]=a(this.h[7],w)},v.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},5328:(e,t,r)=>{"use strict";var i=r(212),n=r(168);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(s,n),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},168:(e,t,r)=>{"use strict";var i=r(212),n=r(4495),s=r(9561),o=i.rotr64_hi,a=i.rotr64_lo,u=i.shr64_hi,d=i.shr64_lo,l=i.sum64,c=i.sum64_hi,h=i.sum64_lo,f=i.sum64_4_hi,p=i.sum64_4_lo,y=i.sum64_5_hi,g=i.sum64_5_lo,m=n.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function _(e,t,r,i,n){var s=e&r^~e&n;return s<0&&(s+=4294967296),s}function w(e,t,r,i,n,s){var o=t&i^~t&s;return o<0&&(o+=4294967296),o}function E(e,t,r,i,n){var s=e&r^e&n^r&n;return s<0&&(s+=4294967296),s}function S(e,t,r,i,n,s){var o=t&i^t&s^i&s;return o<0&&(o+=4294967296),o}function T(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function R(e,t){var r=o(e,t,1)^o(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=a(e,t,1)^a(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function k(e,t){var r=a(e,t,19)^a(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}i.inherits(b,m),e.exports=b,b.blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=(g=r[i-4],m=r[i-3],v=void 0,(v=o(g,m,19)^o(m,g,29)^u(g,m,6))<0&&(v+=4294967296),v),s=k(r[i-4],r[i-3]),a=r[i-14],d=r[i-13],l=R(r[i-30],r[i-29]),c=x(r[i-30],r[i-29]),h=r[i-32],y=r[i-31];r[i]=f(n,s,a,d,l,c,h,y),r[i+1]=p(n,s,a,d,l,c,h,y)}var g,m,v},b.prototype._update=function(e,t){this._prepareBlock(e,t);var r,i,n,a=this.W,u=this.h[0],d=this.h[1],f=this.h[2],p=this.h[3],m=this.h[4],v=this.h[5],b=this.h[6],R=this.h[7],x=this.h[8],k=this.h[9],O=this.h[10],I=this.h[11],C=this.h[12],P=this.h[13],N=this.h[14],D=this.h[15];s(this.k.length===a.length);for(var B=0;B<a.length;B+=2){var q=N,L=D,j=(n=void 0,(n=o(r=x,i=k,14)^o(r,i,18)^o(i,r,9))<0&&(n+=4294967296),n),F=M(x,k),U=_(x,0,O,0,C),z=w(0,k,0,I,0,P),H=this.k[B],G=this.k[B+1],$=a[B],W=a[B+1],V=y(q,L,j,F,U,z,H,G,$,W),K=g(q,L,j,F,U,z,H,G,$,W);q=T(u,d),L=A(u,d),j=E(u,0,f,0,m),F=S(0,d,0,p,0,v);var Y=c(q,L,j,F),Z=h(q,L,j,F);N=C,D=P,C=O,P=I,O=x,I=k,x=c(b,R,V,K),k=h(R,R,V,K),b=m,R=v,m=f,v=p,f=u,p=d,u=c(V,K,Y,Z),d=h(V,K,Y,Z)}l(this.h,0,u,d),l(this.h,2,f,p),l(this.h,4,m,v),l(this.h,6,b,R),l(this.h,8,x,k),l(this.h,10,O,I),l(this.h,12,C,P),l(this.h,14,N,D)},b.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},713:(e,t,r)=>{"use strict";var i=r(212).rotr32;function n(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,i){return 0===e?n(t,r,i):1===e||3===e?o(t,r,i):2===e?s(t,r,i):void 0},t.ch32=n,t.maj32=s,t.p32=o,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},212:(e,t,r)=>{"use strict";var i=r(9561),n=r(1285);function s(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):s(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=a(e[r].toString(16));return t},t.htonl=o,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=o(n)),r+=u(n.toString(16))}return r},t.zero2=a,t.zero8=u,t.join32=function(e,t,r,n){var s=r-t;i(s%4==0);for(var o=new Array(s/4),a=0,u=t;a<o.length;a++,u+=4){var d;d="big"===n?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],o[a]=d>>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var s=e[i];"big"===t?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],s=i+e[t+1]>>>0,o=(s<i?1:0)+r+n;e[t]=o>>>0,e[t+1]=s},t.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,s,o,a){var u=0,d=t;return u+=(d=d+i>>>0)<t?1:0,u+=(d=d+s>>>0)<s?1:0,e+r+n+o+(u+=(d=d+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,r,i,n,s,o,a){return t+i+s+a>>>0},t.sum64_5_hi=function(e,t,r,i,n,s,o,a,u,d){var l=0,c=t;return l+=(c=c+i>>>0)<t?1:0,l+=(c=c+s>>>0)<s?1:0,l+=(c=c+a>>>0)<a?1:0,e+r+n+o+u+(l+=(c=c+d>>>0)<d?1:0)>>>0},t.sum64_5_lo=function(e,t,r,i,n,s,o,a,u,d){return t+i+s+a+d>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},8873:(e,t,r)=>{"use strict";var i=r(4485),n=r(3022),s=r(9561);function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=o,o.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},o.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=n.toArray(e,t),r=n.toArray(r,i),s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(r),this._reseed++,n.encode(o,t)}},2333:(e,t)=>{t.read=function(e,t,r,i,n){var s,o,a=8*n-i-1,u=(1<<a)-1,d=u>>1,l=-7,c=r?n-1:0,h=r?-1:1,f=e[t+c];for(c+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+c],c+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+c],c+=h,l-=8);if(0===s)s=1-d;else{if(s===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),s-=d}return(f?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var o,a,u,d=8*s-n-1,l=(1<<d)-1,c=l>>1,h=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*u-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,d+=n;d>0;e[r+f]=255&o,f+=p,o/=256,d-=8);e[r+f-p]|=128*y}},1285:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},2635:(e,t,r)=>{"use strict";var i=r(7226)(),n=r(2680)("Object.prototype.toString"),s=function(e){return!(i&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===n(e)},o=function(e){return!!s(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==n(e)&&"[object Function]"===n(e.callee)},a=function(){return s(arguments)}();s.isLegacyArguments=o,e.exports=a?s:o},9680:e=>{"use strict";var t,r,i=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},n((function(){throw 42}),null,t)}catch(e){e!==r&&(n=null)}else n=null;var s=/^\s*class\b/,o=function(e){try{var t=i.call(e);return s.test(t)}catch(e){return!1}},a=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,d="object"==typeof document&&void 0===document.all&&void 0!==document.all?document.all:{};e.exports=n?function(e){if(e===d)return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;try{n(e,null,t)}catch(e){if(e!==r)return!1}return!o(e)}:function(e){if(e===d)return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(u)return function(e){try{return!o(e)&&(i.call(e),!0)}catch(e){return!1}}(e);if(o(e))return!1;var t=a.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},1990:(e,t,r)=>{"use strict";var i,n=Object.prototype.toString,s=Function.prototype.toString,o=/^\s*(?:function)?\*/,a=r(7226)(),u=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(o.test(s.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===n.call(e);if(!u)return!1;if(void 0===i){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();i=!!t&&u(t)}return u(e)===i}},7053:e=>{"use strict";e.exports=function(e){return e!=e}},4782:(e,t,r)=>{"use strict";var i=r(9429),n=r(4926),s=r(7053),o=r(755),a=r(5346),u=i(o(),Number);n(u,{getPolyfill:o,implementation:s,shim:a}),e.exports=u},755:(e,t,r)=>{"use strict";var i=r(7053);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:i}},5346:(e,t,r)=>{"use strict";var i=r(4926),n=r(755);e.exports=function(){var e=n();return i(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},198:(e,t,r)=>{"use strict";var i=r(3243),n=r(2191),s=r(2680),o=s("Object.prototype.toString"),a=r(7226)(),u="undefined"==typeof globalThis?r.g:globalThis,d=n(),l=s("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},c=s("String.prototype.slice"),h={},f=r(9765),p=Object.getPrototypeOf;a&&f&&p&&i(d,(function(e){var t=new u[e];if(Symbol.toStringTag in t){var r=p(t),i=f(r,Symbol.toStringTag);if(!i){var n=p(r);i=f(n,Symbol.toStringTag)}h[e]=i.get}})),e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!a||!(Symbol.toStringTag in e)){var t=c(o(e),8,-1);return l(d,t)>-1}return!!f&&function(e){var t=!1;return i(h,(function(r,i){if(!t)try{t=r.call(e)===i}catch(e){}})),t}(e)}},1297:(e,t,r)=>{var i=r(6139).Promise,n=r(8834).Buffer,s=r(4406);e.exports=function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[o]={exports:{}};t[o][0].call(d.exports,(function(e){return n(t[o][1][e]||e)}),d,d.exports,e,t,r,i)}return r[o].exports}for(var s=void 0,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,r){"use strict";var i=e("./utils"),n=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,o,a,u,d,l=[],c=0,h=e.length,f=h,p="string"!==i.getTypeOf(e);c<e.length;)f=h-c,n=p?(t=e[c++],r=c<h?e[c++]:0,c<h?e[c++]:0):(t=e.charCodeAt(c++),r=c<h?e.charCodeAt(c++):0,c<h?e.charCodeAt(c++):0),o=t>>2,a=(3&t)<<4|r>>4,u=1<f?(15&r)<<2|n>>6:64,d=2<f?63&n:64,l.push(s.charAt(o)+s.charAt(a)+s.charAt(u)+s.charAt(d));return l.join("")},r.decode=function(e){var t,r,i,o,a,u,d=0,l=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");var h,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=n.uint8array?new Uint8Array(0|f):new Array(0|f);d<e.length;)t=s.indexOf(e.charAt(d++))<<2|(o=s.indexOf(e.charAt(d++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(d++)))>>2,i=(3&a)<<6|(u=s.indexOf(e.charAt(d++))),h[l++]=t,64!==a&&(h[l++]=r),64!==u&&(h[l++]=i);return h}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var i=e("./external"),n=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var i=e("./utils"),n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,r,i){var s=n,o=0+r;e^=-1;for(var a=0;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length):function(e,t,r,i){var s=n,o=0+r;e^=-1;for(var a=0;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n;n=void 0!==i?i:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function u(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(u,o),u.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},u.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new u("Deflate",e)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function i(e,t){var r,i="";for(r=0;r<t;r++)i+=String.fromCharCode(255&e),e>>>=8;return i}function n(e,t,r,n,o,l){var c,h,f=e.file,p=e.compression,y=l!==a.utf8encode,g=s.transformTo("string",l(f.name)),m=s.transformTo("string",a.utf8encode(f.name)),v=f.comment,b=s.transformTo("string",l(v)),_=s.transformTo("string",a.utf8encode(v)),w=m.length!==f.name.length,E=_.length!==v.length,S="",T="",A="",M=f.dir,R=f.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),y||!w&&!E||(k|=2048);var O=0,I=0;M&&(O|=16),"UNIX"===o?(I=798,O|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(f.unixPermissions,M)):(I=20,O|=function(e){return 63&(e||0)}(f.dosPermissions)),c=R.getUTCHours(),c<<=6,c|=R.getUTCMinutes(),c<<=5,c|=R.getUTCSeconds()/2,h=R.getUTCFullYear()-1980,h<<=4,h|=R.getUTCMonth()+1,h<<=5,h|=R.getUTCDate(),w&&(T=i(1,1)+i(u(g),4)+m,S+="up"+i(T.length,2)+T),E&&(A=i(1,1)+i(u(b),4)+_,S+="uc"+i(A.length,2)+A);var C="";return C+="\n\0",C+=i(k,2),C+=p.magic,C+=i(c,2),C+=i(h,2),C+=i(x.crc32,4),C+=i(x.compressedSize,4),C+=i(x.uncompressedSize,4),C+=i(g.length,2),C+=i(S.length,2),{fileRecord:d.LOCAL_FILE_HEADER+C+g+S,dirRecord:d.CENTRAL_FILE_HEADER+i(I,2)+C+i(b.length,2)+"\0\0\0\0"+i(O,4)+i(n,4)+g+S+b}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),u=e("../crc32"),d=e("../signature");function l(e,t,r,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(l,o),l.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))},l.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return d.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=function(e,t,r,n,o){var a=s.transformTo("string",o(n));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(e,2)+i(e,2)+i(t,4)+i(r,4)+i(a.length,2)+a}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},l.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var i=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var s=new n(t.streamFiles,r,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,r){o++;var n=function(e,t){var r=e||t,n=i[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(r.options.compression,t.compression),a=r.options.compressionOptions||t.compressionOptions||{},u=r.dir,d=r.date;r._compressWorker(n,a).withStreamInfo("file",{name:e,dir:u,date:d,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(s)})),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new i;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(e,t){return(new i).loadAsync(e,t)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var i=e("./utils"),n=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),u=e("./nodejsUtils");function d(e){return new n.Promise((function(t,r){var i=e.decompressed.getContentWorker().pipe(new a);i.on("error",(function(e){r(e)})).on("end",(function(){i.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var r=this;return t=i.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),u.isNode&&u.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var r=new o(t);return r.load(e),r})).then((function(e){var r=[n.Promise.resolve(e)],i=e.files;if(t.checkCRC32)for(var s=0;s<i.length;s++)r.push(d(i[s]));return n.Promise.all(r)})).then((function(e){for(var n=e.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],u=a.fileNameStr,d=i.resolve(a.fileNameStr);r.file(d,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(r.file(d).unsafeOriginalName=u)}return n.zipComment.length&&(r.comment=n.zipComment),r}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../stream/GenericWorker");function s(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}i.inherits(s,n),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var i=e("readable-stream").Readable;function n(e,t,r){i.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),r&&r(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:void 0!==n,newBufferFrom:function(e,t){if(n.from&&n.from!==Uint8Array.from)return n.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new n(e,t)},allocBuffer:function(e){if(n.alloc)return n.alloc(e);var t=new n(e);return t.fill(0),t},isBuffer:function(e){return n.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){"use strict";function i(e,t,r){var i,n=s.getTypeOf(t),a=s.extend(r||{},u);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=y(e)),a.createFolders&&(i=p(e))&&g.call(this,i,!0);var c="string"===n&&!1===a.binary&&!1===a.base64;r&&void 0!==r.binary||(a.binary=!c),(t instanceof d&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var m;m=t instanceof d||t instanceof o?t:h.isNode&&h.isStream(t)?new f(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var v=new l(e,m,a);this.files[e]=v}var n=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),u=e("./defaults"),d=e("./compressedObject"),l=e("./zipObject"),c=e("./generate"),h=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},y=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:u.createFolders,e=y(e),this.files[e]||i.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function m(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,i;for(t in this.files)i=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,i)},filter:function(e){var t=[];return this.forEach((function(r,i){e(r,i)&&t.push(i)})),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,i.call(this,e,t,r),this;if(m(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(m(e))return this.filter((function(t,r){return r.dir&&e.test(t)}));var t=this.root+e,r=g.call(this,t),i=this.clone();return i.root=r.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter((function(t,r){return r.name.slice(0,e.length)===e})),i=0;i<r.length;i++)delete this.files[r[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");s.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";t=c.generateWorker(this,r,i)}catch(e){(t=new o("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var i=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,r){"use strict";var i=e("./Uint8ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var i=e("./ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new u(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,n),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}i.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=i},{}],29:[function(e,t,r){"use strict";var i=e("../utils"),s=e("./ConvertWorker"),o=e("./GenericWorker"),a=e("../base64"),u=e("../support"),d=e("../external"),l=null;if(u.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,i.checkSupport(n),this._worker=e.pipe(new s(n)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new d.Promise((function(r,s){var o=[],u=e._internalType,d=e._outputType,l=e._mimeType;e.on("data",(function(e,r){o.push(e),t&&t(r)})).on("error",(function(e){o=[],s(e)})).on("end",(function(){try{var e=function(e,t,r){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),r);case"base64":return a.encode(t);default:return i.transformTo(e,t)}}(d,function(e,t){var r,i=0,s=null,o=0;for(r=0;r<t.length;r++)o+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(s=new Uint8Array(o),r=0;r<t.length;r++)s.set(t[r],i),i+=t[r].length;return s;case"nodebuffer":return n.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(u,o),l);r(e)}catch(e){s(e)}o=[]})).resume()}))}(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,(function(e){t.call(r,e.data,e.meta)})):this._worker.on(e,(function(){i.delay(t,arguments,r)})),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==n,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),r.blob=0===s.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var i=e("./utils"),n=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),u=0;u<256;u++)a[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(){o.call(this,"utf-8 decode"),this.leftOver=null}function l(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,r.utf8encode=function(e){return n.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,r,i,s,o,a=e.length,u=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),u+=r<128?1:r<2048?2:r<65536?3:4;for(t=n.uint8array?new Uint8Array(u):new Array(u),s=o=0;o<u;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}(e)},r.utf8decode=function(e){return n.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,s,o=e.length,u=new Array(2*o);for(t=r=0;t<o;)if((n=e[t++])<128)u[r++]=n;else if(4<(s=a[n]))u[r++]=65533,t+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&t<o;)n=n<<6|63&e[t++],s--;1<s?u[r++]=65533:n<65536?u[r++]=n:(n-=65536,u[r++]=55296|n>>10&1023,u[r++]=56320|1023&n)}return u.length!==r&&(u.subarray?u=u.subarray(0,r):u.length=r),i.applyFromCharCode(u)}(e=i.transformTo(n.uint8array?"uint8array":"array",e))},i.inherits(d,o),d.prototype.processChunk=function(e){var t=i.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),u=t;o!==t.length&&(n.uint8array?(u=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(u=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:r.utf8decode(u),meta:e.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=d,i.inherits(l,o),l.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var i=e("./support"),n=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function u(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(e,t,r){var i=[],n=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;n<s;)"array"===t||"nodebuffer"===t?i.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function l(e){var t=65536,i=r.getTypeOf(e),n=!0;if("uint8array"===i?n=d.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=d.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return d.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return d.stringifyByChar(e)}function c(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.applyFromCharCode=l;var h={};h.string={string:a,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:function(e){return u(e,s.allocBuffer(e.length))}},h.array={string:l,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},h.arraybuffer={string:function(e){return l(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},h.nodebuffer={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:a},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var i=r.getTypeOf(t);return h[i][e](t)},r.resolve=function(e){for(var t=e.split("/"),r=[],i=0;i<t.length;i++){var n=t[i];"."===n||""===n&&0!==i&&i!==t.length-1||(".."===n?r.pop():r.push(n))}return r.join("/")},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&s.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,i="";for(r=0;r<(e||"").length;r++)i+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return i},r.delay=function(e,t,r){setImmediate((function(){e.apply(r||null,t||[])}))},r.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},r.prepareContent=function(e,t,s,a,d){return o.Promise.resolve(t).then((function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,r){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=function(e){r(e.target.error)},i.readAsArrayBuffer(e)})):e})).then((function(t){var l=r.getTypeOf(t);return l?("arraybuffer"===l?t=r.transformTo("uint8array",t):"string"===l&&(d?t=n.decode(t):s&&!0!==a&&(t=function(e){return u(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var i=e("./reader/readerFor"),n=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function u(e){this.files=[],this.loadOptions=e}u.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4)===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",r=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=t-r;if(0<i)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=i(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var i=e("./reader/readerFor"),n=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),u=e("./compressions"),d=e("./support");function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in u)if(Object.prototype.hasOwnProperty.call(u,t)&&u[t].magic===e)return u[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,i,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),r=e.readInt(2),i=e.readData(r),this.extraFields[t]={id:t,length:r,value:i};e.setIndex(n)},handleUTF8:function(){var e=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var s=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function i(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var n=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),u=e("./stream/GenericWorker");i.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var i="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!i&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&i&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new u("error")).error(e)}return new n(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof u?this._data:new s(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<d.length;c++)i.prototype[d[c]]=l;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){"use strict";var r,i,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var s=0,o=new n(l),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),r=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var u=new e.MessageChannel;u.port1.onmessage=l,r=function(){u.port2.postMessage(0)}}var d=[];function l(){var e,t;i=!0;for(var r=d.length;r;){for(t=d,d=[],e=-1;++e<r;)t[e]();r=d.length}i=!1}t.exports=function(e){1!==d.push(e)||i||r()}}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){"use strict";var i=e("immediate");function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],u=["PENDING"];function d(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==n&&f(this,e)}function l(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function c(e,t,r){i((function(){var i;try{i=t(r)}catch(i){return s.reject(e,i)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var r=!1;function i(t){r||(r=!0,s.reject(e,t))}function n(t){r||(r=!0,s.resolve(e,t))}var o=p((function(){t(n,i)}));"error"===o.status&&i(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=d).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){throw r}))}))},d.prototype.catch=function(e){return this.then(null,e)},d.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(n);return this.state!==u?c(r,this.state===a?e:t,this.outcome):this.queue.push(new l(r,e,t)),r},l.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){c(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){s.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){c(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=p(h,t);if("error"===r.status)return s.reject(e,r.value);var i=r.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callRejected(t);return e},d.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},d.reject=function(e){var t=new this(n);return s.reject(t,e)},d.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,u=-1,d=new this(n);++u<r;)l(e[u],u);return d;function l(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==r||i||(i=!0,s.resolve(d,o))}),(function(e){i||(i=!0,s.reject(d,e))}))}},d.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var i,o=-1,a=new this(n);++o<t;)i=e[o],this.resolve(i).then((function(e){r||(r=!0,s.resolve(a,e))}),(function(e){r||(r=!0,s.reject(a,e))}));return a}},{immediate:36}],38:[function(e,t,r){"use strict";var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var i=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(o[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var l;if(l="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=i.deflateSetDictionary(this.strm,l)))throw new Error(o[r]);this._dict_set=!0}}function l(e,t){var r=new d(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}d.prototype.push=function(e,t){var r,o,a=this.strm,d=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===u.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(d),a.next_out=0,a.avail_out=d),1!==(r=i.deflate(a,o))&&0!==r)return this.onEnd(r),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==o||(this.onEnd(0),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=d,r.deflate=l,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,l(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,l(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var i=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),u=e("./zlib/zstream"),d=e("./zlib/gzheader"),l=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);this.header=new d,i.inflateGetHeader(this.strm,this.header)}function h(e,t){var r=new c(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}c.prototype.push=function(e,t){var r,a,u,d,c,h,f=this.strm,p=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new n.Buf8(p),f.next_out=0,f.avail_out=p),(r=i.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&y&&(h="string"==typeof y?s.string2buf(y):"[object ArrayBuffer]"===l.call(y)?new Uint8Array(y):y,r=i.inflateSetDictionary(this.strm,h)),r===o.Z_BUF_ERROR&&!0===g&&(r=o.Z_OK,g=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&r!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(f.output,f.next_out),d=f.next_out-u,c=s.buf2string(f.output,u),f.next_out=d,f.avail_out=p-d,d&&n.arraySet(f.output,f.output,u,d,0),this.onData(c)):this.onData(n.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((0<f.avail_in||0===f.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=c,r.inflate=h,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},r.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){var t,r,i,n,s,o;for(t=i=0,r=e.length;t<r;t++)i+=e[t].length;for(o=new Uint8Array(i),t=n=0,r=e.length;t<r;t++)s=e[t],o.set(s,n),n+=s.length;return o}},s={arraySet:function(e,t,r,i,n){for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(i)},{}],42:[function(e,t,r){"use strict";var i=e("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function u(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,n,s,o,a=e.length,u=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),u+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.Buf8(u),s=o=0;o<u;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t},r.buf2binstring=function(e){return u(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,i,n,s,a=t||e.length,d=new Array(2*a);for(r=i=0;r<a;)if((n=e[r++])<128)d[i++]=n;else if(4<(s=o[n]))d[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&r<a;)n=n<<6|63&e[r++],s--;1<s?d[i++]=65533:n<65536?d[i++]=n:(n-=65536,d[i++]=55296|n>>10&1023,d[i++]=56320|1023&n)}return u(d,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){for(var n=65535&e|0,s=e>>>16&65535|0,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;s=s+(n=n+t[i++]|0)|0,--o;);n%=65521,s%=65521}return n|s<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var s=i,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var i,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),u=e("./messages"),d=-2,l=258,c=262,h=113;function f(e,t){return e.msg=u[t],t}function p(e){return(e<<1)-(4<e?9:0)}function y(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function m(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function v(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function _(e,t){var r,i,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,u=e.strstart>e.w_size-c?e.strstart-(e.w_size-c):0,d=e.window,h=e.w_mask,f=e.prev,p=e.strstart+l,y=d[s+o-1],g=d[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(d[(r=t)+o]===g&&d[r+o-1]===y&&d[r]===d[s]&&d[++r]===d[s+1]){s+=2,r++;do{}while(d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&s<p);if(i=l-(p-s),s=p-l,o<i){if(e.match_start=t,a<=(o=i))break;y=d[s+o-1],g=d[s+o]}}}while((t=f[t&h])>u&&0!=--n);return o<=e.lookahead?o:e.lookahead}function w(e){var t,r,i,s,u,d,l,h,f,p,y=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=y+(y-c)){for(n.arraySet(e.window,e.window,y,y,0),e.match_start-=y,e.strstart-=y,e.block_start-=y,t=r=e.hash_size;i=e.head[--t],e.head[t]=y<=i?i-y:0,--r;);for(t=r=y;i=e.prev[--t],e.prev[t]=y<=i?i-y:0,--r;);s+=y}if(0===e.strm.avail_in)break;if(d=e.strm,l=e.window,h=e.strstart+e.lookahead,p=void 0,(f=s)<(p=d.avail_in)&&(p=f),r=0===p?0:(d.avail_in-=p,n.arraySet(l,d.input,d.next_in,p,h),1===d.state.wrap?d.adler=o(d.adler,l,p,h):2===d.state.wrap&&(d.adler=a(d.adler,l,p,h)),d.next_in+=p,d.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=3)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+3-1])&e.hash_mask,e.prev[u&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=u,u++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<c&&0!==e.strm.avail_in)}function E(e,t){for(var r,i;;){if(e.lookahead<c){if(w(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-c&&(e.match_length=_(e,r)),e.match_length>=3)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}function S(e,t){for(var r,i,n;;){if(e.lookahead<c){if(w(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-c&&(e.match_length=_(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(m(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&m(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}function T(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function A(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),y(this.dyn_ltree),y(this.dyn_dtree),y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),y(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function M(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:h,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):f(e,d)}function R(e){var t=M(e);return 0===t&&function(e){e.window_size=2*e.w_size,y(e.head),e.max_lazy_match=i[e.level].max_lazy,e.good_match=i[e.level].good_length,e.nice_match=i[e.level].nice_length,e.max_chain_length=i[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function x(e,t,r,i,s,o){if(!e)return d;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||9<s||8!==r||i<8||15<i||t<0||9<t||o<0||4<o)return f(e,d);8===i&&(i=9);var u=new A;return(e.state=u).strm=e,u.wrap=a,u.gzhead=null,u.w_bits=i,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=s+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+3-1)/3),u.window=new n.Buf8(2*u.w_size),u.head=new n.Buf16(u.hash_size),u.prev=new n.Buf16(u.w_size),u.lit_bufsize=1<<s+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new n.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=o,u.method=r,R(e)}i=[new T(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(w(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,m(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-c&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(m(e,!1),e.strm.avail_out),1)})),new T(4,4,8,4,E),new T(4,5,16,8,E),new T(4,6,32,32,E),new T(4,4,16,16,S),new T(8,16,32,32,S),new T(8,16,128,128,S),new T(8,32,128,256,S),new T(32,128,258,1024,S),new T(32,258,258,4096,S)],r.deflateInit=function(e,t){return x(e,t,8,15,8,0)},r.deflateInit2=x,r.deflateReset=R,r.deflateResetKeep=M,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,0):d},r.deflate=function(e,t){var r,n,o,u;if(!e||!e.state||5<t||t<0)return e?f(e,d):d;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return f(e,0===e.avail_out?-5:d);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,v(n,31),v(n,139),v(n,8),n.gzhead?(v(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),v(n,255&n.gzhead.time),v(n,n.gzhead.time>>8&255),v(n,n.gzhead.time>>16&255),v(n,n.gzhead.time>>24&255),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(v(n,255&n.gzhead.extra.length),v(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(v(n,0),v(n,0),v(n,0),v(n,0),v(n,0),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,3),n.status=h);else{var c=8+(n.w_bits-8<<4)<<8;c|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(c|=32),c+=31-c%31,n.status=h,b(n,c),0!==n.strstart&&(b(n,e.adler>>>16),b(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending!==n.pending_buf_size));)v(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,v(n,u)}while(0!==u);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,v(n,u)}while(0!==u);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(e),n.pending+2<=n.pending_buf_size&&(v(n,255&e.adler),v(n,e.adler>>8&255),e.adler=0,n.status=h)):n.status=h),0!==n.pending){if(g(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(r)&&4!==t)return f(e,-5);if(666===n.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var _=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(w(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=l){if(w(e),e.lookahead<=l&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+l;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=l-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}(n,t):i[n.level].func(n,t);if(3!==_&&4!==_||(n.status=666),1===_||3===_)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===_&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(y(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(v(n,255&e.adler),v(n,e.adler>>8&255),v(n,e.adler>>16&255),v(n,e.adler>>24&255),v(n,255&e.total_in),v(n,e.total_in>>8&255),v(n,e.total_in>>16&255),v(n,e.total_in>>24&255)):(b(n,e.adler>>>16),b(n,65535&e.adler)),g(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?f(e,d):(e.state=null,t===h?f(e,-3):0):d},r.deflateSetDictionary=function(e,t){var r,i,s,a,u,l,c,h,f=t.length;if(!e||!e.state)return d;if(2===(a=(r=e.state).wrap)||1===a&&42!==r.status||r.lookahead)return d;for(1===a&&(e.adler=o(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(y(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new n.Buf8(r.w_size),n.arraySet(h,t,f-r.w_size,r.w_size,0),t=h,f=r.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=f,e.next_in=0,e.input=t,w(r);r.lookahead>=3;){for(i=r.strstart,s=r.lookahead-2;r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,--s;);r.strstart=i,r.lookahead=2,w(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=l,e.input=c,e.avail_in=u,r.wrap=a,0},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n,s,o,a,u,d,l,c,h,f,p,y,g,m,v,b,_,w,E,S,T,A,M;r=e.state,i=e.next_in,A=e.input,n=i+(e.avail_in-5),s=e.next_out,M=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),u=r.dmax,d=r.wsize,l=r.whave,c=r.wnext,h=r.window,f=r.hold,p=r.bits,y=r.lencode,g=r.distcode,m=(1<<r.lenbits)-1,v=(1<<r.distbits)-1;e:do{p<15&&(f+=A[i++]<<p,p+=8,f+=A[i++]<<p,p+=8),b=y[f&m];t:for(;;){if(f>>>=_=b>>>24,p-=_,0==(_=b>>>16&255))M[s++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=y[(65535&b)+(f&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&b,(_&=15)&&(p<_&&(f+=A[i++]<<p,p+=8),w+=f&(1<<_)-1,f>>>=_,p-=_),p<15&&(f+=A[i++]<<p,p+=8,f+=A[i++]<<p,p+=8),b=g[f&v];r:for(;;){if(f>>>=_=b>>>24,p-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=g[(65535&b)+(f&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&b,p<(_&=15)&&(f+=A[i++]<<p,(p+=8)<_&&(f+=A[i++]<<p,p+=8)),u<(E+=f&(1<<_)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=_,p-=_,(_=s-o)<E){if(l<(_=E-_)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=h,(S=0)===c){if(S+=d-_,_<w){for(w-=_;M[s++]=h[S++],--_;);S=s-E,T=M}}else if(c<_){if(S+=d+c-_,(_-=c)<w){for(w-=_;M[s++]=h[S++],--_;);if(S=0,c<w){for(w-=_=c;M[s++]=h[S++],--_;);S=s-E,T=M}}}else if(S+=c-_,_<w){for(w-=_;M[s++]=h[S++],--_;);S=s-E,T=M}for(;2<w;)M[s++]=T[S++],M[s++]=T[S++],M[s++]=T[S++],w-=3;w&&(M[s++]=T[S++],1<w&&(M[s++]=T[S++]))}else{for(S=s-E;M[s++]=M[S++],M[s++]=M[S++],M[s++]=M[S++],2<(w-=3););w&&(M[s++]=M[S++],1<w&&(M[s++]=M[S++]))}break}}break}}while(i<n&&s<a);i-=w=p>>3,f&=(1<<(p-=w<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=f,r.bits=p}},{}],49:[function(e,t,r){"use strict";var i=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),u=-2;function d(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):u}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,c(e)):u}function f(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?u:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,h(e))):u}function p(e,t){var r,i;return e?(i=new l,(e.state=i).window=null,0!==(r=f(e,t))&&(e.state=null),r):u}var y,g,m=!0;function v(e){if(m){var t;for(y=new i.Buf32(512),g=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,y,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,g,0,e.work,{bits:5}),m=!1}e.lencode=y,e.lenbits=9,e.distcode=g,e.distbits=5}function b(e,t,r,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new i.Buf8(o.wsize)),n>=o.wsize?(i.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),i.arraySet(o.window,t,r-n,s,o.wnext),(n-=s)?(i.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=h,r.inflateReset2=f,r.inflateResetKeep=c,r.inflateInit=function(e){return p(e,15)},r.inflateInit2=p,r.inflate=function(e,t){var r,l,c,h,f,p,y,g,m,_,w,E,S,T,A,M,R,x,k,O,I,C,P,N,D=0,B=new i.Buf8(4),q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return u;12===(r=e.state).mode&&(r.mode=13),f=e.next_out,c=e.output,y=e.avail_out,h=e.next_in,l=e.input,p=e.avail_in,g=r.hold,m=r.bits,_=p,w=y,C=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(2&r.wrap&&35615===g){B[r.check=0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0),m=g=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",r.mode=30;break}if(m-=4,I=8+(15&(g>>>=4)),0===r.wbits)r.wbits=I;else if(I>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<I,e.adler=r.check=1,r.mode=512&g?10:12,m=g=0;break;case 2:for(;m<16;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(r.flags=g,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=g>>8&1),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0)),m=g=0,r.mode=3;case 3:for(;m<32;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}r.head&&(r.head.time=g),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,B[2]=g>>>16&255,B[3]=g>>>24&255,r.check=s(r.check,B,4,0)),m=g=0,r.mode=4;case 4:for(;m<16;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0)),m=g=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0)),m=g=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(p<(E=r.length)&&(E=p),E&&(r.head&&(I=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,l,h,E,I)),512&r.flags&&(r.check=s(r.check,l,E,h)),p-=E,h+=E,r.length-=E),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break e;for(E=0;I=l[h+E++],r.head&&I&&r.length<65536&&(r.head.name+=String.fromCharCode(I)),I&&E<p;);if(512&r.flags&&(r.check=s(r.check,l,E,h)),p-=E,h+=E,I)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===p)break e;for(E=0;I=l[h+E++],r.head&&I&&r.length<65536&&(r.head.comment+=String.fromCharCode(I)),I&&E<p;);if(512&r.flags&&(r.check=s(r.check,l,E,h)),p-=E,h+=E,I)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(g!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}m=g=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}e.adler=r.check=d(g),m=g=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=f,e.avail_out=y,e.next_in=h,e.avail_in=p,r.hold=g,r.bits=m,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){g>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}switch(r.last=1&g,m-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(v(r),r.mode=20,6!==t)break;g>>>=2,m-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}g>>>=2,m-=2;break;case 14:for(g>>>=7&m,m-=7&m;m<32;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,m=g=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(E=r.length){if(p<E&&(E=p),y<E&&(E=y),0===E)break e;i.arraySet(c,l,h,E,f),p-=E,h+=E,y-=E,f+=E,r.length-=E;break}r.mode=12;break;case 17:for(;m<14;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(r.nlen=257+(31&g),g>>>=5,m-=5,r.ndist=1+(31&g),g>>>=5,m-=5,r.ncode=4+(15&g),g>>>=4,m-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}r.lens[q[r.have++]]=7&g,g>>>=3,m-=3}for(;r.have<19;)r.lens[q[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},C=a(0,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,C){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;M=(D=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,R=65535&D,!((A=D>>>24)<=m);){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(R<16)g>>>=A,m-=A,r.lens[r.have++]=R;else{if(16===R){for(N=A+2;m<N;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(g>>>=A,m-=A,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}I=r.lens[r.have-1],E=3+(3&g),g>>>=2,m-=2}else if(17===R){for(N=A+3;m<N;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}m-=A,I=0,E=3+(7&(g>>>=A)),g>>>=3,m-=3}else{for(N=A+7;m<N;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}m-=A,I=0,E=11+(127&(g>>>=A)),g>>>=7,m-=7}if(r.have+E>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;E--;)r.lens[r.have++]=I}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,P={bits:r.lenbits},C=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,C){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},C=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,C){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=p&&258<=y){e.next_out=f,e.avail_out=y,e.next_in=h,e.avail_in=p,r.hold=g,r.bits=m,o(e,w),f=e.next_out,c=e.output,y=e.avail_out,h=e.next_in,l=e.input,p=e.avail_in,g=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;M=(D=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,R=65535&D,!((A=D>>>24)<=m);){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(M&&0==(240&M)){for(x=A,k=M,O=R;M=(D=r.lencode[O+((g&(1<<x+k)-1)>>x)])>>>16&255,R=65535&D,!(x+(A=D>>>24)<=m);){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}g>>>=x,m-=x,r.back+=x}if(g>>>=A,m-=A,r.back+=A,r.length=R,0===M){r.mode=26;break}if(32&M){r.back=-1,r.mode=12;break}if(64&M){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&M,r.mode=22;case 22:if(r.extra){for(N=r.extra;m<N;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;M=(D=r.distcode[g&(1<<r.distbits)-1])>>>16&255,R=65535&D,!((A=D>>>24)<=m);){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(0==(240&M)){for(x=A,k=M,O=R;M=(D=r.distcode[O+((g&(1<<x+k)-1)>>x)])>>>16&255,R=65535&D,!(x+(A=D>>>24)<=m);){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}g>>>=x,m-=x,r.back+=x}if(g>>>=A,m-=A,r.back+=A,64&M){e.msg="invalid distance code",r.mode=30;break}r.offset=R,r.extra=15&M,r.mode=24;case 24:if(r.extra){for(N=r.extra;m<N;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===y)break e;if(E=w-y,r.offset>E){if((E=r.offset-E)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}S=E>r.wnext?(E-=r.wnext,r.wsize-E):r.wnext-E,E>r.length&&(E=r.length),T=r.window}else T=c,S=f-r.offset,E=r.length;for(y<E&&(E=y),y-=E,r.length-=E;c[f++]=T[S++],--E;);0===r.length&&(r.mode=21);break;case 26:if(0===y)break e;c[f++]=r.length,y--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===p)break e;p--,g|=l[h++]<<m,m+=8}if(w-=y,e.total_out+=w,r.total+=w,w&&(e.adler=r.check=r.flags?s(r.check,c,w,f-w):n(r.check,c,w,f-w)),w=y,(r.flags?g:d(g))!==r.check){e.msg="incorrect data check",r.mode=30;break}m=g=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===p)break e;p--,g+=l[h++]<<m,m+=8}if(g!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}m=g=0}r.mode=29;case 29:C=1;break e;case 30:C=-3;break e;case 31:return-4;default:return u}return e.next_out=f,e.avail_out=y,e.next_in=h,e.avail_in=p,r.hold=g,r.bits=m,(r.wsize||w!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&b(e,e.output,e.next_out,w-e.avail_out)?(r.mode=31,-4):(_-=e.avail_in,w-=e.avail_out,e.total_in+=_,e.total_out+=w,r.total+=w,r.wrap&&w&&(e.adler=r.check=r.flags?s(r.check,c,w,e.next_out-w):n(r.check,c,w,e.next_out-w)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==_&&0===w||4===t)&&0===C&&(C=-5),C)},r.inflateEnd=function(e){if(!e||!e.state)return u;var t=e.state;return t.window&&(t.window=null),e.state=null,0},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?u:((r.head=t).done=!1,0):u},r.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?u:11===r.mode&&n(1,t,i,0)!==r.check?-3:b(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):u},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var i=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,u,d,l,c,h){var f,p,y,g,m,v,b,_,w,E=h.bits,S=0,T=0,A=0,M=0,R=0,x=0,k=0,O=0,I=0,C=0,P=null,N=0,D=new i.Buf16(16),B=new i.Buf16(16),q=null,L=0;for(S=0;S<=15;S++)D[S]=0;for(T=0;T<u;T++)D[t[r+T]]++;for(R=E,M=15;1<=M&&0===D[M];M--);if(M<R&&(R=M),0===M)return d[l++]=20971520,d[l++]=20971520,h.bits=1,0;for(A=1;A<M&&0===D[A];A++);for(R<A&&(R=A),S=O=1;S<=15;S++)if(O<<=1,(O-=D[S])<0)return-1;if(0<O&&(0===e||1!==M))return-1;for(B[1]=0,S=1;S<15;S++)B[S+1]=B[S]+D[S];for(T=0;T<u;T++)0!==t[r+T]&&(c[B[t[r+T]]++]=T);if(v=0===e?(P=q=c,19):1===e?(P=n,N-=257,q=s,L-=257,256):(P=o,q=a,-1),S=A,m=l,k=T=C=0,y=-1,g=(I=1<<(x=R))-1,1===e&&852<I||2===e&&592<I)return 1;for(;;){for(b=S-k,w=c[T]<v?(_=0,c[T]):c[T]>v?(_=q[L+c[T]],P[N+c[T]]):(_=96,0),f=1<<S-k,A=p=1<<x;d[m+(C>>k)+(p-=f)]=b<<24|_<<16|w|0,0!==p;);for(f=1<<S-1;C&f;)f>>=1;if(0!==f?(C&=f-1,C+=f):C=0,T++,0==--D[S]){if(S===M)break;S=t[r+c[T]]}if(R<S&&(C&g)!==y){for(0===k&&(k=R),m+=A,O=1<<(x=S-k);x+k<M&&!((O-=D[x+k])<=0);)x++,O<<=1;if(I+=1<<x,1===e&&852<I||2===e&&592<I)return 1;d[y=C&g]=R<<24|x<<16|m-l|0}}return 0!==C&&(d[m+C]=S-k<<24|64<<16|0),h.bits=R,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var i=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,u=15,d=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],l=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);n(f);var p=new Array(60);n(p);var y=new Array(512);n(y);var g=new Array(256);n(g);var m=new Array(29);n(m);var v,b,_,w=new Array(a);function E(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function S(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?y[e]:y[256+(e>>>7)]}function A(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function M(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,A(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function R(e,t,r){M(e,r[2*t],r[2*t+1])}function x(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function k(e,t,r){var i,n,s=new Array(16),o=0;for(i=1;i<=u;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=x(s[a]++,a))}}function O(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function I(e){8<e.bi_valid?A(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function C(e,t,r,i){var n=2*t,s=2*r;return e[n]<e[s]||e[n]===e[s]&&i[t]<=i[r]}function P(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&C(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!C(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function N(e,t,r){var i,n,o,a,u=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],n=e.pending_buf[e.l_buf+u],u++,0===i?R(e,n,t):(R(e,(o=g[n])+s+1,t),0!==(a=d[o])&&M(e,n-=m[o],a),R(e,o=T(--i),r),0!==(a=l[o])&&M(e,i-=w[o],a)),u<e.last_lit;);R(e,256,t)}function D(e,t){var r,i,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,d=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<d;r++)0!==s[2*r]?(e.heap[++e.heap_len]=l=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,r=e.heap_len>>1;1<=r;r--)P(e,s,r);for(n=d;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],P(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*n]=s[2*r]+s[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=n,e.heap[1]=n++,P(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,s,o,a,d=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,y=t.stat_desc.max_length,g=0;for(s=0;s<=u;s++)e.bl_count[s]=0;for(d[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)y<(s=d[2*d[2*(i=e.heap[r])+1]+1]+1)&&(s=y,g++),d[2*i+1]=s,l<i||(e.bl_count[s]++,o=0,p<=i&&(o=f[i-p]),a=d[2*i],e.opt_len+=a*(s+o),h&&(e.static_len+=a*(c[2*i+1]+o)));if(0!==g){do{for(s=y-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[y]--,g-=2}while(0<g);for(s=y;0!==s;s--)for(i=e.bl_count[s];0!==i;)l<(n=e.heap[--r])||(d[2*n+1]!==s&&(e.opt_len+=(s-d[2*n+1])*d[2*n],d[2*n+1]=s),i--)}}(e,t),k(s,l,e.bl_count)}function B(e,t,r){var i,n,s=-1,o=t[1],a=0,u=7,d=4;for(0===o&&(u=138,d=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=t[2*(i+1)+1],++a<u&&n===o||(a<d?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=n,d=(a=0)===o?(u=138,3):n===o?(u=6,3):(u=7,4))}function q(e,t,r){var i,n,s=-1,o=t[1],a=0,u=7,d=4;for(0===o&&(u=138,d=3),i=0;i<=r;i++)if(n=o,o=t[2*(i+1)+1],!(++a<u&&n===o)){if(a<d)for(;R(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(R(e,n,e.bl_tree),a--),R(e,16,e.bl_tree),M(e,a-3,2)):a<=10?(R(e,17,e.bl_tree),M(e,a-3,3)):(R(e,18,e.bl_tree),M(e,a-11,7));s=n,d=(a=0)===o?(u=138,3):n===o?(u=6,3):(u=7,4)}}n(w);var L=!1;function j(e,t,r,n){M(e,0+(n?1:0),3),function(e,t,r,n){I(e),A(e,r),A(e,~r),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r)}r._tr_init=function(e){L||(function(){var e,t,r,i,n,s=new Array(16);for(i=r=0;i<28;i++)for(m[i]=r,e=0;e<1<<d[i];e++)g[r++]=i;for(g[r-1]=i,i=n=0;i<16;i++)for(w[i]=n,e=0;e<1<<l[i];e++)y[n++]=i;for(n>>=7;i<a;i++)for(w[i]=n<<7,e=0;e<1<<l[i]-7;e++)y[256+n++]=i;for(t=0;t<=u;t++)s[t]=0;for(e=0;e<=143;)f[2*e+1]=8,e++,s[8]++;for(;e<=255;)f[2*e+1]=9,e++,s[9]++;for(;e<=279;)f[2*e+1]=7,e++,s[7]++;for(;e<=287;)f[2*e+1]=8,e++,s[8]++;for(k(f,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=x(e,5);v=new E(f,d,257,o,u),b=new E(p,l,0,a,u),_=new E(new Array(0),c,0,19,7)}(),L=!0),e.l_desc=new S(e.dyn_ltree,v),e.d_desc=new S(e.dyn_dtree,b),e.bl_desc=new S(e.bl_tree,_),e.bi_buf=0,e.bi_valid=0,O(e)},r._tr_stored_block=j,r._tr_flush_block=function(e,t,r,i){var n,o,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),D(e,e.l_desc),D(e,e.d_desc),a=function(e){var t;for(B(e,e.dyn_ltree,e.l_desc.max_code),B(e,e.dyn_dtree,e.d_desc.max_code),D(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?j(e,t,r,i):4===e.strategy||o===n?(M(e,2+(i?1:0),3),N(e,f,p)):(M(e,4+(i?1:0),3),function(e,t,r,i){var n;for(M(e,t-257,5),M(e,r-1,5),M(e,i-4,4),n=0;n<i;n++)M(e,e.bl_tree[2*h[n]+1],3);q(e,e.dyn_ltree,t-1),q(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),N(e,e.dyn_ltree,e.dyn_dtree)),O(e),i&&I(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(g[r]+s+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){M(e,2,3),R(e,256,f),function(e){16===e.bi_valid?(A(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var r,i,n,o,a=1,u={},d=!1,l=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,r="[object process]"==={}.toString.call(e.process)?function(e){s.nextTick((function(){f(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",p,!1):e.attachEvent("onmessage",p),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(f,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];var n={callback:e,args:t};return u[a]=n,r(a),a++},c.clearImmediate=h}function h(e){delete u[e]}function f(e){if(d)setTimeout(f,0,e);else{var t=u[e];if(t){d=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(undefined,r)}}(t)}finally{h(e),d=!1}}}}function p(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&f(+t.data.slice(o.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)},857:(e,t,r)=>{var i=r(7772).Symbol;e.exports=i},3366:(e,t,r)=>{var i=r(857),n=r(2107),s=r(7157),o=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?n(e):s(e)}},1242:(e,t,r)=>{var i="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=i},7353:(e,t,r)=>{var i=r(241)(Object.getPrototypeOf,Object);e.exports=i},2107:(e,t,r)=>{var i=r(857),n=Object.prototype,s=n.hasOwnProperty,o=n.toString,a=i?i.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var i=!0}catch(e){}var n=o.call(e);return i&&(t?e[a]=r:delete e[a]),n}},7157:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},241:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},7772:(e,t,r)=>{var i=r(1242),n="object"==typeof self&&self&&self.Object===Object&&self,s=i||n||Function("return this")();e.exports=s},6152:e=>{var t=Array.isArray;e.exports=t},1049:(e,t,r)=>{var i=r(3366),n=r(9259);e.exports=function(e){if(!n(e))return!1;var t=i(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},9259:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},9993:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},7030:(e,t,r)=>{var i=r(3366),n=r(7353),s=r(9993),o=Function.prototype,a=Object.prototype,u=o.toString,d=a.hasOwnProperty,l=u.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=i(e))return!1;var t=n(e);if(null===t)return!0;var r=d.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},5505:(e,t,r)=>{var i=r(3366),n=r(6152),s=r(9993);e.exports=function(e){return"string"==typeof e||!n(e)&&s(e)&&"[object String]"==i(e)}},7808:e=>{e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=i;var n={},s={};function o(e,t){var r,i,o;return t?(o=0<=(e>>>=0)&&e<256)&&(i=s[e])?i:(r=u(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=n[e])?i:(r=u(e,e<0?-1:0,!1),o&&(n[e]=r),r)}function a(e,t){if(isNaN(e))return t?m:g;if(t){if(e<0)return m;if(e>=f)return E}else{if(e<=-p)return S;if(e+1>=p)return w}return e<0?a(-e,t).neg():u(e%h|0,e/h|0,t)}function u(e,t,i){return new r(e,t,i)}r.fromInt=o,r.fromNumber=a,r.fromBits=u;var d=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return l(e.substring(1),t,r).neg();for(var n=a(d(r,8)),s=g,o=0;o<e.length;o+=8){var u=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+u),r);if(u<8){var h=a(d(r,u));s=s.mul(h).add(a(c))}else s=(s=s.mul(n)).add(a(c))}return s.unsigned=t,s}function c(e,t){return"number"==typeof e?a(e,t):"string"==typeof e?l(e,t):u(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=c;var h=4294967296,f=h*h,p=f/2,y=o(1<<24),g=o(0);r.ZERO=g;var m=o(0,!0);r.UZERO=m;var v=o(1);r.ONE=v;var b=o(1,!0);r.UONE=b;var _=o(-1);r.NEG_ONE=_;var w=u(-1,2147483647,!1);r.MAX_VALUE=w;var E=u(-1,-1,!0);r.MAX_UNSIGNED_VALUE=E;var S=u(0,-2147483648,!1);r.MIN_VALUE=S;var T=r.prototype;T.toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},T.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(S)){var t=a(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=a(d(e,6),this.unsigned),s=this,o="";;){var u=s.div(n),l=(s.sub(u.mul(n)).toInt()>>>0).toString(e);if((s=u).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},T.isZero=function(){return 0===this.high&&0===this.low},T.eqz=T.isZero,T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return i(e)||(e=c(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.ne=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.le=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.ge=T.greaterThanOrEqual,T.compare=function(e){if(i(e)||(e=c(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(v)},T.neg=T.negate,T.add=function(e){i(e)||(e=c(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,d=e.low>>>16,l=0,h=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,h+=(f+=n+d)>>>16,l+=(h+=r+a)>>>16,l+=t+o,u((f&=65535)<<16|(p&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},T.subtract=function(e){return i(e)||(e=c(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=c(e)),t)return u(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(S))return e.isOdd()?S:g;if(e.eq(S))return this.isOdd()?S:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(y)&&e.lt(y))return a(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,n=65535&this.high,s=this.low>>>16,o=65535&this.low,d=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=65535&e.low,p=0,m=0,v=0,b=0;return v+=(b+=o*f)>>>16,m+=(v+=s*f)>>>16,v&=65535,m+=(v+=o*h)>>>16,p+=(m+=n*f)>>>16,m&=65535,p+=(m+=s*h)>>>16,m&=65535,p+=(m+=o*l)>>>16,p+=r*f+n*h+s*l+o*d,u((v&=65535)<<16|(b&=65535),(p&=65535)<<16|(m&=65535),this.unsigned)},T.mul=T.multiply,T.divide=function(e){if(i(e)||(e=c(e)),e.isZero())throw Error("division by zero");var r,n,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?u((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return b;s=m}else{if(this.eq(S))return e.eq(v)||e.eq(_)?S:e.eq(S)?v:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:_:(n=this.sub(e.mul(r)),s=r.add(n.div(e)));if(e.eq(S))return this.unsigned?m:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),l=o<=48?1:d(2,o-48),h=a(r),f=h.mul(e);f.isNegative()||f.gt(n);)f=(h=a(r-=l,this.unsigned)).mul(e);h.isZero()&&(h=v),s=s.add(h),n=n.sub(f)}return s},T.div=T.divide,T.modulo=function(e){return i(e)||(e=c(e)),t?u((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.rem=T.modulo,T.not=function(){return u(~this.low,~this.high,this.unsigned)},T.and=function(e){return i(e)||(e=c(e)),u(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return i(e)||(e=c(e)),u(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return i(e)||(e=c(e)),u(this.low^e.low,this.high^e.high,this.unsigned)},T.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?u(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):u(0,this.low<<e-32,this.unsigned)},T.shl=T.shiftLeft,T.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?u(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):u(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},T.shr=T.shiftRight,T.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?u(this.low>>>e|t<<32-e,t>>>e,this.unsigned):u(32===e?t:t>>>e-32,0,this.unsigned)},T.shru=T.shiftRightUnsigned,T.shr_u=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},T.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,i){return i?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},7105:(e,t,r)=>{"use strict";const i=r(8006),n=Symbol("max"),s=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),u=Symbol("maxAge"),d=Symbol("dispose"),l=Symbol("noDisposeOnSet"),c=Symbol("lruList"),h=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1,y=(e,t,r)=>{const i=e[h].get(t);if(i){const t=i.value;if(g(e,t)){if(v(e,i),!e[a])return}else r&&(e[f]&&(i.value.now=Date.now()),e[c].unshiftNode(i));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[u]&&r>e[u]},m=e=>{if(e[s]>e[n])for(let t=e[c].tail;e[s]>e[n]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[d]&&e[d](r.key,r.value),e[s]-=r.length,e[h].delete(r.key),e[c].removeNode(t)}};class b{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const _=(e,t,r,i)=>{let n=r.value;g(e,n)&&(v(e,r),e[a]||(n=void 0)),n&&t.call(i,n.value,n.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[n]=e.max||1/0;const t=e.length||p;if(this[o]="function"!=typeof t?p:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[d]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[n]=e||1/0,m(this)}get max(){return this[n]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,m(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[o]&&(this[o]=e,this[s]=0,this[c].forEach((e=>{e.length=this[o](e.value,e.key),this[s]+=e.length}))),m(this)}get lengthCalculator(){return this[o]}get length(){return this[s]}get itemCount(){return this[c].length}rforEach(e,t){t=t||this;for(let r=this[c].tail;null!==r;){const i=r.prev;_(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[c].head;null!==r;){const i=r.next;_(this,e,r,t),r=i}}keys(){return this[c].toArray().map((e=>e.key))}values(){return this[c].toArray().map((e=>e.value))}reset(){this[d]&&this[c]&&this[c].length&&this[c].forEach((e=>this[d](e.key,e.value))),this[h]=new Map,this[c]=new i,this[s]=0}dump(){return this[c].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[c]}set(e,t,r){if((r=r||this[u])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const i=r?Date.now():0,a=this[o](t,e);if(this[h].has(e)){if(a>this[n])return v(this,this[h].get(e)),!1;const o=this[h].get(e).value;return this[d]&&(this[l]||this[d](e,o.value)),o.now=i,o.maxAge=r,o.value=t,this[s]+=a-o.length,o.length=a,this.get(e),m(this),!0}const f=new b(e,t,a,i,r);return f.length>this[n]?(this[d]&&this[d](e,t),!1):(this[s]+=f.length,this[c].unshift(f),this[h].set(e,this[c].head),m(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!g(this,t)}get(e){return y(this,e,!0)}peek(e){return y(this,e,!1)}pop(){const e=this[c].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[h].forEach(((e,t)=>y(this,t,!1)))}}},7993:(e,t,r)=>{"use strict";var i=r(1285),n=r(5232),s=r(7834).Buffer,o=new Array(16);function a(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<<t|e>>>32-t}function d(e,t,r,i,n,s,o){return u(e+(t&r|~t&i)+n+s|0,o)+t|0}function l(e,t,r,i,n,s,o){return u(e+(t&i|r&~i)+n+s|0,o)+t|0}function c(e,t,r,i,n,s,o){return u(e+(t^r^i)+n+s|0,o)+t|0}function h(e,t,r,i,n,s,o){return u(e+(r^(t|~i))+n+s|0,o)+t|0}i(a,n),a.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,i=this._b,n=this._c,s=this._d;r=d(r,i,n,s,e[0],3614090360,7),s=d(s,r,i,n,e[1],3905402710,12),n=d(n,s,r,i,e[2],606105819,17),i=d(i,n,s,r,e[3],3250441966,22),r=d(r,i,n,s,e[4],4118548399,7),s=d(s,r,i,n,e[5],1200080426,12),n=d(n,s,r,i,e[6],2821735955,17),i=d(i,n,s,r,e[7],4249261313,22),r=d(r,i,n,s,e[8],1770035416,7),s=d(s,r,i,n,e[9],2336552879,12),n=d(n,s,r,i,e[10],4294925233,17),i=d(i,n,s,r,e[11],2304563134,22),r=d(r,i,n,s,e[12],1804603682,7),s=d(s,r,i,n,e[13],4254626195,12),n=d(n,s,r,i,e[14],2792965006,17),r=l(r,i=d(i,n,s,r,e[15],1236535329,22),n,s,e[1],4129170786,5),s=l(s,r,i,n,e[6],3225465664,9),n=l(n,s,r,i,e[11],643717713,14),i=l(i,n,s,r,e[0],3921069994,20),r=l(r,i,n,s,e[5],3593408605,5),s=l(s,r,i,n,e[10],38016083,9),n=l(n,s,r,i,e[15],3634488961,14),i=l(i,n,s,r,e[4],3889429448,20),r=l(r,i,n,s,e[9],568446438,5),s=l(s,r,i,n,e[14],3275163606,9),n=l(n,s,r,i,e[3],4107603335,14),i=l(i,n,s,r,e[8],1163531501,20),r=l(r,i,n,s,e[13],2850285829,5),s=l(s,r,i,n,e[2],4243563512,9),n=l(n,s,r,i,e[7],1735328473,14),r=c(r,i=l(i,n,s,r,e[12],2368359562,20),n,s,e[5],4294588738,4),s=c(s,r,i,n,e[8],2272392833,11),n=c(n,s,r,i,e[11],1839030562,16),i=c(i,n,s,r,e[14],4259657740,23),r=c(r,i,n,s,e[1],2763975236,4),s=c(s,r,i,n,e[4],1272893353,11),n=c(n,s,r,i,e[7],4139469664,16),i=c(i,n,s,r,e[10],3200236656,23),r=c(r,i,n,s,e[13],681279174,4),s=c(s,r,i,n,e[0],3936430074,11),n=c(n,s,r,i,e[3],3572445317,16),i=c(i,n,s,r,e[6],76029189,23),r=c(r,i,n,s,e[9],3654602809,4),s=c(s,r,i,n,e[12],3873151461,11),n=c(n,s,r,i,e[15],530742520,16),r=h(r,i=c(i,n,s,r,e[2],3299628645,23),n,s,e[0],4096336452,6),s=h(s,r,i,n,e[7],1126891415,10),n=h(n,s,r,i,e[14],2878612391,15),i=h(i,n,s,r,e[5],4237533241,21),r=h(r,i,n,s,e[12],1700485571,6),s=h(s,r,i,n,e[3],2399980690,10),n=h(n,s,r,i,e[10],4293915773,15),i=h(i,n,s,r,e[1],2240044497,21),r=h(r,i,n,s,e[8],1873313359,6),s=h(s,r,i,n,e[15],4264355552,10),n=h(n,s,r,i,e[6],2734768916,15),i=h(i,n,s,r,e[13],1309151649,21),r=h(r,i,n,s,e[4],4149444226,6),s=h(s,r,i,n,e[11],3174756917,10),n=h(n,s,r,i,e[2],718787259,15),i=h(i,n,s,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+s|0},a.prototype._digest=function(){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),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=s.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},9561:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},3022:(e,t)=>{"use strict";var r=t;function i(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",r=0;r<e.length;r++)t+=i(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16));else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),s=n>>8,o=255&n;s?r.push(s,o):r.push(o)}return r},r.zero2=i,r.toHex=n,r.encode=function(e,t){return"hex"===t?n(e):e}},1378:e=>{var t=1e3,r=60*t,i=60*r,n=24*i;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,o){o=o||{};var a,u,d=typeof e;if("string"===d&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(s){var o=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*n;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*r;case"seconds":case"second":case"secs":case"sec":case"s":return o*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(e);if("number"===d&&isFinite(e))return o.long?(a=e,(u=Math.abs(a))>=n?s(a,u,n,"day"):u>=i?s(a,u,i,"hour"):u>=r?s(a,u,r,"minute"):u>=t?s(a,u,t,"second"):a+" ms"):function(e){var s=Math.abs(e);return s>=n?Math.round(e/n)+"d":s>=i?Math.round(e/i)+"h":s>=r?Math.round(e/r)+"m":s>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},8169:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,r){return 0===e&&0===r?1/e==1/r:e===r||!(!t(e)||!t(r))}},4679:(e,t,r)=>{"use strict";var i=r(4926),n=r(9429),s=r(8169),o=r(8070),a=r(191),u=n(o(),Object);i(u,{getPolyfill:o,implementation:s,shim:a}),e.exports=u},8070:(e,t,r)=>{"use strict";var i=r(8169);e.exports=function(){return"function"==typeof Object.is?Object.is:i}},191:(e,t,r)=>{"use strict";var i=r(8070),n=r(4926);e.exports=function(){var e=i();return n(Object,{is:e},{is:function(){return Object.is!==e}}),e}},5691:(e,t,r)=>{"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=r(801),a=Object.prototype.propertyIsEnumerable,u=!a.call({toString:null},"toString"),d=a.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&n.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{c(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();i=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===s.call(e),i=o(e),a=t&&"[object String]"===s.call(e),h=[];if(!t&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=d&&r;if(a&&e.length>0&&!n.call(e,0))for(var y=0;y<e.length;++y)h.push(String(y));if(i&&e.length>0)for(var g=0;g<e.length;++g)h.push(String(g));else for(var m in e)p&&"prototype"===m||!n.call(e,m)||h.push(String(m));if(u)for(var v=function(e){if("undefined"==typeof window||!f)return c(e);try{return c(e)}catch(e){return!1}}(e),b=0;b<l.length;++b)v&&"constructor"===l[b]||!n.call(e,l[b])||h.push(l[b]);return h}}e.exports=i},3464:(e,t,r)=>{"use strict";var i=Array.prototype.slice,n=r(801),s=Object.keys,o=s?function(e){return s(e)}:r(5691),a=Object.keys;o.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return n(e)?a(i.call(e)):a(e)})}else Object.keys=o;return Object.keys||o},e.exports=o},801:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),i}},4406:e=>{var t,r,i=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,u=[],d=!1,l=-1;function c(){d&&a&&(d=!1,a.length?u=a.concat(u):l=-1,u.length&&h())}function h(){if(!d){var e=o(c);d=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new f(e,t)),1!==u.length||d||o(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},3448:(e,t,r)=>{"use strict";e.exports=r(9188)},3746:(e,t,r)=>{"use strict";var i=t,n=r(6901),s=r(8066);function o(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(d%s){",i);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)t.repeated&&s[o[a]]===t.typeDefault&&e("default:"),e("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",i,s[o[a]])("break");e("}")}else e('if(typeof d%s!=="object")',i)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",i,r,i);else{var u=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",i,i);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",i,i);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",i,i);break;case"uint64":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,u)('else if(typeof d%s==="string")',i)("m%s=parseInt(d%s,10)",i,i)('else if(typeof d%s==="number")',i)("m%s=d%s",i,i)('else if(typeof d%s==="object")',i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",i,i,i,u?"true":"");break;case"bytes":e('if(typeof d%s==="string")',i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",i,i,i)("else if(d%s.length)",i)("m%s=d%s",i,i);break;case"string":e("m%s=String(d%s)",i,i);break;case"bool":e("m%s=Boolean(d%s)",i,i)}}return e}function a(e,t,r,i){if(t.resolvedType)t.resolvedType instanceof n?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",i,r,i,i):e("d%s=types[%i].toObject(m%s,o)",i,r,i);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",i,i,i,i);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',i)("d%s=o.longs===String?String(m%s):m%s",i,i,i)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",i,i,i,i,s?"true":"",i);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",i,i,i,i,i);break;default:e("d%s=m%s",i,i)}}return e}i.fromObject=function(e){var t=e.fieldsArray,r=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var i=0;i<t.length;++i){var a=t[i].resolve(),u=s.safeProp(a.name);a.map?(r("if(d%s){",u)('if(typeof d%s!=="object")',u)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",u)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",u),o(r,a,i,u+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",u)("if(!Array.isArray(d%s))",u)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",u)("for(var i=0;i<d%s.length;++i){",u),o(r,a,i,u+"[i]")("}")("}")):(a.resolvedType instanceof n||r("if(d%s!=null){",u),o(r,a,i,u),a.resolvedType instanceof n||r("}"))}return r("return m")},i.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var r=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],o=[],u=[],d=0;d<t.length;++d)t[d].partOf||(t[d].resolve().repeated?i:t[d].map?o:u).push(t[d]);if(i.length){for(r("if(o.arrays||o.defaults){"),d=0;d<i.length;++d)r("d%s=[]",s.safeProp(i[d].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),d=0;d<o.length;++d)r("d%s={}",s.safeProp(o[d].name));r("}")}if(u.length){for(r("if(o.defaults){"),d=0;d<u.length;++d){var l=u[d],c=s.safeProp(l.name);if(l.resolvedType instanceof n)r("d%s=o.enums===String?%j:%j",c,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var h="["+Array.prototype.slice.call(l.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,l.typeDefault))("else{")("d%s=%s",c,h)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else r("d%s=%j",c,l.typeDefault)}r("}")}var f=!1;for(d=0;d<t.length;++d){l=t[d];var p=e._fieldsArray.indexOf(l);c=s.safeProp(l.name),l.map?(f||(f=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),a(r,l,p,c+"[ks2[j]]")("}")):l.repeated?(r("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),a(r,l,p,c+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",c,l.name),a(r,l,p,c),l.partOf&&r("if(o.oneofs)")("d%s=%j",s.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}},9847:(e,t,r)=>{"use strict";e.exports=function(e){var t=s.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break"),t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),u=a.resolvedType instanceof i?"int32":a.type,d="m"+s.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",d)("%s={}",d)("var c2 = r.uint32()+r.pos"),void 0!==n.defaults[a.keyType]?t("k=%j",n.defaults[a.keyType]):t("k=null"),void 0!==n.defaults[u]?t("value=%j",n.defaults[u]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===n.basic[u]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",u),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==n.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',d):t("%s[k]=value",d)):a.repeated?(t("if(!(%s&&%s.length))",d,d)("%s=[]",d),void 0!==n.packed[u]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",d,u)("}else"),void 0===n.basic[u]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",d,r):t("%s.push(r.%s())",d,u)):void 0===n.basic[u]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",d,r):t("%s=r.%s()",d,u),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var l=e._fieldsArray[r];l.required&&t("if(!m.hasOwnProperty(%j))",l.name)("throw util.ProtocolError(%j,{instance:m})",o(l))}return t("return m")};var i=r(6901),n=r(3970),s=r(8066);function o(e){return"missing required '"+e.name+"'"}},5191:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),u=0;u<a.length;++u){var d=a[u].resolve(),l=e._fieldsArray.indexOf(d),c=d.resolvedType instanceof i?"int32":d.type,h=n.basic[c];t="m"+s.safeProp(d.name),d.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,d.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(d.id<<3|2)>>>0,8|n.mapKey[d.keyType],d.keyType),void 0===h?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",l,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,c,t),r("}")("}")):d.repeated?(r("if(%s!=null&&%s.length){",t,t),d.packed&&void 0!==n.packed[c]?r("w.uint32(%i).fork()",(d.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",c,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===h?o(r,d,l,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(d.id<<3|h)>>>0,c,t)),r("}")):(d.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,d.name),void 0===h?o(r,d,l,t):r("w.uint32(%i).%s(%s)",(d.id<<3|h)>>>0,c,t))}return r("return w")};var i=r(6901),n=r(3970),s=r(8066);function o(e,t,r,i){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,i,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,i,(t.id<<3|2)>>>0)}},6901:(e,t,r)=>{"use strict";e.exports=o;var i=r(7641);((o.prototype=Object.create(i.prototype)).constructor=o).className="Enum";var n=r(9788),s=r(8066);function o(e,t,r,n,s){if(i.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=s||{},this.reserved=void 0,t)for(var o=Object.keys(t),a=0;a<o.length;++a)"number"==typeof t[o[a]]&&(this.valuesById[this.values[o[a]]=t[o[a]]]=o[a])}o.fromJSON=function(e,t){var r=new o(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,r){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},o.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)}},797:(e,t,r)=>{"use strict";e.exports=d;var i=r(7641);((d.prototype=Object.create(i.prototype)).constructor=d).className="Field";var n,s=r(6901),o=r(3970),a=r(8066),u=/^required|optional|repeated$/;function d(e,t,r,n,s,d,l){if(a.isObject(n)?(l=s,d=n,n=s=void 0):a.isObject(s)&&(l=d,d=s,s=void 0),i.call(this,e,d),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!u.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===n&&(n="optional"),this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}d.fromJSON=function(e,t){return new d(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(d.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),d.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),i.prototype.setOption.call(this,e,t,r)},d.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},d.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof n?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof n&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},d.d=function(e,t,r,i){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(n,s){a.decorateType(n.constructor).add(new d(s,e,t,r,{default:i}))}},d._configure=function(e){n=e}},9188:(e,t,r)=>{"use strict";var i=e.exports=r(536);i.build="light",i.load=function(e,t,r){return"function"==typeof t?(r=t,t=new i.Root):t||(t=new i.Root),t.load(e,r)},i.loadSync=function(e,t){return t||(t=new i.Root),t.loadSync(e)},i.encoder=r(5191),i.decoder=r(9847),i.verifier=r(2332),i.converter=r(3746),i.ReflectionObject=r(7641),i.Namespace=r(9788),i.Root=r(742),i.Enum=r(6901),i.Type=r(3138),i.Field=r(797),i.OneOf=r(6898),i.MapField=r(1981),i.Service=r(9355),i.Method=r(8820),i.Message=r(3611),i.wrappers=r(6423),i.types=r(3970),i.util=r(8066),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service,i.Enum),i.Root._configure(i.Type),i.Field._configure(i.Type)},536:(e,t,r)=>{"use strict";var i=t;function n(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}i.build="minimal",i.Writer=r(123),i.BufferWriter=r(6673),i.Reader=r(9799),i.BufferReader=r(7038),i.util=r(4165),i.rpc=r(4963),i.roots=r(9009),i.configure=n,n()},1981:(e,t,r)=>{"use strict";e.exports=o;var i=r(797);((o.prototype=Object.create(i.prototype)).constructor=o).className="MapField";var n=r(3970),s=r(8066);function o(e,t,r,n,o,a){if(i.call(this,e,t,n,void 0,void 0,o,a),!s.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},o.d=function(e,t,r){return"function"==typeof r?r=s.decorateType(r).name:r&&"object"==typeof r&&(r=s.decorateEnum(r).name),function(i,n){s.decorateType(i.constructor).add(new o(n,e,t,r))}}},3611:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}n.create=function(e){return this.$type.create(e)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.fromObject=function(e){return this.$type.fromObject(e)},n.toObject=function(e,t){return this.$type.toObject(e,t)},n.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},8820:(e,t,r)=>{"use strict";e.exports=s;var i=r(7641);((s.prototype=Object.create(i.prototype)).constructor=s).className="Method";var n=r(8066);function s(e,t,r,s,o,a,u,d,l){if(n.isObject(o)?(u=o,o=a=void 0):n.isObject(a)&&(u=a,a=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(s))throw TypeError("responseType must be a string");i.call(this,e,u),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=d,this.parsedOptions=l}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return n.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},9788:(e,t,r)=>{"use strict";e.exports=c;var i=r(7641);((c.prototype=Object.create(i.prototype)).constructor=c).className="Namespace";var n,s,o,a=r(797),u=r(6898),d=r(8066);function l(e,t){if(e&&e.length){for(var r={},i=0;i<e.length;++i)r[e[i].name]=e[i].toJSON(t);return r}}function c(e,t){i.call(this,e,t),this.nested=void 0,this._nestedArray=null}function h(e){return e._nestedArray=null,e}c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=l,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=d.toArray(this.nested))}}),c.prototype.toJSON=function(e){return d.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?n.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:c.fromJSON)(r[i],t));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof n||e instanceof o||e instanceof s||e instanceof c||e instanceof u))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof c&&e instanceof c)||t instanceof n||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),h(this)},c.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),h(this)},c.prototype.define=function(e,t){if(d.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var i=e.shift();if(r.nested&&r.nested[i]){if(!((r=r.nested[i])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(i))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),d.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var i=this.get(e[0]);if(i){if(1===e.length){if(!t||t.indexOf(i.constructor)>-1)return i}else if(i instanceof c&&(i=i.lookup(e.slice(1),t,!0)))return i}else for(var n=0;n<this.nestedArray.length;++n)if(this._nestedArray[n]instanceof c&&(i=this._nestedArray[n].lookup(e,t,!0)))return i;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such type: "+e);return t},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[n,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},c.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,t,r){n=e,s=t,o=r}},7641:(e,t,r)=>{"use strict";e.exports=s,s.className="ReflectionObject";var i,n=r(8066);function s(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(s.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),s.prototype.toJSON=function(){throw Error()},s.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},s.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},s.prototype.resolve=function(){return this.resolved||this.root instanceof i&&(this.resolved=!0),this},s.prototype.getOption=function(e){if(this.options)return this.options[e]},s.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},s.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var i=this.parsedOptions;if(r){var s=i.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(s){var o=s[e];n.setProperty(o,r,t)}else(s={})[e]=n.setProperty({},r,t),i.push(s)}else{var a={};a[e]=t,i.push(a)}return this},s.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)this.setOption(r[i],e[r[i]],t);return this},s.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},s._configure=function(e){i=e}},6898:(e,t,r)=>{"use strict";e.exports=o;var i=r(7641);((o.prototype=Object.create(i.prototype)).constructor=o).className="OneOf";var n=r(797),s=r(8066);function o(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},o.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){s.decorateType(t.constructor).add(new o(r,e)),Object.defineProperty(t,r,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},9799:(e,t,r)=>{"use strict";e.exports=u;var i,n=r(4165),s=n.LongBits,o=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var d,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},c=function(){return n.Buffer?function(e){return(u.create=function(e){return n.Buffer.isBuffer(e)?new i(e):l(e)})(e)}:l};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,u.prototype.uint32=(d=4294967295,function(){if(d=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return d;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return d}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},u.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){i=e,u.create=c(),i._configure();var t=n.Long?"toLong":"toNumber";n.merge(u.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},7038:(e,t,r)=>{"use strict";e.exports=s;var i=r(9799);(s.prototype=Object.create(i.prototype)).constructor=s;var n=r(4165);function s(e){i.call(this,e)}s._configure=function(){n.Buffer&&(s.prototype._slice=n.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},742:(e,t,r)=>{"use strict";e.exports=c;var i=r(9788);((c.prototype=Object.create(i.prototype)).constructor=c).className="Root";var n,s,o,a=r(797),u=r(6901),d=r(6898),l=r(8066);function c(e){i.call(this,"",e),this.deferred=[],this.files=[]}function h(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=l.path.resolve,c.prototype.fetch=l.fetch,c.prototype.load=function e(t,r,i){"function"==typeof r&&(i=r,r=void 0);var n=this;if(!i)return l.asPromise(e,n,t,r);var a=i===h;function u(e,t){if(i){var r=i;if(i=null,a)throw e;r(e,t)}}function d(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in o)return r}return null}function c(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){s.filename=e;var i,o=s(t,n,r),c=0;if(o.imports)for(;c<o.imports.length;++c)(i=d(o.imports[c])||n.resolvePath(e,o.imports[c]))&&f(i);if(o.weakImports)for(c=0;c<o.weakImports.length;++c)(i=d(o.weakImports[c])||n.resolvePath(e,o.weakImports[c]))&&f(i,!0)}else n.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}a||p||u(null,n)}function f(e,t){if(!(n.files.indexOf(e)>-1))if(n.files.push(e),e in o)a?c(e,o[e]):(++p,setTimeout((function(){--p,c(e,o[e])})));else if(a){var r;try{r=l.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}c(e,r)}else++p,n.fetch(e,(function(r,s){--p,i&&(r?t?p||u(null,n):u(r):c(e,s))}))}var p=0;l.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=n.resolvePath("",t[g]))&&f(y);if(a)return n;p||u(null,n)},c.prototype.loadSync=function(e,t){if(!l.isNode)throw Error("not supported");return this.load(e,t,h)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return i.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var r=t.parent.lookup(t.extend);if(r){var i=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return i.declaringField=t,t.extensionField=i,r.add(i),!0}return!1}c.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof u)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof d)){if(e instanceof n)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);f.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof u)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof i){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);f.test(e.name)&&delete e.parent[e.name]}},c._configure=function(e,t,r){n=e,s=t,o=r}},9009:e=>{"use strict";e.exports={}},4963:(e,t,r)=>{"use strict";t.Service=r(9548)},9548:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(n.prototype=Object.create(i.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,r,n,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return i.asPromise(e,a,t,r,n,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof n))try{r=n[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){o(e)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9355:(e,t,r)=>{"use strict";e.exports=a;var i=r(9788);((a.prototype=Object.create(i.prototype)).constructor=a).className="Service";var n=r(8820),s=r(8066),o=r(4963);function a(e,t){i.call(this,e,t),this.methods={},this._methodsArray=null}function u(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var i=Object.keys(t.methods),s=0;s<i.length;++s)r.add(n.fromJSON(i[s],t.methods[i[s]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return s.toObject(["options",t&&t.options||void 0,"methods",i.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||i.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return i.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?(this.methods[e.name]=e,e.parent=this,u(this)):i.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,u(this)}return i.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var i,n=new o.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var u=s.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");n[u]=s.codegen(["r","c"],s.isReserved(u)?u+"_":u)("return this.rpcCall(m,q,s,r,c)")({m:i,q:i.resolvedRequestType.ctor,s:i.resolvedResponseType.ctor})}return n}},3138:(e,t,r)=>{"use strict";e.exports=v;var i=r(9788);((v.prototype=Object.create(i.prototype)).constructor=v).className="Type";var n=r(6901),s=r(6898),o=r(797),a=r(1981),u=r(9355),d=r(3611),l=r(9799),c=r(123),h=r(8066),f=r(5191),p=r(9847),y=r(2332),g=r(3746),m=r(6423);function v(e,t){i.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],i=r.id;if(this._fieldsById[i])throw Error("duplicate id "+i+" in "+this);this._fieldsById[i]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=h.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=h.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof d||((e.prototype=new d).constructor=e,h.merge(e.prototype,t)),e.$type=e.prototype.$type=this,h.merge(e,d,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var i={};for(r=0;r<this.oneofsArray.length;++r)i[this._oneofsArray[r].resolve().name]={get:h.oneOfGetter(this._oneofsArray[r].oneof),set:h.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,i)}}}),v.generateConstructor=function(e){for(var t,r=h.codegen(["p"],e.name),i=0;i<e.fieldsArray.length;++i)(t=e._fieldsArray[i]).map?r("this%s={}",h.safeProp(t.name)):t.repeated&&r("this%s=[]",h.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var d=Object.keys(t.fields),l=0;l<d.length;++l)r.add((void 0!==t.fields[d[l]].keyType?a.fromJSON:o.fromJSON)(d[l],t.fields[d[l]]));if(t.oneofs)for(d=Object.keys(t.oneofs),l=0;l<d.length;++l)r.add(s.fromJSON(d[l],t.oneofs[d[l]]));if(t.nested)for(d=Object.keys(t.nested),l=0;l<d.length;++l){var c=t.nested[d[l]];r.add((void 0!==c.id?o.fromJSON:void 0!==c.fields?v.fromJSON:void 0!==c.values?n.fromJSON:void 0!==c.methods?u.fromJSON:i.fromJSON)(d[l],c))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return h.toObject(["options",t&&t.options||void 0,"oneofs",i.arrayToJSON(this.oneofsArray,e),"fields",i.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return i.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):i.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return i.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=f(this)({Writer:c,types:t,util:h}),this.decode=p(this)({Reader:l,types:t,util:h}),this.verify=y(this)({types:t,util:h}),this.fromObject=g.fromObject(this)({types:t,util:h}),this.toObject=g.toObject(this)({types:t,util:h});var i=m[e];if(i){var n=Object.create(this);n.fromObject=this.fromObject,this.fromObject=i.fromObject.bind(n),n.toObject=this.toObject,this.toObject=i.toObject.bind(n)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof l||(e=l.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){h.decorateType(t,e)}}},3970:(e,t,r)=>{"use strict";var i=t,n=r(8066),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,i={};for(t|=0;r<e.length;)i[s[r+t]]=e[r++];return i}i.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n.emptyArray,null]),i.long=o([0,0,0,1,1],7),i.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},8066:(e,t,r)=>{"use strict";var i,n,s=e.exports=r(4165),o=r(9009);s.codegen=r(1706),s.fetch=r(4641),s.path=r(2659),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),i=0;i<t.length;)r[i]=e[t[i++]];return r}return[]},s.toObject=function(e){for(var t={},r=0;r<e.length;){var i=e[r++],n=e[r++];void 0!==n&&(t[i]=n)}return t};var a=/\\/g,u=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(u,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var d=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(d,(function(e,t){return t.toUpperCase()}))},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;i||(i=r(3138));var n=new i(t||e.name);return s.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var l=0;s.decorateEnum=function(e){if(e.$type)return e.$type;n||(n=r(6901));var t=new n("Enum"+l++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,i){var n=r.shift();if("__proto__"===n)return t;if(r.length>0)t[n]=e(t[n]||{},r,i);else{var s=t[n];s&&(i=[].concat(s).concat(i)),t[n]=i}return t}(e,t=t.split("."),r)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(742)))}})},1697:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=n.zero=new n(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(i.isString(e)){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):s},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?s:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},4165:function(e,t,r){"use strict";var i=t;function n(e,t,r){for(var i=Object.keys(t),n=0;n<i.length;++n)void 0!==e[i[n]]&&r||(e[i[n]]=t[i[n]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&n(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}i.asPromise=r(6781),i.base64=r(7026),i.EventEmitter=r(5570),i.float=r(5298),i.inquire=r(6116),i.utf8=r(7958),i.pool=r(804),i.LongBits=r(1697),i.isNode=Boolean(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),i.global=i.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},i.isString=function(e){return"string"==typeof e||e instanceof String},i.isObject=function(e){return e&&"object"==typeof e},i.isset=i.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var r=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},i.merge=n,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=s,i.ProtocolError=s("ProtocolError"),i.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},i.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var e=i.Buffer;e?(i._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},i._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):i._Buffer_from=i._Buffer_allocUnsafe=null}},2332:(e,t,r)=>{"use strict";e.exports=function(e){var t=n.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r={};e.oneofsArray.length&&t("var p={}");for(var i=0;i<e.fieldsArray.length;++i){var u=e._fieldsArray[i].resolve(),d="m"+n.safeProp(u.name);if(u.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",d,u.name),u.map)t("if(!util.isObject(%s))",d)("return%j",s(u,"object"))("var k=Object.keys(%s)",d)("for(var i=0;i<k.length;++i){"),a(t,u,"k[i]"),o(t,u,i,d+"[k[i]]")("}");else if(u.repeated)t("if(!Array.isArray(%s))",d)("return%j",s(u,"array"))("for(var i=0;i<%s.length;++i){",d),o(t,u,i,d+"[i]")("}");else{if(u.partOf){var l=n.safeProp(u.partOf.name);1===r[u.partOf.name]&&t("if(p%s===1)",l)("return%j",u.partOf.name+": multiple values"),r[u.partOf.name]=1,t("p%s=1",l)}o(t,u,i,d)}u.optional&&t("}")}return t("return null")};var i=r(6901),n=r(8066);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(%s){",n)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,n)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",n)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',n)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',n)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",n)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",s(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",s(t,"boolean key"))}return e}},6423:(e,t,r)=>{"use strict";var i=t,n=r(3611);i[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var i="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return-1===i.indexOf("/")&&(i="/"+i),this.create({type_url:i,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",i="";if(t&&t.json&&e.type_url&&e.value){i=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(i);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof n){var o=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),i=r+("."===e.$type.fullName[0]?e.$type.fullName.substr(1):e.$type.fullName),o["@type"]=i,o}return this.toObject(e,t)}}},123:(e,t,r)=>{"use strict";e.exports=c;var i,n=r(4165),s=n.LongBits,o=n.base64,a=n.utf8;function u(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function d(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new u(d,0,0),this.tail=this.head,this.states=null}var h=function(){return n.Buffer?function(){return(c.create=function(){return new i})()}:function(){return new c}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.create=h(),c.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(e,t,r){return this.tail=this.tail.next=new u(e,t,r),this.len+=t,this},p.prototype=Object.create(u.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},c.prototype.bool=function(e){return this._push(f,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var m=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var i=0;i<e.length;++i)t[r+i]=e[i]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(n.isString(e)){var r=c.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},c.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new u(d,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(d,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},c._configure=function(e){i=e,c.create=h(),i._configure()}},6673:(e,t,r)=>{"use strict";e.exports=s;var i=r(123);(s.prototype=Object.create(i.prototype)).constructor=s;var n=r(4165);function s(){i.call(this)}function o(e,t,r){e.length<40?n.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=n._Buffer_allocUnsafe,s.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var i=0;i<e.length;)t[r++]=e[i++]}},s.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},4452:e=>{"use strict";var t={};function r(e,r,i){i||(i=Error);var n=function(e){var t,i;function n(t,i,n){return e.call(this,function(e,t,i){return"string"==typeof r?r:r(e,t,i)}(t,i,n))||this}return i=e,(t=n).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i,n}(i);n.prototype.name=i.name,n.prototype.code=e,t[e]=n}function i(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,s,o,a,u;if("string"==typeof t&&(s="not ",t.substr(0,s.length)===s)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))o="The ".concat(e," ").concat(n," ").concat(i(t,"type"));else{var d=("number"!=typeof u&&(u=0),u+".".length>(a=e).length||-1===a.indexOf(".",u)?"argument":"property");o='The "'.concat(e,'" ').concat(d," ").concat(n," ").concat(i(t,"type"))}return o+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},7073:(e,t,r)=>{"use strict";var i=r(4406),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var s=r(8051),o=r(2557);r(1285)(l,s);for(var a=n(o.prototype),u=0;u<a.length;u++){var d=a[u];l.prototype[d]||(l.prototype[d]=o.prototype[d])}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||i.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},5163:(e,t,r)=>{"use strict";e.exports=n;var i=r(7640);function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}r(1285)(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},8051:(e,t,r)=>{"use strict";var i,n=r(4406);e.exports=A,A.ReadableState=T,r(2699).EventEmitter;var s,o=function(e,t){return e.listeners(t).length},a=r(5010),u=r(8834).Buffer,d=r.g.Uint8Array||function(){},l=r(6602);s=l&&l.debuglog?l.debuglog("stream"):function(){};var c,h,f,p=r(6637),y=r(2262),g=r(7605).getHighWaterMark,m=r(4452).q,v=m.ERR_INVALID_ARG_TYPE,b=m.ERR_STREAM_PUSH_AFTER_EOF,_=m.ERR_METHOD_NOT_IMPLEMENTED,w=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(1285)(A,a);var E=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function T(e,t,n){i=i||r(7073),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(c||(c=r(1922).s),this.decoder=new c(e.encoding),this.encoding=e.encoding)}function A(e){if(i=i||r(7073),!(this instanceof A))return new A(e);var t=this instanceof i;this._readableState=new T(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function M(e,t,r,i,n){s("readableAddChunk",t);var o,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(s("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?O(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,I(e)))}}(e,a);else if(n||(o=function(e,t){var r,i;return i=t,u.isBuffer(i)||i instanceof d||"string"==typeof t||void 0===t||e.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],t)),r}(a,t)),o)E(e,o);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),i)a.endEmitted?E(e,new w):R(e,a,t,!0);else if(a.ended)E(e,new b);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?R(e,a,t,!1):C(e,a)):R(e,a,t,!1)}else i||(a.reading=!1,C(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function R(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&O(e)),C(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=y.destroy,A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=u.from(e,t),t=""),r=!0),M(this,e,t,!1,r)},A.prototype.unshift=function(e){return M(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){c||(c=r(1922).s);var t=new c(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,n="";null!==i;)n+=t.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var x=1073741824;function k(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e){var t=e._readableState;s("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(I,e))}function I(e){var t=e._readableState;s("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,q(e)}function C(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(s("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function D(e){s("readable nexttick read 0"),e.read(0)}function B(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),q(e),t.flowing&&!t.reading&&e.read(0)}function q(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function L(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function j(e){var t=e._readableState;s("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(F,t,e))}function F(e,t){if(s("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function U(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}A.prototype.read=function(e){s("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return s("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):O(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&j(this),null;var i,n=t.needReadable;return s("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&s("length less than watermark",n=!0),t.ended||t.reading?s("reading or ended",n=!1):n&&(s("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=k(r,t))),null===(i=e>0?L(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){E(this,new _("_read()"))},A.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,s("pipe count=%d opts=%j",i.pipesCount,t);var a=t&&!1===t.end||e===n.stdout||e===n.stderr?y:u;function u(){s("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",(function t(n,o){s("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,s("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",d),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",c),l=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||d())}));var d=function(e){return function(){var t=e._readableState;s("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,q(e))}}(r);e.on("drain",d);var l=!1;function c(t){s("ondata");var n=e.write(t);s("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==U(i.pipes,e))&&!l&&(s("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(t){s("onerror",t),y(),e.removeListener("error",h),0===o(e,"error")&&E(e,t)}function f(){e.removeListener("finish",p),y()}function p(){s("onfinish"),e.removeListener("close",f),y()}function y(){s("unpipe"),r.unpipe(e)}return r.on("data",c),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events.error?Array.isArray(e._events.error)?e._events.error.unshift(r):e._events.error=[r,e._events.error]:e.on(t,r)}(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),i.flowing||(s("pipe resume"),r.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=U(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},A.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s("on readable",i.length,i.reading),i.length?O(this):i.reading||n.nextTick(D,this))),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(N,this),r},A.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(N,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(s("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(B,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(s("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){s("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var o=0;o<S.length;o++)e.on(S[o],this.emit.bind(this,S[o]));return this._read=function(t){s("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(1029)),h(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=L,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===f&&(f=r(352)),f(A,e,t)})},7640:(e,t,r)=>{"use strict";e.exports=l;var i=r(4452).q,n=i.ERR_METHOD_NOT_IMPLEMENTED,s=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(7073);function d(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);u.call(this,e),this._transformState={afterTransform:d.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}r(1285)(l,u),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new n("_transform()"))},l.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},l.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},2557:(e,t,r)=>{"use strict";var i,n=r(4406);function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(undefined),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=A,A.WritableState=T;var o,a={deprecate:r(5803)},u=r(5010),d=r(8834).Buffer,l=r.g.Uint8Array||function(){},c=r(2262),h=r(7605).getHighWaterMark,f=r(4452).q,p=f.ERR_INVALID_ARG_TYPE,y=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,m=f.ERR_STREAM_CANNOT_PIPE,v=f.ERR_STREAM_DESTROYED,b=f.ERR_STREAM_NULL_VALUES,_=f.ERR_STREAM_WRITE_AFTER_END,w=f.ERR_UNKNOWN_ENCODING,E=c.errorOrDestroy;function S(){}function T(e,t,o){i=i||r(7073),e=e||{},"boolean"!=typeof o&&(o=t instanceof i),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,s=r.writecb;if("function"!=typeof s)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,s){--t.pendingcb,r?(n.nextTick(s,i),n.nextTick(I,e,t),e._writableState.errorEmitted=!0,E(e,i)):(s(i),e._writableState.errorEmitted=!0,E(e,i),I(e,t))}(e,r,i,t,s);else{var o=k(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||x(e,r),i?n.nextTick(R,e,r,o,s):R(e,r,o,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function A(e){var t=this instanceof(i=i||r(7073));if(!t&&!o.call(A,this))return new A(e);this._writableState=new T(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function M(e,t,r,i,n,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):r?e._writev(n,t.onwrite):e._write(n,s,t.onwrite),t.sync=!1}function R(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),I(e,t)}function x(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)n[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;n.allBuffers=u,M(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,l=r.encoding,c=r.callback;if(M(e,t,!1,t.objectMode?1:d.length,d,l,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function O(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var r=k(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(O,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}r(1285)(A,u),T.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(T.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!o.call(this,e)||this===A&&e&&e._writableState instanceof T}})):o=function(e){return e instanceof this},A.prototype.pipe=function(){E(this,new m)},A.prototype.write=function(e,t,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=e,d.isBuffer(i)||i instanceof l);return a&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof r&&(r=S),s.ending?function(e,t){var r=new _;E(e,r),n.nextTick(t,r)}(this,r):(a||function(e,t,r,i){var s;return null===r?s=new b:"string"==typeof r||t.objectMode||(s=new p("chunk",["string","Buffer"],r)),!s||(E(e,s),n.nextTick(i,s),!1)}(this,s,e,r))&&(s.pendingcb++,o=function(e,t,r,i,n,s){if(!r){var o=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,r)),t}(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var a=t.objectMode?1:i.length;t.length+=a;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else M(e,t,!1,a,i,n,s);return u}(this,s,a,e,t,r)),o},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||x(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,i,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=c.destroy,A.prototype._undestroy=c.undestroy,A.prototype._destroy=function(e,t){t(e)}},1029:(e,t,r)=>{"use strict";var i,n=r(4406),s=r(6139).Promise;function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(9885),u=Symbol("lastResolve"),d=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),h=Symbol("lastPromise"),f=Symbol("handlePromise"),p=Symbol("stream");function y(e,t){return{value:e,done:t}}function g(e){var t=e[u];if(null!==t){var r=e[p].read();null!==r&&(e[h]=null,e[u]=null,e[d]=null,t(y(r,!1)))}}function m(e){n.nextTick(g,e)}var v=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(i={get stream(){return this[p]},next:function(){var e=this,t=this[l];if(null!==t)return s.reject(t);if(this[c])return s.resolve(y(void 0,!0));if(this[p].destroyed)return new s((function(t,r){n.nextTick((function(){e[l]?r(e[l]):t(y(void 0,!0))}))}));var r,i=this[h];if(i)r=new s(function(e,t){return function(r,i){e.then((function(){t[c]?r(y(void 0,!0)):t[f](r,i)}),i)}}(i,this));else{var o=this[p].read();if(null!==o)return s.resolve(y(o,!1));r=new s(this[f])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),o(i,"return",(function(){var e=this;return new s((function(t,r){e[p].destroy(null,(function(e){e?r(e):t(y(void 0,!0))}))}))})),i),v);e.exports=function(e){var t,r=Object.create(b,(o(t={},p,{value:e,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,d,{value:null,writable:!0}),o(t,l,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var i=r[p].read();i?(r[h]=null,r[u]=null,r[d]=null,e(y(i,!1))):(r[u]=e,r[d]=t)},writable:!0}),t));return r[h]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[d];return null!==t&&(r[h]=null,r[u]=null,r[d]=null,t(e)),void(r[l]=e)}var i=r[u];null!==i&&(r[h]=null,r[u]=null,r[d]=null,i(y(void 0,!0))),r[c]=!0})),e.on("readable",m.bind(null,r)),r}},6637:(e,t,r)=>{"use strict";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=r(8834).Buffer,a=r(4854).inspect,u=a&&a.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,i,n=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=n,i=a,o.prototype.copy.call(t,r,i),a+=s.data.length,s=s.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,s=e>n.length?n.length:e;if(s===n.length?i+=n:i+=n.slice(0,e),0==(e-=s)){s===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(s));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,s=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,s),0==(e-=s)){s===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(s));break}++i}return this.length-=i,t}},{key:u,value:function(e,t){return a(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],r&&s(t.prototype,r),e}()},2262:(e,t,r)=>{"use strict";var i=r(4406);function n(e,t){o(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(o,this,e)):i.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?i.nextTick(s,r):(r._writableState.errorEmitted=!0,i.nextTick(n,r,e)):i.nextTick(n,r,e):t?(i.nextTick(s,r),t(e)):i.nextTick(s,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}},9885:(e,t,r)=>{"use strict";var i=r(4452).q.ERR_STREAM_PREMATURE_CLOSE;function n(){}e.exports=function e(t,r,s){if("function"==typeof r)return e(t,null,r);r||(r={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}(s||n);var o=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||l()},d=t._writableState&&t._writableState.finished,l=function(){a=!1,d=!0,o||s.call(t)},c=t._readableState&&t._readableState.endEmitted,h=function(){o=!1,c=!0,a||s.call(t)},f=function(e){s.call(t,e)},p=function(){var e;return o&&!c?(t._readableState&&t._readableState.ended||(e=new i),s.call(t,e)):a&&!d?(t._writableState&&t._writableState.ended||(e=new i),s.call(t,e)):void 0},y=function(){t.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",l),t.on("abort",p),t.req?y():t.on("request",y)):a&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",h),t.on("finish",l),!1!==r.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",l),t.removeListener("abort",p),t.removeListener("request",y),t.req&&t.req.removeListener("finish",l),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",l),t.removeListener("end",h),t.removeListener("error",f),t.removeListener("close",p)}}},352:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},3495:(e,t,r)=>{"use strict";var i,n=r(4452).q,s=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function u(e,t,n,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;e.on("close",(function(){a=!0})),void 0===i&&(i=r(9885)),i(e,{readable:t,writable:n},(function(e){if(e)return s(e);a=!0,s()}));var u=!1;return function(t){if(!a&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new o("pipe"))}}function d(e){e()}function l(e,t){return e.pipe(t)}function c(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n=c(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var o=t.map((function(e,r){var s=r<t.length-1;return u(e,s,r>0,(function(e){i||(i=e),e&&o.forEach(d),s||(o.forEach(d),n(i))}))}));return t.reduce(l)}},7605:(e,t,r)=>{"use strict";var i=r(4452).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,n){var s=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new i(n?r:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},5010:(e,t,r)=>{e.exports=r(2699).EventEmitter},1922:(e,t,r)=>{"use strict";var i=r(7834).Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=d,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=c,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function d(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.s=s,s.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var n=o(t[i]);return n>=0?(n>0&&(e.lastNeed=n-1),n):--i<r||-2===n?0:(n=o(t[i]))>=0?(n>0&&(e.lastNeed=n-2),n):--i<r||-2===n?0:(n=o(t[i]))>=0?(n>0&&(2===n?n=0:e.lastNeed=n-3),n):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},696:(e,t,r)=>{(t=e.exports=r(8051)).Stream=t,t.Readable=t,t.Writable=r(2557),t.Duplex=r(7073),t.Transform=r(7640),t.PassThrough=r(5163),t.finished=r(9885),t.pipeline=r(3495)},1445:(e,t,r)=>{"use strict";var i=r(8834).Buffer,n=r(1285),s=r(5232),o=new Array(16),a=[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],u=[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],d=[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],l=[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],c=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function f(){s.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<<t|e>>>32-t}function y(e,t,r,i,n,s,o,a){return p(e+(t^r^i)+s+o|0,a)+n|0}function g(e,t,r,i,n,s,o,a){return p(e+(t&r|~t&i)+s+o|0,a)+n|0}function m(e,t,r,i,n,s,o,a){return p(e+((t|~r)^i)+s+o|0,a)+n|0}function v(e,t,r,i,n,s,o,a){return p(e+(t&i|r&~i)+s+o|0,a)+n|0}function b(e,t,r,i,n,s,o,a){return p(e+(t^(r|~i))+s+o|0,a)+n|0}n(f,s),f.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,i=0|this._b,n=0|this._c,s=0|this._d,f=0|this._e,_=0|this._a,w=0|this._b,E=0|this._c,S=0|this._d,T=0|this._e,A=0;A<80;A+=1){var M,R;A<16?(M=y(r,i,n,s,f,e[a[A]],c[0],d[A]),R=b(_,w,E,S,T,e[u[A]],h[0],l[A])):A<32?(M=g(r,i,n,s,f,e[a[A]],c[1],d[A]),R=v(_,w,E,S,T,e[u[A]],h[1],l[A])):A<48?(M=m(r,i,n,s,f,e[a[A]],c[2],d[A]),R=m(_,w,E,S,T,e[u[A]],h[2],l[A])):A<64?(M=v(r,i,n,s,f,e[a[A]],c[3],d[A]),R=g(_,w,E,S,T,e[u[A]],h[3],l[A])):(M=b(r,i,n,s,f,e[a[A]],c[4],d[A]),R=y(_,w,E,S,T,e[u[A]],h[4],l[A])),r=f,f=s,s=p(n,10),n=i,i=M,_=T,T=S,S=p(E,10),E=w,w=R}var x=this._b+n+S|0;this._b=this._c+s+T|0,this._c=this._d+f+_|0,this._d=this._e+r+w|0,this._e=this._a+i+E|0,this._a=x},f.prototype._digest=function(){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),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=i.alloc?i.alloc(20):new i(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=f},552:(e,t,r)=>{"use strict";var i=r(8834).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.isValidXAddress=t.decodeXAddress=t.xAddressToClassicAddress=t.encodeXAddress=t.classicAddressToXAddress=t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.decodeNodePublic=t.encodeNodePublic=t.decodeAccountID=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const n=r(1696),s=r(3207);Object.defineProperty(t,"codec",{enumerable:!0,get:function(){return s.codec}}),Object.defineProperty(t,"encodeSeed",{enumerable:!0,get:function(){return s.encodeSeed}}),Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return s.decodeSeed}}),Object.defineProperty(t,"encodeAccountID",{enumerable:!0,get:function(){return s.encodeAccountID}}),Object.defineProperty(t,"decodeAccountID",{enumerable:!0,get:function(){return s.decodeAccountID}}),Object.defineProperty(t,"encodeNodePublic",{enumerable:!0,get:function(){return s.encodeNodePublic}}),Object.defineProperty(t,"decodeNodePublic",{enumerable:!0,get:function(){return s.decodeNodePublic}}),Object.defineProperty(t,"encodeAccountPublic",{enumerable:!0,get:function(){return s.encodeAccountPublic}}),Object.defineProperty(t,"decodeAccountPublic",{enumerable:!0,get:function(){return s.decodeAccountPublic}}),Object.defineProperty(t,"isValidClassicAddress",{enumerable:!0,get:function(){return s.isValidClassicAddress}});const o={main:i.from([5,68]),test:i.from([4,147])};function a(e,t,r){if(20!==e.length)throw new Error("Account ID must be 20 bytes");if(t>4294967295)throw new Error("Invalid tag");const n=t||0,a=!1===t||null==t?0:1,u=i.concat([r?o.test:o.main,e,i.from([a,255&n,n>>8&255,n>>16&255,n>>24&255,0,0,0,0])]);return s.codec.encodeChecked(u)}function u(e){const t=s.codec.decodeChecked(e),r=function(e){const t=e.slice(0,2);if(o.main.equals(t))return!1;if(o.test.equals(t))return!0;throw new Error("Invalid X-address: bad prefix")}(t);return{accountId:t.slice(2,22),tag:function(e){const t=e[22];if(t>=2)throw new Error("Unsupported X-address");return 1===t?e[23]+256*e[24]+65536*e[25]+16777216*e[26]:(n.strictEqual(t,0,"flag must be zero to indicate no tag"),n.ok(i.from("0000000000000000","hex").equals(e.slice(23,31)),"remaining bytes must be zero"),!1)}(t),test:r}}t.classicAddressToXAddress=function(e,t,r){return a((0,s.decodeAccountID)(e),t,r)},t.encodeXAddress=a,t.xAddressToClassicAddress=function(e){const{accountId:t,tag:r,test:i}=u(e);return{classicAddress:(0,s.encodeAccountID)(t),tag:r,test:i}},t.decodeXAddress=u,t.isValidXAddress=function(e){try{u(e)}catch(e){return!1}return!0}},7920:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatArgs=t.seqEqual=void 0,t.seqEqual=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},t.concatArgs=function(...e){const t=[];return e.forEach((e=>{if("number"!=typeof e)for(const r of e)t.push(r);else t.push(e)})),t}},3207:(e,t,r)=>{"use strict";var i=r(8834).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.encodeNodePublic=t.decodeNodePublic=t.decodeAddress=t.decodeAccountID=t.encodeAddress=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const n=r(8166),s=r(6162),o=r(7920),a=[1,225,75],u={sha256:e=>s("sha256").update(i.from(e)).digest(),alphabet:"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"},d=new class{constructor(e){this._sha256=e.sha256,this._alphabet=e.alphabet,this._codec=n(this._alphabet)}encode(e,t){const r=t.versions;return this._encodeVersioned(e,r,t.expectedLength)}decode(e,t){var r;const i=t.versions,n=t.versionTypes,s=this.decodeChecked(e);if(i.length>1&&!t.expectedLength)throw new Error("expectedLength is required because there are >= 2 possible versions");const a="number"==typeof i[0]?1:i[0].length,u=null!==(r=t.expectedLength)&&void 0!==r?r:s.length-a,d=s.slice(0,-u),l=s.slice(-u);for(let e=0;e<i.length;e++){const t=Array.isArray(i[e])?i[e]:[i[e]];if((0,o.seqEqual)(d,t))return{version:t,bytes:l,type:n?n[e]:null}}throw new Error("version_invalid: version bytes do not match any of the provided version(s)")}encodeChecked(e){const t=this._sha256(this._sha256(e)).slice(0,4);return this._encodeRaw(i.from((0,o.concatArgs)(e,t)))}decodeChecked(e){const t=this._decodeRaw(e);if(t.length<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this._verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)}_encodeVersioned(e,t,r){if(r&&e.length!==r)throw new Error("unexpected_payload_length: bytes.length does not match expectedLength. Ensure that the bytes are a Buffer.");return this.encodeChecked(i.from((0,o.concatArgs)(t,e)))}_encodeRaw(e){return this._codec.encode(e)}_decodeRaw(e){return this._codec.decode(e)}_verifyCheckSum(e){const t=this._sha256(this._sha256(e.slice(0,-4))).slice(0,4),r=e.slice(-4);return(0,o.seqEqual)(t,r)}}(u);function l(e){return d.encode(e,{versions:[0],expectedLength:20})}function c(e){return d.decode(e,{versions:[0],expectedLength:20}).bytes}t.codec=d,t.encodeSeed=function(e,t){if(16!==e.length)throw new Error("entropy must have length 16");const r={expectedLength:16,versions:"ed25519"===t?a:[33]};return d.encode(e,r)},t.decodeSeed=function(e,t={versionTypes:["ed25519","secp256k1"],versions:[a,33],expectedLength:16}){return d.decode(e,t)},t.encodeAccountID=l,t.encodeAddress=l,t.decodeAccountID=c,t.decodeAddress=c,t.decodeNodePublic=function(e){return d.decode(e,{versions:[28],expectedLength:33}).bytes},t.encodeNodePublic=function(e){return d.encode(e,{versions:[28],expectedLength:33})},t.encodeAccountPublic=function(e){return d.encode(e,{versions:[35],expectedLength:33})},t.decodeAccountPublic=function(e){return d.decode(e,{versions:[35],expectedLength:33}).bytes},t.isValidClassicAddress=function(e){try{c(e)}catch(e){return!1}return!0}},4683:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r(4485),n=r(4474);t.default=class{constructor(){this.hash=i.sha512()}add(e){return this.hash.update(e),this}addU32(e){return this.add([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}finish(){return this.hash.digest()}first256(){return this.finish().slice(0,32)}first256BN(){return new n(this.first256())}}},7346:(e,t,r)=>{"use strict";var i=r(8834).Buffer;const n=r(1696),s=r(2745),o=r(4485),a=r(7554),u=r(552),d=r(1709),l=r(2388),c=a.eddsa("ed25519"),h=a.ec("secp256k1"),{hexToBytes:f}=l,{bytesToHex:p}=l;function y(e){return o.sha512().update(e).digest().slice(0,32)}const g={deriveKeypair(e,t){const r="00"+(0,d.derivePrivateKey)(e,t).toString(16,64).toUpperCase(),i=p(h.keyFromPrivate(r.slice(2)).getPublic().encodeCompressed());return{privateKey:r,publicKey:i}},sign:(e,t)=>p(h.sign(y(e),f(t),{canonical:!0}).toDER()),verify:(e,t,r)=>h.verify(y(e),t,f(r))},m={deriveKeypair(e){const t=y(e);return{privateKey:"ED"+p(t),publicKey:"ED"+p(c.keyFromSecret(t).pubBytes())}},sign:(e,t)=>(n.ok(Array.isArray(e),"message must be array of octets"),p(c.sign(e,f(t).slice(1)).toBytes())),verify:(e,t,r)=>c.verify(e,f(t),f(r).slice(1))};function v(e){return{"ecdsa-secp256k1":g,ed25519:m}[e]}function b(e){const t=f(e);return 33===t.length&&237===t[0]?"ed25519":"ecdsa-secp256k1"}function _(e){return u.encodeAccountID(l.computePublicKeyHash(e))}const{decodeSeed:w}=u;e.exports={generateSeed:function(e={}){n.ok(!e.entropy||e.entropy.length>=16,"entropy too short");const t=e.entropy?e.entropy.slice(0,16):s(16),r="ed25519"===e.algorithm?"ed25519":"secp256k1";return u.encodeSeed(i.from(t),r)},deriveKeypair:function(e,t){const r=u.decodeSeed(e),i=v("ed25519"===r.type?"ed25519":"ecdsa-secp256k1"),n=i.deriveKeypair(r.bytes,t),s=y("This test message should verify."),o=i.sign(s,n.privateKey);if(!0!==i.verify(s,o,n.publicKey))throw new Error("derived keypair did not generate verifiable signature");return n},sign:function(e,t){return v(b(t)).sign(f(e),t)},verify:function(e,t,r){return v(b(r)).verify(f(e),t,r)},deriveAddress:function(e){return _(i.from(f(e)))},deriveNodeAddress:function(e){const t=u.decodeNodePublic(e);return _((0,d.accountPublicFromPublicGenerator)(t))},decodeSeed:w}},1709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.accountPublicFromPublicGenerator=t.derivePrivateKey=void 0;const i=r(7554),n=r(4683),s=i.ec("secp256k1");function o(e,t){const r=s.curve.n;for(let i=0;i<=4294967295;i++){const s=(new n.default).add(e);void 0!==t&&s.addU32(t),s.addU32(i);const o=s.first256BN();if(o.cmpn(0)>0&&o.cmp(r)<0)return o}throw new Error("impossible unicorn ;)")}t.derivePrivateKey=function(e,t={}){const r=t.validator,i=s.curve.n,n=o(e);if(r)return n;const a=s.g.mul(n),u=t.accountIndex||0;return o(a.encodeCompressed(),u).add(n).mod(i)},t.accountPublicFromPublicGenerator=function(e){const t=s.curve.decodePoint(e),r=o(e,0),i=s.g.mul(r);return t.add(i).encodeCompressed()}},2388:(e,t,r)=>{"use strict";var i=r(8834).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.computePublicKeyHash=t.hexToBytes=t.bytesToHex=void 0;const n=r(1696),s=r(4485),o=r(4474);t.bytesToHex=function(e){return Array.from(e,(e=>{const t=e.toString(16).toUpperCase();return t.length>1?t:`0${t}`})).join("")},t.hexToBytes=function(e){return n.ok(e.length%2==0),0===e.length?[]:new o(e,16).toArray(null,e.length/2)},t.computePublicKeyHash=function(e){const t=s.sha256().update(e).digest(),r=s.ripemd160().update(t).digest();return i.from(r)}},4474:function(e,t,r){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(8621).Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=a(e,r);return r-1>=t&&(i|=a(e,r-1)<<4),i}function d(e,t,r,n){for(var s=0,o=0,a=Math.min(e.length,r),u=t;u<a;u++){var d=e.charCodeAt(u)-48;s*=n,o=d>=49?d-49+10:d>=17?d-17+10:d,i(d>=0&&o<n,"Invalid character"),s+=o}return s}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===r)for(n=e.length-1,s=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,s=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,u=0,l=r;l<a;l+=i)u=d(e,l,l+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var c=1;for(u=d(e,l,e.length,t),l=0;l<o;l++)c*=t;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},s.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype._move=function(e){l(e,this)},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(e){s.prototype.inspect=c}else s.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function y(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var d=1;d<i;d++){for(var l=u>>>26,c=67108863&u,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;l+=(o=(n=0|e.words[p])*(s=0|t.words[f])+c)/67108864|0,c=67108863&o}r.words[d]=0|c,u=0|l}return 0!==u?r.words[d]=0|u:r.length--,r._strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<n|s)).toString(16);s=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=f[e],l=p[e];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var y=c.modrn(l).toString(e);r=(c=c.idivn(l)).isZero()?y+r:h[d-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},s.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},s.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},s.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},s.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},s.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,s=0;s<i.length;s++)t=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&t,n=t>>>26;for(;0!==n&&s<r.length;s++)t=(0|r.words[s])+n,this.words[s]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var s=0,o=0;o<i.length;o++)s=(t=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,s,o=e.words,a=t.words,u=r.words,d=0,l=0|o[0],c=8191&l,h=l>>>13,f=0|o[1],p=8191&f,y=f>>>13,g=0|o[2],m=8191&g,v=g>>>13,b=0|o[3],_=8191&b,w=b>>>13,E=0|o[4],S=8191&E,T=E>>>13,A=0|o[5],M=8191&A,R=A>>>13,x=0|o[6],k=8191&x,O=x>>>13,I=0|o[7],C=8191&I,P=I>>>13,N=0|o[8],D=8191&N,B=N>>>13,q=0|o[9],L=8191&q,j=q>>>13,F=0|a[0],U=8191&F,z=F>>>13,H=0|a[1],G=8191&H,$=H>>>13,W=0|a[2],V=8191&W,K=W>>>13,Y=0|a[3],Z=8191&Y,X=Y>>>13,J=0|a[4],Q=8191&J,ee=J>>>13,te=0|a[5],re=8191&te,ie=te>>>13,ne=0|a[6],se=8191&ne,oe=ne>>>13,ae=0|a[7],ue=8191&ae,de=ae>>>13,le=0|a[8],ce=8191&le,he=le>>>13,fe=0|a[9],pe=8191&fe,ye=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(d+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(h,U)|0))<<13)|0;d=((s=Math.imul(h,z))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,U),n=(n=Math.imul(p,z))+Math.imul(y,U)|0,s=Math.imul(y,z);var me=(d+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,$)|0)+Math.imul(h,G)|0))<<13)|0;d=((s=s+Math.imul(h,$)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,z))+Math.imul(v,U)|0,s=Math.imul(v,z),i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(y,G)|0,s=s+Math.imul(y,$)|0;var ve=(d+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(h,V)|0))<<13)|0;d=((s=s+Math.imul(h,K)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,z))+Math.imul(w,U)|0,s=Math.imul(w,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,$)|0)+Math.imul(v,G)|0,s=s+Math.imul(v,$)|0,i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(y,V)|0,s=s+Math.imul(y,K)|0;var be=(d+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,X)|0)+Math.imul(h,Z)|0))<<13)|0;d=((s=s+Math.imul(h,X)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(S,U),n=(n=Math.imul(S,z))+Math.imul(T,U)|0,s=Math.imul(T,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,$)|0)+Math.imul(w,G)|0,s=s+Math.imul(w,$)|0,i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(v,V)|0,s=s+Math.imul(v,K)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(y,Z)|0,s=s+Math.imul(y,X)|0;var _e=(d+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,ee)|0)+Math.imul(h,Q)|0))<<13)|0;d=((s=s+Math.imul(h,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(M,U),n=(n=Math.imul(M,z))+Math.imul(R,U)|0,s=Math.imul(R,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,$)|0)+Math.imul(T,G)|0,s=s+Math.imul(T,$)|0,i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(w,V)|0,s=s+Math.imul(w,K)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(v,Z)|0,s=s+Math.imul(v,X)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,s=s+Math.imul(y,ee)|0;var we=(d+(i=i+Math.imul(c,re)|0)|0)+((8191&(n=(n=n+Math.imul(c,ie)|0)+Math.imul(h,re)|0))<<13)|0;d=((s=s+Math.imul(h,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(k,U),n=(n=Math.imul(k,z))+Math.imul(O,U)|0,s=Math.imul(O,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(R,G)|0,s=s+Math.imul(R,$)|0,i=i+Math.imul(S,V)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,K)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Z)|0,s=s+Math.imul(w,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,s=s+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(y,re)|0,s=s+Math.imul(y,ie)|0;var Ee=(d+(i=i+Math.imul(c,se)|0)|0)+((8191&(n=(n=n+Math.imul(c,oe)|0)+Math.imul(h,se)|0))<<13)|0;d=((s=s+Math.imul(h,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,z))+Math.imul(P,U)|0,s=Math.imul(P,z),i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(O,G)|0,s=s+Math.imul(O,$)|0,i=i+Math.imul(M,V)|0,n=(n=n+Math.imul(M,K)|0)+Math.imul(R,V)|0,s=s+Math.imul(R,K)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,s=s+Math.imul(w,ee)|0,i=i+Math.imul(m,re)|0,n=(n=n+Math.imul(m,ie)|0)+Math.imul(v,re)|0,s=s+Math.imul(v,ie)|0,i=i+Math.imul(p,se)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(y,se)|0,s=s+Math.imul(y,oe)|0;var Se=(d+(i=i+Math.imul(c,ue)|0)|0)+((8191&(n=(n=n+Math.imul(c,de)|0)+Math.imul(h,ue)|0))<<13)|0;d=((s=s+Math.imul(h,de)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,z))+Math.imul(B,U)|0,s=Math.imul(B,z),i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,$)|0)+Math.imul(P,G)|0,s=s+Math.imul(P,$)|0,i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,K)|0,i=i+Math.imul(M,Z)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,s=s+Math.imul(w,ie)|0,i=i+Math.imul(m,se)|0,n=(n=n+Math.imul(m,oe)|0)+Math.imul(v,se)|0,s=s+Math.imul(v,oe)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(y,ue)|0,s=s+Math.imul(y,de)|0;var Te=(d+(i=i+Math.imul(c,ce)|0)|0)+((8191&(n=(n=n+Math.imul(c,he)|0)+Math.imul(h,ce)|0))<<13)|0;d=((s=s+Math.imul(h,he)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,U),n=(n=Math.imul(L,z))+Math.imul(j,U)|0,s=Math.imul(j,z),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,$)|0)+Math.imul(B,G)|0,s=s+Math.imul(B,$)|0,i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,K)|0,i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(O,Z)|0,s=s+Math.imul(O,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(R,Q)|0,s=s+Math.imul(R,ee)|0,i=i+Math.imul(S,re)|0,n=(n=n+Math.imul(S,ie)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ie)|0,i=i+Math.imul(_,se)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(w,se)|0,s=s+Math.imul(w,oe)|0,i=i+Math.imul(m,ue)|0,n=(n=n+Math.imul(m,de)|0)+Math.imul(v,ue)|0,s=s+Math.imul(v,de)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,he)|0)+Math.imul(y,ce)|0,s=s+Math.imul(y,he)|0;var Ae=(d+(i=i+Math.imul(c,pe)|0)|0)+((8191&(n=(n=n+Math.imul(c,ye)|0)+Math.imul(h,pe)|0))<<13)|0;d=((s=s+Math.imul(h,ye)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,G),n=(n=Math.imul(L,$))+Math.imul(j,G)|0,s=Math.imul(j,$),i=i+Math.imul(D,V)|0,n=(n=n+Math.imul(D,K)|0)+Math.imul(B,V)|0,s=s+Math.imul(B,K)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,X)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,X)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,ee)|0,i=i+Math.imul(M,re)|0,n=(n=n+Math.imul(M,ie)|0)+Math.imul(R,re)|0,s=s+Math.imul(R,ie)|0,i=i+Math.imul(S,se)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(w,ue)|0,s=s+Math.imul(w,de)|0,i=i+Math.imul(m,ce)|0,n=(n=n+Math.imul(m,he)|0)+Math.imul(v,ce)|0,s=s+Math.imul(v,he)|0;var Me=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;d=((s=s+Math.imul(y,ye)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,K))+Math.imul(j,V)|0,s=Math.imul(j,K),i=i+Math.imul(D,Z)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(B,Z)|0,s=s+Math.imul(B,X)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(O,re)|0,s=s+Math.imul(O,ie)|0,i=i+Math.imul(M,se)|0,n=(n=n+Math.imul(M,oe)|0)+Math.imul(R,se)|0,s=s+Math.imul(R,oe)|0,i=i+Math.imul(S,ue)|0,n=(n=n+Math.imul(S,de)|0)+Math.imul(T,ue)|0,s=s+Math.imul(T,de)|0,i=i+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,he)|0)+Math.imul(w,ce)|0,s=s+Math.imul(w,he)|0;var Re=(d+(i=i+Math.imul(m,pe)|0)|0)+((8191&(n=(n=n+Math.imul(m,ye)|0)+Math.imul(v,pe)|0))<<13)|0;d=((s=s+Math.imul(v,ye)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,Z),n=(n=Math.imul(L,X))+Math.imul(j,Z)|0,s=Math.imul(j,X),i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(B,Q)|0,s=s+Math.imul(B,ee)|0,i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(P,re)|0,s=s+Math.imul(P,ie)|0,i=i+Math.imul(k,se)|0,n=(n=n+Math.imul(k,oe)|0)+Math.imul(O,se)|0,s=s+Math.imul(O,oe)|0,i=i+Math.imul(M,ue)|0,n=(n=n+Math.imul(M,de)|0)+Math.imul(R,ue)|0,s=s+Math.imul(R,de)|0,i=i+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,he)|0)+Math.imul(T,ce)|0,s=s+Math.imul(T,he)|0;var xe=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,ye)|0)+Math.imul(w,pe)|0))<<13)|0;d=((s=s+Math.imul(w,ye)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(j,Q)|0,s=Math.imul(j,ee),i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(B,re)|0,s=s+Math.imul(B,ie)|0,i=i+Math.imul(C,se)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,se)|0,s=s+Math.imul(P,oe)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,de)|0)+Math.imul(O,ue)|0,s=s+Math.imul(O,de)|0,i=i+Math.imul(M,ce)|0,n=(n=n+Math.imul(M,he)|0)+Math.imul(R,ce)|0,s=s+Math.imul(R,he)|0;var ke=(d+(i=i+Math.imul(S,pe)|0)|0)+((8191&(n=(n=n+Math.imul(S,ye)|0)+Math.imul(T,pe)|0))<<13)|0;d=((s=s+Math.imul(T,ye)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(j,re)|0,s=Math.imul(j,ie),i=i+Math.imul(D,se)|0,n=(n=n+Math.imul(D,oe)|0)+Math.imul(B,se)|0,s=s+Math.imul(B,oe)|0,i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,de)|0)+Math.imul(P,ue)|0,s=s+Math.imul(P,de)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,he)|0)+Math.imul(O,ce)|0,s=s+Math.imul(O,he)|0;var Oe=(d+(i=i+Math.imul(M,pe)|0)|0)+((8191&(n=(n=n+Math.imul(M,ye)|0)+Math.imul(R,pe)|0))<<13)|0;d=((s=s+Math.imul(R,ye)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,se),n=(n=Math.imul(L,oe))+Math.imul(j,se)|0,s=Math.imul(j,oe),i=i+Math.imul(D,ue)|0,n=(n=n+Math.imul(D,de)|0)+Math.imul(B,ue)|0,s=s+Math.imul(B,de)|0,i=i+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,he)|0)+Math.imul(P,ce)|0,s=s+Math.imul(P,he)|0;var Ie=(d+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,ye)|0)+Math.imul(O,pe)|0))<<13)|0;d=((s=s+Math.imul(O,ye)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,de))+Math.imul(j,ue)|0,s=Math.imul(j,de),i=i+Math.imul(D,ce)|0,n=(n=n+Math.imul(D,he)|0)+Math.imul(B,ce)|0,s=s+Math.imul(B,he)|0;var Ce=(d+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,ye)|0)+Math.imul(P,pe)|0))<<13)|0;d=((s=s+Math.imul(P,ye)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(L,ce),n=(n=Math.imul(L,he))+Math.imul(j,ce)|0,s=Math.imul(j,he);var Pe=(d+(i=i+Math.imul(D,pe)|0)|0)+((8191&(n=(n=n+Math.imul(D,ye)|0)+Math.imul(B,pe)|0))<<13)|0;d=((s=s+Math.imul(B,ye)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(d+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,ye))+Math.imul(j,pe)|0))<<13)|0;return d=((s=Math.imul(j,ye))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=me,u[2]=ve,u[3]=be,u[4]=_e,u[5]=we,u[6]=Ee,u[7]=Se,u[8]=Te,u[9]=Ae,u[10]=Me,u[11]=Re,u[12]=xe,u[13]=ke,u[14]=Oe,u[15]=Ie,u[16]=Ce,u[17]=Pe,u[18]=Ne,0!==d&&(u[19]=d,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,u=Math.min(s,t.length-1),d=Math.max(0,s-e.length+1);d<=u;d++){var l=s-d,c=(0|e.words[l])*(0|t.words[d]),h=67108863&c;a=67108863&(h=h+a|0),n+=(o=(o=o+(c/67108864|0)|0)+(h>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function v(e,t,r){return m(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(g=y),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?y(this,e,t):r<1024?m(this,e,t):v(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},b.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o<s;o++)i[o]=t[e[o]],n[o]=r[e[o]]},b.prototype.transform=function(e,t,r,i,n,s){this.permute(s,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),d=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var c=u,h=d,f=0;f<o;f++){var p=r[l+f],y=i[l+f],g=r[l+f+o],m=i[l+f+o],v=c*g-h*m;m=c*m+h*g,g=v,r[l+f]=p+g,i[l+f]=y+m,r[l+f+o]=p-g,i[l+f+o]=y-m,f!==a&&(v=u*c-d*h,h=u*h+d*c,c=v)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},b.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},b.prototype.convert13b=function(e,t,r,n){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===s),i(0==(-8192&s))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),s=this.stub(i),o=new Array(i),a=new Array(i),u=new Array(i),d=new Array(i),l=new Array(i),c=new Array(i),h=r.words;h.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,d,i),this.transform(o,s,a,u,i,n),this.transform(d,s,l,c,i,n);for(var f=0;f<i;f++){var p=a[f]*l[f]-u[f]*c[f];u[f]=a[f]*c[f]+u[f]*l[f],a[f]=p}return this.conjugate(a,u,i),this.transform(a,u,h,s,i,n),this.conjugate(h,s,i),this.normalize13b(h,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),v(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var s=(0|this.words[n])*e,o=(67108863&s)+(67108863&r);r>>=26,r+=s/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,u=(0|this.words[t])-a<<r;this.words[t]=u|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,u=r;if(n-=o,n=Math.max(0,n),u){for(var d=0;d<o;d++)u.words[d]=this.words[d];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,d=0;d<this.length;d++)this.words[d]=this.words[d+o];else this.words[0]=0,this.length=1;var l=0;for(d=this.length-1;d>=0&&(0!==l||d>=n);d--){var c=0|this.words[d];this.words[d]=l<<26-s|c>>>s,l=c&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r||!(this.words[r]&n))},s.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var n,s,o=e.length+r;this._expand(o);var a=0;for(n=0;n<e.length;n++){s=(0|this.words[n+r])+a;var u=(0|e.words[n])*t;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==t){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var d=0;d<a.length;d++)a.words[d]=0}var l=i.clone()._ishlnsubmul(n,1,u);0===l.negative&&(i=l,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var h=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(h=Math.min(h/o|0,67108863),i._ishlnsubmul(n,h,c);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=h)}return a&&a._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%e;return t?-n:n},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+67108864*r;this.words[n]=s/e|0,r=s%e}return this._strip(),t?this.ineg():this},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var l=r.clone(),c=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(c)),a.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(u)):(r.isub(t),a.isub(n),u.isub(o))}return{a,b:u,gcd:r.iushln(d)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new s(1),a=new s(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,l=1;0==(t.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(t.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(n=0===t.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(e),n},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new M(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function T(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function R(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(E,w),E.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[n-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(S,w),n(T,w),n(A,w),A.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new S;else if("p192"===e)t=new T;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return _[e]=t,t},M.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),d=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);0!==this.pow(l,d).cmp(u);)l.redIAdd(u);for(var c=this.pow(l,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=o;0!==f.cmp(a);){for(var y=f,g=0;0!==y.cmp(a);g++)y=y.redSqr();i(g<p);var m=this.pow(c,new s(1).iushln(p-g-1));h=h.redMul(m),c=m.redSqr(),f=f.redMul(c),p=g}return h},M.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},M.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],l=u-1;l>=0;l--){var c=d>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4==++a||0===i&&0===l)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}u=26}return n},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new R(e)},n(R,M),R.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},R.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},R.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},R.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},R.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},7834:(e,t,r)=>{var i=r(8834),n=i.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(s(i,t),t.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},7847:(e,t,r)=>{const i=Symbol("SemVer ANY");class n{static get ANY(){return i}constructor(e,t){if(t=s(t),e instanceof n){if(e.loose===!!t.loose)return e;e=e.value}d("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===i?this.value="":this.value=this.operator+this.semver.version,d("comp",this)}parse(e){const t=this.options.loose?o[a.COMPARATORLOOSE]:o[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=i}toString(){return this.value}test(e){if(d("Comparator.test",e,this.options.loose),this.semver===i||e===i)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return u(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new c(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new c(this.value,t).test(e.semver);const r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),s=this.semver.version===e.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=u(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),d=u(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||i||s&&o||a||d}}e.exports=n;const s=r(1388),{re:o,t:a}=r(4808),u=r(8117),d=r(952),l=r(2435),c=r(6843)},6843:(e,t,r)=>{class i{constructor(e,t){if(t=s(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&y(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=`parseRange:${Object.keys(this.options).join(",")}:${e}`,r=n.get(t);if(r)return r;const i=this.options.loose,s=i?d[l.HYPHENRANGELOOSE]:d[l.HYPHENRANGE];e=e.replace(s,R(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(d[l.COMPARATORTRIM],c),a("comparator trim",e);let u=(e=(e=(e=e.replace(d[l.TILDETRIM],h)).replace(d[l.CARETTRIM],f)).split(/\s+/).join(" ")).split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>M(e,this.options)));i&&(u=u.filter((e=>(a("loose invalid filter",e,this.options),!!e.match(d[l.COMPARATORLOOSE]))))),a("range list",u);const y=new Map,g=u.map((e=>new o(e,this.options)));for(const e of g){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const v=[...y.values()];return n.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some((r=>g(r,t)&&e.set.some((e=>g(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(x(this.set[t],e,this.options))return!0;return!1}}e.exports=i;const n=new(r(7105))({max:1e3}),s=r(1388),o=r(7847),a=r(952),u=r(2435),{re:d,t:l,comparatorTrimReplace:c,tildeTrimReplace:h,caretTrimReplace:f}=r(4808),p=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,g=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every((e=>n.intersects(e,t))),n=i.pop();return r},m=(e,t)=>(a("comp",e,t),e=w(e,t),a("caret",e),e=b(e,t),a("tildes",e),e=S(e,t),a("xrange",e),e=A(e,t),a("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{const r=t.loose?d[l.TILDELOOSE]:d[l.TILDE];return e.replace(r,((t,r,i,n,s)=>{let o;return a("tilde",e,t,r,i,n,s),v(r)?o="":v(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:v(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?(a("replaceTilde pr",s),o=`>=${r}.${i}.${n}-${s} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,a("tilde return",o),o}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{a("caret",e,t);const r=t.loose?d[l.CARETLOOSE]:d[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,((t,r,n,s,o)=>{let u;return a("caret",e,t,r,n,s,o),v(r)?u="":v(n)?u=`>=${r}.0.0${i} <${+r+1}.0.0-0`:v(s)?u="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(a("replaceCaret pr",o),u="0"===r?"0"===n?`>=${r}.${n}.${s}-${o} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s}-${o} <${+r+1}.0.0-0`):(a("no pr"),u="0"===r?"0"===n?`>=${r}.${n}.${s}${i} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s} <${+r+1}.0.0-0`),a("caret return",u),u}))},S=(e,t)=>(a("replaceXRanges",e,t),e.split(/\s+/).map((e=>T(e,t))).join(" ")),T=(e,t)=>{e=e.trim();const r=t.loose?d[l.XRANGELOOSE]:d[l.XRANGE];return e.replace(r,((r,i,n,s,o,u)=>{a("xRange",e,r,i,n,s,o,u);const d=v(n),l=d||v(s),c=l||v(o),h=c;return"="===i&&h&&(i=""),u=t.includePrerelease?"-0":"",d?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(l&&(s=0),o=0,">"===i?(i=">=",l?(n=+n+1,s=0,o=0):(s=+s+1,o=0)):"<="===i&&(i="<",l?n=+n+1:s=+s+1),"<"===i&&(u="-0"),r=`${i+n}.${s}.${o}${u}`):l?r=`>=${n}.0.0${u} <${+n+1}.0.0-0`:c&&(r=`>=${n}.${s}.0${u} <${n}.${+s+1}.0-0`),a("xRange return",r),r}))},A=(e,t)=>(a("replaceStars",e,t),e.trim().replace(d[l.STAR],"")),M=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(d[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),R=e=>(t,r,i,n,s,o,a,u,d,l,c,h,f)=>`${r=v(i)?"":v(n)?`>=${i}.0.0${e?"-0":""}`:v(s)?`>=${i}.${n}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${u=v(d)?"":v(l)?`<${+d+1}.0.0-0`:v(c)?`<${d}.${+l+1}.0-0`:h?`<=${d}.${l}.${c}-${h}`:e?`<${d}.${l}.${+c+1}-0`:`<=${u}`}`.trim(),x=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(a(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}},2435:(e,t,r)=>{const i=r(952),{MAX_LENGTH:n,MAX_SAFE_INTEGER:s}=r(5558),{re:o,t:a}=r(4808),u=r(1388),{compareIdentifiers:d}=r(4935);class l{constructor(e,t){if(t=u(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>n)throw new TypeError(`version is longer than ${n} characters`);i("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[a.LOOSE]:o[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<s)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(i("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),d(this.major,e.major)||d(this.minor,e.minor)||d(this.patch,e.patch)}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],n=e.prerelease[t];if(i("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return d(r,n)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const r=this.build[t],n=e.build[t];if(i("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return d(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(0===d(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}e.exports=l},6694:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},8117:(e,t,r)=>{const i=r(3276),n=r(7893),s=r(6379),o=r(8463),a=r(1897),u=r(506);e.exports=(e,t,r,d)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return i(e,r,d);case"!=":return n(e,r,d);case">":return s(e,r,d);case">=":return o(e,r,d);case"<":return a(e,r,d);case"<=":return u(e,r,d);default:throw new TypeError(`Invalid operator: ${t}`)}}},8686:(e,t,r)=>{const i=r(2435),n=r(9943),{re:s,t:o}=r(4808);e.exports=(e,t)=>{if(e instanceof i)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=s[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),s[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;s[o.COERCERTL].lastIndex=-1}else r=e.match(s[o.COERCE]);return null===r?null:n(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)}},5914:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r)=>{const n=new i(e,r),s=new i(t,r);return n.compare(s)||n.compareBuild(s)}},5404:(e,t,r)=>{const i=r(2271);e.exports=(e,t)=>i(e,t,!0)},2271:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r)=>new i(e,r).compare(new i(t,r))},6007:(e,t,r)=>{const i=r(9943),n=r(3276);e.exports=(e,t)=>{if(n(e,t))return null;{const r=i(e),n=i(t),s=r.prerelease.length||n.prerelease.length,o=s?"pre":"",a=s?"prerelease":"";for(const e in r)if(("major"===e||"minor"===e||"patch"===e)&&r[e]!==n[e])return o+e;return a}}},3276:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>0===i(e,t,r)},6379:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)>0},8463:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)>=0},6360:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r,n)=>{"string"==typeof r&&(n=r,r=void 0);try{return new i(e instanceof i?e.version:e,r).inc(t,n).version}catch(e){return null}}},1897:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)<0},506:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)<=0},4551:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).major},469:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).minor},7893:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>0!==i(e,t,r)},9943:(e,t,r)=>{const{MAX_LENGTH:i}=r(5558),{re:n,t:s}=r(4808),o=r(2435),a=r(1388);e.exports=(e,t)=>{if(t=a(t),e instanceof o)return e;if("string"!=typeof e)return null;if(e.length>i)return null;if(!(t.loose?n[s.LOOSE]:n[s.FULL]).test(e))return null;try{return new o(e,t)}catch(e){return null}}},4250:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).patch},8204:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e,t);return r&&r.prerelease.length?r.prerelease:null}},733:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(t,e,r)},2961:(e,t,r)=>{const i=r(5914);e.exports=(e,t)=>e.sort(((e,r)=>i(r,e,t)))},9844:(e,t,r)=>{const i=r(6843);e.exports=(e,t,r)=>{try{t=new i(t,r)}catch(e){return!1}return t.test(e)}},1116:(e,t,r)=>{const i=r(5914);e.exports=(e,t)=>e.sort(((e,r)=>i(e,r,t)))},7230:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e,t);return r?r.version:null}},7699:(e,t,r)=>{const i=r(4808);e.exports={re:i.re,src:i.src,tokens:i.t,SEMVER_SPEC_VERSION:r(5558).SEMVER_SPEC_VERSION,SemVer:r(2435),compareIdentifiers:r(4935).compareIdentifiers,rcompareIdentifiers:r(4935).rcompareIdentifiers,parse:r(9943),valid:r(7230),clean:r(6694),inc:r(6360),diff:r(6007),major:r(4551),minor:r(469),patch:r(4250),prerelease:r(8204),compare:r(2271),rcompare:r(733),compareLoose:r(5404),compareBuild:r(5914),sort:r(1116),rsort:r(2961),gt:r(6379),lt:r(1897),eq:r(3276),neq:r(7893),gte:r(8463),lte:r(506),cmp:r(8117),coerce:r(8686),Comparator:r(7847),Range:r(6843),satisfies:r(9844),toComparators:r(8865),maxSatisfying:r(3727),minSatisfying:r(4338),minVersion:r(1542),validRange:r(6240),outside:r(9106),gtr:r(995),ltr:r(7805),intersects:r(2013),simplifyRange:r(1338),subset:r(3122)}},5558:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:t,MAX_SAFE_COMPONENT_LENGTH:16}},952:(e,t,r)=>{var i=r(4406);const n="object"==typeof i&&i.env&&i.env.NODE_DEBUG&&/\bsemver\b/i.test(i.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=n},4935:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const i=t.test(e),n=t.test(r);return i&&n&&(e=+e,r=+r),e===r?0:i&&!n?-1:n&&!i?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},1388:e=>{const t=["includePrerelease","loose","rtl"];e.exports=e=>e?"object"!=typeof e?{loose:!0}:t.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{}},4808:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:i}=r(5558),n=r(952),s=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let u=0;const d=(e,t,r)=>{const i=u++;n(e,i,t),a[e]=i,o[i]=t,s[i]=new RegExp(t,r?"g":void 0)};d("NUMERICIDENTIFIER","0|[1-9]\\d*"),d("NUMERICIDENTIFIERLOOSE","[0-9]+"),d("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),d("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),d("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),d("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),d("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),d("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),d("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),d("BUILDIDENTIFIER","[0-9A-Za-z-]+"),d("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),d("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),d("FULL",`^${o[a.FULLPLAIN]}$`),d("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),d("LOOSE",`^${o[a.LOOSEPLAIN]}$`),d("GTLT","((?:<|>)?=?)"),d("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),d("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),d("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),d("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),d("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),d("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),d("COERCE",`(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?(?:$|[^\\d])`),d("COERCERTL",o[a.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",d("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),d("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),d("LONECARET","(?:\\^)"),d("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",d("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),d("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),d("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),d("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),d("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),d("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},995:(e,t,r)=>{const i=r(9106);e.exports=(e,t,r)=>i(e,t,">",r)},2013:(e,t,r)=>{const i=r(6843);e.exports=(e,t,r)=>(e=new i(e,r),t=new i(t,r),e.intersects(t))},7805:(e,t,r)=>{const i=r(9106);e.exports=(e,t,r)=>i(e,t,"<",r)},3727:(e,t,r)=>{const i=r(2435),n=r(6843);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new n(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&-1!==o.compare(e)||(s=e,o=new i(s,r)))})),s}},4338:(e,t,r)=>{const i=r(2435),n=r(6843);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new n(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&1!==o.compare(e)||(s=e,o=new i(s,r)))})),s}},1542:(e,t,r)=>{const i=r(2435),n=r(6843),s=r(6379);e.exports=(e,t)=>{e=new n(e,t);let r=new i("0.0.0");if(e.test(r))return r;if(r=new i("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const n=e.set[t];let o=null;n.forEach((e=>{const t=new i(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!s(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!s(r,o)||(r=o)}return r&&e.test(r)?r:null}},9106:(e,t,r)=>{const i=r(2435),n=r(7847),{ANY:s}=n,o=r(6843),a=r(9844),u=r(6379),d=r(1897),l=r(506),c=r(8463);e.exports=(e,t,r,h)=>{let f,p,y,g,m;switch(e=new i(e,h),t=new o(t,h),r){case">":f=u,p=l,y=d,g=">",m=">=";break;case"<":f=d,p=c,y=u,g="<",m="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,h))return!1;for(let r=0;r<t.set.length;++r){const i=t.set[r];let o=null,a=null;if(i.forEach((e=>{e.semver===s&&(e=new n(">=0.0.0")),o=o||e,a=a||e,f(e.semver,o.semver,h)?o=e:y(e.semver,a.semver,h)&&(a=e)})),o.operator===g||o.operator===m)return!1;if((!a.operator||a.operator===g)&&p(e,a.semver))return!1;if(a.operator===m&&y(e,a.semver))return!1}return!0}},1338:(e,t,r)=>{const i=r(9844),n=r(2271);e.exports=(e,t,r)=>{const s=[];let o=null,a=null;const u=e.sort(((e,t)=>n(e,t,r)));for(const e of u)i(e,t,r)?(a=e,o||(o=e)):(a&&s.push([o,a]),a=null,o=null);o&&s.push([o,null]);const d=[];for(const[e,t]of s)e===t?d.push(e):t||e!==u[0]?t?e===u[0]?d.push(`<=${t}`):d.push(`${e} - ${t}`):d.push(`>=${e}`):d.push("*");const l=d.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t}},3122:(e,t,r)=>{const i=r(6843),n=r(7847),{ANY:s}=n,o=r(9844),a=r(2271),u=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===s){if(1===t.length&&t[0].semver===s)return!0;e=r.includePrerelease?[new n(">=0.0.0-0")]:[new n(">=0.0.0")]}if(1===t.length&&t[0].semver===s){if(r.includePrerelease)return!0;t=[new n(">=0.0.0")]}const i=new Set;let u,c,h,f,p,y,g;for(const t of e)">"===t.operator||">="===t.operator?u=d(u,t,r):"<"===t.operator||"<="===t.operator?c=l(c,t,r):i.add(t.semver);if(i.size>1)return null;if(u&&c){if(h=a(u.semver,c.semver,r),h>0)return null;if(0===h&&(">="!==u.operator||"<="!==c.operator))return null}for(const e of i){if(u&&!o(e,String(u),r))return null;if(c&&!o(e,String(c),r))return null;for(const i of t)if(!o(e,String(i),r))return!1;return!0}let m=!(!c||r.includePrerelease||!c.semver.prerelease.length)&&c.semver,v=!(!u||r.includePrerelease||!u.semver.prerelease.length)&&u.semver;m&&1===m.prerelease.length&&"<"===c.operator&&0===m.prerelease[0]&&(m=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,y=y||"<"===e.operator||"<="===e.operator,u)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),">"===e.operator||">="===e.operator){if(f=d(u,e,r),f===e&&f!==u)return!1}else if(">="===u.operator&&!o(u.semver,String(e),r))return!1;if(c)if(m&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===m.major&&e.semver.minor===m.minor&&e.semver.patch===m.patch&&(m=!1),"<"===e.operator||"<="===e.operator){if(p=l(c,e,r),p===e&&p!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),r))return!1;if(!e.operator&&(c||u)&&0!==h)return!1}return!(u&&y&&!c&&0!==h||c&&g&&!u&&0!==h||v||m)},d=(e,t,r)=>{if(!e)return t;const i=a(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},l=(e,t,r)=>{if(!e)return t;const i=a(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new i(e,r),t=new i(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=u(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0}},8865:(e,t,r)=>{const i=r(6843);e.exports=(e,t)=>new i(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},6240:(e,t,r)=>{const i=r(6843);e.exports=(e,t)=>{try{return new i(e,t).range||"*"}catch(e){return null}}},3327:(e,t,r)=>{var i=r(7834).Buffer;function n(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}n.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var r=this._block,n=this._blockSize,s=e.length,o=this._len,a=0;a<s;){for(var u=o%n,d=Math.min(s-a,n-u),l=0;l<d;l++)r[u+l]=e[a+l];a+=d,(o+=d)%n==0&&this._update(r)}return this._len+=s,this},n.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=n},9065:(e,t,r)=>{var i=e.exports=function(e){e=e.toLowerCase();var t=i[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};i.sha=r(7407),i.sha1=r(7885),i.sha224=r(8321),i.sha256=r(4424),i.sha384=r(213),i.sha512=r(5596)},7407:(e,t,r)=>{var i=r(1285),n=r(3327),s=r(7834).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,n.call(this,64,56)}function d(e){return e<<30|e>>>2}function l(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var h=0;h<80;++h){var f=~~(h/20),p=0|((t=i)<<5|t>>>27)+l(f,n,s,a)+u+r[h]+o[f];u=a,a=s,s=d(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},7885:(e,t,r)=>{var i=r(1285),n=r(3327),s=r(7834).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,n.call(this,64,56)}function d(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function c(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=(t=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|t>>>31;for(var f=0;f<80;++f){var p=~~(f/20),y=d(i)+c(p,n,s,a)+u+r[f]+o[p]|0;u=a,a=s,s=l(n),n=i,i=y}this._a=i+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},8321:(e,t,r)=>{var i=r(1285),n=r(4424),s=r(3327),o=r(7834).Buffer,a=new Array(64);function u(){this.init(),this._w=a,s.call(this,64,56)}i(u,n),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=o.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},4424:(e,t,r)=>{var i=r(1285),n=r(3327),s=r(7834).Buffer,o=[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 Array(64);function u(){this.init(),this._w=a,n.call(this,64,56)}function d(e,t,r){return r^e&(t^r)}function l(e,t,r){return e&t|r&(e|t)}function c(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function h(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function f(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}i(u,n),u.prototype.init=function(){return 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},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,y=0|this._g,g=0|this._h,m=0;m<16;++m)r[m]=e.readInt32BE(4*m);for(;m<64;++m)r[m]=0|(((t=r[m-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[m-7]+f(r[m-15])+r[m-16];for(var v=0;v<64;++v){var b=g+h(u)+d(u,p,y)+o[v]+r[v]|0,_=c(i)+l(i,n,s)|0;g=y,y=p,p=u,u=a+b|0,a=s,s=n,n=i,i=b+_|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=s.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},213:(e,t,r)=>{var i=r(1285),n=r(5596),s=r(3327),o=r(7834).Buffer,a=new Array(160);function u(){this.init(),this._w=a,s.call(this,128,112)}i(u,n),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},5596:(e,t,r)=>{var i=r(1285),n=r(3327),s=r(7834).Buffer,o=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,n.call(this,128,112)}function d(e,t,r){return r^e&(t^r)}function l(e,t,r){return e&t|r&(e|t)}function c(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function h(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function f(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function m(e,t){return e>>>0<t>>>0?1:0}i(u,n),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,s=0|this._dh,a=0|this._eh,u=0|this._fh,v=0|this._gh,b=0|this._hh,_=0|this._al,w=0|this._bl,E=0|this._cl,S=0|this._dl,T=0|this._el,A=0|this._fl,M=0|this._gl,R=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var k=t[x-30],O=t[x-30+1],I=f(k,O),C=p(O,k),P=y(k=t[x-4],O=t[x-4+1]),N=g(O,k),D=t[x-14],B=t[x-14+1],q=t[x-32],L=t[x-32+1],j=C+B|0,F=I+D+m(j,C)|0;F=(F=F+P+m(j=j+N|0,N)|0)+q+m(j=j+L|0,L)|0,t[x]=F,t[x+1]=j}for(var U=0;U<160;U+=2){F=t[U],j=t[U+1];var z=l(r,i,n),H=l(_,w,E),G=c(r,_),$=c(_,r),W=h(a,T),V=h(T,a),K=o[U],Y=o[U+1],Z=d(a,u,v),X=d(T,A,M),J=R+V|0,Q=b+W+m(J,R)|0;Q=(Q=(Q=Q+Z+m(J=J+X|0,X)|0)+K+m(J=J+Y|0,Y)|0)+F+m(J=J+j|0,j)|0;var ee=$+H|0,te=G+z+m(ee,$)|0;b=v,R=M,v=u,M=A,u=a,A=T,a=s+Q+m(T=S+J|0,S)|0,s=n,S=E,n=i,E=w,i=r,w=_,r=Q+te+m(_=J+ee|0,J)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+T|0,this._fl=this._fl+A|0,this._gl=this._gl+M|0,this._hl=this._hl+R|0,this._ah=this._ah+r+m(this._al,_)|0,this._bh=this._bh+i+m(this._bl,w)|0,this._ch=this._ch+n+m(this._cl,E)|0,this._dh=this._dh+s+m(this._dl,S)|0,this._eh=this._eh+a+m(this._el,T)|0,this._fh=this._fh+u+m(this._fl,A)|0,this._gh=this._gh+v+m(this._gl,M)|0,this._hh=this._hh+b+m(this._hl,R)|0},u.prototype._hash=function(){var e=s.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},4851:(e,t,r)=>{e.exports=n;var i=r(2699).EventEmitter;function n(){i.call(this)}r(1285)(n,i),n.Readable=r(8051),n.Writable=r(2557),n.Duplex=r(7073),n.Transform=r(7640),n.PassThrough=r(5163),n.finished=r(9885),n.pipeline=r(3495),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",s),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,e.end())}function u(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function d(e){if(l(),0===i.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",n),e.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",d),e.removeListener("error",d),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",d),e.on("error",d),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},3974:(e,t,r)=>{var i=r(8834).Buffer,n=i.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},s=t.s=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!n(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=o)}this.charBuffer=new i(6),this.charReceived=0,this.charLength=0};function o(e){return e.toString(this.encoding)}function a(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function u(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}s.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";if(e=e.slice(r,e.length),!((i=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i,n=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived),n=(t+=e.toString(this.encoding,0,n)).length-1,(i=t.charCodeAt(n))>=55296&&i<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),e.copy(this.charBuffer,0,0,s),t.substring(0,n)}return t},s.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},s.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,i=this.charBuffer,n=this.encoding;t+=i.slice(0,r).toString(n)}return t}},5803:(e,t,r)=>{function i(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(i("noDeprecation"))return e;var r=!1;return function(){if(!r){if(i("throwDeprecation"))throw new Error(t);i("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},82:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},4895:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(2635),s=r(1990),o=r(2094),a=r(198);function u(e){return e.call.bind(e)}var d="undefined"!=typeof BigInt,l="undefined"!=typeof Symbol,c=u(Object.prototype.toString),h=u(Number.prototype.valueOf),f=u(String.prototype.valueOf),p=u(Boolean.prototype.valueOf);if(d)var y=u(BigInt.prototype.valueOf);if(l)var g=u(Symbol.prototype.valueOf);function m(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function v(e){return"[object Map]"===c(e)}function b(e){return"[object Set]"===c(e)}function _(e){return"[object WeakMap]"===c(e)}function w(e){return"[object WeakSet]"===c(e)}function E(e){return"[object ArrayBuffer]"===c(e)}function S(e){return"undefined"!=typeof ArrayBuffer&&(E.working?E(e):e instanceof ArrayBuffer)}function T(e){return"[object DataView]"===c(e)}function A(e){return"undefined"!=typeof DataView&&(T.working?T(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=s,t.isTypedArray=a,t.isPromise=function(e){return void 0!==i&&e instanceof i||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):a(e)||A(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},v.working="undefined"!=typeof Map&&v(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(v.working?v(e):e instanceof Map)},b.working="undefined"!=typeof Set&&b(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(b.working?b(e):e instanceof Set)},_.working="undefined"!=typeof WeakMap&&_(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(_.working?_(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},E.working="undefined"!=typeof ArrayBuffer&&E(new ArrayBuffer),t.isArrayBuffer=S,T.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&T(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=A;var M="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function R(e){return"[object SharedArrayBuffer]"===c(e)}function x(e){return void 0!==M&&(void 0===R.working&&(R.working=R(new M)),R.working?R(e):e instanceof M)}function k(e){return m(e,h)}function O(e){return m(e,f)}function I(e){return m(e,p)}function C(e){return d&&m(e,y)}function P(e){return l&&m(e,g)}t.isSharedArrayBuffer=x,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},t.isGeneratorObject=function(e){return"[object Generator]"===c(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},t.isNumberObject=k,t.isStringObject=O,t.isBooleanObject=I,t.isBigIntObject=C,t.isSymbolObject=P,t.isBoxedPrimitive=function(e){return k(e)||O(e)||I(e)||C(e)||P(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(S(e)||x(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},3335:(e,t,r)=>{var i=r(4406),n=r(6139).Promise,s=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},i=0;i<t.length;i++)r[t[i]]=Object.getOwnPropertyDescriptor(e,t[i]);return r},o=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(l(arguments[r]));return t.join(" ")}r=1;for(var i=arguments,n=i.length,s=String(e).replace(o,(function(e){if("%%"===e)return"%";if(r>=n)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),a=i[r];r<n;a=i[++r])v(a)||!S(a)?s+=" "+a:s+=" "+l(a);return s},t.deprecate=function(e,r){if(void 0!==i&&!0===i.noDeprecation)return e;if(void 0===i)return function(){return t.deprecate(e,r).apply(this,arguments)};var n=!1;return function(){if(!n){if(i.throwDeprecation)throw new Error(r);i.traceDeprecation?console.trace(r):console.error(r),n=!0}return e.apply(this,arguments)}};var a={},u=/^$/;if(i.env.NODE_DEBUG){var d=i.env.NODE_DEBUG;d=d.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u=new RegExp("^"+d+"$","i")}function l(e,r){var i={seen:[],stylize:h};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),m(r)?i.showHidden=r:r&&t._extend(i,r),w(i.showHidden)&&(i.showHidden=!1),w(i.depth)&&(i.depth=2),w(i.colors)&&(i.colors=!1),w(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=c),f(i,e,i.depth)}function c(e,t){var r=l.styles[t];return r?"["+l.colors[r][0]+"m"+e+"["+l.colors[r][1]+"m":e}function h(e,t){return e}function f(e,r,i){if(e.customInspect&&r&&M(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,e);return _(n)||(n=f(e,n,i)),n}var s=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(_(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return b(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}(e,r);if(s)return s;var o=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),A(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return p(r);if(0===o.length){if(M(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(E(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(T(r))return e.stylize(Date.prototype.toString.call(r),"date");if(A(r))return p(r)}var d,l="",c=!1,h=["{","}"];return g(r)&&(c=!0,h=["[","]"]),M(r)&&(l=" [Function"+(r.name?": "+r.name:"")+"]"),E(r)&&(l=" "+RegExp.prototype.toString.call(r)),T(r)&&(l=" "+Date.prototype.toUTCString.call(r)),A(r)&&(l=" "+p(r)),0!==o.length||c&&0!=r.length?i<0?E(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),d=c?function(e,t,r,i,n){for(var s=[],o=0,a=t.length;o<a;++o)I(t,String(o))?s.push(y(e,t,r,i,String(o),!0)):s.push("");return n.forEach((function(n){n.match(/^\d+$/)||s.push(y(e,t,r,i,n,!0))})),s}(e,r,i,a,o):o.map((function(t){return y(e,r,i,a,t,c)})),e.seen.pop(),function(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(d,l,h)):h[0]+l+h[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function y(e,t,r,i,n,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),I(i,n)||(o="["+n+"]"),a||(e.seen.indexOf(u.value)<0?(a=v(r)?f(e,u.value,null):f(e,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),w(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function g(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function v(e){return null===e}function b(e){return"number"==typeof e}function _(e){return"string"==typeof e}function w(e){return void 0===e}function E(e){return S(e)&&"[object RegExp]"===R(e)}function S(e){return"object"==typeof e&&null!==e}function T(e){return S(e)&&"[object Date]"===R(e)}function A(e){return S(e)&&("[object Error]"===R(e)||e instanceof Error)}function M(e){return"function"==typeof e}function R(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(u.test(e)){var r=i.pid;a[e]=function(){var i=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,i)}}else a[e]=function(){};return a[e]},t.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(4895),t.isArray=g,t.isBoolean=m,t.isNull=v,t.isNullOrUndefined=function(e){return null==e},t.isNumber=b,t.isString=_,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=E,t.types.isRegExp=E,t.isObject=S,t.isDate=T,t.types.isDate=T,t.isError=A,t.types.isNativeError=A,t.isFunction=M,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(82);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",O(),t.format.apply(t,arguments))},t.inherits=r(1285),t._extend=function(e,t){if(!t||!S(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};var C="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(C&&e[C]){var t;if("function"!=typeof(t=e[C]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,i=new n((function(e,i){t=e,r=i})),s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);s.push((function(e,i){e?r(e):t(i)}));try{e.apply(this,s)}catch(e){r(e)}return i}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),C&&Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,s(e))},t.promisify.custom=C,t.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var s=this,o=function(){return n.apply(s,arguments)};e.apply(this,t).then((function(e){i.nextTick(o.bind(null,null,e))}),(function(e){i.nextTick(P.bind(null,e,o))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,s(e)),t}},2094:(e,t,r)=>{"use strict";var i=r(3243),n=r(2191),s=r(2680),o=s("Object.prototype.toString"),a=r(7226)(),u="undefined"==typeof globalThis?r.g:globalThis,d=n(),l=s("String.prototype.slice"),c={},h=r(9765),f=Object.getPrototypeOf;a&&h&&f&&i(d,(function(e){if("function"==typeof u[e]){var t=new u[e];if(Symbol.toStringTag in t){var r=f(t),i=h(r,Symbol.toStringTag);if(!i){var n=f(r);i=h(n,Symbol.toStringTag)}c[e]=i.get}}}));var p=r(198);e.exports=function(e){return!!p(e)&&(a&&Symbol.toStringTag in e?function(e){var t=!1;return i(c,(function(r,i){if(!t)try{var n=r.call(e);n===i&&(t=n)}catch(e){}})),t}(e):l(o(e),8,-1))}},8268:e=>{"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},8006:(e,t,r)=>{"use strict";function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}function n(e,t,r){var i=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function s(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function o(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,i){if(!(this instanceof a))return new a(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},i.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},i.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},i.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},i.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},i.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},i.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},i.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},i.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},i.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},i.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},i.prototype.map=function(e,t){t=t||this;for(var r=new i,n=this.head;null!==n;)r.push(e.call(t,n.value,this)),n=n.next;return r},i.prototype.mapReverse=function(e,t){t=t||this;for(var r=new i,n=this.tail;null!==n;)r.push(e.call(t,n.value,this)),n=n.prev;return r},i.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},i.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},i.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},i.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;for(;null!==s&&n<t;n++,s=s.next)r.push(s.value);return r},i.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=this.length,s=this.tail;null!==s&&n>t;n--)s=s.prev;for(;null!==s&&n>e;n--,s=s.prev)r.push(s.value);return r},i.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,s=this.head;null!==s&&i<e;i++)s=s.next;var o=[];for(i=0;s&&i<t;i++)o.push(s.value),s=this.removeNode(s);for(null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev),i=0;i<r.length;i++)s=n(this,s,r[i]);return o},i.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{r(8268)(i)}catch(e){}},3196:()=>{},8087:()=>{},4854:()=>{},6602:()=>{},8621:()=>{},2191:(e,t,r)=>{"use strict";var i=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],n="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t<i.length;t++)"function"==typeof n[i[t]]&&(e[e.length]=i[t]);return e}},9765:(e,t,r)=>{"use strict";var i=r(7286)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},763:e=>{"use strict";e.exports={i8:"6.5.4"}},2391:e=>{"use strict";e.exports=JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.3.14","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.3.14","@onekeyfe/hd-transport":"^0.3.14","axios":"^0.27.2","bignumber.js":"^9.0.2","bytebuffer":"^5.0.1","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3","ripple-keypairs":"^1.1.4"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9","ripple-keypairs":"^1.1.4"}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(426),t=__webpack_require__.n(e),r=__webpack_require__(5016),i=__webpack_require__.n(r),n=__webpack_require__(5514);const s=e=>{if("string"!=typeof e)return"unknown";if(0===e.indexOf("file://"))return"file://";const t=e.match(/^.+\:\/\/[^\/]+/);return Array.isArray(t)&&t.length>0?t[0]:"unknown"};var o=__webpack_require__(7408);function a(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class u extends o{emit(e,...t){return super.emit(e,...t)}addListener(e,t){return super.addListener(e,t),this}on(e,t){return super.on(e,t),this}once(e,t){return super.once(e,t),this}removeListener(e,t){return super.removeListener(e,t),this}off(e,t){return super.off(e,t),this}removeAllListeners(e){return super.removeAllListeners(e),this}setMaxListeners(e){return super.setMaxListeners(e),this}getMaxListeners(){return super.getMaxListeners()}listeners(e){return super.listeners(e)}rawListeners(e){return super.rawListeners(e)}listenerCount(e){return super.listenerCount(e)}prependListener(e,t){return super.prependListener(e,t),this}prependOnceListener(e,t){return super.prependOnceListener(e,t),this}eventNames(){return super.eventNames()}}class d extends u{emit(e,...t){let r="error"===e;const i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const n=i[e];if(void 0===n)return!1;if("function"==typeof n)a(n,this,t);else{const e=n.length,r=function(e){const t=e.length,r=new Array(t);for(let i=0;i<t;i+=1)r[i]=e[i];return r}(n);for(let i=0;i<e;i+=1)a(r[i],this,t)}return!0}}var l=__webpack_require__(7030),c=__webpack_require__(5505),h=__webpack_require__(1378),f=__webpack_require__(6139).Promise,p=function(e,t,r,i){return new(r||(r=f))((function(n,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}))};const y="$$ONEKEY_DEBUG_LOGGER";var g=__webpack_require__(6139).Promise,m=__webpack_require__(4406),v=function(e,t,r,i){return new(r||(r=g))((function(n,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}))};const b=y,_={formatArgs:function(e){if(e[0]=`${(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")}+${_.humanize(this.diff)}`,!this.useColors)return;const t=`color: ${this.color}`;e.splice(1,0,t,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r+=1,"%c"===e&&(i=r))})),e.splice(i,0,t)},save:function(e){return v(this,void 0,void 0,(function*(){try{e?yield _.storage.setItem(b,e):yield _.storage.removeItem(b)}catch(e){console.error("debug logger storage error",e)}}))},load:function(){return v(this,void 0,void 0,(function*(){let e;try{e=yield _.storage.getItem(b)}catch(e){console.error("debug logger storage error",e)}return!e&&void 0!==m&&"env"in m&&(e=m.env.DEBUG),e}))},useColors:function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}};_.storage=function(){try{return"undefined"!=typeof global&&global.$$onekeyAppStorage?global.$$onekeyAppStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:(console.warn("debugLogger init warning, neither `global.$$onekeyAppStorage` nor `window.localStorage` found."),{getItem(){return v(this,void 0,void 0,(function*(){return""}))},setItem(){return v(this,void 0,void 0,(function*(){}))},removeItem(){return v(this,void 0,void 0,(function*(){}))}})}catch(e){console.error("debug logger storage error",e)}}(),_.humanize=h,_.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],_.log=(...e)=>{console.debug?console.debug(...e):console.log&&console.log(...e)};const w=_;var E=__webpack_require__(6139).Promise;const S=function(){return e=this,t=void 0,i=function*(){return function(e){return p(this,void 0,void 0,(function*(){function t(e){let i,n,s,o=null;function a(...e){if(!a.enabled)return;const r=a,n=Number(new Date),s=n-(i||n);r.diff=s,r.prev=i,r.curr=n,i=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((i,n)=>{if("%%"===i)return"%";o++;const s=t.formatters[n];if("function"==typeof s){const t=e[o];i=s.call(r,t),e.splice(o,1),o--}return i})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==t.namespaces&&(n=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>`-${e}`))].join(",");return t.enable(""),e},t.enable=function(e){return p(this,void 0,void 0,(function*(){let r;yield t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(e=i[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp(`^${e.substr(1)}$`)):t.names.push(new RegExp(`^${e}$`)))}))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,i;for(r=0,i=t.skips.length;r<i;r++)if(t.skips[r].test(e))return!1;for(r=0,i=t.names.length;r<i;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=h,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={j(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: ${e.message}`}}},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]};const n=yield t.load();return yield t.enable(n),t}))}(w)},new((r=void 0)||(r=E))((function(n,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}));var e,t,r,i};function T(...e){"undefined"!=typeof localStorage&&localStorage.getItem(y)&&console.error(...e)}const A={_isFakeLogger:!0,log:(...e)=>{},warn:(...e)=>{},error:(...e)=>{},debug:(...e)=>{},info:(...e)=>{},trace:(...e)=>{}};var M;!function(e){e.jsBridge="jsBridge",e.providerBase="providerBase",e.extInjected="extInjected",e.extContentScripts="extContentScripts",e.webview="webview",e.desktopInjected="desktopInjected",e.ethereum="ethereum"}(M||(M={}));class R extends d{constructor(){super(),this.jsBridge=(...e)=>null,this.providerBase=(...e)=>null,this.extInjected=(...e)=>null,this.extContentScripts=(...e)=>null,this.webview=(...e)=>null,this.desktopInjected=(...e)=>null,this.ethereum=(...e)=>null,this._debug={enable(e){}},this._externalLogger=A,this._createExternalLog=e=>(...t)=>{var r,i;return this.once("debugReady",(()=>{var r;null===(r=this[e])||void 0===r||r.call(this,...t)})),null===(i=null===(r=this._externalLogger)||void 0===r?void 0:r.log)||void 0===i?void 0:i.call(r,`${e} >>> `,...t)},this.initExternalLogInstances()}initExternalLogInstances(){Object.keys(M).forEach((e=>{this[e]=this._createExternalLog(e)}))}isDebugReady(){return this._debug&&"function"==typeof this._debug}_attachExternalLogger(e){e&&(this._externalLogger=e)}_createDebugInstance(e){}}new R;const x=new class extends R{constructor(){super(),this._debugInstanceCreatedMap={},S().then((e=>{this._debug=e,this.initDebugInstances(),this.emit("debugReady")}))}initDebugInstances(){this.isDebugReady()&&Object.keys(M).forEach((e=>{this[e]=this._debug(e)}))}_createDebugInstance(e){if(!this._debugInstanceCreatedMap[e]&&(this._debugInstanceCreatedMap[e]=!0,e&&this._debug&&"function"==typeof this._debug)){const t=this._debug(e),r=this[e];this[e]=(...e)=>{t(...e),r&&"function"==typeof r&&r(...e)}}}};var k,O;!function(e){e.RESPONSE="RESPONSE",e.REQUEST="REQUEST"}(k||(k={})),function(e){e.ethereum="ethereum",e.conflux="conflux",e.solana="solana",e.starcoin="starcoin",e.sollet="sollet",e.near="near",e.$private="$private",e.$hardware_sdk="$hardware_sdk"}(O||(O={}));var I=__webpack_require__(6920);class C extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return I(this.serialize(),N,2)}}class P extends C{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function N(e,t){if("[Circular]"!==t)return t}const D=4500,B={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Web3 provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4500:{standard:"",message:"The request by this Web3 provider is timeout."}};function q(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){const t=e.toString();if(r=B,i=t,Object.prototype.hasOwnProperty.call(r,i))return B[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return"Unspecified server error."}var r,i;return t}q(-32603);const L=e=>j(D,e);function j(e,t){const[r,i]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(t);return new P(e,r||q(e),i)}var F=__webpack_require__(6139).Promise;const U="undefined"!=typeof window?window:global,z="message",H="error";class G extends d{constructor(e={}){var t,r;super(),this._requestPayloadCache={},this.isExtUi=!1,this.isInjected=!1,this.sendAsString=!0,this.globalOnMessageEnabled=!0,this.providersHub={},this.globalOnMessage=e=>{return t=this,r=void 0,n=function*(){try{if(this.config.receiveHandler&&this.globalOnMessageEnabled){const t=yield this.config.receiveHandler(e,this);e.id&&this.response({id:e.id,scope:e.scope,remoteId:e.remoteId,data:t})}}catch(t){e.id&&e.type===k.REQUEST&&this.responseError({id:e.id,scope:e.scope,remoteId:e.remoteId,error:t}),this.emit(H,t)}},new((i=void 0)||(i=F))((function(e,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,a)}u((n=n.apply(t,r||[])).next())}));var t,r,i,n},this.version="0.0.17",this.remoteInfo={origin:"",remoteId:""},this.callbacksExpireTimeout=6e5,this.debugLogger=x,this.callbacks=[],this.callbackId=1,this.config=e,this.callbacksExpireTimeout=null!==(t=e.timeout)&&void 0!==t?t:this.callbacksExpireTimeout,this.debugLogger=e.debugLogger||x,this.sendAsString=null!==(r=e.sendAsString)&&void 0!==r?r:this.sendAsString,this.config.receiveHandler&&this.on(z,this.globalOnMessage),this.on(H,(e=>{var t;T("JsBridge ERROR: ",e,{code:null===(t=e)||void 0===t?void 0:t.code})})),this.rejectExpiredCallbacks()}attachProviderInstance(e){var t;const r=e.providerName;r&&(this.providersHub[r]=null!==(t=this.providersHub[r])&&void 0!==t?t:[],this.providersHub[r].push(e))}createCallbackId(){return this.callbackId+=1,this.callbackId}createPayload(e,{resolve:t,reject:r}){const{id:i,type:n}=e;if(t&&r&&i&&n===k.REQUEST){if(this.callbacks[i])throw new Error(`JsBridge ERROR: callback exists, id=${i}`);this.callbacks[i]={id:i,resolve:t,reject:r,created:Date.now()}}if(e.error){const t=e.error;e.error=function(e){return{name:e.name,message:e.message,stack:e.stack,code:e.code,data:e.data,key:e.key,info:e.info,className:e.className}}(t)}return null==e||delete e.resolve,null==e||delete e.reject,e}send({type:e,data:t,error:r,id:i,remoteId:n,sync:s=!1,scope:o}){const a=(a,u)=>{var d,l,c;let h=i;s||e!==k.REQUEST||(h=this.createCallbackId());try{const i=this.createPayload({id:h,data:t,error:r,type:e,origin:(null===(d=null==U?void 0:U.location)||void 0===d?void 0:d.origin)||"",remoteId:n,scope:o},{resolve:a,reject:u});let s=i;this.sendAsString&&(s=JSON.stringify(i)),(null===(l=this.debugLogger.jsBridge)||void 0===l?void 0:l.enabled)&&i&&i.id&&i.type===k.REQUEST&&(this._requestPayloadCache[i.id]=i,i.id%100==0&&(this._requestPayloadCache={})),this.debugLogger.jsBridge("send",i,"\r\n ------\x3e ",i.data,"\r\n ------\x3e ",null===(c=i.data)||void 0===c?void 0:c.result),this.sendPayload(s)}catch(e){h?this.rejectCallback(h,e):this.emit(H,e)}};if(!s)return new F(a);a()}rejectCallback(e,t){this.processCallback({method:"reject",id:e,error:t})}resolveCallback(e,t){this.processCallback({method:"resolve",id:e,data:t})}processCallback({method:e,id:t,data:r,error:i}){const n=this.callbacks[t];n&&("reject"===e&&(n.reject&&n.reject(i),this.emit(H,i)),"resolve"===e&&n.resolve&&n.resolve(r),this.clearCallbackCache(t))}rejectExpiredCallbacks(){if(!this.callbacksExpireTimeout)return;const e=Date.now();for(const t in this.callbacks){const r=this.callbacks[t];if(r&&r.created&&e-r.created>this.callbacksExpireTimeout){const e=L();this.rejectCallback(t,e)}}setTimeout((()=>{this.rejectExpiredCallbacks()}),this.callbacksExpireTimeout)}clearCallbackCache(e){delete this.callbacks[e]}receive(e="",t){var r,i,n,s,o;let a={data:null};if(l(e)&&(a=e),c(e))try{a=JSON.parse(e)}catch(p){throw this.emit(H,p),new Error("JsBridge ERROR: JSON.parse payloadReceived failed")}if(a.origin=null==t?void 0:t.origin,a.internal=Boolean(null==t?void 0:t.internal),(null==t?void 0:t.internal)&&this.isExtUi&&function(e){const t=e;return Boolean(t.name)&&["onekey-provider-eth","onekey-provider-cfx","publicConfig"].includes(t.name)}(a))return;if(!a.origin&&!this.isInjected)throw T(null===(r=null==this?void 0:this.constructor)||void 0===r?void 0:r.name,"[payload.origin] is missing.",this),new Error("JsBridge ERROR: receive message [payload.origin] is required.");if(!a.internal&&!a.scope)throw new Error("JsBridge ERROR: receive message [payload.scope] is required for non-internal method call.");const u=null!==(n=this._requestPayloadCache[null!==(i=null==a?void 0:a.id)&&void 0!==i?i:""])&&void 0!==n?n:null;this.debugLogger.jsBridge("receive",a,{sender:t},"\r\n -----\x3e ",null!==(o=null===(s=a.data)||void 0===s?void 0:s.result)&&void 0!==o?o:a.data,"\r\n <----- ",null==u?void 0:u.data);const{type:d,id:h,data:f,error:p,origin:y,remoteId:g}=a;if(this.remoteInfo={origin:y,remoteId:g},d===k.RESPONSE){if(null==h)throw new Error("JsBridge ERROR: parameter [id] is required in JsBridge.receive() when REQUEST type message");if(this.callbacks[h])try{p?this.rejectCallback(h,p):this.resolveCallback(h,f)}catch(e){this.emit(H,e)}}else{if(d!==k.REQUEST)throw new Error(`JsBridge ERROR: payload type not support yet (type=${d||"undefined"})`);{const e=Object.assign(Object.assign({},a),{created:Date.now()});this.emit(z,e)}}}requestSync({data:e,scope:t,remoteId:r}){this.send({id:void 0,type:k.REQUEST,scope:t,data:e,remoteId:r,sync:!0})}request(e){const{data:t,remoteId:r,scope:i}=e;return void 0===t&&console.warn("JsBridge ERROR: data required. Call like `bridge.request({ data: {...} });`"),this.send({type:k.REQUEST,data:t,remoteId:r,sync:!1,scope:i})}response({id:e,data:t,remoteId:r,scope:i}){this.send({type:k.RESPONSE,data:t,id:e,remoteId:r,scope:i,sync:!0})}responseError({id:e,error:t,scope:r,remoteId:i}){this.send({type:k.RESPONSE,error:t,id:e,remoteId:i,scope:r,sync:!0})}}__webpack_require__(1049),__webpack_require__(6139).Promise,__webpack_require__(6139).Promise;let $=!1;class W extends G{constructor(e){var t;super(e),this.sendAsString=!1,this.isInjected=!0,this.bridgeConfig=e,this.targetOrigin=null!==(t=e.targetOrigin)&&void 0!==t?t:window.location.origin,function(e={}){$||($=!0,window.addEventListener("message",(t=>{var r,i,n;const s=t.data,o=null===(r=e.bridge)||void 0===r?void 0:r.bridgeConfig;if(o&&s.channel===o.channel&&s.frameName===o.remoteFrameName){const t=s.payload,r=null!==(i=e.bridge)&&void 0!==i?i:null===(n=null===window||void 0===window?void 0:window.$onekey)||void 0===n?void 0:n.jsBridge;r&&r.receive(t)}}),!1))}({debugLogger:this.debugLogger,bridge:this,origin:this.targetOrigin})}sendPayload(e){const t={channel:this.bridgeConfig.channel,frameName:this.bridgeConfig.selfFrameName,payload:e,direction:""};this.bridgeConfig.remoteFrame.postMessage(t,this.targetOrigin)}}var V=__webpack_require__(1464);const K="onekey-iframe",Y="onekey-host",Z="onekey-js-sdk",X="$hardware_sdk";let J,Q;const ee=(0,n.jl)(n.d0.SendMessage),te=async(e,t=!0)=>{const r=t?Q:J;try{"LOG_EVENT"!==e.event&&ee.debug("request: ",e);const t=await(r?.request({scope:X,data:{...e}}));return"LOG_EVENT"!==e.event&&ee.debug("response: ",t),t}catch(e){throw ee.error(e),V.ERRORS.CreateErrorByMessage(e.message)}};let re;const ie=(0,n.jl)(n.d0.Iframe);window.addEventListener("message",(e=>{if(e.source===window||!e.data)return;const r=(0,n.kW)(e);r.type===n.Bg.INIT&&async function(e){if(n.hm.getSettings("origin"))return;const r=(0,n._4)({...e.settings??{},isFrame:!0});r.origin=origin&&"null"!==origin?origin:e.settings.origin,ie.enabled=!!r.debug;try{const e="webusb"===r.env?i():t();re=await(0,n.S0)(r,e),re?.on(n.WE,(e=>te(e,!1)))}catch(e){return(0,n.xG)(e)}(e=>{const t=new W(e);e.isHost?Q=t:J=t})({isHost:!1,remoteFrame:window.parent,remoteFrameName:Y,selfFrameName:K,channel:Z,targetOrigin:s(r.parentOrigin),receiveHandler:async e=>{const t=(0,n.kW)(e);ie.debug("Frame Bridge Receive message: ",t);const r=await(re?.handleMessage(t));return ie.debug("Frame Bridge response data: ",r),r}}),await te((0,n.Tl)(n.Bg.INIT_BRIDGE,{}),!1)}(r.payload??{})}),!1)})()})();
3
- //# sourceMappingURL=iframe.d52c39c0a861b73374d7.js.map