')},wt=function(t){var e=xt[t];return e?e.schemeName:void 0};function Ot(t){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function It(t,e){for(var n=0;n')}(t)+function(t){return function(e){var n=e.child;return'")}}(t)({child:''+r})}(t,i.imageUrl)})).join(" "),e)?document.getElementById(e).checked=!0:document.getElementById(t[0]).checked=!0})),this.env=e,this.appUrl=this.env.APP_URL,this.imageUrl=(r=this.appUrl,o=r.replace(/[/]+$/,""),"".concat(o,"/img/")),this.onValueChange=a,this.previousState=function(t){for(var e=1;e2?n-2:0),o=2;o=P.CARTES_BANCAIRES_VALIDATION_BIN_LENGTH,l=!!a.lastResolvedBin;if(!f||!e)return a.lastResolvedBin=void 0,a.latestInFlightBin=void 0,a.schemes={},l&&D({onValueChange:i,isDisplayed:!1}),_;var p=s.substring(0,P.CARTES_BANCAIRES_VALIDATION_BIN_LENGTH);if(function(t,e){var n=t.lastResolvedBin===e,r=t.latestInFlightBin===e;return n||r}(a,p))return C;var d=new XMLHttpRequest;d.open("GET",r+"/card-metadata?bin="+p,!0),d.onload=function(){var t=JSON.parse(d.response);!function(t,e){t.binsInFlight=t.binsInFlight.filter((function(t){return t!==e}))}(a,p),a.latestInFlightBin!==p||(a.latestInFlightBin=void 0,200===d.status?M({response:t,state:a,bin:p,onValueChange:i}):(404===d.status&&(a.lastResolvedBin=p),D({onValueChange:i,isDisplayed:!1})))},a.binsInFlight||(a.binsInFlight=[]),a.binsInFlight.includes(p)||(d.send(),a.binsInFlight.push(p)),a.latestInFlightBin=p}({changedValue:i,appState:r.state,appUrl:r.appUrl,onValueChange:null===(n=r.schemeChoice)||void 0===n?void 0:n.toggleElementVisibility});r.state.value=c(s),r.input.value=s,r.state.bin=function(t){return t&&t.length>=8?t.slice(0,8):""}(r.state.value),r.state.scheme=St(r.state.value),r.state.scheme!==r.previousState.scheme&&(r.previousState.scheme=r.state.scheme,r.emitPaymentMethodChanged(r.state.scheme),r.state.cvvHidden||l(t.ELEMENT_FRAMES.CVV,{message:t.EVENTS.PAYMENT_METHOD_CHANGED,scheme:r.state.scheme})),r.updateValidationStatus(),function(t){var e,n=t.target;"data"in t||!n.value?function(t){if(t.isAutofilled){t.isAutofilled=!1,t.classList.remove("field--autofilled");var e=t.parentElement,n=t.value;"FORM"===e.tagName&&e.classList.contains("frames-element")&&(e.reset(),t.value=n)}}(n):(e=n).isAutofilled||(e.isAutofilled=!0,e.classList.add("field--autofilled"))}(e),f(t.ELEMENTS.CARD_NUMBER,{event:t.EVENTS.VALUE_CHANGED,value:r.state.value,validationStatus:r.state.validationStatus,previousValidationStatus:r.previousState.validationStatus}),r.state.bin&&r.state.bin!==r.previousState.bin&&(r.previousState.bin=r.state.bin,r.emitCardBinChanged(r.state.scheme)),function(t){if(L&&H(t)){var e=t.value.length;t.setSelectionRange(e,e)}}(r.input)})),Gt(this,"emitPaymentMethodChanged",(function(e){p(t.EVENTS.PAYMENT_METHOD_CHANGED,{isValid:r.state.validationStatus===t.VALIDATION_STATUSES.VALID,paymentMethod:e,isPaymentMethodAccepted:!r.acceptedPaymentMethods||r.acceptedPaymentMethods.indexOf(e)>=0})})),Gt(this,"emitCardBinChanged",(function(e){var n=N(r.state.cardMetadata.schemes);p(t.EVENTS.CARD_BIN_CHANGED,{bin:r.state.bin,isCoBadged:n,scheme:e})})),Gt(this,"onMouseOver",(function(){var t,e;t=r.input,e=F("card-number").hover,t.classList.add(e)})),Gt(this,"onMouseOut",(function(){var t,e;t=r.input,e=F("card-number").hover,t.classList.remove(e)})),Gt(this,"onFocus",(function(){var e,n;f(t.ELEMENTS.CARD_NUMBER,{event:t.EVENTS.FRAME_FOCUS,validationStatus:r.state.validationStatus}),e=r.input,n=F("card-number").focus,e.classList.add(n)})),Gt(this,"onBlur",(function(){f(t.ELEMENTS.CARD_NUMBER,{event:t.EVENTS.FRAME_BLUR,validationStatus:r.state.validationStatus}),function(t,e){var n=e===V;t.setAttribute("aria-invalid",n.toString())}(r.input,r.state.validationStatus),function(t,e,n){var r=t.classList,o=F(e),i=o.focus,a=o.invalid,c=o.valid;switch(r.remove(i),n.validationStatus){case R:r.remove(c),r.remove(a);break;case k:r.add(c),r.remove(a);break;case V:r.remove(c),r.add(a)}}(r.input,"card-number",r.state)})),Gt(this,"onReceiveMessage",(function(e){var n=e.data.data,o=n.message,i=n.style,a=n.value,c=n.element;switch(o){case"initial-config":i&&function(e){var n=e.style,r=e.element,o=e.isSchemeChoiceEnabled,i=document.getElementById("custom-style"),a=b(n,r);o&&(a+=E(n,t.ELEMENTS.SCHEME_CHOICE)),i.innerHTML=a}({style:i,element:t.ELEMENTS.CARD_NUMBER,isSchemeChoiceEnabled:r.isSchemeChoiceEnabled});break;case"clear":r.state.value="";break;case"forceFocus":r.input.focus();break;case"forceBlur":r.onBlur();break;case"autofilled":!function(t,e){e&&(t.value=e,t.dispatchEvent(new Event("input")),t.dispatchEvent(new Event("blur")))}(r.input,a);break;case t.EVENTS.VALUE_CHANGED:if(c===t.ELEMENTS.SCHEME_CHOICE){var u;r.state.chosenScheme=a;var s=r.state.chosenScheme||(null===(u=r.state.cardMetadata.schemes)||void 0===u?void 0:u.scheme),f=wt(s)||r.state.scheme;r.emitPaymentMethodChanged(f),r.emitCardBinChanged(f)}}})),this.input=document.getElementById("checkout-frames-card-number");var i=Y(n),s=i.MODES,d=i.acceptedPaymentMethods,v=i.isSchemeChoiceEnabled,h=i.APP_URL;this.appUrl=h,this.isSchemeChoiceEnabled=v,this.copyPasteDisabled=j(s,t.FRAMES_MODES.DISABLE_COPY_PASTE),this.state.cvvHidden=j(s,t.FRAMES_MODES.CVV_HIDDEN),this.isSchemeChoiceEnabled&&(this.schemeChoice=new Bt(i)),j(s,t.FRAMES_MODES.RIGHT_TO_LEFT)&&this.input.parentNode.setAttribute("dir","rtl"),d&&d.length>0&&(this.acceptedPaymentMethods=d),this.registerEventHandlers(),this.previousState=function(t){for(var e=1;e