payment-token-efi 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +41 -9
- package/dist/payment-token-efi-cjs.min.js +2 -2
- package/dist/payment-token-efi-esm.min.js +2 -2
- package/dist/payment-token-efi-umd.min.js +2 -2
- package/dist/payment-token-efi.min.js +2 -2
- package/examples/app-angular.ts +22 -4
- package/examples/app-browser.html +11 -0
- package/examples/app-react.js +17 -2
- package/examples/app-react.tsx +16 -1
- package/examples/app-vue.vue +16 -1
- package/examples/webview-react-native.js +21 -0
- package/index.html +13 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).EfiPay=e()}(this,(function(){"use strict";function t(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function e(e){return function(){var r=this,n=arguments;return new Promise((function(i,o){var s=e.apply(r,n);function a(e){t(s,i,o,a,u,"next",e)}function u(e){t(s,i,o,a,u,"throw",e)}a(void 0)}))}}function r(t,e,r){return e=a(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,r||[],a(t).constructor):e.apply(t,r))}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function o(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(u=function(){return!!t})()}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(){l=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,s=Object.create(o.prototype),a=new k(n||[]);return i(s,"_invoke",{value:R(t,r,a)}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",d="suspendedYield",g="executing",v="completed",m={};function y(){}function b(){}function w(){}var E={};c(E,s,(function(){return this}));var T=Object.getPrototypeOf,S=T&&T(T(I([])));S&&S!==r&&n.call(S,s)&&(E=S);var x=w.prototype=y.prototype=Object.create(E);function D(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(i,o,s,a){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return r("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function R(e,r,n){var i=p;return function(o,s){if(i===g)throw Error("Generator is already running");if(i===v){if("throw"===o)throw s;return{value:t,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var u=_(a,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var c=f(e,r,n);if("normal"===c.type){if(i=n.done?v:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=v,n.method="throw",n.arg=c.arg)}}}function _(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=f(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var s=o.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return b.prototype=w,i(x,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=c(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,c(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},D(O.prototype),c(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new O(h(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},D(x),c(x,u,"Generator"),c(x,s,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return a.type="throw",a.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function p(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(u())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&f(i,r.prototype),i}(t,arguments,a(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),f(r,t)},g(t)}var v=function(t){function e(t){var i;return n(this,e),(i=r(this,e,[t.error_description])).code=t.code,i.error=t.error,i.error_description=t.error_description,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(e,t),o(e)}(g(Error)),m=function(){return o((function t(){n(this,t)}),null,[{key:"accountIdentifier",value:function(t){return t?"string"==typeof t&&/^[a-zA-Z0-9]{32}$/i.test(t)||this.throwError("identificador_invalido","Identificador de conta [".concat(t,"] inválido")):this.throwError("identificador_invalido","Identificador de conta não informado"),t}},{key:"environment",value:function(t){var e=["production","sandbox"];return t&&"string"==typeof t&&e.includes(t.toLowerCase())||this.throwError("ambiente_invalido",'Escolha um ambiente de integração válido: "'.concat(e.join('" ou "'),'"')),t.toLowerCase()}},{key:"runtimeEnvironment",value:function(){"undefined"==typeof document&&this.throwError("environment_error","Esta biblioteca não pode ser carregada em um ambiente sem DOM.")}},{key:"creditCard",value:function(t){var e=this;"object"===d(t)&&t||this.throwError("dados_cartao_invalido","O parâmetro em setCreditCardData deve ser um objeto");["brand","number","cvv","expirationMonth","expirationYear"].forEach((function(r){t.hasOwnProperty(r)||e.throwError("dados_cartao_invalido","O atributo [".concat(r,"] é obrigatório"))}));var r={brand:this.brand(t.brand),number:this.cardNumber(t.number),cvv:this.cardCvv(t.cvv),expiration_month:this.expirationMonth(t.expirationMonth),expiration_year:this.expirationYear(t.expirationYear,t.expirationMonth),reuse:this.reusable(t.reuse)},n=this.holderName(t.holderName);n&&(r.holder_name=n);var i=this.holderDocument(t.holderDocument);return i&&(r.holder_document=i),r}},{key:"brand",value:function(t){"string"!=typeof t&&this.throwError("bandeira_cartao_invalido","A bandeira do cartão deve ser fornecida como string");var e=["visa","mastercard","amex","elo","hipercard"],r=t.toLowerCase();return e.includes(r)||this.throwError("bandeira_invalida",'Escolha uma bandeira entre "'.concat(e.join('", "'),'"')),r}},{key:"brands",value:function(t){var e=t.replace(/\D/g,""),r="";return(/(60420[1-9]|6042[1-9][0-9]|6043[0-9]{2}|604400)/.test(e)||/^3(?:0[0-5]|[68][0-9])[0-9]{0,11}$/.test(e)||/^6(?:011|5[0-9]{2})[0-9]{12}/.test(e)||/^2(?:014|149)[0-9]{0,11}$/.test(e)||/^(?:2131|1800|35\d{3})\d{0,11}$/.test(e)||/^627892|^636414/.test(e)||/^606444|^606458|^606482/.test(e)||/^8699[0-9]{0,11}$/.test(e)||/^50[0-9]{0,17}$/.test(e))&&(r="unsupported"),r=/^4\d{0,12}(?:\d{3})?$/.test(e)?"visa":r,r=/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)\d{0,12}$/.test(e)?"mastercard":r,r=/^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|50(9[0-9][0-9][0-9])|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|05([7-9])|06([0-9])|07([0-9])|08([0-9])|4([0-3][0-9]|8[5-9]|9[0-9])|5([0-9][0-9]|3[0-8])|9([0-6][0-9]|7[0-8])|7([0-2][0-9])|541|700|720|727|901)|65165([2-9])|6516([6-7][0-9])|65500([0-9])|6550([0-5][0-9])|655021|65505([6-7])|6516([8-9][0-9])|65170([0-4]))/.test(e)?"elo":r,r=/^3[47][0-9]{0,13}$/.test(e)?"amex":r,(r=/^(606282\d{10}(\d{3})?)|(3841\d{0,15})$/.test(e)?"hipercard":r)||"undefined"}},{key:"total",value:function(t){return Number.isInteger(t)||this.throwError("valor_invalido","O valor total deve ser fornecido como número inteiro"),t<300&&this.throwError("valor_invalido","O valor [".concat(t,"] é inferior ao limite mínimo (R$3,00)")),t}},{key:"cardNumber",value:function(t){"string"!=typeof t&&this.throwError("numero_cartao_invalido","O número do cartão deve ser fornecido como string");var e=t.replace(/\s+/g,"");/^[0-9]+$/.test(e)||this.throwError("numero_cartao_invalido","O número do cartão deve conter somente números");return(e.length<13||e.length>19)&&this.throwError("numero_cartao_invalido","O número do cartão deve conter entre ".concat(13," e ").concat(19," dígitos")),e}},{key:"brandCardNumber",value:function(t){"string"!=typeof t&&this.throwError("numero_cartao_invalido","O número do cartão deve ser fornecido como string");var e=t.replace(/\s+/g,"");return/^[0-9]+$/.test(e)||this.throwError("numero_cartao_invalido","O número do cartão deve conter somente números"),e}},{key:"cardCvv",value:function(t){"string"!=typeof t&&this.throwError("cvv_cartao_invalido","O número CVV do cartão deve ser fornecido como string");var e=t.replace(/\D/g,"");return/^\d{3,4}$/.test(e)||this.throwError("cvv_cartao_invalido","Número CVV do cartão [".concat(t,"] inválido")),e}},{key:"expirationMonth",value:function(t){"string"!=typeof t&&this.throwError("validade_cartao_invalida","O mês de validade do cartão deve ser fornecido como string");var e=t.replace(/\D/g,""),r=parseInt(e,10);return(r<1||r>12||!/^\d{2}$/.test(e))&&this.throwError("validade_cartao_invalida","Mês de validade do cartão [".concat(t,"] inválido")),e}},{key:"expirationYear",value:function(t,e){"string"!=typeof t&&this.throwError("validade_cartao_invalida","O ano de validade do cartão deve ser fornecido como string");var r=(new Date).getFullYear(),n=(new Date).getMonth()+1,i=parseInt(t.replace(/\D/g,""),10);return(isNaN(i)||i<r||i>r+11)&&this.throwError("validade_cartao_invalida","Ano de validade do cartão [".concat(t,"] inválido")),i===r&&parseInt(e,10)<=n&&this.throwError("validade_cartao_invalida","Data de validade do cartão [".concat(e,"/").concat(t,"] expirada")),i.toString()}},{key:"holderName",value:function(t){return null==t?null:("string"!=typeof t&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve ser fornecido como string"),t.length<3&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve ter no mínimo 3 caracteres"),t.length>50&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve ter no máximo 50 caracteres"),t.trim().split(/\s+/).length<2&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve conter pelo menos duas palavras"),t)}},{key:"holderDocument",value:function(t){if(null==t)return null;"string"!=typeof t&&this.throwError("documento_titular_cartao_invalido","O documento do titular do cartão deve ser fornecido como string");var e=t.replace(/\D/g,""),r=!1;if(11===e.length&&e.match(/^[0-9]{11}$/)&&!e.match(/^([0-9])\1{10}$/)){for(var n,i=0,o=1;o<=9;o+=1)i+=parseInt(e.substring(o-1,o),10)*(11-o);if(10!==(n=10*i%11)&&11!==n||(n=0),n===parseInt(e.substring(9,10),10)){i=0;for(var s=1;s<=10;s+=1)i+=parseInt(e.substring(s-1,s),10)*(12-s);10!==(n=10*i%11)&&11!==n||(n=0),n===parseInt(e.substring(10,11),10)&&(r=!0)}}if(e.length>11&&e.match(/^[0-9]{14}$/)&&!e.match(/^([0-9])\1{13}$/)){for(var a=[6,5,4,3,2,9,8,7,6,5,4,3,2],u=0,c=0,h=parseInt(e.substring(12,14),10),l=0;l<a.length;l+=1)u+=l>0?parseInt(e.charAt(l-1),10)*a[l]:0,c+=parseInt(e.charAt(l),10)*a[l];10*(u=u%11<2?0:11-u%11)+(c=c%11<2?0:11-c%11)===h&&(r=!0)}return r||this.throwError("documento_titular_cartao_invalido","O documento do titular do cartão fornecido é inválido"),e}},{key:"reusable",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"boolean"!=typeof t&&this.throwError("reuse_invalido","O parâmetro [reuse] deve ser um booleano"),t}},{key:"debugger",value:function(t){return"boolean"==typeof t||["true","false"].includes(t.toString())||(t=!1),t}},{key:"throwError",value:function(t,e){throw new v({error:t,error_description:e,code:arguments.length>2&&void 0!==arguments[2]?arguments[2]:400})}}])}(),y=function(){return o((function t(){n(this,t)}),null,[{key:"getBrand",value:(t=e(l().mark((function t(e){var r,n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=m.brandCardNumber(e),n=m.brands(r),t.abrupt("return",n);case 3:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})}]);var t}(),b=function(){return o((function t(){n(this,t)}),null,[{key:"getInstallments",value:(t=e(l().mark((function t(e,r,n,i){var o,s,a,u,c,h,f,p,d=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=d.length>4&&void 0!==d[4]&&d[4],s=this.constructUrl(e,r,n,i),a={method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}},t.next=5,fetch(s,a);case 5:return u=t.sent,t.next=8,u.json();case 8:if(c=t.sent,u.ok&&200===c.code){t.next=12;break}throw o&&console.error("RequestError_Installments",c),new v({code:null!==(h=c.code)&&void 0!==h?h:500,error:null!==(f=c.error)&&void 0!==f?f:"request_error",error_description:this.formatErrorDescription(c.error_description)});case 12:return p=c.data,t.abrupt("return",p);case 14:case"end":return t.stop()}}),t,this)}))),function(e,r,n,i){return t.apply(this,arguments)})},{key:"constructUrl",value:function(t,e,r,n){return"".concat("production"===n?"https://api.gerencianet.com.br/v1/installments":"https://sandbox.gerencianet.com.br/v1/installments","/").concat(t,"/jsonp?brand=").concat(e,"&total=").concat(r)}},{key:"formatErrorDescription",value:function(t){return void 0===t?"Falha ao capturar parcelas no processo getInstallments":"object"===d(t)?"Propriedade: ".concat(t.property,". ").concat(t.message):t}}]);var t}(),w=function(){return o((function t(){n(this,t)}),null,[{key:"getSalt",value:(t=e(l().mark((function t(e){var r,n,i,o,s,a,u,c,h=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=h.length>1&&void 0!==h[1]&&h[1],!(n=this.getCachedSalt())){t.next=4;break}return t.abrupt("return",n);case 4:return i=this.constructParams(e),t.next=8,fetch("https://tokenizer.gerencianet.com.br/salt",i);case 8:return o=t.sent,t.next=11,o.json();case 11:if(s=t.sent,o.ok&&200===s.code){t.next=15;break}throw r&&console.error("RequestError_Salt",s),new v({code:null!==(a=s.code)&&void 0!==a?a:500,error:null!==(u=s.error)&&void 0!==u?u:"request_error",error_description:void 0!==s.error_description?s.error_description:"Falha ao capturar o salt no processo getSalt"});case 15:return c=s.data,this.setSaltCookie(c),t.abrupt("return",c);case 18:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"getCachedSalt",value:function(){var t=new RegExp("(?:(?:^|.*;\\s*)P_expireAt\\s*=\\s*([^;]*).*$)|^.*$"),e=document.cookie.replace(t,"$1");if((new Date).setSeconds(1)<e){var r=new RegExp("(?:(?:^|.*;\\s*)P_salt\\s*=\\s*([^;]*).*$)|^.*$");return decodeURIComponent(document.cookie.replace(r,"$1"))||null}return null}},{key:"constructParams",value:function(t){return{method:"GET",headers:{"Account-code":t,"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}}},{key:"setSaltCookie",value:function(t){var e=(new Date).setSeconds(55);document.cookie="".concat(encodeURIComponent("P_expireAt"),"=").concat(encodeURIComponent(e),"; max-age=60; expires=").concat(new Date(Date.now()+6e4).toUTCString(),"; path=/; SameSite=Strict; Secure"),document.cookie="".concat(encodeURIComponent("P_salt"),"=").concat(encodeURIComponent(t),"; max-age=60; expires=").concat(new Date(Date.now()+6e4).toUTCString(),"; path=/; SameSite=Strict; Secure")}}]);var t}(),E=function(){return o((function t(){n(this,t)}),null,[{key:"getPublicKey",value:(r=e(l().mark((function t(e,r){var n,i,o,s,a,u,c,h,f,p,d=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=d.length>2&&void 0!==d[2]&&d[2],o=(i="production"===r)?"P_":"H_",!(s=this.getCachedPublicKey(o))){t.next=6;break}return t.abrupt("return",s);case 6:return a=this.constructUrl(i),t.next=9,this.fetchPublicKey(a,e);case 9:return u=t.sent,t.next=12,u.json();case 12:if(c=t.sent,u.ok&&200===c.code){t.next=16;break}throw n&&console.error("RequestError_PublicKey",c),new v({code:null!==(h=c.code)&&void 0!==h?h:500,error:null!==(f=c.error)&&void 0!==f?f:"request_error",error_description:void 0!==c.error_description?c.error_description:"Falha ao capturar a chave pública no processo getPublicKey"});case 16:return p=c.data,this.setPublicKeyCookie(o,p),t.abrupt("return",p);case 19:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"getCachedPublicKey",value:function(t){var e=new RegExp("(?:(?:^|.*;\\s*)".concat(t,"publicKey\\s*=\\s*([^;]*).*$)|^.*$"));return decodeURIComponent(document.cookie.replace(e,"$1"))||null}},{key:"constructUrl",value:function(t){return t?"https://api.gerencianet.com.br/v1/pubkey":"https://sandbox.gerencianet.com.br/v1/pubkey"}},{key:"fetchPublicKey",value:(t=e(l().mark((function t(e,r){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={method:"GET"},t.next=3,fetch("".concat(e,"?code=").concat(r),n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)}))),function(e,r){return t.apply(this,arguments)})},{key:"setPublicKeyCookie",value:function(t,e){document.cookie="".concat(encodeURIComponent("".concat(t,"publicKey")),"=").concat(encodeURIComponent(e),"; max-age=3600; path=/; SameSite=Strict; Secure; ")}}]);var t,r}(),T=function(){return o((function t(){n(this,t)}),null,[{key:"getPaymentToken",value:(t=e(l().mark((function t(e,r,n,i){var o,s,a,u,c,h,f,p,d,g,m=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=m.length>4&&void 0!==m[4]&&m[4],s=this.constructRequestParams(e,r,n,i),a=s.url,u=s.params,t.next=4,fetch(a,u);case 4:return c=t.sent,t.next=7,c.json();case 7:if(h=t.sent,c.ok&&200===h.code){t.next=11;break}throw o&&console.error("RequestError_SaveCardData:\n",h),new v({code:null!==(f=h.code)&&void 0!==f?f:500,error:null!==(p=h.error)&&void 0!==p?p:"request_error",error_description:null!==(d=h.error_description)&&void 0!==d?d:"Falha ao capturar payment_token no processo getPaymentToken"});case 11:return g=h.data,t.abrupt("return",g);case 13:case"end":return t.stop()}}),t,this)}))),function(e,r,n,i){return t.apply(this,arguments)})},{key:"constructRequestParams",value:function(t,e,r,n){var i="production"===n;return{url:i?"https://tokenizer.gerencianet.com.br/card":"https://sandbox.gerencianet.com.br/v1/card/".concat(t,"/jsonp?")+new URLSearchParams({data:r}),params:h({method:i?"POST":"GET",headers:h({"Content-Type":"application/json; charset=UTF-8","Session-token":e},i&&{"Account-code":t})},i&&{body:JSON.stringify({data:r})})}}}]);var t}(),S=function(){return o((function t(){n(this,t)}),null,[{key:"getSessionToken",value:(t=e(l().mark((function t(){var e,r,n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e="0123456789abcdef",r="",n=0;n<36;n++)[8,13,18,23].includes(n)?r+="-":r+=14===n?"4":19===n?e[4*Math.random()|8]:e[16*Math.random()|0];return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})}]);var t}(),x={version:"3.1.1"},D={cS:{key:"a2fc7cc16f"}},O=function(){return o((function t(){n(this,t)}),null,[{key:"getFingerPrint",value:(s=e(l().mark((function t(e){var r,n,i=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i.length>1&&void 0!==i[1]&&i[1],t.prev=1,n=D.cS.key,t.next=5,this.checkScriptBlocking("https://device.clearsale.com.br/p/fp.png?app=".concat(n),e,n,r);case 5:return t.next=7,this.loadClearSaleScript(n,e,r);case 7:return t.abrupt("return",e);case 10:throw t.prev=10,t.t0=t.catch(1),r&&console.log(t.t0),new v(t.t0);case 14:case"end":return t.stop()}}),t,this,[[1,10]])}))),function(t){return s.apply(this,arguments)})},{key:"checkScriptBlocking",value:(i=e(l().mark((function t(e,r,n,i){var o=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,s){var a=new XMLHttpRequest;a.open("GET",e,!0),a.timeout=5e3,a.onload=function(){a.status>=200&&a.status<300?(i&&console.log("FingerPrint CS foi executado"),t()):(o.handleScriptBlocking(r,n),s({code:400,error:"erro_cs_script",error_description:"Script FingerPrint bloqueado ou erro inesperado na resposta."}))},a.onerror=function(){o.handleScriptBlocking(r,n),s({code:400,error:"erro_cs_script",error_description:"Falha ao conectar ao script FingerPrint. Verifique seu navegador ou extensão."})},a.ontimeout=function(){o.handleScriptBlocking(r,n),s({code:408,error:"timeout_cs_script",error_description:"Timeout ao conectar ao script FingerPrint."})},a.send(null)})));case 1:case"end":return t.stop()}}),t)}))),function(t,e,r,n){return i.apply(this,arguments)})},{key:"handleScriptBlocking",value:(r=e(l().mark((function t(e,r){var n,i;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n="https://web.fpcs-monitor.com.br/p/fp.png?sid=".concat(e,"&app=").concat(r,"&bl=1");try{(i=new XMLHttpRequest).open("GET",n,!0),i.onload=function(){i.status>=200&&i.status<300?console.log("Fallback executado com sucesso."):console.error("Erro ao executar o fallback:",i.statusText)},i.onerror=function(){console.error("Falha na conexão ao executar o fallback.")},i.send(null)}catch(t){console.error("Erro inesperado ao executar o fallback:",t)}case 2:case"end":return t.stop()}}),t)}))),function(t,e){return r.apply(this,arguments)})},{key:"loadClearSaleScript",value:(t=e(l().mark((function t(e,r,n){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,i){window.CsdpObject="csdp",window.csdp=window.csdp||function(){(window.csdp.q=window.csdp.q||[]).push(arguments)},window.csdp.l=1*new Date;var o=document.createElement("script");o.async=!0,o.src="https://device.clearsale.com.br/p/fp.js",o.onload=function(){window.csdp("app",e),window.csdp("sessionid",r),t()},o.onerror=function(t){n&&console.error("Load_FingerPrint:",t),i({code:500,error:"erro_cs_script",error_description:"Falha ao carregar o script de fingerPrint. Verifique seu navegador ou extensão."})};var s=document.getElementsByTagName("script")[0];s&&s.parentNode?s.parentNode.insertBefore(o,s):i({code:400,error:"erro_cs_script",error_description:"Falha ao inserir o script de fingerPrint. Verifique seu navegador ou extensão."})})));case 1:case"end":return t.stop()}}),t)}))),function(e,r,n){return t.apply(this,arguments)})}]);var t,r,i,s}();function R(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _={exports:{}};!function(t){window,t.exports=function(){var t={155:function(t){var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,u=[],c=!1,h=-1;function l(){c&&a&&(c=!1,a.length?u=a.concat(u):h=-1,u.length&&f())}function f(){if(!c){var t=s(l);c=!0;for(var e=u.length;e;){for(a=u,u=[];++h<e;)a&&a[h].run();h=-1,e=u.length}a=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var n={};return function(){function t(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function e(t,e){return t&e}function i(t,e){return t|e}function o(t,e){return t^e}function s(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return!(65535&t)&&(t>>=16,e+=16),!(255&t)&&(t>>=8,e+=8),!(15&t)&&(t>>=4,e+=4),!(3&t)&&(t>>=2,e+=2),!(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}r.d(n,{default:function(){return st}});var c,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function l(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=h.charAt(r>>6)+h.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=h.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=h.charAt(r>>2)+h.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function f(e){var r,n="",i=0,o=0;for(r=0;r<e.length&&"="!=e.charAt(r);++r){var s=h.indexOf(e.charAt(r));s<0||(0==i?(n+=t(s>>2),o=3&s,i=1):1==i?(n+=t(o<<2|s>>4),o=15&s,i=2):2==i?(n+=t(o),n+=t(s>>2),o=3&s,i=3):(n+=t(o<<2|s>>4),n+=t(15&s),i=0))}return 1==i&&(n+=t(o<<2)),n}var p,d={decode:function(t){var e;if(void 0===p){var r="= \f\n\r\t \u2028\u2029";for(p=Object.create(null),e=0;e<64;++e)p["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(p["-"]=62,p._=63,e=0;e<r.length;++e)p[r.charAt(e)]=-1}var n=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=p[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=4?(n[n.length]=i>>16,n[n.length]=i>>8&255,n[n.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=i>>10;break;case 3:n[n.length]=i>>16,n[n.length]=i>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=d.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return d.decode(t)}},g=1e13,v=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var r,n,i=this.buf,o=i.length;for(r=0;r<o;++r)(n=i[r]*t+e)<g?e=0:n-=(e=0|n/g)*g,i[r]=n;e>0&&(i[r]=e)},t.prototype.sub=function(t){var e,r,n=this.buf,i=n.length;for(e=0;e<i;++e)(r=n[e]-t)<0?(r+=g,t=1):t=0,n[e]=r;for(;0===n[n.length-1];)n.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),n=e.length-2;n>=0;--n)r+=(g+e[n]).toString().substring(1);return r},t.prototype.valueOf=function(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*g+t[r];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),m=/^(\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)?)?$/,y=/^(\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 b(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}var w,E=function(){function t(e,r){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=r)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,r){for(var n="",i=t;i<e;++i)if(n+=this.hexByte(this.get(i)),!0!==r)switch(15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n},t.prototype.isASCII=function(t,e){for(var r=t;r<e;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var r="",n=t;n<e;++n)r+=String.fromCharCode(this.get(n));return r},t.prototype.parseStringUTF=function(t,e){for(var r="",n=t;n<e;){var i=this.get(n++);r+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(n++)):String.fromCharCode((15&i)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r},t.prototype.parseStringBMP=function(t,e){for(var r,n,i="",o=t;o<e;)r=this.get(o++),n=this.get(o++),i+=String.fromCharCode(r<<8|n);return i},t.prototype.parseTime=function(t,e,r){var n=this.parseStringISO(t,e),i=(r?m:y).exec(n);return i?(r&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n},t.prototype.parseInteger=function(t,e){for(var r,n=this.get(t),i=n>127,o=i?255:0,s="";n==o&&++t<e;)n=this.get(t);if(0==(r=e-t))return i?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^o));)s=+s<<1,--r;s="("+r+" bit)\n"}i&&(n-=256);for(var a=new v(n),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()},t.prototype.parseBitString=function(t,e,r){for(var n=this.get(t),i="("+((e-t-1<<3)-n)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?n:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>r)return i+b(o,r)}return i+o},t.prototype.parseOctetString=function(t,e,r){if(this.isASCII(t,e))return b(this.parseStringISO(t,e),r);var n=e-t,i="("+n+" byte)\n";n>(r/=2)&&(e=t+r);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return n>r&&(i+="…"),i},t.prototype.parseOID=function(t,e,r){for(var n="",i=new v,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===n)if((i=i.simplify())instanceof v)i.sub(80),n="2."+i.toString();else{var u=i<80?i<40?0:1:2;n=u+"."+(i-40*u)}else n+="."+i.toString();if(n.length>r)return b(n,r);i=new v,o=0}}return o>0&&(n+=".incomplete"),n},t}(),T=function(){function t(t,e,r,n,i){if(!(n instanceof S))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=n,this.sub=i}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return b(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return b(this.stream.parseStringISO(e,e+r),t);case 30:return b(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,n=this.sub.length;r<n;++r)e+=this.sub[r].toPrettyString(t)}return e},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var n=0;n<r;++n)e=256*e+t.get();return e},t.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)},t.decode=function(e){var r;r=e instanceof E?e:new E(e,0);var n=new E(r),i=new S(r),o=t.decodeLength(r),s=r.pos,a=s-n.pos,u=null,c=function(){var e=[];if(null!==o){for(var n=s+o;r.pos<n;)e[e.length]=t.decode(r);if(r.pos!=n)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=t.decode(r);if(i.tag.isEOC())break;e[e.length]=i}o=s-r.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return e};if(i.tagConstructed)u=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=r.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");u=c();for(var h=0;h<u.length;++h)if(u[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){u=null}if(null===u){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);r.pos=s+Math.abs(o)}return new t(n,a,o,i,u)},t}(),S=function(){function t(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=!!(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new v;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/x[x.length-1],O=function(){function r(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var r;if(16==e)r=4;else if(8==e)r=3;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return this.toRadix(e);r=2}var n,i=(1<<r)-1,o=!1,s="",a=this.t,u=this.DB-a*this.DB%r;if(a-- >0)for(u<this.DB&&(n=this[a]>>u)>0&&(o=!0,s=t(n));a>=0;)u<r?(n=(this[a]&(1<<u)-1)<<r-u,n|=this[--a]>>(u+=this.DB-r)):(n=this[a]>>(u-=r)&i,u<=0&&(u+=this.DB,--a)),n>0&&(o=!0),o&&(s+=t(n));return o?s:"0"},r.prototype.negate=function(){var t=k();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+M(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var e=k();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(r.ZERO)>0&&t.subTo(e,e),e},r.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new _(e):new B(e),this.exp(t,r)},r.prototype.clone=function(){var t=k();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),!!(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var r=k();return this.bitwiseTo(t,e,r),r},r.prototype.or=function(t){var e=k();return this.bitwiseTo(t,i,e),e},r.prototype.xor=function(t){var e=k();return this.bitwiseTo(t,o,e),e},r.prototype.andNot=function(t){var e=k();return this.bitwiseTo(t,s,e),e},r.prototype.not=function(){for(var t=k(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var e=k();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},r.prototype.shiftRight=function(t){var e=k();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+a(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=u(this[r]^e);return t},r.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,i)},r.prototype.clearBit=function(t){return this.changeBit(t,s)},r.prototype.flipBit=function(t){return this.changeBit(t,o)},r.prototype.add=function(t){var e=k();return this.addTo(t,e),e},r.prototype.subtract=function(t){var e=k();return this.subTo(t,e),e},r.prototype.multiply=function(t){var e=k();return this.multiplyTo(t,e),e},r.prototype.divide=function(t){var e=k();return this.divRemTo(t,e,null),e},r.prototype.remainder=function(t){var e=k();return this.divRemTo(t,null,e),e},r.prototype.divideAndRemainder=function(t){var e=k(),r=k();return this.divRemTo(t,e,r),[e,r]},r.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),o=L(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new _(e):e.isEven()?new P(e):new B(e);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var h=k();for(n.sqrTo(s[1],h);a<=c;)s[a]=k(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,f,p=t.t-1,d=!0,g=k();for(i=M(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(l|=t[p-1]>>this.DB+i-u)),a=r;!(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),d)s[l].copyTo(o),d=!1;else{for(;a>1;)n.sqrTo(o,g),n.sqrTo(g,o),a-=2;a>0?n.sqrTo(o,g):(f=o,o=g,g=f),n.mulTo(g,s[l],o)}for(;p>=0&&!(t[p]&1<<i);)n.sqrTo(o,g),f=o,o=g,g=f,--i<0&&(i=this.DB-1,--p)}return n.revert(o)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return r.ZERO;for(var n=t.clone(),i=this.clone(),o=L(1),s=L(0),a=L(0),u=L(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),e&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(n,i),e&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(r.ONE)?r.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},r.prototype.pow=function(t){return this.exp(t,new R)},r.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=x[x.length-1]){for(e=0;e<x.length;++e)if(r[0]==x[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<x.length;){for(var n=x[e],i=e+1;i<x.length&&n<D;)n*=x[i++];for(n=r.modInt(n);e<i;)if(n%x[e++]==0)return!1}return r.millerRabin(t)},r.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,e){var n;if(16==e)n=4;else if(8==e)n=3;else if(256==e)n=8;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return void this.fromRadix(t,e);n=2}this.t=0,this.s=0;for(var i=t.length,o=!1,s=0;--i>=0;){var a=8==n?255&+t[i]:C(t,i);a<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=n)>=this.DB&&(s-=this.DB))}8==n&&!!(128&+t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},r.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},r.prototype.lShiftTo=function(t,e){for(var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},r.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}},r.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},r.prototype.multiplyTo=function(t,e){var n=this.abs(),i=t.abs(),o=n.t;for(e.t=o+i.t;--o>=0;)e[o]=0;for(o=0;o<i.t;++o)e[o+n.t]=n.am(0,i[o],e,o,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},r.prototype.divRemTo=function(t,e,n){var i=t.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=k());var s=k(),a=this.s,u=t.s,c=this.DB-M(i[i.t-1]);c>0?(i.lShiftTo(c,s),o.lShiftTo(c,n)):(i.copyTo(s),o.copyTo(n));var h=s.t,l=s[h-1];if(0!=l){var f=l*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),p=this.FV/f,d=(1<<this.F1)/f,g=1<<this.F2,v=n.t,m=v-h,y=null==e?k():e;for(s.dlShiftTo(m,y),n.compareTo(y)>=0&&(n[n.t++]=1,n.subTo(y,n)),r.ONE.dlShiftTo(h,y),y.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--m>=0;){var b=n[--v]==l?this.DM:Math.floor(n[v]*p+(n[v-1]+g)*d);if((n[v]+=s.am(0,b,n,m,0,h))<b)for(s.dlShiftTo(m,y),n.subTo(y,n);n[v]<--b;)n.subTo(y,n)}null!=e&&(n.drShiftTo(h,e),a!=u&&r.ZERO.subTo(e,e)),n.t=h,n.clamp(),c>0&&n.rShiftTo(c,n),a<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(t,e){if(t>4294967295||t<1)return r.ONE;var n=k(),i=k(),o=e.convert(this),s=M(t)-1;for(o.copyTo(n);--s>=0;)if(e.sqrTo(n,i),(t&1<<s)>0)e.mulTo(i,o,n);else{var a=n;n=i,i=a}return e.revert(n)},r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=L(r),i=k(),o=k(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},r.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var n=this.chunkSize(e),i=Math.pow(e,n),o=!1,s=0,a=0,u=0;u<t.length;++u){var c=C(t,u);c<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(a=e*a+c,++s>=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,n){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),i,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var o=[],s=7&t;o.length=1+(t>>3),e.nextBytes(o),s>0?o[0]&=(1<<s)-1:o[0]=0,this.fromString(o,256)}},r.prototype.bitwiseTo=function(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},r.prototype.changeBit=function(t,e){var n=r.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},r.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},r.prototype.multiplyLowerTo=function(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()},r.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},r.prototype.millerRabin=function(t){var e=this.subtract(r.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var i=e.shiftRight(n);(t=t+1>>1)>x.length&&(t=x.length);for(var o=k(),s=0;s<t;++s){o.fromInt(x[Math.floor(Math.random()*x.length)]);var a=o.modPow(i,this);if(0!=a.compareTo(r.ONE)&&0!=a.compareTo(e)){for(var u=1;u++<n&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},r.prototype.square=function(){var t=k();return this.squareTo(t),t},r.prototype.gcda=function(t,e){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var o=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)e(r);else{o<s&&(s=o),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=function(){(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){e(n)}),0))};setTimeout(a,10)}},r.prototype.fromNumberAsync=function(t,e,n,o){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),i,this),this.isEven()&&this.dAddOffset(1,0);var s=this,a=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(r.ONE.shiftLeft(t-1),s),s.isProbablePrime(e)?setTimeout((function(){o()}),0):setTimeout(a,0)};setTimeout(a,0)}else{var u=[],c=7&t;u.length=1+(t>>3),e.nextBytes(u),c>0?u[0]&=(1<<c)-1:u[0]=0,this.fromString(u,256)}},r}(),R=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),_=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),B=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=k();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(O.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=k();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),P=function(){function t(t){this.m=t,this.r2=k(),this.q3=k(),O.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=k();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function k(){return new O(null)}function I(t,e){return new O(t,e)}var A="undefined"!=typeof navigator;A&&"Microsoft Internet Explorer"==navigator.appName?(O.prototype.am=function(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},w=30):A&&"Netscape"!=navigator.appName?(O.prototype.am=function(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},w=26):(O.prototype.am=function(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i},w=28),O.prototype.DB=w,O.prototype.DM=(1<<w)-1,O.prototype.DV=1<<w,O.prototype.FV=Math.pow(2,52),O.prototype.F1=52-w,O.prototype.F2=2*w-52;var V,N,j=[];for(V="0".charCodeAt(0),N=0;N<=9;++N)j[V++]=N;for(V="a".charCodeAt(0),N=10;N<36;++N)j[V++]=N;for(V="A".charCodeAt(0),N=10;N<36;++N)j[V++]=N;function C(t,e){var r=j[t.charCodeAt(e)];return null==r?-1:r}function L(t){var e=k();return e.fromInt(t),e}function M(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}O.ZERO=L(0),O.ONE=L(1);var q,F,H=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),U=null;if(null==U){U=[],F=0;var K=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var $=new Uint32Array(256);for(window.crypto.getRandomValues($),K=0;K<$.length;++K)U[F++]=255&$[K]}var G=0,z=function(t){if((G=G||0)>=256||F>=256)window.removeEventListener?window.removeEventListener("mousemove",z,!1):window.detachEvent&&window.detachEvent("onmousemove",z);else try{var e=t.x+t.y;U[F++]=255&e,G+=1}catch(t){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",z,!1):window.attachEvent&&window.attachEvent("onmousemove",z))}function Z(){if(null==q){for(q=new H;F<256;){var t=Math.floor(65536*Math.random());U[F++]=255&t}for(q.init(U),F=0;F<U.length;++F)U[F]=0;F=0}return q.next()}var Y=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=Z()},t}(),X=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=I(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,r=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new Y,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new O(r)}(t,e);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;for(var i=n.toString(16),o=i.length,s=0;s<2*e-o;s++)i="0"+i;return i},t.prototype.setPrivate=function(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=I(t,16),this.e=parseInt(e,16),this.d=I(r,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,r,n,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=I(t,16),this.e=parseInt(e,16),this.d=I(r,16),this.p=I(n,16),this.q=I(i,16),this.dmp1=I(o,16),this.dmq1=I(s,16),this.coeff=I(a,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var r=new Y,n=t>>1;this.e=parseInt(e,16);for(var i=new O(e,16);;){for(;this.p=new O(t-n,1,r),0!=this.p.subtract(O.ONE).gcd(i).compareTo(O.ONE)||!this.p.isProbablePrime(10););for(;this.q=new O(n,1,r),0!=this.q.subtract(O.ONE).gcd(i).compareTo(O.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(O.ONE),a=this.q.subtract(O.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(O.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=I(t,16),r=this.doPrivate(e);return null==r?null:function(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}(r,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,r){var n=new Y,i=t>>1;this.e=parseInt(e,16);var o=new O(e,16),s=this,a=function(){var e=function(){if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(O.ONE),n=s.q.subtract(O.ONE),i=e.multiply(n);0==i.gcd(o).compareTo(O.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=function(){s.q=k(),s.q.fromNumberAsync(i,1,n,(function(){s.q.subtract(O.ONE).gcda(o,(function(t){0==t.compareTo(O.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=function(){s.p=k(),s.p.fromNumberAsync(t-i,1,n,(function(){s.p.subtract(O.ONE).gcda(o,(function(t){0==t.compareTo(O.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},t.prototype.sign=function(t,e,r){var n=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var r=e-t.length-6,n="",i=0;i<r;i+=2)n+="ff";return I("0001"+n+"00"+t,16)}((J[r]||"")+e(t).toString(),this.n.bitLength()/4);if(null==n)return null;var i=this.doPrivate(n);if(null==i)return null;var o=i.toString(16);return 1&o.length?"0"+o:o},t.prototype.verify=function(t,e,r){var n=I(e,16),i=this.doPublic(n);return null==i?null:function(t){for(var e in J)if(J.hasOwnProperty(e)){var r=J[e],n=r.length;if(t.substr(0,n)==r)return t.substr(n)}return t}(i.toString(16).replace(/^1f+00/,""))==r(t).toString()},t}(),J={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"},Q={};Q.lang={extend:function(t,e,r){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),r){var i;for(i in r)t.prototype[i]=r[i];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(o=function(t,e){for(i=0;i<s.length;i+=1){var r=s[i],n=e[r];"function"==typeof n&&n!=Object.prototype[r]&&(t[r]=n)}})}catch(t){}o(t.prototype,r)}}};var W={};void 0!==W.asn1&&W.asn1||(W.asn1={}),W.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";e=new O(n,16).xor(t).add(O.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=W.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,s=e.DERNull,a=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,l=e.DERPrintableString,f=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,g=e.DERGeneralizedTime,v=e.DERSequence,m=e.DERSet,y=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var E=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":"))throw"undefined key: "+E;if("bool"==E)return new r(t[E]);if("int"==E)return new n(t[E]);if("bitstr"==E)return new i(t[E]);if("octstr"==E)return new o(t[E]);if("null"==E)return new s(t[E]);if("oid"==E)return new a(t[E]);if("enum"==E)return new u(t[E]);if("utf8str"==E)return new c(t[E]);if("numstr"==E)return new h(t[E]);if("prnstr"==E)return new l(t[E]);if("telstr"==E)return new f(t[E]);if("ia5str"==E)return new p(t[E]);if("utctime"==E)return new d(t[E]);if("gentime"==E)return new g(t[E]);if("seq"==E){for(var T=t[E],S=[],x=0;x<T.length;x++){var D=b(T[x]);S.push(D)}return new v({array:S})}if("set"==E){for(T=t[E],S=[],x=0;x<T.length;x++)D=b(T[x]),S.push(D);return new m({array:S})}if("tag"==E){var O=t[E];if("[object Array]"===Object.prototype.toString.call(O)&&3==O.length){var R=b(O[2]);return new y({tag:O[0],explicit:O[1],obj:R})}var _={};if(void 0!==O.explicit&&(_.explicit=O.explicit),void 0!==O.tag&&(_.tag=O.tag),void 0===O.obj)throw"obj shall be specified for 'tag'.";return _.obj=b(O.obj),new y(_)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},W.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);n+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new O(n,2).toString(10),n="")}return e},W.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new O(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(n=o+n,s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n},W.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n=0,v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},W.asn1.DERAbstractString=function(t){W.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Q.lang.extend(W.asn1.DERAbstractString,W.asn1.ASN1Object),W.asn1.DERAbstractTime=function(t){W.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},Q.lang.extend(W.asn1.DERAbstractTime,W.asn1.ASN1Object),W.asn1.DERAbstractStructured=function(t){W.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Q.lang.extend(W.asn1.DERAbstractStructured,W.asn1.ASN1Object),W.asn1.DERBoolean=function(){W.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Q.lang.extend(W.asn1.DERBoolean,W.asn1.ASN1Object),W.asn1.DERInteger=function(t){W.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=W.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new O(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Q.lang.extend(W.asn1.DERInteger,W.asn1.ASN1Object),W.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=W.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}W.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var r=0;r<=e;r++)t+="0";var n="";for(r=0;r<t.length-1;r+=8){var i=t.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+n},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Q.lang.extend(W.asn1.DERBitString,W.asn1.ASN1Object),W.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=W.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}W.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Q.lang.extend(W.asn1.DEROctetString,W.asn1.DERAbstractString),W.asn1.DERNull=function(){W.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Q.lang.extend(W.asn1.DERNull,W.asn1.ASN1Object),W.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new O(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(n=o+n,s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};W.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(t){var e=W.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},Q.lang.extend(W.asn1.DERObjectIdentifier,W.asn1.ASN1Object),W.asn1.DEREnumerated=function(t){W.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=W.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new O(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Q.lang.extend(W.asn1.DEREnumerated,W.asn1.ASN1Object),W.asn1.DERUTF8String=function(t){W.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Q.lang.extend(W.asn1.DERUTF8String,W.asn1.DERAbstractString),W.asn1.DERNumericString=function(t){W.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Q.lang.extend(W.asn1.DERNumericString,W.asn1.DERAbstractString),W.asn1.DERPrintableString=function(t){W.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Q.lang.extend(W.asn1.DERPrintableString,W.asn1.DERAbstractString),W.asn1.DERTeletexString=function(t){W.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Q.lang.extend(W.asn1.DERTeletexString,W.asn1.DERAbstractString),W.asn1.DERIA5String=function(t){W.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Q.lang.extend(W.asn1.DERIA5String,W.asn1.DERAbstractString),W.asn1.DERUTCTime=function(t){W.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},Q.lang.extend(W.asn1.DERUTCTime,W.asn1.DERAbstractTime),W.asn1.DERGeneralizedTime=function(t){W.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},Q.lang.extend(W.asn1.DERGeneralizedTime,W.asn1.DERAbstractTime),W.asn1.DERSequence=function(t){W.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},Q.lang.extend(W.asn1.DERSequence,W.asn1.DERAbstractStructured),W.asn1.DERSet=function(t){W.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Q.lang.extend(W.asn1.DERSet,W.asn1.DERAbstractStructured),W.asn1.DERTaggedObject=function(t){W.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,r){this.hT=e,this.isExplicit=t,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Q.lang.extend(W.asn1.DERTaggedObject,W.asn1.ASN1Object);var tt,et,rt=(tt=function(t,e){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},tt(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}tt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),nt=function(t){function e(r){var n=t.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(e.hasPrivateKeyProperty(r)||e.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}return rt(e,t),e.prototype.parseKey=function(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?function(t){var e;if(void 0===c){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(c={},e=0;e<16;++e)c[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)c[r.charAt(e)]=e;for(e=0;e<n.length;++e)c[n.charAt(e)]=-1}var i=[],o=0,s=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=c[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(i[i.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i}(t):d.unarmor(t),i=T.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=I(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=I(o,16);var s=i.sub[4].getHexStringValue();this.p=I(s,16);var a=i.sub[5].getHexStringValue();this.q=I(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=I(u,16);var h=i.sub[7].getHexStringValue();this.dmq1=I(h,16);var l=i.sub[8].getHexStringValue();this.coeff=I(l,16)}else{if(2!==i.sub.length)return!1;if(i.sub[0].sub){var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=I(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else e=i.sub[0].getHexStringValue(),this.n=I(e,16),r=i.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new W.asn1.DERInteger({int:0}),new W.asn1.DERInteger({bigint:this.n}),new W.asn1.DERInteger({int:this.e}),new W.asn1.DERInteger({bigint:this.d}),new W.asn1.DERInteger({bigint:this.p}),new W.asn1.DERInteger({bigint:this.q}),new W.asn1.DERInteger({bigint:this.dmp1}),new W.asn1.DERInteger({bigint:this.dmq1}),new W.asn1.DERInteger({bigint:this.coeff})]};return new W.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new W.asn1.DERSequence({array:[new W.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new W.asn1.DERNull]}),e=new W.asn1.DERSequence({array:[new W.asn1.DERInteger({bigint:this.n}),new W.asn1.DERInteger({int:this.e})]}),r=new W.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new W.asn1.DERSequence({array:[t,r]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return l(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var r="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(r,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(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")},e.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)},e}(X),it=r(155),ot=void 0!==it?null===(et=it.env)||void 0===et?void 0:"3.3.1":void 0,st=function(){function t(t){void 0===t&&(t={}),t=t||{},this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new nt(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(f(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return l(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,r){try{return l(this.getKey().sign(t,e,r))}catch(t){return!1}},t.prototype.verify=function(t,e,r){try{return this.getKey().verify(t,f(e),r)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new nt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=ot,t}()}(),n.default}()}(_);var B=R(_.exports),P=function(){return o((function t(){n(this,t)}),null,[{key:"encryptCardData",value:(t=e(l().mark((function t(e,r,n){var i,o,s,a,u=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=u.length>3&&void 0!==u[3]&&u[3],o=u.length>4&&void 0!==u[4]&&u[4],s=u.length>5?u[5]:void 0,t.prev=3,this.validateParameters(e,r,n,s),"production"===s&&(e.salt=r),i&&console.info("creditCardData:\n",o?e:"success"),(a=this.encrypt(e,n))||this.throwError("encryption_failed","Falha ao criptografar os dados."),t.abrupt("return",a);case 12:throw t.prev=12,t.t0=t.catch(3),new v(t.t0);case 15:case"end":return t.stop()}}),t,this,[[3,12]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"validateParameters",value:function(t,e,r,n){t&&"object"===d(t)||this.throwError("invalid_credit_card_data","Dados do cartão de crédito são inválidos."),"production"!==n||e||this.throwError("missing_salt","Salt é obrigatório em produção."),r||this.throwError("missing_public_key","Chave pública é obrigatória.")}},{key:"encrypt",value:function(t,e){var r=JSON.stringify(t),n=new B;return n.setPublicKey(e),n.encrypt(r)}},{key:"throwError",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n={code:400,error:t,error_description:e};throw r&&debug&&console.error("originalError:",r),new v(n)}}]);var t}(),k=function(){return o((function t(){n(this,t)}),null,[{key:"debugger",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.debug=m.debugger(t),this.result=m.debugger(e),this.debug&&(console.info("Debugger:",!0),console.info("Lib version:",x.version)),this}},{key:"setAccount",value:function(t){try{return this.accountIdentifier=m.accountIdentifier(t),this}catch(t){this.throwError("Error_setAccount",t)}}},{key:"setEnvironment",value:function(t){try{return this.environment=m.environment(t),this.debug&&console.info("Environment:",this.environment),this}catch(t){this.throwError("Error_setEnvironment",t)}}},{key:"setCreditCardData",value:function(t){try{return this.creditCard=m.creditCard(t),this}catch(t){this.throwError("Error_setCreditCardData",t)}}},{key:"setBrand",value:function(t){try{return this.brand=m.brand(t),this}catch(t){this.throwError("Error_setBrand",t)}}},{key:"setTotal",value:function(t){try{return this.total=m.total(t),this}catch(t){this.throwError("Error_setTotal",t)}}},{key:"setCardNumber",value:function(t){return this.cardNumber=t,this}},{key:"getPaymentToken",value:(a=e(l().mark((function t(){var e,r,n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m.runtimeEnvironment(),null===this.environment&&m.environment(this.environment),null===this.accountIdentifier&&m.accountIdentifier(this.accountIdentifier),t.prev=3,t.next=6,this.getSalt();case 6:return this.salt=t.sent,this.log("salt:\n",this.salt),t.next=10,E.getPublicKey(this.accountIdentifier,this.environment,this.debug);case 10:return this.publicKey=t.sent,this.log("publicKey:\n",this.publicKey),t.next=14,this.encryptCardData();case 14:return e=t.sent,this.log("cardDataEncripted:\n",e),t.next=18,S.getSessionToken();case 18:return r=t.sent,this.log("sessionToken:\n",r),t.next=22,O.getFingerPrint(r,this.debug);case 22:return t.next=24,T.getPaymentToken(this.accountIdentifier,r,e,this.environment,this.debug);case 24:return n=t.sent,this.log("paymentTokenData:\n",n),t.abrupt("return",n);case 29:t.prev=29,t.t0=t.catch(3),this.throwError("Error_getPaymentToken",t.t0);case 32:case"end":return t.stop()}}),t,this,[[3,29]])}))),function(){return a.apply(this,arguments)})},{key:"getInstallments",value:(s=e(l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===this.environment&&m.environment(this.environment),null===this.accountIdentifier&&m.accountIdentifier(this.accountIdentifier),t.prev=2,t.next=5,b.getInstallments(this.accountIdentifier,this.brand,this.total,this.environment,this.debug);case 5:return e=t.sent,this.log("installmentsData:\n",e),t.abrupt("return",e);case 10:t.prev=10,t.t0=t.catch(2),this.throwError("Error_getInstallments",t.t0);case 13:case"end":return t.stop()}}),t,this,[[2,10]])}))),function(){return s.apply(this,arguments)})},{key:"verifyCardBrand",value:(i=e(l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,y.getBrand(this.cardNumber);case 3:return e=t.sent,this.log("brand:",e),t.abrupt("return",e);case 8:t.prev=8,t.t0=t.catch(0),this.throwError("Error_verifyCardBrand",t.t0);case 11:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(){return i.apply(this,arguments)})},{key:"getSalt",value:(r=e(l().mark((function t(){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("production"!==this.environment){t.next=4;break}return t.next=3,w.getSalt(this.accountIdentifier,this.debug);case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return","sandbox_salt");case 5:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"encryptCardData",value:(t=e(l().mark((function t(){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P.encryptCardData(this.creditCard,this.salt,this.publicKey,this.debug,this.result,this.environment);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return t.apply(this,arguments)})},{key:"log",value:function(t,e){this.debug&&console.log(t,this.result?e:"success")}},{key:"throwError",value:function(t,e){throw this.debug&&console.error(t,e),new v(e)}}]);var t,r,i,s,a}();s(k,"accountIdentifier",null),s(k,"environment",null),s(k,"creditCard",null),s(k,"brand",null),s(k,"total",null),s(k,"cardNumber",null),s(k,"cardCvv",null),s(k,"expirationMonth",null),s(k,"expirationYear",null),s(k,"reusable",null),s(k,"debug",!1),s(k,"result",!1);
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).EfiPay=e()}(this,(function(){"use strict";function t(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function e(e){return function(){var r=this,n=arguments;return new Promise((function(i,o){var s=e.apply(r,n);function a(e){t(s,i,o,a,u,"next",e)}function u(e){t(s,i,o,a,u,"throw",e)}a(void 0)}))}}function r(t,e,r){return e=a(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,r||[],a(t).constructor):e.apply(t,r))}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function o(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(u=function(){return!!t})()}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(){l=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,s=Object.create(o.prototype),a=new P(n||[]);return i(s,"_invoke",{value:R(t,r,a)}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",d="suspendedYield",g="executing",v="completed",m={};function y(){}function b(){}function w(){}var E={};c(E,s,(function(){return this}));var S=Object.getPrototypeOf,T=S&&S(S(I([])));T&&T!==r&&n.call(T,s)&&(E=T);var x=w.prototype=y.prototype=Object.create(E);function D(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(i,o,s,a){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return r("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function R(e,r,n){var i=p;return function(o,s){if(i===g)throw Error("Generator is already running");if(i===v){if("throw"===o)throw s;return{value:t,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var u=_(a,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var c=f(e,r,n);if("normal"===c.type){if(i=n.done?v:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=v,n.method="throw",n.arg=c.arg)}}}function _(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=f(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var s=o.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return b.prototype=w,i(x,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=c(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,c(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},D(O.prototype),c(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new O(h(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},D(x),c(x,u,"Generator"),c(x,s,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(B),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return a.type="throw",a.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),B(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;B(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function p(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(u())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&f(i,r.prototype),i}(t,arguments,a(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),f(r,t)},g(t)}var v=function(t){function e(t){var i;return n(this,e),(i=r(this,e,[t.error_description])).code=t.code,i.error=t.error,i.error_description=t.error_description,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(e,t),o(e)}(g(Error)),m=function(){return o((function t(){n(this,t)}),null,[{key:"accountIdentifier",value:function(t){return t?"string"==typeof t&&/^[a-zA-Z0-9]{32}$/i.test(t)||this.throwError("identificador_invalido","Identificador de conta [".concat(t,"] inválido")):this.throwError("identificador_invalido","Identificador de conta não informado ou inválido"),t}},{key:"environment",value:function(t){var e=["production","sandbox"];return t&&"string"==typeof t&&e.includes(t.toLowerCase())||this.throwError("ambiente_invalido",'Escolha um ambiente de integração válido: "'.concat(e.join('" ou "'),'"')),t.toLowerCase()}},{key:"runtimeEnvironment",value:function(){"undefined"==typeof document&&this.throwError("environment_error","Esta biblioteca não pode ser carregada em um ambiente sem DOM.")}},{key:"creditCard",value:function(t){var e=this;"object"===d(t)&&t||this.throwError("dados_cartao_invalido","O parâmetro em setCreditCardData deve ser um objeto");["brand","number","cvv","expirationMonth","expirationYear"].forEach((function(r){t.hasOwnProperty(r)||e.throwError("dados_cartao_invalido","O atributo [".concat(r,"] é obrigatório"))}));var r={brand:this.brand(t.brand),number:this.cardNumber(t.number),cvv:this.cardCvv(t.cvv),expiration_month:this.expirationMonth(t.expirationMonth),expiration_year:this.expirationYear(t.expirationYear,t.expirationMonth),reuse:this.reusable(t.reuse)},n=this.holderName(t.holderName);n&&(r.holder_name=n);var i=this.holderDocument(t.holderDocument);return i&&(r.holder_document=i),r}},{key:"brand",value:function(t){"string"!=typeof t&&this.throwError("bandeira_cartao_invalido","A bandeira do cartão deve ser fornecida como string");var e=["visa","mastercard","amex","elo","hipercard"],r=t.toLowerCase();return e.includes(r)||this.throwError("bandeira_invalida",'Escolha uma bandeira entre "'.concat(e.join('", "'),'"')),r}},{key:"brands",value:function(t){var e=t.replace(/\D/g,""),r="";return(/(60420[1-9]|6042[1-9][0-9]|6043[0-9]{2}|604400)/.test(e)||/^3(?:0[0-5]|[68][0-9])[0-9]{0,11}$/.test(e)||/^6(?:011|5[0-9]{2})[0-9]{12}/.test(e)||/^2(?:014|149)[0-9]{0,11}$/.test(e)||/^(?:2131|1800|35\d{3})\d{0,11}$/.test(e)||/^627892|^636414/.test(e)||/^606444|^606458|^606482/.test(e)||/^8699[0-9]{0,11}$/.test(e)||/^50[0-9]{0,17}$/.test(e))&&(r="unsupported"),r=/^4\d{0,12}(?:\d{3})?$/.test(e)?"visa":r,r=/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)\d{0,12}$/.test(e)?"mastercard":r,r=/^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|50(9[0-9][0-9][0-9])|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|05([7-9])|06([0-9])|07([0-9])|08([0-9])|4([0-3][0-9]|8[5-9]|9[0-9])|5([0-9][0-9]|3[0-8])|9([0-6][0-9]|7[0-8])|7([0-2][0-9])|541|700|720|727|901)|65165([2-9])|6516([6-7][0-9])|65500([0-9])|6550([0-5][0-9])|655021|65505([6-7])|6516([8-9][0-9])|65170([0-4]))/.test(e)?"elo":r,r=/^3[47][0-9]{0,13}$/.test(e)?"amex":r,(r=/^(606282\d{10}(\d{3})?)|(3841\d{0,15})$/.test(e)?"hipercard":r)||"undefined"}},{key:"total",value:function(t){return Number.isInteger(t)||this.throwError("valor_invalido","O valor total deve ser fornecido como número inteiro"),t<300&&this.throwError("valor_invalido","O valor [".concat(t,"] é inferior ao limite mínimo (R$3,00)")),t}},{key:"cardNumber",value:function(t){"string"!=typeof t&&this.throwError("numero_cartao_invalido","O número do cartão deve ser fornecido como string");var e=t.replace(/\s+/g,"");/^[0-9]+$/.test(e)||this.throwError("numero_cartao_invalido","O número do cartão deve conter somente números");return(e.length<13||e.length>19)&&this.throwError("numero_cartao_invalido","O número do cartão deve conter entre ".concat(13," e ").concat(19," dígitos")),e}},{key:"brandCardNumber",value:function(t){"string"!=typeof t&&this.throwError("numero_cartao_invalido","O número do cartão deve ser fornecido como string");var e=t.replace(/\s+/g,"");return/^[0-9]+$/.test(e)||this.throwError("numero_cartao_invalido","O número do cartão deve conter somente números"),e}},{key:"cardCvv",value:function(t){"string"!=typeof t&&this.throwError("cvv_cartao_invalido","O número CVV do cartão deve ser fornecido como string");var e=t.replace(/\D/g,"");return/^\d{3,4}$/.test(e)||this.throwError("cvv_cartao_invalido","Número CVV do cartão [".concat(t,"] inválido")),e}},{key:"expirationMonth",value:function(t){"string"!=typeof t&&this.throwError("validade_cartao_invalida","O mês de validade do cartão deve ser fornecido como string");var e=t.replace(/\D/g,""),r=parseInt(e,10);return(r<1||r>12||!/^\d{2}$/.test(e))&&this.throwError("validade_cartao_invalida","Mês de validade do cartão [".concat(t,"] inválido")),e}},{key:"expirationYear",value:function(t,e){"string"!=typeof t&&this.throwError("validade_cartao_invalida","O ano de validade do cartão deve ser fornecido como string");var r=(new Date).getFullYear(),n=(new Date).getMonth()+1,i=parseInt(t.replace(/\D/g,""),10);return(isNaN(i)||i<r||i>r+11)&&this.throwError("validade_cartao_invalida","Ano de validade do cartão [".concat(t,"] inválido")),i===r&&parseInt(e,10)<=n&&this.throwError("validade_cartao_invalida","Data de validade do cartão [".concat(e,"/").concat(t,"] expirada")),i.toString()}},{key:"holderName",value:function(t){return null==t?null:("string"!=typeof t&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve ser fornecido como string"),t.length<3&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve ter no mínimo 3 caracteres"),t.length>50&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve ter no máximo 50 caracteres"),t.trim().split(/\s+/).length<2&&this.throwError("nome_titular_cartao_invalido","O nome do titular do cartão deve conter pelo menos duas palavras"),t)}},{key:"holderDocument",value:function(t){if(null==t)return null;"string"!=typeof t&&this.throwError("documento_titular_cartao_invalido","O documento do titular do cartão deve ser fornecido como string");var e=t.replace(/\D/g,""),r=!1;if(11===e.length&&e.match(/^[0-9]{11}$/)&&!e.match(/^([0-9])\1{10}$/)){for(var n,i=0,o=1;o<=9;o+=1)i+=parseInt(e.substring(o-1,o),10)*(11-o);if(10!==(n=10*i%11)&&11!==n||(n=0),n===parseInt(e.substring(9,10),10)){i=0;for(var s=1;s<=10;s+=1)i+=parseInt(e.substring(s-1,s),10)*(12-s);10!==(n=10*i%11)&&11!==n||(n=0),n===parseInt(e.substring(10,11),10)&&(r=!0)}}if(e.length>11&&e.match(/^[0-9]{14}$/)&&!e.match(/^([0-9])\1{13}$/)){for(var a=[6,5,4,3,2,9,8,7,6,5,4,3,2],u=0,c=0,h=parseInt(e.substring(12,14),10),l=0;l<a.length;l+=1)u+=l>0?parseInt(e.charAt(l-1),10)*a[l]:0,c+=parseInt(e.charAt(l),10)*a[l];10*(u=u%11<2?0:11-u%11)+(c=c%11<2?0:11-c%11)===h&&(r=!0)}return r||this.throwError("documento_titular_cartao_invalido","O documento do titular do cartão fornecido é inválido"),e}},{key:"reusable",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"boolean"!=typeof t&&this.throwError("reuse_invalido","O parâmetro [reuse] deve ser um booleano"),t}},{key:"debugger",value:function(t){return"boolean"==typeof t||["true","false"].includes(t.toString())||(t=!1),t}},{key:"throwError",value:function(t,e){throw new v({error:t,error_description:e,code:arguments.length>2&&void 0!==arguments[2]?arguments[2]:400})}}])}(),y=function(){return o((function t(){n(this,t)}),null,[{key:"getBrand",value:(t=e(l().mark((function t(e){var r,n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=m.brandCardNumber(e),n=m.brands(r),t.abrupt("return",n);case 3:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})}]);var t}(),b=function(){return o((function t(){n(this,t)}),null,[{key:"getInstallments",value:(t=e(l().mark((function t(e,r,n,i){var o,s,a,u,c,h,f,p,d,g=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=g.length>4&&void 0!==g[4]&&g[4],s=this.constructUrl(e,r,n,i),a={method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}},t.next=5,fetch(s,a);case 5:return u=t.sent,t.next=8,u.json();case 8:if(c=t.sent,u.ok&&200===c.code){t.next=13;break}throw o&&console.error("RequestError_Installments",c),p=401===c.code?"Requisição não autorizada. Identificador de conta inválido.":this.formatErrorDescription(c.error_description),new v({code:null!==(h=c.code)&&void 0!==h?h:500,error:null!==(f=c.error)&&void 0!==f?f:"request_error",error_description:p});case 13:return d=c.data,t.abrupt("return",d);case 15:case"end":return t.stop()}}),t,this)}))),function(e,r,n,i){return t.apply(this,arguments)})},{key:"constructUrl",value:function(t,e,r,n){return"".concat("production"===n?"https://cobrancas.api.efipay.com.br/v1/installments":"https://cobrancas-h.api.efipay.com.br/v1/installments","/").concat(t,"/jsonp?brand=").concat(e,"&total=").concat(r)}},{key:"formatErrorDescription",value:function(t){return void 0===t?"Falha ao capturar parcelas no processo getInstallments":"object"===d(t)?"Propriedade: ".concat(t.property,". ").concat(t.message):t}}]);var t}(),w=function(){return o((function t(){n(this,t)}),null,[{key:"getSalt",value:(t=e(l().mark((function t(e){var r,n,i,o,s,a,u,c,h=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=h.length>1&&void 0!==h[1]&&h[1],!(n=this.getCachedSalt())){t.next=4;break}return t.abrupt("return",n);case 4:return t.prev=4,i=this.constructParams(e),t.next=9,fetch("https://tokenizer.sejaefi.com.br/salt",i);case 9:return o=t.sent,t.next=12,o.json();case 12:if(s=t.sent,o.ok&&200===s.code){t.next=16;break}throw r&&console.error("RequestError_Salt",s),new v({code:null!==(a=s.code)&&void 0!==a?a:500,error:null!==(u=s.error)&&void 0!==u?u:"request_error",error_description:void 0!==s.error_description?s.error_description:"Falha ao capturar o salt no processo getSalt"});case 16:return c=s.data,this.setSaltCookie(c),t.abrupt("return",c);case 21:if(t.prev=21,t.t0=t.catch(4),r&&console.error("RequestError_Salt",t.t0),!(t.t0 instanceof v)){t.next=26;break}throw t.t0;case 26:throw new v({code:503,error:"service_unavailable",error_description:"Falha de comunicação ao obter o salt. Verifique sua conexão."});case 27:case"end":return t.stop()}}),t,this,[[4,21]])}))),function(e){return t.apply(this,arguments)})},{key:"getCachedSalt",value:function(){var t=new RegExp("(?:(?:^|.*;\\s*)P_expireAt\\s*=\\s*([^;]*).*$)|^.*$"),e=document.cookie.replace(t,"$1");if((new Date).setSeconds(1)<e){var r=new RegExp("(?:(?:^|.*;\\s*)P_salt\\s*=\\s*([^;]*).*$)|^.*$");return decodeURIComponent(document.cookie.replace(r,"$1"))||null}return null}},{key:"constructParams",value:function(t){return{method:"GET",headers:{"Account-code":t,"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}}},{key:"setSaltCookie",value:function(t){var e=(new Date).setSeconds(55);document.cookie="".concat(encodeURIComponent("P_expireAt"),"=").concat(encodeURIComponent(e),"; max-age=60; expires=").concat(new Date(Date.now()+6e4).toUTCString(),"; path=/; SameSite=Strict; Secure"),document.cookie="".concat(encodeURIComponent("P_salt"),"=").concat(encodeURIComponent(t),"; max-age=60; expires=").concat(new Date(Date.now()+6e4).toUTCString(),"; path=/; SameSite=Strict; Secure")}}]);var t}(),E=function(){return o((function t(){n(this,t)}),null,[{key:"getPublicKey",value:(r=e(l().mark((function t(e,r){var n,i,o,s,a,u,c,h,f,p,d=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=d.length>2&&void 0!==d[2]&&d[2],o=(i="production"===r)?"P_":"H_",!(s=this.getCachedPublicKey(o))){t.next=6;break}return t.abrupt("return",s);case 6:return a=this.constructUrl(i),t.next=9,this.fetchPublicKey(a,e);case 9:return u=t.sent,t.next=12,u.json();case 12:if(c=t.sent,u.ok&&200===c.code){t.next=16;break}throw n&&console.error("RequestError_PublicKey",c),new v({code:null!==(h=c.code)&&void 0!==h?h:500,error:null!==(f=c.error)&&void 0!==f?f:"request_error",error_description:void 0!==c.error_description?c.error_description:"Falha ao capturar a chave pública no processo getPublicKey"});case 16:return p=c.data,this.setPublicKeyCookie(o,p),t.abrupt("return",p);case 19:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"getCachedPublicKey",value:function(t){var e=new RegExp("(?:(?:^|.*;\\s*)".concat(t,"publicKey\\s*=\\s*([^;]*).*$)|^.*$"));return decodeURIComponent(document.cookie.replace(e,"$1"))||null}},{key:"constructUrl",value:function(t){return t?"https://cobrancas.api.efipay.com.br/v1/pubkey":"https://cobrancas-h.api.efipay.com.br/v1/pubkey"}},{key:"fetchPublicKey",value:(t=e(l().mark((function t(e,r){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={method:"GET"},t.next=3,fetch("".concat(e,"?code=").concat(r),n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)}))),function(e,r){return t.apply(this,arguments)})},{key:"setPublicKeyCookie",value:function(t,e){document.cookie="".concat(encodeURIComponent("".concat(t,"publicKey")),"=").concat(encodeURIComponent(e),"; max-age=3600; path=/; SameSite=Strict; Secure; ")}}]);var t,r}(),S=function(){return o((function t(){n(this,t)}),null,[{key:"getPaymentToken",value:(t=e(l().mark((function t(e,r,n,i){var o,s,a,u,c,h,f,p,d,g,m,y=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=y.length>4&&void 0!==y[4]&&y[4],s=this.constructRequestParams(e,r,n,i),a=s.url,u=s.params,t.next=4,fetch(a,u);case 4:return c=t.sent,t.next=7,c.json();case 7:if(h=t.sent,c.ok&&200===h.code){t.next=12;break}throw o&&console.error("RequestError_SaveCardData:\n",h),g=3500008===h.code,new v({code:g?401:null!==(f=h.code)&&void 0!==f?f:500,error:null!==(p=h.error)&&void 0!==p?p:"request_error",error_description:g?"Requisição não autorizada. Identificador de conta inválido.":null!==(d=h.error_description)&&void 0!==d?d:"Falha ao capturar payment_token no processo getPaymentToken"});case 12:return m=h.data,t.abrupt("return",m);case 14:case"end":return t.stop()}}),t,this)}))),function(e,r,n,i){return t.apply(this,arguments)})},{key:"constructRequestParams",value:function(t,e,r,n){var i="production"===n;return{url:i?"https://tokenizer.sejaefi.com.br/card":"https://cobrancas-h.api.efipay.com.br/v1/card/".concat(t,"/jsonp?")+new URLSearchParams({data:r}),params:h({method:i?"POST":"GET",headers:h({"Content-Type":"application/json; charset=UTF-8","Session-token":e},i&&{"Account-code":t})},i&&{body:JSON.stringify({data:r})})}}}]);var t}(),T=function(){return o((function t(){n(this,t)}),null,[{key:"getSessionToken",value:(t=e(l().mark((function t(){var e,r,n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e="0123456789abcdef",r="",n=0;n<36;n++)[8,13,18,23].includes(n)?r+="-":r+=14===n?"4":19===n?e[4*Math.random()|8]:e[16*Math.random()|0];return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})}]);var t}(),x={version:"3.2.0"},D={cS:{key:"a2fc7cc16f"}},O=function(){return o((function t(){n(this,t)}),null,[{key:"getFingerPrint",value:(s=e(l().mark((function t(e){var r,n,i=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i.length>1&&void 0!==i[1]&&i[1],t.prev=1,n=D.cS.key,t.next=5,this.checkScriptBlocking(e,r);case 5:return t.next=7,this.loadClearSaleScript(n,e,r);case 7:return t.abrupt("return",e);case 10:throw t.prev=10,t.t0=t.catch(1),r&&console.log(t.t0),new v(t.t0);case 14:case"end":return t.stop()}}),t,this,[[1,10]])}))),function(t){return s.apply(this,arguments)})},{key:"checkScriptBlocking",value:(i=e(l().mark((function t(e,r){var n=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,i){var o=new XMLHttpRequest,s=D.cS.key,a="https://device.clearsale.com.br/p/fp.png?app=".concat(s);o.open("GET",a,!0),o.timeout=5e3,o.onload=function(){o.status>=200&&o.status<300?(r&&console.log("FingerPrint CS foi executado"),t()):(n.handleScriptBlocking(e,s),i({code:400,error:"erro_cs_script",error_description:"Script FingerPrint bloqueado ou erro inesperado na resposta."}))},o.onerror=function(){n.handleScriptBlocking(e,s),i({code:400,error:"erro_cs_script",error_description:"Falha ao conectar ao script FingerPrint. Verifique seu navegador ou extensão."})},o.ontimeout=function(){n.handleScriptBlocking(e,s),i({code:408,error:"timeout_cs_script",error_description:"Timeout ao conectar ao script FingerPrint."})},o.send(null)})));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return i.apply(this,arguments)})},{key:"handleScriptBlocking",value:(r=e(l().mark((function t(e,r,n){var i,o;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i="https://web.fpcs-monitor.com.br/p/fp.png?sid=".concat(e,"&app=").concat(r,"&bl=1");try{(o=new XMLHttpRequest).open("GET",i,!0),o.onload=function(){o.status>=200&&o.status<300?n&&console.error("Fallback executado com sucesso"):n&&console.error("Erro ao executar o fallback",o)},o.onerror=function(){n&&console.error("Falha na conexão ao executar o fallback")},o.send(null)}catch(t){n&&console.error("Erro inesperado ao executar o fallback",t)}case 2:case"end":return t.stop()}}),t)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"loadClearSaleScript",value:(t=e(l().mark((function t(e,r,n){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,i){window.CsdpObject="csdp",window.csdp=window.csdp||function(){(window.csdp.q=window.csdp.q||[]).push(arguments)},window.csdp.l=1*new Date;var o=document.createElement("script");o.async=!0,o.src="https://device.clearsale.com.br/p/fp.js",o.onload=function(){window.csdp("app",e),window.csdp("sessionid",r),t()},o.onerror=function(t){n&&console.error("Load_FingerPrint:",t),i({code:500,error:"erro_cs_script",error_description:"Falha ao carregar o script de fingerPrint. Verifique seu navegador ou extensão."})};var s=document.getElementsByTagName("script")[0];s&&s.parentNode?s.parentNode.insertBefore(o,s):i({code:400,error:"erro_cs_script",error_description:"Falha ao inserir o script de fingerPrint. Verifique seu navegador ou extensão."})})));case 1:case"end":return t.stop()}}),t)}))),function(e,r,n){return t.apply(this,arguments)})}]);var t,r,i,s}();function R(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _={exports:{}};!function(t){window,t.exports=function(){var t={155:function(t){var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,u=[],c=!1,h=-1;function l(){c&&a&&(c=!1,a.length?u=a.concat(u):h=-1,u.length&&f())}function f(){if(!c){var t=s(l);c=!0;for(var e=u.length;e;){for(a=u,u=[];++h<e;)a&&a[h].run();h=-1,e=u.length}a=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var n={};return function(){function t(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function e(t,e){return t&e}function i(t,e){return t|e}function o(t,e){return t^e}function s(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return!(65535&t)&&(t>>=16,e+=16),!(255&t)&&(t>>=8,e+=8),!(15&t)&&(t>>=4,e+=4),!(3&t)&&(t>>=2,e+=2),!(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}r.d(n,{default:function(){return st}});var c,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function l(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=h.charAt(r>>6)+h.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=h.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=h.charAt(r>>2)+h.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function f(e){var r,n="",i=0,o=0;for(r=0;r<e.length&&"="!=e.charAt(r);++r){var s=h.indexOf(e.charAt(r));s<0||(0==i?(n+=t(s>>2),o=3&s,i=1):1==i?(n+=t(o<<2|s>>4),o=15&s,i=2):2==i?(n+=t(o),n+=t(s>>2),o=3&s,i=3):(n+=t(o<<2|s>>4),n+=t(15&s),i=0))}return 1==i&&(n+=t(o<<2)),n}var p,d={decode:function(t){var e;if(void 0===p){var r="= \f\n\r\t \u2028\u2029";for(p=Object.create(null),e=0;e<64;++e)p["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(p["-"]=62,p._=63,e=0;e<r.length;++e)p[r.charAt(e)]=-1}var n=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=p[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=4?(n[n.length]=i>>16,n[n.length]=i>>8&255,n[n.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=i>>10;break;case 3:n[n.length]=i>>16,n[n.length]=i>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=d.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return d.decode(t)}},g=1e13,v=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var r,n,i=this.buf,o=i.length;for(r=0;r<o;++r)(n=i[r]*t+e)<g?e=0:n-=(e=0|n/g)*g,i[r]=n;e>0&&(i[r]=e)},t.prototype.sub=function(t){var e,r,n=this.buf,i=n.length;for(e=0;e<i;++e)(r=n[e]-t)<0?(r+=g,t=1):t=0,n[e]=r;for(;0===n[n.length-1];)n.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),n=e.length-2;n>=0;--n)r+=(g+e[n]).toString().substring(1);return r},t.prototype.valueOf=function(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*g+t[r];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),m=/^(\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)?)?$/,y=/^(\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 b(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}var w,E=function(){function t(e,r){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=r)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,r){for(var n="",i=t;i<e;++i)if(n+=this.hexByte(this.get(i)),!0!==r)switch(15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n},t.prototype.isASCII=function(t,e){for(var r=t;r<e;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var r="",n=t;n<e;++n)r+=String.fromCharCode(this.get(n));return r},t.prototype.parseStringUTF=function(t,e){for(var r="",n=t;n<e;){var i=this.get(n++);r+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(n++)):String.fromCharCode((15&i)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r},t.prototype.parseStringBMP=function(t,e){for(var r,n,i="",o=t;o<e;)r=this.get(o++),n=this.get(o++),i+=String.fromCharCode(r<<8|n);return i},t.prototype.parseTime=function(t,e,r){var n=this.parseStringISO(t,e),i=(r?m:y).exec(n);return i?(r&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n},t.prototype.parseInteger=function(t,e){for(var r,n=this.get(t),i=n>127,o=i?255:0,s="";n==o&&++t<e;)n=this.get(t);if(0==(r=e-t))return i?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^o));)s=+s<<1,--r;s="("+r+" bit)\n"}i&&(n-=256);for(var a=new v(n),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()},t.prototype.parseBitString=function(t,e,r){for(var n=this.get(t),i="("+((e-t-1<<3)-n)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?n:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>r)return i+b(o,r)}return i+o},t.prototype.parseOctetString=function(t,e,r){if(this.isASCII(t,e))return b(this.parseStringISO(t,e),r);var n=e-t,i="("+n+" byte)\n";n>(r/=2)&&(e=t+r);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return n>r&&(i+="…"),i},t.prototype.parseOID=function(t,e,r){for(var n="",i=new v,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===n)if((i=i.simplify())instanceof v)i.sub(80),n="2."+i.toString();else{var u=i<80?i<40?0:1:2;n=u+"."+(i-40*u)}else n+="."+i.toString();if(n.length>r)return b(n,r);i=new v,o=0}}return o>0&&(n+=".incomplete"),n},t}(),S=function(){function t(t,e,r,n,i){if(!(n instanceof T))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=n,this.sub=i}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return b(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return b(this.stream.parseStringISO(e,e+r),t);case 30:return b(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,n=this.sub.length;r<n;++r)e+=this.sub[r].toPrettyString(t)}return e},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var n=0;n<r;++n)e=256*e+t.get();return e},t.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)},t.decode=function(e){var r;r=e instanceof E?e:new E(e,0);var n=new E(r),i=new T(r),o=t.decodeLength(r),s=r.pos,a=s-n.pos,u=null,c=function(){var e=[];if(null!==o){for(var n=s+o;r.pos<n;)e[e.length]=t.decode(r);if(r.pos!=n)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=t.decode(r);if(i.tag.isEOC())break;e[e.length]=i}o=s-r.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return e};if(i.tagConstructed)u=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=r.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");u=c();for(var h=0;h<u.length;++h)if(u[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){u=null}if(null===u){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);r.pos=s+Math.abs(o)}return new t(n,a,o,i,u)},t}(),T=function(){function t(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=!!(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new v;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/x[x.length-1],O=function(){function r(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var r;if(16==e)r=4;else if(8==e)r=3;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return this.toRadix(e);r=2}var n,i=(1<<r)-1,o=!1,s="",a=this.t,u=this.DB-a*this.DB%r;if(a-- >0)for(u<this.DB&&(n=this[a]>>u)>0&&(o=!0,s=t(n));a>=0;)u<r?(n=(this[a]&(1<<u)-1)<<r-u,n|=this[--a]>>(u+=this.DB-r)):(n=this[a]>>(u-=r)&i,u<=0&&(u+=this.DB,--a)),n>0&&(o=!0),o&&(s+=t(n));return o?s:"0"},r.prototype.negate=function(){var t=P();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+M(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var e=P();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(r.ZERO)>0&&t.subTo(e,e),e},r.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new _(e):new k(e),this.exp(t,r)},r.prototype.clone=function(){var t=P();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),!!(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var r=P();return this.bitwiseTo(t,e,r),r},r.prototype.or=function(t){var e=P();return this.bitwiseTo(t,i,e),e},r.prototype.xor=function(t){var e=P();return this.bitwiseTo(t,o,e),e},r.prototype.andNot=function(t){var e=P();return this.bitwiseTo(t,s,e),e},r.prototype.not=function(){for(var t=P(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var e=P();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},r.prototype.shiftRight=function(t){var e=P();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+a(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=u(this[r]^e);return t},r.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,i)},r.prototype.clearBit=function(t){return this.changeBit(t,s)},r.prototype.flipBit=function(t){return this.changeBit(t,o)},r.prototype.add=function(t){var e=P();return this.addTo(t,e),e},r.prototype.subtract=function(t){var e=P();return this.subTo(t,e),e},r.prototype.multiply=function(t){var e=P();return this.multiplyTo(t,e),e},r.prototype.divide=function(t){var e=P();return this.divRemTo(t,e,null),e},r.prototype.remainder=function(t){var e=P();return this.divRemTo(t,null,e),e},r.prototype.divideAndRemainder=function(t){var e=P(),r=P();return this.divRemTo(t,e,r),[e,r]},r.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),o=L(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new _(e):e.isEven()?new B(e):new k(e);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var h=P();for(n.sqrTo(s[1],h);a<=c;)s[a]=P(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,f,p=t.t-1,d=!0,g=P();for(i=M(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(l|=t[p-1]>>this.DB+i-u)),a=r;!(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),d)s[l].copyTo(o),d=!1;else{for(;a>1;)n.sqrTo(o,g),n.sqrTo(g,o),a-=2;a>0?n.sqrTo(o,g):(f=o,o=g,g=f),n.mulTo(g,s[l],o)}for(;p>=0&&!(t[p]&1<<i);)n.sqrTo(o,g),f=o,o=g,g=f,--i<0&&(i=this.DB-1,--p)}return n.revert(o)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return r.ZERO;for(var n=t.clone(),i=this.clone(),o=L(1),s=L(0),a=L(0),u=L(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),e&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(n,i),e&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(r.ONE)?r.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},r.prototype.pow=function(t){return this.exp(t,new R)},r.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=x[x.length-1]){for(e=0;e<x.length;++e)if(r[0]==x[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<x.length;){for(var n=x[e],i=e+1;i<x.length&&n<D;)n*=x[i++];for(n=r.modInt(n);e<i;)if(n%x[e++]==0)return!1}return r.millerRabin(t)},r.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,e){var n;if(16==e)n=4;else if(8==e)n=3;else if(256==e)n=8;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return void this.fromRadix(t,e);n=2}this.t=0,this.s=0;for(var i=t.length,o=!1,s=0;--i>=0;){var a=8==n?255&+t[i]:C(t,i);a<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=n)>=this.DB&&(s-=this.DB))}8==n&&!!(128&+t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},r.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},r.prototype.lShiftTo=function(t,e){for(var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},r.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}},r.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},r.prototype.multiplyTo=function(t,e){var n=this.abs(),i=t.abs(),o=n.t;for(e.t=o+i.t;--o>=0;)e[o]=0;for(o=0;o<i.t;++o)e[o+n.t]=n.am(0,i[o],e,o,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},r.prototype.divRemTo=function(t,e,n){var i=t.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=P());var s=P(),a=this.s,u=t.s,c=this.DB-M(i[i.t-1]);c>0?(i.lShiftTo(c,s),o.lShiftTo(c,n)):(i.copyTo(s),o.copyTo(n));var h=s.t,l=s[h-1];if(0!=l){var f=l*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),p=this.FV/f,d=(1<<this.F1)/f,g=1<<this.F2,v=n.t,m=v-h,y=null==e?P():e;for(s.dlShiftTo(m,y),n.compareTo(y)>=0&&(n[n.t++]=1,n.subTo(y,n)),r.ONE.dlShiftTo(h,y),y.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--m>=0;){var b=n[--v]==l?this.DM:Math.floor(n[v]*p+(n[v-1]+g)*d);if((n[v]+=s.am(0,b,n,m,0,h))<b)for(s.dlShiftTo(m,y),n.subTo(y,n);n[v]<--b;)n.subTo(y,n)}null!=e&&(n.drShiftTo(h,e),a!=u&&r.ZERO.subTo(e,e)),n.t=h,n.clamp(),c>0&&n.rShiftTo(c,n),a<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(t,e){if(t>4294967295||t<1)return r.ONE;var n=P(),i=P(),o=e.convert(this),s=M(t)-1;for(o.copyTo(n);--s>=0;)if(e.sqrTo(n,i),(t&1<<s)>0)e.mulTo(i,o,n);else{var a=n;n=i,i=a}return e.revert(n)},r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=L(r),i=P(),o=P(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},r.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var n=this.chunkSize(e),i=Math.pow(e,n),o=!1,s=0,a=0,u=0;u<t.length;++u){var c=C(t,u);c<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(a=e*a+c,++s>=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,n){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),i,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var o=[],s=7&t;o.length=1+(t>>3),e.nextBytes(o),s>0?o[0]&=(1<<s)-1:o[0]=0,this.fromString(o,256)}},r.prototype.bitwiseTo=function(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},r.prototype.changeBit=function(t,e){var n=r.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},r.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},r.prototype.multiplyLowerTo=function(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()},r.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},r.prototype.millerRabin=function(t){var e=this.subtract(r.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var i=e.shiftRight(n);(t=t+1>>1)>x.length&&(t=x.length);for(var o=P(),s=0;s<t;++s){o.fromInt(x[Math.floor(Math.random()*x.length)]);var a=o.modPow(i,this);if(0!=a.compareTo(r.ONE)&&0!=a.compareTo(e)){for(var u=1;u++<n&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},r.prototype.square=function(){var t=P();return this.squareTo(t),t},r.prototype.gcda=function(t,e){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var o=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)e(r);else{o<s&&(s=o),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=function(){(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){e(n)}),0))};setTimeout(a,10)}},r.prototype.fromNumberAsync=function(t,e,n,o){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),i,this),this.isEven()&&this.dAddOffset(1,0);var s=this,a=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(r.ONE.shiftLeft(t-1),s),s.isProbablePrime(e)?setTimeout((function(){o()}),0):setTimeout(a,0)};setTimeout(a,0)}else{var u=[],c=7&t;u.length=1+(t>>3),e.nextBytes(u),c>0?u[0]&=(1<<c)-1:u[0]=0,this.fromString(u,256)}},r}(),R=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),_=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),k=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=P();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(O.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=P();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),B=function(){function t(t){this.m=t,this.r2=P(),this.q3=P(),O.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=P();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function P(){return new O(null)}function I(t,e){return new O(t,e)}var A="undefined"!=typeof navigator;A&&"Microsoft Internet Explorer"==navigator.appName?(O.prototype.am=function(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},w=30):A&&"Netscape"!=navigator.appName?(O.prototype.am=function(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},w=26):(O.prototype.am=function(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i},w=28),O.prototype.DB=w,O.prototype.DM=(1<<w)-1,O.prototype.DV=1<<w,O.prototype.FV=Math.pow(2,52),O.prototype.F1=52-w,O.prototype.F2=2*w-52;var V,N,j=[];for(V="0".charCodeAt(0),N=0;N<=9;++N)j[V++]=N;for(V="a".charCodeAt(0),N=10;N<36;++N)j[V++]=N;for(V="A".charCodeAt(0),N=10;N<36;++N)j[V++]=N;function C(t,e){var r=j[t.charCodeAt(e)];return null==r?-1:r}function L(t){var e=P();return e.fromInt(t),e}function M(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}O.ZERO=L(0),O.ONE=L(1);var q,F,H=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),U=null;if(null==U){U=[],F=0;var K=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var $=new Uint32Array(256);for(window.crypto.getRandomValues($),K=0;K<$.length;++K)U[F++]=255&$[K]}var G=0,z=function(t){if((G=G||0)>=256||F>=256)window.removeEventListener?window.removeEventListener("mousemove",z,!1):window.detachEvent&&window.detachEvent("onmousemove",z);else try{var e=t.x+t.y;U[F++]=255&e,G+=1}catch(t){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",z,!1):window.attachEvent&&window.attachEvent("onmousemove",z))}function Z(){if(null==q){for(q=new H;F<256;){var t=Math.floor(65536*Math.random());U[F++]=255&t}for(q.init(U),F=0;F<U.length;++F)U[F]=0;F=0}return q.next()}var Y=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=Z()},t}(),X=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=I(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,r=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new Y,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new O(r)}(t,e);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;for(var i=n.toString(16),o=i.length,s=0;s<2*e-o;s++)i="0"+i;return i},t.prototype.setPrivate=function(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=I(t,16),this.e=parseInt(e,16),this.d=I(r,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,r,n,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=I(t,16),this.e=parseInt(e,16),this.d=I(r,16),this.p=I(n,16),this.q=I(i,16),this.dmp1=I(o,16),this.dmq1=I(s,16),this.coeff=I(a,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var r=new Y,n=t>>1;this.e=parseInt(e,16);for(var i=new O(e,16);;){for(;this.p=new O(t-n,1,r),0!=this.p.subtract(O.ONE).gcd(i).compareTo(O.ONE)||!this.p.isProbablePrime(10););for(;this.q=new O(n,1,r),0!=this.q.subtract(O.ONE).gcd(i).compareTo(O.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(O.ONE),a=this.q.subtract(O.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(O.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=I(t,16),r=this.doPrivate(e);return null==r?null:function(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}(r,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,r){var n=new Y,i=t>>1;this.e=parseInt(e,16);var o=new O(e,16),s=this,a=function(){var e=function(){if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(O.ONE),n=s.q.subtract(O.ONE),i=e.multiply(n);0==i.gcd(o).compareTo(O.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=function(){s.q=P(),s.q.fromNumberAsync(i,1,n,(function(){s.q.subtract(O.ONE).gcda(o,(function(t){0==t.compareTo(O.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=function(){s.p=P(),s.p.fromNumberAsync(t-i,1,n,(function(){s.p.subtract(O.ONE).gcda(o,(function(t){0==t.compareTo(O.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},t.prototype.sign=function(t,e,r){var n=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var r=e-t.length-6,n="",i=0;i<r;i+=2)n+="ff";return I("0001"+n+"00"+t,16)}((J[r]||"")+e(t).toString(),this.n.bitLength()/4);if(null==n)return null;var i=this.doPrivate(n);if(null==i)return null;var o=i.toString(16);return 1&o.length?"0"+o:o},t.prototype.verify=function(t,e,r){var n=I(e,16),i=this.doPublic(n);return null==i?null:function(t){for(var e in J)if(J.hasOwnProperty(e)){var r=J[e],n=r.length;if(t.substr(0,n)==r)return t.substr(n)}return t}(i.toString(16).replace(/^1f+00/,""))==r(t).toString()},t}(),J={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"},Q={};Q.lang={extend:function(t,e,r){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),r){var i;for(i in r)t.prototype[i]=r[i];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(o=function(t,e){for(i=0;i<s.length;i+=1){var r=s[i],n=e[r];"function"==typeof n&&n!=Object.prototype[r]&&(t[r]=n)}})}catch(t){}o(t.prototype,r)}}};var W={};void 0!==W.asn1&&W.asn1||(W.asn1={}),W.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";e=new O(n,16).xor(t).add(O.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=W.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,s=e.DERNull,a=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,l=e.DERPrintableString,f=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,g=e.DERGeneralizedTime,v=e.DERSequence,m=e.DERSet,y=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var E=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":"))throw"undefined key: "+E;if("bool"==E)return new r(t[E]);if("int"==E)return new n(t[E]);if("bitstr"==E)return new i(t[E]);if("octstr"==E)return new o(t[E]);if("null"==E)return new s(t[E]);if("oid"==E)return new a(t[E]);if("enum"==E)return new u(t[E]);if("utf8str"==E)return new c(t[E]);if("numstr"==E)return new h(t[E]);if("prnstr"==E)return new l(t[E]);if("telstr"==E)return new f(t[E]);if("ia5str"==E)return new p(t[E]);if("utctime"==E)return new d(t[E]);if("gentime"==E)return new g(t[E]);if("seq"==E){for(var S=t[E],T=[],x=0;x<S.length;x++){var D=b(S[x]);T.push(D)}return new v({array:T})}if("set"==E){for(S=t[E],T=[],x=0;x<S.length;x++)D=b(S[x]),T.push(D);return new m({array:T})}if("tag"==E){var O=t[E];if("[object Array]"===Object.prototype.toString.call(O)&&3==O.length){var R=b(O[2]);return new y({tag:O[0],explicit:O[1],obj:R})}var _={};if(void 0!==O.explicit&&(_.explicit=O.explicit),void 0!==O.tag&&(_.tag=O.tag),void 0===O.obj)throw"obj shall be specified for 'tag'.";return _.obj=b(O.obj),new y(_)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},W.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);n+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new O(n,2).toString(10),n="")}return e},W.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new O(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(n=o+n,s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n},W.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n=0,v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},W.asn1.DERAbstractString=function(t){W.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Q.lang.extend(W.asn1.DERAbstractString,W.asn1.ASN1Object),W.asn1.DERAbstractTime=function(t){W.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},Q.lang.extend(W.asn1.DERAbstractTime,W.asn1.ASN1Object),W.asn1.DERAbstractStructured=function(t){W.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Q.lang.extend(W.asn1.DERAbstractStructured,W.asn1.ASN1Object),W.asn1.DERBoolean=function(){W.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Q.lang.extend(W.asn1.DERBoolean,W.asn1.ASN1Object),W.asn1.DERInteger=function(t){W.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=W.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new O(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Q.lang.extend(W.asn1.DERInteger,W.asn1.ASN1Object),W.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=W.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}W.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var r=0;r<=e;r++)t+="0";var n="";for(r=0;r<t.length-1;r+=8){var i=t.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+n},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Q.lang.extend(W.asn1.DERBitString,W.asn1.ASN1Object),W.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=W.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}W.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Q.lang.extend(W.asn1.DEROctetString,W.asn1.DERAbstractString),W.asn1.DERNull=function(){W.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Q.lang.extend(W.asn1.DERNull,W.asn1.ASN1Object),W.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new O(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(n=o+n,s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};W.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(t){var e=W.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},Q.lang.extend(W.asn1.DERObjectIdentifier,W.asn1.ASN1Object),W.asn1.DEREnumerated=function(t){W.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=W.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new O(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Q.lang.extend(W.asn1.DEREnumerated,W.asn1.ASN1Object),W.asn1.DERUTF8String=function(t){W.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Q.lang.extend(W.asn1.DERUTF8String,W.asn1.DERAbstractString),W.asn1.DERNumericString=function(t){W.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Q.lang.extend(W.asn1.DERNumericString,W.asn1.DERAbstractString),W.asn1.DERPrintableString=function(t){W.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Q.lang.extend(W.asn1.DERPrintableString,W.asn1.DERAbstractString),W.asn1.DERTeletexString=function(t){W.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Q.lang.extend(W.asn1.DERTeletexString,W.asn1.DERAbstractString),W.asn1.DERIA5String=function(t){W.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Q.lang.extend(W.asn1.DERIA5String,W.asn1.DERAbstractString),W.asn1.DERUTCTime=function(t){W.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},Q.lang.extend(W.asn1.DERUTCTime,W.asn1.DERAbstractTime),W.asn1.DERGeneralizedTime=function(t){W.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},Q.lang.extend(W.asn1.DERGeneralizedTime,W.asn1.DERAbstractTime),W.asn1.DERSequence=function(t){W.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},Q.lang.extend(W.asn1.DERSequence,W.asn1.DERAbstractStructured),W.asn1.DERSet=function(t){W.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Q.lang.extend(W.asn1.DERSet,W.asn1.DERAbstractStructured),W.asn1.DERTaggedObject=function(t){W.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,r){this.hT=e,this.isExplicit=t,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Q.lang.extend(W.asn1.DERTaggedObject,W.asn1.ASN1Object);var tt,et,rt=(tt=function(t,e){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},tt(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}tt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),nt=function(t){function e(r){var n=t.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(e.hasPrivateKeyProperty(r)||e.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}return rt(e,t),e.prototype.parseKey=function(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?function(t){var e;if(void 0===c){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(c={},e=0;e<16;++e)c[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)c[r.charAt(e)]=e;for(e=0;e<n.length;++e)c[n.charAt(e)]=-1}var i=[],o=0,s=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=c[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(i[i.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i}(t):d.unarmor(t),i=S.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=I(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=I(o,16);var s=i.sub[4].getHexStringValue();this.p=I(s,16);var a=i.sub[5].getHexStringValue();this.q=I(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=I(u,16);var h=i.sub[7].getHexStringValue();this.dmq1=I(h,16);var l=i.sub[8].getHexStringValue();this.coeff=I(l,16)}else{if(2!==i.sub.length)return!1;if(i.sub[0].sub){var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=I(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else e=i.sub[0].getHexStringValue(),this.n=I(e,16),r=i.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new W.asn1.DERInteger({int:0}),new W.asn1.DERInteger({bigint:this.n}),new W.asn1.DERInteger({int:this.e}),new W.asn1.DERInteger({bigint:this.d}),new W.asn1.DERInteger({bigint:this.p}),new W.asn1.DERInteger({bigint:this.q}),new W.asn1.DERInteger({bigint:this.dmp1}),new W.asn1.DERInteger({bigint:this.dmq1}),new W.asn1.DERInteger({bigint:this.coeff})]};return new W.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new W.asn1.DERSequence({array:[new W.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new W.asn1.DERNull]}),e=new W.asn1.DERSequence({array:[new W.asn1.DERInteger({bigint:this.n}),new W.asn1.DERInteger({int:this.e})]}),r=new W.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new W.asn1.DERSequence({array:[t,r]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return l(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var r="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(r,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(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")},e.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)},e}(X),it=r(155),ot=void 0!==it?null===(et=it.env)||void 0===et?void 0:"3.3.1":void 0,st=function(){function t(t){void 0===t&&(t={}),t=t||{},this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new nt(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(f(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return l(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,r){try{return l(this.getKey().sign(t,e,r))}catch(t){return!1}},t.prototype.verify=function(t,e,r){try{return this.getKey().verify(t,f(e),r)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new nt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=ot,t}()}(),n.default}()}(_);var k=R(_.exports),B=function(){return o((function t(){n(this,t)}),null,[{key:"encryptCardData",value:(t=e(l().mark((function t(e,r,n){var i,o,s,a,u=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=u.length>3&&void 0!==u[3]&&u[3],o=u.length>4&&void 0!==u[4]&&u[4],s=u.length>5?u[5]:void 0,t.prev=3,this.validateParameters(e,r,n,s),"production"===s&&(e.salt=r),i&&console.info("creditCardData:\n",o?e:"success"),(a=this.encrypt(e,n))||this.throwError("encryption_failed","Falha ao criptografar os dados."),t.abrupt("return",a);case 12:throw t.prev=12,t.t0=t.catch(3),new v(t.t0);case 15:case"end":return t.stop()}}),t,this,[[3,12]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"validateParameters",value:function(t,e,r,n){t&&"object"===d(t)||this.throwError("invalid_credit_card_data","Dados do cartão de crédito são inválidos."),"production"!==n||e||this.throwError("missing_salt","Salt é obrigatório em produção."),r||this.throwError("missing_public_key","Chave pública é obrigatória.")}},{key:"encrypt",value:function(t,e){var r=JSON.stringify(t),n=new k;return n.setPublicKey(e),n.encrypt(r)}},{key:"throwError",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n={code:400,error:t,error_description:e};throw r&&debug&&console.error("originalError:",r),new v(n)}}]);var t}(),P=function(){return o((function t(){n(this,t)}),null,[{key:"debugger",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.debug=m.debugger(t),this.result=m.debugger(e),this.debug&&(console.info("Debugger:",!0),console.info("Lib version:",x.version)),this}},{key:"setAccount",value:function(t){try{return this.accountIdentifier=m.accountIdentifier(t),this}catch(t){this.throwError("Error_setAccount",t)}}},{key:"setEnvironment",value:function(t){try{return this.environment=m.environment(t),this.debug&&console.info("Environment:",this.environment),this}catch(t){this.throwError("Error_setEnvironment",t)}}},{key:"setCreditCardData",value:function(t){try{return this.creditCard=m.creditCard(t),this}catch(t){this.throwError("Error_setCreditCardData",t)}}},{key:"setBrand",value:function(t){try{return this.brand=m.brand(t),this}catch(t){this.throwError("Error_setBrand",t)}}},{key:"setTotal",value:function(t){try{return this.total=m.total(t),this}catch(t){this.throwError("Error_setTotal",t)}}},{key:"setCardNumber",value:function(t){return this.cardNumber=t,this}},{key:"getPaymentToken",value:(u=e(l().mark((function t(){var e,r,n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m.runtimeEnvironment(),null===this.environment&&m.environment(this.environment),null===this.accountIdentifier&&m.accountIdentifier(this.accountIdentifier),t.prev=3,t.next=6,this.getSalt();case 6:return this.salt=t.sent,this.log("salt:\n",this.salt),t.next=10,E.getPublicKey(this.accountIdentifier,this.environment,this.debug);case 10:return this.publicKey=t.sent,this.log("publicKey:\n",this.publicKey),t.next=14,this.encryptCardData();case 14:return e=t.sent,this.log("cardDataEncripted:\n",e),t.next=18,T.getSessionToken();case 18:return r=t.sent,this.log("sessionToken:\n",r),t.next=22,O.getFingerPrint(r,this.debug);case 22:return t.next=24,S.getPaymentToken(this.accountIdentifier,r,e,this.environment,this.debug);case 24:return n=t.sent,this.log("paymentTokenData:\n",n),t.abrupt("return",n);case 29:t.prev=29,t.t0=t.catch(3),this.throwError("Error_getPaymentToken",t.t0);case 32:case"end":return t.stop()}}),t,this,[[3,29]])}))),function(){return u.apply(this,arguments)})},{key:"getInstallments",value:(a=e(l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===this.environment&&m.environment(this.environment),null===this.accountIdentifier&&m.accountIdentifier(this.accountIdentifier),t.prev=2,t.next=5,b.getInstallments(this.accountIdentifier,this.brand,this.total,this.environment,this.debug);case 5:return e=t.sent,this.log("installmentsData:\n",e),t.abrupt("return",e);case 10:t.prev=10,t.t0=t.catch(2),this.throwError("Error_getInstallments",t.t0);case 13:case"end":return t.stop()}}),t,this,[[2,10]])}))),function(){return a.apply(this,arguments)})},{key:"verifyCardBrand",value:(s=e(l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,y.getBrand(this.cardNumber);case 3:return e=t.sent,this.log("brand:",e),t.abrupt("return",e);case 8:t.prev=8,t.t0=t.catch(0),this.throwError("Error_verifyCardBrand",t.t0);case 11:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(){return s.apply(this,arguments)})},{key:"isScriptBlocked",value:(i=e(l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m.runtimeEnvironment(),t.prev=1,t.next=4,T.getSessionToken();case 4:return e=t.sent,t.next=7,O.checkScriptBlocking(e,this.debug);case 7:return t.abrupt("return",!1);case 10:return t.prev=10,t.t0=t.catch(1),t.abrupt("return",!0);case 13:case"end":return t.stop()}}),t,this,[[1,10]])}))),function(){return i.apply(this,arguments)})},{key:"getSalt",value:(r=e(l().mark((function t(){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("production"!==this.environment){t.next=4;break}return t.next=3,w.getSalt(this.accountIdentifier,this.debug);case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return","sandbox_salt");case 5:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"encryptCardData",value:(t=e(l().mark((function t(){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,B.encryptCardData(this.creditCard,this.salt,this.publicKey,this.debug,this.result,this.environment);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return t.apply(this,arguments)})},{key:"log",value:function(t,e){this.debug&&console.log(t,this.result?e:"success")}},{key:"throwError",value:function(t,e){throw this.debug&&console.error(t,e),new v(e)}}]);var t,r,i,s,a,u}();s(P,"accountIdentifier",null),s(P,"environment",null),s(P,"creditCard",null),s(P,"brand",null),s(P,"total",null),s(P,"cardNumber",null),s(P,"cardCvv",null),s(P,"expirationMonth",null),s(P,"expirationYear",null),s(P,"reusable",null),s(P,"debug",!1),s(P,"result",!1);
|
|
2
2
|
/* eslint-disable no-unused-expressions */
|
|
3
|
-
var I=["debugger","setAccount","accountIdentifier","setEnvironment","setCreditCardData","setBrand","setTotal","setCardNumber","getPaymentToken","getInstallments","verifyCardBrand"];return{CreditCard:new Proxy(
|
|
3
|
+
var I=["debugger","setAccount","accountIdentifier","setEnvironment","setCreditCardData","setBrand","setTotal","setCardNumber","getPaymentToken","getInstallments","verifyCardBrand","isScriptBlocked"];return{CreditCard:new Proxy(P,{get:function(t,e){if(I.includes(e)||void 0!==t[e])return t[e];throw new v({code:404,error:"request_error",error_description:"Método '".concat(String(e),"' solicitado inexistente.")})}})}}));
|