@danidoble/webserial 4.5.0-beta.8 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boardroid.js +2 -2
- package/dist/{devices-B5N__0E-.js → devices-CzEcntFZ.js} +1 -1
- package/dist/hopper.js +1 -1
- package/dist/jofemar.js +2 -2
- package/dist/jsd.js +2 -2
- package/dist/{kernel-B9Cl3HQU.js → kernel-D9C1iBu-.js} +5 -5
- package/dist/kernel.js +2 -2
- package/dist/locker.js +2 -2
- package/dist/pinpad.cjs +11 -11
- package/dist/pinpad.js +654 -576
- package/dist/pinpax.js +2 -2
- package/dist/relay.js +2 -2
- package/dist/types/lib/serial/pinpad.d.ts +5 -3
- package/dist/types/lib/serial/pinpad.d.ts.map +1 -1
- package/dist/{webserial-core-DNpHXAr2.js → webserial-core-Bn6Ker2l.js} +3 -3
- package/dist/webserial.js +8 -8
- package/package.json +4 -4
package/dist/pinpad.cjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./kernel-BEA0hNWZ.cjs"),Te=require("./devices-Be3Fj7uv.cjs");var Rn="0123456789abcdefghijklmnopqrstuvwxyz";function Y(i){return Rn.charAt(i)}function Cn(i,t){return i&t}function Bt(i,t){return i|t}function Ae(i,t){return i^t}function Re(i,t){return i&~t}function On(i){if(i==0)return-1;var t=0;return(i&65535)==0&&(i>>=16,t+=16),(i&255)==0&&(i>>=8,t+=8),(i&15)==0&&(i>>=4,t+=4),(i&3)==0&&(i>>=2,t+=2),(i&1)==0&&++t,t}function Dn(i){for(var t=0;i!=0;)i&=i-1,++t;return t}var gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ze="=";function Tt(i){var t,e,n="";for(t=0;t+3<=i.length;t+=3)e=parseInt(i.substring(t,t+3),16),n+=gt.charAt(e>>6)+gt.charAt(e&63);for(t+1==i.length?(e=parseInt(i.substring(t,t+1),16),n+=gt.charAt(e<<2)):t+2==i.length&&(e=parseInt(i.substring(t,t+2),16),n+=gt.charAt(e>>2)+gt.charAt((e&3)<<4));(n.length&3)>0;)n+=Ze;return n}function Ce(i){var t="",e,n=0,r=0;for(e=0;e<i.length&&i.charAt(e)!=Ze;++e){var s=gt.indexOf(i.charAt(e));s<0||(n==0?(t+=Y(s>>2),r=s&3,n=1):n==1?(t+=Y(r<<2|s>>4),r=s&15,n=2):n==2?(t+=Y(r),t+=Y(s>>2),r=s&3,n=3):(t+=Y(r<<2|s>>4),t+=Y(s&15),n=0))}return n==1&&(t+=Y(r<<2)),t}var pt,In={decode:function(i){var t;if(pt===void 0){var e="0123456789ABCDEF",n=` \f
|
|
2
2
|
\r \u2028\u2029`;for(pt={},t=0;t<16;++t)pt[e.charAt(t)]=t;for(e=e.toLowerCase(),t=10;t<16;++t)pt[e.charAt(t)]=t;for(t=0;t<n.length;++t)pt[n.charAt(t)]=-1}var r=[],s=0,a=0;for(t=0;t<i.length;++t){var o=i.charAt(t);if(o=="=")break;if(o=pt[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+t);s|=o,++a>=2?(r[r.length]=s,s=0,a=0):s<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return r}},ot,ce={decode:function(i){var t;if(ot===void 0){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=`= \f
|
|
3
|
-
\r \u2028\u2029`;for(ot=Object.create(null),t=0;t<64;++t)ot[e.charAt(t)]=t;for(ot["-"]=62,ot._=63,t=0;t<n.length;++t)ot[n.charAt(t)]=-1}var r=[],s=0,a=0;for(t=0;t<i.length;++t){var o=i.charAt(t);if(o=="=")break;if(o=ot[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+t);s|=o,++a>=4?(r[r.length]=s>>16,r[r.length]=s>>8&255,r[r.length]=s&255,s=0,a=0):s<<=6}}switch(a){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=s>>10;break;case 3:r[r.length]=s>>16,r[r.length]=s>>8&255;break}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var t=ce.re.exec(i);if(t)if(t[1])i=t[1];else if(t[2])i=t[2];else throw new Error("RegExp out of sync");return ce.decode(i)}},dt=1e13,St=(function(){function i(t){this.buf=[+t||0]}return i.prototype.mulAdd=function(t,e){var n=this.buf,r=n.length,s,a;for(s=0;s<r;++s)a=n[s]*t+e,a<dt?e=0:(e=0|a/dt,a-=e*dt),n[s]=a;e>0&&(n[s]=e)},i.prototype.sub=function(t){var e=this.buf,n=e.length,r,s;for(r=0;r<n;++r)s=e[r]-t,s<0?(s+=dt,t=1):t=0,e[r]=s;for(;e[e.length-1]===0;)e.pop()},i.prototype.toString=function(t){if((t||10)!=10)throw new Error("only base 10 is supported");for(var e=this.buf,n=e[e.length-1].toString(),r=e.length-2;r>=0;--r)n+=(dt+e[r]).toString().substring(1);return n},i.prototype.valueOf=function(){for(var t=this.buf,e=0,n=t.length-1;n>=0;--n)e=e*dt+t[n];return e},i.prototype.simplify=function(){var t=this.buf;return t.length==1?t[0]:this},i})(),
|
|
4
|
-
`;break;default:r+=" "}return r},i.prototype.isASCII=function(t,e){for(var n=t;n<e;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},i.prototype.parseStringISO=function(t,e){for(var n="",r=t;r<e;++r)n+=String.fromCharCode(this.get(r));return n},i.prototype.parseStringUTF=function(t,e){for(var n="",r=t;r<e;){var s=this.get(r++);s<128?n+=String.fromCharCode(s):s>191&&s<224?n+=String.fromCharCode((s&31)<<6|this.get(r++)&63):n+=String.fromCharCode((s&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return n},i.prototype.parseStringBMP=function(t,e){for(var n="",r,s,a=t;a<e;)r=this.get(a++),s=this.get(a++),n+=String.fromCharCode(r<<8|s);return n},i.prototype.parseTime=function(t,e,n){var r=this.parseStringISO(t,e),s=(n?
|
|
3
|
+
\r \u2028\u2029`;for(ot=Object.create(null),t=0;t<64;++t)ot[e.charAt(t)]=t;for(ot["-"]=62,ot._=63,t=0;t<n.length;++t)ot[n.charAt(t)]=-1}var r=[],s=0,a=0;for(t=0;t<i.length;++t){var o=i.charAt(t);if(o=="=")break;if(o=ot[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+t);s|=o,++a>=4?(r[r.length]=s>>16,r[r.length]=s>>8&255,r[r.length]=s&255,s=0,a=0):s<<=6}}switch(a){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=s>>10;break;case 3:r[r.length]=s>>16,r[r.length]=s>>8&255;break}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var t=ce.re.exec(i);if(t)if(t[1])i=t[1];else if(t[2])i=t[2];else throw new Error("RegExp out of sync");return ce.decode(i)}},dt=1e13,St=(function(){function i(t){this.buf=[+t||0]}return i.prototype.mulAdd=function(t,e){var n=this.buf,r=n.length,s,a;for(s=0;s<r;++s)a=n[s]*t+e,a<dt?e=0:(e=0|a/dt,a-=e*dt),n[s]=a;e>0&&(n[s]=e)},i.prototype.sub=function(t){var e=this.buf,n=e.length,r,s;for(r=0;r<n;++r)s=e[r]-t,s<0?(s+=dt,t=1):t=0,e[r]=s;for(;e[e.length-1]===0;)e.pop()},i.prototype.toString=function(t){if((t||10)!=10)throw new Error("only base 10 is supported");for(var e=this.buf,n=e[e.length-1].toString(),r=e.length-2;r>=0;--r)n+=(dt+e[r]).toString().substring(1);return n},i.prototype.valueOf=function(){for(var t=this.buf,e=0,n=t.length-1;n>=0;--n)e=e*dt+t[n];return e},i.prototype.simplify=function(){var t=this.buf;return t.length==1?t[0]:this},i})(),Ye="…",Nn=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Bn=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function mt(i,t){return i.length>t&&(i=i.substring(0,t)+Ye),i}var ee=(function(){function i(t,e){this.hexDigits="0123456789ABCDEF",t instanceof i?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}return i.prototype.get=function(t){if(t===void 0&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(t):this.enc[t]},i.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(t&15)},i.prototype.hexDump=function(t,e,n){for(var r="",s=t;s<e;++s)if(r+=this.hexByte(this.get(s)),n!==!0)switch(s&15){case 7:r+=" ";break;case 15:r+=`
|
|
4
|
+
`;break;default:r+=" "}return r},i.prototype.isASCII=function(t,e){for(var n=t;n<e;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},i.prototype.parseStringISO=function(t,e){for(var n="",r=t;r<e;++r)n+=String.fromCharCode(this.get(r));return n},i.prototype.parseStringUTF=function(t,e){for(var n="",r=t;r<e;){var s=this.get(r++);s<128?n+=String.fromCharCode(s):s>191&&s<224?n+=String.fromCharCode((s&31)<<6|this.get(r++)&63):n+=String.fromCharCode((s&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return n},i.prototype.parseStringBMP=function(t,e){for(var n="",r,s,a=t;a<e;)r=this.get(a++),s=this.get(a++),n+=String.fromCharCode(r<<8|s);return n},i.prototype.parseTime=function(t,e,n){var r=this.parseStringISO(t,e),s=(n?Nn:Bn).exec(r);return s?(n&&(s[1]=+s[1],s[1]+=+s[1]<70?2e3:1900),r=s[1]+"-"+s[2]+"-"+s[3]+" "+s[4],s[5]&&(r+=":"+s[5],s[6]&&(r+=":"+s[6],s[7]&&(r+="."+s[7]))),s[8]&&(r+=" UTC",s[8]!="Z"&&(r+=s[8],s[9]&&(r+=":"+s[9]))),r):"Unrecognized time: "+r},i.prototype.parseInteger=function(t,e){for(var n=this.get(t),r=n>127,s=r?255:0,a,o="";n==s&&++t<e;)n=this.get(t);if(a=e-t,a===0)return r?-1:0;if(a>4){for(o=n,a<<=3;((+o^s)&128)==0;)o=+o<<1,--a;o="("+a+` bit)
|
|
5
5
|
`}r&&(n=n-256);for(var c=new St(n),u=t+1;u<e;++u)c.mulAdd(256,this.get(u));return o+c.toString()},i.prototype.parseBitString=function(t,e,n){for(var r=this.get(t),s=(e-t-1<<3)-r,a="("+s+` bit)
|
|
6
6
|
`,o="",c=t+1;c<e;++c){for(var u=this.get(c),l=c==e-1?r:0,f=7;f>=l;--f)o+=u>>f&1?"1":"0";if(o.length>n)return a+mt(o,n)}return a+o},i.prototype.parseOctetString=function(t,e,n){if(this.isASCII(t,e))return mt(this.parseStringISO(t,e),n);var r=e-t,s="("+r+` byte)
|
|
7
|
-
`;n/=2,r>n&&(e=t+n);for(var a=t;a<e;++a)s+=this.hexByte(this.get(a));return r>n&&(s+=
|
|
8
|
-
`,this.sub!==null){t+=" ";for(var n=0,r=this.sub.length;n<r;++n)e+=this.sub[n].toPrettyString(t)}return e},i.prototype.posStart=function(){return this.stream.pos},i.prototype.posContent=function(){return this.stream.pos+this.header},i.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},i.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},i.decodeLength=function(t){var e=t.get(),n=e&127;if(n==e)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(n===0)return null;e=0;for(var r=0;r<n;++r)e=e*256+t.get();return e},i.prototype.getHexStringValue=function(){var t=this.toHexString(),e=this.header*2,n=this.length*2;return t.substring(e,e+n)},i.decode=function(t){var e;t instanceof ee?e=t:e=new ee(t,0);var n=new ee(e),r=new Ce(e),s=i.decodeLength(e),a=e.pos,o=a-n.pos,c=null,u=function(){var f=[];if(s!==null){for(var d=a+s;e.pos<d;)f[f.length]=i.decode(e);if(e.pos!=d)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var g=i.decode(e);if(g.tag.isEOC())break;f[f.length]=g}s=a-e.pos}catch(P){throw new Error("Exception while decoding undefined length content: "+P)}return f};if(r.tagConstructed)c=u();else if(r.isUniversal()&&(r.tagNumber==3||r.tagNumber==4))try{if(r.tagNumber==3&&e.get()!=0)throw new Error("BIT STRINGs with unused bits cannot encapsulate.");c=u();for(var l=0;l<c.length;++l)if(c[l].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch{c=null}if(c===null){if(s===null)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);e.pos=a+Math.abs(s)}return new i(n,o,s,r,c)},i})(),Ce=(function(){function i(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var n=new St;do e=t.get(),n.mulAdd(128,e&127);while(e&128);this.tagNumber=n.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i})(),rt,Bn=0xdeadbeefcafe,Oe=(Bn&16777215)==15715070,V=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],xn=(1<<26)/V[V.length-1],v=(function(){function i(t,e,n){t!=null&&(typeof t=="number"?this.fromNumber(t,e,n):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}return i.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var n=(1<<e)-1,r,s=!1,a="",o=this.t,c=this.DB-o*this.DB%e;if(o-- >0)for(c<this.DB&&(r=this[o]>>c)>0&&(s=!0,a=Y(r));o>=0;)c<e?(r=(this[o]&(1<<c)-1)<<e-c,r|=this[--o]>>(c+=this.DB-e)):(r=this[o]>>(c-=e)&n,c<=0&&(c+=this.DB,--o)),r>0&&(s=!0),s&&(a+=Y(r));return s?a:"0"},i.prototype.negate=function(){var t=S();return i.ZERO.subTo(this,t),t},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(t){var e=this.s-t.s;if(e!=0)return e;var n=this.t;if(e=n-t.t,e!=0)return this.s<0?-e:e;for(;--n>=0;)if((e=this[n]-t[n])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+xt(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(t){var e=S();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&t.subTo(e,e),e},i.prototype.modPowInt=function(t,e){var n;return t<256||e.isEven()?n=new De(e):n=new Ie(e),this.exp(t,n)},i.prototype.clone=function(){var t=S();return this.copyTo(t),t},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},i.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var n=this.DB-t*this.DB%8,r,s=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[s++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),(r&128)!=0&&(r|=-256),s==0&&(this.s&128)!=(r&128)&&++s,(s>0||r!=this.s)&&(e[s++]=r);return e},i.prototype.equals=function(t){return this.compareTo(t)==0},i.prototype.min=function(t){return this.compareTo(t)<0?this:t},i.prototype.max=function(t){return this.compareTo(t)>0?this:t},i.prototype.and=function(t){var e=S();return this.bitwiseTo(t,An,e),e},i.prototype.or=function(t){var e=S();return this.bitwiseTo(t,Bt,e),e},i.prototype.xor=function(t){var e=S();return this.bitwiseTo(t,Te,e),e},i.prototype.andNot=function(t){var e=S();return this.bitwiseTo(t,Ae,e),e},i.prototype.not=function(){for(var t=S(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},i.prototype.shiftLeft=function(t){var e=S();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},i.prototype.shiftRight=function(t){var e=S();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},i.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+Rn(this[t]);return this.s<0?this.t*this.DB:-1},i.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=Cn(this[n]^e);return t},i.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0},i.prototype.setBit=function(t){return this.changeBit(t,Bt)},i.prototype.clearBit=function(t){return this.changeBit(t,Ae)},i.prototype.flipBit=function(t){return this.changeBit(t,Te)},i.prototype.add=function(t){var e=S();return this.addTo(t,e),e},i.prototype.subtract=function(t){var e=S();return this.subTo(t,e),e},i.prototype.multiply=function(t){var e=S();return this.multiplyTo(t,e),e},i.prototype.divide=function(t){var e=S();return this.divRemTo(t,e,null),e},i.prototype.remainder=function(t){var e=S();return this.divRemTo(t,null,e),e},i.prototype.divideAndRemainder=function(t){var e=S(),n=S();return this.divRemTo(t,e,n),[e,n]},i.prototype.modPow=function(t,e){var n=t.bitLength(),r,s=nt(1),a;if(n<=0)return s;n<18?r=1:n<48?r=3:n<144?r=4:n<768?r=5:r=6,n<8?a=new De(e):e.isEven()?a=new Ln(e):a=new Ie(e);var o=[],c=3,u=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var f=S();for(a.sqrTo(o[1],f);c<=l;)o[c]=S(),a.mulTo(f,o[c-2],o[c]),c+=2}var d=t.t-1,g,P=!0,m=S(),_;for(n=xt(t[d])-1;d>=0;){for(n>=u?g=t[d]>>n-u&l:(g=(t[d]&(1<<n+1)-1)<<u-n,d>0&&(g|=t[d-1]>>this.DB+n-u)),c=r;(g&1)==0;)g>>=1,--c;if((n-=c)<0&&(n+=this.DB,--d),P)o[g].copyTo(s),P=!1;else{for(;c>1;)a.sqrTo(s,m),a.sqrTo(m,s),c-=2;c>0?a.sqrTo(s,m):(_=s,s=m,m=_),a.mulTo(m,o[g],s)}for(;d>=0&&(t[d]&1<<n)==0;)a.sqrTo(s,m),_=s,s=m,m=_,--n<0&&(n=this.DB-1,--d)}return a.revert(s)},i.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return i.ZERO;for(var n=t.clone(),r=this.clone(),s=nt(1),a=nt(0),o=nt(0),c=nt(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;r.isEven();)r.rShiftTo(1,r),e?((!o.isEven()||!c.isEven())&&(o.addTo(this,o),c.subTo(t,c)),o.rShiftTo(1,o)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);n.compareTo(r)>=0?(n.subTo(r,n),e&&s.subTo(o,s),a.subTo(c,a)):(r.subTo(n,r),e&&o.subTo(s,o),c.subTo(a,c))}if(r.compareTo(i.ONE)!=0)return i.ZERO;if(c.compareTo(t)>=0)return c.subtract(t);if(c.signum()<0)c.addTo(t,c);else return c;return c.signum()<0?c.add(t):c},i.prototype.pow=function(t){return this.exp(t,new Un)},i.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var s=e.getLowestSetBit(),a=n.getLowestSetBit();if(a<0)return e;for(s<a&&(a=s),a>0&&(e.rShiftTo(a,e),n.rShiftTo(a,n));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return a>0&&n.lShiftTo(a,n),n},i.prototype.isProbablePrime=function(t){var e,n=this.abs();if(n.t==1&&n[0]<=V[V.length-1]){for(e=0;e<V.length;++e)if(n[0]==V[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<V.length;){for(var r=V[e],s=e+1;s<V.length&&r<xn;)r*=V[s++];for(r=n.modInt(r);e<s;)if(r%V[e++]==0)return!1}return n.millerRabin(t)},i.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},i.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},i.prototype.fromString=function(t,e){var n;if(e==16)n=4;else if(e==8)n=3;else if(e==256)n=8;else if(e==2)n=1;else if(e==32)n=5;else if(e==4)n=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var r=t.length,s=!1,a=0;--r>=0;){var o=n==8?+t[r]&255:Be(t,r);if(o<0){t.charAt(r)=="-"&&(s=!0);continue}s=!1,a==0?this[this.t++]=o:a+n>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=n,a>=this.DB&&(a-=this.DB)}n==8&&(+t[0]&128)!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),s&&i.ZERO.subTo(this,this)},i.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},i.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},i.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},i.prototype.lShiftTo=function(t,e){for(var n=t%this.DB,r=this.DB-n,s=(1<<r)-1,a=Math.floor(t/this.DB),o=this.s<<n&this.DM,c=this.t-1;c>=0;--c)e[c+a+1]=this[c]>>r|o,o=(this[c]&s)<<n;for(var c=a-1;c>=0;--c)e[c]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t){e.t=0;return}var r=t%this.DB,s=this.DB-r,a=(1<<r)-1;e[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)e[o-n-1]|=(this[o]&a)<<s,e[o-n]=this[o]>>r;r>0&&(e[this.t-n-1]|=(this.s&a)<<s),e.t=this.t-n,e.clamp()},i.prototype.subTo=function(t,e){for(var n=0,r=0,s=Math.min(t.t,this.t);n<s;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},i.prototype.multiplyTo=function(t,e){var n=this.abs(),r=t.abs(),s=n.t;for(e.t=s+r.t;--s>=0;)e[s]=0;for(s=0;s<r.t;++s)e[s+n.t]=n.am(0,r[s],e,s,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&i.ZERO.subTo(e,e)},i.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},i.prototype.divRemTo=function(t,e,n){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t){e?.fromInt(0),n!=null&&this.copyTo(n);return}n==null&&(n=S());var a=S(),o=this.s,c=t.s,u=this.DB-xt(r[r.t-1]);u>0?(r.lShiftTo(u,a),s.lShiftTo(u,n)):(r.copyTo(a),s.copyTo(n));var l=a.t,f=a[l-1];if(f!=0){var d=f*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),g=this.FV/d,P=(1<<this.F1)/d,m=1<<this.F2,_=n.t,b=_-l,w=e??S();for(a.dlShiftTo(b,w),n.compareTo(w)>=0&&(n[n.t++]=1,n.subTo(w,n)),i.ONE.dlShiftTo(l,w),w.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--b>=0;){var T=n[--_]==f?this.DM:Math.floor(n[_]*g+(n[_-1]+m)*P);if((n[_]+=a.am(0,T,n,b,0,l))<T)for(a.dlShiftTo(b,w),n.subTo(w,n);n[_]<--T;)n.subTo(w,n)}e!=null&&(n.drShiftTo(l,e),o!=c&&i.ZERO.subTo(e,e)),n.t=l,n.clamp(),u>0&&n.rShiftTo(u,n),o<0&&i.ZERO.subTo(n,n)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(t,e){if(t>4294967295||t<1)return i.ONE;var n=S(),r=S(),s=e.convert(this),a=xt(t)-1;for(s.copyTo(n);--a>=0;)if(e.sqrTo(n,r),(t&1<<a)>0)e.mulTo(r,s,n);else{var o=n;n=r,r=o}return e.revert(n)},i.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},i.prototype.toRadix=function(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=nt(n),s=S(),a=S(),o="";for(this.divRemTo(r,s,a);s.signum()>0;)o=(n+a.intValue()).toString(t).substring(1)+o,s.divRemTo(r,s,a);return a.intValue().toString(t)+o},i.prototype.fromRadix=function(t,e){this.fromInt(0),e==null&&(e=10);for(var n=this.chunkSize(e),r=Math.pow(e,n),s=!1,a=0,o=0,c=0;c<t.length;++c){var u=Be(t,c);if(u<0){t.charAt(c)=="-"&&this.signum()==0&&(s=!0);continue}o=e*o+u,++a>=n&&(this.dMultiply(r),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(e,a)),this.dAddOffset(o,0)),s&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(t,e,n){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),Bt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var r=[],s=t&7;r.length=(t>>3)+1,e.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},i.prototype.bitwiseTo=function(t,e,n){var r,s,a=Math.min(t.t,this.t);for(r=0;r<a;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=a;r<this.t;++r)n[r]=e(this[r],s);n.t=this.t}else{for(s=this.s&this.DM,r=a;r<t.t;++r)n[r]=e(s,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},i.prototype.changeBit=function(t,e){var n=i.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},i.prototype.addTo=function(t,e){for(var n=0,r=0,s=Math.min(t.t,this.t);n<s;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},i.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(t,e,n){var r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var s=n.t-this.t;r<s;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(var s=Math.min(t.t,e);r<s;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},i.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},i.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(e==0)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},i.prototype.millerRabin=function(t){var e=this.subtract(i.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var r=e.shiftRight(n);t=t+1>>1,t>V.length&&(t=V.length);for(var s=S(),a=0;a<t;++a){s.fromInt(V[Math.floor(Math.random()*V.length)]);var o=s.modPow(r,this);if(o.compareTo(i.ONE)!=0&&o.compareTo(e)!=0){for(var c=1;c++<n&&o.compareTo(e)!=0;)if(o=o.modPowInt(2,this),o.compareTo(i.ONE)==0)return!1;if(o.compareTo(e)!=0)return!1}}return!0},i.prototype.square=function(){var t=S();return this.squareTo(t),t},i.prototype.gcda=function(t,e){var n=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(n.compareTo(r)<0){var s=n;n=r,r=s}var a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){e(n);return}a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var c=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(c,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){e(r)},0))};setTimeout(c,10)},i.prototype.fromNumberAsync=function(t,e,n,r){if(typeof e=="number")if(t<2)this.fromInt(1);else{this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),Bt,this),this.isEven()&&this.dAddOffset(1,0);var s=this,a=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(i.ONE.shiftLeft(t-1),s),s.isProbablePrime(e)?setTimeout(function(){r()},0):setTimeout(a,0)};setTimeout(a,0)}else{var o=[],c=t&7;o.length=(t>>3)+1,e.nextBytes(o),c>0?o[0]&=(1<<c)-1:o[0]=0,this.fromString(o,256)}},i})(),Un=(function(){function i(){}return i.prototype.convert=function(t){return t},i.prototype.revert=function(t){return t},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},i.prototype.sqrTo=function(t,e){t.squareTo(e)},i})(),De=(function(){function i(t){this.m=t}return i.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},i.prototype.revert=function(t){return t},i.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},i.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i})(),Ie=(function(){function i(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return i.prototype.convert=function(t){var e=S();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(v.ZERO)>0&&this.m.subTo(e,e),e},i.prototype.revert=function(t){var e=S();return t.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=t[e]&32767,r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(n=e+this.m.t,t[n]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},i.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i})(),Ln=(function(){function i(t){this.m=t,this.r2=S(),this.q3=S(),v.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return i.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=S();return t.copyTo(e),this.reduce(e),e},i.prototype.revert=function(t){return t},i.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},i.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i})();function S(){return new v(null)}function O(i,t){return new v(i,t)}var Ne=typeof navigator<"u";Ne&&Oe&&navigator.appName=="Microsoft Internet Explorer"?(v.prototype.am=function(t,e,n,r,s,a){for(var o=e&32767,c=e>>15;--a>=0;){var u=this[t]&32767,l=this[t++]>>15,f=c*u+l*o;u=o*u+((f&32767)<<15)+n[r]+(s&1073741823),s=(u>>>30)+(f>>>15)+c*l+(s>>>30),n[r++]=u&1073741823}return s},rt=30):Ne&&Oe&&navigator.appName!="Netscape"?(v.prototype.am=function(t,e,n,r,s,a){for(;--a>=0;){var o=e*this[t++]+n[r]+s;s=Math.floor(o/67108864),n[r++]=o&67108863}return s},rt=26):(v.prototype.am=function(t,e,n,r,s,a){for(var o=e&16383,c=e>>14;--a>=0;){var u=this[t]&16383,l=this[t++]>>14,f=c*u+l*o;u=o*u+((f&16383)<<14)+n[r]+s,s=(u>>28)+(f>>14)+c*l,n[r++]=u&268435455}return s},rt=28);v.prototype.DB=rt;v.prototype.DM=(1<<rt)-1;v.prototype.DV=1<<rt;var _e=52;v.prototype.FV=Math.pow(2,_e);v.prototype.F1=_e-rt;v.prototype.F2=2*rt-_e;var Xt=[],bt,K;bt=48;for(K=0;K<=9;++K)Xt[bt++]=K;bt=97;for(K=10;K<36;++K)Xt[bt++]=K;bt=65;for(K=10;K<36;++K)Xt[bt++]=K;function Be(i,t){var e=Xt[i.charCodeAt(t)];return e??-1}function nt(i){var t=S();return t.fromInt(i),t}function xt(i){var t=1,e;return(e=i>>>16)!=0&&(i=e,t+=16),(e=i>>8)!=0&&(i=e,t+=8),(e=i>>4)!=0&&(i=e,t+=4),(e=i>>2)!=0&&(i=e,t+=2),(e=i>>1)!=0&&(i=e,t+=1),t}v.ZERO=nt(0);v.ONE=nt(1);var Vn=(function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},i.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},i})();function Mn(){return new Vn}var Ye=256,Ut,it=null,W;if(it==null){it=[],W=0;var Lt=void 0;if(typeof window<"u"&&self.crypto&&self.crypto.getRandomValues){var ne=new Uint32Array(256);for(self.crypto.getRandomValues(ne),Lt=0;Lt<ne.length;++Lt)it[W++]=ne[Lt]&255}var Vt=0,Mt=function(i){if(Vt=Vt||0,Vt>=256||W>=Ye){self.removeEventListener?self.removeEventListener("mousemove",Mt,!1):self.detachEvent&&self.detachEvent("onmousemove",Mt);return}try{var t=i.x+i.y;it[W++]=t&255,Vt+=1}catch{}};typeof window<"u"&&(self.addEventListener?self.addEventListener("mousemove",Mt,!1):self.attachEvent&&self.attachEvent("onmousemove",Mt))}function Fn(){if(Ut==null){for(Ut=Mn();W<Ye;){var i=Math.floor(65536*Math.random());it[W++]=i&255}for(Ut.init(it),W=0;W<it.length;++W)it[W]=0;W=0}return Ut.next()}var Ht=(function(){function i(){}return i.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=Fn()},i})();function ue(i){return jn($n(kn(i),i.length*8))}function xe(i){for(var t="0123456789abcdef",e="",n=0;n<i.length;n++){var r=i.charCodeAt(n);e+=t.charAt(r>>>4&15)+t.charAt(r&15)}return e}function kn(i){for(var t=Array(i.length>>2),e=0;e<t.length;e++)t[e]=0;for(var e=0;e<i.length*8;e+=8)t[e>>5]|=(i.charCodeAt(e/8)&255)<<24-e%32;return t}function jn(i){for(var t="",e=0;e<i.length*32;e+=8)t+=String.fromCharCode(i[e>>5]>>>24-e%32&255);return t}function J(i,t){return i>>>t|i<<32-t}function tn(i,t){return i>>>t}function qn(i,t,e){return i&t^~i&e}function Kn(i,t,e){return i&t^i&e^t&e}function Hn(i){return J(i,2)^J(i,13)^J(i,22)}function Wn(i){return J(i,6)^J(i,11)^J(i,25)}function Xn(i){return J(i,7)^J(i,18)^tn(i,3)}function zn(i){return J(i,17)^J(i,19)^tn(i,10)}var Gn=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function $n(i,t){var e=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),n=new Array(64),r,s,a,o,c,u,l,f,d,g,P,m;for(i[t>>5]|=128<<24-t%32,i[(t+64>>9<<4)+15]=t,d=0;d<i.length;d+=16){for(r=e[0],s=e[1],a=e[2],o=e[3],c=e[4],u=e[5],l=e[6],f=e[7],g=0;g<64;g++)g<16?n[g]=i[g+d]:n[g]=N(N(N(zn(n[g-2]),n[g-7]),Xn(n[g-15])),n[g-16]),P=N(N(N(N(f,Wn(c)),qn(c,u,l)),Gn[g]),n[g]),m=N(Hn(r),Kn(r,s,a)),f=l,l=u,u=c,c=N(o,P),o=a,a=s,s=r,r=N(P,m);e[0]=N(r,e[0]),e[1]=N(s,e[1]),e[2]=N(a,e[2]),e[3]=N(o,e[3]),e[4]=N(c,e[4]),e[5]=N(u,e[5]),e[6]=N(l,e[6]),e[7]=N(f,e[7])}return e}function N(i,t){var e=(i&65535)+(t&65535),n=(i>>16)+(t>>16)+(e>>16);return n<<16|e&65535}function Jn(i,t){if(t<i.length+22)return console.error("Message too long for RSA"),null;for(var e=t-i.length-6,n="",r=0;r<e;r+=2)n+="ff";var s="0001"+n+"00"+i;return O(s,16)}function Qn(i,t){if(t<i.length+11)return console.error("Message too long for RSA"),null;for(var e=[],n=i.length-1;n>=0&&t>0;){var r=i.charCodeAt(n--);r<128?e[--t]=r:r>127&&r<2048?(e[--t]=r&63|128,e[--t]=r>>6|192):(e[--t]=r&63|128,e[--t]=r>>6&63|128,e[--t]=r>>12|224)}e[--t]=0;for(var s=new Ht,a=[];t>2;){for(a[0]=0;a[0]==0;)s.nextBytes(a);e[--t]=a[0]}return e[--t]=2,e[--t]=0,new v(e)}function Ue(i,t,e){for(var n="",r=0;n.length<t;)n+=e(String.fromCharCode.apply(String,i.concat([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255]))),r+=1;return n}var Zn=32;function Yn(i,t){var e=Zn,n=ue;if(i.length+2*e+2>t)throw"Message too long for RSA";var r="",s;for(s=0;s<t-i.length-2*e-2;s+=1)r+="\0";var a=n("")+r+""+i,o=new Array(e);new Ht().nextBytes(o);var c=Ue(o,a.length,n),u=[];for(s=0;s<a.length;s+=1)u[s]=a.charCodeAt(s)^c.charCodeAt(s);var l=Ue(u,o.length,n),f=[0];for(s=0;s<o.length;s+=1)f[s+1]=o[s]^l.charCodeAt(s);return new v(f.concat(u))}var ti=(function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(t){if(this.p==null||this.q==null)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),n=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(n)<0;)e=e.add(this.p);return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},i.prototype.setPublic=function(t,e){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=O(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(t,e){typeof e>"u"&&(e=Qn);var n=this.n.bitLength()+7>>3,r=e(t,n);if(r==null)return null;var s=this.doPublic(r);if(s==null)return null;for(var a=s.toString(16),o=a.length,c=0;c<n*2-o;c++)a="0"+a;return a},i.prototype.setPrivate=function(t,e,n){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=O(t,16),this.e=parseInt(e,16),this.d=O(n,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(t,e,n,r,s,a,o,c){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=O(t,16),this.e=parseInt(e,16),this.d=O(n,16),this.p=O(r,16),this.q=O(s,16),this.dmp1=O(a,16),this.dmq1=O(o,16),this.coeff=O(c,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(t,e){var n=new Ht,r=t>>1;this.e=parseInt(e,16);for(var s=new v(e,16);;){for(;this.p=new v(t-r,1,n),!(this.p.subtract(v.ONE).gcd(s).compareTo(v.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new v(r,1,n),!(this.q.subtract(v.ONE).gcd(s).compareTo(v.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(v.ONE),c=this.q.subtract(v.ONE),u=o.multiply(c);if(u.gcd(s).compareTo(v.ONE)==0){this.n=this.p.multiply(this.q),this.d=s.modInverse(u),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(c),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(t){var e=O(t,16),n=this.doPrivate(e);return n==null?null:ei(n,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(t,e,n){var r=new Ht,s=t>>1;this.e=parseInt(e,16);var a=new v(e,16),o=this,c=function(){var u=function(){if(o.p.compareTo(o.q)<=0){var d=o.p;o.p=o.q,o.q=d}var g=o.p.subtract(v.ONE),P=o.q.subtract(v.ONE),m=g.multiply(P);m.gcd(a).compareTo(v.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(m),o.dmp1=o.d.mod(g),o.dmq1=o.d.mod(P),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(c,0)},l=function(){o.q=S(),o.q.fromNumberAsync(s,1,r,function(){o.q.subtract(v.ONE).gcda(a,function(d){d.compareTo(v.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(u,0):setTimeout(l,0)})})},f=function(){o.p=S(),o.p.fromNumberAsync(t-s,1,r,function(){o.p.subtract(v.ONE).gcda(a,function(d){d.compareTo(v.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(f,0)})})};setTimeout(f,0)};setTimeout(c,0)},i.prototype.sign=function(t,e,n){var r=ni(n),s=r+e(t).toString(),a=this.n.bitLength()/4,o=Jn(s,a);if(o==null)return null;var c=this.doPrivate(o);if(c==null)return null;for(var u=c.toString(16),l=u.length,f=0;f<a-l;f++)u="0"+u;return u},i.prototype.verify=function(t,e,n){var r=O(e,16),s=this.doPublic(r);if(s==null)return null;var a=s.toString(16).replace(/^1f+00/,""),o=ii(a);return o==n(t).toString()},i})();function ei(i,t){for(var e=i.toByteArray(),n=0;n<e.length&&e[n]==0;)++n;if(e.length-n!=t-1||e[n]!=2)return null;for(++n;e[n]!=0;)if(++n>=e.length)return null;for(var r="";++n<e.length;){var s=e[n]&255;s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((s&31)<<6|e[n+1]&63),++n):(r+=String.fromCharCode((s&15)<<12|(e[n+1]&63)<<6|e[n+2]&63),n+=2)}return r}var kt={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function ni(i){return kt[i]||""}function ii(i){for(var t in kt)if(kt.hasOwnProperty(t)){var e=kt[t],n=e.length;if(i.substring(0,n)==e)return i.substring(n)}return i}function D(i,t,e){if(!t||!i)throw new Error("extend failed, please check that all dependencies are included.");var n=function(){};n.prototype=t.prototype,i.prototype=new n,i.prototype.constructor=i,i.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}var p={};(typeof p.asn1>"u"||!p.asn1)&&(p.asn1={});p.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var t=i.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(i){var t=i.toString(16);if(t.substring(0,1)!="-")t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var e=t.substring(1),n=e.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r="",s=0;s<n;s++)r+="f";var a=new v(r,16),o=a.xor(i).add(v.ONE);t=o.toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(i,t){return hextopem(i,t)},this.newObject=function(i){var t=p,e=t.asn1,n=e.DERBoolean,r=e.DERInteger,s=e.DERBitString,a=e.DEROctetString,o=e.DERNull,c=e.DERObjectIdentifier,u=e.DEREnumerated,l=e.DERUTF8String,f=e.DERNumericString,d=e.DERPrintableString,g=e.DERTeletexString,P=e.DERIA5String,m=e.DERUTCTime,_=e.DERGeneralizedTime,b=e.DERSequence,w=e.DERSet,T=e.DERTaggedObject,A=e.ASN1Util.newObject,U=Object.keys(i);if(U.length!=1)throw"key of param shall be only one.";var E=U[0];if(":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":")==-1)throw"undefined key: "+E;if(E=="bool")return new n(i[E]);if(E=="int")return new r(i[E]);if(E=="bitstr")return new s(i[E]);if(E=="octstr")return new a(i[E]);if(E=="null")return new o(i[E]);if(E=="oid")return new c(i[E]);if(E=="enum")return new u(i[E]);if(E=="utf8str")return new l(i[E]);if(E=="numstr")return new f(i[E]);if(E=="prnstr")return new d(i[E]);if(E=="telstr")return new g(i[E]);if(E=="ia5str")return new P(i[E]);if(E=="utctime")return new m(i[E]);if(E=="gentime")return new _(i[E]);if(E=="seq"){for(var H=i[E],Q=[],z=0;z<H.length;z++){var k=A(H[z]);Q.push(k)}return new b({array:Q})}if(E=="set"){for(var H=i[E],Q=[],z=0;z<H.length;z++){var k=A(H[z]);Q.push(k)}return new w({array:Q})}if(E=="tag"){var I=i[E];if(Object.prototype.toString.call(I)==="[object Array]"&&I.length==3){var ht=A(I[2]);return new T({tag:I[0],explicit:I[1],obj:ht})}else{var st={};if(I.explicit!==void 0&&(st.explicit=I.explicit),I.tag!==void 0&&(st.tag=I.tag),I.obj===void 0)throw"obj shall be specified for 'tag'.";return st.obj=A(I.obj),new T(st)}}},this.jsonToASN1HEX=function(i){var t=this.newObject(i);return t.getEncodedHex()}};p.asn1.ASN1Util.oidHexToInt=function(i){for(var r="",t=parseInt(i.substring(0,2),16),e=Math.floor(t/40),n=t%40,r=e+"."+n,s="",a=2;a<i.length;a+=2){var o=parseInt(i.substring(a,a+2),16),c=("00000000"+o.toString(2)).slice(-8);if(s=s+c.substring(1,8),c.substring(0,1)=="0"){var u=new v(s,2);r=r+"."+u.toString(10),s=""}}return r};p.asn1.ASN1Util.oidIntToHex=function(i){var t=function(o){var c=o.toString(16);return c.length==1&&(c="0"+c),c},e=function(o){var c="",u=new v(o,10),l=u.toString(2),f=7-l.length%7;f==7&&(f=0);for(var d="",g=0;g<f;g++)d+="0";l=d+l;for(var g=0;g<l.length-1;g+=7){var P=l.substring(g,g+7);g!=l.length-7&&(P="1"+P),c+=t(parseInt(P,2))}return c};if(!i.match(/^[0-9.]+$/))throw"malformed oid string: "+i;var n="",r=i.split("."),s=parseInt(r[0])*40+parseInt(r[1]);n+=t(s),r.splice(0,2);for(var a=0;a<r.length;a++)n+=e(r[a]);return n};p.asn1.ASN1Object=function(){var i="";this.getLengthHexFromValue=function(){if(typeof this.hV>"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);var r=128+n;return r.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};p.asn1.DERAbstractString=function(i){p.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};D(p.asn1.DERAbstractString,p.asn1.ASN1Object);p.asn1.DERAbstractTime=function(i){p.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){utc=t.getTime()+t.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(t,e,n){var r=this.zeroPadding,s=this.localDateToUTC(t),a=String(s.getFullYear());e=="utc"&&(a=a.substring(2,4));var o=r(String(s.getMonth()+1),2),c=r(String(s.getDate()),2),u=r(String(s.getHours()),2),l=r(String(s.getMinutes()),2),f=r(String(s.getSeconds()),2),d=a+o+c+u+l+f;if(n===!0){var g=s.getMilliseconds();if(g!=0){var P=r(String(g),3);P=P.replace(/[0]+$/,""),d=d+"."+P}}return d+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,n,r,s,a){var o=new Date(Date.UTC(t,e-1,n,r,s,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}};D(p.asn1.DERAbstractTime,p.asn1.ASN1Object);p.asn1.DERAbstractStructured=function(i){p.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};D(p.asn1.DERAbstractStructured,p.asn1.ASN1Object);p.asn1.DERBoolean=function(){p.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};D(p.asn1.DERBoolean,p.asn1.ASN1Object);p.asn1.DERInteger=function(i){p.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=p.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new v(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};D(p.asn1.DERInteger,p.asn1.ASN1Object);p.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var t=p.asn1.ASN1Util.newObject(i.obj);i.hex="00"+t.getEncodedHex()}p.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,n){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var r="0"+e;this.hTLV=null,this.isModified=!0,this.hV=r+n},this.setByBinaryString=function(e){e=e.replace(/0+$/,"");var n=8-e.length%8;n==8&&(n=0);for(var r=0;r<=n;r++)e+="0";for(var s="",r=0;r<e.length-1;r+=8){var a=e.substring(r,r+8),o=parseInt(a,2).toString(16);o.length==1&&(o="0"+o),s+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+n+s},this.setByBooleanArray=function(e){for(var n="",r=0;r<e.length;r++)e[r]==!0?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(e){for(var n=new Array(e),r=0;r<e;r++)n[r]=!1;return n},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"&&i.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(i):typeof i.hex<"u"?this.setHexValueIncludingUnusedBits(i.hex):typeof i.bin<"u"?this.setByBinaryString(i.bin):typeof i.array<"u"&&this.setByBooleanArray(i.array))};D(p.asn1.DERBitString,p.asn1.ASN1Object);p.asn1.DEROctetString=function(i){if(i!==void 0&&typeof i.obj<"u"){var t=p.asn1.ASN1Util.newObject(i.obj);i.hex=t.getEncodedHex()}p.asn1.DEROctetString.superclass.constructor.call(this,i),this.hT="04"};D(p.asn1.DEROctetString,p.asn1.DERAbstractString);p.asn1.DERNull=function(){p.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};D(p.asn1.DERNull,p.asn1.ASN1Object);p.asn1.DERObjectIdentifier=function(i){var t=function(n){var r=n.toString(16);return r.length==1&&(r="0"+r),r},e=function(n){var r="",s=new v(n,10),a=s.toString(2),o=7-a.length%7;o==7&&(o=0);for(var c="",u=0;u<o;u++)c+="0";a=c+a;for(var u=0;u<a.length-1;u+=7){var l=a.substring(u,u+7);u!=a.length-7&&(l="1"+l),r+=t(parseInt(l,2))}return r};p.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(n){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueOidString=function(n){if(!n.match(/^[0-9.]+$/))throw"malformed oid string: "+n;var r="",s=n.split("."),a=parseInt(s[0])*40+parseInt(s[1]);r+=t(a),s.splice(0,2);for(var o=0;o<s.length;o++)r+=e(s[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(n){var r=p.asn1.x509.OID.name2oid(n);if(r!=="")this.setValueOidString(r);else throw"DERObjectIdentifier oidName undefined: "+n},this.getFreshValueHex=function(){return this.hV},i!==void 0&&(typeof i=="string"?i.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(i):this.setValueName(i):i.oid!==void 0?this.setValueOidString(i.oid):i.hex!==void 0?this.setValueHex(i.hex):i.name!==void 0&&this.setValueName(i.name))};D(p.asn1.DERObjectIdentifier,p.asn1.ASN1Object);p.asn1.DEREnumerated=function(i){p.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=p.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new v(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};D(p.asn1.DEREnumerated,p.asn1.ASN1Object);p.asn1.DERUTF8String=function(i){p.asn1.DERUTF8String.superclass.constructor.call(this,i),this.hT="0c"};D(p.asn1.DERUTF8String,p.asn1.DERAbstractString);p.asn1.DERNumericString=function(i){p.asn1.DERNumericString.superclass.constructor.call(this,i),this.hT="12"};D(p.asn1.DERNumericString,p.asn1.DERAbstractString);p.asn1.DERPrintableString=function(i){p.asn1.DERPrintableString.superclass.constructor.call(this,i),this.hT="13"};D(p.asn1.DERPrintableString,p.asn1.DERAbstractString);p.asn1.DERTeletexString=function(i){p.asn1.DERTeletexString.superclass.constructor.call(this,i),this.hT="14"};D(p.asn1.DERTeletexString,p.asn1.DERAbstractString);p.asn1.DERIA5String=function(i){p.asn1.DERIA5String.superclass.constructor.call(this,i),this.hT="16"};D(p.asn1.DERIA5String,p.asn1.DERAbstractString);p.asn1.DERUTCTime=function(i){p.asn1.DERUTCTime.superclass.constructor.call(this,i),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return typeof this.date>"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};D(p.asn1.DERUTCTime,p.asn1.DERAbstractTime);p.asn1.DERGeneralizedTime=function(i){p.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};D(p.asn1.DERGeneralizedTime,p.asn1.DERAbstractTime);p.asn1.DERSequence=function(i){p.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t+=n.getEncodedHex()}return this.hV=t,this.hV}};D(p.asn1.DERSequence,p.asn1.DERAbstractStructured);p.asn1.DERSet=function(i){p.asn1.DERSet.superclass.constructor.call(this,i),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t.push(n.getEncodedHex())}return this.sortFlag==!0&&t.sort(),this.hV=t.join(""),this.hV},typeof i<"u"&&typeof i.sortflag<"u"&&i.sortflag==!1&&(this.sortFlag=!1)};D(p.asn1.DERSet,p.asn1.DERAbstractStructured);p.asn1.DERTaggedObject=function(i){p.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.tag<"u"&&(this.hT=i.tag),typeof i.explicit<"u"&&(this.isExplicit=i.explicit),typeof i.obj<"u"&&(this.asn1Object=i.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))};D(p.asn1.DERTaggedObject,p.asn1.ASN1Object);var ri=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Le=(function(i){ri(t,i);function t(e){var n=i.call(this)||this;return e&&(typeof e=="string"?n.parseKey(e):(t.hasPrivateKeyProperty(e)||t.hasPublicKeyProperty(e))&&n.parsePropertiesFrom(e)),n}return t.prototype.parseKey=function(e){try{var n=0,r=0,s=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,a=s.test(e)?On.decode(e):ce.unarmor(e),o=Nn.decode(a);if(o.sub.length===3&&(o=o.sub[2].sub[0]),o.sub.length===9){n=o.sub[1].getHexStringValue(),this.n=O(n,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var c=o.sub[3].getHexStringValue();this.d=O(c,16);var u=o.sub[4].getHexStringValue();this.p=O(u,16);var l=o.sub[5].getHexStringValue();this.q=O(l,16);var f=o.sub[6].getHexStringValue();this.dmp1=O(f,16);var d=o.sub[7].getHexStringValue();this.dmq1=O(d,16);var g=o.sub[8].getHexStringValue();this.coeff=O(g,16)}else if(o.sub.length===2)if(o.sub[0].sub){var P=o.sub[1],m=P.sub[0];n=m.sub[0].getHexStringValue(),this.n=O(n,16),r=m.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else n=o.sub[0].getHexStringValue(),this.n=O(n,16),r=o.sub[1].getHexStringValue(),this.e=parseInt(r,16);else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new p.asn1.DERInteger({int:0}),new p.asn1.DERInteger({bigint:this.n}),new p.asn1.DERInteger({int:this.e}),new p.asn1.DERInteger({bigint:this.d}),new p.asn1.DERInteger({bigint:this.p}),new p.asn1.DERInteger({bigint:this.q}),new p.asn1.DERInteger({bigint:this.dmp1}),new p.asn1.DERInteger({bigint:this.dmq1}),new p.asn1.DERInteger({bigint:this.coeff})]},n=new p.asn1.DERSequence(e);return n.getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Tt(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new p.asn1.DERSequence({array:[new p.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new p.asn1.DERNull]}),n=new p.asn1.DERSequence({array:[new p.asn1.DERInteger({bigint:this.n}),new p.asn1.DERInteger({int:this.e})]}),r=new p.asn1.DERBitString({hex:"00"+n.getEncodedHex()}),s=new p.asn1.DERSequence({array:[e,r]});return s.getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Tt(this.getPublicBaseKey())},t.wordwrap=function(e,n){if(n=n||64,!e)return e;var r="(.{1,"+n+`})( +|$
|
|
7
|
+
`;n/=2,r>n&&(e=t+n);for(var a=t;a<e;++a)s+=this.hexByte(this.get(a));return r>n&&(s+=Ye),s},i.prototype.parseOID=function(t,e,n){for(var r="",s=new St,a=0,o=t;o<e;++o){var c=this.get(o);if(s.mulAdd(128,c&127),a+=7,!(c&128)){if(r==="")if(s=s.simplify(),s instanceof St)s.sub(80),r="2."+s.toString();else{var u=s<80?s<40?0:1:2;r=u+"."+(s-u*40)}else r+="."+s.toString();if(r.length>n)return mt(r,n);s=new St,a=0}}return a>0&&(r+=".incomplete"),r},i})(),xn=(function(){function i(t,e,n,r,s){if(!(r instanceof Oe))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=n,this.tag=r,this.sub=s}return i.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},i.prototype.content=function(t){if(this.tag===void 0)return null;t===void 0&&(t=1/0);var e=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub!==null?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);switch(this.tag.tagNumber){case 1:return this.stream.get(e)===0?"false":"true";case 2:return this.stream.parseInteger(e,e+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+n,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);case 6:return this.stream.parseOID(e,e+n,t);case 16:case 17:return this.sub!==null?"("+this.sub.length+" elem)":"(no elem)";case 12:return mt(this.stream.parseStringUTF(e,e+n),t);case 18:case 19:case 20:case 21:case 22:case 26:return mt(this.stream.parseStringISO(e,e+n),t);case 30:return mt(this.stream.parseStringBMP(e,e+n),t);case 23:case 24:return this.stream.parseTime(e,e+n,this.tag.tagNumber==23)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(this.sub===null?"null":this.sub.length)+"]"},i.prototype.toPrettyString=function(t){t===void 0&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(e+=" (encapsulates)"),e+=`
|
|
8
|
+
`,this.sub!==null){t+=" ";for(var n=0,r=this.sub.length;n<r;++n)e+=this.sub[n].toPrettyString(t)}return e},i.prototype.posStart=function(){return this.stream.pos},i.prototype.posContent=function(){return this.stream.pos+this.header},i.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},i.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},i.decodeLength=function(t){var e=t.get(),n=e&127;if(n==e)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(n===0)return null;e=0;for(var r=0;r<n;++r)e=e*256+t.get();return e},i.prototype.getHexStringValue=function(){var t=this.toHexString(),e=this.header*2,n=this.length*2;return t.substring(e,e+n)},i.decode=function(t){var e;t instanceof ee?e=t:e=new ee(t,0);var n=new ee(e),r=new Oe(e),s=i.decodeLength(e),a=e.pos,o=a-n.pos,c=null,u=function(){var f=[];if(s!==null){for(var d=a+s;e.pos<d;)f[f.length]=i.decode(e);if(e.pos!=d)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var g=i.decode(e);if(g.tag.isEOC())break;f[f.length]=g}s=a-e.pos}catch(P){throw new Error("Exception while decoding undefined length content: "+P)}return f};if(r.tagConstructed)c=u();else if(r.isUniversal()&&(r.tagNumber==3||r.tagNumber==4))try{if(r.tagNumber==3&&e.get()!=0)throw new Error("BIT STRINGs with unused bits cannot encapsulate.");c=u();for(var l=0;l<c.length;++l)if(c[l].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch{c=null}if(c===null){if(s===null)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);e.pos=a+Math.abs(s)}return new i(n,o,s,r,c)},i})(),Oe=(function(){function i(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=(e&32)!==0,this.tagNumber=e&31,this.tagNumber==31){var n=new St;do e=t.get(),n.mulAdd(128,e&127);while(e&128);this.tagNumber=n.simplify()}}return i.prototype.isUniversal=function(){return this.tagClass===0},i.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},i})(),rt,Ln=0xdeadbeefcafe,De=(Ln&16777215)==15715070,V=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Un=(1<<26)/V[V.length-1],w=(function(){function i(t,e,n){t!=null&&(typeof t=="number"?this.fromNumber(t,e,n):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}return i.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var n=(1<<e)-1,r,s=!1,a="",o=this.t,c=this.DB-o*this.DB%e;if(o-- >0)for(c<this.DB&&(r=this[o]>>c)>0&&(s=!0,a=Y(r));o>=0;)c<e?(r=(this[o]&(1<<c)-1)<<e-c,r|=this[--o]>>(c+=this.DB-e)):(r=this[o]>>(c-=e)&n,c<=0&&(c+=this.DB,--o)),r>0&&(s=!0),s&&(a+=Y(r));return s?a:"0"},i.prototype.negate=function(){var t=S();return i.ZERO.subTo(this,t),t},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(t){var e=this.s-t.s;if(e!=0)return e;var n=this.t;if(e=n-t.t,e!=0)return this.s<0?-e:e;for(;--n>=0;)if((e=this[n]-t[n])!=0)return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+xt(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(t){var e=S();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&t.subTo(e,e),e},i.prototype.modPowInt=function(t,e){var n;return t<256||e.isEven()?n=new Ie(e):n=new Ne(e),this.exp(t,n)},i.prototype.clone=function(){var t=S();return this.copyTo(t),t},i.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},i.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},i.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var n=this.DB-t*this.DB%8,r,s=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[s++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),(r&128)!=0&&(r|=-256),s==0&&(this.s&128)!=(r&128)&&++s,(s>0||r!=this.s)&&(e[s++]=r);return e},i.prototype.equals=function(t){return this.compareTo(t)==0},i.prototype.min=function(t){return this.compareTo(t)<0?this:t},i.prototype.max=function(t){return this.compareTo(t)>0?this:t},i.prototype.and=function(t){var e=S();return this.bitwiseTo(t,Cn,e),e},i.prototype.or=function(t){var e=S();return this.bitwiseTo(t,Bt,e),e},i.prototype.xor=function(t){var e=S();return this.bitwiseTo(t,Ae,e),e},i.prototype.andNot=function(t){var e=S();return this.bitwiseTo(t,Re,e),e},i.prototype.not=function(){for(var t=S(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},i.prototype.shiftLeft=function(t){var e=S();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},i.prototype.shiftRight=function(t){var e=S();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},i.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+On(this[t]);return this.s<0?this.t*this.DB:-1},i.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=Dn(this[n]^e);return t},i.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0},i.prototype.setBit=function(t){return this.changeBit(t,Bt)},i.prototype.clearBit=function(t){return this.changeBit(t,Re)},i.prototype.flipBit=function(t){return this.changeBit(t,Ae)},i.prototype.add=function(t){var e=S();return this.addTo(t,e),e},i.prototype.subtract=function(t){var e=S();return this.subTo(t,e),e},i.prototype.multiply=function(t){var e=S();return this.multiplyTo(t,e),e},i.prototype.divide=function(t){var e=S();return this.divRemTo(t,e,null),e},i.prototype.remainder=function(t){var e=S();return this.divRemTo(t,null,e),e},i.prototype.divideAndRemainder=function(t){var e=S(),n=S();return this.divRemTo(t,e,n),[e,n]},i.prototype.modPow=function(t,e){var n=t.bitLength(),r,s=nt(1),a;if(n<=0)return s;n<18?r=1:n<48?r=3:n<144?r=4:n<768?r=5:r=6,n<8?a=new Ie(e):e.isEven()?a=new Mn(e):a=new Ne(e);var o=[],c=3,u=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var f=S();for(a.sqrTo(o[1],f);c<=l;)o[c]=S(),a.mulTo(f,o[c-2],o[c]),c+=2}var d=t.t-1,g,P=!0,m=S(),_;for(n=xt(t[d])-1;d>=0;){for(n>=u?g=t[d]>>n-u&l:(g=(t[d]&(1<<n+1)-1)<<u-n,d>0&&(g|=t[d-1]>>this.DB+n-u)),c=r;(g&1)==0;)g>>=1,--c;if((n-=c)<0&&(n+=this.DB,--d),P)o[g].copyTo(s),P=!1;else{for(;c>1;)a.sqrTo(s,m),a.sqrTo(m,s),c-=2;c>0?a.sqrTo(s,m):(_=s,s=m,m=_),a.mulTo(m,o[g],s)}for(;d>=0&&(t[d]&1<<n)==0;)a.sqrTo(s,m),_=s,s=m,m=_,--n<0&&(n=this.DB-1,--d)}return a.revert(s)},i.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return i.ZERO;for(var n=t.clone(),r=this.clone(),s=nt(1),a=nt(0),o=nt(0),c=nt(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;r.isEven();)r.rShiftTo(1,r),e?((!o.isEven()||!c.isEven())&&(o.addTo(this,o),c.subTo(t,c)),o.rShiftTo(1,o)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);n.compareTo(r)>=0?(n.subTo(r,n),e&&s.subTo(o,s),a.subTo(c,a)):(r.subTo(n,r),e&&o.subTo(s,o),c.subTo(a,c))}if(r.compareTo(i.ONE)!=0)return i.ZERO;if(c.compareTo(t)>=0)return c.subtract(t);if(c.signum()<0)c.addTo(t,c);else return c;return c.signum()<0?c.add(t):c},i.prototype.pow=function(t){return this.exp(t,new Vn)},i.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var s=e.getLowestSetBit(),a=n.getLowestSetBit();if(a<0)return e;for(s<a&&(a=s),a>0&&(e.rShiftTo(a,e),n.rShiftTo(a,n));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return a>0&&n.lShiftTo(a,n),n},i.prototype.isProbablePrime=function(t){var e,n=this.abs();if(n.t==1&&n[0]<=V[V.length-1]){for(e=0;e<V.length;++e)if(n[0]==V[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<V.length;){for(var r=V[e],s=e+1;s<V.length&&r<Un;)r*=V[s++];for(r=n.modInt(r);e<s;)if(r%V[e++]==0)return!1}return n.millerRabin(t)},i.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},i.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},i.prototype.fromString=function(t,e){var n;if(e==16)n=4;else if(e==8)n=3;else if(e==256)n=8;else if(e==2)n=1;else if(e==32)n=5;else if(e==4)n=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var r=t.length,s=!1,a=0;--r>=0;){var o=n==8?+t[r]&255:xe(t,r);if(o<0){t.charAt(r)=="-"&&(s=!0);continue}s=!1,a==0?this[this.t++]=o:a+n>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=n,a>=this.DB&&(a-=this.DB)}n==8&&(+t[0]&128)!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),s&&i.ZERO.subTo(this,this)},i.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},i.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},i.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},i.prototype.lShiftTo=function(t,e){for(var n=t%this.DB,r=this.DB-n,s=(1<<r)-1,a=Math.floor(t/this.DB),o=this.s<<n&this.DM,c=this.t-1;c>=0;--c)e[c+a+1]=this[c]>>r|o,o=(this[c]&s)<<n;for(var c=a-1;c>=0;--c)e[c]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t){e.t=0;return}var r=t%this.DB,s=this.DB-r,a=(1<<r)-1;e[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)e[o-n-1]|=(this[o]&a)<<s,e[o-n]=this[o]>>r;r>0&&(e[this.t-n-1]|=(this.s&a)<<s),e.t=this.t-n,e.clamp()},i.prototype.subTo=function(t,e){for(var n=0,r=0,s=Math.min(t.t,this.t);n<s;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},i.prototype.multiplyTo=function(t,e){var n=this.abs(),r=t.abs(),s=n.t;for(e.t=s+r.t;--s>=0;)e[s]=0;for(s=0;s<r.t;++s)e[s+n.t]=n.am(0,r[s],e,s,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&i.ZERO.subTo(e,e)},i.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},i.prototype.divRemTo=function(t,e,n){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t){e?.fromInt(0),n!=null&&this.copyTo(n);return}n==null&&(n=S());var a=S(),o=this.s,c=t.s,u=this.DB-xt(r[r.t-1]);u>0?(r.lShiftTo(u,a),s.lShiftTo(u,n)):(r.copyTo(a),s.copyTo(n));var l=a.t,f=a[l-1];if(f!=0){var d=f*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),g=this.FV/d,P=(1<<this.F1)/d,m=1<<this.F2,_=n.t,b=_-l,v=e??S();for(a.dlShiftTo(b,v),n.compareTo(v)>=0&&(n[n.t++]=1,n.subTo(v,n)),i.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--b>=0;){var T=n[--_]==f?this.DM:Math.floor(n[_]*g+(n[_-1]+m)*P);if((n[_]+=a.am(0,T,n,b,0,l))<T)for(a.dlShiftTo(b,v),n.subTo(v,n);n[_]<--T;)n.subTo(v,n)}e!=null&&(n.drShiftTo(l,e),o!=c&&i.ZERO.subTo(e,e)),n.t=l,n.clamp(),u>0&&n.rShiftTo(u,n),o<0&&i.ZERO.subTo(n,n)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e},i.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},i.prototype.exp=function(t,e){if(t>4294967295||t<1)return i.ONE;var n=S(),r=S(),s=e.convert(this),a=xt(t)-1;for(s.copyTo(n);--a>=0;)if(e.sqrTo(n,r),(t&1<<a)>0)e.mulTo(r,s,n);else{var o=n;n=r,r=o}return e.revert(n)},i.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},i.prototype.toRadix=function(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=nt(n),s=S(),a=S(),o="";for(this.divRemTo(r,s,a);s.signum()>0;)o=(n+a.intValue()).toString(t).substring(1)+o,s.divRemTo(r,s,a);return a.intValue().toString(t)+o},i.prototype.fromRadix=function(t,e){this.fromInt(0),e==null&&(e=10);for(var n=this.chunkSize(e),r=Math.pow(e,n),s=!1,a=0,o=0,c=0;c<t.length;++c){var u=xe(t,c);if(u<0){t.charAt(c)=="-"&&this.signum()==0&&(s=!0);continue}o=e*o+u,++a>=n&&(this.dMultiply(r),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(e,a)),this.dAddOffset(o,0)),s&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(t,e,n){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),Bt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var r=[],s=t&7;r.length=(t>>3)+1,e.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},i.prototype.bitwiseTo=function(t,e,n){var r,s,a=Math.min(t.t,this.t);for(r=0;r<a;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=a;r<this.t;++r)n[r]=e(this[r],s);n.t=this.t}else{for(s=this.s&this.DM,r=a;r<t.t;++r)n[r]=e(s,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},i.prototype.changeBit=function(t,e){var n=i.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},i.prototype.addTo=function(t,e){for(var n=0,r=0,s=Math.min(t.t,this.t);n<s;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},i.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},i.prototype.multiplyLowerTo=function(t,e,n){var r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var s=n.t-this.t;r<s;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(var s=Math.min(t.t,e);r<s;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},i.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},i.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(e==0)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},i.prototype.millerRabin=function(t){var e=this.subtract(i.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var r=e.shiftRight(n);t=t+1>>1,t>V.length&&(t=V.length);for(var s=S(),a=0;a<t;++a){s.fromInt(V[Math.floor(Math.random()*V.length)]);var o=s.modPow(r,this);if(o.compareTo(i.ONE)!=0&&o.compareTo(e)!=0){for(var c=1;c++<n&&o.compareTo(e)!=0;)if(o=o.modPowInt(2,this),o.compareTo(i.ONE)==0)return!1;if(o.compareTo(e)!=0)return!1}}return!0},i.prototype.square=function(){var t=S();return this.squareTo(t),t},i.prototype.gcda=function(t,e){var n=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(n.compareTo(r)<0){var s=n;n=r,r=s}var a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){e(n);return}a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var c=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(c,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){e(r)},0))};setTimeout(c,10)},i.prototype.fromNumberAsync=function(t,e,n,r){if(typeof e=="number")if(t<2)this.fromInt(1);else{this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),Bt,this),this.isEven()&&this.dAddOffset(1,0);var s=this,a=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(i.ONE.shiftLeft(t-1),s),s.isProbablePrime(e)?setTimeout(function(){r()},0):setTimeout(a,0)};setTimeout(a,0)}else{var o=[],c=t&7;o.length=(t>>3)+1,e.nextBytes(o),c>0?o[0]&=(1<<c)-1:o[0]=0,this.fromString(o,256)}},i})(),Vn=(function(){function i(){}return i.prototype.convert=function(t){return t},i.prototype.revert=function(t){return t},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},i.prototype.sqrTo=function(t,e){t.squareTo(e)},i})(),Ie=(function(){function i(t){this.m=t}return i.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},i.prototype.revert=function(t){return t},i.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},i.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i})(),Ne=(function(){function i(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return i.prototype.convert=function(t){var e=S();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(w.ZERO)>0&&this.m.subTo(e,e),e},i.prototype.revert=function(t){var e=S();return t.copyTo(e),this.reduce(e),e},i.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=t[e]&32767,r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(n=e+this.m.t,t[n]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},i.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i})(),Mn=(function(){function i(t){this.m=t,this.r2=S(),this.q3=S(),w.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return i.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=S();return t.copyTo(e),this.reduce(e),e},i.prototype.revert=function(t){return t},i.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},i.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},i.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i})();function S(){return new w(null)}function O(i,t){return new w(i,t)}var Be=typeof navigator<"u";Be&&De&&navigator.appName=="Microsoft Internet Explorer"?(w.prototype.am=function(t,e,n,r,s,a){for(var o=e&32767,c=e>>15;--a>=0;){var u=this[t]&32767,l=this[t++]>>15,f=c*u+l*o;u=o*u+((f&32767)<<15)+n[r]+(s&1073741823),s=(u>>>30)+(f>>>15)+c*l+(s>>>30),n[r++]=u&1073741823}return s},rt=30):Be&&De&&navigator.appName!="Netscape"?(w.prototype.am=function(t,e,n,r,s,a){for(;--a>=0;){var o=e*this[t++]+n[r]+s;s=Math.floor(o/67108864),n[r++]=o&67108863}return s},rt=26):(w.prototype.am=function(t,e,n,r,s,a){for(var o=e&16383,c=e>>14;--a>=0;){var u=this[t]&16383,l=this[t++]>>14,f=c*u+l*o;u=o*u+((f&16383)<<14)+n[r]+s,s=(u>>28)+(f>>14)+c*l,n[r++]=u&268435455}return s},rt=28);w.prototype.DB=rt;w.prototype.DM=(1<<rt)-1;w.prototype.DV=1<<rt;var _e=52;w.prototype.FV=Math.pow(2,_e);w.prototype.F1=_e-rt;w.prototype.F2=2*rt-_e;var Xt=[],bt,H;bt=48;for(H=0;H<=9;++H)Xt[bt++]=H;bt=97;for(H=10;H<36;++H)Xt[bt++]=H;bt=65;for(H=10;H<36;++H)Xt[bt++]=H;function xe(i,t){var e=Xt[i.charCodeAt(t)];return e??-1}function nt(i){var t=S();return t.fromInt(i),t}function xt(i){var t=1,e;return(e=i>>>16)!=0&&(i=e,t+=16),(e=i>>8)!=0&&(i=e,t+=8),(e=i>>4)!=0&&(i=e,t+=4),(e=i>>2)!=0&&(i=e,t+=2),(e=i>>1)!=0&&(i=e,t+=1),t}w.ZERO=nt(0);w.ONE=nt(1);var Fn=(function(){function i(){this.i=0,this.j=0,this.S=[]}return i.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},i.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},i})();function kn(){return new Fn}var tn=256,Lt,it=null,W;if(it==null){it=[],W=0;var Ut=void 0;if(typeof window<"u"&&self.crypto&&self.crypto.getRandomValues){var ne=new Uint32Array(256);for(self.crypto.getRandomValues(ne),Ut=0;Ut<ne.length;++Ut)it[W++]=ne[Ut]&255}var Vt=0,Mt=function(i){if(Vt=Vt||0,Vt>=256||W>=tn){self.removeEventListener?self.removeEventListener("mousemove",Mt,!1):self.detachEvent&&self.detachEvent("onmousemove",Mt);return}try{var t=i.x+i.y;it[W++]=t&255,Vt+=1}catch{}};typeof window<"u"&&(self.addEventListener?self.addEventListener("mousemove",Mt,!1):self.attachEvent&&self.attachEvent("onmousemove",Mt))}function jn(){if(Lt==null){for(Lt=kn();W<tn;){var i=Math.floor(65536*Math.random());it[W++]=i&255}for(Lt.init(it),W=0;W<it.length;++W)it[W]=0;W=0}return Lt.next()}var Kt=(function(){function i(){}return i.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=jn()},i})();function ue(i){return Hn(Qn(qn(i),i.length*8))}function Le(i){for(var t="0123456789abcdef",e="",n=0;n<i.length;n++){var r=i.charCodeAt(n);e+=t.charAt(r>>>4&15)+t.charAt(r&15)}return e}function qn(i){for(var t=Array(i.length>>2),e=0;e<t.length;e++)t[e]=0;for(var e=0;e<i.length*8;e+=8)t[e>>5]|=(i.charCodeAt(e/8)&255)<<24-e%32;return t}function Hn(i){for(var t="",e=0;e<i.length*32;e+=8)t+=String.fromCharCode(i[e>>5]>>>24-e%32&255);return t}function J(i,t){return i>>>t|i<<32-t}function en(i,t){return i>>>t}function Kn(i,t,e){return i&t^~i&e}function Wn(i,t,e){return i&t^i&e^t&e}function Xn(i){return J(i,2)^J(i,13)^J(i,22)}function zn(i){return J(i,6)^J(i,11)^J(i,25)}function Gn(i){return J(i,7)^J(i,18)^en(i,3)}function $n(i){return J(i,17)^J(i,19)^en(i,10)}var Jn=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function Qn(i,t){var e=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),n=new Array(64),r,s,a,o,c,u,l,f,d,g,P,m;for(i[t>>5]|=128<<24-t%32,i[(t+64>>9<<4)+15]=t,d=0;d<i.length;d+=16){for(r=e[0],s=e[1],a=e[2],o=e[3],c=e[4],u=e[5],l=e[6],f=e[7],g=0;g<64;g++)g<16?n[g]=i[g+d]:n[g]=N(N(N($n(n[g-2]),n[g-7]),Gn(n[g-15])),n[g-16]),P=N(N(N(N(f,zn(c)),Kn(c,u,l)),Jn[g]),n[g]),m=N(Xn(r),Wn(r,s,a)),f=l,l=u,u=c,c=N(o,P),o=a,a=s,s=r,r=N(P,m);e[0]=N(r,e[0]),e[1]=N(s,e[1]),e[2]=N(a,e[2]),e[3]=N(o,e[3]),e[4]=N(c,e[4]),e[5]=N(u,e[5]),e[6]=N(l,e[6]),e[7]=N(f,e[7])}return e}function N(i,t){var e=(i&65535)+(t&65535),n=(i>>16)+(t>>16)+(e>>16);return n<<16|e&65535}function Zn(i,t){if(t<i.length+22)return console.error("Message too long for RSA"),null;for(var e=t-i.length-6,n="",r=0;r<e;r+=2)n+="ff";var s="0001"+n+"00"+i;return O(s,16)}function Yn(i,t){if(t<i.length+11)return console.error("Message too long for RSA"),null;for(var e=[],n=i.length-1;n>=0&&t>0;){var r=i.charCodeAt(n--);r<128?e[--t]=r:r>127&&r<2048?(e[--t]=r&63|128,e[--t]=r>>6|192):(e[--t]=r&63|128,e[--t]=r>>6&63|128,e[--t]=r>>12|224)}e[--t]=0;for(var s=new Kt,a=[];t>2;){for(a[0]=0;a[0]==0;)s.nextBytes(a);e[--t]=a[0]}return e[--t]=2,e[--t]=0,new w(e)}function Ue(i,t,e){for(var n="",r=0;n.length<t;)n+=e(String.fromCharCode.apply(String,i.concat([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255]))),r+=1;return n}var ti=32;function ei(i,t){var e=ti,n=ue;if(i.length+2*e+2>t)throw"Message too long for RSA";var r="",s;for(s=0;s<t-i.length-2*e-2;s+=1)r+="\0";var a=n("")+r+""+i,o=new Array(e);new Kt().nextBytes(o);var c=Ue(o,a.length,n),u=[];for(s=0;s<a.length;s+=1)u[s]=a.charCodeAt(s)^c.charCodeAt(s);var l=Ue(u,o.length,n),f=[0];for(s=0;s<o.length;s+=1)f[s+1]=o[s]^l.charCodeAt(s);return new w(f.concat(u))}var ni=(function(){function i(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return i.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},i.prototype.doPrivate=function(t){if(this.p==null||this.q==null)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),n=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(n)<0;)e=e.add(this.p);return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},i.prototype.setPublic=function(t,e){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=O(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},i.prototype.encrypt=function(t,e){typeof e>"u"&&(e=Yn);var n=this.n.bitLength()+7>>3,r=e(t,n);if(r==null)return null;var s=this.doPublic(r);if(s==null)return null;for(var a=s.toString(16),o=a.length,c=0;c<n*2-o;c++)a="0"+a;return a},i.prototype.setPrivate=function(t,e,n){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=O(t,16),this.e=parseInt(e,16),this.d=O(n,16)):console.error("Invalid RSA private key")},i.prototype.setPrivateEx=function(t,e,n,r,s,a,o,c){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=O(t,16),this.e=parseInt(e,16),this.d=O(n,16),this.p=O(r,16),this.q=O(s,16),this.dmp1=O(a,16),this.dmq1=O(o,16),this.coeff=O(c,16)):console.error("Invalid RSA private key")},i.prototype.generate=function(t,e){var n=new Kt,r=t>>1;this.e=parseInt(e,16);for(var s=new w(e,16);;){for(;this.p=new w(t-r,1,n),!(this.p.subtract(w.ONE).gcd(s).compareTo(w.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new w(r,1,n),!(this.q.subtract(w.ONE).gcd(s).compareTo(w.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(w.ONE),c=this.q.subtract(w.ONE),u=o.multiply(c);if(u.gcd(s).compareTo(w.ONE)==0){this.n=this.p.multiply(this.q),this.d=s.modInverse(u),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(c),this.coeff=this.q.modInverse(this.p);break}}},i.prototype.decrypt=function(t){var e=O(t,16),n=this.doPrivate(e);return n==null?null:ii(n,this.n.bitLength()+7>>3)},i.prototype.generateAsync=function(t,e,n){var r=new Kt,s=t>>1;this.e=parseInt(e,16);var a=new w(e,16),o=this,c=function(){var u=function(){if(o.p.compareTo(o.q)<=0){var d=o.p;o.p=o.q,o.q=d}var g=o.p.subtract(w.ONE),P=o.q.subtract(w.ONE),m=g.multiply(P);m.gcd(a).compareTo(w.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(m),o.dmp1=o.d.mod(g),o.dmq1=o.d.mod(P),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(c,0)},l=function(){o.q=S(),o.q.fromNumberAsync(s,1,r,function(){o.q.subtract(w.ONE).gcda(a,function(d){d.compareTo(w.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(u,0):setTimeout(l,0)})})},f=function(){o.p=S(),o.p.fromNumberAsync(t-s,1,r,function(){o.p.subtract(w.ONE).gcda(a,function(d){d.compareTo(w.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(f,0)})})};setTimeout(f,0)};setTimeout(c,0)},i.prototype.sign=function(t,e,n){var r=ri(n),s=r+e(t).toString(),a=this.n.bitLength()/4,o=Zn(s,a);if(o==null)return null;var c=this.doPrivate(o);if(c==null)return null;for(var u=c.toString(16),l=u.length,f=0;f<a-l;f++)u="0"+u;return u},i.prototype.verify=function(t,e,n){var r=O(e,16),s=this.doPublic(r);if(s==null)return null;var a=s.toString(16).replace(/^1f+00/,""),o=si(a);return o==n(t).toString()},i})();function ii(i,t){for(var e=i.toByteArray(),n=0;n<e.length&&e[n]==0;)++n;if(e.length-n!=t-1||e[n]!=2)return null;for(++n;e[n]!=0;)if(++n>=e.length)return null;for(var r="";++n<e.length;){var s=e[n]&255;s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((s&31)<<6|e[n+1]&63),++n):(r+=String.fromCharCode((s&15)<<12|(e[n+1]&63)<<6|e[n+2]&63),n+=2)}return r}var kt={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function ri(i){return kt[i]||""}function si(i){for(var t in kt)if(kt.hasOwnProperty(t)){var e=kt[t],n=e.length;if(i.substring(0,n)==e)return i.substring(n)}return i}function D(i,t,e){if(!t||!i)throw new Error("extend failed, please check that all dependencies are included.");var n=function(){};n.prototype=t.prototype,i.prototype=new n,i.prototype.constructor=i,i.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}var p={};(typeof p.asn1>"u"||!p.asn1)&&(p.asn1={});p.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var t=i.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(i){var t=i.toString(16);if(t.substring(0,1)!="-")t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var e=t.substring(1),n=e.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r="",s=0;s<n;s++)r+="f";var a=new w(r,16),o=a.xor(i).add(w.ONE);t=o.toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(i,t){return hextopem(i,t)},this.newObject=function(i){var t=p,e=t.asn1,n=e.DERBoolean,r=e.DERInteger,s=e.DERBitString,a=e.DEROctetString,o=e.DERNull,c=e.DERObjectIdentifier,u=e.DEREnumerated,l=e.DERUTF8String,f=e.DERNumericString,d=e.DERPrintableString,g=e.DERTeletexString,P=e.DERIA5String,m=e.DERUTCTime,_=e.DERGeneralizedTime,b=e.DERSequence,v=e.DERSet,T=e.DERTaggedObject,A=e.ASN1Util.newObject,U=Object.keys(i);if(U.length!=1)throw"key of param shall be only one.";var E=U[0];if(":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":")==-1)throw"undefined key: "+E;if(E=="bool")return new n(i[E]);if(E=="int")return new r(i[E]);if(E=="bitstr")return new s(i[E]);if(E=="octstr")return new a(i[E]);if(E=="null")return new o(i[E]);if(E=="oid")return new c(i[E]);if(E=="enum")return new u(i[E]);if(E=="utf8str")return new l(i[E]);if(E=="numstr")return new f(i[E]);if(E=="prnstr")return new d(i[E]);if(E=="telstr")return new g(i[E]);if(E=="ia5str")return new P(i[E]);if(E=="utctime")return new m(i[E]);if(E=="gentime")return new _(i[E]);if(E=="seq"){for(var K=i[E],Q=[],z=0;z<K.length;z++){var k=A(K[z]);Q.push(k)}return new b({array:Q})}if(E=="set"){for(var K=i[E],Q=[],z=0;z<K.length;z++){var k=A(K[z]);Q.push(k)}return new v({array:Q})}if(E=="tag"){var I=i[E];if(Object.prototype.toString.call(I)==="[object Array]"&&I.length==3){var ht=A(I[2]);return new T({tag:I[0],explicit:I[1],obj:ht})}else{var st={};if(I.explicit!==void 0&&(st.explicit=I.explicit),I.tag!==void 0&&(st.tag=I.tag),I.obj===void 0)throw"obj shall be specified for 'tag'.";return st.obj=A(I.obj),new T(st)}}},this.jsonToASN1HEX=function(i){var t=this.newObject(i);return t.getEncodedHex()}};p.asn1.ASN1Util.oidHexToInt=function(i){for(var r="",t=parseInt(i.substring(0,2),16),e=Math.floor(t/40),n=t%40,r=e+"."+n,s="",a=2;a<i.length;a+=2){var o=parseInt(i.substring(a,a+2),16),c=("00000000"+o.toString(2)).slice(-8);if(s=s+c.substring(1,8),c.substring(0,1)=="0"){var u=new w(s,2);r=r+"."+u.toString(10),s=""}}return r};p.asn1.ASN1Util.oidIntToHex=function(i){var t=function(o){var c=o.toString(16);return c.length==1&&(c="0"+c),c},e=function(o){var c="",u=new w(o,10),l=u.toString(2),f=7-l.length%7;f==7&&(f=0);for(var d="",g=0;g<f;g++)d+="0";l=d+l;for(var g=0;g<l.length-1;g+=7){var P=l.substring(g,g+7);g!=l.length-7&&(P="1"+P),c+=t(parseInt(P,2))}return c};if(!i.match(/^[0-9.]+$/))throw"malformed oid string: "+i;var n="",r=i.split("."),s=parseInt(r[0])*40+parseInt(r[1]);n+=t(s),r.splice(0,2);for(var a=0;a<r.length;a++)n+=e(r[a]);return n};p.asn1.ASN1Object=function(){var i="";this.getLengthHexFromValue=function(){if(typeof this.hV>"u"||this.hV==null)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+i.length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);var r=128+n;return r.toString(16)+e},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}};p.asn1.DERAbstractString=function(i){p.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"?this.setString(i):typeof i.str<"u"?this.setString(i.str):typeof i.hex<"u"&&this.setStringHex(i.hex))};D(p.asn1.DERAbstractString,p.asn1.ASN1Object);p.asn1.DERAbstractTime=function(i){p.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){utc=t.getTime()+t.getTimezoneOffset()*6e4;var e=new Date(utc);return e},this.formatDate=function(t,e,n){var r=this.zeroPadding,s=this.localDateToUTC(t),a=String(s.getFullYear());e=="utc"&&(a=a.substring(2,4));var o=r(String(s.getMonth()+1),2),c=r(String(s.getDate()),2),u=r(String(s.getHours()),2),l=r(String(s.getMinutes()),2),f=r(String(s.getSeconds()),2),d=a+o+c+u+l+f;if(n===!0){var g=s.getMilliseconds();if(g!=0){var P=r(String(g),3);P=P.replace(/[0]+$/,""),d=d+"."+P}}return d+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,n,r,s,a){var o=new Date(Date.UTC(t,e-1,n,r,s,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}};D(p.asn1.DERAbstractTime,p.asn1.ASN1Object);p.asn1.DERAbstractStructured=function(i){p.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,typeof i<"u"&&typeof i.array<"u"&&(this.asn1Array=i.array)};D(p.asn1.DERAbstractStructured,p.asn1.ASN1Object);p.asn1.DERBoolean=function(){p.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"};D(p.asn1.DERBoolean,p.asn1.ASN1Object);p.asn1.DERInteger=function(i){p.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=p.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new w(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.bigint<"u"?this.setByBigInteger(i.bigint):typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};D(p.asn1.DERInteger,p.asn1.ASN1Object);p.asn1.DERBitString=function(i){if(i!==void 0&&typeof i.obj<"u"){var t=p.asn1.ASN1Util.newObject(i.obj);i.hex="00"+t.getEncodedHex()}p.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,n){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var r="0"+e;this.hTLV=null,this.isModified=!0,this.hV=r+n},this.setByBinaryString=function(e){e=e.replace(/0+$/,"");var n=8-e.length%8;n==8&&(n=0);for(var r=0;r<=n;r++)e+="0";for(var s="",r=0;r<e.length-1;r+=8){var a=e.substring(r,r+8),o=parseInt(a,2).toString(16);o.length==1&&(o="0"+o),s+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+n+s},this.setByBooleanArray=function(e){for(var n="",r=0;r<e.length;r++)e[r]==!0?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(e){for(var n=new Array(e),r=0;r<e;r++)n[r]=!1;return n},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i=="string"&&i.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(i):typeof i.hex<"u"?this.setHexValueIncludingUnusedBits(i.hex):typeof i.bin<"u"?this.setByBinaryString(i.bin):typeof i.array<"u"&&this.setByBooleanArray(i.array))};D(p.asn1.DERBitString,p.asn1.ASN1Object);p.asn1.DEROctetString=function(i){if(i!==void 0&&typeof i.obj<"u"){var t=p.asn1.ASN1Util.newObject(i.obj);i.hex=t.getEncodedHex()}p.asn1.DEROctetString.superclass.constructor.call(this,i),this.hT="04"};D(p.asn1.DEROctetString,p.asn1.DERAbstractString);p.asn1.DERNull=function(){p.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};D(p.asn1.DERNull,p.asn1.ASN1Object);p.asn1.DERObjectIdentifier=function(i){var t=function(n){var r=n.toString(16);return r.length==1&&(r="0"+r),r},e=function(n){var r="",s=new w(n,10),a=s.toString(2),o=7-a.length%7;o==7&&(o=0);for(var c="",u=0;u<o;u++)c+="0";a=c+a;for(var u=0;u<a.length-1;u+=7){var l=a.substring(u,u+7);u!=a.length-7&&(l="1"+l),r+=t(parseInt(l,2))}return r};p.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(n){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueOidString=function(n){if(!n.match(/^[0-9.]+$/))throw"malformed oid string: "+n;var r="",s=n.split("."),a=parseInt(s[0])*40+parseInt(s[1]);r+=t(a),s.splice(0,2);for(var o=0;o<s.length;o++)r+=e(s[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(n){var r=p.asn1.x509.OID.name2oid(n);if(r!=="")this.setValueOidString(r);else throw"DERObjectIdentifier oidName undefined: "+n},this.getFreshValueHex=function(){return this.hV},i!==void 0&&(typeof i=="string"?i.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(i):this.setValueName(i):i.oid!==void 0?this.setValueOidString(i.oid):i.hex!==void 0?this.setValueHex(i.hex):i.name!==void 0&&this.setValueName(i.name))};D(p.asn1.DERObjectIdentifier,p.asn1.ASN1Object);p.asn1.DEREnumerated=function(i){p.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=p.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new w(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.int<"u"?this.setByInteger(i.int):typeof i=="number"?this.setByInteger(i):typeof i.hex<"u"&&this.setValueHex(i.hex))};D(p.asn1.DEREnumerated,p.asn1.ASN1Object);p.asn1.DERUTF8String=function(i){p.asn1.DERUTF8String.superclass.constructor.call(this,i),this.hT="0c"};D(p.asn1.DERUTF8String,p.asn1.DERAbstractString);p.asn1.DERNumericString=function(i){p.asn1.DERNumericString.superclass.constructor.call(this,i),this.hT="12"};D(p.asn1.DERNumericString,p.asn1.DERAbstractString);p.asn1.DERPrintableString=function(i){p.asn1.DERPrintableString.superclass.constructor.call(this,i),this.hT="13"};D(p.asn1.DERPrintableString,p.asn1.DERAbstractString);p.asn1.DERTeletexString=function(i){p.asn1.DERTeletexString.superclass.constructor.call(this,i),this.hT="14"};D(p.asn1.DERTeletexString,p.asn1.DERAbstractString);p.asn1.DERIA5String=function(i){p.asn1.DERIA5String.superclass.constructor.call(this,i),this.hT="16"};D(p.asn1.DERIA5String,p.asn1.DERAbstractString);p.asn1.DERUTCTime=function(i){p.asn1.DERUTCTime.superclass.constructor.call(this,i),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return typeof this.date>"u"&&typeof this.s>"u"&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{12}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date))};D(p.asn1.DERUTCTime,p.asn1.DERAbstractTime);p.asn1.DERGeneralizedTime=function(i){p.asn1.DERGeneralizedTime.superclass.constructor.call(this,i),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},i!==void 0&&(i.str!==void 0?this.setString(i.str):typeof i=="string"&&i.match(/^[0-9]{14}Z$/)?this.setString(i):i.hex!==void 0?this.setStringHex(i.hex):i.date!==void 0&&this.setByDate(i.date),i.millis===!0&&(this.withMillis=!0))};D(p.asn1.DERGeneralizedTime,p.asn1.DERAbstractTime);p.asn1.DERSequence=function(i){p.asn1.DERSequence.superclass.constructor.call(this,i),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t+=n.getEncodedHex()}return this.hV=t,this.hV}};D(p.asn1.DERSequence,p.asn1.DERAbstractStructured);p.asn1.DERSet=function(i){p.asn1.DERSet.superclass.constructor.call(this,i),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t.push(n.getEncodedHex())}return this.sortFlag==!0&&t.sort(),this.hV=t.join(""),this.hV},typeof i<"u"&&typeof i.sortflag<"u"&&i.sortflag==!1&&(this.sortFlag=!1)};D(p.asn1.DERSet,p.asn1.DERAbstractStructured);p.asn1.DERTaggedObject=function(i){p.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},typeof i<"u"&&(typeof i.tag<"u"&&(this.hT=i.tag),typeof i.explicit<"u"&&(this.isExplicit=i.explicit),typeof i.obj<"u"&&(this.asn1Object=i.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))};D(p.asn1.DERTaggedObject,p.asn1.ASN1Object);var ai=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Ve=(function(i){ai(t,i);function t(e){var n=i.call(this)||this;return e&&(typeof e=="string"?n.parseKey(e):(t.hasPrivateKeyProperty(e)||t.hasPublicKeyProperty(e))&&n.parsePropertiesFrom(e)),n}return t.prototype.parseKey=function(e){try{var n=0,r=0,s=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,a=s.test(e)?In.decode(e):ce.unarmor(e),o=xn.decode(a);if(o.sub.length===3&&(o=o.sub[2].sub[0]),o.sub.length===9){n=o.sub[1].getHexStringValue(),this.n=O(n,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var c=o.sub[3].getHexStringValue();this.d=O(c,16);var u=o.sub[4].getHexStringValue();this.p=O(u,16);var l=o.sub[5].getHexStringValue();this.q=O(l,16);var f=o.sub[6].getHexStringValue();this.dmp1=O(f,16);var d=o.sub[7].getHexStringValue();this.dmq1=O(d,16);var g=o.sub[8].getHexStringValue();this.coeff=O(g,16)}else if(o.sub.length===2)if(o.sub[0].sub){var P=o.sub[1],m=P.sub[0];n=m.sub[0].getHexStringValue(),this.n=O(n,16),r=m.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else n=o.sub[0].getHexStringValue(),this.n=O(n,16),r=o.sub[1].getHexStringValue(),this.e=parseInt(r,16);else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new p.asn1.DERInteger({int:0}),new p.asn1.DERInteger({bigint:this.n}),new p.asn1.DERInteger({int:this.e}),new p.asn1.DERInteger({bigint:this.d}),new p.asn1.DERInteger({bigint:this.p}),new p.asn1.DERInteger({bigint:this.q}),new p.asn1.DERInteger({bigint:this.dmp1}),new p.asn1.DERInteger({bigint:this.dmq1}),new p.asn1.DERInteger({bigint:this.coeff})]},n=new p.asn1.DERSequence(e);return n.getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Tt(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new p.asn1.DERSequence({array:[new p.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new p.asn1.DERNull]}),n=new p.asn1.DERSequence({array:[new p.asn1.DERInteger({bigint:this.n}),new p.asn1.DERInteger({int:this.e})]}),r=new p.asn1.DERBitString({hex:"00"+n.getEncodedHex()}),s=new p.asn1.DERSequence({array:[e,r]});return s.getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Tt(this.getPublicBaseKey())},t.wordwrap=function(e,n){if(n=n||64,!e)return e;var r="(.{1,"+n+`})( +|$
|
|
9
9
|
?)|(.{1,`+n+"})";return e.match(RegExp(r,"g")).join(`
|
|
10
10
|
`)},t.prototype.getPrivateKey=function(){var e=`-----BEGIN RSA PRIVATE KEY-----
|
|
11
11
|
`;return e+=t.wordwrap(this.getPrivateBaseKeyB64())+`
|
|
12
12
|
`,e+="-----END RSA PRIVATE KEY-----",e},t.prototype.getPublicKey=function(){var e=`-----BEGIN PUBLIC KEY-----
|
|
13
13
|
`;return e+=t.wordwrap(this.getPublicBaseKeyB64())+`
|
|
14
|
-
`,e+="-----END PUBLIC KEY-----",e},t.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t})(
|
|
15
|
-
`).forEach(function(a){r=a.indexOf(":"),e=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!e||t[e]
|
|
16
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const n=(this[Fe]=this[Fe]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=wt(a);n[o]||(ir(r,a),n[o]=!0)}return h.isArray(t)?t.forEach(s):s(t),this}};M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);h.reduceDescriptors(M.prototype,({value:i},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(n){this[e]=n}}});h.freezeMethods(M);const rr="[REDACTED ****]";function sr(i){if(h.hasOwnProp(i,"toJSON"))return!0;let t=Object.getPrototypeOf(i);for(;t&&t!==Object.prototype;){if(h.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function ar(i,t){const e=new Set(t.map(s=>String(s).toLowerCase())),n=[],r=s=>{if(s===null||typeof s!="object"||h.isBuffer(s))return s;if(n.indexOf(s)!==-1)return;s instanceof M&&(s=s.toJSON()),n.push(s);let a;if(h.isArray(s))a=[],s.forEach((o,c)=>{const u=r(o);h.isUndefined(u)||(a[c]=u)});else{if(!h.isPlainObject(s)&&sr(s))return n.pop(),s;a=Object.create(null);for(const[o,c]of Object.entries(s)){const u=e.has(o.toLowerCase())?rr:r(c);h.isUndefined(u)||(a[o]=u)}}return n.pop(),a};return r(i)}let y=class ln extends Error{static from(t,e,n,r,s,a){const o=new ln(t.message,e||t.code,n,r,s);return o.cause=t,o.name=t.name,t.status!=null&&o.status==null&&(o.status=t.status),a&&Object.assign(o,a),o}constructor(t,e,n,r,s){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){const t=this.config,e=t&&h.hasOwnProp(t,"redact")?t.redact:void 0,n=h.isArray(e)&&e.length>0?ar(t,e):h.toJSONObject(t);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:n,code:this.code,status:this.status}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";y.ERR_BAD_OPTION="ERR_BAD_OPTION";y.ECONNABORTED="ECONNABORTED";y.ETIMEDOUT="ETIMEDOUT";y.ECONNREFUSED="ECONNREFUSED";y.ERR_NETWORK="ERR_NETWORK";y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";y.ERR_DEPRECATED="ERR_DEPRECATED";y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";y.ERR_CANCELED="ERR_CANCELED";y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";y.ERR_INVALID_URL="ERR_INVALID_URL";y.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const or=null;function fe(i){return h.isPlainObject(i)||h.isArray(i)}function hn(i){return h.endsWith(i,"[]")?i.slice(0,-2):i}function se(i,t,e){return i?i.concat(t).map(function(r,s){return r=hn(r),!e&&s?"["+r+"]":r}).join(e?".":""):t}function cr(i){return h.isArray(i)&&!i.some(fe)}const ur=h.toFlatObject(h,{},null,function(t){return/^is[A-Z]/.test(t)});function Qt(i,t,e){if(!h.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=h.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,b){return!h.isUndefined(b[_])});const n=e.metaTokens,r=e.visitor||f,s=e.dots,a=e.indexes,o=e.Blob||typeof Blob<"u"&&Blob,c=e.maxDepth===void 0?100:e.maxDepth,u=o&&h.isSpecCompliantForm(t);if(!h.isFunction(r))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(h.isDate(m))return m.toISOString();if(h.isBoolean(m))return m.toString();if(!u&&h.isBlob(m))throw new y("Blob is not supported. Use a Buffer instead.");return h.isArrayBuffer(m)||h.isTypedArray(m)?u&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function f(m,_,b){let w=m;if(h.isReactNative(t)&&h.isReactNativeBlob(m))return t.append(se(b,_,s),l(m)),!1;if(m&&!b&&typeof m=="object"){if(h.endsWith(_,"{}"))_=n?_:_.slice(0,-2),m=JSON.stringify(m);else if(h.isArray(m)&&cr(m)||(h.isFileList(m)||h.endsWith(_,"[]"))&&(w=h.toArray(m)))return _=hn(_),w.forEach(function(A,U){!(h.isUndefined(A)||A===null)&&t.append(a===!0?se([_],U,s):a===null?_:_+"[]",l(A))}),!1}return fe(m)?!0:(t.append(se(b,_,s),l(m)),!1)}const d=[],g=Object.assign(ur,{defaultVisitor:f,convertValue:l,isVisitable:fe});function P(m,_,b=0){if(!h.isUndefined(m)){if(b>c)throw new y("Object is too deeply nested ("+b+" levels). Max depth: "+c,y.ERR_FORM_DATA_DEPTH_EXCEEDED);if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+_.join("."));d.push(m),h.forEach(m,function(T,A){(!(h.isUndefined(T)||T===null)&&r.call(t,T,h.isString(A)?A.trim():A,_,g))===!0&&P(T,_?_.concat(A):[A],b+1)}),d.pop()}}if(!h.isObject(i))throw new TypeError("data must be an object");return P(i),t}function ke(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(i).replace(/[!'()~]|%20/g,function(n){return t[n]})}function ge(i,t){this._pairs=[],i&&Qt(i,this,t)}const fn=ge.prototype;fn.append=function(t,e){this._pairs.push([t,e])};fn.toString=function(t){const e=t?function(n){return t.call(this,n,ke)}:ke;return this._pairs.map(function(r){return e(r[0])+"="+e(r[1])},"").join("&")};function lr(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function pn(i,t,e){if(!t)return i;const n=e&&e.encode||lr,r=h.isFunction(e)?{serialize:e}:e,s=r&&r.serialize;let a;if(s?a=s(t,r):a=h.isURLSearchParams(t)?t.toString():new ge(t,r).toString(n),a){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+a}return i}class je{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){h.forEach(this.handlers,function(n){n!==null&&t(n)})}}const me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},hr=typeof URLSearchParams<"u"?URLSearchParams:ge,fr=typeof FormData<"u"?FormData:null,pr=typeof Blob<"u"?Blob:null,dr={isBrowser:!0,classes:{URLSearchParams:hr,FormData:fr,Blob:pr},protocols:["http","https","file","blob","url","data"]},ye=typeof window<"u"&&typeof document<"u",pe=typeof navigator=="object"&&navigator||void 0,_r=ye&&(!pe||["ReactNative","NativeScript","NS"].indexOf(pe.product)<0),gr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mr=ye&&window.location.href||"http://localhost",yr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ye,hasStandardBrowserEnv:_r,hasStandardBrowserWebWorkerEnv:gr,navigator:pe,origin:mr},Symbol.toStringTag,{value:"Module"})),x={...yr,...dr};function br(i,t){return Qt(i,new x.classes.URLSearchParams,{visitor:function(e,n,r,s){return x.isNode&&h.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function Pr(i){return h.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Er(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n<r;n++)s=e[n],t[s]=i[s];return t}function dn(i){function t(e,n,r,s){let a=e[s++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),c=s>=e.length;return a=!a&&h.isArray(r)?r.length:a,c?(h.hasOwnProp(r,a)?r[a]=h.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!r[a]||!h.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&h.isArray(r[a])&&(r[a]=Er(r[a])),!o)}if(h.isFormData(i)&&h.isFunction(i.entries)){const e={};return h.forEachEntry(i,(n,r)=>{t(Pr(n),r,e,0)}),e}return null}const _t=(i,t)=>i!=null&&h.hasOwnProp(i,t)?i[t]:void 0;function vr(i,t,e){if(h.isString(i))try{return(t||JSON.parse)(i),h.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const Ot={transitional:me,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,s=h.isObject(t);if(s&&h.isHTMLForm(t)&&(t=new FormData(t)),h.isFormData(t))return r?JSON.stringify(dn(t)):t;if(h.isArrayBuffer(t)||h.isBuffer(t)||h.isStream(t)||h.isFile(t)||h.isBlob(t)||h.isReadableStream(t))return t;if(h.isArrayBufferView(t))return t.buffer;if(h.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(s){const c=_t(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return br(t,c).toString();if((o=h.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=_t(this,"env"),l=u&&u.FormData;return Qt(o?{"files[]":t}:t,l&&new l,c)}}return s||r?(e.setContentType("application/json",!1),vr(t)):t}],transformResponse:[function(t){const e=_t(this,"transitional")||Ot.transitional,n=e&&e.forcedJSONParsing,r=_t(this,"responseType"),s=r==="json";if(h.isResponse(t)||h.isReadableStream(t))return t;if(t&&h.isString(t)&&(n&&!r||s)){const o=!(e&&e.silentJSONParsing)&&s;try{return JSON.parse(t,_t(this,"parseReviver"))}catch(c){if(o)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,_t(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};h.forEach(["delete","get","head","post","put","patch","query"],i=>{Ot.headers[i]={}});function ae(i,t){const e=this||Ot,n=t||e,r=M.from(n.headers);let s=n.data;return h.forEach(i,function(o){s=o.call(e,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function _n(i){return!!(i&&i.__CANCEL__)}let Dt=class extends y{constructor(t,e,n){super(t??"canceled",y.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function gn(i,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?i(e):t(new y("Request failed with status code "+e.status,e.status>=400&&e.status<500?y.ERR_BAD_REQUEST:y.ERR_BAD_RESPONSE,e.config,e.request,e))}function wr(i){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(i);return t&&t[1]||""}function Sr(i,t){i=i||10;const e=new Array(i),n=new Array(i);let r=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[s];a||(a=u),e[r]=c,n[r]=u;let f=s,d=0;for(;f!==r;)d+=e[f++],f=f%i;if(r=(r+1)%i,r===s&&(s=(s+1)%i),u-a<t)return;const g=l&&u-l;return g?Math.round(d*1e3/g):void 0}}function Tr(i,t){let e=0,n=1e3/t,r,s;const a=(u,l=Date.now())=>{e=l,r=null,s&&(clearTimeout(s),s=null),i(...u)};return[(...u)=>{const l=Date.now(),f=l-e;f>=n?a(u,l):(r=u,s||(s=setTimeout(()=>{s=null,a(r)},n-f)))},()=>r&&a(r)]}const Wt=(i,t,e=3)=>{let n=0;const r=Sr(50,250);return Tr(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,c=o!=null?Math.min(a,o):a,u=Math.max(0,c-n),l=r(u);n=Math.max(n,c);const f={loaded:c,total:o,progress:o?c/o:void 0,bytes:u,rate:l||void 0,estimated:l&&o?(o-c)/l:void 0,event:s,lengthComputable:o!=null,[t?"download":"upload"]:!0};i(f)},e)},qe=(i,t)=>{const e=i!=null;return[n=>t[0]({lengthComputable:e,total:i,loaded:n}),t[1]]},Ke=i=>(...t)=>h.asap(()=>i(...t)),Ar=x.hasStandardBrowserEnv?((i,t)=>e=>(e=new URL(e,x.origin),i.protocol===e.protocol&&i.host===e.host&&(t||i.port===e.port)))(new URL(x.origin),x.navigator&&/(msie|trident)/i.test(x.navigator.userAgent)):()=>!0,Rr=x.hasStandardBrowserEnv?{write(i,t,e,n,r,s,a){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(t)}`];h.isNumber(e)&&o.push(`expires=${new Date(e).toUTCString()}`),h.isString(n)&&o.push(`path=${n}`),h.isString(r)&&o.push(`domain=${r}`),s===!0&&o.push("secure"),h.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let e=0;e<t.length;e++){const n=t[e].replace(/^\s+/,""),r=n.indexOf("=");if(r!==-1&&n.slice(0,r)===i)return decodeURIComponent(n.slice(r+1))}return null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Cr(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Or(i,t){return t?i.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):i}function mn(i,t,e){let n=!Cr(t);return i&&(n||e===!1)?Or(i,t):t}const He=i=>i instanceof M?{...i}:i;function lt(i,t){t=t||{};const e=Object.create(null);Object.defineProperty(e,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,l,f,d){return h.isPlainObject(u)&&h.isPlainObject(l)?h.merge.call({caseless:d},u,l):h.isPlainObject(l)?h.merge({},l):h.isArray(l)?l.slice():l}function r(u,l,f,d){if(h.isUndefined(l)){if(!h.isUndefined(u))return n(void 0,u,f,d)}else return n(u,l,f,d)}function s(u,l){if(!h.isUndefined(l))return n(void 0,l)}function a(u,l){if(h.isUndefined(l)){if(!h.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function o(u,l,f){if(h.hasOwnProp(t,f))return n(u,l);if(h.hasOwnProp(i,f))return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken: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,allowedSocketPaths:a,responseEncoding:a,validateStatus:o,headers:(u,l,f)=>r(He(u),He(l),f,!0)};return h.forEach(Object.keys({...i,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const f=h.hasOwnProp(c,l)?c[l]:r,d=h.hasOwnProp(i,l)?i[l]:void 0,g=h.hasOwnProp(t,l)?t[l]:void 0,P=f(d,g,l);h.isUndefined(P)&&f!==o||(e[l]=P)}),e}const Dr=["content-type","content-length"];function Ir(i,t,e){if(e!=="content-only"){i.set(t);return}Object.entries(t).forEach(([n,r])=>{Dr.includes(n.toLowerCase())&&i.set(n,r)})}const Nr=i=>encodeURIComponent(i).replace(/%([0-9A-F]{2})/gi,(t,e)=>String.fromCharCode(parseInt(e,16))),yn=i=>{const t=lt({},i),e=d=>h.hasOwnProp(t,d)?t[d]:void 0,n=e("data");let r=e("withXSRFToken");const s=e("xsrfHeaderName"),a=e("xsrfCookieName");let o=e("headers");const c=e("auth"),u=e("baseURL"),l=e("allowAbsoluteUrls"),f=e("url");if(t.headers=o=M.from(o),t.url=pn(mn(u,f,l),i.params,i.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?Nr(c.password):""))),h.isFormData(n)&&(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv?o.setContentType(void 0):h.isFunction(n.getHeaders)&&Ir(o,n.getHeaders(),e("formDataHeaderPolicy"))),x.hasStandardBrowserEnv&&(h.isFunction(r)&&(r=r(t)),r===!0||r==null&&Ar(t.url))){const g=s&&a&&Rr.read(a);g&&o.set(s,g)}return t},Br=typeof XMLHttpRequest<"u",xr=Br&&function(i){return new Promise(function(e,n){const r=yn(i);let s=r.data;const a=M.from(r.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:u}=r,l,f,d,g,P;function m(){g&&g(),P&&P(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let _=new XMLHttpRequest;_.open(r.method.toUpperCase(),r.url,!0),_.timeout=r.timeout;function b(){if(!_)return;const T=M.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),U={data:!o||o==="text"||o==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:T,config:i,request:_};gn(function(H){e(H),m()},function(H){n(H),m()},U),_=null}"onloadend"in _?_.onloadend=b:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.startsWith("file:"))||setTimeout(b)},_.onabort=function(){_&&(n(new y("Request aborted",y.ECONNABORTED,i,_)),m(),_=null)},_.onerror=function(A){const U=A&&A.message?A.message:"Network Error",E=new y(U,y.ERR_NETWORK,i,_);E.event=A||null,n(E),m(),_=null},_.ontimeout=function(){let A=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const U=r.transitional||me;r.timeoutErrorMessage&&(A=r.timeoutErrorMessage),n(new y(A,U.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,i,_)),m(),_=null},s===void 0&&a.setContentType(null),"setRequestHeader"in _&&h.forEach(a.toJSON(),function(A,U){_.setRequestHeader(U,A)}),h.isUndefined(r.withCredentials)||(_.withCredentials=!!r.withCredentials),o&&o!=="json"&&(_.responseType=r.responseType),u&&([d,P]=Wt(u,!0),_.addEventListener("progress",d)),c&&_.upload&&([f,g]=Wt(c),_.upload.addEventListener("progress",f),_.upload.addEventListener("loadend",g)),(r.cancelToken||r.signal)&&(l=T=>{_&&(n(!T||T.type?new Dt(null,i,_):T),_.abort(),m(),_=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const w=wr(r.url);if(w&&!x.protocols.includes(w)){n(new y("Unsupported protocol "+w+":",y.ERR_BAD_REQUEST,i));return}_.send(s||null)})},Ur=(i,t)=>{const{length:e}=i=i?i.filter(Boolean):[];if(t||e){let n=new AbortController,r;const s=function(u){if(!r){r=!0,o();const l=u instanceof Error?u:this.reason;n.abort(l instanceof y?l:new Dt(l instanceof Error?l.message:l))}};let a=t&&setTimeout(()=>{a=null,s(new y(`timeout of ${t}ms exceeded`,y.ETIMEDOUT))},t);const o=()=>{i&&(a&&clearTimeout(a),a=null,i.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),i=null)};i.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>h.asap(o),c}},Lr=function*(i,t){let e=i.byteLength;if(e<t){yield i;return}let n=0,r;for(;n<e;)r=n+t,yield i.slice(n,r),n=r},Vr=async function*(i,t){for await(const e of Mr(i))yield*Lr(e,t)},Mr=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const t=i.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},We=(i,t,e,n)=>{const r=Vr(i,t);let s=0,a,o=c=>{a||(a=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await r.next();if(u){o(),c.close();return}let f=l.byteLength;if(e){let d=s+=f;e(d)}c.enqueue(new Uint8Array(l))}catch(u){throw o(u),u}},cancel(c){return o(c),r.return()}},{highWaterMark:2})};function Fr(i){if(!i||typeof i!="string"||!i.startsWith("data:"))return 0;const t=i.indexOf(",");if(t<0)return 0;const e=i.slice(5,t),n=i.slice(t+1);if(/;base64/i.test(e)){let a=n.length;const o=n.length;for(let g=0;g<o;g++)if(n.charCodeAt(g)===37&&g+2<o){const P=n.charCodeAt(g+1),m=n.charCodeAt(g+2);(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(a-=2,g+=2)}let c=0,u=o-1;const l=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);u>=0&&(n.charCodeAt(u)===61?(c++,u--):l(u)&&(c++,u-=3)),c===1&&u>=0&&(n.charCodeAt(u)===61||l(u))&&c++;const d=Math.floor(a/4)*3-(c||0);return d>0?d:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(n,"utf8");let s=0;for(let a=0,o=n.length;a<o;a++){const c=n.charCodeAt(a);if(c<128)s+=1;else if(c<2048)s+=2;else if(c>=55296&&c<=56319&&a+1<o){const u=n.charCodeAt(a+1);u>=56320&&u<=57343?(s+=4,a++):s+=3}else s+=3}return s}const be="1.16.0",Xe=64*1024,{isFunction:Ft}=h,ze=(i,...t)=>{try{return!!i(...t)}catch{return!1}},kr=i=>{const t=h.global??globalThis,{ReadableStream:e,TextEncoder:n}=t;i=h.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},i);const{fetch:r,Request:s,Response:a}=i,o=r?Ft(r):typeof fetch=="function",c=Ft(s),u=Ft(a);if(!o)return!1;const l=o&&Ft(e),f=o&&(typeof n=="function"?(b=>w=>b.encode(w))(new n):async b=>new Uint8Array(await new s(b).arrayBuffer())),d=c&&l&&ze(()=>{let b=!1;const w=new s(x.origin,{body:new e,method:"POST",get duplex(){return b=!0,"half"}}),T=w.headers.has("Content-Type");return w.body!=null&&w.body.cancel(),b&&!T}),g=u&&l&&ze(()=>h.isReadableStream(new a("").body)),P={stream:g&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!P[b]&&(P[b]=(w,T)=>{let A=w&&w[b];if(A)return A.call(w);throw new y(`Response type '${b}' is not supported`,y.ERR_NOT_SUPPORT,T)})});const m=async b=>{if(b==null)return 0;if(h.isBlob(b))return b.size;if(h.isSpecCompliantForm(b))return(await new s(x.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(h.isArrayBufferView(b)||h.isArrayBuffer(b))return b.byteLength;if(h.isURLSearchParams(b)&&(b=b+""),h.isString(b))return(await f(b)).byteLength},_=async(b,w)=>{const T=h.toFiniteNumber(b.getContentLength());return T??m(w)};return async b=>{let{url:w,method:T,data:A,signal:U,cancelToken:E,timeout:H,onDownloadProgress:Q,onUploadProgress:z,responseType:k,headers:I,withCredentials:ht="same-origin",fetchOptions:st,maxContentLength:G,maxBodyLength:Yt}=yn(b);const Et=h.isNumber(G)&&G>-1,wn=h.isNumber(Yt)&&Yt>-1;let Ee=r||fetch;k=k?(k+"").toLowerCase():"text";let tt=Ur([U,E&&E.toAbortSignal()],H),j=null;const at=tt&&tt.unsubscribe&&(()=>{tt.unsubscribe()});let ve;try{if(Et&&typeof w=="string"&&w.startsWith("data:")&&Fr(w)>G)throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j);if(wn&&T!=="get"&&T!=="head"){const R=await _(I,A);if(typeof R=="number"&&isFinite(R)&&R>Yt)throw new y("Request body larger than maxBodyLength limit",y.ERR_BAD_REQUEST,b,j)}if(z&&d&&T!=="get"&&T!=="head"&&(ve=await _(I,A))!==0){let R=new s(w,{method:"POST",body:A,duplex:"half"}),ft;if(h.isFormData(A)&&(ft=R.headers.get("content-type"))&&I.setContentType(ft),R.body){const[It,Nt]=qe(ve,Wt(Ke(z)));A=We(R.body,Xe,It,Nt)}}h.isString(ht)||(ht=ht?"include":"omit");const B=c&&"credentials"in s.prototype;if(h.isFormData(A)){const R=I.getContentType();R&&/^multipart\/form-data/i.test(R)&&!/boundary=/i.test(R)&&I.delete("content-type")}I.set("User-Agent","axios/"+be,!1);const et={...st,signal:tt,method:T.toUpperCase(),headers:I.normalize().toJSON(),body:A,duplex:"half",credentials:B?ht:void 0};j=c&&new s(w,et);let $=await(c?Ee(j,st):Ee(w,et));if(Et){const R=h.toFiniteNumber($.headers.get("content-length"));if(R!=null&&R>G)throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j)}const te=g&&(k==="stream"||k==="response");if(g&&$.body&&(Q||Et||te&&at)){const R={};["status","statusText","headers"].forEach(vt=>{R[vt]=$[vt]});const ft=h.toFiniteNumber($.headers.get("content-length")),[It,Nt]=Q&&qe(ft,Wt(Ke(Q),!0))||[];let we=0;const Sn=vt=>{if(Et&&(we=vt,we>G))throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j);It&&It(vt)};$=new a(We($.body,Xe,Sn,()=>{Nt&&Nt(),at&&at()}),R)}k=k||"text";let Z=await P[h.findKey(P,k)||"text"]($,b);if(Et&&!g&&!te){let R;if(Z!=null&&(typeof Z.byteLength=="number"?R=Z.byteLength:typeof Z.size=="number"?R=Z.size:typeof Z=="string"&&(R=typeof n=="function"?new n().encode(Z).byteLength:Z.length)),typeof R=="number"&&R>G)throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j)}return!te&&at&&at(),await new Promise((R,ft)=>{gn(R,ft,{data:Z,headers:M.from($.headers),status:$.status,statusText:$.statusText,config:b,request:j})})}catch(B){if(at&&at(),tt&&tt.aborted&&tt.reason instanceof y){const et=tt.reason;throw et.config=b,j&&(et.request=j),B!==et&&(et.cause=B),et}throw B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,b,j,B&&B.response),{cause:B.cause||B}):y.from(B,B&&B.code,b,j,B&&B.response)}}},jr=new Map,bn=i=>{let t=i&&i.env||{};const{fetch:e,Request:n,Response:r}=t,s=[n,r,e];let a=s.length,o=a,c,u,l=jr;for(;o--;)c=s[o],u=l.get(c),u===void 0&&l.set(c,u=o?new Map:kr(t)),l=u;return u};bn();const Pe={http:or,xhr:xr,fetch:{get:bn}};h.forEach(Pe,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(i,"adapterName",{__proto__:null,value:t})}});const Ge=i=>`- ${i}`,qr=i=>h.isFunction(i)||i===null||i===!1;function Kr(i,t){i=h.isArray(i)?i:[i];const{length:e}=i;let n,r;const s={};for(let a=0;a<e;a++){n=i[a];let o;if(r=n,!qr(n)&&(r=Pe[(o=String(n)).toLowerCase()],r===void 0))throw new y(`Unknown adapter '${o}'`);if(r&&(h.isFunction(r)||(r=r.get(t))))break;s[o||"#"+a]=r}if(!r){const a=Object.entries(s).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?a.length>1?`since :
|
|
17
|
-
`+a.map(
|
|
18
|
-
`):" "
|
|
14
|
+
`,e+="-----END PUBLIC KEY-----",e},t.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t})(ni),ie,oi=typeof process<"u"?(ie=process.env)===null||ie===void 0?void 0:ie.npm_package_version:void 0,ci=(function(){function i(t){t===void 0&&(t={}),this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=t.key||null}return i.prototype.setKey=function(t){t?(this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Ve(t)):!this.key&&this.log&&console.error("A key was not set.")},i.prototype.setPrivateKey=function(t){this.setKey(t)},i.prototype.setPublicKey=function(t){this.setKey(t)},i.prototype.decrypt=function(t){try{return this.getKey().decrypt(Ce(t))}catch{return!1}},i.prototype.encrypt=function(t){try{return Tt(this.getKey().encrypt(t))}catch{return!1}},i.prototype.encryptOAEP=function(t){try{return Tt(this.getKey().encrypt(t,ei))}catch{return!1}},i.prototype.sign=function(t,e,n){e===void 0&&(e=function(r){return r}),n===void 0&&(n="");try{return Tt(this.getKey().sign(t,e,n))}catch{return!1}},i.prototype.signSha256=function(t){return this.sign(t,function(e){return Le(ue(e))},"sha256")},i.prototype.verify=function(t,e,n){n===void 0&&(n=function(r){return r});try{return this.getKey().verify(t,Ce(e),n)}catch{return!1}},i.prototype.verifySha256=function(t,e){return this.verify(t,e,function(n){return Le(ue(n))})},i.prototype.getKey=function(t){if(!this.key){if(this.key=new Ve,t&&{}.toString.call(t)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},i.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},i.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},i.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},i.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},i.version=oi,i})();function nn(i,t){return function(){return i.apply(t,arguments)}}const{toString:ui}=Object.prototype,{getPrototypeOf:zt}=Object,{iterator:Gt,toStringTag:rn}=Symbol,$t=(i=>t=>{const e=ui.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),X=i=>(i=i.toLowerCase(),t=>$t(t)===i),Jt=i=>t=>typeof t===i,{isArray:Pt}=Array,yt=Jt("undefined");function At(i){return i!==null&&!yt(i)&&i.constructor!==null&&!yt(i.constructor)&&F(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const sn=X("ArrayBuffer");function li(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&sn(i.buffer),t}const hi=Jt("string"),F=Jt("function"),an=Jt("number"),Rt=i=>i!==null&&typeof i=="object",fi=i=>i===!0||i===!1,jt=i=>{if($t(i)!=="object")return!1;const t=zt(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(rn in i)&&!(Gt in i)},pi=i=>{if(!Rt(i)||At(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},di=X("Date"),_i=X("File"),gi=i=>!!(i&&typeof i.uri<"u"),mi=i=>i&&typeof i.getParts<"u",yi=X("Blob"),bi=X("FileList"),Pi=i=>Rt(i)&&F(i.pipe);function Ei(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Me=Ei(),Fe=typeof Me.FormData<"u"?Me.FormData:void 0,wi=i=>{if(!i)return!1;if(Fe&&i instanceof Fe)return!0;const t=zt(i);if(!t||t===Object.prototype||!F(i.append))return!1;const e=$t(i);return e==="formdata"||e==="object"&&F(i.toString)&&i.toString()==="[object FormData]"},vi=X("URLSearchParams"),[Si,Ti,Ai,Ri]=["ReadableStream","Request","Response","Headers"].map(X),Ci=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ct(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),Pt(i))for(n=0,r=i.length;n<r;n++)t.call(null,i[n],n,i);else{if(At(i))return;const s=e?Object.getOwnPropertyNames(i):Object.keys(i),a=s.length;let o;for(n=0;n<a;n++)o=s[n],t.call(null,i[o],o,i)}}function on(i,t){if(At(i))return null;t=t.toLowerCase();const e=Object.keys(i);let n=e.length,r;for(;n-- >0;)if(r=e[n],t===r.toLowerCase())return r;return null}const ct=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,cn=i=>!yt(i)&&i!==ct;function le(...i){const{caseless:t,skipUndefined:e}=cn(this)&&this||{},n={},r=(s,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;const o=t&&on(n,a)||a,c=he(n,o)?n[o]:void 0;jt(c)&&jt(s)?n[o]=le(c,s):jt(s)?n[o]=le({},s):Pt(s)?n[o]=s.slice():(!e||!yt(s))&&(n[o]=s)};for(let s=0,a=i.length;s<a;s++)i[s]&&Ct(i[s],r);return n}const Oi=(i,t,e,{allOwnKeys:n}={})=>(Ct(t,(r,s)=>{e&&F(r)?Object.defineProperty(i,s,{__proto__:null,value:nn(r,e),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,s,{__proto__:null,value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),i),Di=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Ii=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),Object.defineProperty(i.prototype,"constructor",{__proto__:null,value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{__proto__:null,value:t.prototype}),e&&Object.assign(i.prototype,e)},Ni=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&zt(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},Bi=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},xi=i=>{if(!i)return null;if(Pt(i))return i;let t=i.length;if(!an(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},Li=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&zt(Uint8Array)),Ui=(i,t)=>{const n=(i&&i[Gt]).call(i);let r;for(;(r=n.next())&&!r.done;){const s=r.value;t.call(i,s[0],s[1])}},Vi=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},Mi=X("HTMLFormElement"),Fi=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,n,r){return n.toUpperCase()+r}),he=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),ki=X("RegExp"),un=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};Ct(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},ji=i=>{un(i,(t,e)=>{if(F(i)&&["arguments","caller","callee"].includes(e))return!1;const n=i[e];if(F(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},qi=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return Pt(i)?n(i):n(String(i).split(t)),e},Hi=()=>{},Ki=(i,t)=>i!=null&&Number.isFinite(i=+i)?i:t;function Wi(i){return!!(i&&F(i.append)&&i[rn]==="FormData"&&i[Gt])}const Xi=i=>{const t=new WeakSet,e=n=>{if(Rt(n)){if(t.has(n))return;if(At(n))return n;if(!("toJSON"in n)){t.add(n);const r=Pt(n)?[]:{};return Ct(n,(s,a)=>{const o=e(s);!yt(o)&&(r[a]=o)}),t.delete(n),r}}return n};return e(i)},zi=X("AsyncFunction"),Gi=i=>i&&(Rt(i)||F(i))&&F(i.then)&&F(i.catch),ln=((i,t)=>i?setImmediate:t?((e,n)=>(ct.addEventListener("message",({source:r,data:s})=>{r===ct&&s===e&&n.length&&n.shift()()},!1),r=>{n.push(r),ct.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate=="function",F(ct.postMessage)),$i=typeof queueMicrotask<"u"?queueMicrotask.bind(ct):typeof process<"u"&&process.nextTick||ln,Ji=i=>i!=null&&F(i[Gt]),h={isArray:Pt,isArrayBuffer:sn,isBuffer:At,isFormData:wi,isArrayBufferView:li,isString:hi,isNumber:an,isBoolean:fi,isObject:Rt,isPlainObject:jt,isEmptyObject:pi,isReadableStream:Si,isRequest:Ti,isResponse:Ai,isHeaders:Ri,isUndefined:yt,isDate:di,isFile:_i,isReactNativeBlob:gi,isReactNative:mi,isBlob:yi,isRegExp:ki,isFunction:F,isStream:Pi,isURLSearchParams:vi,isTypedArray:Li,isFileList:bi,forEach:Ct,merge:le,extend:Oi,trim:Ci,stripBOM:Di,inherits:Ii,toFlatObject:Ni,kindOf:$t,kindOfTest:X,endsWith:Bi,toArray:xi,forEachEntry:Ui,matchAll:Vi,isHTMLForm:Mi,hasOwnProperty:he,hasOwnProp:he,reduceDescriptors:un,freezeMethods:ji,toObjectSet:qi,toCamelCase:Fi,noop:Hi,toFiniteNumber:Ki,findKey:on,global:ct,isContextDefined:cn,isSpecCompliantForm:Wi,toJSONObject:Xi,isAsyncFn:zi,isThenable:Gi,setImmediate:ln,asap:$i,isIterable:Ji},Qi=h.toObjectSet(["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"]),Zi=i=>{const t={};let e,n,r;return i&&i.split(`
|
|
15
|
+
`).forEach(function(a){r=a.indexOf(":"),e=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!e||t[e]&&Qi[e])&&(e==="set-cookie"?t[e]?t[e].push(n):t[e]=[n]:t[e]=t[e]?t[e]+", "+n:n)}),t};function Yi(i){let t=0,e=i.length;for(;t<e;){const n=i.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;e>t;){const n=i.charCodeAt(e-1);if(n!==9&&n!==32)break;e-=1}return t===0&&e===i.length?i:i.slice(t,e)}const tr=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),er=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ge(i,t){return h.isArray(i)?i.map(e=>ge(e,t)):Yi(String(i).replace(t,""))}const nr=i=>ge(i,tr),ir=i=>ge(i,er);function hn(i){const t=Object.create(null);return h.forEach(i.toJSON(),(e,n)=>{t[n]=ir(e)}),t}const ke=Symbol("internals");function vt(i){return i&&String(i).trim().toLowerCase()}function qt(i){return i===!1||i==null?i:h.isArray(i)?i.map(qt):nr(String(i))}function rr(i){const t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=e.exec(i);)t[n[1]]=n[2];return t}const sr=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function re(i,t,e,n,r){if(h.isFunction(n))return n.call(this,t,e);if(r&&(t=e),!!h.isString(t)){if(h.isString(n))return t.indexOf(n)!==-1;if(h.isRegExp(n))return n.test(t)}}function ar(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}function or(i,t){const e=h.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(i,n+e,{__proto__:null,value:function(r,s,a){return this[n].call(this,t,r,s,a)},configurable:!0})})}let M=class{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function s(o,c,u){const l=vt(c);if(!l)throw new Error("header name must be a non-empty string");const f=h.findKey(r,l);(!f||r[f]===void 0||u===!0||u===void 0&&r[f]!==!1)&&(r[f||c]=qt(o))}const a=(o,c)=>h.forEach(o,(u,l)=>s(u,l,c));if(h.isPlainObject(t)||t instanceof this.constructor)a(t,e);else if(h.isString(t)&&(t=t.trim())&&!sr(t))a(Zi(t),e);else if(h.isObject(t)&&h.isIterable(t)){let o={},c,u;for(const l of t){if(!h.isArray(l))throw TypeError("Object iterator must return a key-value pair");o[u=l[0]]=(c=o[u])?h.isArray(c)?[...c,l[1]]:[c,l[1]]:l[1]}a(o,e)}else t!=null&&s(e,t,n);return this}get(t,e){if(t=vt(t),t){const n=h.findKey(this,t);if(n){const r=this[n];if(!e)return r;if(e===!0)return rr(r);if(h.isFunction(e))return e.call(this,r,n);if(h.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=vt(t),t){const n=h.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||re(this,this[n],n,e)))}return!1}delete(t,e){const n=this;let r=!1;function s(a){if(a=vt(a),a){const o=h.findKey(n,a);o&&(!e||re(n,n[o],o,e))&&(delete n[o],r=!0)}}return h.isArray(t)?t.forEach(s):s(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const s=e[n];(!t||re(this,this[s],s,t,!0))&&(delete this[s],r=!0)}return r}normalize(t){const e=this,n={};return h.forEach(this,(r,s)=>{const a=h.findKey(n,s);if(a){e[a]=qt(r),delete e[s];return}const o=t?ar(s):String(s).trim();o!==s&&delete e[s],e[o]=qt(r),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return h.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=t&&h.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
|
|
16
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const n=(this[ke]=this[ke]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=vt(a);n[o]||(or(r,a),n[o]=!0)}return h.isArray(t)?t.forEach(s):s(t),this}};M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);h.reduceDescriptors(M.prototype,({value:i},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(n){this[e]=n}}});h.freezeMethods(M);const cr="[REDACTED ****]";function ur(i){if(h.hasOwnProp(i,"toJSON"))return!0;let t=Object.getPrototypeOf(i);for(;t&&t!==Object.prototype;){if(h.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function lr(i,t){const e=new Set(t.map(s=>String(s).toLowerCase())),n=[],r=s=>{if(s===null||typeof s!="object"||h.isBuffer(s))return s;if(n.indexOf(s)!==-1)return;s instanceof M&&(s=s.toJSON()),n.push(s);let a;if(h.isArray(s))a=[],s.forEach((o,c)=>{const u=r(o);h.isUndefined(u)||(a[c]=u)});else{if(!h.isPlainObject(s)&&ur(s))return n.pop(),s;a=Object.create(null);for(const[o,c]of Object.entries(s)){const u=e.has(o.toLowerCase())?cr:r(c);h.isUndefined(u)||(a[o]=u)}}return n.pop(),a};return r(i)}let y=class fn extends Error{static from(t,e,n,r,s,a){const o=new fn(t.message,e||t.code,n,r,s);return o.cause=t,o.name=t.name,t.status!=null&&o.status==null&&(o.status=t.status),a&&Object.assign(o,a),o}constructor(t,e,n,r,s){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){const t=this.config,e=t&&h.hasOwnProp(t,"redact")?t.redact:void 0,n=h.isArray(e)&&e.length>0?lr(t,e):h.toJSONObject(t);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:n,code:this.code,status:this.status}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";y.ERR_BAD_OPTION="ERR_BAD_OPTION";y.ECONNABORTED="ECONNABORTED";y.ETIMEDOUT="ETIMEDOUT";y.ECONNREFUSED="ECONNREFUSED";y.ERR_NETWORK="ERR_NETWORK";y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";y.ERR_DEPRECATED="ERR_DEPRECATED";y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";y.ERR_CANCELED="ERR_CANCELED";y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";y.ERR_INVALID_URL="ERR_INVALID_URL";y.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const hr=null;function fe(i){return h.isPlainObject(i)||h.isArray(i)}function pn(i){return h.endsWith(i,"[]")?i.slice(0,-2):i}function se(i,t,e){return i?i.concat(t).map(function(r,s){return r=pn(r),!e&&s?"["+r+"]":r}).join(e?".":""):t}function fr(i){return h.isArray(i)&&!i.some(fe)}const pr=h.toFlatObject(h,{},null,function(t){return/^is[A-Z]/.test(t)});function Qt(i,t,e){if(!h.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=h.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,b){return!h.isUndefined(b[_])});const n=e.metaTokens,r=e.visitor||f,s=e.dots,a=e.indexes,o=e.Blob||typeof Blob<"u"&&Blob,c=e.maxDepth===void 0?100:e.maxDepth,u=o&&h.isSpecCompliantForm(t);if(!h.isFunction(r))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(h.isDate(m))return m.toISOString();if(h.isBoolean(m))return m.toString();if(!u&&h.isBlob(m))throw new y("Blob is not supported. Use a Buffer instead.");return h.isArrayBuffer(m)||h.isTypedArray(m)?u&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function f(m,_,b){let v=m;if(h.isReactNative(t)&&h.isReactNativeBlob(m))return t.append(se(b,_,s),l(m)),!1;if(m&&!b&&typeof m=="object"){if(h.endsWith(_,"{}"))_=n?_:_.slice(0,-2),m=JSON.stringify(m);else if(h.isArray(m)&&fr(m)||(h.isFileList(m)||h.endsWith(_,"[]"))&&(v=h.toArray(m)))return _=pn(_),v.forEach(function(A,U){!(h.isUndefined(A)||A===null)&&t.append(a===!0?se([_],U,s):a===null?_:_+"[]",l(A))}),!1}return fe(m)?!0:(t.append(se(b,_,s),l(m)),!1)}const d=[],g=Object.assign(pr,{defaultVisitor:f,convertValue:l,isVisitable:fe});function P(m,_,b=0){if(!h.isUndefined(m)){if(b>c)throw new y("Object is too deeply nested ("+b+" levels). Max depth: "+c,y.ERR_FORM_DATA_DEPTH_EXCEEDED);if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+_.join("."));d.push(m),h.forEach(m,function(T,A){(!(h.isUndefined(T)||T===null)&&r.call(t,T,h.isString(A)?A.trim():A,_,g))===!0&&P(T,_?_.concat(A):[A],b+1)}),d.pop()}}if(!h.isObject(i))throw new TypeError("data must be an object");return P(i),t}function je(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(i).replace(/[!'()~]|%20/g,function(n){return t[n]})}function me(i,t){this._pairs=[],i&&Qt(i,this,t)}const dn=me.prototype;dn.append=function(t,e){this._pairs.push([t,e])};dn.toString=function(t){const e=t?function(n){return t.call(this,n,je)}:je;return this._pairs.map(function(r){return e(r[0])+"="+e(r[1])},"").join("&")};function dr(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function _n(i,t,e){if(!t)return i;const n=e&&e.encode||dr,r=h.isFunction(e)?{serialize:e}:e,s=r&&r.serialize;let a;if(s?a=s(t,r):a=h.isURLSearchParams(t)?t.toString():new me(t,r).toString(n),a){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+a}return i}class qe{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){h.forEach(this.handlers,function(n){n!==null&&t(n)})}}const ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_r=typeof URLSearchParams<"u"?URLSearchParams:me,gr=typeof FormData<"u"?FormData:null,mr=typeof Blob<"u"?Blob:null,yr={isBrowser:!0,classes:{URLSearchParams:_r,FormData:gr,Blob:mr},protocols:["http","https","file","blob","url","data"]},be=typeof window<"u"&&typeof document<"u",pe=typeof navigator=="object"&&navigator||void 0,br=be&&(!pe||["ReactNative","NativeScript","NS"].indexOf(pe.product)<0),Pr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Er=be&&window.location.href||"http://localhost",wr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:be,hasStandardBrowserEnv:br,hasStandardBrowserWebWorkerEnv:Pr,navigator:pe,origin:Er},Symbol.toStringTag,{value:"Module"})),L={...wr,...yr};function vr(i,t){return Qt(i,new L.classes.URLSearchParams,{visitor:function(e,n,r,s){return L.isNode&&h.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function Sr(i){return h.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Tr(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n<r;n++)s=e[n],t[s]=i[s];return t}function gn(i){function t(e,n,r,s){let a=e[s++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),c=s>=e.length;return a=!a&&h.isArray(r)?r.length:a,c?(h.hasOwnProp(r,a)?r[a]=h.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!h.hasOwnProp(r,a)||!h.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&h.isArray(r[a])&&(r[a]=Tr(r[a])),!o)}if(h.isFormData(i)&&h.isFunction(i.entries)){const e={};return h.forEachEntry(i,(n,r)=>{t(Sr(n),r,e,0)}),e}return null}const _t=(i,t)=>i!=null&&h.hasOwnProp(i,t)?i[t]:void 0;function Ar(i,t,e){if(h.isString(i))try{return(t||JSON.parse)(i),h.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const Ot={transitional:ye,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,s=h.isObject(t);if(s&&h.isHTMLForm(t)&&(t=new FormData(t)),h.isFormData(t))return r?JSON.stringify(gn(t)):t;if(h.isArrayBuffer(t)||h.isBuffer(t)||h.isStream(t)||h.isFile(t)||h.isBlob(t)||h.isReadableStream(t))return t;if(h.isArrayBufferView(t))return t.buffer;if(h.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(s){const c=_t(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return vr(t,c).toString();if((o=h.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=_t(this,"env"),l=u&&u.FormData;return Qt(o?{"files[]":t}:t,l&&new l,c)}}return s||r?(e.setContentType("application/json",!1),Ar(t)):t}],transformResponse:[function(t){const e=_t(this,"transitional")||Ot.transitional,n=e&&e.forcedJSONParsing,r=_t(this,"responseType"),s=r==="json";if(h.isResponse(t)||h.isReadableStream(t))return t;if(t&&h.isString(t)&&(n&&!r||s)){const o=!(e&&e.silentJSONParsing)&&s;try{return JSON.parse(t,_t(this,"parseReviver"))}catch(c){if(o)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,_t(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:L.classes.FormData,Blob:L.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};h.forEach(["delete","get","head","post","put","patch","query"],i=>{Ot.headers[i]={}});function ae(i,t){const e=this||Ot,n=t||e,r=M.from(n.headers);let s=n.data;return h.forEach(i,function(o){s=o.call(e,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function mn(i){return!!(i&&i.__CANCEL__)}let Dt=class extends y{constructor(t,e,n){super(t??"canceled",y.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function yn(i,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?i(e):t(new y("Request failed with status code "+e.status,e.status>=400&&e.status<500?y.ERR_BAD_REQUEST:y.ERR_BAD_RESPONSE,e.config,e.request,e))}function Rr(i){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(i);return t&&t[1]||""}function Cr(i,t){i=i||10;const e=new Array(i),n=new Array(i);let r=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[s];a||(a=u),e[r]=c,n[r]=u;let f=s,d=0;for(;f!==r;)d+=e[f++],f=f%i;if(r=(r+1)%i,r===s&&(s=(s+1)%i),u-a<t)return;const g=l&&u-l;return g?Math.round(d*1e3/g):void 0}}function Or(i,t){let e=0,n=1e3/t,r,s;const a=(u,l=Date.now())=>{e=l,r=null,s&&(clearTimeout(s),s=null),i(...u)};return[(...u)=>{const l=Date.now(),f=l-e;f>=n?a(u,l):(r=u,s||(s=setTimeout(()=>{s=null,a(r)},n-f)))},()=>r&&a(r)]}const Wt=(i,t,e=3)=>{let n=0;const r=Cr(50,250);return Or(s=>{if(!s||typeof s.loaded!="number")return;const a=s.loaded,o=s.lengthComputable?s.total:void 0,c=o!=null?Math.min(a,o):a,u=Math.max(0,c-n),l=r(u);n=Math.max(n,c);const f={loaded:c,total:o,progress:o?c/o:void 0,bytes:u,rate:l||void 0,estimated:l&&o?(o-c)/l:void 0,event:s,lengthComputable:o!=null,[t?"download":"upload"]:!0};i(f)},e)},He=(i,t)=>{const e=i!=null;return[n=>t[0]({lengthComputable:e,total:i,loaded:n}),t[1]]},Ke=i=>(...t)=>h.asap(()=>i(...t)),Dr=L.hasStandardBrowserEnv?((i,t)=>e=>(e=new URL(e,L.origin),i.protocol===e.protocol&&i.host===e.host&&(t||i.port===e.port)))(new URL(L.origin),L.navigator&&/(msie|trident)/i.test(L.navigator.userAgent)):()=>!0,Ir=L.hasStandardBrowserEnv?{write(i,t,e,n,r,s,a){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(t)}`];h.isNumber(e)&&o.push(`expires=${new Date(e).toUTCString()}`),h.isString(n)&&o.push(`path=${n}`),h.isString(r)&&o.push(`domain=${r}`),s===!0&&o.push("secure"),h.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let e=0;e<t.length;e++){const n=t[e].replace(/^\s+/,""),r=n.indexOf("=");if(r!==-1&&n.slice(0,r)===i)return decodeURIComponent(n.slice(r+1))}return null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Nr(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Br(i,t){return t?i.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):i}function bn(i,t,e){let n=!Nr(t);return i&&(n||e===!1)?Br(i,t):t}const We=i=>i instanceof M?{...i}:i;function lt(i,t){t=t||{};const e=Object.create(null);Object.defineProperty(e,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,l,f,d){return h.isPlainObject(u)&&h.isPlainObject(l)?h.merge.call({caseless:d},u,l):h.isPlainObject(l)?h.merge({},l):h.isArray(l)?l.slice():l}function r(u,l,f,d){if(h.isUndefined(l)){if(!h.isUndefined(u))return n(void 0,u,f,d)}else return n(u,l,f,d)}function s(u,l){if(!h.isUndefined(l))return n(void 0,l)}function a(u,l){if(h.isUndefined(l)){if(!h.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function o(u,l,f){if(h.hasOwnProp(t,f))return n(u,l);if(h.hasOwnProp(i,f))return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken: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,allowedSocketPaths:a,responseEncoding:a,validateStatus:o,headers:(u,l,f)=>r(We(u),We(l),f,!0)};return h.forEach(Object.keys({...i,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const f=h.hasOwnProp(c,l)?c[l]:r,d=h.hasOwnProp(i,l)?i[l]:void 0,g=h.hasOwnProp(t,l)?t[l]:void 0,P=f(d,g,l);h.isUndefined(P)&&f!==o||(e[l]=P)}),e}const xr=["content-type","content-length"];function Lr(i,t,e){if(e!=="content-only"){i.set(t);return}Object.entries(t).forEach(([n,r])=>{xr.includes(n.toLowerCase())&&i.set(n,r)})}const Ur=i=>encodeURIComponent(i).replace(/%([0-9A-F]{2})/gi,(t,e)=>String.fromCharCode(parseInt(e,16))),Pn=i=>{const t=lt({},i),e=d=>h.hasOwnProp(t,d)?t[d]:void 0,n=e("data");let r=e("withXSRFToken");const s=e("xsrfHeaderName"),a=e("xsrfCookieName");let o=e("headers");const c=e("auth"),u=e("baseURL"),l=e("allowAbsoluteUrls"),f=e("url");if(t.headers=o=M.from(o),t.url=_n(bn(u,f,l),i.params,i.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?Ur(c.password):""))),h.isFormData(n)&&(L.hasStandardBrowserEnv||L.hasStandardBrowserWebWorkerEnv?o.setContentType(void 0):h.isFunction(n.getHeaders)&&Lr(o,n.getHeaders(),e("formDataHeaderPolicy"))),L.hasStandardBrowserEnv&&(h.isFunction(r)&&(r=r(t)),r===!0||r==null&&Dr(t.url))){const g=s&&a&&Ir.read(a);g&&o.set(s,g)}return t},Vr=typeof XMLHttpRequest<"u",Mr=Vr&&function(i){return new Promise(function(e,n){const r=Pn(i);let s=r.data;const a=M.from(r.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:u}=r,l,f,d,g,P;function m(){g&&g(),P&&P(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let _=new XMLHttpRequest;_.open(r.method.toUpperCase(),r.url,!0),_.timeout=r.timeout;function b(){if(!_)return;const T=M.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),U={data:!o||o==="text"||o==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:T,config:i,request:_};yn(function(K){e(K),m()},function(K){n(K),m()},U),_=null}"onloadend"in _?_.onloadend=b:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.startsWith("file:"))||setTimeout(b)},_.onabort=function(){_&&(n(new y("Request aborted",y.ECONNABORTED,i,_)),m(),_=null)},_.onerror=function(A){const U=A&&A.message?A.message:"Network Error",E=new y(U,y.ERR_NETWORK,i,_);E.event=A||null,n(E),m(),_=null},_.ontimeout=function(){let A=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const U=r.transitional||ye;r.timeoutErrorMessage&&(A=r.timeoutErrorMessage),n(new y(A,U.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,i,_)),m(),_=null},s===void 0&&a.setContentType(null),"setRequestHeader"in _&&h.forEach(hn(a),function(A,U){_.setRequestHeader(U,A)}),h.isUndefined(r.withCredentials)||(_.withCredentials=!!r.withCredentials),o&&o!=="json"&&(_.responseType=r.responseType),u&&([d,P]=Wt(u,!0),_.addEventListener("progress",d)),c&&_.upload&&([f,g]=Wt(c),_.upload.addEventListener("progress",f),_.upload.addEventListener("loadend",g)),(r.cancelToken||r.signal)&&(l=T=>{_&&(n(!T||T.type?new Dt(null,i,_):T),_.abort(),m(),_=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const v=Rr(r.url);if(v&&!L.protocols.includes(v)){n(new y("Unsupported protocol "+v+":",y.ERR_BAD_REQUEST,i));return}_.send(s||null)})},Fr=(i,t)=>{if(i=i?i.filter(Boolean):[],!t&&!i.length)return;const e=new AbortController;let n=!1;const r=function(c){if(!n){n=!0,a();const u=c instanceof Error?c:this.reason;e.abort(u instanceof y?u:new Dt(u instanceof Error?u.message:u))}};let s=t&&setTimeout(()=>{s=null,r(new y(`timeout of ${t}ms exceeded`,y.ETIMEDOUT))},t);const a=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(r):c.removeEventListener("abort",r)}),i=null)};i.forEach(c=>c.addEventListener("abort",r));const{signal:o}=e;return o.unsubscribe=()=>h.asap(a),o},kr=function*(i,t){let e=i.byteLength;if(e<t){yield i;return}let n=0,r;for(;n<e;)r=n+t,yield i.slice(n,r),n=r},jr=async function*(i,t){for await(const e of qr(i))yield*kr(e,t)},qr=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const t=i.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Xe=(i,t,e,n)=>{const r=jr(i,t);let s=0,a,o=c=>{a||(a=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await r.next();if(u){o(),c.close();return}let f=l.byteLength;if(e){let d=s+=f;e(d)}c.enqueue(new Uint8Array(l))}catch(u){throw o(u),u}},cancel(c){return o(c),r.return()}},{highWaterMark:2})};function Hr(i){if(!i||typeof i!="string"||!i.startsWith("data:"))return 0;const t=i.indexOf(",");if(t<0)return 0;const e=i.slice(5,t),n=i.slice(t+1);if(/;base64/i.test(e)){let a=n.length;const o=n.length;for(let g=0;g<o;g++)if(n.charCodeAt(g)===37&&g+2<o){const P=n.charCodeAt(g+1),m=n.charCodeAt(g+2);(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(a-=2,g+=2)}let c=0,u=o-1;const l=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);u>=0&&(n.charCodeAt(u)===61?(c++,u--):l(u)&&(c++,u-=3)),c===1&&u>=0&&(n.charCodeAt(u)===61||l(u))&&c++;const d=Math.floor(a/4)*3-(c||0);return d>0?d:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(n,"utf8");let s=0;for(let a=0,o=n.length;a<o;a++){const c=n.charCodeAt(a);if(c<128)s+=1;else if(c<2048)s+=2;else if(c>=55296&&c<=56319&&a+1<o){const u=n.charCodeAt(a+1);u>=56320&&u<=57343?(s+=4,a++):s+=3}else s+=3}return s}const Pe="1.16.1",ze=64*1024,{isFunction:Ft}=h,Ge=(i,...t)=>{try{return!!i(...t)}catch{return!1}},Kr=i=>{const t=h.global!==void 0&&h.global!==null?h.global:globalThis,{ReadableStream:e,TextEncoder:n}=t;i=h.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},i);const{fetch:r,Request:s,Response:a}=i,o=r?Ft(r):typeof fetch=="function",c=Ft(s),u=Ft(a);if(!o)return!1;const l=o&&Ft(e),f=o&&(typeof n=="function"?(b=>v=>b.encode(v))(new n):async b=>new Uint8Array(await new s(b).arrayBuffer())),d=c&&l&&Ge(()=>{let b=!1;const v=new s(L.origin,{body:new e,method:"POST",get duplex(){return b=!0,"half"}}),T=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!T}),g=u&&l&&Ge(()=>h.isReadableStream(new a("").body)),P={stream:g&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!P[b]&&(P[b]=(v,T)=>{let A=v&&v[b];if(A)return A.call(v);throw new y(`Response type '${b}' is not supported`,y.ERR_NOT_SUPPORT,T)})});const m=async b=>{if(b==null)return 0;if(h.isBlob(b))return b.size;if(h.isSpecCompliantForm(b))return(await new s(L.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(h.isArrayBufferView(b)||h.isArrayBuffer(b))return b.byteLength;if(h.isURLSearchParams(b)&&(b=b+""),h.isString(b))return(await f(b)).byteLength},_=async(b,v)=>{const T=h.toFiniteNumber(b.getContentLength());return T??m(v)};return async b=>{let{url:v,method:T,data:A,signal:U,cancelToken:E,timeout:K,onDownloadProgress:Q,onUploadProgress:z,responseType:k,headers:I,withCredentials:ht="same-origin",fetchOptions:st,maxContentLength:G,maxBodyLength:Yt}=Pn(b);const Et=h.isNumber(G)&&G>-1,Tn=h.isNumber(Yt)&&Yt>-1;let we=r||fetch;k=k?(k+"").toLowerCase():"text";let tt=Fr([U,E&&E.toAbortSignal()],K),j=null;const at=tt&&tt.unsubscribe&&(()=>{tt.unsubscribe()});let ve;try{if(Et&&typeof v=="string"&&v.startsWith("data:")&&Hr(v)>G)throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j);if(Tn&&T!=="get"&&T!=="head"){const R=await _(I,A);if(typeof R=="number"&&isFinite(R)&&R>Yt)throw new y("Request body larger than maxBodyLength limit",y.ERR_BAD_REQUEST,b,j)}if(z&&d&&T!=="get"&&T!=="head"&&(ve=await _(I,A))!==0){let R=new s(v,{method:"POST",body:A,duplex:"half"}),ft;if(h.isFormData(A)&&(ft=R.headers.get("content-type"))&&I.setContentType(ft),R.body){const[It,Nt]=He(ve,Wt(Ke(z)));A=Xe(R.body,ze,It,Nt)}}h.isString(ht)||(ht=ht?"include":"omit");const B=c&&"credentials"in s.prototype;if(h.isFormData(A)){const R=I.getContentType();R&&/^multipart\/form-data/i.test(R)&&!/boundary=/i.test(R)&&I.delete("content-type")}I.set("User-Agent","axios/"+Pe,!1);const et={...st,signal:tt,method:T.toUpperCase(),headers:hn(I.normalize()),body:A,duplex:"half",credentials:B?ht:void 0};j=c&&new s(v,et);let $=await(c?we(j,st):we(v,et));if(Et){const R=h.toFiniteNumber($.headers.get("content-length"));if(R!=null&&R>G)throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j)}const te=g&&(k==="stream"||k==="response");if(g&&$.body&&(Q||Et||te&&at)){const R={};["status","statusText","headers"].forEach(wt=>{R[wt]=$[wt]});const ft=h.toFiniteNumber($.headers.get("content-length")),[It,Nt]=Q&&He(ft,Wt(Ke(Q),!0))||[];let Se=0;const An=wt=>{if(Et&&(Se=wt,Se>G))throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j);It&&It(wt)};$=new a(Xe($.body,ze,An,()=>{Nt&&Nt(),at&&at()}),R)}k=k||"text";let Z=await P[h.findKey(P,k)||"text"]($,b);if(Et&&!g&&!te){let R;if(Z!=null&&(typeof Z.byteLength=="number"?R=Z.byteLength:typeof Z.size=="number"?R=Z.size:typeof Z=="string"&&(R=typeof n=="function"?new n().encode(Z).byteLength:Z.length)),typeof R=="number"&&R>G)throw new y("maxContentLength size of "+G+" exceeded",y.ERR_BAD_RESPONSE,b,j)}return!te&&at&&at(),await new Promise((R,ft)=>{yn(R,ft,{data:Z,headers:M.from($.headers),status:$.status,statusText:$.statusText,config:b,request:j})})}catch(B){if(at&&at(),tt&&tt.aborted&&tt.reason instanceof y){const et=tt.reason;throw et.config=b,j&&(et.request=j),B!==et&&(et.cause=B),et}throw B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,b,j,B&&B.response),{cause:B.cause||B}):y.from(B,B&&B.code,b,j,B&&B.response)}}},Wr=new Map,En=i=>{let t=i&&i.env||{};const{fetch:e,Request:n,Response:r}=t,s=[n,r,e];let a=s.length,o=a,c,u,l=Wr;for(;o--;)c=s[o],u=l.get(c),u===void 0&&l.set(c,u=o?new Map:Kr(t)),l=u;return u};En();const Ee={http:hr,xhr:Mr,fetch:{get:En}};h.forEach(Ee,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(i,"adapterName",{__proto__:null,value:t})}});const $e=i=>`- ${i}`,Xr=i=>h.isFunction(i)||i===null||i===!1;function zr(i,t){i=h.isArray(i)?i:[i];const{length:e}=i;let n,r;const s={};for(let a=0;a<e;a++){n=i[a];let o;if(r=n,!Xr(n)&&(r=Ee[(o=String(n)).toLowerCase()],r===void 0))throw new y(`Unknown adapter '${o}'`);if(r&&(h.isFunction(r)||(r=r.get(t))))break;s[o||"#"+a]=r}if(!r){const a=Object.entries(s).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?a.length>1?`since :
|
|
17
|
+
`+a.map($e).join(`
|
|
18
|
+
`):" "+$e(a[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const wn={getAdapter:zr,adapters:Ee};function oe(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Dt(null,i)}function Je(i){return oe(i),i.headers=M.from(i.headers),i.data=ae.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),wn.getAdapter(i.adapter||Ot.adapter,i)(i).then(function(n){oe(i),i.response=n;try{n.data=ae.call(i,i.transformResponse,n)}finally{delete i.response}return n.headers=M.from(n.headers),n},function(n){if(!mn(n)&&(oe(i),n&&n.response)){i.response=n.response;try{n.response.data=ae.call(i,i.transformResponse,n.response)}finally{delete i.response}n.response.headers=M.from(n.response.headers)}return Promise.reject(n)})}const Zt={};["object","boolean","number","function","string","symbol"].forEach((i,t)=>{Zt[i]=function(n){return typeof n===i||"a"+(t<1?"n ":" ")+i}});const Qe={};Zt.transitional=function(t,e,n){function r(s,a){return"[Axios v"+Pe+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(t===!1)throw new y(r(a," has been removed"+(e?" in "+e:"")),y.ERR_DEPRECATED);return e&&!Qe[a]&&(Qe[a]=!0,console.warn(r(a," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,a,o):!0}};Zt.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Gr(i,t,e){if(typeof i!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const n=Object.keys(i);let r=n.length;for(;r-- >0;){const s=n[r],a=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(a){const o=i[s],c=o===void 0||a(o,s,i);if(c!==!0)throw new y("option "+s+" must be "+c,y.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new y("Unknown option "+s,y.ERR_BAD_OPTION)}}const Ht={assertOptions:Gr,validators:Zt},q=Ht.validators;let ut=class{constructor(t){this.defaults=t||{},this.interceptors={request:new qe,response:new qe}}async request(t,e){try{return await this._request(t,e)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=(()=>{if(!r.stack)return"";const a=r.stack.indexOf(`
|
|
19
19
|
`);return a===-1?"":r.stack.slice(a+1)})();try{if(!n.stack)n.stack=s;else if(s){const a=s.indexOf(`
|
|
20
20
|
`),o=a===-1?-1:s.indexOf(`
|
|
21
21
|
`,a+1),c=o===-1?"":s.slice(o+1);String(n.stack).endsWith(c)||(n.stack+=`
|
|
22
|
-
`+s)}}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=lt(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&Kt.assertOptions(n,{silentJSONParsing:q.transitional(q.boolean),forcedJSONParsing:q.transitional(q.boolean),clarifyTimeoutError:q.transitional(q.boolean),legacyInterceptorReqResOrdering:q.transitional(q.boolean)},!1),r!=null&&(h.isFunction(r)?e.paramsSerializer={serialize:r}:Kt.assertOptions(r,{encode:q.function,serialize:q.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Kt.assertOptions(e,{baseUrl:q.spelling("baseURL"),withXsrfToken:q.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&h.merge(s.common,s[e.method]);s&&h.forEach(["delete","get","head","post","put","patch","query","common"],P=>{delete s[P]}),e.headers=M.concat(a,s);const o=[];let c=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(e)===!1)return;c=c&&m.synchronous;const _=e.transitional||me;_&&_.legacyInterceptorReqResOrdering?o.unshift(m.fulfilled,m.rejected):o.push(m.fulfilled,m.rejected)});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,f=0,d;if(!c){const P=[$e.bind(this),void 0];for(P.unshift(...o),P.push(...u),d=P.length,l=Promise.resolve(e);f<d;)l=l.then(P[f++],P[f++]);return l}d=o.length;let g=e;for(;f<d;){const P=o[f++],m=o[f++];try{g=P(g)}catch(_){m.call(this,_);break}}try{l=$e.call(this,g)}catch(P){return Promise.reject(P)}for(f=0,d=u.length;f<d;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=lt(this.defaults,t);const e=mn(t.baseURL,t.url,t.allowAbsoluteUrls);return pn(e,t.params,t.paramsSerializer)}};h.forEach(["delete","get","head","options"],function(t){ut.prototype[t]=function(e,n){return this.request(lt(n||{},{method:t,url:e,data:(n||{}).data}))}});h.forEach(["post","put","patch","query"],function(t){function e(n){return function(s,a,o){return this.request(lt(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}ut.prototype[t]=e(),t!=="query"&&(ut.prototype[t+"Form"]=e(!0))});let Wr=class En{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});const n=this;this.promise.then(r=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new Dt(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=n=>{t.abort(n)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new En(function(r){t=r}),cancel:t}}};function Xr(i){return function(e){return i.apply(null,e)}}function zr(i){return h.isObject(i)&&i.isAxiosError===!0}const de={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(de).forEach(([i,t])=>{de[t]=i});function vn(i){const t=new ut(i),e=en(ut.prototype.request,t);return h.extend(e,ut.prototype,t,{allOwnKeys:!0}),h.extend(e,t,null,{allOwnKeys:!0}),e.create=function(r){return vn(lt(i,r))},e}const C=vn(Ot);C.Axios=ut;C.CanceledError=Dt;C.CancelToken=Wr;C.isCancel=_n;C.VERSION=be;C.toFormData=Qt;C.AxiosError=y;C.Cancel=C.CanceledError;C.all=function(t){return Promise.all(t)};C.spread=Xr;C.isAxiosError=zr;C.mergeConfig=lt;C.AxiosHeaders=M;C.formToJSON=i=>dn(h.isHTMLForm(i)?new FormData(i):i);C.getAdapter=Pn.getAdapter;C.HttpStatusCode=de;C.default=C;const{Axios:Zr,AxiosError:Yr,CanceledError:ts,isCancel:es,CancelToken:ns,VERSION:is,all:rs,Cancel:ss,isAxiosError:as,spread:os,toFormData:cs,AxiosHeaders:us,HttpStatusCode:ls,formToJSON:hs,getAdapter:fs,mergeConfig:ps,create:ds}=C;class Gr extends L.Kernel{__pinPad__={buffer:null,about:{EMV:null,model:null,serial:null,brand:null,appVersion:null,printer:null,hasCashback:!1,supportInjection:!1,supportSign:!1,supportContactlessCollisionCard:!1,supportContactless:!1,supportDUKPT:"",injectedValues:!1,pp:null},config:{defaultEnvironment:"production",environment:"production",currency:"MXN",currencyCode:"0484",timeoutPinPad:"100",signSupport:"1",CTLSSupport:"1",userTRX:"userPinpadWeb",tp_operation:"29",requireCVVAmex:"1",forceOnline:"00",emvCard:"0",validateQPS:"1",username:null,password:null,country:null,idBranch:null,idCompany:null,latitude:null,longitude:null,publicKeyRSA:null,publicIP:null,internal:{stTokenization:!1,qpsDomestic:"",qpsInternational:"",cvmlVMCDomestic:"",cvmlVMCInternational:"",cvmlAmex:"",translimitCTLSVMC:"",translimitCTLSAmex:"",emv:{}},terminal:{},loginResponse:null,otherLogin:{},RC4Key:"KEY CREDIT CARD KEY",read:{EMV:"",PIN:"",POSEM:"",AppId:"",AppIdLabel:"",Arqc:"",Chip:"",ChipName:"",ChipNameEnc:"",ReadCTLS:"",NB_Data:"",NB_ksn:"",Tags:"",Type:""},tokenizeTRX:!1},constants:{appVersion:"1.0.16",appName:"pinpapWebApp ",STX:"",ETX:"",FS:"",getNULL:"\0",appChannel:"3",typeChannel:"11",urls:{development:"https://fcdev.mitec.com.mx",qa:"https://fcqa.mitec.com.mx",production:"https://m.mit.com.mx",productionAlternative:"https://m2.mit.com.mx"},uris:{login:"/pinpadWeb/login",RSAKey:"/pinpadWeb/getDataCrypt",merchant:"/pinpadWeb/getAfiliaciones",consult:"/pinpadWeb/queryTrx",keysDUKPT:"/pinpadWeb/getKeysDUKPT",reverse:"/pinpadWeb/executeBackSale",rePrint:"/pinpadWeb/reprint",checkInMoto:"/pinpadWeb/checkin",checkOutMoto:"/pinpadWeb/checkout",reAuthorizationMoto:"/pinpadWeb/reAuthorization",cancellation:"/pinpadWeb/executeVoid",sale:"/pinpadWeb/executeSale"}},operation:{amount:"0",reference:null,folio:null,authorization:null,errors:0,last_error:null,commerceVoucher:"",clientVoucher:"",consultDate:null,ignore:{responseGlobal:{},counter:!1,counterSale:!1,isError92TRX:!1,C93Global:!1,error:""},finalResult:{},moto:{ccType:"",ccName:"",ccNumber:"",ccExpMonth:"",ccExpYear:"",ccCvvCsc:"",txRoom:""},bin:"",bin8:"",hasQPS:!1,onlyMerchant:"",merchant:null,typeOperation:"29",typeResponse:"",responseMit:{},applyReverse:!1},finishCommand:{A:"",B:"",C:"",D:"",E:"",F:"",G:"",H:"",I:"",J:"",K:""},waiting:{statusAboutWaiting:null,statusInjectWaiting:null,statusReadCardWaiting:null,statusSecondGenerateWaiting:null,statusinitDUKPTWaiting:null,statuswritingDUKPTWaiting:null}};constructor({filters:t=null,config_port:e={baudRate:19200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:n=1,device_listen_on_channel:r=1,username:s=null,password:a=null,environment:o="production",socket:c=!1}={filters:null,config_port:{baudRate:19200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:1,device_listen_on_channel:1,username:null,password:null,environment:"production",socket:!1}){if(super({filters:t,config_port:e,no_device:n,device_listen_on_channel:r,socket:c}),this.__internal__.device.type="pinpad",!L.supportCrypto())throw new Error("Crypto not supported in this browser");if(Se.Devices.getCustom(this.typeDevice,n))throw new Error(`Device ${this.typeDevice} ${n} already exists`);this.__internal__.time.response_connection=3e3,this.__internal__.time.response_general=5e3,this.__internal__.serial.delay_first_connection=1e3,this.environment=o,s&&(this.username=s),a&&(this.password=a),this.#A(),Se.Devices.add(this)}#A(){const t=["pp:processing-card","pp:read-card","pp:error","pp:print","pp:merchant-moto","pp:dukpt","pp:finish-emv","pp:response"];for(const e of t)this.serialRegisterAvailableListener(e)}async timeout(t,e){await super.timeout(t,e),this.__pinPad__.waiting.statusAboutWaiting&&e==="about"?this.__pinPad__.waiting.statusAboutWaiting="rejected":this.__pinPad__.waiting.statusInjectWaiting&&e==="inject"?this.__pinPad__.waiting.statusInjectWaiting="rejected":this.__pinPad__.waiting.statusinitDUKPTWaiting&&e==="init-dukpt"?this.__pinPad__.waiting.statusinitDUKPTWaiting="rejected":this.__pinPad__.waiting.statuswritingDUKPTWaiting&&e==="dukpt"?this.__pinPad__.waiting.statuswritingDUKPTWaiting="rejected":this.__pinPad__.waiting.statusReadCardWaiting&&e==="read-card"?this.__pinPad__.waiting.statusReadCardWaiting="rejected":this.__pinPad__.waiting.statusSecondGenerateWaiting&&e==="second-generate"&&(this.__pinPad__.waiting.statusSecondGenerateWaiting="rejected")}#R(t){const e=this.__pinPad__.constants.STX,n=this.__pinPad__.constants.ETX,r=this.__pinPad__.constants.FS,s=this.__pinPad__.constants.getNULL;t=t.replace(new RegExp(e,"g"),"");const a=t.split(n);t=a[0];const o=t.split(r);o.push(...a[1].split(r));const c={};return o.map((u,l)=>{const f=l>0?u.substring(0,1):"A",d=l>0?u.substring(1):u;return{[f]:d.replace(new RegExp(s,"g"),"")}}).forEach(u=>Object.assign(c,u)),c}#f(t,e){const n=this.__pinPad__.constants.ETX,r=e.substring(e.indexOf("D")+2,e.indexOf("E"));let s=0;const a=e.indexOf("N")>0,o=e.substring(e.indexOf("A00")+3,e.indexOf("B"));if(o&&o!=="undefined"&&o.toUpperCase()==="VERIFONE"){const u=r.replace("MITP_1.00.","").replace("MITP_01.00.","").replace("MITD_1.00.","").replace("MITD_01.00.","");s=parseInt(u),s>=15&&(this.__pinPad__.about.hasCashback=!0)}this.__pinPad__.about.supportInjection=a,e.indexOf("M")>0?(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf("M"))=="1",this.__pinPad__.about.supportInjection?this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf("N"))==="1":(this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf(n))=="1",this.__pinPad__.about.supportContactless=!0)):(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf(n))=="1",this.__pinPad__.about.supportContactless=!1),this.__pinPad__.about.supportDUKPT=e.substring(e.indexOf("J")+2,e.indexOf("K")),this.__pinPad__.about.EMV=e.substring(e.indexOf("E")+2,e.indexOf("F")),this.__pinPad__.about.serial=e.substring(e.indexOf("C")+2,e.indexOf("D")),this.__pinPad__.about.printer=e.substring(e.indexOf("F")+2,e.indexOf("G")),this.__pinPad__.about.model=e.substring(e.indexOf("B")+2,e.indexOf("C")),this.__pinPad__.about.brand=o,this.__pinPad__.about.appVersion=r;const c=e.substring(e.indexOf("K")+2,e.indexOf("L"))=="1";this.__pinPad__.about.pp={brand:o,appVersion:r,versionInt:s,hasCashback:this.__pinPad__.about.hasCashback,supportInjection:this.__pinPad__.about.supportInjection,supportSign:this.__pinPad__.about.supportSign,supportContactlessCollisionCard:this.__pinPad__.about.supportContactlessCollisionCard,supportContactless:this.__pinPad__.about.supportContactless,supportDUKPT:this.__pinPad__.about.supportDUKPT=="1",hasDUKPTKeys:c,EMV:this.__pinPad__.about.EMV,serial:this.__pinPad__.about.serial,printer:this.__pinPad__.about.printer,model:this.__pinPad__.about.model},this.__pinPad__.waiting.statusAboutWaiting&&(this.__pinPad__.waiting.statusAboutWaiting="resolved")}#C(){this.__pinPad__.waiting.statusInjectWaiting="resolved"}#O(t,e){e=e.replace("010P93A00B01t036P81AACERQUE, INSERTE CHIP O DESLICE*",""),this.__pinPad__.config.terminal={nb_kcv:e.substring(e.indexOf("E")+2,e.indexOf("F")),nb_marca_terminal:e.substring(e.indexOf("P91A")+4,e.indexOf("B")),nb_modelo_terminal:e.substring(e.indexOf("B")+2,e.indexOf("C")),nb_serie_lector:e.substring(e.indexOf("C")+2,e.indexOf("D")),nb_tk:e.substring(e.indexOf("F")+2,e.length-2),nb_version_terminal:e.substring(e.indexOf("D")+2,e.indexOf("E"))},this.__pinPad__.waiting.statusinitDUKPTWaiting="resolved"}#D(){this.__pinPad__.waiting.statuswritingDUKPTWaiting="resolved"}#I(t,e){const n=this.__pinPad__.about?.brand?.toLowerCase(),r=this.__pinPad__.about?.model?.toLowerCase(),s=n==="ingenico"&&r==="ipp320"?500:350;if(e.length<s){e=e.replace("006P93A00.","").replace("006P93A00,",""),e.includes("E93")?this.__pinPad__.operation.ignore.error=e.substring(e.indexOf("E93")+3,e.indexOf("E93")+6):e.includes("E71")&&(this.__pinPad__.operation.ignore.error=e.substring(e.indexOf("E71")+3,e.indexOf("E71")+6)),this.__pinPad__.operation.ignore.error!==""&&e.indexOf("OPERACION CANCELADA")===-1&&e.indexOf("TIEMPO EXCEDIDO")===-1&&this.__pinPad__.operation.ignore.error.length===3&&(this.__pinPad__.operation.last_error=this.#T(this.__pinPad__.operation.ignore.error),this.__pinPad__.waiting.statusReadCardWaiting="rejected");return}if(e.includes("M1")||e.includes("M0")||e.includes("M1")||e.includes("N1")||e.includes("N1")||e.includes("P93A022")&&e.substring(e.length-24).includes("I")&&e.substring(e.length-1).includes("")||e.includes("P93A800")&&e.substring(e.length-24).includes("I")&&e.substring(e.length-1).includes("")||e.includes("P93A022")&&e.length>=406&&r==="vx820"||e.includes("P93A022")&&e.length>=406&&r==="vx520"||e.includes("P93A800")&&e.length>=406&&r==="vx520"||e.includes("P93A800")&&e.length>=406&&r==="vx820"||e.includes("P93A022")&&e.length>=406&&r==="p400"||e.includes("P93A800")&&e.length>=406&&r==="p400"||e.includes("P93A022")&&e.length>=406&&r==="v205c"||e.includes("P93A800")&&e.length>=406&&r==="v205c"||e.includes("P93A022")&&e.length>=406&&r==="move2500"||e.includes("P93A800")&&e.length>=406&&r==="move2500"||e.includes("P93A022")&&e.length>=406&&r==="lane3000"||e.includes("P93A800")&&e.length>=406&&r==="lane3000"){let a=e;n==="verifone"&&(a=e.replace("006P93A00.","").substring(e.indexOf("P93A"),e.indexOf("P93A")+7)),e.includes("P81APROCESANDO, NO RETIRE TARJETA")||e.includes("P81APROCESANDO TARJETA")||a.includes("P93A022")||a.includes("P81AINSERTE CHIP O DESLICE TARJETA")||a.includes("ACERQUE, INSERTE CHIP O DESLICE")||a.includes("P81AACERQUE, INSERTE CHIP O DESLICE TARJETA")?this.dispatch("pp:processing-card",{waiting:!0}):e.length>s&&this.#B(e)}}#N(t,e){const n=this.__pinPad__.constants.ETX;let r=e.replace("023P81AFAVOR RETIRAR TARJ.","").replace("020P81A DECLINADA EMV ","").replace("020P81A DECLINADA EMV ","");r=r.substring(r.indexOf("B")+2,r.indexOf(n)),r.includes("006E93A16")&&(r="01"),this.__pinPad__.operation.applyReverse=r==="01"&&this.__pinPad__.operation.responseMit._approved&&this.__pinPad__.config.otherLogin.executeReverse==="1",this.__pinPad__.waiting.statusSecondGenerateWaiting="resolved"}#B(t){const e=this.__pinPad__.constants.ETX,n=this.__pinPad__.about?.brand?.toLowerCase();let r,s,a,o,c;n==="verifone"?t=t.replace("006P93A00.","").replace("009P93A00","").replace("010P93A00B01v",""):t=t.replace("006P93A00,",""),this.__pinPad__.config.read.POSEM=t.substring(t.indexOf("P93A")+4,t.indexOf("B"));const u=this.__pinPad__.config.read.POSEM;if(u==="051"||u==="071"){if(this.__pinPad__.config.read.Chip="1",this.__pinPad__.config.read.PIN=t.substring(t.indexOf("C")+2,t.indexOf("D")),this.__pinPad__.config.read.AppId=t.substring(t.indexOf("G")+2,t.indexOf("H")),this.__pinPad__.config.read.AppIdLabel=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.Arqc=t.substring(t.indexOf("F")+2,t.indexOf("G")),t.includes("O")){const l=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=l.substring(l.indexOf("M")+2,l.indexOf("N")),this.__pinPad__.operation.hasQPS=l.substring(l.indexOf("N")+2,l.indexOf("O"))==="1",this.__pinPad__.operation.bin8=l.substring(l.indexOf("O")+2,l.indexOf(e))}else if(t.includes("N")){const l=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=l.substring(l.indexOf("M")+2,l.indexOf("N")),this.__pinPad__.operation.hasQPS=l.substring(l.indexOf("N")+2,l.indexOf(e))==="1"}else{const l=t.substring(t.indexOf("P93A"),t.indexOf("M")+5);this.__pinPad__.config.read.ReadCTLS=l.substring(l.indexOf("M")+2,l.indexOf(e)),this.__pinPad__.operation.hasQPS=!1}this.__pinPad__.config.read.Tags=t.substring(t.indexOf("B")+2,t.indexOf("C")),this.__pinPad__.config.read.NB_ksn=t.substring(t.indexOf("K")+2,t.indexOf("M")),this.__pinPad__.config.read.NB_Data=t.substring(t.indexOf("D")+2,t.indexOf("E")),s=t.substring(t.indexOf("I")+2,t.indexOf("J")),a=t.substring(t.indexOf("E")+2,t.indexOf("F")),this.__pinPad__.config.read.ChipName=a,r=t.substring(t.indexOf("J")+2,t.indexOf("K"))}else{let l;if(this.__pinPad__.config.read.Chip="0",this.__pinPad__.config.read.PIN="",this.__pinPad__.config.read.AppId="",this.__pinPad__.config.read.Arqc="",this.__pinPad__.config.read.ReadCTLS="0",this.__pinPad__.config.read.AppIdLabel=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.Tags=t.substring(t.indexOf("B")+2,t.indexOf("C")),u==="022")if(t.includes("O")){const f=t.substring(t.indexOf("P93A"));this.__pinPad__.operation.bin8=f.substring(f.indexOf("O")+2,f.indexOf(e)),l=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),l=l.substring(l.indexOf("I")+2,l.lastIndexOf(""))}else l=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),l=l.substring(l.indexOf("I")+2,l.indexOf(e));else l=t.substring(t.indexOf("P93A800"),t.indexOf("I")+23),l=l.substring(l.indexOf("I")+2,l.indexOf(e));this.__pinPad__.config.read.NB_ksn=l,this.__pinPad__.config.read.NB_Data=t.substring(t.indexOf("B")+2,t.indexOf("C")),s=t.substring(t.indexOf("F")+2,t.indexOf("G")),r=t.substring(t.indexOf("G")+2,t.indexOf("H")),this.__pinPad__.about.model?.toLowerCase()==="vx520"?(a=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=a):(a=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=a)}r.includes("/")&&(r=r.replace("/","")),r.toString().length===4?(c=r.toString().substring(0,2),o=r.toString().substring(2)):(c="",o=""),this.__pinPad__.config.read.Chip==="1"?(this.__pinPad__.config.read.EMV="3",this.__pinPad__.config.read.ChipNameEnc="1"):(this.__pinPad__.config.read.ChipNameEnc="",this.__pinPad__.config.read.EMV="2"),this.__pinPad__.config.read.AppIdLabel.toLowerCase().includes("american")||this.__pinPad__.config.read.AppIdLabel.toLowerCase().includes("amex")?this.__pinPad__.config.read.Type="AMEX":this.__pinPad__.config.read.Type="V/MC",this.__pinPad__.operation.bin=s,s.length>6&&(this.__pinPad__.operation.bin=s.substring(0,6)),this.__pinPad__.waiting.statusReadCardWaiting="resolved",this.dispatch("pp:read-card",{ERROR:"",maskPan:s,name:a,month:c,year:o})}#x(t,e){e.length>10&&e.includes("E93A10")&&(this.__pinPad__.waiting.statusReadCardWaiting==="pending"&&(this.__pinPad__.waiting.statusReadCardWaiting="rejected"),this.dispatch("pp:error",{message:"Operation cancelled by user."}))}#U(t,e){if(this.__pinPad__.about.model?.toLowerCase()==="vx520"){if(e.length>11)if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(()=>{this.print("client").then(()=>{}).catch(n=>{console.error(n)})},1e3):this.dispatch("pp:print",{type:"success"});else{const n=e.includes("E17")||e.includes("A17")?{type:"warning",message:"printer without paper"}:{type:"error",message:"The voucher could not be printed"};this.dispatch("pp:print",n)}}else if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(()=>{this.print("client").then(()=>{}).catch(n=>{console.error(n)})},1e3):this.dispatch("pp:print",{type:"success"});else{const n=e.includes("E17")||e.includes("A17")?{type:"warning",message:"printer without paper"}:{type:"error",message:"The voucher could not be printed"};this.dispatch("pp:print",n)}}#L(t,e){console.log(t,e)}#V(t,e){console.log(t,e)}serialMessage(t){const e={original_code:t,code:null,name:null,description:null,request:this.lastAction,no_code:0,parsed:null},n=this.parseHexToUint8(t),r=this.parseUint8ArrayToString(n),s=this.#R(r);switch(this.__pinPad__.buffer=r,e.parsed=s,e.code=r,e.request){case"connect":e.name="connected",e.description="Connection established",e.no_code=100,this.#f(s,r);break;case"about":e.name="About PinPad",e.description="Response of about",e.no_code=101,this.#f(s,r);break;case"inject":e.name="Inject",e.description="Response of inject values",e.no_code=102,this.#C();break;case"init-dukpt":e.name="Init DUKPT",e.description="Response of init DUKPT",e.no_code=103,this.#O(s,r);break;case"dukpt":e.name="Write DUKPT",e.description="Response of write DUKPT",e.no_code=104,this.#D();break;case"read-card":e.name="read card",e.description="response of read card",e.no_code=105,this.#I(s,r);break;case"second-generate":e.name="second generate",e.description="response of second generate",e.no_code=106,this.#N(s,r);break;case"cancel":e.name="cancel pinpad",e.description="response of cancel",e.no_code=107;break;case"print":this.#U(s,r),e.name="print voucher",e.description="response of print",e.no_code=108;break;case"cancel-read-card":this.#x(s,r),e.name="cancel read card",e.description="response of cancel read card",e.no_code=109;break;case"code93":this.#L(s,r),e.name="code 93",e.description="response of code 93",e.no_code=110;break;case"finish-emv-end":this.#V(s,r),e.name="Finish EMV End",e.description="response of finish EMV End",e.no_code=111;break;default:e.name="unknown",e.description="Unknown command",e.no_code=400;break}this.dispatch("serial:message",e)}serialSetConnectionConstant(){let n="C56AABOUT";n=""+n.length.toString().padStart(3,"0")+n+"";let r=0;for(let a=0;a<n.length;a++)r^=n.charCodeAt(a);n=n+String.fromCharCode(r);const s=this.parseStringToBytes(n,"");return this.add0x(s)}async sendCustomCode({code:t=""}={}){if(typeof t!="string")throw new Error("Invalid string");const e=this.parseStringToBytes(t);await this.appendToQueue(e,"custom")}set username(t){this.__pinPad__.config.username=t}get username(){return this.__pinPad__.config.username}set password(t){if(typeof t!="string")throw new Error("Invalid password");this.__pinPad__.config.password=t.toUpperCase()}get password(){return this.__pinPad__.config.password}set amount(t){if(t=parseFloat(t),isNaN(t)||t<=0)throw new Error("Invalid amount");this.__pinPad__.operation.amount=t.toFixed(2).toString()}get amount(){return parseFloat(this.__pinPad__.operation.amount)||0}set reference(t){if(!this.#g(t.trim()))throw new Error("Invalid reference");this.__pinPad__.operation.reference=t.trim().toString().replaceAll(" ","").toUpperCase()}get reference(){return this.__pinPad__.operation.reference||""}get url(){const t=this.environment;return this.__pinPad__.constants.urls[t]}get version(){return{name:this.__pinPad__.constants.appName,version:this.__pinPad__.constants.appVersion,environment:this.environment,type:this.typeDevice}}set environment(t){const e=["development","qa","production","productionAlternative"];if(typeof t!="string"||!e.includes(t.toLowerCase()))throw new Error("The environment must be a string, in: "+e.join(", "));this.__pinPad__.config.defaultEnvironment=t.toLowerCase(),this.__pinPad__.config.environment=t.toLowerCase()}get defaultEnvironment(){return this.__pinPad__.config.defaultEnvironment}get environment(){return this.__pinPad__.config.environment}get latitudeLongitude(){return{latitude:this.__pinPad__.config.latitude,longitude:this.__pinPad__.config.longitude}}set timeoutPinPad(t){if(t=parseInt(t),isNaN(t)||t<=10||t>=300)throw new Error("Invalid timeout please use a number between 10 and 300 seconds");this.__pinPad__.config.timeoutPinPad=t.toString()}get timeoutPinPad(){return parseInt(this.__pinPad__.config.timeoutPinPad)}#s(t,e){const n=new ai;return n.setPublicKey(t),n.encrypt(e)}#a(t){const e="0123456789ABCDEF";let n="";for(let r=0;r<t;r++){const s=Math.floor(Math.random()*e.length);n+=e.substring(s,s+1)}return n}#M(t){const e="0123456789abcdef",n=[],r=[];for(let s=0;s<256;s++)n[s]=e.charAt(s>>4)+e.charAt(s&15);for(let s=0;s<t.length;s++)r[s]=n[t.charCodeAt(s)];return r.join("")}async#o(t,e){const n=t.match(/.{1,2}/g)||[],r=new Uint8Array(n.map(d=>parseInt(d,16))),s=crypto.getRandomValues(new Uint8Array(16)),o=new TextEncoder().encode(e),c=await crypto.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt"]),u=await crypto.subtle.encrypt({name:"AES-CBC",iv:s},c,o),l=btoa(String.fromCharCode(...s)),f=btoa(String.fromCharCode(...new Uint8Array(u)));return l+f}#F(t,e,n=!1){const r=[];for(let u=0;u<256;u++)r[u]=u;let s=0;for(let u=0;u<256;u++)s=(s+r[u]+t.charCodeAt(u%t.length))%256,[r[u],r[s]]=[r[s],r[u]];let a=0,o=0,c="";for(const u of e){a=(a+1)%256,o=(o+r[a])%256,[r[a],r[o]]=[r[o],r[a]];const l=r[(r[a]+r[o])%256];c+=String.fromCharCode(u.charCodeAt(0)^l)}return n?this.#M(c).toUpperCase():c}#i(t,e){return this.#F(t,this.hexToAscii(e))}#k(t){return t.replaceAll("Á","A"),t.replaceAll("É","E"),t.replaceAll("Í","I"),t.replaceAll("Ó","O"),t.replaceAll("Ú","U"),t.replaceAll("á","a"),t.replaceAll("é","e"),t.replaceAll("í","i"),t.replaceAll("ó","o"),t.replaceAll("ú","u"),t.replaceAll("ñ","n"),t.replaceAll("Ñ","N"),t.replaceAll('Electr?a"',"Electronica"),t}#t(t,e,n){if(t=t.replace("@cnb logo_cpagos",e),t=t.replace("@cnn ver_app",n),t=t.replace(/@/g," @"),t=t.replace(/ {2}@/g," @"),t=t.replace(/ {3}@/g," @"),t=t.replace(/\r/g,""),t=t.replace(/\n/g,""),t.includes("@lsn POR ESTE PAGARE ME OBLIGO INCONDI")){const r=t.indexOf("@lsn POR ESTE PAGARE ME OBLIGO INCONDI");t=t.substring(0,r)}return t.trim()+"@br @br @br @br @br"}#j(t,e){const n="@logo3 @br",r="@cnn "+e;return t.includes("@cnb Santander")?(t=t.replace("@cnb Santander","@logo1@br"),this.#t(t,n,r)):t.includes("@cnb American Express")?(t=t.replace("@cnb American Express","@logo2@br"),this.#t(t,n,r)):t.includes("@cnb HSBC")?(t=t.replace("@cnb HSBC","@logo7@br"),this.#t(t,n,r)):t.includes("@cnb IXE")?(t=t.replace("@cnb IXE","@logo11@br"),this.#t(t,n,r)):t.includes("@cnb MULTIVA")?(t=t.replace("@cnb MULTIVA","@logo15@br"),this.#t(t,n,r)):t.includes("@cnb Multiva")?(t=t.replace("@cnb Multiva","@logo15@br"),this.#t(t,n,r)):t.includes("@cnb SCOTIA BANK")?(t=t.replace("@cnb SCOTIA BANK","@logo16@br"),this.#t(t,n,r)):t.includes("@cnb SCOTIABANK")?(t=t.replace("@cnb SCOTIABANK","@logo16@br"),this.#t(t,n,r)):t.includes("@cnb BANCOMER")?(t=t.replace("@cnb BANCOMER","@logo17@br"),this.#t(t,n,r)):t.includes("@cnb Bancomer")?(t=t.replace("@cnb Bancomer","@logo17@br"),this.#t(t,n,r)):t.includes("@cnb BBVA")?(t=t.replace("@cnb BBVA","@logo17@br"),this.#t(t,n,r)):t.includes("@cnb BANORTE")?(t=t.replace("@cnb BANORTE","@logo18@br"),this.#t(t,n,r)):t.includes("@cnb Banorte")?(t=t.replace("@cnb Banorte","@logo18@br"),this.#t(t,n,r)):t.includes("@cnb BANREGIO")?(t=t.replace("@cnb BANREGIO","@logo19@br"),this.#t(t,n,r)):t.includes("@cnb Banregio")?(t=t.replace("@cnb Banregio","@logo19@br"),this.#t(t,n,r)):t.includes("@cnb GETNET")?(t=t.replace("@cnb GETNET","@logo20@br"),this.#t(t,n,r)):t.includes("@cnb GetNET")?(t=t.replace("@cnb GetNET","@logo20@br"),this.#t(t,n,r)):this.#t(t,n,r)}async#q(t=!1){if(this.#H(),this.__pinPad__.config.loginResponse&&!t)return await this.#p();const e=this.url+this.__pinPad__.constants.uris.login,n={usuario:this.username,password:this.password,crypto:"",version:this.__pinPad__.constants.appVersion,serieLector:"",canal:this.__pinPad__.constants.appChannel};if(await this.#c(),this.#d())throw new Error("Empty RSA Key");const r=this.#a(32),s=this.#s(this.__pinPad__.config.publicKeyRSA||"",r),a=await this.#o(r,JSON.stringify(n)),o=await C.post(e,a,{headers:{"Content-Type":"application/json","cache-control":"no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0",data:s||""}}).catch(l=>{throw new Error(`Error in request, verify internet connection: ${l.response?.status} ${l.message}`)}),c=this.#b(JSON.stringify(o.data));let u=c;if(typeof c=="string"&&(u=JSON.parse(c)),!u)throw new Error("Invalid response JSON");if(u.RESPUESTA==="error")throw new Error(u);return this.__pinPad__.config.loginResponse=u,localStorage.setItem("ppLoginResponse",JSON.stringify({timestamp:new Date().getTime(),data:u})),await this.#p()}async#p(){await this.#G();try{await this.getPosition()}catch(t){console.log("Error getting position",t)}return this.__pinPad__.config.otherLogin={},this.#K(this.__pinPad__.config.loginResponse),this.__pinPad__.config.otherLogin}#K(t){let e="",n="";t.xml?.ventaspropias?.merchant_currencyb&&(e=t.xml.ventaspropias.merchant_currencyb),t.xml?.ventaspropias?.merchant_currencym&&(n=t.xml.ventaspropias.merchant_currencym);let r=t.xml?.emvReverso;r||(r="0");const s=t.xml?.st_tokenizacion;!s||s==="false"||s==="0"?this.__pinPad__.config.internal.stTokenization=!1:this.__pinPad__.config.internal.stTokenization&&(this.__pinPad__.config.internal.stTokenization=!0),this.__pinPad__.config.internal.emv=t.xml.importesPGS,this.__pinPad__.config.internal.qpsDomestic=this.__pinPad__.config.internal.emv.qps_dom,this.__pinPad__.config.internal.qpsInternational=this.__pinPad__.config.internal.emv.qps_il,this.__pinPad__.config.internal.cvmlVMCDomestic=this.__pinPad__.config.internal.emv.cvml_vm_dom,this.__pinPad__.config.internal.cvmlVMCInternational=this.__pinPad__.config.internal.emv.cvml_vm_il,this.__pinPad__.config.internal.cvmlAmex=this.__pinPad__.config.internal.emv.cvml_amex,this.__pinPad__.config.internal.translimitCTLSVMC=this.__pinPad__.config.internal.emv.tl_mc,this.__pinPad__.config.internal.translimitCTLSAmex=this.__pinPad__.config.internal.emv.tl_amex,this.__pinPad__.config.country=t.country.toUpperCase(),this.__pinPad__.config.idBranch=t.id_branch.toUpperCase(),this.__pinPad__.config.idCompany=t.id_company.toUpperCase(),this.__pinPad__.config.otherLogin={bsUser:t.user,nbUser:t.nb_user,bsCompany:t.id_company,nbCompany:t.nb_company,nbStreetCompany:t.nb_companystreet,bsBranch:t.id_branch,nbBranch:t.nb_branch,bsCountry:t.country,coins:e,coinsMOTO:n,executeReverse:r}}#H(){const t=localStorage.getItem("ppLoginResponse");let e=null;t&&(e=JSON.parse(t),this.__pinPad__.config.loginResponse||(this.__pinPad__.config.loginResponse=e?.data),new Date().getTime()-e?.timestamp>=864e5&&(this.__pinPad__.config.loginResponse=null))}async login({force:t=!1}={}){return await this.#q(t)}async#W(){const t=this.url+this.__pinPad__.constants.uris.RSAKey,e=await C.get(t).catch(r=>{throw new Error(`Error in request, verify internet connection: ${r.response.status} ${r.message}`)});if(!e)return"";const n=e.headers;if(!n)return"";if(n.get("content-type").indexOf("application/json")===-1)throw new Error("Fail to fetch RSA public key");return this.__pinPad__.config.publicKeyRSA=e.data.key_public,localStorage.setItem("ppRSAKey",JSON.stringify({timestamp:new Date().getTime(),data:e.data.key_public})),this.__pinPad__.config.publicKeyRSA}clearSession(){localStorage.removeItem("ppLoginResponse"),localStorage.removeItem("ppRSAKey"),localStorage.removeItem("ppPublicIP")}#d(){const t=localStorage.getItem("ppRSAKey");if(!t)return!0;const e=JSON.parse(t);return!e.data||(this.__pinPad__.config.publicKeyRSA=e.data,new Date().getTime()-e.timestamp>=864e5)?!0:!this.__pinPad__.config.publicKeyRSA}async#_(){return this.#d()?await this.#W():this.__pinPad__.config.publicKeyRSA}async#c(){if(!await this.#_())throw new Error("RSA public key is empty")}#g(t){return/^[A-Z-a-z0-9\s]+$/g.test(t)}#X(t){if(L.isEmpty(t))return!0;const e=/^[A-Z-a-z0-9\s]+$/g.test(t)===!0;if(!e)throw new Error("Invalid reference");return e}#e(t){return t.length.toString().padStart(3,"0")}#n(t){let e=0;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n);return String.fromCharCode(e)}#l(t,e=0){return t=parseFloat(t.toString().replace(/[^0-9.-]/g,"")),isNaN(t)?0 .toFixed(e):t.toFixed(e).replace(/,/g,"")}#m(t){return t=parseFloat(t.toString()),!(isNaN(t)||t<0)}async#u(t){for(const e in t)if(typeof t[e]>"u"||t[e]===null||t[e]==="")throw new Error("Object incomplete to process");return t}#y(t){if(!t||isNaN(parseInt(t))||t.toString().length!==9)throw new Error("Number of operation must be number of 9 digits");return t}#b(t){if(typeof t!="string")throw new Error("Invalid string");return!t||/<html(?:\s+lang=["'][^"']*["'])?>/i.test(t)||(t=t.replace(/aaa/g,"á"),t=t.replace(/eee/g,"é"),t=t.replace(/iii/g,"í"),t=t.replace(/ooo/g,"ó"),t=t.replace(/uuu/g,"ú"),t=t.replace(/NNN/g,"Ñ"),t=t.replace(/nnn/g,"ñ"),t=t.replace(/á/g,"á")),t}async#z(){const t=this.__pinPad__.constants.STX,e=this.__pinPad__.constants.ETX;let n="C55ACANCEL";n=t+this.#e(n)+n+e,n=n+this.#n(n);const r=this.parseStringToBytes(n,"");await this.appendToQueue(r,"cancel")}#P(){const t=new Date,e=t.getDate().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),r=t.getFullYear().toString().substring(2);return e+n+r}#E(){const t=new Date,e=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");return e+n}async checkPositionPermission(){if(!L.supportGeolocation())throw new Error("Geolocation not supported");return new Promise((t,e)=>{navigator.permissions.query({name:"geolocation"}).then(n=>{n.state==="granted"?t(!0):t(!1)}).catch(()=>e(!1))})}async getPosition(){return this.__pinPad__.config.latitude&&this.__pinPad__.config.longitude?this.latitudeLongitude:(this.__pinPad__.config.latitude=null,this.__pinPad__.config.longitude=null,L.supportGeolocation()?new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.__pinPad__.config.latitude=e.coords.latitude,this.__pinPad__.config.longitude=e.coords.longitude,t(this.latitudeLongitude)},()=>{t(this.latitudeLongitude)})}):this.latitudeLongitude)}async#G(){const t=localStorage.getItem("ppPublicIP");if(t){const s=JSON.parse(t);this.__pinPad__.config.publicIP=s.data,new Date().getTime()-s.timestamp>=864e5&&(this.__pinPad__.config.publicIP=null)}if(this.__pinPad__.config.publicIP)return this.__pinPad__.config.publicIP;this.__pinPad__.config.publicIP=null;let e=!1;const n=await C.get("https://api.ipify.org?format=json").catch(()=>e=!0);if(e||typeof n!="object"||!n||!n.data)return null;const r=n.data||{};return this.__pinPad__.config.publicIP=r.ip||null,localStorage.setItem("ppPublicIP",JSON.stringify({timestamp:new Date().getTime(),data:r.ip})),this.__pinPad__.config.publicIP}async cancelReadCard(){let t="012VXVCANCELl";this.__pinPad__.about.model?.toLowerCase()==="ingenico"&&(t="029C50AOPERACION CANCELADA");const e=this.parseStringToBytes(t,"");await this.appendToQueue(e,"cancel-read-card")}async print(t="client"){this.__pinPad__.operation.errors=0;const e=this.__pinPad__.constants.STX,n=this.__pinPad__.constants.ETX;this.__pinPad__.operation.commerceVoucher.includes(":")||(this.__pinPad__.operation.commerceVoucher=this.#i(this.__pinPad__.config.RC4Key,this.__pinPad__.operation.commerceVoucher)),this.__pinPad__.operation.clientVoucher.includes(":")||(this.__pinPad__.operation.clientVoucher=this.#i(this.__pinPad__.config.RC4Key,this.__pinPad__.operation.clientVoucher));let r=t==="client"?this.__pinPad__.operation.clientVoucher:this.__pinPad__.operation.commerceVoucher;if(r.length===0){this.dispatch("pp:print",{error:!0,code:"001",message:"Without information to print"});return}r=this.#k(r),r=this.#j(r,this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion);let s="C59A"+r;s=e+this.#e(s)+s+n,s=s+this.#n(s),t==="client"?this.__pinPad__.operation.clientVoucher="":t==="commerce"&&(this.__pinPad__.operation.commerceVoucher="");const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"print")}async#r(t,e){await this.#c();const n=this.#a(32),r=this.#s(this.__pinPad__.config.publicKeyRSA||"",n),s=await this.#o(n,JSON.stringify(e));return(await C.post(t,s,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:r||""}}).catch(o=>{throw o.response.data.includes("Ha ocurrido un error al procesar su solicitud.")?new Error("It was not possible to obtain the affiliations."):o.response.status>=500&&o.response.status<=599?new Error(`Service Temporarily Unavailable ${o.message}`):new Error(`Error in request, verify internet connection: ${o.response?.status} ${o.message}`)})).data}async#v({data:t,url:e,cancelable:n=!1}={data:null,url:"",cancelable:!1}){await this.#c();const r=this.#a(32),s=this.#s(this.__pinPad__.config.publicKeyRSA||"",r),a=await this.#o(r,JSON.stringify(t)),o=this;return(await C.post(e,a,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:s||""}}).catch(async u=>{let l=`Error in request, verify internet connection: ${u.status} ${u.message}`;throw u.response.status>=500&&u.response.status<=599?l="Service Temporarily Unavailable":u.response.status>=400&&u.response.status<=499&&(l="Bad Request"),n&&await o.#z(),new Error(l)})).data}async#$(){const t=this.__pinPad__.constants.FS,e=this.__pinPad__.constants.ETX,n=this.__pinPad__.constants.STX;let r="C57A"+this.__pinPad__.config.internal.qpsDomestic;if(r=r+t+"B"+this.__pinPad__.config.internal.qpsInternational,r=r+t+"C"+this.__pinPad__.config.internal.cvmlVMCDomestic,r=r+t+"D"+this.__pinPad__.config.internal.cvmlVMCInternational,r=r+t+"E"+this.__pinPad__.config.internal.cvmlAmex,r=r+t+"F"+this.__pinPad__.config.internal.translimitCTLSVMC,r=r+t+"G"+this.__pinPad__.config.internal.translimitCTLSAmex,r=n+this.#e(r)+r+e,r=r+this.#n(r),!this.__pinPad__.about.injectedValues){const s=this.parseStringToBytes(r,"");await this.appendToQueue(s,"inject")}}async#J(){this.__pinPad__.operation.bin8&&(this.__pinPad__.operation.bin=this.__pinPad__.operation.bin8),this.__pinPad__.operation.bin8="";const t=await this.#v({data:{accion:"tipoPagoInfo",cc_num:this.__pinPad__.operation.bin,usuario:this.username?.toUpperCase(),canal:this.__pinPad__.constants.typeChannel,tp_canal:"1",tp_moneda:this.__pinPad__.config.currency.toUpperCase()},url:this.url+this.__pinPad__.constants.uris.merchant,cancelable:!0});if(!t.respuesta||t.respuesta==="0"){let e="C55ACANCEL";const n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;e=n+this.#e(e)+e+r,e=e+this.#n(e);const s=this.parseStringToBytes(e,"");return await this.appendToQueue(s,"cancel"),!1}return this.__pinPad__.operation.merchant=t,this.__pinPad__.operation.onlyMerchant=t.contado.af.length>1?t.contado.af[0].merchant:t.contado.af.merchant,!0}async#Q(t=null){if(this.__pinPad__.waiting.statusAboutWaiting)throw new Error("AboutPP is already running");const e=this.__pinPad__.constants.STX,n=this.__pinPad__.constants.ETX;let r="C56AABOUT";if(r=e+this.#e(r)+r+n,r=r+this.#n(r),L.isEmpty(this.__pinPad__.about.pp)){this.__pinPad__.waiting.statusAboutWaiting="pending";const a=this.parseStringToBytes(r,"");await this.appendToQueue(a,"about")}else return t?t(this.__pinPad__.about.pp?.supportDUKPT||!1,this.__pinPad__.about.pp?.hasDUKPTKeys||!1):!0;let s=0;return new Promise((a,o)=>{s=setInterval(()=>{if(this.__pinPad__.waiting.statusAboutWaiting==="resolved"){if(clearInterval(s),this.__pinPad__.waiting.statusAboutWaiting=null,L.isEmpty(this.__pinPad__.about.pp))return;if(!t||typeof t!="function"){a(!0);return}const c=t(this.__pinPad__.about.pp?.supportDUKPT||!1,this.__pinPad__.about.pp?.hasDUKPTKeys||!1);a(c)}else this.__pinPad__.waiting.statusAboutWaiting==="rejected"&&(clearInterval(s),this.__pinPad__.waiting.statusAboutWaiting=null,o("Error"))},500)})}async#h(t,e){if(t=t?t.toString():"",e=e?e.toString():"",L.isEmpty(t)||t==="0"){this.dispatch("pp:dukpt",{status:"unsupported",already:!1});return}if(L.isEmpty(e)||e==="1"){this.dispatch("pp:dukpt",{status:"charged",already:!0});return}const n=this.#P(),r=this.#E(),s=this.__pinPad__.constants.FS,a=this.__pinPad__.constants.ETX,o=this.__pinPad__.constants.STX;let c="C91A"+n+s+"B"+r;c=o+this.#e(c)+c+a,c=c+this.#n(c);const u=this.parseStringToBytes(c,"");await this.appendToQueue(u,"init-dukpt");let l=0;return this.__pinPad__.waiting.statusinitDUKPTWaiting="pending",new Promise((f,d)=>{l=setInterval(async()=>{this.__pinPad__.waiting.statusinitDUKPTWaiting==="resolved"?(clearInterval(l),this.__pinPad__.waiting.statusinitDUKPTWaiting=null,this.dispatch("pp:dukpt",{status:"charged",already:!1}),await this.#Z(),f(!0)):this.__pinPad__.waiting.statusinitDUKPTWaiting==="rejected"&&(clearInterval(l),this.__pinPad__.waiting.statusinitDUKPTWaiting=null,d("Error"))},500)})}async#Z(){const t={IPEK_REQUESTType:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},terminal:this.__pinPad__.config.terminal}},e=await this.#v({data:t,url:this.url+this.__pinPad__.constants.uris.keysDUKPT});await this.#lt(e)}async#Y(){if(!await this.#_())throw new Error("RSA public key is empty");const e=this;await this.#Q(async function(r,s){if(e.__pinPad__.about.supportInjection&&e.__pinPad__.config.internal.emv&&e.__pinPad__.about.injectedValues)return await e.#h(r,s),!0;let a=0;return e.__pinPad__.waiting.statusInjectWaiting="pending",await e.#$(),new Promise((o,c)=>{a=setInterval(async()=>{e.__pinPad__.waiting.statusInjectWaiting==="resolved"?(clearInterval(a),e.__pinPad__.waiting.statusInjectWaiting=null,await e.#h(r,s),o(!0)):e.__pinPad__.waiting.statusInjectWaiting==="rejected"&&(clearInterval(a),e.__pinPad__.waiting.statusInjectWaiting=null,c("Error"))},500)})})}#w(t,e=0){if(t=parseFloat(t.toString().replace(/[^0-9.-]/g,"")),isNaN(t)||t===0)return parseFloat("0").toFixed(e);t=t.toFixed(e);const n=t.split(".");return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,""),n.join(".")}getClientVoucher(){return this.__pinPad__.operation.clientVoucher}getCommerceVoucher(){return this.__pinPad__.operation.commerceVoucher}async#tt(){this.__pinPad__.operation.errors=0;let t="ACERQUE, INSERTE CHIP O DESLICE TARJETA";if(this.__pinPad__.about.supportContactless||(t="INSERTE CHIP O DESLICE TARJETA"),this.__pinPad__.about.model?.toUpperCase().includes("UX300")&&(t="ACERQUE O INSERTE TARJETA"),L.isEmpty(this.amount)||isNaN(parseFloat(this.amount)))throw new Error("Amount required");if(parseFloat(this.amount)<=0)throw new Error("Amount must be greater than 0");if(this.#m(this.amount)===!1)throw new Error("Invalid amount required");if(parseFloat(this.#l(this.amount,2))<=0)throw new Error("Amount must be greater than 0");const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C93A"+t;s=s+e+"B"+this.#P(),s=s+e+"C"+this.#E(),s=s+e+"D"+this.#l(this.amount,2),s=s+e+"E0.00",s=s+e+"F"+this.__pinPad__.config.currencyCode,this.__pinPad__.about.supportDUKPT&&this.__pinPad__.about.supportDUKPT!=="0"&&this.__pinPad__.about.supportDUKPT!=="false"&&(this.__pinPad__.about.supportContactless?(s=s+e+"G"+this.timeoutPinPad,s=s+e+"HTAGS",s=s+e+"I"+this.__pinPad__.config.requireCVVAmex,s=s+e+"J"+this.__pinPad__.config.forceOnline,s=s+e+"K"+this.__pinPad__.about.supportContactless,s=s+e+"L"+this.__pinPad__.config.emvCard,this.__pinPad__.about.hasCashback&&(s=s+e+"M0",s=s+e+"N00")):(s=s+e+"G"+this.timeoutPinPad,s=s+e+"HTAGS",s=s+e+"I"+this.__pinPad__.config.requireCVVAmex,s=s+e+"L"+this.__pinPad__.config.emvCard),this.__pinPad__.about.supportInjection&&(s=s+e+"O"+this.__pinPad__.config.validateQPS)),s=n+this.#e(s)+s+r,s=s+this.#n(s),this.#ht();const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"read-card");let o=0;return this.__pinPad__.waiting.statusReadCardWaiting="pending",new Promise((c,u)=>{o=setInterval(()=>{if(this.__pinPad__.waiting.statusReadCardWaiting==="resolved")clearInterval(o),this.__pinPad__.waiting.statusReadCardWaiting=null,c(!0);else if(this.__pinPad__.waiting.statusReadCardWaiting==="rejected"){clearInterval(o),this.__pinPad__.waiting.statusReadCardWaiting=null;const l=this.__pinPad__.operation.last_error;u(l??"Error reading card")}},500)})}async#et(t){return await L.wait(t*1e3)}async consult({reference:t=null}={reference:null}){return t||(t=this.reference),L.isEmpty(t)&&(t="--",this.reference=t),this.#X(this.reference),this.__pinPad__.operation.consultDate=new Date().toLocaleDateString("en-GB"),await this.#u({Ambiente:this.environment,User:this.username,Pwd:this.password,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,Country:this.__pinPad__.config.country,Tx_Date:this.__pinPad__.operation.consultDate}),this.#r(this.url+this.__pinPad__.constants.uris.consult,{user:this.username?.toUpperCase(),pwd:this.password?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),date:this.__pinPad__.operation.consultDate,reference:this.reference})}async#nt(t){let e=this.url+this.__pinPad__.constants.uris.consult;return t>1&&this.environment==="production"&&(e=e.replace(this.__pinPad__.constants.urls.production,this.__pinPad__.constants.urls.productionAlternative)),this.__pinPad__.operation.consultDate=new Date().toLocaleDateString("en-GB"),await this.#r(e,{user:this.username?.toUpperCase(),pwd:this.password?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),date:this.__pinPad__.operation.consultDate,reference:this.reference})}async#it(t="",e={}){let n=1,r=null;do{n>1&&this.environment==="production"&&(t=t.replace(this.__pinPad__.constants.urls.production,this.__pinPad__.constants.urls.productionAlternative),await this.#et(5)),await this.#c();const s=this.#a(32),a=this.#s(this.__pinPad__.config.publicKeyRSA||"",s),o=await this.#o(s,JSON.stringify(e));let c=!1;const u=await C.post(t,o,{headers:{"Content-Type":"application/json",data:a||""}}).catch(async l=>{let f=`Error in request, verify internet connection: ${l.status} ${l.message}`;l.response.status>=500&&l.response.status<=599?f="Service Temporarily Unavailable":l.response.status>=400&&l.response.status<=499&&(f="Bad Request"),console.warn(l),r=f;const d=await this.#nt(n);d&&d!=="{}"&&!d.includes('"transacciones":""')&&d.includes("nu_operaion")&&(n=5,r="EE32"),c=!0});if(!c){if(!u||typeof u!="object"||!u.data){r="It was not possible to obtain the affiliations.";continue}return u.data}}while(n++<=3);return r?Promise.reject(r):Promise.reject("Communication error with CDP. IL/MTY")}#rt(t){if(L.isEmpty(t))throw new Error("Number of authorization invalid");if(/^[A-Za-z0-9]+$/g.test(t)!==!0)throw new Error("Number of authorization invalid");if(t.length!==6)throw new Error("Number of authorization invalid");return!0}async rePrint({folio:t=null}={}){let e="";t===null&&(e=this.__pinPad__.operation.folio||""),this.#y(e),await this.#u({Ambiente:this.environment,User:this.username,Pwd:this.password,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,Country:this.__pinPad__.config.country,Tx_OperationNumber:e});const n=await this.#r(this.url+this.__pinPad__.constants.uris.rePrint,{REPRINTVOUCHER:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},no_operacion:t,crypto:"2"}});let r=n.voucher_comercio;return this.__pinPad__.operation.commerceVoucher="",r&&(n.voucher_comercio.includes(":")?this.__pinPad__.operation.commerceVoucher=n.voucher_comercio:this.__pinPad__.operation.commerceVoucher=this.#i(this.__pinPad__.config.RC4Key,n.voucher_comercio)),r=n.voucher_cliente,this.__pinPad__.operation.clientVoucher="",r&&(n.voucher_cliente.includes(":")?this.__pinPad__.operation.clientVoucher=n.voucher_cliente:this.__pinPad__.operation.clientVoucher=this.#i(this.__pinPad__.config.RC4Key,n.voucher_cliente)),n}#st(t){this.__pinPad__.operation.responseMit._approved=t.response==="approved",this.__pinPad__.operation.responseMit._status=t.response,this.__pinPad__.operation.responseMit._originalToken=t.number_tkn??"",this.__pinPad__.operation.folio=t.foliocpagos,this.__pinPad__.operation.authorization=t.auth;let e=t.cd_response?.toUpperCase();return e.toUpperCase()==="0C"||this.__pinPad__.operation.responseMit._approved?e="00":(e!=="Z3"&&e!=="05"||t.cd_error==="92")&&(e="01"),this.__pinPad__.operation.responseMit._cdResponse=e,this.__pinPad__.finishCommand.A=e,this.__pinPad__.finishCommand.B="",this.__pinPad__.finishCommand.C="",this.__pinPad__.finishCommand.D="",this.__pinPad__.finishCommand.E=t.emv_key_date?t.emv_key_date:"",this.__pinPad__.finishCommand.F=t.icc_csn?t.icc_csn:"",this.__pinPad__.finishCommand.G=t.icc_atc?t.icc_atc:"",this.__pinPad__.finishCommand.H=t.icc_arpc?t.icc_arpc:"",this.__pinPad__.finishCommand.I=t.icc_issuer_script?t.icc_issuer_script:"",this.__pinPad__.finishCommand.J=t.authorized_amount?t.authorized_amount:"",this.__pinPad__.finishCommand.K=t.account_balance_1?t.account_balance_1:"",{reference:t.reference,response:t.response,foliocpagos:t.foliocpagos,auth:t.auth,cd_response:e,cd_error:t.cd_error,nb_error:this.#b(t.nb_error??""),time:t.time,date:t.date,nb_company:t.nb_company,nb_merchant:t.nb_merchant,nb_street:t.nb_street,cc_type:t.cc_type,tp_operation:t.tp_operation,cc_name:t.cc_name,cc_number:t.cc_number,cc_expmonth:t.cc_expmonth,cc_expyear:t.cc_expyear,amount:t.amount,voucher_comercio:t.voucher_comercio,voucher_cliente:t.voucher_cliente,friendly_response:t.friendly_response,appid:t.appid,appidlabel:t.appidlabel,arqc:t.arqc}}async cancelPurchase({amount:t=0,authorization:e="",folio:n=""}={}){if(!this.#m(t))throw new Error("Invalid amount");if(!this.#rt(e))throw new Error("Invalid authorization");if(!this.#y(n))throw new Error("Invalid folio");const r=this.#w(t,2),s={Ambiente:this.environment,User:this.username,Pwd:this.password,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,Country:this.__pinPad__.config.country,UserTRX:"userPinpadWeb",Tx_OperationNumber:n,Tx_Auth:e,Amount:r};await this.#u(s);const a=await this.#r(this.url+this.__pinPad__.constants.uris.cancellation,{VMCAMEXMCANCELACION:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},transacction:{amount:t,auth:e.toUpperCase(),crypto:"2",no_operacion:n,usrtransacction:this.username?.toUpperCase(),version:this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion}}});return this.__pinPad__.operation.commerceVoucher="",a.voucher_comercio&&(a.voucher_comercio.includes(":")?this.__pinPad__.operation.commerceVoucher=a.voucher_comercio:this.__pinPad__.operation.commerceVoucher=this.#i(this.__pinPad__.config.RC4Key,a.voucher_comercio)),this.__pinPad__.operation.clientVoucher="",a.voucher_cliente&&(a.voucher_cliente.includes(":")?this.__pinPad__.operation.clientVoucher=a.voucher_cliente:this.__pinPad__.operation.clientVoucher=this.#i(this.__pinPad__.config.RC4Key,a.voucher_cliente)),JSON.stringify(a)}async#at(){this.__pinPad__.operation.errors=0,this.__pinPad__.operation.ignore.counterSale=!1;const t=this.__pinPad__.operation.onlyMerchant;if(/^[0-9]+$/.test(t)===!1)throw new Error("Invalid merchant");this.__pinPad__.operation.typeOperation="29";const e={error:!1,message:null,approved:!1,object:{}};try{const n=await this.#w(this.amount,2);await this.#u({Ambiente:this.environment,Country:this.__pinPad__.config.country,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,pwd:this.password,User:this.username,UserTRX:"userPinpadWeb",EMV:this.__pinPad__.config.read.EMV,ModeloTerminal:this.__pinPad__.about.model,SerieTerminal:this.__pinPad__.about.serial,Contactless:this.__pinPad__.about.supportContactless,Printer:this.__pinPad__.about.printer,VersionTerminal:this.__pinPad__.about.appVersion,TpOperation:this.__pinPad__.operation.typeOperation,Reference:this.reference,Amount:n,Currency:this.__pinPad__.config.currency,Merchant:t,Reverse:this.__pinPad__.config.otherLogin.executeReverse});let r=this.__pinPad__.about.supportContactless;typeof r=="string"&&(r=r!=="0");const s=this.__pinPad__.about.supportContactless&&r,a=await this.#it(this.url+this.__pinPad__.constants.uris.sale,{VMCAMEXB:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},dcc:{dcc_amount:"0",dcc_status:"0"},transacction:{amount:n,creditcard:{appid:this.__pinPad__.config.read.AppId,appidlabel:this.__pinPad__.config.read.AppIdLabel,arqc:this.__pinPad__.config.read.Arqc,chip:this.__pinPad__.config.read.Chip,chipname:this.__pinPad__.config.read.ChipName,chipnameenc:this.__pinPad__.config.read.ChipNameEnc,contactless:this.__pinPad__.config.read.ReadCTLS,crypto:"4",dukpt:{nb_data:this.__pinPad__.config.read.NB_Data,nb_ksn:this.__pinPad__.config.read.NB_ksn,tp_dukpt:"1"},pin:this.__pinPad__.config.read.PIN,posentrymode:this.__pinPad__.config.read.POSEM,tags:this.__pinPad__.config.read.Tags,type:this.__pinPad__.config.read.Type},currency:this.__pinPad__.config.currency.toUpperCase(),emv:this.__pinPad__.config.read.EMV,merchant:this.__pinPad__.operation.onlyMerchant,modelo_terminal:this.__pinPad__.about.model,reference:this.reference,serie:this.__pinPad__.about.serial,terminal:{display:"1",is_contactless:s,is_mobile:"0",printer:this.__pinPad__.about.printer},tp_operation:this.__pinPad__.operation.typeOperation,tp_resp:this.__pinPad__.operation.typeResponse,usrtransacction:this.username?.toUpperCase(),version:this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion,version_terminal:this.__pinPad__.about.appVersion},geolocation:{latitude:this.__pinPad__.config.latitude,longitude:this.__pinPad__.config.longitude,ip:this.__pinPad__.config.publicIP}}});a.response==="error"&&(e.error=!0,e.message=a.nb_error||"Error in response");const o=this.#st(a);return e.object=o,await this.#ot(o),e.approved=this.__pinPad__.operation.responseMit._approved,this.__pinPad__.operation.finalResult=o,e}catch(n){throw this.__pinPad__.finishCommand.A="01",this.__pinPad__.finishCommand.B="",this.__pinPad__.finishCommand.C="",this.__pinPad__.finishCommand.D="",this.__pinPad__.finishCommand.E="",this.__pinPad__.finishCommand.F="",this.__pinPad__.finishCommand.G="",this.__pinPad__.finishCommand.H="",this.__pinPad__.finishCommand.I="",this.__pinPad__.finishCommand.J="",this.__pinPad__.finishCommand.K="",await this.#ut(this.#T(n)),n}}async#ot(t){if(this.__pinPad__.config.read.POSEM==="022"||this.__pinPad__.config.read.POSEM==="800"||this.__pinPad__.config.read.ReadCTLS==="1")return this.dispatch("pp:finish-emv",t),!0;const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C93A"+this.__pinPad__.finishCommand.A;s=s+e+"B"+this.__pinPad__.finishCommand.B,s=s+e+"C"+this.__pinPad__.finishCommand.C,s=s+e+"D"+this.__pinPad__.finishCommand.D,s=s+e+"E"+this.__pinPad__.finishCommand.E,s=s+e+"F"+this.__pinPad__.finishCommand.F,s=s+e+"G"+this.__pinPad__.finishCommand.G,s=s+e+"H"+this.__pinPad__.finishCommand.H,s=s+e+"I"+this.__pinPad__.finishCommand.I,s=s+e+"J"+this.__pinPad__.finishCommand.J,s=s+e+"K"+this.__pinPad__.finishCommand.K,s=n+this.#e(s)+s+r,s=s+this.#n(s);const a=this.parseStringToBytes(s,"");this.__pinPad__.waiting.statusSecondGenerateWaiting="pending",await this.appendToQueue(a,"second-generate");let o=0;return new Promise((c,u)=>{o=setInterval(async()=>{if(this.__pinPad__.waiting.statusSecondGenerateWaiting==="resolved"){if(clearInterval(o),this.__pinPad__.waiting.statusSecondGenerateWaiting=null,this.__pinPad__.operation.applyReverse){const l=await this.#r(this.url+this.__pinPad__.constants.uris.reverse,{VMCAMEXMREVERSO:{business:{id_company:this.__pinPad__.config.idCompany?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),country:this.__pinPad__.config.country?.toUpperCase(),user:this.username?.toUpperCase(),pwd:this.password?.toUpperCase()},transacction:{amount:this.#l(this.amount,2),no_operacion:this.__pinPad__.operation.folio,auth:this.__pinPad__.operation.authorization?.toUpperCase(),tracks:"",usrtransacction:this.username?.toUpperCase(),crypto:"2",version:this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion}}}),f=JSON.parse(l);let d;f.response==="approved"?d={message:"Transaction rejected by PinPad."}:d={message:"No communication, please check your report."},this.__pinPad__.operation.ignore.counterSale||(this.dispatch("pp:finish-emv",d),this.__pinPad__.operation.ignore.counterSale=!0)}else this.__pinPad__.operation.ignore.counterSale||(this.dispatch("pp:finish-emv",t),this.__pinPad__.operation.ignore.counterSale=!0);t.cd_error==="92"&&await this.#ct(t,s),c(!0)}else this.__pinPad__.waiting.statusSecondGenerateWaiting==="rejected"&&(clearInterval(o),this.__pinPad__.waiting.statusSecondGenerateWaiting=null,u("There is no response from the reader, check that it is connected."))},500)})}async#ct(t,e){this.__pinPad__.operation.ignore.responseGlobal=t,this.__pinPad__.operation.ignore.C93Global=e,this.__pinPad__.operation.ignore.isError92TRX=!0,await this.#h(!0,!1)}async#S(){if(this.__pinPad__.operation.ignore.isError92TRX=!1,this.__pinPad__.config.read.POSEM==="022"||this.__pinPad__.config.read.POSEM==="800"||this.__pinPad__.config.read.ReadCTLS==="1")this.dispatch("pp:response",this.__pinPad__.operation.ignore.responseGlobal);else{const t=this.parseStringToBytes(this.__pinPad__.operation.ignore.C93Global,"");await this.appendToQueue(t,"code93"),await L.wait(1400),this.dispatch("pp:response",this.__pinPad__.operation.ignore.responseGlobal)}}#T(t){const e={PPE02:"Importe Incorrecto.",A02:"Importe Incorrecto.",PPE03:"No hay respuesta del lector, verifique que se encuentra conectado.",A03:"No hay respuesta del lector, verifique que se encuentra conectado.",PP18:"Sin comunicación, por favor verifique su reporte.",PP24:"Transacción declinada por la PinPad.",A01:"Tarjeta Ilegible.",A04:"No hay planes de pago para esta tarjeta, por favor cambie la tarjeta.",A10:"Operación cancelada por el usuario.",A11:"Proceso cancelado por timeout.",A12:"Lectura errónea de banda/chip.",A13:"Carga de llave fallida.",A14:"Error de lectura de PIN.",A15:"Tarjeta Vencida.",A16:"Problemas al leer el chip.",A17:"Impresora sin Papel.",E17:"Impresora sin Papel.",A21:"Información no almacenada correctamente.",A22:"Tarjeta bloqueada.",A23:"Sin llave de cifrado DUKPT.",A28:"Fallback no soportado.",EE19:"Error de conexión, verifique su reporte.",EE21:"Ha ocurrido un error al procesar su solicitud.",EE22:"Ha ocurrido un error de conexión al servidor.",EE23:"El número de operación no puede ir vacío.",EE24:"El número de operación debe ser de 9 dígitos.",EE25:"El número de operación debe ser numérico.",EE26:"La información enviada al servicio está incompleta.",EE27:"La referencia contiene caracteres inválidos o está vacía.",EE28:"Número de autorización inválido.",EE29:"Importe inválido.",EE30:"La información enviada al servicio no es válida.",EE31:"No fue posible obtener las afiliaciones.",EE32:"Error de conexión, existe una o más transacciones en el servidor , Favor de validar su reporte y en su caso reimprimir el voucher.",EE33:"Error de comunicacion con CDP. IL/MTY",EE20:"La Referencia contiene caracteres inválidos",EE99:"Error código 99."},n=e[t]?{error:t,message:e[t]}:{error:t,message:"Error desconocido"};return this.dispatch("pp:error",n),n}async#ut(t){const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C93A"+this.__pinPad__.finishCommand.A;if(s=s+e+"B"+this.__pinPad__.finishCommand.B,s=s+e+"C"+this.__pinPad__.finishCommand.C,s=s+e+"D"+this.__pinPad__.finishCommand.D,s=s+e+"E"+this.__pinPad__.finishCommand.E,s=s+e+"F"+this.__pinPad__.finishCommand.F,s=s+e+"G"+this.__pinPad__.finishCommand.G,s=s+e+"H"+this.__pinPad__.finishCommand.H,s=s+e+"I"+this.__pinPad__.finishCommand.I,s=s+e+"J"+this.__pinPad__.finishCommand.J,s=s+e+"K"+this.__pinPad__.finishCommand.K,s=n+this.#e(s)+s+r,s=s+this.#n(s),this.__pinPad__.config.read.POSEM==="022"||this.__pinPad__.config.read.POSEM==="800"||this.__pinPad__.config.read.ReadCTLS==="1"){this.dispatch("pp:finish-emv",t);return}const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"finish-emv-end")}async#lt(t){if(t.cd_estatus=t.cd_estatus?t.cd_estatus:"0",t.cd_estatus!=="1"){this.__pinPad__.operation.ignore.isError92TRX&&await this.#S();return}const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.ETX,r=this.__pinPad__.constants.STX,s=t.nb_ksn,a=t.nb_kcv||"",o=t.nb_ipek||"";let c="C92A"+s+e+"B"+a+e+"C"+o;c=r+this.#e(c)+c+n,c=c+this.#n(c);const u=this.parseStringToBytes(c,"");await this.appendToQueue(u,"dukpt");let l=0;return this.__pinPad__.waiting.statuswritingDUKPTWaiting="pending",new Promise((f,d)=>{l=setInterval(async()=>{this.__pinPad__.waiting.statuswritingDUKPTWaiting==="resolved"?(clearInterval(l),this.__pinPad__.waiting.statuswritingDUKPTWaiting=null,this.__pinPad__.operation.ignore.isError92TRX&&await this.#S(),f(!0)):this.__pinPad__.waiting.statuswritingDUKPTWaiting==="rejected"&&(clearInterval(l),this.__pinPad__.waiting.statuswritingDUKPTWaiting=null,d("Error writing DUKPT keys"))},500)})}#ht(){this.__pinPad__.config.read.AppId="",this.__pinPad__.config.read.AppIdLabel="",this.__pinPad__.config.read.Arqc="",this.__pinPad__.config.read.ChipName="",this.__pinPad__.config.read.ReadCTLS="",this.__pinPad__.config.read.NB_Data="",this.__pinPad__.config.read.NB_ksn="",this.__pinPad__.config.read.PIN="",this.__pinPad__.config.read.POSEM="",this.__pinPad__.config.read.Tags="",this.__pinPad__.config.read.Type="",this.__pinPad__.config.read.Chip="",this.__pinPad__.config.read.ChipNameEnc="",this.__pinPad__.operation.ignore.error="",this.__pinPad__.operation.ignore.C93Global="",this.__pinPad__.operation.folio="",this.__pinPad__.operation.authorization="",this.__pinPad__.config.tokenizeTRX=!1}async makeSale({amount:t=0,reference:e=null}={}){if(t=parseFloat(t.toString()),isNaN(t)||t<=0)throw new Error("Amount is required and must be greater than 0");if(this.amount=t,!e||L.isEmpty(e)||!this.#g(e))throw new Error("Reference is required and must be alphanumeric");if(this.reference=e,/^[A-Z-a-z\s]+$/g.test(this.__pinPad__.config.currency)===!1)throw new Error("Invalid currency");const n={error:!1,message:null,approved:!1,object:{}};try{return await this.login(),await this.#Y(),!await this.#tt()||!await this.#J()?n:await this.#at()}catch(r){console.warn(r),n.error=!0,n.message=r.message,n.approved=!1,n.object=r}return n}}exports.PinPad=Gr;
|
|
22
|
+
`+s)}}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=lt(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&Ht.assertOptions(n,{silentJSONParsing:q.transitional(q.boolean),forcedJSONParsing:q.transitional(q.boolean),clarifyTimeoutError:q.transitional(q.boolean),legacyInterceptorReqResOrdering:q.transitional(q.boolean)},!1),r!=null&&(h.isFunction(r)?e.paramsSerializer={serialize:r}:Ht.assertOptions(r,{encode:q.function,serialize:q.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ht.assertOptions(e,{baseUrl:q.spelling("baseURL"),withXsrfToken:q.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&h.merge(s.common,s[e.method]);s&&h.forEach(["delete","get","head","post","put","patch","query","common"],P=>{delete s[P]}),e.headers=M.concat(a,s);const o=[];let c=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(e)===!1)return;c=c&&m.synchronous;const _=e.transitional||ye;_&&_.legacyInterceptorReqResOrdering?o.unshift(m.fulfilled,m.rejected):o.push(m.fulfilled,m.rejected)});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,f=0,d;if(!c){const P=[Je.bind(this),void 0];for(P.unshift(...o),P.push(...u),d=P.length,l=Promise.resolve(e);f<d;)l=l.then(P[f++],P[f++]);return l}d=o.length;let g=e;for(;f<d;){const P=o[f++],m=o[f++];try{g=P(g)}catch(_){m.call(this,_);break}}try{l=Je.call(this,g)}catch(P){return Promise.reject(P)}for(f=0,d=u.length;f<d;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=lt(this.defaults,t);const e=bn(t.baseURL,t.url,t.allowAbsoluteUrls);return _n(e,t.params,t.paramsSerializer)}};h.forEach(["delete","get","head","options"],function(t){ut.prototype[t]=function(e,n){return this.request(lt(n||{},{method:t,url:e,data:(n||{}).data}))}});h.forEach(["post","put","patch","query"],function(t){function e(n){return function(s,a,o){return this.request(lt(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}ut.prototype[t]=e(),t!=="query"&&(ut.prototype[t+"Form"]=e(!0))});let $r=class vn{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});const n=this;this.promise.then(r=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new Dt(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=n=>{t.abort(n)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new vn(function(r){t=r}),cancel:t}}};function Jr(i){return function(e){return i.apply(null,e)}}function Qr(i){return h.isObject(i)&&i.isAxiosError===!0}const de={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(de).forEach(([i,t])=>{de[t]=i});function Sn(i){const t=new ut(i),e=nn(ut.prototype.request,t);return h.extend(e,ut.prototype,t,{allOwnKeys:!0}),h.extend(e,t,null,{allOwnKeys:!0}),e.create=function(r){return Sn(lt(i,r))},e}const C=Sn(Ot);C.Axios=ut;C.CanceledError=Dt;C.CancelToken=$r;C.isCancel=mn;C.VERSION=Pe;C.toFormData=Qt;C.AxiosError=y;C.Cancel=C.CanceledError;C.all=function(t){return Promise.all(t)};C.spread=Jr;C.isAxiosError=Qr;C.mergeConfig=lt;C.AxiosHeaders=M;C.formToJSON=i=>gn(h.isHTMLForm(i)?new FormData(i):i);C.getAdapter=wn.getAdapter;C.HttpStatusCode=de;C.default=C;const{Axios:ns,AxiosError:is,CanceledError:rs,isCancel:ss,CancelToken:as,VERSION:os,all:cs,Cancel:us,isAxiosError:ls,spread:hs,toFormData:fs,AxiosHeaders:ps,HttpStatusCode:ds,formToJSON:_s,getAdapter:gs,mergeConfig:ms,create:ys}=C;class Zr extends x.Kernel{__pinPad__={buffer:null,about:{EMV:null,model:null,serial:null,brand:null,appVersion:null,printer:null,hasCashback:!1,supportInjection:!1,supportSign:!1,supportContactlessCollisionCard:!1,supportContactless:!1,supportDUKPT:"",injectedValues:!1,pp:null},config:{defaultEnvironment:"production",environment:"production",currency:"MXN",currencyCode:"0484",timeoutPinPad:"100",signSupport:"1",CTLSSupport:"1",userTRX:"userPinpadWeb",tp_operation:"29",requireCVVAmex:"1",forceOnline:"00",emvCard:"0",validateQPS:"1",username:null,password:null,country:null,idBranch:null,idCompany:null,latitude:null,longitude:null,publicKeyRSA:null,publicIP:null,internal:{stTokenization:!1,qpsDomestic:"",qpsInternational:"",cvmlVMCDomestic:"",cvmlVMCInternational:"",cvmlAmex:"",translimitCTLSVMC:"",translimitCTLSAmex:"",emv:{}},terminal:{},loginResponse:null,otherLogin:{},RC4Key:"KEY CREDIT CARD KEY",read:{EMV:"",PIN:"",POSEM:"",AppId:"",AppIdLabel:"",Arqc:"",Chip:"",ChipName:"",ChipNameEnc:"",ReadCTLS:"",NB_Data:"",NB_ksn:"",Tags:"",Type:""},tokenizeTRX:!1},constants:{appVersion:"1.0.16",appName:"pinpapWebApp ",STX:"",ETX:"",FS:"",getNULL:"\0",appChannel:"3",typeChannel:"11",urls:{development:"https://fcdev.mitec.com.mx",qa:"https://fcqa.mitec.com.mx",production:"https://m.mit.com.mx",productionAlternative:"https://m2.mit.com.mx"},uris:{login:"/pinpadWeb/login",RSAKey:"/pinpadWeb/getDataCrypt",merchant:"/pinpadWeb/getAfiliaciones",consult:"/pinpadWeb/queryTrx",keysDUKPT:"/pinpadWeb/getKeysDUKPT",reverse:"/pinpadWeb/executeBackSale",rePrint:"/pinpadWeb/reprint",checkInMoto:"/pinpadWeb/checkin",checkOutMoto:"/pinpadWeb/checkout",reAuthorizationMoto:"/pinpadWeb/reAuthorization",cancellation:"/pinpadWeb/executeVoid",sale:"/pinpadWeb/executeSale"}},operation:{amount:"0",reference:null,folio:null,authorization:null,errors:0,last_error:null,commerceVoucher:"",clientVoucher:"",consultDate:null,ignore:{responseGlobal:{},counter:!1,counterSale:!1,isError92TRX:!1,C93Global:!1,error:""},finalResult:{},moto:{ccType:"",ccName:"",ccNumber:"",ccExpMonth:"",ccExpYear:"",ccCvvCsc:"",txRoom:""},bin:"",bin8:"",hasQPS:!1,onlyMerchant:"",merchant:null,typeOperation:"29",typeResponse:"",responseMit:{},applyReverse:!1},finishCommand:{A:"",B:"",C:"",D:"",E:"",F:"",G:"",H:"",I:"",J:"",K:""},waiting:{statusAboutWaiting:null,statusInjectWaiting:null,statusReadCardWaiting:null,statusSecondGenerateWaiting:null,statusinitDUKPTWaiting:null,statuswritingDUKPTWaiting:null}};constructor({filters:t=null,config_port:e={baudRate:19200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:n=1,device_listen_on_channel:r=1,username:s=null,password:a=null,environment:o="production",socket:c=!1}={filters:null,config_port:{baudRate:19200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:1,device_listen_on_channel:1,username:null,password:null,environment:"production",socket:!1}){if(super({filters:t,config_port:e,no_device:n,device_listen_on_channel:r,socket:c}),this.__internal__.device.type="pinpad",!x.supportCrypto())throw new Error("Crypto not supported in this browser");if(Te.Devices.getCustom(this.typeDevice,n))throw new Error(`Device ${this.typeDevice} ${n} already exists`);this.__internal__.time.response_connection=3e3,this.__internal__.time.response_general=5e3,this.__internal__.serial.delay_first_connection=1e3,this.environment=o,s&&(this.username=s),a&&(this.password=a),this.#A(),Te.Devices.add(this)}#A(){const t=["pp:processing-card","pp:read-card","pp:error","pp:print","pp:merchant-moto","pp:dukpt","pp:finish-emv","pp:response"];for(const e of t)this.serialRegisterAvailableListener(e)}async timeout(t,e){await super.timeout(t,e),this.__pinPad__.waiting.statusAboutWaiting&&e==="about"?this.__pinPad__.waiting.statusAboutWaiting="rejected":this.__pinPad__.waiting.statusInjectWaiting&&e==="inject"?this.__pinPad__.waiting.statusInjectWaiting="rejected":this.__pinPad__.waiting.statusinitDUKPTWaiting&&e==="init-dukpt"?this.__pinPad__.waiting.statusinitDUKPTWaiting="rejected":this.__pinPad__.waiting.statuswritingDUKPTWaiting&&e==="dukpt"?this.__pinPad__.waiting.statuswritingDUKPTWaiting="rejected":this.__pinPad__.waiting.statusReadCardWaiting&&e==="read-card"?this.__pinPad__.waiting.statusReadCardWaiting="rejected":this.__pinPad__.waiting.statusSecondGenerateWaiting&&e==="second-generate"&&(this.__pinPad__.waiting.statusSecondGenerateWaiting="rejected")}#R(t){const e=this.__pinPad__.constants.STX,n=this.__pinPad__.constants.ETX,r=this.__pinPad__.constants.FS,s=this.__pinPad__.constants.getNULL;t=t.replace(new RegExp(e,"g"),"");const a=t.split(n);t=a[0];const o=t.split(r);o.push(...a[1].split(r));const c={};return o.map((u,l)=>{const f=l>0?u.substring(0,1):"A",d=l>0?u.substring(1):u;return{[f]:d.replace(new RegExp(s,"g"),"")}}).forEach(u=>Object.assign(c,u)),c}#f(t,e){const n=this.__pinPad__.constants.ETX,r=e.substring(e.indexOf("D")+2,e.indexOf("E"));let s=0;const a=e.indexOf("N")>0,o=e.substring(e.indexOf("A00")+3,e.indexOf("B"));if(o&&o!=="undefined"&&o.toUpperCase()==="VERIFONE"){const u=r.replace("MITP_1.00.","").replace("MITP_01.00.","").replace("MITD_1.00.","").replace("MITD_01.00.","");s=parseInt(u),s>=15&&(this.__pinPad__.about.hasCashback=!0)}this.__pinPad__.about.supportInjection=a,e.indexOf("M")>0?(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf("M"))=="1",this.__pinPad__.about.supportInjection?this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf("N"))==="1":(this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf(n))=="1",this.__pinPad__.about.supportContactless=!0)):(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf(n))=="1",this.__pinPad__.about.supportContactless=!1),this.__pinPad__.about.supportDUKPT=e.substring(e.indexOf("J")+2,e.indexOf("K")),this.__pinPad__.about.EMV=e.substring(e.indexOf("E")+2,e.indexOf("F")),this.__pinPad__.about.serial=e.substring(e.indexOf("C")+2,e.indexOf("D")),this.__pinPad__.about.printer=e.substring(e.indexOf("F")+2,e.indexOf("G")),this.__pinPad__.about.model=e.substring(e.indexOf("B")+2,e.indexOf("C")),this.__pinPad__.about.brand=o,this.__pinPad__.about.appVersion=r;const c=e.substring(e.indexOf("K")+2,e.indexOf("L"))=="1";this.__pinPad__.about.pp={brand:o,appVersion:r,versionInt:s,hasCashback:this.__pinPad__.about.hasCashback,supportInjection:this.__pinPad__.about.supportInjection,supportSign:this.__pinPad__.about.supportSign,supportContactlessCollisionCard:this.__pinPad__.about.supportContactlessCollisionCard,supportContactless:this.__pinPad__.about.supportContactless,supportDUKPT:this.__pinPad__.about.supportDUKPT=="1",hasDUKPTKeys:c,EMV:this.__pinPad__.about.EMV,serial:this.__pinPad__.about.serial,printer:this.__pinPad__.about.printer,model:this.__pinPad__.about.model},this.__pinPad__.waiting.statusAboutWaiting&&(this.__pinPad__.waiting.statusAboutWaiting="resolved")}#C(){this.__pinPad__.waiting.statusInjectWaiting="resolved"}#O(t,e){e=e.replace("010P93A00B01t036P81AACERQUE, INSERTE CHIP O DESLICE*",""),this.__pinPad__.config.terminal={nb_kcv:e.substring(e.indexOf("E")+2,e.indexOf("F")),nb_marca_terminal:e.substring(e.indexOf("P91A")+4,e.indexOf("B")),nb_modelo_terminal:e.substring(e.indexOf("B")+2,e.indexOf("C")),nb_serie_lector:e.substring(e.indexOf("C")+2,e.indexOf("D")),nb_tk:e.substring(e.indexOf("F")+2,e.length-2),nb_version_terminal:e.substring(e.indexOf("D")+2,e.indexOf("E"))},this.__pinPad__.waiting.statusinitDUKPTWaiting="resolved"}#D(){this.__pinPad__.waiting.statuswritingDUKPTWaiting="resolved"}#I(t,e){const n=this.__pinPad__.about?.brand?.toLowerCase(),r=this.__pinPad__.about?.model?.toLowerCase(),s=n==="ingenico"&&r==="ipp320"?500:350;if(e.length<s){e=e.replace("006P93A00.","").replace("006P93A00,",""),e.includes("E93")?this.__pinPad__.operation.ignore.error=e.substring(e.indexOf("E93")+3,e.indexOf("E93")+6):e.includes("E71")&&(this.__pinPad__.operation.ignore.error=e.substring(e.indexOf("E71")+3,e.indexOf("E71")+6)),this.__pinPad__.operation.ignore.error!==""&&e.indexOf("OPERACION CANCELADA")===-1&&e.indexOf("TIEMPO EXCEDIDO")===-1&&this.__pinPad__.operation.ignore.error.length===3&&(this.__pinPad__.operation.last_error=this.#T(this.__pinPad__.operation.ignore.error),this.__pinPad__.waiting.statusReadCardWaiting="rejected"),e.includes("INSERTE CHIP O DESLICE TARJETA")&&(this.dispatch("pp:sale-process",{step:"insert-card",message:"Please insert or swipe the card"}),this.dispatch("pp:insert-card",{waiting:!0}));return}if(e.includes("M1")||e.includes("M0")||e.includes("M1")||e.includes("N1")||e.includes("N1")||e.includes("P93A022")&&e.substring(e.length-24).includes("I")&&e.substring(e.length-1).includes("")||e.includes("P93A800")&&e.substring(e.length-24).includes("I")&&e.substring(e.length-1).includes("")||e.includes("P93A022")&&e.length>=406&&r==="vx820"||e.includes("P93A022")&&e.length>=406&&r==="vx520"||e.includes("P93A800")&&e.length>=406&&r==="vx520"||e.includes("P93A800")&&e.length>=406&&r==="vx820"||e.includes("P93A022")&&e.length>=406&&r==="p400"||e.includes("P93A800")&&e.length>=406&&r==="p400"||e.includes("P93A022")&&e.length>=406&&r==="v205c"||e.includes("P93A800")&&e.length>=406&&r==="v205c"||e.includes("P93A022")&&e.length>=406&&r==="move2500"||e.includes("P93A800")&&e.length>=406&&r==="move2500"||e.includes("P93A022")&&e.length>=406&&r==="lane3000"||e.includes("P93A800")&&e.length>=406&&r==="lane3000"){let a=e;n==="verifone"&&(a=e.replace("006P93A00.","").substring(e.indexOf("P93A"),e.indexOf("P93A")+7)),e.includes("P81APROCESANDO, NO RETIRE TARJETA")||e.includes("P81APROCESANDO TARJETA")||a.includes("P93A022")||a.includes("P81AINSERTE CHIP O DESLICE TARJETA")||a.includes("ACERQUE, INSERTE CHIP O DESLICE")||a.includes("P81AACERQUE, INSERTE CHIP O DESLICE TARJETA")?this.dispatch("pp:processing-card",{waiting:!0}):e.length>s&&this.#B(e)}}#N(t,e){const n=this.__pinPad__.constants.ETX;let r=e.replace("023P81AFAVOR RETIRAR TARJ.","").replace("020P81A DECLINADA EMV ","").replace("020P81A DECLINADA EMV ","");r=r.substring(r.indexOf("B")+2,r.indexOf(n)),r.includes("006E93A16")&&(r="01"),this.__pinPad__.operation.applyReverse=r==="01"&&this.__pinPad__.operation.responseMit._approved&&this.__pinPad__.config.otherLogin.executeReverse==="1",this.__pinPad__.waiting.statusSecondGenerateWaiting="resolved"}#B(t){const e=this.__pinPad__.constants.ETX,n=this.__pinPad__.about?.brand?.toLowerCase();let r,s,a,o,c;n==="verifone"?t=t.replace("006P93A00.","").replace("009P93A00","").replace("010P93A00B01v",""):t=t.replace("006P93A00,",""),this.__pinPad__.config.read.POSEM=t.substring(t.indexOf("P93A")+4,t.indexOf("B"));const u=this.__pinPad__.config.read.POSEM;if(u==="051"||u==="071"){if(this.__pinPad__.config.read.Chip="1",this.__pinPad__.config.read.PIN=t.substring(t.indexOf("C")+2,t.indexOf("D")),this.__pinPad__.config.read.AppId=t.substring(t.indexOf("G")+2,t.indexOf("H")),this.__pinPad__.config.read.AppIdLabel=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.Arqc=t.substring(t.indexOf("F")+2,t.indexOf("G")),t.includes("O")){const l=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=l.substring(l.indexOf("M")+2,l.indexOf("N")),this.__pinPad__.operation.hasQPS=l.substring(l.indexOf("N")+2,l.indexOf("O"))==="1",this.__pinPad__.operation.bin8=l.substring(l.indexOf("O")+2,l.indexOf(e))}else if(t.includes("N")){const l=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=l.substring(l.indexOf("M")+2,l.indexOf("N")),this.__pinPad__.operation.hasQPS=l.substring(l.indexOf("N")+2,l.indexOf(e))==="1"}else{const l=t.substring(t.indexOf("P93A"),t.indexOf("M")+5);this.__pinPad__.config.read.ReadCTLS=l.substring(l.indexOf("M")+2,l.indexOf(e)),this.__pinPad__.operation.hasQPS=!1}this.__pinPad__.config.read.Tags=t.substring(t.indexOf("B")+2,t.indexOf("C")),this.__pinPad__.config.read.NB_ksn=t.substring(t.indexOf("K")+2,t.indexOf("M")),this.__pinPad__.config.read.NB_Data=t.substring(t.indexOf("D")+2,t.indexOf("E")),s=t.substring(t.indexOf("I")+2,t.indexOf("J")),a=t.substring(t.indexOf("E")+2,t.indexOf("F")),this.__pinPad__.config.read.ChipName=a,r=t.substring(t.indexOf("J")+2,t.indexOf("K"))}else{let l;if(this.__pinPad__.config.read.Chip="0",this.__pinPad__.config.read.PIN="",this.__pinPad__.config.read.AppId="",this.__pinPad__.config.read.Arqc="",this.__pinPad__.config.read.ReadCTLS="0",this.__pinPad__.config.read.AppIdLabel=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.Tags=t.substring(t.indexOf("B")+2,t.indexOf("C")),u==="022")if(t.includes("O")){const f=t.substring(t.indexOf("P93A"));this.__pinPad__.operation.bin8=f.substring(f.indexOf("O")+2,f.indexOf(e)),l=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),l=l.substring(l.indexOf("I")+2,l.lastIndexOf(""))}else l=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),l=l.substring(l.indexOf("I")+2,l.indexOf(e));else l=t.substring(t.indexOf("P93A800"),t.indexOf("I")+23),l=l.substring(l.indexOf("I")+2,l.indexOf(e));this.__pinPad__.config.read.NB_ksn=l,this.__pinPad__.config.read.NB_Data=t.substring(t.indexOf("B")+2,t.indexOf("C")),s=t.substring(t.indexOf("F")+2,t.indexOf("G")),r=t.substring(t.indexOf("G")+2,t.indexOf("H")),this.__pinPad__.about.model?.toLowerCase()==="vx520"?(a=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=a):(a=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=a)}r.includes("/")&&(r=r.replace("/","")),r.toString().length===4?(c=r.toString().substring(0,2),o=r.toString().substring(2)):(c="",o=""),this.__pinPad__.config.read.Chip==="1"?(this.__pinPad__.config.read.EMV="3",this.__pinPad__.config.read.ChipNameEnc="1"):(this.__pinPad__.config.read.ChipNameEnc="",this.__pinPad__.config.read.EMV="2"),this.__pinPad__.config.read.AppIdLabel.toLowerCase().includes("american")||this.__pinPad__.config.read.AppIdLabel.toLowerCase().includes("amex")?this.__pinPad__.config.read.Type="AMEX":this.__pinPad__.config.read.Type="V/MC",this.__pinPad__.operation.bin=s,s.length>6&&(this.__pinPad__.operation.bin=s.substring(0,6)),this.__pinPad__.waiting.statusReadCardWaiting="resolved",this.dispatch("pp:read-card",{ERROR:"",maskPan:s,name:a,month:c,year:o})}#x(t,e){e.length>10&&e.includes("E93A10")&&(this.__pinPad__.waiting.statusReadCardWaiting==="pending"&&(this.__pinPad__.waiting.statusReadCardWaiting="rejected"),this.dispatch("pp:error",{message:"Operation cancelled by user."}))}#L(t,e){if(this.__pinPad__.about.model?.toLowerCase()==="vx520"){if(e.length>11)if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(()=>{this.print("client").then(()=>{}).catch(n=>{console.error(n)})},1e3):this.dispatch("pp:print",{type:"success"});else{const n=e.includes("E17")||e.includes("A17")?{type:"warning",message:"printer without paper"}:{type:"error",message:"The voucher could not be printed"};this.dispatch("pp:print",n)}}else if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(()=>{this.print("client").then(()=>{}).catch(n=>{console.error(n)})},1e3):this.dispatch("pp:print",{type:"success"});else{const n=e.includes("E17")||e.includes("A17")?{type:"warning",message:"printer without paper"}:{type:"error",message:"The voucher could not be printed"};this.dispatch("pp:print",n)}}#U(t,e){console.log(t,e)}#V(t,e){console.log(t,e)}serialMessage(t){const e={original_code:t,code:null,name:null,description:null,request:this.lastAction,no_code:0,parsed:null},n=this.parseHexToUint8(t),r=this.parseUint8ArrayToString(n),s=this.#R(r);switch(this.__pinPad__.buffer=r,e.parsed=s,e.code=r,e.request){case"connect":e.name="connected",e.description="Connection established",e.no_code=100,this.#f(s,r);break;case"about":e.name="About PinPad",e.description="Response of about",e.no_code=101,this.#f(s,r);break;case"inject":this.dispatch("pp:sale-process",{step:"inject",message:"Injecting values..."}),e.name="Inject",e.description="Response of inject values",e.no_code=102,this.#C();break;case"init-dukpt":this.dispatch("pp:sale-process",{step:"dukpt-init",message:"Initializing DUKPT..."}),e.name="Init DUKPT",e.description="Response of init DUKPT",e.no_code=103,this.#O(s,r);break;case"dukpt":this.dispatch("pp:sale-process",{step:"dukpt-written",message:"Written DUKPT..."}),e.name="Write DUKPT",e.description="Response of write DUKPT",e.no_code=104,this.#D();break;case"read-card":e.name="read card",e.description="response of read card",e.no_code=105,this.#I(s,r);break;case"second-generate":e.name="second generate",e.description="response of second generate",e.no_code=106,this.#N(s,r);break;case"cancel":e.name="cancel pinpad",e.description="response of cancel",e.no_code=107;break;case"print":this.#L(s,r),e.name="print voucher",e.description="response of print",e.no_code=108;break;case"cancel-read-card":this.#x(s,r),e.name="cancel read card",e.description="response of cancel read card",e.no_code=109;break;case"code93":this.#U(s,r),e.name="code 93",e.description="response of code 93",e.no_code=110;break;case"finish-emv-end":this.#V(s,r),e.name="Finish EMV End",e.description="response of finish EMV End",e.no_code=111;break;default:e.name="unknown",e.description="Unknown command",e.no_code=400;break}this.dispatch("serial:message",e)}serialSetConnectionConstant(){let n="C56AABOUT";n=""+n.length.toString().padStart(3,"0")+n+"";let r=0;for(let a=0;a<n.length;a++)r^=n.charCodeAt(a);n=n+String.fromCharCode(r);const s=this.parseStringToBytes(n,"");return this.add0x(s)}async sendCustomCode({code:t=""}={}){if(typeof t!="string")throw new Error("Invalid string");const e=this.parseStringToBytes(t);await this.appendToQueue(e,"custom")}set username(t){this.__pinPad__.config.username=t}get username(){return this.__pinPad__.config.username}set password(t){if(typeof t!="string")throw new Error("Invalid password");this.__pinPad__.config.password=t.toUpperCase()}get password(){return this.__pinPad__.config.password}set amount(t){if(t=parseFloat(t),isNaN(t)||t<=0)throw new Error("Invalid amount");this.__pinPad__.operation.amount=t.toFixed(2).toString()}get amount(){return parseFloat(this.__pinPad__.operation.amount)||0}set reference(t){if(!this.#g(t.trim()))throw new Error("Invalid reference");this.__pinPad__.operation.reference=t.trim().toString().replaceAll(" ","").toUpperCase()}get reference(){return this.__pinPad__.operation.reference||""}get url(){const t=this.environment;return this.__pinPad__.constants.urls[t]}get version(){return{name:this.__pinPad__.constants.appName,version:this.__pinPad__.constants.appVersion,environment:this.environment,type:this.typeDevice}}set environment(t){const e=["development","qa","production","productionAlternative"];if(typeof t!="string"||!e.includes(t.toLowerCase()))throw new Error("The environment must be a string, in: "+e.join(", "));this.__pinPad__.config.defaultEnvironment=t.toLowerCase(),this.__pinPad__.config.environment=t.toLowerCase()}get defaultEnvironment(){return this.__pinPad__.config.defaultEnvironment}get environment(){return this.__pinPad__.config.environment}get latitudeLongitude(){return{latitude:this.__pinPad__.config.latitude,longitude:this.__pinPad__.config.longitude}}set timeoutPinPad(t){if(t=parseInt(t),isNaN(t)||t<=10||t>=300)throw new Error("Invalid timeout please use a number between 10 and 300 seconds");this.__pinPad__.config.timeoutPinPad=t.toString()}get timeoutPinPad(){return parseInt(this.__pinPad__.config.timeoutPinPad)}#s(t,e){const n=new ci;return n.setPublicKey(t),n.encrypt(e)}#a(t){const e="0123456789ABCDEF";let n="";for(let r=0;r<t;r++){const s=Math.floor(Math.random()*e.length);n+=e.substring(s,s+1)}return n}#M(t){const e="0123456789abcdef",n=[],r=[];for(let s=0;s<256;s++)n[s]=e.charAt(s>>4)+e.charAt(s&15);for(let s=0;s<t.length;s++)r[s]=n[t.charCodeAt(s)];return r.join("")}async#o(t,e){const n=t.match(/.{1,2}/g)||[],r=new Uint8Array(n.map(d=>parseInt(d,16))),s=crypto.getRandomValues(new Uint8Array(16)),o=new TextEncoder().encode(e),c=await crypto.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt"]),u=await crypto.subtle.encrypt({name:"AES-CBC",iv:s},c,o),l=btoa(String.fromCharCode(...s)),f=btoa(String.fromCharCode(...new Uint8Array(u)));return l+f}#F(t,e,n=!1){const r=[];for(let u=0;u<256;u++)r[u]=u;let s=0;for(let u=0;u<256;u++)s=(s+r[u]+t.charCodeAt(u%t.length))%256,[r[u],r[s]]=[r[s],r[u]];let a=0,o=0,c="";for(const u of e){a=(a+1)%256,o=(o+r[a])%256,[r[a],r[o]]=[r[o],r[a]];const l=r[(r[a]+r[o])%256];c+=String.fromCharCode(u.charCodeAt(0)^l)}return n?this.#M(c).toUpperCase():c}#i(t,e){return this.#F(t,this.hexToAscii(e))}#k(t){return t.replaceAll("Á","A"),t.replaceAll("É","E"),t.replaceAll("Í","I"),t.replaceAll("Ó","O"),t.replaceAll("Ú","U"),t.replaceAll("á","a"),t.replaceAll("é","e"),t.replaceAll("í","i"),t.replaceAll("ó","o"),t.replaceAll("ú","u"),t.replaceAll("ñ","n"),t.replaceAll("Ñ","N"),t.replaceAll('Electr?a"',"Electronica"),t}#t(t,e,n){if(t=t.replace("@cnb logo_cpagos",e),t=t.replace("@cnn ver_app",n),t=t.replace(/@/g," @"),t=t.replace(/ {2}@/g," @"),t=t.replace(/ {3}@/g," @"),t=t.replace(/\r/g,""),t=t.replace(/\n/g,""),t.includes("@lsn POR ESTE PAGARE ME OBLIGO INCONDI")){const r=t.indexOf("@lsn POR ESTE PAGARE ME OBLIGO INCONDI");t=t.substring(0,r)}return t.trim()+"@br @br @br @br @br"}#j(t,e){const n="@logo3 @br",r="@cnn "+e;return t.includes("@cnb Santander")?(t=t.replace("@cnb Santander","@logo1@br"),this.#t(t,n,r)):t.includes("@cnb American Express")?(t=t.replace("@cnb American Express","@logo2@br"),this.#t(t,n,r)):t.includes("@cnb HSBC")?(t=t.replace("@cnb HSBC","@logo7@br"),this.#t(t,n,r)):t.includes("@cnb IXE")?(t=t.replace("@cnb IXE","@logo11@br"),this.#t(t,n,r)):t.includes("@cnb MULTIVA")?(t=t.replace("@cnb MULTIVA","@logo15@br"),this.#t(t,n,r)):t.includes("@cnb Multiva")?(t=t.replace("@cnb Multiva","@logo15@br"),this.#t(t,n,r)):t.includes("@cnb SCOTIA BANK")?(t=t.replace("@cnb SCOTIA BANK","@logo16@br"),this.#t(t,n,r)):t.includes("@cnb SCOTIABANK")?(t=t.replace("@cnb SCOTIABANK","@logo16@br"),this.#t(t,n,r)):t.includes("@cnb BANCOMER")?(t=t.replace("@cnb BANCOMER","@logo17@br"),this.#t(t,n,r)):t.includes("@cnb Bancomer")?(t=t.replace("@cnb Bancomer","@logo17@br"),this.#t(t,n,r)):t.includes("@cnb BBVA")?(t=t.replace("@cnb BBVA","@logo17@br"),this.#t(t,n,r)):t.includes("@cnb BANORTE")?(t=t.replace("@cnb BANORTE","@logo18@br"),this.#t(t,n,r)):t.includes("@cnb Banorte")?(t=t.replace("@cnb Banorte","@logo18@br"),this.#t(t,n,r)):t.includes("@cnb BANREGIO")?(t=t.replace("@cnb BANREGIO","@logo19@br"),this.#t(t,n,r)):t.includes("@cnb Banregio")?(t=t.replace("@cnb Banregio","@logo19@br"),this.#t(t,n,r)):t.includes("@cnb GETNET")?(t=t.replace("@cnb GETNET","@logo20@br"),this.#t(t,n,r)):t.includes("@cnb GetNET")?(t=t.replace("@cnb GetNET","@logo20@br"),this.#t(t,n,r)):this.#t(t,n,r)}async#q(t=!1){if(this.#K(),this.__pinPad__.config.loginResponse&&!t)return await this.#p();const e=this.url+this.__pinPad__.constants.uris.login,n={usuario:this.username,password:this.password,crypto:"",version:this.__pinPad__.constants.appVersion,serieLector:"",canal:this.__pinPad__.constants.appChannel};if(await this.#c(),this.#d())throw new Error("Empty RSA Key");const r=this.#a(32),s=this.#s(this.__pinPad__.config.publicKeyRSA||"",r),a=await this.#o(r,JSON.stringify(n)),o=await C.post(e,a,{headers:{"Content-Type":"application/json","cache-control":"no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0",data:s||""}}).catch(l=>{throw new Error(`Error in request, verify internet connection: ${l.response?.status} ${l.message}`)}),c=this.#b(JSON.stringify(o.data));let u=c;if(typeof c=="string"&&(u=JSON.parse(c)),!u)throw new Error("Invalid response JSON");if(u.RESPUESTA==="error")throw new Error(u);return this.__pinPad__.config.loginResponse=u,localStorage.setItem("ppLoginResponse",JSON.stringify({timestamp:new Date().getTime(),data:u})),await this.#p()}async#p(){await this.#G();try{await this.getPosition()}catch(t){console.log("Error getting position",t)}return this.__pinPad__.config.otherLogin={},this.#H(this.__pinPad__.config.loginResponse),this.__pinPad__.config.otherLogin}#H(t){let e="",n="";t.xml?.ventaspropias?.merchant_currencyb&&(e=t.xml.ventaspropias.merchant_currencyb),t.xml?.ventaspropias?.merchant_currencym&&(n=t.xml.ventaspropias.merchant_currencym);let r=t.xml?.emvReverso;r||(r="0");const s=t.xml?.st_tokenizacion;!s||s==="false"||s==="0"?this.__pinPad__.config.internal.stTokenization=!1:this.__pinPad__.config.internal.stTokenization&&(this.__pinPad__.config.internal.stTokenization=!0),this.__pinPad__.config.internal.emv=t.xml.importesPGS,this.__pinPad__.config.internal.qpsDomestic=this.__pinPad__.config.internal.emv.qps_dom,this.__pinPad__.config.internal.qpsInternational=this.__pinPad__.config.internal.emv.qps_il,this.__pinPad__.config.internal.cvmlVMCDomestic=this.__pinPad__.config.internal.emv.cvml_vm_dom,this.__pinPad__.config.internal.cvmlVMCInternational=this.__pinPad__.config.internal.emv.cvml_vm_il,this.__pinPad__.config.internal.cvmlAmex=this.__pinPad__.config.internal.emv.cvml_amex,this.__pinPad__.config.internal.translimitCTLSVMC=this.__pinPad__.config.internal.emv.tl_mc,this.__pinPad__.config.internal.translimitCTLSAmex=this.__pinPad__.config.internal.emv.tl_amex,this.__pinPad__.config.country=t.country.toUpperCase(),this.__pinPad__.config.idBranch=t.id_branch.toUpperCase(),this.__pinPad__.config.idCompany=t.id_company.toUpperCase(),this.__pinPad__.config.otherLogin={bsUser:t.user,nbUser:t.nb_user,bsCompany:t.id_company,nbCompany:t.nb_company,nbStreetCompany:t.nb_companystreet,bsBranch:t.id_branch,nbBranch:t.nb_branch,bsCountry:t.country,coins:e,coinsMOTO:n,executeReverse:r}}#K(){const t=localStorage.getItem("ppLoginResponse");let e=null;t&&(e=JSON.parse(t),this.__pinPad__.config.loginResponse||(this.__pinPad__.config.loginResponse=e?.data),new Date().getTime()-e?.timestamp>=864e5&&(this.__pinPad__.config.loginResponse=null))}async login({force:t=!1}={}){return await this.#q(t)}async#W(){const t=this.url+this.__pinPad__.constants.uris.RSAKey,e=await C.get(t).catch(r=>{throw new Error(`Error in request, verify internet connection: ${r.response.status} ${r.message}`)});if(!e)return"";const n=e.headers;if(!n)return"";if(n.get("content-type").indexOf("application/json")===-1)throw new Error("Fail to fetch RSA public key");return this.__pinPad__.config.publicKeyRSA=e.data.key_public,localStorage.setItem("ppRSAKey",JSON.stringify({timestamp:new Date().getTime(),data:e.data.key_public})),this.__pinPad__.config.publicKeyRSA}clearSession(){localStorage.removeItem("ppLoginResponse"),localStorage.removeItem("ppRSAKey"),localStorage.removeItem("ppPublicIP"),localStorage.removeItem("ppGeolocation")}#d(){const t=localStorage.getItem("ppRSAKey");if(!t)return!0;const e=JSON.parse(t);return!e.data||(this.__pinPad__.config.publicKeyRSA=e.data,new Date().getTime()-e.timestamp>=864e5)?!0:!this.__pinPad__.config.publicKeyRSA}async#_(){return this.#d()?await this.#W():this.__pinPad__.config.publicKeyRSA}async#c(){if(!await this.#_())throw new Error("RSA public key is empty")}#g(t){return/^[A-Z-a-z0-9\s]+$/g.test(t)}#X(t){if(x.isEmpty(t))return!0;const e=/^[A-Z-a-z0-9\s]+$/g.test(t)===!0;if(!e)throw new Error("Invalid reference");return e}#e(t){return t.length.toString().padStart(3,"0")}#n(t){let e=0;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n);return String.fromCharCode(e)}#l(t,e=0){return t=parseFloat(t.toString().replace(/[^0-9.-]/g,"")),isNaN(t)?0 .toFixed(e):t.toFixed(e).replace(/,/g,"")}#m(t){return t=parseFloat(t.toString()),!(isNaN(t)||t<0)}async#u(t){for(const e in t)if(typeof t[e]>"u"||t[e]===null||t[e]==="")throw new Error("Object incomplete to process");return t}#y(t){if(!t||isNaN(parseInt(t))||t.toString().length!==9)throw new Error("Number of operation must be number of 9 digits");return t}#b(t){if(typeof t!="string")throw new Error("Invalid string");return!t||/<html(?:\s+lang=["'][^"']*["'])?>/i.test(t)||(t=t.replace(/aaa/g,"á"),t=t.replace(/eee/g,"é"),t=t.replace(/iii/g,"í"),t=t.replace(/ooo/g,"ó"),t=t.replace(/uuu/g,"ú"),t=t.replace(/NNN/g,"Ñ"),t=t.replace(/nnn/g,"ñ"),t=t.replace(/á/g,"á")),t}async#z(){const t=this.__pinPad__.constants.STX,e=this.__pinPad__.constants.ETX;let n="C55ACANCEL";n=t+this.#e(n)+n+e,n=n+this.#n(n);const r=this.parseStringToBytes(n,"");await this.appendToQueue(r,"cancel")}#P(){const t=new Date,e=t.getDate().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),r=t.getFullYear().toString().substring(2);return e+n+r}#E(){const t=new Date,e=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");return e+n}async checkPositionPermission(){if(!x.supportGeolocation())throw new Error("Geolocation not supported");return new Promise((t,e)=>{navigator.permissions.query({name:"geolocation"}).then(n=>{n.state==="granted"?t(!0):t(!1)}).catch(()=>e(!1))})}async getPosition(){const t="ppGeolocation";if(!this.__pinPad__.config.latitude||!this.__pinPad__.config.longitude){const r=localStorage.getItem(t);if(r)try{const s=JSON.parse(r);s.data?.latitude&&s.data?.longitude&&(this.__pinPad__.config.latitude=s.data.latitude,this.__pinPad__.config.longitude=s.data.longitude)}catch{localStorage.removeItem(t)}}const n=localStorage.getItem(t);if(n)try{const r=JSON.parse(n);if(new Date().getTime()-r.timestamp<864e5&&r.data?.latitude&&r.data?.longitude)return this.__pinPad__.config.latitude=r.data.latitude,this.__pinPad__.config.longitude=r.data.longitude,this.latitudeLongitude}catch{localStorage.removeItem(t)}return x.supportGeolocation()?new Promise(r=>{navigator.permissions.query({name:"geolocation"}).then(s=>{s.state==="granted"?navigator.geolocation.getCurrentPosition(a=>{this.__pinPad__.config.latitude=a.coords.latitude,this.__pinPad__.config.longitude=a.coords.longitude,localStorage.setItem(t,JSON.stringify({timestamp:new Date().getTime(),data:{latitude:a.coords.latitude,longitude:a.coords.longitude}})),r(this.latitudeLongitude)},()=>{r(this.latitudeLongitude)},{enableHighAccuracy:!1,timeout:5e3,maximumAge:6e4}):r(this.latitudeLongitude)}).catch(()=>r(this.latitudeLongitude))}):this.latitudeLongitude}async#G(){const e=localStorage.getItem("ppPublicIP");let n=null,r=!1;if(e)try{const c=JSON.parse(e);if(n=c.data||null,this.__pinPad__.config.publicIP=n,new Date().getTime()-c.timestamp<864e5)return this.__pinPad__.config.publicIP;r=!0}catch{localStorage.removeItem("ppPublicIP")}let s=!1;const a=await C.get("https://api.ipify.org?format=json").catch(()=>s=!0);if(s||typeof a!="object"||!a||!a.data)return r&&n?this.__pinPad__.config.publicIP:(this.__pinPad__.config.publicIP=null,null);const o=a.data||{};return this.__pinPad__.config.publicIP=o.ip||null,localStorage.setItem("ppPublicIP",JSON.stringify({timestamp:new Date().getTime(),data:o.ip})),this.__pinPad__.config.publicIP}async cancelReadCard(){let t="012VXVCANCELl";this.__pinPad__.about.model?.toLowerCase()==="ingenico"&&(t="029C50AOPERACION CANCELADA");const e=this.parseStringToBytes(t,"");await this.appendToQueue(e,"cancel-read-card")}async print(t="client"){this.__pinPad__.operation.errors=0;const e=this.__pinPad__.constants.STX,n=this.__pinPad__.constants.ETX;this.__pinPad__.operation.commerceVoucher.includes(":")||(this.__pinPad__.operation.commerceVoucher=this.#i(this.__pinPad__.config.RC4Key,this.__pinPad__.operation.commerceVoucher)),this.__pinPad__.operation.clientVoucher.includes(":")||(this.__pinPad__.operation.clientVoucher=this.#i(this.__pinPad__.config.RC4Key,this.__pinPad__.operation.clientVoucher));let r=t==="client"?this.__pinPad__.operation.clientVoucher:this.__pinPad__.operation.commerceVoucher;if(r.length===0){this.dispatch("pp:print",{error:!0,code:"001",message:"Without information to print"});return}r=this.#k(r),r=this.#j(r,this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion);let s="C59A"+r;s=e+this.#e(s)+s+n,s=s+this.#n(s),t==="client"?this.__pinPad__.operation.clientVoucher="":t==="commerce"&&(this.__pinPad__.operation.commerceVoucher="");const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"print")}async#r(t,e){await this.#c();const n=this.#a(32),r=this.#s(this.__pinPad__.config.publicKeyRSA||"",n),s=await this.#o(n,JSON.stringify(e));return(await C.post(t,s,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:r||""}}).catch(o=>{throw o.response.data.includes("Ha ocurrido un error al procesar su solicitud.")?new Error("It was not possible to obtain the affiliations."):o.response.status>=500&&o.response.status<=599?new Error(`Service Temporarily Unavailable ${o.message}`):new Error(`Error in request, verify internet connection: ${o.response?.status} ${o.message}`)})).data}async#w({data:t,url:e,cancelable:n=!1}={data:null,url:"",cancelable:!1}){await this.#c();const r=this.#a(32),s=this.#s(this.__pinPad__.config.publicKeyRSA||"",r),a=await this.#o(r,JSON.stringify(t)),o=this;return(await C.post(e,a,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:s||""}}).catch(async u=>{let l;throw u.code==="ERR_NETWORK"&&u.name==="AxiosError"&&(l=`Error in request, verify internet connection: ${u.code} ${u.message}`),u.status&&u.response&&(l=`Error in request, verify internet connection: ${u.status} ${u.message}`,u.response.status>=500&&u.response.status<=599?l="Service Temporarily Unavailable":u.response.status>=400&&u.response.status<=499&&(l="Bad Request")),n&&await o.#z(),o.dispatch("pp:error",{error:!0,code:u.response?.status||"NETWORK_ERROR",message:l}),new Error(l)})).data}async#$(){const t=this.__pinPad__.constants.FS,e=this.__pinPad__.constants.ETX,n=this.__pinPad__.constants.STX;let r="C57A"+this.__pinPad__.config.internal.qpsDomestic;if(r=r+t+"B"+this.__pinPad__.config.internal.qpsInternational,r=r+t+"C"+this.__pinPad__.config.internal.cvmlVMCDomestic,r=r+t+"D"+this.__pinPad__.config.internal.cvmlVMCInternational,r=r+t+"E"+this.__pinPad__.config.internal.cvmlAmex,r=r+t+"F"+this.__pinPad__.config.internal.translimitCTLSVMC,r=r+t+"G"+this.__pinPad__.config.internal.translimitCTLSAmex,r=n+this.#e(r)+r+e,r=r+this.#n(r),!this.__pinPad__.about.injectedValues){const s=this.parseStringToBytes(r,"");await this.appendToQueue(s,"inject")}}async#J(){this.__pinPad__.operation.bin8&&(this.__pinPad__.operation.bin=this.__pinPad__.operation.bin8),this.__pinPad__.operation.bin8="";const t=await this.#w({data:{accion:"tipoPagoInfo",cc_num:this.__pinPad__.operation.bin,usuario:this.username?.toUpperCase(),canal:this.__pinPad__.constants.typeChannel,tp_canal:"1",tp_moneda:this.__pinPad__.config.currency.toUpperCase()},url:this.url+this.__pinPad__.constants.uris.merchant,cancelable:!0});if(!t.respuesta||t.respuesta==="0"){let e="C55ACANCEL";const n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;e=n+this.#e(e)+e+r,e=e+this.#n(e);const s=this.parseStringToBytes(e,"");return await this.appendToQueue(s,"cancel"),!1}return this.__pinPad__.operation.merchant=t,this.__pinPad__.operation.onlyMerchant=t.contado.af.length>1?t.contado.af[0].merchant:t.contado.af.merchant,!0}async#Q(t=null){if(this.__pinPad__.waiting.statusAboutWaiting)throw new Error("AboutPP is already running");const e=this.__pinPad__.constants.STX,n=this.__pinPad__.constants.ETX;let r="C56AABOUT";if(r=e+this.#e(r)+r+n,r=r+this.#n(r),x.isEmpty(this.__pinPad__.about.pp)){this.__pinPad__.waiting.statusAboutWaiting="pending";const a=this.parseStringToBytes(r,"");await this.appendToQueue(a,"about")}else return t?t(this.__pinPad__.about.pp?.supportDUKPT||!1,this.__pinPad__.about.pp?.hasDUKPTKeys||!1):!0;let s=0;return new Promise((a,o)=>{s=setInterval(()=>{if(this.__pinPad__.waiting.statusAboutWaiting==="resolved"){if(clearInterval(s),this.__pinPad__.waiting.statusAboutWaiting=null,x.isEmpty(this.__pinPad__.about.pp))return;if(!t||typeof t!="function"){a(!0);return}const c=t(this.__pinPad__.about.pp?.supportDUKPT||!1,this.__pinPad__.about.pp?.hasDUKPTKeys||!1);a(c)}else this.__pinPad__.waiting.statusAboutWaiting==="rejected"&&(clearInterval(s),this.__pinPad__.waiting.statusAboutWaiting=null,o("Error"))},500)})}async#h(t,e){if(t=t?t.toString():"",e=e?e.toString():"",x.isEmpty(t)||t==="0"){this.dispatch("pp:dukpt",{status:"unsupported",already:!1});return}if(x.isEmpty(e)||e==="1"){this.dispatch("pp:dukpt",{status:"charged",already:!0});return}const n=this.#P(),r=this.#E(),s=this.__pinPad__.constants.FS,a=this.__pinPad__.constants.ETX,o=this.__pinPad__.constants.STX;let c="C91A"+n+s+"B"+r;c=o+this.#e(c)+c+a,c=c+this.#n(c);const u=this.parseStringToBytes(c,"");await this.appendToQueue(u,"init-dukpt");let l=0;return this.__pinPad__.waiting.statusinitDUKPTWaiting="pending",new Promise((f,d)=>{l=setInterval(async()=>{this.__pinPad__.waiting.statusinitDUKPTWaiting==="resolved"?(clearInterval(l),this.__pinPad__.waiting.statusinitDUKPTWaiting=null,this.dispatch("pp:dukpt",{status:"charged",already:!1}),await this.#Z(),f(!0)):this.__pinPad__.waiting.statusinitDUKPTWaiting==="rejected"&&(clearInterval(l),this.__pinPad__.waiting.statusinitDUKPTWaiting=null,d("Error"))},500)})}async#Z(){const t={IPEK_REQUESTType:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},terminal:this.__pinPad__.config.terminal}},e=await this.#w({data:t,url:this.url+this.__pinPad__.constants.uris.keysDUKPT});await this.#lt(e)}async#Y(){if(!await this.#_())throw new Error("RSA public key is empty");const e=this;await this.#Q(async function(r,s){if(e.__pinPad__.about.supportInjection&&e.__pinPad__.config.internal.emv&&e.__pinPad__.about.injectedValues)return await e.#h(r,s),!0;let a=0;return e.__pinPad__.waiting.statusInjectWaiting="pending",await e.#$(),new Promise((o,c)=>{a=setInterval(async()=>{e.__pinPad__.waiting.statusInjectWaiting==="resolved"?(clearInterval(a),e.__pinPad__.waiting.statusInjectWaiting=null,await e.#h(r,s),o(!0)):e.__pinPad__.waiting.statusInjectWaiting==="rejected"&&(clearInterval(a),e.__pinPad__.waiting.statusInjectWaiting=null,c("Error"))},500)})})}#v(t,e=0){if(t=parseFloat(t.toString().replace(/[^0-9.-]/g,"")),isNaN(t)||t===0)return parseFloat("0").toFixed(e);t=t.toFixed(e);const n=t.split(".");return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,""),n.join(".")}getClientVoucher(){return this.__pinPad__.operation.clientVoucher}getCommerceVoucher(){return this.__pinPad__.operation.commerceVoucher}async#tt(){this.__pinPad__.operation.errors=0;let t="ACERQUE, INSERTE CHIP O DESLICE TARJETA";if(this.__pinPad__.about.supportContactless||(t="INSERTE CHIP O DESLICE TARJETA"),this.__pinPad__.about.model?.toUpperCase().includes("UX300")&&(t="ACERQUE O INSERTE TARJETA"),x.isEmpty(this.amount)||isNaN(parseFloat(this.amount)))throw new Error("Amount required");if(parseFloat(this.amount)<=0)throw new Error("Amount must be greater than 0");if(this.#m(this.amount)===!1)throw new Error("Invalid amount required");if(parseFloat(this.#l(this.amount,2))<=0)throw new Error("Amount must be greater than 0");const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C93A"+t;s=s+e+"B"+this.#P(),s=s+e+"C"+this.#E(),s=s+e+"D"+this.#l(this.amount,2),s=s+e+"E0.00",s=s+e+"F"+this.__pinPad__.config.currencyCode,this.__pinPad__.about.supportDUKPT&&this.__pinPad__.about.supportDUKPT!=="0"&&this.__pinPad__.about.supportDUKPT!=="false"&&(this.__pinPad__.about.supportContactless?(s=s+e+"G"+this.timeoutPinPad,s=s+e+"HTAGS",s=s+e+"I"+this.__pinPad__.config.requireCVVAmex,s=s+e+"J"+this.__pinPad__.config.forceOnline,s=s+e+"K"+this.__pinPad__.about.supportContactless,s=s+e+"L"+this.__pinPad__.config.emvCard,this.__pinPad__.about.hasCashback&&(s=s+e+"M0",s=s+e+"N00")):(s=s+e+"G"+this.timeoutPinPad,s=s+e+"HTAGS",s=s+e+"I"+this.__pinPad__.config.requireCVVAmex,s=s+e+"L"+this.__pinPad__.config.emvCard),this.__pinPad__.about.supportInjection&&(s=s+e+"O"+this.__pinPad__.config.validateQPS)),s=n+this.#e(s)+s+r,s=s+this.#n(s),this.#ht();const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"read-card");let o=0;return this.__pinPad__.waiting.statusReadCardWaiting="pending",new Promise((c,u)=>{o=setInterval(()=>{if(this.__pinPad__.waiting.statusReadCardWaiting==="resolved")clearInterval(o),this.__pinPad__.waiting.statusReadCardWaiting=null,c(!0);else if(this.__pinPad__.waiting.statusReadCardWaiting==="rejected"){clearInterval(o),this.__pinPad__.waiting.statusReadCardWaiting=null;const l=this.__pinPad__.operation.last_error;u(l??"Error reading card")}},500)})}async#et(t){return await x.wait(t*1e3)}async consult({reference:t=null}={reference:null}){return t||(t=this.reference),x.isEmpty(t)&&(t="--",this.reference=t),this.#X(this.reference),this.__pinPad__.operation.consultDate=new Date().toLocaleDateString("en-GB"),await this.#u({Ambiente:this.environment,User:this.username,Pwd:this.password,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,Country:this.__pinPad__.config.country,Tx_Date:this.__pinPad__.operation.consultDate}),this.#r(this.url+this.__pinPad__.constants.uris.consult,{user:this.username?.toUpperCase(),pwd:this.password?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),date:this.__pinPad__.operation.consultDate,reference:this.reference})}async#nt(t){let e=this.url+this.__pinPad__.constants.uris.consult;return t>1&&this.environment==="production"&&(e=e.replace(this.__pinPad__.constants.urls.production,this.__pinPad__.constants.urls.productionAlternative)),this.__pinPad__.operation.consultDate=new Date().toLocaleDateString("en-GB"),await this.#r(e,{user:this.username?.toUpperCase(),pwd:this.password?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),date:this.__pinPad__.operation.consultDate,reference:this.reference})}async#it(t="",e={}){let n=1,r=null;do{n>1&&this.environment==="production"&&(t=t.replace(this.__pinPad__.constants.urls.production,this.__pinPad__.constants.urls.productionAlternative),await this.#et(5)),await this.#c();const s=this.#a(32),a=this.#s(this.__pinPad__.config.publicKeyRSA||"",s),o=await this.#o(s,JSON.stringify(e));let c=!1;const u=await C.post(t,o,{headers:{"Content-Type":"application/json",data:a||""}}).catch(async l=>{let f=`Error in request, verify internet connection: ${l.status} ${l.message}`;l.response.status>=500&&l.response.status<=599?f="Service Temporarily Unavailable":l.response.status>=400&&l.response.status<=499&&(f="Bad Request"),console.warn(l),r=f;const d=await this.#nt(n);d&&d!=="{}"&&!d.includes('"transacciones":""')&&d.includes("nu_operaion")&&(n=5,r="EE32"),c=!0});if(!c){if(!u||typeof u!="object"||!u.data){r="It was not possible to obtain the affiliations.";continue}return u.data}}while(n++<=3);return r?Promise.reject(r):Promise.reject("Communication error with CDP. IL/MTY")}#rt(t){if(x.isEmpty(t))throw new Error("Number of authorization invalid");if(/^[A-Za-z0-9]+$/g.test(t)!==!0)throw new Error("Number of authorization invalid");if(t.length!==6)throw new Error("Number of authorization invalid");return!0}async rePrint({folio:t=null}={}){let e="";t===null&&(e=this.__pinPad__.operation.folio||""),this.#y(e),await this.#u({Ambiente:this.environment,User:this.username,Pwd:this.password,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,Country:this.__pinPad__.config.country,Tx_OperationNumber:e});const n=await this.#r(this.url+this.__pinPad__.constants.uris.rePrint,{REPRINTVOUCHER:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},no_operacion:t,crypto:"2"}});let r=n.voucher_comercio;return this.__pinPad__.operation.commerceVoucher="",r&&(n.voucher_comercio.includes(":")?this.__pinPad__.operation.commerceVoucher=n.voucher_comercio:this.__pinPad__.operation.commerceVoucher=this.#i(this.__pinPad__.config.RC4Key,n.voucher_comercio)),r=n.voucher_cliente,this.__pinPad__.operation.clientVoucher="",r&&(n.voucher_cliente.includes(":")?this.__pinPad__.operation.clientVoucher=n.voucher_cliente:this.__pinPad__.operation.clientVoucher=this.#i(this.__pinPad__.config.RC4Key,n.voucher_cliente)),n}#st(t){this.__pinPad__.operation.responseMit._approved=t.response==="approved",this.__pinPad__.operation.responseMit._status=t.response,this.__pinPad__.operation.responseMit._originalToken=t.number_tkn??"",this.__pinPad__.operation.folio=t.foliocpagos,this.__pinPad__.operation.authorization=t.auth;let e=t.cd_response?.toUpperCase();return e.toUpperCase()==="0C"||this.__pinPad__.operation.responseMit._approved?e="00":(e!=="Z3"&&e!=="05"||t.cd_error==="92")&&(e="01"),this.__pinPad__.operation.responseMit._cdResponse=e,this.__pinPad__.finishCommand.A=e,this.__pinPad__.finishCommand.B="",this.__pinPad__.finishCommand.C="",this.__pinPad__.finishCommand.D="",this.__pinPad__.finishCommand.E=t.emv_key_date?t.emv_key_date:"",this.__pinPad__.finishCommand.F=t.icc_csn?t.icc_csn:"",this.__pinPad__.finishCommand.G=t.icc_atc?t.icc_atc:"",this.__pinPad__.finishCommand.H=t.icc_arpc?t.icc_arpc:"",this.__pinPad__.finishCommand.I=t.icc_issuer_script?t.icc_issuer_script:"",this.__pinPad__.finishCommand.J=t.authorized_amount?t.authorized_amount:"",this.__pinPad__.finishCommand.K=t.account_balance_1?t.account_balance_1:"",{reference:t.reference,response:t.response,foliocpagos:t.foliocpagos,auth:t.auth,cd_response:e,cd_error:t.cd_error,nb_error:this.#b(t.nb_error??""),time:t.time,date:t.date,nb_company:t.nb_company,nb_merchant:t.nb_merchant,nb_street:t.nb_street,cc_type:t.cc_type,tp_operation:t.tp_operation,cc_name:t.cc_name,cc_number:t.cc_number,cc_expmonth:t.cc_expmonth,cc_expyear:t.cc_expyear,amount:t.amount,voucher_comercio:t.voucher_comercio,voucher_cliente:t.voucher_cliente,friendly_response:t.friendly_response,appid:t.appid,appidlabel:t.appidlabel,arqc:t.arqc}}async cancelPurchase({amount:t=0,authorization:e="",folio:n=""}={}){if(!this.#m(t))throw new Error("Invalid amount");if(!this.#rt(e))throw new Error("Invalid authorization");if(!this.#y(n))throw new Error("Invalid folio");const r=this.#v(t,2),s={Ambiente:this.environment,User:this.username,Pwd:this.password,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,Country:this.__pinPad__.config.country,UserTRX:"userPinpadWeb",Tx_OperationNumber:n,Tx_Auth:e,Amount:r};await this.#u(s);const a=await this.#r(this.url+this.__pinPad__.constants.uris.cancellation,{VMCAMEXMCANCELACION:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},transacction:{amount:t,auth:e.toUpperCase(),crypto:"2",no_operacion:n,usrtransacction:this.username?.toUpperCase(),version:this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion}}});return this.__pinPad__.operation.commerceVoucher="",a.voucher_comercio&&(a.voucher_comercio.includes(":")?this.__pinPad__.operation.commerceVoucher=a.voucher_comercio:this.__pinPad__.operation.commerceVoucher=this.#i(this.__pinPad__.config.RC4Key,a.voucher_comercio)),this.__pinPad__.operation.clientVoucher="",a.voucher_cliente&&(a.voucher_cliente.includes(":")?this.__pinPad__.operation.clientVoucher=a.voucher_cliente:this.__pinPad__.operation.clientVoucher=this.#i(this.__pinPad__.config.RC4Key,a.voucher_cliente)),JSON.stringify(a)}async#at(){this.__pinPad__.operation.errors=0,this.__pinPad__.operation.ignore.counterSale=!1;const t=this.__pinPad__.operation.onlyMerchant;if(/^[0-9]+$/.test(t)===!1)throw new Error("Invalid merchant");this.__pinPad__.operation.typeOperation="29";const e={error:!1,message:null,approved:!1,object:{}};try{const n=await this.#v(this.amount,2);await this.#u({Ambiente:this.environment,Country:this.__pinPad__.config.country,IdBranch:this.__pinPad__.config.idBranch,IdCompany:this.__pinPad__.config.idCompany,pwd:this.password,User:this.username,UserTRX:"userPinpadWeb",EMV:this.__pinPad__.config.read.EMV,ModeloTerminal:this.__pinPad__.about.model,SerieTerminal:this.__pinPad__.about.serial,Contactless:this.__pinPad__.about.supportContactless,Printer:this.__pinPad__.about.printer,VersionTerminal:this.__pinPad__.about.appVersion,TpOperation:this.__pinPad__.operation.typeOperation,Reference:this.reference,Amount:n,Currency:this.__pinPad__.config.currency,Merchant:t,Reverse:this.__pinPad__.config.otherLogin.executeReverse});let r=this.__pinPad__.about.supportContactless;typeof r=="string"&&(r=r!=="0");const s=this.__pinPad__.about.supportContactless&&r,a=await this.#it(this.url+this.__pinPad__.constants.uris.sale,{VMCAMEXB:{business:{country:this.__pinPad__.config.country?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),id_company:this.__pinPad__.config.idCompany?.toUpperCase(),pwd:this.password?.toUpperCase(),user:this.username?.toUpperCase()},dcc:{dcc_amount:"0",dcc_status:"0"},transacction:{amount:n,creditcard:{appid:this.__pinPad__.config.read.AppId,appidlabel:this.__pinPad__.config.read.AppIdLabel,arqc:this.__pinPad__.config.read.Arqc,chip:this.__pinPad__.config.read.Chip,chipname:this.__pinPad__.config.read.ChipName,chipnameenc:this.__pinPad__.config.read.ChipNameEnc,contactless:this.__pinPad__.config.read.ReadCTLS,crypto:"4",dukpt:{nb_data:this.__pinPad__.config.read.NB_Data,nb_ksn:this.__pinPad__.config.read.NB_ksn,tp_dukpt:"1"},pin:this.__pinPad__.config.read.PIN,posentrymode:this.__pinPad__.config.read.POSEM,tags:this.__pinPad__.config.read.Tags,type:this.__pinPad__.config.read.Type},currency:this.__pinPad__.config.currency.toUpperCase(),emv:this.__pinPad__.config.read.EMV,merchant:this.__pinPad__.operation.onlyMerchant,modelo_terminal:this.__pinPad__.about.model,reference:this.reference,serie:this.__pinPad__.about.serial,terminal:{display:"1",is_contactless:s?"1":"0",is_mobile:"0",printer:this.__pinPad__.about.printer},tp_operation:this.__pinPad__.operation.typeOperation,tp_resp:this.__pinPad__.operation.typeResponse,usrtransacction:this.username?.toUpperCase(),version:this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion,version_terminal:this.__pinPad__.about.appVersion},geolocation:{latitude:this.__pinPad__.config.latitude,longitude:this.__pinPad__.config.longitude,ip:this.__pinPad__.config.publicIP}}});a.response==="error"&&(e.error=!0,e.message=a.nb_error||"Error in response");const o=this.#st(a);return e.object=o,await this.#ot(o),e.approved=this.__pinPad__.operation.responseMit._approved,this.__pinPad__.operation.finalResult=o,e}catch(n){throw this.__pinPad__.finishCommand.A="01",this.__pinPad__.finishCommand.B="",this.__pinPad__.finishCommand.C="",this.__pinPad__.finishCommand.D="",this.__pinPad__.finishCommand.E="",this.__pinPad__.finishCommand.F="",this.__pinPad__.finishCommand.G="",this.__pinPad__.finishCommand.H="",this.__pinPad__.finishCommand.I="",this.__pinPad__.finishCommand.J="",this.__pinPad__.finishCommand.K="",await this.#ut(this.#T(n)),n}}async#ot(t){if(this.__pinPad__.config.read.POSEM==="022"||this.__pinPad__.config.read.POSEM==="800"||this.__pinPad__.config.read.ReadCTLS==="1")return this.dispatch("pp:finish-emv",t),!0;const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C93A"+this.__pinPad__.finishCommand.A;s=s+e+"B"+this.__pinPad__.finishCommand.B,s=s+e+"C"+this.__pinPad__.finishCommand.C,s=s+e+"D"+this.__pinPad__.finishCommand.D,s=s+e+"E"+this.__pinPad__.finishCommand.E,s=s+e+"F"+this.__pinPad__.finishCommand.F,s=s+e+"G"+this.__pinPad__.finishCommand.G,s=s+e+"H"+this.__pinPad__.finishCommand.H,s=s+e+"I"+this.__pinPad__.finishCommand.I,s=s+e+"J"+this.__pinPad__.finishCommand.J,s=s+e+"K"+this.__pinPad__.finishCommand.K,s=n+this.#e(s)+s+r,s=s+this.#n(s);const a=this.parseStringToBytes(s,"");this.__pinPad__.waiting.statusSecondGenerateWaiting="pending",await this.appendToQueue(a,"second-generate");let o=0;return new Promise((c,u)=>{o=setInterval(async()=>{if(this.__pinPad__.waiting.statusSecondGenerateWaiting==="resolved"){if(clearInterval(o),this.__pinPad__.waiting.statusSecondGenerateWaiting=null,this.__pinPad__.operation.applyReverse){const l=await this.#r(this.url+this.__pinPad__.constants.uris.reverse,{VMCAMEXMREVERSO:{business:{id_company:this.__pinPad__.config.idCompany?.toUpperCase(),id_branch:this.__pinPad__.config.idBranch?.toUpperCase(),country:this.__pinPad__.config.country?.toUpperCase(),user:this.username?.toUpperCase(),pwd:this.password?.toUpperCase()},transacction:{amount:this.#l(this.amount,2),no_operacion:this.__pinPad__.operation.folio,auth:this.__pinPad__.operation.authorization?.toUpperCase(),tracks:"",usrtransacction:this.username?.toUpperCase(),crypto:"2",version:this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion}}}),f=JSON.parse(l);let d;f.response==="approved"?d={message:"Transaction rejected by PinPad."}:d={message:"No communication, please check your report."},this.__pinPad__.operation.ignore.counterSale||(this.dispatch("pp:finish-emv",d),this.__pinPad__.operation.ignore.counterSale=!0)}else this.__pinPad__.operation.ignore.counterSale||(this.dispatch("pp:finish-emv",t),this.__pinPad__.operation.ignore.counterSale=!0);t.cd_error==="92"&&await this.#ct(t,s),c(!0)}else this.__pinPad__.waiting.statusSecondGenerateWaiting==="rejected"&&(clearInterval(o),this.__pinPad__.waiting.statusSecondGenerateWaiting=null,u("There is no response from the reader, check that it is connected."))},500)})}async#ct(t,e){this.__pinPad__.operation.ignore.responseGlobal=t,this.__pinPad__.operation.ignore.C93Global=e,this.__pinPad__.operation.ignore.isError92TRX=!0,await this.#h(!0,!1)}async#S(){if(this.__pinPad__.operation.ignore.isError92TRX=!1,this.__pinPad__.config.read.POSEM==="022"||this.__pinPad__.config.read.POSEM==="800"||this.__pinPad__.config.read.ReadCTLS==="1")this.dispatch("pp:response",this.__pinPad__.operation.ignore.responseGlobal);else{const t=this.parseStringToBytes(this.__pinPad__.operation.ignore.C93Global,"");await this.appendToQueue(t,"code93"),await x.wait(1400),this.dispatch("pp:response",this.__pinPad__.operation.ignore.responseGlobal)}}#T(t){const e={PPE02:"Importe Incorrecto.",A02:"Importe Incorrecto.",PPE03:"No hay respuesta del lector, verifique que se encuentra conectado.",A03:"No hay respuesta del lector, verifique que se encuentra conectado.",PP18:"Sin comunicación, por favor verifique su reporte.",PP24:"Transacción declinada por la PinPad.",A01:"Tarjeta Ilegible.",A04:"No hay planes de pago para esta tarjeta, por favor cambie la tarjeta.",A10:"Operación cancelada por el usuario.",A11:"Proceso cancelado por timeout.",A12:"Lectura errónea de banda/chip.",A13:"Carga de llave fallida.",A14:"Error de lectura de PIN.",A15:"Tarjeta Vencida.",A16:"Problemas al leer el chip.",A17:"Impresora sin Papel.",E17:"Impresora sin Papel.",A21:"Información no almacenada correctamente.",A22:"Tarjeta bloqueada.",A23:"Sin llave de cifrado DUKPT.",A28:"Fallback no soportado.",EE19:"Error de conexión, verifique su reporte.",EE21:"Ha ocurrido un error al procesar su solicitud.",EE22:"Ha ocurrido un error de conexión al servidor.",EE23:"El número de operación no puede ir vacío.",EE24:"El número de operación debe ser de 9 dígitos.",EE25:"El número de operación debe ser numérico.",EE26:"La información enviada al servicio está incompleta.",EE27:"La referencia contiene caracteres inválidos o está vacía.",EE28:"Número de autorización inválido.",EE29:"Importe inválido.",EE30:"La información enviada al servicio no es válida.",EE31:"No fue posible obtener las afiliaciones.",EE32:"Error de conexión, existe una o más transacciones en el servidor , Favor de validar su reporte y en su caso reimprimir el voucher.",EE33:"Error de comunicacion con CDP. IL/MTY",EE20:"La Referencia contiene caracteres inválidos",EE99:"Error código 99."},n=e[t]?{error:t,message:e[t]}:{error:t,message:"Error desconocido"};return this.dispatch("pp:error",n),n}async#ut(t){const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C93A"+this.__pinPad__.finishCommand.A;if(s=s+e+"B"+this.__pinPad__.finishCommand.B,s=s+e+"C"+this.__pinPad__.finishCommand.C,s=s+e+"D"+this.__pinPad__.finishCommand.D,s=s+e+"E"+this.__pinPad__.finishCommand.E,s=s+e+"F"+this.__pinPad__.finishCommand.F,s=s+e+"G"+this.__pinPad__.finishCommand.G,s=s+e+"H"+this.__pinPad__.finishCommand.H,s=s+e+"I"+this.__pinPad__.finishCommand.I,s=s+e+"J"+this.__pinPad__.finishCommand.J,s=s+e+"K"+this.__pinPad__.finishCommand.K,s=n+this.#e(s)+s+r,s=s+this.#n(s),this.__pinPad__.config.read.POSEM==="022"||this.__pinPad__.config.read.POSEM==="800"||this.__pinPad__.config.read.ReadCTLS==="1"){this.dispatch("pp:finish-emv",t);return}const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"finish-emv-end")}async#lt(t){if(t.cd_estatus=t.cd_estatus?t.cd_estatus:"0",t.cd_estatus!=="1"){this.__pinPad__.operation.ignore.isError92TRX&&await this.#S();return}const e=this.__pinPad__.constants.FS,n=this.__pinPad__.constants.ETX,r=this.__pinPad__.constants.STX,s=t.nb_ksn,a=t.nb_kcv||"",o=t.nb_ipek||"";let c="C92A"+s+e+"B"+a+e+"C"+o;c=r+this.#e(c)+c+n,c=c+this.#n(c);const u=this.parseStringToBytes(c,"");await this.appendToQueue(u,"dukpt");let l=0;return this.__pinPad__.waiting.statuswritingDUKPTWaiting="pending",new Promise((f,d)=>{l=setInterval(async()=>{this.__pinPad__.waiting.statuswritingDUKPTWaiting==="resolved"?(clearInterval(l),this.__pinPad__.waiting.statuswritingDUKPTWaiting=null,this.__pinPad__.operation.ignore.isError92TRX&&await this.#S(),f(!0)):this.__pinPad__.waiting.statuswritingDUKPTWaiting==="rejected"&&(clearInterval(l),this.__pinPad__.waiting.statuswritingDUKPTWaiting=null,d("Error writing DUKPT keys"))},500)})}#ht(){this.__pinPad__.config.read.AppId="",this.__pinPad__.config.read.AppIdLabel="",this.__pinPad__.config.read.Arqc="",this.__pinPad__.config.read.ChipName="",this.__pinPad__.config.read.ReadCTLS="",this.__pinPad__.config.read.NB_Data="",this.__pinPad__.config.read.NB_ksn="",this.__pinPad__.config.read.PIN="",this.__pinPad__.config.read.POSEM="",this.__pinPad__.config.read.Tags="",this.__pinPad__.config.read.Type="",this.__pinPad__.config.read.Chip="",this.__pinPad__.config.read.ChipNameEnc="",this.__pinPad__.operation.ignore.error="",this.__pinPad__.operation.ignore.C93Global="",this.__pinPad__.operation.folio="",this.__pinPad__.operation.authorization="",this.__pinPad__.config.tokenizeTRX=!1}createReference(){const t=Date.now().toString(),e=Math.random().toString(36).substring(2,12).toUpperCase();return`${t}${e}`}verifyNetwork(){return new Promise(t=>{const e=new Image;e.onload=()=>t(!0),e.onerror=()=>t(!1),e.src="https://www.google.com/favicon.ico?"+new Date().getTime()})}async makeSale({amount:t=0,reference:e=null}={}){if(t=parseFloat(t.toString()),isNaN(t)||t<=0)throw new Error("Amount is required and must be greater than 0");if(this.amount=t,(!e||x.isEmpty(e))&&(e=this.createReference()),!e||x.isEmpty(e)||!this.#g(e))throw new Error("Reference is required and must be alphanumeric");if(this.reference=e,/^[A-Z-a-z\s]+$/g.test(this.__pinPad__.config.currency)===!1)throw new Error("Invalid currency");if(this.username===null||this.username.trim()==="")throw new Error("Username are required");if(this.password===null||this.password.trim()==="")throw new Error("Password are required");const n={error:!1,message:null,approved:!1,object:{}};try{if(!await this.verifyNetwork())throw new Error("No internet connection");return await this.login(),await this.#Y(),!await this.#tt()||!await this.#J()?n:await this.#at()}catch(r){this.dispatch("pp:sale-process",{step:"error",message:r.message}),n.error=!0,n.message=r.message,n.approved=!1,n.object=r}return n}}exports.PinPad=Zr;
|