@nordhealth/provet-pay-elements 0.18.0 → 0.18.1

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.
@@ -3,6 +3,6 @@
3
3
  About to set up securedField:`,r),await this.setupSecuredField(r,e,n).catch(i=>{window._b$dl&&console.log("Secured fields setup failure. e=",i)}),window._b$dl&&console.log("Finished setting up securedField:",r)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const o={type:this.state.type,rootNode:this.props.rootNode,brand:a,cvcPolicy:e,expiryDatePolicy:n,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(o)},0)}}function Al(t,e,n){return new Promise((a,o)=>{const r=ua(t,this.encryptedAttrName);r===Q&&(this.state.hasSeparateDateFields=!0);const i={fieldType:r,extraFieldData:ua(t,Ii),uid:ua(t,$i),cvcPolicy:e,holderEl:t,expiryDatePolicy:n,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},s=new vl(i,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new z("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.
4
4
  iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(s.loadToConfigTimeout=setTimeout(()=>{o({type:i.fieldType,failReason:"sf took too long to config"})},jc),this.state.iframeCount===this.state.originalNumIframes){const d={iframesLoaded:!0};this.callbacks.onLoad(d)}}).onConfig(d=>{this.handleIframeConfigFeedback(d),clearTimeout(s.loadToConfigTimeout),s.loadToConfigTimeout=null,a(d)}).onFocus(d=>{this.handleFocus(d)}).onBinValue(d=>{this.handleBinValue(d)}).onTouchstart(d=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||d.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:d.fieldType}),(d.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:d.fieldType,fieldClick:!0})}).onShiftTab(d=>{this.handleSFShiftTab(d.fieldType)}).onEncryption(d=>{this.handleEncryption(d)}).onValidation(d=>{this.handleValidation(d)}).onAutoComplete(d=>{this.processAutoComplete(d)}).onKeyPressed(d=>{const u=d,{numKey:l}=u,h=Ce(u,["numKey"]);this.callbacks.onKeyPressed(h)});this.state.securedFields[r]=s})}var ht={__IS_IE:typeof navigator!="undefined"&&(function(){const t=navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){const a=t.indexOf("rv:");return parseInt(t.substring(a+3,t.indexOf(".",a)),10)}const n=t.indexOf("Edge/");return n>0&&parseInt(t.substring(n+5,t.indexOf(".",n)),10)})(),__IS_IOS:typeof navigator!="undefined"&&/iphone|ipod|ipad/i.test(navigator.userAgent),__IS_FIREFOX:typeof navigator!="undefined"&&/(firefox)/i.test(navigator.userAgent)},En={touchendListener:function(t){const e=t.target;if(e instanceof HTMLInputElement||HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){const a=e.value;let o="selectionStart"in(n=e)?n.selectionStart:0,r=!1;o===a.length&&(o-=1,r=!0),e.value=a;try{e.setSelectionRange&&(e.focus(),e.setSelectionRange(o,o),r&&(o+=1,setTimeout(()=>{e.setSelectionRange(o,o)},0)))}catch(i){}}else if(this.config.keypadFix){const a=this.props.rootNode,o=document.createElement("input");o.style.width="1px",o.style.height="1px",o.style.opacity="0",o.style.fontSize="18px",a.appendChild(o),o.focus(),a.removeChild(o)}var n;this.destroyTouchendListener(),this.state.registerFieldForIos=!1,this.postMessageToAllIframes({fieldType:"webInternalElement",fieldClick:!0})},touchstartListener:function(t){var n,a,o;this.hasGenuineTouchEvents=!0;const e=t.target;if(e instanceof HTMLInputElement||e instanceof HTMLSpanElement){this.postMessageToAllIframes({fieldType:"webInternalElement",checkoutTouchEvent:!0});const r=(n=e.getAttribute("name"))!=null?n:e.getAttribute("data-id");(o=(a=this.callbacks).onTouchstartIOS)==null||o.call(a,{fieldType:"webInternalElement",name:r})}},handleTouchend:function(){const t=kt(document,"body");t.style.cursor="pointer",Cn(t,"touchend",this.touchendListener),this.state.registerFieldForIos=!0},destroyTouchendListener:function(){if(!ht.__IS_IOS)return!1;const t=kt(document,"body");return t.style.cursor="auto",Sn(t,"touchend",this.touchendListener),!0},destroyTouchstartListener:function(){return!!ht.__IS_IOS&&(Sn(document,"touchstart",this.touchstartListener),!0)}};const Tn=(t,e,n)=>((a,o=!0)=>{const r=Array.prototype.slice.call(Vi(document,"*[data-cse], a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), object, embed, *[tabindex], *[contenteditable]")),i=[];r.forEach(d=>{const l=d.getAttribute("tabindex"),h=!l||parseInt(l,10)>=0,u=d.getBoundingClientRect(),y=u.width>0&&u.height>0;h&&y&&i.push(d)});const s=((d,l)=>{for(let h=0;h<d.length;h+=1)if(l(d[h]))return h;return-1})(i,d=>d===a||a.contains(d));return i[s+(o?-1:1)]})(kt(e,`[data-cse=${t}]`),n),Dl=t=>{t&&(t.focus(),t.blur(),t.focus())};function Il(t,e,n,a){let o,r;switch(t){case V:o=Tn(V,e);break;case q:case re:r=V;break;case Q:r=re;break;case H:a===1?o=Tn(H,e):r=n?Q:q}return{fieldToFocus:r,additionalField:o}}function $l(t,e){let n,a;switch(t){case V:n=Tn(V,e);break;case H:a=V}return{fieldToFocus:a,additionalField:n}}function Rl(t,e,n){let a,o;switch(t){case V:a=Tn(V,e);break;case q:case re:o=V;break;case Q:o=re;break;case H:o=n?Q:q;break;case tt:a=Tn(t,e)}return{fieldToFocus:o,additionalField:a}}var Ki={handleShiftTab:function(t){let e;this.state.type==="giftcard"?e=$l(t,this.props.rootNode):e=this.state.isKCP?Rl(t,this.props.rootNode,this.state.hasSeparateDateFields):Il(t,this.props.rootNode,this.state.hasSeparateDateFields,this.state.numIframes);const n=e.fieldToFocus,a=e.additionalField;n?this.setFocusOnFrame(n,!1):a&&Dl(a)},handleSFShiftTab:function(t){(ht.__IS_FIREFOX||ht.__IS_IE&&ht.__IS_IE<=11)&&this.handleShiftTab(t)}};function Fl(t){if(Y(this.state.securedFields,V)){const e=C(p({txVariant:this.state.type},t),{fieldType:V,numKey:this.state.securedFields[V].numKey});at(e,pt(this.state,V),this.config.loadingContext)}}function Ol(t){(Y(this.state.securedFields,re)&&Y(this.state.securedFields,Q)?[re,Q]:[q]).forEach(e=>{const n=C(p({txVariant:this.state.type},t),{fieldType:e,numKey:this.state.securedFields[e].numKey});at(n,pt(this.state,e),this.config.loadingContext)})}function Ml(t,e){var s,d;const n=this.state.type==="card";if(!t||!Object.keys(t).length)return n?(this.sendBrandToCardSF({brand:"reset"}),this.sendExpiryDatePolicyToSF({expiryDatePolicy:Et})):e&&this.processBrand(C(p({},e),{fieldType:V})),void(this.state.type==="card"&&Y(this.state.securedFields,q)&&(this.state.securedFields[q].expiryDatePolicy=Et));const a=t.supportedBrands[0],o=a.brand,r=(s=a.expiryDatePolicy)!=null?s:a.showExpiryDate===!0?Et:en,i={brand:o,cvcPolicy:a.cvcPolicy,expiryDatePolicy:r,cvcText:"Security code",showSocialSecurityNumber:(d=a.showSocialSecurityNumber)!=null?d:!1,fieldType:V,mode:Kc};if(this.processBrand(i),n){const l=p({brand:o,enableLuhnCheck:t.supportedBrands[0].enableLuhnCheck!==!1},(a==null?void 0:a.panLength)&&!t.isDualBrandSelection&&{panLength:a==null?void 0:a.panLength});this.sendBrandToCardSF(l),this.sendExpiryDatePolicyToSF({expiryDatePolicy:r})}Y(this.state.securedFields,H)&&(this.state.securedFields[H].cvcPolicy=a.cvcPolicy),Y(this.state.securedFields,q)?this.state.securedFields[q].expiryDatePolicy=r:Y(this.state.securedFields,re)&&Y(this.state.securedFields,Q)&&(this.state.securedFields[re].expiryDatePolicy=r,this.state.securedFields[Q].expiryDatePolicy=r),this.validateForm()}function Ll({csfState:t,csfConfig:e},n,a){if(!Y(t.securedFields,n))return;const o={txVariant:t.type,fieldType:n,focus:!0,numKey:t.securedFields[n].numKey};at(o,pt(t,n),e.loadingContext)}function Bl({csfState:t,csfConfig:e},n){const a=Object.keys(n||{});return a.length?(Object.keys(t.securedFields).forEach(o=>{const r={txVariant:t.type,fieldType:o,numKey:t.securedFields[o].numKey};a.forEach(i=>{r[i]=n[i]}),at(r,pt(t,o),e.loadingContext)}),!0):!1}function Vl({csfState:t,csfConfig:e,csfProps:n,csfCallbacks:a},o){if(o.fieldType===V){const s={brand:o.brand,cvcPolicy:o.cvcPolicy,expiryDatePolicy:o.expiryDatePolicy,showSocialSecurityNumber:o.showSocialSecurityNumber},d=(r=s,i=t.brand,!zi(r,i));if(!d)return null;const l=t.type==="card"||t.type==="bcmc";if(l&&d&&(t.brand=s,Y(t.securedFields,H))){const u={txVariant:t.type,brand:s.brand,fieldType:H,cvcPolicy:o.cvcPolicy,numKey:t.securedFields[H].numKey};at(u,pt(t,H),e.loadingContext)}const h=l?go(["brand","cvcPolicy","cvcText","expiryDatePolicy","showSocialSecurityNumber","mode"]).from(o):null;if(h&&h.brand){const u=h;u.type=t.type,u.rootNode=n.rootNode,a.onBrand(u)}return!0}var r,i;return!1}function zl({csfState:t,csfConfig:e,csfCallbacks:n},a){if(a.name==="cc-name"){const o=p({},a);delete o.numKey;const r=o;return n.onAutoComplete(r),!0}if(a.name==="cc-exp"){const o=a.value.replace(/[^0-9]/gi,"/").split("/");if(o.length!==2)return!1;o[0].length===1&&(o[0]=`0${o[0]}`);const r=o[0],i=o[1];if(!(((i==null?void 0:i.length)===4||(i==null?void 0:i.length)===2)&&!isNaN(parseInt(i))))return!1;const s=i.slice(-2),d=`${r}/${s}`;if(Y(t.securedFields,q)){const l={txVariant:t.type,fieldType:q,autoComplete:d,numKey:t.securedFields[q].numKey};return at(l,pt(t,q),e.loadingContext),!0}if(Y(t.securedFields,re)){const l={txVariant:t.type,fieldType:re,autoComplete:r,numKey:t.securedFields[re].numKey};at(l,pt(t,re),e.loadingContext)}return Y(t.securedFields,Q)&&setTimeout(()=>{const l={txVariant:t.type,fieldType:Q,autoComplete:s,numKey:t.securedFields[Q].numKey};at(l,pt(t,Q),e.loadingContext)},0),!0}return!1}function Ul({csfState:t,csfProps:e,csfCallbacks:n},a,o){const r=p({},o);delete r.numKey,r.rootNode=e.rootNode,r.type=t.type;const i=r.fieldType;r.focus?t.currentFocusObject!==i&&(t.currentFocusObject=i,ht.__IS_IOS&&!t.registerFieldForIos&&a()):t.currentFocusObject===i&&(t.currentFocusObject=null);const s=r;s.currentFocusObject=t.currentFocusObject,n.onFocus(s)}function jl({csfState:t,csfCallbacks:e},n,a){if(t.iframeConfigCount+=1,window._b$dl&&console.log("### handleIframeConfigFeedback::csfState.iframeConfigCount:: ",t.iframeConfigCount,"who=",a.fieldType),t.isConfigured){const o={additionalIframeConfigured:!0,fieldType:a.fieldType,type:t.type};e.onAdditionalSFConfig(o)}else if(t.iframeConfigCount===t.originalNumIframes)return n(),!0;return!1}function Kl({csfState:t,csfConfig:e,csfProps:n,csfCallbacks:a},o){var i;t.isConfigured=!0;const r={iframesConfigured:!0,type:t.type,rootNode:n.rootNode};if(a.onConfigSuccess(r),t.numIframes===1&&e.isCreditCardType){if(t.type==="card")return ko("ERROR: Payment method with a single secured field - but 'brands' has not been set to an array containing the specific card brand"),!1;const s=wo.getCardByBrand(t.type);s&&((i=s.cvcPolicy)!=null?i:It)!==It&&o()}return!0}function Hl({csfState:t,csfProps:e,csfCallbacks:n}){const a=(i=>{const s=Object.keys(i);for(let d=0,l=s.length;d<l;d+=1)if(!i[s[d]].isValid)return!1;return!0})(t.securedFields),o=a!==t.allValid;if(t.allValid=a,!a&&!o)return;const r={allValid:a,type:t.type,rootNode:e.rootNode};n.onAllValid(r)}function ql({csfState:t,csfCallbacks:e},n){const{binValue:a,encryptedBin:o,uuid:r}=n,i={binValue:a,type:t.type};o&&(i.encryptedBin=o,i.uuid=r),e.onBinValue(i)}function Wl(){this.postMessageToAllIframes({destroy:!0}),Object.keys(this.state.securedFields).forEach(t=>{const e=this.state.securedFields[t];e&&e.destroy(),this.state.securedFields[t]=null}),this.destroyTouchendListener(),this.destroyTouchstartListener(),this.state.securedFields={}}const Nn=(t="You cannot use secured fields")=>{Bt(`${t} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`)};class Gl extends Qc{init(){this.configHandler(this.props),this.callbacksHandler(this.props.callbacks);const e=this.createSecuredFields();this.state.numIframes=this.state.originalNumIframes=e,this.state.isKCP=!!this.props.isKCP,ht.__IS_IOS&&this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents=!1,Cn(document,"touchstart",this.touchstartListener))}createReturnObject(){return{updateStyles:e=>{this.state.isConfigured?this.postMessageToAllIframes({styleObject:e}):Bt("You cannot update the secured fields styling - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.")},setFocusOnFrame:e=>{this.state.isConfigured?this.setFocusOnFrame(e):Nn("You cannot set focus on any secured field")},isValidated:(e,n)=>{if(this.state.isConfigured){if(Y(this.state.securedFields,e)){this.state.securedFields[e].hasError=!0,this.state.securedFields[e].errorType===""&&(this.state.securedFields[e].errorType="isValidated");const a={txVariant:this.state.type,fieldType:e,externalValidation:!0,code:n,numKey:this.state.securedFields[e].numKey};at(a,pt(this.state,e),this.config.loadingContext)}}else Nn("You cannot set validated on any secured field")},hasUnsupportedCard:(e,n)=>{if(this.state.isConfigured){if(Y(this.state.securedFields,e)){this.state.securedFields[e].hasError=!!n,this.state.securedFields[e].errorType=n;const a={txVariant:this.state.type,fieldType:e,unsupportedCard:!!n,code:n,numKey:this.state.securedFields[e].numKey};at(a,pt(this.state,e),this.config.loadingContext)}}else Nn("You cannot set hasUnsupportedCard on any secured field")},destroy:()=>{this.state.isConfigured?this.destroySecuredFields():Nn("You cannot destroy secured fields")},brandsFromBinLookup:(e,n)=>{if(!this.config.isCreditCardType)return null;this.state.isConfigured?this.handleBrandFromBinLookup(e,n):Nn("You cannot set pass brands to secured fields")},addSecuredField:e=>{const n=kt(this.props.rootNode,`[data-cse="${e}"]`);n&&(this.state.numIframes+=1,this.setupSecuredField(n))},removeSecuredField:e=>{if(this.state.securedFields[e]){this.state.securedFields[e].destroy(),delete this.state.securedFields[e],this.state.numIframes-=1,this.state.iframeCount-=1;const n={additionalIframeRemoved:!0,fieldType:e,type:this.state.type};this.callbacks.onAdditionalSFRemoved(n)}},setKCPStatus:e=>{this.state.isKCP=e},sfIsOptionalOrHidden:e=>this.state.securedFields[e].isOptionalOrHidden()}}constructor(e){super(e),this.state={type:this.props.type,brand:this.props.type!=="card"?{brand:this.props.type,cvcPolicy:"required"}:{brand:null,cvcPolicy:"required"},allValid:void 0,numIframes:0,originalNumIframes:0,iframeCount:0,iframeConfigCount:0,isConfigured:!1,hasSeparateDateFields:!1,currentFocusObject:null,registerFieldForIos:!1,securedFields:{},isKCP:!1};const n={csfState:this.state,csfConfig:this.config,csfProps:this.props,csfCallbacks:this.callbacks};this.configHandler=el.bind(this),this.callbacksHandler=tl.bind(this),this.validateForm=vt(Hl,n),this.isConfigured=vt(Kl,n,this.validateForm),this.handleIframeConfigFeedback=vt(jl,n,this.isConfigured),this.processBrand=vt(Vl,n),this.handleValidation=ol.bind(this),this.handleEncryption=rl.bind(this),this.createSecuredFields=Tl.bind(this),this.createNonCardSecuredFields=Nl.bind(this),this.createCardSecuredFields=Pl.bind(this),this.setupSecuredField=Al.bind(this),this.postMessageToAllIframes=vt(Bl,n),this.handleIOSTouchEvents=En.handleTouchend.bind(this),this.touchendListener=En.touchendListener.bind(this),this.destroyTouchendListener=En.destroyTouchendListener.bind(this),this.touchstartListener=En.touchstartListener.bind(this),this.destroyTouchstartListener=En.destroyTouchstartListener.bind(this),this.setFocusOnFrame=vt(Ll,n),this.handleFocus=vt(Ul,n,this.handleIOSTouchEvents),this.handleSFShiftTab=Ki.handleSFShiftTab.bind(this),this.handleShiftTab=Ki.handleShiftTab.bind(this),this.destroySecuredFields=Wl.bind(this),this.processAutoComplete=vt(zl,n),this.handleBinValue=vt(ql,n),this.handleBrandFromBinLookup=Ml.bind(this),this.sendBrandToCardSF=Fl.bind(this),this.sendExpiryDatePolicyToSF=Ol.bind(this),this.init()}}const Yl=t=>{if(!t)throw new Error("No securedFields configuration object defined");const e=p({},t);try{const a=wo.isGenericCardType(e.type);e.type=a?"card":e.type}catch(a){e.type="card"}if(!Y(e,"rootNode"))return ko('ERROR: SecuredFields configuration object is missing a "rootNode" property');if(Zc(e.clientKey))return Bt('WARNING: AdyenCheckout configuration object is missing a "clientKey" property.');const n=Jl(e.rootNode);return n?(e.rootNode=n,new Gl(e).createReturnObject()):ko(`ERROR: SecuredFields cannot find a valid rootNode element for ${e.type}`)},Jl=t=>{let e;return typeof t=="object"&&(e=t),typeof t!="string"||(e=kt(document,t),e)?e:null};function ha(t,e,n,a){return(e!==po&&e!==ho||n[t]!==0)&&a[t]}var yt={handleFocus:function(t){this.numCharsInField[t.fieldType]=t.numChars,this.props.onFocus(t)},handleOnAllValid:function(t){return!this.state.detectedUnsupportedBrands&&(this.setState({isSfpValid:t.allValid},()=>{this.props.onChange(this.state,{event:"handleOnAllValid"}),this.props.onAllValid(t)}),!0)},handleOnAutoComplete:function(t){this.setState({autoCompleteName:t.value},()=>{this.props.onChange(this.state,{event:"handleOnAutoComplete",fieldType:t.fieldType}),this.setState({autoCompleteName:null})}),this.props.onAutoComplete(t)},handleOnFieldValid:function(t){return(!this.state.detectedUnsupportedBrands||t.fieldType!==V)&&(this.setState(e=>{var n;return{data:C(p({},e.data),{[t.encryptedFieldName]:t.blob}),valid:C(p({},e.valid),{[t.encryptedFieldName]:t.valid}),errors:C(p({},e.errors),{[t.fieldType]:(n=e.errors[t.fieldType])!=null?n:null})}},()=>{this.props.onChange(this.state,{event:"handleOnFieldValid",fieldType:t.fieldType}),this.props.onFieldValid(t)}),!0)},handleOnLoad:function(t){clearTimeout(this.csfLoadFailTimeout),this.csfLoadFailTimeout=null,this.props.onLoad(t),this.csfConfigFailTimeout=setTimeout(()=>{this.state.status!=="ready"&&(this.setState({status:"csfConfigFailure"}),this.props.onError(new z("ERROR","secured fields have failed to configure")))},this.csfConfigFailTimeoutMS)},handleOnConfigSuccess:function(t){clearTimeout(this.csfConfigFailTimeout),this.csfConfigFailTimeout=null,this.setState({status:"ready"},()=>{this.props.onConfigSuccess(t)})},handleOnBrand:function(t){this.setState(e=>{var i,s;const n=ha(H,t.cvcPolicy,this.numCharsInField,e.errors),a=this.numDateFields===1?ha(q,t.expiryDatePolicy,this.numCharsInField,e.errors):null,o=this.numDateFields===2?ha(re,t.expiryDatePolicy,this.numCharsInField,e.errors):null,r=this.numDateFields===2?ha(Q,t.expiryDatePolicy,this.numCharsInField,e.errors):null;return{brand:t.brand,cvcPolicy:(i=t.cvcPolicy)!=null?i:It,showSocialSecurityNumber:t.showSocialSecurityNumber,errors:p(p(p(p(p({},e.errors),Tt(n)&&{[H]:n}),Tt(a)&&{[q]:a}),Tt(o)&&{[re]:o}),Tt(r)&&{[Q]:r}),expiryDatePolicy:(s=t.expiryDatePolicy)!=null?s:Et}},()=>{var n,a;this.props.onChange(this.state,{event:"handleOnBrand"});const e=(a=(n=this.props.brandsConfiguration[t.brand])==null?void 0:n.icon)!=null?a:El(t.brand,this.props.resources);this.props.onBrand(C(p({},t),{brandImageUrl:e}))})},handleOnError:function(t,e=null){const n=t.error;return this.setState(a=>p(p(p({errors:C(p({},a.errors),{[t.fieldType]:n||null})},e&&{data:C(p({},a.data),{[V]:void 0})}),e&&{valid:C(p({},a.valid),{[V]:!1})}),e&&{isSfpValid:!1}),()=>{this.props.onChange(this.state,{event:"handleOnError",fieldType:t.fieldType})}),!0},handleOnNoDataRequired:function(){this.setState({status:"ready"},()=>this.props.onChange({isSfpValid:!0}))},handleOnTouchstartIOS:function(t){var e,n;(n=(e=this.props).disableIOSArrowKeys)==null||n.call(e,t)},handleKeyPressed:function(t){var e,n;if(t.action==="enterKeyPressed"){const a=new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,key:"Enter",code:"Enter"});(n=(e=this.props).handleKeyPress)==null||n.call(e,a)}}},Ql={type:"card",keypadFix:!0,rootNode:null,loadingContext:null,brands:[],showWarnings:!1,autoFocus:!0,trimTrailingSeparator:!0,onChange:()=>{},onLoad:()=>{},onConfigSuccess:()=>{},onAllValid:()=>{},onFieldValid:()=>{},onBrand:()=>{},onError:()=>{},onBinValue:()=>{},onFocus:()=>{},onAutoComplete:()=>{},handleKeyPress:()=>{},styles:{}},v=(function(t){return t.address="address",t.bankTransfer_IBAN="bankTransfer_IBAN",t.bankTransfer_BE="bankTransfer_BE",t.bankTransfer_NL="bankTransfer_NL",t.bankTransfer_PL="bankTransfer_PL",t.bankTransfer_FR="bankTransfer_FR",t.bankTransfer_CH="bankTransfer_CH",t.bankTransfer_IE="bankTransfer_IE",t.bankTransfer_GB="bankTransfer_GB",t.bankTransfer_DE="bankTransfer_DE",t.bankTransfer_AE="bankTransfer_AE",t.bankTransfer_AT="bankTransfer_AT",t.bankTransfer_AU="bankTransfer_AU",t.bankTransfer_BG="bankTransfer_BG",t.bankTransfer_CA="bankTransfer_CA",t.bankTransfer_EE="bankTransfer_EE",t.bankTransfer_ES="bankTransfer_ES",t.bankTransfer_FI="bankTransfer_FI",t.bankTransfer_HK="bankTransfer_HK",t.bankTransfer_HU="bankTransfer_HU",t.bankTransfer_IT="bankTransfer_IT",t.bankTransfer_JP="bankTransfer_JP",t.bankTransfer_LU="bankTransfer_LU",t.bankTransfer_NZ="bankTransfer_NZ",t.bankTransfer_PT="bankTransfer_PT",t.bankTransfer_SG="bankTransfer_SG",t.bankTransfer_SK="bankTransfer_SK",t.bankTransfer_US="bankTransfer_US",t.donation="donation",t.personal_details="personal_details",t.dropin="dropin",t.bcmc="bcmc",t.card="card",t.scheme="scheme",t.storedCard="storedCard",t.customCard="customcard",t.threeDS2Challenge="threeDS2Challenge",t.threeDS2Fingerprint="threeDS2Fingerprint",t.threeDS2DeviceFingerprint="threeDS2DeviceFingerprint",t.ach="ach",t.directdebit_GB="directdebit_GB",t.sepadirectdebit="sepadirectdebit",t.eft_directdebit_CA="eft_directdebit_CA",t.affirm="affirm",t.afterpay="afterpay",t.afterpay_default="afterpay_default",t.afterpay_b2b="afterpay_b2b",t.atome="atome",t.facilypay_3x="facilypay_3x",t.facilypay_4x="facilypay_4x",t.facilypay_6x="facilypay_6x",t.facilypay_10x="facilypay_10x",t.facilypay_12x="facilypay_12x",t.ratepay="ratepay",t.ratepay_directdebit="ratepay_directdebit",t.amazonpay="amazonpay",t.applepay="applepay",t.cashapp="cashapp",t.clicktopay="clicktopay",t.googlepay="googlepay",t.paypal="paypal",t.fastlane="fastlane",t.paywithgoogle="paywithgoogle",t.boletobancario="boletobancario",t.boletobancario_itau="boletobancario_itau",t.boletobancario_santander="boletobancario_santander",t.primeiropay_boleto="primeiropay_boleto",t.doku="doku",t.doku_alfamart="doku_alfamart",t.doku_permata_lite_atm="doku_permata_lite_atm",t.doku_indomaret="doku_indomaret",t.doku_atm_mandiri_va="doku_atm_mandiri_va",t.doku_sinarmas_va="doku_sinarmas_va",t.doku_mandiri_va="doku_mandiri_va",t.doku_cimb_va="doku_cimb_va",t.doku_danamon_va="doku_danamon_va",t.doku_bri_va="doku_bri_va",t.doku_bni_va="doku_bni_va",t.doku_bca_va="doku_bca_va",t.doku_wallet="doku_wallet",t.oxxo="oxxo",t.billdesk_online="billdesk_online",t.billdesk_wallet="billdesk_wallet",t.dotpay="dotpay",t.eps="eps",t.iris="iris",t.molpay_ebanking_fpx_MY="molpay_ebanking_fpx_MY",t.molpay_ebanking_TH="molpay_ebanking_TH",t.molpay_ebanking_VN="molpay_ebanking_VN",t.onlineBanking_CZ="onlineBanking_CZ",t.onlinebanking_IN="onlinebanking_IN",t.onlineBanking_PL="onlineBanking_PL",t.onlineBanking_SK="onlineBanking_SK",t.paybybank="paybybank",t.payu_IN_cashcard="payu_IN_cashcard",t.payu_IN_nb="payu_IN_nb",t.wallet_IN="wallet_IN",t.dragonpay="dragonpay",t.dragonpay_ebanking="dragonpay_ebanking",t.dragonpay_otc_banking="dragonpay_otc_banking",t.dragonpay_otc_non_banking="dragonpay_otc_non_banking",t.dragonpay_otc_philippines="dragonpay_otc_philippines",t.econtext="econtext",t.econtext_atm="econtext_atm",t.econtext_online="econtext_online",t.econtext_seven_eleven="econtext_seven_eleven",t.econtext_stores="econtext_stores",t.giropay="giropay",t.multibanco="multibanco",t.redirect="redirect",t.twint="twint",t.vipps="vipps",t.trustly="trustly",t.paybybank_AIS_DD="paybybank_AIS_DD",t.riverty="riverty",t.paybybank_pix="paybybank_pix",t.klarna="klarna",t.klarna_account="klarna_account",t.klarna_paynow="klarna_paynow",t.klarna_b2b="klarna_b2b",t.bcmc_mobile="bcmc_mobile",t.bcmc_mobile_QR="bcmc_mobile_QR",t.pix="pix",t.swish="swish",t.wechatpay="wechatpay",t.wechatpayQR="wechatpayQR",t.promptpay="promptpay",t.paynow="paynow",t.duitnow="duitnow",t.blik="blik",t.mbway="mbway",t.ancv="ancv",t.payto="payto",t.upi="upi",t.upi_qr="upi_qr",t.upi_intent="upi_intent",t.giftcard="giftcard",t.mealVoucher_FR="mealVoucher_FR",t.mealVoucher_FR_natixis="mealVoucher_FR_natixis",t.mealVoucher_FR_sodexo="mealVoucher_FR_sodexo",t.mealVoucher_FR_groupeup="mealVoucher_FR_groupeup",t})({});function ue(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Hi extends Fe{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const e=Wc(this.rootNode),n=e.reduce(Gc,{});this.setState({valid:n}),e.forEach(a=>{this.numCharsInField[a]=0}),this.numDateFields=e.filter(a=>a.match(/Expiry/)).length,e.length?(this.destroy(),this.initializeCSF(this.rootNode)):(this.props.componentType===v.customCard&&console.debug('You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a "data-cse" attribute e.g. <div data-cse="encryptedCardNumber"></div>'),this.handleOnNoDataRequired())}componentDidUpdate(){var e,n;this.checkForKCPFields(),(n=(e=this.props).onStateUpdate)==null||n.call(e,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(e){var o;let n=this.props.loadingContext;const a={rootNode:e,type:this.props.type,componentType:this.props.componentType,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:n,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,onSubmitAnalytics:this.props.onSubmitAnalytics,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:(o=this.props.placeholders)!=null?o:{},showContextualElement:this.props.showContextualElement};this.csf=Yl(a),this.csfLoadFailTimeout=setTimeout(()=>{this.state.status!=="ready"&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new z("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let e=!1;if(this.props.koreanAuthenticationRequired&&(e=this.issuingCountryCode?this.issuingCountryCode==="kr":this.props.countryCode==="kr"),this.state.hasKoreanFields&&!e){const n=a=>({data:C(p({},a.data),{[tt]:void 0}),valid:C(p({},a.valid),{[tt]:!1}),errors:C(p({},a.errors),{[tt]:null}),hasKoreanFields:!1});this.setState(n,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(tt),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&e){const n=a=>({valid:C(p({},a.valid),{[tt]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(n,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(tt),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(e){const n=!!e.error;return n&&this.setState({detectedUnsupportedBrands:e.detectedBrands}),e.rootNode=this.rootNode,this.handleOnError(e,n),this.csf&&this.csf.hasUnsupportedCard(V,e.error),n}setFocusOn(e){this.csf&&this.csf.setFocusOnFrame(e)}updateStyles(e){this.csf&&this.csf.updateStyles(e)}sfIsOptionalOrHidden(e){return this.csf.sfIsOptionalOrHidden(e)}destroy(){this.csf&&this.csf.destroy()}getRootNode(){return this.rootNode}showValidation(){const{numDateFields:e,state:n}=this;Object.keys(n.valid).reduce(Yc(e,n),[]).forEach(a=>{const o=Jc(a,this.rootNode,n);this.handleOnError(o,!!n.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(a,o.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((e,n)=>{const a=this.state.errors[n];return e[n]=a?p({isValid:!1,errorMessage:Ui(a,$t),errorI18n:this.props.i18n.get(a),error:a,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,e},{})}processBinLookupResponse(e,n){var r;if(this.state.detectedUnsupportedBrands&&(this.setState(i=>({errors:C(p({},i.errors),{[V]:null}),detectedUnsupportedBrands:null})),this.csf&&e)){const i={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(i)}this.issuingCountryCode=(r=e==null?void 0:e.issuingCountryCode)==null?void 0:r.toLowerCase();const a=n==null?void 0:n.brand,o=a&&zc.includes(n.brand);o&&this.setState(n,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(e,o?n:null)}render(e,n){return e.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},n)}constructor(e){super(e),ue(this,"csfLoadFailTimeout",void 0),ue(this,"csfLoadFailTimeoutMS",void 0),ue(this,"csfConfigFailTimeout",void 0),ue(this,"csfConfigFailTimeoutMS",void 0),ue(this,"numCharsInField",void 0),ue(this,"rootNode",void 0),ue(this,"numDateFields",void 0),ue(this,"csf",void 0),ue(this,"handleOnLoad",void 0),ue(this,"handleOnConfigSuccess",void 0),ue(this,"handleOnFieldValid",void 0),ue(this,"handleOnAllValid",void 0),ue(this,"handleOnBrand",void 0),ue(this,"handleFocus",void 0),ue(this,"handleOnError",void 0),ue(this,"handleOnAutoComplete",void 0),ue(this,"handleOnNoDataRequired",void 0),ue(this,"handleOnTouchstartIOS",void 0),ue(this,"handleKeyPressed",void 0),ue(this,"state",void 0),ue(this,"props",void 0),ue(this,"issuingCountryCode",void 0),ue(this,"setRootNode",a=>{this.rootNode=a});const n={status:"loading",brand:e.type,errors:{},valid:{},data:{},cvcPolicy:It,expiryDatePolicy:Et,isSfpValid:!1,hasKoreanFields:e.hasKoreanFields};this.state=n,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=yt.handleOnLoad.bind(this),this.handleOnConfigSuccess=yt.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=yt.handleOnFieldValid.bind(this),this.handleOnAllValid=yt.handleOnAllValid.bind(this),this.handleOnBrand=yt.handleOnBrand.bind(this),this.handleFocus=yt.handleFocus.bind(this),this.handleOnError=yt.handleOnError.bind(this),this.handleOnNoDataRequired=yt.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=yt.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=yt.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=yt.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}ue(Hi,"defaultProps",Ql);var Do=(function(t){return t.full="full",t.partial="partial",t.none="none",t})({}),Io={type:"scheme",setComponentRef:()=>{},autoFocus:!0,billingAddressAllowedCountries:[],billingAddressMode:Do.full,billingAddressRequired:!1,billingAddressRequiredFields:["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],configuration:{koreanAuthenticationRequired:!1,socialSecurityNumberMode:"auto"},data:{billingAddress:{}},disableIOSArrowKeys:!1,enableStoreDetails:!1,exposeExpiryDate:!1,forceCompat:!1,hasHolderName:!1,holderNameRequired:!1,hasCVC:!0,hideCVC:!1,installmentOptions:{},keypadFix:!0,legacyInputMode:!1,maskSecurityCode:!1,minimumExpiryDate:null,name:null,placeholders:{},positionHolderNameOnTop:!1,showBrandIcon:!0,showInstallmentAmounts:null,styles:{},trimTrailingSeparator:!0,isPayButtonPrimaryVariant:!0,showContextualElement:!0,onLoad:t=>{},onConfigSuccess:t=>{},onAllValid:t=>{},onFieldValid:t=>{},onBrand:t=>{},onError:t=>{},onBinValue:t=>{},onBlur:t=>{},onFocus:t=>{},onChange:()=>{}};const Zl=11;function Xl(t){return t.replace(/\W/gi,"").replace(/(\d{3})(?!$)/g,"$1.").replace(/(.{11}).(\d{1,2})$/g,"$1-$2")}function eu(t){return t.replace(/^(\d{2})(\d{3})(\d{3})?(\d{4})?(\d{1,2})?$/g,(e,n,a,o,r="",i="")=>`${n}.${a}.${o}/${r}${i.length?`-${i}`:""}`)}function tu(t){return t.replace(/[^0-9]/g,"").trim()}function nu(t=""){if(typeof t!="string")return"";const e=tu(t);return e.length>Zl?eu(e):Xl(e)}function au(t){return/(^\d{3}\.\d{3}\.\d{3}-\d{2}$)|(^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$)/.test(t)}const ou=(t,e,n,a)=>{var r,i,s,d;return(i=(r=t[n])==null?void 0:r[e])!=null&&i.formatterFn?null:((d=(s=t[n])==null?void 0:s[e])==null?void 0:d.maxlength)||30},zt=t=>!(t!=null&&!/^[\s]*$/.test(t)),qi="?\\+_=!@#$%^&*(){}~<>\\[\\]\\\\",Ut=(t,e="g")=>new RegExp(`[${t}]`,e),ru=t=>t.trimStart().replace(/\s+/g," "),iu={socialSecurityNumber:nu},Wi={socialSecurityNumber:[{modes:["blur"],validate:t=>zt(t)?null:au(t),errorMessage:Oi}],taxNumber:[{modes:["blur"],validate:t=>zt(t)?null:(t==null?void 0:t.length)===6||(t==null?void 0:t.length)===10,errorMessage:_o}],holderName:[{modes:["blur"],validate:t=>!zt(t)||null,errorMessage:mo}],default:[{modes:["blur"],validate:t=>!!t&&typeof t=="string"&&t.trim().length>0}]},su=(t,e)=>{var a;const n=Wi[t];return(a=(Array.isArray(n)?n:[n]).reduce((o,r)=>(o.length||r.modes.includes(e)&&o.push(r.validate),o),[])[0])!=null?a:(()=>!0)};function du(t,e){const[n,a]=t;return{dualBrandSelectElements:[{id:n.brand,brandObject:n},{id:a.brand,brandObject:a}],selectedBrandValue:e?n.brand:"",leadBrand:n}}const Gi="holderName",$o="socialSecurityNumber",ya=[V,q,H],ma=[Gi,V,q,H],_a=[V,q,H,Gi],Ro=["taxNumber",tt],cu=ya.concat(Ro),lu=ma.concat(Ro),uu=_a.concat(Ro),pu=ya.concat([$o]),hu=ma.concat([$o]),yu=_a.concat([$o]),fa="N/A",ga=["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],[Rt,mt,jt,an,We,Pn]=ga,mu={street:"address-line1",houseNumberOrName:"address-line2",postalCode:"postal-code",city:"address-level2"},Fo={AU:{hasDataset:!0,labels:{[mt]:"apartmentSuite",[We]:"state",[Rt]:"address"},optionalFields:[mt],placeholders:{[We]:"select.state"},schema:[Pn,Rt,mt,an,[[We,50],[jt,50]]]},BR:{hasDataset:!0,labels:{[We]:"state"},placeholders:{[We]:"select.state"}},CA:{hasDataset:!0,labels:{[mt]:"apartmentSuite",[We]:"provinceOrTerritory",[Rt]:"address"},optionalFields:[mt],schema:[Pn,Rt,mt,[[an,70],[jt,30]],We]},GB:{labels:{[an]:"cityTown"},schema:[Pn,[[mt,30],[Rt,70]],[[an,70],[jt,30]],We]},US:{hasDataset:!0,labels:{[jt]:"zipCode",[mt]:"apartmentSuite",[We]:"state",[Rt]:"address"},optionalFields:[mt],placeholders:{[We]:"select.state"},schema:[Pn,Rt,mt,an,[[We,50],[jt,50]]]},default:{optionalFields:[],placeholders:{[We]:"select.provinceOrTerritory"},schema:[Pn,[[Rt,70],[mt,30]],[[jt,30],[an,70]],We]}},_u=Object.keys(Fo).reduce((t,e)=>(t[e]={labels:Fo[e].labels,schema:[jt]},t),{}),Oo=na(void 0),fu=({i18n:t,loadingContext:e,resources:n,analytics:a,children:o})=>{const r=Lt(Oo);return F(()=>{t&&e&&n||console.warn(`CoreProvider - WARNING core provider is missing:${t?"":"i18n"} ${e?"":"loadingContext"} ${n?"":"resources"}`)},[t,e,n]),r?c(G,null,ea(o)):c(Oo.Provider,{value:{i18n:t,loadingContext:e,resources:n,analytics:a}},ea(o))},O=()=>{const t=Lt(Oo);if(t===void 0)throw new Error('"useCoreContext" must be used within a CoreProvider');return t};function $e(){const{resources:t}=O();return D(e=>t==null?void 0:t.getImage(e),[])}const Yi=(t,e)=>e({type:t==="card"?"nocard":t||"nocard",extension:"svg"})(t),gu=t=>["revolving","bonus"].includes(t==null?void 0:t.plan)||(t==null?void 0:t.value)>1,bu=({props:t,showKCP:e,showBrazilianSSN:n,countrySpecificSchemas:a=null,billingAddressRequiredFields:o=null})=>{let r=ya;const i=t.hasHolderName&&t.holderNameRequired;if(i&&(r=t.positionHolderNameOnTop?ma:_a),e&&(r=cu,i&&(r=t.positionHolderNameOnTop?lu:uu)),n&&(r=pu,i&&(r=t.positionHolderNameOnTop?hu:yu)),a){const s=a.flat(2).filter(l=>typeof l!="number");let d=s;o&&(d=s.filter(l=>o.includes(l))),r=ya.concat(d),i&&(r=t.positionHolderNameOnTop?ma.concat(d):_a.concat(d))}return r},ku=(t,e,n)=>{switch(t){case"socialSecurityNumber":return e.get(`boleto.${t}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return n!=null&&n[t]?e.get(n==null?void 0:n[t]):e.get(t);default:return null}},vu=t=>({billingAddressRequired:t.billingAddressRequired,billingAddressRequiredFields:t.billingAddressRequiredFields,billingAddressAllowedCountries:t.billingAddressAllowedCountries,brandsConfiguration:t.brandsConfiguration,showStoreDetailsCheckbox:t.showStoreDetailsCheckbox,hasCVC:t.hasCVC,hasHolderName:t.hasHolderName,holderNameRequired:t.holderNameRequired,installmentOptions:t.installmentOptions,placeholders:t.placeholders,positionHolderNameOnTop:t.positionHolderNameOnTop,showBrandIcon:t.showBrandIcon,showContextualElement:t.showContextualElement,lastFour:t.lastFour,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,disclaimerMessage:t.disclaimerMessage}),xu=t=>({autoFocus:t.autoFocus,brands:t.brands,brandsConfiguration:t.brandsConfiguration,clientKey:t.clientKey,countryCode:t.countryCode,forceCompat:t.forceCompat,i18n:t.i18n,implementationType:t.implementationType,keypadFix:t.keypadFix,legacyInputMode:t.legacyInputMode,loadingContext:t.loadingContext,maskSecurityCode:t.maskSecurityCode,exposeExpiryDate:t.exposeExpiryDate,minimumExpiryDate:t.minimumExpiryDate,onAdditionalSFConfig:t.onAdditionalSFConfig,onAdditionalSFRemoved:t.onAdditionalSFRemoved,onAllValid:t.onAllValid,onAutoComplete:t.onAutoComplete,onBinValue:t.onBinValue,onConfigSuccess:t.onConfigSuccess,handleKeyPress:t.handleKeyPress,onError:t.onError,onFieldValid:t.onFieldValid,onLoad:t.onLoad,placeholders:t.placeholders,resources:t.resources,showContextualElement:t.showContextualElement,showWarnings:t.showWarnings,trimTrailingSeparator:t.trimTrailingSeparator}),Ji=t=>t==Do.partial?_u:null;function wu(t){return![$t.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,$t.ERROR_MSG_CARD_TOO_OLD,$t.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,$t.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(t)}function Mo(t){var e;return(e=Uc[t])!=null?e:t}const Cu=(t,e)=>t.map(n=>{var s,d;const a=n.id,o=$e(),r=a==="card"?"nocard":a,i=(d=(s=e==null?void 0:e[a])==null?void 0:s.icon)!=null?d:Yi(r,o);return{id:n.id,name:n.brandObject.localeBrand||n.brandObject.brand,imageURL:i,altName:Mo(a)}}),Lo=(t,e,n)=>e.some(a=>t.includes(a[n])),Su=({installmentOptions:t,fundingSource:e,amount:n})=>!(!t||Object.keys(t).length===0)&&!(!n||n.value===0)&&(!e||e==="credit"),Bo=["cartebancaire","bcmc","dankort"],Eu=(t,e)=>t.reduce((n,a)=>n||e.includes(a.brand),!1),Qi=t=>t.map(e=>p({},e)),Tu=(t,e="mc",n="visa")=>{const a=Qi(t);return a[0].brand!==e&&a[0].brand!==n&&a.reverse(),a.length=1,a};function Nu(t,e,n,a={}){const{type:o,cvcPolicy:r}=t,{sfp:i}=e,{dualBrandSelectElements:s,setDualBrandSelectElements:d,setSelectedBrandValue:l,issuingCountryCode:h,setIssuingCountryCode:u}=n;return{processBinLookup:(y,m)=>{var x;const f=y!=null&&y.issuingCountryCode?y.issuingCountryCode.toLowerCase():null;if(u(f),!y||!Object.keys(y).length){d([]),l("");const S=m&&o!=="card"?o:null;return i.current.processBinLookupResponse(y,{brand:S,cvcPolicy:r}),void(a.current=0)}if((x=y.supportedBrands)!=null&&x.length){const S=Eu(y.supportedBrands,ra),w=S?Tu(y.supportedBrands):Qi(y.supportedBrands);if(w.length>1){const k=Lo(Bo,w,"brand"),b=du(w,k);d(b.dualBrandSelectElements),l(b.selectedBrandValue),i.current.processBinLookupResponse({issuingCountryCode:y.issuingCountryCode,supportedBrands:[b.leadBrand]}),b.leadBrand.panLength>0&&(a.current=b.leadBrand.panLength)}else d([]),l(""),S||l(w[0].brand),i.current.processBinLookupResponse({issuingCountryCode:y.issuingCountryCode,supportedBrands:w}),w[0].panLength>0&&(a.current=w[0].panLength)}},handleDualBrandSelection:y=>{let m=[];y&&(m=s.reduce((f,x)=>(x.brandObject.brand===y&&f.push(x.brandObject),f),[]),m.length&&(l(y),i.current.processBinLookupResponse({issuingCountryCode:h,supportedBrands:m,isDualBrandSelection:!0})))}}}function ba(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Pu=class{hasError(e=!1){return e?!this.isValid&&this.shouldValidate:this.isValid!=null&&!this.isValid&&this.shouldValidate}constructor(e,n,a,o,r){ba(this,"shouldValidate",void 0),ba(this,"isValid",void 0),ba(this,"errorMessage",void 0),ba(this,"errorI18n",void 0),this.shouldValidate=e.modes.includes(a),this.isValid=e.validate(n,o),this.errorMessage=e.errorMessage,typeof e.errorMessage=="string"?this.errorI18n=r.get(e.errorMessage):e.errorMessage&&(this.errorI18n=r.get(e.errorMessage.translationKey,e.errorMessage.translationObject))}};function Vo(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Au=class{get isValid(){return this.validationResults.reduce((e,n)=>e&&n.isValid,!0)}hasError(e=!1){return!!this.getError(e)}getError(e=!1){return this.validationResults.find(n=>n.hasError(e))}getAllErrors(){return this.validationResults.filter(e=>e.hasError())}constructor(e){Vo(this,"validationResults",void 0),this.validationResults=e}},Du=class{setRules(e){this.rules=p(p({},this.rules),e)}getRulesFor(e){var a;let n=(a=this.rules[e])!=null?a:this.rules.default;return Array.isArray(n)||(n=[n]),n}validate({key:e,value:n,mode:a="blur"},o){const r=this.getRulesFor(e).map(i=>new Pu(i,n,a,o,this.i18n));return new Au(r)}constructor(e,n){Vo(this,"rules",{default:{validate:()=>!0,modes:["blur","input"]}}),Vo(this,"i18n",void 0),this.setRules(e),this.i18n=n}};const on=(t,e)=>Object.keys(t).filter(n=>!e.includes(n)).reduce((n,a)=>(n[a]=t[a],n),{}),zo=(t,e,n,a,o)=>e.reduce((r,i)=>{var s,d,l;return C(p({},r),{[i]:(l=(d=(s=r[i])!=null?s:o==null?void 0:o[i])!=null?d:a==null?void 0:a[i])!=null?l:n})},t);function Zi({schema:t,defaultData:e,processField:n,fieldProblems:a}){const o=i=>{var l,h;if(e[i]===void 0)return{valid:!1,errors:null,data:null,fieldProblems:(l=a==null?void 0:a[i])!=null?l:null};const[s,d]=n({key:i,value:e[i],mode:"blur"},{state:{data:e}});return{valid:d.isValid&&!(a!=null&&a[i])||!1,errors:d.hasError()?d.getError():null,data:s,fieldProblems:(h=a==null?void 0:a[i])!=null?h:null}},r=t.reduce((i,s)=>{const{valid:d,errors:l,data:h,fieldProblems:u}=o(s);return{valid:C(p({},i.valid),{[s]:d}),errors:C(p({},i.errors),{[s]:l}),data:C(p({},i.data),{[s]:h}),fieldProblems:C(p({},i.fieldProblems),{[s]:u})}},{data:{},valid:{},errors:{},fieldProblems:{}});return{schema:t,data:r.data,valid:r.valid,errors:r.errors,fieldProblems:r.fieldProblems}}function Iu(t){return function(e,{type:n,key:a,value:o,mode:r,schema:i,defaultData:s,formValue:d,selectedSchema:l,fieldProblems:h,data:u}){var m,f,x,S,w;const y=l||e.schema;switch(n){case"setData":return C(p({},e),{data:C(p({},e.data),{[a]:o})});case"mergeData":return C(p({},e),{data:p(p({},e.data),u)});case"setValid":return C(p({},e),{valid:C(p({},e.valid),{[a]:o})});case"setErrors":return C(p({},e),{errors:C(p({},e.errors),{[a]:o})});case"setFieldProblems":return(f=(m=e==null?void 0:e.schema)==null?void 0:m.reduce((k,b)=>{var _,g;return C(p({},k),{fieldProblems:C(p({},e.fieldProblems),{[b]:(_=h==null?void 0:h[b])!=null?_:null}),valid:C(p({},e.valid),{[b]:((g=e.valid)==null?void 0:g[b])&&!h[b]})})},e))!=null?f:e;case"updateField":{const[k,b]=t({key:a,value:o,mode:r},{state:e}),_=e.data[a],g=p({},e.fieldProblems);return _!==k&&(g[a]=null),C(p({},e),{data:C(p({},e.data),{[a]:k}),errors:C(p({},e.errors),{[a]:b.hasError()?b.getError():null}),valid:C(p({},e.valid),{[a]:b.isValid&&!g[a]||!1}),fieldProblems:g})}case"mergeForm":{const k=C(p({},e),{data:p(p({},e.data),d.data),errors:p(p({},e.errors),d.errors),valid:p(p({},e.valid),d.valid),fieldProblems:p(p({},e.fieldProblems),d.fieldProblems)});return k.valid&&(k.isValid=Object.values(k.valid).every(b=>b)),k}case"setSchema":{const k=Zi({schema:i,defaultData:s,processField:t,fieldProblems:h}),b=e.schema.filter(A=>!i.includes(A)),_=i.filter(A=>!e.schema.includes(A)),g={data:on(e.data,_),errors:on(e.errors,_),valid:on(e.valid,_)},T=zo(on(e.data,b),_,null,k.data,(x=e.local)==null?void 0:x.data),E=zo(on(e.valid,b),_,!1,k.valid,(S=e.local)==null?void 0:S.valid),P=zo(on(e.errors,b),_,null,k.errors,(w=e.local)==null?void 0:w.errors);return C(p({},e),{schema:i,data:T,valid:E,errors:P,local:g})}case"validateForm":{const k=y.reduce((b,_)=>{const[,g]=t({key:_,value:e.data[_],mode:"blur"},{state:e});return{valid:C(p({},b.valid),{[_]:g.isValid&&!e.fieldProblems[_]||!1}),errors:C(p({},b.errors),{[_]:g.hasError(!0)?g.getError(!0):null})}},{valid:e.valid,errors:e.errors});return C(p({},e),{valid:k.valid,errors:k.errors})}default:throw new Error("Undefined useForm action")}}}function An(t){const{rules:e={},formatters:n={},defaultData:a={},fieldProblems:o={},schema:r=[]}=t,{i18n:i}=O(),s=ce(()=>new Du(e,i),[e]),d=({key:_,value:g,mode:T},E)=>{const P=n==null?void 0:n[_],A=(function(U){return U&&"formatterFn"in U})(P)?P.formatterFn:P,I=A&&typeof A=="function"?A(g!=null?g:"",E):g;return[I,s.validate({key:_,value:I,mode:T},E)]},[l,h]=Ti(Iu(d),{defaultData:a,schema:r!=null?r:[],processField:d,fieldProblems:o},Zi),u=ce(()=>l.schema.reduce((_,g)=>_&&l.valid[g],!0),[l.schema,l.valid]),y=D((_=null)=>{h({type:"validateForm",selectedSchema:_})},[]),m=D((_,g)=>h({type:"setErrors",key:_,value:g}),[]),f=D((_,g)=>h({type:"setValid",key:_,value:g}),[]),x=D((_,g)=>h({type:"setData",key:_,value:g}),[]),S=D(_=>h({type:"mergeData",data:_}),[]),w=D(_=>h({type:"setSchema",schema:_,defaultData:a}),[l.schema]),k=D(_=>h({type:"mergeForm",formValue:_}),[]),b=D(_=>h({type:"setFieldProblems",fieldProblems:_}),[l.schema]);return F(()=>{b(o!=null?o:{})},[JSON.stringify(o)]),{handleChangeFor:(_,g)=>T=>{const E=((P,A)=>A.target?A.target.type==="checkbox"?!l.data[P]:A.target.value:A)(_,T);h({type:"updateField",key:_,value:E,mode:g})},triggerValidation:y,setSchema:w,setData:x,mergeData:S,setValid:f,setErrors:m,isValid:u,mergeForm:k,setFieldProblems:b,schema:l.schema,valid:l.valid,errors:l.errors,data:l.data,fieldProblems:l.fieldProblems}}let Xi=class{countryHasDataset(e){var n,a;return!!((a=(n=this.specifications)==null?void 0:n[e])!=null&&a.hasDataset)}countryHasOptionalField(e,n){var a,o,r;return!!((r=(o=(a=this.specifications)==null?void 0:a[e])==null?void 0:o.optionalFields)!=null&&r.includes(n))}getAddressSchemaForCountry(e){var n,a;return((a=(n=this.specifications)==null?void 0:n[e])==null?void 0:a.schema)||this.specifications.default.schema}getAddressLabelsForCountry(e){var n,a;return((a=(n=this.specifications)==null?void 0:n[e])==null?void 0:a.labels)||this.specifications.default.labels}getOptionalFieldsForCountry(e){var n,a,o;return((a=(n=this.specifications)==null?void 0:n[e])==null?void 0:a.optionalFields)||((o=this.specifications.default)==null?void 0:o.optionalFields)||[]}getKeyForField(e,n){var a,o,r,i,s,d;return((r=(o=(a=this.specifications)==null?void 0:a[n])==null?void 0:o.labels)==null?void 0:r[e])||((d=(s=(i=this.specifications)==null?void 0:i.default)==null?void 0:s.labels)==null?void 0:d[e])||e}getPlaceholderKeyForField(e,n){var a,o,r,i,s,d;return((r=(o=(a=this.specifications)==null?void 0:a[n])==null?void 0:o.placeholders)==null?void 0:r[e])||((d=(s=(i=this.specifications)==null?void 0:i.default)==null?void 0:s.placeholders)==null?void 0:d[e])}getAddressSchemaForCountryFlat(e){return this.getAddressSchemaForCountry(e).flat(2).filter(n=>typeof n=="string")}constructor(e){var n,a,o;o=void 0,(a="specifications")in(n=this)?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o,this.specifications=p(p({},Fo),e)}};function $u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var es={exports:{}};var ts;function Ru(){return ts||(ts=1,t=es,(function(){var e={}.hasOwnProperty;function n(){for(var r="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(r=o(r,a(s)))}return r}function a(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var s in r)e.call(r,s)&&r[s]&&(i=o(i,s));return i}function o(r,i){return i?r?r+" "+i:r+i:r}t.exports?(n.default=n,t.exports=n):window.classNames=n})()),es.exports;var t}var $=$u(Ru());const rn=({inline:t=!1,size:e="large"})=>c("div",{"data-testid":"spinner",className:"adyen-checkout__spinner__wrapper "+(t?"adyen-checkout__spinner__wrapper--inline":"")},c("div",{className:`adyen-checkout__spinner adyen-checkout__spinner--${e}`})),ns=({children:t,status:e})=>{const n=$("adyen-checkout__loading-input__form","loading-input__form",{"loading-input__form--loading":e==="loading"}),a=$({"loading-input__spinner":!0,"loading-input__spinner--active":e==="loading"});return c("div",{style:{position:"relative"}},c("div",{className:a},c(rn,null)),c("div",{className:n},t))};function Fu({frontCVC:t=!1}){const e=$({"adyen-checkout__card__cvc__hint__wrapper":!0,"adyen-checkout__field__cvc--front-hint":!!t,"adyen-checkout__field__cvc--back-hint":!t});return c("span",{className:e},c("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front","data-testid":"cvc-hint-front",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},c("path",{d:"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z",fill:"#E6E9EB"}),c("rect",{x:"4",y:"12",width:"19",height:"2",fill:"#B9C4C9"}),c("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1",fill:"white"}),c("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"4.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})),c("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back","data-testid":"cvc-hint-back",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},c("path",{d:"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z",fill:"#E6E9EB"}),c("path",{d:"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z",fill:"#E6E9EB"}),c("rect",{y:"4.00012",width:"27",height:"3.00001",fill:"#687282"}),c("path",{d:"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z",fill:"white"}),c("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"9.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})))}function we(t){const{backgroundUrl:e="",className:n="",classNameModifiers:a=[],src:o="",alt:r="",showOnError:i=!1}=t,[s,d]=N(!1),l=J(null),h=()=>{d(!0)},u=$([n],"adyen-checkout__image",{"adyen-checkout__image--loaded":s},...a.map(y=>`adyen-checkout__image--${y}`));return F(()=>{const y=e?new Image:l.current;y.src=e||o,y.onload=h,d(!!y.complete)},[]),e?c("div",C(p({"data-testid":"background",style:{backgroundUrl:e}},t),{className:u})):c("img",C(p({},t),{alt:r,ref:l,className:u,onError:y=>{var m;d(i),(m=t==null?void 0:t.onError)==null||m.call(t,y)}}))}const ka=({type:t,className:e="",alt:n="",height:a,width:o})=>{var s;const r=$e(),i=(s=r({imageFolder:"components/"}))==null?void 0:s(t);return c(we,{className:$("adyen-checkout__icon",e),alt:n,src:i,height:a,width:o})};let as=Date.now();const Uo=(t="field")=>(as+=1,`${t}-${as}`),Kt="bento_",ke=t=>{const{children:e,className:n,classNameModifiers:a,dir:o,disabled:r,readOnly:i,errorMessage:s,helper:d,inputWrapperModifiers:l,isLoading:h,isValid:u,label:y,labelEndAdornment:m,name:f,onBlur:x,onFieldBlur:S,onFocus:w,onFocusField:k,showValidIcon:b,useLabelElement:_,showErrorElement:g,showContextualElement:T,staticValue:E,contextualText:P,filled:A,focused:I,i18n:U,contextVisibleToScreenReader:W,renderAlternativeToLabel:Z,onInputContainerClick:Pe,errorLive:fe}=t,Be=W!=null?W:!0,Ae=g&&typeof s=="string"&&s.length>0,Ie=T&&!Ae&&P&&P.length>0,Ve=J(Uo(`adyen-checkout-${f}`)),et=ce(()=>E?`input-static-value-${ze()}`:null,[E]),[ne,De]=N(!1),[ft,j]=N(!1);I!=null&&De(!!I),A!=null&&j(!!A);const ie=D(L=>{De(!0),w==null||w(L)},[w]),ye=D(L=>{De(!1),x==null||x(L),S==null||S(L)},[x,S]),pe=D(()=>c(G,null,typeof y=="string"&&c("span",{className:$({"adyen-checkout__label__text":!0,"adyen-checkout__label__text--error":s}),"data-id":f,"data-testid":f},y),typeof y=="function"&&y(),m&&c("span",{className:"adyen-checkout__label-adornment--end"},m),d&&c("span",{className:"adyen-checkout__helper-text"},d)),[y,s,m,d]),Se=D(()=>{const L=c("span",p(C(p({className:$({"adyen-checkout-contextual-text--error":!0,"adyen-checkout-contextual-text--hidden":!Ae})},Be&&{id:`${Ve.current}${sa}`}),{"aria-hidden":Be?void 0:"true"}),Be&&fe&&{"aria-live":"polite"}),s),ve=c("span",C(p({className:$({"adyen-checkout-contextual-text":!0,"adyen-checkout-contextual-text--hidden":!Ie})},Be&&{id:`${Ve.current}${da}`}),{"aria-hidden":Be?void 0:"true"}),P);return c(G,null,c("div",{className:$(["adyen-checkout__input-wrapper",...l.map(xe=>`adyen-checkout__input-wrapper--${xe}`)]),dir:o,onClick:Pe},E&&c("span",{id:et,className:"adyen-checkout__field-static-value"},E),ea(e).map(xe=>{const lt=C(p({isValid:u,onFocusHandler:ie,onBlurHandler:ye,isInvalid:!!s,"aria-owns":et},f&&{uniqueId:Ve.current}),{showErrorElement:g});return Ic(xe,lt)}),h&&c("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--loading"},c(rn,{size:"small"})),u&&b!==!1&&c("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--valid"},c(ka,{type:`${Kt}checkmark_black`,alt:U==null?void 0:U.get("field.valid")})),s&&c("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--invalid"},c(ka,{type:`${Kt}field_error`,alt:U==null?void 0:U.get("error.title")}))),L,ve)},[e,s,P,h,u,ie,ye]),R=D(({onFocusField:L,focused:ve,filled:xe,disabled:lt,name:Gn,uniqueId:Qt,useLabelElement:Qr,isSecuredField:Zr,children:At,renderAlternativeToLabel:gt})=>{const Ke={onClick:L,className:$({"adyen-checkout__label":!0,"adyen-checkout__label--focused":ve,"adyen-checkout__label--filled":xe,"adyen-checkout__label--disabled":lt})};return Qr?c("label",p(p({},Ke),!Zr&&Gn&&{htmlFor:Qt,id:`${Qt}-label`}),At):gt(Ke,At,Qt)},[]);return c("div",{"data-testid":"form-field",className:$("adyen-checkout__field",n,a==null?void 0:a.map(L=>`adyen-checkout__field--${L}`),{"adyen-checkout__field--error":s,"adyen-checkout__field--valid":u,"adyen-checkout__field--inactive":i||r})},c(R,{onFocusField:k,name:f,disabled:r,filled:ft,focused:ne,useLabelElement:_,uniqueId:Ve.current,isSecuredField:!Be,renderAlternativeToLabel:Z},pe()),Se())};ke.defaultProps={className:"",classNameModifiers:[],inputWrapperModifiers:[],useLabelElement:!0,showErrorElement:!0,showContextualElement:!0,renderAlternativeToLabel:()=>null};function va(t){const e={[Di]:t.encryptedFieldType,[Ii]:t["data-info"],[$i]:t.uniqueId,className:t.className};return c("span",e,t.children)}const Dn=(t,e)=>c("div",C(p({},t),{"aria-hidden":"true"}),e);function os(t){const{label:e,onFocusField:n=()=>{},error:a="",className:o="",classNameModifiers:r=[],focused:i,filled:s,isValid:d,frontCVC:l=!1,cvcPolicy:h=It,showContextualElement:u,contextualText:y}=t,{i18n:m}=O(),f=$(o,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":h===oa,"adyen-checkout__field__cvc--optional":h===xn}),x=$({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":a,"adyen-checkout__input--focus":i,"adyen-checkout__input--valid":d}),S=h!==xn?e:m.get("creditCard.securityCode.label.optional");return c(ke,{label:S,focused:i,filled:s,classNameModifiers:[...r,"securityCode"],onFocusField:()=>n(H),className:f,errorMessage:a,isValid:d,dir:"ltr",name:H,i18n:m,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:Dn,showContextualElement:u,contextualText:y,onInputContainerClick:()=>{n(H)}},c(va,{encryptedFieldType:H,className:x}),c(Fu,{frontCVC:l}))}function xa(n){var a=n,{setRef:t}=a,e=Ce(a,["setRef"]);const{autoCorrect:o,classNameModifiers:r,isInvalid:i,isValid:s,readonly:d=null,spellcheck:l,type:h,uniqueId:u,disabled:y}=e,m=e.className;Object.prototype.hasOwnProperty.call(e,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const f=D(W=>{e.onInput(W)},[e.onInput]),x=D(W=>{e!=null&&e.onKeyPress&&e.onKeyPress(W)},[e==null?void 0:e.onKeyPress]),S=D(W=>{e!=null&&e.onKeyUp&&e.onKeyUp(W)},[e==null?void 0:e.onKeyUp]),w=D(W=>{var Z,Pe;(Z=e==null?void 0:e.onBlurHandler)==null||Z.call(e,W),e.trimOnBlur&&(W.target.value=W.target.value.trim()),(Pe=e==null?void 0:e.onBlur)==null||Pe.call(e,W)},[e.onBlur,e.onBlurHandler]),k=D(W=>{var Z;(Z=e==null?void 0:e.onFocusHandler)==null||Z.call(e,W)},[e.onFocusHandler]),b=$("adyen-checkout__input",[`adyen-checkout__input--${h}`],m,{"adyen-checkout__input--invalid":i,"adyen-checkout__input--valid":s},r.map(W=>`adyen-checkout__input--${W}`)),U=e,{classNameModifiers:_,uniqueId:g,isInvalid:T,isValid:E,addContextualElement:P,autocomplete:A}=U,I=Ce(U,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","autocomplete"]);return c("input",C(p({id:u},I),{autocomplete:A,"aria-required":I.required,type:h,className:b,readOnly:d,spellcheck:l,autoCorrect:o,"aria-describedby":`${u}${i?sa:da}`,"aria-invalid":i,onInput:f,onBlur:w,onFocus:k,onKeyUp:S,onKeyPress:x,disabled:y,ref:t}))}xa.defaultProps={type:"text",classNameModifiers:[]};function In(t){return c(xa,C(p({classNameModifiers:["large"]},t),{"aria-required":t.required,type:"text"}))}function wa({children:t,classNameModifiers:e=[],classNamesFields:n=[],label:a,readonly:o=!1,description:r,id:i,renderLabelAsSectionHeading:s=!1}){const{i18n:d}=O(),l=ce(()=>Uo("fieldset-description"),[]);return c("fieldset",{id:i,className:$(["adyen-checkout__fieldset",...e.map(h=>`adyen-checkout__fieldset--${h}`),{"adyen-checkout__fieldset--readonly":o}]),"aria-describedby":r?l:null},a&&c("legend",{className:"adyen-checkout__fieldset__title"},s?c("h2",{className:"adyen-checkout__fieldset__title-heading"},d.get(a)):d.get(a)),r&&c("p",{id:l,className:"adyen-checkout__fieldset__description"},d.get(r)),c("div",{className:$("adyen-checkout__fieldset__fields",n)},t))}function Ou({brand:t,hasCVC:e,onFocusField:n,errors:a,valid:o,cvcPolicy:r,focusedElement:i,lastFour:s,expiryMonth:d,expiryYear:l,showContextualElement:h}){const{i18n:u}=O(),y=`${u.get("creditCard.storedCard.description.ariaLabel").replace("%@",s)}${d&&l?` ${u.get("creditCard.expiryDate.label")} ${d}/${l}`:""}`,m=t==="amex",f=m?u.get("creditCard.securityCode.contextualText.4digits"):u.get("creditCard.securityCode.contextualText.3digits");return c("div",{className:"adyen-checkout__card__form adyen-checkout__card__form--oneClick","aria-label":y},c(wa,{classNamesFields:["adyen-checkout__card__exp-cvc"]},d&&l&&c(ke,{label:u.get("creditCard.expiryDate.label"),classNameModifiers:["col-50","storedCard"],name:"expiryDateField",disabled:!0},c(In,{name:"expiryDateField",className:"adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick",value:`${d} / ${l}`,disabled:!0,dir:"ltr",autocomplete:void 0})),e&&c(os,{cvcPolicy:r,error:((x,S)=>x[S]?u.get(x[S]):null)(a,H),focused:i==="encryptedSecurityCode",filled:!!o.encryptedSecurityCode||!!a.encryptedSecurityCode,isValid:!!o.encryptedSecurityCode,label:u.get("creditCard.securityCode.label"),onFocusField:n,classNameModifiers:[...d&&l?["col-50","storedCard"]:["storedCard"]],frontCVC:m,showContextualElement:h,contextualText:f})))}function rs(t){const{items:e,name:n,onChange:a,value:o,isInvalid:r,uniqueId:i,ariaLabel:s,style:d="classic"}=t,{i18n:l}=O(),h=i==null?void 0:i.replace(/[0-9]/g,"").substring(0,i.lastIndexOf("-"));return c("div",p({className:$(["adyen-checkout__radio_group",`adyen-checkout__radio_group--${d}`]),role:"radiogroup"},s&&{"aria-label":s}),e.map(u=>{const y=Uo(h);return c("div",{key:u.id,className:"adyen-checkout__radio_group__input-wrapper"},c("input",{id:y,type:"radio",checked:o===u.id,className:"adyen-checkout__radio_group__input",name:n,onChange:a,onClick:a,value:u.id}),c("label",{className:$(["adyen-checkout__label__text","adyen-checkout__radio_group__label",t.className,{"adyen-checkout__radio_group__label--invalid":r}]),htmlFor:y},l.get(u.name)))}))}rs.defaultProps={onChange:()=>{},items:[],autocomplete:void 0};function Mu(r){var i=r,{filterable:t,toggleButtonRef:e,showList:n,selectListId:a}=i,o=Ce(i,["filterable","toggleButtonRef","showList","selectListId"]);if(t){const s=o,{id:d}=s,l=Ce(s,["id"]);return c("div",C(p({},l),{ref:e}))}return c("button",{role:"combobox",type:"button",id:o.id,className:o.className,"aria-haspopup":"listbox","aria-expanded":n,"aria-controls":a,"aria-activedescendant":o["aria-activedescendant"]||void 0,disabled:o.disabled,"aria-disabled":o.readonly,"aria-describedby":o.ariaDescribedBy,"aria-labelledby":o.id?`${o.id}-label ${o.id}-value`:void 0,onClick:o.onClick,onKeyDown:o.onKeyDown,ref:e},o.children)}function Lu(t){const{active:e,selected:n,inputText:a,readonly:o,showList:r,required:i}=t,s=ce(()=>{const y=n.selectedOptionName||n.name;return!(typeof y=="string"&&y.trim()!=="")},[n,t.placeholder]),d=n.selectedOptionName||n.name||t.placeholder||"",l=r?a!=null?a:"":d,h=o?null:t.filterable?y=>{y.preventDefault(),document.activeElement===t.filterInputRef.current?t.showList||t.toggleList(y):t.filterInputRef.current&&t.filterInputRef.current.focus()}:t.toggleList,u=e.id?`listItem-${e.id}`:"";return c(Mu,{className:$({"adyen-checkout__dropdown__button":!0,"adyen-checkout__dropdown__button--readonly":o,"adyen-checkout__dropdown__button--active":r,"adyen-checkout__dropdown__button--invalid":t.isInvalid,"adyen-checkout__dropdown__button--valid":t.isValid,"adyen-checkout__dropdown__button--disabled":n.disabled}),disabled:t.disabled,filterable:t.filterable,onClick:h,onKeyDown:o?null:t.onButtonKeyDown,toggleButtonRef:t.toggleButtonRef,id:t.id,showList:r,selectListId:t.selectListId,"aria-activedescendant":!t.filterable&&r&&u||void 0},t.filterable?c(G,null,!r&&n.icon&&c(we,{className:"adyen-checkout__dropdown__button__icon",src:n.icon,alt:n.name}),c("input",{value:l,"aria-autocomplete":"list","aria-controls":t.selectListId,"aria-expanded":r,"aria-owns":t.selectListId,autoComplete:"off",className:$("adyen-checkout__filter-input",{"adyen-checkout__filter-input--placeholder":!r&&s}),onInput:t.onInput,ref:t.filterInputRef,role:"combobox","aria-activedescendant":u,type:"text",readOnly:t.readonly,"aria-disabled":t.readonly,id:t.id,"aria-describedby":t.ariaDescribedBy,required:i}),!r&&n.secondaryText&&c("span",{className:"adyen-checkout__dropdown__button__secondary-text"},n.secondaryText)):c(G,null,n.icon&&c(we,{className:"adyen-checkout__dropdown__button__icon",src:n.icon,alt:n.name}),c("span",{id:t.id?`${t.id}-value`:void 0,className:$("adyen-checkout__dropdown__button__text",{"adyen-checkout__dropdown__button__text-placeholder":s})},d),n.secondaryText&&c("span",{className:"adyen-checkout__dropdown__button__secondary-text"},n.secondaryText)))}const Bu=o=>{var r=o,{item:t,active:e,selected:n}=r,a=Ce(r,["item","active","selected"]);return c("li",{"aria-disabled":!!t.disabled,"aria-selected":n,className:$(["adyen-checkout__dropdown__element",{"adyen-checkout__dropdown__element--active":e,"adyen-checkout__dropdown__element--disabled":!!t.disabled}]),"data-disabled":t.disabled===!0||null,"data-value":t.id,onClick:a.onSelect,onMouseEnter:a.onHover,role:"option",id:`listItem-${t.id}`},t.icon&&c(we,{className:"adyen-checkout__dropdown__element__icon",alt:t.name,src:t.icon}),c("span",{className:"adyen-checkout__dropdown__element__text"},t.name),t.secondaryText&&c("span",{className:"adyen-checkout__dropdown__element__secondary-text"},t.secondaryText),n&&c(ka,{type:`${Kt}checkmark_black`,height:14,width:14}))};function Vu(r){var i=r,{selected:t,active:e,filteredItems:n,showList:a}=i,o=Ce(i,["selected","active","filteredItems","showList"]);const{i18n:s}=O();return c("ul",{className:$({"adyen-checkout__dropdown__list":!0,"adyen-checkout__dropdown__list--active":a}),id:o.selectListId,ref:o.selectListRef,role:"listbox"},n.length?n.map(d=>c(Bu,{active:d.id===e.id,item:d,key:d.id,onSelect:o.onSelect,onHover:o.onHover,selected:d.id===t.id})):c("li",null,c("div",{className:"adyen-checkout__dropdown__element adyen-checkout__dropdown__element--no-options"},s.get("select.noOptionsFound"))))}const ot={arrowDown:"ArrowDown",arrowUp:"ArrowUp",enter:"Enter",escape:"Escape",space:" ",tab:"Tab"},zu=t=>{const e=t.parentNode,n=window.getComputedStyle(e,null),a=parseInt(n.getPropertyValue("border-top-width")),o=t.offsetTop-e.offsetTop<e.scrollTop,r=t.offsetTop-e.offsetTop+t.clientHeight-a>e.scrollTop+e.clientHeight;(o||r)&&(e.scrollTop=t.offsetTop-e.offsetTop-e.clientHeight/2-a+t.clientHeight/2)};function Ht({items:t=[],className:e="",classNameModifiers:n=[],filterable:a=!0,readonly:o=!1,onChange:r=()=>{},onInput:i,selectedValue:s,name:d,isInvalid:l,isValid:h,placeholder:u,uniqueId:y,disabled:m,disableTextFilter:f,clearOnSelect:x,blurOnClose:S,onListToggle:w,required:k}){const{i18n:b}=O(),_=J(null),g=J(null),T=J(null),E=J(null),[P,A]=N(null),[I,U]=N(!1),[W,Z]=N(null),Pe=ce(()=>`select-${ze()}`,[]),fe=t.find(R=>R.id===s)||{},[Be,Ae]=N(),[Ie,Ve]=N(fe),et=fe,ne=f?t:t.filter(R=>!P||R.name.toLowerCase().includes(P.toLowerCase())),De=y?`${y}${l?sa:da}`:null,ft=R=>{if(!R)return;const L=document.getElementById(`listItem-${R.id}`);zu(L)},j=()=>{S&&_.current.blur(),U(!1)},ie=()=>{U(!0)},ye=R=>{const L=R.currentTarget.getAttribute("data-value");return ne.find(ve=>ve.id==L)},pe=R=>{let L;R.preventDefault(),L=R.currentTarget instanceof HTMLElement&&R.currentTarget.getAttribute("role")==="option"?ye(R):Ie.id&&ne.some(ve=>ve.id===Ie.id)?Ie:P?ne[0]:{id:s},L&&!L.disabled&&(r({target:{value:L.id,name:d}}),x&&Ae(null),j())},Se=R=>{switch(R.key){case ot.space:case ot.enter:pe(R);break;case ot.arrowDown:R.preventDefault(),(()=>{if(!ne||ne.length<1)return;const L=ne.findIndex(lt=>lt.id===Ie.id)+1,ve=L<ne.length?L:0,xe=ne[ve];ft(xe),Ve(xe)})();break;case ot.arrowUp:R.preventDefault(),(()=>{if(!ne||ne.length<1)return;const L=ne.findIndex(lt=>lt.id===Ie.id)-1,ve=L<0?ne.length-1:L,xe=ne[ve];ft(xe),Ve(xe)})()}};return F(()=>{I?Ae(null):A(null)},[I]),F(()=>{I&&a&&_.current&&_.current.focus(),w==null||w(I)},[I]),F(()=>{function R(L){(L.composedPath?!L.composedPath().includes(g.current):!g.current.contains(L.target))&&j()}return document.addEventListener("click",R,!1),()=>{document.removeEventListener("click",R,!1)}},[g]),F(()=>{const R=setTimeout(()=>{ne.length===0?Z(b.get("select.noOptionsFound")):Z(b.get("select.results",{values:{count:ne.length}}))},500);return()=>clearTimeout(R)},[I,ne.length,b]),c("div",{className:$(["adyen-checkout__dropdown",e,...n.map(R=>`adyen-checkout__dropdown--${R}`)]),ref:g},c(Lu,{inputText:Be,id:y!=null?y:null,active:Ie,selected:et,filterInputRef:_,filterable:a,isInvalid:l,isValid:h,onButtonKeyDown:R=>{R.key===ot.enter&&a&&I&&P?pe(R):R.key===ot.escape?j():![ot.arrowUp,ot.arrowDown,ot.enter].includes(R.key)&&(R.key!==ot.space||a&&I)?(R.shiftKey&&R.key===ot.tab||R.key===ot.tab)&&j():(R.preventDefault(),I?Se(R):ie())},onInput:R=>{const L=R.target.value;Ae(L),A(L),I||ie(),i&&i(L)},placeholder:u,readonly:o,selectListId:Pe,showList:I,toggleButtonRef:T,toggleList:R=>{R.preventDefault(),I?(Ae(et.name),j()):(Ae(null),ie())},disabled:m,ariaDescribedBy:De,required:k}),c(Vu,{active:Ie,filteredItems:ne,onHover:R=>{R.preventDefault();const L=ye(R);Ve(L)},onSelect:pe,selected:et,selectListId:Pe,selectListRef:E,showList:I}),c("div",{key:Be,role:"status","aria-live":"polite","aria-relevant":"additions text",className:"adyen-checkout-sr-panel--sr-only"},W))}Ht.defaultProps={className:"",classNameModifiers:[],filterable:!0,items:[],readonly:!1,onChange:()=>{}};const Ca=na(void 0),$n=()=>{var e;const t=Lt(Ca);if(!t)throw new Error("useAmount must be used within an AmountProvider");return{amount:t.amount,isZeroAuth:((e=t.amount)==null?void 0:e.value)===0}},Uu=()=>{const t=Lt(Ca);if(!t)throw new Error("useAmount must be used within an AmountProvider");return{secondaryAmount:t.secondaryAmount}},ju=({amount:t,secondaryAmount:e,providerRef:n,children:a})=>{const o=Lt(Ca),[r,i]=N(t),[s,d]=N(e);F(()=>{i(t)},[t]),$c(n,()=>({update:(h,u)=>{i(h),d(u)}}));const l=ce(()=>({amount:r,secondaryAmount:s}),[r,s]);return o?c(G,null,a):c(Ca.Provider,{value:l},a)};function jo(t){var w,k,b;const{i18n:e}=O(),{amount:n}=$n(),{brand:a,onChange:o,type:r}=t,i=t.installmentOptions[a]||t.installmentOptions.card,s=((w=i==null?void 0:i.values)==null?void 0:w.length)===1,[d,l]=N((i==null?void 0:i.preselectedValue)||(i==null?void 0:i.values[0])),[h,u]=N("onetime"),y=((k=i==null?void 0:i.plans)==null?void 0:k.includes("revolving"))||((b=i==null?void 0:i.plans)==null?void 0:b.includes("bonus")),m=ce(()=>(function(_,g){return _?[{id:"onetime",name:"installments.oneTime"},{id:"installments",name:"installments.installments"},...g!=null&&g.includes("revolving")?[{id:"revolving",name:"installments.revolving"}]:[],...g!=null&&g.includes("bonus")?[{id:"bonus",name:"installments.bonus"}]:[]]:[]})(y,i==null?void 0:i.plans),[y,i]),f=_=>{const g=_.target.value;l(Number(g))},x=_=>{const g=_.currentTarget.getAttribute("value");u(g)},S=_=>{let g,T;return r==="amount"?(g="installmentOption",T={count:_,values:{times:_,partialValue:(E=>e.amount(n.value/E,n.currency))(_)}}):(g="installmentOptionMonths",T={count:_,values:{times:_}}),{id:_,name:n.value?e.get(g,T):`${_}`}};return F(()=>{var _,g;(_=i==null?void 0:i.values)!=null&&_.includes(d)||l((g=i==null?void 0:i.preselectedValue)!=null?g:i==null?void 0:i.values[0])},[a]),F(()=>{const _=p(p(p({value:d},y&&h==="onetime"&&{value:1}),y&&h==="revolving"&&{value:1,plan:"revolving"}),y&&h==="bonus"&&{value:1,plan:"bonus"});o(i?_:{value:null})},[o,y,d,i,h]),i&&n&&n.value!==0?y?c("div",{className:"adyen-checkout__installments adyen-checkout__installments--revolving-plan"},c(ke,{label:e.get("installments"),classNameModifiers:["installments"],name:"installmentsPseudoLabel",useLabelElement:!1,showContextualElement:!1,renderAlternativeToLabel:Dn},c(wa,{classNameModifiers:["revolving-plan"],label:""},c(rs,{items:m,onChange:x,value:h,ariaLabel:e.get("installments")}),c(ke,{className:h!=="installments"?"revolving-plan-installments__disabled":"revolving-plan-installments",classNameModifiers:["revolving-plan-installments"],name:"",useLabelElement:!1,showContextualElement:!1},c(Ht,{filterable:!1,items:i.values.map(S),selectedValue:d,onChange:f,name:"installments",disabled:h!=="installments"}))))):c("div",{className:"adyen-checkout__installments"},c(ke,{label:e.get("installments"),classNameModifiers:["installments"],name:"installments",showContextualElement:!1},c(Ht,{filterable:!1,items:i.values.map(S),selectedValue:d,onChange:f,name:"installments",readonly:s,disabled:s}))):null}jo.defaultProps={brand:"",onChange:()=>{}};const qt=(t,e=!1)=>{let n;try{n=new URL(t)}catch(a){return!1}return e&&n.protocol==="http:"||n.protocol==="https:"},Ko=["ar","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","el-GR","en-US","es-ES","et-EE","fi-FI","fr-FR","hr-HR","hu-HU","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","zh-CN","zh-TW"],Sa="en-US",Ku=2,Hu=5,Ho=t=>t.toLowerCase().substring(0,2),is=t=>!!t&&t.length>=Ku&&t.length<=Hu;function ss(t,e){return t&&typeof t=="string"&&e.find(n=>Ho(n)===Ho(t))||null}function ds(t){const e=t.replace("_","-");if(/^([a-z]{2})(-)([A-Z]{2})$/.test(e))return e;const[n,a]=e.split("-");if(!n||!a)return null;const o=[n.toLowerCase(),a.toUpperCase()].join("-");return o.length===5?o:null}function qu(t,e){if(!is(t))return Sa;const n=ds(t);return n&&e.includes(n)?n:ss(n||t,e)||Sa}function Wu(t={}){return Object.keys(t).reduce((e,n)=>(is(n)&&(e[ds(n)||Ho(n)]=t[n]),e),{})}const qo=(t,e)=>t.replace(/%{(\w+)}/g,(n,a)=>e[a]||""),Gu=(t,e,n={})=>{const{values:a={},count:o=0}=n,r=`${e}__plural`,i=s=>`${e}__${s}`;return Object.prototype.hasOwnProperty.call(t,i(o))?qo(t[i(o)],a):Object.prototype.hasOwnProperty.call(t,r)&&o>1?qo(t[r],a):Object.prototype.hasOwnProperty.call(t,e)?qo(t[e],a):null},Yu=(t,e)=>{const n=t.split(/%#(.*?)%#/gm);if(e.length!==Math.floor(n.length/2))throw Error("The number of functions provided does not match the number of elements in the translation string.");return n.map((a,o)=>{const r=Math.floor(o/2);return o%2==0?a:e[r](a)})},Ju=({to:t,children:e})=>c("a",{className:"adyen-checkout-link",href:t,target:"_blank",rel:"noopener noreferrer"},e);function Wo({message:t,urls:e=[]}){return c("span",{className:"adyen-checkout-disclaimer__label"},c(cs,{message:t,urls:e}))}function cs({message:t,urls:e}){const n=typeof t=="string",a=e.every(r=>typeof r=="string"&&qt(r));if(!n||!a)return null;let o;try{o=Yu(t,e.map(r=>function(i){return c(Ju,{to:r},i)}))}catch(r){o=t,console.warn(r)}return c(G,null,o)}const Qu=({sfpState:t,setFocusOn:e,cvcPolicy:n,focusedElement:a,hasInstallments:o,handleInstallments:r,showAmountsInInstallments:i,showContextualElement:s,hasCVC:d,installmentOptions:l,lastFour:h,expiryMonth:u,expiryYear:y,disclaimerMessage:m})=>c(ns,{status:t.status},c(Ou,{errors:t.errors,brand:t.brand,hasCVC:d,cvcPolicy:n,onFocusField:e,focusedElement:a,valid:t.valid,lastFour:h,expiryMonth:u,expiryYear:y,showContextualElement:s}),o&&c(jo,{brand:t.brand,installmentOptions:l,onChange:r,type:i?"amount":"months"}),m&&c(Wo,{message:m.message.replace("%{linkText}",`%#${m.linkText}%#`),urls:[m.link]})),Go=({src:t,alt:e,wrapperClassName:n="",imgClassName:a="",showOnError:o,as:r})=>{const[i,s]=N(!1),d=$("adyen-checkout-brand-wrapper",n,o?{}:{"adyen-checkout-brand-wrapper--error":i});return c(r!=null?r:"span",{className:d,"data-testid":"brand-image-wrapper"},c(we,{className:a,src:t,alt:e,onError:()=>s(!0)}))};function ls({brand:t,brandsConfiguration:e}){var i,s;const n=$e(),a=t==="card",o=a?"nocard":t,r=(s=(i=e==null?void 0:e[t])==null?void 0:i.icon)!=null?s:Yi(o,n);return c(Go,{imgClassName:"adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon",alt:a?"":Mo(t),src:r})}var Ea={dualBrandSelector:"DualBrandSelector-module_dualBrandSelector__Fz7UW",dualBrandSelectorButton:"DualBrandSelector-module_dualBrandSelectorButton__3Dxem",dualBrandSelectorButtonSelected:"DualBrandSelector-module_dualBrandSelectorButtonSelected__EswTK",dualBrandSelectorIcon:"DualBrandSelector-module_dualBrandSelectorIcon__qeN0L"};function Zu({dualBrandingElements:t,brandsConfiguration:e,dualBrandingChangeHandler:n,selectedBrandValue:a}){const{i18n:o}=O(),r=Cu(t,e),[i,s]=N(a),d=l=>{s(l),n(l)};return c("div",{className:Ea.dualBrandSelector,role:"group","aria-label":o.get("creditCard.dualBrand.description")},r.map(l=>c("button",{key:l.id,type:"button",className:$(Ea.dualBrandSelectorButton,{[Ea.dualBrandSelectorButtonSelected]:i===l.id}),onMouseDown:h=>h.preventDefault(),onClick:()=>d(l.id),onKeyDown:h=>((u,y)=>{u.key==="Enter"&&(u.preventDefault(),d(y))})(h,l.id),"aria-label":l.altName,"aria-pressed":i===l.id},c("img",{src:l.imageURL,alt:l.altName,className:Ea.dualBrandSelectorIcon}))))}function Xu(t){const{i18n:e}=O(),{error:n="",isValid:a=!1,onFocusField:o=()=>{},dualBrandingElements:r,dualBrandingChangeHandler:i,brandsConfiguration:s,selectedBrandValue:d}=t,l=!!r&&Lo(Bo,r,"id"),h=l?e.get("creditCard.dualBrand.description"):void 0;return c(ke,{label:t.label,focused:t.focused,filled:t.filled,classNameModifiers:["cardNumber"],onFocusField:()=>o(V),errorMessage:n,isValid:a,dir:"ltr",name:V,showValidIcon:!1,i18n:e,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:Dn,onInputContainerClick:()=>{o(V)},contextualText:h},c(va,{encryptedFieldType:V,className:$({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":n,"adyen-checkout__input--focus":t.focused,"adyen-checkout__input--valid":a,"adyen-checkout__card__cardNumber__input--noBrand":!t.showBrandIcon})}),t.showBrandIcon&&!r&&c(ls,{brandsConfiguration:t.brandsConfiguration,brand:t.brand}),r&&!n&&c("div",{className:$(["adyen-checkout__card__dual-branding__icons"])},l?c(Zu,{dualBrandingElements:r,dualBrandingChangeHandler:i,brandsConfiguration:s,selectedBrandValue:d}):r.map(u=>c(ls,{key:u.id,brand:u.id,brandsConfiguration:t.brandsConfiguration}))),c("span",{className:"adyen-checkout__card__dual-branding__sr-only","aria-live":"polite"},h))}function ep(t){const{label:e,focused:n,filled:a,onFocusField:o,className:r="",classNameModifiers:i=[],error:s="",isValid:d=!1,expiryDatePolicy:l=Et,showContextualElement:h,contextualText:u}=t,{i18n:y}=O(),m=$e(),f=$(r,{"adyen-checkout__field__exp-date":!0,"adyen-checkout__card__exp-date__input--hidden":l===en,"adyen-checkout__field__exp-date--optional":l===wn}),x=l!==wn?e:`${e} ${y.get("field.title.optional")}`;return c(ke,{label:x,classNameModifiers:[...i,"expiryDate"],className:f,focused:n,filled:a,onFocusField:()=>o(q),errorMessage:s,isValid:d,dir:"ltr",name:"encryptedExpiryDate",i18n:y,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:Dn,showContextualElement:h,contextualText:u,onInputContainerClick:()=>{o(q)}},c(va,{encryptedFieldType:q,className:$("adyen-checkout__input","adyen-checkout__input--small","adyen-checkout__card__exp-date__input",{"adyen-checkout__input--error":s,"adyen-checkout__input--focus":n,"adyen-checkout__input--valid":d})}),c(Go,{wrapperClassName:s||d?$("adyen-checkout__field__exp-date_hint_wrapper","adyen-checkout__field__exp-date_hint_wrapper--hidden"):"adyen-checkout__field__exp-date_hint_wrapper",imgClassName:"adyen-checkout__field__exp-date_hint",alt:"",src:m({imageFolder:"components/"})("expiry_date_hint")}))}var sn={container:"BrandIcons-module_container__FeCxK",grid:"BrandIcons-module_grid__wb0DE",smallImgGrid:"BrandIcons-module_smallImgGrid__iCMqT",remainingBrandsLabel:"BrandIcons-module_remainingBrandsLabel__v0FKS",img:"BrandIcons-module_img__Oe3i-",smallImg:"BrandIcons-module_smallImg__GwOZ0"};const tp=({brandIcons:t,maxBrandsToShow:e=t.length,remainingBrandsLabel:n,className:a,containerType:o="flex",remainingBrandsLabelClassName:r,brandImageClassName:i,brandImageWrapperClassName:s,showIconOnError:d,smallIcons:l,renderBrandIcon:h,ariaHidden:u})=>{const y=ce(()=>t.slice(0,e),[t,e]),m=ce(()=>t.slice(e),[t,e]),f=!!n||m.length>0;return c("ul",{className:$(sn.container,{[sn.grid]:o==="grid",[sn.smallImgGrid]:l&&o==="grid"},a),"aria-hidden":u},y.map(x=>h?h(x):c(Go,{as:"li",key:x.alt,src:x.src,alt:x.alt,wrapperClassName:s,imgClassName:$(sn.img,{[sn.smallImg]:l},i),showOnError:d})),f&&c("li",{className:$(sn.remainingBrandsLabel,r)},n||`+ ${m.length}`))},np=({brands:t,activeBrand:e})=>{if(!(t!=null&&t.length))return null;const n=e!=="card",a=ce(()=>t.map(o=>({src:o.icon,alt:Mo(o.name)})),[t]);return c(tp,{className:$("adyen-checkout__card__brands",{"adyen-checkout__card__brands--hidden":n}),brandIcons:a,smallIcons:!0,showIconOnError:!0,containerType:"grid",ariaHidden:n||void 0})};function ap({brand:t,brandsIcons:e,brandsConfiguration:n,dualBrandingElements:a,selectedBrandValue:o,dualBrandingChangeHandler:r,errors:i,focusedElement:s,hasCVC:d,cvcPolicy:l,expiryDatePolicy:h,onFocusField:u,showBrandIcon:y,valid:m,showContextualElement:f}){const{i18n:x}=O(),S=(_,g)=>_[g]?x.get(_[g]):null,w=e==null?void 0:e.filter(_=>!(ra!=null&&ra.includes(_.name))),k=t==="amex",b=k?x.get("creditCard.securityCode.contextualText.4digits"):x.get("creditCard.securityCode.contextualText.3digits");return c("div",{className:"adyen-checkout__card__form"},c(Xu,{brand:t,brandsConfiguration:n,error:S(i,V),focused:s===V,isValid:!!m.encryptedCardNumber,label:x.get("creditCard.cardNumber.label"),onFocusField:u,filled:!!i.encryptedCardNumber||!!m.encryptedCardNumber,showBrandIcon:y,dualBrandingElements:a,selectedBrandValue:o,dualBrandingChangeHandler:r}),c(np,{activeBrand:t,brands:w}),c("div",{className:$("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":h===en})},c(ep,{classNameModifiers:["col-50"],error:S(i,q),focused:s===q,isValid:!!m.encryptedExpiryMonth&&!!m.encryptedExpiryYear,filled:!!i.encryptedExpiryDate||!!m.encryptedExpiryYear,label:x.get("creditCard.expiryDate.label"),onFocusField:u,expiryDatePolicy:h,showContextualElement:f,contextualText:x.get("creditCard.expiryDate.contextualText")}),d&&c(os,{classNameModifiers:["col-50"],error:S(i,H),focused:s===H,cvcPolicy:l,isValid:!!m.encryptedSecurityCode,filled:!!i.encryptedSecurityCode||!!m.encryptedSecurityCode,label:x.get("creditCard.securityCode.label"),onFocusField:u,frontCVC:k,showContextualElement:f,contextualText:b})))}function us(t){return c(xa,C(p({},t),{type:"tel"}))}function op(t){const{i18n:e}=O(),n=ce(()=>{var a;return((a=t.value)==null?void 0:a.length)>6?e.get("creditCard.taxNumber.labelAlt"):e.get("creditCard.taxNumber.label")},[t.value]);return c("div",{className:"adyen-checkout__card__kcp-authentication"},c(ke,{label:n,filled:t.filled,classNameModifiers:["kcp-taxNumber"],errorMessage:t.error&&e.get(_o),isValid:t.isValid,dir:"ltr",name:"kcpTaxNumberOrDOB",onFocus:a=>t.onFieldFocusAnalytics("taxNumber",a),onBlur:a=>t.onFieldBlurAnalytics("taxNumber",a)},c(us,{name:"kcpTaxNumberOrDOB",className:"adyen-checkout__card__kcp-taxNumber__input adyen-checkout__input",maxLength:10,minLength:6,autoComplete:"false",value:t.value,required:!0,onBlur:t.onBlur,onInput:t.onInput,disabled:t.disabled,placeholder:t.placeholder})),c(ke,{label:e.get("creditCard.password.label"),focused:t.focusedElement==="encryptedPassword",filled:t.filled,classNameModifiers:["50","koreanAuthentication-encryptedPassword"],onFocusField:()=>t.onFocusField("encryptedPassword"),errorMessage:t.encryptedPasswordState.errors&&e.get(String(t.encryptedPasswordState.errors)),isValid:t.encryptedPasswordState.valid,dir:"ltr",name:"encryptedPassword",useLabelElement:!1,renderAlternativeToLabel:Dn},c(va,{encryptedFieldType:"encryptedPassword",className:$({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__input--error":t.encryptedPasswordState.errors,"adyen-checkout__input--valid":t.encryptedPasswordState.valid,"adyen-checkout__input--focus":t.focusedElement==="encryptedPassword"})})))}const rp=({onBlur:t,onInput:e,valid:n=!1,error:a=null,data:o="",required:r=!1,disabled:i=!1,onFieldFocusAnalytics:s=null,onFieldBlurAnalytics:d=null})=>{const{i18n:l}=O();return c(ke,{label:`${l.get("boleto.socialSecurityNumber")}`,classNameModifiers:["socialSecurityNumber"],errorMessage:a&&a.errorMessage?l.get(a.errorMessage):!!a,isValid:!!n,name:"socialSecurityNumber",onFocus:h=>s==null?void 0:s("socialSecurityNumber",h),onBlur:h=>d==null?void 0:d("socialSecurityNumber",h)},c(In,{name:"socialSecurityNumber",autocorrect:"off",spellcheck:!1,value:o,maxlength:18,onInput:e,onBlur:t,required:r,disabled:i,autocomplete:void 0}))};function Yo(i){var s=i,{classNameModifiers:t=[],label:e,isInvalid:n,onChange:a,disabled:o=!1}=s,r=Ce(s,["classNameModifiers","label","isInvalid","onChange","disabled"]);const y=r,{uniqueId:d,showErrorElement:l,showContextualElement:h}=y,u=Ce(y,["uniqueId","showErrorElement","showContextualElement"]);return c("label",{className:"adyen-checkout__checkbox",htmlFor:d},c("input",C(p(p(p({id:d},u),l&&{"aria-describedby":`${d}${sa}`}),h&&{"aria-describedby":`${d}${da}`}),{className:$(["adyen-checkout__checkbox__input",[r.className],{"adyen-checkout__checkbox__input--invalid":n},t.map(m=>`adyen-checkout__input--${m}`)]),type:"checkbox",disabled:o,onChange:a})),c("span",{className:"adyen-checkout__checkbox__label"},e))}Yo.defaultProps={onChange:()=>{}};function ip(o){var r=o,{storeDetails:t=!1,disabled:e=!1,className:n=""}=r,a=Ce(r,["storeDetails","disabled","className"]);const{i18n:i}=O(),[s,d]=N(t);return F(()=>{a.onChange(s)},[s]),c("div",{className:$("adyen-checkout__store-details",n)},c(Yo,{onChange:l=>{d(l.target.checked)},disabled:e,label:i.get("storeDetails"),name:"storeDetails"}))}const sp=({data:t,label:e})=>{const{street:n,houseNumberOrName:a,city:o,postalCode:r,stateOrProvince:i,country:s}=t;return c(wa,{classNameModifiers:[e],label:e,readonly:!0},c(G,null,!!n&&n,a&&`, ${a},`,c("br",null),r&&`${r}`,o&&`, ${o}`,i&&i!==fa&&`, ${i}`,s&&`, ${s} `))},me=t=>({formatterFn:e=>e.replace(Ut("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),dp=Ut(qi),Jo=t=>ru(t).replace(dp,""),cp={postalCode:{formatterFn:(t,e)=>{var o;const n=e.state.data.country,a=(o=Qo[n])==null?void 0:o.postalCode.formatterFn;return a?a(t):t}},street:{formatterFn:Jo},houseNumberOrName:{formatterFn:Jo},city:{formatterFn:Jo}},Qo={AT:{postalCode:me(4)},AU:{postalCode:me(4)},BE:{postalCode:me(4)},BG:{postalCode:me(4)},BR:{postalCode:{formatterFn:t=>{const e=t.replace(Ut("^\\d-","g"),""),n=e.includes("-")?9:8;return e.substring(0,n)},format:"12345678 or 12345-678",maxlength:9}},CA:{postalCode:{format:"A9A 9A9 or A9A9A9",maxlength:7}},CH:{postalCode:me(4)},CY:{postalCode:me(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:me(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:me(5)},ES:{postalCode:me(5)},FI:{postalCode:me(5)},FR:{postalCode:me(5)},GB:{postalCode:{formatterFn:t=>t.replace(Ut(qi),"").substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode:me(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:me(3)},IT:{postalCode:me(5)},LI:{postalCode:me(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:me(4)},LV:{postalCode:{format:"9999 or LV-9999",maxlength:7}},MC:{postalCode:{format:"980NN",maxlength:5}},MT:{postalCode:{format:"AA99 or AAA99 or AA9999 or AAA9999",maxlength:8}},MY:{postalCode:me(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:me(4)},NO:{postalCode:me(4)},PL:{postalCode:{formatterFn:t=>{const e=t.replace(Ut("^\\d-","g"),""),n=e.includes("-")?6:5;return e.substring(0,n)},format:"99999 or 99-999",maxlength:6}},PT:{postalCode:{formatterFn:t=>t.replace(Ut("^\\d-","g"),"").substring(0,8),format:"9999-999",maxlength:8}},RO:{postalCode:me(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:me(5)},SG:{postalCode:me(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const e=t.replace(Ut("^\\d-","g"),""),n=e.includes("-")?10:5;return e.substring(0,n)},format:"99999 or 99999-9999"}}},he=t=>({pattern:new RegExp(`\\d{${t}}`)}),ps=(t,e,n)=>{var a,o;if(e){if(zt(t))return null;n.postalCode.errorMessage={translationKey:yo,translationObject:{values:{format:((a=Qo[e])==null?void 0:a.postalCode.format)||null}}};const r=(o=lp[e])==null?void 0:o.pattern;return r?r.test(t):!!t}return!zt(t)||null},lp={AT:he(4),AU:he(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:he(4),BR:{pattern:/^\d{5}-?\d{3}$/},CA:{pattern:/(?:[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d)/},CH:{pattern:/[1-9]\d{3}/},CY:he(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:he(5),DK:he(4),EE:he(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:he(5),FR:he(5),GB:{pattern:/^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/},GE:he(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:he(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:he(3),IT:he(5),LI:he(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:he(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:he(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:he(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:he(6),SI:he(4),SE:he(5),SG:he(6),SK:he(5),US:he(5)},up=t=>{const e={postalCode:{modes:["blur"],validate:n=>ps(n,t,e),errorMessage:nt}};return e},pp=t=>{const e={postalCode:{modes:["blur"],validate:(n,a)=>{const o=a.state.data.country;return ps(n,o,e)},errorMessage:nt},houseNumberOrName:{validate:(n,a)=>{var r,i;const o=(i=(r=a.state)==null?void 0:r.data)==null?void 0:i.country;return o&&t.countryHasOptionalField(o,"houseNumberOrName")||!zt(n)||null},modes:["blur"],errorMessage:nt},default:{validate:n=>!zt(n)||null,modes:["blur"],errorMessage:nt}};return e};function hs(t,e){if(t==null)throw new Error(e);return t}const hp="https://checkoutshopper-live.adyen.com/checkoutshopper/",Zo=hs("6.40.1","LIBRARY_VERSION is not defined"),ys=hs("esm","BUNDLE_TYPE is not defined"),yp=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],mp=6e4;var Xo=(function(t){return t.WEB="web",t})({});const er="web";var ms=(function(t){return t.NATIVE="nativeComponent",t.GENERIC="genericComponent",t})({});function _s(t,e){const{headers:n=[],errorLevel:a="warn",errorCode:o,loadingContext:r=hp,method:i="GET",path:s,timeout:d=mp}=t,l=p(p({method:i,mode:"cors",cache:"default",credentials:"same-origin",headers:p({Accept:"application/json, text/plain, */*","Content-Type":i==="POST"?"application/json":"text/plain"},n),redirect:"follow",referrerPolicy:"no-referrer-when-downgrade"},(AbortSignal==null?void 0:AbortSignal.timeout)&&{signal:AbortSignal==null?void 0:AbortSignal.timeout(d)}),e&&{body:JSON.stringify(e)}),h=`${r}${s}`;return fetch(h,l).then(async u=>{if(u.status===204)return;const y=await u.json();if(u.ok)return y;if((function(m){return m&&m.errorCode&&m.errorType&&m.message&&m.status})(y))return void tr({message:y.message,level:a,cause:y,code:o});tr({message:t.errorMessage||`Service at ${h} is not available`,level:a,cause:y,code:o})}).catch(u=>{if(u instanceof z)throw u;tr({message:t.errorMessage||`Call to ${h} failed. Error= ${u}`,level:a,cause:u,code:o})})}function tr({message:t,level:e,cause:n,code:a}){switch(e){case"silent":break;case"info":case"warn":case"error":console[e](t);break;default:throw new z("NETWORK_ERROR",t,{cause:n,code:a})}}function fs(t,e){return _s(C(p({},t),{method:"GET"}),e)}function Ge(t,e){return _s(C(p({},t),{method:"POST"}),e)}function gs(t,e,n){return fs({loadingContext:e,errorLevel:"warn",errorMessage:`Dataset ${t} is not available`,path:n?`datasets/${t}/${n}.json`:`datasets/${t}.json`})}function _p(t){const{classNameModifiers:e,label:n,onDropdownChange:a,readOnly:o,selectedCountry:r,specifications:i,value:s,required:d}=t,{i18n:l,loadingContext:h}=O(),[u,y]=N([]),[m,f]=N(!1);return ro(()=>{if(!r||!i.countryHasDataset(r))return y([]),void f(!0);gs(`states/${r}`,h,l.locale).then(x=>{const S=x&&x.length?x:[];y(S),f(!0)}).catch(()=>{y([]),f(!0)})},[r]),m&&u.length?c(ke,{label:n,classNameModifiers:e,errorMessage:t.errorMessage,isValid:!!s,showValidIcon:!1,name:"stateOrProvince",i18n:l,readOnly:o&&!!s},c(Ht,{name:"stateOrProvince",onChange:a,selectedValue:s,items:u,required:d,readonly:o&&!!s})):null}function fp(t){const{allowedCountries:e=[],classNameModifiers:n=[],errorMessage:a,onDropdownChange:o,value:r,required:i}=t,{i18n:s,loadingContext:d}=O(),[l,h]=N([]),[u,y]=N(!1),[m,f]=N(t.readOnly);return ro(()=>{gs("countries",d,s.locale).then(x=>{const S=((w,k)=>{const b=_=>C(p({},_),{name:_.name,selectedOptionName:_.name});return k.length?w.filter(_=>k.includes(_.id)).map(b):w.map(b)})(x,e);h(S||[]),f(S.length===1||m),y(!0)}).catch(x=>{console.error(x),h([]),y(!0)})},[]),u?c(ke,{name:"country",label:s.get("country"),errorMessage:a,classNameModifiers:n,isValid:!!r,showValidIcon:!1,i18n:s,readOnly:m&&!!r},c(Ht,{onChange:o,name:"country",selectedValue:r,items:l,readonly:m&&!!r,required:i})):null}function gp(t,e){const n=mu[t];if(n)return e==="billingAddress"?`billing ${n}`:e==="deliveryAddress"?`shipping ${n}`:n}function bp(t){const{i18n:e}=O(),{classNameModifiers:n=[],data:a,errors:o,valid:r,fieldName:i,onInput:s,onBlur:d,trimOnBlur:l,maxLength:h,disabled:u,addressType:y}=t,m=a[i],f=a.country,x=t.specifications.countryHasOptionalField(f,i),S=t.specifications.getKeyForField(i,f),w=x?` ${e.get("field.title.optional")}`:"",k=`${e.get(S)}${w}`,b=(function(_,g,T,E){var P,A;if(typeof((P=_[g])==null?void 0:P.errorMessage)=="object"){const{translationKey:I,translationObject:U}=_[g].errorMessage;return T.get(I,U)}return T.get((A=_[g])==null?void 0:A.errorMessage,{values:{label:E.toLowerCase()}})||!!_[g]})(o,i,e,k);switch(i){case"country":return c(fp,{allowedCountries:t.allowedCountries,classNameModifiers:n,label:k,errorMessage:b,onDropdownChange:t.onDropdownChange,value:m,required:!x});case"stateOrProvince":return c(_p,{classNameModifiers:n,label:k,errorMessage:b,onDropdownChange:t.onDropdownChange,selectedCountry:f,specifications:t.specifications,value:m,required:!x});default:return c(ke,{label:k,classNameModifiers:n,errorMessage:b,isValid:r[i],name:i,i18n:e,onFocus:_=>t.onFieldFocusAnalytics(i,_),onBlur:_=>t.onFieldBlurAnalytics(i,_)},c(In,{name:i,classNameModifiers:n,value:m,onInput:s,onBlur:d,maxlength:h,trimOnBlur:l,disabled:u,required:!x,autocomplete:gp(i,y)}))}}const kp=300,nr=(t,e=300)=>{let n;return function(...a){clearTimeout(n),n=setTimeout(()=>t.apply(this,a),e)}};function vp({onAddressLookup:t,onAddressSelected:e,onSelect:n,onManualAddress:a,externalErrorMessage:o,hideManualButton:r,showContextualElement:i,contextualText:s,placeholder:d,addressSearchDebounceMs:l}){const[h,u]=N([]),[y,m]=N([]),[f,x]=N(""),{i18n:S}=O(),w=D(_=>{_!=null&&_.errorMessage&&x(_.errorMessage)},[]),k=D(_=>{new Promise((g,T)=>{t(_,{resolve:g,reject:T})}).then(g=>{m(g),u(g.map(({id:T,name:E})=>({id:T,name:E}))),x("")}).catch(g=>w(g))},[t]);F(()=>{x(o)},[o]);const b=ce(()=>nr(k,l),[]);return c("div",{className:"adyen-checkout__address-search adyen-checkout__field-group"},c(ke,{label:S.get("address"),classNameModifiers:["address-search"],errorMessage:f,name:"address-search",showContextualElement:i,contextualText:s},c(Ht,{name:"address-search",className:"adyen-checkout__address-search__dropdown",placeholder:d,onInput:b,items:h,onChange:_=>{if(!_.target.value)return void x(S.get("address.errors.incomplete"));const g=y.find(T=>T.id===_.target.value);if(typeof e!="function")return n(g),void u([]);new Promise((T,E)=>{e(g,{resolve:T,reject:E})}).then(T=>{n(T),u([])}).catch(T=>w(T))},disableTextFilter:!0,blurOnClose:!0})),!r&&c("span",{className:"adyen-checkout__address-search__manual-add"},c("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button",onClick:a},"+ "+S.get("address.enterManually"))))}const xp=(t,e)=>t||(e==="billingAddress"||e==="deliveryAddress"?e:void 0);function bs(t){var ne,De,ft;const{i18n:e}=O(),{label:n="",requiredFields:a,visibility:o,iOSFocusedField:r=null,showContextualElement:i}=t,s=xp(t.addressType,n),d=J({});Object.keys(d.current).length||((ne=t.setComponentRef)==null||ne.call(t,d.current));const l=ce(()=>new Xi(t.specifications),[t.specifications]),h=l.getAddressSchemaForCountryFlat(t.countryCode).filter(j=>a.includes(j)),[u,y]=N(!1),[m,f]=N(!1),[x,S]=N(""),w=!!t.onAddressLookup,[k,b]=N(!1),_=!t.onAddressLookup||u||m,{data:g,errors:T,valid:E,isValid:P,handleChangeFor:A,triggerValidation:I,setData:U,mergeData:W}=An({schema:h,defaultData:t.data,rules:p(p({},pp(l)),t.validationRules),formatters:cp}),Z=J((De=t.data)==null?void 0:De.country),Pe=(ft=g.country||Z.current)==null?void 0:ft.toUpperCase(),fe=ce(()=>C(p({},g),{country:Pe}),[g,Pe]),Be=D(j=>{const ie=ga.reduce((ye,pe)=>{const Se=j[pe];return Se!=null&&(ye[pe]=String(Se)),ye},{});W(ie),b(!0),I(),y(!0)},[y,I,U]),Ae=D(()=>{f(!0)},[]);d.current.showValidation=()=>{I(),S(!w||_||P?"":e.get("address.errors.incomplete"))};const Ie=h.filter(j=>!r||j===r);if(F(()=>{if(k)return void b(!1);const j=l.countryHasDataset(g.country)?"":fa,ie=C(p({},g),{stateOrProvince:j});a.forEach(ye=>{var pe;A(ye,"input")((pe=ie[ye])!=null?pe:"")}),ie.postalCode&&A("postalCode","blur")(g.postalCode)},[g.country]),F(()=>{const j=a.includes("stateOrProvince"),ie=g.country&&l.countryHasDataset(g.country),ye=j&&ie,pe=g.stateOrProvince||(ye?"":fa);A("stateOrProvince","input")(pe)},[]),F(()=>{const j=l.getOptionalFieldsForCountry(g.country),ie=ga.reduce((ye,pe)=>{const Se=j.includes(pe),R=a.includes(pe),L=g[pe],ve=t.data[pe],xe=Se&&!L||!R?R||L||!ve?fa:ve:L;return xe!=null&&xe.length&&(ye[pe]=xe),ye},{});!ie.country&&Z.current&&(ie.country=Z.current),t.onChange({data:ie,valid:E,errors:T,isValid:P})},[g,E,T,P]),o==="hidden")return null;if(o==="readOnly")return c(sp,{data:g,label:n});const Ve=(j,{classNameModifiers:ie=[]})=>a.includes(j)?c(bp,{key:j,allowedCountries:t.allowedCountries,classNameModifiers:[...ie,j],data:fe,errors:T,valid:E,fieldName:j,onInput:A(j,"input"),onBlur:A(j,"blur"),onDropdownChange:A(j,"blur"),specifications:l,maxLength:ou(Qo,j,Pe),trimOnBlur:!0,disabled:!Ie.includes(j),addressType:s,onFieldFocusAnalytics:t.onFieldFocusAnalytics,onFieldBlurAnalytics:t.onFieldBlurAnalytics}):null,et=l.getAddressSchemaForCountry(g.country);return c(G,null,c(wa,{classNameModifiers:[n,"address"],label:n,renderLabelAsSectionHeading:!0},w&&c(vp,{onAddressLookup:t.onAddressLookup,onAddressSelected:t.onAddressSelected,onSelect:Be,onManualAddress:Ae,externalErrorMessage:x,hideManualButton:_,showContextualElement:i,contextualText:e.get("address.search.contextualText"),addressSearchDebounceMs:t.addressSearchDebounceMs}),_&&c(G,null,et.map(j=>j instanceof Array?c("div",{className:"adyen-checkout__field-group"},j.map(([ie,ye])=>Ve(ie,{classNameModifiers:[`col-${ye}`]}))):Ve(j,{})))))}bs.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:ga,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};function wp({onBlur:t,onInput:e,placeholder:n,value:a,required:o,error:r=!1,isValid:i,disabled:s,onFieldFocusAnalytics:d,onFieldBlurAnalytics:l}){const{i18n:h}=O();return c(ke,{label:h.get("creditCard.holderName"),className:"adyen-checkout__card__holderName",errorMessage:r&&h.get(mo),isValid:!!i,name:"holderName",i18n:h,onFocus:u=>d("holderName",u),onBlur:u=>l("holderName",u)},c(In,{name:"holderName",className:"adyen-checkout__card__holderName__input adyen-checkout__input",placeholder:n,autocomplete:"cc-name",value:a,required:o,onBlur:t,onInput:e,disabled:s}))}const Cp=({data:t,valid:e,errors:n,handleChangeFor:a,sfpState:o,setFocusOn:r,cvcPolicy:i,focusedElement:s,hasInstallments:d,handleInstallments:l,showAmountsInInstallments:h,brandsIcons:u,formData:y,formErrors:m,formValid:f,expiryDatePolicy:x,dualBrandSelectElements:S,extensions:w,selectedBrandValue:k,showKCP:b,showBrazilianSSN:_,socialSecurityNumber:g,handleOnStoreDetails:T,billingAddress:E,handleAddress:P,setAddressRef:A,partialAddressSchema:I,onAddressLookup:U,onAddressSelected:W,addressSearchDebounceMs:Z,billingAddressRequired:Pe,billingAddressRequiredFields:fe,billingAddressAllowedCountries:Be,billingAddressValidationRules:Ae=null,brandsConfiguration:Ie,showStoreDetailsCheckbox:Ve,hasCVC:et,hasHolderName:ne,holderNameRequired:De,installmentOptions:ft,placeholders:j,positionHolderNameOnTop:ie,showBrandIcon:ye,showContextualElement:pe,iOSFocusedField:Se,disclaimerMessage:R,onFieldFocusAnalytics:L,onFieldBlurAnalytics:ve})=>{var lt;const xe=c(wp,{required:De,placeholder:j.holderName,value:y.holderName,error:!!m.holderName&&De,isValid:!!f.holderName,onBlur:a("holderName","blur"),onInput:a("holderName","input"),disabled:Se&&Se!=="holderName",onFieldFocusAnalytics:L,onFieldBlurAnalytics:ve});return c(ns,{status:o.status},ne&&ie&&xe,c(ap,{showBrandIcon:ye,showContextualElement:pe,brand:(lt=o.brand)!=null?lt:"card",brandsIcons:u,brandsConfiguration:Ie,focusedElement:s,onFocusField:r,hasCVC:et,cvcPolicy:i,expiryDatePolicy:x,errors:o.errors,valid:o.valid,dualBrandingElements:S.length>0&&S,dualBrandingChangeHandler:w.handleDualBrandSelection,selectedBrandValue:k}),ne&&!ie&&xe,b&&c(op,{onFocusField:r,focusedElement:s,encryptedPasswordState:{data:o.encryptedPassword,valid:!!o.valid&&o.valid.encryptedPassword,errors:!!o.errors&&o.errors.encryptedPassword},value:t.taxNumber,error:!!n.taxNumber,isValid:!!e.taxNumber,onBlur:a("taxNumber","blur"),onInput:a("taxNumber","input"),disabled:Se&&Se!=="kcpTaxNumberOrDOB",placeholder:j.taxNumber,onFieldFocusAnalytics:L,onFieldBlurAnalytics:ve}),_&&c("div",{className:"adyen-checkout__card__socialSecurityNumber"},c(rp,{onBlur:a("socialSecurityNumber","blur"),onInput:a("socialSecurityNumber","input"),error:n==null?void 0:n.socialSecurityNumber,valid:e==null?void 0:e.socialSecurityNumber,data:g,required:!0,disabled:Se&&Se!=="socialSecurityNumber",onFieldFocusAnalytics:L,onFieldBlurAnalytics:ve})),Ve&&c(ip,{onChange:T}),d&&c(jo,{brand:o.brand,installmentOptions:ft,onChange:l,type:h?"amount":"months"}),Pe&&c(bs,{label:"billingAddress",data:E,onChange:P,allowedCountries:Be,requiredFields:fe,setComponentRef:A,validationRules:Ae,specifications:I,iOSFocusedField:Se,onAddressLookup:U,showContextualElement:pe,onAddressSelected:W,addressSearchDebounceMs:Z,onFieldFocusAnalytics:L,onFieldBlurAnalytics:ve}),R&&c(Wo,{message:R.message.replace("%{linkText}",`%#${R.linkText}%#`),urls:[R.link]}))},ks=t=>{if(t){const e=document.body.getBoundingClientRect().top,n=t.getBoundingClientRect().top-e-100;window.scrollTo({top:n,behavior:"smooth"})}},Sp=(t,e,n)=>{var a,o;if(t){if(ht.__IS_IOS){const r=(o=(a=e.current).getRootNode)==null?void 0:o.call(a),i=r==null?void 0:r.querySelector(`[data-id="${n}"]`);ks(i)}nn(n)?e.current.setFocusOn(n):vs(n,e,ht.__IS_IOS)}},Ep=(t,e,n)=>a=>{t("billingAddress",a.data),e("billingAddress",a.isValid),n("billingAddress",a.errors)},Tp=(t,e,n)=>a=>{t(a.currentFocusObject),a.focus===!0?e(a.fieldType,a):n(a.fieldType,a)},Np=(t,e,n)=>()=>{t.current||(t.current=!0,Promise.resolve().then(()=>{const a=n.findIndex(r=>r===V),o=n.slice(a+1);for(const r of o){if(!nn(r)){vs(r,e,!1);break}if(!e.current.sfIsOptionalOrHidden(r)){e.current.setFocusOn(r);break}}t.current=!1}))},vs=(t,e,n)=>{var o,r;t==="taxNumber"&&(t="kcpTaxNumberOrDOB");const a=(r=(o=e.current).getRootNode)==null?void 0:r.call(o);if(t==="country"||t==="stateOrProvince"){const i=kt(a,`.adyen-checkout__field--${t} .adyen-checkout__filter-input`);i==null||i.focus({preventScroll:n})}else{const i=kt(a,`[name="${t}"]`);i==null||i.focus({preventScroll:n})}};function xs(t,e,n){let a;const o=n;return t.length!==1||e||(a=t),t.length>(e==null?void 0:e.length)&&(a=t.filter(({[o]:r})=>!e.some(({[o]:i})=>i===r))),a}const Pp=()=>{const{i18n:t}=O();return c("p",{className:"adyen-checkout-form-instruction"},t.get("form.instruction"))},ws=na({srPanel:null,setSRMessagesFromObjects:null,setSRMessagesFromStrings:null,clearSRPanel:null,shouldMoveFocusSR:null});function Cs(){return Lt(ws)}function Ss(t){const e=J();return F(()=>{e.current=t},[t]),e.current}const Ap=({errors:t,props:e,isValidating:n,retrieveLayout:a,specifications:o,billingAddress:r,sfp:i})=>{var k;const{setSRMessagesFromObjects:s,setSRMessagesFromStrings:d,clearSRPanel:l,shouldMoveFocusSR:h}=Cs(),u=s==null?void 0:s({fieldTypeMappingFn:ku}),y=Ji(e.billingAddressMode),[m,f]=N(null),x=Ss(m),S=(k=i.current)==null?void 0:k.mapErrorsToValidationRuleResult(),w=p(p({},t),S);return F(()=>{var b,_;try{const g=w,{billingAddress:T}=g,E=Ce(g,["billingAddress"]),P=p(p({},E),T),A=u==null?void 0:u({errors:P,isValidating:n.current,layout:a(),countrySpecificLabels:(_=o.getAddressLabelsForCountry(r==null?void 0:r.country))!=null?_:(b=y==null?void 0:y.default)==null?void 0:b.labels}),I=A==null?void 0:A.currentErrorsSortedByLayout;switch(f(I),A==null?void 0:A.action){case Ri:h&&(A!=null&&A.fieldToFocus)&&Sp(n.current,i,A==null?void 0:A.fieldToFocus),setTimeout(()=>{n.current=!1},300);break;case Fi:{const U=xs(I,x,"field"),W=U==null?void 0:U[0];if(W){const Z=wu(W.errorCode)?W.errorMessage:null;d(Z)}else l();break}}}catch(T){}},[t]),{sortedErrorList:m,previousSortedErrors:x,clearSRPanel:l}},Dp=({label:t,labelPosition:e="after",ariaLabel:n,description:a,checked:o,disabled:r=!1,readonly:i=!1,onChange:s})=>{const d=ce(()=>a?`toggle-description-${ze()}`:null,[a]),l=ce(()=>n||(typeof t=="string"?t:null),[n,t]),h=$({"adyen-checkout-toggle--label-first":e==="before","adyen-checkout-toggle--disabled":r,"adyen-checkout-toggle--readonly":i}),u=D(y=>{s(y.target.checked)},[s]);return c("label",{className:`adyen-checkout-toggle ${h}`},c("input",{disabled:r,checked:o,onChange:u,"aria-label":l,"aria-readonly":i,"aria-describedby":d,role:"switch",type:"checkbox",className:"adyen-checkout-toggle__input"}),c("span",{"aria-hidden":!0,className:"adyen-checkout-toggle__track"},c("span",{className:"adyen-checkout-toggle__handle"},o&&c("svg",{role:"img",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"},c("path",{fill:"#00112C",d:"M12.0608 6.00011L11.0001 4.93945L7.00011 8.93945L5.00011 6.93945L3.93945 8.00011L7.00011 11.0608L12.0608 6.00011Z"})))),t&&c("span",{className:"adyen-checkout-toggle__label-container"},c("span",{className:"adyen-checkout-toggle__label-text","data-testid":"inner-label"},t),a&&c("span",{"data-testid":"description",className:"adyen-checkout-toggle__description",id:d},a)))};function Es(t){if(!t)return"";let e=t;return e=e.replace(/\D/g,""),e.length>3&&e.length<=6?e=e.slice(0,3)+" "+e.slice(3):e.length>6&&(e=e.slice(0,3)+" "+e.slice(3,6)+" "+e.slice(6,10)),e}const Ip=({initialValue:t,onChange:e})=>{const{i18n:n}=O(),{handleChangeFor:a,data:o}=An({schema:["mobileNumber"],defaultData:{mobileNumber:t},formatters:{mobileNumber:Es}}),r=J(null),i=D(()=>{var s;(s=r.current)==null||s.focus()},[r.current]);return F(()=>{var s;e((s=o.mobileNumber)==null?void 0:s.replaceAll(" ",""))},[o.mobileNumber,e]),c(ke,{name:"mobile-number",label:n.get("card.fastlane.mobileInputLabel"),staticValue:"+1",onInputContainerClick:i},c(us,{name:"mobile-number",autocorrect:"off",spellcheck:!1,maxlength:12,value:o.mobileNumber,onInput:a("mobileNumber","input"),onBlur:a("mobileNumber","blur"),setRef:r}))},$p=({rootElement:t,focusFirst:e,shouldTrap:n=!0})=>{const[a,o]=N(e);F(()=>{n&&(a==null||a.focus())},[a,n]),F(()=>{if(!n)return;const r=t.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])'),i=r[0],s=r[r.length-1];o(e||i);const d=l=>{if(l.key==="Tab"||l.keyCode===9)return l.shiftKey&&document.activeElement===i?(s.focus(),void l.preventDefault()):document.activeElement===s?(i.focus(),void l.preventDefault()):void 0};return t.addEventListener("keydown",d),()=>{o(null),t.removeEventListener("keydown",d)}},[t,e,n])},Rp=({modalElement:t,isOpen:e,isDismissible:n,focusFirst:a,focusAfterClose:o,onClose:r})=>{$p({rootElement:t,shouldTrap:e,focusFirst:a});const i=D(()=>{o.focus(),r()},[r,o]),s=D(d=>{n&&d.target instanceof HTMLElement&&!t.contains(d.target)&&i()},[i,n,t]);return F(()=>{if(!e||!t)return;const d=l=>{(l.key==="Escape"||l.key==="Esc"||l.keyCode===27)&&i()};return t.addEventListener("keydown",d),()=>t.removeEventListener("keydown",d)},[e,t,i]),{closeModal:i,handleClickOutside:s}},Ts=h=>{var u=h,{children:t,classNameModifiers:e=[],isOpen:n,onClose:a,isDismissible:o=!0,labelledBy:r,describedBy:i,focusFirst:s,focusAfterClose:d}=u,l=Ce(u,["children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose"]);const y=J(),{closeModal:m,handleClickOutside:f}=Rp({modalElement:y.current,isOpen:n,isDismissible:o,focusFirst:s,focusAfterClose:d,onClose:a});return F(()=>{if(!y.current)return;const x=S=>{S.key!=="Enter"&&S.code!=="Enter"||S.stopPropagation()};return y.current.addEventListener("keypress",x,{capture:!0}),()=>{y.current.removeEventListener("keypress",x)}},[y.current]),c("div",p({className:$("adyen-checkout__modal-wrapper",e.map(x=>`adyen-checkout__modal-wrapper--${x}`),{"adyen-checkout__modal-wrapper--open":n}),role:"dialog","aria-labelledby":r,"aria-describedby":i,"aria-modal":"true","aria-hidden":!n,onClick:f},l),c("div",{className:"adyen-checkout__modal",ref:y},t({onCloseModal:m})))};function Ta(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Ye=class extends Fe{render(){const{id:e,classNameModifiers:n=[],disabled:a,href:o,icon:r,onClickCompletedIcon:i,inline:s,label:d,ariaLabel:l,ariaLabelledBy:h,ariaDescribedBy:u,ariaExpanded:y,ariaControls:m,status:f,variant:x,buttonRef:S,onClickCompletedLabel:w,onMouseEnter:k,onMouseLeave:b,onFocus:_,onBlur:g,onKeyDown:T,onKeyPress:E}=this.props,{completed:P}=this.state,{i18n:A}=O(),I=i||r?c("img",{className:"adyen-checkout__button__icon",src:this.state.completed&&i!=null?i:r,alt:"","aria-hidden":"true"}):"",U=[...n,...x==="primary"?[]:[x],...s?["inline"]:[],...P?["completed"]:[],...f==="loading"||f==="redirect"?["loading"]:[]],W=$(["adyen-checkout__button",...U.map(fe=>`adyen-checkout__button--${fe}`)]),Z={loading:c("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},c(rn,{size:"medium",inline:!0})),redirect:c("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},c(rn,{size:"medium",inline:!0}),A.get("payButton.redirecting")),default:c("span",{className:"adyen-checkout__button__content"},I,c("span",{className:"adyen-checkout__button__text"},this.state.completed&&w!=null?w:d))},Pe=Z[f]||Z.default;return o?c("a",{className:W,href:o,target:this.props.target,rel:this.props.rel,"aria-disabled":a,onClick:fe=>{a&&fe.preventDefault()}},Pe):c("button",{ref:S,id:e,className:W,type:"button",disabled:a,onClick:this.onClick,"aria-label":l,"aria-labelledby":h,"aria-describedby":u,"aria-expanded":y,"aria-controls":m,onMouseEnter:k,onMouseLeave:b,onKeyDown:T,onFocus:_,onBlur:g,onKeyPress:E},Pe,f!=="loading"&&f!=="redirect"&&this.props.children,c("span",{role:"status","aria-live":"polite",className:"adyen-checkout__button__text--sr-only"},A.get(this.buttonStatusSRLabel(f))))}constructor(...e){super(...e),Ta(this,"onClick",n=>{var a,o;n.preventDefault(),this.props.disabled||((o=(a=this.props).onClick)==null||o.call(a,n,{complete:this.complete}))}),Ta(this,"complete",(n=1e3)=>{this.setState({completed:!0}),setTimeout(()=>{this.setState({completed:!1})},n)}),Ta(this,"buttonStatusSRLabel",n=>({loading:"loading",redirect:"payButton.redirecting"})[n]||"")}};Ta(Ye,"defaultProps",{status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self"});const ar=[{headerKey:"card.fastlane.modal.benefit1.header",labelById:`adyen-fastlane-modal-label-${ze()}`,descriptionTextKey:"card.fastlane.modal.benefit1.text",describedById:`adyen-fastlane-modal-describedBy-${ze()}`,image:"fastlane_autofill",altImage:""},{headerKey:"card.fastlane.modal.benefit2.header",labelById:`adyen-fastlane-modal-label-${ze()}`,descriptionTextKey:"card.fastlane.modal.benefit2.text",describedById:`adyen-fastlane-modal-describedBy-${ze()}`,image:"fastlane_protection",altImage:""},{headerKey:"card.fastlane.modal.benefit3.header",labelById:`adyen-fastlane-modal-label-${ze()}`,descriptionTextKey:"card.fastlane.modal.benefit3.text",describedById:`adyen-fastlane-modal-describedBy-${ze()}`,image:"fastlane_ubiquity",altImage:""}],Fp=({isOpen:t,onClose:e,focusAfterClose:n})=>{const{i18n:a}=O(),o=J(),r=$e(),i=ar.map(d=>d.labelById).join(" "),s=ar.map(d=>d.describedById).join(" ");return c(Ts,{onClose:e,isOpen:t,labelledBy:i,describedBy:s,focusFirst:o.current,focusAfterClose:n},({onCloseModal:d})=>c("div",{className:"adyen-checkout-card-fastlane__modal"},c("div",{className:"adyen-checkout-card-fastlane__modal-button-container"},c(Ye,{onClick:d,inline:!0,variant:"link",ariaLabel:a.get("card.fastlane.a11y.closeDialog"),label:c(we,{height:"10",width:"10",src:r({imageFolder:"components/"})("cross_black"),"aria-hidden":!0,alt:""})})),ar.map(l=>c("div",{key:l.labelById,className:"adyen-checkout-card-fastlane__modal-section"},c(we,{className:"adyen-checkout-card-fastlane__modal-section-image",src:r({imageFolder:"components/"})(l.image),alt:l.altImage}),c("h1",{id:l.labelById,className:"adyen-checkout-card-fastlane__modal-section-header"},a.get(l.headerKey)),c("div",{id:l.describedById,className:"adyen-checkout-card-fastlane__modal-section-text"},a.get(l.descriptionTextKey)))),c(we,{className:"adyen-checkout-card-fastlane__modal-brand",src:r({imageFolder:"components/"})("paypal_fastlane_black"),alt:a.get("card.fastlane.a11y.logo")})))},Op=()=>{const[t,e]=N(!1),{i18n:n}=O(),a=$e(),o=J(),r=D(()=>{e(!1)},[]),i=D(()=>{e(!0)},[]);return c(G,null,c(Ye,{buttonRef:o,onClick:i,classNameModifiers:["fastlane-info-modal"],variant:"link",ariaLabel:n.get("card.fastlane.a11y.openDialog"),label:c(we,{height:"14",width:"14",src:a({imageFolder:"components/"})("fastlane_info"),alt:"","aria-hidden":!0})}),c(Fp,{isOpen:t,onClose:r,focusAfterClose:o.current}))},Mp=["showConsent","defaultToggleState","termsAndConditionsLink","privacyPolicyLink","termsAndConditionsVersion","fastlaneSessionId"],Lp=t=>{if(!t)return!1;Object.keys(t).forEach(s=>!Mp.includes(s)&&console.warn(`Fastlane: '${s}' is not valid Fastlane config property`));const{showConsent:e,defaultToggleState:n,termsAndConditionsLink:a,privacyPolicyLink:o,termsAndConditionsVersion:r}=t;let i=!1;return i=e?qt(o)&&qt(a)&&typeof e=="boolean"&&typeof n=="boolean"&&!!r:typeof e=="boolean",i||console.warn("Fastlane: Component configuration is not valid. Fastlane will not be displayed"),i},Ns={[mo]:"925",[_o]:"942",[Oi]:"926",[`${nt}.country`]:"930",[`${nt}.street`]:"931",[`${nt}.house_number_or_name`]:"932",[`${nt}.postal_code`]:"933",[`${nt}.city`]:"935",[`${nt}.state_or_province`]:"936",[`${yo}.postal_code`]:"934"},Bp="fetch-checkoutAttemptId-failed",Vp=t=>t.replace(/[^0-9]/g,""),zp=(t,e)=>{var a,o;if(t===nt||t===yo)return(a=Ns[`${t}.${e}`])!=null?a:t;let n=(o=Ns[t])!=null?o:t;return isNaN(Number(n))&&(n=Vp(n)),n},Up=t=>t?["applicationInfo","checkoutAttemptId"].reduce((e,n)=>n==="applicationInfo"?(t.applicationInfo!==void 0&&(e.applicationInfo=t.applicationInfo),e):(n==="checkoutAttemptId"&&t.checkoutAttemptId!==void 0&&(e.checkoutAttemptId=t.checkoutAttemptId),e),{}):{};function Je(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Na=(function(t){return t.instantPaymentButton="instant_payment_button",t.dualBrandButton="dual_brand_button",t.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",t.otherPaymentMethodButton="otherpaymentmethod_button",t.featuredIssuer="featured_issuer",t.list="list",t.listSearch="list_search",t.qrDownloadButton="qr_download_button",t.segmentedControl="segmented_control",t.cardNumber="card_number",t.expiryDate="expiry_date",t.expiryMonth="expiry_month",t.expiryYear="expiry_year",t.securityCode="security_code",t.donationAmountButton="donation_amount_button",t})({}),Le=(function(t){return t.clicked="clicked",t.rendered="rendered",t.selected="selected",t.validationError="validationError",t.focus="focus",t.unfocus="unfocus",t.configured="configured",t.displayed="displayed",t.input="input",t.download="download",t.sdkDownloadInitiated="sdkDownloadInitiated",t.sdkDownloadFailed="sdkDownloadFailed",t.sdkDownloadAborted="sdkDownloadAborted",t.sdkDownloadCompleted="sdkDownloadCompleted",t.Initialized="initialized",t.LookupStarted="lookupStarted",t.LookupUserNotFound="lookupUserNotFound",t.OtpStarted="otpStarted",t.OtpSucceeded="otpSucceeded",t.OtpCanceled="otpCanceled",t.OtpFailed="otpFailed",t.AddressSelectorClicked="addressSelectorClicked",t.AddressSelectorClosed="addressSelectorClosed",t.AddressChanged="addressChanged",t})({});let rt=class extends So{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const n={};try{for(const[a,o]of Object.entries(e))this.configDataExcludedFields.includes(a)||(typeof o=="function"?n[a]="function":Array.isArray(o)?n[a]=o.join(", ").substring(0,128):n[a]=typeof o=="object"&&o!==null?JSON.stringify(o).substring(0,128):o);return n}catch(a){return n}}getEventCategory(){return Vt.info}constructor(e){super(e.component),Je(this,"type",void 0),Je(this,"configData",void 0),Je(this,"target",void 0),Je(this,"issuer",void 0),Je(this,"isExpress",void 0),Je(this,"expressPage",void 0),Je(this,"isStoredPaymentMethod",void 0),Je(this,"brand",void 0),Je(this,"selectedValue",void 0),Je(this,"validationErrorCode",void 0),Je(this,"validationErrorMessage",void 0),Je(this,"presentedValues",void 0),Je(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),e.isStoredPaymentMethod!==void 0&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),e.isExpress!==void 0&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),e.presentedValues&&(this.presentedValues=e.presentedValues),this.type==="rendered"&&(this.configData=this.createAnalyticsConfigData(e==null?void 0:e.configData)),this.type==="validationError"&&(this.validationErrorCode=zp(this.validationErrorCode,this.target))}};const jp=["mc","visa"],Kp=({showConsent:t,defaultToggleState:e,termsAndConditionsLink:n,privacyPolicyLink:a,termsAndConditionsVersion:o,fastlaneSessionId:r,currentDetectedBrand:i,telephoneNumber:s,onChange:d,onSubmitAnalytics:l,type:h})=>{const u=ce(()=>t&&jp.includes(i),[t,i]),[y,m]=N(u),[f,x]=N(e),S=$e(),[w,k]=N(""),{i18n:b}=O(),_=ce(()=>Lp({showConsent:t,defaultToggleState:e,termsAndConditionsLink:n,privacyPolicyLink:a,termsAndConditionsVersion:o,fastlaneSessionId:r}),[t,e,n,a,o,r]),g=D(()=>{const T=!f;x(T);const E=new rt({component:h,type:Le.clicked,target:Na.fastlaneSignupConsentToggle,configData:{isToggleOn:T}});l(E)},[f,l,h]);return F(()=>{_&&d({fastlaneData:p(p({consentShown:y,fastlaneSessionId:r,consentGiven:!!u&&f},o&&{consentVersion:o}),w&&{telephoneNumber:w})})},[u,y,o,f,r,w,d,_]),F(()=>{u&&m(!0)},[u]),F(()=>{if(!_)return;const T=new rt({component:h,type:Le.rendered,configData:{isFastlaneSignupRendered:u}});l(T)},[u,_,l,h]),u&&_?c("div",{className:"adyen-checkout-card__fastlane","data-testid":"fastlane-signup-component"},c("div",{className:$("adyen-checkout-card__fastlane-consent-toggle",{"adyen-checkout-card__fastlane-consent-toggle--active":f})},c(Dp,{checked:f,onChange:g,ariaLabel:b.get("card.fastlane.consentToggle"),label:c("span",null,b.get("card.fastlane.consentToggle"))}),c(Op,null)),f&&c(G,null,c(Ip,{initialValue:Es(s),onChange:k}),c("div",{className:"adyen-checkout-card__fastlane-consent-text"},c(cs,{message:b.get("card.fastlane.consentText"),urls:[n,a]})),c(we,{className:"adyen-checkout-card__fastlane-brand",src:S({imageFolder:"components/"})("paypal_fastlane_black"),alt:b.get("card.fastlane.a11y.logo")}))):null},Ps=t=>{var lc,uc,pc,hc,yc,mc,_c;const e=J(null),n=J(!1),a=$e(),o=J(null),r=M=>{o.current=M},i=J({});Object.keys(i.current).length||t.setComponentRef(i.current);const s=J(0),d=J(!1),l=ce(()=>new Xi(t.specifications),[t.specifications]),{amount:h}=$n();i.current.sfp=e;const[u,y]=N("ready"),[m,f]=N({}),[x,S]=N(p({},t.holderNameRequired&&{holderName:!1})),[w,k]=N(p({},t.hasHolderName&&{holderName:(uc=(lc=t.data)==null?void 0:lc.holderName)!=null?uc:""})),[b,_]=N(""),[g,T]=N(!1),[E,P]=N(Et),[A,I]=N(It),[U,W]=N(null),[Z,Pe]=N([]),[fe,Be]=N(t.storedPaymentMethodId?t.brand:""),Ae=t.billingAddressMode!==Do.none&&t.billingAddressRequired,Ie=Ji(t.billingAddressMode),Ve=J(Ie&&((hc=(pc=t.data)==null?void 0:pc.billingAddress)==null?void 0:hc.country)),[et,ne]=N(!1),[De,ft]=N(Ae&&(mc=(yc=t.data)==null?void 0:yc.billingAddress)!=null?mc:null),[j,ie]=N(!1),[ye,pe]=N(""),[Se,R]=N({value:null}),[L,ve]=N(null),[xe,lt]=N("card"),[Gn,Qt]=N(!1),{handleChangeFor:Qr,triggerValidation:Zr,data:At,valid:gt,errors:Ke,setSchema:h_,setData:ac,setValid:oc,setErrors:rc}=An({schema:[],defaultData:t.data,formatters:iu,rules:Wi}),y_=Su({installmentOptions:t.installmentOptions,fundingSource:t.fundingSource,amount:h}),m_=(_c=t.showInstallmentAmounts)!=null?_c:!0,__=(U!=null?U:t.countryCode)==="kr",yn=!!t.configuration.koreanAuthenticationRequired&&__,mn=j&&t.configuration.socialSecurityNumberMode==="auto"||t.configuration.socialSecurityNumberMode==="show",ic=(M,ae)=>{t.onFocus({fieldType:M,event:ae})},sc=(M,ae)=>{t.onBlur({fieldType:M,event:ae})},f_=D(M=>{lt(M.brand),t.onBrand(M)},[]),g_=Tp(_,ic,sc),dc=()=>bu(p({props:t,showKCP:yn,showBrazilianSSN:mn},t.billingAddressRequired&&{countrySpecificSchemas:l.getAddressSchemaForCountry(De==null?void 0:De.country),billingAddressRequiredFields:t.billingAddressRequiredFields})),b_=D(M=>{const ae=M.fieldType!=="webInternalElement"?M.fieldType:M.name;ve(ae)},[]),k_=Ep(ac,oc,rc),v_=Np(d,e,dc()),x_=D(M=>{w_(M)},[Gn,Qt]),w_=M=>{M.status&&(M.status=="loading"?Qt(!1):Qt(!0))},cc=ce(()=>Nu(t,{sfp:e},{dualBrandSelectElements:Z,setDualBrandSelectElements:Pe,setSelectedBrandValue:Be,issuingCountryCode:U,setIssuingCountryCode:W},s),[Z,U]);i.current.showValidation=()=>{n.current=!0,ei==null||ei(),e.current.showValidation(),Zr(["holderName","socialSecurityNumber","taxNumber"]),o!=null&&o.current&&o.current.showValidation()},i.current.processBinLookupResponse=(M,ae)=>{cc.processBinLookup(M,ae)},i.current.setStatus=y,F(()=>(i.current.setFocusOn=e.current.setFocusOn,i.current.updateStyles=e.current.updateStyles,i.current.handleUnsupportedCard=e.current.handleUnsupportedCard,()=>{e.current.destroy()}),[]),F(()=>{const M=[...t.hasHolderName?["holderName"]:[],...mn?["socialSecurityNumber"]:[],...yn?["taxNumber"]:[],...Ae?["billingAddress"]:[]];h_(M)},[t.hasHolderName,mn,yn]),F(()=>{var ae;k(C(p({},w),{holderName:(ae=At.holderName)!=null?ae:"",taxNumber:At.taxNumber})),pe(At.socialSecurityNumber),Ae&&ft(p({},At.billingAddress)),S(C(p({},x),{holderName:!t.holderNameRequired||gt.holderName,socialSecurityNumber:!!gt.socialSecurityNumber&&gt.socialSecurityNumber,taxNumber:!!gt.taxNumber&&gt.taxNumber,billingAddress:!!gt.billingAddress&&gt.billingAddress}));const M=!!Ke.billingAddress&&Object.entries(Ke.billingAddress).reduce((Re,[,He])=>Re||He!=null,!1);f(C(p({},m),{holderName:t.holderNameRequired&&Ke.holderName?Ke.holderName:null,socialSecurityNumber:mn&&Ke.socialSecurityNumber?Ke.socialSecurityNumber:null,taxNumber:yn&&Ke.taxNumber?Ke.taxNumber:null,billingAddress:Ae&&M?Ke.billingAddress:null}))},[At,gt,Ke]);const{sortedErrorList:Xr,previousSortedErrors:C_,clearSRPanel:ei}=Ap({errors:m,props:t,isValidating:n,retrieveLayout:dc,specifications:l,billingAddress:De,sfp:e});F(()=>{if(Xr){const M=xs(Xr,C_,"field");M==null||M.forEach(ae=>{const Re=new rt({component:t.type,type:Le.validationError,target:Ao(ae.field),validationErrorCode:ae.errorCode,validationErrorMessage:Ui(ae.errorCode,$t)});t.onSubmitAnalytics(Re)})}},[Xr]),F(()=>{const M=!!x.holderName,ae=g,Re=!Ae||!!x.billingAddress,He=!yn||!!x.taxNumber&&!!x.encryptedPassword,qa=!mn||!!x.socialSecurityNumber,E_=ae&&M&&Re&&He&&qa,T_=e.current.mapErrorsToValidationRuleResult(),N_=p(p({},m),T_);t.onChange({data:w,valid:x,errors:N_,isValid:E_,billingAddress:De,selectedBrandValue:fe,storePaymentMethod:et,socialSecurityNumber:ye,installments:Se})},[w,x,m,fe,et,Se]),F(()=>{if(Z.length>0&&Z){const M=Z.map(He=>He.id),ae=M[0],Re=M.toString();if(Z&&Lo(Bo,Z,"id")){const He=new rt({component:t.type,type:Le.displayed,target:Na.dualBrandButton,brand:ae,configData:{dualBrands:Re}});t.onSubmitAnalytics(He)}}},[Z]);const ti=Ss(fe);F(()=>{if(ti!=null&&ti.length&&(fe!=null&&fe.length)){const M=new rt({component:t.type,type:Le.selected,target:Na.dualBrandButton,brand:fe});t.onSubmitAnalytics(M)}},[fe]);const S_=t.storedPaymentMethodId?Qu:Cp;return c(G,null,c(Hi,C(p({ref:e},xu(t)),{styles:p({},t.styles),koreanAuthenticationRequired:t.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!t.configuration.koreanAuthenticationRequired||t.countryCode!=="kr"),onSubmitAnalytics:t.onSubmitAnalytics,onChange:(M,ae)=>{if(M.autoCompleteName){if(!t.hasHolderName)return;const He=su("holderName","blur"),qa=He!=null&&He(M.autoCompleteName,null)?M.autoCompleteName:null;return void(qa&&(ac("holderName",qa),oc("holderName",!0),rc("holderName",null)))}var Re;t.autoFocus&&s.current>0&&(ae==null?void 0:ae.event)==="handleOnFieldValid"&&(ae==null?void 0:ae.fieldType)===V&&M.valid.encryptedCardNumber&&v_(),k(p(p({},w),M.data)),f(p(p({},m),(Re=M.errors,Re?{encryptedCardNumber:!!Re.encryptedCardNumber,encryptedExpiryDate:!!Re.encryptedExpiryDate,encryptedSecurityCode:!!Re.encryptedSecurityCode,encryptedPassword:!!Re.encryptedPassword}:{}))),S(p(p({},x),M.valid)),T(M.isSfpValid),I(M.cvcPolicy),ie(M.showSocialSecurityNumber),P(M.expiryDatePolicy)},onBrand:f_,onFocus:g_,onStateUpdate:x_,type:t.brand,componentType:t.type,disableIOSArrowKeys:t.disableIOSArrowKeys?b_:null,render:({setRootNode:M,setFocusOn:ae},Re)=>{var He;return c("div",{ref:M,className:$({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${(He=t.fundingSource)!=null?He:"credit"}`]:!0,"adyen-checkout__card-input--loading":u==="loading"}),role:"form"},Gn&&c(Pp,null),c(S_,C(p({},vu(t)),{data:w,valid:x,errors:m,handleChangeFor:Qr,focusedElement:b,setFocusOn:ae,sfpState:Re,cvcPolicy:A,hasInstallments:y_,showAmountsInInstallments:m_,handleInstallments:R,brandsIcons:t.brandsIcons,formData:At,formErrors:Ke,formValid:gt,expiryDatePolicy:E,dualBrandSelectElements:Z,extensions:cc,selectedBrandValue:fe,showKCP:yn,showBrazilianSSN:mn,socialSecurityNumber:ye,handleOnStoreDetails:ne,setAddressRef:r,billingAddress:De,billingAddressValidationRules:Ie&&up(Ve.current),partialAddressSchema:Ie,handleAddress:k_,onAddressLookup:t.onAddressLookup,onAddressSelected:t.onAddressSelected,addressSearchDebounceMs:t.addressSearchDebounceMs,iOSFocusedField:L,onFieldFocusAnalytics:ic,onFieldBlurAnalytics:sc})))}})),t.fastlaneConfiguration&&c(Kp,C(p({},t.fastlaneConfiguration),{currentDetectedBrand:xe,onChange:t.onChange,onSubmitAnalytics:t.onSubmitAnalytics,type:t.type})),Gn&&t.showPayButton&&t.payButton({status:u,variant:t.isPayButtonPrimaryVariant?"primary":"secondary",icon:a({imageFolder:"components/"})(`${Kt}lock`)}))};Ps.defaultProps=Io;function or(){if(typeof window=="undefined")return;const t=window.screen.colorDepth,e=window.screen.height,n=window.screen.width,a=window.navigator.userAgent;return{acceptHeader:"*/*",javaEnabled:!1,colorDepth:t,language:window.navigator.language||"en",screenHeight:e,screenWidth:n,userAgent:a,timeZoneOffset:new Date().getTimezoneOffset()}}var Hp=t=>{let e=null;return n=>{if(t.props.doBinLookup!==!1){if(n.encryptedBin&&t.props.clientKey)e=n.uuid,Ge({loadingContext:t.props.loadingContext,path:`v3/bin/binLookup?token=${t.props.clientKey}`},{type:t.props.brand,supportedBrands:t.props.brands||vn,encryptedBin:n.encryptedBin,requestId:n.uuid}).then(a=>{var o;if((a==null?void 0:a.requestId)===e)if((o=a.brands)!=null&&o.length){const r=a.brands.reduce((i,s)=>(i.detectedBrands.push(s.brand),i.paymentMethodVariants.push(s.paymentMethodVariant),s.supported===!0&&i.supportedBrands.push(s),i),{supportedBrands:[],detectedBrands:[],paymentMethodVariants:[]});if(r.supportedBrands.length)return t.processBinLookupResponse(p({issuingCountryCode:a.issuingCountryCode,supportedBrands:r.supportedBrands},a.showSocialSecurityNumber?{showSocialSecurityNumber:a.showSocialSecurityNumber}:{})),void t.onBinLookup({type:n.type,detectedBrands:r.detectedBrands,supportedBrands:r.supportedBrands.map(i=>i.brand),paymentMethodVariants:r.paymentMethodVariants,supportedBrandsRaw:r.supportedBrands,brands:t.props.brands||vn,issuingCountryCode:a.issuingCountryCode});if(r.detectedBrands.length){const i={type:"card",fieldType:"encryptedCardNumber",error:$t.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,detectedBrands:r.detectedBrands};return t.handleUnsupportedCard(i),void t.onBinLookup({type:n.type,detectedBrands:r.detectedBrands,supportedBrands:null,paymentMethodVariants:r.paymentMethodVariants,brands:t.props.brands||vn})}}else t.onBinLookup({type:n.type,detectedBrands:null,supportedBrands:null,brands:t.props.brands||vn}),t.processBinLookupResponse({},!0);else a!=null&&a.requestId||t.props.onError(a||{errorType:"binLookup",message:"unknownError"})});else if(e){t.processBinLookupResponse(null,!0),e=null;const a={type:"card",fieldType:"encryptedCardNumber",error:""};t.handleUnsupportedCard(a),t.onBinLookup({isReset:!0})}t.props.onBinValue&&t.props.onBinValue(n)}else t.props.onBinValue&&t.props.onBinValue(n)}};const qp="https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/src-i-adapter/visa-sdk.js?v2",Wp="https://assets.secure.checkout.visa.com/checkout-widget/resources/js/src-i-adapter/visa-sdk.js?v2",Gp="https://sandbox.src.mastercard.com/sdk/srcsdk.mastercard.js",Yp="https://src.mastercard.com/sdk/srcsdk.mastercard.js",Jp=({dpaLocale:t="en_US",dpaPresentationName:e=""})=>({dpaTransactionOptions:{dpaLocale:t,payloadTypeIndicator:"NON_PAYMENT",customInputData:{checkoutOrchestrator:"merchant"}},dpaData:{dpaPresentationName:e}}),Qp=({dpaLocale:t="en_US",dpaPresentationName:e=""})=>({dpaTransactionOptions:{dpaLocale:t,paymentOptions:{dynamicDataType:"CARD_APPLICATION_CRYPTOGRAM_SHORT_FORM"},consumerNameRequested:!0,customInputData:{"com.mastercard.dcfExperience":"PAYMENT_SETTINGS"},confirmPayment:!1},dpaData:{dpaPresentationName:e}});function Rn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Te=class extends Error{toString(){return`Reason: ${this.reason} / Source: ${this.source} / Scheme: ${this.scheme} / Message: ${this.message}`}constructor(e,n,a){var i,s;super(),Rn(this,"reason",void 0),Rn(this,"message",void 0),Rn(this,"source",void 0),Rn(this,"scheme",void 0),Rn(this,"errorFromCardSchemeSdk",void 0);const o="error"in e?(i=e==null?void 0:e.error)==null?void 0:i.message:e==null?void 0:e.message,r="error"in e?(s=e==null?void 0:e.error)==null?void 0:s.reason:e==null?void 0:e.reason;this.message=o,this.reason=r,this.source=n,this.scheme=a,this.errorFromCardSchemeSdk=e}};function Ne(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let rr=class ai{removeScript(){var e,n;this.cleanupListeners(),(n=(e=this.script)==null?void 0:e.parentNode)==null||n.removeChild(this.script),this.script=null}cleanupListeners(){this.script&&(this.script.removeEventListener("load",this.handleOnLoad),this.script.removeEventListener("error",this.handleOnError))}attachListeners(){this.script&&(this.cleanupListeners(),this.script.addEventListener("load",this.handleOnLoad),this.script.addEventListener("error",this.handleOnError))}loadScript(){return new Promise((e,n)=>{var o;const a=document.querySelector(this.node);a?(this.resolveLoadScript=e,this.rejectLoadScript=n,this.script=a.querySelector(`script[src="${this.src}"]`),(o=this.script)!=null&&o.getAttribute("data-script-loaded")?this.resolveLoadScript():this.script?this.attachListeners():(this.script=document.createElement("script"),Object.assign(this.script,this.attributes),Object.assign(this.script.dataset,this.dataAttributes),this.script.src=this.src,this.script.async=!0,this.attachListeners(),a.appendChild(this.script))):n(new z("SCRIPT_ERROR",`Unable to find script container node: ${this.node}`))})}trackEvent(e){var a;const n=new rt({type:e,component:this.component,cdnUrl:this.baseUrl});(a=this.analytics)==null||a.sendAnalytics(n)}constructor({src:e,component:n,node:a="body",attributes:o,dataAttributes:r,analytics:i}){Ne(this,"src",void 0),Ne(this,"component",void 0),Ne(this,"node",void 0),Ne(this,"attributes",void 0),Ne(this,"dataAttributes",void 0),Ne(this,"analytics",void 0),Ne(this,"baseUrl",void 0),Ne(this,"script",void 0),Ne(this,"loadPromise",null),Ne(this,"rejectLoadPromise",null),Ne(this,"resolveLoadScript",null),Ne(this,"rejectLoadScript",null),Ne(this,"handleOnLoad",()=>{var s,d;(s=this.script)==null||s.setAttribute("data-script-loaded","true"),this.cleanupListeners(),(d=this.resolveLoadScript)==null||d.call(this)}),Ne(this,"handleOnError",s=>{var l;this.cleanupListeners();const d=new z("SCRIPT_ERROR",`Unable to load script ${this.src}.${(s==null?void 0:s.message)&&`Message: ${s.message}`}`,{cause:(s==null?void 0:s.error)||s});(l=this.rejectLoadScript)==null||l.call(this,d)}),Ne(this,"load",()=>(this.loadPromise!==null||(this.loadPromise=new Promise((s,d)=>{this.rejectLoadPromise=d;let l=0;this.trackEvent(Le.sdkDownloadInitiated);const h=async()=>{try{l++,await this.loadScript(),this.trackEvent(Le.sdkDownloadCompleted),s()}catch(u){if(this.loadPromise===null)return;this.trackEvent(Le.sdkDownloadFailed),this.removeScript(),l<ai.MAX_NUMBER_OF_RETRIES?setTimeout(()=>{h()},ai.RETRY_DELAY):(this.trackEvent(Le.sdkDownloadAborted),this.loadPromise=null,this.rejectLoadPromise=null,d(u))}};h()})),this.loadPromise)),Ne(this,"remove",()=>{var s;(s=this.rejectLoadPromise)==null||s.call(this,new z("CANCEL","Script loading cancelled.")),this.removeScript(),this.loadPromise=null}),this.src=e,this.component=n,this.node=a,this.attributes=o,this.dataAttributes=r,this.analytics=i,this.baseUrl=(function(s){const d=new URL(s);return d.origin+d.pathname})(this.src)}};Ne(rr,"RETRY_DELAY",1e3),Ne(rr,"MAX_NUMBER_OF_RETRIES",3);function Fn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let As=class{async loadSdkScript(){this.isSdkIsAvailableOnWindow()||(this.scriptElement=new rr({src:this.sdkUrl,component:"clicktopay",analytics:this.analytics}),await this.scriptElement.load()),this.assignSdkReference()}removeSdkScript(){this.scriptElement.remove()}async checkout(e){try{return await this.schemeSdk.checkout(e)}catch(n){throw new Te(n,"checkout",this.schemeName)}}async unbindAppInstance(){try{await this.schemeSdk.unbindAppInstance()}catch(e){throw new Te(e,"unbindAppInstance",this.schemeName)}}async isRecognized(){try{return await this.schemeSdk.isRecognized()}catch(e){throw new Te(e,"isRecognized",this.schemeName)}}async initiateIdentityValidation(){try{return await this.schemeSdk.initiateIdentityValidation()}catch(e){throw new Te(e,"initiateIdentityValidation",this.schemeName)}}async getSrcProfile(e){try{return await this.schemeSdk.getSrcProfile({idTokens:e})}catch(n){throw new Te(n,"getSrcProfile",this.schemeName)}}constructor(e,n,a){if(Fn(this,"schemeSdk",void 0),Fn(this,"customSdkConfiguration",void 0),Fn(this,"analytics",void 0),Fn(this,"sdkUrl",void 0),Fn(this,"scriptElement",null),!e)throw Error("AbstractSrcInitiator: Invalid SDK URL");this.sdkUrl=e,this.customSdkConfiguration=n,this.analytics=a}};const Zp={email:"EMAIL",telephoneNumber:"MOBILE_NUMBER"};let Xp=class extends As{isSdkIsAvailableOnWindow(){var e;return!!((e=window.vAdapters)!=null&&e.VisaSRCI)}assignSdkReference(){this.schemeSdk=new window.vAdapters.VisaSRCI}async init(e,n){try{const a=C(p(p({},e),Jp(this.customSdkConfiguration)),{srciTransactionId:n});await this.schemeSdk.init(a);const o=document.getElementById("vcop-src-system-frame");o==null||o.setAttribute("aria-hidden","true"),o==null||o.setAttribute("tabindex","-1"),o==null||o.setAttribute("inert","")}catch(a){throw new Te(a,"init",this.schemeName)}}async identityLookup({identityValue:e,type:n}){try{const a={identityValue:e,type:Zp[n]};return await this.schemeSdk.identityLookup(a)}catch(a){throw new Te(a,"identityLookup",this.schemeName)}}async completeIdentityValidation(e){try{return await this.schemeSdk.completeIdentityValidation(e)}catch(n){throw new Te(n,"completeIdentityValidation",this.schemeName)}}constructor(e,n,a){var o,r,i;super(e.toLowerCase().includes("live")?Wp:qp,n,a),i="visa",(r="schemeName")in(o=this)?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i}};const eh={email:"EMAIL_ADDRESS",telephoneNumber:"MOBILE_PHONE_NUMBER"};let th=class extends As{isSdkIsAvailableOnWindow(){return!!window.SRCSDK_MASTERCARD}assignSdkReference(){this.schemeSdk=window.SRCSDK_MASTERCARD}async init(e,n){try{const a=C(p(p({},e),Qp(this.customSdkConfiguration)),{srciTransactionId:n});await this.schemeSdk.init(a)}catch(a){throw new Te(a,"init",this.schemeName)}}async identityLookup({identityValue:e,type:n}){try{const a={identityValue:e,identityType:eh[n]};return await this.schemeSdk.identityLookup({consumerIdentity:a})}catch(a){throw new Te(a,"identityLookup",this.schemeName)}}async completeIdentityValidation(e){try{return await this.schemeSdk.completeIdentityValidation({validationData:e})}catch(n){throw new Te(n,"completeIdentityValidation",this.schemeName)}}constructor(e,n,a){var o,r,i;super(e.toLowerCase().includes("live")?Yp:Gp,n,a),i="mc",(r="schemeName")in(o=this)?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i}};const Ds=t=>t.status==="fulfilled",Is=t=>t.status==="rejected";function $s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Rs={visa:Xp,mc:th,default:null};let nh=class{async load(e,n){if(!this.schemes||this.schemes.length===0)throw new z("ERROR","ClickToPay -> SrcSdkLoader: There are no schemes set to be loaded");return new Promise((a,o)=>{const r=this.schemes.map(s=>((d,l,h,u)=>{const y=Rs[d]||Rs.default;return y?new y(l,h,u):null})(s,e,this.customSdkConfiguration,n)),i=r.map(s=>s.loadSdkScript());Promise.allSettled(i).then(s=>{s.every(Is)&&o(new z("ERROR",`ClickToPay -> SrcSdkLoader # Unable to load network schemes: ${this.schemes.toString()}`));const d=r.filter((l,h)=>Ds(s[h]));a(d)})})}constructor(e,{dpaLocale:n="en_US",dpaPresentationName:a=""}){$s(this,"schemes",void 0),$s(this,"customSdkConfiguration",void 0),this.schemes=e,this.customSdkConfiguration={dpaLocale:n,dpaPresentationName:a}}};const Pa={mc:"Mastercard",visa:"Visa"};function Qe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let ah=class{get title(){return this.scheme==="visa"?Pa[this.scheme]:this.descriptorName||Pa[this.scheme]}get isDcfPopupEmbedded(){return this.scheme==="mc"}confirmCardIsExpired(){if(!["ACTIVE","PENDING"].includes(this.status))return!0;if(!this.panExpirationYear&&!this.panExpirationMonth)return!1;const[e,n]=[new Date().getMonth()+1,new Date().getFullYear()];return!(Number(this.panExpirationYear)>n)&&!(Number(this.panExpirationYear)===n&&Number(this.panExpirationMonth)>=e)}constructor(e,n,a){Qe(this,"dateOfCardLastUsed",void 0),Qe(this,"dateOfCardCreated",void 0),Qe(this,"panLastFour",void 0),Qe(this,"srcDigitalCardId",void 0),Qe(this,"scheme",void 0),Qe(this,"artUri",void 0),Qe(this,"srcCorrelationId",void 0),Qe(this,"tokenId",void 0),Qe(this,"isExpired",void 0),Qe(this,"panExpirationMonth",void 0),Qe(this,"panExpirationYear",void 0),Qe(this,"descriptorName",void 0),Qe(this,"status",null),this.dateOfCardLastUsed=e.dateOfCardLastUsed,this.dateOfCardCreated=e.dateOfCardCreated,this.panLastFour=e.panLastFour,this.srcDigitalCardId=e.srcDigitalCardId,this.descriptorName=e.digitalCardData.descriptorName,this.tokenId=e.tokenId,this.scheme=n,this.artUri=e.digitalCardData.artUri,this.srcCorrelationId=a,this.panExpirationMonth=e.panExpirationMonth,this.panExpirationYear=e.panExpirationYear,this.status=e.digitalCardData.status,this.isExpired=this.confirmCardIsExpired()}};const Fs="ctpIframe";function oh(t,e,n){const{scheme:a,tokenId:o,srcDigitalCardId:r,srcCorrelationId:i}=t;return a==="visa"?o?{srcScheme:a,srcCorrelationId:i,srcTokenReference:n.toLowerCase().includes("live")?o:"987654321"}:{srcScheme:a,srcCheckoutPayload:e.checkoutResponse,srcCorrelationId:i}:{srcScheme:a,srcDigitalCardId:r,srcCorrelationId:i}}function rh(t,e){const{profiles:n,srcCorrelationId:a}=e,o=n.reduce((r,i)=>[...r,...i.maskedCards.map(s=>new ah(s,e.scheme,a))],[]);return[...t,...o]}function Os(t,e){return new Date(e.dateOfCardLastUsed).getTime()-new Date(t.dateOfCardLastUsed).getTime()}function ih(t,e){return new Date(e.dateOfCardCreated).getTime()-new Date(t.dateOfCardCreated).getTime()}function sh(t,e){return e.isExpired?t.expiredCards.push(e):t.availableCards.push(e),t}function dh(t,e){return e.dateOfCardLastUsed?t.usedCards.push(e):t.unusedCards.push(e),t}function ch(t){const e=t.reduce(rh,[]),{availableCards:n,expiredCards:a}=e.reduce(sh,{availableCards:[],expiredCards:[]}),{unusedCards:o,usedCards:r}=n.reduce(dh,{unusedCards:[],usedCards:[]});return[...r.sort(Os),...o.sort(ih),...a.sort(Os)]}function ir(t){return!!t.reason}function Aa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let dn=class extends Error{setCorrelationId(e){this.correlationId=e}toString(){return this.message}constructor(e){super(`ClickToPayService - Timeout during ${e.source}() of the scheme '${e.scheme}'`),Aa(this,"scheme",void 0),Aa(this,"source",void 0),Aa(this,"isTimeoutTriggeredBySchemeSdk",void 0),Aa(this,"correlationId",void 0),this.name="TimeoutError",this.source=e.source,this.scheme=e.scheme,this.isTimeoutTriggeredBySchemeSdk=e.isTimeoutTriggeredBySchemeSdk}};function sr(t,e,n){let a=null;return Promise.race([t(),(o=e,new Promise((r,i)=>{a=setTimeout(()=>i(n),o)}))]).then(r=>(clearTimeout(a),r)).catch(r=>{throw clearTimeout(a),r});var o}function Ue(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _e=(function(t){return t.Idle="Idle",t.Loading="Loading",t.ShopperIdentified="ShopperIdentified",t.OneTimePassword="OneTimePassword",t.Ready="Ready",t.Login="Login",t.NotAvailable="NotAvailable",t})({});let lh=class{get shopperAccountFound(){return["Ready","ShopperIdentified"].includes(this.state)}get schemes(){return this.sdkLoader.schemes}updateStoreCookiesConsent(e){this.storeCookies=e}async initialize(){this.setState("Loading");try{this.sdks=await this.sdkLoader.load(this.environment,this.analytics),await this.initiateSdks();const{recognized:e=!1,idTokens:n=null}=await this.verifyIfShopperIsRecognized();if(e)return await this.getShopperProfile(n),void this.setState("Ready");if(!this.shopperIdentity)return void this.setState("NotAvailable");const{isEnrolled:a}=await this.verifyIfShopperIsEnrolled(this.shopperIdentity);if(a)return void this.setState("ShopperIdentified");this.setState("NotAvailable")}catch(e){e instanceof Te&&(e==null?void 0:e.reason)==="REQUEST_TIMEOUT"||e instanceof dn?this.handleTimeout(e):e instanceof Te?console.warn(`Error at ClickToPayService # init: ${e.toString()}`):console.warn(e),this.setState("NotAvailable")}}subscribeOnStateChange(e){this.stateSubscriber=e}async startIdentityValidation(){if(!this.validationSchemeSdk)throw Error("startIdentityValidation: No ValidationSDK set for the validation process");try{const{maskedValidationChannel:e}=await this.validationSchemeSdk.initiateIdentityValidation();this.identityValidationData={maskedShopperContact:e.replace(/\*/g,"•"),selectedNetwork:Pa[this.validationSchemeSdk.schemeName]},this.setState("OneTimePassword")}catch(e){throw this.validationSchemeSdk=null,e}}async finishIdentityValidation(e){if(!this.validationSchemeSdk)throw Error("finishIdentityValidation: No ValidationSDK set for the validation process");const n=await this.validationSchemeSdk.completeIdentityValidation(e);await this.getShopperProfile([n.idToken]),this.setState("Ready"),this.validationSchemeSdk=null}async checkout(e){if(!e)throw Error("ClickToPayService # checkout: Missing card data");const n=this.sdks.find(o=>o.schemeName===e.scheme),a=await n.checkout(p(p({srcDigitalCardId:e.srcDigitalCardId,srcCorrelationId:e.srcCorrelationId},e.isDcfPopupEmbedded&&{windowRef:window.frames[Fs]}),this.storeCookies&&{complianceSettings:{complianceResources:[{complianceType:"REMEMBER_ME",uri:""}]}}));if(a.dcfActionCode!=="COMPLETE")throw new z("ERROR",`Checkout through Scheme DCF did not complete. DCF Action code received: ${a.dcfActionCode}`);return oh(e,a,this.environment)}async logout(){if(!this.sdks)throw new z("ERROR","ClickToPayService is not initialized");try{const e=this.sdks.map(n=>n.unbindAppInstance());await Promise.all(e)}catch(e){e instanceof Te?console.warn(`Error at ClickToPayService # logout: ${e.toString()}`):console.warn(e)}this.shopperCards=null,this.identityValidationData=null,this.validationSchemeSdk=null,this.setState("Login")}verifyIfShopperIsEnrolled(e){const{shopperEmail:n}=e;return new Promise((a,o)=>{const r=this.sdks.map(i=>sr(()=>i.identityLookup({identityValue:n,type:"email"}),5e3,new dn({source:"identityLookup",scheme:i.schemeName,isTimeoutTriggeredBySchemeSdk:!1})).then(s=>{s.consumerPresent&&!this.validationSchemeSdk&&(this.setSdkForPerformingShopperIdentityValidation(i),a({isEnrolled:!0}))}).catch(s=>{o(s)}));Promise.allSettled(r).then(()=>{a({isEnrolled:!1})})})}setState(e){var n;this.state=e,(n=this.stateSubscriber)==null||n.call(this,this.state)}setSdkForPerformingShopperIdentityValidation(e){this.validationSchemeSdk=e}handleTimeout(e){var a,o,r,i,s,d,l;const n=e instanceof Te?new dn({source:e.source,scheme:e.scheme,isTimeoutTriggeredBySchemeSdk:!0}):e;n.scheme==="visa"&&(n.setCorrelationId((a=window.VISA_SDK)==null?void 0:a.correlationId),(o=window.VISA_SDK)!=null&&o.correlationId?(i=(r=window.VISA_SDK)==null?void 0:r.buildClientProfile)==null||i.call(r):(d=(s=window.VISA_SDK)==null?void 0:s.buildClientProfile)==null||d.call(s,this.schemesConfig.visa.srciDpaId)),(l=this.onTimeout)==null||l.call(this,n)}async getShopperProfile(e){return new Promise((n,a)=>{const o=this.sdks.map(r=>r.getSrcProfile(e));Promise.allSettled(o).then(r=>{r.every(Is)&&a(r[0].reason);const i=r.map((s,d)=>Ds(s)&&C(p({},s.value),{scheme:this.sdks[d].schemeName})).filter(s=>!!s);this.shopperCards=ch(i),n()})})}verifyIfShopperIsRecognized(){return new Promise((e,n)=>{const a=this.sdks.map(o=>sr(()=>o.isRecognized(),5e3,new dn({source:"isRecognized",scheme:o.schemeName,isTimeoutTriggeredBySchemeSdk:!1})).then(r=>{r.recognized&&e(r)}).catch(r=>{n(r)}));Promise.allSettled(a).then(()=>{e({recognized:!1})})})}initiateSdks(){const e=this.sdks.map(n=>{const a=this.schemesConfig[n.schemeName];return sr(()=>n.init(a,this.srciTransactionId),5e3,new dn({source:"init",scheme:n.schemeName,isTimeoutTriggeredBySchemeSdk:!1}))});return Promise.all(e)}constructor(e,n,a,o,r,i){Ue(this,"sdkLoader",void 0),Ue(this,"schemesConfig",void 0),Ue(this,"shopperIdentity",void 0),Ue(this,"environment",void 0),Ue(this,"analytics",void 0),Ue(this,"onTimeout",void 0),Ue(this,"srciTransactionId",ze()),Ue(this,"sdks",void 0),Ue(this,"validationSchemeSdk",null),Ue(this,"stateSubscriber",void 0),Ue(this,"state","Idle"),Ue(this,"shopperCards",null),Ue(this,"identityValidationData",null),Ue(this,"storeCookies",!1),this.sdkLoader=n,this.schemesConfig=e,this.shopperIdentity=r,this.environment=a,this.onTimeout=i,this.analytics=o}};function uh(t,e,n,a){const o=hh(t);if(!o)return null;const r=ph(e==null?void 0:e.shopperEmail,e==null?void 0:e.telephoneNumber),i=Object.keys(o),s=new nh(i,{dpaLocale:e==null?void 0:e.locale,dpaPresentationName:e==null?void 0:e.merchantDisplayName});return new lh(o,s,n,a,r,e==null?void 0:e.onTimeout)}const ph=(t,e)=>{const n=p({},t&&{shopperEmail:t});return Object.keys(n).length>0?n:null},hh=t=>{if(!t)return null;const{visaSrciDpaId:e,visaSrcInitiatorId:n,mcDpaId:a,mcSrcClientId:o}=t,r=p(p({},a&&o&&{mc:{srciDpaId:a,srcInitiatorId:o}}),e&&n&&{visa:{srciDpaId:e,srcInitiatorId:n}});return Object.keys(r).length===0?null:r},Ms=na({status:null,onSubmit:null,onSetStatus:null,onError:null,onReady:null,configuration:null,isStandaloneComponent:null,isCtpPrimaryPaymentMethod:null,isStoringCookies:!1,setIsCtpPrimaryPaymentMethod:null,logoutShopper:null,updateStoreCookiesConsent:null,ctpState:null,cards:[],schemes:[],otpMaskedContact:null,otpNetwork:null,checkout:null,verifyIfShopperIsEnrolled:null,startIdentityValidation:null,finishIdentityValidation:null}),yh=({isStandaloneComponent:t=!1,clickToPayService:e,configuration:n,children:a,setClickToPayRef:o,onSubmit:r,onSetStatus:i,onError:s})=>{var P,A;const[d]=N(e),[l,h]=N((e==null?void 0:e.state)||_e.NotAvailable),[u,y]=N(!0),[m,f]=N("ready"),x=J({}),S=J(!1);F(()=>{o(x.current),x.current.setStatus=f},[]),F(()=>{d==null||d.subscribeOnStateChange(I=>h(I))},[d]);const w=D(()=>{var I;S.current||((I=n.onReady)==null||I.call(n),S.current=!0)},[n==null?void 0:n.onReady]),k=D(async I=>{await(d==null?void 0:d.finishIdentityValidation(I))},[d]),b=D(async()=>await(d==null?void 0:d.startIdentityValidation()),[d]),_=D(async I=>await(d==null?void 0:d.checkout(I)),[d]),g=D(async I=>await(d==null?void 0:d.verifyIfShopperIsEnrolled(I)),[d]),T=D(async()=>{await(d==null?void 0:d.logout())},[d]),E=D(I=>{d.updateStoreCookiesConsent(I)},[d]);return c(Ms.Provider,{value:{status:m,onSubmit:r,onError:s,onSetStatus:i,configuration:n,isStoringCookies:d==null?void 0:d.storeCookies,isStandaloneComponent:t,isCtpPrimaryPaymentMethod:u,setIsCtpPrimaryPaymentMethod:y,ctpState:l,verifyIfShopperIsEnrolled:g,cards:d==null?void 0:d.shopperCards,schemes:d==null?void 0:d.schemes,otpMaskedContact:(P=d==null?void 0:d.identityValidationData)==null?void 0:P.maskedShopperContact,otpNetwork:(A=d==null?void 0:d.identityValidationData)==null?void 0:A.selectedNetwork,checkout:_,logoutShopper:T,startIdentityValidation:b,finishIdentityValidation:k,updateStoreCookiesConsent:E,onReady:w}},a)};function it(){return Lt(Ms)}const mh={otp:{validate:t=>!!t&&t.length>0,errorMessage:"field.error.required",modes:["blur"]},default:{validate:t=>!!t&&t.length>0,errorMessage:"field.error.required",modes:["blur"]}},_h=t=>{const{srPanel:e}=Cs();F(()=>(e.setAriaProps({"aria-relevant":"additions text"}),()=>{e.setMessages(null),e.setAriaProps({"aria-relevant":e.constructor.defaultProps.ariaAttributes["aria-relevant"]})}),[]),F(()=>{e.setMessages(t)},[t])},fh=({onError:t,onResendCode:e,disabled:n})=>{const[a,o]=N(null),[r,i]=N(!1),{i18n:s}=O(),{startIdentityValidation:d}=it(),[l,h]=N(null);_h(l),F(()=>{let y;return a>0&&(y=setTimeout(()=>o(a-1),1e3)),a===60?h(`${s.get("ctp.otp.resendCode")} - ${a}s`):a===0&&h(s.get("ctp.otp.resendCode")),()=>clearTimeout(y)},[a]),F(()=>{let y;return r&&(y=setTimeout(()=>{i(!1),o(60)},2e3)),()=>clearTimeout(y)},[r]);const u=D(async y=>{y.preventDefault();try{e(),i(!0),await d()}catch(m){if(o(0),i(!1),!ir(m))return void console.error(m);t(m.reason)}},[d,t,e]);return r?c("div",{role:"alert",className:"adyen-checkout-ctp__otp-resend-code--confirmation"},s.get("ctp.otp.codeResent"),c(ka,{type:`${Kt}checkmark_black`,height:14,width:14})):a>0?c("div",{role:"timer",className:"adyen-checkout-ctp__otp-resend-code--disabled"},s.get("ctp.otp.resendCode")," -"," ",c("span",{className:"adyen-checkout-ctp__otp-resend-code-counter"}," ",a>0&&`${a}s`," ")):c(Ye,{classNameModifiers:[$("otp-resend-code",{"otp-resend-code--disabled":n})],onClick:u,variant:"link",inline:!0,disabled:n},s.get("ctp.otp.resendCode"))},dr=(t,e,n="")=>{const a=t instanceof Element?t:kt(document,t);let o;o=kt(a,e==="country"||e==="stateOrProvince"||e==="issuer-list"||e==="selectedAccountType"?`${n}.adyen-checkout__field--${e} .adyen-checkout__filter-input`:`${n} [name="${e}"]`),ht.__IS_IOS&&ks(o),o==null||o.focus({preventScroll:ht.__IS_IOS})};function gh(t){return{focusFirstError:D((e,n)=>{const a=(function(r){var i;return r&&typeof r=="object"&&"current"in r?(i=r.current)!=null?i:void 0:r})(t);if(!a)return;const o=n.find(r=>e[r]);o&&dr(a,o)},[t])}}function Ls(t){const s=t,{formHolder:e}=s,n=Ce(s,["formHolder"]),a=An(n),{focusFirstError:o}=gh(e),r=J(!1),i=D((d=null)=>{r.current=!0,a.triggerValidation(d)},[a.triggerValidation]);return F(()=>{r.current&&(r.current=!1,o(a.errors,a.schema))},[a.errors]),C(p({},a),{triggerValidation:i})}const bh=(t,e,n,a=!0)=>{if(e!=null&&e.errorMessage&&typeof e.errorMessage=="string"){const o=e.errorMessage,r=[nt,Hc].includes(o),i={values:{label:a?n==null?void 0:n.toLowerCase():n}};return r?t.get(o,i):t.get(o)}return!!e},kh=t=>{const{i18n:e}=O(),{configuration:{disableOtpAutoFocus:n}}=it(),[a,o]=N(null),r=J(null),{handleChangeFor:i,data:s,triggerValidation:d,valid:l,errors:h,isValid:u,setData:y}=Ls({schema:["otp"],rules:mh,formHolder:r}),m=J({validateInput:null}),f=J(null),[x,S]=N(!1),w=D(()=>{S(!0),d()},[d]);F(()=>{s.otp&&S(!0)},[s.otp]),F(()=>{!n&&f.current&&f.current.focus()},[f.current,n]),F(()=>{r.current&&t.errorMessage&&dr(r.current,"otp")},[t.errorMessage]),F(()=>{m.current.validateInput=w,t.onSetInputHandlers(m.current)},[w,t.onSetInputHandlers]);const k=D(()=>{y("otp",""),o(null),n||f.current.focus(),t.onResendCode()},[t.onResendCode,f.current,n]),b=D(T=>{const E=e.get(`ctp.errors.${T}`);E&&o(E)},[e]),_=D(T=>{T.key==="Enter"&&t.onPressEnter()},[t.onPressEnter]);F(()=>{t.onChange({data:s,valid:l,errors:h,isValid:u})},[s,l,h]);const g=D(()=>x?a||t.errorMessage||bh(e,h.otp,e.get("ctp.otp.fieldLabel")):null,[x,a,t.errorMessage,h.otp,e]);return c("div",{ref:r,className:"adyen-checkout-ctp__otp-field-wrapper"},c(ke,{name:"oneTimePassword",label:e.get("ctp.otp.fieldLabel"),errorMessage:g(),classNameModifiers:["otp"],errorLive:!0},c(In,{name:"otp",autocorrect:"off",spellcheck:!1,value:s.otp,disabled:t.disabled,onInput:i("otp","input"),onBlur:i("otp","blur"),onKeyPress:_,setRef:T=>{f.current=T},autocomplete:"off"})),c("div",{className:"adyen-checkout-ctp__otp-resend-code-wrapper"},c(fh,{disabled:t.isValidatingOtp,onError:b,onResendCode:k})))},Bs=({classNameModifiers:t=[]})=>{const e=$e(),{schemes:n}=it(),a=e()("ctp"),o=e({imageFolder:"components/"})("pipe");return c("div",{className:$("adyen_checkout-ctp__brand-wrapper",t.map(r=>`adyen_checkout-ctp__brand-wrapper--${r}`))},c(we,{className:"adyen_checkout-ctp__brand-logo",src:a,alt:"Logo of Click to Pay"}),c(we,{className:"adyen_checkout-ctp__brand-pipe",src:o,alt:""}),n.map(r=>c(we,{key:r,className:$("adyen_checkout-ctp__brand-scheme",`adyen_checkout-ctp__brand-scheme-${r}`),src:e()(r),alt:`Logo of ${Pa[r]}`})))};let Vs=Date.now();function zs(){return Vs+=1,`adyen-${Vs}`}const vh=({isOpen:t,onClose:e,focusAfterClose:n})=>{const a=J(),{i18n:o}=O(),r=$e(),i=zs(),s=zs();return c(Ts,{onClose:e,isOpen:t,classNameModifiers:["ctp"],labelledBy:i,describedBy:s,focusFirst:a.current,focusAfterClose:n},({onCloseModal:d})=>c(G,null,c(we,{className:"adyen-checkout__ctp-modal-header-image",src:r({imageFolder:"components/"})("ctp_landscape"),alt:""}),c("h2",{id:i,className:"adyen-checkout__ctp-modal-title"},o.get("ctp.infoPopup.title")),c("div",{id:s},c("p",{tabIndex:-1,ref:a,className:"adyen-checkout__ctp-modal-text"},o.get("ctp.infoPopup.subtitle")),c("ul",{className:"adyen-checkout__ctp-modal-text adyen-checkout__ctp-modal-benefits"},c("li",null,o.get("ctp.infoPopup.benefit1")),c("li",null,o.get("ctp.infoPopup.benefit2")),c("li",null,o.get("ctp.infoPopup.benefit3"))),c(Bs,{classNameModifiers:["popup"]})),c(Ye,{onClick:d,label:o.get("close")})))},Us=()=>{const[t,e]=N(!1),n=J(),{i18n:a}=O(),o=$e()({imageFolder:"components/"})("info"),r=D(()=>{e(!1)},[]),i=D(()=>{e(!0)},[]);return c(G,null,c("button",{ref:n,onClick:i,className:"adyen-web__ctp-info-button","aria-label":a.get("ctp.aria.infoModalButton"),type:"button"},c(we,{height:"15",src:o,"aria-hidden":!0})),c(vh,{isOpen:t,onClose:r,focusAfterClose:n.current}))},xh=()=>{const{ctpState:t,logoutShopper:e,status:n,cards:a}=it(),{i18n:o}=O();if([_e.Ready,_e.OneTimePassword].includes(t)===!1)return null;const r=ce(()=>t===_e.Ready&&a.length>1?o.get("ctp.logout.notYourCards"):t===_e.Ready&&a.length===1?o.get("ctp.logout.notYourCard"):t===_e.Ready&&a.length===0?o.get("ctp.logout.notYourProfile"):o.get("ctp.logout.notYou"),[o,t]);return c(Ye,{classNameModifiers:[$("section-logout-button",{"section-logout-button--disabled":n==="loading"})],disabled:n==="loading",onClick:e,variant:"link",inline:!0},r)},Ft=({children:t,onEnterKeyPress:e})=>{const{isStandaloneComponent:n}=it();return c("div",{className:$("adyen-checkout-ctp__section",{"adyen-checkout-ctp__section--standalone":n}),onKeyPress:e},c("div",{className:"adyen-checkout-ctp__section-brand"},c(Bs,null),c(xh,null)),t)};Ft.Title=({endAdornment:t,children:e})=>c("div",{className:"adyen-checkout-ctp__section-header"},c("h1",{className:"adyen-checkout-ctp__section-header-title"},e),t&&c("span",{className:"adyen-checkout-ctp__section-header-adornment"},t)),Ft.Text=({children:t})=>c("p",{className:"adyen-checkout-ctp__section-text"},t);const wh=()=>window.matchMedia("(max-width: 480px)").matches;function Ch(){const{i18n:t}=O(),{updateStoreCookiesConsent:e,isStoringCookies:n}=it(),[a,o]=N(n),[r,i]=N(wh()),s=D(()=>{const d=!a;o(d),e(d)},[e,o,a]);return c("div",{className:$("adyen-checkout-ctp__otp-checkbox-container",{"adyen-checkout-ctp__otp-checkbox-container--checked":a})},c(ke,{classNameModifiers:["consentCheckbox"],name:"clickToPayCookiesCheckbox",showContextualElement:!1,useLabelElement:!1,i18n:t},c(Yo,{name:"clickToPayCookiesCheckbox",onInput:s,label:t.get("ctp.otp.saveCookiesCheckbox.label"),checked:a,"aria-describedby":"adyen-ctp-cookies-info"})),c("p",{className:"adyen-checkout-ctp__otp-checkbox-info"},r?c(G,null,c("span",{id:"adyen-ctp-cookies-info"},t.get("ctp.otp.saveCookiesCheckbox.shorterInfo")," "),c("button",{className:"adyen-checkout-ctp__otp-readmore-button",onClick:()=>i(!1)},t.get("readMore"),"..")):c("span",{id:"adyen-ctp-cookies-info"},t.get("ctp.otp.saveCookiesCheckbox.information"))))}const Sh=({onDisplayCardComponent:t})=>{const{i18n:e}=O(),{finishIdentityValidation:n,otpMaskedContact:a,otpNetwork:o,isCtpPrimaryPaymentMethod:r}=it(),[i,s]=N(null),[d,l]=N(!1),[h,u]=N(!1),[y,m]=N(null),[f,x]=N(null),[S,w]=N(!1),k=D(P=>{x(P)},[]),b=D(({data:P,isValid:A})=>{s(P.otp),l(A)},[]),_=D(()=>{m(null)},[]),g=D(async()=>{if(m(null),d){u(!0);try{await n(i)}catch(P){if(!ir(P))return void u(!1);m(P==null?void 0:P.reason),u(!1),(P==null?void 0:P.reason)==="ACCT_INACCESSIBLE"&&(w(!0),t==null||t())}}else f.validateInput()},[i,d,f,t]),T=D(P=>{P.key==="Enter"&&g()},[g]),E=e.get("ctp.otp.subtitle").split("%@");return c(G,null,c(Ft.Title,{endAdornment:c(Us,null)},e.get("ctp.otp.title")),c(Ft.Text,null,E[0]," ",o," ",E[1],c("span",{className:"adyen-checkout-ctp__otp-subtitle--highlighted"},a),E[2]),c(kh,{hideResendOtpButton:S,onChange:b,onSetInputHandlers:k,disabled:h,errorMessage:y&&e.get(`ctp.errors.${y}`),onPressEnter:g,onResendCode:_,isValidatingOtp:h}),c(Ch,null),c(Ye,{disabled:S,label:e.get("continue"),variant:r?"primary":"secondary",onClick:g,status:h&&"loading",onKeyDown:T}))},Eh=({card:t,errorMessage:e})=>{const{i18n:n}=O(),a=$e(),o=t.artUri||a()(t.scheme);return c(G,null,c("div",{className:"adyen-checkout-ctp__card-list-single-card"},c(we,{src:o,height:24,className:"adyen-checkout-ctp__card-image"}),c("span",{className:$({"adyen-checkout-ctp__card-list-single-card-expired":t.isExpired})},t.title," ",`•••• ${t.panLastFour}`),t.isExpired&&c("span",{className:"adyen-checkout-ctp__expired-label"},n.get("ctp.cards.expiredCard"))),e&&c("div",{className:"adyen-checkout-contextual-text--error"},e))},js=(t,e)=>e!=null&&e.value&&(e!=null&&e.currency)?t.amount(e.value,e.currency,{currencyDisplay:e.currencyDisplay||"symbol"}):"",Ks=t=>{const e=t.get("payAmountFormat"),n=e.indexOf("%@");return n>=0&&e.substring(n+2).trim().length>0},Hs=(t,e,n)=>{const a=js(t,e);if(!a)return t.get("payButton");if(n&&Ks(t)){const o=qs(t,n);return t.get("payAmountFormat").replace("%@",`${a}${o}`)}return t.get("payAmountFormat").replace("%@",a)},qs=(t,e)=>{const n=e&&(e!=null&&e.value)&&(e!=null&&e.currency)?t.amount(e.value,e.currency,{currencyDisplay:e.currencyDisplay||"symbol"}):"";return`${n.length?"/ ":""}${n}`};function Th(t,e,n,a,o,r){return e||(o?Hs(t,o):a?t.get("confirmPreauthorization"):Hs(t,n,r))}function Nh(t,e,n,a,o){return a||o||!n||!e||Ks(t)?null:qs(t,e)}const Ph=({label:t})=>c("span",{className:"checkout-secondary-button__text"},t),Ah={IDR:1,JPY:1,KRW:1,VND:1,BYR:1,CVE:1,DJF:1,GHC:1,GNF:1,KMF:1,PYG:1,RWF:1,UGX:1,VUV:1,XAF:1,XOF:1,XPF:1,MRO:10,BHD:1e3,IQD:1e3,JOD:1e3,KWD:1e3,OMR:1e3,LYD:1e3,TND:1e3},Ws={RSD:{minimumFractionDigits:2},AFN:{minimumFractionDigits:2},ALL:{minimumFractionDigits:2},IRR:{minimumFractionDigits:2},LAK:{minimumFractionDigits:2},LBP:{minimumFractionDigits:2},MMK:{minimumFractionDigits:2},SOS:{minimumFractionDigits:2},SYP:{minimumFractionDigits:2},YER:{minimumFractionDigits:2},IQD:{minimumFractionDigits:3}},Dh=t=>Ah[t]||100,Ih=(t,e)=>{const n=Dh(e);return parseInt(String(t),10)/n},$h=(t,e,n,a={})=>{const o=t.toString(),r=Ih(o,n),i=e.replace("_","-"),s=p({style:"currency",currency:n,currencyDisplay:"symbol"},Ws[n]?p(p({},a),Ws[n]):a);try{return r.toLocaleString(i,s)}catch(d){return o}},cr=t=>{if(!t||typeof t!="object")return!1;const e=typeof t.value=="number"&&!Number.isNaN(t.value),n=typeof t.currency=="string"&&t.currency.length>0,a=t.currencyDisplay===void 0||typeof t.currencyDisplay=="string";return e&&n&&a},lr=o=>{var r=o,{customAmount:t,classNameModifiers:e=[],label:n}=r,a=Ce(r,["customAmount","classNameModifiers","label"]);const{amount:i,isZeroAuth:s}=$n(),{secondaryAmount:d}=Uu(),{i18n:l}=O(),h=Th(l,n,i,s,t,d),u=Nh(l,d,cr(i),s,n),y=a.disabled||a.status==="loading";return c(Ye,C(p({},a),{disabled:y,classNameModifiers:[...e,"pay"],label:h}),u&&c(Ph,{label:u}))},Gs=()=>window.matchMedia("(max-width: 768px)").matches&&/Android|iPhone|iPod/.test(navigator.userAgent),Rh=["srcDigitalCardId"],Fh=({cardSelected:t,cards:e,errorMessage:n,onChangeCard:a})=>{const{i18n:o}=O(),r=$e(),{status:i}=it(),{handleChangeFor:s,data:d}=An({schema:Rh,defaultData:{srcDigitalCardId:t.srcDigitalCardId}}),l=ce(()=>e.map(h=>({icon:h.artUri||r()(h.scheme),name:`${Gs()?"":h.title} •••• ${h.panLastFour} `,secondaryText:h.isExpired&&o.get("ctp.cards.expiredCard"),id:h.srcDigitalCardId,disabled:h.isExpired})),[e]);return F(()=>{const{srcDigitalCardId:h}=d,u=e.find(y=>y.srcDigitalCardId===h);a(u)},[d,a]),c(ke,{name:"clickToPayCards",className:"adyen-checkout-ctp__cards-list-field",errorMessage:n,readOnly:i==="loading",label:o.get("ctp.cards.subtitle")},c(Ht,{items:l,selectedValue:d.srcDigitalCardId,name:"clickToPayCards",filterable:!1,className:"adyen-checkout-ctp__cards-list-dropdown",readonly:i==="loading",onChange:s("srcDigitalCardId")}))};function Ys(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let On=class extends Fe{iframeOnLoad(){this.props.callback&&typeof this.props.callback=="function"&&this.props.callback(this.iframeEl.contentWindow)}componentDidMount(){this.iframeEl.addEventListener?this.iframeEl.addEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.attachEvent?this.iframeEl.attachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=this.iframeOnLoad.bind(this)}componentWillUnmount(){this.iframeEl.removeEventListener?this.iframeEl.removeEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.detachEvent?this.iframeEl.detachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=null}render({name:e,src:n,width:a,height:o,minWidth:r,minHeight:i,allow:s,title:d,classNameModifiers:l}){const h=l.filter(u=>!!u);return c("iframe",{ref:u=>{this.iframeEl=u},allow:s,className:$("adyen-checkout__iframe",`adyen-checkout__iframe--${e}`,h.length&&l.map(u=>`adyen-checkout__iframe--${e}-${u}`)),name:e,src:n,width:a,height:o,frameBorder:"0",title:d,referrerpolicy:"origin","min-width":r,"min-height":i})}constructor(...e){super(...e),Ys(this,"iframeEl",void 0)}};Ys(On,"defaultProps",{width:"0",height:"0",minWidth:"0",minHeight:"0",src:null,allow:null,title:"components iframe",classNameModifiers:[]});function Js(t,e){if(!t)return null;const n=e.get(`ctp.errors.${t}`);return n.includes("ctp.errors")?e.get("ctp.errors.UNKNOWN_ERROR"):n}function Oh(t,e,n){return n?Gs()?null:t.get("payButton.with",{values:{value:js(t,e),maskedData:`•••• ${n==null?void 0:n.panLastFour}`}}):t.get("payButton")}const Mh=({onDisplayCardComponent:t})=>{const{i18n:e}=O(),n=$e(),{cards:a,checkout:o,isCtpPrimaryPaymentMethod:r,status:i,onSubmit:s,onSetStatus:d,onError:l}=it(),[h,u]=N(a.find(E=>!E.isExpired)||a[0]),[y,m]=N(null),f=a.every(E=>E.isExpired),[x,S]=N(!1),{amount:w}=$n();F(()=>{(a.length===0||f)&&(t==null||t())},[t,f,a]);const k=D(async()=>{if(h)try{S(!0),m(null),d("loading");const E=await o(h);s(E)}catch(E){E instanceof Te&&(m(E==null?void 0:E.reason),console.warn(`CtP - Checkout: Reason: ${E==null?void 0:E.reason} / Source: ${E==null?void 0:E.source} / Scheme: ${E==null?void 0:E.scheme}`)),S(!1),l(E instanceof z?E:new z("ERROR","Error during ClickToPay checkout",{cause:E}))}},[o,h]),b=D(E=>{u(E)},[]),_=x&&i==="loading"&&(h==null?void 0:h.isDcfPopupEmbedded),g=i!=="loading"||!_,T=D(E=>{E.key==="Enter"&&k()},[k]);return c(G,null,c(On,{name:Fs,height:"380",width:"100%",classNameModifiers:[_?"":"hidden"]}),g&&c(G,null,c(Ft.Title,null,e.get("ctp.cards.title")),a.length===0&&c("div",{className:"adyen-checkout-ctp__empty-cards"},e.get("ctp.emptyProfile.message")),a.length===1&&c(Eh,{card:a[0],errorMessage:Js(y,e)}),a.length>1&&c(Fh,{cardSelected:h,cards:a,onChangeCard:b,errorMessage:Js(y,e)}),c(lr,{disabled:f,label:Oh(e,w,h),status:i,variant:r?"primary":"secondary",icon:a.length!==0&&n({imageFolder:"components/"})(r?`${Kt}lock`:`${Kt}lock_black`),onClick:k,onKeyDown:T})))},Lh=()=>{const{i18n:t}=O();return c(G,null,c("div",{className:"adyen-checkout-ctp__card-animation"},c("div",{className:"adyen-checkout-ctp__card-animation-layer"}),c("div",{className:"adyen-checkout-ctp__card-animation-layer"}),c("div",{className:"adyen-checkout-ctp__card-animation-layer"})),c("div",{className:"adyen-checkout-ctp__loading-subtitle"},t.get("ctp.loading.intro")))},Bh={shopperLogin:{validate:t=>!!t&&t.length>0,errorMessage:"ctp.errors.INVALID_EMAIL",modes:["blur"]},default:{validate:t=>!!t&&t.length>0,errorMessage:"",modes:["blur"]}};function Vh(t){return c(xa,C(p({},t),{type:"email",autoCapitalize:"off"}))}const zh=t=>{const{i18n:e}=O(),n=J(null),{handleChangeFor:a,data:o,triggerValidation:r,valid:i,errors:s,isValid:d}=Ls({schema:["shopperLogin"],rules:Bh,formHolder:n}),l=J({validateInput:null,focusInput:null}),[h,u]=N(!1),y=D(()=>{u(!0),r()},[r]);F(()=>{n.current&&t.errorMessage&&dr(n.current,"shopperLogin")},[t.errorMessage]),F(()=>{o.shopperLogin&&u(!0)},[o.shopperLogin]),F(()=>{l.current.validateInput=y,t.onSetInputHandlers(l.current)},[y,t.onSetInputHandlers]);const m=D(f=>{f.key==="Enter"&&t.onPressEnter()},[t.onPressEnter]);return F(()=>{t.onChange({data:o,valid:i,errors:s,isValid:d})},[o,i,s]),c("div",{ref:n},c(ke,{name:"shopperLogin",label:e.get("ctp.login.inputLabel"),errorMessage:h?t.errorMessage||s.shopperLogin&&e.get(s.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},c(Vh,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:o.shopperLogin,disabled:t.disabled,onInput:a("shopperLogin","input"),onBlur:a("shopperLogin","blur"),onKeyPress:m,autocomplete:"email"})))},Uh=()=>{const{i18n:t}=O(),{isCtpPrimaryPaymentMethod:e,setIsCtpPrimaryPaymentMethod:n,verifyIfShopperIsEnrolled:a,startIdentityValidation:o}=it(),[r,i]=N(null),[s,d]=N(!1),[l,h]=N(null),[u,y]=N(!1),[m,f]=N(null),x=D(b=>{f(b)},[]),S=D(({data:b,isValid:_})=>{var g;i(b.shopperLogin),d(_),((g=b==null?void 0:b.shopperLogin)==null?void 0:g.length)>0&&n(!0)},[]),w=D(async()=>{if(h(null),s){y(!0);try{const{isEnrolled:b}=await a({shopperEmail:r});b?await o():(h("NOT_FOUND"),y(!1))}catch(b){b instanceof Te&&console.warn(`CtP - Login error: ${b.toString()}`),b instanceof dn&&console.warn(b.toString()),ir(b)?h(b.reason==="INVALID_PARAMETER"?"INVALID_EMAIL":b.reason):console.error(b),y(!1)}}else m.validateInput()},[a,o,r,s,m]),k=D(b=>{b.key==="Enter"&&w()},[w]);return c(G,null,c(Ft.Title,{endAdornment:c(Us,null)},t.get("ctp.login.title")),c(Ft.Text,null,t.get("ctp.login.subtitle")),c(zh,{onChange:S,onSetInputHandlers:x,disabled:u,errorMessage:l&&t.get(`ctp.errors.${l}`),onPressEnter:w}),c(Ye,{label:t.get("continue"),variant:e?"primary":"secondary",status:u&&"loading",onClick:()=>{w()},onKeyDown:k}))},Qs=({onDisplayCardComponent:t})=>{const{ctpState:e,onReady:n,startIdentityValidation:a,logoutShopper:o}=it();F(()=>{[_e.OneTimePassword,_e.Login,_e.Ready].includes(e)&&n()},[e,n]),F(()=>{e===_e.ShopperIdentified&&(async function(){try{await a()}catch(i){i instanceof Te&&console.warn(`CtP - Identity Validation error: ${i.toString()}`),await o()}})()},[e]);const r=D(i=>{i.key==="Enter"&&(i.preventDefault(),i.stopPropagation())},[]);return e===_e.NotAvailable?null:c(Ft,{onEnterKeyPress:r},[_e.Loading,_e.ShopperIdentified].includes(e)&&c(Lh,null),e===_e.OneTimePassword&&c(Sh,{onDisplayCardComponent:t}),e===_e.Ready&&c(Mh,{onDisplayCardComponent:t}),e===_e.Login&&c(Uh,null))};function jh({label:t="qrCodeOrApp",classNames:e=[]}){const{i18n:n}=O();return c("div",{className:$("adyen-checkout__content-separator",...e)},n.get(t))}const Kh=({children:t})=>{const{i18n:e}=O(),[n,a]=N(null),{ctpState:o,isCtpPrimaryPaymentMethod:r,setIsCtpPrimaryPaymentMethod:i,status:s}=it(),d=n===null&&r===null;F(()=>{if(d){if(o===_e.ShopperIdentified||o===_e.Ready)return a(!1),void i(!0);o===_e.NotAvailable&&(a(!0),i(!1))}},[o,d]);const l=D(()=>{a(!0),i(!1)},[]),h=D(u=>{u.key==="Enter"&&l()},[l]);return o===_e.NotAvailable?t():o===_e.Loading||o===_e.ShopperIdentified?c(Qs,null):c(G,null,c(Qs,{onDisplayCardComponent:l}),c(jh,{classNames:["adyen-checkout-ctp__separator"],label:e.get("ctp.separatorText")}),n?t(!r):c(Ye,{variant:"secondary",disabled:s==="loading",label:e.get("ctp.manualCardEntry"),onClick:l,onKeyDown:h}))},Hh=d=>{var l=d,{configuration:t,clickToPayService:e,setClickToPayRef:n,onSetStatus:a,onSubmit:o,onError:r,isStandaloneComponent:i}=l,s=Ce(l,["configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent"]);return c(yh,{isStandaloneComponent:i,configuration:t,clickToPayService:e,setClickToPayRef:n,onSetStatus:a,onSubmit:o,onError:r},c(Kh,null,s.children))},qh="not base64",Wh="malformed URI sequence",Mn={decode:t=>{if(!Mn.isBase64(t))return{success:!1,error:qh};try{return{success:!0,data:(e=t,decodeURIComponent(Array.prototype.map.call(window.atob(e),n=>`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")))}}catch(n){return{success:!1,error:Wh}}var e},encode:t=>window.btoa(t),isBase64:t=>{if(!t||t.length%4)return!1;try{return window.btoa(window.atob(t))===t}catch(e){return!1}}};function Gh(t,e,n){const a=p({schemaVersion:1,createdAt:Date.now(),channel:Xo.WEB,platform:er,sdkVersion:Zo,paymentMethodBehavior:n,analytics:{checkoutAttemptId:t}},e&&{riskData:{clientData:e}});return Mn.encode(JSON.stringify(a))}const Yh={[v.address]:"Address",[v.donation]:"Donation",[v.personal_details]:"PersonalDetails",[v.bankTransfer_IBAN]:"BankTransfer",[v.bankTransfer_BE]:"BankTransfer",[v.bankTransfer_NL]:"BankTransfer",[v.bankTransfer_PL]:"BankTransfer",[v.bankTransfer_FR]:"BankTransfer",[v.bankTransfer_CH]:"BankTransfer",[v.bankTransfer_IE]:"BankTransfer",[v.bankTransfer_GB]:"BankTransfer",[v.bankTransfer_DE]:"BankTransfer",[v.bcmc]:"Bancontact",[v.card]:"Card",[v.scheme]:"Card",[v.storedCard]:"Card",[v.customCard]:"CustomCard",[v.ach]:"Ach",[v.directdebit_GB]:"BacsDirectDebit",[v.sepadirectdebit]:"SepaDirectDebit",[v.eft_directdebit_CA]:"PreAuthorizedDebitCanada",[v.affirm]:"Affirm",[v.afterpay]:"AfterPay",[v.afterpay_default]:"AfterPay",[v.afterpay_b2b]:"AfterPayB2B",[v.atome]:"Atome",[v.facilypay_3x]:"FacilyPay3x",[v.facilypay_4x]:"FacilyPay4x",[v.facilypay_6x]:"FacilyPay6x",[v.facilypay_10x]:"FacilyPay10x",[v.facilypay_12x]:"FacilyPay12x",[v.ratepay]:"RatePay",[v.ratepay_directdebit]:"RatePayDirectDebit",[v.amazonpay]:"AmazonPay",[v.applepay]:"ApplePay",[v.cashapp]:"CashAppPay",[v.clicktopay]:"ClickToPay",[v.googlepay]:"GooglePay",[v.paypal]:"PayPal",[v.fastlane]:"Fastlane",[v.paywithgoogle]:"GooglePay",[v.boletobancario]:"Boleto",[v.boletobancario_itau]:"Boleto",[v.boletobancario_santander]:"Boleto",[v.doku]:"Doku",[v.doku_alfamart]:"Doku",[v.doku_permata_lite_atm]:"Doku",[v.doku_indomaret]:"Doku",[v.doku_atm_mandiri_va]:"Doku",[v.doku_sinarmas_va]:"Doku",[v.doku_mandiri_va]:"Doku",[v.doku_cimb_va]:"Doku",[v.doku_danamon_va]:"Doku",[v.doku_bri_va]:"Doku",[v.doku_bni_va]:"Doku",[v.doku_bca_va]:"Doku",[v.doku_wallet]:"Doku",[v.oxxo]:"Oxxo",[v.primeiropay_boleto]:"Boleto",[v.billdesk_online]:"BillDeskOnline",[v.billdesk_wallet]:"BillDeskWallet",[v.dotpay]:"Dotpay",[v.eps]:"Eps",[v.iris]:"Iris",[v.molpay_ebanking_fpx_MY]:"MolPayEBankingMY",[v.molpay_ebanking_TH]:"MolPayEBankingTH",[v.molpay_ebanking_VN]:"MolPayEBankingVN",[v.onlineBanking_CZ]:"OnlineBankingCZ",[v.onlinebanking_IN]:"OnlineBankingIN",[v.onlineBanking_PL]:"OnlineBankingPL",[v.onlineBanking_SK]:"OnlineBankingSK",[v.paybybank]:"PayByBank",[v.payu_IN_cashcard]:"PayuCashcard",[v.payu_IN_nb]:"PayuNetBanking",[v.wallet_IN]:"WalletINElement",[v.dragonpay_ebanking]:"Dragonpay",[v.dragonpay_otc_banking]:"Dragonpay",[v.dragonpay_otc_non_banking]:"Dragonpay",[v.dragonpay_otc_philippines]:"Dragonpay",[v.econtext_atm]:"Econtext",[v.econtext_online]:"Econtext",[v.econtext_seven_eleven]:"Econtext",[v.econtext_stores]:"Econtext",[v.giropay]:"Giropay",[v.multibanco]:"Multibanco",[v.redirect]:"Redirect",[v.twint]:"Twint",[v.vipps]:"Vipps",[v.trustly]:"Trustly",[v.paybybank_AIS_DD]:"PayByBankUS",[v.riverty]:"Riverty",[v.paybybank_pix]:"PayByBankPix",[v.klarna]:"Klarna",[v.klarna_account]:"Klarna",[v.klarna_paynow]:"Klarna",[v.klarna_b2b]:"Klarna",[v.bcmc_mobile]:"BcmcMobile",[v.bcmc_mobile_QR]:"BcmcMobile",[v.pix]:"Pix",[v.swish]:"Swish",[v.wechatpay]:"WeChat",[v.wechatpayQR]:"WeChat",[v.promptpay]:"PromptPay",[v.paynow]:"PayNow",[v.duitnow]:"DuitNow",[v.blik]:"Blik",[v.mbway]:"MBWay",[v.ancv]:"ANCV",[v.payto]:"PayTo",[v.upi]:"UPI",[v.upi_qr]:"UPI",[v.upi_intent]:"UPI",[v.giftcard]:"Giftcard",[v.mealVoucher_FR_natixis]:"MealVoucherFR",[v.mealVoucher_FR_sodexo]:"MealVoucherFR",[v.mealVoucher_FR_groupeup]:"MealVoucherFR"};function Jh(t){return Yh[t]}function Wt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Da=class{buildElementProps(e){this.props=this.formatProps(p(p({},this.constructor.defaultProps),e))}formatProps(e){return e}formatData(){return{}}submitAnalytics(e){return null}handleKeyPress(e){return null}setState(e){this.state=p(p({},this.state),e)}get data(){var d,l;const e=this.state.order||this.props.order,n=this.formatData(),a=!!Jh((d=n.paymentMethod)==null?void 0:d.type),o=this.core.modules.risk.data,r=(l=this.core.modules.analytics.checkoutAttemptId)!=null?l:Bp,i=a?ms.NATIVE:ms.GENERIC,s=Gh(r,o,i);return n.paymentMethod&&r&&(n.paymentMethod.checkoutAttemptId=r),n.paymentMethod&&s&&(n.paymentMethod.sdkData=s),C(p(p(p({},o&&{riskData:{clientData:o}}),e&&{order:{orderData:e.orderData,pspReference:e.pspReference}}),n),{clientStateDataIndicator:!0})}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const n=typeof e=="string"?document.querySelector(e):e;if(!n)throw new Error("Component could not mount. Root node was not found.");return this._node&&this.unmount(),this._node=n,Cn(this._node,"keypress",this.handleKeyPress,!1),this._component=this.render(),gi(this._component,n),this}update(e){return this.props=this.formatProps(p(p({},this.props),e)),this.state={},this.unmount().mount(this._node)}unmount(){return Sn(this._node,"keypress",this.handleKeyPress),this._node&&gi(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(e,n){if(Wt(this,"_id",`${this.constructor.type}-${ze()}`),Wt(this,"core",void 0),Wt(this,"props",void 0),Wt(this,"state",{}),Wt(this,"_component",void 0),Wt(this,"_node",null),!(function(o){return!!o&&typeof o.initialize=="function"&&typeof o.createFromAction=="function"})(e))throw new z("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=e,this.buildElementProps(n),this.handleKeyPress=this.handleKeyPress.bind(this)}};Wt(Da,"defaultProps",{});const Qh=["action","resultCode","sessionData","order","sessionResult","donationToken","error","askDonation"];function ur(t){const e=[],n=Object.keys(t).reduce((a,o)=>(Qh.includes(o)?a[o]=t[o]:e.push(o),a),{});return e.length&&console.warn(`The following properties should not be passed to the client: ${e.join(", ")}`),n}function Ia(t){t&&(delete t.order,delete t.action,t.donationToken&&t.donationToken.length!==0||delete t.donationToken)}function pr(t){return["Cancelled","Error","Refused"].includes(t.resultCode)?Promise.reject(t):Promise.resolve(t)}function $a(t){return t?typeof t.activePaymentMethod=="object"&&typeof t.closeActivePaymentMethod=="function":!1}function Zh(t,e){return t==="FI"&&e?{openFirstPaymentMethod:!1,openFirstStoredPaymentMethod:!1}:{}}function Ra(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var st=(function(t){return t.action="action",t.submit="submit",t.redirect="redirect",t.threeDS2="threeDS2",t.closed="closed",t.apiRequest="apiRequest",t})({}),xt=(function(t){return t.challengeIframeLoaded="challengeIframeLoaded",t.challengeDataSentWeb="challengeDataSentWeb",t.challengeCompleted="challengeCompleted",t.fingerprintDataSentWeb="fingerprintDataSentWeb",t.fingerprintCompleted="fingerprintCompleted",t.fingerprintIframeLoaded="fingerprintIframeLoaded",t.threeDS2="threeDS2",t.redirect="redirect",t.voucher="voucher",t.await="awat",t.qrCode="qrCode",t.bankTransfer="bankTransfer",t.sdk="sdk",t.donation="donation",t.donationCampaigns="donationCampaigns",t})({});let Ze=class extends So{getEventCategory(){return Vt.log}static getSubtypeFromActionType(e){return xt[e]}constructor(e){super(e.component),Ra(this,"type",void 0),Ra(this,"subType",void 0),Ra(this,"message",void 0),Ra(this,"result",void 0),this.type=e.type,this.message=e.message,e.subType&&(this.subType=e.subType),e.result&&(this.result=e.result)}},Fa=class extends Error{constructor(e){super(e)}};const Xh=({srPanel:t,children:e})=>{const{i18n:n}=O(),a=t.moveFocus;return c(ws.Provider,{value:{srPanel:t,setSRMessagesFromObjects:({fieldTypeMappingFn:o})=>vt(fl,{SRPanelRef:t,i18n:n,fieldTypeMappingFn:o}),setSRMessagesFromStrings:o=>{t.setMessages(o)},clearSRPanel:()=>{t.setMessages(null)},shouldMoveFocusSR:a}},e)};function dt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Gt extends Da{createBeforeRenderHook(e){const n=this.render;this.render=(...a)=>(this.beforeRender(e),n.apply(this,a))}beforeRender(e){if(e!=null&&e.originalAction)return;const n=new rt(p({type:Le.rendered,component:this.type,configData:C(p({},e),{showPayButton:this.props.showPayButton})},(e==null?void 0:e.oneClick)&&{isStoredPaymentMethod:!0}));this.analytics.sendAnalytics(n)}reportIntegrationFlavor(){this.analytics.sendFlavor("components")}get analytics(){return this.core.modules.analytics}get srPanel(){return this.core.modules.srPanel}getPaymentMethodConfigFromResponse(e){return e!=null&&e.storedPaymentMethodId?this.getStoredPaymentMethodDetails(e.storedPaymentMethodId):this.getPaymentMethodFromPaymentMethodsResponse(e==null?void 0:e.type,e==null?void 0:e.paymentMethodId)}buildElementProps(e){const n=p(p(p({showPayButton:!0},this.core.getCorePropsForComponent()),this.getPaymentMethodConfigFromResponse(e)),e),a=$a(this);this.props=this.formatProps(p(p(p({},this.constructor.defaultProps),Zh(this.core.options.countryCode,a)),n))}getStoredPaymentMethodDetails(e){return this.core.paymentMethodsResponse.findStoredPaymentMethod(e)}getPaymentMethodFromPaymentMethodsResponse(e,n){var a;return n?this.core.paymentMethodsResponse.findById(n):(a=this.core.paymentMethodsResponse)==null?void 0:a.find(e||this.constructor.type)}storeElementRefOnCore(e){e!=null&&e.isDropin||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(e){this.state=p(p({},this.state),e),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}updateAmount(e,n){var a;this.props=p(p(p({},this.props),e&&{amount:e}),n&&{secondaryAmount:n}),(a=this.amountProviderRef.current)==null||a.update(e,n)}setElementStatus(e,n){var a;return(a=this.elementRef)==null||a.setStatus(e,n),this}setStatus(e,n){var a;return(a=this.componentRef)!=null&&a.setStatus&&this.componentRef.setStatus(e,n),this}onChange(){var e,n;(n=(e=this.props).onChange)==null||n.call(e,{data:this.data,isValid:this.isValid,errors:this.state.errors,valid:this.state.valid},this.elementRef)}submitAnalytics(e){this.analytics.sendAnalytics(e)}submit(){this.isValid?this.makePaymentsCall().then(ur).then(pr).then(this.handleResponse).catch(e=>{e instanceof Fa?this.setElementStatus("ready"):this.handleFailedResult(e)}):this.showValidation()}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session)return(this.props.beforeSubmit?new Promise((e,n)=>{this.props.beforeSubmit(this.data,this.elementRef,{resolve:e,reject:()=>n(new Fa("beforeSubmitRejected"))})}):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow);this.handleError(new z("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){const e=new Ze({component:this.type,type:st.submit,message:"Shopper clicked pay"});return this.submitAnalytics(e),new Promise((n,a)=>{this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:n,reject:a})})}async submitUsingSessionsFlow(e){const n=new Ze({component:this.type,type:st.submit,message:"Shopper clicked pay"});this.submitAnalytics(n);try{return await this.core.session.submitPayment(e)}catch(a){return a instanceof z?this.handleError(a):this.handleError(new z("ERROR","Error when making /payments call",{cause:a})),Promise.reject(a)}}onComplete(e){this.handleAdditionalDetails(e)}handleAdditionalDetails(e){this.makeAdditionalDetailsCall(e).then(ur).then(pr).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(e){return this.props.onAdditionalDetails?new Promise((n,a)=>{this.props.onAdditionalDetails(e,this.elementRef,{resolve:n,reject:a})}):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(e.data):void this.handleError(new z("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(e){try{return await this.core.session.submitDetails(e)}catch(n){return n instanceof z?this.handleError(n):this.handleError(new z("ERROR","Error when making /details call",{cause:n})),Promise.reject(n)}}handleAction(e,n={}){if(!e||!e.type)throw Y(e,"action")&&Y(e,"resultCode")?new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?'):new Error('handleAction::Invalid Action - the passed action object does not have a "type" property');const a=this.core.createFromAction(e,p(p({},this.elementRef.props),n));return a?(this.unmount(),a.mount(this._node)):null}onActionHandled(e){var n,a;(a=(n=this.props)==null?void 0:n.onActionHandled)==null||a.call(n,p({originalAction:this.props.originalAction},e))}setupSessionsDonation(){const{amount:e,donation:n}=this.props;if((n==null?void 0:n.autoMount)!==!1){const a=$a(this.elementRef)?this.elementRef._node:this._node;new(this.core.getComponent(v.donation))(this.core,{rootNode:a,commercialTxAmount:e.value})}}handleResponse(e){var n,a;e.action?this.elementRef.handleAction(e.action):((a=(n=e.order)==null?void 0:n.remainingAmount)==null?void 0:a.value)>0?this.handleOrder(e):this.handleSuccessResult(e)}handleKeyPress(e){e.key!=="Enter"&&e.code!=="Enter"||(e.preventDefault(),this.onEnterKeyPressed(document==null?void 0:document.activeElement,this))}onEnterKeyPressed(e,n){this.props.onEnterKeyPressed?this.props.onEnterKeyPressed(e,n):(e.blur(),this.submit())}updateParent(e={}){return this.elementRef.core.update(e)}get isValid(){return!1}get icon(){var n;const e=this.props.paymentMethodType||this.type;return(n=this.props.icon)!=null?n:this.resources.getImage()(e)}get displayName(){var n,a;const e=(a=(n=this.core.paymentMethodsResponse)==null?void 0:n.paymentMethods)==null?void 0:a.find(o=>o.type===this.type);return this.props.name||(e==null?void 0:e.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(e,n){return new Promise((a,o)=>{if(!this.props.onPaymentMethodsRequest)return a();this.props.onPaymentMethodsRequest(C(p({},e&&{order:{orderData:e.orderData,pspReference:e.pspReference}}),{locale:this.core.options.locale}),{resolve:a,reject:o})}).catch(a=>{this.handleError(new z("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:a}))}).then(a=>this.core.update(C(p({},a&&{paymentMethodsResponse:a}),{order:e,amount:e?e.remainingAmount:n})))}render(){return c(fu,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources,analytics:this.analytics},c(Xh,{srPanel:this.srPanel},c(ju,{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,providerRef:this.amountProviderRef},this.componentToRender())))}constructor(e,n){super(e,n),dt(this,"componentRef",void 0),dt(this,"resources",void 0),dt(this,"elementRef",void 0),dt(this,"amountProviderRef",Ec()),dt(this,"handleError",a=>{if(this.setElementStatus("ready"),a.name===ji&&a.options.code){const o=new Me({component:this.type,errorType:Oe.apiError,code:a.options.code});this.submitAnalytics(o)}this.props.onError&&this.props.onError(a,this.elementRef)}),dt(this,"handleOrder",a=>{const{order:o}=a;(this.core.session?this.core.update({order:o}):this.handleAdvanceFlowPaymentMethodsUpdate(o)).then(()=>{var r,i;(i=(r=this.props).onOrderUpdated)==null||i.call(r,{order:o})})}),dt(this,"handleFailedResult",a=>{var o,r;$a(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),Ia(a),(r=(o=this.props).onPaymentFailed)==null||r.call(o,a,this.elementRef)}),dt(this,"handleSuccessResult",a=>{var o,r;$a(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),Ia(a),this.core.session&&a.askDonation===!0&&this.setupSessionsDonation(),(r=(o=this.props).onPaymentCompleted)==null||r.call(o,a,this.elementRef)}),dt(this,"setComponentRef",a=>{this.componentRef=a}),dt(this,"payButton",a=>c(lr,C(p({},a),{onClick:this.submit}))),this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.updateAmount=this.updateAmount.bind(this),this.setupSessionsDonation=this.setupSessionsDonation.bind(this),this.elementRef=n&&n.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props),this.onEnterKeyPressed=this.onEnterKeyPressed.bind(this),this.onActionHandled=this.onActionHandled.bind(this),this.createBeforeRenderHook(n),this.reportIntegrationFlavor()}}dt(Gt,"type",void 0),dt(Gt,"txVariants",[]);function ct(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Yt extends Gt{setStatus(e,n){var a,o;return(a=this.componentRef)!=null&&a.setStatus&&this.componentRef.setStatus(e,n),(o=this.clickToPayRef)!=null&&o.setStatus&&this.clickToPayRef.setStatus(e,n),this}getPaymentMethodConfigFromResponse(e){var n;return e!=null&&e.fundingSource?(n=this.core.paymentMethodsResponse)==null?void 0:n.findByFundingSource(e.type,e.fundingSource):super.getPaymentMethodConfigFromResponse(e)}formatProps(e){var i,s,d,l,h,u,y,m,f,x,S,w,k,b,_,g,T,E,P,A,I,U;const n=(d=(s=(i=e.session)==null?void 0:i.configuration)==null?void 0:s.enableStoreDetails)!=null?d:e.enableStoreDetails,a=((l=e.amount)==null?void 0:l.value)!==0&&n,o=e.storedPaymentMethodId||e.id,r=o&&((h=e==null?void 0:e.supportedShopperInteractions)==null?void 0:h.includes("Ecommerce"));if(o&&!r)throw new z(No,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");return p(C(p({},e),{holderNameRequired:!!e.hasHolderName&&e.holderNameRequired,hasCVC:!(e.brand&&e.brand==="bcmc"||e.hideCVC),billingAddressRequired:!e.storedPaymentMethodId&&e.billingAddressRequired,billingAddressMode:e.onAddressLookup?Io.billingAddressMode:e.billingAddressMode,brand:(u=e.brand)!=null?u:v.card,countryCode:e.countryCode?e.countryCode.toLowerCase():null,configuration:C(p({},e.configuration),{socialSecurityNumberMode:(m=(y=e.configuration)==null?void 0:y.socialSecurityNumberMode)!=null?m:"auto"}),brandsConfiguration:e.brandsConfiguration||((f=e.configuration)==null?void 0:f.brandsConfiguration)||{},icon:e.icon||((x=e.configuration)==null?void 0:x.icon),installmentOptions:((w=(S=e.session)==null?void 0:S.configuration)==null?void 0:w.installmentOptions)||e.installmentOptions,enableStoreDetails:n,showStoreDetailsCheckbox:a,clickToPayConfiguration:C(p({},e.clickToPayConfiguration),{disableOtpAutoFocus:((k=e.clickToPayConfiguration)==null?void 0:k.disableOtpAutoFocus)||!1,shopperEmail:((b=e.clickToPayConfiguration)==null?void 0:b.shopperEmail)||((g=(_=this.core.options)==null?void 0:_.session)==null?void 0:g.shopperEmail),telephoneNumber:((T=e.clickToPayConfiguration)==null?void 0:T.telephoneNumber)||((P=(E=this.core.options)==null?void 0:E.session)==null?void 0:P.telephoneNumber),locale:((A=e.clickToPayConfiguration)==null?void 0:A.locale)||((U=(I=e.i18n)==null?void 0:I.locale)==null?void 0:U.replace("-","_"))})}),o&&{storedPaymentMethodId:o})}formatData(){var n;const e=this.state.selectedBrandValue;return C(p(p(p(p({paymentMethod:p(p(p(p(p({type:Yt.type},this.state.data),this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:(n=this.props.holderName)!=null?n:""}),e&&{brand:e}),this.props.fundingSource&&{fundingSource:this.props.fundingSource}),this.state.fastlaneData&&{fastlaneData:btoa(JSON.stringify(this.state.fastlaneData))})},this.state.billingAddress&&{billingAddress:this.state.billingAddress}),this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber}),this.storePaymentMethodPayload),gu(this.state.installments)&&{installments:this.state.installments}),{browserInfo:this.browserInfo,origin:!!window&&window.location.origin})}beforeRender(e){if(e!=null&&e.originalAction)return;const n=new rt(p({type:Le.rendered,component:this.type,configData:C(p({},e),{showPayButton:this.props.showPayButton})},(e==null?void 0:e.oneClick)&&{isStoredPaymentMethod:!0,brand:e.brand}));this.analytics.sendAnalytics(n)}updateStyles(e){var n;return(n=this.componentRef)!=null&&n.updateStyles&&this.componentRef.updateStyles(e),this}setFocusOn(e){var n;return(n=this.componentRef)!=null&&n.setFocusOn&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e,n=!1){var a;return(a=this.componentRef)!=null&&a.processBinLookupResponse&&this.componentRef.processBinLookupResponse(e,n),this}handleUnsupportedCard(e){var n;return(n=this.componentRef)!=null&&n.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){var n,a;if(!e.isReset){const o=bo("supportedBrandsRaw").from(e);(a=(n=this.props).onBinLookup)==null||a.call(n,o)}}get storePaymentMethodPayload(){var e,n;return((e=this.props.storedPaymentMethodId)==null?void 0:e.length)>0?{}:((n=this.props.amount)==null?void 0:n.value)===0?this.props.enableStoreDetails?{storePaymentMethod:!0}:{}:this.props.showStoreDetailsCheckbox&&this.state.storePaymentMethod!==void 0?{storePaymentMethod:!!this.state.storePaymentMethod}:{}}get isValid(){return!!this.state.isValid}get icon(){var e;return(e=this.props.icon)!=null?e:this.resources.getImage()(this.props.brand)}get brands(){const{brands:e,brandsConfiguration:n}=this.props;return e?e.map(a=>{var o,r;return{icon:(r=(o=n==null?void 0:n[a])==null?void 0:o.icon)!=null?r:this.props.modules.resources.getImage()(a),name:a}}):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||Yt.type}get accessibleName(){return(this.props.name||Yt.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return or()}renderCardInput(e=!0){return c(Ps,C(p(p({setComponentRef:this.setComponentRef},this.props),this.state),{onSubmitAnalytics:this.submitAnalytics,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onConfigSuccess:this.onConfigSuccess}))}componentToRender(){return c(Hh,{configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e=>this.renderCardInput(e))}constructor(e,n){var a;super(e,n),ct(this,"clickToPayService",void 0),ct(this,"clickToPayRef",null),ct(this,"setClickToPayRef",o=>{this.clickToPayRef=o}),ct(this,"onBrand",o=>{var r,i;(i=(r=this.props).onBrand)==null||i.call(r,o)}),ct(this,"handleClickToPaySubmit",o=>{this.setState({data:p({},o),valid:{},errors:{},isValid:!0}),this.submit()}),ct(this,"onConfigSuccess",o=>{var i,s;const r=new rt({component:this.type,type:Le.configured});this.submitAnalytics(r),(s=(i=this.props).onConfigSuccess)==null||s.call(i,o)}),ct(this,"onFocus",o=>{var i,s,d,l;const r=new rt({component:this.type,type:Le.focus,target:Ao(o.fieldType)});this.submitAnalytics(r),nn(o.fieldType)?(s=(i=this.props).onFocus)==null||s.call(i,o.event):(l=(d=this.props).onFocus)==null||l.call(d,o)}),ct(this,"onBlur",o=>{var i,s,d,l;const r=new rt({component:this.type,type:Le.unfocus,target:Ao(o.fieldType)});this.submitAnalytics(r),nn(o.fieldType)?(s=(i=this.props).onBlur)==null||s.call(i,o.event):(l=(d=this.props).onBlur)==null||l.call(d,o)}),ct(this,"onBinValue",Hp(this)),ct(this,"payButton",o=>{var s,d;const r=((s=this.props.amount)==null?void 0:s.value)===0,i=((d=this.props.storedPaymentMethodId)==null?void 0:d.length)>0;return c(lr,C(p({},o),{label:r&&!i?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit}))}),n&&!n._disableClickToPay&&this.props.fundingSource!=="prepaid"&&(this.clickToPayService=uh(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment,this.analytics),(a=this.clickToPayService)==null||a.initialize())}}ct(Yt,"type",v.scheme),ct(Yt,"defaultProps",p({showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0},bo(["type","setComponentRef"]).from(Io)));let Zs=class extends Fe{componentDidMount(){this.formEl.submit(),this.props.onFormSubmit(`${this.props.inputName} sent`)}render({name:e,action:n,target:a,inputName:o,inputValue:r}){return c("form",{ref:i=>{this.formEl=i},method:"POST",className:$(["adyen-checkout__threeds2__form",`adyen-checkout__threeds2__form--${e}`]),name:e,action:n,target:a,style:{display:"none"}},c("input",{name:o,value:r}))}constructor(...e){var n,a,o;super(...e),o=void 0,(a="formEl")in(n=this)?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}};const hr=(t,e,n,a)=>o=>{var i;const r={};if((o.origin||((i=o.originalEvent)==null?void 0:i.origin))!==t)return"Message was not sent from the expected domain";if(typeof o.data!="string")return"Event data was not of type string";if(!o.data.length)return"Invalid event data string";try{const s=JSON.parse(o.data);if(!Y(s,"type")||s.type!==a)return"Event data was not of expected type";e(s)}catch(s){return r.type=`${a}-JSON-parse-error`,r.comment="failed to JSON parse event.data",r.extraInfo=`event.data = ${o.data}`,r.eventDataRaw=o.data,console.debug("get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=",r),!1}return!0},Xs="threeDS2Fingerprint",Ln="3DS2Fingerprint_Error",yr="callSubmit3DS2Fingerprint_Response",ed="threeDS2Challenge",wt="3DS2Challenge_Error",ey="threeDS2",Oa="3DS2",cn='Missing "token" property from threeDS2 action',td="02",ty=1e4,ny=6e5,Bn="timeout",ay={result:{transStatus:"U"},type:"challengeResult",errorCode:Bn},oy={result:{threeDSCompInd:"N"},type:"fingerPrintResult",errorCode:Bn},nd={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]},mr=t=>{const e=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);if(!e)return null;const[,n,a,o,r]=e;return n&&a&&o?`${n}:${a}${o}${r?`:${r}`:""}`:null},Ma=t=>"success"in t&&!t.success,ad=t=>{const e=Mn.decode(t);if(e.success&&e.data)try{return JSON.parse(e.data)}catch(n){return{success:!1,error:"Could not JSON parse token"}}return e},od=t=>{if(!t||!Object.keys(t).length)throw new Error("No (populated) data object to encode");return Mn.encode(JSON.stringify(t))},rd=t=>{const e=t.length===1?`0${t}`:t;return Object.prototype.hasOwnProperty.call(nd,e)?e:td},ry=t=>nd[rd(t)],iy=({token:t,size:e})=>{const n=ad(t);if(Ma(n))return n;const{acsTransID:a,acsURL:o,messageVersion:r,threeDSNotificationURL:i,threeDSServerTransID:s}=n,d=mr(i!=null?i:"");return{acsURL:o!=null?o:"",cReqData:{acsTransID:a!=null?a:"",messageVersion:r!=null?r:"",threeDSServerTransID:s!=null?s:"",messageType:"CReq",challengeWindowSize:rd(e)},iframeSizeArr:ry(e),postMessageDomain:d}},sy=({token:t,notificationURL:e})=>{var s;const n=ad(t);if(Ma(n))return n;const{threeDSMethodNotificationURL:a,threeDSMethodUrl:o,threeDSServerTransID:r}=n,i=(s=e!=null?e:a)!=null?s:"";return{threeDSServerTransID:r!=null?r:"",threeDSMethodURL:o!=null?o:"",threeDSMethodNotificationURL:i,postMessageDomain:mr(i)}},dy=(t,e,n)=>({data:{[t]:od({threeDSCompInd:e.threeDSCompInd}),paymentData:n}}),cy=(t,e,n)=>({data:{details:{[t]:od({transStatus:e,authorisationToken:n})}}}),id=t=>{let e=window.btoa(t).split("=")[0];return e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e},ly=(t,e)=>t==="fingerprint"?p({showSpinner:!e.isDropin,statusType:"loading"},e.elementRef&&{elementRef:e.elementRef}):{statusType:"custom",i18n:e.i18n,elementRef:e.elementRef},_r=(t,e,n)=>{let a;return{promise:new Promise((o,r)=>{a=setTimeout(()=>{r(n)},t),e.then(i=>{clearTimeout(a),o(i)}).catch(i=>{clearTimeout(a),r(i)})}),cancel:()=>{clearTimeout(a)}}};function fr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const sd="threeDSIframe";class uy extends Fe{get3DS2ChallengePromise(){return new Promise((e,n)=>{this.processMessageHandler=hr(this.props.postMessageDomain,e,n,"challengeResult"),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.challengePromise=_r(ny,this.get3DS2ChallengePromise(),ay),this.challengePromise.promise.then(e=>{window.removeEventListener("message",this.processMessageHandler),this.props.onCompleteChallenge(e)}).catch(e=>{window.removeEventListener("message",this.processMessageHandler),this.props.onErrorChallenge(e)})}componentWillUnmount(){this.challengePromise&&this.challengePromise.cancel(),window.removeEventListener("message",this.processMessageHandler)}render({acsURL:e,cReqData:n,iframeSizeArr:a,onFormSubmit:o},{base64URLencodedData:r,status:i}){const[s,d]=a;return c("div",{className:$(["adyen-checkout__threeds2__challenge",`adyen-checkout__threeds2__challenge--${n.challengeWindowSize}`])},i!=="iframeLoaded"&&c(rn,null),c(On,{name:sd,width:s,height:d,callback:this.iframeCallback}),c(Zs,{name:"cReqForm",action:e,target:sd,inputName:"creq",inputValue:r,onFormSubmit:o}))}constructor(e){super(e),fr(this,"processMessageHandler",void 0),fr(this,"challengePromise",void 0),fr(this,"iframeCallback",()=>{var o,r;this.setState({status:"iframeLoaded"}),this.state.status==="init"&&((r=(o=this.props).onActionHandled)==null||r.call(o,{componentType:"3DS2Challenge",actionDescription:`${Oa} challenge iframe loaded`}))});const n=JSON.stringify(this.props.cReqData),a=id(n);this.state={base64URLencodedData:a,status:"init"}}}function dd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let cd=class extends Fe{componentDidMount(){var e,n;if(Ma(this.state.challengeData)){const a=this.state.challengeData.error,o=a.includes(cn)?be.THREEDS2_ACTION_IS_MISSING_TOKEN:be.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setError({errorInfo:`${o}: ${this.props.i18n.get("err.gen.9102")}`},!0);const r=new Me({component:this.props.type,code:o,errorType:Oe.threeDS2,message:`${wt}: ${a}`});this.props.onSubmitAnalytics(r),console.debug("### PrepareChallenge3DS2::exiting:: no challengeData")}else{const a=this.props.environment==="test"&&((n=(e=this.props._environmentUrls)==null?void 0:e.api)==null?void 0:n.includes("http://localhost:8080")),{acsURL:o}=this.state.challengeData;if(!qt(o,a)){this.setError({errorInfo:`${be.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get("err.gen.9102")}`},!0);const d=new Me({component:this.props.type,code:be.THREEDS2_TOKEN_IS_MISSING_ACSURL,errorType:Oe.threeDS2,message:`${wt}: Decoded token is missing a valid acsURL property`});return this.props.onSubmitAnalytics(d),void console.debug("### PrepareChallenge3DS2::exiting:: no valid acsURL")}const{acsTransID:r,messageVersion:i,threeDSServerTransID:s}=this.state.challengeData.cReqData;if(!r||!i||!s){this.setError({errorInfo:`${be.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get("err.gen.9102")}`},!0);const d=new Me({component:this.props.type,code:be.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,errorType:Oe.threeDS2,message:`${wt}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`});return this.props.onSubmitAnalytics(d),void console.debug("### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)")}this.setState({status:"performingChallenge"})}}setStatusComplete(e,n=null){this.setState({status:"complete"},()=>{const a=cy(this.props.dataKey,e.transStatus,this.props.paymentData);let o;n&&console.debug("### PrepareChallenge3DS2::errorCodeObject::",n);const r=n||e;if(r.errorCode){const s={code:r.errorCode==="timeout"?be.THREEDS2_TIMEOUT:be.THREEDS2_NO_TRANSSTATUS,errorType:Oe.threeDS2};o=new Me(p({component:this.props.type,message:r.message},s)),this.props.onSubmitAnalytics(o)}let i;switch(e==null?void 0:e.transStatus){case"Y":i="success";break;case"N":i="failed";break;case"U":i=n?"timeout":"cancelled"}e!=null&&e.errorCode&&(i="noTransStatus"),o=new Ze({component:this.props.type,type:st.threeDS2,subType:xt.challengeCompleted,message:`${Oa} challenge has completed`,result:i}),this.props.onSubmitAnalytics(o),this.props.onComplete(a)})}setError(e,n){this.setState({status:"error",errorInfo:e.errorInfo}),n&&this.props.onError(new z(pa,e.errorInfo,{cause:e.errorObj}))}render(e,{challengeData:n}){const a=$e();return this.state.status==="performingChallenge"?c(uy,C(p({onCompleteChallenge:o=>{let r=null;if(Y(o.result,"errorCode")&&o.result.errorCode.length&&(r={errorCode:o.result.errorCode,message:`${wt}: ${o.result.errorDescription?o.result.errorDescription:"no transStatus could be retrieved"}`},this.props.isMDFlow&&this.props.onError(new z(pa,`${wt}: ${o.result.errorDescription?o.result.errorDescription:"no transStatus could be retrieved"}`,{cause:o.result.errorCode}))),!o.result){this.setError({errorInfo:`${wt}: ${this.props.i18n.get("3ds.chal.805",{values:{result:'"result"'}})}`,errorObj:o},!0);const i=new Me({component:this.props.type,code:be.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,errorType:Oe.threeDS2,message:`${wt}: challenge resolved without a "result" object`});return this.props.onSubmitAnalytics(i),void console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a "result" object')}this.setStatusComplete(o.result,r)},onErrorChallenge:o=>{if(Y(o,"errorCode")){const r={errorCode:o.errorCode,message:`${ed}: ${o.errorCode}`};return this.props.isMDFlow&&this.props.onError(new z(pa,`${wt}: '3DS2 challenge timed out'`,{cause:o.errorCode})),void this.setStatusComplete(o.result,r)}}},n),{onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit})):this.state.status==="error"?c("div",{className:"adyen-checkout__threeds2-challenge-error"},c(we,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:a({imageFolder:"components/"})("error"),alt:""}),c("div",{className:"adyen-checkout__status__text"},this.state.errorInfo?this.state.errorInfo:this.props.i18n.get("error.message.unknown"))):null}constructor(e){if(super(e),dd(this,"onFormSubmit",n=>{const a=new Ze({component:this.props.type,type:st.threeDS2,subType:xt.challengeDataSentWeb,message:n});this.props.onSubmitAnalytics(a)}),this.props.token){const n=iy({token:this.props.token,size:this.props.challengeWindowSize||this.props.size});this.state={status:"init",challengeData:n}}else this.state={challengeData:{success:!1,error:cn}},console.debug(`${wt}: ${cn}`)}};dd(cd,"defaultProps",{onComplete:()=>{},onError:()=>{},isMDFlow:!1});function gr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let br=class extends Gt{beforeRender(){}onComplete(e){var n,a;this.props.isMDFlow?(a=(n=this.props).on3DS2RedirectFlowComplete)==null||a.call(n,e,this.elementRef):super.onComplete(e),this.unmount()}componentToRender(){if(!Tt(this.props.paymentData)){const e=Y(this.props,"isMDFlow")?"paymentData":"authorisationToken";this.props.onError(new z(Po,`No ${e} received. 3DS2 Challenge cannot proceed`));const n=new Me({component:this.type,code:be.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:Oe.threeDS2,message:`${wt}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(n),null}return c(cd,C(p({},this.props),{onComplete:this.onComplete,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled}))}constructor(...e){super(...e),gr(this,"onActionHandled",n=>{const a=new Ze({component:this.type,type:st.threeDS2,subType:xt.challengeIframeLoaded,message:n.actionDescription});this.submitAnalytics(a),super.onActionHandled(n)})}};gr(br,"type",v.threeDS2Challenge),gr(br,"defaultProps",{dataKey:"threeDSResult",size:td,type:ed});function kr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const ld="threeDSMethodIframe";let ud=class extends Fe{get3DS2MethodPromise(){return new Promise((e,n)=>{this.processMessageHandler=hr(this.props.postMessageDomain,e,n,"fingerPrintResult"),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.fingerPrintPromise=_r(ty,this.get3DS2MethodPromise(),oy),this.fingerPrintPromise.promise.then(e=>{window.removeEventListener("message",this.processMessageHandler),this.props.onCompleteFingerprint(e)}).catch(e=>{window.removeEventListener("message",this.processMessageHandler),this.props.onErrorFingerprint(e)})}componentWillUnmount(){this.fingerPrintPromise&&this.fingerPrintPromise.cancel(),window.removeEventListener("message",this.processMessageHandler)}render({threeDSMethodURL:e,onActionHandled:n,onFormSubmit:a},{base64URLencodedData:o}){return c("div",{className:"adyen-checkout__3ds2-device-fingerprint"},this.props.showSpinner&&c(rn,null),c("div",{style:{display:"none"}},c(On,{name:ld,callback:()=>{n==null||n({componentType:"3DS2Fingerprint",actionDescription:`${Oa} fingerprint iframe loaded`})}}),c(Zs,{name:"threeDSMethodForm",action:e,target:ld,inputName:"threeDSMethodData",inputValue:o,onFormSubmit:a})))}constructor(e){super(e),kr(this,"processMessageHandler",void 0),kr(this,"fingerPrintPromise",void 0);const{threeDSServerTransID:n,threeDSMethodNotificationURL:a}=this.props,o=JSON.stringify({threeDSServerTransID:n,threeDSMethodNotificationURL:a}),r=id(o);this.state={base64URLencodedData:r}}};kr(ud,"defaultProps",{showSpinner:!0});function vr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class xr extends Fe{componentDidMount(){var e,n;if(Ma(this.state.fingerPrintData)){const a=this.state.fingerPrintData.error,o=a.includes(cn)?be.THREEDS2_ACTION_IS_MISSING_TOKEN:be.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setStatusComplete({threeDSCompInd:"N"},{errorCode:o,message:`${Ln}: ${a}`}),console.debug("### PrepareFingerprint3DS2:: token does not exist or could not be base64 decoded &/or JSON.parsed")}else{const a=this.props.environment==="test"&&((n=(e=this.props._environmentUrls)==null?void 0:e.api)==null?void 0:n.includes("http://localhost:8080")),{threeDSMethodURL:o,threeDSMethodNotificationURL:r,postMessageDomain:i,threeDSServerTransID:s}=this.state.fingerPrintData;if(!qt(o,a))return this.setStatusComplete({threeDSCompInd:"U"},{errorCode:be.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,message:`${Ln}: Decoded token is missing a valid threeDSMethodURL property`}),void console.debug("### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL");const d=qt(r,a),l=qt(i,a),h=s==null?void 0:s.length;if(!d||!l||!h)return this.setStatusComplete({threeDSCompInd:"N"},{errorCode:be.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,message:`${Ln}: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)`}),void console.debug("### PrepareFingerprint3DS2::exiting:: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)");this.setState({status:"retrievingFingerPrint"})}}setStatusComplete(e,n=null){this.setState({status:"complete"},()=>{const a=dy(this.props.dataKey,e,this.props.paymentData);let o;const r=n||e;if(r.errorCode){const s={code:r.errorCode===Bn?be.THREEDS2_TIMEOUT:r.errorCode,errorType:Oe.threeDS2};o=new Me(p({component:this.props.type,message:r.message},s)),this.props.onSubmitAnalytics(o)}let i;switch(e==null?void 0:e.threeDSCompInd){case"Y":i="success";break;case"N":i=n?n.errorCode===Bn?Bn:"failedInternal":"failed";break;case"U":i="noThreeDSMethodURL"}o=new Ze({component:this.props.type,type:st.threeDS2,subType:xt.fingerprintCompleted,message:`${Oa} fingerprinting has completed`,result:i}),this.props.onSubmitAnalytics(o),this.props.onComplete(a)})}render({showSpinner:e},{status:n,fingerPrintData:a}){return n==="retrievingFingerPrint"?c(ud,C(p({onCompleteFingerprint:o=>{this.setStatusComplete(o.result)},onErrorFingerprint:o=>{const r={errorCode:o.errorCode,message:`${Xs}: ${o.errorCode}`};this.setStatusComplete(o.result,r)},showSpinner:e},a),{onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit})):null}constructor(e){super(e),vr(this,"onFormSubmit",o=>{const r=new Ze({component:this.props.type,type:st.threeDS2,subType:xt.fingerprintDataSentWeb,message:o});this.props.onSubmitAnalytics(r)});const{token:n,notificationURL:a}=this.props;if(n){const o=sy({token:n,notificationURL:a});this.state={status:"init",fingerPrintData:o}}else this.state={fingerPrintData:{success:!1,error:cn}},console.debug(`${Ln}: ${cn}`)}}vr(xr,"type","scheme"),vr(xr,"defaultProps",{onComplete:()=>{},onError:()=>{},paymentData:"",showSpinner:!0,isMDFlow:!1});const Ot="v1",ln={makePayments:"620",submitPaymentDetails:"621",submitThreeDS2Fingerprint:"622",createOrder:"624",donationCampaigns:"627",donations:"628"};function py({data:t}){Ge({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:ln.submitThreeDS2Fingerprint},p({},t)).then(e=>{var o,r,i;let n;if(e.type==="completed"){const{details:s}=e;return e.details?this.onComplete({data:{details:s}}):(console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a "frictionless" flow, or a "refused" response. resData=',e),n=new Me({component:"threeDS2Fingerprint",code:be.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:Oe.threeDS2,message:`${yr}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(n))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),n=new Me({component:"threeDS2Fingerprint",code:be.THREEDS2_NO_ACTION_FOR_CHALLENGE,errorType:Oe.threeDS2,message:`${yr}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(n);const a=(o=this.props.elementRef)!=null?o:this;return a?((r=e.action)==null?void 0:r.type)==="threeDS2"?a.handleAction(e.action,go("challengeWindowSize").from(this.props)):((i=e.action)==null?void 0:i.type)==="redirect"?a.handleAction(e.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),n=new Me({component:"threeDS2Fingerprint",code:be.THREEDS2_NO_COMPONENT_FOR_ACTION,errorType:Oe.threeDS2,message:`${yr}: no component defined to handle the action response`}),void this.submitAnalytics(n))}).catch(e=>{this.handleError(e)})}function La(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let wr=class extends Gt{beforeRender(){}onComplete(e){var n,a;this.props.isMDFlow?(a=(n=this.props).on3DS2RedirectFlowComplete)==null||a.call(n,e,this.elementRef):super.onComplete(e),this.unmount()}componentToRender(){if(!Tt(this.props.paymentData)){this.props.onError(new z(Po,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const e=new Me({component:this.type,code:be.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:Oe.threeDS2,message:`${Ln}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(e),null}return c(xr,C(p({},this.props),{onComplete:this.props.isMDFlow?this.onComplete:this.callSubmit3DS2Fingerprint,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled}))}constructor(...e){super(...e),La(this,"callSubmit3DS2Fingerprint",py.bind(this)),La(this,"onActionHandled",n=>{const a=new Ze({component:this.type,type:st.threeDS2,subType:xt.fingerprintIframeLoaded,message:n.actionDescription});this.submitAnalytics(a),super.onActionHandled(n)})}};La(wr,"type",v.threeDS2Fingerprint),La(wr,"defaultProps",{dataKey:"fingerprintResult",type:Xs});function hy(s){var d=s,{label:t=null,icon:e=null,payButton:n,onSubmit:a,name:o,showPayButton:r}=d,i=Ce(d,["label","icon","payButton","onSubmit","name","showPayButton"]);const{i18n:l}=O(),[h,u]=N("ready"),{amount:y}=$n();if(this.setStatus=m=>{u(m)},r)return c(G,null,n(C(p({},i),{status:h,icon:e,classNameModifiers:["standalone"],label:t||(y&&{}.hasOwnProperty.call(y,"value")&&y.value===0?`${l.get("preauthorizeWith")} ${o}`:`${l.get("continueTo")} ${o}`),onClick:a})))}var pd=()=>{try{if(window.parent.location.href)return window.location!==window.parent.location}catch(t){return!1}};function hd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let yd=class extends Fe{componentDidMount(){new Promise((e,n)=>{this.props.beforeRedirect(e,n,p({url:this.props.url,method:this.props.method},this.props.data?{data:this.props.data}:{}))}).then(()=>{var e,n,a,o;(n=(e=this.props).onActionHandled)==null||n.call(e,{componentType:this.props.paymentMethodType,actionDescription:"performing-redirect"}),this.postForm?this.postForm.submit():this.props.redirectFromTopWhenInIframe&&pd()?(o=(a=window.top.location).assign)==null||o.call(a,this.props.url):window.location.assign(this.props.url)}).catch(()=>{this.props.onRedirectError()})}render({url:e,method:n,data:a={}}){return n==="POST"?c("form",p({method:"post","data-testid":"redirect-shopper-form",action:e,style:{display:"none"},ref:o=>{this.postForm=o}},this.props.redirectFromTopWhenInIframe&&pd()&&{target:"_top"}),Object.keys(a).map(o=>c("input",{type:"hidden",name:o,key:o,value:a[o]}))):null}constructor(...e){super(...e),hd(this,"postForm",void 0)}};hd(yd,"defaultProps",{beforeRedirect:t=>t(),onRedirectError:()=>{},method:"GET"});function Cr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Vn extends Gt{formatData(){return{paymentMethod:{type:this.type},browserInfo:this.browserInfo}}get isRedirecting(){return!!this.props.url&&!!this.props.method}get isValid(){return!0}get browserInfo(){return or()}componentToRender(){return this.isRedirecting?c(yd,C(p({url:this.props.url},this.props),{onActionHandled:this.onActionHandled,onRedirectError:this.handleRedirectError})):this.props.showPayButton?c(hy,C(p({},this.props),{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:e=>{this.componentRef=e}})):null}constructor(...e){super(...e),Cr(this,"handleRedirectError",()=>{const n=new Me({component:this.props.paymentMethodType,errorType:Oe.redirect,code:be.REDIRECT});super.submitAnalytics(n)})}}Cr(Vn,"type",v.redirect),Cr(Vn,"defaultProps",{type:Vn.type});const yy={test:"https://checkoutshopper-test.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.adyen.com/checkoutshopper/","live-nea":"https://checkoutshopper-live-nea.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.adyen.com/checkoutshopper/"},md={test:"https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/","live-nea":"https://checkoutshopper-live-nea.cdn.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/"},my={test:"https://checkoutanalytics-test.adyen.com/checkoutanalytics/",live:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/","live-us":"https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/","live-au":"https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/","live-apse":"https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/","live-in":"https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/","live-nea":"https://checkoutanalytics-live-nea.adyen.com/checkoutanalytics/",fallback:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/"},Ba=(t,e,n)=>n||e[t]||e.fallback,_y=(t,e)=>{var n,a;return{apiUrl:Ba(t,yy,e==null?void 0:e.api),analyticsUrl:Ba(t,my,e==null?void 0:e.analytics),cdnImagesUrl:Ba(t,md,(n=e==null?void 0:e.cdn)==null?void 0:n.images),cdnTranslationsUrl:Ba(t,md,(a=e==null?void 0:e.cdn)==null?void 0:a.translations)}};function fy(t){return Object.keys(t).reduce((e,n)=>(yp.includes(n)&&(e[n]=t[n]),e),{})}function gy(t){const e=(n=>n)(["session","environment","_environmentUrls","showPayButton","clientKey","locale","translations","paymentMethodsResponse","amount","secondaryAmount","countryCode","allowPaymentMethods","removePaymentMethods","srConfig","analytics","risk","order","donation","exposeLibraryMetadata","beforeRedirect","beforeSubmit","onPaymentCompleted","onPaymentFailed","onSubmit","onAdditionalDetails","onActionHandled","onChange","onError","onBalanceCheck","onOrderRequest","onPaymentMethodsRequest","onOrderCancel","onOrderUpdated","loadingContext","onEnterKeyPressed","afterAdditionalDetails"]);Object.keys(t).forEach(n=>{e.includes(n)||console.warn(`AdyenCheckout - Configuration property "${n}" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to "paymentMethodsConfiguration" object`)})}function _d({logoUrl:t="",nonprofitName:e="",causeName:n="",bannerUrl:a=""}){return c(G,null,c(we,{className:"adyen-checkout__campaign-background-image",style:{backgroundImage:`url(${a})`},backgroundUrl:a}),c("div",{className:"adyen-checkout__campaign-content"},t&&c("img",{src:t,className:"adyen-checkout__campaign-logo",alt:e}),c("div",null,e&&c("div",{className:"adyen-checkout__campaign-title"},e),n&&c("div",{className:"adyen-checkout__campaign-cause"},n))))}function by({logoUrl:t="",nonprofitDescription:e="",nonprofitName:n="",causeName:a="",nonprofitUrl:o="",bannerUrl:r=""}){return c("div",{className:"adyen-checkout__campaign"},o?c("a",{href:o,className:"adyen-checkout__campaign-link",target:"_blank",rel:"noopener noreferrer"},c(_d,{logoUrl:t,nonprofitName:n,causeName:a,bannerUrl:r})):c(_d,{logoUrl:t,nonprofitName:n,causeName:a,bannerUrl:r}),e&&c("div",{className:"adyen-checkout__campaign-description"},e))}const ky=({options:t=[],name:e,onChange:n})=>c("div",{className:"adyen-checkout__button-group"},t.map(({label:a,selected:o,value:r,disabled:i},s)=>c("label",{key:`${e}${s}`,className:$({"adyen-checkout__button":!0,"adyen-checkout__button--selected":o,"adyen-checkout__button--disabled":i})},c("input",{type:"radio",className:"adyen-checkout__button-group__input",value:r,checked:o,onChange:n,disabled:i}),c("span",{className:"adyen-checkout__button-text"},a)))),fd=(t,e)=>t-e%t,Sr=(t,{value:e,currency:n})=>t.amount(e,n),vy=(t,{maxRoundupAmount:e,commercialTxAmount:n,currency:a})=>Sr(t,{value:fd(e,n),currency:a});function xy(t){const{currency:e,values:n,selectedAmount:a,status:o,onAmountSelected:r,onDonateButtonClicked:i}=t,{i18n:s}=O();return c(G,null,c("div",{className:"adyen-checkout__amounts"},c(ky,{options:n.map(d=>({value:d,label:Sr(s,{value:d,currency:e}),disabled:o==="loading",selected:d===a})),name:"amount",onChange:r})),c(Ye,{classNameModifiers:["donate"],onClick:i,label:s.get("donateButton"),disabled:a===null,status:o}))}function wy(t){const{status:e,donationAmount:n,originalPaymentAmount:a,onDonateButtonClicked:o}=t,{i18n:r}=O();return c(G,null,c(Ye,{classNameModifiers:["donate"],onClick:o,label:`${r.get("donateButton")} ${n}`,status:e}),c("span",{className:"adyen-checkout-roundup-description"},r.get("donationRoundUpDescription",{values:{donationAmount:n,originalPaymentAmount:a}})))}function gd(t){const{donation:e,commercialTxAmount:n,onAmountSelected:a,onCancel:o,onDonate:r,showCancelButton:i=!0,termsAndConditionsUrl:s}=t,{i18n:d}=O(),l=$e(),{currency:h,type:u}=e,y=u==="roundup",[m,f]=N("ready"),[x,S]=N(y),[w,k]=N({currency:h,value:y?fd(e.maxRoundupAmount,n):null});this.setStatus=_=>{f(_)};const b=()=>{f("loading"),r({data:{amount:w}})};return F(()=>{t.onChange({data:{amount:w},isValid:x})},[w,x]),m==="error"?c("div",{className:"adyen-checkout__adyen-giving"},c(we,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:l({imageFolder:"components/"})("error"),alt:d.get("error.message.unknown")}),c("div",{className:"adyen-checkout__status__text"},d.get("error.message.unknown"))):m==="success"?c("div",{className:"adyen-checkout__adyen-giving"},c(we,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--success",src:l({imageFolder:"components/"})("heart"),alt:d.get("thanksForYourSupport")}),c("div",{className:"adyen-checkout__status__text"},d.get("thanksForYourSupport"))):c("div",{className:"adyen-checkout__adyen-giving"},c(by,t),c("div",{className:"adyen-checkout__adyen-giving-actions"},s&&c(Wo,{message:d.get("donationTermsCondition"),urls:[s]}),y?c(wy,{donationAmount:vy(d,{maxRoundupAmount:e.maxRoundupAmount,commercialTxAmount:n,currency:h}),originalPaymentAmount:Sr(d,{value:n,currency:h}),status:m,onDonateButtonClicked:b}):c(xy,{selectedAmount:w.value,values:e.values,currency:h,status:m,onAmountSelected:({target:_})=>{const g=parseInt(_.value,10);S(!0),k(T=>C(p({},T),{value:g})),a({data:{amount:C(p({},w),{value:g})}})},onDonateButtonClicked:b}),i&&c(Ye,{classNameModifiers:["decline"],variant:"ghost",onClick:()=>{f("ready"),o({data:{amount:w},isValid:x})},disabled:m==="loading",label:`${d.get("notNowButton")} ›`})))}gd.defaultProps={onCancel:()=>{},onChange:()=>{},onDonate:()=>{},donation:{},showCancelButton:!0};function un(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Cy=`Donation instantiation error:: You need to set donation.autoMount to false if you wish to display the Donation component in a different container.
5
5
  The Donation component will be displayed in the default container.`;let bd=class kc{async initialise(){const[e]=await Promise.all([this.callSessionsDonationCampaigns(),new Promise(n=>setTimeout(n,this.delayMS))]);return e}async callSessionsDonationCampaigns(){const e=new Ze({component:kc.type,type:st.apiRequest,subType:xt.donationCampaigns,message:"Sessions flow: calling donationCampaigns endpoint"});this.core.modules.analytics.sendAnalytics(e);const n=await this.makeSessionsDonationCampaignsCall(),[a]=(n==null?void 0:n.donationCampaigns)||[];return a?this.handleDonationCampaign(a):null}handleDonationCampaign(e){const s=e,{id:n,campaignName:a}=s,o=Ce(s,["id","campaignName"]),r=o.donation.type,i=C(p({},o),{onCancel:d=>{var l;(l=this.onDonationCompleted)==null||l.call(this,{didDonate:!1})},onDonate:(d,l)=>{const h={amount:d.data.amount,donationCampaignId:n,donationType:r};this.callSessionsDonations(h,l)},commercialTxAmount:this.commercialTxAmount});if(r==="roundup"&&!this.commercialTxAmount)throw new Error(`The donation type is "roundup" and the commercialTxAmount is not set.
6
- It will not be possible to mount a Donation component.`);return i}async callSessionsDonations(e,n){var a,o,r;try{const i=await this.makeSessionDonationsCall(e);i.resultCode==="Authorised"?(n.setStatus("success"),(a=this.onDonationCompleted)==null||a.call(this,{didDonate:!0})):(n.setStatus("error"),(o=this.onDonationFailed)==null||o.call(this,i.resultCode))}catch(i){n.setStatus("error"),(r=this.onDonationFailed)==null||r.call(this,i)}}async makeSessionsDonationCampaignsCall(){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.fetchDonationCampaigns()}async makeSessionDonationsCall(e){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.makeDonation(e)}constructor(e,n){var a,o,r,i;un(this,"core",void 0),un(this,"commercialTxAmount",0),un(this,"onDonationCompleted",void 0),un(this,"onDonationFailed",void 0),un(this,"delayMS",void 0),this.core=e,this.onDonationCompleted=(a=e.options.donation)==null?void 0:a.onDonationSuccess,this.onDonationFailed=(o=e.options.donation)==null?void 0:o.onDonationFailure,this.commercialTxAmount=n.commercialTxAmount,this.delayMS=(i=(r=e.options.donation)==null?void 0:r.delay)!=null?i:3e3}};un(bd,"type","donationCampaignService");function Er(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Tr=class Yn extends Gt{static isServiceMode(e){return"rootNode"in e&&!!e.rootNode}async initialiseServiceMode(e,n){var a,o;if(e.session)if(e.session.sessionsDonationInitiated)console.error(Cy);else{e.session.sessionsDonationInitiated=!0;try{const r=await new bd(e,n).initialise();r&&(this.props=p(p({},this.props),r),this.mount(n.rootNode))}catch(r){(o=(a=e.options.donation)==null?void 0:a.onDonationFailure)==null||o.call(a,r)}}}get data(){return this.state.data}get isValid(){return this.state.isValid}setState(e){this.state=p(p({},this.state),e)}donate(){const e=new Ze({component:Yn.type,type:st.submit,subType:xt.donation,message:"Making donation"});this.core.modules.analytics.sendAnalytics(e);const{data:n,isValid:a}=this;this.props.onDonate({data:n,isValid:a},this)}cancel(){const e=new Ze({component:Yn.type,type:st.closed,subType:xt.donation,message:"Opting to not make donation"});this.core.modules.analytics.sendAnalytics(e);const{data:n,isValid:a}=this;this.isInServiceMode&&this.unmount(),this.props.onCancel({data:n,isValid:a})}amountSelected(e){const n=new rt({component:Yn.type,type:Le.selected,selectedValue:JSON.stringify(e.data.amount),target:Na.donationAmountButton});this.core.modules.analytics.sendAnalytics(n)}componentToRender(){return c(gd,C(p({},this.props),{ref:e=>{this.componentRef=e},onChange:this.setState,onDonate:this.donate,onCancel:this.cancel,onAmountSelected:this.amountSelected}))}constructor(e,n){const a=Yn.isServiceMode(n);super(e,a?void 0:n),Er(this,"isInServiceMode",!1),this.donate=this.donate.bind(this),this.cancel=this.cancel.bind(this),this.amountSelected=this.amountSelected.bind(this),this.isInServiceMode=a,e.session&&a&&this.initialiseServiceMode(e,n)}};Er(Tr,"type",v.donation),Er(Tr,"defaultProps",{onCancel:()=>{},onDonate:()=>{}});function Va(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Sy=class{get length(){return Object.keys(this.storage).length}key(e){var n;return(n=Object.keys(this.storage)[e])!=null?n:null}getItem(e){return this.storage[e]||null}setItem(e,n){this.storage[e]=n}removeItem(e){delete this.storage[e]}clear(){this.storage={}}constructor(){Va(this,"storage",void 0),this.storage={}}},kd=class{get(){try{const e=this.storage.getItem(this.key);return e?JSON.parse(e):null}catch(e){return null}}set(e){this.storage.setItem(this.key,JSON.stringify(e))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(e){return this.storage.key(e)}get length(){return this.storage.length}constructor(e,n){Va(this,"prefix","adyen-checkout__"),Va(this,"key",void 0),Va(this,"storage",void 0);try{if(this.storage=n?window[n]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch(a){this.storage=new Sy}this.key=this.prefix+e}};function Ct(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Ey=kp;let Ty=class{get checkoutAttemptId(){return this._checkoutAttemptId}set checkoutAttemptId(e){this._checkoutAttemptId=e}async setUp({sessionId:e,checkoutStage:n,locale:a}={}){var o;try{const r=this.storage.get(),i=(function(u){if(!(u!=null&&u.timestamp))return!1;const y=Date.now()-9e5;return u.timestamp>y})(r),{applicationInfo:s,checkoutAttemptId:d}=(o=Up(this.analyticsData))!=null?o:{},l=i?r==null?void 0:r.id:d,h=p(p(p({version:Zo,buildType:ys,channel:Xo.WEB,platform:er,locale:a,referrer:window.location.href,screenWidth:window.screen.width,checkoutStage:n||"checkout",level:this.enabled?"all":"initial"},s&&{applicationInfo:s}),e&&{sessionId:e}),l&&{checkoutAttemptId:l});this.checkoutAttemptId=await this.service.requestCheckoutAttemptId(h),this.dispatchPendingAnalytics(),this.storage.set({id:this.checkoutAttemptId,timestamp:i?r.timestamp:Date.now()})}catch(r){this.enabled=!1,console.warn("Analytics: Error setting up",r)}}sendAnalytics(e){if(this.enabled)try{this.addEventToQueue(e)}catch(n){console.warn("Analytics: Error adding event to queue",n)}}async sendFlavor(e){this.isFlavorReported||(this.checkoutAttemptId?await this.dispatchFlavor(e):this.pendingFlavor||(this.pendingFlavor=e))}async dispatchFlavor(e){if(!this.isFlavorReported&&this.checkoutAttemptId){this.isFlavorReported=!0;try{await this.service.reportIntegrationFlavor(e,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error reporting flavor",n)}}}flush(){this.sendEvents()}addEventToQueue(e){this.eventsQueue.add(e),e.getEventCategory()===Vt.info?this.debouncedSendInfoEvents():this.debouncedSendEvents()}async sendEvents(){if(!this.checkoutAttemptId||!this.enabled||!this.eventsQueue.hasEvents)return;const e={channel:Xo.WEB,platform:er,info:this.eventsQueue.infoEvents,errors:this.eventsQueue.errorEvents,logs:this.eventsQueue.logEvents};this.eventsQueue.clear();try{await this.service.sendEvents(e,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error sending events",n)}}dispatchPendingAnalytics(){if(!this.isFlavorReported&&this.pendingFlavor){const e=this.pendingFlavor;this.pendingFlavor=void 0,this.dispatchFlavor(e)}this.sendEvents()}constructor({service:e,eventQueue:n,enabled:a,analyticsData:o}){Ct(this,"analyticsData",void 0),Ct(this,"service",void 0),Ct(this,"eventsQueue",void 0),Ct(this,"storage",new kd("checkout-attempt-id","sessionStorage")),Ct(this,"debouncedSendInfoEvents",void 0),Ct(this,"debouncedSendEvents",void 0),Ct(this,"_checkoutAttemptId",void 0),Ct(this,"enabled",!0),Ct(this,"isFlavorReported",!1),Ct(this,"pendingFlavor",void 0),this.service=e,this.eventsQueue=n,this.debouncedSendInfoEvents=nr(this.sendEvents.bind(this),1e4),this.debouncedSendEvents=nr(this.sendEvents.bind(this),Ey),a!==void 0&&(this.enabled=a),o&&(this.analyticsData=o)}};function Nr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Ny=class{add(e){const n=e.getEventCategory();n===Vt.info&&this.info.push(e),n===Vt.error&&this.errors.push(e),n===Vt.log&&this.logs.push(e)}get infoEvents(){return this.info}get errorEvents(){return this.errors}get logEvents(){return this.logs}get hasEvents(){return this.info.length>0||this.errors.length>0||this.logs.length>0}clear(){this.info=[],this.errors=[],this.logs=[]}constructor(){Nr(this,"info",[]),Nr(this,"errors",[]),Nr(this,"logs",[])}};function vd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Pr="v3/analytics";let Py=class{async requestCheckoutAttemptId(e){const n={loadingContext:this.analyticsContext,path:`${Pr}?clientKey=${this.clientKey}`};try{const{checkoutAttemptId:a}=await Ge(n,e);return a}catch(a){throw new z("NETWORK_ERROR","requestCheckoutAttemptId() - failed to get checkout attempt ID",{cause:a})}}async sendEvents(e,n){if(!n)throw new z("IMPLEMENTATION_ERROR","sendEvents() - checkoutAttemptId is required");if(!e.info.length&&!e.errors.length&&!e.logs.length)return Promise.resolve();const a={loadingContext:this.analyticsContext,path:`${Pr}/${n}?clientKey=${this.clientKey}`};try{await Ge(a,e)}catch(o){throw new z("NETWORK_ERROR","sendEvents() - failed to send events",{cause:o})}}async reportIntegrationFlavor(e,n){if(!e||!n)throw new z("IMPLEMENTATION_ERROR","reportIntegrationFlavor() - flavor or checkoutAttemptId is required");const a={loadingContext:this.analyticsContext,path:`${Pr}?clientKey=${this.clientKey}`},o={flavor:e,checkoutAttemptId:n};try{await Ge(a,o)}catch(r){throw new z("NETWORK_ERROR","reportIntegrationFlavor() - failed to send flavor",{cause:r})}}constructor({clientKey:e,analyticsContext:n}){vd(this,"clientKey",void 0),vd(this,"analyticsContext",void 0),this.clientKey=e,this.analyticsContext=n}};var Ar={payButton:"Pay","payButton.redirecting":"Redirecting...","payButton.with":"Pay %{value} with %{maskedData}","payButton.saveDetails":"Save details",close:"Close",storeDetails:"Save for my next payment",readMore:"Read more","creditCard.holderName":"Name on card","creditCard.holderName.invalid":"Enter name as shown on card","creditCard.expiryDateField.month":"Month","creditCard.expiryDateField.year":"Year","creditCard.storeDetailsButton":"Remember for next time","creditCard.dualBrand.title":"Card Brand","creditCard.dualBrand.description":"You can select the card brand you prefer to pay with. This is optional.",installments:"Number of installments",installmentOption:"%{times}x %{partialValue}",installmentOptionMonths:"%{times} months","installments.oneTime":"One time payment","installments.installments":"Installments payment","installments.revolving":"Revolving payment","installments.bonus":"Bonus payment","sepaDirectDebit.ibanField.invalid":"Invalid account number","sepa.ownerName":"Holder Name","sepa.ibanNumber":"Account Number (IBAN)","error.title":"Error","error.subtitle.redirect":"Redirect failed","error.subtitle.payment":"Payment failed","error.subtitle.refused":"Payment refused","error.message.unknown":"An unknown error occurred","errorPanel.title":"Existing errors","idealIssuer.selectField.title":"Bank","creditCard.success":"Payment Successful",loading:"Loading…",continue:"Continue",continueTo:"Continue to","wechatpay.timetopay":"You have %@ to pay","sr.wechatpay.timetopay":"You have %#minutes%# %#seconds%# to pay","wechatpay.scanqrcode":"Scan QR code",personalDetails:"Personal details",companyDetails:"Company details","companyDetails.name":"Company name","companyDetails.registrationNumber":"Registration number",socialSecurityNumber:"Social security number",firstName:"First name","firstName.invalid":"Enter your first name",infix:"Prefix",lastName:"Last name","lastName.invalid":"Enter your last name",mobileNumber:"Mobile number","mobileNumber.invalid":"Invalid mobile number",city:"City",postalCode:"Postal code","postalCode.optional":"Postal code (optional)",countryCode:"Country Code",telephoneNumber:"Telephone number",telephonePrefix:"Prefix",dateOfBirth:"Date of birth",shopperEmail:"Email address",gender:"Gender","gender.notselected":"Select your gender",male:"Male",female:"Female",billingAddress:"Billing address",street:"Street",stateOrProvince:"State or province",country:"Country/Region",houseNumberOrName:"House number",separateDeliveryAddress:"Specify a separate delivery address",deliveryAddress:"Delivery Address","deliveryAddress.firstName":"Recipient first name","deliveryAddress.lastName":"Recipient last name",zipCode:"Zip code",apartmentSuite:"Apartment / Suite",provinceOrTerritory:"Province or Territory",cityTown:"City / Town",address:"Address","address.search.contextualText":"Type to start searching your address","address.errors.incomplete":"Enter an address to continue","address.enterManually":"Enter address manually",state:"State",payAmountFormat:"Pay %@","field.title.optional":"(optional)","issuerList.selectField.contextualText":"Select your bank to continue","issuerList.selectField.label":"Bank selection",privacyPolicy:"Privacy policy","afterPay.agreement":"I agree with the %@ of Riverty","riverty.termsAndConditions":"I agree with the general %#Terms & Conditions%# for the Riverty Payment Method. The privacy policy of Riverty can be found %#here%#.",paymentConditions:"payment conditions",openApp:"Open the app","voucher.readInstructions":"Read instructions","voucher.introduction":"Thank you for your purchase, please use the following coupon to complete your payment.","voucher.expirationDate":"Expiration Date","voucher.alternativeReference":"Alternative Reference","voucher.paymentReferenceLabel":"Payment Reference","voucher.surcharge":"Incl. %@ surcharge","voucher.introduction.doku":"Thank you for your purchase, please use the following information to complete your payment.","voucher.shopperName":"Shopper Name","voucher.merchantName":"Merchant","voucher.introduction.econtext":"Thank you for your purchase, please use the following information to complete your payment.","voucher.telephoneNumber":"Phone Number","voucher.shopperReference":"Shopper Reference","voucher.collectionInstitutionNumber":"Collection Institution Number","voucher.econtext.telephoneNumber.invalid":"Telephone number must be 10 or 11 digits long","boletobancario.btnLabel":"Generate Boleto","boleto.sendCopyToEmail":"Send a copy to my email","button.copy":"Copy","button.copied":"Copied!","button.download":"Download","boleto.socialSecurityNumber":"CPF/CNPJ","boleto.socialSecurityNumber.invalid":"Enter a valid CPF/CNPJ number","creditCard.storedCard.description.ariaLabel":"Stored card ends in %@","voucher.entity":"Entity",donateButton:"Donate",donationTermsCondition:"By donating you agree to the %#terms and conditions%#",donationRoundUpDescription:"%{donationAmount} is a round up from your original payment (%{originalPaymentAmount})",notNowButton:"Not now",thanksForYourSupport:"Thanks for your support!","resultMessages.preauthorized":"Details saved",preauthorizeWith:"Preauthorize with",confirmPreauthorization:"Confirm preauthorization",confirmPurchase:"Confirm purchase",applyGiftcard:"Redeem",giftcardBalance:"Gift card balance",deductedBalance:"Deducted balance","creditCard.taxNumber":"Cardholder birthdate or Corporate registration number","creditCard.taxNumber.label":"Cardholder birthdate (YYMMDD) or Corporate registration number (10 digits)","creditCard.taxNumber.labelAlt":"Corporate registration number (10 digits)","creditCard.taxNumber.invalid":"Invalid Cardholder birthdate or Corporate registration number","storedPaymentMethod.disable.button":"Remove","storedPaymentMethod.disable.confirmation":"Remove stored payment method","storedPaymentMethod.disable.confirmButton":"Yes, remove","storedPaymentMethod.disable.cancelButton":"Cancel","ach.bankAccount":"Bank account","ach.bankAccount.title":"Bank account details","ach.bankAccount.label":"Account type","ach.bankAccount.placeholder":"Choose an account type","ach.bankAccount.nothing-selected-error":"Choose an account type","ach.bankAccount.option.personal-checking":"Personal Checking Account","ach.bankAccount.option.personal-savings":"Personal Savings Account","ach.bankAccount.option.business-checking":"Business Checking Account","ach.bankAccount.option.business-savings":"Business Savings Account","ach.bankAccountNumberVerification.label":"Verify account number","ach.bankAccountNumberVerification.error.not-match":"Account number does not match","ach.bankAccountNumberVerification.error.empty":"Enter the provided account number to verify the account number","ach.routingNumber.label":"Routing number","ach.accountHolderNameField.title":"Account holder name","ach.accountHolderNameField.contextualText":"Located on the front of your card","ach.accountHolderNameField.invalid":"Invalid account holder name","ach.accountNumberField.invalid":"Invalid account number","ach.accountLocationField.invalid":"Invalid ABA routing number","ach.savedBankAccount":"Saved bank account","ach.savings":"Savings account","ach.checking":"Checking account","select.state":"Select state","select.stateOrProvince":"Select state or province","select.provinceOrTerritory":"Select province or territory","select.country":"Select country/region","select.noOptionsFound":"No options found","select.results":"%{count} results available","telephoneNumber.invalid":"Invalid telephone number",qrCodeOrApp:"or","paypal.processingPayment":"Processing payment...",generateQRCode:"Generate QR code","await.waitForConfirmation":"Waiting for confirmation","mbway.confirmPayment":"Confirm your payment on the MB WAY app","shopperEmail.invalid":"Invalid email address","dateOfBirth.format":"DD/MM/YYYY","dateOfBirth.invalid":"Enter a valid date of birth that indicates you are at least 18 years old","blik.confirmPayment":"Open your banking app to confirm the payment.","blik.invalid":"Enter 6 numbers","blik.code":"6-digit code","blik.help":"Get the code from your banking app.","swish.pendingMessage":"After you scan, the status can be pending for up to 10 minutes. Attempting to pay again within this time may result in multiple charges.","field.valid":"Field valid","field.invalid":"Field not valid","field.error.required":"Enter the %{label}","field.error.invalid":"Enter a valid %{label}","error.giftcard.no-balance":"This gift card has zero balance","error.giftcard.card-error":"In our records we have no gift card with this number","error.giftcard.currency-error":"Gift cards are only valid in the currency they were issued in","err.gen.9100":"Incomplete field","err.gen.9101":"Field not valid","err.gen.9102":"Data parsing error","3ds.chal.805":"Challenge resolved without a %{result} object","cc.num.902":"Enter a valid card number","cc.num.900":"Enter the card number","cc.num.903":"Enter a supported card brand","cc.num.901":"Enter the complete card number","cc.dat.912":"Enter a valid expiry date","cc.dat.913":"Enter a valid expiry date","cc.dat.914":"Credit card about to expire","cc.dat.910":"Enter the expiry date","cc.dat.911":"Enter the complete expiry date","cc.mth.915":"Enter the expiry month","cc.yr.917":"Enter the expiry year","cc.yr.918":"Enter the complete expiry year","cc.cvc.920":"Enter the security code","cc.cvc.921":"Enter the complete security code","ach.num.945":"Enter the bank account number","ach.num.946":"Enter the complete bank account number","ach.loc.947":"Enter the bank routing number","ach.loc.948":"Enter the complete bank routing number","kcp.pwd.940":"Enter the password","kcp.pwd.941":"Enter the complete password","amazonpay.signout":"Sign out from Amazon","amazonpay.changePaymentDetails":"Change payment details","partialPayment.warning":"Select another payment method to pay the remaining","partialPayment.remainingBalance":"Remaining balance will be %{amount}","order.paymentMethod.description":"%{name} ending in %{lastFour}","bankTransfer.beneficiary":"Beneficiary name","bankTransfer.iban":"IBAN","bankTransfer.bic":"BIC","bankTransfer.reference":"Reference","bankTransfer.accountNumber":"Account number","bankTransfer.sortCode":"Sort code","bankTransfer.routingNumber":"Routing number","bankTransfer.branchCode":"Branch code","bankTransfer.bankCode":"Bank code","bankTransfer.introduction":"Press ‘Continue’ to create a new bank transfer payment. You can use the details in the following screen to finalize this payment.","bankTransfer.instructions":"Thank you for your purchase, please use the following information to complete your payment.","bankTransfer.shopperEmail.contextualText":"A copy of the payment details will be sent to your email so you can complete the payment later.","bankTransfer.details.title":"Payment details","bankTransfer.instruction.title":"Payment process","bankTransfer.instruction.step1":"Open your banking app","bankTransfer.instruction.step2":"Start a new transfer","bankTransfer.instruction.step3":"Enter the account details provided below","bankTransfer.instruction.step4":"Review and confirm the payment","bacs.accountHolderName":"Bank account holder name","bacs.accountHolderName.invalid":"Invalid bank account holder name","bacs.accountNumber":"Bank account number","bacs.accountNumber.invalid":"Invalid bank account number","bacs.bankLocationId":"Sort code","bacs.bankLocationId.invalid":"Invalid sort code","bacs.consent.amount":"I agree that the above amount will be deducted from my bank account.","bacs.consent.account":"I confirm the account is in my name and I am the only signatory required to authorise the Direct Debit on this account.",edit:"Edit","bacs.confirm":"Confirm and pay","bacs.result.introduction":"Download your Direct Debit Instruction (DDI / Mandate)","download.pdf":"Download PDF","creditCard.encryptedCardNumber.aria.iframeTitle":"Card number","creditCard.encryptedExpiryDate.aria.iframeTitle":"Expiry date","creditCard.encryptedExpiryMonth.aria.iframeTitle":"Expiry month","creditCard.encryptedExpiryYear.aria.iframeTitle":"Expiry year","creditCard.encryptedSecurityCode.aria.iframeTitle":"Security code","creditCard.encryptedPassword.aria.iframeTitle":"Password","giftcard.encryptedCardNumber.aria.iframeTitle":"Card number","giftcard.encryptedSecurityCode.aria.iframeTitle":"Pin",giftcardTransactionLimit:"Max. %{amount} allowed per transaction on this gift card","pix.instructions":"Use your banking app to scan the QR code or copy the PIX code below to complete your payment.","pix.code.label":"PIX code","pix.code.copy.label":"Copy PIX code","pix.code.copied.label":"PIX code copied","twint.saved":"saved",orPayWith:"or pay with","invalid.format.expects":"%{label} Invalid format. Expected format: %{format}","upi.qrCodeWaitingMessage":"Scan the QR code using your preferred UPI app to complete the payment","upi.vpaWaitingMessage":"Open your UPI app to confirm the payment","upi.modeSelection":"How would you like to use UPI?","upi.completePayment":"Complete your payment","upi.mode.enterUpiId":"UPI ID","upi.mode.qrCode":"QR code","upi.mode.payByAnyUpi":"UPI apps","upi.collect.dropdown.label":"Enter UPI ID","upi.collect.instruction":"Enter your UPI ID","upi.collect.field.label":"UPI ID","upi.collect.field.contextualText":"Enter the UPI ID connected to your account and press continue","upi.collect.field.invalid-id-error":"Enter a valid UPI","upi.error.noAppSelected":"Select your preferred UPI app to continue","upi.intent.instruction":"Select your preferred UPI app","upi.qrCode.instruction":"After generating the QR code you can use your preferred UPI app to complete the payment.","onlineBanking.termsAndConditions":"By continuing you agree with the %#terms and conditions%#","onlineBankingPL.termsAndConditions":"By continuing you agree with the %#regulations%# and %#information obligation%# of Przelewy24","ctp.loading.poweredByCtp":"Powered by Click to Pay","ctp.loading.intro":"We are checking to see if you have any saved cards with Click to Pay...","ctp.login.title":"Continue to Click to Pay","ctp.login.subtitle":"Enter the email address that is connected to Click to Pay to continue.","ctp.login.inputLabel":"Email","ctp.logout.notYou":"Not you?","ctp.logout.notYourCards":"Not your cards?","ctp.logout.notYourCard":"Not your card?","ctp.logout.notYourProfile":"Not your profile?","ctp.otp.fieldLabel":"One time code","ctp.otp.resendCode":"Resend code","ctp.otp.codeResent":"Code resent","ctp.otp.title":"Access your Click to Pay cards","ctp.otp.subtitle":"Enter the code %@ sent to %@ to verify it‘s you.","ctp.otp.saveCookiesCheckbox.label":"Skip verification next time","ctp.otp.saveCookiesCheckbox.information":"Select to be remembered on your device and browser at participating stores for faster checkout. Not recommended for shared devices.","ctp.otp.saveCookiesCheckbox.shorterInfo":"Select to be remembered on your device and browser","ctp.emptyProfile.message":"No cards registered in this Click to Pay profile","ctp.separatorText":"or use","ctp.cards.title":"Complete payment with Click to Pay","ctp.cards.subtitle":"Select a card to use.","ctp.cards.expiredCard":"Expired","ctp.manualCardEntry":"Manual card entry","ctp.aria.infoModalButton":"What is Click to Pay","ctp.infoPopup.title":"Click to Pay brings the ease of contactless, online","ctp.infoPopup.subtitle":"A fast, secure payment method supported by Mastercard, Visa and other payment cards.","ctp.infoPopup.benefit1":"Click to Pay uses encryption to keep your information safe and secure","ctp.infoPopup.benefit2":"Use it with merchants worldwide","ctp.infoPopup.benefit3":"Set up once for hassle-free payments in the future","ctp.errors.AUTH_INVALID":"Authentication Invalid","ctp.errors.NOT_FOUND":"No account found, enter a valid email or continue using manual card entry","ctp.errors.ID_FORMAT_UNSUPPORTED":"Format not supported","ctp.errors.FRAUD":"The user account was locked or disabled","ctp.errors.CONSUMER_ID_MISSING":"Consumer identity is missing in the request","ctp.errors.ACCT_INACCESSIBLE":"This account is currently not available, e.g it is locked","ctp.errors.CODE_INVALID":"Incorrect verification code","ctp.errors.CODE_EXPIRED":"This code has expired","ctp.errors.RETRIES_EXCEEDED":"The limit for the number of retries for OTP generation was exceeded","ctp.errors.OTP_SEND_FAILED":"The OTP could not be sent to the recipient","ctp.errors.REQUEST_TIMEOUT":"Something went wrong, try again or use the manual card entry","ctp.errors.UNKNOWN_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVICE_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVER_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_PARAMETER":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_EMAIL":"Enter a valid email address (e.g. name@example.com)","ctp.errors.AUTH_ERROR":"Something went wrong, try again or use the manual card entry","paymentMethodsList.aria.label":"Choose a payment method","paymentMethodsList.storedPayments.label":"Saved payment methods","paymentMethodsList.otherPayments.label":"More payment options","paymentMethodsList.otherPayments.buttonLabel":"Show %{count} more","paymentMethodsList.promotedPayments.label":"Other","companyDetails.name.invalid":"Enter the company name","companyDetails.registrationNumber.invalid":"Enter the registration number","consent.checkbox.invalid":"You must agree with the terms & conditions","form.instruction":"All fields are required unless marked otherwise.","trustly.descriptor":"Instant Bank Payment","trustly.description1":"Pay directly from any of your bank accounts, backed by bank-level security","trustly.description2":"No cards, no app download, no registration","ancv.input.label":"Your ANCV identification","ancv.confirmPayment":"Use your ANCV application to confirm the payment.","ancv.form.instruction":"The Cheque-Vacances application is necessary to validate this payment.","ancv.beneficiaryId.invalid":"Enter a valid email address or ANCV ID","creditCard.cardNumber.label":"Card number","creditCard.expiryDate.label":"Expiry date","creditCard.expiryDate.contextualText":"Front of card in MM/YY format","creditCard.securityCode.label":"Security code","creditCard.securityCode.label.optional":"Security code (optional)","creditCard.securityCode.contextualText.3digits":"3 digits on back of card","creditCard.securityCode.contextualText.4digits":"4 digits on front of card","creditCard.expiryMonth.label":"Expiry month","creditCard.expiryYear.label":"Expiry year","creditCard.pin.label":"Pin","creditCard.password.label":"First 2 digits of card password","giftcard.cardNumber.label":"Card Number","giftcard.expiryDate.label":"Expiry date","giftcard.securityCode.label":"Pin","ach.bankAccountNumber.label":"Account number","ach.bankLocationId.label":"ABA routing number","dragonpayVoucher.selectField.contextualText.nonBank":"Select your provider","dragonpayVoucher.selectField.contextualText.bank":"Select your bank","payme.openPayMeApp":"Complete your payment in the PayMe app by authorizing the payment in the app and wait for the confirmation.","payme.redirectButtonLabel":"Open PayMe app","payme.scanQrCode":"Complete your payment by QR code","payme.timeToPay":"This QR code is valid for %@","payme.instructions.steps":"Open the PayMe app.%@Scan the QR code to authorize the payment.%@Complete the payment in the app and wait for confirmation.","payme.instructions.footnote":"Please do not close this page before the payment is completed","payByBankAISDD.disclaimer.header":"Use Pay by Bank to pay instantly from any bank account.","payByBankAISDD.disclaimer.body":"By connecting your bank account you are authorizing debits to your account for any amount owed for use of our services and/or purchase of our products, until this authorization is revoked.","paymentMethodBrand.other":"other","paynow.scanQrCode":"Scan the QR code using the PayNow app to complete the payment","paynow.mobileViewInstruction.step1":"Take a screenshot of the QR code.","paynow.mobileViewInstruction.step2":"Open the PayNow bank or payment app.","paynow.mobileViewInstruction.step3":"Select the option to scan a QR code.","paynow.mobileViewInstruction.step4":"Choose the option to upload a QR and select the screenshot.","paynow.mobileViewInstruction.step5":"Complete the transaction.","payto.payid.description":"Enter the PayID and account details that are connected to your PayTo account.","payto.payid.label.identifier":"Identifier","payto.payid.label.orgid":"Organization ID","payto.payid.option.phone":"Mobile","payto.payid.option.email":"Email","payto.payid.option.orgid":"Organization ID","payto.bsb.description":"Enter the bank account number and the Bank State Branch that is connected to your account to continue","payto.bsb.label.bankAccountNumber":"Bank account number","payto.instructions.steps":"Log into your PayTo banking app@Authorize the PayTo agreement@Approve the payment terms@Complete the transaction","payto.confirmPayment":"Thank you for your purchase, complete your payment by following the instructions below.","payto.mandate.amount.label":"Amount","payto.mandate.frequency.label":"Frequency","payto.mandate.remarks.label":"Description","payto.mandate.startsAt.label":"First payment date","payto.mandate.endsAt.label":"End date","payto.mandate.payee.label":"Payee","payto.mandate.amount.max":"Up to %{amount} per transaction","payto.mandate.frequency.adhoc-no-count":"Ad Hoc","payto.mandate.frequency.adhoc":"%{count} time(s)","payto.mandate.frequency.daily":"%{count} payment(s) Daily","payto.mandate.frequency.weekly":"%{count} payment(s) Weekly","payto.mandate.frequency.biWeekly":"%{count} payment(s) Fortnightly","payto.mandate.frequency.monthly":"%{count} payment(s) Monthly","payto.mandate.frequency.quarterly":"%{count} payment(s) Quarterly","payto.mandate.frequency.halfYearly":"%{count} payment(s) Bi-Annual","payto.mandate.frequency.yearly":"%{count} payment(s) Yearly","payto.label.firstName":"Account holder first name","payto.label.lastName":"Account holder last name","payto.await.waitForConfirmation":"Awaiting your approval","payto.bsb.option.label":"BSB and account number","card.fastlane.a11y.logo":"Fastlane by Paypal logo","card.fastlane.a11y.openDialog":"Read more about Fastlane","card.fastlane.a11y.closeDialog":"Close dialog","card.fastlane.mobileInputLabel":"Mobile number","card.fastlane.consentToggle":"Save your info with Fastlane for faster checkouts and more","card.fastlane.consentText":"By saving your info, you agree to get codes by text to use Fastlane everywhere it's available. Fastlane will text the number provided. You also agree to this %#terms%# and %#privacy statement%#.","card.fastlane.modal.benefit1.header":"Autofill your checkouts","card.fastlane.modal.benefit1.text":"Get one-time codes to use card and addresses you’ve saved.","card.fastlane.modal.benefit2.header":"Protect your info","card.fastlane.modal.benefit2.text":"Your payment info is encrypted when it’s stored and sent to places you shop.","card.fastlane.modal.benefit3.header":"Use across stores","card.fastlane.modal.benefit3.text":"Speed through checkout everywhere Fastlane is available.","paybybankpix.redirectBtn.label":"Continue to PIX through OpenBanking","paybybankpix.issuerList.disclaimer":"By continuing, you agree to the %#Consent Notice%# and will be redirected to your bank.","paybybankpix.issuerList.selectField.label":"Bank","paybybankpix.issuerList.introduction.logo.content":"Connect your favorite PIX keys to pay through Open Finance","paybybankpix.await.waitForConfirmation":"Waiting for your confirmation...","paybybankpix.await.timeToPay":"This process will take approximately %{numberOfMin} minute(s)","paybybankpix.await.withOpenFinance":"With the ease of Open Finance","paybybankpix.await.logoAlt.openFinance":"Open Finance","paybybankpix.storedPayment.payButton.label":"Continue payment","paybybankpix.storedPayment.additionalLabel":"%{receiver} account through PIX","paybybankpix.await.fetchDetails":"Fetching details...","eftpad-canada.input.accountHolderName.label":"Account holder name","eftpad-canada.input.accountHolderName.error":"Enter an account holder name","eftpad-canada.input.accountNumber.label":"Account number","eftpad-canada.input.accountNumber.contextualText":"Between 7 and 12 digits","eftpad-canada.input.accountNumber.error":"Enter an account number that is between 7 and 12 digits","eftpad-canada.input.institutionNumber.label":"Institution number","eftpad-canada.input.institutionNumber.contextualText":"3 digits","eftpad-canada.input.institutionNumber.error":"Enter an institution number that consists of 3 digits","eftpad-canada.input.transitNumber.label":"Transit number","eftpad-canada.input.transitNumber.contextualText":"5 digits","eftpad-canada.input.transitNumber.error":"Enter a transit number that consists of 5 digits","eftpad-canada.settlement-info":"The funds will be withdrawn from your bank account within 1–3 business days.","upi.mandate.intro":"You’re setting up a UPI Autopay recurring payment","upi.mandate.max.extraText":"You’ll approve a higher limit to allow future plan changes","upi.mandate.upTo":"up to %{amount}","upi.mandate.frequency.monthly":"/month","upi.mandate.frequency.weekly":"/week","upi.mandate.frequency.adhoc":" as presented",bankList:"Bank list",qrCode:"QR code","iris.instructions.generateQrCode":"After generating the QR code you can use your preferred banking app to complete the payment.","iris.instructions.payment.step1":"Open your preferred banking app.","iris.instructions.payment.step2":"Scan the QR code with your banking app.","iris.instructions.payment.step3":"Complete the payment in the app and wait for the confirmation here.","econtext.customerNumber":"Customer number","econtext.confirmationNumber":"Confirmation number","econtext.useBefore":"Use before","econtext.paymentInformation":"Payment information","issuerList.separatorText":"or choose from list","upi.intent.apps.title":"Options","upi.intent.apps.dropdown.label":"UPI apps","upi.intent.apps.dropdown.placeholder":"Choose preferred app"};function Nt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Ay{async requestTranslations(){const e=await this.service.fetchTranslationsFromCdn(this.locale);this._translations=p(p(p({},Ar),e),!!this.customTranslations[this.locale]&&this.customTranslations[this.locale])}get translations(){return this._translations}get(e,n){const a=Gu(this._translations,e,n);return a!==null?a:e}amount(e,n,a){return $h(e,this.locale,n,a)}date(e,n={}){if(e===void 0)return"";const a=p({year:"numeric",month:"2-digit",day:"2-digit"},n);return new Date(e).toLocaleDateString(this.locale,a)}dateTime(e){return e===void 0?"":this.timeAndDateFormatter.format(new Date(e))}createSupportedLocalesList(e){if(!e)return Ko;const n=new Set([...Ko,...Object.keys(e)]);return Array.from(n).sort((a,o)=>a.localeCompare(o))}constructor(e){Nt(this,"locale",void 0),Nt(this,"languageCode",void 0),Nt(this,"service",void 0),Nt(this,"customTranslations",void 0),Nt(this,"supportedLocales",void 0),Nt(this,"_translations",{}),Nt(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),Nt(this,"timeAndDateFormatOptions",p({year:"numeric",month:"2-digit",day:"2-digit"},this.timeFormatOptions)),Nt(this,"timeAndDateFormatter",void 0);const{locale:n,customTranslations:a,service:o}=e;this.service=o,this.customTranslations=Wu(a),this.supportedLocales=this.createSupportedLocalesList(this.customTranslations),this.locale=qu(n||Sa,this.supportedLocales),this.languageCode=this.locale.split("-")[0],this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions)}}const Dy="1.0.0",Iy="1.0.0",za="deviceFingerprint",$y=2e4,Ry={result:{type:za,value:"df-timedOut"},errorCode:"timeout"},Fy={UNKNOWN:"unknownError"},xd={timeout:"iframe loading timed out",wrongOrigin:"Result did not come from the expected origin",wrongDataType:"Result data was not of the expected type",missingProperty:"Result data did not contain the expected properties",unknownError:"An unknown error occurred"};function Dr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Oy extends Fe{getDfpPromise(){return new Promise((e,n)=>{this.processMessageHandler=hr(this.postMessageDomain,e,n,za),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.deviceFingerPrintPromise=_r($y,this.getDfpPromise(),Ry),this.deviceFingerPrintPromise.promise.then(e=>{this.props.onCompleteFingerprint(e),window.removeEventListener("message",this.processMessageHandler)}).catch(e=>{this.props.onErrorFingerprint(e),window.removeEventListener("message",this.processMessageHandler)})}render({dfpURL:e}){return c("div",{className:"adyen-checkout-risk__device-fingerprint"},c(On,{name:"dfIframe",src:e,allow:"geolocation; microphone; camera;",title:"devicefingerprinting iframe"}))}constructor(e){super(e),Dr(this,"postMessageDomain",void 0),Dr(this,"processMessageHandler",void 0),Dr(this,"deviceFingerPrintPromise",void 0),this.postMessageDomain=mr(this.props.loadingContext)||this.props.loadingContext}}const My=t=>({errorCode:t,message:xd[t]||xd[Fy.UNKNOWN],type:za});let wd=class extends Fe{setStatusComplete(e){this.setState({status:"complete"},()=>{this.props.onComplete(e)})}render({loadingContext:e},{dfpURL:n}){return this.state.status==="retrievingFingerPrint"?c("div",{className:"adyen-checkout-risk__device-fingerprint--wrapper",style:{position:"absolute",width:0,height:0}},c(Oy,{loadingContext:e,dfpURL:n,onCompleteFingerprint:a=>{this.setStatusComplete(a)},onErrorFingerprint:a=>{this.props.onError(My(a.errorCode)),this.setStatusComplete(a.result)}})):null}constructor(e){super(e),e.clientKey&&(this.state={status:"retrievingFingerPrint",dfpURL:`${this.props.loadingContext}assets/html/${e.clientKey}/dfp.${Iy}.html`})}};var Ir,$r,Rr;Rr={onComplete:()=>{},onError:()=>{}},($r="defaultProps")in(Ir=wd)?Object.defineProperty(Ir,$r,{value:Rr,enumerable:!0,configurable:!0,writable:!0}):Ir[$r]=Rr;function pn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Fr=class vc extends Da{formatProps(e){return C(p({},e),{risk:p(p({},vc.defaultProps.risk),e.risk)})}get isValid(){return this.state.isValid}get data(){if(this.isValid){const e=p({version:Dy},this.state.data);return Mn.encode(JSON.stringify(e))}return!1}get enabled(){return this.props.risk.enabled}componentWillUnmount(){this.cleanUp()}render(){return c(wd,C(p({},this.props),{loadingContext:this.props.loadingContext,onComplete:this.onComplete,onError:this.onError}))}constructor(e,n){super(e,n),pn(this,"nodeRiskContainer",null),pn(this,"onComplete",o=>{const r=C(p({},this.state.data),{[o.type]:o.value,persistentCookie:o.persistentCookie,components:o.components});this.setState({data:r,isValid:!0}),this.props.risk.onComplete(this.data),this.cleanUp()}),pn(this,"onError",o=>{this.props.risk.onError(o),this.cleanUp()}),pn(this,"cleanUp",()=>{this.nodeRiskContainer&&this.nodeRiskContainer.parentNode&&this.nodeRiskContainer.parentNode.removeChild(this.nodeRiskContainer)});const a={[za]:null};this.setState({data:a}),this.props.risk.enabled===!0&&(document.querySelector(this.props.risk.node)?(this.nodeRiskContainer=document.createElement("div"),document.querySelector(this.props.risk.node).appendChild(this.nodeRiskContainer),this.mount(this.nodeRiskContainer)):this.onError({message:"RiskModule node was not found"}))}};pn(Fr,"type","risk"),pn(Fr,"defaultProps",{risk:{enabled:!0,onComplete:()=>{},onError:()=>{},node:"body"}});function Cd(t){return!this.length||this.includes(t.type)}function Sd(t){return!this.length||!this.includes(t.type)}function Ly(t){return!!t&&!!t.supportedShopperInteractions&&t.supportedShopperInteractions.includes("Ecommerce")}const By=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto","paybybank_pix","eft_directdebit_CA"];function Vy(t){return!!t&&!!t.type&&By.includes(t.type)}function zy(t){return C(p({},t),{_id:ze()})}const Uy=(t,{allowPaymentMethods:e=[],removePaymentMethods:n=[]})=>t?t.filter(Cd,e).filter(Sd,n).map(zy):[],jy=(t,{allowPaymentMethods:e=[],removePaymentMethods:n=[]},a=[])=>t?t.filter(Vy).filter(Cd,e).filter(Sd,n).filter(Ly).map(o=>((r,i)=>{const s=(function(d,l){if(d.type!=="scheme")return;const h=d.brand;if(!h)return;const u=l.find(y=>{var m;return y.type==="scheme"&&((m=y.brands)==null?void 0:m.includes(h))});return u==null?void 0:u.fundingSource})(r,i);return p(C(p({},r),{storedPaymentMethodId:r.id,isStoredPaymentMethod:!0}),s&&{fundingSource:s})})(o,a)):[],Ky=t=>{var e,n;if(typeof t=="string")throw new Error('paymentMethodsResponse was provided but of an incorrect type (should be an object but a string was provided).Try JSON.parse("{...}") your paymentMethodsResponse.');if(t instanceof Array)throw new Error("paymentMethodsResponse was provided but of an incorrect type (should be an object but an array was provided).Please check you are passing the whole response.");!t||(e=t==null?void 0:t.paymentMethods)!=null&&e.length||(n=t==null?void 0:t.storedPaymentMethods)!=null&&n.length||console.warn("paymentMethodsResponse was provided but no payment methods were found.")};function Ed(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Hy=class{mapCreatedComponentType(e){return e==="card"?"scheme":e}has(e){return!!this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(e))}find(e){return this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(e))}findByFundingSource(e,n){const a=this.mapCreatedComponentType(e);return this.paymentMethods.find(o=>o.type===a&&o.fundingSource===n)}findById(e){return this.paymentMethods.find(n=>n._id===e)}findStoredPaymentMethod(e){return this.storedPaymentMethods.find(n=>n.id===e)}constructor(e,n={}){Ed(this,"paymentMethods",[]),Ed(this,"storedPaymentMethods",[]),Ky(e),this.paymentMethods=e?Uy(e.paymentMethods,n):[],this.storedPaymentMethods=e?jy(e.storedPaymentMethods,n,e.paymentMethods||[]):[]}};const Or=(t,e,n,a)=>{const o=e.getComponent(n);if(!o)throw Error(`Action Element of type ${n} not found in the registry`);return new o(t,C(p({},a),{id:`${n}-${ze()}`}))},zn=t=>(e,n,a,o)=>{const r=C(p(p({},o),a),{onError:o.onError,statusType:t,originalAction:a});return Or(e,n,a.paymentMethodType,r)},qy={redirect:(t,e,n,a)=>{const o=C(p(p({},a),n),{statusType:"redirect",originalAction:n});return Or(t,e,"redirect",o)},threeDS2:(t,e,n,a)=>{var s,d;const o=n.subtype==="fingerprint"?"threeDS2DeviceFingerprint":"threeDS2Challenge",r=n.subtype==="fingerprint"||a.isMDFlow?n.paymentData:n.authorisationToken,i=p({core:t,token:n.token,paymentData:r,onActionHandled:a.onActionHandled,on3DS2RedirectFlowComplete:a.on3DS2RedirectFlowComplete,onAdditionalDetails:a.onAdditionalDetails,onError:a.onError,isDropin:!!a.isDropin,loadingContext:a.loadingContext,clientKey:a.clientKey,paymentMethodType:a.paymentMethodType,challengeWindowSize:a.challengeWindowSize,isMDFlow:a.isMDFlow,modules:{analytics:(s=a.modules)==null?void 0:s.analytics,resources:(d=a.modules)==null?void 0:d.resources}},ly(n.subtype,a));return Or(t,e,o,i)},voucher:zn("custom"),qrCode:zn("custom"),await:zn("custom"),bankTransfer:zn("custom"),sdk:zn("custom")};function Wy(t,e,n,a={}){const o=qy[n.type];if(o&&typeof o=="function")return o(t,e,n,a);throw new Error("Invalid Action")}function Gy(t,e){const n=`${Ot}/sessions/${e.id}/payments?clientKey=${e.clientKey}`,a=p({sessionData:e.data},t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal",errorCode:ln.makePayments},a)}function Yy(t,e){const n=`${Ot}/sessions/${e.id}/paymentDetails?clientKey=${e.clientKey}`,a=p(p({},e.data&&{sessionData:e.data}),t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal",errorCode:ln.submitPaymentDetails},a)}function Jy(t){const e=`${Ot}/sessions/${t.id}/donationCampaigns?clientKey=${t.clientKey}`,n=p({},t.data&&{sessionData:t.data});return Ge({loadingContext:t.loadingContext,path:e,errorLevel:"fatal",errorCode:ln.donationCampaigns},n)}function Qy(t,e){const n=`${Ot}/sessions/${e.id}/donations?clientKey=${e.clientKey}`,a=p(p({},e.data&&{sessionData:e.data}),t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal",errorCode:ln.donations},a)}function Zy(t,e){const n=`${Ot}/sessions/${t.id}/setup?clientKey=${t.clientKey}`,a=p({browserInfo:e.browserInfo,sessionData:t.data},e.order?{order:{orderData:e.order.orderData,pspReference:e.order.pspReference}}:{});return Ge({loadingContext:t.loadingContext,path:n,errorLevel:"fatal"},a)}function Xy(t,e){const n=`${Ot}/sessions/${e.id}/paymentMethodBalance?clientKey=${e.clientKey}`,a=p({sessionData:e.data},t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal"},a)}function em(t){const e=`${Ot}/sessions/${t.id}/orders?clientKey=${t.clientKey}`,n={sessionData:t.data};return Ge({loadingContext:t.loadingContext,path:e,errorLevel:"fatal",errorCode:ln.createOrder},n)}function tm(t){if(!t||!t.id)throw new z("IMPLEMENTATION_ERROR","Invalid session");const{shopperLocale:e,shopperEmail:n,telephoneNumber:a,id:o}=t;return p(p(p(p({id:o},t.sessionData?{sessionData:t.sessionData}:{}),e&&{shopperLocale:e}),n&&{shopperEmail:n}),a&&{telephoneNumber:a})}function nm(t,e){const n=`${Ot}/sessions/${e.id}/orders/cancel?clientKey=${e.clientKey}`,a={sessionData:e.data,order:t};return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal"},a)}function hn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class am{get shopperLocale(){return this.session.shopperLocale}get id(){return this.session.id}get data(){return this.session.sessionData}set sessionsDonationInitiated(e){this._sessionsDonationInitiated=e}get sessionsDonationInitiated(){return this._sessionsDonationInitiated}updateSessionData(e){this.session.sessionData=e,this.storeSession()}setupSession(e){const n=C(p({},e),{browserInfo:or()});return Zy(this,n).then(a=>(a.configuration&&(this.configuration=p({},a.configuration)),a.sessionData&&this.updateSessionData(a.sessionData),a))}submitPayment(e){return Gy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}submitDetails(e){return Yy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}fetchDonationCampaigns(){return Jy(this).then(e=>(e.sessionData&&this.updateSessionData(e.sessionData),e))}makeDonation(e){return Qy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}checkBalance(e){return Xy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}createOrder(){return em(this).then(e=>(e.sessionData&&this.updateSessionData(e.sessionData),e))}cancelOrder(e){return nm(e.order,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}getStoredSession(){const e=this.storage.get();return this.id===(e==null?void 0:e.id)?e:this.session}storeSession(){this.storage.set({id:this.session.id,sessionData:this.session.sessionData})}removeStoredSession(){this.storage.remove()}constructor(e,n,a){hn(this,"storage",void 0),hn(this,"session",void 0),hn(this,"clientKey",void 0),hn(this,"loadingContext",void 0),hn(this,"configuration",void 0),hn(this,"_sessionsDonationInitiated",void 0);const o=tm(e);if(!n)throw new Error("No clientKey available");if(!a)throw new Error("No loadingContext available");this.storage=new kd("session","localStorage"),this.clientKey=n,this.loadingContext=a,this.session=o,this._sessionsDonationInitiated=!1,this.session.sessionData?this.storeSession():this.session=this.getStoredSession()}}function Mr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let om=class{getImage(e={}){return this.getImageUrl(C(p({},e),{resourceContext:this.resourceContext}))}constructor(e){if(Mr(this,"resourceContext",void 0),Mr(this,"returnImage",({name:n,resourceContext:a,imageFolder:o="",parentFolder:r="",extension:i,size:s="",subFolder:d=""})=>`${a}images/${o}${d}${r}${n}${s}.${i}`),Mr(this,"getImageUrl",r=>{var i=r,{resourceContext:n,extension:a="svg"}=i,o=Ce(i,["resourceContext","extension"]);return s=>{const d=p({extension:a,resourceContext:n,imageFolder:"logos/",parentFolder:"",name:s},o);return this.returnImage(d)}}),!e)throw new z("IMPLEMENTATION_ERROR",'Resources module: "environmentsUrls.cdn" is not a valid URL');this.resourceContext=e}};function rm({setComponentRef:t}){const e=J({});Object.keys(e.current).length||(t==null||t(e.current));const[n,a]=N(null);return e.current.setMessages=o=>{a(o)},n?c(G,null,n.map(o=>c("div",{key:o,className:"adyen-checkout-sr-panel__msg"},o))):null}function St(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Lr extends Da{get enabled(){return this._enabled}get moveFocus(){return this._moveFocus}setAriaProps(e){if(!this.props.enabled)return;const n=document.querySelector('[class^="adyen-checkout-sr-panel"]');if(n){for(const[a,o]of Object.entries(e))n.setAttribute(a,o);this.props=C(p({},this.props),{ariaAttributes:p(p({},this.props.ariaAttributes),e)})}else console.error("SRPanel: Failed to set aria props because no panel was found")}render(){return this.props.enabled?c("div",p({className:this.showPanel?"adyen-checkout-sr-panel":"adyen-checkout-sr-panel--sr-only",role:"log"},this.props.ariaAttributes),c(rm,{setComponentRef:this.setComponentRef})):null}constructor(e,n){var a;if(super(e,n),St(this,"srPanelContainer",null),St(this,"id",void 0),St(this,"showPanel",void 0),St(this,"_enabled",void 0),St(this,"_moveFocus",void 0),St(this,"componentRef",void 0),St(this,"setComponentRef",o=>{this.componentRef=o}),St(this,"setMessages",o=>{if(!this.props.enabled)return;let r=null;o&&(r=Array.isArray(o)?o:[o]),this.componentRef.setMessages(r)}),this.id=this.props.id,this.showPanel=!1,this._enabled=!1,this._moveFocus=(a=this.props.moveFocus)!=null?a:!0,this.props.enabled){this._enabled=!0;const o=document.querySelector(this.props.node);if(!o)throw new Error("Component could not mount. Root node was not found.");{const r=document.getElementById(this.id);r&&o.removeChild(r),this.srPanelContainer=document.createElement("div"),this.srPanelContainer.className="sr-panel-holder",this.srPanelContainer.id=this.id,o.appendChild(this.srPanelContainer),this.mount(this.srPanelContainer)}}}}St(Lr,"type","srPanel"),St(Lr,"defaultProps",{enabled:!0,node:"body",showPanel:!1,id:"ariaLiveSRPanel",ariaAttributes:{"aria-relevant":"all","aria-live":"polite","aria-atomic":"true"}});function Td(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const im={[v.redirect]:Vn,[v.threeDS2Challenge]:br,[v.threeDS2DeviceFingerprint]:wr,[v.donation]:Tr};var Un=new class{add(...t){this.componentsMap=p(p({},this.componentsMap),this.createComponentsMap(t))}getComponent(t){return this.componentsMap[t]||(this.supportedTxVariants.has(t)?void 0:Vn)}createComponentsMap(t){return t.reduce((e,n)=>{var a;return typeof(a=n).type=="string"&&a.type?(n.type==="dropin"||[n.type,...n.txVariants].filter(o=>o).forEach(o=>{e=C(p({},e),{[o]:n})}),e):(console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),e)},{})}constructor(){Td(this,"componentsMap",im),Td(this,"supportedTxVariants",new Set(Object.values(v)))}};const sm={exposeLibraryMetadata:!0,showPayButton:!0};function Nd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class dm{async fetchTranslationsFromCdn(e){const n=this.matchLocaleWithCdnSupportedLocales(e);if(n==="en-US")return Ar;try{return await fs({loadingContext:this.cdnUrl,errorLevel:"fatal",errorMessage:`Translations: Failed to fetch translations for locale "${n}"`,path:`sdk/${this.sdkVersion}/translations/${n}.json`})}catch(a){return console.warn(`LanguageService - fetchTranslationsFromCdn(): Failed to fetch locale "${n}."`,a),Ar}}matchLocaleWithCdnSupportedLocales(e){return ss(e,Ko)||Sa}constructor({cdnUrl:e,sdkVersion:n}){Nd(this,"cdnUrl",void 0),Nd(this,"sdkVersion",void 0),this.cdnUrl=e,this.sdkVersion=n}}function je(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Pt{static setBundleType(e){Pt.metadata.bundleType=e}static register(...e){Un.add(...e)}register(...e){Un.add(...e)}getComponent(e){return Un.getComponent(e)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),this.createCoreModules(),this.assignLocaleToCore(),this.requestAnalyticsAttemptId(),await this.requestTranslations(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(e=>{const s=e,{amount:n,shopperLocale:a,countryCode:o,paymentMethods:r}=s,i=Ce(s,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(C(p({},i),{amount:this.options.order?this.options.order.remainingAmount:n,locale:this.options.locale||a,countryCode:this.options.countryCode||o})),this.createPaymentMethodsList(r),this}).catch(e=>(this.options.onError&&this.options.onError(e),Promise.reject(e))):(this.createPaymentMethodsList(),Promise.resolve(this))}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new z(No,"You must specify a countryCode when initializing checkout.")}submitDetails(e){var a,o;let n=null;this.options.onAdditionalDetails&&(n=new Promise((r,i)=>{this.options.onAdditionalDetails({data:e},void 0,{resolve:r,reject:i})})),this.session&&(n=this.session.submitDetails(e).catch(r=>{var i,s;return(s=(i=this.options).onError)==null||s.call(i,r),Promise.reject(r)})),n?n.then(ur).then(pr).then(this.afterAdditionalDetails).then(r=>{var i,s;Ia(r),(s=(i=this.options).onPaymentCompleted)==null||s.call(i,r)}).catch(r=>{var i,s;r instanceof Fa||(Ia(r),(s=(i=this.options).onPaymentFailed)==null||s.call(i,r))}):(o=(a=this.options).onError)==null||o.call(a,new z("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(e,n={}){if(!e||!e.type)throw Y(e,"action")&&Y(e,"resultCode")?new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?'):new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property');if(e.type){const a=e.type===ey?`${e.type}${e.subtype}`:e.paymentMethodType,o=new Ze({type:st.action,subType:Ze.getSubtypeFromActionType(e.type),message:`${a} action was handled by the SDK`,component:a});this.modules.analytics.sendAnalytics(o);const r=p(p({},this.getCorePropsForComponent()),n);return Wy(this,Un,e,r)}return this.handleCreateError()}update(e={},{shouldReinitializeCheckout:n=!0}={}){if(n)return this.setOptions(e),this.initialize().then(()=>(this.components.forEach(r=>{var s;const i=p(p(p({},(s=e.order)!=null&&s.remainingAmount?{amount:e.order.remainingAmount}:{amount:this.options.amount}),this.session&&{session:this.session}),e);r.update(i)}),this));const{amount:a,secondaryAmount:o}=e;return(a||o)&&this.triggerAmountUpdate(a,o),Promise.resolve(this)}triggerAmountUpdate(e,n){cr(e)?!n||cr(n)?(this.setOptions(p({amount:e},n&&{secondaryAmount:n})),this.components.forEach(a=>{a.updateAmount(e,n)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return C(p({},fy(this.options)),{core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction})}storeElementReference(e){e&&this.components.push(e)}handleCreateError(e){var a;const n=e?`${(a=e==null?void 0:e.name)!=null?a:"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(e)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(n)}createPaymentMethodsList(e){this.paymentMethodsResponse=new Hy(this.options.paymentMethodsResponse||e,this.options)}createCoreModules(){var e,n,a;this.modules||(this.modules=Object.freeze({risk:new Fr(this,C(p({},this.options),{loadingContext:this.loadingContext})),analytics:new Ty({eventQueue:new Ny,service:new Py({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:(e=this.options.analytics)==null?void 0:e.enabled,analyticsData:(n=this.options.analytics)==null?void 0:n.analyticsData}),resources:new om(this.cdnImagesUrl),i18n:new Ay({locale:this.options.locale,customTranslations:this.options.translations,service:new dm({cdnUrl:this.cdnTranslationsUrl,sdkVersion:Pt.metadata.version}),onError:(a=this.options)==null?void 0:a.onError}),srPanel:new Lr(this,p({},this.options.srConfig))}))}assignLocaleToCore(){this.options.locale=this.modules.i18n.locale}async requestTranslations(){try{await this.modules.i18n.requestTranslations()}catch(e){console.warn("Core - requestTranslations(): Something went wrong.",e)}}async requestAnalyticsAttemptId(){var e;await this.modules.analytics.setUp(p({locale:this.options.locale},((e=this.session)==null?void 0:e.id)&&{sessionId:this.session.id}))}constructor(e){var s,d,l;je(this,"session",void 0),je(this,"paymentMethodsResponse",void 0),je(this,"modules",void 0),je(this,"options",void 0),je(this,"analyticsContext",void 0),je(this,"loadingContext",void 0),je(this,"cdnImagesUrl",void 0),je(this,"cdnTranslationsUrl",void 0),je(this,"components",[]),je(this,"afterAdditionalDetails",h=>{if(this.options.afterAdditionalDetails&&(h!=null&&h.action)){const u=this.createFromAction(h.action);return this.options.afterAdditionalDetails(u),Promise.reject(new Fa("Handled by afterAdditionalDetails"))}return Promise.resolve(h)}),je(this,"remove",h=>(this.components=this.components.filter(u=>u._id!==h._id),h.unmount(),this)),je(this,"setOptions",h=>{var u,y;this.options=C(p(p({},this.options),h),{locale:(h==null?void 0:h.locale)||((u=this.options)==null?void 0:u.locale),environment:String.prototype.toLowerCase.apply((h==null?void 0:h.environment)||((y=this.options)==null?void 0:y.environment))})}),gy(e),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions(p(p({},sm),e));const{apiUrl:n,analyticsUrl:a,cdnImagesUrl:o,cdnTranslationsUrl:r}=_y(this.options.environment,this.options._environmentUrls);this.loadingContext=n,this.analyticsContext=a,this.cdnImagesUrl=o,this.cdnTranslationsUrl=r,this.session=this.options.session&&new am(this.options.session,this.options.clientKey,this.loadingContext);const i=(s=this.options.clientKey)==null?void 0:s.substring(0,4);if((i==="test"||i==="live")&&!this.loadingContext.includes(i))throw new z("IMPLEMENTATION_ERROR",`Error: you are using a ${i} clientKey against the ${((d=this.options._environmentUrls)==null?void 0:d.api)||this.options.environment} environment`);i==="pub."&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${(l=this.options.clientKey)==null?void 0:l.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=Pt.metadata)}}je(Pt,"metadata",{version:Zo,bundleType:ys}),je(Pt,"registry",Un);async function Br(t){return await new Pt(t).initialize()}Br.register=(...t)=>{Pt.register(...t)},Br.setBundleType=t=>{Pt.setBundleType(t)};const Vr="https://docs.adyen.com/online-payments/build-your-integration/payment-result-codes#final-state-result-codes",zr={refused:{resultCode:"Refused",advice:"Inform the shopper that their payment was refused and ask them to try the payment again, for example, by using a different payment method or card.",docs:Vr},cancelled:{resultCode:"Cancelled",advice:"Inform the shopper that their payment was cancelled and check if they want to continue with their order.",docs:Vr},error:{resultCode:"Error",advice:"Inform the shopper that there was an error processing their payment.",docs:Vr}},cm=3e3,lm=t=>t==null?void 0:t.resultCode;async function um(t){var S,w;const e={};let n=null,a=null,o=!1,r=()=>!1,i=!1,s=!1,d=!1,l=null;const h=k=>{var b;try{(b=e.card)==null||b.setStatus(k)}catch(_){}},u=()=>{n&&(clearTimeout(n),n=null),a&&(clearTimeout(a),a=null)},y=await Br({session:{id:t.session.id,sessionData:t.session.session_data},clientKey:t.clientKey,environment:t.environment,countryCode:t.countryCode,locale:t.locale,translations:t.translations,beforeSubmit:(k,b,_)=>{var g;u(),(g=t.onAttempt)==null||g.call(t),_.resolve(k)},onPaymentCompleted:k=>{u(),h("success");try{t.onCompleted(lm(k))}catch(b){setTimeout(()=>{throw b})}},onPaymentFailed:k=>{var _;if(k instanceof Error)return;u(),h("error"),a=window.setTimeout(()=>r(),0),n=setTimeout(()=>{r()||h("ready")},cm);const b=k==null?void 0:k.resultCode;t.onFailed((_=Object.keys(zr).find(g=>zr[g].resultCode===b))!=null?_:"refused")},onError:k=>{if(!i)return;const b=d&&l!==null&&t.container.contains(l);t.onError(k,b)}});if(i=!0,(S=t.isCancelled)!=null&&S.call(t))return{unmount:()=>{},hasFieldErrors:()=>!1,reset:()=>{}};y.options.locale&&(t.container.lang=y.options.locale);let m="",f=!1;const x=()=>{d=!1,f=!1,e.card=new Yt(y,C(p({showPayButton:!0,hasHolderName:!0,holderNameRequired:!0,styles:t.styles,disclaimerMessage:t.disclaimerMessage},m?{data:{holderName:m}}:{}),{onChange:k=>{var _;const b=k.data.paymentMethod.holderName;typeof b=="string"&&(m=b),f=Object.values((_=k.errors)!=null?_:{}).some(Boolean)},onConfigSuccess:()=>{var k;d=!0,s||(k=t.onReady)==null||k.call(t),s=!0}})),e.card.mount(t.container),l=t.container.lastElementChild};return r=()=>o||t.container.hasChildNodes()?!1:(x(),!0),x(),t.redirectResult&&(y.submitDetails({details:{redirectResult:t.redirectResult}}),(w=t.onRedirectResultSubmitted)==null||w.call(t)),{unmount:()=>{var k;o=!0,u();try{(k=e.card)==null||k.unmount()}catch(b){}},hasFieldErrors:()=>f,reset:()=>{var k;u(),d=!1,f=!1,(k=e.card)==null||k.update({}),l=t.container.lastElementChild}}}const pm=/^https:\/\/([a-z0-9-]+\.)?provetcloud\.com$/,jn=t=>t.replace(/\/+$/,""),hm=t=>pm.test(jn(t)),Pd=t=>hm(t)||jn(t)===jn("https://provetcloud.com"),ym=(t,e)=>{const n=Pd(e)?e:"https://provetcloud.com";return`${jn(n)}/${t}`},mm=()=>`${window.location.origin}${window.location.pathname}`,_m=()=>{var t;return(t=new URL(window.location.href).searchParams.get("redirectResult"))!=null?t:void 0},fm=()=>{var t;return(t=new URL(window.location.href).searchParams.get("sessionId"))!=null?t:void 0},Ua=new Set,gm=()=>{const t=_m();if(!(t===void 0||Ua.has(t)))return Ua.add(t),t},Ad=t=>{t!==void 0&&Ua.delete(t)},Dd=()=>{const t=new URL(window.location.href),e=t.searchParams.get("redirectResult");e!==null&&(t.searchParams.delete("redirectResult"),t.searchParams.delete("sessionId"),window.history.replaceState(window.history.state,"",t),Ua.delete(e))},Ur="/api/0.1/pay",bm=3,km=1e3,vm=3e5,xm=t=>new Promise(e=>setTimeout(e,t)),_t=t=>typeof t=="string",Id=t=>_t(t)&&t.length>0||Number.isInteger(t);function wm(t){var r,i;const e=t!=null?t:{},n=(r=e.session)!=null?r:{},a=(i=e.card)!=null?i:{},o=Object.entries({"card.id":Id(a.id),"session.id":_t(n.id),"session.session_data":_t(n.session_data),"session.expires_at":_t(n.expires_at),client_key:_t(e.client_key),country_code:_t(e.country_code)}).filter(([,s])=>!s).map(([s])=>s);if(o.length>0)throw new oe("session_error",`The checkout-sessions response is missing: ${o.join(", ")}.`,{cause:t});if(e.environment!=="test"&&e.environment!=="live")throw new oe("session_error",`The checkout-sessions response has an unknown environment "${String(e.environment)}".`,{cause:t});return{card:{id:String(a.id)},session:{id:String(n.id),session_data:String(n.session_data),expires_at:String(n.expires_at)},client_key:String(e.client_key),environment:e.environment,country_code:String(e.country_code)}}const Cm=t=>{const e={id:String(t.id)};return _t(t.brand)&&(e.brand=t.brand),_t(t.last4)&&(e.last4=t.last4),_t(t.expiration_date)&&(e.expiration_date=t.expiration_date),typeof t.default=="boolean"&&(e.default=t.default),e},Sm=t=>{if(!Array.isArray(t))throw new oe("session_error","The saved-cards response is not a list.",{cause:t});return t.map(e=>e!=null?e:{}).filter(e=>Id(e.id)).map(Cm)},jr=t=>new oe("network","The server did not answer in time.",{recoverable:!0,cause:t});async function Em(t,e){try{const n=await t.json();if(_t(n==null?void 0:n.message))return String(n==null?void 0:n.message);if(_t(n==null?void 0:n.detail))return String(n==null?void 0:n.detail);if(n&&typeof n=="object"){const a=Object.entries(n).map(([o,r])=>`${o}: ${[].concat(r).join(" ")}`);if(a.length>0)return a.join(" | ")}}catch(n){if(e.aborted)throw jr(n)}return`The server responded with HTTP ${t.status}.`}class Tm{constructor(e,n){this.baseUrl=e,this.getToken=n}createCheckoutSession(e){return this.request(`${Ur}/checkout-sessions/`,{method:"POST",body:JSON.stringify(e)}).then(wm)}deleteSavedCard(e){return this.request(`${Ur}/saved-cards/${encodeURIComponent(e)}/`,{method:"DELETE"}).then(()=>{})}getSavedCards(){return this.request(`${Ur}/saved-cards/`,{method:"GET"}).then(Sm)}async request(e,n){for(let a=0;;a++){let o;const r=new AbortController,i=setTimeout(()=>r.abort(),vm);try{try{o=await fetch(`${this.baseUrl}${e}`,C(p({},n),{signal:r.signal,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`}}))}catch(s){throw r.signal.aborted?jr(s):new oe("network","Could not reach the server.",{recoverable:!0,cause:s})}if(o.status===204)return null;if(o.ok)try{return await o.json()}catch(s){throw r.signal.aborted?jr(s):new oe("session_error","The server did not return valid JSON.",{cause:s})}if(o.status===401)throw new oe("auth_error","The card tokenization token has expired.",{recoverable:!0,cause:{status:401}});if(o.status===403)throw new oe("auth_forbidden","The card tokenization token is not allowed to use the card component.",{cause:{status:403}});if(o.status>=500&&a<bm){await xm(km);continue}throw new oe("session_error",await Em(o,r.signal),{recoverable:o.status>=500,cause:{status:o.status}})}finally{clearTimeout(i)}}}}const Kn=t=>JSON.stringify([jn(t.provetOrigin),String(t.provetId),String(t.clientId),String(t.departmentId)]),ja=t=>`provet-pay-elements.envelope:${Kn(t)}`,$d=(t,e)=>t.recurringModel===e.recurringModel&&t.returnUrl===e.returnUrl,Kr=t=>typeof t=="string"||typeof t=="number",Nm=t=>{const e=t!=null?t:{};return typeof e.provetOrigin=="string"&&Kr(e.provetId)&&Kr(e.clientId)&&Kr(e.departmentId)&&(e.recurringModel==="subscription"||e.recurringModel==="one-off")&&typeof e.returnUrl=="string"},Hr=()=>{try{return window.sessionStorage}catch(t){return null}};function Rd(t,e){return{owner:t,session:e.session,card:e.card,adyen:{client_key:e.client_key,environment:e.environment,country_code:e.country_code}}}function Pm(t,e,n){var a;try{(a=Hr())==null||a.setItem(t,JSON.stringify(Rd(e,n)))}catch(o){}}const Am=(t,e)=>{var n;try{const a=t.getItem(e);return a?(n=JSON.parse(a).session)==null?void 0:n.id:void 0}catch(a){return}};function Hn(t,e){try{const n=Hr();if(!n||e!==void 0&&Am(n,t)!==e)return;n.removeItem(t)}catch(n){}}function Fd(t,e){var s,d,l,h,u,y,m;const n=Hr();if(!n)return null;let a;try{const f=n.getItem(t);a=f?JSON.parse(f):null}catch(f){return Hn(t),null}if(!a)return null;const o=Date.parse((d=(s=a.session)==null?void 0:s.expires_at)!=null?d:""),r=typeof((l=a.session)==null?void 0:l.id)=="string"&&typeof((h=a.session)==null?void 0:h.session_data)=="string"&&typeof((u=a.card)==null?void 0:u.id)=="string"&&a.card.id.length>0&&typeof((y=a.adyen)==null?void 0:y.client_key)=="string"&&typeof((m=a.adyen)==null?void 0:m.country_code)=="string"&&(a.adyen.environment==="test"||a.adyen.environment==="live"),i=Nm(a.owner)&&Kn(a.owner)===Kn(e);return!r||!i||Number.isNaN(o)||o<=Date.now()?(Hn(t),null):a}const qn=new Map,Dm=(t,e)=>{const n=Kn(t),a=JSON.stringify([n,t.recurringModel,t.returnUrl]),o=qn.get(a);if(o&&!o.dropped)return o.response;const r={identity:n,dropped:!1};return r.response=e().then(i=>(r.dropped||Pm(ja(t),t,i),i)).finally(()=>{qn.get(a)===r&&qn.delete(a)}),qn.set(a,r),r.response},Od=(t,e)=>{const n=Kn(t);qn.forEach(a=>{a.identity===n&&(a.dropped=!0)}),Hn(ja(t),e)},Im={colorAccent:"--pp-color-accent",colorButton:"--pp-color-pay-button",colorText:"--pp-color-text",colorBorder:"--pp-color-border",colorSurface:"--pp-color-surface",colorError:"--pp-color-error",borderRadius:"--pp-border-radius",fontFamily:"--pp-font-family"},qr=t=>typeof t=="string"&&t.length>0&&!t.trim().startsWith("var("),$m=t=>{const e=getComputedStyle(t),n=a=>e.getPropertyValue(a).trim()||void 0;return{text:n("--pp-color-text"),textWeaker:n("--pp-color-text-weaker"),textDanger:n("--pp-color-error")}};function Md(t,e,n={}){var l;const a=(l=t==null?void 0:t.variables)!=null?l:{},o={};for(const[h,u]of Object.entries(Im)){const y=a[h];y!==void 0&&(o[u]=y)}Object.assign(o,t==null?void 0:t.cssVariables);const r={},i={},s={},d={};return n.text&&(r.color=n.text),n.textWeaker&&(s.color=n.textWeaker),n.textDanger&&(i.color=n.textDanger),qr(a.colorText)&&(r.color=a.colorText),qr(a.fontFamily)&&(r.fontFamily=a.fontFamily),qr(a.colorError)&&(i.color=a.colorError),Object.assign(r,e==null?void 0:e.base),Object.assign(i,e==null?void 0:e.error),Object.assign(s,e==null?void 0:e.placeholder),Object.assign(d,e==null?void 0:e.validated),{cssVariables:o,styles:{base:r,error:i,placeholder:s,validated:d}}}function Rm(t,e,n){for(const[a,o]of Object.entries(Md(e).cssVariables))t.style.setProperty(a,o);return Md(e,n,$m(t))}function Fm(t){const e=document.createElement("div");return e.className="pp-loading",e.setAttribute("data-provet-pay-elements-loader",""),e.setAttribute("role","status"),e.setAttribute("aria-label",t),e.appendChild(document.createElement("span")),e}function Ld(t,e,n){const a=document.createElement("p");return a.className=`pp-message pp-message-${e}`,a.setAttribute("role","alert"),a.setAttribute("data-provet-pay-elements-message",e),n&&a.setAttribute("data-provet-pay-elements-error",n),a.textContent=t,a}const Om={visa:"Visa",mc:"Mastercard",amex:"American Express",maestro:"Maestro",discover:"Discover",diners:"Diners Club",jcb:"JCB",cup:"UnionPay"},Mm=t=>{var e;return t?(e=Om[t.toLowerCase()])!=null?e:t.charAt(0).toUpperCase()+t.slice(1):""},Bd=t=>{const e=/^(\d{4})-(\d{2})/.exec(t!=null?t:"");return e?{year:Number(e[1]),month:Number(e[2])}:null},Lm=t=>{const e=Bd(t);return e?`${e.month}/${e.year}`:""},Bm=(t,e=new Date)=>{const n=Bd(t);return n?new Date(n.year,n.month,1)<=e:!1},Vm=(t,e)=>{const n=t.last4?`•••• ${t.last4}`:e("provetPay.savedCards.noNumber"),a=Mm(t.brand);return a?`${a} ${n}`:n};function Vd(t,e){const n=document.createElement("span");n.className="pp-card";const a=document.createElement("span");a.className="pp-card-label",a.textContent=Vm(t,e),n.appendChild(a);const o=Lm(t.expiration_date);if(o){const r=document.createElement("span");r.className=Bm(t.expiration_date)?"pp-card-expiry pp-card-expired":"pp-card-expiry",r.textContent=e("provetPay.savedCards.expiry",{values:{date:o}}),n.appendChild(r)}return n}const zd="http://www.w3.org/2000/svg",Ud={chevron:"m14.0864 12.0402 1.8138 1.8137-4.7724 4.7724c-.2573.2573-.5789.373-.9133.373-.33447 0-.65606-.1286-.91333-.373l-4.77238-4.7724 1.81377-1.8137 3.85904 3.859 3.8591-3.859zm-3.859-7.93687 3.859 3.85907 1.8138-1.81376-4.7724-4.77238c-.5017-.50168-1.31208-.50168-1.81376 0l-4.77238 4.77238 1.81376 1.81376 3.85908-3.85907z",check:"m18.9985 5.35769-9.8419 10.83221c-.27855.3095-.68088.4952-1.11417.5107h-.03095c-.41782 0-.80469-.1548-1.0987-.4488l-5.91132-5.9113 2.18193-2.1819 4.76619 4.7662 8.75862-9.62524 2.2903 2.08908z"},jd="12",Kd=(t,e)=>{const n=document.createElementNS(zd,"svg");e&&n.setAttribute("class",e),n.setAttribute("viewBox","0 0 20 20"),n.setAttribute("width",jd),n.setAttribute("height",jd),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");const a=document.createElementNS(zd,"path");return a.setAttribute("d",t),n.appendChild(a),n};let zm=0;function Um(t,e,n,a){const o=document.createElement("div");o.className="pp-stack pp-saved-cards",o.setAttribute("data-provet-pay-elements-saved-cards","");const r=document.createElement("h2");r.className="pp-heading",r.textContent=n("provetPay.savedCards.heading");const i=`pp-saved-cards-${++zm}`,s=document.createElement("div");s.className="pp-dropdown";const d=document.createElement("button");d.type="button",d.className="pp-button pp-dropdown-trigger",d.setAttribute("aria-haspopup","listbox"),d.setAttribute("aria-expanded","false"),d.setAttribute("aria-controls",i),d.setAttribute("data-provet-pay-elements-saved-cards-trigger","");const l=document.createElement("span");l.className="pp-dropdown-value",d.append(l,Kd(Ud.chevron,"pp-dropdown-chevron"));const h=new Map,u=T=>{if(l.replaceChildren(),T)l.appendChild(Vd(T,n)),d.setAttribute("data-provet-pay-elements-selected-card",T.id);else{const E=t.length;l.textContent=n("provetPay.savedCards.choose",{count:E,values:{count:String(E)}}),d.removeAttribute("data-provet-pay-elements-selected-card")}h.forEach((E,P)=>{E.setAttribute("aria-selected",String(P===T))})},y=document.createElement("div");y.className="pp-dropdown-popout",y.id=i,y.hidden=!0;const m=document.createElement("ul");m.className="pp-list",m.setAttribute("role","listbox"),m.setAttribute("aria-label",n("provetPay.savedCards.list"));const f=[];for(const T of t){const E=document.createElement("li");E.setAttribute("role","none"),E.className="pp-dropdown-row";const P=document.createElement("button");P.type="button",P.className="pp-dropdown-option",P.setAttribute("role","option"),P.setAttribute("aria-selected","false"),P.setAttribute("data-provet-pay-elements-saved-card",T.id),P.append(Vd(T,n),Kd(Ud.check,"pp-check")),P.addEventListener("click",()=>{u(T),g(!0),e.onPick(T)}),h.set(T,P),f.push(P),E.appendChild(P),m.appendChild(E)}const x=document.createElement("hr");x.className="pp-dropdown-divider";const S=document.createElement("button");S.type="button",S.className="pp-dropdown-option pp-dropdown-new",S.setAttribute("data-provet-pay-elements-new-card","");const w=document.createElement("span");w.setAttribute("aria-hidden","true"),w.textContent="+ ";const k=document.createElement("span");k.append(w,n("provetPay.savedCards.addNew")),S.appendChild(k),S.addEventListener("click",()=>{g(),e.onUseNewCard()}),f.push(S),y.append(m,x,S),s.append(d,y),o.append(r,s),u(null);let b=null;const _=()=>{var T;y.hidden=!1,d.setAttribute("aria-expanded","true"),(T=f[0])==null||T.focus(),b=new AbortController,document.addEventListener("pointerdown",E=>{(!o.isConnected||!o.contains(E.target))&&g()},{signal:b.signal}),a.addEventListener("abort",()=>g(),{signal:b.signal})},g=(T=!1)=>{y.hidden=!0,d.setAttribute("aria-expanded","false"),b==null||b.abort(),b=null,T&&d.focus()};return d.addEventListener("click",()=>{y.hidden?_():g()}),y.addEventListener("keydown",T=>{var P,A,I,U;const E=f.indexOf(document.activeElement);switch(T.key){case"Escape":T.preventDefault(),g(!0);return;case"ArrowDown":T.preventDefault(),(P=f[Math.min(E+1,f.length-1)])==null||P.focus();return;case"ArrowUp":T.preventDefault(),(A=f[Math.max(E-1,0)])==null||A.focus();return;case"Home":T.preventDefault(),(I=f[0])==null||I.focus();return;case"End":T.preventDefault(),(U=f[f.length-1])==null||U.focus();return}}),o}const Hd="http://www.w3.org/2000/svg",qd="56",Wd=(t,e)=>{const n=document.createElementNS(Hd,"path");return n.setAttribute("class",t),n.setAttribute("d",e),n.setAttribute("pathLength","1"),n},jm=t=>{const e=document.createElement("div");e.className="pp-success",e.setAttribute("role","status"),e.setAttribute("tabindex","-1"),e.setAttribute("data-provet-pay-elements-success","");const n=document.createElementNS(Hd,"svg");n.setAttribute("viewBox","0 0 52 52"),n.setAttribute("width",qd),n.setAttribute("height",qd),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),n.append(Wd("pp-success-circle","M26 2a24 24 0 1 1 0 48a24 24 0 1 1 0-48"),Wd("pp-success-check","M15 27l7 7 15-15"));const a=document.createElement("p");return a.className="pp-success-text",a.textContent=t,e.append(n,a),e};class Km{constructor(e,n,a){ee(this,"fieldsHost");ee(this,"slot");ee(this,"lifetime",new AbortController);this.handlers=n,this.t=a,this.slot=document.createElement("div"),this.slot.className="pp-stack",this.fieldsHost=document.createElement("div"),this.fieldsHost.setAttribute("data-provet-pay-elements-fields",""),this.fieldsHost.hidden=!0,e.append(this.slot,this.fieldsHost)}render(e){const n=this.fieldsHost.contains(document.activeElement);switch(this.slot.replaceChildren(),this.fieldsHost.hidden=e.name!=="card",e.name){case"loading":this.slot.appendChild(Fm(this.t("provetPay.loading")));return;case"saved-cards":this.slot.appendChild(Um(e.cards,this.handlers,this.t,this.lifetime.signal));return;case"card":e.failure&&this.slot.appendChild(Ld(this.t(`provetPay.notices.${e.failure}`),"danger"));return;case"success":{const a=jm(this.t("provetPay.cardSaved"));this.slot.appendChild(a),n&&a.focus();return}case"error":{const a=e.code==="session_expired"?"session_error":e.code;this.slot.appendChild(Ld(this.t(`provetPay.errors.${a}`),"danger",a));return}}}unmount(){this.lifetime.abort()}}const Hm=6e4,qm=t=>new Promise((e,n)=>{const a=setTimeout(()=>n(new oe("auth_error","auth.refreshToken did not answer in time.")),Hm);t.then(e,n).finally(()=>clearTimeout(a))});class Wm{constructor(e,n,a,o){ee(this,"chrome");ee(this,"client");ee(this,"appearance");ee(this,"storeKey");ee(this,"token");ee(this,"mounted",null);ee(this,"attempt",0);ee(this,"offered",[]);ee(this,"finished",!1);ee(this,"ready",!1);ee(this,"paying",!1);ee(this,"closed",!1);ee(this,"showsFailure",!1);ee(this,"redirectClaim");this.handlers=n,this.init=a,this.token=a.token,this.storeKey=ja(a),this.client=new Tm(ym(a.provetId,a.provetOrigin),()=>this.token),this.chrome=new Km(e,{onPick:r=>this.pick(r),onUseNewCard:()=>{this.guard(()=>this.useNewCard())},onRemove:r=>{this.guard(()=>this.removeCard(r))}},o.t),this.appearance=Rm(e,a.appearance,a.styles)}run(){return this.chrome.render({name:"loading"}),this.guard(()=>this.resume())}goBack(){var e,n;return(this.showsFailure||(e=this.mounted)!=null&&e.hasFieldErrors())&&(this.showsFailure=!1,(n=this.mounted)==null||n.reset()),this.chrome.render({name:"loading"}),this.guard(()=>this.offerSavedCards(this.offered))}unmount(){var e;this.finished=!0,Ad(this.redirectClaim),this.chrome.unmount(),(e=this.mounted)==null||e.unmount(),this.mounted=null}get idle(){return!this.finished&&!this.paying&&!this.closed}owner(){var e;return{provetOrigin:this.init.provetOrigin,provetId:this.init.provetId,clientId:this.init.clientId,departmentId:this.init.departmentId,recurringModel:(e=this.init.recurringModel)!=null?e:"subscription",returnUrl:mm()}}fittingSession(e=this.owner()){const n=Fd(this.storeKey,e);return n&&$d(n.owner,e)?n:null}async resume(){const e=this.owner(),n=Fd(this.storeKey,e),a=fm(),o=n!==null&&(a===void 0||a===n.session.id);this.redirectClaim=o?gm():void 0;const r=this.redirectClaim;if(n&&(r!==void 0||$d(n.owner,e)))return this.offered=await this.loadSavedCards().catch(i=>{if(i instanceof oe&&(i.code==="auth_error"||i.code==="auth_forbidden"))throw i;return[]}),this.finished?void 0:this.mount(n.session,n.adyen,n.card,!0,r);await this.offerSavedCards()}loadSavedCards(){return this.withAuthRetry(()=>this.client.getSavedCards())}async offerSavedCards(e){const n=await this.loadSavedCards().catch(a=>{if(!e)throw a;return e});if(!this.finished){if(this.offered=n,n.length===0)return this.useNewCard();this.showOffer(n)}}pick(e){var n;this.attempt++,(n=this.mounted)==null||n.unmount(),this.mounted=null,Od(this.init),this.handlers.onSuccess(e)}showOffer(e){this.chrome.render({name:"saved-cards",cards:e}),this.handlers.onBackAvailable(!1),this.markReady()}showCard(e){this.showsFailure=e!==void 0,this.chrome.render({name:"card",failure:e}),this.handlers.onBackAvailable(this.offered.length>0)}showSuccess(){this.chrome.render({name:"success"}),this.handlers.onBackAvailable(!1)}async useNewCard(){if(this.mounted&&this.fittingSession())return this.showCard();await this.startIntent()}async removeCard(e){this.chrome.render({name:"loading"}),await this.withAuthRetry(()=>this.client.deleteSavedCard(e.id)),await this.offerSavedCards()}async startIntent(){this.chrome.render({name:"loading"});const e=await this.withAuthRetry(()=>this.openSession());this.finished||await this.mount(e.session,e.adyen,e.card,e.resumed)}async openSession(){const e=this.owner(),n=this.fittingSession(e);if(n)return C(p({},n),{resumed:!0});const a=await Dm(e,()=>this.client.createCheckoutSession({department:this.init.departmentId,recurring_model:e.recurringModel,return_url:e.returnUrl}));return C(p({},Rd(e,a)),{resumed:!1})}async mount(e,n,a,o,r){var s;(s=this.mounted)==null||s.unmount();const i=++this.attempt;this.paying=!!r;try{const d=await um({container:this.chrome.fieldsHost,session:e,clientKey:n.client_key,environment:n.environment,countryCode:n.country_code,locale:this.init.locale,translations:this.init.translations,styles:this.appearance.styles,disclaimerMessage:this.init.disclaimerMessage,onCompleted:l=>{i===this.attempt&&(this.finished=!0,Od(this.init,e.id),this.showSuccess(),this.handlers.onSuccess(a,l))},onAttempt:()=>{this.finished||i!==this.attempt||(this.paying=!0,this.showCard(),this.handlers.onBackAvailable(!1))},onFailed:l=>{this.finished||i!==this.attempt||(this.paying=!1,this.showCard(l),this.handlers.onRefused(zr[l].resultCode))},onError:(l,h)=>{if(i!==this.attempt)return;const u=Ga(l);if(u.code==="attempts_exceeded"&&(Hn(this.storeKey,e.id),this.closed=!0),!this.finished){if(this.paying=!1,!h||u.code==="attempts_exceeded")return this.fail(u);this.showCard("error"),this.handlers.onError(u.surfaced)}},onReady:()=>{!this.finished&&i===this.attempt&&this.markReady()},redirectResult:r,onRedirectResultSubmitted:()=>{Dd(),this.redirectClaim=void 0},isCancelled:()=>this.finished||i!==this.attempt});if(this.finished||i!==this.attempt){d.unmount();return}this.mounted=d,r||this.showCard()}catch(d){if(this.finished||i!==this.attempt)return;throw this.paying=!1,o?(Hn(this.storeKey,e.id),r&&Dd(),new oe("session_expired","The card session is no longer usable.",{recoverable:!0,cause:d})):Ga(d)}}async withAuthRetry(e){try{return await e()}catch(n){const{onAuthExpired:a}=this.handlers;if(this.finished||!(n instanceof oe)||n.code!=="auth_error"||!a||(this.token=await qm(a()),this.finished))throw n;return e()}}async guard(e){try{await e()}catch(n){const a=this.toPayError(n);if(a.code!=="session_expired")return this.fail(a);try{await this.useNewCard()}catch(o){this.fail(this.toPayError(o))}}}toPayError(e){return e instanceof oe?e:Ga(e)}markReady(){this.ready||(this.ready=!0,this.handlers.onReady())}fail(e){this.finished||(Ad(this.redirectClaim),this.redirectClaim=void 0,this.showsFailure=!0,this.chrome.render({name:"error",code:e.code}),this.handlers.onError(e.surfaced))}}const Wr={"provetPay.backToSavedCards":"Back to saved cards","provetPay.cardSaved":"Card saved","provetPay.errors.attempts_exceeded":"This card form had too many attempts. Try again later, or use another card.","provetPay.errors.auth_error":"The card form is not available right now. Reload the page and try again.","provetPay.errors.auth_forbidden":"The card form is not available right now. Reload the page and try again.","provetPay.errors.cancelled":"The card setup was cancelled.","provetPay.errors.config_invalid":"Something went wrong while setting up the card.","provetPay.errors.network":"Could not reach the server. Check your connection and try again.","provetPay.errors.session_error":"The card form could not be opened. Try again later.","provetPay.errors.technical":"Something went wrong while setting up the card.","provetPay.loading":"Loading the card form","provetPay.notices.cancelled":"The card check was cancelled. Try again.","provetPay.notices.error":"Something went wrong while checking the card. Try again, or use another card.","provetPay.notices.refused":"The card was declined. Try another card.","provetPay.savedCards.addNew":"Add a new card","provetPay.savedCards.choose":"Choose your saved card","provetPay.savedCards.choose__plural":"Choose one of your %{count} saved cards","provetPay.savedCards.expiry":"(EXP: %{date})","provetPay.savedCards.heading":"Use a saved card","provetPay.savedCards.list":"Saved cards","provetPay.savedCards.noNumber":"Saved card","provetPay.savedCards.remove":"Remove %{card}","provetPay.savedCards.removeCancel":"Cancel","provetPay.savedCards.removeConfirm":"Remove","provetPay.savedCards.removeQuestion":"Remove this saved card?"},Jt="en-GB",Gm=Object.freeze(p({},Wr)),Gr=new Map([[Jt,Wr]]),Ka=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Yr=t=>t.toLowerCase().substring(0,2),Gd=t=>t.length>=2&&t.length<=5,Yd=(t,e)=>e.find(n=>Yr(n)===Yr(t)),Jd=t=>{const e=t.replace("_","-");if(/^[a-z]{2}-[A-Z]{2}$/.test(e))return e;const[n,a]=e.split("-");if(!n||!a)return;const o=`${n.toLowerCase()}-${a.toUpperCase()}`;return o.length===5?o:void 0},Ym=(t,e)=>{var a;if(!Gd(t))return Jt;const n=Jd(t);return n&&e.includes(n)?n:(a=Yd(n!=null?n:t,e))!=null?a:Jt},Jm=t=>{var n;const e={};for(const[a,o]of Object.entries(t))Gd(a)&&(e[(n=Jd(a))!=null?n:Yr(a)]=o);return e},Qd=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Qm=(t,e,{values:n={},count:a=0}={})=>{const o=[`${e}__${a}`,...a>1?[`${e}__plural`]:[],e].find(r=>Qd(t,r));return o===void 0?e:t[o].replace(/%{(\w+)}/g,(r,i)=>Qd(n,i)&&n[i]||"")},Zm="provetPay.",Xm=t=>Ka(t)&&Object.keys(t).some(e=>e.startsWith(Zm)),e_=t=>Object.fromEntries(Object.entries(Ka(t)?t:{}).filter(e=>typeof e[1]=="string")),t_=(t,e)=>{var h,u;const n=Jm(e!=null?e:{}),a=Array.from(Gr.keys()),o=Object.keys(n).filter(y=>Xm(n[y])),r=Array.from(new Set([...a,...o])).sort((y,m)=>y.localeCompare(m)),i=Ym(t!=null?t:Jt,r),s=(u=Gr.get(i))!=null?u:Gr.get((h=Yd(i,a))!=null?h:Jt),d=p(p(p({},Wr),s),e_(n[i]));return{locale:i,t:(y,m)=>Qm(d,y,m)}};function n_(t){const e=typeof t=="string"?document.querySelector(t):t;if(!(e instanceof HTMLElement))throw new oe("config_invalid",typeof t=="string"?`No element matches the container selector "${t}".`:"The container option must be an HTMLElement or a selector string.");return e}const Wn={container:"provet-pay-elements",back:"provet-pay-elements-back",root:"pp-root"},Jr="provet-pay-elements-style",Zd=[se,Ee,ut].join(`
7
- `),a_=()=>{if(document.getElementById(Jr))return;const t=document.createElement("meta");if(t.id=Jr,typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in document){const n=new CSSStyleSheet;n.replaceSync(Zd),document.adoptedStyleSheets=[...document.adoptedStyleSheets,n],document.head.appendChild(t);return}const e=document.createElement("style");e.id=Jr,e.textContent=Zd,document.head.appendChild(e)},o_=["token","provetId","clientId","departmentId"],r_=t=>t==null||t==="",Xe=t=>new oe("config_invalid",t),i_=t=>(typeof t=="string"||typeof t=="number")&&/^\d{1,10}$/.test(String(t)),s_=t=>{if(!t||typeof t!="object")throw Xe("The auth option is required.");for(const e of o_)if(r_(t[e]))throw Xe(`The auth.${e} option is required.`);if(typeof t.token!="string")throw Xe("The auth.token option must be a string.");if(!i_(t.clientId))throw Xe("The auth.clientId option must be the Provet client id in the token's audience, for example 2624.");if(t.provetOrigin!==void 0&&(typeof t.provetOrigin!="string"||!Pd(t.provetOrigin)))throw Xe("The auth.provetOrigin option must be a Provet instance, for example https://us.provetcloud.com.");if(t.refreshToken!==void 0&&typeof t.refreshToken!="function")throw Xe("The auth.refreshToken option must be a function.")},Xd=t=>{if(t!=null&&typeof t!="string")throw Xe("The locale option must be a string, for example fi-FI.")},ec=t=>t!=null&&t.length?t:Jt,d_=(t,e)=>{let n=t.locale;return Reflect.defineProperty(t,"locale",{configurable:!0,enumerable:!0,get:()=>n,set:a=>{e(a),n=a}}),()=>Reflect.defineProperty(t,"locale",{configurable:!0,enumerable:!0,writable:!0,value:n})},c_=t=>{if(t!=null){if(!Ka(t))throw Xe("The translations option must be an object keyed by locale.");for(const[e,n]of Object.entries(t))if(!Ka(n))throw Xe(`The translations.${e} option must be an object.`)}},l_=t=>async()=>{let e;try{e=await t()}catch(n){throw new oe("auth_error",n instanceof Error&&n.message?n.message:"auth.refreshToken failed.",{cause:n})}if(typeof e!="string"||e.length===0)throw new oe("auth_error","auth.refreshToken must resolve to a non-empty string.");return e},Ha=new WeakMap,tc="The container already holds the card form. Call unmount() on it first.";class nc{constructor(e,n){ee(this,"container");ee(this,"locale");ee(this,"identity");ee(this,"root");ee(this,"back");ee(this,"i18n");ee(this,"controller",null);var o;this.options=n;const{auth:a}=n;if(s_(a),typeof n.onSuccess!="function")throw Xe("The onSuccess callback is required.");Xd(n.locale),c_(n.translations),this.locale=ec(n.locale),this.i18n=t_(n.locale,n.translations),this.identity=ja({provetOrigin:(o=a.provetOrigin)!=null?o:"https://provetcloud.com",provetId:a.provetId,clientId:a.clientId,departmentId:a.departmentId}),this.container=n_(e),this.claimContainer(),this.back=this.createBack(),this.root=document.createElement("div"),this.root.className=Wn.root,this.root.lang=this.i18n.locale,a_(),this.container.classList.add(Wn.container),this.container.append(this.back,this.root),Ha.set(this.container,this),this.start()}unmount(){var e;(e=this.controller)==null||e.unmount(),this.controller=null,Ha.get(this.container)===this&&(Ha.delete(this.container),this.container.classList.remove(Wn.container)),this.back.remove(),this.root.remove()}claimContainer(){const e=Ha.get(this.container);if(e)throw e.identity===this.identity?Xe(tc):(e.unmount(),Xe("The container held the card form for another shopper, so both forms were stopped. Call unmount() before mounting for another shopper."));if(Array.from(this.container.children).some(n=>n.classList.contains(Wn.root)))throw Xe(tc)}get idle(){var e,n;return(n=(e=this.controller)==null?void 0:e.idle)!=null?n:!1}createBack(){const e=document.createElement("button");e.type="button",e.className=Wn.back,e.hidden=!0,e.lang=this.i18n.locale;const n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent="‹",e.append(n,this.i18n.t("provetPay.backToSavedCards")),e.addEventListener("click",()=>{var a;e.hidden=!0,(a=this.controller)==null||a.goBack()}),e}start(){var a,o;const{auth:e}=this.options,n={token:e.token,provetOrigin:(a=e.provetOrigin)!=null?a:"https://provetcloud.com",provetId:e.provetId,clientId:e.clientId,departmentId:e.departmentId,recurringModel:this.options.recurringModel,locale:this.locale,translations:(o=this.options.translations)!=null?o:void 0,appearance:this.options.appearance,styles:this.options.styles,disclaimerMessage:this.options.disclaimerMessage};this.controller=new Wm(this.root,this.handlers(),n,this.i18n),this.controller.run()}handlers(){const{refreshToken:e}=this.options.auth;return{onReady:()=>{var n,a;return(a=(n=this.options).onReady)==null?void 0:a.call(n)},onSuccess:(n,a)=>this.options.onSuccess(a?{card:n,resultCode:a}:{card:n}),onRefused:n=>{var a,o;return(o=(a=this.options).onRefused)==null?void 0:o.call(a,{resultCode:n})},onError:n=>{var a,o;return(o=(a=this.options).onError)==null?void 0:o.call(a,n)},onAuthExpired:e?l_(e):void 0,onBackAvailable:n=>{this.back.hidden=!n}}}}function u_(t,e){let n=new nc(t,e);const a=r=>{Xd(r),!(!n.idle||ec(r)===n.locale)&&(n.unmount(),n=new nc(n.container,C(p({},e),{locale:r})))},o=d_(e,a);return{unmount:()=>{n.unmount(),o()},changeLocale:a}}const p_="0.18.0";X.DEFAULT_LOCALE=Jt,X.DEFAULT_TRANSLATIONS=Gm,X.VERSION=p_,X.mount=u_,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
6
+ It will not be possible to mount a Donation component.`);return i}async callSessionsDonations(e,n){var a,o,r;try{const i=await this.makeSessionDonationsCall(e);i.resultCode==="Authorised"?(n.setStatus("success"),(a=this.onDonationCompleted)==null||a.call(this,{didDonate:!0})):(n.setStatus("error"),(o=this.onDonationFailed)==null||o.call(this,i.resultCode))}catch(i){n.setStatus("error"),(r=this.onDonationFailed)==null||r.call(this,i)}}async makeSessionsDonationCampaignsCall(){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.fetchDonationCampaigns()}async makeSessionDonationsCall(e){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.makeDonation(e)}constructor(e,n){var a,o,r,i;un(this,"core",void 0),un(this,"commercialTxAmount",0),un(this,"onDonationCompleted",void 0),un(this,"onDonationFailed",void 0),un(this,"delayMS",void 0),this.core=e,this.onDonationCompleted=(a=e.options.donation)==null?void 0:a.onDonationSuccess,this.onDonationFailed=(o=e.options.donation)==null?void 0:o.onDonationFailure,this.commercialTxAmount=n.commercialTxAmount,this.delayMS=(i=(r=e.options.donation)==null?void 0:r.delay)!=null?i:3e3}};un(bd,"type","donationCampaignService");function Er(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Tr=class Yn extends Gt{static isServiceMode(e){return"rootNode"in e&&!!e.rootNode}async initialiseServiceMode(e,n){var a,o;if(e.session)if(e.session.sessionsDonationInitiated)console.error(Cy);else{e.session.sessionsDonationInitiated=!0;try{const r=await new bd(e,n).initialise();r&&(this.props=p(p({},this.props),r),this.mount(n.rootNode))}catch(r){(o=(a=e.options.donation)==null?void 0:a.onDonationFailure)==null||o.call(a,r)}}}get data(){return this.state.data}get isValid(){return this.state.isValid}setState(e){this.state=p(p({},this.state),e)}donate(){const e=new Ze({component:Yn.type,type:st.submit,subType:xt.donation,message:"Making donation"});this.core.modules.analytics.sendAnalytics(e);const{data:n,isValid:a}=this;this.props.onDonate({data:n,isValid:a},this)}cancel(){const e=new Ze({component:Yn.type,type:st.closed,subType:xt.donation,message:"Opting to not make donation"});this.core.modules.analytics.sendAnalytics(e);const{data:n,isValid:a}=this;this.isInServiceMode&&this.unmount(),this.props.onCancel({data:n,isValid:a})}amountSelected(e){const n=new rt({component:Yn.type,type:Le.selected,selectedValue:JSON.stringify(e.data.amount),target:Na.donationAmountButton});this.core.modules.analytics.sendAnalytics(n)}componentToRender(){return c(gd,C(p({},this.props),{ref:e=>{this.componentRef=e},onChange:this.setState,onDonate:this.donate,onCancel:this.cancel,onAmountSelected:this.amountSelected}))}constructor(e,n){const a=Yn.isServiceMode(n);super(e,a?void 0:n),Er(this,"isInServiceMode",!1),this.donate=this.donate.bind(this),this.cancel=this.cancel.bind(this),this.amountSelected=this.amountSelected.bind(this),this.isInServiceMode=a,e.session&&a&&this.initialiseServiceMode(e,n)}};Er(Tr,"type",v.donation),Er(Tr,"defaultProps",{onCancel:()=>{},onDonate:()=>{}});function Va(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Sy=class{get length(){return Object.keys(this.storage).length}key(e){var n;return(n=Object.keys(this.storage)[e])!=null?n:null}getItem(e){return this.storage[e]||null}setItem(e,n){this.storage[e]=n}removeItem(e){delete this.storage[e]}clear(){this.storage={}}constructor(){Va(this,"storage",void 0),this.storage={}}},kd=class{get(){try{const e=this.storage.getItem(this.key);return e?JSON.parse(e):null}catch(e){return null}}set(e){this.storage.setItem(this.key,JSON.stringify(e))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(e){return this.storage.key(e)}get length(){return this.storage.length}constructor(e,n){Va(this,"prefix","adyen-checkout__"),Va(this,"key",void 0),Va(this,"storage",void 0);try{if(this.storage=n?window[n]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch(a){this.storage=new Sy}this.key=this.prefix+e}};function Ct(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Ey=kp;let Ty=class{get checkoutAttemptId(){return this._checkoutAttemptId}set checkoutAttemptId(e){this._checkoutAttemptId=e}async setUp({sessionId:e,checkoutStage:n,locale:a}={}){var o;try{const r=this.storage.get(),i=(function(u){if(!(u!=null&&u.timestamp))return!1;const y=Date.now()-9e5;return u.timestamp>y})(r),{applicationInfo:s,checkoutAttemptId:d}=(o=Up(this.analyticsData))!=null?o:{},l=i?r==null?void 0:r.id:d,h=p(p(p({version:Zo,buildType:ys,channel:Xo.WEB,platform:er,locale:a,referrer:window.location.href,screenWidth:window.screen.width,checkoutStage:n||"checkout",level:this.enabled?"all":"initial"},s&&{applicationInfo:s}),e&&{sessionId:e}),l&&{checkoutAttemptId:l});this.checkoutAttemptId=await this.service.requestCheckoutAttemptId(h),this.dispatchPendingAnalytics(),this.storage.set({id:this.checkoutAttemptId,timestamp:i?r.timestamp:Date.now()})}catch(r){this.enabled=!1,console.warn("Analytics: Error setting up",r)}}sendAnalytics(e){if(this.enabled)try{this.addEventToQueue(e)}catch(n){console.warn("Analytics: Error adding event to queue",n)}}async sendFlavor(e){this.isFlavorReported||(this.checkoutAttemptId?await this.dispatchFlavor(e):this.pendingFlavor||(this.pendingFlavor=e))}async dispatchFlavor(e){if(!this.isFlavorReported&&this.checkoutAttemptId){this.isFlavorReported=!0;try{await this.service.reportIntegrationFlavor(e,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error reporting flavor",n)}}}flush(){this.sendEvents()}addEventToQueue(e){this.eventsQueue.add(e),e.getEventCategory()===Vt.info?this.debouncedSendInfoEvents():this.debouncedSendEvents()}async sendEvents(){if(!this.checkoutAttemptId||!this.enabled||!this.eventsQueue.hasEvents)return;const e={channel:Xo.WEB,platform:er,info:this.eventsQueue.infoEvents,errors:this.eventsQueue.errorEvents,logs:this.eventsQueue.logEvents};this.eventsQueue.clear();try{await this.service.sendEvents(e,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error sending events",n)}}dispatchPendingAnalytics(){if(!this.isFlavorReported&&this.pendingFlavor){const e=this.pendingFlavor;this.pendingFlavor=void 0,this.dispatchFlavor(e)}this.sendEvents()}constructor({service:e,eventQueue:n,enabled:a,analyticsData:o}){Ct(this,"analyticsData",void 0),Ct(this,"service",void 0),Ct(this,"eventsQueue",void 0),Ct(this,"storage",new kd("checkout-attempt-id","sessionStorage")),Ct(this,"debouncedSendInfoEvents",void 0),Ct(this,"debouncedSendEvents",void 0),Ct(this,"_checkoutAttemptId",void 0),Ct(this,"enabled",!0),Ct(this,"isFlavorReported",!1),Ct(this,"pendingFlavor",void 0),this.service=e,this.eventsQueue=n,this.debouncedSendInfoEvents=nr(this.sendEvents.bind(this),1e4),this.debouncedSendEvents=nr(this.sendEvents.bind(this),Ey),a!==void 0&&(this.enabled=a),o&&(this.analyticsData=o)}};function Nr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Ny=class{add(e){const n=e.getEventCategory();n===Vt.info&&this.info.push(e),n===Vt.error&&this.errors.push(e),n===Vt.log&&this.logs.push(e)}get infoEvents(){return this.info}get errorEvents(){return this.errors}get logEvents(){return this.logs}get hasEvents(){return this.info.length>0||this.errors.length>0||this.logs.length>0}clear(){this.info=[],this.errors=[],this.logs=[]}constructor(){Nr(this,"info",[]),Nr(this,"errors",[]),Nr(this,"logs",[])}};function vd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Pr="v3/analytics";let Py=class{async requestCheckoutAttemptId(e){const n={loadingContext:this.analyticsContext,path:`${Pr}?clientKey=${this.clientKey}`};try{const{checkoutAttemptId:a}=await Ge(n,e);return a}catch(a){throw new z("NETWORK_ERROR","requestCheckoutAttemptId() - failed to get checkout attempt ID",{cause:a})}}async sendEvents(e,n){if(!n)throw new z("IMPLEMENTATION_ERROR","sendEvents() - checkoutAttemptId is required");if(!e.info.length&&!e.errors.length&&!e.logs.length)return Promise.resolve();const a={loadingContext:this.analyticsContext,path:`${Pr}/${n}?clientKey=${this.clientKey}`};try{await Ge(a,e)}catch(o){throw new z("NETWORK_ERROR","sendEvents() - failed to send events",{cause:o})}}async reportIntegrationFlavor(e,n){if(!e||!n)throw new z("IMPLEMENTATION_ERROR","reportIntegrationFlavor() - flavor or checkoutAttemptId is required");const a={loadingContext:this.analyticsContext,path:`${Pr}?clientKey=${this.clientKey}`},o={flavor:e,checkoutAttemptId:n};try{await Ge(a,o)}catch(r){throw new z("NETWORK_ERROR","reportIntegrationFlavor() - failed to send flavor",{cause:r})}}constructor({clientKey:e,analyticsContext:n}){vd(this,"clientKey",void 0),vd(this,"analyticsContext",void 0),this.clientKey=e,this.analyticsContext=n}};var Ar={payButton:"Pay","payButton.redirecting":"Redirecting...","payButton.with":"Pay %{value} with %{maskedData}","payButton.saveDetails":"Save details",close:"Close",storeDetails:"Save for my next payment",readMore:"Read more","creditCard.holderName":"Name on card","creditCard.holderName.invalid":"Enter name as shown on card","creditCard.expiryDateField.month":"Month","creditCard.expiryDateField.year":"Year","creditCard.storeDetailsButton":"Remember for next time","creditCard.dualBrand.title":"Card Brand","creditCard.dualBrand.description":"You can select the card brand you prefer to pay with. This is optional.",installments:"Number of installments",installmentOption:"%{times}x %{partialValue}",installmentOptionMonths:"%{times} months","installments.oneTime":"One time payment","installments.installments":"Installments payment","installments.revolving":"Revolving payment","installments.bonus":"Bonus payment","sepaDirectDebit.ibanField.invalid":"Invalid account number","sepa.ownerName":"Holder Name","sepa.ibanNumber":"Account Number (IBAN)","error.title":"Error","error.subtitle.redirect":"Redirect failed","error.subtitle.payment":"Payment failed","error.subtitle.refused":"Payment refused","error.message.unknown":"An unknown error occurred","errorPanel.title":"Existing errors","idealIssuer.selectField.title":"Bank","creditCard.success":"Payment Successful",loading:"Loading…",continue:"Continue",continueTo:"Continue to","wechatpay.timetopay":"You have %@ to pay","sr.wechatpay.timetopay":"You have %#minutes%# %#seconds%# to pay","wechatpay.scanqrcode":"Scan QR code",personalDetails:"Personal details",companyDetails:"Company details","companyDetails.name":"Company name","companyDetails.registrationNumber":"Registration number",socialSecurityNumber:"Social security number",firstName:"First name","firstName.invalid":"Enter your first name",infix:"Prefix",lastName:"Last name","lastName.invalid":"Enter your last name",mobileNumber:"Mobile number","mobileNumber.invalid":"Invalid mobile number",city:"City",postalCode:"Postal code","postalCode.optional":"Postal code (optional)",countryCode:"Country Code",telephoneNumber:"Telephone number",telephonePrefix:"Prefix",dateOfBirth:"Date of birth",shopperEmail:"Email address",gender:"Gender","gender.notselected":"Select your gender",male:"Male",female:"Female",billingAddress:"Billing address",street:"Street",stateOrProvince:"State or province",country:"Country/Region",houseNumberOrName:"House number",separateDeliveryAddress:"Specify a separate delivery address",deliveryAddress:"Delivery Address","deliveryAddress.firstName":"Recipient first name","deliveryAddress.lastName":"Recipient last name",zipCode:"Zip code",apartmentSuite:"Apartment / Suite",provinceOrTerritory:"Province or Territory",cityTown:"City / Town",address:"Address","address.search.contextualText":"Type to start searching your address","address.errors.incomplete":"Enter an address to continue","address.enterManually":"Enter address manually",state:"State",payAmountFormat:"Pay %@","field.title.optional":"(optional)","issuerList.selectField.contextualText":"Select your bank to continue","issuerList.selectField.label":"Bank selection",privacyPolicy:"Privacy policy","afterPay.agreement":"I agree with the %@ of Riverty","riverty.termsAndConditions":"I agree with the general %#Terms & Conditions%# for the Riverty Payment Method. The privacy policy of Riverty can be found %#here%#.",paymentConditions:"payment conditions",openApp:"Open the app","voucher.readInstructions":"Read instructions","voucher.introduction":"Thank you for your purchase, please use the following coupon to complete your payment.","voucher.expirationDate":"Expiration Date","voucher.alternativeReference":"Alternative Reference","voucher.paymentReferenceLabel":"Payment Reference","voucher.surcharge":"Incl. %@ surcharge","voucher.introduction.doku":"Thank you for your purchase, please use the following information to complete your payment.","voucher.shopperName":"Shopper Name","voucher.merchantName":"Merchant","voucher.introduction.econtext":"Thank you for your purchase, please use the following information to complete your payment.","voucher.telephoneNumber":"Phone Number","voucher.shopperReference":"Shopper Reference","voucher.collectionInstitutionNumber":"Collection Institution Number","voucher.econtext.telephoneNumber.invalid":"Telephone number must be 10 or 11 digits long","boletobancario.btnLabel":"Generate Boleto","boleto.sendCopyToEmail":"Send a copy to my email","button.copy":"Copy","button.copied":"Copied!","button.download":"Download","boleto.socialSecurityNumber":"CPF/CNPJ","boleto.socialSecurityNumber.invalid":"Enter a valid CPF/CNPJ number","creditCard.storedCard.description.ariaLabel":"Stored card ends in %@","voucher.entity":"Entity",donateButton:"Donate",donationTermsCondition:"By donating you agree to the %#terms and conditions%#",donationRoundUpDescription:"%{donationAmount} is a round up from your original payment (%{originalPaymentAmount})",notNowButton:"Not now",thanksForYourSupport:"Thanks for your support!","resultMessages.preauthorized":"Details saved",preauthorizeWith:"Preauthorize with",confirmPreauthorization:"Confirm preauthorization",confirmPurchase:"Confirm purchase",applyGiftcard:"Redeem",giftcardBalance:"Gift card balance",deductedBalance:"Deducted balance","creditCard.taxNumber":"Cardholder birthdate or Corporate registration number","creditCard.taxNumber.label":"Cardholder birthdate (YYMMDD) or Corporate registration number (10 digits)","creditCard.taxNumber.labelAlt":"Corporate registration number (10 digits)","creditCard.taxNumber.invalid":"Invalid Cardholder birthdate or Corporate registration number","storedPaymentMethod.disable.button":"Remove","storedPaymentMethod.disable.confirmation":"Remove stored payment method","storedPaymentMethod.disable.confirmButton":"Yes, remove","storedPaymentMethod.disable.cancelButton":"Cancel","ach.bankAccount":"Bank account","ach.bankAccount.title":"Bank account details","ach.bankAccount.label":"Account type","ach.bankAccount.placeholder":"Choose an account type","ach.bankAccount.nothing-selected-error":"Choose an account type","ach.bankAccount.option.personal-checking":"Personal Checking Account","ach.bankAccount.option.personal-savings":"Personal Savings Account","ach.bankAccount.option.business-checking":"Business Checking Account","ach.bankAccount.option.business-savings":"Business Savings Account","ach.bankAccountNumberVerification.label":"Verify account number","ach.bankAccountNumberVerification.error.not-match":"Account number does not match","ach.bankAccountNumberVerification.error.empty":"Enter the provided account number to verify the account number","ach.routingNumber.label":"Routing number","ach.accountHolderNameField.title":"Account holder name","ach.accountHolderNameField.contextualText":"Located on the front of your card","ach.accountHolderNameField.invalid":"Invalid account holder name","ach.accountNumberField.invalid":"Invalid account number","ach.accountLocationField.invalid":"Invalid ABA routing number","ach.savedBankAccount":"Saved bank account","ach.savings":"Savings account","ach.checking":"Checking account","select.state":"Select state","select.stateOrProvince":"Select state or province","select.provinceOrTerritory":"Select province or territory","select.country":"Select country/region","select.noOptionsFound":"No options found","select.results":"%{count} results available","telephoneNumber.invalid":"Invalid telephone number",qrCodeOrApp:"or","paypal.processingPayment":"Processing payment...",generateQRCode:"Generate QR code","await.waitForConfirmation":"Waiting for confirmation","mbway.confirmPayment":"Confirm your payment on the MB WAY app","shopperEmail.invalid":"Invalid email address","dateOfBirth.format":"DD/MM/YYYY","dateOfBirth.invalid":"Enter a valid date of birth that indicates you are at least 18 years old","blik.confirmPayment":"Open your banking app to confirm the payment.","blik.invalid":"Enter 6 numbers","blik.code":"6-digit code","blik.help":"Get the code from your banking app.","swish.pendingMessage":"After you scan, the status can be pending for up to 10 minutes. Attempting to pay again within this time may result in multiple charges.","field.valid":"Field valid","field.invalid":"Field not valid","field.error.required":"Enter the %{label}","field.error.invalid":"Enter a valid %{label}","error.giftcard.no-balance":"This gift card has zero balance","error.giftcard.card-error":"In our records we have no gift card with this number","error.giftcard.currency-error":"Gift cards are only valid in the currency they were issued in","err.gen.9100":"Incomplete field","err.gen.9101":"Field not valid","err.gen.9102":"Data parsing error","3ds.chal.805":"Challenge resolved without a %{result} object","cc.num.902":"Enter a valid card number","cc.num.900":"Enter the card number","cc.num.903":"Enter a supported card brand","cc.num.901":"Enter the complete card number","cc.dat.912":"Enter a valid expiry date","cc.dat.913":"Enter a valid expiry date","cc.dat.914":"Credit card about to expire","cc.dat.910":"Enter the expiry date","cc.dat.911":"Enter the complete expiry date","cc.mth.915":"Enter the expiry month","cc.yr.917":"Enter the expiry year","cc.yr.918":"Enter the complete expiry year","cc.cvc.920":"Enter the security code","cc.cvc.921":"Enter the complete security code","ach.num.945":"Enter the bank account number","ach.num.946":"Enter the complete bank account number","ach.loc.947":"Enter the bank routing number","ach.loc.948":"Enter the complete bank routing number","kcp.pwd.940":"Enter the password","kcp.pwd.941":"Enter the complete password","amazonpay.signout":"Sign out from Amazon","amazonpay.changePaymentDetails":"Change payment details","partialPayment.warning":"Select another payment method to pay the remaining","partialPayment.remainingBalance":"Remaining balance will be %{amount}","order.paymentMethod.description":"%{name} ending in %{lastFour}","bankTransfer.beneficiary":"Beneficiary name","bankTransfer.iban":"IBAN","bankTransfer.bic":"BIC","bankTransfer.reference":"Reference","bankTransfer.accountNumber":"Account number","bankTransfer.sortCode":"Sort code","bankTransfer.routingNumber":"Routing number","bankTransfer.branchCode":"Branch code","bankTransfer.bankCode":"Bank code","bankTransfer.introduction":"Press ‘Continue’ to create a new bank transfer payment. You can use the details in the following screen to finalize this payment.","bankTransfer.instructions":"Thank you for your purchase, please use the following information to complete your payment.","bankTransfer.shopperEmail.contextualText":"A copy of the payment details will be sent to your email so you can complete the payment later.","bankTransfer.details.title":"Payment details","bankTransfer.instruction.title":"Payment process","bankTransfer.instruction.step1":"Open your banking app","bankTransfer.instruction.step2":"Start a new transfer","bankTransfer.instruction.step3":"Enter the account details provided below","bankTransfer.instruction.step4":"Review and confirm the payment","bacs.accountHolderName":"Bank account holder name","bacs.accountHolderName.invalid":"Invalid bank account holder name","bacs.accountNumber":"Bank account number","bacs.accountNumber.invalid":"Invalid bank account number","bacs.bankLocationId":"Sort code","bacs.bankLocationId.invalid":"Invalid sort code","bacs.consent.amount":"I agree that the above amount will be deducted from my bank account.","bacs.consent.account":"I confirm the account is in my name and I am the only signatory required to authorise the Direct Debit on this account.",edit:"Edit","bacs.confirm":"Confirm and pay","bacs.result.introduction":"Download your Direct Debit Instruction (DDI / Mandate)","download.pdf":"Download PDF","creditCard.encryptedCardNumber.aria.iframeTitle":"Card number","creditCard.encryptedExpiryDate.aria.iframeTitle":"Expiry date","creditCard.encryptedExpiryMonth.aria.iframeTitle":"Expiry month","creditCard.encryptedExpiryYear.aria.iframeTitle":"Expiry year","creditCard.encryptedSecurityCode.aria.iframeTitle":"Security code","creditCard.encryptedPassword.aria.iframeTitle":"Password","giftcard.encryptedCardNumber.aria.iframeTitle":"Card number","giftcard.encryptedSecurityCode.aria.iframeTitle":"Pin",giftcardTransactionLimit:"Max. %{amount} allowed per transaction on this gift card","pix.instructions":"Use your banking app to scan the QR code or copy the PIX code below to complete your payment.","pix.code.label":"PIX code","pix.code.copy.label":"Copy PIX code","pix.code.copied.label":"PIX code copied","twint.saved":"saved",orPayWith:"or pay with","invalid.format.expects":"%{label} Invalid format. Expected format: %{format}","upi.qrCodeWaitingMessage":"Scan the QR code using your preferred UPI app to complete the payment","upi.vpaWaitingMessage":"Open your UPI app to confirm the payment","upi.modeSelection":"How would you like to use UPI?","upi.completePayment":"Complete your payment","upi.mode.enterUpiId":"UPI ID","upi.mode.qrCode":"QR code","upi.mode.payByAnyUpi":"UPI apps","upi.collect.dropdown.label":"Enter UPI ID","upi.collect.instruction":"Enter your UPI ID","upi.collect.field.label":"UPI ID","upi.collect.field.contextualText":"Enter the UPI ID connected to your account and press continue","upi.collect.field.invalid-id-error":"Enter a valid UPI","upi.error.noAppSelected":"Select your preferred UPI app to continue","upi.intent.instruction":"Select your preferred UPI app","upi.qrCode.instruction":"After generating the QR code you can use your preferred UPI app to complete the payment.","onlineBanking.termsAndConditions":"By continuing you agree with the %#terms and conditions%#","onlineBankingPL.termsAndConditions":"By continuing you agree with the %#regulations%# and %#information obligation%# of Przelewy24","ctp.loading.poweredByCtp":"Powered by Click to Pay","ctp.loading.intro":"We are checking to see if you have any saved cards with Click to Pay...","ctp.login.title":"Continue to Click to Pay","ctp.login.subtitle":"Enter the email address that is connected to Click to Pay to continue.","ctp.login.inputLabel":"Email","ctp.logout.notYou":"Not you?","ctp.logout.notYourCards":"Not your cards?","ctp.logout.notYourCard":"Not your card?","ctp.logout.notYourProfile":"Not your profile?","ctp.otp.fieldLabel":"One time code","ctp.otp.resendCode":"Resend code","ctp.otp.codeResent":"Code resent","ctp.otp.title":"Access your Click to Pay cards","ctp.otp.subtitle":"Enter the code %@ sent to %@ to verify it‘s you.","ctp.otp.saveCookiesCheckbox.label":"Skip verification next time","ctp.otp.saveCookiesCheckbox.information":"Select to be remembered on your device and browser at participating stores for faster checkout. Not recommended for shared devices.","ctp.otp.saveCookiesCheckbox.shorterInfo":"Select to be remembered on your device and browser","ctp.emptyProfile.message":"No cards registered in this Click to Pay profile","ctp.separatorText":"or use","ctp.cards.title":"Complete payment with Click to Pay","ctp.cards.subtitle":"Select a card to use.","ctp.cards.expiredCard":"Expired","ctp.manualCardEntry":"Manual card entry","ctp.aria.infoModalButton":"What is Click to Pay","ctp.infoPopup.title":"Click to Pay brings the ease of contactless, online","ctp.infoPopup.subtitle":"A fast, secure payment method supported by Mastercard, Visa and other payment cards.","ctp.infoPopup.benefit1":"Click to Pay uses encryption to keep your information safe and secure","ctp.infoPopup.benefit2":"Use it with merchants worldwide","ctp.infoPopup.benefit3":"Set up once for hassle-free payments in the future","ctp.errors.AUTH_INVALID":"Authentication Invalid","ctp.errors.NOT_FOUND":"No account found, enter a valid email or continue using manual card entry","ctp.errors.ID_FORMAT_UNSUPPORTED":"Format not supported","ctp.errors.FRAUD":"The user account was locked or disabled","ctp.errors.CONSUMER_ID_MISSING":"Consumer identity is missing in the request","ctp.errors.ACCT_INACCESSIBLE":"This account is currently not available, e.g it is locked","ctp.errors.CODE_INVALID":"Incorrect verification code","ctp.errors.CODE_EXPIRED":"This code has expired","ctp.errors.RETRIES_EXCEEDED":"The limit for the number of retries for OTP generation was exceeded","ctp.errors.OTP_SEND_FAILED":"The OTP could not be sent to the recipient","ctp.errors.REQUEST_TIMEOUT":"Something went wrong, try again or use the manual card entry","ctp.errors.UNKNOWN_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVICE_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVER_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_PARAMETER":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_EMAIL":"Enter a valid email address (e.g. name@example.com)","ctp.errors.AUTH_ERROR":"Something went wrong, try again or use the manual card entry","paymentMethodsList.aria.label":"Choose a payment method","paymentMethodsList.storedPayments.label":"Saved payment methods","paymentMethodsList.otherPayments.label":"More payment options","paymentMethodsList.otherPayments.buttonLabel":"Show %{count} more","paymentMethodsList.promotedPayments.label":"Other","companyDetails.name.invalid":"Enter the company name","companyDetails.registrationNumber.invalid":"Enter the registration number","consent.checkbox.invalid":"You must agree with the terms & conditions","form.instruction":"All fields are required unless marked otherwise.","trustly.descriptor":"Instant Bank Payment","trustly.description1":"Pay directly from any of your bank accounts, backed by bank-level security","trustly.description2":"No cards, no app download, no registration","ancv.input.label":"Your ANCV identification","ancv.confirmPayment":"Use your ANCV application to confirm the payment.","ancv.form.instruction":"The Cheque-Vacances application is necessary to validate this payment.","ancv.beneficiaryId.invalid":"Enter a valid email address or ANCV ID","creditCard.cardNumber.label":"Card number","creditCard.expiryDate.label":"Expiry date","creditCard.expiryDate.contextualText":"Front of card in MM/YY format","creditCard.securityCode.label":"Security code","creditCard.securityCode.label.optional":"Security code (optional)","creditCard.securityCode.contextualText.3digits":"3 digits on back of card","creditCard.securityCode.contextualText.4digits":"4 digits on front of card","creditCard.expiryMonth.label":"Expiry month","creditCard.expiryYear.label":"Expiry year","creditCard.pin.label":"Pin","creditCard.password.label":"First 2 digits of card password","giftcard.cardNumber.label":"Card Number","giftcard.expiryDate.label":"Expiry date","giftcard.securityCode.label":"Pin","ach.bankAccountNumber.label":"Account number","ach.bankLocationId.label":"ABA routing number","dragonpayVoucher.selectField.contextualText.nonBank":"Select your provider","dragonpayVoucher.selectField.contextualText.bank":"Select your bank","payme.openPayMeApp":"Complete your payment in the PayMe app by authorizing the payment in the app and wait for the confirmation.","payme.redirectButtonLabel":"Open PayMe app","payme.scanQrCode":"Complete your payment by QR code","payme.timeToPay":"This QR code is valid for %@","payme.instructions.steps":"Open the PayMe app.%@Scan the QR code to authorize the payment.%@Complete the payment in the app and wait for confirmation.","payme.instructions.footnote":"Please do not close this page before the payment is completed","payByBankAISDD.disclaimer.header":"Use Pay by Bank to pay instantly from any bank account.","payByBankAISDD.disclaimer.body":"By connecting your bank account you are authorizing debits to your account for any amount owed for use of our services and/or purchase of our products, until this authorization is revoked.","paymentMethodBrand.other":"other","paynow.scanQrCode":"Scan the QR code using the PayNow app to complete the payment","paynow.mobileViewInstruction.step1":"Take a screenshot of the QR code.","paynow.mobileViewInstruction.step2":"Open the PayNow bank or payment app.","paynow.mobileViewInstruction.step3":"Select the option to scan a QR code.","paynow.mobileViewInstruction.step4":"Choose the option to upload a QR and select the screenshot.","paynow.mobileViewInstruction.step5":"Complete the transaction.","payto.payid.description":"Enter the PayID and account details that are connected to your PayTo account.","payto.payid.label.identifier":"Identifier","payto.payid.label.orgid":"Organization ID","payto.payid.option.phone":"Mobile","payto.payid.option.email":"Email","payto.payid.option.orgid":"Organization ID","payto.bsb.description":"Enter the bank account number and the Bank State Branch that is connected to your account to continue","payto.bsb.label.bankAccountNumber":"Bank account number","payto.instructions.steps":"Log into your PayTo banking app@Authorize the PayTo agreement@Approve the payment terms@Complete the transaction","payto.confirmPayment":"Thank you for your purchase, complete your payment by following the instructions below.","payto.mandate.amount.label":"Amount","payto.mandate.frequency.label":"Frequency","payto.mandate.remarks.label":"Description","payto.mandate.startsAt.label":"First payment date","payto.mandate.endsAt.label":"End date","payto.mandate.payee.label":"Payee","payto.mandate.amount.max":"Up to %{amount} per transaction","payto.mandate.frequency.adhoc-no-count":"Ad Hoc","payto.mandate.frequency.adhoc":"%{count} time(s)","payto.mandate.frequency.daily":"%{count} payment(s) Daily","payto.mandate.frequency.weekly":"%{count} payment(s) Weekly","payto.mandate.frequency.biWeekly":"%{count} payment(s) Fortnightly","payto.mandate.frequency.monthly":"%{count} payment(s) Monthly","payto.mandate.frequency.quarterly":"%{count} payment(s) Quarterly","payto.mandate.frequency.halfYearly":"%{count} payment(s) Bi-Annual","payto.mandate.frequency.yearly":"%{count} payment(s) Yearly","payto.label.firstName":"Account holder first name","payto.label.lastName":"Account holder last name","payto.await.waitForConfirmation":"Awaiting your approval","payto.bsb.option.label":"BSB and account number","card.fastlane.a11y.logo":"Fastlane by Paypal logo","card.fastlane.a11y.openDialog":"Read more about Fastlane","card.fastlane.a11y.closeDialog":"Close dialog","card.fastlane.mobileInputLabel":"Mobile number","card.fastlane.consentToggle":"Save your info with Fastlane for faster checkouts and more","card.fastlane.consentText":"By saving your info, you agree to get codes by text to use Fastlane everywhere it's available. Fastlane will text the number provided. You also agree to this %#terms%# and %#privacy statement%#.","card.fastlane.modal.benefit1.header":"Autofill your checkouts","card.fastlane.modal.benefit1.text":"Get one-time codes to use card and addresses you’ve saved.","card.fastlane.modal.benefit2.header":"Protect your info","card.fastlane.modal.benefit2.text":"Your payment info is encrypted when it’s stored and sent to places you shop.","card.fastlane.modal.benefit3.header":"Use across stores","card.fastlane.modal.benefit3.text":"Speed through checkout everywhere Fastlane is available.","paybybankpix.redirectBtn.label":"Continue to PIX through OpenBanking","paybybankpix.issuerList.disclaimer":"By continuing, you agree to the %#Consent Notice%# and will be redirected to your bank.","paybybankpix.issuerList.selectField.label":"Bank","paybybankpix.issuerList.introduction.logo.content":"Connect your favorite PIX keys to pay through Open Finance","paybybankpix.await.waitForConfirmation":"Waiting for your confirmation...","paybybankpix.await.timeToPay":"This process will take approximately %{numberOfMin} minute(s)","paybybankpix.await.withOpenFinance":"With the ease of Open Finance","paybybankpix.await.logoAlt.openFinance":"Open Finance","paybybankpix.storedPayment.payButton.label":"Continue payment","paybybankpix.storedPayment.additionalLabel":"%{receiver} account through PIX","paybybankpix.await.fetchDetails":"Fetching details...","eftpad-canada.input.accountHolderName.label":"Account holder name","eftpad-canada.input.accountHolderName.error":"Enter an account holder name","eftpad-canada.input.accountNumber.label":"Account number","eftpad-canada.input.accountNumber.contextualText":"Between 7 and 12 digits","eftpad-canada.input.accountNumber.error":"Enter an account number that is between 7 and 12 digits","eftpad-canada.input.institutionNumber.label":"Institution number","eftpad-canada.input.institutionNumber.contextualText":"3 digits","eftpad-canada.input.institutionNumber.error":"Enter an institution number that consists of 3 digits","eftpad-canada.input.transitNumber.label":"Transit number","eftpad-canada.input.transitNumber.contextualText":"5 digits","eftpad-canada.input.transitNumber.error":"Enter a transit number that consists of 5 digits","eftpad-canada.settlement-info":"The funds will be withdrawn from your bank account within 1–3 business days.","upi.mandate.intro":"You’re setting up a UPI Autopay recurring payment","upi.mandate.max.extraText":"You’ll approve a higher limit to allow future plan changes","upi.mandate.upTo":"up to %{amount}","upi.mandate.frequency.monthly":"/month","upi.mandate.frequency.weekly":"/week","upi.mandate.frequency.adhoc":" as presented",bankList:"Bank list",qrCode:"QR code","iris.instructions.generateQrCode":"After generating the QR code you can use your preferred banking app to complete the payment.","iris.instructions.payment.step1":"Open your preferred banking app.","iris.instructions.payment.step2":"Scan the QR code with your banking app.","iris.instructions.payment.step3":"Complete the payment in the app and wait for the confirmation here.","econtext.customerNumber":"Customer number","econtext.confirmationNumber":"Confirmation number","econtext.useBefore":"Use before","econtext.paymentInformation":"Payment information","issuerList.separatorText":"or choose from list","upi.intent.apps.title":"Options","upi.intent.apps.dropdown.label":"UPI apps","upi.intent.apps.dropdown.placeholder":"Choose preferred app"};function Nt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Ay{async requestTranslations(){const e=await this.service.fetchTranslationsFromCdn(this.locale);this._translations=p(p(p({},Ar),e),!!this.customTranslations[this.locale]&&this.customTranslations[this.locale])}get translations(){return this._translations}get(e,n){const a=Gu(this._translations,e,n);return a!==null?a:e}amount(e,n,a){return $h(e,this.locale,n,a)}date(e,n={}){if(e===void 0)return"";const a=p({year:"numeric",month:"2-digit",day:"2-digit"},n);return new Date(e).toLocaleDateString(this.locale,a)}dateTime(e){return e===void 0?"":this.timeAndDateFormatter.format(new Date(e))}createSupportedLocalesList(e){if(!e)return Ko;const n=new Set([...Ko,...Object.keys(e)]);return Array.from(n).sort((a,o)=>a.localeCompare(o))}constructor(e){Nt(this,"locale",void 0),Nt(this,"languageCode",void 0),Nt(this,"service",void 0),Nt(this,"customTranslations",void 0),Nt(this,"supportedLocales",void 0),Nt(this,"_translations",{}),Nt(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),Nt(this,"timeAndDateFormatOptions",p({year:"numeric",month:"2-digit",day:"2-digit"},this.timeFormatOptions)),Nt(this,"timeAndDateFormatter",void 0);const{locale:n,customTranslations:a,service:o}=e;this.service=o,this.customTranslations=Wu(a),this.supportedLocales=this.createSupportedLocalesList(this.customTranslations),this.locale=qu(n||Sa,this.supportedLocales),this.languageCode=this.locale.split("-")[0],this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions)}}const Dy="1.0.0",Iy="1.0.0",za="deviceFingerprint",$y=2e4,Ry={result:{type:za,value:"df-timedOut"},errorCode:"timeout"},Fy={UNKNOWN:"unknownError"},xd={timeout:"iframe loading timed out",wrongOrigin:"Result did not come from the expected origin",wrongDataType:"Result data was not of the expected type",missingProperty:"Result data did not contain the expected properties",unknownError:"An unknown error occurred"};function Dr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Oy extends Fe{getDfpPromise(){return new Promise((e,n)=>{this.processMessageHandler=hr(this.postMessageDomain,e,n,za),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.deviceFingerPrintPromise=_r($y,this.getDfpPromise(),Ry),this.deviceFingerPrintPromise.promise.then(e=>{this.props.onCompleteFingerprint(e),window.removeEventListener("message",this.processMessageHandler)}).catch(e=>{this.props.onErrorFingerprint(e),window.removeEventListener("message",this.processMessageHandler)})}render({dfpURL:e}){return c("div",{className:"adyen-checkout-risk__device-fingerprint"},c(On,{name:"dfIframe",src:e,allow:"geolocation; microphone; camera;",title:"devicefingerprinting iframe"}))}constructor(e){super(e),Dr(this,"postMessageDomain",void 0),Dr(this,"processMessageHandler",void 0),Dr(this,"deviceFingerPrintPromise",void 0),this.postMessageDomain=mr(this.props.loadingContext)||this.props.loadingContext}}const My=t=>({errorCode:t,message:xd[t]||xd[Fy.UNKNOWN],type:za});let wd=class extends Fe{setStatusComplete(e){this.setState({status:"complete"},()=>{this.props.onComplete(e)})}render({loadingContext:e},{dfpURL:n}){return this.state.status==="retrievingFingerPrint"?c("div",{className:"adyen-checkout-risk__device-fingerprint--wrapper",style:{position:"absolute",width:0,height:0}},c(Oy,{loadingContext:e,dfpURL:n,onCompleteFingerprint:a=>{this.setStatusComplete(a)},onErrorFingerprint:a=>{this.props.onError(My(a.errorCode)),this.setStatusComplete(a.result)}})):null}constructor(e){super(e),e.clientKey&&(this.state={status:"retrievingFingerPrint",dfpURL:`${this.props.loadingContext}assets/html/${e.clientKey}/dfp.${Iy}.html`})}};var Ir,$r,Rr;Rr={onComplete:()=>{},onError:()=>{}},($r="defaultProps")in(Ir=wd)?Object.defineProperty(Ir,$r,{value:Rr,enumerable:!0,configurable:!0,writable:!0}):Ir[$r]=Rr;function pn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Fr=class vc extends Da{formatProps(e){return C(p({},e),{risk:p(p({},vc.defaultProps.risk),e.risk)})}get isValid(){return this.state.isValid}get data(){if(this.isValid){const e=p({version:Dy},this.state.data);return Mn.encode(JSON.stringify(e))}return!1}get enabled(){return this.props.risk.enabled}componentWillUnmount(){this.cleanUp()}render(){return c(wd,C(p({},this.props),{loadingContext:this.props.loadingContext,onComplete:this.onComplete,onError:this.onError}))}constructor(e,n){super(e,n),pn(this,"nodeRiskContainer",null),pn(this,"onComplete",o=>{const r=C(p({},this.state.data),{[o.type]:o.value,persistentCookie:o.persistentCookie,components:o.components});this.setState({data:r,isValid:!0}),this.props.risk.onComplete(this.data),this.cleanUp()}),pn(this,"onError",o=>{this.props.risk.onError(o),this.cleanUp()}),pn(this,"cleanUp",()=>{this.nodeRiskContainer&&this.nodeRiskContainer.parentNode&&this.nodeRiskContainer.parentNode.removeChild(this.nodeRiskContainer)});const a={[za]:null};this.setState({data:a}),this.props.risk.enabled===!0&&(document.querySelector(this.props.risk.node)?(this.nodeRiskContainer=document.createElement("div"),document.querySelector(this.props.risk.node).appendChild(this.nodeRiskContainer),this.mount(this.nodeRiskContainer)):this.onError({message:"RiskModule node was not found"}))}};pn(Fr,"type","risk"),pn(Fr,"defaultProps",{risk:{enabled:!0,onComplete:()=>{},onError:()=>{},node:"body"}});function Cd(t){return!this.length||this.includes(t.type)}function Sd(t){return!this.length||!this.includes(t.type)}function Ly(t){return!!t&&!!t.supportedShopperInteractions&&t.supportedShopperInteractions.includes("Ecommerce")}const By=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto","paybybank_pix","eft_directdebit_CA"];function Vy(t){return!!t&&!!t.type&&By.includes(t.type)}function zy(t){return C(p({},t),{_id:ze()})}const Uy=(t,{allowPaymentMethods:e=[],removePaymentMethods:n=[]})=>t?t.filter(Cd,e).filter(Sd,n).map(zy):[],jy=(t,{allowPaymentMethods:e=[],removePaymentMethods:n=[]},a=[])=>t?t.filter(Vy).filter(Cd,e).filter(Sd,n).filter(Ly).map(o=>((r,i)=>{const s=(function(d,l){if(d.type!=="scheme")return;const h=d.brand;if(!h)return;const u=l.find(y=>{var m;return y.type==="scheme"&&((m=y.brands)==null?void 0:m.includes(h))});return u==null?void 0:u.fundingSource})(r,i);return p(C(p({},r),{storedPaymentMethodId:r.id,isStoredPaymentMethod:!0}),s&&{fundingSource:s})})(o,a)):[],Ky=t=>{var e,n;if(typeof t=="string")throw new Error('paymentMethodsResponse was provided but of an incorrect type (should be an object but a string was provided).Try JSON.parse("{...}") your paymentMethodsResponse.');if(t instanceof Array)throw new Error("paymentMethodsResponse was provided but of an incorrect type (should be an object but an array was provided).Please check you are passing the whole response.");!t||(e=t==null?void 0:t.paymentMethods)!=null&&e.length||(n=t==null?void 0:t.storedPaymentMethods)!=null&&n.length||console.warn("paymentMethodsResponse was provided but no payment methods were found.")};function Ed(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Hy=class{mapCreatedComponentType(e){return e==="card"?"scheme":e}has(e){return!!this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(e))}find(e){return this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(e))}findByFundingSource(e,n){const a=this.mapCreatedComponentType(e);return this.paymentMethods.find(o=>o.type===a&&o.fundingSource===n)}findById(e){return this.paymentMethods.find(n=>n._id===e)}findStoredPaymentMethod(e){return this.storedPaymentMethods.find(n=>n.id===e)}constructor(e,n={}){Ed(this,"paymentMethods",[]),Ed(this,"storedPaymentMethods",[]),Ky(e),this.paymentMethods=e?Uy(e.paymentMethods,n):[],this.storedPaymentMethods=e?jy(e.storedPaymentMethods,n,e.paymentMethods||[]):[]}};const Or=(t,e,n,a)=>{const o=e.getComponent(n);if(!o)throw Error(`Action Element of type ${n} not found in the registry`);return new o(t,C(p({},a),{id:`${n}-${ze()}`}))},zn=t=>(e,n,a,o)=>{const r=C(p(p({},o),a),{onError:o.onError,statusType:t,originalAction:a});return Or(e,n,a.paymentMethodType,r)},qy={redirect:(t,e,n,a)=>{const o=C(p(p({},a),n),{statusType:"redirect",originalAction:n});return Or(t,e,"redirect",o)},threeDS2:(t,e,n,a)=>{var s,d;const o=n.subtype==="fingerprint"?"threeDS2DeviceFingerprint":"threeDS2Challenge",r=n.subtype==="fingerprint"||a.isMDFlow?n.paymentData:n.authorisationToken,i=p({core:t,token:n.token,paymentData:r,onActionHandled:a.onActionHandled,on3DS2RedirectFlowComplete:a.on3DS2RedirectFlowComplete,onAdditionalDetails:a.onAdditionalDetails,onError:a.onError,isDropin:!!a.isDropin,loadingContext:a.loadingContext,clientKey:a.clientKey,paymentMethodType:a.paymentMethodType,challengeWindowSize:a.challengeWindowSize,isMDFlow:a.isMDFlow,modules:{analytics:(s=a.modules)==null?void 0:s.analytics,resources:(d=a.modules)==null?void 0:d.resources}},ly(n.subtype,a));return Or(t,e,o,i)},voucher:zn("custom"),qrCode:zn("custom"),await:zn("custom"),bankTransfer:zn("custom"),sdk:zn("custom")};function Wy(t,e,n,a={}){const o=qy[n.type];if(o&&typeof o=="function")return o(t,e,n,a);throw new Error("Invalid Action")}function Gy(t,e){const n=`${Ot}/sessions/${e.id}/payments?clientKey=${e.clientKey}`,a=p({sessionData:e.data},t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal",errorCode:ln.makePayments},a)}function Yy(t,e){const n=`${Ot}/sessions/${e.id}/paymentDetails?clientKey=${e.clientKey}`,a=p(p({},e.data&&{sessionData:e.data}),t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal",errorCode:ln.submitPaymentDetails},a)}function Jy(t){const e=`${Ot}/sessions/${t.id}/donationCampaigns?clientKey=${t.clientKey}`,n=p({},t.data&&{sessionData:t.data});return Ge({loadingContext:t.loadingContext,path:e,errorLevel:"fatal",errorCode:ln.donationCampaigns},n)}function Qy(t,e){const n=`${Ot}/sessions/${e.id}/donations?clientKey=${e.clientKey}`,a=p(p({},e.data&&{sessionData:e.data}),t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal",errorCode:ln.donations},a)}function Zy(t,e){const n=`${Ot}/sessions/${t.id}/setup?clientKey=${t.clientKey}`,a=p({browserInfo:e.browserInfo,sessionData:t.data},e.order?{order:{orderData:e.order.orderData,pspReference:e.order.pspReference}}:{});return Ge({loadingContext:t.loadingContext,path:n,errorLevel:"fatal"},a)}function Xy(t,e){const n=`${Ot}/sessions/${e.id}/paymentMethodBalance?clientKey=${e.clientKey}`,a=p({sessionData:e.data},t);return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal"},a)}function em(t){const e=`${Ot}/sessions/${t.id}/orders?clientKey=${t.clientKey}`,n={sessionData:t.data};return Ge({loadingContext:t.loadingContext,path:e,errorLevel:"fatal",errorCode:ln.createOrder},n)}function tm(t){if(!t||!t.id)throw new z("IMPLEMENTATION_ERROR","Invalid session");const{shopperLocale:e,shopperEmail:n,telephoneNumber:a,id:o}=t;return p(p(p(p({id:o},t.sessionData?{sessionData:t.sessionData}:{}),e&&{shopperLocale:e}),n&&{shopperEmail:n}),a&&{telephoneNumber:a})}function nm(t,e){const n=`${Ot}/sessions/${e.id}/orders/cancel?clientKey=${e.clientKey}`,a={sessionData:e.data,order:t};return Ge({loadingContext:e.loadingContext,path:n,errorLevel:"fatal"},a)}function hn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class am{get shopperLocale(){return this.session.shopperLocale}get id(){return this.session.id}get data(){return this.session.sessionData}set sessionsDonationInitiated(e){this._sessionsDonationInitiated=e}get sessionsDonationInitiated(){return this._sessionsDonationInitiated}updateSessionData(e){this.session.sessionData=e,this.storeSession()}setupSession(e){const n=C(p({},e),{browserInfo:or()});return Zy(this,n).then(a=>(a.configuration&&(this.configuration=p({},a.configuration)),a.sessionData&&this.updateSessionData(a.sessionData),a))}submitPayment(e){return Gy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}submitDetails(e){return Yy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}fetchDonationCampaigns(){return Jy(this).then(e=>(e.sessionData&&this.updateSessionData(e.sessionData),e))}makeDonation(e){return Qy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}checkBalance(e){return Xy(e,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}createOrder(){return em(this).then(e=>(e.sessionData&&this.updateSessionData(e.sessionData),e))}cancelOrder(e){return nm(e.order,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}getStoredSession(){const e=this.storage.get();return this.id===(e==null?void 0:e.id)?e:this.session}storeSession(){this.storage.set({id:this.session.id,sessionData:this.session.sessionData})}removeStoredSession(){this.storage.remove()}constructor(e,n,a){hn(this,"storage",void 0),hn(this,"session",void 0),hn(this,"clientKey",void 0),hn(this,"loadingContext",void 0),hn(this,"configuration",void 0),hn(this,"_sessionsDonationInitiated",void 0);const o=tm(e);if(!n)throw new Error("No clientKey available");if(!a)throw new Error("No loadingContext available");this.storage=new kd("session","localStorage"),this.clientKey=n,this.loadingContext=a,this.session=o,this._sessionsDonationInitiated=!1,this.session.sessionData?this.storeSession():this.session=this.getStoredSession()}}function Mr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let om=class{getImage(e={}){return this.getImageUrl(C(p({},e),{resourceContext:this.resourceContext}))}constructor(e){if(Mr(this,"resourceContext",void 0),Mr(this,"returnImage",({name:n,resourceContext:a,imageFolder:o="",parentFolder:r="",extension:i,size:s="",subFolder:d=""})=>`${a}images/${o}${d}${r}${n}${s}.${i}`),Mr(this,"getImageUrl",r=>{var i=r,{resourceContext:n,extension:a="svg"}=i,o=Ce(i,["resourceContext","extension"]);return s=>{const d=p({extension:a,resourceContext:n,imageFolder:"logos/",parentFolder:"",name:s},o);return this.returnImage(d)}}),!e)throw new z("IMPLEMENTATION_ERROR",'Resources module: "environmentsUrls.cdn" is not a valid URL');this.resourceContext=e}};function rm({setComponentRef:t}){const e=J({});Object.keys(e.current).length||(t==null||t(e.current));const[n,a]=N(null);return e.current.setMessages=o=>{a(o)},n?c(G,null,n.map(o=>c("div",{key:o,className:"adyen-checkout-sr-panel__msg"},o))):null}function St(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Lr extends Da{get enabled(){return this._enabled}get moveFocus(){return this._moveFocus}setAriaProps(e){if(!this.props.enabled)return;const n=document.querySelector('[class^="adyen-checkout-sr-panel"]');if(n){for(const[a,o]of Object.entries(e))n.setAttribute(a,o);this.props=C(p({},this.props),{ariaAttributes:p(p({},this.props.ariaAttributes),e)})}else console.error("SRPanel: Failed to set aria props because no panel was found")}render(){return this.props.enabled?c("div",p({className:this.showPanel?"adyen-checkout-sr-panel":"adyen-checkout-sr-panel--sr-only",role:"log"},this.props.ariaAttributes),c(rm,{setComponentRef:this.setComponentRef})):null}constructor(e,n){var a;if(super(e,n),St(this,"srPanelContainer",null),St(this,"id",void 0),St(this,"showPanel",void 0),St(this,"_enabled",void 0),St(this,"_moveFocus",void 0),St(this,"componentRef",void 0),St(this,"setComponentRef",o=>{this.componentRef=o}),St(this,"setMessages",o=>{if(!this.props.enabled)return;let r=null;o&&(r=Array.isArray(o)?o:[o]),this.componentRef.setMessages(r)}),this.id=this.props.id,this.showPanel=!1,this._enabled=!1,this._moveFocus=(a=this.props.moveFocus)!=null?a:!0,this.props.enabled){this._enabled=!0;const o=document.querySelector(this.props.node);if(!o)throw new Error("Component could not mount. Root node was not found.");{const r=document.getElementById(this.id);r&&o.removeChild(r),this.srPanelContainer=document.createElement("div"),this.srPanelContainer.className="sr-panel-holder",this.srPanelContainer.id=this.id,o.appendChild(this.srPanelContainer),this.mount(this.srPanelContainer)}}}}St(Lr,"type","srPanel"),St(Lr,"defaultProps",{enabled:!0,node:"body",showPanel:!1,id:"ariaLiveSRPanel",ariaAttributes:{"aria-relevant":"all","aria-live":"polite","aria-atomic":"true"}});function Td(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const im={[v.redirect]:Vn,[v.threeDS2Challenge]:br,[v.threeDS2DeviceFingerprint]:wr,[v.donation]:Tr};var Un=new class{add(...t){this.componentsMap=p(p({},this.componentsMap),this.createComponentsMap(t))}getComponent(t){return this.componentsMap[t]||(this.supportedTxVariants.has(t)?void 0:Vn)}createComponentsMap(t){return t.reduce((e,n)=>{var a;return typeof(a=n).type=="string"&&a.type?(n.type==="dropin"||[n.type,...n.txVariants].filter(o=>o).forEach(o=>{e=C(p({},e),{[o]:n})}),e):(console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),e)},{})}constructor(){Td(this,"componentsMap",im),Td(this,"supportedTxVariants",new Set(Object.values(v)))}};const sm={exposeLibraryMetadata:!0,showPayButton:!0};function Nd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class dm{async fetchTranslationsFromCdn(e){const n=this.matchLocaleWithCdnSupportedLocales(e);if(n==="en-US")return Ar;try{return await fs({loadingContext:this.cdnUrl,errorLevel:"fatal",errorMessage:`Translations: Failed to fetch translations for locale "${n}"`,path:`sdk/${this.sdkVersion}/translations/${n}.json`})}catch(a){return console.warn(`LanguageService - fetchTranslationsFromCdn(): Failed to fetch locale "${n}."`,a),Ar}}matchLocaleWithCdnSupportedLocales(e){return ss(e,Ko)||Sa}constructor({cdnUrl:e,sdkVersion:n}){Nd(this,"cdnUrl",void 0),Nd(this,"sdkVersion",void 0),this.cdnUrl=e,this.sdkVersion=n}}function je(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Pt{static setBundleType(e){Pt.metadata.bundleType=e}static register(...e){Un.add(...e)}register(...e){Un.add(...e)}getComponent(e){return Un.getComponent(e)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),this.createCoreModules(),this.assignLocaleToCore(),this.requestAnalyticsAttemptId(),await this.requestTranslations(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(e=>{const s=e,{amount:n,shopperLocale:a,countryCode:o,paymentMethods:r}=s,i=Ce(s,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(C(p({},i),{amount:this.options.order?this.options.order.remainingAmount:n,locale:this.options.locale||a,countryCode:this.options.countryCode||o})),this.createPaymentMethodsList(r),this}).catch(e=>(this.options.onError&&this.options.onError(e),Promise.reject(e))):(this.createPaymentMethodsList(),Promise.resolve(this))}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new z(No,"You must specify a countryCode when initializing checkout.")}submitDetails(e){var a,o;let n=null;this.options.onAdditionalDetails&&(n=new Promise((r,i)=>{this.options.onAdditionalDetails({data:e},void 0,{resolve:r,reject:i})})),this.session&&(n=this.session.submitDetails(e).catch(r=>{var i,s;return(s=(i=this.options).onError)==null||s.call(i,r),Promise.reject(r)})),n?n.then(ur).then(pr).then(this.afterAdditionalDetails).then(r=>{var i,s;Ia(r),(s=(i=this.options).onPaymentCompleted)==null||s.call(i,r)}).catch(r=>{var i,s;r instanceof Fa||(Ia(r),(s=(i=this.options).onPaymentFailed)==null||s.call(i,r))}):(o=(a=this.options).onError)==null||o.call(a,new z("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(e,n={}){if(!e||!e.type)throw Y(e,"action")&&Y(e,"resultCode")?new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?'):new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property');if(e.type){const a=e.type===ey?`${e.type}${e.subtype}`:e.paymentMethodType,o=new Ze({type:st.action,subType:Ze.getSubtypeFromActionType(e.type),message:`${a} action was handled by the SDK`,component:a});this.modules.analytics.sendAnalytics(o);const r=p(p({},this.getCorePropsForComponent()),n);return Wy(this,Un,e,r)}return this.handleCreateError()}update(e={},{shouldReinitializeCheckout:n=!0}={}){if(n)return this.setOptions(e),this.initialize().then(()=>(this.components.forEach(r=>{var s;const i=p(p(p({},(s=e.order)!=null&&s.remainingAmount?{amount:e.order.remainingAmount}:{amount:this.options.amount}),this.session&&{session:this.session}),e);r.update(i)}),this));const{amount:a,secondaryAmount:o}=e;return(a||o)&&this.triggerAmountUpdate(a,o),Promise.resolve(this)}triggerAmountUpdate(e,n){cr(e)?!n||cr(n)?(this.setOptions(p({amount:e},n&&{secondaryAmount:n})),this.components.forEach(a=>{a.updateAmount(e,n)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return C(p({},fy(this.options)),{core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction})}storeElementReference(e){e&&this.components.push(e)}handleCreateError(e){var a;const n=e?`${(a=e==null?void 0:e.name)!=null?a:"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(e)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(n)}createPaymentMethodsList(e){this.paymentMethodsResponse=new Hy(this.options.paymentMethodsResponse||e,this.options)}createCoreModules(){var e,n,a;this.modules||(this.modules=Object.freeze({risk:new Fr(this,C(p({},this.options),{loadingContext:this.loadingContext})),analytics:new Ty({eventQueue:new Ny,service:new Py({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:(e=this.options.analytics)==null?void 0:e.enabled,analyticsData:(n=this.options.analytics)==null?void 0:n.analyticsData}),resources:new om(this.cdnImagesUrl),i18n:new Ay({locale:this.options.locale,customTranslations:this.options.translations,service:new dm({cdnUrl:this.cdnTranslationsUrl,sdkVersion:Pt.metadata.version}),onError:(a=this.options)==null?void 0:a.onError}),srPanel:new Lr(this,p({},this.options.srConfig))}))}assignLocaleToCore(){this.options.locale=this.modules.i18n.locale}async requestTranslations(){try{await this.modules.i18n.requestTranslations()}catch(e){console.warn("Core - requestTranslations(): Something went wrong.",e)}}async requestAnalyticsAttemptId(){var e;await this.modules.analytics.setUp(p({locale:this.options.locale},((e=this.session)==null?void 0:e.id)&&{sessionId:this.session.id}))}constructor(e){var s,d,l;je(this,"session",void 0),je(this,"paymentMethodsResponse",void 0),je(this,"modules",void 0),je(this,"options",void 0),je(this,"analyticsContext",void 0),je(this,"loadingContext",void 0),je(this,"cdnImagesUrl",void 0),je(this,"cdnTranslationsUrl",void 0),je(this,"components",[]),je(this,"afterAdditionalDetails",h=>{if(this.options.afterAdditionalDetails&&(h!=null&&h.action)){const u=this.createFromAction(h.action);return this.options.afterAdditionalDetails(u),Promise.reject(new Fa("Handled by afterAdditionalDetails"))}return Promise.resolve(h)}),je(this,"remove",h=>(this.components=this.components.filter(u=>u._id!==h._id),h.unmount(),this)),je(this,"setOptions",h=>{var u,y;this.options=C(p(p({},this.options),h),{locale:(h==null?void 0:h.locale)||((u=this.options)==null?void 0:u.locale),environment:String.prototype.toLowerCase.apply((h==null?void 0:h.environment)||((y=this.options)==null?void 0:y.environment))})}),gy(e),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions(p(p({},sm),e));const{apiUrl:n,analyticsUrl:a,cdnImagesUrl:o,cdnTranslationsUrl:r}=_y(this.options.environment,this.options._environmentUrls);this.loadingContext=n,this.analyticsContext=a,this.cdnImagesUrl=o,this.cdnTranslationsUrl=r,this.session=this.options.session&&new am(this.options.session,this.options.clientKey,this.loadingContext);const i=(s=this.options.clientKey)==null?void 0:s.substring(0,4);if((i==="test"||i==="live")&&!this.loadingContext.includes(i))throw new z("IMPLEMENTATION_ERROR",`Error: you are using a ${i} clientKey against the ${((d=this.options._environmentUrls)==null?void 0:d.api)||this.options.environment} environment`);i==="pub."&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${(l=this.options.clientKey)==null?void 0:l.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=Pt.metadata)}}je(Pt,"metadata",{version:Zo,bundleType:ys}),je(Pt,"registry",Un);async function Br(t){return await new Pt(t).initialize()}Br.register=(...t)=>{Pt.register(...t)},Br.setBundleType=t=>{Pt.setBundleType(t)};const Vr="https://docs.adyen.com/online-payments/build-your-integration/payment-result-codes#final-state-result-codes",zr={refused:{resultCode:"Refused",advice:"Inform the shopper that their payment was refused and ask them to try the payment again, for example, by using a different payment method or card.",docs:Vr},cancelled:{resultCode:"Cancelled",advice:"Inform the shopper that their payment was cancelled and check if they want to continue with their order.",docs:Vr},error:{resultCode:"Error",advice:"Inform the shopper that there was an error processing their payment.",docs:Vr}},cm=3e3,lm=t=>t==null?void 0:t.resultCode;async function um(t){var S,w;const e={};let n=null,a=null,o=!1,r=()=>!1,i=!1,s=!1,d=!1,l=null;const h=k=>{var b;try{(b=e.card)==null||b.setStatus(k)}catch(_){}},u=()=>{n&&(clearTimeout(n),n=null),a&&(clearTimeout(a),a=null)},y=await Br({session:{id:t.session.id,sessionData:t.session.session_data},clientKey:t.clientKey,environment:t.environment,countryCode:t.countryCode,locale:t.locale,translations:t.translations,beforeSubmit:(k,b,_)=>{var g;u(),(g=t.onAttempt)==null||g.call(t),_.resolve(k)},onPaymentCompleted:k=>{u(),h("success");try{t.onCompleted(lm(k))}catch(b){setTimeout(()=>{throw b})}},onPaymentFailed:k=>{var _;if(k instanceof Error)return;u(),h("error"),a=window.setTimeout(()=>r(),0),n=setTimeout(()=>{r()||h("ready")},cm);const b=k==null?void 0:k.resultCode;t.onFailed((_=Object.keys(zr).find(g=>zr[g].resultCode===b))!=null?_:"refused")},onError:k=>{if(!i)return;const b=d&&l!==null&&t.container.contains(l);t.onError(k,b)}});if(i=!0,(S=t.isCancelled)!=null&&S.call(t))return{unmount:()=>{},hasFieldErrors:()=>!1,reset:()=>{}};y.options.locale&&(t.container.lang=y.options.locale);let m="",f=!1;const x=()=>{d=!1,f=!1,e.card=new Yt(y,C(p({showPayButton:!0,hasHolderName:!0,holderNameRequired:!0,styles:t.styles,disclaimerMessage:t.disclaimerMessage},m?{data:{holderName:m}}:{}),{onChange:k=>{var _;const b=k.data.paymentMethod.holderName;typeof b=="string"&&(m=b),f=Object.values((_=k.errors)!=null?_:{}).some(Boolean)},onConfigSuccess:()=>{var k;d=!0,s||(k=t.onReady)==null||k.call(t),s=!0}})),e.card.mount(t.container),l=t.container.lastElementChild};return r=()=>o||t.container.hasChildNodes()?!1:(x(),!0),x(),t.redirectResult&&(y.submitDetails({details:{redirectResult:t.redirectResult}}),(w=t.onRedirectResultSubmitted)==null||w.call(t)),{unmount:()=>{var k;o=!0,u();try{(k=e.card)==null||k.unmount()}catch(b){}},hasFieldErrors:()=>f,reset:()=>{var k;u(),d=!1,f=!1,(k=e.card)==null||k.update({}),l=t.container.lastElementChild}}}const pm=/^https:\/\/([a-z0-9-]+\.)?provetcloud\.com$/,jn=t=>t.replace(/\/+$/,""),hm=t=>pm.test(jn(t)),Pd=t=>hm(t)||jn(t)===jn("https://provetcloud.com"),ym=(t,e)=>{const n=Pd(e)?e:"https://provetcloud.com";return`${jn(n)}/${t}`},mm=()=>`${window.location.origin}${window.location.pathname}`,_m=()=>{var t;return(t=new URL(window.location.href).searchParams.get("redirectResult"))!=null?t:void 0},fm=()=>{var t;return(t=new URL(window.location.href).searchParams.get("sessionId"))!=null?t:void 0},Ua=new Set,gm=()=>{const t=_m();if(!(t===void 0||Ua.has(t)))return Ua.add(t),t},Ad=t=>{t!==void 0&&Ua.delete(t)},Dd=()=>{const t=new URL(window.location.href),e=t.searchParams.get("redirectResult");e!==null&&(t.searchParams.delete("redirectResult"),t.searchParams.delete("sessionId"),window.history.replaceState(window.history.state,"",t),Ua.delete(e))},Ur="/api/0.1/pay",bm=3,km=1e3,vm=3e5,xm=t=>new Promise(e=>setTimeout(e,t)),_t=t=>typeof t=="string",Id=t=>_t(t)&&t.length>0||Number.isInteger(t);function wm(t){var r,i;const e=t!=null?t:{},n=(r=e.session)!=null?r:{},a=(i=e.card)!=null?i:{},o=Object.entries({"card.id":Id(a.id),"session.id":_t(n.id),"session.session_data":_t(n.session_data),"session.expires_at":_t(n.expires_at),client_key:_t(e.client_key),country_code:_t(e.country_code)}).filter(([,s])=>!s).map(([s])=>s);if(o.length>0)throw new oe("session_error",`The checkout-sessions response is missing: ${o.join(", ")}.`,{cause:t});if(e.environment!=="test"&&e.environment!=="live")throw new oe("session_error",`The checkout-sessions response has an unknown environment "${String(e.environment)}".`,{cause:t});return{card:{id:String(a.id)},session:{id:String(n.id),session_data:String(n.session_data),expires_at:String(n.expires_at)},client_key:String(e.client_key),environment:e.environment,country_code:String(e.country_code)}}const Cm=t=>{const e={id:String(t.id)};return _t(t.brand)&&(e.brand=t.brand),_t(t.last4)&&(e.last4=t.last4),_t(t.expiration_date)&&(e.expiration_date=t.expiration_date),typeof t.default=="boolean"&&(e.default=t.default),e},Sm=t=>{if(!Array.isArray(t))throw new oe("session_error","The saved-cards response is not a list.",{cause:t});return t.map(e=>e!=null?e:{}).filter(e=>Id(e.id)).map(Cm)},jr=t=>new oe("network","The server did not answer in time.",{recoverable:!0,cause:t});async function Em(t,e){try{const n=await t.json();if(_t(n==null?void 0:n.message))return String(n==null?void 0:n.message);if(_t(n==null?void 0:n.detail))return String(n==null?void 0:n.detail);if(n&&typeof n=="object"){const a=Object.entries(n).map(([o,r])=>`${o}: ${[].concat(r).join(" ")}`);if(a.length>0)return a.join(" | ")}}catch(n){if(e.aborted)throw jr(n)}return`The server responded with HTTP ${t.status}.`}class Tm{constructor(e,n){this.baseUrl=e,this.getToken=n}createCheckoutSession(e){return this.request(`${Ur}/checkout-sessions/`,{method:"POST",body:JSON.stringify(e)}).then(wm)}deleteSavedCard(e){return this.request(`${Ur}/saved-cards/${encodeURIComponent(e)}/`,{method:"DELETE"}).then(()=>{})}getSavedCards(){return this.request(`${Ur}/saved-cards/`,{method:"GET"}).then(Sm)}async request(e,n){for(let a=0;;a++){let o;const r=new AbortController,i=setTimeout(()=>r.abort(),vm);try{try{o=await fetch(`${this.baseUrl}${e}`,C(p({},n),{signal:r.signal,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`}}))}catch(s){throw r.signal.aborted?jr(s):new oe("network","Could not reach the server.",{recoverable:!0,cause:s})}if(o.status===204)return null;if(o.ok)try{return await o.json()}catch(s){throw r.signal.aborted?jr(s):new oe("session_error","The server did not return valid JSON.",{cause:s})}if(o.status===401)throw new oe("auth_error","The card tokenization token has expired.",{recoverable:!0,cause:{status:401}});if(o.status===403)throw new oe("auth_forbidden","The card tokenization token is not allowed to use the card component.",{cause:{status:403}});if(o.status>=500&&a<bm){await xm(km);continue}throw new oe("session_error",await Em(o,r.signal),{recoverable:o.status>=500,cause:{status:o.status}})}finally{clearTimeout(i)}}}}const Kn=t=>JSON.stringify([jn(t.provetOrigin),String(t.provetId),String(t.clientId),String(t.departmentId)]),ja=t=>`provet-pay-elements.envelope:${Kn(t)}`,$d=(t,e)=>t.recurringModel===e.recurringModel&&t.returnUrl===e.returnUrl,Kr=t=>typeof t=="string"||typeof t=="number",Nm=t=>{const e=t!=null?t:{};return typeof e.provetOrigin=="string"&&Kr(e.provetId)&&Kr(e.clientId)&&Kr(e.departmentId)&&(e.recurringModel==="subscription"||e.recurringModel==="one-off")&&typeof e.returnUrl=="string"},Hr=()=>{try{return window.sessionStorage}catch(t){return null}};function Rd(t,e){return{owner:t,session:e.session,card:e.card,adyen:{client_key:e.client_key,environment:e.environment,country_code:e.country_code}}}function Pm(t,e,n){var a;try{(a=Hr())==null||a.setItem(t,JSON.stringify(Rd(e,n)))}catch(o){}}const Am=(t,e)=>{var n;try{const a=t.getItem(e);return a?(n=JSON.parse(a).session)==null?void 0:n.id:void 0}catch(a){return}};function Hn(t,e){try{const n=Hr();if(!n||e!==void 0&&Am(n,t)!==e)return;n.removeItem(t)}catch(n){}}function Fd(t,e){var s,d,l,h,u,y,m;const n=Hr();if(!n)return null;let a;try{const f=n.getItem(t);a=f?JSON.parse(f):null}catch(f){return Hn(t),null}if(!a)return null;const o=Date.parse((d=(s=a.session)==null?void 0:s.expires_at)!=null?d:""),r=typeof((l=a.session)==null?void 0:l.id)=="string"&&typeof((h=a.session)==null?void 0:h.session_data)=="string"&&typeof((u=a.card)==null?void 0:u.id)=="string"&&a.card.id.length>0&&typeof((y=a.adyen)==null?void 0:y.client_key)=="string"&&typeof((m=a.adyen)==null?void 0:m.country_code)=="string"&&(a.adyen.environment==="test"||a.adyen.environment==="live"),i=Nm(a.owner)&&Kn(a.owner)===Kn(e);return!r||!i||Number.isNaN(o)||o<=Date.now()?(Hn(t),null):a}const qn=new Map,Dm=(t,e)=>{const n=Kn(t),a=JSON.stringify([n,t.recurringModel,t.returnUrl]),o=qn.get(a);if(o&&!o.dropped)return o.response;const r={identity:n,dropped:!1};return r.response=e().then(i=>(r.dropped||Pm(ja(t),t,i),i)).finally(()=>{qn.get(a)===r&&qn.delete(a)}),qn.set(a,r),r.response},Od=(t,e)=>{const n=Kn(t);qn.forEach(a=>{a.identity===n&&(a.dropped=!0)}),Hn(ja(t),e)},Im={colorAccent:"--pp-color-accent",colorButton:"--pp-color-pay-button",colorText:"--pp-color-text",colorBorder:"--pp-color-border",colorSurface:"--pp-color-surface",colorError:"--pp-color-error",borderRadius:"--pp-border-radius",fontFamily:"--pp-font-family"},qr=t=>typeof t=="string"&&t.length>0&&!t.trim().startsWith("var("),$m=t=>{const e=getComputedStyle(t),n=a=>e.getPropertyValue(a).trim()||void 0;return{text:n("--pp-color-text"),textWeaker:n("--pp-color-text-weaker"),textDanger:n("--pp-color-error")}};function Md(t,e,n={}){var l;const a=(l=t==null?void 0:t.variables)!=null?l:{},o={};for(const[h,u]of Object.entries(Im)){const y=a[h];y!==void 0&&(o[u]=y)}Object.assign(o,t==null?void 0:t.cssVariables);const r={},i={},s={},d={};return n.text&&(r.color=n.text),n.textWeaker&&(s.color=n.textWeaker),n.textDanger&&(i.color=n.textDanger),qr(a.colorText)&&(r.color=a.colorText),qr(a.fontFamily)&&(r.fontFamily=a.fontFamily),qr(a.colorError)&&(i.color=a.colorError),Object.assign(r,e==null?void 0:e.base),Object.assign(i,e==null?void 0:e.error),Object.assign(s,e==null?void 0:e.placeholder),Object.assign(d,e==null?void 0:e.validated),{cssVariables:o,styles:{base:r,error:i,placeholder:s,validated:d}}}function Rm(t,e,n){for(const[a,o]of Object.entries(Md(e).cssVariables))t.style.setProperty(a,o);return Md(e,n,$m(t))}function Fm(t){const e=document.createElement("div");return e.className="pp-loading",e.setAttribute("data-provet-pay-elements-loader",""),e.setAttribute("role","status"),e.setAttribute("aria-label",t),e.appendChild(document.createElement("span")),e}function Ld(t,e,n){const a=document.createElement("p");return a.className=`pp-message pp-message-${e}`,a.setAttribute("role","alert"),a.setAttribute("data-provet-pay-elements-message",e),n&&a.setAttribute("data-provet-pay-elements-error",n),a.textContent=t,a}const Om={visa:"Visa",mc:"Mastercard",amex:"American Express",maestro:"Maestro",discover:"Discover",diners:"Diners Club",jcb:"JCB",cup:"UnionPay"},Mm=t=>{var e;return t?(e=Om[t.toLowerCase()])!=null?e:t.charAt(0).toUpperCase()+t.slice(1):""},Bd=t=>{const e=/^(\d{4})-(\d{2})/.exec(t!=null?t:"");return e?{year:Number(e[1]),month:Number(e[2])}:null},Lm=t=>{const e=Bd(t);return e?`${e.month}/${e.year}`:""},Bm=(t,e=new Date)=>{const n=Bd(t);return n?new Date(n.year,n.month,1)<=e:!1},Vm=(t,e)=>{const n=t.last4?`•••• ${t.last4}`:e("provetPay.savedCards.noNumber"),a=Mm(t.brand);return a?`${a} ${n}`:n};function Vd(t,e){const n=document.createElement("span");n.className="pp-card";const a=document.createElement("span");a.className="pp-card-label",a.textContent=Vm(t,e),n.appendChild(a);const o=Lm(t.expiration_date);if(o){const r=document.createElement("span");r.className=Bm(t.expiration_date)?"pp-card-expiry pp-card-expired":"pp-card-expiry",r.textContent=e("provetPay.savedCards.expiry",{values:{date:o}}),n.appendChild(r)}return n}const zd="http://www.w3.org/2000/svg",Ud={chevron:"m14.0864 12.0402 1.8138 1.8137-4.7724 4.7724c-.2573.2573-.5789.373-.9133.373-.33447 0-.65606-.1286-.91333-.373l-4.77238-4.7724 1.81377-1.8137 3.85904 3.859 3.8591-3.859zm-3.859-7.93687 3.859 3.85907 1.8138-1.81376-4.7724-4.77238c-.5017-.50168-1.31208-.50168-1.81376 0l-4.77238 4.77238 1.81376 1.81376 3.85908-3.85907z",check:"m18.9985 5.35769-9.8419 10.83221c-.27855.3095-.68088.4952-1.11417.5107h-.03095c-.41782 0-.80469-.1548-1.0987-.4488l-5.91132-5.9113 2.18193-2.1819 4.76619 4.7662 8.75862-9.62524 2.2903 2.08908z"},jd="12",Kd=(t,e)=>{const n=document.createElementNS(zd,"svg");e&&n.setAttribute("class",e),n.setAttribute("viewBox","0 0 20 20"),n.setAttribute("width",jd),n.setAttribute("height",jd),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");const a=document.createElementNS(zd,"path");return a.setAttribute("d",t),n.appendChild(a),n};let zm=0;function Um(t,e,n,a){const o=document.createElement("div");o.className="pp-stack pp-saved-cards",o.setAttribute("data-provet-pay-elements-saved-cards","");const r=document.createElement("h2");r.className="pp-heading",r.textContent=n("provetPay.savedCards.heading");const i=`pp-saved-cards-${++zm}`,s=document.createElement("div");s.className="pp-dropdown";const d=document.createElement("button");d.type="button",d.className="pp-button pp-dropdown-trigger",d.setAttribute("aria-haspopup","listbox"),d.setAttribute("aria-expanded","false"),d.setAttribute("aria-controls",i),d.setAttribute("data-provet-pay-elements-saved-cards-trigger","");const l=document.createElement("span");l.className="pp-dropdown-value",d.append(l,Kd(Ud.chevron,"pp-dropdown-chevron"));const h=new Map,u=T=>{if(l.replaceChildren(),T)l.appendChild(Vd(T,n)),d.setAttribute("data-provet-pay-elements-selected-card",T.id);else{const E=t.length;l.textContent=n("provetPay.savedCards.choose",{count:E,values:{count:String(E)}}),d.removeAttribute("data-provet-pay-elements-selected-card")}h.forEach((E,P)=>{E.setAttribute("aria-selected",String(P===T))})},y=document.createElement("div");y.className="pp-dropdown-popout",y.id=i,y.hidden=!0;const m=document.createElement("ul");m.className="pp-list",m.setAttribute("role","listbox"),m.setAttribute("aria-label",n("provetPay.savedCards.list"));const f=[];for(const T of t){const E=document.createElement("li");E.setAttribute("role","none"),E.className="pp-dropdown-row";const P=document.createElement("button");P.type="button",P.className="pp-dropdown-option",P.setAttribute("role","option"),P.setAttribute("aria-selected","false"),P.setAttribute("data-provet-pay-elements-saved-card",T.id),P.append(Vd(T,n),Kd(Ud.check,"pp-check")),P.addEventListener("click",()=>{u(T),g(!0),e.onPick(T)}),h.set(T,P),f.push(P),E.appendChild(P),m.appendChild(E)}const x=document.createElement("hr");x.className="pp-dropdown-divider";const S=document.createElement("button");S.type="button",S.className="pp-dropdown-option pp-dropdown-new",S.setAttribute("data-provet-pay-elements-new-card","");const w=document.createElement("span");w.setAttribute("aria-hidden","true"),w.textContent="+ ";const k=document.createElement("span");k.append(w,n("provetPay.savedCards.addNew")),S.appendChild(k),S.addEventListener("click",()=>{g(),e.onUseNewCard()}),f.push(S),y.append(m,x,S),s.append(d,y),o.append(r,s),u(null);let b=null;const _=()=>{var T;y.hidden=!1,d.setAttribute("aria-expanded","true"),(T=f[0])==null||T.focus(),b=new AbortController,document.addEventListener("pointerdown",E=>{(!o.isConnected||!o.contains(E.target))&&g()},{signal:b.signal}),a.addEventListener("abort",()=>g(),{signal:b.signal})},g=(T=!1)=>{y.hidden=!0,d.setAttribute("aria-expanded","false"),b==null||b.abort(),b=null,T&&d.focus()};return d.addEventListener("click",()=>{y.hidden?_():g()}),y.addEventListener("keydown",T=>{var P,A,I,U;const E=f.indexOf(document.activeElement);switch(T.key){case"Escape":T.preventDefault(),g(!0);return;case"ArrowDown":T.preventDefault(),(P=f[Math.min(E+1,f.length-1)])==null||P.focus();return;case"ArrowUp":T.preventDefault(),(A=f[Math.max(E-1,0)])==null||A.focus();return;case"Home":T.preventDefault(),(I=f[0])==null||I.focus();return;case"End":T.preventDefault(),(U=f[f.length-1])==null||U.focus();return}}),o}const Hd="http://www.w3.org/2000/svg",qd="56",Wd=(t,e)=>{const n=document.createElementNS(Hd,"path");return n.setAttribute("class",t),n.setAttribute("d",e),n.setAttribute("pathLength","1"),n},jm=t=>{const e=document.createElement("div");e.className="pp-success",e.setAttribute("role","status"),e.setAttribute("tabindex","-1"),e.setAttribute("data-provet-pay-elements-success","");const n=document.createElementNS(Hd,"svg");n.setAttribute("viewBox","0 0 52 52"),n.setAttribute("width",qd),n.setAttribute("height",qd),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),n.append(Wd("pp-success-circle","M26 2a24 24 0 1 1 0 48a24 24 0 1 1 0-48"),Wd("pp-success-check","M15 27l7 7 15-15"));const a=document.createElement("p");return a.className="pp-success-text",a.textContent=t,e.append(n,a),e};class Km{constructor(e,n,a){ee(this,"fieldsHost");ee(this,"slot");ee(this,"lifetime",new AbortController);this.handlers=n,this.t=a,this.slot=document.createElement("div"),this.slot.className="pp-stack",this.fieldsHost=document.createElement("div"),this.fieldsHost.setAttribute("data-provet-pay-elements-fields",""),this.fieldsHost.hidden=!0,e.append(this.slot,this.fieldsHost)}render(e){const n=this.fieldsHost.contains(document.activeElement);switch(this.slot.replaceChildren(),this.fieldsHost.hidden=e.name!=="card",e.name){case"loading":this.slot.appendChild(Fm(this.t("provetPay.loading")));return;case"saved-cards":this.slot.appendChild(Um(e.cards,this.handlers,this.t,this.lifetime.signal));return;case"card":e.failure&&this.slot.appendChild(Ld(this.t(`provetPay.notices.${e.failure}`),"danger"));return;case"success":{const a=jm(this.t("provetPay.cardSaved"));this.slot.appendChild(a),n&&a.focus();return}case"error":{const a=e.code==="session_expired"?"session_error":e.code;this.slot.appendChild(Ld(this.t(`provetPay.errors.${a}`),"danger",a));return}}}unmount(){this.lifetime.abort()}}const Hm=6e4,qm=t=>new Promise((e,n)=>{const a=setTimeout(()=>n(new oe("auth_error","auth.refreshToken did not answer in time.")),Hm);t.then(e,n).finally(()=>clearTimeout(a))});class Wm{constructor(e,n,a,o){ee(this,"chrome");ee(this,"client");ee(this,"appearance");ee(this,"storeKey");ee(this,"token");ee(this,"mounted",null);ee(this,"attempt",0);ee(this,"offered",[]);ee(this,"finished",!1);ee(this,"ready",!1);ee(this,"paying",!1);ee(this,"closed",!1);ee(this,"showsFailure",!1);ee(this,"redirectClaim");this.handlers=n,this.init=a,this.token=a.token,this.storeKey=ja(a),this.client=new Tm(ym(a.provetId,a.provetOrigin),()=>this.token),this.chrome=new Km(e,{onPick:r=>this.pick(r),onUseNewCard:()=>{this.guard(()=>this.useNewCard())},onRemove:r=>{this.guard(()=>this.removeCard(r))}},o.t),this.appearance=Rm(e,a.appearance,a.styles)}run(){return this.chrome.render({name:"loading"}),this.guard(()=>this.resume())}goBack(){var e,n;return(this.showsFailure||(e=this.mounted)!=null&&e.hasFieldErrors())&&(this.showsFailure=!1,(n=this.mounted)==null||n.reset()),this.chrome.render({name:"loading"}),this.guard(()=>this.offerSavedCards(this.offered))}unmount(){var e;this.finished=!0,Ad(this.redirectClaim),this.chrome.unmount(),(e=this.mounted)==null||e.unmount(),this.mounted=null}get idle(){return!this.finished&&!this.paying&&!this.closed}owner(){var e;return{provetOrigin:this.init.provetOrigin,provetId:this.init.provetId,clientId:this.init.clientId,departmentId:this.init.departmentId,recurringModel:(e=this.init.recurringModel)!=null?e:"subscription",returnUrl:mm()}}fittingSession(e=this.owner()){const n=Fd(this.storeKey,e);return n&&$d(n.owner,e)?n:null}async resume(){const e=this.owner(),n=Fd(this.storeKey,e),a=fm(),o=n!==null&&(a===void 0||a===n.session.id);this.redirectClaim=o?gm():void 0;const r=this.redirectClaim;if(n&&(r!==void 0||$d(n.owner,e)))return this.offered=await this.loadSavedCards().catch(i=>{if(i instanceof oe&&(i.code==="auth_error"||i.code==="auth_forbidden"))throw i;return[]}),this.finished?void 0:this.mount(n.session,n.adyen,n.card,!0,r);await this.offerSavedCards()}loadSavedCards(){return this.withAuthRetry(()=>this.client.getSavedCards())}async offerSavedCards(e){const n=await this.loadSavedCards().catch(a=>{if(!e)throw a;return e});if(!this.finished){if(this.offered=n,n.length===0)return this.useNewCard();this.showOffer(n)}}pick(e){var n;this.attempt++,(n=this.mounted)==null||n.unmount(),this.mounted=null,Od(this.init),this.handlers.onSuccess(e)}showOffer(e){this.chrome.render({name:"saved-cards",cards:e}),this.handlers.onBackAvailable(!1),this.markReady()}showCard(e){this.showsFailure=e!==void 0,this.chrome.render({name:"card",failure:e}),this.handlers.onBackAvailable(this.offered.length>0)}showSuccess(){this.chrome.render({name:"success"}),this.handlers.onBackAvailable(!1)}async useNewCard(){if(this.mounted&&this.fittingSession())return this.showCard();await this.startIntent()}async removeCard(e){this.chrome.render({name:"loading"}),await this.withAuthRetry(()=>this.client.deleteSavedCard(e.id)),await this.offerSavedCards()}async startIntent(){this.chrome.render({name:"loading"});const e=await this.withAuthRetry(()=>this.openSession());this.finished||await this.mount(e.session,e.adyen,e.card,e.resumed)}async openSession(){const e=this.owner(),n=this.fittingSession(e);if(n)return C(p({},n),{resumed:!0});const a=await Dm(e,()=>this.client.createCheckoutSession({department:this.init.departmentId,recurring_model:e.recurringModel,return_url:e.returnUrl}));return C(p({},Rd(e,a)),{resumed:!1})}async mount(e,n,a,o,r){var s;(s=this.mounted)==null||s.unmount();const i=++this.attempt;this.paying=!!r,this.closed=!1;try{const d=await um({container:this.chrome.fieldsHost,session:e,clientKey:n.client_key,environment:n.environment,countryCode:n.country_code,locale:this.init.locale,translations:this.init.translations,styles:this.appearance.styles,disclaimerMessage:this.init.disclaimerMessage,onCompleted:l=>{i===this.attempt&&(this.finished=!0,Od(this.init,e.id),this.showSuccess(),this.handlers.onSuccess(a,l))},onAttempt:()=>{this.finished||i!==this.attempt||(this.paying=!0,this.showCard(),this.handlers.onBackAvailable(!1))},onFailed:l=>{this.finished||i!==this.attempt||(this.paying=!1,this.showCard(l),this.handlers.onRefused(zr[l].resultCode))},onError:(l,h)=>{if(i!==this.attempt)return;const u=Ga(l);if(u.code==="attempts_exceeded"&&(Hn(this.storeKey,e.id),this.closed=!0),!this.finished){if(this.paying=!1,!h||u.code==="attempts_exceeded")return this.fail(u);this.showCard("error"),this.handlers.onError(u.surfaced)}},onReady:()=>{!this.finished&&i===this.attempt&&this.markReady()},redirectResult:r,onRedirectResultSubmitted:()=>{Dd(),this.redirectClaim=void 0},isCancelled:()=>this.finished||i!==this.attempt});if(this.finished||i!==this.attempt){d.unmount();return}this.mounted=d,r||this.showCard()}catch(d){if(this.finished||i!==this.attempt)return;throw this.paying=!1,o?(Hn(this.storeKey,e.id),r&&Dd(),new oe("session_expired","The card session is no longer usable.",{recoverable:!0,cause:d})):Ga(d)}}async withAuthRetry(e){try{return await e()}catch(n){const{onAuthExpired:a}=this.handlers;if(this.finished||!(n instanceof oe)||n.code!=="auth_error"||!a||(this.token=await qm(a()),this.finished))throw n;return e()}}async guard(e){try{await e()}catch(n){const a=this.toPayError(n);if(a.code!=="session_expired")return this.fail(a);try{await this.useNewCard()}catch(o){this.fail(this.toPayError(o))}}}toPayError(e){return e instanceof oe?e:Ga(e)}markReady(){this.ready||(this.ready=!0,this.handlers.onReady())}fail(e){this.finished||(Ad(this.redirectClaim),this.redirectClaim=void 0,this.showsFailure=!0,this.chrome.render({name:"error",code:e.code}),this.handlers.onError(e.surfaced))}}const Wr={"provetPay.backToSavedCards":"Back to saved cards","provetPay.cardSaved":"Card saved","provetPay.errors.attempts_exceeded":"This card form had too many attempts. Try again later, or use another card.","provetPay.errors.auth_error":"The card form is not available right now. Reload the page and try again.","provetPay.errors.auth_forbidden":"The card form is not available right now. Reload the page and try again.","provetPay.errors.cancelled":"The card setup was cancelled.","provetPay.errors.config_invalid":"Something went wrong while setting up the card.","provetPay.errors.network":"Could not reach the server. Check your connection and try again.","provetPay.errors.session_error":"The card form could not be opened. Try again later.","provetPay.errors.technical":"Something went wrong while setting up the card.","provetPay.loading":"Loading the card form","provetPay.notices.cancelled":"The card check was cancelled. Try again.","provetPay.notices.error":"Something went wrong while checking the card. Try again, or use another card.","provetPay.notices.refused":"The card was declined. Try another card.","provetPay.savedCards.addNew":"Add a new card","provetPay.savedCards.choose":"Choose your saved card","provetPay.savedCards.choose__plural":"Choose one of your %{count} saved cards","provetPay.savedCards.expiry":"(EXP: %{date})","provetPay.savedCards.heading":"Use a saved card","provetPay.savedCards.list":"Saved cards","provetPay.savedCards.noNumber":"Saved card","provetPay.savedCards.remove":"Remove %{card}","provetPay.savedCards.removeCancel":"Cancel","provetPay.savedCards.removeConfirm":"Remove","provetPay.savedCards.removeQuestion":"Remove this saved card?"},Jt="en-GB",Gm=Object.freeze(p({},Wr)),Gr=new Map([[Jt,Wr]]),Ka=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Yr=t=>t.toLowerCase().substring(0,2),Gd=t=>t.length>=2&&t.length<=5,Yd=(t,e)=>e.find(n=>Yr(n)===Yr(t)),Jd=t=>{const e=t.replace("_","-");if(/^[a-z]{2}-[A-Z]{2}$/.test(e))return e;const[n,a]=e.split("-");if(!n||!a)return;const o=`${n.toLowerCase()}-${a.toUpperCase()}`;return o.length===5?o:void 0},Ym=(t,e)=>{var a;if(!Gd(t))return Jt;const n=Jd(t);return n&&e.includes(n)?n:(a=Yd(n!=null?n:t,e))!=null?a:Jt},Jm=t=>{var n;const e={};for(const[a,o]of Object.entries(t))Gd(a)&&(e[(n=Jd(a))!=null?n:Yr(a)]=o);return e},Qd=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Qm=(t,e,{values:n={},count:a=0}={})=>{const o=[`${e}__${a}`,...a>1?[`${e}__plural`]:[],e].find(r=>Qd(t,r));return o===void 0?e:t[o].replace(/%{(\w+)}/g,(r,i)=>Qd(n,i)&&n[i]||"")},Zm="provetPay.",Xm=t=>Ka(t)&&Object.keys(t).some(e=>e.startsWith(Zm)),e_=t=>Object.fromEntries(Object.entries(Ka(t)?t:{}).filter(e=>typeof e[1]=="string")),t_=(t,e)=>{var h,u;const n=Jm(e!=null?e:{}),a=Array.from(Gr.keys()),o=Object.keys(n).filter(y=>Xm(n[y])),r=Array.from(new Set([...a,...o])).sort((y,m)=>y.localeCompare(m)),i=Ym(t!=null?t:Jt,r),s=(u=Gr.get(i))!=null?u:Gr.get((h=Yd(i,a))!=null?h:Jt),d=p(p(p({},Wr),s),e_(n[i]));return{locale:i,t:(y,m)=>Qm(d,y,m)}};function n_(t){const e=typeof t=="string"?document.querySelector(t):t;if(!(e instanceof HTMLElement))throw new oe("config_invalid",typeof t=="string"?`No element matches the container selector "${t}".`:"The container option must be an HTMLElement or a selector string.");return e}const Wn={container:"provet-pay-elements",back:"provet-pay-elements-back",root:"pp-root"},Jr="provet-pay-elements-style",Zd=[se,Ee,ut].join(`
7
+ `),a_=()=>{if(document.getElementById(Jr))return;const t=document.createElement("meta");if(t.id=Jr,typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in document){const n=new CSSStyleSheet;n.replaceSync(Zd),document.adoptedStyleSheets=[...document.adoptedStyleSheets,n],document.head.appendChild(t);return}const e=document.createElement("style");e.id=Jr,e.textContent=Zd,document.head.appendChild(e)},o_=["token","provetId","clientId","departmentId"],r_=t=>t==null||t==="",Xe=t=>new oe("config_invalid",t),i_=t=>(typeof t=="string"||typeof t=="number")&&/^\d{1,10}$/.test(String(t)),s_=t=>{if(!t||typeof t!="object")throw Xe("The auth option is required.");for(const e of o_)if(r_(t[e]))throw Xe(`The auth.${e} option is required.`);if(typeof t.token!="string")throw Xe("The auth.token option must be a string.");if(!i_(t.clientId))throw Xe("The auth.clientId option must be the Provet client id in the token's audience, for example 2624.");if(t.provetOrigin!==void 0&&(typeof t.provetOrigin!="string"||!Pd(t.provetOrigin)))throw Xe("The auth.provetOrigin option must be a Provet instance, for example https://us.provetcloud.com.");if(t.refreshToken!==void 0&&typeof t.refreshToken!="function")throw Xe("The auth.refreshToken option must be a function.")},Xd=t=>{if(t!=null&&typeof t!="string")throw Xe("The locale option must be a string, for example fi-FI.")},ec=t=>t!=null&&t.length?t:Jt,d_=(t,e)=>{let n=t.locale;return Reflect.defineProperty(t,"locale",{configurable:!0,enumerable:!0,get:()=>n,set:a=>{e(a),n=a}}),()=>Reflect.defineProperty(t,"locale",{configurable:!0,enumerable:!0,writable:!0,value:n})},c_=t=>{if(t!=null){if(!Ka(t))throw Xe("The translations option must be an object keyed by locale.");for(const[e,n]of Object.entries(t))if(!Ka(n))throw Xe(`The translations.${e} option must be an object.`)}},l_=t=>async()=>{let e;try{e=await t()}catch(n){throw new oe("auth_error",n instanceof Error&&n.message?n.message:"auth.refreshToken failed.",{cause:n})}if(typeof e!="string"||e.length===0)throw new oe("auth_error","auth.refreshToken must resolve to a non-empty string.");return e},Ha=new WeakMap,tc="The container already holds the card form. Call unmount() on it first.";class nc{constructor(e,n){ee(this,"container");ee(this,"locale");ee(this,"identity");ee(this,"root");ee(this,"back");ee(this,"i18n");ee(this,"controller",null);var o;this.options=n;const{auth:a}=n;if(s_(a),typeof n.onSuccess!="function")throw Xe("The onSuccess callback is required.");Xd(n.locale),c_(n.translations),this.locale=ec(n.locale),this.i18n=t_(n.locale,n.translations),this.identity=ja({provetOrigin:(o=a.provetOrigin)!=null?o:"https://provetcloud.com",provetId:a.provetId,clientId:a.clientId,departmentId:a.departmentId}),this.container=n_(e),this.claimContainer(),this.back=this.createBack(),this.root=document.createElement("div"),this.root.className=Wn.root,this.root.lang=this.i18n.locale,a_(),this.container.classList.add(Wn.container),this.container.append(this.back,this.root),Ha.set(this.container,this),this.start()}unmount(){var e;(e=this.controller)==null||e.unmount(),this.controller=null,Ha.get(this.container)===this&&(Ha.delete(this.container),this.container.classList.remove(Wn.container)),this.back.remove(),this.root.remove()}claimContainer(){const e=Ha.get(this.container);if(e)throw e.identity===this.identity?Xe(tc):(e.unmount(),Xe("The container held the card form for another shopper, so both forms were stopped. Call unmount() before mounting for another shopper."));if(Array.from(this.container.children).some(n=>n.classList.contains(Wn.root)))throw Xe(tc)}get idle(){var e,n;return(n=(e=this.controller)==null?void 0:e.idle)!=null?n:!1}createBack(){const e=document.createElement("button");e.type="button",e.className=Wn.back,e.hidden=!0,e.lang=this.i18n.locale;const n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent="‹",e.append(n,this.i18n.t("provetPay.backToSavedCards")),e.addEventListener("click",()=>{var a;e.hidden=!0,(a=this.controller)==null||a.goBack()}),e}start(){var a,o;const{auth:e}=this.options,n={token:e.token,provetOrigin:(a=e.provetOrigin)!=null?a:"https://provetcloud.com",provetId:e.provetId,clientId:e.clientId,departmentId:e.departmentId,recurringModel:this.options.recurringModel,locale:this.locale,translations:(o=this.options.translations)!=null?o:void 0,appearance:this.options.appearance,styles:this.options.styles,disclaimerMessage:this.options.disclaimerMessage};this.controller=new Wm(this.root,this.handlers(),n,this.i18n),this.controller.run()}handlers(){const{refreshToken:e}=this.options.auth;return{onReady:()=>{var n,a;return(a=(n=this.options).onReady)==null?void 0:a.call(n)},onSuccess:(n,a)=>this.options.onSuccess(a?{card:n,resultCode:a}:{card:n}),onRefused:n=>{var a,o;return(o=(a=this.options).onRefused)==null?void 0:o.call(a,{resultCode:n})},onError:n=>{var a,o;return(o=(a=this.options).onError)==null?void 0:o.call(a,n)},onAuthExpired:e?l_(e):void 0,onBackAvailable:n=>{this.back.hidden=!n}}}}function u_(t,e){let n=new nc(t,e);const a=r=>{Xd(r),!(!n.idle||ec(r)===n.locale)&&(n.unmount(),n=new nc(n.container,C(p({},e),{locale:r})))},o=d_(e,a);return{unmount:()=>{n.unmount(),o()},changeLocale:a}}const p_="0.18.1";X.DEFAULT_LOCALE=Jt,X.DEFAULT_TRANSLATIONS=Gm,X.VERSION=p_,X.mount=u_,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
8
8
  //# sourceMappingURL=provet-pay-elements.umd.js.map