@danidoble/webserial 4.2.6 → 4.2.8
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/arduino.cjs +1 -1
- package/dist/arduino.js +1 -1
- package/dist/boardroid.cjs +1 -1
- package/dist/boardroid.js +171 -135
- package/dist/jofemar.cjs +1 -1
- package/dist/jofemar.js +1 -1
- package/dist/{kernel-Bquzoyqh.js → kernel-BLbpgXHp.js} +600 -480
- package/dist/kernel-Dv8bd_hz.cjs +4 -0
- package/dist/kernel.cjs +2 -2
- package/dist/kernel.js +2 -2
- package/dist/locker.cjs +1 -1
- package/dist/locker.js +1 -1
- package/dist/pinpad.cjs +5 -5
- package/dist/pinpad.js +5 -3
- package/dist/pinpax.cjs +4 -3
- package/dist/pinpax.js +68 -23
- package/dist/relay.cjs +1 -1
- package/dist/relay.js +1 -1
- package/dist/webserial.cjs +2 -2
- package/dist/webserial.js +5 -5
- package/package.json +6 -6
- package/dist/kernel-DSUxKxea.cjs +0 -4
package/dist/pinpad.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _n=Object.defineProperty;var Te=n=>{throw TypeError(n)};var gn=(n,i,t)=>i in n?_n(n,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[i]=t;var Ce=(n,i,t)=>gn(n,typeof i!="symbol"?i+"":i,t),mn=(n,i,t)=>i.has(n)||Te("Cannot "+t);var Ae=(n,i,t)=>i.has(n)?Te("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(n):i.set(n,t);var f=(n,i,t)=>(mn(n,i,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./kernel-
|
|
1
|
+
"use strict";var _n=Object.defineProperty;var Te=n=>{throw TypeError(n)};var gn=(n,i,t)=>i in n?_n(n,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[i]=t;var Ce=(n,i,t)=>gn(n,typeof i!="symbol"?i+"":i,t),mn=(n,i,t)=>i.has(n)||Te("Cannot "+t);var Ae=(n,i,t)=>i.has(n)?Te("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(n):i.set(n,t);var f=(n,i,t)=>(mn(n,i,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./kernel-Dv8bd_hz.cjs");var yn="0123456789abcdefghijklmnopqrstuvwxyz";function $(n){return yn.charAt(n)}function bn(n,i){return n&i}function Et(n,i){return n|i}function Re(n,i){return n^i}function Oe(n,i){return n&~i}function Pn(n){if(n==0)return-1;var i=0;return(n&65535)==0&&(n>>=16,i+=16),(n&255)==0&&(n>>=8,i+=8),(n&15)==0&&(n>>=4,i+=4),(n&3)==0&&(n>>=2,i+=2),(n&1)==0&&++i,i}function vn(n){for(var i=0;n!=0;)n&=n-1,++i;return i}var at="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qe="=";function Vt(n){var i,t,e="";for(i=0;i+3<=n.length;i+=3)t=parseInt(n.substring(i,i+3),16),e+=at.charAt(t>>6)+at.charAt(t&63);for(i+1==n.length?(t=parseInt(n.substring(i,i+1),16),e+=at.charAt(t<<2)):i+2==n.length&&(t=parseInt(n.substring(i,i+2),16),e+=at.charAt(t>>2)+at.charAt((t&3)<<4));(e.length&3)>0;)e+=Qe;return e}function xe(n){var i="",t,e=0,r=0;for(t=0;t<n.length&&n.charAt(t)!=Qe;++t){var s=at.indexOf(n.charAt(t));s<0||(e==0?(i+=$(s>>2),r=s&3,e=1):e==1?(i+=$(r<<2|s>>4),r=s&15,e=2):e==2?(i+=$(r),i+=$(s>>2),r=s&3,e=3):(i+=$(r<<2|s>>4),i+=$(s&15),e=0))}return e==1&&(i+=$(r<<2)),i}var rt,wn={decode:function(n){var i;if(rt===void 0){var t="0123456789ABCDEF",e=` \f
|
|
2
2
|
\r \u2028\u2029`;for(rt={},i=0;i<16;++i)rt[t.charAt(i)]=i;for(t=t.toLowerCase(),i=10;i<16;++i)rt[t.charAt(i)]=i;for(i=0;i<e.length;++i)rt[e.charAt(i)]=-1}var r=[],s=0,a=0;for(i=0;i<n.length;++i){var o=n.charAt(i);if(o=="=")break;if(o=rt[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+i);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}},Y,Yt={decode:function(n){var i;if(Y===void 0){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=`= \f
|
|
3
3
|
\r \u2028\u2029`;for(Y=Object.create(null),i=0;i<64;++i)Y[t.charAt(i)]=i;for(Y["-"]=62,Y._=63,i=0;i<e.length;++i)Y[e.charAt(i)]=-1}var r=[],s=0,a=0;for(i=0;i<n.length;++i){var o=n.charAt(i);if(o=="=")break;if(o=Y[o],o!=-1){if(o===void 0)throw new Error("Illegal character at offset "+i);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(n){var i=Yt.re.exec(n);if(i)if(i[1])n=i[1];else if(i[2])n=i[2];else throw new Error("RegExp out of sync");return Yt.decode(n)}},st=1e13,ft=function(){function n(i){this.buf=[+i||0]}return n.prototype.mulAdd=function(i,t){var e=this.buf,r=e.length,s,a;for(s=0;s<r;++s)a=e[s]*i+t,a<st?t=0:(t=0|a/st,a-=t*st),e[s]=a;t>0&&(e[s]=t)},n.prototype.sub=function(i){var t=this.buf,e=t.length,r,s;for(r=0;r<e;++r)s=t[r]-i,s<0?(s+=st,i=1):i=0,t[r]=s;for(;t[t.length-1]===0;)t.pop()},n.prototype.toString=function(i){if((i||10)!=10)throw new Error("only base 10 is supported");for(var t=this.buf,e=t[t.length-1].toString(),r=t.length-2;r>=0;--r)e+=(st+t[r]).toString().substring(1);return e},n.prototype.valueOf=function(){for(var i=this.buf,t=0,e=i.length-1;e>=0;--e)t=t*st+i[e];return t},n.prototype.simplify=function(){var i=this.buf;return i.length==1?i[0]:this},n}(),Ze="…",En=/^(\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)?)?$/,Sn=/^(\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 ct(n,i){return n.length>i&&(n=n.substring(0,i)+Ze),n}var zt=function(){function n(i,t){this.hexDigits="0123456789ABCDEF",i instanceof n?(this.enc=i.enc,this.pos=i.pos):(this.enc=i,this.pos=t)}return n.prototype.get=function(i){if(i===void 0&&(i=this.pos++),i>=this.enc.length)throw new Error("Requesting byte offset ".concat(i," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(i):this.enc[i]},n.prototype.hexByte=function(i){return this.hexDigits.charAt(i>>4&15)+this.hexDigits.charAt(i&15)},n.prototype.hexDump=function(i,t,e){for(var r="",s=i;s<t;++s)if(r+=this.hexByte(this.get(s)),e!==!0)switch(s&15){case 7:r+=" ";break;case 15:r+=`
|
|
4
4
|
`;break;default:r+=" "}return r},n.prototype.isASCII=function(i,t){for(var e=i;e<t;++e){var r=this.get(e);if(r<32||r>176)return!1}return!0},n.prototype.parseStringISO=function(i,t){for(var e="",r=i;r<t;++r)e+=String.fromCharCode(this.get(r));return e},n.prototype.parseStringUTF=function(i,t){for(var e="",r=i;r<t;){var s=this.get(r++);s<128?e+=String.fromCharCode(s):s>191&&s<224?e+=String.fromCharCode((s&31)<<6|this.get(r++)&63):e+=String.fromCharCode((s&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return e},n.prototype.parseStringBMP=function(i,t){for(var e="",r,s,a=i;a<t;)r=this.get(a++),s=this.get(a++),e+=String.fromCharCode(r<<8|s);return e},n.prototype.parseTime=function(i,t,e){var r=this.parseStringISO(i,t),s=(e?En:Sn).exec(r);return s?(e&&(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},n.prototype.parseInteger=function(i,t){for(var e=this.get(i),r=e>127,s=r?255:0,a,o="";e==s&&++i<t;)e=this.get(i);if(a=t-i,a===0)return r?-1:0;if(a>4){for(o=e,a<<=3;((+o^s)&128)==0;)o=+o<<1,--a;o="("+a+` bit)
|
|
@@ -23,9 +23,9 @@ version: 2.9.0
|
|
|
23
23
|
`;return t+=i.wordwrap(this.getPrivateBaseKeyB64())+`
|
|
24
24
|
`,t+="-----END RSA PRIVATE KEY-----",t},i.prototype.getPublicKey=function(){var t=`-----BEGIN PUBLIC KEY-----
|
|
25
25
|
`;return t+=i.wordwrap(this.getPublicBaseKeyB64())+`
|
|
26
|
-
`,t+="-----END PUBLIC KEY-----",t},i.hasPublicKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")},i.hasPrivateKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},i.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},i}(Vn),$t,Fn=typeof process<"u"?($t=process.env)===null||$t===void 0?void 0:$t.npm_package_version:void 0,jn=function(){function n(i){i===void 0&&(i={}),i=i||{},this.default_key_size=i.default_key_size?parseInt(i.default_key_size,10):1024,this.default_public_exponent=i.default_public_exponent||"010001",this.log=i.log||!1,this.key=null}return n.prototype.setKey=function(i){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Le(i)},n.prototype.setPrivateKey=function(i){this.setKey(i)},n.prototype.setPublicKey=function(i){this.setKey(i)},n.prototype.decrypt=function(i){try{return this.getKey().decrypt(xe(i))}catch{return!1}},n.prototype.encrypt=function(i){try{return Vt(this.getKey().encrypt(i))}catch{return!1}},n.prototype.sign=function(i,t,e){try{return Vt(this.getKey().sign(i,t,e))}catch{return!1}},n.prototype.verify=function(i,t,e){try{return this.getKey().verify(i,xe(t),e)}catch{return!1}},n.prototype.getKey=function(i){if(!this.key){if(this.key=new Le,i&&{}.toString.call(i)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,i);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},n.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},n.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},n.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},n.version=Fn,n}();function ti(n,i){return function(){return n.apply(i,arguments)}}const{toString:qn}=Object.prototype,{getPrototypeOf:we}=Object,{iterator:kt,toStringTag:ei}=Symbol,Ft=(n=>i=>{const t=qn.call(i);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),W=n=>(n=n.toLowerCase(),i=>Ft(i)===n),jt=n=>i=>typeof i===n,{isArray:ht}=Array,bt=jt("undefined");function Kn(n){return n!==null&&!bt(n)&&n.constructor!==null&&!bt(n.constructor)&&L(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const ii=W("ArrayBuffer");function Hn(n){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(n):i=n&&n.buffer&&ii(n.buffer),i}const Wn=jt("string"),L=jt("function"),ni=jt("number"),qt=n=>n!==null&&typeof n=="object",Xn=n=>n===!0||n===!1,xt=n=>{if(Ft(n)!=="object")return!1;const i=we(n);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(ei in n)&&!(kt in n)},zn=W("Date"),Gn=W("File"),$n=W("Blob"),Jn=W("FileList"),Qn=n=>qt(n)&&L(n.pipe),Zn=n=>{let i;return n&&(typeof FormData=="function"&&n instanceof FormData||L(n.append)&&((i=Ft(n))==="formdata"||i==="object"&&L(n.toString)&&n.toString()==="[object FormData]"))},Yn=W("URLSearchParams"),[tr,er,ir,nr]=["ReadableStream","Request","Response","Headers"].map(W),rr=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pt(n,i,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let e,r;if(typeof n!="object"&&(n=[n]),ht(n))for(e=0,r=n.length;e<r;e++)i.call(null,n[e],e,n);else{const s=t?Object.getOwnPropertyNames(n):Object.keys(n),a=s.length;let o;for(e=0;e<a;e++)o=s[e],i.call(null,n[o],o,n)}}function ri(n,i){i=i.toLowerCase();const t=Object.keys(n);let e=t.length,r;for(;e-- >0;)if(r=t[e],i===r.toLowerCase())return r;return null}const et=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,si=n=>!bt(n)&&n!==et;function ee(){const{caseless:n}=si(this)&&this||{},i={},t=(e,r)=>{const s=n&&ri(i,r)||r;xt(i[s])&&xt(e)?i[s]=ee(i[s],e):xt(e)?i[s]=ee({},e):ht(e)?i[s]=e.slice():i[s]=e};for(let e=0,r=arguments.length;e<r;e++)arguments[e]&&Pt(arguments[e],t);return i}const sr=(n,i,t,{allOwnKeys:e}={})=>(Pt(i,(r,s)=>{t&&L(r)?n[s]=ti(r,t):n[s]=r},{allOwnKeys:e}),n),ar=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),or=(n,i,t,e)=>{n.prototype=Object.create(i.prototype,e),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:i.prototype}),t&&Object.assign(n.prototype,t)},cr=(n,i,t,e)=>{let r,s,a;const o={};if(i=i||{},n==null)return i;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)a=r[s],(!e||e(a,n,i))&&!o[a]&&(i[a]=n[a],o[a]=!0);n=t!==!1&&we(n)}while(n&&(!t||t(n,i))&&n!==Object.prototype);return i},ur=(n,i,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=i.length;const e=n.indexOf(i,t);return e!==-1&&e===t},hr=n=>{if(!n)return null;if(ht(n))return n;let i=n.length;if(!ni(i))return null;const t=new Array(i);for(;i-- >0;)t[i]=n[i];return t},lr=(n=>i=>n&&i instanceof n)(typeof Uint8Array<"u"&&we(Uint8Array)),pr=(n,i)=>{const e=(n&&n[kt]).call(n);let r;for(;(r=e.next())&&!r.done;){const s=r.value;i.call(n,s[0],s[1])}},fr=(n,i)=>{let t;const e=[];for(;(t=n.exec(i))!==null;)e.push(t);return e},dr=W("HTMLFormElement"),_r=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,r){return e.toUpperCase()+r}),Me=(({hasOwnProperty:n})=>(i,t)=>n.call(i,t))(Object.prototype),gr=W("RegExp"),ai=(n,i)=>{const t=Object.getOwnPropertyDescriptors(n),e={};Pt(t,(r,s)=>{let a;(a=i(r,s,n))!==!1&&(e[s]=a||r)}),Object.defineProperties(n,e)},mr=n=>{ai(n,(i,t)=>{if(L(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const e=n[t];if(L(e)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},yr=(n,i)=>{const t={},e=r=>{r.forEach(s=>{t[s]=!0})};return ht(n)?e(n):e(String(n).split(i)),t},br=()=>{},Pr=(n,i)=>n!=null&&Number.isFinite(n=+n)?n:i;function vr(n){return!!(n&&L(n.append)&&n[ei]==="FormData"&&n[kt])}const wr=n=>{const i=new Array(10),t=(e,r)=>{if(qt(e)){if(i.indexOf(e)>=0)return;if(!("toJSON"in e)){i[r]=e;const s=ht(e)?[]:{};return Pt(e,(a,o)=>{const c=t(a,r+1);!bt(c)&&(s[o]=c)}),i[r]=void 0,s}}return e};return t(n,0)},Er=W("AsyncFunction"),Sr=n=>n&&(qt(n)||L(n))&&L(n.then)&&L(n.catch),oi=((n,i)=>n?setImmediate:i?((t,e)=>(et.addEventListener("message",({source:r,data:s})=>{r===et&&s===t&&e.length&&e.shift()()},!1),r=>{e.push(r),et.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",L(et.postMessage)),Tr=typeof queueMicrotask<"u"?queueMicrotask.bind(et):typeof process<"u"&&process.nextTick||oi,Cr=n=>n!=null&&L(n[kt]),d={isArray:ht,isArrayBuffer:ii,isBuffer:Kn,isFormData:Zn,isArrayBufferView:Hn,isString:Wn,isNumber:ni,isBoolean:Xn,isObject:qt,isPlainObject:xt,isReadableStream:tr,isRequest:er,isResponse:ir,isHeaders:nr,isUndefined:bt,isDate:zn,isFile:Gn,isBlob:$n,isRegExp:gr,isFunction:L,isStream:Qn,isURLSearchParams:Yn,isTypedArray:lr,isFileList:Jn,forEach:Pt,merge:ee,extend:sr,trim:rr,stripBOM:ar,inherits:or,toFlatObject:cr,kindOf:Ft,kindOfTest:W,endsWith:ur,toArray:hr,forEachEntry:pr,matchAll:fr,isHTMLForm:dr,hasOwnProperty:Me,hasOwnProp:Me,reduceDescriptors:ai,freezeMethods:mr,toObjectSet:yr,toCamelCase:_r,noop:br,toFiniteNumber:Pr,findKey:ri,global:et,isContextDefined:si,isSpecCompliantForm:vr,toJSONObject:wr,isAsyncFn:Er,isThenable:Sr,setImmediate:oi,asap:Tr,isIterable:Cr};function w(n,i,t,e,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",i&&(this.code=i),t&&(this.config=t),e&&(this.request=e),r&&(this.response=r,this.status=r.status?r.status:null)}d.inherits(w,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}});const ci=w.prototype,ui={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{ui[n]={value:n}});Object.defineProperties(w,ui);Object.defineProperty(ci,"isAxiosError",{value:!0});w.from=(n,i,t,e,r,s)=>{const a=Object.create(ci);return d.toFlatObject(n,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),w.call(a,n.message,i,t,e,r),a.cause=n,a.name=n.name,s&&Object.assign(a,s),a};const Ar=null;function ie(n){return d.isPlainObject(n)||d.isArray(n)}function hi(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function ke(n,i,t){return n?n.concat(i).map(function(r,s){return r=hi(r),!t&&s?"["+r+"]":r}).join(t?".":""):i}function Rr(n){return d.isArray(n)&&!n.some(ie)}const Or=d.toFlatObject(d,{},null,function(i){return/^is[A-Z]/.test(i)});function Kt(n,i,t){if(!d.isObject(n))throw new TypeError("target must be an object");i=i||new FormData,t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,y){return!d.isUndefined(y[b])});const e=t.metaTokens,r=t.visitor||l,s=t.dots,a=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(i);if(!d.isFunction(r))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(d.isDate(m))return m.toISOString();if(!c&&d.isBlob(m))throw new w("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(m)||d.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function l(m,b,y){let C=m;if(m&&!y&&typeof m=="object"){if(d.endsWith(b,"{}"))b=e?b:b.slice(0,-2),m=JSON.stringify(m);else if(d.isArray(m)&&Rr(m)||(d.isFileList(m)||d.endsWith(b,"[]"))&&(C=d.toArray(m)))return b=hi(b),C.forEach(function(R,U){!(d.isUndefined(R)||R===null)&&i.append(a===!0?ke([b],U,s):a===null?b:b+"[]",u(R))}),!1}return ie(m)?!0:(i.append(ke(y,b,s),u(m)),!1)}const p=[],g=Object.assign(Or,{defaultVisitor:l,convertValue:u,isVisitable:ie});function P(m,b){if(!d.isUndefined(m)){if(p.indexOf(m)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(m),d.forEach(m,function(C,T){(!(d.isUndefined(C)||C===null)&&r.call(i,C,d.isString(T)?T.trim():T,b,g))===!0&&P(C,b?b.concat(T):[T])}),p.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return P(n),i}function Fe(n){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(e){return i[e]})}function Ee(n,i){this._pairs=[],n&&Kt(n,this,i)}const li=Ee.prototype;li.append=function(i,t){this._pairs.push([i,t])};li.toString=function(i){const t=i?function(e){return i.call(this,e,Fe)}:Fe;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function xr(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function pi(n,i,t){if(!i)return n;const e=t&&t.encode||xr;d.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let s;if(r?s=r(i,t):s=d.isURLSearchParams(i)?i.toString():new Ee(i,t).toString(e),s){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class je{constructor(){this.handlers=[]}use(i,t,e){return this.handlers.push({fulfilled:i,rejected:t,synchronous:e?e.synchronous:!1,runWhen:e?e.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){d.forEach(this.handlers,function(e){e!==null&&i(e)})}}const fi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dr=typeof URLSearchParams<"u"?URLSearchParams:Ee,Ir=typeof FormData<"u"?FormData:null,Br=typeof Blob<"u"?Blob:null,Nr={isBrowser:!0,classes:{URLSearchParams:Dr,FormData:Ir,Blob:Br},protocols:["http","https","file","blob","url","data"]},Se=typeof window<"u"&&typeof document<"u",ne=typeof navigator=="object"&&navigator||void 0,Vr=Se&&(!ne||["ReactNative","NativeScript","NS"].indexOf(ne.product)<0),Ur=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Lr=Se&&window.location.href||"http://localhost",Mr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Se,hasStandardBrowserEnv:Vr,hasStandardBrowserWebWorkerEnv:Ur,navigator:ne,origin:Lr},Symbol.toStringTag,{value:"Module"})),N={...Mr,...Nr};function kr(n,i){return Kt(n,new N.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,s){return N.isNode&&d.isBuffer(t)?(this.append(e,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},i))}function Fr(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(i=>i[0]==="[]"?"":i[1]||i[0])}function jr(n){const i={},t=Object.keys(n);let e;const r=t.length;let s;for(e=0;e<r;e++)s=t[e],i[s]=n[s];return i}function di(n){function i(t,e,r,s){let a=t[s++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),c=s>=t.length;return a=!a&&d.isArray(r)?r.length:a,c?(d.hasOwnProp(r,a)?r[a]=[r[a],e]:r[a]=e,!o):((!r[a]||!d.isObject(r[a]))&&(r[a]=[]),i(t,e,r[a],s)&&d.isArray(r[a])&&(r[a]=jr(r[a])),!o)}if(d.isFormData(n)&&d.isFunction(n.entries)){const t={};return d.forEachEntry(n,(e,r)=>{i(Fr(e),r,t,0)}),t}return null}function qr(n,i,t){if(d.isString(n))try{return(i||JSON.parse)(n),d.trim(n)}catch(e){if(e.name!=="SyntaxError")throw e}return(t||JSON.stringify)(n)}const vt={transitional:fi,adapter:["xhr","http","fetch"],transformRequest:[function(i,t){const e=t.getContentType()||"",r=e.indexOf("application/json")>-1,s=d.isObject(i);if(s&&d.isHTMLForm(i)&&(i=new FormData(i)),d.isFormData(i))return r?JSON.stringify(di(i)):i;if(d.isArrayBuffer(i)||d.isBuffer(i)||d.isStream(i)||d.isFile(i)||d.isBlob(i)||d.isReadableStream(i))return i;if(d.isArrayBufferView(i))return i.buffer;if(d.isURLSearchParams(i))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let o;if(s){if(e.indexOf("application/x-www-form-urlencoded")>-1)return kr(i,this.formSerializer).toString();if((o=d.isFileList(i))||e.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Kt(o?{"files[]":i}:i,c&&new c,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),qr(i)):i}],transformResponse:[function(i){const t=this.transitional||vt.transitional,e=t&&t.forcedJSONParsing,r=this.responseType==="json";if(d.isResponse(i)||d.isReadableStream(i))return i;if(i&&d.isString(i)&&(e&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(i)}catch(o){if(a)throw o.name==="SyntaxError"?w.from(o,w.ERR_BAD_RESPONSE,this,null,this.response):o}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:N.classes.FormData,Blob:N.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{vt.headers[n]={}});const Kr=d.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"]),Hr=n=>{const i={};let t,e,r;return n&&n.split(`
|
|
26
|
+
`,t+="-----END PUBLIC KEY-----",t},i.hasPublicKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")},i.hasPrivateKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},i.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},i}(Vn),$t,Fn=typeof process<"u"?($t=process.env)===null||$t===void 0?void 0:$t.npm_package_version:void 0,jn=function(){function n(i){i===void 0&&(i={}),i=i||{},this.default_key_size=i.default_key_size?parseInt(i.default_key_size,10):1024,this.default_public_exponent=i.default_public_exponent||"010001",this.log=i.log||!1,this.key=null}return n.prototype.setKey=function(i){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Le(i)},n.prototype.setPrivateKey=function(i){this.setKey(i)},n.prototype.setPublicKey=function(i){this.setKey(i)},n.prototype.decrypt=function(i){try{return this.getKey().decrypt(xe(i))}catch{return!1}},n.prototype.encrypt=function(i){try{return Vt(this.getKey().encrypt(i))}catch{return!1}},n.prototype.sign=function(i,t,e){try{return Vt(this.getKey().sign(i,t,e))}catch{return!1}},n.prototype.verify=function(i,t,e){try{return this.getKey().verify(i,xe(t),e)}catch{return!1}},n.prototype.getKey=function(i){if(!this.key){if(this.key=new Le,i&&{}.toString.call(i)==="[object Function]"){this.key.generateAsync(this.default_key_size,this.default_public_exponent,i);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},n.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},n.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},n.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},n.version=Fn,n}();function ti(n,i){return function(){return n.apply(i,arguments)}}const{toString:qn}=Object.prototype,{getPrototypeOf:we}=Object,{iterator:kt,toStringTag:ei}=Symbol,Ft=(n=>i=>{const t=qn.call(i);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),W=n=>(n=n.toLowerCase(),i=>Ft(i)===n),jt=n=>i=>typeof i===n,{isArray:ht}=Array,bt=jt("undefined");function Kn(n){return n!==null&&!bt(n)&&n.constructor!==null&&!bt(n.constructor)&&L(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const ii=W("ArrayBuffer");function Hn(n){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(n):i=n&&n.buffer&&ii(n.buffer),i}const Wn=jt("string"),L=jt("function"),ni=jt("number"),qt=n=>n!==null&&typeof n=="object",Xn=n=>n===!0||n===!1,xt=n=>{if(Ft(n)!=="object")return!1;const i=we(n);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(ei in n)&&!(kt in n)},zn=W("Date"),Gn=W("File"),$n=W("Blob"),Jn=W("FileList"),Qn=n=>qt(n)&&L(n.pipe),Zn=n=>{let i;return n&&(typeof FormData=="function"&&n instanceof FormData||L(n.append)&&((i=Ft(n))==="formdata"||i==="object"&&L(n.toString)&&n.toString()==="[object FormData]"))},Yn=W("URLSearchParams"),[tr,er,ir,nr]=["ReadableStream","Request","Response","Headers"].map(W),rr=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pt(n,i,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let e,r;if(typeof n!="object"&&(n=[n]),ht(n))for(e=0,r=n.length;e<r;e++)i.call(null,n[e],e,n);else{const s=t?Object.getOwnPropertyNames(n):Object.keys(n),a=s.length;let o;for(e=0;e<a;e++)o=s[e],i.call(null,n[o],o,n)}}function ri(n,i){i=i.toLowerCase();const t=Object.keys(n);let e=t.length,r;for(;e-- >0;)if(r=t[e],i===r.toLowerCase())return r;return null}const et=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,si=n=>!bt(n)&&n!==et;function ee(){const{caseless:n}=si(this)&&this||{},i={},t=(e,r)=>{const s=n&&ri(i,r)||r;xt(i[s])&&xt(e)?i[s]=ee(i[s],e):xt(e)?i[s]=ee({},e):ht(e)?i[s]=e.slice():i[s]=e};for(let e=0,r=arguments.length;e<r;e++)arguments[e]&&Pt(arguments[e],t);return i}const sr=(n,i,t,{allOwnKeys:e}={})=>(Pt(i,(r,s)=>{t&&L(r)?n[s]=ti(r,t):n[s]=r},{allOwnKeys:e}),n),ar=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),or=(n,i,t,e)=>{n.prototype=Object.create(i.prototype,e),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:i.prototype}),t&&Object.assign(n.prototype,t)},cr=(n,i,t,e)=>{let r,s,a;const o={};if(i=i||{},n==null)return i;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)a=r[s],(!e||e(a,n,i))&&!o[a]&&(i[a]=n[a],o[a]=!0);n=t!==!1&&we(n)}while(n&&(!t||t(n,i))&&n!==Object.prototype);return i},ur=(n,i,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=i.length;const e=n.indexOf(i,t);return e!==-1&&e===t},hr=n=>{if(!n)return null;if(ht(n))return n;let i=n.length;if(!ni(i))return null;const t=new Array(i);for(;i-- >0;)t[i]=n[i];return t},lr=(n=>i=>n&&i instanceof n)(typeof Uint8Array<"u"&&we(Uint8Array)),pr=(n,i)=>{const e=(n&&n[kt]).call(n);let r;for(;(r=e.next())&&!r.done;){const s=r.value;i.call(n,s[0],s[1])}},fr=(n,i)=>{let t;const e=[];for(;(t=n.exec(i))!==null;)e.push(t);return e},dr=W("HTMLFormElement"),_r=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,r){return e.toUpperCase()+r}),Me=(({hasOwnProperty:n})=>(i,t)=>n.call(i,t))(Object.prototype),gr=W("RegExp"),ai=(n,i)=>{const t=Object.getOwnPropertyDescriptors(n),e={};Pt(t,(r,s)=>{let a;(a=i(r,s,n))!==!1&&(e[s]=a||r)}),Object.defineProperties(n,e)},mr=n=>{ai(n,(i,t)=>{if(L(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const e=n[t];if(L(e)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},yr=(n,i)=>{const t={},e=r=>{r.forEach(s=>{t[s]=!0})};return ht(n)?e(n):e(String(n).split(i)),t},br=()=>{},Pr=(n,i)=>n!=null&&Number.isFinite(n=+n)?n:i;function vr(n){return!!(n&&L(n.append)&&n[ei]==="FormData"&&n[kt])}const wr=n=>{const i=new Array(10),t=(e,r)=>{if(qt(e)){if(i.indexOf(e)>=0)return;if(!("toJSON"in e)){i[r]=e;const s=ht(e)?[]:{};return Pt(e,(a,o)=>{const c=t(a,r+1);!bt(c)&&(s[o]=c)}),i[r]=void 0,s}}return e};return t(n,0)},Er=W("AsyncFunction"),Sr=n=>n&&(qt(n)||L(n))&&L(n.then)&&L(n.catch),oi=((n,i)=>n?setImmediate:i?((t,e)=>(et.addEventListener("message",({source:r,data:s})=>{r===et&&s===t&&e.length&&e.shift()()},!1),r=>{e.push(r),et.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",L(et.postMessage)),Tr=typeof queueMicrotask<"u"?queueMicrotask.bind(et):typeof process<"u"&&process.nextTick||oi,Cr=n=>n!=null&&L(n[kt]),d={isArray:ht,isArrayBuffer:ii,isBuffer:Kn,isFormData:Zn,isArrayBufferView:Hn,isString:Wn,isNumber:ni,isBoolean:Xn,isObject:qt,isPlainObject:xt,isReadableStream:tr,isRequest:er,isResponse:ir,isHeaders:nr,isUndefined:bt,isDate:zn,isFile:Gn,isBlob:$n,isRegExp:gr,isFunction:L,isStream:Qn,isURLSearchParams:Yn,isTypedArray:lr,isFileList:Jn,forEach:Pt,merge:ee,extend:sr,trim:rr,stripBOM:ar,inherits:or,toFlatObject:cr,kindOf:Ft,kindOfTest:W,endsWith:ur,toArray:hr,forEachEntry:pr,matchAll:fr,isHTMLForm:dr,hasOwnProperty:Me,hasOwnProp:Me,reduceDescriptors:ai,freezeMethods:mr,toObjectSet:yr,toCamelCase:_r,noop:br,toFiniteNumber:Pr,findKey:ri,global:et,isContextDefined:si,isSpecCompliantForm:vr,toJSONObject:wr,isAsyncFn:Er,isThenable:Sr,setImmediate:oi,asap:Tr,isIterable:Cr};function w(n,i,t,e,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",i&&(this.code=i),t&&(this.config=t),e&&(this.request=e),r&&(this.response=r,this.status=r.status?r.status:null)}d.inherits(w,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}});const ci=w.prototype,ui={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{ui[n]={value:n}});Object.defineProperties(w,ui);Object.defineProperty(ci,"isAxiosError",{value:!0});w.from=(n,i,t,e,r,s)=>{const a=Object.create(ci);return d.toFlatObject(n,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),w.call(a,n.message,i,t,e,r),a.cause=n,a.name=n.name,s&&Object.assign(a,s),a};const Ar=null;function ie(n){return d.isPlainObject(n)||d.isArray(n)}function hi(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function ke(n,i,t){return n?n.concat(i).map(function(r,s){return r=hi(r),!t&&s?"["+r+"]":r}).join(t?".":""):i}function Rr(n){return d.isArray(n)&&!n.some(ie)}const Or=d.toFlatObject(d,{},null,function(i){return/^is[A-Z]/.test(i)});function Kt(n,i,t){if(!d.isObject(n))throw new TypeError("target must be an object");i=i||new FormData,t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,y){return!d.isUndefined(y[b])});const e=t.metaTokens,r=t.visitor||l,s=t.dots,a=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(i);if(!d.isFunction(r))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(d.isDate(m))return m.toISOString();if(d.isBoolean(m))return m.toString();if(!c&&d.isBlob(m))throw new w("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(m)||d.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function l(m,b,y){let C=m;if(m&&!y&&typeof m=="object"){if(d.endsWith(b,"{}"))b=e?b:b.slice(0,-2),m=JSON.stringify(m);else if(d.isArray(m)&&Rr(m)||(d.isFileList(m)||d.endsWith(b,"[]"))&&(C=d.toArray(m)))return b=hi(b),C.forEach(function(R,U){!(d.isUndefined(R)||R===null)&&i.append(a===!0?ke([b],U,s):a===null?b:b+"[]",u(R))}),!1}return ie(m)?!0:(i.append(ke(y,b,s),u(m)),!1)}const p=[],g=Object.assign(Or,{defaultVisitor:l,convertValue:u,isVisitable:ie});function P(m,b){if(!d.isUndefined(m)){if(p.indexOf(m)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(m),d.forEach(m,function(C,T){(!(d.isUndefined(C)||C===null)&&r.call(i,C,d.isString(T)?T.trim():T,b,g))===!0&&P(C,b?b.concat(T):[T])}),p.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return P(n),i}function Fe(n){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(e){return i[e]})}function Ee(n,i){this._pairs=[],n&&Kt(n,this,i)}const li=Ee.prototype;li.append=function(i,t){this._pairs.push([i,t])};li.toString=function(i){const t=i?function(e){return i.call(this,e,Fe)}:Fe;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function xr(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function pi(n,i,t){if(!i)return n;const e=t&&t.encode||xr;d.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let s;if(r?s=r(i,t):s=d.isURLSearchParams(i)?i.toString():new Ee(i,t).toString(e),s){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class je{constructor(){this.handlers=[]}use(i,t,e){return this.handlers.push({fulfilled:i,rejected:t,synchronous:e?e.synchronous:!1,runWhen:e?e.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){d.forEach(this.handlers,function(e){e!==null&&i(e)})}}const fi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dr=typeof URLSearchParams<"u"?URLSearchParams:Ee,Ir=typeof FormData<"u"?FormData:null,Br=typeof Blob<"u"?Blob:null,Nr={isBrowser:!0,classes:{URLSearchParams:Dr,FormData:Ir,Blob:Br},protocols:["http","https","file","blob","url","data"]},Se=typeof window<"u"&&typeof document<"u",ne=typeof navigator=="object"&&navigator||void 0,Vr=Se&&(!ne||["ReactNative","NativeScript","NS"].indexOf(ne.product)<0),Ur=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Lr=Se&&window.location.href||"http://localhost",Mr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Se,hasStandardBrowserEnv:Vr,hasStandardBrowserWebWorkerEnv:Ur,navigator:ne,origin:Lr},Symbol.toStringTag,{value:"Module"})),N={...Mr,...Nr};function kr(n,i){return Kt(n,new N.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,s){return N.isNode&&d.isBuffer(t)?(this.append(e,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},i))}function Fr(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(i=>i[0]==="[]"?"":i[1]||i[0])}function jr(n){const i={},t=Object.keys(n);let e;const r=t.length;let s;for(e=0;e<r;e++)s=t[e],i[s]=n[s];return i}function di(n){function i(t,e,r,s){let a=t[s++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),c=s>=t.length;return a=!a&&d.isArray(r)?r.length:a,c?(d.hasOwnProp(r,a)?r[a]=[r[a],e]:r[a]=e,!o):((!r[a]||!d.isObject(r[a]))&&(r[a]=[]),i(t,e,r[a],s)&&d.isArray(r[a])&&(r[a]=jr(r[a])),!o)}if(d.isFormData(n)&&d.isFunction(n.entries)){const t={};return d.forEachEntry(n,(e,r)=>{i(Fr(e),r,t,0)}),t}return null}function qr(n,i,t){if(d.isString(n))try{return(i||JSON.parse)(n),d.trim(n)}catch(e){if(e.name!=="SyntaxError")throw e}return(t||JSON.stringify)(n)}const vt={transitional:fi,adapter:["xhr","http","fetch"],transformRequest:[function(i,t){const e=t.getContentType()||"",r=e.indexOf("application/json")>-1,s=d.isObject(i);if(s&&d.isHTMLForm(i)&&(i=new FormData(i)),d.isFormData(i))return r?JSON.stringify(di(i)):i;if(d.isArrayBuffer(i)||d.isBuffer(i)||d.isStream(i)||d.isFile(i)||d.isBlob(i)||d.isReadableStream(i))return i;if(d.isArrayBufferView(i))return i.buffer;if(d.isURLSearchParams(i))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let o;if(s){if(e.indexOf("application/x-www-form-urlencoded")>-1)return kr(i,this.formSerializer).toString();if((o=d.isFileList(i))||e.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Kt(o?{"files[]":i}:i,c&&new c,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),qr(i)):i}],transformResponse:[function(i){const t=this.transitional||vt.transitional,e=t&&t.forcedJSONParsing,r=this.responseType==="json";if(d.isResponse(i)||d.isReadableStream(i))return i;if(i&&d.isString(i)&&(e&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(i)}catch(o){if(a)throw o.name==="SyntaxError"?w.from(o,w.ERR_BAD_RESPONSE,this,null,this.response):o}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:N.classes.FormData,Blob:N.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{vt.headers[n]={}});const Kr=d.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"]),Hr=n=>{const i={};let t,e,r;return n&&n.split(`
|
|
27
27
|
`).forEach(function(a){r=a.indexOf(":"),t=a.substring(0,r).trim().toLowerCase(),e=a.substring(r+1).trim(),!(!t||i[t]&&Kr[t])&&(t==="set-cookie"?i[t]?i[t].push(e):i[t]=[e]:i[t]=i[t]?i[t]+", "+e:e)}),i},qe=Symbol("internals");function pt(n){return n&&String(n).trim().toLowerCase()}function Dt(n){return n===!1||n==null?n:d.isArray(n)?n.map(Dt):String(n)}function Wr(n){const i=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let e;for(;e=t.exec(n);)i[e[1]]=e[2];return i}const Xr=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Jt(n,i,t,e,r){if(d.isFunction(e))return e.call(this,i,t);if(r&&(i=t),!!d.isString(i)){if(d.isString(e))return i.indexOf(e)!==-1;if(d.isRegExp(e))return e.test(i)}}function zr(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,t,e)=>t.toUpperCase()+e)}function Gr(n,i){const t=d.toCamelCase(" "+i);["get","set","has"].forEach(e=>{Object.defineProperty(n,e+t,{value:function(r,s,a){return this[e].call(this,i,r,s,a)},configurable:!0})})}let M=class{constructor(i){i&&this.set(i)}set(i,t,e){const r=this;function s(o,c,u){const l=pt(c);if(!l)throw new Error("header name must be a non-empty string");const p=d.findKey(r,l);(!p||r[p]===void 0||u===!0||u===void 0&&r[p]!==!1)&&(r[p||c]=Dt(o))}const a=(o,c)=>d.forEach(o,(u,l)=>s(u,l,c));if(d.isPlainObject(i)||i instanceof this.constructor)a(i,t);else if(d.isString(i)&&(i=i.trim())&&!Xr(i))a(Hr(i),t);else if(d.isObject(i)&&d.isIterable(i)){let o={},c,u;for(const l of i){if(!d.isArray(l))throw TypeError("Object iterator must return a key-value pair");o[u=l[0]]=(c=o[u])?d.isArray(c)?[...c,l[1]]:[c,l[1]]:l[1]}a(o,t)}else i!=null&&s(t,i,e);return this}get(i,t){if(i=pt(i),i){const e=d.findKey(this,i);if(e){const r=this[e];if(!t)return r;if(t===!0)return Wr(r);if(d.isFunction(t))return t.call(this,r,e);if(d.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,t){if(i=pt(i),i){const e=d.findKey(this,i);return!!(e&&this[e]!==void 0&&(!t||Jt(this,this[e],e,t)))}return!1}delete(i,t){const e=this;let r=!1;function s(a){if(a=pt(a),a){const o=d.findKey(e,a);o&&(!t||Jt(e,e[o],o,t))&&(delete e[o],r=!0)}}return d.isArray(i)?i.forEach(s):s(i),r}clear(i){const t=Object.keys(this);let e=t.length,r=!1;for(;e--;){const s=t[e];(!i||Jt(this,this[s],s,i,!0))&&(delete this[s],r=!0)}return r}normalize(i){const t=this,e={};return d.forEach(this,(r,s)=>{const a=d.findKey(e,s);if(a){t[a]=Dt(r),delete t[s];return}const o=i?zr(s):String(s).trim();o!==s&&delete t[s],t[o]=Dt(r),e[o]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const t=Object.create(null);return d.forEach(this,(e,r)=>{e!=null&&e!==!1&&(t[r]=i&&d.isArray(e)?e.join(", "):e)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,t])=>i+": "+t).join(`
|
|
28
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...t){const e=new this(i);return t.forEach(r=>e.set(r)),e}static accessor(i){const e=(this[qe]=this[qe]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=pt(a);e[o]||(Gr(r,a),e[o]=!0)}return d.isArray(i)?i.forEach(s):s(i),this}};M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(M.prototype,({value:n},i)=>{let t=i[0].toUpperCase()+i.slice(1);return{get:()=>n,set(e){this[t]=e}}});d.freezeMethods(M);function Qt(n,i){const t=this||vt,e=i||t,r=M.from(e.headers);let s=e.data;return d.forEach(n,function(o){s=o.call(t,s,r.normalize(),i?i.status:void 0)}),r.normalize(),s}function _i(n){return!!(n&&n.__CANCEL__)}function lt(n,i,t){w.call(this,n??"canceled",w.ERR_CANCELED,i,t),this.name="CanceledError"}d.inherits(lt,w,{__CANCEL__:!0});function gi(n,i,t){const e=t.config.validateStatus;!t.status||!e||e(t.status)?n(t):i(new w("Request failed with status code "+t.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function $r(n){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return i&&i[1]||""}function Jr(n,i){n=n||10;const t=new Array(n),e=new Array(n);let r=0,s=0,a;return i=i!==void 0?i:1e3,function(c){const u=Date.now(),l=e[s];a||(a=u),t[r]=c,e[r]=u;let p=s,g=0;for(;p!==r;)g+=t[p++],p=p%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),u-a<i)return;const P=l&&u-l;return P?Math.round(g*1e3/P):void 0}}function Qr(n,i){let t=0,e=1e3/i,r,s;const a=(u,l=Date.now())=>{t=l,r=null,s&&(clearTimeout(s),s=null),n.apply(null,u)};return[(...u)=>{const l=Date.now(),p=l-t;p>=e?a(u,l):(r=u,s||(s=setTimeout(()=>{s=null,a(r)},e-p)))},()=>r&&a(r)]}const Ut=(n,i,t=3)=>{let e=0;const r=Jr(50,250);return Qr(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,c=a-e,u=r(c),l=a<=o;e=a;const p={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:u||void 0,estimated:u&&o&&l?(o-a)/u:void 0,event:s,lengthComputable:o!=null,[i?"download":"upload"]:!0};n(p)},t)},Ke=(n,i)=>{const t=n!=null;return[e=>i[0]({lengthComputable:t,total:n,loaded:e}),i[1]]},He=n=>(...i)=>d.asap(()=>n(...i)),Zr=N.hasStandardBrowserEnv?((n,i)=>t=>(t=new URL(t,N.origin),n.protocol===t.protocol&&n.host===t.host&&(i||n.port===t.port)))(new URL(N.origin),N.navigator&&/(msie|trident)/i.test(N.navigator.userAgent)):()=>!0,Yr=N.hasStandardBrowserEnv?{write(n,i,t,e,r,s){const a=[n+"="+encodeURIComponent(i)];d.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),d.isString(e)&&a.push("path="+e),d.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(n){const i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ts(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function es(n,i){return i?n.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):n}function mi(n,i,t){let e=!ts(i);return n&&(e||t==!1)?es(n,i):i}const We=n=>n instanceof M?{...n}:n;function nt(n,i){i=i||{};const t={};function e(u,l,p,g){return d.isPlainObject(u)&&d.isPlainObject(l)?d.merge.call({caseless:g},u,l):d.isPlainObject(l)?d.merge({},l):d.isArray(l)?l.slice():l}function r(u,l,p,g){if(d.isUndefined(l)){if(!d.isUndefined(u))return e(void 0,u,p,g)}else return e(u,l,p,g)}function s(u,l){if(!d.isUndefined(l))return e(void 0,l)}function a(u,l){if(d.isUndefined(l)){if(!d.isUndefined(u))return e(void 0,u)}else return e(void 0,l)}function o(u,l,p){if(p in i)return e(u,l);if(p in n)return e(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,responseEncoding:a,validateStatus:o,headers:(u,l,p)=>r(We(u),We(l),p,!0)};return d.forEach(Object.keys(Object.assign({},n,i)),function(l){const p=c[l]||r,g=p(n[l],i[l],l);d.isUndefined(g)&&p!==o||(t[l]=g)}),t}const yi=n=>{const i=nt({},n);let{data:t,withXSRFToken:e,xsrfHeaderName:r,xsrfCookieName:s,headers:a,auth:o}=i;i.headers=a=M.from(a),i.url=pi(mi(i.baseURL,i.url,i.allowAbsoluteUrls),n.params,n.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let c;if(d.isFormData(t)){if(N.hasStandardBrowserEnv||N.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...l]=c?c.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...l].join("; "))}}if(N.hasStandardBrowserEnv&&(e&&d.isFunction(e)&&(e=e(i)),e||e!==!1&&Zr(i.url))){const u=r&&s&&Yr.read(s);u&&a.set(r,u)}return i},is=typeof XMLHttpRequest<"u",ns=is&&function(n){return new Promise(function(t,e){const r=yi(n);let s=r.data;const a=M.from(r.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:u}=r,l,p,g,P,m;function b(){P&&P(),m&&m(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let y=new XMLHttpRequest;y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout;function C(){if(!y)return;const R=M.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),I={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:R,config:n,request:y};gi(function(k){t(k),b()},function(k){e(k),b()},I),y=null}"onloadend"in y?y.onloadend=C:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(C)},y.onabort=function(){y&&(e(new w("Request aborted",w.ECONNABORTED,n,y)),y=null)},y.onerror=function(){e(new w("Network Error",w.ERR_NETWORK,n,y)),y=null},y.ontimeout=function(){let U=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const I=r.transitional||fi;r.timeoutErrorMessage&&(U=r.timeoutErrorMessage),e(new w(U,I.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,n,y)),y=null},s===void 0&&a.setContentType(null),"setRequestHeader"in y&&d.forEach(a.toJSON(),function(U,I){y.setRequestHeader(I,U)}),d.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),o&&o!=="json"&&(y.responseType=r.responseType),u&&([g,m]=Ut(u,!0),y.addEventListener("progress",g)),c&&y.upload&&([p,P]=Ut(c),y.upload.addEventListener("progress",p),y.upload.addEventListener("loadend",P)),(r.cancelToken||r.signal)&&(l=R=>{y&&(e(!R||R.type?new lt(null,n,y):R),y.abort(),y=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const T=$r(r.url);if(T&&N.protocols.indexOf(T)===-1){e(new w("Unsupported protocol "+T+":",w.ERR_BAD_REQUEST,n));return}y.send(s||null)})},rs=(n,i)=>{const{length:t}=n=n?n.filter(Boolean):[];if(i||t){let e=new AbortController,r;const s=function(u){if(!r){r=!0,o();const l=u instanceof Error?u:this.reason;e.abort(l instanceof w?l:new lt(l instanceof Error?l.message:l))}};let a=i&&setTimeout(()=>{a=null,s(new w(`timeout ${i} of ms exceeded`,w.ETIMEDOUT))},i);const o=()=>{n&&(a&&clearTimeout(a),a=null,n.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),n=null)};n.forEach(u=>u.addEventListener("abort",s));const{signal:c}=e;return c.unsubscribe=()=>d.asap(o),c}},ss=function*(n,i){let t=n.byteLength;if(t<i){yield n;return}let e=0,r;for(;e<t;)r=e+i,yield n.slice(e,r),e=r},as=async function*(n,i){for await(const t of os(n))yield*ss(t,i)},os=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const i=n.getReader();try{for(;;){const{done:t,value:e}=await i.read();if(t)break;yield e}}finally{await i.cancel()}},Xe=(n,i,t,e)=>{const r=as(n,i);let s=0,a,o=c=>{a||(a=!0,e&&e(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await r.next();if(u){o(),c.close();return}let p=l.byteLength;if(t){let g=s+=p;t(g)}c.enqueue(new Uint8Array(l))}catch(u){throw o(u),u}},cancel(c){return o(c),r.return()}},{highWaterMark:2})},Ht=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bi=Ht&&typeof ReadableStream=="function",cs=Ht&&(typeof TextEncoder=="function"?(n=>i=>n.encode(i))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),Pi=(n,...i)=>{try{return!!n(...i)}catch{return!1}},us=bi&&Pi(()=>{let n=!1;const i=new Request(N.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!i}),ze=64*1024,re=bi&&Pi(()=>d.isReadableStream(new Response("").body)),Lt={stream:re&&(n=>n.body)};Ht&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(i=>{!Lt[i]&&(Lt[i]=d.isFunction(n[i])?t=>t[i]():(t,e)=>{throw new w(`Response type '${i}' is not supported`,w.ERR_NOT_SUPPORT,e)})})})(new Response);const hs=async n=>{if(n==null)return 0;if(d.isBlob(n))return n.size;if(d.isSpecCompliantForm(n))return(await new Request(N.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(d.isArrayBufferView(n)||d.isArrayBuffer(n))return n.byteLength;if(d.isURLSearchParams(n)&&(n=n+""),d.isString(n))return(await cs(n)).byteLength},ls=async(n,i)=>{const t=d.toFiniteNumber(n.getContentLength());return t??hs(i)},ps=Ht&&(async n=>{let{url:i,method:t,data:e,signal:r,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:u,headers:l,withCredentials:p="same-origin",fetchOptions:g}=yi(n);u=u?(u+"").toLowerCase():"text";let P=rs([r,s&&s.toAbortSignal()],a),m;const b=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let y;try{if(c&&us&&t!=="get"&&t!=="head"&&(y=await ls(l,e))!==0){let I=new Request(i,{method:"POST",body:e,duplex:"half"}),v;if(d.isFormData(e)&&(v=I.headers.get("content-type"))&&l.setContentType(v),I.body){const[k,X]=Ke(y,Ut(He(c)));e=Xe(I.body,ze,k,X)}}d.isString(p)||(p=p?"include":"omit");const C="credentials"in Request.prototype;m=new Request(i,{...g,signal:P,method:t.toUpperCase(),headers:l.normalize().toJSON(),body:e,duplex:"half",credentials:C?p:void 0});let T=await fetch(m);const R=re&&(u==="stream"||u==="response");if(re&&(o||R&&b)){const I={};["status","statusText","headers"].forEach(z=>{I[z]=T[z]});const v=d.toFiniteNumber(T.headers.get("content-length")),[k,X]=o&&Ke(v,Ut(He(o),!0))||[];T=new Response(Xe(T.body,ze,k,()=>{X&&X(),b&&b()}),I)}u=u||"text";let U=await Lt[d.findKey(Lt,u)||"text"](T,n);return!R&&b&&b(),await new Promise((I,v)=>{gi(I,v,{data:U,headers:M.from(T.headers),status:T.status,statusText:T.statusText,config:n,request:m})})}catch(C){throw b&&b(),C&&C.name==="TypeError"&&/Load failed|fetch/i.test(C.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,n,m),{cause:C.cause||C}):w.from(C,C&&C.code,n,m)}}),se={http:Ar,xhr:ns,fetch:ps};d.forEach(se,(n,i)=>{if(n){try{Object.defineProperty(n,"name",{value:i})}catch{}Object.defineProperty(n,"adapterName",{value:i})}});const Ge=n=>`- ${n}`,fs=n=>d.isFunction(n)||n===null||n===!1,vi={getAdapter:n=>{n=d.isArray(n)?n:[n];const{length:i}=n;let t,e;const r={};for(let s=0;s<i;s++){t=n[s];let a;if(e=t,!fs(t)&&(e=se[(a=String(t)).toLowerCase()],e===void 0))throw new w(`Unknown adapter '${a}'`);if(e)break;r[a||"#"+s]=e}if(!e){const s=Object.entries(r).map(([o,c])=>`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=i?s.length>1?`since :
|
|
28
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...t){const e=new this(i);return t.forEach(r=>e.set(r)),e}static accessor(i){const e=(this[qe]=this[qe]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=pt(a);e[o]||(Gr(r,a),e[o]=!0)}return d.isArray(i)?i.forEach(s):s(i),this}};M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(M.prototype,({value:n},i)=>{let t=i[0].toUpperCase()+i.slice(1);return{get:()=>n,set(e){this[t]=e}}});d.freezeMethods(M);function Qt(n,i){const t=this||vt,e=i||t,r=M.from(e.headers);let s=e.data;return d.forEach(n,function(o){s=o.call(t,s,r.normalize(),i?i.status:void 0)}),r.normalize(),s}function _i(n){return!!(n&&n.__CANCEL__)}function lt(n,i,t){w.call(this,n??"canceled",w.ERR_CANCELED,i,t),this.name="CanceledError"}d.inherits(lt,w,{__CANCEL__:!0});function gi(n,i,t){const e=t.config.validateStatus;!t.status||!e||e(t.status)?n(t):i(new w("Request failed with status code "+t.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function $r(n){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return i&&i[1]||""}function Jr(n,i){n=n||10;const t=new Array(n),e=new Array(n);let r=0,s=0,a;return i=i!==void 0?i:1e3,function(c){const u=Date.now(),l=e[s];a||(a=u),t[r]=c,e[r]=u;let p=s,g=0;for(;p!==r;)g+=t[p++],p=p%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),u-a<i)return;const P=l&&u-l;return P?Math.round(g*1e3/P):void 0}}function Qr(n,i){let t=0,e=1e3/i,r,s;const a=(u,l=Date.now())=>{t=l,r=null,s&&(clearTimeout(s),s=null),n.apply(null,u)};return[(...u)=>{const l=Date.now(),p=l-t;p>=e?a(u,l):(r=u,s||(s=setTimeout(()=>{s=null,a(r)},e-p)))},()=>r&&a(r)]}const Ut=(n,i,t=3)=>{let e=0;const r=Jr(50,250);return Qr(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,c=a-e,u=r(c),l=a<=o;e=a;const p={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:u||void 0,estimated:u&&o&&l?(o-a)/u:void 0,event:s,lengthComputable:o!=null,[i?"download":"upload"]:!0};n(p)},t)},Ke=(n,i)=>{const t=n!=null;return[e=>i[0]({lengthComputable:t,total:n,loaded:e}),i[1]]},He=n=>(...i)=>d.asap(()=>n(...i)),Zr=N.hasStandardBrowserEnv?((n,i)=>t=>(t=new URL(t,N.origin),n.protocol===t.protocol&&n.host===t.host&&(i||n.port===t.port)))(new URL(N.origin),N.navigator&&/(msie|trident)/i.test(N.navigator.userAgent)):()=>!0,Yr=N.hasStandardBrowserEnv?{write(n,i,t,e,r,s){const a=[n+"="+encodeURIComponent(i)];d.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),d.isString(e)&&a.push("path="+e),d.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(n){const i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ts(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function es(n,i){return i?n.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):n}function mi(n,i,t){let e=!ts(i);return n&&(e||t==!1)?es(n,i):i}const We=n=>n instanceof M?{...n}:n;function nt(n,i){i=i||{};const t={};function e(u,l,p,g){return d.isPlainObject(u)&&d.isPlainObject(l)?d.merge.call({caseless:g},u,l):d.isPlainObject(l)?d.merge({},l):d.isArray(l)?l.slice():l}function r(u,l,p,g){if(d.isUndefined(l)){if(!d.isUndefined(u))return e(void 0,u,p,g)}else return e(u,l,p,g)}function s(u,l){if(!d.isUndefined(l))return e(void 0,l)}function a(u,l){if(d.isUndefined(l)){if(!d.isUndefined(u))return e(void 0,u)}else return e(void 0,l)}function o(u,l,p){if(p in i)return e(u,l);if(p in n)return e(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,responseEncoding:a,validateStatus:o,headers:(u,l,p)=>r(We(u),We(l),p,!0)};return d.forEach(Object.keys(Object.assign({},n,i)),function(l){const p=c[l]||r,g=p(n[l],i[l],l);d.isUndefined(g)&&p!==o||(t[l]=g)}),t}const yi=n=>{const i=nt({},n);let{data:t,withXSRFToken:e,xsrfHeaderName:r,xsrfCookieName:s,headers:a,auth:o}=i;i.headers=a=M.from(a),i.url=pi(mi(i.baseURL,i.url,i.allowAbsoluteUrls),n.params,n.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let c;if(d.isFormData(t)){if(N.hasStandardBrowserEnv||N.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...l]=c?c.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...l].join("; "))}}if(N.hasStandardBrowserEnv&&(e&&d.isFunction(e)&&(e=e(i)),e||e!==!1&&Zr(i.url))){const u=r&&s&&Yr.read(s);u&&a.set(r,u)}return i},is=typeof XMLHttpRequest<"u",ns=is&&function(n){return new Promise(function(t,e){const r=yi(n);let s=r.data;const a=M.from(r.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:u}=r,l,p,g,P,m;function b(){P&&P(),m&&m(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let y=new XMLHttpRequest;y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout;function C(){if(!y)return;const R=M.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),I={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:R,config:n,request:y};gi(function(k){t(k),b()},function(k){e(k),b()},I),y=null}"onloadend"in y?y.onloadend=C:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(C)},y.onabort=function(){y&&(e(new w("Request aborted",w.ECONNABORTED,n,y)),y=null)},y.onerror=function(){e(new w("Network Error",w.ERR_NETWORK,n,y)),y=null},y.ontimeout=function(){let U=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const I=r.transitional||fi;r.timeoutErrorMessage&&(U=r.timeoutErrorMessage),e(new w(U,I.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,n,y)),y=null},s===void 0&&a.setContentType(null),"setRequestHeader"in y&&d.forEach(a.toJSON(),function(U,I){y.setRequestHeader(I,U)}),d.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),o&&o!=="json"&&(y.responseType=r.responseType),u&&([g,m]=Ut(u,!0),y.addEventListener("progress",g)),c&&y.upload&&([p,P]=Ut(c),y.upload.addEventListener("progress",p),y.upload.addEventListener("loadend",P)),(r.cancelToken||r.signal)&&(l=R=>{y&&(e(!R||R.type?new lt(null,n,y):R),y.abort(),y=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const T=$r(r.url);if(T&&N.protocols.indexOf(T)===-1){e(new w("Unsupported protocol "+T+":",w.ERR_BAD_REQUEST,n));return}y.send(s||null)})},rs=(n,i)=>{const{length:t}=n=n?n.filter(Boolean):[];if(i||t){let e=new AbortController,r;const s=function(u){if(!r){r=!0,o();const l=u instanceof Error?u:this.reason;e.abort(l instanceof w?l:new lt(l instanceof Error?l.message:l))}};let a=i&&setTimeout(()=>{a=null,s(new w(`timeout ${i} of ms exceeded`,w.ETIMEDOUT))},i);const o=()=>{n&&(a&&clearTimeout(a),a=null,n.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),n=null)};n.forEach(u=>u.addEventListener("abort",s));const{signal:c}=e;return c.unsubscribe=()=>d.asap(o),c}},ss=function*(n,i){let t=n.byteLength;if(t<i){yield n;return}let e=0,r;for(;e<t;)r=e+i,yield n.slice(e,r),e=r},as=async function*(n,i){for await(const t of os(n))yield*ss(t,i)},os=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const i=n.getReader();try{for(;;){const{done:t,value:e}=await i.read();if(t)break;yield e}}finally{await i.cancel()}},Xe=(n,i,t,e)=>{const r=as(n,i);let s=0,a,o=c=>{a||(a=!0,e&&e(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await r.next();if(u){o(),c.close();return}let p=l.byteLength;if(t){let g=s+=p;t(g)}c.enqueue(new Uint8Array(l))}catch(u){throw o(u),u}},cancel(c){return o(c),r.return()}},{highWaterMark:2})},Ht=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bi=Ht&&typeof ReadableStream=="function",cs=Ht&&(typeof TextEncoder=="function"?(n=>i=>n.encode(i))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),Pi=(n,...i)=>{try{return!!n(...i)}catch{return!1}},us=bi&&Pi(()=>{let n=!1;const i=new Request(N.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!i}),ze=64*1024,re=bi&&Pi(()=>d.isReadableStream(new Response("").body)),Lt={stream:re&&(n=>n.body)};Ht&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(i=>{!Lt[i]&&(Lt[i]=d.isFunction(n[i])?t=>t[i]():(t,e)=>{throw new w(`Response type '${i}' is not supported`,w.ERR_NOT_SUPPORT,e)})})})(new Response);const hs=async n=>{if(n==null)return 0;if(d.isBlob(n))return n.size;if(d.isSpecCompliantForm(n))return(await new Request(N.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(d.isArrayBufferView(n)||d.isArrayBuffer(n))return n.byteLength;if(d.isURLSearchParams(n)&&(n=n+""),d.isString(n))return(await cs(n)).byteLength},ls=async(n,i)=>{const t=d.toFiniteNumber(n.getContentLength());return t??hs(i)},ps=Ht&&(async n=>{let{url:i,method:t,data:e,signal:r,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:u,headers:l,withCredentials:p="same-origin",fetchOptions:g}=yi(n);u=u?(u+"").toLowerCase():"text";let P=rs([r,s&&s.toAbortSignal()],a),m;const b=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let y;try{if(c&&us&&t!=="get"&&t!=="head"&&(y=await ls(l,e))!==0){let I=new Request(i,{method:"POST",body:e,duplex:"half"}),v;if(d.isFormData(e)&&(v=I.headers.get("content-type"))&&l.setContentType(v),I.body){const[k,X]=Ke(y,Ut(He(c)));e=Xe(I.body,ze,k,X)}}d.isString(p)||(p=p?"include":"omit");const C="credentials"in Request.prototype;m=new Request(i,{...g,signal:P,method:t.toUpperCase(),headers:l.normalize().toJSON(),body:e,duplex:"half",credentials:C?p:void 0});let T=await fetch(m,g);const R=re&&(u==="stream"||u==="response");if(re&&(o||R&&b)){const I={};["status","statusText","headers"].forEach(z=>{I[z]=T[z]});const v=d.toFiniteNumber(T.headers.get("content-length")),[k,X]=o&&Ke(v,Ut(He(o),!0))||[];T=new Response(Xe(T.body,ze,k,()=>{X&&X(),b&&b()}),I)}u=u||"text";let U=await Lt[d.findKey(Lt,u)||"text"](T,n);return!R&&b&&b(),await new Promise((I,v)=>{gi(I,v,{data:U,headers:M.from(T.headers),status:T.status,statusText:T.statusText,config:n,request:m})})}catch(C){throw b&&b(),C&&C.name==="TypeError"&&/Load failed|fetch/i.test(C.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,n,m),{cause:C.cause||C}):w.from(C,C&&C.code,n,m)}}),se={http:Ar,xhr:ns,fetch:ps};d.forEach(se,(n,i)=>{if(n){try{Object.defineProperty(n,"name",{value:i})}catch{}Object.defineProperty(n,"adapterName",{value:i})}});const Ge=n=>`- ${n}`,fs=n=>d.isFunction(n)||n===null||n===!1,vi={getAdapter:n=>{n=d.isArray(n)?n:[n];const{length:i}=n;let t,e;const r={};for(let s=0;s<i;s++){t=n[s];let a;if(e=t,!fs(t)&&(e=se[(a=String(t)).toLowerCase()],e===void 0))throw new w(`Unknown adapter '${a}'`);if(e)break;r[a||"#"+s]=e}if(!e){const s=Object.entries(r).map(([o,c])=>`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=i?s.length>1?`since :
|
|
29
29
|
`+s.map(Ge).join(`
|
|
30
|
-
`):" "+Ge(s[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return e},adapters:se};function Zt(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new lt(null,n)}function $e(n){return Zt(n),n.headers=M.from(n.headers),n.data=Qt.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),vi.getAdapter(n.adapter||vt.adapter)(n).then(function(e){return Zt(n),e.data=Qt.call(n,n.transformResponse,e),e.headers=M.from(e.headers),e},function(e){return _i(e)||(Zt(n),e&&e.response&&(e.response.data=Qt.call(n,n.transformResponse,e.response),e.response.headers=M.from(e.response.headers))),Promise.reject(e)})}const wi="1.
|
|
31
|
-
`+s):e.stack=s}catch{}}throw e}}_request(i,t){typeof i=="string"?(t=t||{},t.url=i):t=i||{},t=nt(this.defaults,t);const{transitional:e,paramsSerializer:r,headers:s}=t;e!==void 0&&It.assertOptions(e,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(d.isFunction(r)?t.paramsSerializer={serialize:r}:It.assertOptions(r,{encode:G.function,serialize:G.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),It.assertOptions(t,{baseUrl:G.spelling("baseURL"),withXsrfToken:G.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=s&&d.merge(s.common,s[t.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),t.headers=M.concat(a,s);const o=[];let c=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(t)===!1||(c=c&&b.synchronous,o.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let l,p=0,g;if(!c){const m=[$e.bind(this),void 0];for(m.unshift.apply(m,o),m.push.apply(m,u),g=m.length,l=Promise.resolve(t);p<g;)l=l.then(m[p++],m[p++]);return l}g=o.length;let P=t;for(p=0;p<g;){const m=o[p++],b=o[p++];try{P=m(P)}catch(y){b.call(this,y);break}}try{l=$e.call(this,P)}catch(m){return Promise.reject(m)}for(p=0,g=u.length;p<g;)l=l.then(u[p++],u[p++]);return l}getUri(i){i=nt(this.defaults,i);const t=mi(i.baseURL,i.url,i.allowAbsoluteUrls);return pi(t,i.params,i.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(i){it.prototype[i]=function(t,e){return this.request(nt(e||{},{method:i,url:t,data:(e||{}).data}))}});d.forEach(["post","put","patch"],function(i){function t(e){return function(s,a,o){return this.request(nt(o||{},{method:i,headers:e?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}it.prototype[i]=t(),it.prototype[i+"Form"]=t(!0)});let _s=class Ei{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const e=this;this.promise.then(r=>{if(!e._listeners)return;let s=e._listeners.length;for(;s-- >0;)e._listeners[s](r);e._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{e.subscribe(o),s=o}).then(r);return a.cancel=function(){e.unsubscribe(s)},a},i(function(s,a,o){e.reason||(e.reason=new lt(s,a,o),t(e.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const i=new AbortController,t=e=>{i.abort(e)};return this.subscribe(t),i.signal.unsubscribe=()=>this.unsubscribe(t),i.signal}static source(){let i;return{token:new Ei(function(r){i=r}),cancel:i}}};function gs(n){return function(t){return n.apply(null,t)}}function ms(n){return d.isObject(n)&&n.isAxiosError===!0}const ae={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};Object.entries(ae).forEach(([n,i])=>{ae[i]=n});function Si(n){const i=new it(n),t=ti(it.prototype.request,i);return d.extend(t,it.prototype,i,{allOwnKeys:!0}),d.extend(t,i,null,{allOwnKeys:!0}),t.create=function(r){return Si(nt(n,r))},t}const A=Si(vt);A.Axios=it;A.CanceledError=lt;A.CancelToken=_s;A.isCancel=_i;A.VERSION=wi;A.toFormData=Kt;A.AxiosError=w;A.Cancel=A.CanceledError;A.all=function(i){return Promise.all(i)};A.spread=gs;A.isAxiosError=ms;A.mergeConfig=nt;A.AxiosHeaders=M;A.formToJSON=n=>di(d.isHTMLForm(n)?new FormData(n):n);A.getAdapter=vi.getAdapter;A.HttpStatusCode=ae;A.default=A;const{Axios:ws,AxiosError:Es,CanceledError:Ss,isCancel:Ts,CancelToken:Cs,VERSION:As,all:Rs,Cancel:Os,isAxiosError:xs,spread:Ds,toFormData:Is,AxiosHeaders:Bs,HttpStatusCode:Ns,formToJSON:Vs,getAdapter:Us,mergeConfig:Ls}=A;var h,Ti,Ci,Ai,oe,Ri,Oi,xi,Di,Ii,Bi,Ni,Vi,Ui,Li,dt,_t,Mi,gt,ki,tt,Fi,D,ji,qi,ce,Ki,Hi,Wi,ue,he,mt,le,Xi,q,K,Bt,pe,yt,fe,de,zi,_e,ge,Gi,$i,ot,me,Ji,Qi,Zi,Nt,Yi,tn,ye,en,nn,rn,sn,an,on,cn,un,hn,be,Pe,ln,pn,fn;class ys extends B.Kernel{constructor({filters:t=null,config_port:e={baudRate:19200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:r=1,device_listen_on_channel:s=1,username:a=null,password:o=null,environment:c="production"}={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"}){super({filters:t,config_port:e,no_device:r,device_listen_on_channel:s});Ae(this,h);Ce(this,"__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:{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}});if(this.__internal__.device.type="pinpad",!B.supportCrypto())throw new Error("Crypto not supported in this browser");if(B._.getCustom(this.typeDevice,r))throw new Error(`Device ${this.typeDevice} ${r} already exists`);this.__internal__.time.response_connection=3e3,this.__internal__.time.response_general=5e3,this.__internal__.serial.delay_first_connection=1e3,this.environment=c,a&&(this.username=a),o&&(this.password=o),f(this,h,Ci).call(this),f(this,h,Ti).call(this)}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")}serialMessage(t){const e={original_code:t,code:null,name:null,description:null,request:this.lastAction,no_code:0,parsed:null},r=this.parseHexToUint8(t),s=this.parseUint8ArrayToString(r);let a=f(this,h,Ai).call(this,s);switch(this.__pinPad__.buffer=s,e.parsed=a,e.code=s,e.request){case"connect":e.name="connected",e.description="Connection established",e.no_code=100,f(this,h,oe).call(this,a,s);break;case"about":e.name="About PinPad",e.description="Response of about",e.no_code=101,f(this,h,oe).call(this,a,s);break;case"inject":e.name="Inject",e.description="Response of inject values",e.no_code=102,f(this,h,Ri).call(this,a,s);break;case"init-dukpt":e.name="Init DUKPT",e.description="Response of init DUKPT",e.no_code=103,f(this,h,Oi).call(this,a,s);break;case"dukpt":e.name="Write DUKPT",e.description="Response of write DUKPT",e.no_code=104,f(this,h,xi).call(this,a,s);break;case"read-card":e.name="read card",e.description="response of read card",e.no_code=105,f(this,h,Di).call(this,a,s);break;case"second-generate":e.name="second generate",e.description="response of second generate",e.no_code=106,f(this,h,Ii).call(this,a,s);break;case"cancel":e.name="cancel pinpad",e.description="response of cancel",e.no_code=107;break;case"print":f(this,h,Vi).call(this,a,s),e.name="print voucher",e.description="response of print",e.no_code=108;break;case"cancel-read-card":f(this,h,Ni).call(this,a,s),e.name="cancel read card",e.description="response of cancel read card",e.no_code=109;break;case"code93":f(this,h,Ui).call(this,a,s),e.name="code 93",e.description="response of code 93",e.no_code=110;break;case"finish-emv-end":f(this,h,Li).call(this,a,s),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(t=1){const e="",r="";let s="C56AABOUT";s=e+s.length.toString().padStart(3,"0")+s+r;let a=0;for(let c=0;c<s.length;c++)a^=s.charCodeAt(c);s=s+String.fromCharCode(a);const o=this.parseStringToBytes(s,"");return this.add0x(o)}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(!f(this,h,le).call(this,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)}async login({force:t=!1}={}){return await f(this,h,qi).call(this,t)}clearSession(){localStorage.removeItem("ppLoginResponse"),localStorage.removeItem("ppRSAKey"),localStorage.removeItem("ppPublicIP")}async checkPositionPermission(){if(!B.supportGeolocation())throw new Error("Geolocation not supported");return new Promise((t,e)=>{navigator.permissions.query({name:"geolocation"}).then(r=>{r.state==="granted"?t(!0):t(!1)}).catch(()=>e(!1))})}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,r=this.__pinPad__.constants.ETX;this.__pinPad__.operation.commerceVoucher.includes(":")||(this.__pinPad__.operation.commerceVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,this.__pinPad__.operation.commerceVoucher)),this.__pinPad__.operation.clientVoucher.includes(":")||(this.__pinPad__.operation.clientVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,this.__pinPad__.operation.clientVoucher));let s=t==="client"?this.__pinPad__.operation.clientVoucher:this.__pinPad__.operation.commerceVoucher;if(s.length===0){this.dispatch("pp:print",{error:!0,code:"001",message:"Without information to print"});return}s=f(this,h,Fi).call(this,s),s=f(this,h,ji).call(this,s,this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion);let a="C59A"+s;a=e+f(this,h,q).call(this,a)+a+r,a=a+f(this,h,K).call(this,a),t==="client"?this.__pinPad__.operation.clientVoucher="":t==="commerce"&&(this.__pinPad__.operation.commerceVoucher="");const o=this.parseStringToBytes(a,"");await this.appendToQueue(o,"print")}getClientVoucher(){return this.__pinPad__.operation.clientVoucher}getCommerceVoucher(){return this.__pinPad__.operation.commerceVoucher}async consult({reference:t=null}){return t||(t=this.reference),B.isEmpty(t)&&(t="--",this.reference=t),f(this,h,Xi).call(this,this.reference),this.__pinPad__.operation.consultDate=new Date().toLocaleDateString("en-GB"),await f(this,h,yt).call(this,{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}),f(this,h,ot).call(this,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 rePrint({folio:t=null}={}){t===null&&(t=this.__pinPad__.operation.folio||""),f(this,h,fe).call(this,t),await f(this,h,yt).call(this,{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:t});const e=await f(this,h,ot).call(this,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=e.voucher_comercio;return this.__pinPad__.operation.commerceVoucher="",r&&(e.voucher_comercio.includes(":")?this.__pinPad__.operation.commerceVoucher=e.voucher_comercio:this.__pinPad__.operation.commerceVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,e.voucher_comercio)),r=e.voucher_cliente,this.__pinPad__.operation.clientVoucher="",r&&(e.voucher_cliente.includes(":")?this.__pinPad__.operation.clientVoucher=e.voucher_cliente:this.__pinPad__.operation.clientVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,e.voucher_cliente)),e}async cancelPurchase({amount:t=0,authorization:e="",folio:r=""}={}){if(!f(this,h,pe).call(this,t))throw new Error("Invalid amount");if(!f(this,h,an).call(this,e))throw new Error("Invalid authorization");if(!f(this,h,fe).call(this,r))throw new Error("Invalid folio");t=f(this,h,ye).call(this,t,2);const 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:r,Tx_Auth:e,Amount:t};await f(this,h,yt).call(this,s);const a=f(this,h,ot).call(this,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:r,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=f(this,h,tt).call(this,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=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,a.voucher_cliente)),JSON.stringify(a)}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||B.isEmpty(e)||!f(this,h,le).call(this,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");let r={error:!1,message:null,approved:!1,object:{}};try{return await this.login(),await f(this,h,tn).call(this),!await f(this,h,en).call(this)||!await f(this,h,Qi).call(this)?r:await f(this,h,cn).call(this)}catch(s){console.warn(s),r.error=!0,r.message=s.message,r.approved=!1,r.object=s}return r}}h=new WeakSet,Ti=function(){B._.add(this)},Ci=function(){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)},Ai=function(t){const e=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX,s=this.__pinPad__.constants.FS,a=this.__pinPad__.constants.getNULL;t=t.replace(new RegExp(e,"g"),"");const o=t.split(r);t=o[0];const c=t.split(s);c.push(...o[1].split(s));const u={};return c.map((l,p)=>{const g=p>0?l.substring(0,1):"A",P=p>0?l.substring(1):l;return{[g]:P.replace(new RegExp(a,"g"),"")}}).forEach(l=>Object.assign(u,l)),u},oe=function(t,e){const r=this.__pinPad__.constants.ETX,s=e.substring(e.indexOf("D")+2,e.indexOf("E"));let a=0;const o=e.indexOf("N")>0,c=e.substring(e.indexOf("A00")+3,e.indexOf("B"));if(c&&c!=="undefined"&&c.toUpperCase()==="VERIFONE"){const l=s.replace("MITP_1.00.","").replace("MITP_01.00.","").replace("MITD_1.00.","").replace("MITD_01.00.","");a=parseInt(l),a>=15&&(this.__pinPad__.about.hasCashback=!0)}this.__pinPad__.about.supportInjection=o,e.indexOf("M")>0?(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf("M")),this.__pinPad__.about.supportInjection?this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf("N")):(this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf(r)),this.__pinPad__.about.supportContactless=!0)):(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf(r)),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=c,this.__pinPad__.about.appVersion=s;const u=e.substring(e.indexOf("K")+2,e.indexOf("L"));this.__pinPad__.about.pp={brand:c,appVersion:s,versionInt:a,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,hasDUKPTKeys:u,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")},Ri=function(t,e){this.__pinPad__.waiting.statusInjectWaiting="resolved"},Oi=function(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"},xi=function(t,e){this.__pinPad__.waiting.statuswritingDUKPTWaiting="resolved"},Di=function(t,e){const r=this.__pinPad__.about.brand.toLowerCase(),s=this.__pinPad__.about.model.toLowerCase(),a=r==="ingenico"&&s==="ipp320"?500:350;if(e.length<a){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=f(this,h,Pe).call(this,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&&s==="vx820"||e.includes("P93A022")&&e.length>=406&&s==="vx520"||e.includes("P93A800")&&e.length>=406&&s==="vx520"||e.includes("P93A800")&&e.length>=406&&s==="vx820"||e.includes("P93A022")&&e.length>=406&&s==="p400"||e.includes("P93A800")&&e.length>=406&&s==="p400"||e.includes("P93A022")&&e.length>=406&&s==="v205c"||e.includes("P93A800")&&e.length>=406&&s==="v205c"||e.includes("P93A022")&&e.length>=406&&s==="move2500"||e.includes("P93A800")&&e.length>=406&&s==="move2500"||e.includes("P93A022")&&e.length>=406&&s==="lane3000"||e.includes("P93A800")&&e.length>=406&&s==="lane3000"){let o=e;r==="verifone"&&(o=e.replace("006P93A00.","").substring(e.indexOf("P93A"),e.indexOf("P93A")+7)),e.includes("P81APROCESANDO, NO RETIRE TARJETA")||e.includes("P81APROCESANDO TARJETA")||o.includes("P93A022")||o.includes("P81AINSERTE CHIP O DESLICE TARJETA")||o.includes("ACERQUE, INSERTE CHIP O DESLICE")||o.includes("P81AACERQUE, INSERTE CHIP O DESLICE TARJETA")?this.dispatch("pp:processing-card",{waiting:!0}):e.length>a&&f(this,h,Bi).call(this,e)}},Ii=function(t,e){const r=this.__pinPad__.constants.ETX;let s=e.replace("023P81AFAVOR RETIRAR TARJ.","").replace("020P81A DECLINADA EMV ","").replace("020P81A DECLINADA EMV ","");s=s.substring(s.indexOf("B")+2,s.indexOf(r)),s.includes("006E93A16")&&(s="01"),this.__pinPad__.operation.applyReverse=s==="01"&&this.__pinPad__.operation.responseMit._approved&&this.__pinPad__.config.otherLogin.executeReverse==="1",this.__pinPad__.waiting.statusSecondGenerateWaiting="resolved"},Bi=function(t){const e=this.__pinPad__.constants.ETX,r=this.__pinPad__.about.brand.toLowerCase();let s,a,o,c,u;r==="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 l=this.__pinPad__.config.read.POSEM;if(l==="051"||l==="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 p=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=p.substring(p.indexOf("M")+2,p.indexOf("N")),this.__pinPad__.operation.hasQPS=p.substring(p.indexOf("N")+2,p.indexOf("O"))==="1",this.__pinPad__.operation.bin8=p.substring(p.indexOf("O")+2,p.indexOf(e))}else if(t.includes("N")){const p=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=p.substring(p.indexOf("M")+2,p.indexOf("N")),this.__pinPad__.operation.hasQPS=p.substring(p.indexOf("N")+2,p.indexOf(e))==="1"}else{const p=t.substring(t.indexOf("P93A"),t.indexOf("M")+5);this.__pinPad__.config.read.ReadCTLS=p.substring(p.indexOf("M")+2,p.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")),a=t.substring(t.indexOf("I")+2,t.indexOf("J")),o=t.substring(t.indexOf("E")+2,t.indexOf("F")),this.__pinPad__.config.read.ChipName=o,s=t.substring(t.indexOf("J")+2,t.indexOf("K"))}else{let p;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")),l==="022")if(t.includes("O")){const g=t.substring(t.indexOf("P93A"));this.__pinPad__.operation.bin8=g.substring(g.indexOf("O")+2,g.indexOf(e)),p=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),p=p.substring(p.indexOf("I")+2,p.lastIndexOf(""))}else p=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),p=p.substring(p.indexOf("I")+2,p.indexOf(e));else p=t.substring(t.indexOf("P93A800"),t.indexOf("I")+23),p=p.substring(p.indexOf("I")+2,p.indexOf(e));this.__pinPad__.config.read.NB_ksn=p,this.__pinPad__.config.read.NB_Data=t.substring(t.indexOf("B")+2,t.indexOf("C")),a=t.substring(t.indexOf("F")+2,t.indexOf("G")),s=t.substring(t.indexOf("G")+2,t.indexOf("H")),this.__pinPad__.about.model.toLowerCase()==="vx520"?(o=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=o):(o=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=o)}s.includes("/")&&(s=s.replace("/","")),s.toString().length===4?(u=s.toString().substring(0,2),c=s.toString().substring(2)):(u="",c=""),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=a,a.length>6&&(this.__pinPad__.operation.bin=a.substring(0,6)),this.__pinPad__.waiting.statusReadCardWaiting="resolved",this.dispatch("pp:read-card",{ERROR:"",maskPan:a,name:o,month:u,year:c})},Ni=function(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."}))},Vi=function(t,e){const r=this;if(this.__pinPad__.about.model.toLowerCase()==="vx520"){if(e.length>11)if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(function(){r.print("client").then(()=>{}).catch(s=>{console.error(s)})},1e3):this.dispatch("pp:print",{type:"success"});else{const s=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",s)}}else if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(function(){r.print("client").then(()=>{}).catch(s=>{console.error(s)})},1e3):this.dispatch("pp:print",{type:"success"});else{const s=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",s)}},Ui=function(t,e){},Li=function(t,e){},dt=function(t,e){const r=new jn;return r.setPublicKey(t),r.encrypt(e)},_t=function(t){const e="0123456789ABCDEF";let r="";for(let s=0;s<t;s++){const a=Math.floor(Math.random()*e.length);r+=e.substring(a,a+1)}return r},Mi=function(t){const e="0123456789abcdef",r=[],s=[];for(let a=0;a<256;a++)r[a]=e.charAt(a>>4)+e.charAt(a&15);for(let a=0;a<t.length;a++)s[a]=r[t.charCodeAt(a)];return s.join("")},gt=async function(t,e){const r=new Uint8Array(t.match(/.{1,2}/g).map(g=>parseInt(g,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)),p=btoa(String.fromCharCode(...new Uint8Array(u)));return l+p},ki=function(t,e,r=!1){const s=[];for(let l=0;l<256;l++)s[l]=l;let a=0;for(let l=0;l<256;l++)a=(a+s[l]+t.charCodeAt(l%t.length))%256,[s[l],s[a]]=[s[a],s[l]];let o=0,c=0,u="";for(const l of e){o=(o+1)%256,c=(c+s[o])%256,[s[o],s[c]]=[s[c],s[o]];let p=s[(s[o]+s[c])%256];u+=String.fromCharCode(l.charCodeAt(0)^p)}return r?f(this,h,Mi).call(this,u).toUpperCase():u},tt=function(t,e){return f(this,h,ki).call(this,t,this.hexToAscii(e))},Fi=function(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},D=function(t,e,r){if(t=t.replace("@cnb logo_cpagos",e),t=t.replace("@cnn ver_app",r),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 s=t.indexOf("@lsn POR ESTE PAGARE ME OBLIGO INCONDI");t=t.substring(0,s)}return t.trim()+"@br @br @br @br @br"},ji=function(t,e){const r="@logo3 @br",s="@cnn "+e;return t.includes("@cnb Santander")?(t=t.replace("@cnb Santander","@logo1@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb American Express")?(t=t.replace("@cnb American Express","@logo2@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb HSBC")?(t=t.replace("@cnb HSBC","@logo7@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb IXE")?(t=t.replace("@cnb IXE","@logo11@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb MULTIVA")?(t=t.replace("@cnb MULTIVA","@logo15@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Multiva")?(t=t.replace("@cnb Multiva","@logo15@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb SCOTIA BANK")?(t=t.replace("@cnb SCOTIA BANK","@logo16@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb SCOTIABANK")?(t=t.replace("@cnb SCOTIABANK","@logo16@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BANCOMER")?(t=t.replace("@cnb BANCOMER","@logo17@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Bancomer")?(t=t.replace("@cnb Bancomer","@logo17@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BBVA")?(t=t.replace("@cnb BBVA","@logo17@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BANORTE")?(t=t.replace("@cnb BANORTE","@logo18@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Banorte")?(t=t.replace("@cnb Banorte","@logo18@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BANREGIO")?(t=t.replace("@cnb BANREGIO","@logo19@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Banregio")?(t=t.replace("@cnb Banregio","@logo19@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb GETNET")?(t=t.replace("@cnb GETNET","@logo20@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb GetNET")?(t=t.replace("@cnb GetNET","@logo20@br"),f(this,h,D).call(this,t,r,s)):f(this,h,D).call(this,t,r,s)},qi=async function(t=!1){if(f(this,h,Hi).call(this),this.__pinPad__.config.loginResponse&&!t)return await f(this,h,ce).call(this);const e=this.url+this.__pinPad__.constants.uris.login,r={usuario:this.username,password:this.password,crypto:"",version:this.__pinPad__.constants.appVersion,serieLector:"",canal:this.__pinPad__.constants.appChannel};if(await f(this,h,mt).call(this),f(this,h,ue).call(this))throw new Error("Empty RSA Key");const s=f(this,h,_t).call(this,32),a=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,s),o=await f(this,h,gt).call(this,s,JSON.stringify(r)),c=await A.post(e,o,{headers:{"Content-Type":"application/json","cache-control":"no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0",data:a||""}}).catch(l=>{var p;throw new Error(`Error in request, verify internet connection: ${(p=l.response)==null?void 0:p.status} ${l.message}`)});let u=f(this,h,de).call(this,JSON.stringify(c.data));if(typeof u=="string"&&(u=JSON.parse(u)),!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 f(this,h,ce).call(this)},ce=async function(){await f(this,h,$i).call(this);try{await f(this,h,Gi).call(this)}catch(t){console.log("Error getting position",t)}return this.__pinPad__.config.otherLogin={},f(this,h,Ki).call(this,this.__pinPad__.config.loginResponse),this.__pinPad__.config.otherLogin},Ki=function(t){var a,o,c,u,l,p;let e="",r="";(o=(a=t.xml)==null?void 0:a.ventaspropias)!=null&&o.merchant_currencyb&&(e=t.xml.ventaspropias.merchant_currencyb),(u=(c=t.xml)==null?void 0:c.ventaspropias)!=null&&u.merchant_currencym&&(r=t.xml.ventaspropias.merchant_currencym);let s=(l=t.xml)==null?void 0:l.emvReverso;s||(s="0"),this.__pinPad__.config.internal.stTokenization=(p=t.xml)==null?void 0:p.st_tokenizacion,!this.__pinPad__.config.internal.stTokenization||this.__pinPad__.config.internal.stTokenization==="false"||this.__pinPad__.config.internal.stTokenization==="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:r,executeReverse:s}},Hi=function(){let t=localStorage.getItem("ppLoginResponse");t&&(t=JSON.parse(t),this.__pinPad__.config.loginResponse||(this.__pinPad__.config.loginResponse=t.data),new Date().getTime()-t.timestamp>=864e5&&(this.__pinPad__.config.loginResponse=null))},Wi=async function(){const t=this.url+this.__pinPad__.constants.uris.RSAKey,e=await A.get(t).catch(r=>{throw new Error(`Error in request, verify internet connection: ${r.response.status} ${r.message}`)});if(e.headers.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},ue=function(){let t=localStorage.getItem("ppRSAKey");return!t||(t=JSON.parse(t),this.__pinPad__.config.publicKeyRSA=t.data,new Date().getTime()-t.timestamp>=864e5)?!0:!this.__pinPad__.config.publicKeyRSA},he=async function(){return f(this,h,ue).call(this)?await f(this,h,Wi).call(this):this.__pinPad__.config.publicKeyRSA},mt=async function(){if(!await f(this,h,he).call(this))throw new Error("RSA public key is empty")},le=function(t){return/^[A-Z-a-z0-9\s]+$/g.test(t)},Xi=function(t){if(B.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},q=function(t){return t.length.toString().padStart(3,"0")},K=function(t){let e=0;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r);return String.fromCharCode(e)},Bt=function(t,e=0){return t=parseFloat(t.toString().replace(/[^0-9.-]/g,"")),isNaN(t)?0 .toFixed(e):t.toFixed(e).replace(/,/g,"")},pe=function(t){return t=parseFloat(t.toString()),!(isNaN(t)||t<0)},yt=async function(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},fe=function(t){if(!t||isNaN(parseInt(t))||t.toString().length!==9)throw new Error("Number of operation must be number of 9 digits");return t},de=function(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},zi=async function(){const t=this.__pinPad__.constants.STX,e=this.__pinPad__.constants.ETX;let r="C55ACANCEL";r=t+f(this,h,q).call(this,r)+r+e,r=r+f(this,h,K).call(this,r);const s=this.parseStringToBytes(r,"");await this.appendToQueue(s,"cancel")},_e=function(){const t=new Date,e=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear().toString().substring(2);return e+r+s},ge=function(){const t=new Date,e=t.getHours().toString().padStart(2,"0"),r=t.getMinutes().toString().padStart(2,"0");return e+r},Gi=async function(){return this.__pinPad__.config.latitude&&this.__pinPad__.config.longitude?this.latitudeLongitude:(this.__pinPad__.config.latitude=null,this.__pinPad__.config.longitude=null,B.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)},$i=async function(){let t=localStorage.getItem("ppPublicIP");if(t&&(t=JSON.parse(t),this.__pinPad__.config.publicIP=t.data,new Date().getTime()-t.timestamp>=864e5&&(this.__pinPad__.config.publicIP=null)),this.__pinPad__.config.publicIP)return this.__pinPad__.config.publicIP;this.__pinPad__.config.publicIP=null;let e=!1;const r=await A.get("https://api.ipify.org?format=json").catch(()=>e=!0);return e?null:(this.__pinPad__.config.publicIP=r.data.ip||null,localStorage.setItem("ppPublicIP",JSON.stringify({timestamp:new Date().getTime(),data:r.data.ip})),this.__pinPad__.config.publicIP)},ot=async function(t,e){await f(this,h,mt).call(this);const r=f(this,h,_t).call(this,32);let s=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,r),a=await f(this,h,gt).call(this,r,JSON.stringify(e));return(await A.post(t,a,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:s||""}}).catch(c=>{var u;throw c.response.data.includes("Ha ocurrido un error al procesar su solicitud.")?new Error("It was not possible to obtain the affiliations."):c.response.status>=500&&c.response.status<=599?new Error(`Service Temporarily Unavailable ${c.message}`):new Error(`Error in request, verify internet connection: ${(u=c.response)==null?void 0:u.status} ${c.message}`)})).data},me=async function({data:t,url:e,cancelable:r=!1}={}){await f(this,h,mt).call(this);const s=f(this,h,_t).call(this,32),a=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,s),o=await f(this,h,gt).call(this,s,JSON.stringify(t)),c=this;return(await A.post(e,o,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:a||""}}).catch(async l=>{var g;let p=`Error in request, verify internet connection: ${l.status} ${l.message}`;throw l.response.status>=500&&l.response.status<=599?p="Service Temporarily Unavailable":l.response.status>=400&&l.response.status<=499&&(p="Bad Request"),r&&await f(g=c,h,zi).call(g),new Error(p)})).data},Ji=async function(){const t=this.__pinPad__.constants.FS,e=this.__pinPad__.constants.ETX,r=this.__pinPad__.constants.STX;let s="C57A"+this.__pinPad__.config.internal.qpsDomestic;if(s=s+t+"B"+this.__pinPad__.config.internal.qpsInternational,s=s+t+"C"+this.__pinPad__.config.internal.cvmlVMCDomestic,s=s+t+"D"+this.__pinPad__.config.internal.cvmlVMCInternational,s=s+t+"E"+this.__pinPad__.config.internal.cvmlAmex,s=s+t+"F"+this.__pinPad__.config.internal.translimitCTLSVMC,s=s+t+"G"+this.__pinPad__.config.internal.translimitCTLSAmex,s=r+f(this,h,q).call(this,s)+s+e,s=s+f(this,h,K).call(this,s),!this.__pinPad__.about.injectedValues){const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"inject")}},Qi=async function(){this.__pinPad__.operation.bin8&&(this.__pinPad__.operation.bin=this.__pinPad__.operation.bin8),this.__pinPad__.operation.bin8="";const t=await f(this,h,me).call(this,{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 r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;e=r+f(this,h,q).call(this,e)+e+s,e=e+f(this,h,K).call(this,e);const a=this.parseStringToBytes(e,"");return await this.appendToQueue(a,"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},Zi=async function(t=null){if(this.__pinPad__.waiting.statusAboutWaiting)throw new Error("AboutPP is already running");const e=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C56AABOUT";if(s=e+f(this,h,q).call(this,s)+s+r,s=s+f(this,h,K).call(this,s),B.isEmpty(this.__pinPad__.about.pp)){this.__pinPad__.waiting.statusAboutWaiting="pending";const c=this.parseStringToBytes(s,"");await this.appendToQueue(c,"about")}else return t?t(this.__pinPad__.about.pp.supportDUKPT,this.__pinPad__.about.pp.hasDUKPTKeys):!0;const a=this;let o=0;return new Promise((c,u)=>{o=setInterval(()=>{if(a.__pinPad__.waiting.statusAboutWaiting==="resolved"){if(clearInterval(o),a.__pinPad__.waiting.statusAboutWaiting=null,B.isEmpty(a.__pinPad__.about.pp))return;t||c(!0),c(t(a.__pinPad__.about.pp.supportDUKPT,a.__pinPad__.about.pp.hasDUKPTKeys))}else a.__pinPad__.waiting.statusAboutWaiting==="rejected"&&(clearInterval(o),a.__pinPad__.waiting.statusAboutWaiting=null,u("Error"))},500)})},Nt=async function(t,e){if(t=t?t.toString():"",e=e?e.toString():"",B.isEmpty(t)||t==="0"){this.dispatch("pp:dukpt",{status:"unsupported",already:!1});return}if(B.isEmpty(e)||e==="1"){this.dispatch("pp:dukpt",{status:"charged",already:!0});return}const r=f(this,h,_e).call(this),s=f(this,h,ge).call(this),a=this.__pinPad__.constants.FS,o=this.__pinPad__.constants.ETX,c=this.__pinPad__.constants.STX;let u="C91A"+r+a+"B"+s;u=c+f(this,h,q).call(this,u)+u+o,u=u+f(this,h,K).call(this,u);const l=this.parseStringToBytes(u,"");await this.appendToQueue(l,"init-dukpt");let p=0;this.__pinPad__.waiting.statusinitDUKPTWaiting="pending";const g=this;return new Promise((P,m)=>{p=setInterval(async()=>{var b;g.__pinPad__.waiting.statusinitDUKPTWaiting==="resolved"?(clearInterval(p),g.__pinPad__.waiting.statusinitDUKPTWaiting=null,g.dispatch("pp:dukpt",{status:"charged",already:!1}),await f(b=g,h,Yi).call(b),P(!0)):g.__pinPad__.waiting.statusinitDUKPTWaiting==="rejected"&&(clearInterval(p),g.__pinPad__.waiting.statusinitDUKPTWaiting=null,m("Error"))},500)})},Yi=async function(){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 f(this,h,me).call(this,{data:t,url:this.url+this.__pinPad__.constants.uris.keysDUKPT});await f(this,h,pn).call(this,e)},tn=async function(){if(!await f(this,h,he).call(this))throw new Error("RSA public key is empty");const e=this;await f(this,h,Zi).call(this,async function(s,a){var c,u;if(e.__pinPad__.about.supportInjection&&e.__pinPad__.config.internal.emv&&e.__pinPad__.about.injectedValues)return await f(c=e,h,Nt).call(c,s,a),!0;let o=0;return e.__pinPad__.waiting.statusInjectWaiting="pending",await f(u=e,h,Ji).call(u),new Promise((l,p)=>{o=setInterval(async()=>{var g;e.__pinPad__.waiting.statusInjectWaiting==="resolved"?(clearInterval(o),e.__pinPad__.waiting.statusInjectWaiting=null,await f(g=e,h,Nt).call(g,s,a),l(!0)):e.__pinPad__.waiting.statusInjectWaiting==="rejected"&&(clearInterval(o),e.__pinPad__.waiting.statusInjectWaiting=null,p("Error"))},500)})})},ye=function(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);let r=t.split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,""),r.join(".")},en=async function(){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"),B.isEmpty(this.amount)||this.amount<=0)throw new Error("Amount required");if(f(this,h,pe).call(this,this.amount)===!1)throw new Error("Invalid amount required");if(f(this,h,Bt).call(this,this.amount,2)<=0)throw new Error("Amount must be greater than 0");const e=this.__pinPad__.constants.FS,r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;let a="C93A"+t;a=a+e+"B"+f(this,h,_e).call(this),a=a+e+"C"+f(this,h,ge).call(this),a=a+e+"D"+f(this,h,Bt).call(this,this.amount,2),a=a+e+"E0.00",a=a+e+"F"+this.__pinPad__.config.currencyCode,this.__pinPad__.about.supportDUKPT&&this.__pinPad__.about.supportDUKPT!=="0"&&this.__pinPad__.about.supportDUKPT!=="false"&&(this.__pinPad__.about.supportContactless?(a=a+e+"G"+this.timeoutPinPad,a=a+e+"HTAGS",a=a+e+"I"+this.__pinPad__.config.requireCVVAmex,a=a+e+"J"+this.__pinPad__.config.forceOnline,a=a+e+"K"+this.__pinPad__.about.supportContactless,a=a+e+"L"+this.__pinPad__.config.emvCard,this.__pinPad__.about.hasCashback&&(a=a+e+"M0",a=a+e+"N00")):(a=a+e+"G"+this.timeoutPinPad,a=a+e+"HTAGS",a=a+e+"I"+this.__pinPad__.config.requireCVVAmex,a=a+e+"L"+this.__pinPad__.config.emvCard),this.__pinPad__.about.supportInjection&&(a=a+e+"O"+this.__pinPad__.config.validateQPS)),a=r+f(this,h,q).call(this,a)+a+s,a=a+f(this,h,K).call(this,a),f(this,h,fn).call(this);const o=this.parseStringToBytes(a,"");await this.appendToQueue(o,"read-card");let c=0;const u=this;return this.__pinPad__.waiting.statusReadCardWaiting="pending",new Promise((l,p)=>{c=setInterval(()=>{if(u.__pinPad__.waiting.statusReadCardWaiting==="resolved")clearInterval(c),u.__pinPad__.waiting.statusReadCardWaiting=null,l(!0);else if(u.__pinPad__.waiting.statusReadCardWaiting==="rejected"){clearInterval(c),u.__pinPad__.waiting.statusReadCardWaiting=null;const g=u.__pinPad__.operation.last_error;p(g??"Error reading card")}},500)})},nn=async function(t){return await B.wait(t*1e3)},rn=async function(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 f(this,h,ot).call(this,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})},sn=async function(t="",e={}){let r=1,s=null;do{r>1&&this.environment==="production"&&(t=t.replace(this.__pinPad__.constants.urls.production,this.__pinPad__.constants.urls.productionAlternative),await f(this,h,nn).call(this,5)),await f(this,h,mt).call(this);const a=f(this,h,_t).call(this,32),o=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,a),c=await f(this,h,gt).call(this,a,JSON.stringify(e));let u=!1;const l=await A.post(t,c,{headers:{"Content-Type":"application/json",data:o||""}}).catch(async p=>{let g=`Error in request, verify internet connection: ${p.status} ${p.message}`;p.response.status>=500&&p.response.status<=599?g="Service Temporarily Unavailable":p.response.status>=400&&p.response.status<=499&&(g="Bad Request"),console.warn(p),s=g;const P=await f(this,h,rn).call(this,r);P&&P!=="{}"&&!P.includes('"transacciones":""')&&P.includes("nu_operaion")&&(r=5,s="EE32"),u=!0});if(!u)return l.data}while(r++<=3);return s?Promise.reject(s):Promise.reject("Communication error with CDP. IL/MTY")},an=function(t){if(B.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},on=function(t){var s,a;const e=this;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 r=(s=t.cd_response)==null?void 0:s.toUpperCase();return r.toUpperCase()==="0C"||this.__pinPad__.operation.responseMit._approved?r="00":(r!=="Z3"&&r!=="05"||t.cd_error==="92")&&(r="01"),this.__pinPad__.operation.responseMit._cdResponse=r,this.__pinPad__.finishCommand.A=r,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:r,cd_error:t.cd_error,nb_error:f(a=e,h,de).call(a,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}},cn=async function(){var s,a;const t=this;this.__pinPad__.operation.errors=0,this.__pinPad__.operation.ignore.counterSale=!1;const e=this.__pinPad__.operation.onlyMerchant;if(/^[0-9]+$/.test(e)===!1)throw new Error("Invalid merchant");this.__pinPad__.operation.typeOperation="29";let r={error:!1,message:null,approved:!1,object:{}};try{const o=await f(this,h,ye).call(this,this.amount,2);await f(this,h,yt).call(this,{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:o,Currency:this.__pinPad__.config.currency,Merchant:e,Reverse:this.__pinPad__.config.otherLogin.executeReverse});const c=this.__pinPad__.about.supportContactless&&this.__pinPad__.about.supportContactless!=="0"?"1":"0",u=await f(this,h,sn).call(this,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:o,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:c,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}}});u.response==="error"&&(r.error=!0,r.message=u.nb_error||"Error in response");const l=f(this,h,on).call(this,u);return r.object=l,await f(this,h,un).call(this,l),r.approved=this.__pinPad__.operation.responseMit._approved,this.__pinPad__.operation.finalResult=l,r}catch(o){throw t.__pinPad__.finishCommand.A="01",t.__pinPad__.finishCommand.B="",t.__pinPad__.finishCommand.C="",t.__pinPad__.finishCommand.D="",t.__pinPad__.finishCommand.E="",t.__pinPad__.finishCommand.F="",t.__pinPad__.finishCommand.G="",t.__pinPad__.finishCommand.H="",t.__pinPad__.finishCommand.I="",t.__pinPad__.finishCommand.J="",t.__pinPad__.finishCommand.K="",await f(a=t,h,ln).call(a,f(s=t,h,Pe).call(s,o)),o}},un=async function(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,r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;let a="C93A"+this.__pinPad__.finishCommand.A;a=a+e+"B"+this.__pinPad__.finishCommand.B,a=a+e+"C"+this.__pinPad__.finishCommand.C,a=a+e+"D"+this.__pinPad__.finishCommand.D,a=a+e+"E"+this.__pinPad__.finishCommand.E,a=a+e+"F"+this.__pinPad__.finishCommand.F,a=a+e+"G"+this.__pinPad__.finishCommand.G,a=a+e+"H"+this.__pinPad__.finishCommand.H,a=a+e+"I"+this.__pinPad__.finishCommand.I,a=a+e+"J"+this.__pinPad__.finishCommand.J,a=a+e+"K"+this.__pinPad__.finishCommand.K,a=r+f(this,h,q).call(this,a)+a+s,a=a+f(this,h,K).call(this,a);const o=this.parseStringToBytes(a,"");this.__pinPad__.waiting.statusSecondGenerateWaiting="pending",await this.appendToQueue(o,"second-generate");let c=0;const u=this;return new Promise((l,p)=>{c=setInterval(async()=>{var g,P;if(u.__pinPad__.waiting.statusSecondGenerateWaiting==="resolved"){if(clearInterval(c),u.__pinPad__.waiting.statusSecondGenerateWaiting=null,u.__pinPad__.operation.applyReverse){const m=await f(g=u,h,ot).call(g,u.url+u.__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:f(this,h,Bt).call(this,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}}}),b=JSON.parse(m);let y;b.response==="approved"?y={message:"Transaction rejected by PinPad."}:y={message:"No communication, please check your report."},u.__pinPad__.operation.ignore.counterSale||(u.dispatch("pp:finish-emv",y),u.__pinPad__.operation.ignore.counterSale=!0)}else u.__pinPad__.operation.ignore.counterSale||(u.dispatch("pp:finish-emv",t),u.__pinPad__.operation.ignore.counterSale=!0);t.cd_error==="92"&&await f(P=u,h,hn).call(P,t,a),l(!0)}else u.__pinPad__.waiting.statusSecondGenerateWaiting==="rejected"&&(clearInterval(c),u.__pinPad__.waiting.statusSecondGenerateWaiting=null,p("There is no response from the reader, check that it is connected."))},500)})},hn=async function(t,e){this.__pinPad__.operation.ignore.responseGlobal=t,this.__pinPad__.operation.ignore.C93Global=e,this.__pinPad__.operation.ignore.isError92TRX=!0,await f(this,h,Nt).call(this,1,0)},be=async function(){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 B.wait(1400),this.dispatch("pp:response",this.__pinPad__.operation.ignore.responseGlobal)}},Pe=function(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."};let r=e[t]?{error:t,message:e[t]}:{error:t,message:"Error desconocido"};return this.dispatch("pp:error",r),r},ln=async function(t){const e=this.__pinPad__.constants.FS,r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;let a="C93A"+this.__pinPad__.finishCommand.A;if(a=a+e+"B"+this.__pinPad__.finishCommand.B,a=a+e+"C"+this.__pinPad__.finishCommand.C,a=a+e+"D"+this.__pinPad__.finishCommand.D,a=a+e+"E"+this.__pinPad__.finishCommand.E,a=a+e+"F"+this.__pinPad__.finishCommand.F,a=a+e+"G"+this.__pinPad__.finishCommand.G,a=a+e+"H"+this.__pinPad__.finishCommand.H,a=a+e+"I"+this.__pinPad__.finishCommand.I,a=a+e+"J"+this.__pinPad__.finishCommand.J,a=a+e+"K"+this.__pinPad__.finishCommand.K,a=r+f(this,h,q).call(this,a)+a+s,a=a+f(this,h,K).call(this,a),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 o=this.parseStringToBytes(a,"");await this.appendToQueue(o,"finish-emv-end")},pn=async function(t){if(t.cd_estatus=t.cd_estatus?t.cd_estatus:"0",t.cd_estatus!=="1"){this.__pinPad__.operation.ignore.isError92TRX&&await f(this,h,be).call(this);return}const e=this.__pinPad__.constants.FS,r=this.__pinPad__.constants.ETX,s=this.__pinPad__.constants.STX,a=t.nb_ksn,o=t.nb_kcv||"",c=t.nb_ipek||"";let u="C92A"+a+e+"B"+o+e+"C"+c;u=s+f(this,h,q).call(this,u)+u+r,u=u+f(this,h,K).call(this,u);const l=this.parseStringToBytes(u,"");await this.appendToQueue(l,"dukpt");let p=0;this.__pinPad__.waiting.statuswritingDUKPTWaiting="pending";const g=this;return new Promise((P,m)=>{p=setInterval(async()=>{var b;g.__pinPad__.waiting.statuswritingDUKPTWaiting==="resolved"?(clearInterval(p),g.__pinPad__.waiting.statuswritingDUKPTWaiting=null,this.__pinPad__.operation.ignore.isError92TRX&&await f(b=g,h,be).call(b),P(!0)):g.__pinPad__.waiting.statuswritingDUKPTWaiting==="rejected"&&(clearInterval(p),g.__pinPad__.waiting.statuswritingDUKPTWaiting=null,m("Error writing DUKPT keys"))},500)})},fn=function(){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};exports.PinPad=ys;
|
|
30
|
+
`):" "+Ge(s[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return e},adapters:se};function Zt(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new lt(null,n)}function $e(n){return Zt(n),n.headers=M.from(n.headers),n.data=Qt.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),vi.getAdapter(n.adapter||vt.adapter)(n).then(function(e){return Zt(n),e.data=Qt.call(n,n.transformResponse,e),e.headers=M.from(e.headers),e},function(e){return _i(e)||(Zt(n),e&&e.response&&(e.response.data=Qt.call(n,n.transformResponse,e.response),e.response.headers=M.from(e.response.headers))),Promise.reject(e)})}const wi="1.10.0",Wt={};["object","boolean","number","function","string","symbol"].forEach((n,i)=>{Wt[n]=function(e){return typeof e===n||"a"+(i<1?"n ":" ")+n}});const Je={};Wt.transitional=function(i,t,e){function r(s,a){return"[Axios v"+wi+"] Transitional option '"+s+"'"+a+(e?". "+e:"")}return(s,a,o)=>{if(i===!1)throw new w(r(a," has been removed"+(t?" in "+t:"")),w.ERR_DEPRECATED);return t&&!Je[a]&&(Je[a]=!0,console.warn(r(a," has been deprecated since v"+t+" and will be removed in the near future"))),i?i(s,a,o):!0}};Wt.spelling=function(i){return(t,e)=>(console.warn(`${e} is likely a misspelling of ${i}`),!0)};function ds(n,i,t){if(typeof n!="object")throw new w("options must be an object",w.ERR_BAD_OPTION_VALUE);const e=Object.keys(n);let r=e.length;for(;r-- >0;){const s=e[r],a=i[s];if(a){const o=n[s],c=o===void 0||a(o,s,n);if(c!==!0)throw new w("option "+s+" must be "+c,w.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new w("Unknown option "+s,w.ERR_BAD_OPTION)}}const It={assertOptions:ds,validators:Wt},G=It.validators;let it=class{constructor(i){this.defaults=i||{},this.interceptors={request:new je,response:new je}}async request(i,t){try{return await this._request(i,t)}catch(e){if(e instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{e.stack?s&&!String(e.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(e.stack+=`
|
|
31
|
+
`+s):e.stack=s}catch{}}throw e}}_request(i,t){typeof i=="string"?(t=t||{},t.url=i):t=i||{},t=nt(this.defaults,t);const{transitional:e,paramsSerializer:r,headers:s}=t;e!==void 0&&It.assertOptions(e,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(d.isFunction(r)?t.paramsSerializer={serialize:r}:It.assertOptions(r,{encode:G.function,serialize:G.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),It.assertOptions(t,{baseUrl:G.spelling("baseURL"),withXsrfToken:G.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=s&&d.merge(s.common,s[t.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),t.headers=M.concat(a,s);const o=[];let c=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(t)===!1||(c=c&&b.synchronous,o.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let l,p=0,g;if(!c){const m=[$e.bind(this),void 0];for(m.unshift.apply(m,o),m.push.apply(m,u),g=m.length,l=Promise.resolve(t);p<g;)l=l.then(m[p++],m[p++]);return l}g=o.length;let P=t;for(p=0;p<g;){const m=o[p++],b=o[p++];try{P=m(P)}catch(y){b.call(this,y);break}}try{l=$e.call(this,P)}catch(m){return Promise.reject(m)}for(p=0,g=u.length;p<g;)l=l.then(u[p++],u[p++]);return l}getUri(i){i=nt(this.defaults,i);const t=mi(i.baseURL,i.url,i.allowAbsoluteUrls);return pi(t,i.params,i.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(i){it.prototype[i]=function(t,e){return this.request(nt(e||{},{method:i,url:t,data:(e||{}).data}))}});d.forEach(["post","put","patch"],function(i){function t(e){return function(s,a,o){return this.request(nt(o||{},{method:i,headers:e?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}it.prototype[i]=t(),it.prototype[i+"Form"]=t(!0)});let _s=class Ei{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const e=this;this.promise.then(r=>{if(!e._listeners)return;let s=e._listeners.length;for(;s-- >0;)e._listeners[s](r);e._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{e.subscribe(o),s=o}).then(r);return a.cancel=function(){e.unsubscribe(s)},a},i(function(s,a,o){e.reason||(e.reason=new lt(s,a,o),t(e.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const i=new AbortController,t=e=>{i.abort(e)};return this.subscribe(t),i.signal.unsubscribe=()=>this.unsubscribe(t),i.signal}static source(){let i;return{token:new Ei(function(r){i=r}),cancel:i}}};function gs(n){return function(t){return n.apply(null,t)}}function ms(n){return d.isObject(n)&&n.isAxiosError===!0}const ae={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};Object.entries(ae).forEach(([n,i])=>{ae[i]=n});function Si(n){const i=new it(n),t=ti(it.prototype.request,i);return d.extend(t,it.prototype,i,{allOwnKeys:!0}),d.extend(t,i,null,{allOwnKeys:!0}),t.create=function(r){return Si(nt(n,r))},t}const A=Si(vt);A.Axios=it;A.CanceledError=lt;A.CancelToken=_s;A.isCancel=_i;A.VERSION=wi;A.toFormData=Kt;A.AxiosError=w;A.Cancel=A.CanceledError;A.all=function(i){return Promise.all(i)};A.spread=gs;A.isAxiosError=ms;A.mergeConfig=nt;A.AxiosHeaders=M;A.formToJSON=n=>di(d.isHTMLForm(n)?new FormData(n):n);A.getAdapter=vi.getAdapter;A.HttpStatusCode=ae;A.default=A;const{Axios:ws,AxiosError:Es,CanceledError:Ss,isCancel:Ts,CancelToken:Cs,VERSION:As,all:Rs,Cancel:Os,isAxiosError:xs,spread:Ds,toFormData:Is,AxiosHeaders:Bs,HttpStatusCode:Ns,formToJSON:Vs,getAdapter:Us,mergeConfig:Ls}=A;var h,Ti,Ci,Ai,oe,Ri,Oi,xi,Di,Ii,Bi,Ni,Vi,Ui,Li,dt,_t,Mi,gt,ki,tt,Fi,D,ji,qi,ce,Ki,Hi,Wi,ue,he,mt,le,Xi,q,K,Bt,pe,yt,fe,de,zi,_e,ge,Gi,$i,ot,me,Ji,Qi,Zi,Nt,Yi,tn,ye,en,nn,rn,sn,an,on,cn,un,hn,be,Pe,ln,pn,fn;class ys extends B.Kernel{constructor({filters:t=null,config_port:e={baudRate:19200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:r=1,device_listen_on_channel:s=1,username:a=null,password:o=null,environment:c="production"}={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"}){super({filters:t,config_port:e,no_device:r,device_listen_on_channel:s});Ae(this,h);Ce(this,"__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:{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}});if(this.__internal__.device.type="pinpad",!B.supportCrypto())throw new Error("Crypto not supported in this browser");if(B.h.getCustom(this.typeDevice,r))throw new Error(`Device ${this.typeDevice} ${r} already exists`);this.__internal__.time.response_connection=3e3,this.__internal__.time.response_general=5e3,this.__internal__.serial.delay_first_connection=1e3,this.environment=c,a&&(this.username=a),o&&(this.password=o),f(this,h,Ci).call(this),f(this,h,Ti).call(this)}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")}serialMessage(t){const e={original_code:t,code:null,name:null,description:null,request:this.lastAction,no_code:0,parsed:null},r=this.parseHexToUint8(t),s=this.parseUint8ArrayToString(r);let a=f(this,h,Ai).call(this,s);switch(this.__pinPad__.buffer=s,e.parsed=a,e.code=s,e.request){case"connect":e.name="connected",e.description="Connection established",e.no_code=100,f(this,h,oe).call(this,a,s);break;case"about":e.name="About PinPad",e.description="Response of about",e.no_code=101,f(this,h,oe).call(this,a,s);break;case"inject":e.name="Inject",e.description="Response of inject values",e.no_code=102,f(this,h,Ri).call(this,a,s);break;case"init-dukpt":e.name="Init DUKPT",e.description="Response of init DUKPT",e.no_code=103,f(this,h,Oi).call(this,a,s);break;case"dukpt":e.name="Write DUKPT",e.description="Response of write DUKPT",e.no_code=104,f(this,h,xi).call(this,a,s);break;case"read-card":e.name="read card",e.description="response of read card",e.no_code=105,f(this,h,Di).call(this,a,s);break;case"second-generate":e.name="second generate",e.description="response of second generate",e.no_code=106,f(this,h,Ii).call(this,a,s);break;case"cancel":e.name="cancel pinpad",e.description="response of cancel",e.no_code=107;break;case"print":f(this,h,Vi).call(this,a,s),e.name="print voucher",e.description="response of print",e.no_code=108;break;case"cancel-read-card":f(this,h,Ni).call(this,a,s),e.name="cancel read card",e.description="response of cancel read card",e.no_code=109;break;case"code93":f(this,h,Ui).call(this,a,s),e.name="code 93",e.description="response of code 93",e.no_code=110;break;case"finish-emv-end":f(this,h,Li).call(this,a,s),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(t=1){const e="",r="";let s="C56AABOUT";s=e+s.length.toString().padStart(3,"0")+s+r;let a=0;for(let c=0;c<s.length;c++)a^=s.charCodeAt(c);s=s+String.fromCharCode(a);const o=this.parseStringToBytes(s,"");return this.add0x(o)}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(!f(this,h,le).call(this,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)}async login({force:t=!1}={}){return await f(this,h,qi).call(this,t)}clearSession(){localStorage.removeItem("ppLoginResponse"),localStorage.removeItem("ppRSAKey"),localStorage.removeItem("ppPublicIP")}async checkPositionPermission(){if(!B.supportGeolocation())throw new Error("Geolocation not supported");return new Promise((t,e)=>{navigator.permissions.query({name:"geolocation"}).then(r=>{r.state==="granted"?t(!0):t(!1)}).catch(()=>e(!1))})}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,r=this.__pinPad__.constants.ETX;this.__pinPad__.operation.commerceVoucher.includes(":")||(this.__pinPad__.operation.commerceVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,this.__pinPad__.operation.commerceVoucher)),this.__pinPad__.operation.clientVoucher.includes(":")||(this.__pinPad__.operation.clientVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,this.__pinPad__.operation.clientVoucher));let s=t==="client"?this.__pinPad__.operation.clientVoucher:this.__pinPad__.operation.commerceVoucher;if(s.length===0){this.dispatch("pp:print",{error:!0,code:"001",message:"Without information to print"});return}s=f(this,h,Fi).call(this,s),s=f(this,h,ji).call(this,s,this.__pinPad__.constants.appName+this.__pinPad__.constants.appVersion);let a="C59A"+s;a=e+f(this,h,q).call(this,a)+a+r,a=a+f(this,h,K).call(this,a),t==="client"?this.__pinPad__.operation.clientVoucher="":t==="commerce"&&(this.__pinPad__.operation.commerceVoucher="");const o=this.parseStringToBytes(a,"");await this.appendToQueue(o,"print")}getClientVoucher(){return this.__pinPad__.operation.clientVoucher}getCommerceVoucher(){return this.__pinPad__.operation.commerceVoucher}async consult({reference:t=null}){return t||(t=this.reference),B.isEmpty(t)&&(t="--",this.reference=t),f(this,h,Xi).call(this,this.reference),this.__pinPad__.operation.consultDate=new Date().toLocaleDateString("en-GB"),await f(this,h,yt).call(this,{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}),f(this,h,ot).call(this,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 rePrint({folio:t=null}={}){t===null&&(t=this.__pinPad__.operation.folio||""),f(this,h,fe).call(this,t),await f(this,h,yt).call(this,{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:t});const e=await f(this,h,ot).call(this,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=e.voucher_comercio;return this.__pinPad__.operation.commerceVoucher="",r&&(e.voucher_comercio.includes(":")?this.__pinPad__.operation.commerceVoucher=e.voucher_comercio:this.__pinPad__.operation.commerceVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,e.voucher_comercio)),r=e.voucher_cliente,this.__pinPad__.operation.clientVoucher="",r&&(e.voucher_cliente.includes(":")?this.__pinPad__.operation.clientVoucher=e.voucher_cliente:this.__pinPad__.operation.clientVoucher=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,e.voucher_cliente)),e}async cancelPurchase({amount:t=0,authorization:e="",folio:r=""}={}){if(!f(this,h,pe).call(this,t))throw new Error("Invalid amount");if(!f(this,h,an).call(this,e))throw new Error("Invalid authorization");if(!f(this,h,fe).call(this,r))throw new Error("Invalid folio");t=f(this,h,ye).call(this,t,2);const 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:r,Tx_Auth:e,Amount:t};await f(this,h,yt).call(this,s);const a=f(this,h,ot).call(this,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:r,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=f(this,h,tt).call(this,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=f(this,h,tt).call(this,this.__pinPad__.config.RC4Key,a.voucher_cliente)),JSON.stringify(a)}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||B.isEmpty(e)||!f(this,h,le).call(this,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");let r={error:!1,message:null,approved:!1,object:{}};try{return await this.login(),await f(this,h,tn).call(this),!await f(this,h,en).call(this)||!await f(this,h,Qi).call(this)?r:await f(this,h,cn).call(this)}catch(s){console.warn(s),r.error=!0,r.message=s.message,r.approved=!1,r.object=s}return r}}h=new WeakSet,Ti=function(){B.h.add(this)},Ci=function(){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)},Ai=function(t){const e=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX,s=this.__pinPad__.constants.FS,a=this.__pinPad__.constants.getNULL;t=t.replace(new RegExp(e,"g"),"");const o=t.split(r);t=o[0];const c=t.split(s);c.push(...o[1].split(s));const u={};return c.map((l,p)=>{const g=p>0?l.substring(0,1):"A",P=p>0?l.substring(1):l;return{[g]:P.replace(new RegExp(a,"g"),"")}}).forEach(l=>Object.assign(u,l)),u},oe=function(t,e){const r=this.__pinPad__.constants.ETX,s=e.substring(e.indexOf("D")+2,e.indexOf("E"));let a=0;const o=e.indexOf("N")>0,c=e.substring(e.indexOf("A00")+3,e.indexOf("B"));if(c&&c!=="undefined"&&c.toUpperCase()==="VERIFONE"){const l=s.replace("MITP_1.00.","").replace("MITP_01.00.","").replace("MITD_1.00.","").replace("MITD_01.00.","");a=parseInt(l),a>=15&&(this.__pinPad__.about.hasCashback=!0)}this.__pinPad__.about.supportInjection=o,e.indexOf("M")>0?(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf("M")),this.__pinPad__.about.supportInjection?this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf("N")):(this.__pinPad__.about.supportContactlessCollisionCard=e.substring(e.indexOf("M")+2,e.indexOf(r)),this.__pinPad__.about.supportContactless=!0)):(this.__pinPad__.about.supportSign=e.substring(e.indexOf("L")+2,e.indexOf(r)),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=c,this.__pinPad__.about.appVersion=s;const u=e.substring(e.indexOf("K")+2,e.indexOf("L"));this.__pinPad__.about.pp={brand:c,appVersion:s,versionInt:a,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,hasDUKPTKeys:u,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")},Ri=function(t,e){this.__pinPad__.waiting.statusInjectWaiting="resolved"},Oi=function(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"},xi=function(t,e){this.__pinPad__.waiting.statuswritingDUKPTWaiting="resolved"},Di=function(t,e){const r=this.__pinPad__.about.brand.toLowerCase(),s=this.__pinPad__.about.model.toLowerCase(),a=r==="ingenico"&&s==="ipp320"?500:350;if(e.length<a){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=f(this,h,Pe).call(this,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&&s==="vx820"||e.includes("P93A022")&&e.length>=406&&s==="vx520"||e.includes("P93A800")&&e.length>=406&&s==="vx520"||e.includes("P93A800")&&e.length>=406&&s==="vx820"||e.includes("P93A022")&&e.length>=406&&s==="p400"||e.includes("P93A800")&&e.length>=406&&s==="p400"||e.includes("P93A022")&&e.length>=406&&s==="v205c"||e.includes("P93A800")&&e.length>=406&&s==="v205c"||e.includes("P93A022")&&e.length>=406&&s==="move2500"||e.includes("P93A800")&&e.length>=406&&s==="move2500"||e.includes("P93A022")&&e.length>=406&&s==="lane3000"||e.includes("P93A800")&&e.length>=406&&s==="lane3000"){let o=e;r==="verifone"&&(o=e.replace("006P93A00.","").substring(e.indexOf("P93A"),e.indexOf("P93A")+7)),e.includes("P81APROCESANDO, NO RETIRE TARJETA")||e.includes("P81APROCESANDO TARJETA")||o.includes("P93A022")||o.includes("P81AINSERTE CHIP O DESLICE TARJETA")||o.includes("ACERQUE, INSERTE CHIP O DESLICE")||o.includes("P81AACERQUE, INSERTE CHIP O DESLICE TARJETA")?this.dispatch("pp:processing-card",{waiting:!0}):e.length>a&&f(this,h,Bi).call(this,e)}},Ii=function(t,e){const r=this.__pinPad__.constants.ETX;let s=e.replace("023P81AFAVOR RETIRAR TARJ.","").replace("020P81A DECLINADA EMV ","").replace("020P81A DECLINADA EMV ","");s=s.substring(s.indexOf("B")+2,s.indexOf(r)),s.includes("006E93A16")&&(s="01"),this.__pinPad__.operation.applyReverse=s==="01"&&this.__pinPad__.operation.responseMit._approved&&this.__pinPad__.config.otherLogin.executeReverse==="1",this.__pinPad__.waiting.statusSecondGenerateWaiting="resolved"},Bi=function(t){const e=this.__pinPad__.constants.ETX,r=this.__pinPad__.about.brand.toLowerCase();let s,a,o,c,u;r==="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 l=this.__pinPad__.config.read.POSEM;if(l==="051"||l==="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 p=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=p.substring(p.indexOf("M")+2,p.indexOf("N")),this.__pinPad__.operation.hasQPS=p.substring(p.indexOf("N")+2,p.indexOf("O"))==="1",this.__pinPad__.operation.bin8=p.substring(p.indexOf("O")+2,p.indexOf(e))}else if(t.includes("N")){const p=t.substring(t.indexOf("P93A"));this.__pinPad__.config.read.ReadCTLS=p.substring(p.indexOf("M")+2,p.indexOf("N")),this.__pinPad__.operation.hasQPS=p.substring(p.indexOf("N")+2,p.indexOf(e))==="1"}else{const p=t.substring(t.indexOf("P93A"),t.indexOf("M")+5);this.__pinPad__.config.read.ReadCTLS=p.substring(p.indexOf("M")+2,p.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")),a=t.substring(t.indexOf("I")+2,t.indexOf("J")),o=t.substring(t.indexOf("E")+2,t.indexOf("F")),this.__pinPad__.config.read.ChipName=o,s=t.substring(t.indexOf("J")+2,t.indexOf("K"))}else{let p;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")),l==="022")if(t.includes("O")){const g=t.substring(t.indexOf("P93A"));this.__pinPad__.operation.bin8=g.substring(g.indexOf("O")+2,g.indexOf(e)),p=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),p=p.substring(p.indexOf("I")+2,p.lastIndexOf(""))}else p=t.substring(t.indexOf("P93A022"),t.indexOf("I")+23),p=p.substring(p.indexOf("I")+2,p.indexOf(e));else p=t.substring(t.indexOf("P93A800"),t.indexOf("I")+23),p=p.substring(p.indexOf("I")+2,p.indexOf(e));this.__pinPad__.config.read.NB_ksn=p,this.__pinPad__.config.read.NB_Data=t.substring(t.indexOf("B")+2,t.indexOf("C")),a=t.substring(t.indexOf("F")+2,t.indexOf("G")),s=t.substring(t.indexOf("G")+2,t.indexOf("H")),this.__pinPad__.about.model.toLowerCase()==="vx520"?(o=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=o):(o=t.substring(t.indexOf("H")+2,t.indexOf("I")),this.__pinPad__.config.read.ChipName=o)}s.includes("/")&&(s=s.replace("/","")),s.toString().length===4?(u=s.toString().substring(0,2),c=s.toString().substring(2)):(u="",c=""),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=a,a.length>6&&(this.__pinPad__.operation.bin=a.substring(0,6)),this.__pinPad__.waiting.statusReadCardWaiting="resolved",this.dispatch("pp:read-card",{ERROR:"",maskPan:a,name:o,month:u,year:c})},Ni=function(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."}))},Vi=function(t,e){const r=this;if(this.__pinPad__.about.model.toLowerCase()==="vx520"){if(e.length>11)if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(function(){r.print("client").then(()=>{}).catch(s=>{console.error(s)})},1e3):this.dispatch("pp:print",{type:"success"});else{const s=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",s)}}else if(e.includes("P59A00"))this.__pinPad__.operation.clientVoucher!==""?setTimeout(function(){r.print("client").then(()=>{}).catch(s=>{console.error(s)})},1e3):this.dispatch("pp:print",{type:"success"});else{const s=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",s)}},Ui=function(t,e){},Li=function(t,e){},dt=function(t,e){const r=new jn;return r.setPublicKey(t),r.encrypt(e)},_t=function(t){const e="0123456789ABCDEF";let r="";for(let s=0;s<t;s++){const a=Math.floor(Math.random()*e.length);r+=e.substring(a,a+1)}return r},Mi=function(t){const e="0123456789abcdef",r=[],s=[];for(let a=0;a<256;a++)r[a]=e.charAt(a>>4)+e.charAt(a&15);for(let a=0;a<t.length;a++)s[a]=r[t.charCodeAt(a)];return s.join("")},gt=async function(t,e){const r=new Uint8Array(t.match(/.{1,2}/g).map(g=>parseInt(g,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)),p=btoa(String.fromCharCode(...new Uint8Array(u)));return l+p},ki=function(t,e,r=!1){const s=[];for(let l=0;l<256;l++)s[l]=l;let a=0;for(let l=0;l<256;l++)a=(a+s[l]+t.charCodeAt(l%t.length))%256,[s[l],s[a]]=[s[a],s[l]];let o=0,c=0,u="";for(const l of e){o=(o+1)%256,c=(c+s[o])%256,[s[o],s[c]]=[s[c],s[o]];let p=s[(s[o]+s[c])%256];u+=String.fromCharCode(l.charCodeAt(0)^p)}return r?f(this,h,Mi).call(this,u).toUpperCase():u},tt=function(t,e){return f(this,h,ki).call(this,t,this.hexToAscii(e))},Fi=function(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},D=function(t,e,r){if(t=t.replace("@cnb logo_cpagos",e),t=t.replace("@cnn ver_app",r),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 s=t.indexOf("@lsn POR ESTE PAGARE ME OBLIGO INCONDI");t=t.substring(0,s)}return t.trim()+"@br @br @br @br @br"},ji=function(t,e){const r="@logo3 @br",s="@cnn "+e;return t.includes("@cnb Santander")?(t=t.replace("@cnb Santander","@logo1@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb American Express")?(t=t.replace("@cnb American Express","@logo2@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb HSBC")?(t=t.replace("@cnb HSBC","@logo7@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb IXE")?(t=t.replace("@cnb IXE","@logo11@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb MULTIVA")?(t=t.replace("@cnb MULTIVA","@logo15@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Multiva")?(t=t.replace("@cnb Multiva","@logo15@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb SCOTIA BANK")?(t=t.replace("@cnb SCOTIA BANK","@logo16@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb SCOTIABANK")?(t=t.replace("@cnb SCOTIABANK","@logo16@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BANCOMER")?(t=t.replace("@cnb BANCOMER","@logo17@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Bancomer")?(t=t.replace("@cnb Bancomer","@logo17@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BBVA")?(t=t.replace("@cnb BBVA","@logo17@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BANORTE")?(t=t.replace("@cnb BANORTE","@logo18@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Banorte")?(t=t.replace("@cnb Banorte","@logo18@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb BANREGIO")?(t=t.replace("@cnb BANREGIO","@logo19@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb Banregio")?(t=t.replace("@cnb Banregio","@logo19@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb GETNET")?(t=t.replace("@cnb GETNET","@logo20@br"),f(this,h,D).call(this,t,r,s)):t.includes("@cnb GetNET")?(t=t.replace("@cnb GetNET","@logo20@br"),f(this,h,D).call(this,t,r,s)):f(this,h,D).call(this,t,r,s)},qi=async function(t=!1){if(f(this,h,Hi).call(this),this.__pinPad__.config.loginResponse&&!t)return await f(this,h,ce).call(this);const e=this.url+this.__pinPad__.constants.uris.login,r={usuario:this.username,password:this.password,crypto:"",version:this.__pinPad__.constants.appVersion,serieLector:"",canal:this.__pinPad__.constants.appChannel};if(await f(this,h,mt).call(this),f(this,h,ue).call(this))throw new Error("Empty RSA Key");const s=f(this,h,_t).call(this,32),a=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,s),o=await f(this,h,gt).call(this,s,JSON.stringify(r)),c=await A.post(e,o,{headers:{"Content-Type":"application/json","cache-control":"no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0",data:a||""}}).catch(l=>{var p;throw new Error(`Error in request, verify internet connection: ${(p=l.response)==null?void 0:p.status} ${l.message}`)});let u=f(this,h,de).call(this,JSON.stringify(c.data));if(typeof u=="string"&&(u=JSON.parse(u)),!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 f(this,h,ce).call(this)},ce=async function(){await f(this,h,$i).call(this);try{await f(this,h,Gi).call(this)}catch(t){console.log("Error getting position",t)}return this.__pinPad__.config.otherLogin={},f(this,h,Ki).call(this,this.__pinPad__.config.loginResponse),this.__pinPad__.config.otherLogin},Ki=function(t){var a,o,c,u,l,p;let e="",r="";(o=(a=t.xml)==null?void 0:a.ventaspropias)!=null&&o.merchant_currencyb&&(e=t.xml.ventaspropias.merchant_currencyb),(u=(c=t.xml)==null?void 0:c.ventaspropias)!=null&&u.merchant_currencym&&(r=t.xml.ventaspropias.merchant_currencym);let s=(l=t.xml)==null?void 0:l.emvReverso;s||(s="0"),this.__pinPad__.config.internal.stTokenization=(p=t.xml)==null?void 0:p.st_tokenizacion,!this.__pinPad__.config.internal.stTokenization||this.__pinPad__.config.internal.stTokenization==="false"||this.__pinPad__.config.internal.stTokenization==="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:r,executeReverse:s}},Hi=function(){let t=localStorage.getItem("ppLoginResponse");t&&(t=JSON.parse(t),this.__pinPad__.config.loginResponse||(this.__pinPad__.config.loginResponse=t.data),new Date().getTime()-t.timestamp>=864e5&&(this.__pinPad__.config.loginResponse=null))},Wi=async function(){const t=this.url+this.__pinPad__.constants.uris.RSAKey,e=await A.get(t).catch(r=>{throw new Error(`Error in request, verify internet connection: ${r.response.status} ${r.message}`)});if(e.headers.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},ue=function(){let t=localStorage.getItem("ppRSAKey");return!t||(t=JSON.parse(t),this.__pinPad__.config.publicKeyRSA=t.data,new Date().getTime()-t.timestamp>=864e5)?!0:!this.__pinPad__.config.publicKeyRSA},he=async function(){return f(this,h,ue).call(this)?await f(this,h,Wi).call(this):this.__pinPad__.config.publicKeyRSA},mt=async function(){if(!await f(this,h,he).call(this))throw new Error("RSA public key is empty")},le=function(t){return/^[A-Z-a-z0-9\s]+$/g.test(t)},Xi=function(t){if(B.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},q=function(t){return t.length.toString().padStart(3,"0")},K=function(t){let e=0;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r);return String.fromCharCode(e)},Bt=function(t,e=0){return t=parseFloat(t.toString().replace(/[^0-9.-]/g,"")),isNaN(t)?0 .toFixed(e):t.toFixed(e).replace(/,/g,"")},pe=function(t){return t=parseFloat(t.toString()),!(isNaN(t)||t<0)},yt=async function(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},fe=function(t){if(!t||isNaN(parseInt(t))||t.toString().length!==9)throw new Error("Number of operation must be number of 9 digits");return t},de=function(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},zi=async function(){const t=this.__pinPad__.constants.STX,e=this.__pinPad__.constants.ETX;let r="C55ACANCEL";r=t+f(this,h,q).call(this,r)+r+e,r=r+f(this,h,K).call(this,r);const s=this.parseStringToBytes(r,"");await this.appendToQueue(s,"cancel")},_e=function(){const t=new Date,e=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear().toString().substring(2);return e+r+s},ge=function(){const t=new Date,e=t.getHours().toString().padStart(2,"0"),r=t.getMinutes().toString().padStart(2,"0");return e+r},Gi=async function(){return this.__pinPad__.config.latitude&&this.__pinPad__.config.longitude?this.latitudeLongitude:(this.__pinPad__.config.latitude=null,this.__pinPad__.config.longitude=null,B.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)},$i=async function(){let t=localStorage.getItem("ppPublicIP");if(t&&(t=JSON.parse(t),this.__pinPad__.config.publicIP=t.data,new Date().getTime()-t.timestamp>=864e5&&(this.__pinPad__.config.publicIP=null)),this.__pinPad__.config.publicIP)return this.__pinPad__.config.publicIP;this.__pinPad__.config.publicIP=null;let e=!1;const r=await A.get("https://api.ipify.org?format=json").catch(()=>e=!0);return e?null:(this.__pinPad__.config.publicIP=r.data.ip||null,localStorage.setItem("ppPublicIP",JSON.stringify({timestamp:new Date().getTime(),data:r.data.ip})),this.__pinPad__.config.publicIP)},ot=async function(t,e){await f(this,h,mt).call(this);const r=f(this,h,_t).call(this,32);let s=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,r),a=await f(this,h,gt).call(this,r,JSON.stringify(e));return(await A.post(t,a,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:s||""}}).catch(c=>{var u;throw c.response.data.includes("Ha ocurrido un error al procesar su solicitud.")?new Error("It was not possible to obtain the affiliations."):c.response.status>=500&&c.response.status<=599?new Error(`Service Temporarily Unavailable ${c.message}`):new Error(`Error in request, verify internet connection: ${(u=c.response)==null?void 0:u.status} ${c.message}`)})).data},me=async function({data:t,url:e,cancelable:r=!1}={}){await f(this,h,mt).call(this);const s=f(this,h,_t).call(this,32),a=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,s),o=await f(this,h,gt).call(this,s,JSON.stringify(t)),c=this;return(await A.post(e,o,{headers:{"Content-Type":"application/json","cache-control":"no-cache",data:a||""}}).catch(async l=>{var g;let p=`Error in request, verify internet connection: ${l.status} ${l.message}`;throw l.response.status>=500&&l.response.status<=599?p="Service Temporarily Unavailable":l.response.status>=400&&l.response.status<=499&&(p="Bad Request"),r&&await f(g=c,h,zi).call(g),new Error(p)})).data},Ji=async function(){const t=this.__pinPad__.constants.FS,e=this.__pinPad__.constants.ETX,r=this.__pinPad__.constants.STX;let s="C57A"+this.__pinPad__.config.internal.qpsDomestic;if(s=s+t+"B"+this.__pinPad__.config.internal.qpsInternational,s=s+t+"C"+this.__pinPad__.config.internal.cvmlVMCDomestic,s=s+t+"D"+this.__pinPad__.config.internal.cvmlVMCInternational,s=s+t+"E"+this.__pinPad__.config.internal.cvmlAmex,s=s+t+"F"+this.__pinPad__.config.internal.translimitCTLSVMC,s=s+t+"G"+this.__pinPad__.config.internal.translimitCTLSAmex,s=r+f(this,h,q).call(this,s)+s+e,s=s+f(this,h,K).call(this,s),!this.__pinPad__.about.injectedValues){const a=this.parseStringToBytes(s,"");await this.appendToQueue(a,"inject")}},Qi=async function(){this.__pinPad__.operation.bin8&&(this.__pinPad__.operation.bin=this.__pinPad__.operation.bin8),this.__pinPad__.operation.bin8="";const t=await f(this,h,me).call(this,{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 r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;e=r+f(this,h,q).call(this,e)+e+s,e=e+f(this,h,K).call(this,e);const a=this.parseStringToBytes(e,"");return await this.appendToQueue(a,"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},Zi=async function(t=null){if(this.__pinPad__.waiting.statusAboutWaiting)throw new Error("AboutPP is already running");const e=this.__pinPad__.constants.STX,r=this.__pinPad__.constants.ETX;let s="C56AABOUT";if(s=e+f(this,h,q).call(this,s)+s+r,s=s+f(this,h,K).call(this,s),B.isEmpty(this.__pinPad__.about.pp)){this.__pinPad__.waiting.statusAboutWaiting="pending";const c=this.parseStringToBytes(s,"");await this.appendToQueue(c,"about")}else return t?t(this.__pinPad__.about.pp.supportDUKPT,this.__pinPad__.about.pp.hasDUKPTKeys):!0;const a=this;let o=0;return new Promise((c,u)=>{o=setInterval(()=>{if(a.__pinPad__.waiting.statusAboutWaiting==="resolved"){if(clearInterval(o),a.__pinPad__.waiting.statusAboutWaiting=null,B.isEmpty(a.__pinPad__.about.pp))return;t||c(!0),c(t(a.__pinPad__.about.pp.supportDUKPT,a.__pinPad__.about.pp.hasDUKPTKeys))}else a.__pinPad__.waiting.statusAboutWaiting==="rejected"&&(clearInterval(o),a.__pinPad__.waiting.statusAboutWaiting=null,u("Error"))},500)})},Nt=async function(t,e){if(t=t?t.toString():"",e=e?e.toString():"",B.isEmpty(t)||t==="0"){this.dispatch("pp:dukpt",{status:"unsupported",already:!1});return}if(B.isEmpty(e)||e==="1"){this.dispatch("pp:dukpt",{status:"charged",already:!0});return}const r=f(this,h,_e).call(this),s=f(this,h,ge).call(this),a=this.__pinPad__.constants.FS,o=this.__pinPad__.constants.ETX,c=this.__pinPad__.constants.STX;let u="C91A"+r+a+"B"+s;u=c+f(this,h,q).call(this,u)+u+o,u=u+f(this,h,K).call(this,u);const l=this.parseStringToBytes(u,"");await this.appendToQueue(l,"init-dukpt");let p=0;this.__pinPad__.waiting.statusinitDUKPTWaiting="pending";const g=this;return new Promise((P,m)=>{p=setInterval(async()=>{var b;g.__pinPad__.waiting.statusinitDUKPTWaiting==="resolved"?(clearInterval(p),g.__pinPad__.waiting.statusinitDUKPTWaiting=null,g.dispatch("pp:dukpt",{status:"charged",already:!1}),await f(b=g,h,Yi).call(b),P(!0)):g.__pinPad__.waiting.statusinitDUKPTWaiting==="rejected"&&(clearInterval(p),g.__pinPad__.waiting.statusinitDUKPTWaiting=null,m("Error"))},500)})},Yi=async function(){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 f(this,h,me).call(this,{data:t,url:this.url+this.__pinPad__.constants.uris.keysDUKPT});await f(this,h,pn).call(this,e)},tn=async function(){if(!await f(this,h,he).call(this))throw new Error("RSA public key is empty");const e=this;await f(this,h,Zi).call(this,async function(s,a){var c,u;if(e.__pinPad__.about.supportInjection&&e.__pinPad__.config.internal.emv&&e.__pinPad__.about.injectedValues)return await f(c=e,h,Nt).call(c,s,a),!0;let o=0;return e.__pinPad__.waiting.statusInjectWaiting="pending",await f(u=e,h,Ji).call(u),new Promise((l,p)=>{o=setInterval(async()=>{var g;e.__pinPad__.waiting.statusInjectWaiting==="resolved"?(clearInterval(o),e.__pinPad__.waiting.statusInjectWaiting=null,await f(g=e,h,Nt).call(g,s,a),l(!0)):e.__pinPad__.waiting.statusInjectWaiting==="rejected"&&(clearInterval(o),e.__pinPad__.waiting.statusInjectWaiting=null,p("Error"))},500)})})},ye=function(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);let r=t.split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,""),r.join(".")},en=async function(){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"),B.isEmpty(this.amount)||this.amount<=0)throw new Error("Amount required");if(f(this,h,pe).call(this,this.amount)===!1)throw new Error("Invalid amount required");if(f(this,h,Bt).call(this,this.amount,2)<=0)throw new Error("Amount must be greater than 0");const e=this.__pinPad__.constants.FS,r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;let a="C93A"+t;a=a+e+"B"+f(this,h,_e).call(this),a=a+e+"C"+f(this,h,ge).call(this),a=a+e+"D"+f(this,h,Bt).call(this,this.amount,2),a=a+e+"E0.00",a=a+e+"F"+this.__pinPad__.config.currencyCode,this.__pinPad__.about.supportDUKPT&&this.__pinPad__.about.supportDUKPT!=="0"&&this.__pinPad__.about.supportDUKPT!=="false"&&(this.__pinPad__.about.supportContactless?(a=a+e+"G"+this.timeoutPinPad,a=a+e+"HTAGS",a=a+e+"I"+this.__pinPad__.config.requireCVVAmex,a=a+e+"J"+this.__pinPad__.config.forceOnline,a=a+e+"K"+this.__pinPad__.about.supportContactless,a=a+e+"L"+this.__pinPad__.config.emvCard,this.__pinPad__.about.hasCashback&&(a=a+e+"M0",a=a+e+"N00")):(a=a+e+"G"+this.timeoutPinPad,a=a+e+"HTAGS",a=a+e+"I"+this.__pinPad__.config.requireCVVAmex,a=a+e+"L"+this.__pinPad__.config.emvCard),this.__pinPad__.about.supportInjection&&(a=a+e+"O"+this.__pinPad__.config.validateQPS)),a=r+f(this,h,q).call(this,a)+a+s,a=a+f(this,h,K).call(this,a),f(this,h,fn).call(this);const o=this.parseStringToBytes(a,"");await this.appendToQueue(o,"read-card");let c=0;const u=this;return this.__pinPad__.waiting.statusReadCardWaiting="pending",new Promise((l,p)=>{c=setInterval(()=>{if(u.__pinPad__.waiting.statusReadCardWaiting==="resolved")clearInterval(c),u.__pinPad__.waiting.statusReadCardWaiting=null,l(!0);else if(u.__pinPad__.waiting.statusReadCardWaiting==="rejected"){clearInterval(c),u.__pinPad__.waiting.statusReadCardWaiting=null;const g=u.__pinPad__.operation.last_error;p(g??"Error reading card")}},500)})},nn=async function(t){return await B.wait(t*1e3)},rn=async function(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 f(this,h,ot).call(this,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})},sn=async function(t="",e={}){let r=1,s=null;do{r>1&&this.environment==="production"&&(t=t.replace(this.__pinPad__.constants.urls.production,this.__pinPad__.constants.urls.productionAlternative),await f(this,h,nn).call(this,5)),await f(this,h,mt).call(this);const a=f(this,h,_t).call(this,32),o=f(this,h,dt).call(this,this.__pinPad__.config.publicKeyRSA,a),c=await f(this,h,gt).call(this,a,JSON.stringify(e));let u=!1;const l=await A.post(t,c,{headers:{"Content-Type":"application/json",data:o||""}}).catch(async p=>{let g=`Error in request, verify internet connection: ${p.status} ${p.message}`;p.response.status>=500&&p.response.status<=599?g="Service Temporarily Unavailable":p.response.status>=400&&p.response.status<=499&&(g="Bad Request"),console.warn(p),s=g;const P=await f(this,h,rn).call(this,r);P&&P!=="{}"&&!P.includes('"transacciones":""')&&P.includes("nu_operaion")&&(r=5,s="EE32"),u=!0});if(!u)return l.data}while(r++<=3);return s?Promise.reject(s):Promise.reject("Communication error with CDP. IL/MTY")},an=function(t){if(B.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},on=function(t){var s,a;const e=this;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 r=(s=t.cd_response)==null?void 0:s.toUpperCase();return r.toUpperCase()==="0C"||this.__pinPad__.operation.responseMit._approved?r="00":(r!=="Z3"&&r!=="05"||t.cd_error==="92")&&(r="01"),this.__pinPad__.operation.responseMit._cdResponse=r,this.__pinPad__.finishCommand.A=r,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:r,cd_error:t.cd_error,nb_error:f(a=e,h,de).call(a,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}},cn=async function(){var s,a;const t=this;this.__pinPad__.operation.errors=0,this.__pinPad__.operation.ignore.counterSale=!1;const e=this.__pinPad__.operation.onlyMerchant;if(/^[0-9]+$/.test(e)===!1)throw new Error("Invalid merchant");this.__pinPad__.operation.typeOperation="29";let r={error:!1,message:null,approved:!1,object:{}};try{const o=await f(this,h,ye).call(this,this.amount,2);await f(this,h,yt).call(this,{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:o,Currency:this.__pinPad__.config.currency,Merchant:e,Reverse:this.__pinPad__.config.otherLogin.executeReverse});const c=this.__pinPad__.about.supportContactless&&this.__pinPad__.about.supportContactless!=="0"?"1":"0",u=await f(this,h,sn).call(this,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:o,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:c,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}}});u.response==="error"&&(r.error=!0,r.message=u.nb_error||"Error in response");const l=f(this,h,on).call(this,u);return r.object=l,await f(this,h,un).call(this,l),r.approved=this.__pinPad__.operation.responseMit._approved,this.__pinPad__.operation.finalResult=l,r}catch(o){throw t.__pinPad__.finishCommand.A="01",t.__pinPad__.finishCommand.B="",t.__pinPad__.finishCommand.C="",t.__pinPad__.finishCommand.D="",t.__pinPad__.finishCommand.E="",t.__pinPad__.finishCommand.F="",t.__pinPad__.finishCommand.G="",t.__pinPad__.finishCommand.H="",t.__pinPad__.finishCommand.I="",t.__pinPad__.finishCommand.J="",t.__pinPad__.finishCommand.K="",await f(a=t,h,ln).call(a,f(s=t,h,Pe).call(s,o)),o}},un=async function(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,r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;let a="C93A"+this.__pinPad__.finishCommand.A;a=a+e+"B"+this.__pinPad__.finishCommand.B,a=a+e+"C"+this.__pinPad__.finishCommand.C,a=a+e+"D"+this.__pinPad__.finishCommand.D,a=a+e+"E"+this.__pinPad__.finishCommand.E,a=a+e+"F"+this.__pinPad__.finishCommand.F,a=a+e+"G"+this.__pinPad__.finishCommand.G,a=a+e+"H"+this.__pinPad__.finishCommand.H,a=a+e+"I"+this.__pinPad__.finishCommand.I,a=a+e+"J"+this.__pinPad__.finishCommand.J,a=a+e+"K"+this.__pinPad__.finishCommand.K,a=r+f(this,h,q).call(this,a)+a+s,a=a+f(this,h,K).call(this,a);const o=this.parseStringToBytes(a,"");this.__pinPad__.waiting.statusSecondGenerateWaiting="pending",await this.appendToQueue(o,"second-generate");let c=0;const u=this;return new Promise((l,p)=>{c=setInterval(async()=>{var g,P;if(u.__pinPad__.waiting.statusSecondGenerateWaiting==="resolved"){if(clearInterval(c),u.__pinPad__.waiting.statusSecondGenerateWaiting=null,u.__pinPad__.operation.applyReverse){const m=await f(g=u,h,ot).call(g,u.url+u.__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:f(this,h,Bt).call(this,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}}}),b=JSON.parse(m);let y;b.response==="approved"?y={message:"Transaction rejected by PinPad."}:y={message:"No communication, please check your report."},u.__pinPad__.operation.ignore.counterSale||(u.dispatch("pp:finish-emv",y),u.__pinPad__.operation.ignore.counterSale=!0)}else u.__pinPad__.operation.ignore.counterSale||(u.dispatch("pp:finish-emv",t),u.__pinPad__.operation.ignore.counterSale=!0);t.cd_error==="92"&&await f(P=u,h,hn).call(P,t,a),l(!0)}else u.__pinPad__.waiting.statusSecondGenerateWaiting==="rejected"&&(clearInterval(c),u.__pinPad__.waiting.statusSecondGenerateWaiting=null,p("There is no response from the reader, check that it is connected."))},500)})},hn=async function(t,e){this.__pinPad__.operation.ignore.responseGlobal=t,this.__pinPad__.operation.ignore.C93Global=e,this.__pinPad__.operation.ignore.isError92TRX=!0,await f(this,h,Nt).call(this,1,0)},be=async function(){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 B.wait(1400),this.dispatch("pp:response",this.__pinPad__.operation.ignore.responseGlobal)}},Pe=function(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."};let r=e[t]?{error:t,message:e[t]}:{error:t,message:"Error desconocido"};return this.dispatch("pp:error",r),r},ln=async function(t){const e=this.__pinPad__.constants.FS,r=this.__pinPad__.constants.STX,s=this.__pinPad__.constants.ETX;let a="C93A"+this.__pinPad__.finishCommand.A;if(a=a+e+"B"+this.__pinPad__.finishCommand.B,a=a+e+"C"+this.__pinPad__.finishCommand.C,a=a+e+"D"+this.__pinPad__.finishCommand.D,a=a+e+"E"+this.__pinPad__.finishCommand.E,a=a+e+"F"+this.__pinPad__.finishCommand.F,a=a+e+"G"+this.__pinPad__.finishCommand.G,a=a+e+"H"+this.__pinPad__.finishCommand.H,a=a+e+"I"+this.__pinPad__.finishCommand.I,a=a+e+"J"+this.__pinPad__.finishCommand.J,a=a+e+"K"+this.__pinPad__.finishCommand.K,a=r+f(this,h,q).call(this,a)+a+s,a=a+f(this,h,K).call(this,a),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 o=this.parseStringToBytes(a,"");await this.appendToQueue(o,"finish-emv-end")},pn=async function(t){if(t.cd_estatus=t.cd_estatus?t.cd_estatus:"0",t.cd_estatus!=="1"){this.__pinPad__.operation.ignore.isError92TRX&&await f(this,h,be).call(this);return}const e=this.__pinPad__.constants.FS,r=this.__pinPad__.constants.ETX,s=this.__pinPad__.constants.STX,a=t.nb_ksn,o=t.nb_kcv||"",c=t.nb_ipek||"";let u="C92A"+a+e+"B"+o+e+"C"+c;u=s+f(this,h,q).call(this,u)+u+r,u=u+f(this,h,K).call(this,u);const l=this.parseStringToBytes(u,"");await this.appendToQueue(l,"dukpt");let p=0;this.__pinPad__.waiting.statuswritingDUKPTWaiting="pending";const g=this;return new Promise((P,m)=>{p=setInterval(async()=>{var b;g.__pinPad__.waiting.statuswritingDUKPTWaiting==="resolved"?(clearInterval(p),g.__pinPad__.waiting.statuswritingDUKPTWaiting=null,this.__pinPad__.operation.ignore.isError92TRX&&await f(b=g,h,be).call(b),P(!0)):g.__pinPad__.waiting.statuswritingDUKPTWaiting==="rejected"&&(clearInterval(p),g.__pinPad__.waiting.statuswritingDUKPTWaiting=null,m("Error writing DUKPT keys"))},500)})},fn=function(){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};exports.PinPad=ys;
|
package/dist/pinpad.js
CHANGED
|
@@ -6,7 +6,7 @@ var bn = (n, i, t) => i in n ? yn(n, i, { enumerable: !0, configurable: !0, writ
|
|
|
6
6
|
var Ce = (n, i, t) => bn(n, typeof i != "symbol" ? i + "" : i, t), Pn = (n, i, t) => i.has(n) || Te("Cannot " + t);
|
|
7
7
|
var Ae = (n, i, t) => i.has(n) ? Te("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t);
|
|
8
8
|
var p = (n, i, t) => (Pn(n, i, "access private method"), t);
|
|
9
|
-
import { K as vn, a as wn,
|
|
9
|
+
import { K as vn, a as wn, h as Re, i as G, b as Oe, w as xe } from "./kernel-BLbpgXHp.js";
|
|
10
10
|
var En = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
11
11
|
function $(n) {
|
|
12
12
|
return En.charAt(n);
|
|
@@ -2295,6 +2295,8 @@ function Kt(n, i, t) {
|
|
|
2295
2295
|
if (m === null) return "";
|
|
2296
2296
|
if (d.isDate(m))
|
|
2297
2297
|
return m.toISOString();
|
|
2298
|
+
if (d.isBoolean(m))
|
|
2299
|
+
return m.toString();
|
|
2298
2300
|
if (!c && d.isBlob(m))
|
|
2299
2301
|
throw new w("Blob is not supported. Use a Buffer instead.");
|
|
2300
2302
|
return d.isArrayBuffer(m) || d.isTypedArray(m) ? c && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
|
|
@@ -3215,7 +3217,7 @@ const _s = async (n) => {
|
|
|
3215
3217
|
duplex: "half",
|
|
3216
3218
|
credentials: C ? f : void 0
|
|
3217
3219
|
});
|
|
3218
|
-
let T = await fetch(m);
|
|
3220
|
+
let T = await fetch(m, g);
|
|
3219
3221
|
const R = re && (u === "stream" || u === "response");
|
|
3220
3222
|
if (re && (o || R && b)) {
|
|
3221
3223
|
const I = {};
|
|
@@ -3320,7 +3322,7 @@ function Ze(n) {
|
|
|
3320
3322
|
), e.response.headers = L.from(e.response.headers))), Promise.reject(e);
|
|
3321
3323
|
});
|
|
3322
3324
|
}
|
|
3323
|
-
const Ti = "1.
|
|
3325
|
+
const Ti = "1.10.0", Wt = {};
|
|
3324
3326
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((n, i) => {
|
|
3325
3327
|
Wt[n] = function(e) {
|
|
3326
3328
|
return typeof e === n || "a" + (i < 1 ? "n " : " ") + n;
|