@bizzsv/bizz-payment 1.2.2 → 1.2.4-dev
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/README.md +11 -175
- package/README.npm.md +27 -0
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +3 -0
- package/dist/index.global.js +11 -11
- package/dist/index.js +266 -213
- package/package.json +1 -1
- package/dist/package.json +0 -71
package/dist/index.cjs
CHANGED
|
@@ -20,12 +20,12 @@ Private-Lines: `+f+`\r
|
|
|
20
20
|
`,l+=m;var b=o(`putty-private-key-file-mac-key`,t),x=n.util.createBuffer();a(x,s),a(x,c),a(x,r),x.putInt32(u.length()),x.putBuffer(u),x.putInt32(p.length()),x.putBuffer(p);var S=n.hmac.create();return S.start(`sha1`,b),S.update(x.bytes()),l+=`\r
|
|
21
21
|
Private-MAC: `+S.digest().toHex()+`\r
|
|
22
22
|
`,l},r.publicKeyToOpenSSH=function(e,t){var r=`ssh-rsa`;t||=``;var o=n.util.createBuffer();return a(o,r),i(o,e.e),i(o,e.n),r+` `+n.util.encode64(o.bytes())+` `+t},r.privateKeyToOpenSSH=function(e,t){return t?n.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:`aes128`}):n.pki.privateKeyToPem(e)},r.getPublicKeyFingerprint=function(e,t){t||={};var r=t.md||n.md.md5.create(),o=`ssh-rsa`,s=n.util.createBuffer();a(s,o),i(s,e.e),i(s,e.n),r.start(),r.update(s.getBytes());var c=r.digest();if(t.encoding===`hex`){var l=c.toHex();return t.delimiter?l.match(/.{2}/g).join(t.delimiter):l}else if(t.encoding===`binary`)return c.getBytes();else if(t.encoding)throw Error(`Unknown encoding "`+t.encoding+`".`);return c};function i(e,t){var r=t.toString(16);r[0]>=`8`&&(r=`00`+r);var i=n.util.hexToBytes(r);e.putInt32(i.length),e.putBytes(i)}function a(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}})),te=c(o(((e,t)=>{t.exports=d(),g(),U(),v(),m(),C(),K(),b(),q(),J(),Y(),I(),T(),S(),M(),B(),X(),V(),N(),D(),R(),O(),k(),Z(),H(),p()}))(),1),{entries:ne,setPrototypeOf:re,isFrozen:ie,getPrototypeOf:ae,getOwnPropertyDescriptor:oe}=Object,{freeze:se,seal:ce,create:le}=Object,{apply:ue,construct:de}=typeof Reflect<`u`&&Reflect;se||=function(e){return e},ce||=function(e){return e},ue||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},de||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var fe=Q(Array.prototype.forEach),pe=Q(Array.prototype.lastIndexOf),me=Q(Array.prototype.pop),he=Q(Array.prototype.push),ge=Q(Array.prototype.splice),_e=Q(String.prototype.toLowerCase),ve=Q(String.prototype.toString),ye=Q(String.prototype.match),be=Q(String.prototype.replace),xe=Q(String.prototype.indexOf),Se=Q(String.prototype.trim),Ce=Q(Object.prototype.hasOwnProperty),we=Q(RegExp.prototype.test),Te=Ee(TypeError);function Q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return ue(e,t,r)}}function Ee(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return de(e,n)}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_e;re&&re(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ie(t)||(t[r]=e),i=e)}e[i]=!0}return e}function De(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Oe(e){let t=le(null);for(let[n,r]of ne(e))Ce(e,n)&&(Array.isArray(r)?t[n]=De(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=Oe(r):t[n]=r);return t}function ke(e,t){for(;e!==null;){let n=oe(e,t);if(n){if(n.get)return Q(n.get);if(typeof n.value==`function`)return Q(n.value)}e=ae(e)}function n(){return null}return n}var Ae=se(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),je=se(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Me=se([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ne=se([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Pe=se(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Fe=se([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ie=se([`#text`]),Le=se(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),Re=se(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),ze=se(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Be=se([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ve=ce(/\{\{[\w\W]*|[\w\W]*\}\}/gm),He=ce(/<%[\w\W]*|[\w\W]*%>/gm),Ue=ce(/\$\{[\w\W]*/gm),We=ce(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ge=ce(/^aria-[\-\w]+$/),Ke=ce(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qe=ce(/^(?:\w+script|data):/i),Je=ce(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ye=ce(/^html$/i),Xe=ce(/^[a-z][.\w]*(-[.\w]+)+$/i),Ze=Object.freeze({__proto__:null,ARIA_ATTR:Ge,ATTR_WHITESPACE:Je,CUSTOM_ELEMENT:Xe,DATA_ATTR:We,DOCTYPE_NAME:Ye,ERB_EXPR:He,IS_ALLOWED_URI:Ke,IS_SCRIPT_OR_DATA:qe,MUSTACHE_EXPR:Ve,TMPLIT_EXPR:Ue}),Qe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$e=function(){return typeof window>`u`?null:window},et=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},tt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$e(),t=e=>nt(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Qe.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=ke(m,`cloneNode`),g=ke(m,`remove`),_=ke(m,`nextSibling`),v=ke(m,`childNodes`),y=ke(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=tt();t.isSupported=typeof ne==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:A,DATA_ATTR:j,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:ee}=Ze,{IS_ALLOWED_URI:F}=Ze,I=null,L=$({},[...Ae,...je,...Me,...Pe,...Ie]),R=null,z=$({},[...Le,...Re,...ze,...Be]),B=Object.seal(le(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,H=null,U=Object.seal(le(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),W=!0,G=!0,K=!1,q=!0,J=!1,Y=!0,X=!1,Z=!1,te=!1,re=!1,ie=!1,ae=!1,oe=!0,ce=!1,ue=!0,de=!1,Q={},Ee=null,De=$({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Ve=null,He=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ue=null,We=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ge=`http://www.w3.org/1998/Math/MathML`,qe=`http://www.w3.org/2000/svg`,Je=`http://www.w3.org/1999/xhtml`,Xe=Je,rt=!1,it=null,at=$({},[Ge,qe,Je],ve),ot=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),st=$({},[`annotation-xml`]),ct=$({},[`title`,`style`,`font`,`a`,`script`]),lt=null,ut=[`application/xhtml+xml`,`text/html`],dt=null,ft=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ft&&ft===e)){if((!e||typeof e!=`object`)&&(e={}),e=Oe(e),lt=ut.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,dt=lt===`application/xhtml+xml`?ve:_e,I=Ce(e,`ALLOWED_TAGS`)?$({},e.ALLOWED_TAGS,dt):L,R=Ce(e,`ALLOWED_ATTR`)?$({},e.ALLOWED_ATTR,dt):z,it=Ce(e,`ALLOWED_NAMESPACES`)?$({},e.ALLOWED_NAMESPACES,ve):at,Ue=Ce(e,`ADD_URI_SAFE_ATTR`)?$(Oe(We),e.ADD_URI_SAFE_ATTR,dt):We,Ve=Ce(e,`ADD_DATA_URI_TAGS`)?$(Oe(He),e.ADD_DATA_URI_TAGS,dt):He,Ee=Ce(e,`FORBID_CONTENTS`)?$({},e.FORBID_CONTENTS,dt):De,V=Ce(e,`FORBID_TAGS`)?$({},e.FORBID_TAGS,dt):Oe({}),H=Ce(e,`FORBID_ATTR`)?$({},e.FORBID_ATTR,dt):Oe({}),Q=Ce(e,`USE_PROFILES`)?e.USE_PROFILES:!1,W=e.ALLOW_ARIA_ATTR!==!1,G=e.ALLOW_DATA_ATTR!==!1,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=e.SAFE_FOR_TEMPLATES||!1,Y=e.SAFE_FOR_XML!==!1,X=e.WHOLE_DOCUMENT||!1,re=e.RETURN_DOM||!1,ie=e.RETURN_DOM_FRAGMENT||!1,ae=e.RETURN_TRUSTED_TYPE||!1,te=e.FORCE_BODY||!1,oe=e.SANITIZE_DOM!==!1,ce=e.SANITIZE_NAMED_PROPS||!1,ue=e.KEEP_CONTENT!==!1,de=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||Ke,Xe=e.NAMESPACE||Je,ot=e.MATHML_TEXT_INTEGRATION_POINTS||ot,st=e.HTML_INTEGRATION_POINTS||st,B=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(G=!1),ie&&(re=!0),Q&&(I=$({},Ie),R=le(null),Q.html===!0&&($(I,Ae),$(R,Le)),Q.svg===!0&&($(I,je),$(R,Re),$(R,Be)),Q.svgFilters===!0&&($(I,Me),$(R,Re),$(R,Be)),Q.mathMl===!0&&($(I,Pe),$(R,ze),$(R,Be))),Ce(e,`ADD_TAGS`)||(U.tagCheck=null),Ce(e,`ADD_ATTR`)||(U.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?U.tagCheck=e.ADD_TAGS:(I===L&&(I=Oe(I)),$(I,e.ADD_TAGS,dt))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?U.attributeCheck=e.ADD_ATTR:(R===z&&(R=Oe(R)),$(R,e.ADD_ATTR,dt))),e.ADD_URI_SAFE_ATTR&&$(Ue,e.ADD_URI_SAFE_ATTR,dt),e.FORBID_CONTENTS&&(Ee===De&&(Ee=Oe(Ee)),$(Ee,e.FORBID_CONTENTS,dt)),e.ADD_FORBID_CONTENTS&&(Ee===De&&(Ee=Oe(Ee)),$(Ee,e.ADD_FORBID_CONTENTS,dt)),ue&&(I[`#text`]=!0),X&&$(I,[`html`,`head`,`body`]),I.table&&($(I,[`tbody`]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=et(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));se&&se(e),ft=e}},gt=$({},[...je,...Me,...Ne]),_t=$({},[...Pe,...Fe]),vt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Xe,tagName:`template`});let n=_e(e.tagName),r=_e(t.tagName);return it[e.namespaceURI]?e.namespaceURI===qe?t.namespaceURI===Je?n===`svg`:t.namespaceURI===Ge?n===`svg`&&(r===`annotation-xml`||ot[r]):!!gt[n]:e.namespaceURI===Ge?t.namespaceURI===Je?n===`math`:t.namespaceURI===qe?n===`math`&&st[r]:!!_t[n]:e.namespaceURI===Je?t.namespaceURI===qe&&!st[r]||t.namespaceURI===Ge&&!ot[r]?!1:!_t[n]&&(ct[n]||!gt[n]):!!(lt===`application/xhtml+xml`&&it[e.namespaceURI]):!1},yt=function(e){he(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},bt=function(e,n){try{he(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{he(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(re||ie)try{yt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},xt=function(e){let t=null,r=null;if(te)e=`<remove></remove>`+e;else{let t=ye(e,/^[\r\n\t ]+/);r=t&&t[0]}lt===`application/xhtml+xml`&&Xe===Je&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Xe===Je)try{t=new f().parseFromString(i,lt)}catch{}if(!t||!t.documentElement){t=S.createDocument(Xe,`template`,null);try{t.documentElement.innerHTML=rt?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Xe===Je?T.call(t,X?`html`:`body`)[0]:X?t.documentElement:a},St=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Ct=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},wt=function(e){return typeof s==`function`&&e instanceof s};function Tt(e,n,r){fe(e,e=>{e.call(t,n,r,ft)})}let Et=function(e){let n=null;if(Tt(D.beforeSanitizeElements,e,null),Ct(e))return yt(e),!0;let r=dt(e.nodeName);if(Tt(D.uponSanitizeElement,e,{tagName:r,allowedTags:I}),Y&&e.hasChildNodes()&&!wt(e.firstElementChild)&&we(/<[/\w!]/g,e.innerHTML)&&we(/<[/\w!]/g,e.textContent)||e.nodeType===Qe.progressingInstruction||Y&&e.nodeType===Qe.comment&&we(/<[/\w]/g,e.data))return yt(e),!0;if(!(U.tagCheck instanceof Function&&U.tagCheck(r))&&(!I[r]||V[r])){if(!V[r]&&Ot(r)&&(B.tagNameCheck instanceof RegExp&&we(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r)))return!1;if(ue&&!Ee[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,_(e))}}}return yt(e),!0}return e instanceof c&&!vt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&we(/<\/no(script|embed|frames)/i,e.innerHTML)?(yt(e),!0):(J&&e.nodeType===Qe.text&&(n=e.textContent,fe([O,k,A],e=>{n=be(n,e,` `)}),e.textContent!==n&&(he(t.removed,{element:e.cloneNode()}),e.textContent=n)),Tt(D.afterSanitizeElements,e,null),!1)},Dt=function(e,t,r){if(H[t]||oe&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;if(!(G&&!H[t]&&we(j,t))&&!(W&&we(M,t))&&!(U.attributeCheck instanceof Function&&U.attributeCheck(t,e))){if(!R[t]||H[t]){if(!(Ot(e)&&(B.tagNameCheck instanceof RegExp&&we(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&we(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&we(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!Ue[t]&&!we(F,be(r,P,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&xe(r,`data:`)===0&&Ve[e])&&!(K&&!we(N,be(r,P,``)))&&r)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&ye(e,ee)},kt=function(e){Tt(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||Ct(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=dt(a),l=s,u=a===`value`?l:Se(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Tt(D.uponSanitizeAttribute,e,r),u=r.attrValue,ce&&(c===`id`||c===`name`)&&(bt(a,e),u=`user-content-`+u),Y&&we(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){bt(a,e);continue}if(c===`attributename`&&ye(u,`href`)){bt(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){bt(a,e);continue}if(!q&&we(/\/>/i,u)){bt(a,e);continue}J&&fe([O,k,A],e=>{u=be(u,e,` `)});let d=dt(e.nodeName);if(!Dt(d,c,u)){bt(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),Ct(e)?yt(e):me(t.removed)}catch{bt(a,e)}}Tt(D.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=St(t);for(Tt(D.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Tt(D.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof a&&e(n.content);Tt(D.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(rt=!e,rt&&(e=`<!-->`),typeof e!=`string`&&!wt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Te(`dirty is not a string, aborting`)}else throw Te(`toString is not a function`);if(!t.isSupported)return e;if(Z||ht(n),t.removed=[],typeof e==`string`&&(de=!1),de){if(e.nodeName){let t=dt(e.nodeName);if(!I[t]||V[t])throw Te(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=xt(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Qe.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!re&&!J&&!X&&e.indexOf(`<`)===-1)return b&&ae?b.createHTML(e):e;if(i=xt(e),!i)return re?null:ae?x:``}i&&te&&yt(i.firstChild);let u=St(de?e:i);for(;c=u.nextNode();)Et(c),kt(c),c.content instanceof a&&At(c.content);if(de)return e;if(re){if(ie)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(R.shadowroot||R.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=X?i.outerHTML:i.innerHTML;return X&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&we(Ye,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
23
|
-
`+d),J&&fe([O,k,A],e=>{d=be(d,e,` `)}),b&&ae?b.createHTML(d):d},t.setConfig=function(){ht(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Z=!0},t.clearConfig=function(){ft=null,Z=!1},t.isValidAttribute=function(e,t,n){return ft||ht({}),Dt(dt(e),dt(t),n)},t.addHook=function(e,t){typeof t==`function`&&he(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=pe(D[e],t);return n===-1?void 0:ge(D[e],n,1)[0]}return me(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=tt()},t}var rt=nt(),it=class e{static instance;baseUrl=``;bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:rt.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},at=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``),ot=async e=>{let t=new TextEncoder().encode(e);return at(await crypto.subtle.digest(`SHA-256`,t))},st=void 0,ct=void 0,lt=class e{static instance;authenticateAuthorize=`oauth/application/authorize`;authenticateToken=`oauth/application/token`;request=it.getInstance();pkceReady;authToken=null;constructor(){this.pkceReady=this.generatePkce()}static getInstance(){return e.instance||=new e,e.instance}getAuthToken(){return this.authToken}async generatePkce(){let e=te.util.bytesToHex(te.random.getBytesSync(32));return{verifier:e,challenge:await ot(e)}}async authorize(e){let t={client_id:st,redirect_uri:ct,response_type:`code`,code_challenge:e,code_challenge_method:`S256`};return(await this.request.post(this.authenticateAuthorize,t)).json()}async token(e,t){let n={client_id:st,code:e,code_verifier:t,redirect_uri:ct,grant_type:`authorization_code`};return(await this.request.post(this.authenticateToken,n)).json()}async authenticateAndAuthorize(){let{verifier:e,challenge:t}=await this.pkceReady;try{let n=await this.authorize(t);this.authToken=await this.token(n.redirect_uri.code,e)}catch(e){throw console.error(`Error authenticating or authorizing:`,e),e}}},ut=class e{request=it.getInstance();static instance;urlConfig=`external/online_payments/orders/configuration`;config=null;constructor(e,t){this.urlConfig=this.setURLcode(e,t)}static getInstance(t,n){return!e.instance&&t&&(e.instance=new e(t,n)),e.instance}getConfig(){return this.config}setURLcode=(e,t)=>t?`${this.urlConfig}?code=${t}&scope=order_template`:`${this.urlConfig}?code=${e}&scope=branch`;async configRequest(){let e=await this.request.get(this.urlConfig),t=await e.json();return e.ok&&(this.config=t),t}},dt=class e{request=it.getInstance();static instance;countries=[];countriesLoadError=null;urlCountries=`resources/countries`;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCountries(){return this.countries}setCountries(e){this.countries=e}getCountriesLoadError(){return this.countriesLoadError}async fetchCountries(){let e=await this.request.get(this.urlCountries),t=await e.json();return e.ok?(this.countriesLoadError=null,this.setCountries(t.data),t):(this.countriesLoadError=`No se pudo cargar la lista de países.`,t)}},ft={400:`Error al cargar orden de pago: solicitud inválida`,401:`Error al cargar orden de pago: autenticación requerida`,403:`Error al cargar orden de pago: autorización denegada`,404:`Error al cargar orden de pago: recurso no encontrado`,500:`Error al cargar orden de pago: falla interna del servicio`,502:`Error al cargar orden de pago: respuesta inválida del servicio upstream`,503:`Error al cargar orden de pago: servicio no disponible`};function pt(e,t){return ft[e]||`Error al obtener información de sucursal: ${t}`}var mt=class e{static instance;initPromise=null;auth=lt.getInstance();request=it.getInstance();branchConfig;countryContent=dt.getInstance();authToken=null;config=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async initialize(e,t){return this.initPromise||=this.boot(e,t),this.initPromise}async boot(e,t){await this.auth.authenticateAndAuthorize(),this.authToken=this.auth.getAuthToken(),this.request.setBearerToken(this.authToken?.access_token??``),this.branchConfig=ut.getInstance(e,t);let n=await this.branchConfig.configRequest();if(`error`in n)throw Error(pt(n.status,e));this.config=this.branchConfig.getConfig(),await this.countryContent.fetchCountries()}getAuthToken(){if(!this.authToken)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.authToken}getConfig(){if(!this.config)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.config}},ht=class e{request=it.getInstance();static instance;cardinalToken=null;urlCardinalToken=`external/online_payments/orders/token`;orchestrator=mt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCardinalToken(){return this.cardinalToken}setCardinalToken(e){this.cardinalToken=e}generateCardinalTokenPayload(e){return{branch_id:this.orchestrator.getConfig().data.branch_id,subtotal_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),subtotal_currency:`USD`,tip_cents:0,tip_currency:`USD`,description:e.description}}async fetchCardinalToken(e){let t=await this.request.post(this.urlCardinalToken,{data:e}),n=await t.json();return t.ok,n}},gt=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await it.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},_t=e=>{let t=e[0];return Number(t)===4?`visa`:Number(t)===2||Number(t)===5?`mastercard`:Number(t)===6?`union_pay`:`not_valid`},vt=e=>{let[t,n]=e.split(`/`);return{month:t,year:n}},yt=e=>e.replace(/\s/g,``),bt=class e{static instance;songbirdUrl=``;loaded=!1;initialized=!1;constructor(){}static getInstance(){return e.instance||=new e,e.instance}loadSongbird(){return this.loaded?Promise.resolve():new Promise((e,t)=>{let n=document.createElement(`script`);n.src=this.songbirdUrl,n.onload=()=>{this.loaded=!0,e()},n.onerror=()=>t(Error(`Failed to load Songbird script`)),document.head.appendChild(n)})}getBrowserData(){return{browser_java_enabled:!1,browser_language:navigator.language,browser_color_depth:screen.colorDepth,browser_screen_height:screen.height,browser_screen_width:screen.width,browser_time_zone:Intl.DateTimeFormat().resolvedOptions().timeZone||`America/El_Salvador`,user_agent:navigator.userAgent,device_channel:`Browser`,browser_javascript_enabled:!0}}async setupCardinal(e){return await this.loadSongbird(),this.cleanup(),new Promise((t,n)=>{try{Cardinal.configure({timeout:6e3,maxRequestRetries:3,logging:{level:`on`}}),Cardinal.on(`payments.setupComplete`,n=>{Cardinal.off(`payments.setupComplete`),this.submitCollectionForm(e),t(n.sessionId)}),Cardinal.setup(`init`,{jwt:e}),this.initialized=!0}catch(e){n(e)}})}cleanup(){let e=document.querySelector(`iframe[name="cardinalIframe"]`);e&&e.remove();let t=document.getElementById(`collectionForm`);t&&t.remove()}submitCollectionForm(e){this.cleanup();let t=document.createElement(`iframe`);t.name=`cardinalIframe`,t.height=`10`,t.width=`10`,t.style.cssText=`visibility:hidden;position:absolute;top:-1000px;left:-1000px;`,document.body.appendChild(t);let n=document.createElement(`form`);n.id=`collectionForm`,n.name=`devicedata`,n.method=`POST`,n.action=`https://centinelapistag.cardinalcommerce.com/V2/Cruise/Collect`,n.target=`cardinalIframe`;let r=document.createElement(`input`);r.type=`hidden`,r.name=`JWT`,r.value=e,n.appendChild(r),document.body.appendChild(n),n.submit()}onCardinalValidated(){return new Promise(e=>{Cardinal.on(`payments.validated`,t=>{Cardinal.off(`payments.validated`),e(t)})})}continueCardinal(e,t,n){Cardinal.continue(`cca`,{AcsUrl:e.acs_url,Payload:e.payload},{OrderDetails:{TransactionId:e.transaction_id,OrderNumber:e.order_number_client,Amount:t,CurrencyCode:e.currency_code,OrderDescription:n,OrderChannel:e.transaction_mode}})}},xt=class e{static instance;request=it.getInstance();cardinalService=bt.getInstance();registerPaymentResponse=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async registerPayment(e,t){let n={data:{...t,...this.cardinalService.getBrowserData()}},r=await this.request.post(`external/online_payments/orders/${e}/register_payment`,n,{},`api/v2`),i=await r.json();return r.ok&&(this.registerPaymentResponse=i.data),i}async validatePayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/validate_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}async confirmPayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/confirm_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}buildValidatePayloadFromCardinal(e){let t=this.registerPaymentResponse;return{validated:e.Validated,action_code:e.ActionCode,error_number:e.ErrorNumber,error_description:e.ErrorDescription,payment_type:e.Payment.Type,processor_transaction_id:e.Payment.ProcessorTransactionId,cavv:e.Payment.ExtendedData.CAVV,currency_code:e.Payment.ExtendedData.CurrencyCode,eci_flag:e.Payment.ExtendedData.ECIFlag,three_ds_version:e.Payment.ExtendedData.ThreeDSVersion,pares_status:e.Payment.ExtendedData.PAResStatus,signature_verification:e.Payment.ExtendedData.SignatureVerification,cavv_algorithm:t?.cavv_algorithm||void 0,enrolled:t?.enrolled||void 0,ds_transaction_id:t?.ds_transaction_id||void 0}}},St=class{request=it.getInstance();urlEncrypt=`resources/encryption/public_key`;token=null;async getTokenFromServer(){let e=await this.request.get(this.urlEncrypt,{},`api/v2`);if(!e.ok)throw Error(`Failed to get encryption token`);this.token=(await e.json()).data}getToken(){return this.token}encryptData(e){if(!this.token)throw Error(`Encryption token not found`);let t=JSON.stringify({...e,nonce:crypto.randomUUID(),timestamp:Math.floor(Date.now()/1e3)}),n=te.default.random.getBytesSync(32),r=te.default.random.getBytesSync(12),i=te.default.cipher.createCipher(`AES-GCM`,n);i.start({iv:r,additionalData:``,tagLength:128}),i.update(te.default.util.createBuffer(t,`utf8`)),i.finish();let a=te.default.pki.publicKeyFromPem(this.token.public_key).encrypt(n,`RSA-OAEP`);return{encrypted_data:te.default.util.encode64(i.output.getBytes()),encrypted_key:te.default.util.encode64(a),iv:te.default.util.encode64(r),tag:te.default.util.encode64(i.mode.tag.getBytes())}}},Ct=class e{static instance;cardinalToken=ht.getInstance();cardinalService=bt.getInstance();cardinalPayment=xt.getInstance();countryContent=dt.getInstance();stateContent=gt.getInstance();orchestrator=mt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}async process(e,t,n){let r=this.cardinalToken.generateCardinalTokenPayload(e);t&&(r.subtotal_cents=t);let i=await this.cardinalToken.fetchCardinalToken(r);if(`error`in i){n.sendAlert(`Error`,i.error||`Error al procesar el pago`);return}let{id:a,token:o}=i.data,s=await this.cardinalService.setupCardinal(o),c=this.countryContent.getCountries().find(t=>t.id===e.country),l=this.stateContent.getStates().find(t=>t.id===e.region),u=vt(e.cardExpiry),d=new St;try{await d.getTokenFromServer()}catch(e){throw Error(`Failed to get encryption token: `+e)}let f=d.encryptData({card_number:yt(e.cardNumber),card_expiration_month:u.month,card_expiration_year:`20${u.year}`,cvv:e.cardCvc,expiration_date:`${u.year}${u.month}`,cardholder_name:e.cardHolder}),p={reference:s,billing_address:e.address,billing_city:e.city,billing_country_code:String(c?.number||``),billing_first_name:e.firstName,billing_last_name:e.lastName,billing_postal_code:e.postalCode,billing_state_code:l?.short_code||``,billing_country_name:c?.name||``,email:e.email,phone_number:e.phone.replace(/\s/g,``),...f},m=await this.cardinalPayment.registerPayment(a,p);if(`error`in m){n.sendAlert(`Error`,m.error||`Error al procesar el pago`);return}let h=m.data;if(h.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
23
|
+
`+d),J&&fe([O,k,A],e=>{d=be(d,e,` `)}),b&&ae?b.createHTML(d):d},t.setConfig=function(){ht(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Z=!0},t.clearConfig=function(){ft=null,Z=!1},t.isValidAttribute=function(e,t,n){return ft||ht({}),Dt(dt(e),dt(t),n)},t.addHook=function(e,t){typeof t==`function`&&he(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=pe(D[e],t);return n===-1?void 0:ge(D[e],n,1)[0]}return me(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=tt()},t}var rt=nt(),it=`https://devapi.teip.io`,at=`R33xmWassTrJO5I52s6FZ_3sdQRdiOR7Vc0oDSuf7No`,ot=`urn:ietf:wg:oauth:2.0:oob`,st=`https://cas.static.client.cardinaltrusted.com/songbird/v2.0.0/songbird.js`,ct=void 0,lt=void 0,ut=void 0,dt=void 0,ft=void 0,pt=void 0,mt=void 0,ht=void 0,gt=class e{static instance;environment=`development`;constructor(){}static getInstance(){return e.instance||=new e,e.instance}isDevelopmentEnvironment(){return ot}getEnvironment(){return this.isDevelopmentEnvironment()?`development`:this.environment}getDevelopmentEnvironment(){return{apiBase:it,externalApiUid:at,songbirdUrl:st,externalApiRedirectUri:ot}}getProductionEnvironment(){return{apiBase:ct,songbirdUrl:dt,externalApiUid:lt,externalApiRedirectUri:ut}}getSandboxEnvironment(){return{apiBase:ft,songbirdUrl:ht,externalApiUid:pt,externalApiRedirectUri:mt}}setEnvironment(e){this.environment=e}getCurrentEnvironment(){switch(this.getEnvironment()){case`production`:return this.getProductionEnvironment();case`sandbox`:return this.getSandboxEnvironment();default:return this.getDevelopmentEnvironment()}}},_t=class e{static instance;get baseUrl(){return gt.getInstance().getCurrentEnvironment().apiBase||``}bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:rt.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},vt=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``),yt=async e=>{let t=new TextEncoder().encode(e);return vt(await crypto.subtle.digest(`SHA-256`,t))},bt=class e{static instance;authenticateAuthorize=`oauth/application/authorize`;authenticateToken=`oauth/application/token`;request=_t.getInstance();pkceReady;authToken=null;environment=gt.getInstance();constructor(){this.pkceReady=this.generatePkce()}static getInstance(){return e.instance||=new e,e.instance}getAuthToken(){return this.authToken}async generatePkce(){let e=te.util.bytesToHex(te.random.getBytesSync(32));return{verifier:e,challenge:await yt(e)}}async authorize(e){let{externalApiUid:t,externalApiRedirectUri:n}=this.environment.getCurrentEnvironment(),r={client_id:t,redirect_uri:n,response_type:`code`,code_challenge:e,code_challenge_method:`S256`};return(await this.request.post(this.authenticateAuthorize,r)).json()}async token(e,t){let{externalApiUid:n,externalApiRedirectUri:r}=this.environment.getCurrentEnvironment(),i={client_id:n,code:e,code_verifier:t,redirect_uri:r,grant_type:`authorization_code`};return(await this.request.post(this.authenticateToken,i)).json()}async authenticateAndAuthorize(){let{verifier:e,challenge:t}=await this.pkceReady;try{let n=await this.authorize(t);this.authToken=await this.token(n.redirect_uri.code,e)}catch(e){throw console.error(`Error authenticating or authorizing:`,e),e}}},xt=class e{request=_t.getInstance();static instance;urlConfig=`external/online_payments/orders/configuration`;config=null;constructor(e,t){this.urlConfig=this.setURLcode(e,t)}static getInstance(t,n){return!e.instance&&t&&(e.instance=new e(t,n)),e.instance}getConfig(){return this.config}setURLcode=(e,t)=>t?`${this.urlConfig}?code=${t}&scope=order_template`:`${this.urlConfig}?code=${e}&scope=branch`;async configRequest(){let e=await this.request.get(this.urlConfig),t=await e.json();return e.ok&&(this.config=t),t}},St=class e{request=_t.getInstance();static instance;countries=[];countriesLoadError=null;urlCountries=`resources/countries`;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCountries(){return this.countries}setCountries(e){this.countries=e}getCountriesLoadError(){return this.countriesLoadError}async fetchCountries(){let e=await this.request.get(this.urlCountries),t=await e.json();return e.ok?(this.countriesLoadError=null,this.setCountries(t.data),t):(this.countriesLoadError=`No se pudo cargar la lista de países.`,t)}},Ct={400:`Error al cargar orden de pago: solicitud inválida`,401:`Error al cargar orden de pago: autenticación requerida`,403:`Error al cargar orden de pago: autorización denegada`,404:`Error al cargar orden de pago: recurso no encontrado`,500:`Error al cargar orden de pago: falla interna del servicio`,502:`Error al cargar orden de pago: respuesta inválida del servicio upstream`,503:`Error al cargar orden de pago: servicio no disponible`};function wt(e,t){return Ct[e]||`Error al obtener información de sucursal: ${t}`}var Tt=class e{static instance;initPromise=null;auth=bt.getInstance();request=_t.getInstance();branchConfig;countryContent=St.getInstance();environment=gt.getInstance();authToken=null;config=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async initialize(e,t,n=`production`){return this.initPromise?this.initPromise:(this.environment.setEnvironment(n),this.initPromise=this.boot(e,t),this.initPromise)}async boot(e,t){await this.auth.authenticateAndAuthorize(),this.authToken=this.auth.getAuthToken(),this.request.setBearerToken(this.authToken?.access_token??``),this.branchConfig=xt.getInstance(e,t);let n=await this.branchConfig.configRequest();if(`error`in n)throw Error(wt(n.status,e));this.config=this.branchConfig.getConfig(),await this.countryContent.fetchCountries()}getAuthToken(){if(!this.authToken)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.authToken}getConfig(){if(!this.config)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.config}},Et=class e{request=_t.getInstance();static instance;cardinalToken=null;urlCardinalToken=`external/online_payments/orders/token`;orchestrator=Tt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCardinalToken(){return this.cardinalToken}setCardinalToken(e){this.cardinalToken=e}generateCardinalTokenPayload(e){return{branch_id:this.orchestrator.getConfig().data.branch_id,subtotal_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),subtotal_currency:`USD`,tip_cents:0,tip_currency:`USD`,description:e.description}}async fetchCardinalToken(e){let t=await this.request.post(this.urlCardinalToken,{data:e}),n=await t.json();return t.ok,n}},Dt=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await _t.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},Ot=e=>{let t=e[0];return Number(t)===4?`visa`:Number(t)===2||Number(t)===5?`mastercard`:Number(t)===6?`union_pay`:`not_valid`},kt=e=>{let[t,n]=e.split(`/`);return{month:t,year:n}},At=e=>e.replace(/\s/g,``),jt=class e{static instance;get songbirdUrl(){return gt.getInstance().getCurrentEnvironment().songbirdUrl||``}loaded=!1;initialized=!1;constructor(){}static getInstance(){return e.instance||=new e,e.instance}loadSongbird(){return this.loaded?Promise.resolve():new Promise((e,t)=>{let n=document.createElement(`script`);n.src=this.songbirdUrl,n.onload=()=>{this.loaded=!0,e()},n.onerror=()=>t(Error(`Failed to load Songbird script`)),document.head.appendChild(n)})}getBrowserData(){return{browser_java_enabled:!1,browser_language:navigator.language,browser_color_depth:screen.colorDepth,browser_screen_height:screen.height,browser_screen_width:screen.width,browser_time_zone:Intl.DateTimeFormat().resolvedOptions().timeZone||`America/El_Salvador`,user_agent:navigator.userAgent,device_channel:`Browser`,browser_javascript_enabled:!0}}async setupCardinal(e){return await this.loadSongbird(),this.cleanup(),new Promise((t,n)=>{try{Cardinal.configure({timeout:6e3,maxRequestRetries:3,logging:{level:`on`}}),Cardinal.on(`payments.setupComplete`,n=>{Cardinal.off(`payments.setupComplete`),this.submitCollectionForm(e),t(n.sessionId)}),Cardinal.setup(`init`,{jwt:e}),this.initialized=!0}catch(e){n(e)}})}cleanup(){let e=document.querySelector(`iframe[name="cardinalIframe"]`);e&&e.remove();let t=document.getElementById(`collectionForm`);t&&t.remove()}submitCollectionForm(e){this.cleanup();let t=document.createElement(`iframe`);t.name=`cardinalIframe`,t.height=`10`,t.width=`10`,t.style.cssText=`visibility:hidden;position:absolute;top:-1000px;left:-1000px;`,document.body.appendChild(t);let n=document.createElement(`form`);n.id=`collectionForm`,n.name=`devicedata`,n.method=`POST`,n.action=`https://centinelapistag.cardinalcommerce.com/V2/Cruise/Collect`,n.target=`cardinalIframe`;let r=document.createElement(`input`);r.type=`hidden`,r.name=`JWT`,r.value=e,n.appendChild(r),document.body.appendChild(n),n.submit()}onCardinalValidated(){return new Promise(e=>{Cardinal.on(`payments.validated`,t=>{Cardinal.off(`payments.validated`),e(t)})})}continueCardinal(e,t,n){Cardinal.continue(`cca`,{AcsUrl:e.acs_url,Payload:e.payload},{OrderDetails:{TransactionId:e.transaction_id,OrderNumber:e.order_number_client,Amount:t,CurrencyCode:e.currency_code,OrderDescription:n,OrderChannel:e.transaction_mode}})}},Mt=class e{static instance;request=_t.getInstance();cardinalService=jt.getInstance();registerPaymentResponse=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async registerPayment(e,t){let n={data:{...t,...this.cardinalService.getBrowserData()}},r=await this.request.post(`external/online_payments/orders/${e}/register_payment`,n,{},`api/v2`),i=await r.json();return r.ok&&(this.registerPaymentResponse=i.data),i}async validatePayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/validate_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}async confirmPayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/confirm_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}buildValidatePayloadFromCardinal(e){let t=this.registerPaymentResponse;return{validated:e.Validated,action_code:e.ActionCode,error_number:e.ErrorNumber,error_description:e.ErrorDescription,payment_type:e.Payment.Type,processor_transaction_id:e.Payment.ProcessorTransactionId,cavv:e.Payment.ExtendedData.CAVV,currency_code:e.Payment.ExtendedData.CurrencyCode,eci_flag:e.Payment.ExtendedData.ECIFlag,three_ds_version:e.Payment.ExtendedData.ThreeDSVersion,pares_status:e.Payment.ExtendedData.PAResStatus,signature_verification:e.Payment.ExtendedData.SignatureVerification,cavv_algorithm:t?.cavv_algorithm||void 0,enrolled:t?.enrolled||void 0,ds_transaction_id:t?.ds_transaction_id||void 0}}},Nt=class{request=_t.getInstance();urlEncrypt=`resources/encryption/public_key`;token=null;async getTokenFromServer(){let e=await this.request.get(this.urlEncrypt,{},`api/v2`);if(!e.ok)throw Error(`Failed to get encryption token`);this.token=(await e.json()).data}getToken(){return this.token}encryptData(e){if(!this.token)throw Error(`Encryption token not found`);let t=JSON.stringify({...e,nonce:crypto.randomUUID(),timestamp:Math.floor(Date.now()/1e3)}),n=te.default.random.getBytesSync(32),r=te.default.random.getBytesSync(12),i=te.default.cipher.createCipher(`AES-GCM`,n);i.start({iv:r,additionalData:``,tagLength:128}),i.update(te.default.util.createBuffer(t,`utf8`)),i.finish();let a=te.default.pki.publicKeyFromPem(this.token.public_key).encrypt(n,`RSA-OAEP`);return{encrypted_data:te.default.util.encode64(i.output.getBytes()),encrypted_key:te.default.util.encode64(a),iv:te.default.util.encode64(r),tag:te.default.util.encode64(i.mode.tag.getBytes())}}},Pt=class e{static instance;cardinalToken=Et.getInstance();cardinalService=jt.getInstance();cardinalPayment=Mt.getInstance();countryContent=St.getInstance();stateContent=Dt.getInstance();orchestrator=Tt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}async process(e,t,n){let r=this.cardinalToken.generateCardinalTokenPayload(e);t&&(r.subtotal_cents=t);let i=await this.cardinalToken.fetchCardinalToken(r);if(`error`in i){n.sendAlert(`Error`,i.error||`Error al procesar el pago`);return}let{id:a,token:o}=i.data,s=await this.cardinalService.setupCardinal(o),c=this.countryContent.getCountries().find(t=>t.id===e.country),l=this.stateContent.getStates().find(t=>t.id===e.region),u=kt(e.cardExpiry),d=new Nt;try{await d.getTokenFromServer()}catch(e){throw Error(`Failed to get encryption token: `+e)}let f=d.encryptData({card_number:At(e.cardNumber),card_expiration_month:u.month,card_expiration_year:`20${u.year}`,cvv:e.cardCvc,expiration_date:`${u.year}${u.month}`,cardholder_name:e.cardHolder}),p={reference:s,billing_address:e.address,billing_city:e.city,billing_country_code:String(c?.number||``),billing_first_name:e.firstName,billing_last_name:e.lastName,billing_postal_code:e.postalCode,billing_state_code:l?.short_code||``,billing_country_name:c?.name||``,email:e.email,phone_number:e.phone.replace(/\s/g,``),...f},m=await this.cardinalPayment.registerPayment(a,p);if(`error`in m){n.sendAlert(`Error`,m.error||`Error al procesar el pago`);return}let h=m.data;if(h.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
24
24
|
Por favor revisa tu información e inténtalo de nuevo`);return}if(h.required_authentication&&h.acs_url!==``){this.cardinalService.continueCardinal(h,String(r.subtotal_cents),e.description);let t=await this.cardinalService.onCardinalValidated();if(t.ActionCode!==`SUCCESS`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
25
25
|
Por favor revisa tu información e inténtalo de nuevo`);return}let i=this.cardinalPayment.buildValidatePayloadFromCardinal(t),o=await this.cardinalPayment.validatePayment(a,{...i,...f});if(`error`in o){n.sendAlert(`Error`,o.error||`Error al procesar el pago`);return}if(o.data.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
26
26
|
Por favor revisa tu información e inténtalo de nuevo`);return}}else{let e=await this.cardinalPayment.validatePayment(a,{...f});if(`error`in e){n.sendAlert(`Error`,e.error||`Error al procesar el pago`);return}if(e.data.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
27
27
|
Por favor revisa tu información e inténtalo de nuevo`);return}}let g=this.buildConfirmPayload(),_=await this.cardinalPayment.confirmPayment(a,{...g,...f});if(`error`in _){n.sendAlert(`Error`,_.error||`Error al procesar el pago`);return}_.data.status===`success`?(n.sendSuccess({data:{id:a,status:_.data.status,amount_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),amount_currency:`USD`,response_code:_.data.response_code,authorization_number:_.data.authorization_code,reference_number:_.data.reference_code,billing_document_number:e.billingDocumentNumber,description:e.description,date:this.getCurrentDate(),time:this.getCurrentTime(),commerce_name:this.orchestrator.getConfig().data.name,branch_name:this.orchestrator.getConfig().data.branch_name,card_network:``,card_last_digits:e.cardNumber.slice(-4),invoice_serie:null}}),n.resetForm()):n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
28
|
-
Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){let e=new Date,t=String(e.getFullYear()).slice(2),n=String(e.getMonth()+1).padStart(2,`0`),r=String(e.getHours()).padStart(2,`0`),i=String(e.getMinutes()).padStart(2,`0`),a=String(e.getSeconds()).padStart(2,`0`);return{invoice_number:String(Math.floor(Math.random()*90001)+1e4),terminal_id
|
|
28
|
+
Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){let e=new Date,t=String(e.getFullYear()).slice(2),n=String(e.getMonth()+1).padStart(2,`0`),r=String(e.getHours()).padStart(2,`0`),i=String(e.getMinutes()).padStart(2,`0`),a=String(e.getSeconds()).padStart(2,`0`);return{invoice_number:String(Math.floor(Math.random()*90001)+1e4),terminal_id:`00299998`,retailer_id:`000999999999999`,transaction_date:`${t}${n}`,transaction_time:`${r}${i}${a}`}}getCurrentDate(){let e=new Date,t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}getCurrentTime(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}`}};function Ft(){let e=document.createElement(`div`);return e.setAttribute(`data-bizz-loading`,``),e.innerHTML=`
|
|
29
29
|
<style>
|
|
30
30
|
[data-bizz-loading] {
|
|
31
31
|
display: flex;
|
|
@@ -46,7 +46,8 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
46
46
|
}
|
|
47
47
|
</style>
|
|
48
48
|
<div class="bizz-spinner"></div>
|
|
49
|
-
`,e}var
|
|
49
|
+
`,e}var It={minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0};new Intl.NumberFormat(`en-US`,It);function Lt(e,t=`USD`,n=`currency`){return new Intl.NumberFormat(`en-US`,{style:n,currency:t,...It}).format(e)}function Rt(e){return parseInt(e.replace(/,/g,``).replace(`.`,``),0)}var zt=class e{static instance;orchestrator=Tt.getInstance();urlValidateAmount=`external/online_payments/orders/validate`;lastAmountValidate=0;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setLastAmountValidate(e){this.lastAmountValidate=e}getLastAmountValidate(){return this.lastAmountValidate}async validateAmount(e,t=!1){let n=typeof e==`string`?Rt(e):e;if(!t&&n===this.getLastAmountValidate())return;this.setLastAmountValidate(n);let r=await _t.getInstance().post(this.urlValidateAmount,{data:{branch_id:this.orchestrator.getConfig().data.branch_id,amount_cents:n}}),i=await r.json();return r.ok,i}},Bt={subtotal_cents:`amount`,billing_document_number:`billingDocumentNumber`,billing_email:`email`,card_network:`cardNumber`,cardholder_name:`cardHolder`,billing_name:`cardHolder`,country:`country`,description:`description`},Vt=new Set([`iv`,`tag`,`encrypted_data`,`encrypted_key`]),Ht=class{origin;constructor(e){this.origin=e}sendServerValidationErrors(e,t){if(typeof t==`string`||!e)return!1;let n=this.buildValidationResults(t);for(let t of n)e.postMessage({type:`payment-form:validation-result`,field:t.field,error:t.error},this.origin);return n.length>0}hasEncryptionPayloadErrors(e){return typeof e==`string`?!1:Object.keys(e).some(e=>Vt.has(e))}resolveServerErrorMessage(e){return typeof e==`string`?e:`Por favor, revisa los campos`}buildValidationResults(e){let t=[];for(let[n,r]of Object.entries(e)){let e=Bt[n],i=Array.isArray(r)?r.find(e=>typeof e==`string`):void 0;!e||!i||t.push({field:e,error:i})}return t}},Ut=class e{request=_t.getInstance();urlPaymentIntent=`external/online_payments/payment_intents`;orchestrator=Tt.getInstance();static instance;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async generatePaymentIntentPayload(e){let t=this.orchestrator.getConfig(),n=new Nt;try{await n.getTokenFromServer()}catch(e){throw Error(`Failed to get encryption token: `+e)}let r={card_number:At(e.cardNumber),card_security_code:e.cardCvc,cardholder_name:e.cardHolder,card_expiration_month:kt(e.cardExpiry).month,card_expiration_year:kt(e.cardExpiry).year},i=null;try{i=n.encryptData(r)}catch(e){throw Error(`Failed to encrypt data: `+e)}return{branch_id:t.data.branch_id,card_network:Ot(e.cardNumber),operation:`direct`,iv:i.iv,tag:i.tag,encrypted_data:i.encrypted_data,cardholder_name:e.cardHolder,card_last_digits:e.cardNumber.slice(-4),subtotal_currency:`USD`,billing_name:e.cardHolder,encrypted_key:i.encrypted_key,subtotal_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),billing_email:e.email,description:e.description,billing_document_number:e.billingDocumentNumber}}async createPaymentIntent(e){let t=this.orchestrator.getAuthToken(),n=await this.request.post(this.urlPaymentIntent,{data:e},{headers:{Authorization:`Bearer ${t.access_token}`,"Content-Type":`application/json`}},`api/v2`),r=await n.json();return n.ok,r}},Wt=[{code:`51`,title:`¡Fondos insuficientes!`,message:`Intenta con otra tarjeta o confirma que tengas saldo disponible.`},{code:`04`,title:`¡Tarjeta bloqueada!`,message:`Contacta a tu banco o prueba con otra tarjeta.`},{code:`96`,title:`¡Sistema no disponible!`,message:`Vuelve a intentar en unos minutos.`},{code:`54`,title:`¡Tarjeta expirada!`,message:`Revisa la fecha de vencimiento o usa otra tarjeta.`},{code:`06`,title:`¡CVV no válido!`,message:`Verifica el código de seguridad e inténtalo de nuevo.`},{code:`99`,title:`¡Transacción inválida!`,message:`Revisa tus datos e inténtalo de nuevo.`}],Gt=e=>Wt.find(t=>t.code===e)||{title:`¡Error al pagar!`,message:`Tu compra no pudo ser procesada!
|
|
50
|
+
Por favor revisa tu información e inténtalo de nuevo`,code:0},Kt=[{label:`Documento Único de Identidad (DUI)`,value:`dui`},{label:`Pasaporte`,value:`passport`},{label:`Tarjeta de extranjero`,value:`resident_card`}],qt=[{label:`Selecciona aquí`,value:``}],Jt=[{label:`Selecciona aquí`,value:``}],Yt={amount:{label:`Monto a pagar`,icon:`currency-dollar`,placeholder:`0.00`,divider:!0},documentType:{label:`Tipo de documento`,icon:`document`,placeholder:`Tipo de documento`,type:`select`,default:`dui`,options:Kt},billingDocumentNumber:{label:`Número de documento`,icon:`document`,placeholder:`1234567890`,type:`text`,mask:`########-#`},email:{label:`Correo electrónico`,icon:`email`,placeholder:`example@example.com`,type:`email`,divider:!0},cardNumber:{label:`Número de tarjeta`,icon:`credit-card`,placeholder:`4111 1111 1111 1111`,mask:`#### #### #### ####`},cardExpiry:{label:`Fecha de expiración`,icon:`calendar`,placeholder:`MM/YY`,mask:`##/##`},cardCvc:{label:`CVV`,icon:`shield-lock`,placeholder:`123`,mask:`###`},cardHolder:{label:`Nombre en tarjeta`,icon:`user`,placeholder:`John Doe`},description:{label:`Descripción`,icon:`description`,placeholder:`Description`}},Xt={amount:{label:`Monto a pagar`,icon:`currency-dollar`,placeholder:`0.00`,divider:!0},documentType:{label:`Tipo de documento`,icon:`document`,placeholder:`Selecciona tipo de documento`,type:`select`,default:`dui`,options:Kt},billingDocumentNumber:{label:`Número de documento`,icon:`document`,placeholder:`Escribe acá`,type:`text`,mask:`########-#`},firstName:{label:`Nombre`,icon:`user`,placeholder:`Ingresar nombre`},lastName:{label:`Apellido`,icon:`user`,placeholder:`Ingresar apellido`},email:{label:`Correo electrónico`,icon:`email`,placeholder:`Escribe acá`,type:`email`},phone:{label:`Teléfono`,icon:`phone`,placeholder:`Ingresar teléfono`,divider:!0},cardNumber:{label:`Número de tarjeta`,icon:`credit-card`,placeholder:`Escribe acá`,mask:`#### #### #### ####`},cardHolder:{label:`Nombre en tarjeta`,icon:`user`,placeholder:`Escribe acá`},cardExpiry:{label:`Fecha de vencimiento`,icon:`calendar`,placeholder:`Escribe acá`,mask:`##/##`},cardCvc:{label:`CVV`,icon:`shield-lock`,placeholder:`Escribe acá`,mask:`###`,divider:!0},country:{label:`País`,icon:`map-pin`,placeholder:`Selecciona aquí`,type:`select`,options:qt},region:{label:`Región`,icon:`map-pin`,placeholder:`Selecciona aquí`,type:`select`,options:Jt},city:{label:`Ciudad`,icon:`map-pin`,placeholder:`Escribe aquí`},address:{label:`Dirección`,icon:`map-pin`,placeholder:`Escribe aquí`},postalCode:{label:`Código postal`,icon:`document`,placeholder:`Escribe aquí`,divider:!0},description:{label:`Descripción`,icon:`description`,placeholder:`Escribe acá`}};function Zt(e){let t=e?.label??`Pagar`;return`<button type="submit" data-label="${t}" data-loading-label="${e?.loadingLabel??`Procesando...`}">${t}</button>`}function Qt(e){let{header:t}=e,n=!0,r=!0,i=!0,a=!0,o=!0;return typeof t==`boolean`&&!t?``:(typeof t==`object`&&(`logo`in t&&typeof t.logo==`boolean`&&(n=t.logo),`totalAmount`in t&&typeof t.totalAmount==`boolean`&&(r=t.totalAmount),`description`in t&&typeof t.description==`boolean`&&(i=t.description),`requestMessage`in t&&typeof t.requestMessage==`boolean`&&(a=t.requestMessage),`date`in t&&typeof t.date==`boolean`&&(o=t.date)),`
|
|
50
51
|
<header class="form-header">
|
|
51
52
|
${n?`<img src="${e.logo}" alt="${e.name} Logo" class="commerce-logo">`:``}
|
|
52
53
|
${r?`<div class="commerce-total-amount-container">
|
|
@@ -58,7 +59,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
58
59
|
${o?`<date class="commerce-date"> ${new Date().toLocaleDateString(`es-SV`,{day:`numeric`,month:`long`,year:`numeric`})} </date>`:``}
|
|
59
60
|
</header>
|
|
60
61
|
<span class="divider-header"></span>
|
|
61
|
-
`)}function
|
|
62
|
+
`)}function $t(e){let t=e.find(e=>e.name===`amount`);return{amountHtml:t?`
|
|
62
63
|
<div class="field">
|
|
63
64
|
<label for="amount">${t.label}</label>
|
|
64
65
|
<div class="input-wrapper">
|
|
@@ -86,7 +87,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
86
87
|
<span class="field-error" id="error-${e.name}"></span>
|
|
87
88
|
${e.divider?`<span class="divider" />`:``}
|
|
88
89
|
</div>
|
|
89
|
-
`}).join(``)}}var
|
|
90
|
+
`}).join(``)}}var en=`<!DOCTYPE html>
|
|
90
91
|
<html lang="en">
|
|
91
92
|
<head>
|
|
92
93
|
<meta charset="UTF-8">
|
|
@@ -374,7 +375,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
374
375
|
<!--SCRIPT-->
|
|
375
376
|
</body>
|
|
376
377
|
</html>
|
|
377
|
-
`,zt='(function(){var{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},l||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var u=b(Array.prototype.forEach),d=b(Array.prototype.lastIndexOf),ee=b(Array.prototype.pop),f=b(Array.prototype.push),p=b(Array.prototype.splice),m=b(String.prototype.toLowerCase),h=b(String.prototype.toString),g=b(String.prototype.match),te=b(String.prototype.replace),ne=b(String.prototype.indexOf),re=b(String.prototype.trim),_=b(Object.prototype.hasOwnProperty),v=b(RegExp.prototype.test),y=ie(TypeError);function b(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return c(e,t,r)}}function ie(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return l(e,n)}}function x(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function S(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function C(t){let n=s(null);for(let[r,i]of e(t))_(t,r)&&(Array.isArray(i)?n[r]=S(i):i&&typeof i==`object`&&i.constructor===Object?n[r]=C(i):n[r]=i);return n}function ae(e,t){for(;e!==null;){let n=i(e,t);if(n){if(n.get)return b(n.get);if(typeof n.value==`function`)return b(n.value)}e=r(e)}function n(){return null}return n}var oe=a(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),se=a(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ce=a([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),le=a([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ue=a(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),de=a([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),fe=a([`#text`]),pe=a(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),me=a(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),he=a(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ge=a([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),_e=o(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm),ve=o(/<%[\\w\\W]*|[\\w\\W]*%>/gm),ye=o(/\\$\\{[\\w\\W]*/gm),be=o(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/),w=o(/^aria-[\\-\\w]+$/),xe=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),Se=o(/^(?:\\w+script|data):/i),Ce=o(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),we=o(/^html$/i),Te=o(/^[a-z][.\\w]*(-[.\\w]+)+$/i),Ee=Object.freeze({__proto__:null,ARIA_ATTR:w,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Te,DATA_ATTR:be,DOCTYPE_NAME:we,ERB_EXPR:ve,IS_ALLOWED_URI:xe,IS_SCRIPT_OR_DATA:Se,MUSTACHE_EXPR:_e,TMPLIT_EXPR:ye}),De={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Oe=function(){return typeof window>`u`?null:window},ke=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ae=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function je(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oe(),n=e=>je(e);if(n.version=`3.3.3`,n.removed=[],!t||!t.document||t.document.nodeType!==De.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:b,Element:ie,NodeFilter:S,NamedNodeMap:_e=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ve,DOMParser:ye,trustedTypes:be}=t,w=ie.prototype,Se=ae(w,`cloneNode`),Ce=ae(w,`remove`),Te=ae(w,`nextSibling`),Me=ae(w,`childNodes`),T=ae(w,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let E,D=``,{implementation:O,createNodeIterator:Ne,createDocumentFragment:Pe,getElementsByTagName:Fe}=r,{importNode:Ie}=i,k=Ae();n.isSupported=typeof e==`function`&&typeof T==`function`&&O&&O.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Le,ERB_EXPR:A,TMPLIT_EXPR:Re,DATA_ATTR:ze,ARIA_ATTR:Be,IS_SCRIPT_OR_DATA:Ve,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:He}=Ee,{IS_ALLOWED_URI:Ue}=Ee,M=null,We=x({},[...oe,...se,...ce,...ue,...fe]),N=null,Ge=x({},[...pe,...me,...he,...ge]),P=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),F=null,I=null,L=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ke=!0,qe=!0,Je=!1,Ye=!0,R=!1,Xe=!0,z=!1,Ze=!1,B=!1,V=!1,H=!1,U=!1,W=!0,Qe=!1,$e=!0,et=!1,G={},K=null,tt=x({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),nt=null,rt=x({},[`audio`,`video`,`img`,`source`,`image`,`track`]),it=null,at=x({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ot=`http://www.w3.org/1998/Math/MathML`,st=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,J=q,ct=!1,lt=null,ut=x({},[ot,st,q],h),dt=x({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ft=x({},[`annotation-xml`]),pt=x({},[`title`,`style`,`font`,`a`,`script`]),mt=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=r.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=C(e),mt=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=mt===`application/xhtml+xml`?h:m,M=_(e,`ALLOWED_TAGS`)?x({},e.ALLOWED_TAGS,Y):We,N=_(e,`ALLOWED_ATTR`)?x({},e.ALLOWED_ATTR,Y):Ge,lt=_(e,`ALLOWED_NAMESPACES`)?x({},e.ALLOWED_NAMESPACES,h):ut,it=_(e,`ADD_URI_SAFE_ATTR`)?x(C(at),e.ADD_URI_SAFE_ATTR,Y):at,nt=_(e,`ADD_DATA_URI_TAGS`)?x(C(rt),e.ADD_DATA_URI_TAGS,Y):rt,K=_(e,`FORBID_CONTENTS`)?x({},e.FORBID_CONTENTS,Y):tt,F=_(e,`FORBID_TAGS`)?x({},e.FORBID_TAGS,Y):C({}),I=_(e,`FORBID_ATTR`)?x({},e.FORBID_ATTR,Y):C({}),G=_(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ke=e.ALLOW_ARIA_ATTR!==!1,qe=e.ALLOW_DATA_ATTR!==!1,Je=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,R=e.SAFE_FOR_TEMPLATES||!1,Xe=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,V=e.RETURN_DOM||!1,H=e.RETURN_DOM_FRAGMENT||!1,U=e.RETURN_TRUSTED_TYPE||!1,B=e.FORCE_BODY||!1,W=e.SANITIZE_DOM!==!1,Qe=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,et=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||xe,J=e.NAMESPACE||q,dt=e.MATHML_TEXT_INTEGRATION_POINTS||dt,ft=e.HTML_INTEGRATION_POINTS||ft,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),R&&(qe=!1),H&&(V=!0),G&&(M=x({},fe),N=s(null),G.html===!0&&(x(M,oe),x(N,pe)),G.svg===!0&&(x(M,se),x(N,me),x(N,ge)),G.svgFilters===!0&&(x(M,ce),x(N,me),x(N,ge)),G.mathMl===!0&&(x(M,ue),x(N,he),x(N,ge))),_(e,`ADD_TAGS`)||(L.tagCheck=null),_(e,`ADD_ATTR`)||(L.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?L.tagCheck=e.ADD_TAGS:(M===We&&(M=C(M)),x(M,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?L.attributeCheck=e.ADD_ATTR:(N===Ge&&(N=C(N)),x(N,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&x(it,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(K===tt&&(K=C(K)),x(K,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(K===tt&&(K=C(K)),x(K,e.ADD_FORBID_CONTENTS,Y)),$e&&(M[`#text`]=!0),z&&x(M,[`html`,`head`,`body`]),M.table&&(x(M,[`tbody`]),delete F.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);E=e.TRUSTED_TYPES_POLICY,D=E.createHTML(``)}else E===void 0&&(E=ke(be,o)),E!==null&&typeof D==`string`&&(D=E.createHTML(``));a&&a(e),X=e}},yt=x({},[...se,...ce,...le]),bt=x({},[...ue,...de]),xt=function(e){let t=T(e);(!t||!t.tagName)&&(t={namespaceURI:J,tagName:`template`});let n=m(e.tagName),r=m(t.tagName);return lt[e.namespaceURI]?e.namespaceURI===st?t.namespaceURI===q?n===`svg`:t.namespaceURI===ot?n===`svg`&&(r===`annotation-xml`||dt[r]):!!yt[n]:e.namespaceURI===ot?t.namespaceURI===q?n===`math`:t.namespaceURI===st?n===`math`&&ft[r]:!!bt[n]:e.namespaceURI===q?t.namespaceURI===st&&!ft[r]||t.namespaceURI===ot&&!dt[r]?!1:!bt[n]&&(pt[n]||!yt[n]):!!(mt===`application/xhtml+xml`&<[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{T(e).removeChild(e)}catch{Ce(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(V||H)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},St=function(e){let t=null,n=null;if(B)e=`<remove></remove>`+e;else{let t=g(e,/^[\\r\\n\\t ]+/);n=t&&t[0]}mt===`application/xhtml+xml`&&J===q&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?E.createHTML(e):e;if(J===q)try{t=new ye().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=O.createDocument(J,`template`,null);try{t.documentElement.innerHTML=ct?D:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),J===q?Fe.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},Ct=function(e){return Ne.call(e.ownerDocument||e,e,S.SHOW_ELEMENT|S.SHOW_COMMENT|S.SHOW_TEXT|S.SHOW_PROCESSING_INSTRUCTION|S.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof ve&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof _e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof b==`function`&&e instanceof b};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Et=function(e){let t=null;if($(k.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(k.uponSanitizeElement,e,{tagName:r,allowedTags:M}),Xe&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&v(/<[/\\w!]/g,e.innerHTML)&&v(/<[/\\w!]/g,e.textContent)||e.nodeType===De.progressingInstruction||Xe&&e.nodeType===De.comment&&v(/<[/\\w]/g,e.data))return Z(e),!0;if(!(L.tagCheck instanceof Function&&L.tagCheck(r))&&(!M[r]||F[r])){if(!F[r]&&Ot(r)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r)))return!1;if($e&&!K[r]){let t=T(e)||e.parentNode,n=Me(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Se(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Te(e))}}}return Z(e),!0}return e instanceof ie&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&v(/<\\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(R&&e.nodeType===De.text&&(t=e.textContent,u([Le,A,Re],e=>{t=te(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(k.afterSanitizeElements,e,null),!1)},Dt=function(e,t,n){if(I[t]||W&&(t===`id`||t===`name`)&&(n in r||n in gt))return!1;if(!(qe&&!I[t]&&v(ze,t))&&!(Ke&&v(Be,t))&&!(L.attributeCheck instanceof Function&&L.attributeCheck(t,e))){if(!N[t]||I[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&v(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if(!it[t]&&!v(Ue,te(n,j,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ne(n,`data:`)===0&&nt[e])&&!(Je&&!v(Ve,te(n,j,``)))&&n)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&g(e,He)},kt=function(e){$(k.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=s,d=a===`value`?l:re(l);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(k.uponSanitizeAttribute,e,r),d=r.attrValue,Qe&&(c===`id`||c===`name`)&&(Q(a,e),d=`user-content-`+d),Xe&&v(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Q(a,e);continue}if(c===`attributename`&&g(d,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Ye&&v(/\\/>/i,d)){Q(a,e);continue}R&&u([Le,A,Re],e=>{d=te(d,e,` `)});let f=Y(e.nodeName);if(!Dt(f,c,d)){Q(a,e);continue}if(E&&typeof be==`object`&&typeof be.getAttributeType==`function`&&!o)switch(be.getAttributeType(f,c)){case`TrustedHTML`:d=E.createHTML(d);break;case`TrustedScriptURL`:d=E.createScriptURL(d);break}if(d!==l)try{o?e.setAttributeNS(o,a,d):e.setAttribute(a,d),wt(e)?Z(e):ee(n.removed)}catch{Q(a,e)}}$(k.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=Ct(t);for($(k.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(k.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof c&&e(n.content);$(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(ct=!e,ct&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw y(`dirty is not a string, aborting`)}else throw y(`toString is not a function`);if(!n.isSupported)return e;if(Ze||vt(t),n.removed=[],typeof e==`string`&&(et=!1),et){if(e.nodeName){let t=Y(e.nodeName);if(!M[t]||F[t])throw y(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof b)r=St(`<!---->`),a=r.ownerDocument.importNode(e,!0),a.nodeType===De.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!V&&!R&&!z&&e.indexOf(`<`)===-1)return E&&U?E.createHTML(e):e;if(r=St(e),!r)return V?null:U?D:``}r&&B&&Z(r.firstChild);let l=Ct(et?e:r);for(;o=l.nextNode();)Et(o),kt(o),o.content instanceof c&&At(o.content);if(et)return e;if(V){if(H)for(s=Pe.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(N.shadowroot||N.shadowrootmode)&&(s=Ie.call(i,s,!0)),s}let d=z?r.outerHTML:r.innerHTML;return z&&M[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&v(we,r.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+r.ownerDocument.doctype.name+`>\n`+d),R&&u([Le,A,Re],e=>{d=te(d,e,` `)}),E&&U?E.createHTML(d):d},n.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ze=!0},n.clearConfig=function(){X=null,Ze=!1},n.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},n.addHook=function(e,t){typeof t==`function`&&f(k[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(k[e],t);return n===-1?void 0:p(k[e],n,1)[0]}return ee(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k=Ae()},n}var Me=je(),T=class e{static instance;baseUrl=``;bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:Me.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},E=Object.defineProperty,D=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>D(e,typeof t==`symbol`?t:t+``,n),Ne={"#":{pattern:/[0-9]/},"@":{pattern:/[a-zA-Z]/},"*":{pattern:/[a-zA-Z0-9]/}},Pe=(e,t,n)=>e.replaceAll(t,``).replace(n,`.`).replace(`..`,`.`).replace(/[^.\\d]/g,``),Fe=(e,t,n)=>new Intl.NumberFormat(n.number?.locale??`en`,{minimumFractionDigits:e,maximumFractionDigits:t,roundingMode:`trunc`}),Ie=(e,t=!0,n)=>{let r=n.number?.unsigned!==!0&&e.startsWith(`-`)?`-`:``,i=n.number?.fraction??0,a=Fe(0,i,n),o=a.formatToParts(1000.12),s=o.find(e=>e.type===`group`)?.value??` `,c=o.find(e=>e.type===`decimal`)?.value??`.`,l=Pe(e,s,c);if(Number.isNaN(parseFloat(l)))return r;let u=l.split(`.`);u[1]!=null&&u[1].length>=1&&(a=Fe(u[1].length<=i?u[1].length:i,i,n));let d=a.format(parseFloat(l));return t?i>0&&l.endsWith(`.`)&&!l.slice(0,-1).includes(`.`)&&(d+=c):d=Pe(d,s,c),r+d},k=e=>JSON.parse(e.replaceAll(`\'`,`"`)),Le=(e,t={})=>{let n={...t};e.dataset.maska!=null&&e.dataset.maska!==``&&(n.mask=Re(e.dataset.maska)),e.dataset.maskaEager!=null&&(n.eager=A(e.dataset.maskaEager)),e.dataset.maskaReversed!=null&&(n.reversed=A(e.dataset.maskaReversed)),e.dataset.maskaTokensReplace!=null&&(n.tokensReplace=A(e.dataset.maskaTokensReplace)),e.dataset.maskaTokens!=null&&(n.tokens=ze(e.dataset.maskaTokens));let r={};return e.dataset.maskaNumberLocale!=null&&(r.locale=e.dataset.maskaNumberLocale),e.dataset.maskaNumberFraction!=null&&(r.fraction=parseInt(e.dataset.maskaNumberFraction)),e.dataset.maskaNumberUnsigned!=null&&(r.unsigned=A(e.dataset.maskaNumberUnsigned)),(e.dataset.maskaNumber!=null||Object.values(r).length>0)&&(n.number=r),n},A=e=>e===``?!0:!!JSON.parse(e),Re=e=>e.startsWith(`[`)&&e.endsWith(`]`)?k(e):e,ze=e=>{if(e.startsWith(`{`)&&e.endsWith(`}`))return k(e);let t={};return e.split(`|`).forEach(e=>{let n=e.split(`:`);t[n[0]]={pattern:Be()?new RegExp(n[1],`u`):new RegExp(n[1]),optional:n[2]===`optional`,multiple:n[2]===`multiple`,repeated:n[2]===`repeated`}}),t},Be=()=>{try{return!0}catch{return!1}},Ve=class{constructor(e={}){O(this,`opts`,{}),O(this,`memo`,new Map);let t={...e};if(t.tokens!=null){t.tokens=t.tokensReplace?{...t.tokens}:{...Ne,...t.tokens};for(let e of Object.values(t.tokens))typeof e.pattern==`string`&&(e.pattern=Be()?new RegExp(e.pattern,`u`):new RegExp(e.pattern))}else t.tokens=Ne;Array.isArray(t.mask)&&(t.mask.length>1?t.mask=[...t.mask].sort((e,t)=>e.length-t.length):t.mask=t.mask[0]??``),t.mask===``&&(t.mask=null),this.opts=t}masked(e){return this.process(String(e),this.findMask(String(e)))}unmasked(e){return this.process(String(e),this.findMask(String(e)),!1)}isEager(){return this.opts.eager===!0}isReversed(){return this.opts.reversed===!0}completed(e){let t=this.findMask(String(e));if(this.opts.mask==null||t==null)return!1;let n=this.process(String(e),t).length;return typeof this.opts.mask==`string`?n>=this.opts.mask.length:n>=t.length}findMask(e){let t=this.opts.mask;if(t==null)return null;if(typeof t==`string`)return t;if(typeof t==`function`)return t(e);let n=this.process(e,t.slice(-1).pop()??``,!1);return t.find(t=>this.process(e,t,!1).length>=n.length)??``}escapeMask(e){let t=[],n=[];return e.split(``).forEach((r,i)=>{r===`!`&&e[i-1]!==`!`?n.push(i-n.length):t.push(r)}),{mask:t.join(``),escaped:n}}process(e,t,n=!0){if(this.opts.number!=null)return Ie(e,n,this.opts);if(t==null)return e;let r=`v=${e},mr=${t},m=${n?1:0}`;if(this.memo.has(r))return this.memo.get(r);let{mask:i,escaped:a}=this.escapeMask(t),o=[],s=this.opts.tokens==null?{}:this.opts.tokens,c=this.isReversed()?-1:1,l=this.isReversed()?`unshift`:`push`,u=this.isReversed()?0:i.length-1,d=this.isReversed()?()=>m>-1&&h>-1:()=>m<i.length&&h<e.length,ee=e=>!this.isReversed()&&e<=u||this.isReversed()&&e>=u,f,p=-1,m=this.isReversed()?i.length-1:0,h=this.isReversed()?e.length-1:0,g=!1;for(;d();){let t=i.charAt(m),r=s[t],d=r?.transform==null?e.charAt(h):r.transform(e.charAt(h));if(!a.includes(m)&&r!=null?(d.match(r.pattern)==null?r.multiple?g&&=(m+=c,h-=c,!1):d===f?f=void 0:r.optional&&(m+=c,h-=c):(o[l](d),r.repeated?(p===-1?p=m:m===u&&m!==p&&(m=p-c),u===p&&(m-=c)):r.multiple&&(g=!0,m-=c),m+=c),h+=c):(n&&!this.isEager()&&o[l](t),d===t&&!this.isEager()?h+=c:f=t,this.isEager()||(m+=c)),this.isEager())for(;ee(m)&&(s[i.charAt(m)]==null||a.includes(m));){if(n){if(o[l](i.charAt(m)),e.charAt(h)===i.charAt(m)){m+=c,h+=c;continue}}else i.charAt(m)===e.charAt(h)&&(h+=c);m+=c}}return this.memo.set(r,o.join(``)),this.memo.get(r)}},j=class{constructor(e,t={}){O(this,`items`,new Map),O(this,`eventAbortController`),O(this,`onInput`,e=>{if(e instanceof CustomEvent&&e.type===`input`&&!e.isTrusted&&!e.bubbles)return;let t=e.target,n=this.items.get(t);if(n===void 0)return;let r=`inputType`in e&&e.inputType.startsWith(`delete`),i=n.isEager(),a=r&&i&&n.unmasked(t.value)===``?``:t.value;this.fixCursor(t,r,()=>this.setValue(t,a))}),this.options=t,this.eventAbortController=new AbortController,this.init(this.getInputs(e))}update(e={}){this.options={...e},this.init(Array.from(this.items.keys()))}updateValue(e){e.value!==``&&e.value!==this.processInput(e)?.masked&&this.setValue(e,e.value)}destroy(){this.eventAbortController.abort(),this.items.clear()}init(e){let t=this.getOptions(this.options);for(let n of e){if(!this.items.has(n)){let{signal:e}=this.eventAbortController;n.addEventListener(`input`,this.onInput,{capture:!0,signal:e})}let e=new Ve(Le(n,t));this.items.set(n,e),queueMicrotask(()=>this.updateValue(n)),n.selectionStart===null&&e.isEager()&&console.warn("Maska: input of `%s` type is not supported",n.type)}}getInputs(e){return typeof e==`string`?Array.from(document.querySelectorAll(e)):`length`in e?Array.from(e):[e]}getOptions(e){let{onMaska:t,preProcess:n,postProcess:r,...i}=e;return i}fixCursor(e,t,n){let r=e.selectionStart,i=e.value;if(n(),r===null||r===i.length&&!t)return;let a=e.value,o=i.slice(0,r),s=a.slice(0,r),c=this.processInput(e,o)?.unmasked,l=this.processInput(e,s)?.unmasked;if(c===void 0||l===void 0)return;let u=r;o!==s&&(u+=t?a.length-i.length:c.length-l.length),e.setSelectionRange(u,u)}setValue(e,t){let n=this.processInput(e,t);n!==void 0&&(e.value=n.masked,this.options.onMaska!=null&&(Array.isArray(this.options.onMaska)?this.options.onMaska.forEach(e=>e(n)):this.options.onMaska(n)),e.dispatchEvent(new CustomEvent(`maska`,{detail:n})),e.dispatchEvent(new CustomEvent(`input`,{detail:n.masked})))}processInput(e,t){let n=this.items.get(e);if(n===void 0)return;let r=t??e.value;this.options.preProcess!=null&&(r=this.options.preProcess(r));let i=n.masked(r);return this.options.postProcess!=null&&(i=this.options.postProcess(i)),{masked:i,unmasked:n.unmasked(r),completed:n.completed(r)}}},He={minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0},Ue=new Intl.NumberFormat(`en-US`,He);function M(e,t=`USD`,n=`currency`){return new Intl.NumberFormat(`en-US`,{style:n,currency:t,...He}).format(e)}function We(e){if(!e?.trim())return`—`;let t=e.trim();return t.startsWith(`#`)?t:`#${t}`}var N=(e,t)=>e.querySelector(`input[name="${t}"], select[name="${t}"]`),Ge=(e,t)=>{let n=e.querySelector(`button[type="submit"]`);if(n){n.disabled=t;let e=n.dataset.label??`Pagar`,r=n.dataset.loadingLabel??`Procesando...`;n.textContent=t?r:e}},P=e=>{e.reset();let t=e.querySelector(`select[name="documentType"]`);t&&(t.value=`dui`,t.dispatchEvent(new Event(`change`,{bubbles:!0})))},F=(e,t,n)=>{let r=e.querySelector(`.form-alert`);r&&(r.innerHTML=`<h3>`+t+`</h3><p>`+n+`</p>`,r.classList.remove(`form-alert--receipt`),r.classList.add(`visible`))},I=(e,t)=>{let n=document.querySelector(`.form-header`);if(n){let e=n.querySelector(`.commerce-logo`);e&&(n.innerHTML=``,n.appendChild(e))}let r=document.querySelector(`.divider-header`);r&&(r.style.display=`none`);let i=t.data,a=M(i.amount_cents/100,i.amount_currency),o=`${i.date}, ${i.time}`,s=We(i.reference_number),c=We(i.authorization_number);e.innerHTML=`<div class="payment-success"><p class="payment-success__amount">`+a+`</p><p class="payment-success__datetime">`+o+`</p><div class="payment-success__blocks"><div class="payment-success__block"><span class="payment-success__label">Número de referencia</span><span class="payment-success__value">`+s+`</span></div><div class="payment-success__block"><span class="payment-success__label">Número de autorización</span><span class="payment-success__value">`+c+`</span></div></div><div class="payment-success__footer"><h3 class="payment-success__done">¡Gracias por tu compra!</h3></div></div>`},L=(e,t,n)=>{let r=N(e,t);if(!r)return;let i=r.closest(`.input-wrapper`),a=i?.parentElement?.querySelector(`.field-error`);n?(i&&i.classList.add(`has-error`),a&&(a.textContent=n,a.classList.add(`visible`),Ke(a))):(i&&i.classList.remove(`has-error`),a&&(a.textContent=``,a.classList.remove(`visible`)))},Ke=e=>{e.scrollIntoView({behavior:`smooth`,block:`center`})},qe=e=>{let t=e.find(e=>e.name===`amount`);t&&(t.addEventListener(`input`,function(){let e=t.value.replace(/\\D/g,``);if(e){let n=parseInt(e,10)/100;t.value=Ue.format(n)}else t.value=``}),t.addEventListener(`blur`,()=>{parent.postMessage({type:`payment-form:validate-amount`,amount:t.value},`*`)}))},Je=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await T.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},Ye=e=>{let t=e.find(e=>e.name===`documentType`),n=e.find(e=>e.name===`billingDocumentNumber`);if(!t||!n)return;let r=new j(n);t.addEventListener(`change`,function(e){r?.destroy(),e.target.value===`dui`?(n.setAttribute(`inputmode`,`numeric`),n.setAttribute(`data-maska`,`########-#`),r=new j(n)):(n.removeAttribute(`inputmode`),n.removeAttribute(`data-maska`),n.value=``,r=null)})},R=e=>{e.forEach(function(e){e instanceof HTMLInputElement&&(e.addEventListener(`blur`,function(){let t=e.dataset.maskaValue||e.value;parent.postMessage({type:`payment-form:validate`,field:e.name,value:t},`*`)}),e.addEventListener(`input`,function(){let t=e.closest(`.input-wrapper`),n=t?.parentElement?.querySelector(`.field-error`);t&&t.classList.remove(`has-error`),n&&(n.textContent=``,n.classList.remove(`visible`))})),e instanceof HTMLSelectElement&&e.addEventListener(`change`,function(){parent.postMessage({type:`payment-form:validate`,field:e.name,value:e.value},`*`)})})},Xe=(e,t)=>{e.addEventListener(`submit`,function(e){e.preventDefault();let n={};t.forEach(function(e){n[e.name]=e.dataset.maskaValue||e.value}),parent.postMessage({type:`payment-form:submit`,value:n},`*`)})};function z(e=document.body){let t=new ResizeObserver(()=>{let{width:t,height:n}=e.getBoundingClientRect();parent.postMessage({type:`payment-form:sizing`,width:t,height:n},`*`)});return t.observe(e),t}var Ze=T.getInstance();new j(`input[data-maska]:not([name="billingDocumentNumber"])`);var B=document.getElementById(`payment-form`),V=B.querySelectorAll(`input, select`),H=Array.from(V.values());qe(H),Ye(H);var U=H.find(e=>e.name===`country`),W=H.find(e=>e.name===`region`);if(U instanceof HTMLSelectElement){let e=Je.getInstance();U.addEventListener(`change`,async function(){if(U.value===``)return;if(L(B,`region`,``),W instanceof HTMLSelectElement){W.innerHTML=``;let e=document.createElement(`option`);e.value=``,e.textContent=`Cargando...`,W.appendChild(e),W.disabled=!0}let t=await e.fetchStates(U.value);if(W instanceof HTMLSelectElement&&(W.disabled=!1,W.innerHTML=``),`error`in t){let t=e.getStatesLoadError();t&&L(B,`region`,t);return}if(e.setStates(t.data),parent.postMessage({type:`payment-form:states-loaded`,states:t.data},`*`),W instanceof HTMLSelectElement){let e=document.createElement(`option`);e.value=``,e.textContent=`Selecciona aquí`,W.appendChild(e),t.data.forEach(e=>{let t=document.createElement(`option`);t.value=e.id,t.textContent=e.name,W.appendChild(t)})}})}R(H),z(),window.addEventListener(`message`,function(e){if(!(!e.data||!e.data.type))switch(e.data.type){case`payment-form:set-submit-loading`:Ge(B,e.data.disabled);break;case`payment-form:reset`:P(B);break;case`payment-form:alert`:F(B,e.data.title,e.data.message);break;case`payment-form:validation-result`:L(B,e.data.field,e.data.error);break;case`payment-form:success`:I(B,e.data.paymentIntent);break;case`payment-form:set-token`:Ze.setBearerToken(e.data.token);break;default:break}}),Xe(B,H)})();',Bt=`data:image/svg+xml,%3csvg%20width='99'%20height='32'%20viewBox='0%200%2099%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M27.3848%200C29.8942%206.60543e-06%2031.9284%202.03883%2031.9284%204.55384V27.4462C31.9284%2029.9611%2029.8942%2032%2027.3848%2032H4.54376C2.03439%2032%203.69132e-05%2029.9611%200%2027.4462V4.55384C0%202.03882%202.03437%200%204.54376%200H27.3848ZM12.0067%205.0348C11.1292%205.03257%2010.3064%205.37037%209.68349%205.98797C9.0639%206.60335%208.70775%207.46498%208.70775%208.35337V15.4962C8.70775%2016.0154%209.12754%2016.4372%209.64666%2016.4372C10.1647%2016.4372%2010.5856%2016.0165%2010.5856%2015.4962V8.331C10.5856%207.95282%2010.7328%207.59689%2011.0008%207.32948C11.2676%207.06208%2011.6215%206.91564%2011.9978%206.91564H12.0023C12.7781%206.91791%2013.4099%207.56007%2013.4099%208.34774V13.5762C13.4099%2014.5508%2014.1982%2015.3407%2015.1705%2015.3407H18.1221C18.9695%2015.3407%2019.7934%2015.6518%2020.4119%2016.2325C21.0851%2016.8647%2021.4568%2017.7273%2021.4568%2018.647V21.6646C21.4568%2022.5473%2021.1141%2023.3776%2020.4901%2024.003C19.8672%2024.6274%2019.0387%2024.972%2018.1568%2024.972H14.0229C13.1689%2024.972%2012.3315%2024.67%2011.7063%2024.0871C11.0287%2023.4538%2010.6547%2022.5889%2010.6547%2021.6658V20.9799C10.6547%2020.7315%2010.7529%2020.4931%2010.9282%2020.3163L12.5169%2018.7242C12.6922%2018.5485%2012.93%2018.45%2013.1778%2018.45H15.6618C16.0067%2018.4501%2016.3449%2018.5688%2016.6005%2018.8004C16.8941%2019.0655%2017.056%2019.4314%2017.0549%2019.823C17.0527%2020.576%2016.4331%2021.188%2015.6729%2021.188H13.3161C12.7982%2021.188%2012.3774%2021.6087%2012.3774%2022.1289C12.3774%2022.6481%2012.797%2023.0699%2013.3161%2023.0699H15.6896C16.759%2023.0699%2017.755%2022.5518%2018.3813%2021.6355C18.6346%2021.2651%2018.8066%2020.841%2018.8825%2020.398C19.0666%2019.3273%2018.7339%2018.2823%2017.9949%2017.5338C17.3898%2016.9207%2016.5413%2016.5692%2015.6683%2016.5692H13.2045C12.9232%2016.5692%2012.643%2016.605%2012.3729%2016.6867C11.9196%2016.8243%2011.5189%2017.0638%2011.1884%2017.395L9.62652%2018.9614C9.4334%2019.1549%209.26156%2019.372%209.12983%2019.6115C8.89539%2020.0389%208.77596%2020.5021%208.77596%2020.981V21.6669C8.77597%2022.3673%208.91323%2023.0464%209.18337%2023.6864C9.44348%2024.304%209.81749%2024.859%2010.292%2025.3356C10.7664%2025.8112%2011.3202%2026.186%2011.9364%2026.4467C12.575%2026.7174%2013.2526%2026.855%2013.9514%2026.855H18.1546C18.8534%2026.855%2019.5311%2026.7174%2020.1696%2026.4467C20.7859%2026.1849%2021.3396%2025.8112%2021.8141%2025.3356C22.2885%2024.8601%2022.6626%2024.3052%2022.9227%2023.6876C23.1928%2023.0476%2023.3301%2022.3684%2023.3301%2021.668V18.6503C23.3301%2017.9499%2023.1928%2017.2708%2022.9227%2016.6309L22.9259%2016.6274C22.6647%2016.0098%2022.2918%2015.4549%2021.8174%2014.9794C21.3418%2014.5028%2020.7891%2014.1291%2020.1729%2013.8684C19.5343%2013.5976%2018.8567%2013.4598%2018.1579%2013.4598H15.2865V8.331C15.2865%207.46722%2014.9562%206.65034%2014.3545%206.03272C13.7416%205.40167%2012.8852%205.03816%2012.0067%205.0348Z'%20fill='%23121417'/%3e%3cpath%20d='M53.3405%2027.9622C52.2765%2027.9622%2051.291%2027.7244%2050.3858%2027.2507C49.4807%2026.7769%2048.7229%2026.121%2048.1143%2025.2809V25.8218C48.1143%2026.7616%2047.3527%2027.5249%2046.415%2027.5249C45.4773%2027.5249%2044.7157%2026.7616%2044.7157%2025.8218V5.70262C44.7157%204.76283%2045.4773%203.99949%2046.415%203.99949C47.3527%203.99949%2048.1143%204.76283%2048.1143%205.70262V15.6663C48.6789%2014.855%2049.408%2014.2202%2050.3055%2013.7656C51.201%2013.3092%2052.1904%2013.0809%2053.2735%2013.0809C54.6112%2013.0809%2055.8072%2013.4051%2056.8635%2014.0514C57.918%2014.6997%2058.7485%2015.5819%2059.3532%2016.6982C59.9579%2017.8144%2060.2603%2019.0898%2060.2603%2020.5206C60.2603%2021.9514%2059.9503%2023.2422%2059.3321%2024.3642C58.714%2025.4862%2057.8835%2026.3665%2056.8406%2027.0033C55.7995%2027.6419%2054.6322%2027.9603%2053.3405%2027.9603V27.9622ZM52.3722%2025.0489C53.218%2025.0489%2053.9663%2024.8552%2054.6169%2024.4677C55.2676%2024.0803%2055.7766%2023.5471%2056.1459%2022.8682C56.5133%2022.1892%2056.699%2021.4125%2056.699%2020.536C56.699%2019.6595%2056.5095%2018.8789%2056.1325%2018.1903C55.7555%2017.5018%2055.2427%2016.9648%2054.5978%2016.5754C53.951%2016.188%2053.2104%2015.9943%2052.3741%2015.9943C51.5378%2015.9943%2050.7877%2016.188%2050.1294%2016.5754C49.4692%2016.9628%2048.9525%2017.5018%2048.5813%2018.1903C48.2081%2018.8789%2048.0225%2019.6614%2048.0225%2020.536C48.0225%2021.4105%2048.2062%2022.1892%2048.5755%2022.8682C48.9449%2023.5471%2049.4577%2024.0803%2050.1179%2024.4677C50.7781%2024.8552%2051.5302%2025.0489%2052.376%2025.0489H52.3722Z'%20fill='%23121417'/%3e%3cpath%20d='M64.816%2010.647C64.4429%2010.647%2064.1003%2010.553%2063.7865%2010.367C63.4726%2010.1809%2063.2219%209.92969%2063.0363%209.61515C62.8488%209.30061%2062.7569%208.95154%2062.7569%208.56795C62.7569%208.18437%2062.8507%207.85256%2063.0363%207.54186C63.2219%207.23115%2063.4726%206.98374%2063.7865%206.79578C64.1003%206.60974%2064.4429%206.51576%2064.816%206.51576C65.1892%206.51576%2065.5413%206.60974%2065.8456%206.79578C66.1498%206.98374%2066.3967%207.23115%2066.5823%207.54186C66.7679%207.85256%2066.8617%208.19396%2066.8617%208.56795C66.8617%208.94195%2066.7679%209.30061%2066.5823%209.61515C66.3948%209.92969%2066.1498%2010.1809%2065.8456%2010.367C65.5413%2010.5549%2065.1968%2010.647%2064.816%2010.647ZM63.109%2025.8217V15.2213C63.109%2014.2815%2063.8707%2013.5182%2064.8084%2013.5182C65.746%2013.5182%2066.5077%2014.2815%2066.5077%2015.2213V25.8217C66.5077%2026.7615%2065.746%2027.5249%2064.8084%2027.5249C63.8707%2027.5249%2063.109%2026.7615%2063.109%2025.8217Z'%20fill='%23121417'/%3e%3cpath%20d='M70.9719%2025.4033L78.0104%2016.1569H71.7795C71.0523%2016.1569%2070.4629%2015.5662%2070.4629%2014.8374C70.4629%2014.1086%2071.0523%2013.5178%2071.7795%2013.5178H81.1736C82.2644%2013.5178%2082.8825%2014.7702%2082.2204%2015.6391L75.1724%2024.8835H82.1113C82.8385%2024.8835%2083.4279%2025.4743%2083.4279%2026.2031C83.4279%2026.9319%2082.8385%2027.5226%2082.1113%2027.5226H72.0187C70.9279%2027.5226%2070.3098%2026.2702%2070.9719%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3cpath%20d='M86.544%2025.4033L93.5824%2016.1569H87.3516C86.6244%2016.1569%2086.035%2015.5662%2086.035%2014.8374C86.035%2014.1086%2086.6244%2013.5178%2087.3516%2013.5178H96.7457C97.8365%2013.5178%2098.4546%2014.7702%2097.7925%2015.6391L90.7445%2024.8835H97.6834C98.4106%2024.8835%2099%2025.4743%2099%2026.2031C99%2026.9319%2098.4106%2027.5226%2097.6834%2027.5226H87.5908C86.5%2027.5226%2085.8819%2026.2702%2086.544%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3c/svg%3e`;function Vt(e){let t=`<img src="${Bt}" alt="Bizz Logo" class="bizz-logo">`;return Rt.replace(`<!--BIZZ_LOGO-->`,t).replace(`<!--HEADER-->`,e.headerHtml).replace(`<!--AMOUNT_FIELD-->`,e.amountHtml).replace(`<!--FIELDS-->`,e.fieldsHtml).replace(`<!--SUBMIT_BUTTON-->`,e.submitButtonHtml).replace(`<!--SCRIPT-->`,`<script>${zt}<\/script>`)}function Ht(e){let t=document.createElement(`iframe`);return t.style.border=`none`,t.style.display=`block`,t.style.overflow=`hidden`,t.srcdoc=e,t.style.width=`100%`,t.style.height=`100%`,t}var Ut=`<svg
|
|
378
|
+
`,tn='(function(){var{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},l||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var u=b(Array.prototype.forEach),d=b(Array.prototype.lastIndexOf),ee=b(Array.prototype.pop),f=b(Array.prototype.push),p=b(Array.prototype.splice),m=b(String.prototype.toLowerCase),h=b(String.prototype.toString),g=b(String.prototype.match),te=b(String.prototype.replace),ne=b(String.prototype.indexOf),re=b(String.prototype.trim),_=b(Object.prototype.hasOwnProperty),v=b(RegExp.prototype.test),y=ie(TypeError);function b(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return c(e,t,r)}}function ie(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return l(e,n)}}function x(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function S(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function C(t){let n=s(null);for(let[r,i]of e(t))_(t,r)&&(Array.isArray(i)?n[r]=S(i):i&&typeof i==`object`&&i.constructor===Object?n[r]=C(i):n[r]=i);return n}function ae(e,t){for(;e!==null;){let n=i(e,t);if(n){if(n.get)return b(n.get);if(typeof n.value==`function`)return b(n.value)}e=r(e)}function n(){return null}return n}var oe=a(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),se=a(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ce=a([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),le=a([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ue=a(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),de=a([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),fe=a([`#text`]),pe=a(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),me=a(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),he=a(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ge=a([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),_e=o(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm),ve=o(/<%[\\w\\W]*|[\\w\\W]*%>/gm),ye=o(/\\$\\{[\\w\\W]*/gm),w=o(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/),T=o(/^aria-[\\-\\w]+$/),be=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),xe=o(/^(?:\\w+script|data):/i),Se=o(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),Ce=o(/^html$/i),we=o(/^[a-z][.\\w]*(-[.\\w]+)+$/i),Te=Object.freeze({__proto__:null,ARIA_ATTR:T,ATTR_WHITESPACE:Se,CUSTOM_ELEMENT:we,DATA_ATTR:w,DOCTYPE_NAME:Ce,ERB_EXPR:ve,IS_ALLOWED_URI:be,IS_SCRIPT_OR_DATA:xe,MUSTACHE_EXPR:_e,TMPLIT_EXPR:ye}),E={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ee=function(){return typeof window>`u`?null:window},De=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Oe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ke(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ee(),n=e=>ke(e);if(n.version=`3.3.3`,n.removed=[],!t||!t.document||t.document.nodeType!==E.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:b,Element:ie,NodeFilter:S,NamedNodeMap:_e=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ve,DOMParser:ye,trustedTypes:w}=t,T=ie.prototype,xe=ae(T,`cloneNode`),Se=ae(T,`remove`),we=ae(T,`nextSibling`),Ae=ae(T,`childNodes`),D=ae(T,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let O,k=``,{implementation:je,createNodeIterator:Me,createDocumentFragment:Ne,getElementsByTagName:Pe}=r,{importNode:Fe}=i,A=Oe();n.isSupported=typeof e==`function`&&typeof D==`function`&&je&&je.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Ie,ERB_EXPR:Le,TMPLIT_EXPR:Re,DATA_ATTR:ze,ARIA_ATTR:Be,IS_SCRIPT_OR_DATA:Ve,ATTR_WHITESPACE:He,CUSTOM_ELEMENT:j}=Te,{IS_ALLOWED_URI:Ue}=Te,M=null,We=x({},[...oe,...se,...ce,...ue,...fe]),N=null,Ge=x({},[...pe,...me,...he,...ge]),P=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),F=null,I=null,L=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ke=!0,qe=!0,Je=!1,Ye=!0,R=!1,Xe=!0,z=!1,Ze=!1,Qe=!1,B=!1,$e=!1,et=!1,tt=!0,nt=!1,rt=!0,V=!1,H={},U=null,it=x({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),at=null,ot=x({},[`audio`,`video`,`img`,`source`,`image`,`track`]),W=null,st=x({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),G=`http://www.w3.org/1998/Math/MathML`,K=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,J=q,ct=!1,lt=null,ut=x({},[G,K,q],h),dt=x({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ft=x({},[`annotation-xml`]),pt=x({},[`title`,`style`,`font`,`a`,`script`]),mt=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=r.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=C(e),mt=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=mt===`application/xhtml+xml`?h:m,M=_(e,`ALLOWED_TAGS`)?x({},e.ALLOWED_TAGS,Y):We,N=_(e,`ALLOWED_ATTR`)?x({},e.ALLOWED_ATTR,Y):Ge,lt=_(e,`ALLOWED_NAMESPACES`)?x({},e.ALLOWED_NAMESPACES,h):ut,W=_(e,`ADD_URI_SAFE_ATTR`)?x(C(st),e.ADD_URI_SAFE_ATTR,Y):st,at=_(e,`ADD_DATA_URI_TAGS`)?x(C(ot),e.ADD_DATA_URI_TAGS,Y):ot,U=_(e,`FORBID_CONTENTS`)?x({},e.FORBID_CONTENTS,Y):it,F=_(e,`FORBID_TAGS`)?x({},e.FORBID_TAGS,Y):C({}),I=_(e,`FORBID_ATTR`)?x({},e.FORBID_ATTR,Y):C({}),H=_(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ke=e.ALLOW_ARIA_ATTR!==!1,qe=e.ALLOW_DATA_ATTR!==!1,Je=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,R=e.SAFE_FOR_TEMPLATES||!1,Xe=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,B=e.RETURN_DOM||!1,$e=e.RETURN_DOM_FRAGMENT||!1,et=e.RETURN_TRUSTED_TYPE||!1,Qe=e.FORCE_BODY||!1,tt=e.SANITIZE_DOM!==!1,nt=e.SANITIZE_NAMED_PROPS||!1,rt=e.KEEP_CONTENT!==!1,V=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||be,J=e.NAMESPACE||q,dt=e.MATHML_TEXT_INTEGRATION_POINTS||dt,ft=e.HTML_INTEGRATION_POINTS||ft,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),R&&(qe=!1),$e&&(B=!0),H&&(M=x({},fe),N=s(null),H.html===!0&&(x(M,oe),x(N,pe)),H.svg===!0&&(x(M,se),x(N,me),x(N,ge)),H.svgFilters===!0&&(x(M,ce),x(N,me),x(N,ge)),H.mathMl===!0&&(x(M,ue),x(N,he),x(N,ge))),_(e,`ADD_TAGS`)||(L.tagCheck=null),_(e,`ADD_ATTR`)||(L.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?L.tagCheck=e.ADD_TAGS:(M===We&&(M=C(M)),x(M,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?L.attributeCheck=e.ADD_ATTR:(N===Ge&&(N=C(N)),x(N,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&x(W,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(U===it&&(U=C(U)),x(U,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(U===it&&(U=C(U)),x(U,e.ADD_FORBID_CONTENTS,Y)),rt&&(M[`#text`]=!0),z&&x(M,[`html`,`head`,`body`]),M.table&&(x(M,[`tbody`]),delete F.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);O=e.TRUSTED_TYPES_POLICY,k=O.createHTML(``)}else O===void 0&&(O=De(w,o)),O!==null&&typeof k==`string`&&(k=O.createHTML(``));a&&a(e),X=e}},yt=x({},[...se,...ce,...le]),bt=x({},[...ue,...de]),xt=function(e){let t=D(e);(!t||!t.tagName)&&(t={namespaceURI:J,tagName:`template`});let n=m(e.tagName),r=m(t.tagName);return lt[e.namespaceURI]?e.namespaceURI===K?t.namespaceURI===q?n===`svg`:t.namespaceURI===G?n===`svg`&&(r===`annotation-xml`||dt[r]):!!yt[n]:e.namespaceURI===G?t.namespaceURI===q?n===`math`:t.namespaceURI===K?n===`math`&&ft[r]:!!bt[n]:e.namespaceURI===q?t.namespaceURI===K&&!ft[r]||t.namespaceURI===G&&!dt[r]?!1:!bt[n]&&(pt[n]||!yt[n]):!!(mt===`application/xhtml+xml`&<[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{D(e).removeChild(e)}catch{Se(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(B||$e)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},St=function(e){let t=null,n=null;if(Qe)e=`<remove></remove>`+e;else{let t=g(e,/^[\\r\\n\\t ]+/);n=t&&t[0]}mt===`application/xhtml+xml`&&J===q&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=O?O.createHTML(e):e;if(J===q)try{t=new ye().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=je.createDocument(J,`template`,null);try{t.documentElement.innerHTML=ct?k:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),J===q?Pe.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},Ct=function(e){return Me.call(e.ownerDocument||e,e,S.SHOW_ELEMENT|S.SHOW_COMMENT|S.SHOW_TEXT|S.SHOW_PROCESSING_INSTRUCTION|S.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof ve&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof _e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof b==`function`&&e instanceof b};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Et=function(e){let t=null;if($(A.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(A.uponSanitizeElement,e,{tagName:r,allowedTags:M}),Xe&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&v(/<[/\\w!]/g,e.innerHTML)&&v(/<[/\\w!]/g,e.textContent)||e.nodeType===E.progressingInstruction||Xe&&e.nodeType===E.comment&&v(/<[/\\w]/g,e.data))return Z(e),!0;if(!(L.tagCheck instanceof Function&&L.tagCheck(r))&&(!M[r]||F[r])){if(!F[r]&&Ot(r)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r)))return!1;if(rt&&!U[r]){let t=D(e)||e.parentNode,n=Ae(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=xe(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,we(e))}}}return Z(e),!0}return e instanceof ie&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&v(/<\\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(R&&e.nodeType===E.text&&(t=e.textContent,u([Ie,Le,Re],e=>{t=te(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(A.afterSanitizeElements,e,null),!1)},Dt=function(e,t,n){if(I[t]||tt&&(t===`id`||t===`name`)&&(n in r||n in gt))return!1;if(!(qe&&!I[t]&&v(ze,t))&&!(Ke&&v(Be,t))&&!(L.attributeCheck instanceof Function&&L.attributeCheck(t,e))){if(!N[t]||I[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&v(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if(!W[t]&&!v(Ue,te(n,He,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ne(n,`data:`)===0&&at[e])&&!(Je&&!v(Ve,te(n,He,``)))&&n)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&g(e,j)},kt=function(e){$(A.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=s,d=a===`value`?l:re(l);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(A.uponSanitizeAttribute,e,r),d=r.attrValue,nt&&(c===`id`||c===`name`)&&(Q(a,e),d=`user-content-`+d),Xe&&v(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Q(a,e);continue}if(c===`attributename`&&g(d,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Ye&&v(/\\/>/i,d)){Q(a,e);continue}R&&u([Ie,Le,Re],e=>{d=te(d,e,` `)});let f=Y(e.nodeName);if(!Dt(f,c,d)){Q(a,e);continue}if(O&&typeof w==`object`&&typeof w.getAttributeType==`function`&&!o)switch(w.getAttributeType(f,c)){case`TrustedHTML`:d=O.createHTML(d);break;case`TrustedScriptURL`:d=O.createScriptURL(d);break}if(d!==l)try{o?e.setAttributeNS(o,a,d):e.setAttribute(a,d),wt(e)?Z(e):ee(n.removed)}catch{Q(a,e)}}$(A.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=Ct(t);for($(A.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(A.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof c&&e(n.content);$(A.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(ct=!e,ct&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw y(`dirty is not a string, aborting`)}else throw y(`toString is not a function`);if(!n.isSupported)return e;if(Ze||vt(t),n.removed=[],typeof e==`string`&&(V=!1),V){if(e.nodeName){let t=Y(e.nodeName);if(!M[t]||F[t])throw y(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof b)r=St(`<!---->`),a=r.ownerDocument.importNode(e,!0),a.nodeType===E.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!B&&!R&&!z&&e.indexOf(`<`)===-1)return O&&et?O.createHTML(e):e;if(r=St(e),!r)return B?null:et?k:``}r&&Qe&&Z(r.firstChild);let l=Ct(V?e:r);for(;o=l.nextNode();)Et(o),kt(o),o.content instanceof c&&At(o.content);if(V)return e;if(B){if($e)for(s=Ne.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(N.shadowroot||N.shadowrootmode)&&(s=Fe.call(i,s,!0)),s}let d=z?r.outerHTML:r.innerHTML;return z&&M[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&v(Ce,r.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+r.ownerDocument.doctype.name+`>\n`+d),R&&u([Ie,Le,Re],e=>{d=te(d,e,` `)}),O&&et?O.createHTML(d):d},n.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ze=!0},n.clearConfig=function(){X=null,Ze=!1},n.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},n.addHook=function(e,t){typeof t==`function`&&f(A[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(A[e],t);return n===-1?void 0:p(A[e],n,1)[0]}return ee(A[e])},n.removeHooks=function(e){A[e]=[]},n.removeAllHooks=function(){A=Oe()},n}var Ae=ke(),D=`https://devapi.teip.io`,O=`R33xmWassTrJO5I52s6FZ_3sdQRdiOR7Vc0oDSuf7No`,k=`urn:ietf:wg:oauth:2.0:oob`,je=`https://cas.static.client.cardinaltrusted.com/songbird/v2.0.0/songbird.js`,Me=void 0,Ne=void 0,Pe=void 0,Fe=void 0,A=void 0,Ie=void 0,Le=void 0,Re=void 0,ze=class e{static instance;environment=`development`;constructor(){}static getInstance(){return e.instance||=new e,e.instance}isDevelopmentEnvironment(){return k}getEnvironment(){return this.isDevelopmentEnvironment()?`development`:this.environment}getDevelopmentEnvironment(){return{apiBase:D,externalApiUid:O,songbirdUrl:je,externalApiRedirectUri:k}}getProductionEnvironment(){return{apiBase:Me,songbirdUrl:Fe,externalApiUid:Ne,externalApiRedirectUri:Pe}}getSandboxEnvironment(){return{apiBase:A,songbirdUrl:Re,externalApiUid:Ie,externalApiRedirectUri:Le}}setEnvironment(e){this.environment=e}getCurrentEnvironment(){switch(this.getEnvironment()){case`production`:return this.getProductionEnvironment();case`sandbox`:return this.getSandboxEnvironment();default:return this.getDevelopmentEnvironment()}}},Be=class e{static instance;get baseUrl(){return ze.getInstance().getCurrentEnvironment().apiBase||``}bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:Ae.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},Ve=Object.defineProperty,He=(e,t,n)=>t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t,n)=>He(e,typeof t==`symbol`?t:t+``,n),Ue={"#":{pattern:/[0-9]/},"@":{pattern:/[a-zA-Z]/},"*":{pattern:/[a-zA-Z0-9]/}},M=(e,t,n)=>e.replaceAll(t,``).replace(n,`.`).replace(`..`,`.`).replace(/[^.\\d]/g,``),We=(e,t,n)=>new Intl.NumberFormat(n.number?.locale??`en`,{minimumFractionDigits:e,maximumFractionDigits:t,roundingMode:`trunc`}),N=(e,t=!0,n)=>{let r=n.number?.unsigned!==!0&&e.startsWith(`-`)?`-`:``,i=n.number?.fraction??0,a=We(0,i,n),o=a.formatToParts(1000.12),s=o.find(e=>e.type===`group`)?.value??` `,c=o.find(e=>e.type===`decimal`)?.value??`.`,l=M(e,s,c);if(Number.isNaN(parseFloat(l)))return r;let u=l.split(`.`);u[1]!=null&&u[1].length>=1&&(a=We(u[1].length<=i?u[1].length:i,i,n));let d=a.format(parseFloat(l));return t?i>0&&l.endsWith(`.`)&&!l.slice(0,-1).includes(`.`)&&(d+=c):d=M(d,s,c),r+d},Ge=e=>JSON.parse(e.replaceAll(`\'`,`"`)),P=(e,t={})=>{let n={...t};e.dataset.maska!=null&&e.dataset.maska!==``&&(n.mask=I(e.dataset.maska)),e.dataset.maskaEager!=null&&(n.eager=F(e.dataset.maskaEager)),e.dataset.maskaReversed!=null&&(n.reversed=F(e.dataset.maskaReversed)),e.dataset.maskaTokensReplace!=null&&(n.tokensReplace=F(e.dataset.maskaTokensReplace)),e.dataset.maskaTokens!=null&&(n.tokens=L(e.dataset.maskaTokens));let r={};return e.dataset.maskaNumberLocale!=null&&(r.locale=e.dataset.maskaNumberLocale),e.dataset.maskaNumberFraction!=null&&(r.fraction=parseInt(e.dataset.maskaNumberFraction)),e.dataset.maskaNumberUnsigned!=null&&(r.unsigned=F(e.dataset.maskaNumberUnsigned)),(e.dataset.maskaNumber!=null||Object.values(r).length>0)&&(n.number=r),n},F=e=>e===``?!0:!!JSON.parse(e),I=e=>e.startsWith(`[`)&&e.endsWith(`]`)?Ge(e):e,L=e=>{if(e.startsWith(`{`)&&e.endsWith(`}`))return Ge(e);let t={};return e.split(`|`).forEach(e=>{let n=e.split(`:`);t[n[0]]={pattern:Ke()?new RegExp(n[1],`u`):new RegExp(n[1]),optional:n[2]===`optional`,multiple:n[2]===`multiple`,repeated:n[2]===`repeated`}}),t},Ke=()=>{try{return!0}catch{return!1}},qe=class{constructor(e={}){j(this,`opts`,{}),j(this,`memo`,new Map);let t={...e};if(t.tokens!=null){t.tokens=t.tokensReplace?{...t.tokens}:{...Ue,...t.tokens};for(let e of Object.values(t.tokens))typeof e.pattern==`string`&&(e.pattern=Ke()?new RegExp(e.pattern,`u`):new RegExp(e.pattern))}else t.tokens=Ue;Array.isArray(t.mask)&&(t.mask.length>1?t.mask=[...t.mask].sort((e,t)=>e.length-t.length):t.mask=t.mask[0]??``),t.mask===``&&(t.mask=null),this.opts=t}masked(e){return this.process(String(e),this.findMask(String(e)))}unmasked(e){return this.process(String(e),this.findMask(String(e)),!1)}isEager(){return this.opts.eager===!0}isReversed(){return this.opts.reversed===!0}completed(e){let t=this.findMask(String(e));if(this.opts.mask==null||t==null)return!1;let n=this.process(String(e),t).length;return typeof this.opts.mask==`string`?n>=this.opts.mask.length:n>=t.length}findMask(e){let t=this.opts.mask;if(t==null)return null;if(typeof t==`string`)return t;if(typeof t==`function`)return t(e);let n=this.process(e,t.slice(-1).pop()??``,!1);return t.find(t=>this.process(e,t,!1).length>=n.length)??``}escapeMask(e){let t=[],n=[];return e.split(``).forEach((r,i)=>{r===`!`&&e[i-1]!==`!`?n.push(i-n.length):t.push(r)}),{mask:t.join(``),escaped:n}}process(e,t,n=!0){if(this.opts.number!=null)return N(e,n,this.opts);if(t==null)return e;let r=`v=${e},mr=${t},m=${n?1:0}`;if(this.memo.has(r))return this.memo.get(r);let{mask:i,escaped:a}=this.escapeMask(t),o=[],s=this.opts.tokens==null?{}:this.opts.tokens,c=this.isReversed()?-1:1,l=this.isReversed()?`unshift`:`push`,u=this.isReversed()?0:i.length-1,d=this.isReversed()?()=>m>-1&&h>-1:()=>m<i.length&&h<e.length,ee=e=>!this.isReversed()&&e<=u||this.isReversed()&&e>=u,f,p=-1,m=this.isReversed()?i.length-1:0,h=this.isReversed()?e.length-1:0,g=!1;for(;d();){let t=i.charAt(m),r=s[t],d=r?.transform==null?e.charAt(h):r.transform(e.charAt(h));if(!a.includes(m)&&r!=null?(d.match(r.pattern)==null?r.multiple?g&&=(m+=c,h-=c,!1):d===f?f=void 0:r.optional&&(m+=c,h-=c):(o[l](d),r.repeated?(p===-1?p=m:m===u&&m!==p&&(m=p-c),u===p&&(m-=c)):r.multiple&&(g=!0,m-=c),m+=c),h+=c):(n&&!this.isEager()&&o[l](t),d===t&&!this.isEager()?h+=c:f=t,this.isEager()||(m+=c)),this.isEager())for(;ee(m)&&(s[i.charAt(m)]==null||a.includes(m));){if(n){if(o[l](i.charAt(m)),e.charAt(h)===i.charAt(m)){m+=c,h+=c;continue}}else i.charAt(m)===e.charAt(h)&&(h+=c);m+=c}}return this.memo.set(r,o.join(``)),this.memo.get(r)}},Je=class{constructor(e,t={}){j(this,`items`,new Map),j(this,`eventAbortController`),j(this,`onInput`,e=>{if(e instanceof CustomEvent&&e.type===`input`&&!e.isTrusted&&!e.bubbles)return;let t=e.target,n=this.items.get(t);if(n===void 0)return;let r=`inputType`in e&&e.inputType.startsWith(`delete`),i=n.isEager(),a=r&&i&&n.unmasked(t.value)===``?``:t.value;this.fixCursor(t,r,()=>this.setValue(t,a))}),this.options=t,this.eventAbortController=new AbortController,this.init(this.getInputs(e))}update(e={}){this.options={...e},this.init(Array.from(this.items.keys()))}updateValue(e){e.value!==``&&e.value!==this.processInput(e)?.masked&&this.setValue(e,e.value)}destroy(){this.eventAbortController.abort(),this.items.clear()}init(e){let t=this.getOptions(this.options);for(let n of e){if(!this.items.has(n)){let{signal:e}=this.eventAbortController;n.addEventListener(`input`,this.onInput,{capture:!0,signal:e})}let e=new qe(P(n,t));this.items.set(n,e),queueMicrotask(()=>this.updateValue(n)),n.selectionStart===null&&e.isEager()&&console.warn("Maska: input of `%s` type is not supported",n.type)}}getInputs(e){return typeof e==`string`?Array.from(document.querySelectorAll(e)):`length`in e?Array.from(e):[e]}getOptions(e){let{onMaska:t,preProcess:n,postProcess:r,...i}=e;return i}fixCursor(e,t,n){let r=e.selectionStart,i=e.value;if(n(),r===null||r===i.length&&!t)return;let a=e.value,o=i.slice(0,r),s=a.slice(0,r),c=this.processInput(e,o)?.unmasked,l=this.processInput(e,s)?.unmasked;if(c===void 0||l===void 0)return;let u=r;o!==s&&(u+=t?a.length-i.length:c.length-l.length),e.setSelectionRange(u,u)}setValue(e,t){let n=this.processInput(e,t);n!==void 0&&(e.value=n.masked,this.options.onMaska!=null&&(Array.isArray(this.options.onMaska)?this.options.onMaska.forEach(e=>e(n)):this.options.onMaska(n)),e.dispatchEvent(new CustomEvent(`maska`,{detail:n})),e.dispatchEvent(new CustomEvent(`input`,{detail:n.masked})))}processInput(e,t){let n=this.items.get(e);if(n===void 0)return;let r=t??e.value;this.options.preProcess!=null&&(r=this.options.preProcess(r));let i=n.masked(r);return this.options.postProcess!=null&&(i=this.options.postProcess(i)),{masked:i,unmasked:n.unmasked(r),completed:n.completed(r)}}},Ye={minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0},R=new Intl.NumberFormat(`en-US`,Ye);function Xe(e,t=`USD`,n=`currency`){return new Intl.NumberFormat(`en-US`,{style:n,currency:t,...Ye}).format(e)}function z(e){if(!e?.trim())return`—`;let t=e.trim();return t.startsWith(`#`)?t:`#${t}`}var Ze=(e,t)=>e.querySelector(`input[name="${t}"], select[name="${t}"]`),Qe=(e,t)=>{let n=e.querySelector(`button[type="submit"]`);if(n){n.disabled=t;let e=n.dataset.label??`Pagar`,r=n.dataset.loadingLabel??`Procesando...`;n.textContent=t?r:e}},B=e=>{e.reset();let t=e.querySelector(`select[name="documentType"]`);t&&(t.value=`dui`,t.dispatchEvent(new Event(`change`,{bubbles:!0})))},$e=(e,t,n)=>{let r=e.querySelector(`.form-alert`);r&&(r.innerHTML=`<h3>`+t+`</h3><p>`+n+`</p>`,r.classList.remove(`form-alert--receipt`),r.classList.add(`visible`))},et=(e,t)=>{let n=document.querySelector(`.form-header`);if(n){let e=n.querySelector(`.commerce-logo`);e&&(n.innerHTML=``,n.appendChild(e))}let r=document.querySelector(`.divider-header`);r&&(r.style.display=`none`);let i=t.data,a=Xe(i.amount_cents/100,i.amount_currency),o=`${i.date}, ${i.time}`,s=z(i.reference_number),c=z(i.authorization_number);e.innerHTML=`<div class="payment-success"><p class="payment-success__amount">`+a+`</p><p class="payment-success__datetime">`+o+`</p><div class="payment-success__blocks"><div class="payment-success__block"><span class="payment-success__label">Número de referencia</span><span class="payment-success__value">`+s+`</span></div><div class="payment-success__block"><span class="payment-success__label">Número de autorización</span><span class="payment-success__value">`+c+`</span></div></div><div class="payment-success__footer"><h3 class="payment-success__done">¡Gracias por tu compra!</h3></div></div>`},tt=(e,t,n)=>{let r=Ze(e,t);if(!r)return;let i=r.closest(`.input-wrapper`),a=i?.parentElement?.querySelector(`.field-error`);n?(i&&i.classList.add(`has-error`),a&&(a.textContent=n,a.classList.add(`visible`),nt(a))):(i&&i.classList.remove(`has-error`),a&&(a.textContent=``,a.classList.remove(`visible`)))},nt=e=>{e.scrollIntoView({behavior:`smooth`,block:`center`})},rt=e=>{let t=e.find(e=>e.name===`amount`);t&&(t.addEventListener(`input`,function(){let e=t.value.replace(/\\D/g,``);if(e){let n=parseInt(e,10)/100;t.value=R.format(n)}else t.value=``}),t.addEventListener(`blur`,()=>{parent.postMessage({type:`payment-form:validate-amount`,amount:t.value},`*`)}))},V=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await Be.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},H=e=>{let t=e.find(e=>e.name===`documentType`),n=e.find(e=>e.name===`billingDocumentNumber`);if(!t||!n)return;let r=new Je(n);t.addEventListener(`change`,function(e){r?.destroy(),e.target.value===`dui`?(n.setAttribute(`inputmode`,`numeric`),n.setAttribute(`data-maska`,`########-#`),r=new Je(n)):(n.removeAttribute(`inputmode`),n.removeAttribute(`data-maska`),n.value=``,r=null)})},U=e=>{e.forEach(function(e){e instanceof HTMLInputElement&&(e.addEventListener(`blur`,function(){let t=e.dataset.maskaValue||e.value;parent.postMessage({type:`payment-form:validate`,field:e.name,value:t},`*`)}),e.addEventListener(`input`,function(){let t=e.closest(`.input-wrapper`),n=t?.parentElement?.querySelector(`.field-error`);t&&t.classList.remove(`has-error`),n&&(n.textContent=``,n.classList.remove(`visible`))})),e instanceof HTMLSelectElement&&e.addEventListener(`change`,function(){parent.postMessage({type:`payment-form:validate`,field:e.name,value:e.value},`*`)})})},it=(e,t)=>{e.addEventListener(`submit`,function(e){e.preventDefault();let n={};t.forEach(function(e){n[e.name]=e.dataset.maskaValue||e.value}),parent.postMessage({type:`payment-form:submit`,value:n},`*`)})};function at(e=document.body){let t=new ResizeObserver(()=>{let{width:t,height:n}=e.getBoundingClientRect();parent.postMessage({type:`payment-form:sizing`,width:t,height:n},`*`)});return t.observe(e),t}var ot=Be.getInstance();new Je(`input[data-maska]:not([name="billingDocumentNumber"])`);var W=document.getElementById(`payment-form`),st=W.querySelectorAll(`input, select`),G=Array.from(st.values());rt(G),H(G);var K=G.find(e=>e.name===`country`),q=G.find(e=>e.name===`region`);if(K instanceof HTMLSelectElement){let e=V.getInstance();K.addEventListener(`change`,async function(){if(K.value===``)return;if(tt(W,`region`,``),q instanceof HTMLSelectElement){q.innerHTML=``;let e=document.createElement(`option`);e.value=``,e.textContent=`Cargando...`,q.appendChild(e),q.disabled=!0}let t=await e.fetchStates(K.value);if(q instanceof HTMLSelectElement&&(q.disabled=!1,q.innerHTML=``),`error`in t){let t=e.getStatesLoadError();t&&tt(W,`region`,t);return}if(e.setStates(t.data),parent.postMessage({type:`payment-form:states-loaded`,states:t.data},`*`),q instanceof HTMLSelectElement){let e=document.createElement(`option`);e.value=``,e.textContent=`Selecciona aquí`,q.appendChild(e),t.data.forEach(e=>{let t=document.createElement(`option`);t.value=e.id,t.textContent=e.name,q.appendChild(t)})}})}U(G),at(),window.addEventListener(`message`,function(e){if(!(!e.data||!e.data.type))switch(e.data.type){case`payment-form:set-submit-loading`:Qe(W,e.data.disabled);break;case`payment-form:reset`:B(W);break;case`payment-form:alert`:$e(W,e.data.title,e.data.message);break;case`payment-form:validation-result`:tt(W,e.data.field,e.data.error);break;case`payment-form:success`:et(W,e.data.paymentIntent);break;case`payment-form:set-token`:ot.setBearerToken(e.data.token);break;default:break}}),it(W,G)})();',nn=`data:image/svg+xml,%3csvg%20width='99'%20height='32'%20viewBox='0%200%2099%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M27.3848%200C29.8942%206.60543e-06%2031.9284%202.03883%2031.9284%204.55384V27.4462C31.9284%2029.9611%2029.8942%2032%2027.3848%2032H4.54376C2.03439%2032%203.69132e-05%2029.9611%200%2027.4462V4.55384C0%202.03882%202.03437%200%204.54376%200H27.3848ZM12.0067%205.0348C11.1292%205.03257%2010.3064%205.37037%209.68349%205.98797C9.0639%206.60335%208.70775%207.46498%208.70775%208.35337V15.4962C8.70775%2016.0154%209.12754%2016.4372%209.64666%2016.4372C10.1647%2016.4372%2010.5856%2016.0165%2010.5856%2015.4962V8.331C10.5856%207.95282%2010.7328%207.59689%2011.0008%207.32948C11.2676%207.06208%2011.6215%206.91564%2011.9978%206.91564H12.0023C12.7781%206.91791%2013.4099%207.56007%2013.4099%208.34774V13.5762C13.4099%2014.5508%2014.1982%2015.3407%2015.1705%2015.3407H18.1221C18.9695%2015.3407%2019.7934%2015.6518%2020.4119%2016.2325C21.0851%2016.8647%2021.4568%2017.7273%2021.4568%2018.647V21.6646C21.4568%2022.5473%2021.1141%2023.3776%2020.4901%2024.003C19.8672%2024.6274%2019.0387%2024.972%2018.1568%2024.972H14.0229C13.1689%2024.972%2012.3315%2024.67%2011.7063%2024.0871C11.0287%2023.4538%2010.6547%2022.5889%2010.6547%2021.6658V20.9799C10.6547%2020.7315%2010.7529%2020.4931%2010.9282%2020.3163L12.5169%2018.7242C12.6922%2018.5485%2012.93%2018.45%2013.1778%2018.45H15.6618C16.0067%2018.4501%2016.3449%2018.5688%2016.6005%2018.8004C16.8941%2019.0655%2017.056%2019.4314%2017.0549%2019.823C17.0527%2020.576%2016.4331%2021.188%2015.6729%2021.188H13.3161C12.7982%2021.188%2012.3774%2021.6087%2012.3774%2022.1289C12.3774%2022.6481%2012.797%2023.0699%2013.3161%2023.0699H15.6896C16.759%2023.0699%2017.755%2022.5518%2018.3813%2021.6355C18.6346%2021.2651%2018.8066%2020.841%2018.8825%2020.398C19.0666%2019.3273%2018.7339%2018.2823%2017.9949%2017.5338C17.3898%2016.9207%2016.5413%2016.5692%2015.6683%2016.5692H13.2045C12.9232%2016.5692%2012.643%2016.605%2012.3729%2016.6867C11.9196%2016.8243%2011.5189%2017.0638%2011.1884%2017.395L9.62652%2018.9614C9.4334%2019.1549%209.26156%2019.372%209.12983%2019.6115C8.89539%2020.0389%208.77596%2020.5021%208.77596%2020.981V21.6669C8.77597%2022.3673%208.91323%2023.0464%209.18337%2023.6864C9.44348%2024.304%209.81749%2024.859%2010.292%2025.3356C10.7664%2025.8112%2011.3202%2026.186%2011.9364%2026.4467C12.575%2026.7174%2013.2526%2026.855%2013.9514%2026.855H18.1546C18.8534%2026.855%2019.5311%2026.7174%2020.1696%2026.4467C20.7859%2026.1849%2021.3396%2025.8112%2021.8141%2025.3356C22.2885%2024.8601%2022.6626%2024.3052%2022.9227%2023.6876C23.1928%2023.0476%2023.3301%2022.3684%2023.3301%2021.668V18.6503C23.3301%2017.9499%2023.1928%2017.2708%2022.9227%2016.6309L22.9259%2016.6274C22.6647%2016.0098%2022.2918%2015.4549%2021.8174%2014.9794C21.3418%2014.5028%2020.7891%2014.1291%2020.1729%2013.8684C19.5343%2013.5976%2018.8567%2013.4598%2018.1579%2013.4598H15.2865V8.331C15.2865%207.46722%2014.9562%206.65034%2014.3545%206.03272C13.7416%205.40167%2012.8852%205.03816%2012.0067%205.0348Z'%20fill='%23121417'/%3e%3cpath%20d='M53.3405%2027.9622C52.2765%2027.9622%2051.291%2027.7244%2050.3858%2027.2507C49.4807%2026.7769%2048.7229%2026.121%2048.1143%2025.2809V25.8218C48.1143%2026.7616%2047.3527%2027.5249%2046.415%2027.5249C45.4773%2027.5249%2044.7157%2026.7616%2044.7157%2025.8218V5.70262C44.7157%204.76283%2045.4773%203.99949%2046.415%203.99949C47.3527%203.99949%2048.1143%204.76283%2048.1143%205.70262V15.6663C48.6789%2014.855%2049.408%2014.2202%2050.3055%2013.7656C51.201%2013.3092%2052.1904%2013.0809%2053.2735%2013.0809C54.6112%2013.0809%2055.8072%2013.4051%2056.8635%2014.0514C57.918%2014.6997%2058.7485%2015.5819%2059.3532%2016.6982C59.9579%2017.8144%2060.2603%2019.0898%2060.2603%2020.5206C60.2603%2021.9514%2059.9503%2023.2422%2059.3321%2024.3642C58.714%2025.4862%2057.8835%2026.3665%2056.8406%2027.0033C55.7995%2027.6419%2054.6322%2027.9603%2053.3405%2027.9603V27.9622ZM52.3722%2025.0489C53.218%2025.0489%2053.9663%2024.8552%2054.6169%2024.4677C55.2676%2024.0803%2055.7766%2023.5471%2056.1459%2022.8682C56.5133%2022.1892%2056.699%2021.4125%2056.699%2020.536C56.699%2019.6595%2056.5095%2018.8789%2056.1325%2018.1903C55.7555%2017.5018%2055.2427%2016.9648%2054.5978%2016.5754C53.951%2016.188%2053.2104%2015.9943%2052.3741%2015.9943C51.5378%2015.9943%2050.7877%2016.188%2050.1294%2016.5754C49.4692%2016.9628%2048.9525%2017.5018%2048.5813%2018.1903C48.2081%2018.8789%2048.0225%2019.6614%2048.0225%2020.536C48.0225%2021.4105%2048.2062%2022.1892%2048.5755%2022.8682C48.9449%2023.5471%2049.4577%2024.0803%2050.1179%2024.4677C50.7781%2024.8552%2051.5302%2025.0489%2052.376%2025.0489H52.3722Z'%20fill='%23121417'/%3e%3cpath%20d='M64.816%2010.647C64.4429%2010.647%2064.1003%2010.553%2063.7865%2010.367C63.4726%2010.1809%2063.2219%209.92969%2063.0363%209.61515C62.8488%209.30061%2062.7569%208.95154%2062.7569%208.56795C62.7569%208.18437%2062.8507%207.85256%2063.0363%207.54186C63.2219%207.23115%2063.4726%206.98374%2063.7865%206.79578C64.1003%206.60974%2064.4429%206.51576%2064.816%206.51576C65.1892%206.51576%2065.5413%206.60974%2065.8456%206.79578C66.1498%206.98374%2066.3967%207.23115%2066.5823%207.54186C66.7679%207.85256%2066.8617%208.19396%2066.8617%208.56795C66.8617%208.94195%2066.7679%209.30061%2066.5823%209.61515C66.3948%209.92969%2066.1498%2010.1809%2065.8456%2010.367C65.5413%2010.5549%2065.1968%2010.647%2064.816%2010.647ZM63.109%2025.8217V15.2213C63.109%2014.2815%2063.8707%2013.5182%2064.8084%2013.5182C65.746%2013.5182%2066.5077%2014.2815%2066.5077%2015.2213V25.8217C66.5077%2026.7615%2065.746%2027.5249%2064.8084%2027.5249C63.8707%2027.5249%2063.109%2026.7615%2063.109%2025.8217Z'%20fill='%23121417'/%3e%3cpath%20d='M70.9719%2025.4033L78.0104%2016.1569H71.7795C71.0523%2016.1569%2070.4629%2015.5662%2070.4629%2014.8374C70.4629%2014.1086%2071.0523%2013.5178%2071.7795%2013.5178H81.1736C82.2644%2013.5178%2082.8825%2014.7702%2082.2204%2015.6391L75.1724%2024.8835H82.1113C82.8385%2024.8835%2083.4279%2025.4743%2083.4279%2026.2031C83.4279%2026.9319%2082.8385%2027.5226%2082.1113%2027.5226H72.0187C70.9279%2027.5226%2070.3098%2026.2702%2070.9719%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3cpath%20d='M86.544%2025.4033L93.5824%2016.1569H87.3516C86.6244%2016.1569%2086.035%2015.5662%2086.035%2014.8374C86.035%2014.1086%2086.6244%2013.5178%2087.3516%2013.5178H96.7457C97.8365%2013.5178%2098.4546%2014.7702%2097.7925%2015.6391L90.7445%2024.8835H97.6834C98.4106%2024.8835%2099%2025.4743%2099%2026.2031C99%2026.9319%2098.4106%2027.5226%2097.6834%2027.5226H87.5908C86.5%2027.5226%2085.8819%2026.2702%2086.544%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3c/svg%3e`;function rn(e){let t=`<img src="${nn}" alt="Bizz Logo" class="bizz-logo">`;return en.replace(`<!--BIZZ_LOGO-->`,t).replace(`<!--HEADER-->`,e.headerHtml).replace(`<!--AMOUNT_FIELD-->`,e.amountHtml).replace(`<!--FIELDS-->`,e.fieldsHtml).replace(`<!--SUBMIT_BUTTON-->`,e.submitButtonHtml).replace(`<!--SCRIPT-->`,`<script>${tn}<\/script>`)}function an(e){let t=document.createElement(`iframe`);return t.style.border=`none`,t.style.display=`block`,t.style.overflow=`hidden`,t.srcdoc=e,t.style.width=`100%`,t.style.height=`100%`,t}var on=`<svg
|
|
378
379
|
xmlns="http://www.w3.org/2000/svg"
|
|
379
380
|
width="24"
|
|
380
381
|
height="24"
|
|
@@ -389,7 +390,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
389
390
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
390
391
|
<path d="M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2" />
|
|
391
392
|
<path d="M12 3v3m0 12v3" />
|
|
392
|
-
</svg>`,
|
|
393
|
+
</svg>`,sn=`<svg
|
|
393
394
|
xmlns="http://www.w3.org/2000/svg"
|
|
394
395
|
width="24"
|
|
395
396
|
height="24"
|
|
@@ -406,7 +407,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
406
407
|
<path d="M3 10l18 0" />
|
|
407
408
|
<path d="M7 15l.01 0" />
|
|
408
409
|
<path d="M11 15l2 0" />
|
|
409
|
-
</svg>`,
|
|
410
|
+
</svg>`,cn=`<svg
|
|
410
411
|
xmlns="http://www.w3.org/2000/svg"
|
|
411
412
|
width="24"
|
|
412
413
|
height="24"
|
|
@@ -425,7 +426,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
425
426
|
<path d="M4 11h16" />
|
|
426
427
|
<path d="M11 15h1" />
|
|
427
428
|
<path d="M12 15v3" />
|
|
428
|
-
</svg>`,
|
|
429
|
+
</svg>`,ln=`<svg
|
|
429
430
|
xmlns="http://www.w3.org/2000/svg"
|
|
430
431
|
width="24"
|
|
431
432
|
height="24"
|
|
@@ -441,5 +442,4 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
441
442
|
<path d="M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3" />
|
|
442
443
|
<path d="M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
|
443
444
|
<path d="M12 12l0 2.5" />
|
|
444
|
-
</svg>`,qt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-mail"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10" /><path d="M3 7l9 6l9 -6" /></svg>`,Jt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-user"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0" /><path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2" /></svg>`,Yt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-message-circle"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1" /></svg>`,Xt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-id"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10" /><path d="M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M15 8l2 0" /><path d="M15 12l2 0" /><path d="M7 16l10 0" /></svg>`,Zt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-device-mobile"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14" /><path d="M11 4h2" /><path d="M12 17v.01" /></svg>`,Qt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-map-pin"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" /><path d="M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0" /></svg>`,$t={"currency-dollar":Ut,"credit-card":Wt,calendar:Gt,"shield-lock":Kt,email:qt,user:Jt,description:Yt,document:Xt,phone:Zt,"map-pin":Qt};function en(e){let t=$t[e];if(!t)throw Error(`Icon "${e}" not found`);return t}var tn=class e{static instance;currentDate=new Date;currentYear=this.currentDate.getFullYear();currentMonth=this.currentDate.getMonth()+1;static getInstance(){return e.instance||=new e,e.instance}validateField(e,t){return this.inputRequired(t)||({amount:e=>this.amountInput(e),cardNumber:e=>this.cardNumberInput(e),cardExpiry:e=>this.cardExpiryInput(e),cardCvc:e=>this.cardCvcInput(e),email:e=>this.emailInput(e)}[e]?.(t)??``)}inputRequired(e){return e.trim()===``?`Este campo es requerido`:``}amountInput(e){return Number(e)<=0?`El monto debe ser mayor a 0`:``}cardNumberInput(e){let t=e.replace(/\s/g,``);return/^[0-9]{16}$/.test(t)?_t(t)===`not_valid`?`Por favor ingrese una tarjeta visa, mastercard o union_pay`:``:`Por favor, ingrese un número de tarjeta válido`}cardExpiryInput(e){let[t,n]=e.split(`/`),r=Number(this.currentYear.toString().slice(-2));return Number(n)<r?`El año de expiración no puede ser anterior al año actual`:Number(t)<1||Number(t)>12?`El mes de expiración debe estar entre 01 y 12`:Number(n)===r&&Number(t)<this.currentMonth?`La tarjeta está expirada`:``}emailInput(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?``:`Por favor, ingrese un email válido`}cardCvcInput(e){return/^[0-9]{3,4}$/.test(e)?``:`Por favor, ingrese un código de seguridad válido`}},nn=(e,t,n,r)=>Object.keys(t).map(i=>{let a=t[i],o=e.get(i);return{name:i,label:o?.label??a.label,placeholder:o?.placeholder??a.placeholder??a.label,iconSvg:en(a.icon),mask:a.mask,divider:a.divider,type:a.type??`text`,options:a.type===`select`?a.options:void 0,default:a.default,amountValue:n?Et(n/100,`USD`,`decimal`):void 0,disabled:i===`amount`?r:!1}}),rn=[{code:`51`,title:`¡Fondos insuficientes!`,message:`Intenta con otra tarjeta o confirma que tengas saldo disponible.`},{code:`04`,title:`¡Tarjeta bloqueada!`,message:`Contacta a tu banco o prueba con otra tarjeta.`},{code:`96`,title:`¡Sistema no disponible!`,message:`Vuelve a intentar en unos minutos.`},{code:`54`,title:`¡Tarjeta expirada!`,message:`Revisa la fecha de vencimiento o usa otra tarjeta.`},{code:`06`,title:`¡CVV no válido!`,message:`Verifica el código de seguridad e inténtalo de nuevo.`},{code:`99`,title:`¡Transacción inválida!`,message:`Revisa tus datos e inténtalo de nuevo.`}],an=e=>rn.find(t=>t.code===e)||{title:`¡Error al pagar!`,message:`Tu compra no pudo ser procesada!
|
|
445
|
-
Por favor revisa tu información e inténtalo de nuevo`,code:0},on={subtotal_cents:`amount`,billing_document_number:`billingDocumentNumber`,billing_email:`email`,card_network:`cardNumber`,cardholder_name:`cardHolder`,billing_name:`cardHolder`,country:`country`,description:`description`},sn=new Set([`iv`,`tag`,`encrypted_data`,`encrypted_key`]),cn=class{origin;constructor(e){this.origin=e}sendServerValidationErrors(e,t){if(typeof t==`string`||!e)return!1;let n=this.buildValidationResults(t);for(let t of n)e.postMessage({type:`payment-form:validation-result`,field:t.field,error:t.error},this.origin);return n.length>0}hasEncryptionPayloadErrors(e){return typeof e==`string`?!1:Object.keys(e).some(e=>sn.has(e))}resolveServerErrorMessage(e){return typeof e==`string`?e:`Por favor, revisa los campos`}buildValidationResults(e){let t=[];for(let[n,r]of Object.entries(e)){let e=on[n],i=Array.isArray(r)?r.find(e=>typeof e==`string`):void 0;!e||!i||t.push({field:e,error:i})}return t}},ln=class{config;iframe=null;messageHandler=null;successListeners=new Set;failureListeners=new Set;readyListeners=new Set;sizingListeners=new Set;validation=tn.getInstance();origin=u;serverErrorHandler;orchestrator=mt.getInstance();paymentIntent=kt.getInstance();countryContent=dt.getInstance();processPayment=Ct.getInstance();stateContent=gt.getInstance();amountEvaluation=Ot.getInstance();currentAmount;currentValues={};constructor(e){this.config=e,this.currentAmount=e.totalAmount,this.serverErrorHandler=new cn(this.origin)}on(e,t){e===`success`?this.successListeners.add(t):e===`failure`?this.failureListeners.add(t):e===`ready`?this.readyListeners.add(t):e===`sizing`&&this.sizingListeners.add(t)}async setup(){let e=document.querySelector(this.config.iframeTarget);if(!e)throw Error(`Element not found: ${this.config.iframeTarget}`);let t=wt();e.appendChild(t);try{await this.orchestrator.initialize(this.config.branchCode,this.config.paymentRequestCode)}catch(n){t.remove();let r=document.createElement(`div`);r.style.cssText=`font-family:Poppins,sans-serif;text-align:center;padding:32px;color:#DB3339;font-size:14px;`,r.textContent=n instanceof Error?n.message:`Pago no procesado`,e.appendChild(r);return}if(t.remove(),this.applyFixedAmountFromOrderTemplate(),this.renderForm(),this.messageHandler=async e=>{if(e.source!==this.iframe?.contentWindow)return;let t=e.data;if(t?.type){if(t.type===`payment-form:states-loaded`&&this.stateContent.setStates(t.states),t.type===`payment-form:sizing`&&(this.iframe&&(this.iframe.style.height=`${t.height}px`),this.sendSizingEmitter(t.width,t.height)),t.type===`payment-form:validate-amount`){this.currentAmount=Dt(t.amount),this.setSubmitLoading(!0);let e=await this.amountEvaluation.validateAmount(t.amount);if(this.setSubmitLoading(!1),e&&`data`in e){let t=this.orchestrator.getConfig();t.data.secure_mode!==e.data.secure_mode&&(t.data.secure_mode=e.data.secure_mode,this.renderForm())}}if(t.type===`payment-form:validate`){this.currentValues[t.field]=t.value;let e=this.validation.validateField(t.field,t.value);this.iframe?.contentWindow?.postMessage({type:`payment-form:validation-result`,field:t.field,error:e},this.origin)}if(t.type===`payment-form:submit`){t.value.amount&&(this.currentAmount=Dt(t.value.amount));let e=!1,n=Object.keys(t.value);for(let r of n){let n=this.validation.validateField(r,t.value[r]??``);n&&(e=!0,this.iframe?.contentWindow?.postMessage({type:`payment-form:validation-result`,field:r,error:n},this.origin))}if(!e){if(this.setSubmitLoading(!0),this.orchestrator.getConfig().data.secure_mode){try{await this.processPayment.process(t.value,this.config.totalAmount,{sendAlert:(e,t)=>this.sendAlert(e,t),sendSuccess:e=>this.sendSuccess(e),resetForm:()=>this.resetForm()})}catch{let e=`No pudimos obtener información de encriptación`;this.sendAlert(`¡Error al encriptar tus datos!`,e),this.sendFailureEmitter(0,e)}finally{this.setSubmitLoading(!1)}return}let e=await this.paymentIntent.generatePaymentIntentPayload(t.value).catch(e=>{this.setSubmitLoading(!1),this.sendAlert(`¡Error al cifrar tus datos!`,`Por favor, intenta nuevamente, o contacta al comercio.`)});if(!e)return;this.config.totalAmount&&(e.subtotal_cents=this.config.totalAmount);let n=await this.paymentIntent.createPaymentIntent(e);if(this.setSubmitLoading(!1),`error`in n&&`code`in n){if(n.status===422&&this.serverErrorHandler.hasEncryptionPayloadErrors(n.error)){let e=`Error al encriptar tus datos.`;this.sendAlert(`¡Error al encriptar tus datos!`,e),this.sendFailureEmitter(n.status,e);return}if(n.status===422&&this.serverErrorHandler.sendServerValidationErrors(this.iframe?.contentWindow,n.error)){this.sendFailureEmitter(n.status,`Por favor, revisa los campos`);return}n.code===`inactive_company_commerce`?this.sendAlert(`¡Comercio inactivo!`,`Tu compra no pudo ser procesada! El comercio no está disponible por el momento`):n.code===`payment_limit_exceeded`?this.sendAlert(`¡Límite de pago excedido!`,`Por favor, contacta al comercio.`):n.status===422?this.sendAlert(`¡Revisa la información!`,`Por favor, revisa los campos`):this.sendAlert(`¡Error al procesar el pago!`,`Por favor, intenta nuevamente, o contacta al comercio.`),this.sendFailureEmitter(n.status,this.serverErrorHandler.resolveServerErrorMessage(n.error));return}if(n.data.status!==`success`){let e=an(n.data.response_code??``);this.sendAlert(e.title,e.message),this.sendFailureEmitter(0,e.message);return}if(n.data.status===`success`){this.sendSuccess(n),this.resetForm();return}}}}},window.addEventListener(`message`,this.messageHandler),this.config.totalAmount&&Number(this.config.totalAmount)>0)try{this.setSubmitLoading(!0);let e=await this.amountEvaluation.validateAmount(this.config.totalAmount.toString());if(this.setSubmitLoading(!1),e&&`data`in e){let t=this.orchestrator.getConfig();t.data.secure_mode!==e.data.secure_mode&&(t.data.secure_mode=e.data.secure_mode,this.renderForm())}}catch{this.setSubmitLoading(!1),this.sendAlert(`¡Error al validar el monto!`,`Asegúrate de que el monto a pagar sea válido`)}}applyFixedAmountFromOrderTemplate(){if(!this.config.paymentRequestCode)return;let{data:e}=this.orchestrator.getConfig();if(e.order_template_id==null||typeof e.amount_cents!=`number`||e.amount_cents<=0)return;let t=Et(e.amount_cents/100,`USD`,`decimal`);this.config.description=e.description,this.config.totalAmount=Dt(t),this.currentAmount=Dt(t)}renderForm(){let e=document.querySelector(this.config.iframeTarget);if(!e)return;this.iframe&&this.iframe.remove();let t=new Map((this.config.i18n?.fields??[]).map(e=>[e.name,e])),n=this.orchestrator.getConfig().data.secure_mode?Pt:Nt,r=n.country;r&&`options`in r&&(r.options=[...r.options,...this.countryContent.getCountries().map(e=>({label:e.name,value:e.id}))]);let i=!!this.config.totalAmount,a=nn(t,n,this.currentAmount,i);a.forEach(e=>{this.currentValues[e.name]!==void 0&&e.name!==`amount`&&(e.default=this.currentValues[e.name])});let o=this.config.totalAmount?Et(this.config.totalAmount/100,`USD`,`decimal`):``,{amountHtml:s,fieldsHtml:c}=Lt(a);this.iframe=Ht(Vt({headerHtml:It({logo:this.orchestrator.getConfig().data.logo_url,name:this.orchestrator.getConfig().data.name,description:this.config.description,header:this.config.header,totalAmount:o,...o?{icon:en(`currency-dollar`)}:{}}),amountHtml:s,fieldsHtml:c,submitButtonHtml:Ft(this.config.i18n?.submitButton)})),e.appendChild(this.iframe),this.iframe.addEventListener(`load`,()=>{this.setToken(this.orchestrator.getAuthToken().access_token);let e=this.countryContent.getCountriesLoadError();e&&this.serverErrorHandler.sendServerValidationErrors(this.iframe?.contentWindow,{country:[e]}),this.sendReadyEmitter()})}resetForm(){this.iframe?.contentWindow?.postMessage({type:`payment-form:reset`},this.origin)}setSubmitLoading(e){this.iframe?.contentWindow?.postMessage({type:`payment-form:set-submit-loading`,disabled:e},this.origin)}setToken(e){this.iframe?.contentWindow?.postMessage({type:`payment-form:set-token`,token:e},this.origin)}sendAlert(e,t){this.iframe?.contentWindow?.postMessage({type:`payment-form:alert`,title:e,message:t},this.origin)}sendFailureEmitter(e,t){for(let n of this.failureListeners)n({status:e,message:t})}sendReadyEmitter(){for(let e of this.readyListeners)e()}sendSizingEmitter(e,t){for(let n of this.sizingListeners)n({width:e,height:t})}sendSuccess(e){this.config.totalAmount&&(e.data.amount_cents=this.config.totalAmount),this.iframe?.contentWindow?.postMessage({type:`payment-form:success`,paymentIntent:e},this.origin);let{id:t,status:n,amount_cents:r,response_code:i,authorization_number:a,reference_number:o}=e.data,s={id:t,status:n,amount_cents:r,response_code:i,authorization_number:a,reference_number:o};for(let e of this.successListeners)e(s)}destroy(){this.messageHandler&&=(window.removeEventListener(`message`,this.messageHandler),null),this.successListeners.clear(),this.failureListeners.clear(),this.readyListeners.clear(),this.sizingListeners.clear(),this.iframe&&=(this.iframe.remove(),null)}};exports.BizzPaymentForm=ln;
|
|
445
|
+
</svg>`,un=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-mail"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10" /><path d="M3 7l9 6l9 -6" /></svg>`,dn=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-user"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0" /><path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2" /></svg>`,fn=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-message-circle"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1" /></svg>`,pn=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-id"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10" /><path d="M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M15 8l2 0" /><path d="M15 12l2 0" /><path d="M7 16l10 0" /></svg>`,mn=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-device-mobile"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14" /><path d="M11 4h2" /><path d="M12 17v.01" /></svg>`,hn=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-map-pin"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" /><path d="M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0" /></svg>`,gn={"currency-dollar":on,"credit-card":sn,calendar:cn,"shield-lock":ln,email:un,user:dn,description:fn,document:pn,phone:mn,"map-pin":hn};function _n(e){let t=gn[e];if(!t)throw Error(`Icon "${e}" not found`);return t}var vn=class e{static instance;currentDate=new Date;currentYear=this.currentDate.getFullYear();currentMonth=this.currentDate.getMonth()+1;static getInstance(){return e.instance||=new e,e.instance}validateField(e,t){return this.inputRequired(t)||({amount:e=>this.amountInput(e),cardNumber:e=>this.cardNumberInput(e),cardExpiry:e=>this.cardExpiryInput(e),cardCvc:e=>this.cardCvcInput(e),email:e=>this.emailInput(e)}[e]?.(t)??``)}inputRequired(e){return e.trim()===``?`Este campo es requerido`:``}amountInput(e){return Number(e)<=0?`El monto debe ser mayor a 0`:``}cardNumberInput(e){let t=e.replace(/\s/g,``);return/^[0-9]{16}$/.test(t)?Ot(t)===`not_valid`?`Por favor ingrese una tarjeta visa, mastercard o union_pay`:``:`Por favor, ingrese un número de tarjeta válido`}cardExpiryInput(e){let[t,n]=e.split(`/`),r=Number(this.currentYear.toString().slice(-2));return Number(n)<r?`El año de expiración no puede ser anterior al año actual`:Number(t)<1||Number(t)>12?`El mes de expiración debe estar entre 01 y 12`:Number(n)===r&&Number(t)<this.currentMonth?`La tarjeta está expirada`:``}emailInput(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?``:`Por favor, ingrese un email válido`}cardCvcInput(e){return/^[0-9]{3,4}$/.test(e)?``:`Por favor, ingrese un código de seguridad válido`}},yn=(e,t,n,r)=>Object.keys(t).map(i=>{let a=t[i],o=e.get(i);return{name:i,label:o?.label??a.label,placeholder:o?.placeholder??a.placeholder??a.label,iconSvg:_n(a.icon),mask:a.mask,divider:a.divider,type:a.type??`text`,options:a.type===`select`?a.options:void 0,default:a.default,amountValue:n?Lt(n/100,`USD`,`decimal`):void 0,disabled:i===`amount`?r:!1}}),bn=class{config;iframe=null;messageHandler=null;successListeners=new Set;failureListeners=new Set;readyListeners=new Set;sizingListeners=new Set;validation=vn.getInstance();origin=u;serverErrorHandler;orchestrator=Tt.getInstance();paymentIntent=Ut.getInstance();countryContent=St.getInstance();processPayment=Pt.getInstance();stateContent=Dt.getInstance();amountEvaluation=zt.getInstance();currentAmount;currentValues={};constructor(e){this.config=e,this.currentAmount=e.totalAmount,this.serverErrorHandler=new Ht(this.origin)}on(e,t){e===`success`?this.successListeners.add(t):e===`failure`?this.failureListeners.add(t):e===`ready`?this.readyListeners.add(t):e===`sizing`&&this.sizingListeners.add(t)}async setup(){let e=document.querySelector(this.config.iframeTarget);if(!e)throw Error(`Element not found: ${this.config.iframeTarget}`);let t=Ft();e.appendChild(t);try{await this.orchestrator.initialize(this.config.branchCode,this.config.paymentRequestCode,this.config.environment)}catch(n){t.remove();let r=document.createElement(`div`);r.style.cssText=`font-family:Poppins,sans-serif;text-align:center;padding:32px;color:#DB3339;font-size:14px;`,r.textContent=n instanceof Error?n.message:`Pago no procesado`,e.appendChild(r);return}if(t.remove(),this.applyFixedAmountFromOrderTemplate(),this.renderForm(),this.messageHandler=async e=>{if(e.source!==this.iframe?.contentWindow)return;let t=e.data;if(t?.type){if(t.type===`payment-form:states-loaded`&&this.stateContent.setStates(t.states),t.type===`payment-form:sizing`&&(this.iframe&&(this.iframe.style.height=`${t.height}px`),this.sendSizingEmitter(t.width,t.height)),t.type===`payment-form:validate-amount`){this.currentAmount=Rt(t.amount),this.setSubmitLoading(!0);let e=await this.amountEvaluation.validateAmount(t.amount);if(this.setSubmitLoading(!1),e&&`data`in e){let t=this.orchestrator.getConfig();t.data.secure_mode!==e.data.secure_mode&&(t.data.secure_mode=e.data.secure_mode,this.renderForm())}}if(t.type===`payment-form:validate`){this.currentValues[t.field]=t.value;let e=this.validation.validateField(t.field,t.value);this.iframe?.contentWindow?.postMessage({type:`payment-form:validation-result`,field:t.field,error:e},this.origin)}if(t.type===`payment-form:submit`){t.value.amount&&(this.currentAmount=Rt(t.value.amount));let e=!1,n=Object.keys(t.value);for(let r of n){let n=this.validation.validateField(r,t.value[r]??``);n&&(e=!0,this.iframe?.contentWindow?.postMessage({type:`payment-form:validation-result`,field:r,error:n},this.origin))}if(!e){if(this.setSubmitLoading(!0),this.orchestrator.getConfig().data.secure_mode){try{await this.processPayment.process(t.value,this.config.totalAmount,{sendAlert:(e,t)=>this.sendAlert(e,t),sendSuccess:e=>this.sendSuccess(e),resetForm:()=>this.resetForm()})}catch{let e=`No pudimos obtener información de encriptación`;this.sendAlert(`¡Error al encriptar tus datos!`,e),this.sendFailureEmitter(0,e)}finally{this.setSubmitLoading(!1)}return}let e=await this.paymentIntent.generatePaymentIntentPayload(t.value).catch(e=>{this.setSubmitLoading(!1),this.sendAlert(`¡Error al cifrar tus datos!`,`Por favor, intenta nuevamente, o contacta al comercio.`)});if(!e)return;this.config.totalAmount&&(e.subtotal_cents=this.config.totalAmount);let n=await this.paymentIntent.createPaymentIntent(e);if(this.setSubmitLoading(!1),`error`in n&&`code`in n){if(n.status===422&&this.serverErrorHandler.hasEncryptionPayloadErrors(n.error)){let e=`Error al encriptar tus datos.`;this.sendAlert(`¡Error al encriptar tus datos!`,e),this.sendFailureEmitter(n.status,e);return}if(n.status===422&&this.serverErrorHandler.sendServerValidationErrors(this.iframe?.contentWindow,n.error)){this.sendFailureEmitter(n.status,`Por favor, revisa los campos`);return}n.code===`inactive_company_commerce`?this.sendAlert(`¡Comercio inactivo!`,`Tu compra no pudo ser procesada! El comercio no está disponible por el momento`):n.code===`payment_limit_exceeded`?this.sendAlert(`¡Límite de pago excedido!`,`Por favor, contacta al comercio.`):n.status===422?this.sendAlert(`¡Revisa la información!`,`Por favor, revisa los campos`):this.sendAlert(`¡Error al procesar el pago!`,`Por favor, intenta nuevamente, o contacta al comercio.`),this.sendFailureEmitter(n.status,this.serverErrorHandler.resolveServerErrorMessage(n.error));return}if(n.data.status!==`success`){let e=Gt(n.data.response_code??``);this.sendAlert(e.title,e.message),this.sendFailureEmitter(0,e.message);return}if(n.data.status===`success`){this.sendSuccess(n),this.resetForm();return}}}}},window.addEventListener(`message`,this.messageHandler),this.config.totalAmount&&Number(this.config.totalAmount)>0)try{this.setSubmitLoading(!0);let e=await this.amountEvaluation.validateAmount(this.config.totalAmount.toString());if(this.setSubmitLoading(!1),e&&`data`in e){let t=this.orchestrator.getConfig();t.data.secure_mode!==e.data.secure_mode&&(t.data.secure_mode=e.data.secure_mode,this.renderForm())}}catch{this.setSubmitLoading(!1),this.sendAlert(`¡Error al validar el monto!`,`Asegúrate de que el monto a pagar sea válido`)}}applyFixedAmountFromOrderTemplate(){if(!this.config.paymentRequestCode)return;let{data:e}=this.orchestrator.getConfig();if(e.order_template_id==null||typeof e.amount_cents!=`number`||e.amount_cents<=0)return;let t=Lt(e.amount_cents/100,`USD`,`decimal`);this.config.description=e.description,this.config.totalAmount=Rt(t),this.currentAmount=Rt(t)}renderForm(){let e=document.querySelector(this.config.iframeTarget);if(!e)return;this.iframe&&this.iframe.remove();let t=new Map((this.config.i18n?.fields??[]).map(e=>[e.name,e])),n=this.orchestrator.getConfig().data.secure_mode?Xt:Yt,r=n.country;r&&`options`in r&&(r.options=[...r.options,...this.countryContent.getCountries().map(e=>({label:e.name,value:e.id}))]);let i=!!this.config.totalAmount,a=yn(t,n,this.currentAmount,i);a.forEach(e=>{this.currentValues[e.name]!==void 0&&e.name!==`amount`&&(e.default=this.currentValues[e.name])});let o=this.config.totalAmount?Lt(this.config.totalAmount/100,`USD`,`decimal`):``,{amountHtml:s,fieldsHtml:c}=$t(a);this.iframe=an(rn({headerHtml:Qt({logo:this.orchestrator.getConfig().data.logo_url,name:this.orchestrator.getConfig().data.name,description:this.config.description,header:this.config.header,totalAmount:o,...o?{icon:_n(`currency-dollar`)}:{}}),amountHtml:s,fieldsHtml:c,submitButtonHtml:Zt(this.config.i18n?.submitButton)})),e.appendChild(this.iframe),this.iframe.addEventListener(`load`,()=>{this.setToken(this.orchestrator.getAuthToken().access_token);let e=this.countryContent.getCountriesLoadError();e&&this.serverErrorHandler.sendServerValidationErrors(this.iframe?.contentWindow,{country:[e]}),this.sendReadyEmitter()})}resetForm(){this.iframe?.contentWindow?.postMessage({type:`payment-form:reset`},this.origin)}setSubmitLoading(e){this.iframe?.contentWindow?.postMessage({type:`payment-form:set-submit-loading`,disabled:e},this.origin)}setToken(e){this.iframe?.contentWindow?.postMessage({type:`payment-form:set-token`,token:e},this.origin)}sendAlert(e,t){this.iframe?.contentWindow?.postMessage({type:`payment-form:alert`,title:e,message:t},this.origin)}sendFailureEmitter(e,t){for(let n of this.failureListeners)n({status:e,message:t})}sendReadyEmitter(){for(let e of this.readyListeners)e()}sendSizingEmitter(e,t){for(let n of this.sizingListeners)n({width:e,height:t})}sendSuccess(e){this.config.totalAmount&&(e.data.amount_cents=this.config.totalAmount),this.iframe?.contentWindow?.postMessage({type:`payment-form:success`,paymentIntent:e},this.origin);let{id:t,status:n,amount_cents:r,response_code:i,authorization_number:a,reference_number:o}=e.data,s={id:t,status:n,amount_cents:r,response_code:i,authorization_number:a,reference_number:o};for(let e of this.successListeners)e(s)}destroy(){this.messageHandler&&=(window.removeEventListener(`message`,this.messageHandler),null),this.successListeners.clear(),this.failureListeners.clear(),this.readyListeners.clear(),this.sizingListeners.clear(),this.iframe&&=(this.iframe.remove(),null)}};exports.BizzPaymentForm=bn;
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export declare class BizzPaymentForm {
|
|
|
39
39
|
destroy(): void;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
declare type Environment = 'production' | 'sandbox';
|
|
43
|
+
|
|
42
44
|
declare interface FormCustomHeader {
|
|
43
45
|
logo?: boolean;
|
|
44
46
|
description?: boolean;
|
|
@@ -55,6 +57,7 @@ export declare interface PaymentFormConfig {
|
|
|
55
57
|
description?: string;
|
|
56
58
|
totalAmount?: number;
|
|
57
59
|
header?: boolean | FormCustomHeader;
|
|
60
|
+
environment?: Environment;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
declare type PaymentFormEventMap = {
|