@finyxpay/ui 0.1.3 → 0.1.4

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.
@@ -1,4 +1,4 @@
1
- (function(ze,mn){typeof exports=="object"&&typeof module<"u"?mn(exports):typeof define=="function"&&define.amd?define(["exports"],mn):(ze=typeof globalThis<"u"?globalThis:ze||self,mn(ze.Finyx={}))})(this,(function(ze){"use strict";function mn(e){return{"Content-Type":"application/json","x-api-key":e}}function zt(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.message=="string"&&t.message.trim()?t.message:typeof t.error=="string"&&t.error.trim()?t.error:null}const ds=new Map,Wo=new Map;class vu{constructor(t,n){this.apiKey=t,this.apiBase=n,this.apiVersion="v4"}headers(){return mn(this.apiKey)}methodsKey(){return`${this.apiBase}\0${this.apiKey}\0v4`}async getClientConfig(){throw new Error("Adyen client config is returned from createPayment on API v4.")}async getPaymentMethods(t){const n=this.methodsKey(),r=ds.get(n);if(r)return r;const o=Wo.get(n);if(o)return o;const i=this.fetchPaymentMethods().then(a=>(ds.set(n,a),a)).finally(()=>{Wo.delete(n)});return Wo.set(n,i),i}async fetchPaymentMethods(){const t=await fetch(`${this.apiBase}/api/v4/payment-methods`,{headers:this.headers()}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(zt(n)||`Failed to load payment methods (${t.status})`);return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]}async createPayment(t){try{const n=await fetch(`${this.apiBase}/api/v4/payments`,{method:"POST",headers:this.headers(),body:JSON.stringify({amount:t.amount,currency:t.currency,orderId:t.orderId,paymentMethod:t.paymentMethod,items:t.items,returnUrl:t.returnUrl,iframe3ds:!0,autoCapture:t.autoCapture??!0,metadata:t.metadata??{source:"finyx-js",version:"0.1.0"},...t.existingPaymentId?{paymentId:t.existingPaymentId}:{}})}),r=await n.json().catch(()=>null);return n.ok?{ok:!0,data:r}:{ok:!1,message:zt(r)||"Checkout failed"}}catch(n){return{ok:!1,message:n instanceof Error?n.message:"Checkout failed"}}}async confirmPayment(t,n){try{const r=await fetch(`${this.apiBase}/api/v4/payments/${t}/confirm`,{method:"POST",headers:this.headers(),body:JSON.stringify(n)}),o=await r.json().catch(()=>null);return r.ok?{ok:!0,data:o}:{ok:!1,message:zt(o)||"Confirm failed"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:"Confirm failed"}}}async getPayment(t){try{const n=await fetch(`${this.apiBase}/api/v4/payments/${t}`,{headers:this.headers()});return n.ok?await n.json():null}catch{return null}}}const Cu={SGD:"SG",USD:"US",HKD:"HK",AUD:"AU",GBP:"GB",EUR:"DE",CNY:"CN",JPY:"JP"};function Fr(e){return Cu[e.toUpperCase()]??"SG"}const _u=new Set(["card","googlepay","applepay","paynow","wechatpay","alipay"]),wu={scheme:"card",card:"card",googlepay:"googlepay",applepay:"applepay",paynow:"paynow",wechatpay:"wechatpay",wechatpayqr:"wechatpay",alipay:"alipay"},Su=new Set(["wechatpayminiprogram","wechatpayweb","wechatpaysdk","alipay_wap"]),ku={card:"Credit Card",googlepay:"Google Pay",applepay:"Apple Pay",paynow:"PayNow",wechatpay:"WeChat Pay",alipay:"Alipay"};function Eu(e){const t=e.toLowerCase();return Su.has(t)?null:wu[t]??null}function xu(e){return _u.has(e)}function us(e){return e==="card"?"scheme":e}function Pu(e){const t=Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.paymentMethods)?e.paymentMethods:[],n=new Set,r=[];for(const o of t){if(!o||typeof o!="object")continue;const i=o;if(typeof i.type!="string")continue;const a=Eu(i.type);if(!a||!xu(a)||n.has(a))continue;n.add(a);const s=Array.isArray(i.brands)?i.brands.filter(l=>typeof l=="string"):void 0;r.push({type:a,name:typeof i.name=="string"&&i.name.trim()?i.name:ku[a]??a,...s?.length?{brands:s}:{}})}return r}const hs=new Map,Go=new Map;class Tu{constructor(t,n){this.apiKey=t,this.apiBase=n,this.apiVersion="v2"}headers(){return mn(this.apiKey)}async getClientConfig(){const t=await fetch(`${this.apiBase}/v2/koomipay/payment-config`,{method:"POST",headers:this.headers(),body:JSON.stringify({})}),n=await t.json().catch(()=>null);if(!Lr(n))throw new Error(zt(n)||`Failed to load payment config (${t.status})`);const r=n.data||{},o=typeof r.clientKey=="string"?r.clientKey:"";if(!o)throw new Error("Adyen client key is missing.");return{clientKey:o,environment:typeof r.environment=="string"?r.environment:"test",locale:typeof r.locale=="string"?r.locale:"en-US"}}async getPaymentMethods(t){const n=t?.amount,r=t?.currency,o=`${this.apiBase}\0${this.apiKey}\0v2\0${n??""}\0${r??""}`,i=hs.get(o);if(i)return i;const a=Go.get(o);if(a)return a;const s=this.fetchPaymentMethods(n,r).then(l=>(hs.set(o,l),l)).finally(()=>{Go.delete(o)});return Go.set(o,s),s}async fetchPaymentMethods(t,n){const r=await fetch(`${this.apiBase}/v2/koomipay/payment-methods`,{method:"POST",headers:this.headers(),body:JSON.stringify({countryCode:Fr(n||"SGD"),amount:{currency:n||"SGD",price:t??0},merchantOrigin:typeof window<"u"?window.location.origin:void 0})}),o=await r.json().catch(()=>null);if(!Lr(o)&&!Array.isArray(o?.paymentMethods))throw new Error(zt(o)||`Failed to load payment methods (${r.status})`);return Pu(o)}async createPayment(t){try{const n=t.encryptedPaymentMethod||{type:us(t.paymentMethod.type)};if(t.existingOrderId)return this.postCheckout(`${this.apiBase}/api/v2/paymentLinkCheckout`,{data:{orderId:t.existingOrderId,paymentMethod:n,browserInfo:t.browserInfo||{}}});const r=t.autoCapture===!0?"/v2/koomipay/instant-checkout":"/v2/koomipay/checkout";return this.postCheckout(`${this.apiBase}${r}`,{orderID:t.orderId,amount:{currency:t.currency,price:t.amount},paymentMethod:n,browserInfo:t.browserInfo||{},items:t.items,returnUrl:t.returnUrl,autoCapture:t.autoCapture??!1,metadata:t.metadata??{source:"finyx-js",version:"0.1.0"}})}catch(n){return{ok:!1,message:n instanceof Error?n.message:"Checkout failed"}}}async confirmPayment(t,n){try{const o=await(await fetch(`${this.apiBase}/v2/koomipay/payment-details`,{method:"POST",headers:this.headers(),body:JSON.stringify({data:{details:n.details,paymentData:n.paymentData,paymentMethod:n.paymentMethod,browserInfo:n.browserInfo}})})).json().catch(()=>null);return Lr(o)?{ok:!0,data:ps(o,t)}:{ok:!1,message:zt(o)||"Confirm failed"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:"Confirm failed"}}}async getPayment(t){try{const n=await fetch(`${this.apiBase}/api/v2/checkout/payments/${t}/status`,{headers:this.headers()});if(!n.ok)return null;const o=(await n.json().catch(()=>null))?.data?.payment;if(!o)return null;const i=String(o.id??t),a=typeof o.transactionStatus=="string"?o.transactionStatus:void 0;return{payment:{id:i,transactionStatus:a,platform:"ADYEN"}}}catch{return null}}async postCheckout(t,n){const o=await(await fetch(t,{method:"POST",headers:this.headers(),body:JSON.stringify(n)})).json().catch(()=>null);return Lr(o)?{ok:!0,data:ps(o)}:{ok:!1,message:zt(o)||"Checkout failed"}}}function ps(e,t=""){const n=e&&typeof e=="object"?e:{},r=n.data&&typeof n.data=="object"?n.data:n,o=r.action&&typeof r.action=="object"?{...r.action}:void 0,i=String(r.paymentID||r.paymentId||t||""),a=typeof r.resultCode=="string"?r.resultCode:void 0,s=typeof r.redirectUrl=="string"?r.redirectUrl:void 0;return o&&s&&!o.url&&(o.type==="redirect"||a==="RedirectShopper")&&(o.url=s),{provider:"ADYEN",paymentData:{action:o,resultCode:a},payment:{id:i,transactionStatus:typeof r.paymentStatus=="string"?r.paymentStatus:a,platform:"ADYEN"}}}function Lr(e){return!e||typeof e!="object"?!1:e.success!==!1}function Du(e,t,n){return n==="v2"?new Tu(e,t):new vu(e,t)}const Au={dev:"http://localhost:32022",test:"https://awx-api-pay-demo.koomi.app",playground:"https://awx-api-pay-demo.koomi.app",sandbox:"https://api-sandbox.koomipay.com",live:"https://api.koomipay.com"};function Yo(e,t){const n=t?.trim();if(n)return n.replace(/\/$/,"");const[r]=e.split("."),o=r?Au[r]:void 0;if(!o)throw new Error("[@finyxpay/ui] Invalid API Key. Expected a prefix of dev, test, playground, sandbox, or live — or pass apiBase.");return o}function Nu(e){try{if(new URL(e).hostname==="api.koomipay.com")return"prod"}catch{}return"demo"}const Iu={colorPrimary:"--fy-color-primary",colorBackground:"--fy-color-bg",colorText:"--fy-color-text",colorMuted:"--fy-color-muted",colorDanger:"--fy-color-danger",borderRadius:"--fy-radius",fontFamily:"--fy-font"};function Ru(e,t){const n=t?.theme??"default";e.dataset.fyTheme=n;const r=t?.variables;if(r)for(const[o,i]of Object.entries(r)){const a=Iu[o];a&&i&&e.style.setProperty(a,i)}}function Or(...e){return e.filter(Boolean).join(" ")}function k(e,t={},n=[]){const r=document.createElement(e);for(const[o,i]of Object.entries(t))i===void 0||i===!1||(o==="class"?r.className=String(i):o==="text"?r.textContent=String(i):i===!0?r.setAttribute(o,""):r.setAttribute(o,String(i)));for(const o of n)o&&r.append(typeof o=="string"?document.createTextNode(o):o);return r}function $u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function fn(e,t){try{return new Intl.NumberFormat("en-SG",{style:"currency",currency:t}).format(e)}catch{return`${t} ${e.toFixed(2)}`}}function Br(e){if(e)try{const t=new URL(e);if(t.protocol==="http:"||t.protocol==="https:")return t.href}catch{}}function Mu(e="fy"){return`${e}-${Math.random().toString(36).slice(2,10)}`}class Vr{constructor(t,n,r){this.container=null,this.root=null,this.listeners=new Map,this.type=t,this.options={...n},this.ctx=r}mount(t){if(this.container)return console.warn(`[@finyxpay/ui] Element "${this.type}" is already mounted.`),this;const n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error(`[@finyxpay/ui] Cannot mount "${this.type}": container not found.`);return this.container=n,this.root=document.createElement("div"),this.root.className="fy",Ru(this.root,this.ctx.appearance),n.appendChild(this.root),this.render(),this.emit("ready",void 0),this}unmount(){return!this.container||!this.root?this:(this.onUnmount(),this.container.removeChild(this.root),this.root=null,this.container=null,this)}destroy(){this.unmount(),this.listeners.clear()}update(t){return this.options={...this.options,...t},this.root&&this.render(),this}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),this}off(t,n){return this.listeners.get(t)?.delete(n),this}emit(t,n){this.listeners.get(t)?.forEach(r=>{r(n)})}get showWordmark(){return this.ctx.appearance.showWordmark!==!1}onUnmount(){this.root&&$u(this.root)}}function Fu(){if(typeof navigator>"u")return!1;const e=navigator.userAgent,t=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return/iPad|iPhone|iPod/.test(e)||t}function Zo(){if(typeof window>"u"||typeof ApplePaySession>"u")return!1;try{return ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(4)}catch{return!1}}function Qo(){return typeof window>"u"||Fu()||!window.isSecureContext?!1:typeof window.PaymentRequest=="function"}function Lu(e){return e==="applepay"?Zo():e==="googlepay"?Qo():!0}function Jo(e){return e.filter(t=>Lu(t.type))}function ms(e,t){if(!t?.length)return e;const n=new Set(t.map(r=>r.toLowerCase()));return e.filter(r=>n.has(r.type.toLowerCase())?!0:!!r.brands?.some(o=>n.has(o.toLowerCase()))).map(r=>{if(!r.brands?.length||n.has(r.type.toLowerCase())&&!r.brands.some(i=>n.has(i.toLowerCase())))return r;const o=r.brands.filter(i=>n.has(i.toLowerCase()));return o.length?{...r,brands:o}:r})}const Ou=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="Card">
1
+ (function(ze,mn){typeof exports=="object"&&typeof module<"u"?mn(exports):typeof define=="function"&&define.amd?define(["exports"],mn):(ze=typeof globalThis<"u"?globalThis:ze||self,mn(ze.Finyx={}))})(this,(function(ze){"use strict";function mn(e){return{"Content-Type":"application/json","x-api-key":e}}function zt(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.message=="string"&&t.message.trim()?t.message:typeof t.error=="string"&&t.error.trim()?t.error:null}const ds=new Map,Wo=new Map;class vu{constructor(t,n){this.apiKey=t,this.apiBase=n,this.apiVersion="v4"}headers(){return mn(this.apiKey)}methodsKey(){return`${this.apiBase}\0${this.apiKey}\0v4`}async getClientConfig(){throw new Error("Adyen client config is returned from createPayment on API v4.")}async getPaymentMethods(t){const n=this.methodsKey(),r=ds.get(n);if(r)return r;const o=Wo.get(n);if(o)return o;const i=this.fetchPaymentMethods().then(a=>(ds.set(n,a),a)).finally(()=>{Wo.delete(n)});return Wo.set(n,i),i}async fetchPaymentMethods(){const t=await fetch(`${this.apiBase}/api/v4/payment-methods`,{headers:this.headers()}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(zt(n)||`Failed to load payment methods (${t.status})`);return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]}async createPayment(t){try{const n=await fetch(`${this.apiBase}/api/v4/payments`,{method:"POST",headers:this.headers(),body:JSON.stringify({amount:t.amount,currency:t.currency,orderId:t.orderId,paymentMethod:t.paymentMethod,items:t.items,returnUrl:t.returnUrl??"",iframe3ds:!0,autoCapture:t.autoCapture??!0,metadata:t.metadata??{source:"finyx-js",version:"0.1.0"},...t.existingPaymentId?{paymentId:t.existingPaymentId}:{}})}),r=await n.json().catch(()=>null);return n.ok?{ok:!0,data:r}:{ok:!1,message:zt(r)||"Checkout failed"}}catch(n){return{ok:!1,message:n instanceof Error?n.message:"Checkout failed"}}}async confirmPayment(t,n){try{const r=await fetch(`${this.apiBase}/api/v4/payments/${t}/confirm`,{method:"POST",headers:this.headers(),body:JSON.stringify(n)}),o=await r.json().catch(()=>null);return r.ok?{ok:!0,data:o}:{ok:!1,message:zt(o)||"Confirm failed"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:"Confirm failed"}}}async getPayment(t){try{const n=await fetch(`${this.apiBase}/api/v4/payments/${t}`,{headers:this.headers()});return n.ok?await n.json():null}catch{return null}}}const Cu={SGD:"SG",USD:"US",HKD:"HK",AUD:"AU",GBP:"GB",EUR:"DE",CNY:"CN",JPY:"JP"};function Fr(e){return Cu[e.toUpperCase()]??"SG"}const _u=new Set(["card","googlepay","applepay","paynow","wechatpay","alipay"]),wu={scheme:"card",card:"card",googlepay:"googlepay",applepay:"applepay",paynow:"paynow",wechatpay:"wechatpay",wechatpayqr:"wechatpay",alipay:"alipay"},Su=new Set(["wechatpayminiprogram","wechatpayweb","wechatpaysdk","alipay_wap"]),ku={card:"Credit Card",googlepay:"Google Pay",applepay:"Apple Pay",paynow:"PayNow",wechatpay:"WeChat Pay",alipay:"Alipay"};function Eu(e){const t=e.toLowerCase();return Su.has(t)?null:wu[t]??null}function xu(e){return _u.has(e)}function us(e){return e==="card"?"scheme":e}function Pu(e){const t=Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.paymentMethods)?e.paymentMethods:[],n=new Set,r=[];for(const o of t){if(!o||typeof o!="object")continue;const i=o;if(typeof i.type!="string")continue;const a=Eu(i.type);if(!a||!xu(a)||n.has(a))continue;n.add(a);const s=Array.isArray(i.brands)?i.brands.filter(l=>typeof l=="string"):void 0;r.push({type:a,name:typeof i.name=="string"&&i.name.trim()?i.name:ku[a]??a,...s?.length?{brands:s}:{}})}return r}const hs=new Map,Go=new Map;class Tu{constructor(t,n){this.apiKey=t,this.apiBase=n,this.apiVersion="v2"}headers(){return mn(this.apiKey)}async getClientConfig(){const t=await fetch(`${this.apiBase}/v2/koomipay/payment-config`,{method:"POST",headers:this.headers(),body:JSON.stringify({})}),n=await t.json().catch(()=>null);if(!Lr(n))throw new Error(zt(n)||`Failed to load payment config (${t.status})`);const r=n.data||{},o=typeof r.clientKey=="string"?r.clientKey:"";if(!o)throw new Error("Adyen client key is missing.");return{clientKey:o,environment:typeof r.environment=="string"?r.environment:"test",locale:typeof r.locale=="string"?r.locale:"en-US"}}async getPaymentMethods(t){const n=t?.amount,r=t?.currency,o=`${this.apiBase}\0${this.apiKey}\0v2\0${n??""}\0${r??""}`,i=hs.get(o);if(i)return i;const a=Go.get(o);if(a)return a;const s=this.fetchPaymentMethods(n,r).then(l=>(hs.set(o,l),l)).finally(()=>{Go.delete(o)});return Go.set(o,s),s}async fetchPaymentMethods(t,n){const r=await fetch(`${this.apiBase}/v2/koomipay/payment-methods`,{method:"POST",headers:this.headers(),body:JSON.stringify({countryCode:Fr(n||"SGD"),amount:{currency:n||"SGD",price:t??0},merchantOrigin:typeof window<"u"?window.location.origin:void 0})}),o=await r.json().catch(()=>null);if(!Lr(o)&&!Array.isArray(o?.paymentMethods))throw new Error(zt(o)||`Failed to load payment methods (${r.status})`);return Pu(o)}async createPayment(t){try{const n=t.encryptedPaymentMethod||{type:us(t.paymentMethod.type)};if(t.existingOrderId)return this.postCheckout(`${this.apiBase}/api/v2/paymentLinkCheckout`,{data:{orderId:t.existingOrderId,paymentMethod:n,browserInfo:t.browserInfo||{}}});const r=t.autoCapture===!0?"/v2/koomipay/instant-checkout":"/v2/koomipay/checkout";return this.postCheckout(`${this.apiBase}${r}`,{orderID:t.orderId,amount:{currency:t.currency,price:t.amount},paymentMethod:n,browserInfo:t.browserInfo||{},items:t.items,returnUrl:t.returnUrl??"",autoCapture:t.autoCapture??!1,metadata:t.metadata??{source:"finyx-js",version:"0.1.0"}})}catch(n){return{ok:!1,message:n instanceof Error?n.message:"Checkout failed"}}}async confirmPayment(t,n){try{const o=await(await fetch(`${this.apiBase}/v2/koomipay/payment-details`,{method:"POST",headers:this.headers(),body:JSON.stringify({data:{details:n.details,paymentData:n.paymentData,paymentMethod:n.paymentMethod,browserInfo:n.browserInfo}})})).json().catch(()=>null);return Lr(o)?{ok:!0,data:ps(o,t)}:{ok:!1,message:zt(o)||"Confirm failed"}}catch(r){return{ok:!1,message:r instanceof Error?r.message:"Confirm failed"}}}async getPayment(t){try{const n=await fetch(`${this.apiBase}/api/v2/checkout/payments/${t}/status`,{headers:this.headers()});if(!n.ok)return null;const o=(await n.json().catch(()=>null))?.data?.payment;if(!o)return null;const i=String(o.id??t),a=typeof o.transactionStatus=="string"?o.transactionStatus:void 0;return{payment:{id:i,transactionStatus:a,platform:"ADYEN"}}}catch{return null}}async postCheckout(t,n){const o=await(await fetch(t,{method:"POST",headers:this.headers(),body:JSON.stringify(n)})).json().catch(()=>null);return Lr(o)?{ok:!0,data:ps(o)}:{ok:!1,message:zt(o)||"Checkout failed"}}}function ps(e,t=""){const n=e&&typeof e=="object"?e:{},r=n.data&&typeof n.data=="object"?n.data:n,o=r.action&&typeof r.action=="object"?{...r.action}:void 0,i=String(r.paymentID||r.paymentId||t||""),a=typeof r.resultCode=="string"?r.resultCode:void 0,s=typeof r.redirectUrl=="string"?r.redirectUrl:void 0;return o&&s&&!o.url&&(o.type==="redirect"||a==="RedirectShopper")&&(o.url=s),{provider:"ADYEN",paymentData:{action:o,resultCode:a},payment:{id:i,transactionStatus:typeof r.paymentStatus=="string"?r.paymentStatus:a,platform:"ADYEN"}}}function Lr(e){return!e||typeof e!="object"?!1:e.success!==!1}function Du(e,t,n){return n==="v2"?new Tu(e,t):new vu(e,t)}const Au={dev:"http://localhost:32022",test:"https://awx-api-pay-demo.koomi.app",playground:"https://awx-api-pay-demo.koomi.app",sandbox:"https://api-sandbox.koomipay.com",live:"https://api.koomipay.com"};function Yo(e,t){const n=t?.trim();if(n)return n.replace(/\/$/,"");const[r]=e.split("."),o=r?Au[r]:void 0;if(!o)throw new Error("[@finyxpay/ui] Invalid API Key. Expected a prefix of dev, test, playground, sandbox, or live — or pass apiBase.");return o}function Nu(e){try{if(new URL(e).hostname==="api.koomipay.com")return"prod"}catch{}return"demo"}const Iu={colorPrimary:"--fy-color-primary",colorBackground:"--fy-color-bg",colorText:"--fy-color-text",colorMuted:"--fy-color-muted",colorDanger:"--fy-color-danger",borderRadius:"--fy-radius",fontFamily:"--fy-font"};function Ru(e,t){const n=t?.theme??"default";e.dataset.fyTheme=n;const r=t?.variables;if(r)for(const[o,i]of Object.entries(r)){const a=Iu[o];a&&i&&e.style.setProperty(a,i)}}function Or(...e){return e.filter(Boolean).join(" ")}function k(e,t={},n=[]){const r=document.createElement(e);for(const[o,i]of Object.entries(t))i===void 0||i===!1||(o==="class"?r.className=String(i):o==="text"?r.textContent=String(i):i===!0?r.setAttribute(o,""):r.setAttribute(o,String(i)));for(const o of n)o&&r.append(typeof o=="string"?document.createTextNode(o):o);return r}function $u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function fn(e,t){try{return new Intl.NumberFormat("en-SG",{style:"currency",currency:t}).format(e)}catch{return`${t} ${e.toFixed(2)}`}}function Br(e){if(e)try{const t=new URL(e);if(t.protocol==="http:"||t.protocol==="https:")return t.href}catch{}}function Mu(e="fy"){return`${e}-${Math.random().toString(36).slice(2,10)}`}class Vr{constructor(t,n,r){this.container=null,this.root=null,this.listeners=new Map,this.type=t,this.options={...n},this.ctx=r}mount(t){if(this.container)return console.warn(`[@finyxpay/ui] Element "${this.type}" is already mounted.`),this;const n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error(`[@finyxpay/ui] Cannot mount "${this.type}": container not found.`);return this.container=n,this.root=document.createElement("div"),this.root.className="fy",Ru(this.root,this.ctx.appearance),n.appendChild(this.root),this.render(),this.emit("ready",void 0),this}unmount(){return!this.container||!this.root?this:(this.onUnmount(),this.container.removeChild(this.root),this.root=null,this.container=null,this)}destroy(){this.unmount(),this.listeners.clear()}update(t){return this.options={...this.options,...t},this.root&&this.render(),this}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),this}off(t,n){return this.listeners.get(t)?.delete(n),this}emit(t,n){this.listeners.get(t)?.forEach(r=>{r(n)})}get showWordmark(){return this.ctx.appearance.showWordmark!==!1}onUnmount(){this.root&&$u(this.root)}}function Fu(){if(typeof navigator>"u")return!1;const e=navigator.userAgent,t=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return/iPad|iPhone|iPod/.test(e)||t}function Zo(){if(typeof window>"u"||typeof ApplePaySession>"u")return!1;try{return ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(4)}catch{return!1}}function Qo(){return typeof window>"u"||Fu()||!window.isSecureContext?!1:typeof window.PaymentRequest=="function"}function Lu(e){return e==="applepay"?Zo():e==="googlepay"?Qo():!0}function Jo(e){return e.filter(t=>Lu(t.type))}function ms(e,t){if(!t?.length)return e;const n=new Set(t.map(r=>r.toLowerCase()));return e.filter(r=>n.has(r.type.toLowerCase())?!0:!!r.brands?.some(o=>n.has(o.toLowerCase()))).map(r=>{if(!r.brands?.length||n.has(r.type.toLowerCase())&&!r.brands.some(i=>n.has(i.toLowerCase())))return r;const o=r.brands.filter(i=>n.has(i.toLowerCase()));return o.length?{...r,brands:o}:r})}const Ou=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="Card">
2
2
  <rect x="1" y="4" width="22" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/>
3
3
  <rect x="1" y="8" width="22" height="3" fill="currentColor"/>
4
4
  <rect x="3" y="14" width="6" height="1.5" rx="0.5" fill="currentColor" opacity="0.6"/>
@@ -136,7 +136,7 @@ With this integration, installments configuration must be defined when you creat
136
136
 
137
137
  `);const s=t.session?t.session?.configuration?.installmentOptions??uo.installmentOptions:a;return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&t.brand==="bcmc"||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?uo.billingAddressMode:t.billingAddressMode,brand:t.brand??g.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:s,enableStoreDetails:n,showStoreDetailsCheckbox:r,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...o&&{storedPaymentMethodId:o}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:qo.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...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,...a0(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}beforeRender(t){if(t?.originalAction)return;const n=new Te({type:ge.rendered,component:this.type,configData:{...t,showPayButton:this.props.showPayButton},...t?.oneClick&&{isStoredPaymentMethod:!0,brand:t.brand}});this.analytics.sendAnalytics(n)}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t,n=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,n),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){if(!t.isReset){const n=Ei("supportedBrandsRaw").from(t);this.props.onBinLookup?.(n)}}get storePaymentMethodPayload(){return this.props.storedPaymentMethodId?.length>0?{}:this.props.amount?.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(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:n}=this.props;return t?t.map(r=>({icon:n?.[r]?.icon??this.props.modules.resources.getImage()(r),name:r})):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||qo.type}get accessibleName(){return(this.props.name||qo.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return _o()}renderCardInput(t=!0){return u(pc,{setComponentRef:this.setComponentRef,...this.props,...this.state,onSubmitAnalytics:this.submitAnalytics,onChange:this.setState,onSubmit:this.submit,handleKeyDown:this.handleKeyDown,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:t,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onConfigSuccess:this.onConfigSuccess})}componentToRender(){return u(G1,{configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},t=>this.renderCardInput(t))}constructor(t,n){super(t,n),st(this,"clickToPayService",void 0),st(this,"clickToPayRef",null),st(this,"setClickToPayRef",r=>{this.clickToPayRef=r}),st(this,"onBrand",r=>{this.props.onBrand?.(r)}),st(this,"handleClickToPaySubmit",r=>{this.setState({data:{...r},valid:{},errors:{},isValid:!0}),this.submit()}),st(this,"onConfigSuccess",r=>{const o=new Te({component:this.type,type:ge.configured});this.submitAnalytics(o),this.props.onConfigSuccess?.(r)}),st(this,"onFocus",r=>{const o=new Te({component:this.type,type:ge.focus,target:Fi(r.fieldType)});this.submitAnalytics(o),_n(r.fieldType)?this.props.onFocus?.(r.event):this.props.onFocus?.(r)}),st(this,"onBlur",r=>{const o=new Te({component:this.type,type:ge.unfocus,target:Fi(r.fieldType)});this.submitAnalytics(o),_n(r.fieldType)?this.props.onBlur?.(r.event):this.props.onBlur?.(r)}),st(this,"onBinValue",Zm(this)),st(this,"payButton",r=>{const o=this.props.amount?.value===0,i=this.props.storedPaymentMethodId?.length>0;return u(ga,{...r,label:o&&!i?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit})}),n&&!n._disableClickToPay&&this.props.fundingSource!=="prepaid"&&(this.clickToPayService=y1(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment,this.analytics),this.clickToPayService?.initialize())}};st(Do,"type",g.scheme),st(Do,"defaultProps",{showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...Ei(["type","setComponentRef"]).from(uo)});let Fc=class extends Ne{componentDidMount(){this.formEl.submit(),this.props.onFormSubmit(`${this.props.inputName} sent`)}render({name:t,action:n,target:r,inputName:o,inputValue:i}){return u("form",{ref:a=>{this.formEl=a},method:"POST",className:I(["adyen-checkout__threeds2__form",`adyen-checkout__threeds2__form--${t}`]),name:t,action:n,target:r,style:{display:"none"}},u("input",{name:o,value:i}))}constructor(...t){var n,r,o;super(...t),o=void 0,(r="formEl")in(n=this)?Object.defineProperty(n,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[r]=o}};const ba=(e,t,n,r)=>o=>{const i={};if(o.origin!==e)return"Message was not sent from the expected domain";if(typeof o.data!="string")return"Event data from expected domain but not in expected form";if(!o.data.length)return"Event data from expected domain, in expected form, but empty";try{const a=JSON.parse(o.data);return a&&typeof a=="object"&&Y(a,"type")?a.type===r?(t(a),!0):'Event data has "type" but the object is not in the expected form':"Event data had no type"}catch{return i.type=`${r}-JSON-parse-error`,i.comment="failed to JSON parse event.data",i.extraInfo=`event.data = ${o.data}`,i.eventDataRaw=o.data,console.debug("get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=",i),!1}},Lc="threeDS2Fingerprint",mr="3DS2Fingerprint_Error",va="callSubmit3DS2Fingerprint_Response",Oc="threeDS2Challenge",kt="3DS2Challenge_Error",rf="threeDS2",Ao="3DS2",Dn='Missing "token" property from threeDS2 action',Bc="02",of=1e4,af=6e5,fr="timeout",sf={result:{transStatus:"U"},type:"challengeResult",errorCode:fr},lf={result:{threeDSCompInd:"N"},type:"fingerPrintResult",errorCode:fr},cf="payment *; publickey-credentials-get *",df="payment *; publickey-credentials-get *; publickey-credentials-create *",uf="allow-forms allow-same-origin allow-scripts allow-pointer-lock allow-popups",Vc={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]},Ca=e=>{const t=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(e);if(!t)return null;const[,n,r,o,i]=t;return n&&r&&o?`${n}:${r}${o}${i?`:${i}`:""}`:null},No=e=>"success"in e&&!e.success,Uc=e=>{const t=Tn.decode(e);if(t.success&&t.data)try{return JSON.parse(t.data)}catch{return{success:!1,error:"Could not JSON parse token"}}return t},Hc=e=>{if(!e||!Object.keys(e).length)throw new Error("No (populated) data object to encode");return Tn.encode(JSON.stringify(e))},Kc=e=>{const t=e.length===1?`0${e}`:e;return Object.prototype.hasOwnProperty.call(Vc,t)?t:Bc},hf=e=>Vc[Kc(e)],pf=({token:e,size:t})=>{const n=Uc(e);if(No(n))return n;const{acsTransID:r,acsURL:o,messageVersion:i,threeDSNotificationURL:a,threeDSServerTransID:s}=n,l=Ca(a??"");return{acsURL:o??"",cReqData:{acsTransID:r??"",messageVersion:i??"",threeDSServerTransID:s??"",messageType:"CReq",challengeWindowSize:Kc(t)},iframeSizeArr:hf(t),postMessageDomain:l}},mf=({token:e,notificationURL:t})=>{const n=Uc(e);if(No(n))return n;const{threeDSMethodNotificationURL:r,threeDSMethodUrl:o,threeDSServerTransID:i}=n,a=t??r??"";return{threeDSServerTransID:i??"",threeDSMethodURL:o??"",threeDSMethodNotificationURL:a,postMessageDomain:Ca(a)}},ff=(e,t,n)=>({data:{[e]:Hc({threeDSCompInd:t.threeDSCompInd}),paymentData:n}}),yf=(e,t,n)=>({data:{details:{[e]:Hc({transStatus:t,authorisationToken:n})}}}),jc=e=>{let t=window.btoa(e).split("=")[0];return t=t.replace(/\+/g,"-"),t=t.replace(/\//g,"_"),t},gf=(e,t)=>e==="fingerprint"?{showSpinner:!t.isDropin,statusType:"loading",...t.elementRef&&{elementRef:t.elementRef}}:{statusType:"custom",i18n:t.i18n,elementRef:t.elementRef},_a=(e,t,n)=>{let r;return{promise:new Promise((o,i)=>{r=setTimeout(()=>{i(n)},e),t.then(a=>{clearTimeout(r),o(a)}).catch(a=>{clearTimeout(r),i(a)})}),cancel:()=>{clearTimeout(r)}}};function wa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const zc="threeDSIframe";let bf=class extends Ne{get3DS2ChallengePromise(){return new Promise((t,n)=>{this.processMessageHandler=ba(this.props.postMessageDomain,t,n,"challengeResult"),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.challengePromise=_a(af,this.get3DS2ChallengePromise(),sf),this.challengePromise.promise.then(t=>{window.removeEventListener("message",this.processMessageHandler),this.props.onCompleteChallenge(t)}).catch(t=>{window.removeEventListener("message",this.processMessageHandler),this.props.onErrorChallenge(t)})}componentWillUnmount(){this.challengePromise&&this.challengePromise.cancel(),window.removeEventListener("message",this.processMessageHandler)}render({acsURL:t,cReqData:n,iframeSizeArr:r,onFormSubmit:o,usePasskeyIFrameAttributes:i},{base64URLencodedData:a,status:s}){const[l,c]=r;return u("div",{className:I(["adyen-checkout__threeds2__challenge",`adyen-checkout__threeds2__challenge--${n.challengeWindowSize}`])},s!=="iframeLoaded"&&u(kn,null),u(ur,{name:zc,width:l,height:c,callback:this.iframeCallback,allow:i?df:cf,sandbox:i?uf:void 0}),u(Fc,{name:"cReqForm",action:t,target:zc,inputName:"creq",inputValue:a??"",onFormSubmit:o}))}constructor(t){super(t),wa(this,"processMessageHandler",void 0),wa(this,"challengePromise",void 0),wa(this,"iframeCallback",()=>{this.setState({status:"iframeLoaded"}),this.state.status==="init"&&this.props.onActionHandled?.({componentType:"3DS2Challenge",actionDescription:`${Ao} challenge iframe loaded`})});const n=JSON.stringify(this.props.cReqData),r=jc(n);this.state={base64URLencodedData:r,status:"init"}}};function qc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Wc extends Ne{componentDidMount(){if(No(this.state.challengeData)){const t=this.state.challengeData.error,n=t.includes(Dn)?pe.THREEDS2_ACTION_IS_MISSING_TOKEN:pe.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setError({errorInfo:`${n}: ${this.props.i18n.get("err.gen.9102")}`},!0);const r=new Re({component:this.props.type,code:n,errorType:Ie.threeDS2,message:`${kt}: ${t}`});this.props.onSubmitAnalytics(r),console.debug("### PrepareChallenge3DS2::exiting:: no challengeData")}else{const t=this.props.environment==="test"&&this.props._environmentUrls?.api?.includes("http://localhost:8080"),{acsURL:n,postMessageDomain:r}=this.state.challengeData,o=Lt(n,t),i=Lt(r,t);if(!o||!i){const c=o?pe.THREEDS2_CHALLENGE_TOKEN_IS_MISSING_THREEDSNOTIFICATIONURL:pe.THREEDS2_TOKEN_IS_MISSING_ACSURL,d=o?"threeDSNotificationURL":"acsURL";this.setError({errorInfo:`${c}: ${this.props.i18n.get("err.gen.9102")}`},!0);const p=new Re({component:this.props.type,code:c,errorType:Ie.threeDS2,message:`${kt}: Decoded token is missing a valid ${d} property`});return this.props.onSubmitAnalytics(p),void console.debug(`### PrepareChallenge3DS2::exiting:: no valid ${d}.${i?"":` postMessageDomain=${r}`}`)}const{acsTransID:a,messageVersion:s,threeDSServerTransID:l}=this.state.challengeData.cReqData;if(!a||!s||!l){this.setError({errorInfo:`${pe.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get("err.gen.9102")}`},!0);const c=new Re({component:this.props.type,code:pe.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,errorType:Ie.threeDS2,message:`${kt}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`});return this.props.onSubmitAnalytics(c),void console.debug("### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)")}this.setState({status:"performingChallenge"})}}setStatusComplete(t,n=null){this.setState({status:"complete"},()=>{const r=yf(this.props.dataKey,t.transStatus,this.props.paymentData);let o;n&&console.debug("### PrepareChallenge3DS2::errorCodeObject::",n);const i=n||t;if(i.errorCode){const s={code:i.errorCode==="timeout"?pe.THREEDS2_TIMEOUT:pe.THREEDS2_NO_TRANSSTATUS,errorType:Ie.threeDS2};o=new Re({component:this.props.type,message:i.message,...s}),this.props.onSubmitAnalytics(o)}let a;switch(t?.transStatus){case"Y":a="success";break;case"N":a="failed";break;case"U":a=n?"timeout":"cancelled"}t?.errorCode&&(a="noTransStatus"),o=new Ze({component:this.props.type,type:it.threeDS2,subType:St.challengeCompleted,message:`${Ao} challenge has completed`,result:a}),this.props.onSubmitAnalytics(o),this.props.onComplete(r)})}setError(t,n){this.setState({status:"error",errorInfo:t.errorInfo}),n&&this.props.onError(new M(ro,t.errorInfo,{cause:t.errorObj}))}render(t,{challengeData:n}){const r=n,o=Pe();return this.state.status==="performingChallenge"?u(bf,{onCompleteChallenge:i=>{let a=null;if(Y(i.result,"errorCode")&&i.result.errorCode.length&&(a={errorCode:i.result.errorCode,message:`${kt}: ${i.result.errorDescription?i.result.errorDescription:"no transStatus could be retrieved"}`},this.props.isMDFlow&&this.props.onError(new M(ro,`${kt}: ${i.result.errorDescription?i.result.errorDescription:"no transStatus could be retrieved"}`,{cause:i.result.errorCode}))),!i.result){this.setError({errorInfo:`${kt}: ${this.props.i18n.get("3ds.chal.805",{values:{result:'"result"'}})}`,errorObj:i},!0);const s=new Re({component:this.props.type,code:pe.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,errorType:Ie.threeDS2,message:`${kt}: challenge resolved without a "result" object`});return this.props.onSubmitAnalytics(s),void console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a "result" object')}this.setStatusComplete(i.result,a)},onErrorChallenge:i=>{if(Y(i,"errorCode")){const a={errorCode:i.errorCode,message:`${Oc}: ${i.errorCode}`};return this.props.isMDFlow&&this.props.onError(new M(ro,`${kt}: '3DS2 challenge timed out'`,{cause:i.errorCode})),void this.setStatusComplete(i.result,a)}},...r,onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit,usePasskeyIFrameAttributes:this.props.usePasskeyIFrameAttributes}):this.state.status==="error"?u("div",{className:"adyen-checkout__threeds2-challenge-error"},u(fe,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:o({imageFolder:"components/"})("error"),alt:""}),u("div",{className:"adyen-checkout__status__text"},this.state.errorInfo?this.state.errorInfo:this.props.i18n.get("error.message.unknown"))):null}constructor(t){if(super(t),qc(this,"onFormSubmit",n=>{const r=new Ze({component:this.props.type,type:it.threeDS2,subType:St.challengeDataSentWeb,message:n});this.props.onSubmitAnalytics(r)}),this.props.token){const n=pf({token:this.props.token,size:this.props.challengeWindowSize||this.props.size});this.state={status:"init",challengeData:n}}else this.state={challengeData:{success:!1,error:Dn}},console.debug(`${kt}: ${Dn}`)}}qc(Wc,"defaultProps",{onComplete:()=>{},onError:()=>{},isMDFlow:!1});function Sa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ka=class extends Dt{beforeRender(){}onComplete(t){this.props.isMDFlow?this.props.on3DS2RedirectFlowComplete?.(t,this.elementRef):super.onComplete(t),this.unmount()}componentToRender(){if(!Tt(this.props.paymentData)){const t=Y(this.props,"isMDFlow")?"paymentData":"authorisationToken";this.props.onError(new M(Mi,`No ${t} received. 3DS2 Challenge cannot proceed`));const n=new Re({component:this.type,code:pe.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:Ie.threeDS2,message:`${kt}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(n),null}return u(Wc,{...this.props,onComplete:this.onComplete,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled})}constructor(...t){super(...t),Sa(this,"onActionHandled",n=>{const r=new Ze({component:this.type,type:it.threeDS2,subType:St.challengeIframeLoaded,message:n.actionDescription});this.submitAnalytics(r),super.onActionHandled(n)})}};Sa(ka,"type",g.threeDS2Challenge),Sa(ka,"defaultProps",{dataKey:"threeDSResult",size:Bc,type:Oc});function Ea(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gc="threeDSMethodIframe";let Yc=class extends Ne{get3DS2MethodPromise(){return new Promise((t,n)=>{this.processMessageHandler=ba(this.props.postMessageDomain,t,n,"fingerPrintResult"),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.fingerPrintPromise=_a(of,this.get3DS2MethodPromise(),lf),this.fingerPrintPromise.promise.then(t=>{window.removeEventListener("message",this.processMessageHandler),this.props.onCompleteFingerprint(t)}).catch(t=>{window.removeEventListener("message",this.processMessageHandler),this.props.onErrorFingerprint(t)})}componentWillUnmount(){this.fingerPrintPromise&&this.fingerPrintPromise.cancel(),window.removeEventListener("message",this.processMessageHandler)}render({threeDSMethodURL:t,onActionHandled:n,onFormSubmit:r},{base64URLencodedData:o}){return u("div",{className:"adyen-checkout__3ds2-device-fingerprint"},this.props.showSpinner&&u(kn,null),u("div",{style:{display:"none"}},u(ur,{name:Gc,callback:()=>{n?.({componentType:"3DS2Fingerprint",actionDescription:`${Ao} fingerprint iframe loaded`})}}),u(Fc,{name:"threeDSMethodForm",action:t,target:Gc,inputName:"threeDSMethodData",inputValue:o,onFormSubmit:r})))}constructor(t){super(t),Ea(this,"processMessageHandler",void 0),Ea(this,"fingerPrintPromise",void 0);const{threeDSServerTransID:n,threeDSMethodNotificationURL:r}=this.props,o=JSON.stringify({threeDSServerTransID:n,threeDSMethodNotificationURL:r}),i=jc(o);this.state={base64URLencodedData:i}}};Ea(Yc,"defaultProps",{showSpinner:!0});function xa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Pa extends Ne{componentDidMount(){if(No(this.state.fingerPrintData)){const t=this.state.fingerPrintData.error,n=t.includes(Dn)?pe.THREEDS2_ACTION_IS_MISSING_TOKEN:pe.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setStatusComplete({threeDSCompInd:"N"},{errorCode:n,message:`${mr}: ${t}`}),console.debug("### PrepareFingerprint3DS2:: token does not exist or could not be base64 decoded &/or JSON.parsed")}else{const t=this.props.environment==="test"&&this.props._environmentUrls?.api?.includes("http://localhost:8080"),{threeDSMethodURL:n,threeDSMethodNotificationURL:r,postMessageDomain:o,threeDSServerTransID:i}=this.state.fingerPrintData;if(!Lt(n,t))return this.setStatusComplete({threeDSCompInd:"U"},{errorCode:pe.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,message:`${mr}: Decoded token is missing a valid threeDSMethodURL property`}),void console.debug("### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL");const a=Lt(r,t),s=Lt(o,t),l=i?.length;if(!a||!s||!l)return this.setStatusComplete({threeDSCompInd:"N"},{errorCode:pe.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,message:`${mr}: 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(t,n=null){this.setState({status:"complete"},()=>{const r=ff(this.props.dataKey,t,this.props.paymentData);let o;const i=n||t;if(i.errorCode){const s={code:i.errorCode===fr?pe.THREEDS2_TIMEOUT:i.errorCode,errorType:Ie.threeDS2};o=new Re({component:this.props.type,message:i.message,...s}),this.props.onSubmitAnalytics(o)}let a;switch(t?.threeDSCompInd){case"Y":a="success";break;case"N":a=n?n.errorCode===fr?fr:"failedInternal":"failed";break;case"U":a="noThreeDSMethodURL"}o=new Ze({component:this.props.type,type:it.threeDS2,subType:St.fingerprintCompleted,message:`${Ao} fingerprinting has completed`,result:a}),this.props.onSubmitAnalytics(o),this.props.onComplete(r)})}render({showSpinner:t},{status:n,fingerPrintData:r}){return n==="retrievingFingerPrint"?u(Yc,{onCompleteFingerprint:o=>{this.setStatusComplete(o.result)},onErrorFingerprint:o=>{const i={errorCode:o.errorCode,message:`${Lc}: ${o.errorCode}`};this.setStatusComplete(o.result,i)},showSpinner:t,...r,onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit}):null}constructor(t){super(t),xa(this,"onFormSubmit",o=>{const i=new Ze({component:this.props.type,type:it.threeDS2,subType:St.fingerprintDataSentWeb,message:o});this.props.onSubmitAnalytics(i)});const{token:n,notificationURL:r}=this.props;if(n){const o=mf({token:n,notificationURL:r});this.state={status:"init",fingerPrintData:o}}else this.state={fingerPrintData:{success:!1,error:Dn}},console.debug(`${mr}: ${Dn}`)}}xa(Pa,"type","scheme"),xa(Pa,"defaultProps",{onComplete:()=>{},onError:()=>{},paymentData:"",showSpinner:!0,isMDFlow:!1});const Bt="v1",An={makePayments:"620",submitPaymentDetails:"621",submitThreeDS2Fingerprint:"622",createOrder:"624",donationCampaigns:"627",donations:"628"};function vf({data:e}){Ve({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:An.submitThreeDS2Fingerprint},{...e}).then(t=>{let n;if(t.type==="completed"){const{details:o}=t;return t.details?this.onComplete({data:{details:o}}):(console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a "frictionless" flow, or a "refused" response. resData=',t),n=new Re({component:"threeDS2Fingerprint",code:pe.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:Ie.threeDS2,message:`${va}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(n))}if(!t.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',t),n=new Re({component:"threeDS2Fingerprint",code:pe.THREEDS2_NO_ACTION_FOR_CHALLENGE,errorType:Ie.threeDS2,message:`${va}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(n);const r=this.props.elementRef??this;return r?t.action?.type==="threeDS2"?r.handleAction(t.action,ki("challengeWindowSize","usePasskeyIFrameAttributes").from(this.props)):t.action?.type==="redirect"?r.handleAction(t.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),n=new Re({component:"threeDS2Fingerprint",code:pe.THREEDS2_NO_COMPONENT_FOR_ACTION,errorType:Ie.threeDS2,message:`${va}: no component defined to handle the action response`}),void this.submitAnalytics(n))}).catch(t=>{this.handleError(t)})}function Io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Ta=class extends Dt{beforeRender(){}onComplete(t){this.props.isMDFlow?this.props.on3DS2RedirectFlowComplete?.(t,this.elementRef):super.onComplete(t),this.unmount()}componentToRender(){if(!Tt(this.props.paymentData)){this.props.onError(new M(Mi,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const t=new Re({component:this.type,code:pe.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:Ie.threeDS2,message:`${mr}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return u(Pa,{...this.props,onComplete:this.props.isMDFlow?this.onComplete:this.callSubmit3DS2Fingerprint,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled})}constructor(...t){super(...t),Io(this,"callSubmit3DS2Fingerprint",vf.bind(this)),Io(this,"onActionHandled",n=>{const r=new Ze({component:this.type,type:it.threeDS2,subType:St.fingerprintIframeLoaded,message:n.actionDescription});this.submitAnalytics(r),super.onActionHandled(n)})}};Io(Ta,"type",g.threeDS2Fingerprint),Io(Ta,"defaultProps",{dataKey:"fingerprintResult",type:Lc});function Cf({label:e=null,icon:t=null,payButton:n,onSubmit:r,name:o,showPayButton:i,...a}){const{i18n:s}=O(),[l,c]=w("ready"),{amount:d}=sr();if(this.setStatus=p=>{c(p)},i)return u(G,null,n({...a,status:l,icon:t,classNameModifiers:["standalone"],label:e||(d&&{}.hasOwnProperty.call(d,"value")&&d.value===0?`${s.get("preauthorizeWith")} ${o}`:`${s.get("continueTo")} ${o}`),onClick:r}))}const _f=({buttonStyle:e,buttonType:t,buttonLocale:n,onClick:r})=>u("apple-pay-button",{"data-testid":"apple-pay-button",buttonstyle:e,type:t,locale:n,onclick:r});function Zc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let wf=class{begin(){return this.session.begin()}onvalidatemerchant(t,n){return new Promise((r,o)=>{n(r,o,t.validationURL)}).then(r=>{this.session.completeMerchantValidation(r)}).catch(r=>{console.error(r),this.session.abort(),this.options.onError(r)})}onpaymentauthorized(t,n){return new Promise((r,o)=>n(r,o,t)).then(r=>{this.session.completePayment(r)}).catch(r=>{this.session.completePayment(r)})}onpaymentmethodselected(t,n){return new Promise((r,o)=>n(r,o,t)).then(r=>{this.session.completePaymentMethodSelection(r)}).catch(r=>{this.session.completePaymentMethodSelection(r)})}onshippingcontactselected(t,n){return new Promise((r,o)=>n(r,o,t)).then(r=>{this.session.completeShippingContactSelection(r)}).catch(r=>{this.session.completeShippingContactSelection(r)})}onshippingmethodselected(t,n){return new Promise((r,o)=>n(r,o,t)).then(r=>{this.session.completeShippingMethodSelection(r)}).catch(r=>{this.session.completeShippingMethodSelection(r)})}oncouponcodechanged(t,n){return new Promise((r,o)=>n(r,o,t)).then(r=>{this.session.completeCouponCodeChange(r)}).catch(r=>{this.session.completeCouponCodeChange(r)})}oncancel(t,n){n(t)}constructor(t,n){Zc(this,"session",void 0),Zc(this,"options",void 0),this.options=n,this.session=new ApplePaySession(n.version,t),this.session.onvalidatemerchant=r=>{this.onvalidatemerchant(r,n.onValidateMerchant)},this.session.onpaymentauthorized=r=>{this.onpaymentauthorized(r,n.onPaymentAuthorized)},this.session.oncancel=r=>{this.oncancel(r,n.onCancel)},typeof n.onPaymentMethodSelected=="function"&&(this.session.onpaymentmethodselected=r=>{this.onpaymentmethodselected(r,n.onPaymentMethodSelected)}),typeof n.onShippingContactSelected=="function"&&(this.session.onshippingcontactselected=r=>{this.onshippingcontactselected(r,n.onShippingContactSelected)}),typeof n.onShippingMethodSelected=="function"&&(this.session.onshippingmethodselected=r=>{this.onshippingmethodselected(r,n.onShippingMethodSelected)}),typeof n.onCouponCodeChanged=="function"&&(this.session.oncouponcodechanged=r=>{this.oncouponcodechanged(r,n.onCouponCodeChanged)})}};const Sf={isExpress:!1,amount:{currency:"USD",value:0},totalPriceStatus:"final",initiative:"web",merchantCapabilities:["supports3DS"],supportedNetworks:["amex","discover","masterCard","visa"],buttonType:"plain",buttonColor:"black",onClick:e=>e()},kf=e=>{const{countryCode:t,companyName:n,amount:r,...o}=e,i=(a=>String(fa(a.value,a.currency)))(r);return t||console.warn("Apple Pay - Make sure to set the countryCode in the AdyenCheckout configuration or in the Checkout Session creation"),{countryCode:t,currencyCode:r.currency,total:{label:o.totalPriceLabel,amount:i,type:o.totalPriceStatus},lineItems:o.lineItems,shippingContactEditingMode:o.shippingContactEditingMode,shippingMethods:o.shippingMethods,shippingType:o.shippingType,recurringPaymentRequest:o.recurringPaymentRequest,merchantCapabilities:o.merchantCapabilities,supportedCountries:o.supportedCountries,supportedNetworks:o.supportedNetworks,requiredShippingContactFields:o.requiredShippingContactFields,requiredBillingContactFields:o.requiredBillingContactFields,billingContact:o.billingContact,shippingContact:o.shippingContact,applicationData:o.applicationData,couponCode:o.couponCode,supportsCouponCode:o.supportsCouponCode}};function Ef(e){try{for(let t=e;t>0;t--)if(typeof ApplePaySession?.supportsVersion=="function"&&ApplePaySession.supportsVersion(t))return t}catch(t){console.warn(t)}return null}function Qc(e,t){if(e)return{city:e.locality,country:e.countryCode,houseNumberOrName:"ZZ",postalCode:e.postalCode,street:e.addressLines?.join(" ").trim(),...e.administrativeArea&&{stateOrProvince:e.administrativeArea},...t&&{firstName:e.givenName,lastName:e.familyName}}}function xf(e){const t={mc:"masterCard",amex:"amex",visa:"visa",elodebit:"elo",elo:"elo",interac:"interac",discover:"discover",jcb:"jcb",electron:"electron",maestro:"maestro",girocard:"girocard",cartebancaire:"cartesBancaires",eftpos_australia:"eftpos"};return e.reduce((n,r)=>(t[r]&&!n.includes(t[r])&&n.push(t[r]),n),[])}function Jc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Pf="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";let Tf=class{async load(){try{const t=new cr({src:Pf,component:"applepay",attributes:{crossOrigin:"anonymous"},analytics:this.analytics});return this.sdkLoadingPromise=t.load(),await this.sdkLoadingPromise,window?.ApplePaySession}catch(t){throw new M("SCRIPT_ERROR","ApplePaySDK failed to load",{cause:t})}}isSdkLoaded(){return this.sdkLoadingPromise===void 0?Promise.reject():this.sdkLoadingPromise}constructor({analytics:t}){Jc(this,"sdkLoadingPromise",void 0),Jc(this,"analytics",void 0),this.analytics=t}};const Df=()=>{if(typeof window>"u")return!1;try{return window.self!==window.top}catch{return!0}};function yr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Nn extends Dt{formatProps(t){const n=t.brands?.length?xf(t.brands):t.supportedNetworks;return{...t,configuration:t.configuration,supportedNetworks:n,buttonLocale:t.buttonLocale??t.i18n?.locale,totalPriceLabel:t.totalPriceLabel||t.configuration?.merchantName,renderApplePayCodeAs:t.renderApplePayCodeAs??(Df()?"window":"modal")}}formatData(){const{applePayToken:t,billingAddress:n,deliveryAddress:r}=this.state,{isExpress:o}=this.props;return{paymentMethod:{type:Nn.type,applePayToken:t,...o&&{subtype:"express"}},...n&&{billingAddress:n},...r&&{deliveryAddress:r}}}beforeRender(t){const n=new Te({type:ge.rendered,component:this.type,configData:{...t,showPayButton:this.props.showPayButton},...t?.isExpress&&{isExpress:t.isExpress},...t?.expressPage&&{expressPage:t.expressPage}});this.analytics.sendAnalytics(n)}get isValid(){return!0}async applePayCapabilities(t){const n=t||this.props.configuration.merchantId;try{return await this.sdkLoader.isSdkLoaded(),await ApplePaySession?.applePayCapabilities(n)}catch(r){throw new M("ERROR","Apple Pay: Error when requesting applePayCapabilities()",{cause:r})}}async isAvailable(){if(window.location.protocol!=="https:")return Promise.reject(new M("IMPLEMENTATION_ERROR","Trying to start an Apple Pay session from an insecure document"));try{return await this.sdkLoader.isSdkLoaded(),ApplePaySession?.canMakePayments()?Promise.resolve():Promise.reject(new M("ERROR","Apple Pay is not available on this device"))}catch(t){return Promise.reject(new M("ERROR","Apple Pay SDK failed to load",{cause:t}))}}defineApplePayVersionNumber(){window.location.protocol==="https:"&&(this.applePayVersionNumber=this.props.version||Ef(14))}configureApplePayWebOptions(){if(window.ApplePayWebOptions){const{renderApplePayCodeAs:t,onApplePayCodeClose:n}=this.props;window.ApplePayWebOptions.set({renderApplePayCodeAs:t,...n&&{onApplePayCodeClose:n}})}}startSession(){const{onValidateMerchant:t,onPaymentMethodSelected:n,onShippingMethodSelected:r,onShippingContactSelected:o,onCouponCodeChanged:i}=this.props,a=kf({companyName:this.props.configuration.merchantName,countryCode:this.core.options.countryCode,...this.props}),s=new wf(a,{version:this.applePayVersionNumber,onError:l=>{this.handleError(new M("ERROR","ApplePay - Something went wrong on ApplePayService",{cause:l}))},onCancel:l=>{this.handleError(new M("CANCEL","ApplePay UI dismissed",{cause:l}))},onPaymentMethodSelected:n,onShippingMethodSelected:r,onShippingContactSelected:o,onCouponCodeChanged:i,onValidateMerchant:t||this.validateMerchant,onPaymentAuthorized:(l,c,d)=>{const p=Qc(d.payment.billingContact),h=Qc(d.payment.shippingContact,!0);this.setState({applePayToken:btoa(JSON.stringify(d.payment.token.paymentData)),authorizedEvent:d,...p&&{billingAddress:p},...h&&{deliveryAddress:h}}),this.handleAuthorization().then(this.makePaymentsCall).then(hr).then(pr).then(this.collectOrderTrackingDetailsIfNeeded).then(({paymentResponse:m,orderDetails:f})=>(l({status:ApplePaySession.STATUS_SUCCESS,...f&&{orderDetails:f}}),m)).then(m=>{this.handleResponse(m)}).catch(m=>{const f=m?.error?.applePayError;c({status:ApplePaySession.STATUS_FAILURE,errors:f?Array.isArray(f)?f:[f]:void 0});const y={...m,error:{applePayError:f}};this.handleFailedResult(y)})}});return new Promise((l,c)=>this.props.onClick(l,c)).then(()=>{s.begin()}).catch(()=>({}))}async handleAuthorization(){return new Promise((t,n)=>{this.props.onAuthorized||t();const{authorizedEvent:r,billingAddress:o,deliveryAddress:i}=this.state;this.props.onAuthorized({authorizedEvent:r,...o&&{billingAddress:o},...i&&{deliveryAddress:i}},{resolve:t,reject:n})}).catch(t=>{const n={error:{applePayError:t}};return Promise.reject(n)})}async collectOrderTrackingDetailsIfNeeded(t){return new Promise((n,r)=>{if(!this.props.onOrderTrackingRequest)return n();this.props.onOrderTrackingRequest(n,r)}).then(n=>({paymentResponse:t,...n&&{orderDetails:n}})).catch(()=>({paymentResponse:t}))}async validateMerchant(t,n){const{hostname:r}=window.location,{clientKey:o,configuration:i,loadingContext:a,initiative:s,domainName:l}=this.props,{merchantName:c,merchantId:d}=i,p={loadingContext:a,path:`v1/applePay/sessions?clientKey=${o}`},h={displayName:c,domainName:l||r,initiative:s,merchantIdentifier:d};try{const m=await Ve(p,h),f=Tn.decode(m.data);f.success?t(JSON.parse(f.data)):n("Could not decode Apple Pay session")}catch{n("Could not get Apple Pay session")}}componentToRender(){return this.props.showPayButton?u(_f,{buttonStyle:this.props.buttonColor,buttonType:this.props.buttonType,buttonLocale:this.props.buttonLocale,onClick:this.submit}):null}constructor(t,n){super(t,n),yr(this,"sdkLoader",void 0),yr(this,"applePayVersionNumber",void 0),yr(this,"submit",()=>{if(this.props.isInstantPayment){const a=new Te({component:this.type,type:ge.selected,target:xn.instantPaymentButton});this.submitAnalytics(a)}this.startSession()});const{isExpress:r,onShippingContactSelected:o,onShippingMethodSelected:i}=this.props;if(r===!1&&(o||i))throw new M("IMPLEMENTATION_ERROR",'ApplePay - You must set "isExpress" flag to "true" in order to use "onShippingContactSelected" and/or "onShippingMethodSelected" callbacks');this.startSession=this.startSession.bind(this),this.submit=this.submit.bind(this),this.validateMerchant=this.validateMerchant.bind(this),this.collectOrderTrackingDetailsIfNeeded=this.collectOrderTrackingDetailsIfNeeded.bind(this),this.handleAuthorization=this.handleAuthorization.bind(this),this.defineApplePayVersionNumber=this.defineApplePayVersionNumber.bind(this),this.configureApplePayWebOptions=this.configureApplePayWebOptions.bind(this),this.sdkLoader=new Tf({analytics:this.analytics}),this.sdkLoader.load().then(this.defineApplePayVersionNumber).then(this.configureApplePayWebOptions).catch(a=>{this.handleError(a)})}}yr(Nn,"type",g.applepay),yr(Nn,"defaultProps",Sf);var In={API_VERSION:2,API_VERSION_MINOR:0,GATEWAY:"adyen",URL:"https://pay.google.com/gp/p/js/pay.js"};function Af({allowedAuthMethods:e,allowedCardNetworks:t,existingPaymentMethodRequired:n=!1}){return{apiVersion:In.API_VERSION,apiVersionMinor:In.API_VERSION_MINOR,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:e,allowedCardNetworks:t},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{}}}],existingPaymentMethodRequired:n}}function Nf({amount:e,countryCode:t="US",totalPriceStatus:n="FINAL",...r}){const o=String(fa(e.value,e.currency));return{countryCode:t,currencyCode:e.currency,totalPrice:o,totalPriceStatus:n,...r.transactionInfo}}function Xc({configuration:e,...t},n){return{apiVersion:In.API_VERSION,apiVersionMinor:In.API_VERSION_MINOR,transactionInfo:Nf({countryCode:n,...t}),merchantInfo:{merchantId:e.merchantId,merchantName:e.merchantName,...e.merchantOrigin?{merchantOrigin:e.merchantOrigin}:{},...e.authJwt?{authJwt:e.authJwt}:{}},allowedPaymentMethods:[{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:In.GATEWAY,gatewayMerchantId:e.gatewayMerchantId}},parameters:{allowedAuthMethods:t.allowedAuthMethods,allowedCardNetworks:t.allowedCardNetworks,assuranceDetailsRequired:t.assuranceDetailsRequired,allowPrepaidCards:t.allowPrepaidCards,allowCreditCards:t.allowCreditCards,allowedIssuerCountryCodes:t.allowedIssuerCountryCodes,blockedIssuerCountryCodes:t.blockedIssuerCountryCodes,billingAddressRequired:t.billingAddressRequired,billingAddressParameters:t.billingAddressParameters}}],emailRequired:t.emailRequired,shippingAddressRequired:t.shippingAddressRequired,shippingAddressParameters:t.shippingAddressParameters,shippingOptionRequired:t.shippingOptionRequired,shippingOptionParameters:t.shippingOptionParameters,callbackIntents:t.callbackIntents}}function If(e="PRODUCTION"){switch(e){case"beta":case"test":return"TEST";default:return"PRODUCTION"}}function ed(e,t){if(e)return{postalCode:e.postalCode,country:e.countryCode,street:[e.address1,e.address2,e.address3].join(" ").trim(),houseNumberOrName:"ZZ",city:e.locality||"",...e.administrativeArea&&{stateOrProvince:e.administrativeArea},...t&&{firstName:e.name}}}const Rf=["en","ar","bg","ca","cs","da","de","el","es","et","fi","fr","hr","id","it","ja","ko","ms","nl","no","pl","pt","ru","sk","sl","sr","sv","th","tr","uk","zh"];function $f(e=""){const t=e.toLowerCase().substring(0,2);return Rf.includes(t)?t:null}function td(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Mf=class{async getGooglePaymentsClient(t){return window.google?.payments||await new cr({src:In.URL,component:"googlepay",analytics:this.analytics}).load(),new google.payments.api.PaymentsClient(t)}isReadyToPay(t){return this.paymentsClient?this.paymentsClient.then(n=>n.isReadyToPay(Af(t))):Promise.reject(new Error("Google Pay is not available"))}prefetchPaymentData(t,n){if(!this.paymentsClient)throw new Error("Google Pay is not available");const r=Xc(t,n);this.paymentsClient.then(o=>o.prefetchPaymentData(r))}initiatePayment(t,n){if(!this.paymentsClient)throw new Error("Google Pay is not available");const r=Xc(t,n);return this.paymentsClient.then(o=>o.loadPaymentData(r))}constructor(t,n,r){td(this,"analytics",void 0),td(this,"paymentsClient",void 0);const o=If(t);this.analytics=n,this.paymentsClient=this.getGooglePaymentsClient({environment:o,paymentDataCallbacks:r})}};const Ff=e=>{const t=W(void 0);return R(()=>{const{onClick:n,buttonRadius:r,buttonColor:o,buttonType:i,buttonLocale:a,buttonSizeMode:s,buttonRootNode:l,paymentsClient:c}=e;c.then(d=>d.createButton({onClick:n,buttonType:i,buttonColor:o,buttonLocale:a,buttonSizeMode:s,buttonRootNode:l,...r!==void 0&&{buttonRadius:r}})).then(d=>{t.current&&t.current.appendChild(d)})},[e.buttonColor,e.buttonType,e.buttonLocale,e.buttonSizeMode,e.buttonRootNode,e.paymentsClient]),u("div",{"data-testid":"googlepay-button-container",className:"adyen-checkout__paywithgoogle",ref:t})},Lf={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"buy",buttonSizeMode:"fill",configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]},Of=Object.freeze({mc:"MASTERCARD",amex:"AMEX",visa:"VISA",elodebit:"ELO_DEBIT",elo:"ELO",interac:"INTERAC",discover:"DISCOVER",jcb:"JCB",electron:"ELECTRON",maestro:"MAESTRO"});function Bf(e){const t=e.map(n=>Of[n]).filter(n=>!!n);return[...new Set(t)]}function Vt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Vf=["AMEX","DISCOVER","JCB","MASTERCARD","VISA"];class gr extends Dt{getPaymentMethodFromPaymentMethodsResponse(t,n){return n?this.core.paymentMethodsResponse.findById(n):this.core.paymentMethodsResponse.find(t||this.constructor.type)||this.core.paymentMethodsResponse.find(g.paywithgoogle)}formatProps(t){const n=t.buttonSizeMode??(t.isDropin?"fill":"static"),r=$f(t.buttonLocale??t.i18n?.locale),o=[...t.callbackIntents,"PAYMENT_AUTHORIZATION"],i=this.createAllowedCardNetworksValues({allowedCardNetworks:t.allowedCardNetworks,brands:t.brands});return{...t,allowedCardNetworks:i,configuration:t.configuration,buttonSizeMode:n,buttonLocale:r,callbackIntents:o}}formatData(){const{googlePayCardNetwork:t,googlePayToken:n,billingAddress:r,deliveryAddress:o}=this.state,{isExpress:i}=this.props;return{paymentMethod:{type:this.type,googlePayCardNetwork:t,googlePayToken:n,...i&&{subtype:"express"}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin,...r&&{billingAddress:r},...o&&{deliveryAddress:o}}}createAllowedCardNetworksValues({allowedCardNetworks:t,brands:n}){return t?.length>0?t:n?.length>0?Bf(n):Vf}beforeRender(t){if(t?.originalAction)return;const n=new Te({type:ge.rendered,component:this.type,configData:{...t,showPayButton:this.props.showPayButton},...t?.isExpress&&{isExpress:t.isExpress},...t?.expressPage&&{expressPage:t.expressPage}});this.analytics.sendAnalytics(n)}showGooglePayPaymentSheet(){this.googlePay.initiatePayment(this.props,this.core.options.countryCode).catch(t=>{this.handleError(new M(t.statusCode==="CANCELED"?"CANCEL":"ERROR",t.toString(),{cause:t}))})}async handleAuthorization(){return new Promise((t,n)=>{this.props.onAuthorized||t();const{authorizedEvent:r,billingAddress:o,deliveryAddress:i}=this.state;this.props.onAuthorized({authorizedEvent:r,...o&&{billingAddress:o},...i&&{deliveryAddress:i}},{resolve:t,reject:n})}).catch(t=>{const n={error:{googlePayError:t}};return Promise.reject(n)})}get isValid(){return!0}async isAvailable(){return this.isReadyToPay().then(t=>{if(!t.result)throw new M("ERROR","GooglePay is not available");if(t.paymentMethodPresent===!1)throw new M("ERROR","GooglePay - No paymentMethodPresent");return Promise.resolve()}).catch(t=>Promise.reject(t))}get browserInfo(){return _o()}get icon(){return this.props.icon??this.resources.getImage()("googlepay")}componentToRender(){return this.props.showPayButton?u(Ff,{buttonColor:this.props.buttonColor,buttonType:this.props.buttonType,buttonSizeMode:this.props.buttonSizeMode,buttonLocale:this.props.buttonLocale,buttonRootNode:this.props.buttonRootNode,buttonRadius:this.props.buttonRadius,paymentsClient:this.googlePay.paymentsClient,onClick:this.submit}):null}constructor(t,n){super(t,n),Vt(this,"googlePay",void 0),Vt(this,"submit",()=>{if(this.props.isInstantPayment){const i=new Te({component:this.type,type:ge.selected,target:xn.instantPaymentButton});this.submitAnalytics(i)}new Promise((i,a)=>this.props.onClick(i,a)).then(this.showGooglePayPaymentSheet).catch(()=>{})}),Vt(this,"onPaymentAuthorized",async i=>{const a=ed(i.paymentMethodData.info.billingAddress),s=ed(i.shippingAddress,!0);return this.setState({authorizedEvent:i,googlePayToken:i.paymentMethodData.tokenizationData.token,googlePayCardNetwork:i.paymentMethodData.info.cardNetwork,...a&&{billingAddress:a},...s&&{deliveryAddress:s}}),new Promise(l=>{this.handleAuthorization().then(this.makePaymentsCall).then(hr).then(pr).then(c=>(l({transactionState:"SUCCESS"}),c)).then(c=>{this.handleResponse(c)}).catch(c=>{this.setElementStatus("ready");const d=c?.error?.googlePayError,p=this.props.i18n.get("error.subtitle.payment"),h=typeof d=="string"?{intent:"PAYMENT_AUTHORIZATION",reason:"OTHER_ERROR",message:d||p}:{intent:d?.intent||"PAYMENT_AUTHORIZATION",reason:d?.reason||"OTHER_ERROR",message:d?.message||p};l({transactionState:"ERROR",error:h});const m={...c,error:{googlePayError:h}};this.handleFailedResult(m)})})}),Vt(this,"isReadyToPay",()=>this.googlePay.isReadyToPay(this.props)),Vt(this,"prefetch",()=>this.googlePay.prefetchPaymentData(this.props,this.core.options.countryCode)),this.handleAuthorization=this.handleAuthorization.bind(this),this.showGooglePayPaymentSheet=this.showGooglePayPaymentSheet.bind(this);const{isExpress:r,paymentDataCallbacks:o}=this.props;if(r===!1&&o?.onPaymentDataChanged)throw new M("IMPLEMENTATION_ERROR",'GooglePay - You must set "isExpress" flag to "true" in order to use "onPaymentDataChanged" callback');if(!this.props.configuration.merchantId)throw new M("IMPLEMENTATION_ERROR","GooglePay - Missing merchantId. Please ensure that it is correctly configured in your customer area.");this.googlePay=new Mf(this.props.environment,this.analytics,{...r&&o?.onPaymentDataChanged&&{onPaymentDataChanged:o.onPaymentDataChanged},onPaymentAuthorized:this.onPaymentAuthorized})}}Vt(gr,"type",g.googlepay),Vt(gr,"txVariants",[g.googlepay,g.paywithgoogle]),Vt(gr,"defaultProps",Lf);var nd=()=>{try{if(window.parent.location.href)return window.location!==window.parent.location}catch{return!1}};function rd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let od=class extends Ne{componentDidMount(){new Promise((t,n)=>{this.props.beforeRedirect(t,n,{url:this.props.url,method:this.props.method,...this.props.data?{data:this.props.data}:{}})}).then(()=>{this.props.onActionHandled?.({componentType:this.props.paymentMethodType,actionDescription:"performing-redirect"}),this.postForm?this.postForm.submit():this.props.redirectFromTopWhenInIframe&&nd()?window.top.location.assign?.(this.props.url):window.location.assign(this.props.url)}).catch(()=>{this.props.onRedirectError()})}render({url:t,method:n,data:r={}}){return n==="POST"?u("form",{method:"post","data-testid":"redirect-shopper-form",action:t,style:{display:"none"},ref:o=>{this.postForm=o},...this.props.redirectFromTopWhenInIframe&&nd()&&{target:"_top"}},Object.keys(r).map(o=>u("input",{type:"hidden",name:o,key:o,value:r[o]}))):null}constructor(...t){super(...t),rd(this,"postForm",void 0)}};rd(od,"defaultProps",{beforeRedirect:e=>e(),onRedirectError:()=>{},method:"GET"});function Da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class br extends Dt{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 _o()}componentToRender(){return this.isRedirecting?u(od,{url:this.props.url,...this.props,onActionHandled:this.onActionHandled,onRedirectError:this.handleRedirectError}):this.props.showPayButton?u(Cf,{...this.props,showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}):null}constructor(...t){super(...t),Da(this,"handleRedirectError",()=>{const n=new Re({component:this.props.paymentMethodType,errorType:Ie.redirect,code:pe.REDIRECT});super.submitAnalytics(n)})}}Da(br,"type",g.redirect),Da(br,"defaultProps",{type:br.type});const Uf={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/"},id={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/"},Hf={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/"},Ro=(e,t,n)=>n||t[e]||t.fallback,Kf=(e,t)=>({apiUrl:Ro(e,Uf,t?.api),analyticsUrl:Ro(e,Hf,t?.analytics),cdnImagesUrl:Ro(e,id,t?.cdn?.images),cdnTranslationsUrl:Ro(e,id,t?.cdn?.translations)});function jf(e){return Object.keys(e).reduce((t,n)=>(bm.includes(n)&&(t[n]=e[n]),t),{})}function zf(e){const t=(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(e).forEach(n=>{t.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 ad({logoUrl:e="",nonprofitName:t="",causeName:n="",bannerUrl:r=""}){return u(G,null,u(fe,{className:"adyen-checkout__campaign-background-image",style:{backgroundImage:`url(${r})`},backgroundUrl:r}),u("div",{className:"adyen-checkout__campaign-content"},e&&u("img",{src:e,className:"adyen-checkout__campaign-logo",alt:t}),u("div",null,t&&u("div",{className:"adyen-checkout__campaign-title"},t),n&&u("div",{className:"adyen-checkout__campaign-cause"},n))))}function qf({logoUrl:e="",nonprofitDescription:t="",nonprofitName:n="",causeName:r="",nonprofitUrl:o="",bannerUrl:i=""}){return u("div",{className:"adyen-checkout__campaign"},o?u("a",{href:o,className:"adyen-checkout__campaign-link",target:"_blank",rel:"noopener noreferrer"},u(ad,{logoUrl:e,nonprofitName:n,causeName:r,bannerUrl:i})):u(ad,{logoUrl:e,nonprofitName:n,causeName:r,bannerUrl:i}),t&&u("div",{className:"adyen-checkout__campaign-description"},t))}const Wf=({options:e=[],name:t,onChange:n})=>u("div",{className:"adyen-checkout__button-group"},e.map(({label:r,selected:o,value:i,disabled:a},s)=>u("label",{key:`${t}${s}`,className:I({"adyen-checkout__button":!0,"adyen-checkout__button--selected":o,"adyen-checkout__button--disabled":a})},u("input",{type:"radio",className:"adyen-checkout__button-group__input",value:i,checked:o,onChange:n,disabled:a}),u("span",{className:"adyen-checkout__button-text"},r)))),sd=(e,t)=>e-t%e,Aa=(e,{value:t,currency:n})=>e.amount(t,n),Gf=(e,{maxRoundupAmount:t,commercialTxAmount:n,currency:r})=>Aa(e,{value:sd(t,n),currency:r});function Yf(e){const{currency:t,values:n,selectedAmount:r,status:o,onAmountSelected:i,onDonateButtonClicked:a}=e,{i18n:s}=O();return u(G,null,u("div",{className:"adyen-checkout__amounts"},u(Wf,{options:n.map(l=>({value:l,label:Aa(s,{value:l,currency:t}),disabled:o==="loading",selected:l===r})),name:"amount",onChange:i})),u(Ge,{classNameModifiers:["donate"],onClick:a,label:s.get("donateButton"),disabled:r===null,status:o}))}function Zf(e){const{status:t,donationAmount:n,originalPaymentAmount:r,onDonateButtonClicked:o}=e,{i18n:i}=O();return u(G,null,u(Ge,{classNameModifiers:["donate"],onClick:o,label:`${i.get("donateButton")} ${n}`,status:t}),u("span",{className:"adyen-checkout-roundup-description"},i.get("donationRoundUpDescription",{values:{donationAmount:n,originalPaymentAmount:r}})))}function ld(e){const{donation:t,commercialTxAmount:n,onAmountSelected:r,onCancel:o,onDonate:i,showCancelButton:a=!0,termsAndConditionsUrl:s}=e,{i18n:l}=O(),c=Pe(),{currency:d,type:p}=t,h=p==="roundup",[m,f]=w("ready"),[y,b]=w(h),[v,C]=w({currency:d,value:h?sd(t.maxRoundupAmount,n):null});this.setStatus=S=>{f(S)};const _=()=>{f("loading"),i({data:{amount:v}})};return R(()=>{e.onChange({data:{amount:v},isValid:y})},[v,y]),m==="error"?u("div",{className:"adyen-checkout__adyen-giving"},u(fe,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:c({imageFolder:"components/"})("error"),alt:l.get("error.message.unknown")}),u("div",{className:"adyen-checkout__status__text"},l.get("error.message.unknown"))):m==="success"?u("div",{className:"adyen-checkout__adyen-giving"},u(fe,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--success",src:c({imageFolder:"components/"})("heart"),alt:l.get("thanksForYourSupport")}),u("div",{className:"adyen-checkout__status__text"},l.get("thanksForYourSupport"))):u("div",{className:"adyen-checkout__adyen-giving"},u(qf,e),u("div",{className:"adyen-checkout__adyen-giving-actions"},s&&u(ta,{message:l.get("donationTermsCondition"),urls:[s]}),h?u(Zf,{donationAmount:Gf(l,{maxRoundupAmount:t.maxRoundupAmount,commercialTxAmount:n,currency:d}),originalPaymentAmount:Aa(l,{value:n,currency:d}),status:m,onDonateButtonClicked:_}):u(Yf,{selectedAmount:v.value,values:t.values,currency:d,status:m,onAmountSelected:({target:S})=>{const x=parseInt(S.value,10);b(!0),C(E=>({...E,value:x})),r({data:{amount:{...v,value:x}}})},onDonateButtonClicked:_}),a&&u(Ge,{classNameModifiers:["decline"],variant:"ghost",onClick:()=>{f("ready"),o({data:{amount:v},isValid:y})},disabled:m==="loading",label:`${l.get("notNowButton")} ›`})))}ld.defaultProps={onCancel:()=>{},onChange:()=>{},onDonate:()=>{},donation:{},showCancelButton:!0};function Rn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qf=`Donation instantiation error:: You need to set donation.autoMount to false if you wish to display the Donation component in a different container.
138
138
  The Donation component will be displayed in the default container.`;let cd=class gu{async initialise(){const[t]=await Promise.all([this.callSessionsDonationCampaigns(),new Promise(n=>setTimeout(n,this.delayMS))]);return t}async callSessionsDonationCampaigns(){const t=new Ze({component:gu.type,type:it.apiRequest,subType:St.donationCampaigns,message:"Sessions flow: calling donationCampaigns endpoint"});this.core.modules.analytics.sendAnalytics(t);const n=await this.makeSessionsDonationCampaignsCall(),[r]=n?.donationCampaigns||[];return r?this.handleDonationCampaign(r):null}handleDonationCampaign(t){const{id:n,campaignName:r,...o}=t,i=o.donation.type,a={...o,onCancel:s=>{this.onDonationCompleted?.({didDonate:!1})},onDonate:(s,l)=>{const c={amount:s.data.amount,donationCampaignId:n,donationType:i};this.callSessionsDonations(c,l)},commercialTxAmount:this.commercialTxAmount};if(i==="roundup"&&!this.commercialTxAmount)throw new Error(`The donation type is "roundup" and the commercialTxAmount is not set.
139
- It will not be possible to mount a Donation component.`);return a}async callSessionsDonations(t,n){try{const r=await this.makeSessionDonationsCall(t);r.resultCode==="Authorised"?(n.setStatus("success"),this.onDonationCompleted?.({didDonate:!0})):(n.setStatus("error"),this.onDonationFailed?.(r.resultCode))}catch(r){n.setStatus("error"),this.onDonationFailed?.(r)}}async makeSessionsDonationCampaignsCall(){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.fetchDonationCampaigns()}async makeSessionDonationsCall(t){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.makeDonation(t)}constructor(t,n){Rn(this,"core",void 0),Rn(this,"commercialTxAmount",0),Rn(this,"onDonationCompleted",void 0),Rn(this,"onDonationFailed",void 0),Rn(this,"delayMS",void 0),this.core=t,this.onDonationCompleted=t.options.donation?.onDonationSuccess,this.onDonationFailed=t.options.donation?.onDonationFailure,this.commercialTxAmount=n.commercialTxAmount,this.delayMS=t.options.donation?.delay??3e3}};Rn(cd,"type","donationCampaignService");function Na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Ia=class Mr extends Dt{static isServiceMode(t){return"rootNode"in t&&!!t.rootNode}async initialiseServiceMode(t,n){if(t.session)if(t.session.sessionsDonationInitiated)console.error(Qf);else{t.session.sessionsDonationInitiated=!0;try{const r=await new cd(t,n).initialise();r&&(this.props={...this.props,...r},this.mount(n.rootNode))}catch(r){t.options.donation?.onDonationFailure?.(r)}}}get data(){return this.state.data}get isValid(){return this.state.isValid}setState(t){this.state={...this.state,...t}}donate(){const t=new Ze({component:Mr.type,type:it.submit,subType:St.donation,message:"Making donation"});this.core.modules.analytics.sendAnalytics(t);const{data:n,isValid:r}=this;this.props.onDonate({data:n,isValid:r},this)}cancel(){const t=new Ze({component:Mr.type,type:it.closed,subType:St.donation,message:"Opting to not make donation"});this.core.modules.analytics.sendAnalytics(t);const{data:n,isValid:r}=this;this.isInServiceMode&&this.unmount(),this.props.onCancel({data:n,isValid:r})}amountSelected(t){const n=new Te({component:Mr.type,type:ge.selected,selectedValue:JSON.stringify(t.data.amount),target:xn.donationAmountButton});this.core.modules.analytics.sendAnalytics(n)}componentToRender(){return u(ld,{...this.props,ref:t=>{this.componentRef=t},onChange:this.setState,onDonate:this.donate,onCancel:this.cancel,onAmountSelected:this.amountSelected})}constructor(t,n){const r=Mr.isServiceMode(n);super(t,r?void 0:n),Na(this,"isInServiceMode",!1),this.donate=this.donate.bind(this),this.cancel=this.cancel.bind(this),this.amountSelected=this.amountSelected.bind(this),this.isInServiceMode=r,t.session&&r&&this.initialiseServiceMode(t,n)}};Na(Ia,"type",g.donation),Na(Ia,"defaultProps",{onCancel:()=>{},onDonate:()=>{}});function $o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Jf=class{get length(){return Object.keys(this.storage).length}key(t){return Object.keys(this.storage)[t]??null}getItem(t){return this.storage[t]||null}setItem(t,n){this.storage[t]=n}removeItem(t){delete this.storage[t]}clear(){this.storage={}}constructor(){$o(this,"storage",void 0),this.storage={}}},dd=class{get(){try{const t=this.storage.getItem(this.key);return t?JSON.parse(t):null}catch{return null}}set(t){this.storage.setItem(this.key,JSON.stringify(t))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(t){return this.storage.key(t)}get length(){return this.storage.length}constructor(t,n){$o(this,"prefix","adyen-checkout__"),$o(this,"key",void 0),$o(this,"storage",void 0);try{if(this.storage=n?window[n]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch{this.storage=new Jf}this.key=this.prefix+t}};function Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Xf=km;let ey=class{get checkoutAttemptId(){return this._checkoutAttemptId}set checkoutAttemptId(t){this._checkoutAttemptId=t}async setUp({sessionId:t,checkoutStage:n,locale:r}={}){try{const o=this.storage.get(),i=(function(d){if(!d?.timestamp)return!1;const p=Date.now()-9e5;return d.timestamp>p})(o),{applicationInfo:a,checkoutAttemptId:s}=Wm(this.analyticsData)??{},l=i?o?.id:s,c={version:aa,buildType:ec,channel:sa.WEB,platform:la,locale:r,referrer:window.location.href,screenWidth:window.screen.width,checkoutStage:n||"checkout",level:this.enabled?"all":"initial",...a&&{applicationInfo:a},...t&&{sessionId:t},...l&&{checkoutAttemptId:l}};this.checkoutAttemptId=await this.service.requestCheckoutAttemptId(c),this.dispatchPendingAnalytics(),this.storage.set({id:this.checkoutAttemptId,timestamp:i?o.timestamp:Date.now()})}catch(o){this.enabled=!1,console.warn("Analytics: Error setting up",o)}}sendAnalytics(t){if(this.enabled)try{this.addEventToQueue(t)}catch(n){console.warn("Analytics: Error adding event to queue",n)}}async sendFlavor(t){this.isFlavorReported||(this.checkoutAttemptId?await this.dispatchFlavor(t):this.pendingFlavor||(this.pendingFlavor=t))}async dispatchFlavor(t){if(!this.isFlavorReported&&this.checkoutAttemptId){this.isFlavorReported=!0;try{await this.service.reportIntegrationFlavor(t,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error reporting flavor",n)}}}flush(){this.sendEvents()}addEventToQueue(t){this.eventsQueue.add(t),t.getEventCategory()===Qt.info?this.debouncedSendInfoEvents():this.debouncedSendEvents()}async sendEvents(){if(!this.checkoutAttemptId||!this.enabled||!this.eventsQueue.hasEvents)return;const t={channel:sa.WEB,platform:la,info:this.eventsQueue.infoEvents,errors:this.eventsQueue.errorEvents,logs:this.eventsQueue.logEvents};this.eventsQueue.clear();try{await this.service.sendEvents(t,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error sending events",n)}}dispatchPendingAnalytics(){if(!this.isFlavorReported&&this.pendingFlavor){const t=this.pendingFlavor;this.pendingFlavor=void 0,this.dispatchFlavor(t)}this.sendEvents()}constructor({service:t,eventQueue:n,enabled:r,analyticsData:o}){Et(this,"analyticsData",void 0),Et(this,"service",void 0),Et(this,"eventsQueue",void 0),Et(this,"storage",new dd("checkout-attempt-id","sessionStorage")),Et(this,"debouncedSendInfoEvents",void 0),Et(this,"debouncedSendEvents",void 0),Et(this,"_checkoutAttemptId",void 0),Et(this,"enabled",!0),Et(this,"isFlavorReported",!1),Et(this,"pendingFlavor",void 0),this.service=t,this.eventsQueue=n,this.debouncedSendInfoEvents=da(this.sendEvents.bind(this),1e4),this.debouncedSendEvents=da(this.sendEvents.bind(this),Xf),r!==void 0&&(this.enabled=r),o&&(this.analyticsData=o)}};function Ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ty=class{add(t){const n=t.getEventCategory();n===Qt.info&&this.info.push(t),n===Qt.error&&this.errors.push(t),n===Qt.log&&this.logs.push(t)}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(){Ra(this,"info",[]),Ra(this,"errors",[]),Ra(this,"logs",[])}};function ud(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $a="v3/analytics";let ny=class{async requestCheckoutAttemptId(t){const n={loadingContext:this.analyticsContext,path:`${$a}?clientKey=${this.clientKey}`};try{const{checkoutAttemptId:r}=await Ve(n,t);return r}catch(r){throw new M("NETWORK_ERROR","requestCheckoutAttemptId() - failed to get checkout attempt ID",{cause:r})}}async sendEvents(t,n){if(!n)throw new M("IMPLEMENTATION_ERROR","sendEvents() - checkoutAttemptId is required");if(!t.info.length&&!t.errors.length&&!t.logs.length)return Promise.resolve();const r={loadingContext:this.analyticsContext,path:`${$a}/${n}?clientKey=${this.clientKey}`};try{await Ve(r,t)}catch(o){throw new M("NETWORK_ERROR","sendEvents() - failed to send events",{cause:o})}}async reportIntegrationFlavor(t,n){if(!t||!n)throw new M("IMPLEMENTATION_ERROR","reportIntegrationFlavor() - flavor or checkoutAttemptId is required");const r={loadingContext:this.analyticsContext,path:`${$a}?clientKey=${this.clientKey}`},o={flavor:t,checkoutAttemptId:n};try{await Ve(r,o)}catch(i){throw new M("NETWORK_ERROR","reportIntegrationFlavor() - failed to send flavor",{cause:i})}}constructor({clientKey:t,analyticsContext:n}){ud(this,"clientKey",void 0),ud(this,"analyticsContext",void 0),this.clientKey=t,this.analyticsContext=n}};var Ma={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…",loaded:"Loaded",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}","field.error.invalidCharacters":"Some special characters are not allowed, 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.num.904":"This card type is not supported","cc.dat.912":"Enter a valid expiry date. Front of card in MM/YY format.","cc.dat.913":"Enter a valid expiry date. Front of card in MM/YY format.","cc.dat.914":"Credit card about to expire","cc.dat.910":"Enter the expiry date. Front of card in MM/YY format.","cc.dat.911":"Enter the complete expiry date. Front of card in MM/YY format.","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. 3 digits on back of card.","cc.cvc.921":"Enter the complete security code. 3 digits on back of card.","cc.cvc.920.amex":"Enter the security code. 4 digits on front of card.","cc.cvc.921.amex":"Enter the complete security code. 4 digits on front of card.","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","order.paymentMethod.description":"%{name} ending in %{lastFour}","partialPayment.warning":"Select another payment method to pay the remaining","partialPayment.remainingBalance":"Remaining balance will be %{amount}","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.AUTH_ERROR":"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)","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.errors.accountHolderFirstName.invalid":"Enter your account holder first name","payto.errors.accountHolderLastName.invalid":"Enter your account holder last name","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","emi.subtitle":"Installment plans on credit cards","emi.title":"EMI plan","emi.instructions":"Choose your preferred combination from the options listed below and continue to enter your card details","emi.provider":"Provider","emi.plan":"Plan","emi.planSummary":"Plan summary","emi.itemPrice":"Item price","emi.amountReservedOnCard":"Amount reserved on card","emi.interestChargedByBank":"Interest charged by bank @%{interest}","emi.totalAmountOverTime":"Total amount to be paid over time","emi.upcomingMonthlyPayment":"Upcoming monthly payment","emi.discount":"Discount","emi.discountApplied":"%{amount} discount offer applied for using %{provider}","emi.noCost":"No cost","emi.lowCost":"Low cost","emi.discountAvailable":"discount available","emi.perAnnum":"p.a","emi.cardDetailsInstructions":"Enter card details that are associated with a %{provider} card","emi.cardDetails":"Card details"};function At(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ry{async requestTranslations(){const t=await this.service.fetchTranslationsFromCdn(this.locale);this._translations={...Ma,...t,...!!this.customTranslations[this.locale]&&this.customTranslations[this.locale]}}get translations(){return this._translations}get(t,n){const r=J0(this._translations,t,n);return r!==null?r:t}amount(t,n,r){return F1(t,this.locale,n,r)}date(t,n={}){if(t===void 0)return"";const r={year:"numeric",month:"2-digit",day:"2-digit",...n};return new Date(t).toLocaleDateString(this.locale,r)}dateTime(t){return t===void 0?"":this.timeAndDateFormatter.format(new Date(t))}createSupportedLocalesList(t){if(!t)return Ji;const n=new Set([...Ji,...Object.keys(t)]);return Array.from(n).sort((r,o)=>r.localeCompare(o))}constructor(t){At(this,"locale",void 0),At(this,"languageCode",void 0),At(this,"service",void 0),At(this,"customTranslations",void 0),At(this,"supportedLocales",void 0),At(this,"_translations",{}),At(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),At(this,"timeAndDateFormatOptions",{year:"numeric",month:"2-digit",day:"2-digit",...this.timeFormatOptions}),At(this,"timeAndDateFormatter",void 0);const{locale:n,customTranslations:r,service:o}=t;this.service=o,this.customTranslations=Q0(r),this.supportedLocales=this.createSupportedLocalesList(this.customTranslations),this.locale=Z0(n||bo,this.supportedLocales),this.languageCode=this.locale.split("-")[0],this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions)}}const oy="1.0.0",iy="1.0.0",Mo="deviceFingerprint",ay=2e4,sy={result:{type:Mo,value:"df-timedOut"},errorCode:"timeout"},ly={UNKNOWN:"unknownError"},hd={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 Fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class cy extends Ne{getDfpPromise(){return new Promise((t,n)=>{this.processMessageHandler=ba(this.postMessageDomain,t,n,Mo),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.deviceFingerPrintPromise=_a(ay,this.getDfpPromise(),sy),this.deviceFingerPrintPromise.promise.then(t=>{this.props.onCompleteFingerprint(t),window.removeEventListener("message",this.processMessageHandler)}).catch(t=>{this.props.onErrorFingerprint(t),window.removeEventListener("message",this.processMessageHandler)})}render({dfpURL:t}){return u("div",{className:"adyen-checkout-risk__device-fingerprint"},u(ur,{name:"dfIframe",src:t,allow:"geolocation; microphone; camera;",title:"devicefingerprinting iframe"}))}constructor(t){super(t),Fa(this,"postMessageDomain",void 0),Fa(this,"processMessageHandler",void 0),Fa(this,"deviceFingerPrintPromise",void 0),this.postMessageDomain=Ca(this.props.loadingContext)||this.props.loadingContext}}const dy=e=>({errorCode:e,message:hd[e]||hd[ly.UNKNOWN],type:Mo});let pd=class extends Ne{setStatusComplete(t){this.setState({status:"complete"},()=>{this.props.onComplete(t)})}render({loadingContext:t},{dfpURL:n}){return this.state.status==="retrievingFingerPrint"?u("div",{className:"adyen-checkout-risk__device-fingerprint--wrapper",style:{position:"absolute",width:0,height:0}},u(cy,{loadingContext:t,dfpURL:n,onCompleteFingerprint:r=>{this.setStatusComplete(r)},onErrorFingerprint:r=>{this.props.onError(dy(r.errorCode)),this.setStatusComplete(r.result)}})):null}constructor(t){super(t),t.clientKey&&(this.state={status:"retrievingFingerPrint",dfpURL:`${this.props.loadingContext}assets/html/${t.clientKey}/dfp.${iy}.html`})}};var La,Oa,Ba;Ba={onComplete:()=>{},onError:()=>{}},(Oa="defaultProps")in(La=pd)?Object.defineProperty(La,Oa,{value:Ba,enumerable:!0,configurable:!0,writable:!0}):La[Oa]=Ba;function $n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Va=class bu extends ko{formatProps(t){return{...t,risk:{...bu.defaultProps.risk,...t.risk}}}get isValid(){return this.state.isValid}get data(){if(this.isValid){const t={version:oy,...this.state.data};return Tn.encode(JSON.stringify(t))}return!1}get enabled(){return this.props.risk.enabled}componentWillUnmount(){this.cleanUp()}render(){return u(pd,{...this.props,loadingContext:this.props.loadingContext,onComplete:this.onComplete,onError:this.onError})}constructor(t,n){super(t,n),$n(this,"nodeRiskContainer",null),$n(this,"onComplete",o=>{const i={...this.state.data,[o.type]:o.value,persistentCookie:o.persistentCookie,components:o.components};this.setState({data:i,isValid:!0}),this.props.risk.onComplete(this.data),this.cleanUp()}),$n(this,"onError",o=>{this.props.risk.onError(o),this.cleanUp()}),$n(this,"cleanUp",()=>{this.nodeRiskContainer&&this.nodeRiskContainer.parentNode&&this.nodeRiskContainer.parentNode.removeChild(this.nodeRiskContainer)});const r={[Mo]:null};this.setState({data:r}),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"}))}};$n(Va,"type","risk"),$n(Va,"defaultProps",{risk:{enabled:!0,onComplete:()=>{},onError:()=>{},node:"body"}});function md(e){return!this.length||this.includes(e.type)}function fd(e){return!this.length||!this.includes(e.type)}function uy(e){return!!e&&!!e.supportedShopperInteractions&&e.supportedShopperInteractions.includes("Ecommerce")}const hy=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto","paybybank_pix","eft_directdebit_CA"];function py(e){return!!e&&!!e.type&&hy.includes(e.type)}function my(e){return{...e,_id:Be()}}const fy=(e,{allowPaymentMethods:t=[],removePaymentMethods:n=[]})=>e?e.filter(md,t).filter(fd,n).map(my):[],yy=(e,{allowPaymentMethods:t=[],removePaymentMethods:n=[]},r=[])=>e?e.filter(py).filter(md,t).filter(fd,n).filter(uy).map(o=>((i,a)=>{const s=(function(l,c){if(l.type!=="scheme")return;const d=l.brand;return d?c.find(h=>h.type==="scheme"&&h.brands?.includes(d))?.fundingSource:void 0})(i,a);return{...i,storedPaymentMethodId:i.id,isStoredPaymentMethod:!0,...s&&{fundingSource:s}}})(o,r)):[],gy=e=>{if(typeof e=="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(e 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.");!e||e?.paymentMethods?.length||e?.storedPaymentMethods?.length||console.warn("paymentMethodsResponse was provided but no payment methods were found.")};function yd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let by=class{mapCreatedComponentType(t){return t==="card"?"scheme":t}has(t){return!!this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(t))}find(t){return this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(t))}findByFundingSource(t,n){const r=this.mapCreatedComponentType(t);return this.paymentMethods.find(o=>o.type===r&&o.fundingSource===n)}findById(t){return this.paymentMethods.find(n=>n._id===t)}findStoredPaymentMethod(t){return this.storedPaymentMethods.find(n=>n.id===t)}constructor(t,n={}){yd(this,"paymentMethods",[]),yd(this,"storedPaymentMethods",[]),gy(t),this.paymentMethods=t?fy(t.paymentMethods,n):[],this.storedPaymentMethods=t?yy(t.storedPaymentMethods,n,t.paymentMethods||[]):[]}};const Ua=(e,t,n,r)=>{const o=t.getComponent(n);if(!o)throw Error(`Action Element of type ${n} not found in the registry`);return new o(e,{...r,id:`${n}-${Be()}`})},vr=e=>(t,n,r,o)=>{const i={...o,...r,onError:o.onError,statusType:e,originalAction:r};return Ua(t,n,r.paymentMethodType,i)},vy={redirect:(e,t,n,r)=>{const o={...r,...n,statusType:"redirect",originalAction:n};return Ua(e,t,"redirect",o)},threeDS2:(e,t,n,r)=>{const o=n.subtype==="fingerprint"?"threeDS2DeviceFingerprint":"threeDS2Challenge",i=n.subtype==="fingerprint"||r.isMDFlow?n.paymentData:n.authorisationToken,a={core:e,token:n.token,paymentData:i,onActionHandled:r.onActionHandled,on3DS2RedirectFlowComplete:r.on3DS2RedirectFlowComplete,onAdditionalDetails:r.onAdditionalDetails,onError:r.onError,isDropin:!!r.isDropin,loadingContext:r.loadingContext,clientKey:r.clientKey,paymentMethodType:r.paymentMethodType,challengeWindowSize:r.challengeWindowSize,usePasskeyIFrameAttributes:r.usePasskeyIFrameAttributes,isMDFlow:r.isMDFlow,modules:{analytics:r.modules?.analytics,resources:r.modules?.resources},...gf(n.subtype,r)};return Ua(e,t,o,a)},voucher:vr("custom"),qrCode:vr("custom"),await:vr("custom"),bankTransfer:vr("custom"),sdk:vr("custom")};function Cy(e,t,n,r={}){const o=vy[n.type];if(o&&typeof o=="function")return o(e,t,n,r);throw new Error("Invalid Action")}function _y(e,t){const n=`${Bt}/sessions/${t.id}/payments?clientKey=${t.clientKey}`,r={sessionData:t.data,...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal",errorCode:An.makePayments},r)}function wy(e,t){const n=`${Bt}/sessions/${t.id}/paymentDetails?clientKey=${t.clientKey}`,r={...t.data&&{sessionData:t.data},...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal",errorCode:An.submitPaymentDetails},r)}function Sy(e){const t=`${Bt}/sessions/${e.id}/donationCampaigns?clientKey=${e.clientKey}`,n={...e.data&&{sessionData:e.data}};return Ve({loadingContext:e.loadingContext,path:t,errorLevel:"fatal",errorCode:An.donationCampaigns},n)}function ky(e,t){const n=`${Bt}/sessions/${t.id}/donations?clientKey=${t.clientKey}`,r={...t.data&&{sessionData:t.data},...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal",errorCode:An.donations},r)}function Ey(e,t){const n=`${Bt}/sessions/${e.id}/setup?clientKey=${e.clientKey}`,r={browserInfo:t.browserInfo,sessionData:e.data,...t.order?{order:{orderData:t.order.orderData,pspReference:t.order.pspReference}}:{}};return Ve({loadingContext:e.loadingContext,path:n,errorLevel:"fatal"},r)}function xy(e,t){const n=`${Bt}/sessions/${t.id}/paymentMethodBalance?clientKey=${t.clientKey}`,r={sessionData:t.data,...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal"},r)}function Py(e){const t=`${Bt}/sessions/${e.id}/orders?clientKey=${e.clientKey}`,n={sessionData:e.data};return Ve({loadingContext:e.loadingContext,path:t,errorLevel:"fatal",errorCode:An.createOrder},n)}function Ty(e){if(!e||!e.id)throw new M("IMPLEMENTATION_ERROR","Invalid session");const{shopperLocale:t,shopperEmail:n,telephoneNumber:r,id:o}=e;return{id:o,...e.sessionData?{sessionData:e.sessionData}:{},...t&&{shopperLocale:t},...n&&{shopperEmail:n},...r&&{telephoneNumber:r}}}function Dy(e,t){const n=`${Bt}/sessions/${t.id}/orders/cancel?clientKey=${t.clientKey}`,r={sessionData:t.data,order:e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal"},r)}function Mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ay{get shopperLocale(){return this.session.shopperLocale}get id(){return this.session.id}get data(){return this.session.sessionData}set sessionsDonationInitiated(t){this._sessionsDonationInitiated=t}get sessionsDonationInitiated(){return this._sessionsDonationInitiated}updateSessionData(t){this.session.sessionData=t,this.storeSession()}setupSession(t){const n={...t,browserInfo:_o()};return Ey(this,n).then(r=>(r.configuration&&(this.configuration={...r.configuration}),r.sessionData&&this.updateSessionData(r.sessionData),r))}submitPayment(t){return _y(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}submitDetails(t){return wy(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}fetchDonationCampaigns(){return Sy(this).then(t=>(t.sessionData&&this.updateSessionData(t.sessionData),t))}makeDonation(t){return ky(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}checkBalance(t){return xy(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}createOrder(){return Py(this).then(t=>(t.sessionData&&this.updateSessionData(t.sessionData),t))}cancelOrder(t){return Dy(t.order,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}getStoredSession(){const t=this.storage.get();return this.id===t?.id?t:this.session}storeSession(){this.storage.set({id:this.session.id,sessionData:this.session.sessionData})}removeStoredSession(){this.storage.remove()}constructor(t,n,r){Mn(this,"storage",void 0),Mn(this,"session",void 0),Mn(this,"clientKey",void 0),Mn(this,"loadingContext",void 0),Mn(this,"configuration",void 0),Mn(this,"_sessionsDonationInitiated",void 0);const o=Ty(t);if(!n)throw new Error("No clientKey available");if(!r)throw new Error("No loadingContext available");this.storage=new dd("session","localStorage"),this.clientKey=n,this.loadingContext=r,this.session=o,this._sessionsDonationInitiated=!1,this.session.sessionData?this.storeSession():this.session=this.getStoredSession()}}function Ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Ny=class{getImage(t={}){return this.getImageUrl({...t,resourceContext:this.resourceContext})}constructor(t){if(Ha(this,"resourceContext",void 0),Ha(this,"returnImage",({name:n,resourceContext:r,imageFolder:o="",parentFolder:i="",extension:a,size:s="",subFolder:l=""})=>`${r}images/${o}${l}${i}${n}${s}.${a}`),Ha(this,"getImageUrl",({resourceContext:n,extension:r="svg",...o})=>i=>{const a={extension:r,resourceContext:n,imageFolder:"logos/",parentFolder:"",name:i,...o};return this.returnImage(a)}),!t)throw new M("IMPLEMENTATION_ERROR",'Resources module: "environmentsUrls.cdn" is not a valid URL');this.resourceContext=t}};function Iy({setComponentRef:e}){const t=W({});Object.keys(t.current).length||e?.(t.current);const[n,r]=w(null),o=W(null),i=W(0),[a,s]=w(0);return t.current.setMessages=l=>{const c=o.current;l?.length&&c?.length===l.length&&c.every((d,p)=>d===l[p])&&(i.current+=1,s(i.current)),r(l)},o.current=n,n?u(G,null,n.map(l=>u("div",{key:`${a}-${l}`,className:"adyen-checkout-sr-panel__msg"},l))):null}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ka extends ko{get enabled(){return this._enabled}get moveFocus(){return this._moveFocus}setAriaProps(t){if(!this.props.enabled)return;const n=document.querySelector('[class^="adyen-checkout-sr-panel"]');if(n){for(const[r,o]of Object.entries(t))n.setAttribute(r,o);this.props={...this.props,ariaAttributes:{...this.props.ariaAttributes,...t}}}else console.error("SRPanel: Failed to set aria props because no panel was found")}render(){return this.props.enabled?u("div",{className:this.showPanel?"adyen-checkout-sr-panel":"adyen-checkout-sr-panel--sr-only",role:"log",...this.props.ariaAttributes},u(Iy,{setComponentRef:this.setComponentRef})):null}constructor(t,n){if(super(t,n),xt(this,"srPanelContainer",null),xt(this,"id",void 0),xt(this,"showPanel",void 0),xt(this,"_enabled",void 0),xt(this,"_moveFocus",void 0),xt(this,"componentRef",void 0),xt(this,"setComponentRef",r=>{this.componentRef=r}),xt(this,"setMessages",r=>{if(!this.props.enabled)return;let o=null;r&&(o=Array.isArray(r)?r:[r]),this.componentRef.setMessages(o)}),this.id=this.props.id,this.showPanel=!1,this._enabled=!1,this._moveFocus=this.props.moveFocus??!0,this.props.enabled){this._enabled=!0;const r=document.querySelector(this.props.node);if(!r)throw new Error("Component could not mount. Root node was not found.");{const o=document.getElementById(this.id);o&&r.removeChild(o),this.srPanelContainer=document.createElement("div"),this.srPanelContainer.className="sr-panel-holder",this.srPanelContainer.id=this.id,r.appendChild(this.srPanelContainer),this.mount(this.srPanelContainer)}}}}xt(Ka,"type","srPanel"),xt(Ka,"defaultProps",{enabled:!0,node:"body",showPanel:!1,id:"ariaLiveSRPanel",ariaAttributes:{"aria-relevant":"all","aria-live":"polite","aria-atomic":"true"}});function gd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ry={[g.redirect]:br,[g.threeDS2Challenge]:ka,[g.threeDS2DeviceFingerprint]:Ta,[g.donation]:Ia};var Cr=new class{add(...e){this.componentsMap={...this.componentsMap,...this.createComponentsMap(e)}}getComponent(e){return this.componentsMap[e]||(this.supportedTxVariants.has(e)?void 0:br)}createComponentsMap(e){return e.reduce((t,n)=>{var r;return typeof(r=n).type=="string"&&r.type?(n.type==="dropin"||[n.type,...n.txVariants].filter(o=>o).forEach(o=>{t={...t,[o]:n}}),t):(console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),t)},{})}constructor(){gd(this,"componentsMap",Ry),gd(this,"supportedTxVariants",new Set(Object.values(g)))}};const $y={exposeLibraryMetadata:!0,showPayButton:!0};function bd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class My{async fetchTranslationsFromCdn(t){const n=this.matchLocaleWithCdnSupportedLocales(t);if(n==="en-US")return Ma;try{return await rc({loadingContext:this.cdnUrl,errorLevel:"fatal",errorMessage:`Translations: Failed to fetch translations for locale "${n}"`,path:`sdk/${this.sdkVersion}/translations/${n}.json`})}catch(r){return console.warn(`LanguageService - fetchTranslationsFromCdn(): Failed to fetch locale "${n}."`,r),Ma}}matchLocaleWithCdnSupportedLocales(t){return Wl(t,Ji)||bo}constructor({cdnUrl:t,sdkVersion:n}){bd(this,"cdnUrl",void 0),bd(this,"sdkVersion",void 0),this.cdnUrl=t,this.sdkVersion=n}}function He(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Nt{static setBundleType(t){Nt.metadata.bundleType=t}static register(...t){Cr.add(...t)}register(...t){Cr.add(...t)}getComponent(t){return Cr.getComponent(t)}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(t=>{const{amount:n,shopperLocale:r,countryCode:o,paymentMethods:i,...a}=t;return this.setOptions({...a,amount:this.options.order?this.options.order.remainingAmount:n,locale:this.options.locale||r,countryCode:this.options.countryCode||o}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(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 M($i,"You must specify a countryCode when initializing checkout.")}submitDetails(t){let n=null;this.options.onAdditionalDetails&&(n=new Promise((r,o)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:r,reject:o})})),this.session&&(n=this.session.submitDetails(t).catch(r=>(this.options.onError?.(r),Promise.reject(r)))),n?n.then(hr).then(pr).then(this.afterAdditionalDetails).then(r=>{Eo(r),this.options.onPaymentCompleted?.(r)}).catch(r=>{r instanceof To||(Eo(r),this.options.onPaymentFailed?.(r))}):this.options.onError?.(new M("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,n={}){if(!t||!t.type)throw Y(t,"action")&&Y(t,"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(t.type){const r=t.type===rf?`${t.type}${t.subtype}`:t.paymentMethodType,o=new Ze({type:it.action,subType:Ze.getSubtypeFromActionType(t.type),message:`${r} action was handled by the SDK`,component:r});this.modules.analytics.sendAnalytics(o);const i={...this.getCorePropsForComponent(),...n};return Cy(this,Cr,t,i)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:n=!0}={}){if(n)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(i=>{const a={...t.order?.remainingAmount?{amount:t.order.remainingAmount}:{amount:this.options.amount},...this.session&&{session:this.session},...t};i.update(a)}),this));const{amount:r,secondaryAmount:o}=t;return(r||o)&&this.triggerAmountUpdate(r,o),Promise.resolve(this)}triggerAmountUpdate(t,n){ya(t)?!n||ya(n)?(this.setOptions({amount:t,...n&&{secondaryAmount:n}}),this.components.forEach(r=>{r.updateAmount(t,n)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return{...jf(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const n=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. 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(t){this.paymentMethodsResponse=new by(this.options.paymentMethodsResponse||t,this.options)}createCoreModules(){this.modules||(this.modules=Object.freeze({risk:new Va(this,{...this.options,loadingContext:this.loadingContext}),analytics:new ey({eventQueue:new ty,service:new ny({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:this.options.analytics?.enabled,analyticsData:this.options.analytics?.analyticsData}),resources:new Ny(this.cdnImagesUrl),i18n:new ry({locale:this.options.locale,customTranslations:this.options.translations,service:new My({cdnUrl:this.cdnTranslationsUrl,sdkVersion:Nt.metadata.version}),onError:this.options?.onError}),srPanel:new Ka(this,{...this.options.srConfig})}))}assignLocaleToCore(){this.options.locale=this.modules.i18n.locale}async requestTranslations(){try{await this.modules.i18n.requestTranslations()}catch(t){console.warn("Core - requestTranslations(): Something went wrong.",t)}}async requestAnalyticsAttemptId(){await this.modules.analytics.setUp({locale:this.options.locale,...this.session?.id&&{sessionId:this.session.id}})}constructor(t){He(this,"session",void 0),He(this,"paymentMethodsResponse",void 0),He(this,"modules",void 0),He(this,"options",void 0),He(this,"analyticsContext",void 0),He(this,"loadingContext",void 0),He(this,"cdnImagesUrl",void 0),He(this,"cdnTranslationsUrl",void 0),He(this,"components",[]),He(this,"afterAdditionalDetails",s=>{if(this.options.afterAdditionalDetails&&s?.action){const l=this.createFromAction(s.action);return this.options.afterAdditionalDetails(l),Promise.reject(new To("Handled by afterAdditionalDetails"))}return Promise.resolve(s)}),He(this,"remove",s=>(this.components=this.components.filter(l=>l._id!==s._id),s.unmount(),this)),He(this,"setOptions",s=>{this.options={...this.options,...s,locale:s?.locale||this.options?.locale,environment:String.prototype.toLowerCase.apply(s?.environment||this.options?.environment)}}),zf(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions({...$y,...t});const{apiUrl:n,analyticsUrl:r,cdnImagesUrl:o,cdnTranslationsUrl:i}=Kf(this.options.environment,this.options._environmentUrls);this.loadingContext=n,this.analyticsContext=r,this.cdnImagesUrl=o,this.cdnTranslationsUrl=i,this.session=this.options.session&&new Ay(this.options.session,this.options.clientKey,this.loadingContext);const a=this.options.clientKey?.substring(0,4);if((a==="test"||a==="live")&&!this.loadingContext.includes(a))throw new M("IMPLEMENTATION_ERROR",`Error: you are using a ${a} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);a==="pub."&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.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=Nt.metadata)}}He(Nt,"metadata",{version:aa,bundleType:ec}),He(Nt,"registry",Cr);async function Fo(e){return await new Nt(e).initialize()}Fo.register=(...e)=>{Nt.register(...e)},Fo.setBundleType=e=>{Nt.setBundleType(e)};function Fn(e){const t=k("div",{class:"fy fy-threeds-overlay",role:"dialog","aria-modal":"true"}),n=k("div",{class:"fy-threeds-box"}),r=k("div",{class:"flex items-center justify-between border-b border-zinc-200 px-4 py-3"}),o=k("div",{class:"flex flex-col gap-0.5"});o.append(k("p",{class:"text-sm font-semibold",text:"Secure authentication"})),e.showWordmark!==!1&&o.append(yn());const i=k("button",{type:"button",class:"rounded-md px-2 py-1 text-sm text-zinc-500 hover:bg-zinc-100",text:"Close"});r.append(o,i);const a=k("div",{class:"relative min-h-0 flex-1 bg-white"});let s=null;e.url&&(s=k("iframe",{src:e.url,title:"3-D Secure authentication",allow:"payment"}),s.style.cssText="width:100%;height:100%;border:0;display:block;",a.append(s)),n.append(r,a),t.append(n),document.body.append(t);const l=d=>{const p=d.data;if(!(!p||typeof p!="object")){if("code"in p&&p.code==="3DS-Success"){c(),e.onSuccess();return}if("code"in p&&p.code==="3DS-Error"){c(),e.onError(p.error?.message||p.resultCode||"3-D Secure failed");return}"success"in p&&p.success===!1&&(c(),e.onError(p.message||"3-D Secure failed"))}};window.addEventListener("message",l);function c(){window.removeEventListener("message",l),t.remove()}return i.addEventListener("click",()=>{c(),e.onError("Authentication cancelled")}),e.mountAdyen&&e.mountAdyen(a),c}function Fy(e){return e==="applepay"?Nn:e==="googlepay"?gr:Do}async function vd(e){const t=e.paymentData.clientKey;if(!t)throw new Error("Adyen client key is missing.");let n=null,r=null;const o=await Fo({clientKey:t,environment:e.paymentData.environment||"test",locale:e.paymentData.locale||"en-US",countryCode:Fr(e.currency),amount:{value:Math.round(e.amount*100),currency:e.currency},onSubmit:async(s,l)=>{if(!s.isValid)return;const c=s.data;await a({paymentMethod:c.paymentMethod,browserInfo:c.browserInfo},l)},onAdditionalDetails:async s=>{const l=s.data;await a({details:l.details,paymentData:l.paymentData},n)},onError:s=>{e.onError(s?.message||"Adyen checkout error")}}),i=Fy(e.methodType);n=new i(o,{showPayButton:!0}).mount(e.container);async function a(s,l){const c=await e.client.confirmPayment(e.paymentId,s);if(!c.ok){e.onError(c.message);return}const d=c.data.paymentData?.action,p=c.data.paymentData?.resultCode;if(d){const h=String(d.type||""),m=Br(d.url);if((h==="redirect"||h==="redirect_iframe")&&m){r=Fn({url:m,showWordmark:e.showWordmark,onSuccess:e.onSuccess,onError:e.onError});return}r=Fn({showWordmark:e.showWordmark,onSuccess:e.onSuccess,onError:e.onError,mountAdyen:f=>{f.append(e.container);try{l?.handleAction?.(d)}catch{f.append("Could not present 3-D Secure challenge.")}}});return}if(p==="Authorised"||c.data.payment.transactionStatus==="Authorised"){e.onSuccess();return}p&&p!=="Pending"&&p!=="Received"&&e.onError(p)}return()=>{r?.(),n?.unmount?.()}}function Cd(e){return String(e||"").toUpperCase()==="ADYEN"}function Ly(e){return e==="applepay"?Nn:e==="googlepay"?gr:Do}async function Oy(e){const t=await e.ctx.client.getClientConfig();let n=null,r=null,o=e.options.existingPaymentId||"";const i=await Fo({clientKey:t.clientKey,environment:t.environment||"test",locale:t.locale||"en-US",countryCode:Fr(e.options.currency),amount:{value:Math.round(e.options.amount*100),currency:e.options.currency},onSubmit:async(c,d)=>{if(!c.isValid)return;const p=c.data,h={...p.paymentMethod||{},type:us(e.method.type)},m=await e.ctx.client.createPayment({amount:e.options.amount,currency:e.options.currency,orderId:e.options.orderId,items:e.options.items,returnUrl:e.options.returnUrl,autoCapture:e.options.autoCapture,metadata:e.options.metadata,existingOrderId:e.options.existingOrderId,existingPaymentId:e.options.existingPaymentId,paymentMethod:e.method,encryptedPaymentMethod:h,browserInfo:p.browserInfo});await l(m,d)},onAdditionalDetails:async c=>{const d=c.data;await s({details:d.details,paymentData:d.paymentData},n)},onError:c=>{e.onError(c?.message||"Adyen checkout error")}}),a=Ly(e.method.type);n=new a(i,{showPayButton:!0}).mount(e.container);async function s(c,d){const p=await e.ctx.client.confirmPayment(o,c);await l(p,d)}async function l(c,d){if(!c.ok){e.onError(c.message);return}o=String(c.data.payment.id||o);const p=c.data.paymentData?.action,h=c.data.paymentData?.resultCode;if(p){const m=String(p.type||""),f=Br(typeof p.url=="string"?p.url:void 0);if((m==="redirect"||h==="RedirectShopper")&&f){window.location.assign(f);return}if(m==="redirect_iframe"&&f){r=Fn({url:f,showWordmark:e.showWordmark,onSuccess:()=>e.onSuccess(o),onError:e.onError});return}r=Fn({showWordmark:e.showWordmark,onSuccess:()=>e.onSuccess(o),onError:e.onError,mountAdyen:y=>{y.append(e.container);try{d?.handleAction?.(p)}catch{y.append("Could not present 3-D Secure challenge.")}}});return}if(h==="Authorised"||c.data.payment.transactionStatus==="Authorised"){e.onSuccess(o);return}h&&h!=="Pending"&&h!=="Received"&&e.onError(h)}return()=>{r?.(),n?.unmount?.()}}function ja(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function By(e){if(Array.isArray(e))return e}function Vy(e){if(Array.isArray(e))return ja(e)}function _d(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(c){n(c);return}s.done?t(l):Promise.resolve(l).then(r,o)}function _r(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(l){_d(i,r,o,a,s,"next",l)}function s(l){_d(i,r,o,a,s,"throw",l)}a(void 0)})}}function za(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Uy(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qa(e,t,n){return t&&Uy(e.prototype,t),e}function Wa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Hy(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ky(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,s;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,s=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw s}}return r}}function jy(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zy(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable}))),r.forEach(function(o){Wa(e,o,n[o])})}return e}function qy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}function Lo(e,t){return t=t??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qy(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function wd(e,t){return By(e)||Ky(e,t)||kd(e,t)||jy()}function Sd(e){return Vy(e)||Hy(e)||kd(e)||zy()}function wr(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function kd(e,t){if(e){if(typeof e=="string")return ja(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ja(e,t)}}function Sr(e,t){var n,r,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(d){return l([c,d])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=c[0]&2?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(d){c=[6,d],r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}var an=(function(e){return e.production="prod",e.demo="demo",e.staging="staging",e})(an||{}),sn="airTracker_unknown",Wy={appName:sn,appVersion:sn,env:"staging",isWebappContainer:!1,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:!1,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:!1,enableRecordPageRetention:!1,hideSearchParams:!1,useSessionStorageForSessionId:!1,assetSpeedMonitoringWhiteListByMFE:{}},Gy={appName:sn,env:"staging",sessionId:sn,deviceId:sn},Yy=function(e){return!e||/^\s*$/.test(e)?!1:(e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@"),e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]"),e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(e))},Ed=function(){var e=new WeakSet;return function(t,n){if(Ut(n,Error))return"Error.message: ".concat(n.message,`
139
+ It will not be possible to mount a Donation component.`);return a}async callSessionsDonations(t,n){try{const r=await this.makeSessionDonationsCall(t);r.resultCode==="Authorised"?(n.setStatus("success"),this.onDonationCompleted?.({didDonate:!0})):(n.setStatus("error"),this.onDonationFailed?.(r.resultCode))}catch(r){n.setStatus("error"),this.onDonationFailed?.(r)}}async makeSessionsDonationCampaignsCall(){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.fetchDonationCampaigns()}async makeSessionDonationsCall(t){if(!this.core.session)throw new Error("DonationCampaignService requires a session to be configured");return await this.core.session.makeDonation(t)}constructor(t,n){Rn(this,"core",void 0),Rn(this,"commercialTxAmount",0),Rn(this,"onDonationCompleted",void 0),Rn(this,"onDonationFailed",void 0),Rn(this,"delayMS",void 0),this.core=t,this.onDonationCompleted=t.options.donation?.onDonationSuccess,this.onDonationFailed=t.options.donation?.onDonationFailure,this.commercialTxAmount=n.commercialTxAmount,this.delayMS=t.options.donation?.delay??3e3}};Rn(cd,"type","donationCampaignService");function Na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Ia=class Mr extends Dt{static isServiceMode(t){return"rootNode"in t&&!!t.rootNode}async initialiseServiceMode(t,n){if(t.session)if(t.session.sessionsDonationInitiated)console.error(Qf);else{t.session.sessionsDonationInitiated=!0;try{const r=await new cd(t,n).initialise();r&&(this.props={...this.props,...r},this.mount(n.rootNode))}catch(r){t.options.donation?.onDonationFailure?.(r)}}}get data(){return this.state.data}get isValid(){return this.state.isValid}setState(t){this.state={...this.state,...t}}donate(){const t=new Ze({component:Mr.type,type:it.submit,subType:St.donation,message:"Making donation"});this.core.modules.analytics.sendAnalytics(t);const{data:n,isValid:r}=this;this.props.onDonate({data:n,isValid:r},this)}cancel(){const t=new Ze({component:Mr.type,type:it.closed,subType:St.donation,message:"Opting to not make donation"});this.core.modules.analytics.sendAnalytics(t);const{data:n,isValid:r}=this;this.isInServiceMode&&this.unmount(),this.props.onCancel({data:n,isValid:r})}amountSelected(t){const n=new Te({component:Mr.type,type:ge.selected,selectedValue:JSON.stringify(t.data.amount),target:xn.donationAmountButton});this.core.modules.analytics.sendAnalytics(n)}componentToRender(){return u(ld,{...this.props,ref:t=>{this.componentRef=t},onChange:this.setState,onDonate:this.donate,onCancel:this.cancel,onAmountSelected:this.amountSelected})}constructor(t,n){const r=Mr.isServiceMode(n);super(t,r?void 0:n),Na(this,"isInServiceMode",!1),this.donate=this.donate.bind(this),this.cancel=this.cancel.bind(this),this.amountSelected=this.amountSelected.bind(this),this.isInServiceMode=r,t.session&&r&&this.initialiseServiceMode(t,n)}};Na(Ia,"type",g.donation),Na(Ia,"defaultProps",{onCancel:()=>{},onDonate:()=>{}});function $o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Jf=class{get length(){return Object.keys(this.storage).length}key(t){return Object.keys(this.storage)[t]??null}getItem(t){return this.storage[t]||null}setItem(t,n){this.storage[t]=n}removeItem(t){delete this.storage[t]}clear(){this.storage={}}constructor(){$o(this,"storage",void 0),this.storage={}}},dd=class{get(){try{const t=this.storage.getItem(this.key);return t?JSON.parse(t):null}catch{return null}}set(t){this.storage.setItem(this.key,JSON.stringify(t))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(t){return this.storage.key(t)}get length(){return this.storage.length}constructor(t,n){$o(this,"prefix","adyen-checkout__"),$o(this,"key",void 0),$o(this,"storage",void 0);try{if(this.storage=n?window[n]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch{this.storage=new Jf}this.key=this.prefix+t}};function Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Xf=km;let ey=class{get checkoutAttemptId(){return this._checkoutAttemptId}set checkoutAttemptId(t){this._checkoutAttemptId=t}async setUp({sessionId:t,checkoutStage:n,locale:r}={}){try{const o=this.storage.get(),i=(function(d){if(!d?.timestamp)return!1;const p=Date.now()-9e5;return d.timestamp>p})(o),{applicationInfo:a,checkoutAttemptId:s}=Wm(this.analyticsData)??{},l=i?o?.id:s,c={version:aa,buildType:ec,channel:sa.WEB,platform:la,locale:r,referrer:window.location.href,screenWidth:window.screen.width,checkoutStage:n||"checkout",level:this.enabled?"all":"initial",...a&&{applicationInfo:a},...t&&{sessionId:t},...l&&{checkoutAttemptId:l}};this.checkoutAttemptId=await this.service.requestCheckoutAttemptId(c),this.dispatchPendingAnalytics(),this.storage.set({id:this.checkoutAttemptId,timestamp:i?o.timestamp:Date.now()})}catch(o){this.enabled=!1,console.warn("Analytics: Error setting up",o)}}sendAnalytics(t){if(this.enabled)try{this.addEventToQueue(t)}catch(n){console.warn("Analytics: Error adding event to queue",n)}}async sendFlavor(t){this.isFlavorReported||(this.checkoutAttemptId?await this.dispatchFlavor(t):this.pendingFlavor||(this.pendingFlavor=t))}async dispatchFlavor(t){if(!this.isFlavorReported&&this.checkoutAttemptId){this.isFlavorReported=!0;try{await this.service.reportIntegrationFlavor(t,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error reporting flavor",n)}}}flush(){this.sendEvents()}addEventToQueue(t){this.eventsQueue.add(t),t.getEventCategory()===Qt.info?this.debouncedSendInfoEvents():this.debouncedSendEvents()}async sendEvents(){if(!this.checkoutAttemptId||!this.enabled||!this.eventsQueue.hasEvents)return;const t={channel:sa.WEB,platform:la,info:this.eventsQueue.infoEvents,errors:this.eventsQueue.errorEvents,logs:this.eventsQueue.logEvents};this.eventsQueue.clear();try{await this.service.sendEvents(t,this.checkoutAttemptId)}catch(n){console.warn("Analytics: Error sending events",n)}}dispatchPendingAnalytics(){if(!this.isFlavorReported&&this.pendingFlavor){const t=this.pendingFlavor;this.pendingFlavor=void 0,this.dispatchFlavor(t)}this.sendEvents()}constructor({service:t,eventQueue:n,enabled:r,analyticsData:o}){Et(this,"analyticsData",void 0),Et(this,"service",void 0),Et(this,"eventsQueue",void 0),Et(this,"storage",new dd("checkout-attempt-id","sessionStorage")),Et(this,"debouncedSendInfoEvents",void 0),Et(this,"debouncedSendEvents",void 0),Et(this,"_checkoutAttemptId",void 0),Et(this,"enabled",!0),Et(this,"isFlavorReported",!1),Et(this,"pendingFlavor",void 0),this.service=t,this.eventsQueue=n,this.debouncedSendInfoEvents=da(this.sendEvents.bind(this),1e4),this.debouncedSendEvents=da(this.sendEvents.bind(this),Xf),r!==void 0&&(this.enabled=r),o&&(this.analyticsData=o)}};function Ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ty=class{add(t){const n=t.getEventCategory();n===Qt.info&&this.info.push(t),n===Qt.error&&this.errors.push(t),n===Qt.log&&this.logs.push(t)}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(){Ra(this,"info",[]),Ra(this,"errors",[]),Ra(this,"logs",[])}};function ud(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $a="v3/analytics";let ny=class{async requestCheckoutAttemptId(t){const n={loadingContext:this.analyticsContext,path:`${$a}?clientKey=${this.clientKey}`};try{const{checkoutAttemptId:r}=await Ve(n,t);return r}catch(r){throw new M("NETWORK_ERROR","requestCheckoutAttemptId() - failed to get checkout attempt ID",{cause:r})}}async sendEvents(t,n){if(!n)throw new M("IMPLEMENTATION_ERROR","sendEvents() - checkoutAttemptId is required");if(!t.info.length&&!t.errors.length&&!t.logs.length)return Promise.resolve();const r={loadingContext:this.analyticsContext,path:`${$a}/${n}?clientKey=${this.clientKey}`};try{await Ve(r,t)}catch(o){throw new M("NETWORK_ERROR","sendEvents() - failed to send events",{cause:o})}}async reportIntegrationFlavor(t,n){if(!t||!n)throw new M("IMPLEMENTATION_ERROR","reportIntegrationFlavor() - flavor or checkoutAttemptId is required");const r={loadingContext:this.analyticsContext,path:`${$a}?clientKey=${this.clientKey}`},o={flavor:t,checkoutAttemptId:n};try{await Ve(r,o)}catch(i){throw new M("NETWORK_ERROR","reportIntegrationFlavor() - failed to send flavor",{cause:i})}}constructor({clientKey:t,analyticsContext:n}){ud(this,"clientKey",void 0),ud(this,"analyticsContext",void 0),this.clientKey=t,this.analyticsContext=n}};var Ma={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…",loaded:"Loaded",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}","field.error.invalidCharacters":"Some special characters are not allowed, 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.num.904":"This card type is not supported","cc.dat.912":"Enter a valid expiry date. Front of card in MM/YY format.","cc.dat.913":"Enter a valid expiry date. Front of card in MM/YY format.","cc.dat.914":"Credit card about to expire","cc.dat.910":"Enter the expiry date. Front of card in MM/YY format.","cc.dat.911":"Enter the complete expiry date. Front of card in MM/YY format.","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. 3 digits on back of card.","cc.cvc.921":"Enter the complete security code. 3 digits on back of card.","cc.cvc.920.amex":"Enter the security code. 4 digits on front of card.","cc.cvc.921.amex":"Enter the complete security code. 4 digits on front of card.","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","order.paymentMethod.description":"%{name} ending in %{lastFour}","partialPayment.warning":"Select another payment method to pay the remaining","partialPayment.remainingBalance":"Remaining balance will be %{amount}","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.AUTH_ERROR":"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)","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.errors.accountHolderFirstName.invalid":"Enter your account holder first name","payto.errors.accountHolderLastName.invalid":"Enter your account holder last name","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","emi.subtitle":"Installment plans on credit cards","emi.title":"EMI plan","emi.instructions":"Choose your preferred combination from the options listed below and continue to enter your card details","emi.provider":"Provider","emi.plan":"Plan","emi.planSummary":"Plan summary","emi.itemPrice":"Item price","emi.amountReservedOnCard":"Amount reserved on card","emi.interestChargedByBank":"Interest charged by bank @%{interest}","emi.totalAmountOverTime":"Total amount to be paid over time","emi.upcomingMonthlyPayment":"Upcoming monthly payment","emi.discount":"Discount","emi.discountApplied":"%{amount} discount offer applied for using %{provider}","emi.noCost":"No cost","emi.lowCost":"Low cost","emi.discountAvailable":"discount available","emi.perAnnum":"p.a","emi.cardDetailsInstructions":"Enter card details that are associated with a %{provider} card","emi.cardDetails":"Card details"};function At(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ry{async requestTranslations(){const t=await this.service.fetchTranslationsFromCdn(this.locale);this._translations={...Ma,...t,...!!this.customTranslations[this.locale]&&this.customTranslations[this.locale]}}get translations(){return this._translations}get(t,n){const r=J0(this._translations,t,n);return r!==null?r:t}amount(t,n,r){return F1(t,this.locale,n,r)}date(t,n={}){if(t===void 0)return"";const r={year:"numeric",month:"2-digit",day:"2-digit",...n};return new Date(t).toLocaleDateString(this.locale,r)}dateTime(t){return t===void 0?"":this.timeAndDateFormatter.format(new Date(t))}createSupportedLocalesList(t){if(!t)return Ji;const n=new Set([...Ji,...Object.keys(t)]);return Array.from(n).sort((r,o)=>r.localeCompare(o))}constructor(t){At(this,"locale",void 0),At(this,"languageCode",void 0),At(this,"service",void 0),At(this,"customTranslations",void 0),At(this,"supportedLocales",void 0),At(this,"_translations",{}),At(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),At(this,"timeAndDateFormatOptions",{year:"numeric",month:"2-digit",day:"2-digit",...this.timeFormatOptions}),At(this,"timeAndDateFormatter",void 0);const{locale:n,customTranslations:r,service:o}=t;this.service=o,this.customTranslations=Q0(r),this.supportedLocales=this.createSupportedLocalesList(this.customTranslations),this.locale=Z0(n||bo,this.supportedLocales),this.languageCode=this.locale.split("-")[0],this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions)}}const oy="1.0.0",iy="1.0.0",Mo="deviceFingerprint",ay=2e4,sy={result:{type:Mo,value:"df-timedOut"},errorCode:"timeout"},ly={UNKNOWN:"unknownError"},hd={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 Fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class cy extends Ne{getDfpPromise(){return new Promise((t,n)=>{this.processMessageHandler=ba(this.postMessageDomain,t,n,Mo),window.addEventListener("message",this.processMessageHandler)})}componentDidMount(){this.deviceFingerPrintPromise=_a(ay,this.getDfpPromise(),sy),this.deviceFingerPrintPromise.promise.then(t=>{this.props.onCompleteFingerprint(t),window.removeEventListener("message",this.processMessageHandler)}).catch(t=>{this.props.onErrorFingerprint(t),window.removeEventListener("message",this.processMessageHandler)})}render({dfpURL:t}){return u("div",{className:"adyen-checkout-risk__device-fingerprint"},u(ur,{name:"dfIframe",src:t,allow:"geolocation; microphone; camera;",title:"devicefingerprinting iframe"}))}constructor(t){super(t),Fa(this,"postMessageDomain",void 0),Fa(this,"processMessageHandler",void 0),Fa(this,"deviceFingerPrintPromise",void 0),this.postMessageDomain=Ca(this.props.loadingContext)||this.props.loadingContext}}const dy=e=>({errorCode:e,message:hd[e]||hd[ly.UNKNOWN],type:Mo});let pd=class extends Ne{setStatusComplete(t){this.setState({status:"complete"},()=>{this.props.onComplete(t)})}render({loadingContext:t},{dfpURL:n}){return this.state.status==="retrievingFingerPrint"?u("div",{className:"adyen-checkout-risk__device-fingerprint--wrapper",style:{position:"absolute",width:0,height:0}},u(cy,{loadingContext:t,dfpURL:n,onCompleteFingerprint:r=>{this.setStatusComplete(r)},onErrorFingerprint:r=>{this.props.onError(dy(r.errorCode)),this.setStatusComplete(r.result)}})):null}constructor(t){super(t),t.clientKey&&(this.state={status:"retrievingFingerPrint",dfpURL:`${this.props.loadingContext}assets/html/${t.clientKey}/dfp.${iy}.html`})}};var La,Oa,Ba;Ba={onComplete:()=>{},onError:()=>{}},(Oa="defaultProps")in(La=pd)?Object.defineProperty(La,Oa,{value:Ba,enumerable:!0,configurable:!0,writable:!0}):La[Oa]=Ba;function $n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Va=class bu extends ko{formatProps(t){return{...t,risk:{...bu.defaultProps.risk,...t.risk}}}get isValid(){return this.state.isValid}get data(){if(this.isValid){const t={version:oy,...this.state.data};return Tn.encode(JSON.stringify(t))}return!1}get enabled(){return this.props.risk.enabled}componentWillUnmount(){this.cleanUp()}render(){return u(pd,{...this.props,loadingContext:this.props.loadingContext,onComplete:this.onComplete,onError:this.onError})}constructor(t,n){super(t,n),$n(this,"nodeRiskContainer",null),$n(this,"onComplete",o=>{const i={...this.state.data,[o.type]:o.value,persistentCookie:o.persistentCookie,components:o.components};this.setState({data:i,isValid:!0}),this.props.risk.onComplete(this.data),this.cleanUp()}),$n(this,"onError",o=>{this.props.risk.onError(o),this.cleanUp()}),$n(this,"cleanUp",()=>{this.nodeRiskContainer&&this.nodeRiskContainer.parentNode&&this.nodeRiskContainer.parentNode.removeChild(this.nodeRiskContainer)});const r={[Mo]:null};this.setState({data:r}),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"}))}};$n(Va,"type","risk"),$n(Va,"defaultProps",{risk:{enabled:!0,onComplete:()=>{},onError:()=>{},node:"body"}});function md(e){return!this.length||this.includes(e.type)}function fd(e){return!this.length||!this.includes(e.type)}function uy(e){return!!e&&!!e.supportedShopperInteractions&&e.supportedShopperInteractions.includes("Ecommerce")}const hy=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto","paybybank_pix","eft_directdebit_CA"];function py(e){return!!e&&!!e.type&&hy.includes(e.type)}function my(e){return{...e,_id:Be()}}const fy=(e,{allowPaymentMethods:t=[],removePaymentMethods:n=[]})=>e?e.filter(md,t).filter(fd,n).map(my):[],yy=(e,{allowPaymentMethods:t=[],removePaymentMethods:n=[]},r=[])=>e?e.filter(py).filter(md,t).filter(fd,n).filter(uy).map(o=>((i,a)=>{const s=(function(l,c){if(l.type!=="scheme")return;const d=l.brand;return d?c.find(h=>h.type==="scheme"&&h.brands?.includes(d))?.fundingSource:void 0})(i,a);return{...i,storedPaymentMethodId:i.id,isStoredPaymentMethod:!0,...s&&{fundingSource:s}}})(o,r)):[],gy=e=>{if(typeof e=="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(e 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.");!e||e?.paymentMethods?.length||e?.storedPaymentMethods?.length||console.warn("paymentMethodsResponse was provided but no payment methods were found.")};function yd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let by=class{mapCreatedComponentType(t){return t==="card"?"scheme":t}has(t){return!!this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(t))}find(t){return this.paymentMethods.find(n=>n.type===this.mapCreatedComponentType(t))}findByFundingSource(t,n){const r=this.mapCreatedComponentType(t);return this.paymentMethods.find(o=>o.type===r&&o.fundingSource===n)}findById(t){return this.paymentMethods.find(n=>n._id===t)}findStoredPaymentMethod(t){return this.storedPaymentMethods.find(n=>n.id===t)}constructor(t,n={}){yd(this,"paymentMethods",[]),yd(this,"storedPaymentMethods",[]),gy(t),this.paymentMethods=t?fy(t.paymentMethods,n):[],this.storedPaymentMethods=t?yy(t.storedPaymentMethods,n,t.paymentMethods||[]):[]}};const Ua=(e,t,n,r)=>{const o=t.getComponent(n);if(!o)throw Error(`Action Element of type ${n} not found in the registry`);return new o(e,{...r,id:`${n}-${Be()}`})},vr=e=>(t,n,r,o)=>{const i={...o,...r,onError:o.onError,statusType:e,originalAction:r};return Ua(t,n,r.paymentMethodType,i)},vy={redirect:(e,t,n,r)=>{const o={...r,...n,statusType:"redirect",originalAction:n};return Ua(e,t,"redirect",o)},threeDS2:(e,t,n,r)=>{const o=n.subtype==="fingerprint"?"threeDS2DeviceFingerprint":"threeDS2Challenge",i=n.subtype==="fingerprint"||r.isMDFlow?n.paymentData:n.authorisationToken,a={core:e,token:n.token,paymentData:i,onActionHandled:r.onActionHandled,on3DS2RedirectFlowComplete:r.on3DS2RedirectFlowComplete,onAdditionalDetails:r.onAdditionalDetails,onError:r.onError,isDropin:!!r.isDropin,loadingContext:r.loadingContext,clientKey:r.clientKey,paymentMethodType:r.paymentMethodType,challengeWindowSize:r.challengeWindowSize,usePasskeyIFrameAttributes:r.usePasskeyIFrameAttributes,isMDFlow:r.isMDFlow,modules:{analytics:r.modules?.analytics,resources:r.modules?.resources},...gf(n.subtype,r)};return Ua(e,t,o,a)},voucher:vr("custom"),qrCode:vr("custom"),await:vr("custom"),bankTransfer:vr("custom"),sdk:vr("custom")};function Cy(e,t,n,r={}){const o=vy[n.type];if(o&&typeof o=="function")return o(e,t,n,r);throw new Error("Invalid Action")}function _y(e,t){const n=`${Bt}/sessions/${t.id}/payments?clientKey=${t.clientKey}`,r={sessionData:t.data,...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal",errorCode:An.makePayments},r)}function wy(e,t){const n=`${Bt}/sessions/${t.id}/paymentDetails?clientKey=${t.clientKey}`,r={...t.data&&{sessionData:t.data},...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal",errorCode:An.submitPaymentDetails},r)}function Sy(e){const t=`${Bt}/sessions/${e.id}/donationCampaigns?clientKey=${e.clientKey}`,n={...e.data&&{sessionData:e.data}};return Ve({loadingContext:e.loadingContext,path:t,errorLevel:"fatal",errorCode:An.donationCampaigns},n)}function ky(e,t){const n=`${Bt}/sessions/${t.id}/donations?clientKey=${t.clientKey}`,r={...t.data&&{sessionData:t.data},...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal",errorCode:An.donations},r)}function Ey(e,t){const n=`${Bt}/sessions/${e.id}/setup?clientKey=${e.clientKey}`,r={browserInfo:t.browserInfo,sessionData:e.data,...t.order?{order:{orderData:t.order.orderData,pspReference:t.order.pspReference}}:{}};return Ve({loadingContext:e.loadingContext,path:n,errorLevel:"fatal"},r)}function xy(e,t){const n=`${Bt}/sessions/${t.id}/paymentMethodBalance?clientKey=${t.clientKey}`,r={sessionData:t.data,...e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal"},r)}function Py(e){const t=`${Bt}/sessions/${e.id}/orders?clientKey=${e.clientKey}`,n={sessionData:e.data};return Ve({loadingContext:e.loadingContext,path:t,errorLevel:"fatal",errorCode:An.createOrder},n)}function Ty(e){if(!e||!e.id)throw new M("IMPLEMENTATION_ERROR","Invalid session");const{shopperLocale:t,shopperEmail:n,telephoneNumber:r,id:o}=e;return{id:o,...e.sessionData?{sessionData:e.sessionData}:{},...t&&{shopperLocale:t},...n&&{shopperEmail:n},...r&&{telephoneNumber:r}}}function Dy(e,t){const n=`${Bt}/sessions/${t.id}/orders/cancel?clientKey=${t.clientKey}`,r={sessionData:t.data,order:e};return Ve({loadingContext:t.loadingContext,path:n,errorLevel:"fatal"},r)}function Mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ay{get shopperLocale(){return this.session.shopperLocale}get id(){return this.session.id}get data(){return this.session.sessionData}set sessionsDonationInitiated(t){this._sessionsDonationInitiated=t}get sessionsDonationInitiated(){return this._sessionsDonationInitiated}updateSessionData(t){this.session.sessionData=t,this.storeSession()}setupSession(t){const n={...t,browserInfo:_o()};return Ey(this,n).then(r=>(r.configuration&&(this.configuration={...r.configuration}),r.sessionData&&this.updateSessionData(r.sessionData),r))}submitPayment(t){return _y(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}submitDetails(t){return wy(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}fetchDonationCampaigns(){return Sy(this).then(t=>(t.sessionData&&this.updateSessionData(t.sessionData),t))}makeDonation(t){return ky(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}checkBalance(t){return xy(t,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}createOrder(){return Py(this).then(t=>(t.sessionData&&this.updateSessionData(t.sessionData),t))}cancelOrder(t){return Dy(t.order,this).then(n=>(n.sessionData&&this.updateSessionData(n.sessionData),n))}getStoredSession(){const t=this.storage.get();return this.id===t?.id?t:this.session}storeSession(){this.storage.set({id:this.session.id,sessionData:this.session.sessionData})}removeStoredSession(){this.storage.remove()}constructor(t,n,r){Mn(this,"storage",void 0),Mn(this,"session",void 0),Mn(this,"clientKey",void 0),Mn(this,"loadingContext",void 0),Mn(this,"configuration",void 0),Mn(this,"_sessionsDonationInitiated",void 0);const o=Ty(t);if(!n)throw new Error("No clientKey available");if(!r)throw new Error("No loadingContext available");this.storage=new dd("session","localStorage"),this.clientKey=n,this.loadingContext=r,this.session=o,this._sessionsDonationInitiated=!1,this.session.sessionData?this.storeSession():this.session=this.getStoredSession()}}function Ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Ny=class{getImage(t={}){return this.getImageUrl({...t,resourceContext:this.resourceContext})}constructor(t){if(Ha(this,"resourceContext",void 0),Ha(this,"returnImage",({name:n,resourceContext:r,imageFolder:o="",parentFolder:i="",extension:a,size:s="",subFolder:l=""})=>`${r}images/${o}${l}${i}${n}${s}.${a}`),Ha(this,"getImageUrl",({resourceContext:n,extension:r="svg",...o})=>i=>{const a={extension:r,resourceContext:n,imageFolder:"logos/",parentFolder:"",name:i,...o};return this.returnImage(a)}),!t)throw new M("IMPLEMENTATION_ERROR",'Resources module: "environmentsUrls.cdn" is not a valid URL');this.resourceContext=t}};function Iy({setComponentRef:e}){const t=W({});Object.keys(t.current).length||e?.(t.current);const[n,r]=w(null),o=W(null),i=W(0),[a,s]=w(0);return t.current.setMessages=l=>{const c=o.current;l?.length&&c?.length===l.length&&c.every((d,p)=>d===l[p])&&(i.current+=1,s(i.current)),r(l)},o.current=n,n?u(G,null,n.map(l=>u("div",{key:`${a}-${l}`,className:"adyen-checkout-sr-panel__msg"},l))):null}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ka extends ko{get enabled(){return this._enabled}get moveFocus(){return this._moveFocus}setAriaProps(t){if(!this.props.enabled)return;const n=document.querySelector('[class^="adyen-checkout-sr-panel"]');if(n){for(const[r,o]of Object.entries(t))n.setAttribute(r,o);this.props={...this.props,ariaAttributes:{...this.props.ariaAttributes,...t}}}else console.error("SRPanel: Failed to set aria props because no panel was found")}render(){return this.props.enabled?u("div",{className:this.showPanel?"adyen-checkout-sr-panel":"adyen-checkout-sr-panel--sr-only",role:"log",...this.props.ariaAttributes},u(Iy,{setComponentRef:this.setComponentRef})):null}constructor(t,n){if(super(t,n),xt(this,"srPanelContainer",null),xt(this,"id",void 0),xt(this,"showPanel",void 0),xt(this,"_enabled",void 0),xt(this,"_moveFocus",void 0),xt(this,"componentRef",void 0),xt(this,"setComponentRef",r=>{this.componentRef=r}),xt(this,"setMessages",r=>{if(!this.props.enabled)return;let o=null;r&&(o=Array.isArray(r)?r:[r]),this.componentRef.setMessages(o)}),this.id=this.props.id,this.showPanel=!1,this._enabled=!1,this._moveFocus=this.props.moveFocus??!0,this.props.enabled){this._enabled=!0;const r=document.querySelector(this.props.node);if(!r)throw new Error("Component could not mount. Root node was not found.");{const o=document.getElementById(this.id);o&&r.removeChild(o),this.srPanelContainer=document.createElement("div"),this.srPanelContainer.className="sr-panel-holder",this.srPanelContainer.id=this.id,r.appendChild(this.srPanelContainer),this.mount(this.srPanelContainer)}}}}xt(Ka,"type","srPanel"),xt(Ka,"defaultProps",{enabled:!0,node:"body",showPanel:!1,id:"ariaLiveSRPanel",ariaAttributes:{"aria-relevant":"all","aria-live":"polite","aria-atomic":"true"}});function gd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ry={[g.redirect]:br,[g.threeDS2Challenge]:ka,[g.threeDS2DeviceFingerprint]:Ta,[g.donation]:Ia};var Cr=new class{add(...e){this.componentsMap={...this.componentsMap,...this.createComponentsMap(e)}}getComponent(e){return this.componentsMap[e]||(this.supportedTxVariants.has(e)?void 0:br)}createComponentsMap(e){return e.reduce((t,n)=>{var r;return typeof(r=n).type=="string"&&r.type?(n.type==="dropin"||[n.type,...n.txVariants].filter(o=>o).forEach(o=>{t={...t,[o]:n}}),t):(console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),t)},{})}constructor(){gd(this,"componentsMap",Ry),gd(this,"supportedTxVariants",new Set(Object.values(g)))}};const $y={exposeLibraryMetadata:!0,showPayButton:!0};function bd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class My{async fetchTranslationsFromCdn(t){const n=this.matchLocaleWithCdnSupportedLocales(t);if(n==="en-US")return Ma;try{return await rc({loadingContext:this.cdnUrl,errorLevel:"fatal",errorMessage:`Translations: Failed to fetch translations for locale "${n}"`,path:`sdk/${this.sdkVersion}/translations/${n}.json`})}catch(r){return console.warn(`LanguageService - fetchTranslationsFromCdn(): Failed to fetch locale "${n}."`,r),Ma}}matchLocaleWithCdnSupportedLocales(t){return Wl(t,Ji)||bo}constructor({cdnUrl:t,sdkVersion:n}){bd(this,"cdnUrl",void 0),bd(this,"sdkVersion",void 0),this.cdnUrl=t,this.sdkVersion=n}}function He(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Nt{static setBundleType(t){Nt.metadata.bundleType=t}static register(...t){Cr.add(...t)}register(...t){Cr.add(...t)}getComponent(t){return Cr.getComponent(t)}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(t=>{const{amount:n,shopperLocale:r,countryCode:o,paymentMethods:i,...a}=t;return this.setOptions({...a,amount:this.options.order?this.options.order.remainingAmount:n,locale:this.options.locale||r,countryCode:this.options.countryCode||o}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(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 M($i,"You must specify a countryCode when initializing checkout.")}submitDetails(t){let n=null;this.options.onAdditionalDetails&&(n=new Promise((r,o)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:r,reject:o})})),this.session&&(n=this.session.submitDetails(t).catch(r=>(this.options.onError?.(r),Promise.reject(r)))),n?n.then(hr).then(pr).then(this.afterAdditionalDetails).then(r=>{Eo(r),this.options.onPaymentCompleted?.(r)}).catch(r=>{r instanceof To||(Eo(r),this.options.onPaymentFailed?.(r))}):this.options.onError?.(new M("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,n={}){if(!t||!t.type)throw Y(t,"action")&&Y(t,"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(t.type){const r=t.type===rf?`${t.type}${t.subtype}`:t.paymentMethodType,o=new Ze({type:it.action,subType:Ze.getSubtypeFromActionType(t.type),message:`${r} action was handled by the SDK`,component:r});this.modules.analytics.sendAnalytics(o);const i={...this.getCorePropsForComponent(),...n};return Cy(this,Cr,t,i)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:n=!0}={}){if(n)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(i=>{const a={...t.order?.remainingAmount?{amount:t.order.remainingAmount}:{amount:this.options.amount},...this.session&&{session:this.session},...t};i.update(a)}),this));const{amount:r,secondaryAmount:o}=t;return(r||o)&&this.triggerAmountUpdate(r,o),Promise.resolve(this)}triggerAmountUpdate(t,n){ya(t)?!n||ya(n)?(this.setOptions({amount:t,...n&&{secondaryAmount:n}}),this.components.forEach(r=>{r.updateAmount(t,n)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return{...jf(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const n=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. 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(t){this.paymentMethodsResponse=new by(this.options.paymentMethodsResponse||t,this.options)}createCoreModules(){this.modules||(this.modules=Object.freeze({risk:new Va(this,{...this.options,loadingContext:this.loadingContext}),analytics:new ey({eventQueue:new ty,service:new ny({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:this.options.analytics?.enabled,analyticsData:this.options.analytics?.analyticsData}),resources:new Ny(this.cdnImagesUrl),i18n:new ry({locale:this.options.locale,customTranslations:this.options.translations,service:new My({cdnUrl:this.cdnTranslationsUrl,sdkVersion:Nt.metadata.version}),onError:this.options?.onError}),srPanel:new Ka(this,{...this.options.srConfig})}))}assignLocaleToCore(){this.options.locale=this.modules.i18n.locale}async requestTranslations(){try{await this.modules.i18n.requestTranslations()}catch(t){console.warn("Core - requestTranslations(): Something went wrong.",t)}}async requestAnalyticsAttemptId(){await this.modules.analytics.setUp({locale:this.options.locale,...this.session?.id&&{sessionId:this.session.id}})}constructor(t){He(this,"session",void 0),He(this,"paymentMethodsResponse",void 0),He(this,"modules",void 0),He(this,"options",void 0),He(this,"analyticsContext",void 0),He(this,"loadingContext",void 0),He(this,"cdnImagesUrl",void 0),He(this,"cdnTranslationsUrl",void 0),He(this,"components",[]),He(this,"afterAdditionalDetails",s=>{if(this.options.afterAdditionalDetails&&s?.action){const l=this.createFromAction(s.action);return this.options.afterAdditionalDetails(l),Promise.reject(new To("Handled by afterAdditionalDetails"))}return Promise.resolve(s)}),He(this,"remove",s=>(this.components=this.components.filter(l=>l._id!==s._id),s.unmount(),this)),He(this,"setOptions",s=>{this.options={...this.options,...s,locale:s?.locale||this.options?.locale,environment:String.prototype.toLowerCase.apply(s?.environment||this.options?.environment)}}),zf(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions({...$y,...t});const{apiUrl:n,analyticsUrl:r,cdnImagesUrl:o,cdnTranslationsUrl:i}=Kf(this.options.environment,this.options._environmentUrls);this.loadingContext=n,this.analyticsContext=r,this.cdnImagesUrl=o,this.cdnTranslationsUrl=i,this.session=this.options.session&&new Ay(this.options.session,this.options.clientKey,this.loadingContext);const a=this.options.clientKey?.substring(0,4);if((a==="test"||a==="live")&&!this.loadingContext.includes(a))throw new M("IMPLEMENTATION_ERROR",`Error: you are using a ${a} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);a==="pub."&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.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=Nt.metadata)}}He(Nt,"metadata",{version:aa,bundleType:ec}),He(Nt,"registry",Cr);async function Fo(e){return await new Nt(e).initialize()}Fo.register=(...e)=>{Nt.register(...e)},Fo.setBundleType=e=>{Nt.setBundleType(e)};function Fn(e){const t=k("div",{class:"fy fy-threeds-overlay",role:"dialog","aria-modal":"true"}),n=k("div",{class:"fy-threeds-box"}),r=k("div",{class:"flex items-center justify-between border-b border-zinc-200 px-4 py-3"}),o=k("div",{class:"flex flex-col gap-0.5"});o.append(k("p",{class:"text-sm font-semibold",text:"Secure authentication"})),e.showWordmark!==!1&&o.append(yn());const i=k("button",{type:"button",class:"rounded-md px-2 py-1 text-sm text-zinc-500 hover:bg-zinc-100",text:"Close"});r.append(o,i);const a=k("div",{class:"relative min-h-0 flex-1 bg-white"});let s=null;e.url&&(s=k("iframe",{src:e.url,title:"3-D Secure authentication",allow:"payment"}),s.style.cssText="width:100%;height:100%;border:0;display:block;",a.append(s)),n.append(r,a),t.append(n),document.body.append(t);const l=d=>{const p=d.data;if(!(!p||typeof p!="object")){if("code"in p&&p.code==="3DS-Success"){c(),e.onSuccess();return}if("code"in p&&p.code==="3DS-Error"){c(),e.onError(p.error?.message||p.resultCode||"3-D Secure failed");return}"success"in p&&p.success===!1&&(c(),e.onError(p.message||"3-D Secure failed"))}};window.addEventListener("message",l);function c(){window.removeEventListener("message",l),t.remove()}return i.addEventListener("click",()=>{c(),e.onError("Authentication cancelled")}),e.mountAdyen&&e.mountAdyen(a),c}function Fy(e){return e==="applepay"?Nn:e==="googlepay"?gr:Do}async function vd(e){const t=e.paymentData.clientKey;if(!t)throw new Error("Adyen client key is missing.");let n=null,r=null;const o=await Fo({clientKey:t,environment:e.paymentData.environment||"test",locale:e.paymentData.locale||"en-US",countryCode:Fr(e.currency),amount:{value:Math.round(e.amount*100),currency:e.currency},onSubmit:async(s,l)=>{if(!s.isValid)return;const c=s.data;await a({paymentMethod:c.paymentMethod,browserInfo:c.browserInfo},l)},onAdditionalDetails:async s=>{const l=s.data;await a({details:l.details,paymentData:l.paymentData},n)},onError:s=>{e.onError(s?.message||"Adyen checkout error")}}),i=Fy(e.methodType);n=new i(o,{showPayButton:!0}).mount(e.container);async function a(s,l){const c=await e.client.confirmPayment(e.paymentId,s);if(!c.ok){e.onError(c.message);return}const d=c.data.paymentData?.action,p=c.data.paymentData?.resultCode;if(d){const h=String(d.type||""),m=Br(d.url);if((h==="redirect"||h==="redirect_iframe")&&m){r=Fn({url:m,showWordmark:e.showWordmark,onSuccess:e.onSuccess,onError:e.onError});return}r=Fn({showWordmark:e.showWordmark,onSuccess:e.onSuccess,onError:e.onError,mountAdyen:f=>{f.append(e.container);try{l?.handleAction?.(d)}catch{f.append("Could not present 3-D Secure challenge.")}}});return}if(p==="Authorised"||c.data.payment.transactionStatus==="Authorised"){e.onSuccess();return}p&&p!=="Pending"&&p!=="Received"&&e.onError(p)}return()=>{r?.(),n?.unmount?.()}}function Cd(e){return String(e||"").toUpperCase()==="ADYEN"}function Ly(e){return e==="applepay"?Nn:e==="googlepay"?gr:Do}async function Oy(e){const t=await e.ctx.client.getClientConfig();let n=null,r=null,o=e.options.existingPaymentId||"";const i=await Fo({clientKey:t.clientKey,environment:t.environment||"test",locale:t.locale||"en-US",countryCode:Fr(e.options.currency),amount:{value:Math.round(e.options.amount*100),currency:e.options.currency},onSubmit:async(c,d)=>{if(!c.isValid)return;const p=c.data,h={...p.paymentMethod||{},type:us(e.method.type)},m=await e.ctx.client.createPayment({amount:e.options.amount,currency:e.options.currency,orderId:e.options.orderId,items:e.options.items,returnUrl:e.options.returnUrl??"",autoCapture:e.options.autoCapture,metadata:e.options.metadata,existingOrderId:e.options.existingOrderId,existingPaymentId:e.options.existingPaymentId,paymentMethod:e.method,encryptedPaymentMethod:h,browserInfo:p.browserInfo});await l(m,d)},onAdditionalDetails:async c=>{const d=c.data;await s({details:d.details,paymentData:d.paymentData},n)},onError:c=>{e.onError(c?.message||"Adyen checkout error")}}),a=Ly(e.method.type);n=new a(i,{showPayButton:!0}).mount(e.container);async function s(c,d){const p=await e.ctx.client.confirmPayment(o,c);await l(p,d)}async function l(c,d){if(!c.ok){e.onError(c.message);return}o=String(c.data.payment.id||o);const p=c.data.paymentData?.action,h=c.data.paymentData?.resultCode;if(p){const m=String(p.type||""),f=Br(typeof p.url=="string"?p.url:void 0);if((m==="redirect"||h==="RedirectShopper")&&f){window.location.assign(f);return}if(m==="redirect_iframe"&&f){r=Fn({url:f,showWordmark:e.showWordmark,onSuccess:()=>e.onSuccess(o),onError:e.onError});return}r=Fn({showWordmark:e.showWordmark,onSuccess:()=>e.onSuccess(o),onError:e.onError,mountAdyen:y=>{y.append(e.container);try{d?.handleAction?.(p)}catch{y.append("Could not present 3-D Secure challenge.")}}});return}if(h==="Authorised"||c.data.payment.transactionStatus==="Authorised"){e.onSuccess(o);return}h&&h!=="Pending"&&h!=="Received"&&e.onError(h)}return()=>{r?.(),n?.unmount?.()}}function ja(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function By(e){if(Array.isArray(e))return e}function Vy(e){if(Array.isArray(e))return ja(e)}function _d(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(c){n(c);return}s.done?t(l):Promise.resolve(l).then(r,o)}function _r(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(l){_d(i,r,o,a,s,"next",l)}function s(l){_d(i,r,o,a,s,"throw",l)}a(void 0)})}}function za(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Uy(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qa(e,t,n){return t&&Uy(e.prototype,t),e}function Wa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Hy(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ky(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,s;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,s=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw s}}return r}}function jy(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zy(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable}))),r.forEach(function(o){Wa(e,o,n[o])})}return e}function qy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}function Lo(e,t){return t=t??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qy(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function wd(e,t){return By(e)||Ky(e,t)||kd(e,t)||jy()}function Sd(e){return Vy(e)||Hy(e)||kd(e)||zy()}function wr(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function kd(e,t){if(e){if(typeof e=="string")return ja(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ja(e,t)}}function Sr(e,t){var n,r,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(d){return l([c,d])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=c[0]&2?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(d){c=[6,d],r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}var an=(function(e){return e.production="prod",e.demo="demo",e.staging="staging",e})(an||{}),sn="airTracker_unknown",Wy={appName:sn,appVersion:sn,env:"staging",isWebappContainer:!1,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:!1,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:!1,enableRecordPageRetention:!1,hideSearchParams:!1,useSessionStorageForSessionId:!1,assetSpeedMonitoringWhiteListByMFE:{}},Gy={appName:sn,env:"staging",sessionId:sn,deviceId:sn},Yy=function(e){return!e||/^\s*$/.test(e)?!1:(e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@"),e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]"),e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,""),/^[\],:{}\s]*$/.test(e))},Ed=function(){var e=new WeakSet;return function(t,n){if(Ut(n,Error))return"Error.message: ".concat(n.message,`
140
140
  Error.stack: `).concat(n.stack);if((typeof n>"u"?"undefined":wr(n))==="object"&&n!==null){if(e.has(n))return"[Circular ".concat(t||"root","]");e.add(n)}return typeof n=="function"?"function":(typeof n>"u"?"undefined":wr(n))==="symbol"?"symbol":typeof n>"u"?null:n}},Ln=function(e){if(typeof e=="string")return e;try{return Ut(e,Error)?(JSON.stringify(e,Ed())||"undefined").replace(/"/gim,""):JSON.stringify(e,Ed())}catch{return'{"error":"error happen when airTracker stringify"}'}},Oo=function(e){var t=e.method,n=t===void 0?"post":t,r=e.url,o=e.data,i=e.success,a=e.fail;if(Yy(o)){var s=new XMLHttpRequest;s.addEventListener("readystatechange",function(){s.readyState===4&&(s.status>=400||s.status===0?a?.(s.response):i?.(s.response))}),s.open(n,r),s.setRequestHeader("Content-Type","application/json"),s.send(o)}},It={onInit:"onInit",onConfigInit:"onConfigInit",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated"},xd="AIR_ANALYTICS_DEVICE_ID",Pd="AIR_ANALYTICS_SESSION_ID",Zy="AWX_RISK_ID",Qy=function(e){return e=="prod"?"https://o11y.airwallex.com/airtracker/logs":e=="demo"?"https://o11y-demo.airwallex.com/airtracker/logs":"https://o11y-staging.airwallex.com/airtracker/logs"},Jy=function(e){return e=="prod"?"https://o11y.airwallex.com/airtracker/metrics":e=="demo"?"https://o11y-demo.airwallex.com/airtracker/metrics":"https://o11y-staging.airwallex.com/airtracker/metrics"},Bo=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=Math.random()*16|0,r=t==="x"?n:n&3|8;return r.toString(16)});return e},kr=function(e){var t,n,r;return e.config.getMFEName?e.config.getMFEName():((r=location)===null||r===void 0||(n=r.pathname)===null||n===void 0||(t=n.split("/"))===null||t===void 0?void 0:t[2])||"unknown"},Xy=function(){try{var e=window.sessionStorage.getItem(Pd);return e||(e=Bo(),window.sessionStorage.setItem(Pd,e)),e}catch{return Bo()}},e2=function(){try{var e=window.localStorage.getItem(xd);return e||(e=Bo(),window.localStorage.setItem(xd,e)),e}catch{}},t2=function(){try{var e=window.localStorage.getItem(Zy);return e||void 0}catch{}},n2=function(){var e,t="",n=navigator.userAgent.match(/NetType\/(\w+)/);if(n){var r;r=wd(n,2),t=r[1]}else if(!((e=navigator)===null||e===void 0)&&e.connection){var o,i,a,s;t=((i=navigator)===null||i===void 0||(o=i.connection)===null||o===void 0?void 0:o.effectiveType)||((s=navigator)===null||s===void 0||(a=s.connection)===null||a===void 0?void 0:a.type)}return t||(t="unknown"),r2(t)},r2=function(e){return e=String(e).toLowerCase(),e.indexOf("4g")>=0?"net4g":e.indexOf("wifi")>=0?"wifi":e.indexOf("5g")>=0?"net5g":e.indexOf("3g")>=0?"net3g":e.indexOf("2g")>=0?"net2g":"unknown"},o2=function(){return typeof window.performance<"u"&&typeof window.performance.clearResourceTimings=="function"&&typeof window.performance.getEntriesByType=="function"&&typeof window.performance.now=="function"},i2=function(e){if(typeof e=="string"){var t=e.split("?")[0]||"";return t.slice(0,200)}return e},a2=function(e){return typeof e=="string"?e.split("?")[1]||"":e},s2=function(e){var t=typeof e=="string"&&e.startsWith("//");return t?typeof location<"u"&&location.protocol==="https:":/^https/.test(e)},Td=function(e,t){return typeof e=="number"||typeof e=="string"?e:-1},l2=function(e,t){var n,r=!1;if(!t.config.isWebappContainer)return r=Ga(e,t.config.assetSpeedMonitoringWhiteList),r;var o=kr(t);return r||Ga(e,(n=t.config.assetSpeedMonitoringWhiteListByMFE)===null||n===void 0?void 0:n[o])},Ga=function(e,t){if(!t?.length)return!1;for(var n=0;n<t.length;n++){var r=t[n];if(Ut(r,RegExp)&&r.test(e)||typeof r=="string"&&e.includes(r))return!0}return!1},On=function(e,t){var n=100;return Math.round((e-t)*n)/n},Dd=function(e){return function(t){var n,r,o=kr(e),i=e.config.isWebappContainer?ft({},e.commonData||{},((n=e.MFECommonDataMap)===null||n===void 0?void 0:n[o])||{}):e.commonData,a=Array.isArray(t)?t:[t];if(a.length!==0){var s={commonData:i,data:a},l=Ln(s),c={method:"post",url:Qy(e.commonData.env),data:l};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)=="function"){var d=navigator.sendBeacon(c.url,l);d||Oo(c)}else Oo(c)}}},c2=function(e){return function(t){var n,r,o=kr(e),i=e.config.isWebappContainer?ft({},e.commonData||{},((n=e.MFECommonDataMap)===null||n===void 0?void 0:n[o])||{}):e.commonData,a={commonData:i,data:Array.isArray(t)?t:[t]},s=Ln(a),l={method:"post",url:Jy(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)=="function"){var c=navigator.sendBeacon(l.url,s);c||Oo(l)}else Oo(l)}},Ad=function(e,t){var n,r=[],o=e.config;return window.addEventListener("beforeunload",function(){r.length>0&&(e.immediateSendPipe(r.splice(0,r.length)),n&&clearTimeout(n))}),function(i,a){if(r.push(i),e.lifeCycle.on(It.onCommonUpdated,function(){r.length>0&&(a?.(r.splice(0,r.length)),e.lifeCycle.remove(It.onCommonUpdated),n&&clearTimeout(n))}),r.length>=t){a?.(r.splice(0,r.length)),n&&clearTimeout(n);return}n&&clearTimeout(n),n=setTimeout(function(){n=null,r.length>0&&(a?.(r.splice(0,r.length)),e.lifeCycle.remove(It.onCommonUpdated))},o.delay)}},d2=function(e){var t={};return function(n,r){var o=typeof e.config.errorRepeatTime=="number"?e.config.errorRepeatTime:5;if(o===0)return r?.(n);r?.(n.filter(function(i){return i.severity=="autoDetectError"?(t[i.error]=t[i.error]||0,t[i.error]+=1,!(t[i.error]>o)):!0}))}},Nd=function(){},Id=function(e){if(!e||!e.reduce||!e.length)throw new TypeError("createPipeline need at least one function param");return e.length===1?function(t,n){e[0](t,n||Nd)}:e.reduce(function(t,n){return function(r){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nd;return t(r,function(i){return n?.(i,o)})}})},u2=(function(){function e(){var t=this;za(this,e),this.emit=function(n,r){if(t){var o=t.eventsList[n],i;if(o?.length){o=o.slice();for(var a=0;a<o.length;a++){i=o[a];try{var s=i.callback.apply(t,[r]);if(i.type===1&&t.remove(n,i.callback),s===!1)break}catch(l){throw l}}}return t}},this.eventsList={}}return qa(e,[{key:"indexOf",value:function(n,r){for(var o=0;o<n.length;o++)if(n[o].callback===r)return o;return-1}},{key:"on",value:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this){var i=this.eventsList[n];if(i||(this.eventsList[n]=[],i=this.eventsList[n]),this.indexOf(i,r)===-1){var a={name:n,type:o||0,callback:r};return i.push(a),this}return this}}},{key:"one",value:function(n,r){this.on(n,r,1)}},{key:"remove",value:function(n,r){if(this){var o=this.eventsList[n];if(!o)return null;if(!r){try{delete this.eventsList[n]}catch{}return null}if(o.length){var i=this.indexOf(o,r);o.splice(i,1)}return this}}},{key:"clear",value:function(){this.eventsList={}}}]),e})(),Er=(function(){function e(t){za(this,e),this.name="",this.isInit=!1,this.name=t.name,this.option=t}return qa(e,[{key:"patch",value:function(n){if(!this.isInit){var r,o;this.isInit=!0,(o=this.option)===null||o===void 0||(r=o.setUp)===null||r===void 0||r.call(this.option,n)}}},{key:"uninstall",value:function(){var n,r;(r=this.option)===null||r===void 0||(n=r.destroy)===null||n===void 0||n.apply(this),this.isInit=!1}}]),e})(),Vo,Rd=function(e){var t="".concat(Ln(e.message)||""," @ (").concat(Ln(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,`)
141
- `).concat(Ln(e.error||""));Vo.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:t}})},$d=function(e){var t=e&&Ln(e.reason);Vo.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:t}})},Md=function(e){var t=e?.target||e?.srcElement;if(t){var n=t?.src||t?.href,r=t.tagName,o="unknown";if(typeof n=="string"&&r){if(window.location.href.indexOf(n)>-1)return;if(/\.js$/.test(n))o="script";else if(/\.css$/.test(n))o="css";else switch(r.toLowerCase()){case"script":o="script";break;case"link":o="css";break;case"img":o="image";break;case"audio":case"video":o="media";break;default:return}Vo.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:o,error:"".concat(r," load fail: ").concat(n)}})}}},h2=new Er({name:"errorDetectionPlugin",setUp:function(e){Vo=e,window.addEventListener("error",Rd),window.addEventListener("unhandledrejection",$d),window.document.addEventListener("error",Md,!0)},destroy:function(){window.removeEventListener("unhandledrejection",$d),window.document.removeEventListener("error",Md,!0),window.removeEventListener("error",Rd)}}),p2=["img","css","script","link","audio","video","iframe"],Ya="resource",m2=function(e){var t=e.name;return{url:i2(t),method:"get",duration:Number(e.duration.toFixed(2)),type:"static",isHttps:s2(t),urlQuery:a2(t),domainLookup:Td(e.domainLookupEnd-e.domainLookupStart),connectTime:Td(e.connectEnd-e.connectStart)}},Za=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];p2.indexOf(o.initiatorType)!==-1&&l2(o.name,t)&&t.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:m2(o)}})}},Qa,xr,f2=new Er({name:"assetsSpeedPlugin",setUp:function(e){if(o2()){var t=0;window.performance.onresourcetimingbufferfull=function(){t=0,window.performance.clearResourceTimings()},typeof window.PerformanceObserver=="function"?(Za(window.performance.getEntriesByType(Ya),e),xr=new window.PerformanceObserver(function(n){Za(n.getEntries(),e)}),xr.observe({entryTypes:[Ya]})):Qa=setInterval(function(){var n=window.performance.getEntriesByType(Ya),r=n.slice(t);t=n.length,Za(r,e)},3e3)}},destroy:function(){xr?.disconnect(),Qa&&clearInterval(Qa)}}),Pr,y2=new Er({name:"onPageChangePlugin",setUp:(function(){var e=_r(function(t){var n,r,o,i,a;return Sr(this,function(s){return r=(n=location)===null||n===void 0?void 0:n.href,o=document.querySelector("body"),i=function(l){var c=l.prevHref,d,p,h,m,f;t.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:c,href:((d=location)===null||d===void 0?void 0:d.href)||"",hostname:(p=location)===null||p===void 0?void 0:p.hostname,pathName:(h=location)===null||h===void 0?void 0:h.pathname,protocol:(m=location)===null||m===void 0?void 0:m.protocol,search:(f=location)===null||f===void 0?void 0:f.search}})},i({prevHref:""}),Pr=new MutationObserver(function(){if(location.href!==r){var l=r;r=location.href,i({prevHref:l})}}),a={subtree:!0,childList:!0},Pr.observe(o||document,a),[2]})});return function(t){return e.apply(this,arguments)}})(),destroy:function(){Pr?.disconnect()}}),Tr,g2=new Er({name:"onPageRetentionPlugin",setUp:(function(){var e=_r(function(t){var n,r,o,i,a,s,l;return Sr(this,function(c){return typeof document.visibilityState>"u"?[2]:(r=(n=location)===null||n===void 0?void 0:n.href,o=document.querySelector("body"),a=function(){i=Date.now()},a(),document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"?s({href:location.href,leftReason:"visibilityChange"}):document.visibilityState==="visible"&&a()}),window.addEventListener("beforeunload",function(){s({href:location.href,sendImmediate:!0,leftReason:"pageClose"})}),s=function(d){var p=d.href,h=d.sendImmediate,m=d.leftReason;if(i){var f=Date.now()-i;if(f!==0){i=void 0;var y={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:p,duration:f,leftReason:m}};if(h){t.ImmediatePipeline(y);return}t.normalLogPipeLine(y)}}},Tr=new MutationObserver(function(){if(location.href!==r){var d=r;r=location.href,s({href:d,leftReason:"nextPage"}),a()}}),l={subtree:!0,childList:!0},Tr.observe(o||document,l),[2])})});return function(t){return e.apply(this,arguments)}})(),destroy:function(){Tr?.disconnect()}}),Fd=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)},Ld=function(e,t){var n=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/],r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];return r.some(function(o){return o.test(e)})?!1:Ga(e,t||n)},b2=function(e){var t=e.startTime,n=e.endTime,r=e.entries;if(r.length!==0){if(r.length===1)return r[0];var o=r.filter(function(i){return i.startTime>=t&&n&&i.responseEnd<=n}).sort(function(i,a){return i.startTime-a.startTime});return o?.[0]}},Od=function(e){return Math.round(e*100)/100},v2=function(e){var t=e.startTime,n=e.duration,r=e.responseStart,o=e.connectEnd,i=e.connectStart,a=e.domainLookupEnd,s=e.domainLookupStart,l=e.requestStart,c=e.secureConnectionStart,d=e.redirectEnd,p=e.redirectStart,h=e.responseStatus,m=e.responseEnd,f=e.encodedBodySize,y=e.decodedBodySize,b=e.transferSize,v=e.deliveryType,C=e.initiatorType;return{startTime:Od(t),totalDuration:Od(n),timeToFirstByte:On(r,t),tcpDuration:On(o,i),dnsDuration:On(a,s),tlsDuration:On(l,c),redirectDuration:On(d,p),responseDuration:On(m,r),encodeResponseSize:f,decodeResponseSize:y,transferSize:b,deliveryType:v,statusCode:h,initiatorType:C}},Bd=function(e,t){var n=e.url,r=e.method,o=e.errorType,i=e.errorDetail,a=b2(e),s=new URL(n,window.location.href),l=s.href,c=s.protocol,d=a?v2(a):{},p={severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:ft(Lo(ft({httpUrl:l,method:r,scheme:c},o&&{errorType:o},i&&{errorDetail:i},d),{statusCode:d?.statusCode||e?.responseStatus,startTime:d?.startTime||e?.startTime,initiatorType:d?.initiatorType||e?.initiatorType}),t)};return p},Vd=function(e){return e&&(typeof e>"u"?"undefined":wr(e))==="object"&&"errors"in e&&Array.isArray(e.errors)&&e.errors.every(function(t){return t&&(typeof t>"u"?"undefined":wr(t))==="object"&&"message"in t})},lt="awx_airtracker_api_performance_queue",Ud="awx_airtracker_api_performance_plugin_loaded",C2=300,_2=1e4,Ke=typeof window<"u"?window:typeof global<"u"?global:{};Ke[lt]=Ke[lt]||[];var Bn=function(e,t,n){setTimeout(function(){var r=Bd(e,n);t.observerPipeline(r),Ke[lt]=Ke[lt].filter(function(o){return o.id!==e.id})},C2)},Hd=function(e,t){setTimeout(function(){var n=Ke[lt].find(function(o){return o.id===e});if(n){var r=Bd(n,{exceptionType:"timeout-without-response"});t.observerPipeline(r),Ke[lt]=Ke[lt].filter(function(o){return o.id!==e})}},_2)},w2=function(e){var t=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(o,i,a,s,l){try{var c,d=Fd();this.__requestId=d;var p=Ut(i,URL)?i.href:new URL(i,window.location.href).href;if(!Ld(p,(c=e.config)===null||c===void 0?void 0:c.enableRecordAPIPerformanceWhitelist))return t.call(this,o,i,a??!0,s,l);var h={id:d,startTime:performance.now(),method:o,url:p,entries:[],initiatorType:"xmlhttprequest"};return Ke[lt].push(h),Hd(d,e),t.call(this,o,i,a??!0,s,l)}catch(m){return e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:m}}),t.call(this,o,i,a??!0,s,l)}},XMLHttpRequest.prototype.send=function(){for(var o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];try{var l=Ke[lt].find(function(d){return d.id===o.__requestId});if(!l)return n.apply(this,a);var c=this;return this.addEventListener("loadend",_r(function(){var d,p,h,m,f,y,b;return Sr(this,function(v){switch(v.label){case 0:if(d=performance.now(),p=d-l.startTime,h=c.status,h===0)return[2];l.endTime=d,l.duration=p,l.responseStatus=h,v.label=1;case 1:return v.trys.push([1,6,,7]),c.responseType===""||c.responseType==="text"?(m=c.responseText,[3,5]):[3,2];case 2:return c.responseType!=="json"?[3,3]:(m=c.response,[3,5]);case 3:return c.responseType!=="blob"?[3,5]:(f=c.response,f?.type!=="application/json"?[3,5]:[4,f.text()]);case 4:m=v.sent(),v.label=5;case 5:return y=m&&typeof m=="string"?JSON.parse(m):m,y&&Vd(y)&&(l.errorType="graphqlError",l.errorDetail=y.errors),[3,7];case 6:return b=v.sent(),e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:l?.url,error:b}}),[3,7];case 7:return Bn(l,e),[2]}})})),this.addEventListener("error",function(){Bn(l,e,{exceptionType:"network-error"})}),this.addEventListener("abort",function(){Bn(l,e,{exceptionType:"abort-error"})}),this.addEventListener("timeout",function(){Bn(l,e,{exceptionType:"timeout-error"})}),n.apply(this,a)}catch(d){throw e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:d}}),d}}},S2=function(e){var t=window.fetch;window.fetch=_r(function(){var n,r,o,i,a,s,l,c,d,p,h,m,f,y,b,v,C=arguments;return Sr(this,function(_){switch(_.label){case 0:for(n=C.length,r=new Array(n),o=0;o<n;o++)r[o]=C[o];return s=new URL(Ut(r[0],Request)?r[0].url:String(r[0]),window.location.href).href,Ld(s,(i=e.config)===null||i===void 0?void 0:i.enableRecordAPIPerformanceWhitelist)?[3,2]:[4,t.apply(this,r)];case 1:return[2,_.sent()];case 2:return _.trys.push([2,9,,10]),c=performance.now(),d=Fd(),a={id:d,startTime:c,method:((l=Ut(r[0],Request)?r[0]:r[1])===null||l===void 0?void 0:l.method)||"GET",url:s,entries:[],initiatorType:"fetch"},Ke[lt].push(a),Hd(d,e),[4,t.apply(this,r)];case 3:p=_.sent(),h=performance.now(),a.endTime=h,a.duration=h-c,a.responseStatus=p.status,m=p.clone(),_.label=4;case 4:return _.trys.push([4,7,,8]),m.ok?[4,m.json()]:[3,6];case 5:f=_.sent(),f&&Vd(f)&&(a.errorType="graphqlError",a.errorDetail=f.errors),_.label=6;case 6:return[3,8];case 7:return y=_.sent(),e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a?.url,error:y}}),[3,8];case 8:return Bn(a,e),[2,p];case 9:throw b=_.sent(),a&&a.id&&Ke[lt].find(function(S){return S.id===a?.id})?(v="fetch-error",Ut(b,TypeError)?v="network-error":Ut(b,DOMException)&&b.name==="AbortError"&&(v="abort-error"),Bn(a,e,{exceptionType:v})):e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:b}}),b;case 10:return[2]}})})},k2=function(e){var t;if(w2(e),S2(e),!((t=window)===null||t===void 0)&&t.PerformanceObserver){var n=new window.PerformanceObserver(function(r){var o=r.getEntries();o.forEach(function(i){var a=i;if(a.initiatorType==="fetch"||a.initiatorType==="xmlhttprequest"){var s=Ke[lt].filter(function(l){return l.url===a.name});s.forEach(function(l){l.entries.push(a)})}})});n.observe({entryTypes:["resource"],buffered:!0})}else e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})},E2=new Er({name:"apiPerformancePlugin",setUp:(function(){var e=_r(function(t){var n,r;return Sr(this,function(o){return Ke[Ud]?[2]:(!((n=t.config)===null||n===void 0)&&n.enableRecordAPIPerformance&&Math.random()<(((r=t.config)===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)||0)&&(Ke[Ud]=!0,k2(t)),[2])})});return function(t){return e.apply(this,arguments)}})()}),x2="3.1.0",P2=(function(){function e(t){var n=this,r=t.config,o=t.plugins,i=o===void 0?[]:o;za(this,e),this.config=Wy,this.lifeCycle=new u2,this.plugins=[],this._commonData=Gy,this._MFECommonDataMap={},this.timeMap={},this.packedDataConvert=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d,p,h=ft({severity:s,eventName:l,currentHref:n.config.hideSearchParams?(((d=location)===null||d===void 0?void 0:d.href)||"").split("?")[0]||"":((p=location)===null||p===void 0?void 0:p.href)||""},c);return n.config.isWebappContainer&&(h.MFEName=kr(n)),h},this.normalPipelineObj=Id([Ad(this,8),d2(this),Dd(this)]),this.observerPipelineObj=Id([Ad(this,8),c2(this)]),this.immediateSendPipe=Dd(this),this.observerPipeline=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d=n.packedDataConvert({severity:s,eventName:l,extraInfo:c});return n.observerPipelineObj(d)},this.normalLogPipeLine=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d=n.packedDataConvert({severity:s,eventName:l,extraInfo:c});return n.config.disableThrottle?n.immediateSendPipe(d):n.normalPipelineObj(d)},this.ImmediatePipeline=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d=n.packedDataConvert({severity:s,eventName:l,extraInfo:c});return n.immediateSendPipe(d)},this.plugins=Sd(i),this.setConfig(r),this.initCommonData(r),this.lifeCycle.emit(It.onInit),r.enableErrorMonitoring&&this.plugins.push(h2),(r?.assetSpeedMonitoringWhiteList&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer)&&this.plugins.push(f2),r?.enableDetectPageChange&&this.plugins.push(y2),r?.enableRecordPageRetention&&this.plugins.push(g2),r?.enableRecordAPIPerformance&&r?.enableRecordAPIPerformancePercentage&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1&&this.plugins.push(E2),this.installPlugins()}return qa(e,[{key:"installPlugins",value:function(){var n=this;this.plugins.forEach(function(r){r.patch(n)})}},{key:"commonData",get:function(){return this._commonData}},{key:"MFECommonDataMap",get:function(){return this._MFECommonDataMap}},{key:"initCommonData",value:function(n){this._commonData.sessionId=n.useSessionStorageForSessionId?Xy():Bo(),this._commonData.deviceId=e2()||sn,this._commonData.riskDeviceId=t2(),this._commonData.networkType=n2()||"unknown",this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||sn,this._commonData.appVersion=n.appVersion,this._commonData.appName=n.appName,this._commonData.sdkVersion=x2,this.lifeCycle.emit(It.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function(n){this.lifeCycle.emit(It.onCommonUpdated,this._commonData),this._commonData.env=n.env||this._commonData.env,this._commonData.appName=n.appName||this._commonData.appName,this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||this._commonData.accountId,this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function(n){this.lifeCycle.emit(It.onCommonUpdated,this._commonData),this._commonData=ft({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function(n){var r=this;this.lifeCycle.emit(It.onCommonUpdated,this._commonData),setTimeout(function(){n.forEach(function(o){delete r._commonData[o]})},1e3)}},{key:"addToMFECommonData",value:function(n){var r=n.MFEName,o=n.MFECommonData,i;this.config.isWebappContainer&&(!r||!o||(this._MFECommonDataMap=Lo(ft({},this._MFECommonDataMap||{}),Wa({},r,ft({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[r])||{},o)))))}},{key:"setConfig",value:function(n){var r=this;if(!this.config.isWebappContainer){var o=function(i,a){r.config[i]=a};Object.entries(n).forEach(function(i){var a=wd(i,2),s=a[0],l=a[1];(typeof l>"u"?"undefined":wr(l))!==void 0&&o(s,l)}),this.lifeCycle.emit(It.onConfigInit,this.config),this.updateCommonDataBasedOnConfig(n)}}},{key:"verbose",value:function(n,r){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:r})}},{key:"httpLog",value:function(n,r){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:r})}},{key:"info",value:function(n,r){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:r})}},{key:"warn",value:function(n,r){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:r})}},{key:"error",value:function(n,r){console.error("error",n),this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:r})}},{key:"businessLog",value:function(n,r){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:Lo(ft({},r),{isBusinessLog:!0})})}},{key:"reportDuration",value:function(n,r,o){if(typeof n!="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof r!="number"){console.warn("reportDuration: duration (second param) must be number");return}if(r<0||r>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:ft({duration:r},o)})}},{key:"getTimerKey",value:function(n){var r=kr(this);return this.config.isWebappContainer?"".concat(r,"_").concat(n):n}},{key:"timeStart",value:function(n){if(typeof n!="string"){console.warn("time: first param must be a string");return}this.timeMap[this.getTimerKey(n)]&&console.warn("Timer ".concat(n," already exists")),this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function(n,r){if(typeof n!="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var o=Date.now()-this.timeMap[this.getTimerKey(n)]+(r||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:o}}),delete this.timeMap[this.getTimerKey(n)]}else console.warn("Timer key :".concat(n," does not exist"))}},{key:"addToAssetSpeedWhiteListByMFE",value:function(n){var r=n.MFEName,o=n.whiteList,i;if(this.config.isWebappContainer&&!(!r||!o?.length))if(this.config.assetSpeedMonitoringWhiteListByMFE||(this.config.assetSpeedMonitoringWhiteListByMFE={}),!(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0)&&i[r]))this.config.assetSpeedMonitoringWhiteListByMFE=Lo(ft({},this.config.assetSpeedMonitoringWhiteListByMFE),Wa({},r,o));else{var a,s,l;(l=this.config.assetSpeedMonitoringWhiteListByMFE)===null||l===void 0||(s=l[r])===null||s===void 0||(a=s).push.apply(a,Sd(o))}}},{key:"destroy",value:function(){this.config.isWebappContainer||this.plugins.forEach(function(n){n.uninstall()})}}]),e})(),T2=P2,Ja=function(e,t){return Ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Ja(e,t)};function Xa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ja(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ct=function(){return ct=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ct.apply(this,arguments)};function Dr(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(d){try{c(r.next(d))}catch(p){a(p)}}function l(d){try{c(r.throw(d))}catch(p){a(p)}}function c(d){d.done?i(d.value):o(d.value).then(s,l)}c((r=r.apply(e,[])).next())})}function Ar(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(d){return l([c,d])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(d){c=[6,d],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Kd(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var D2="1.35.0",A2={version:D2},N2={dev:an.staging,staging:an.staging,demo:an.demo,prod:an.production},I2=function(e,t){return e===void 0&&(e=an.production),window._AirwallexSDKs.airTracker||(window._AirwallexSDKs.airTracker=new T2({config:{appName:"components-sdk",appVersion:A2.version,env:N2[e]||an.production}}),window._AirwallexSDKs.airTracker.updateCommonData({clientId:t})),window._AirwallexSDKs.airTracker},Uo=function(e){if(typeof e!="object")return e;try{var t=JSON.parse(JSON.stringify(e));return Object.keys(t).forEach(function(n){typeof n=="string"&&["auth","code"].some(function(r){return n.includes(r)})&&(t[n]="***")}),t}catch{return e}},ln=function(e,t){var n,r;(r=(n=window._AirwallexSDKs)===null||n===void 0?void 0:n.airTracker)===null||r===void 0||r.error(e,ct(ct({},t),{context:"components-sdk"}))},R2=function(e,t){var n;(n=window._AirwallexSDKs.airTracker)===null||n===void 0||n.warn(e,ct(ct({},t),{context:"components-sdk"}))},Nr=function(e,t){var n;(n=window._AirwallexSDKs.airTracker)===null||n===void 0||n.info(e,ct(ct({},t),{context:"components-sdk"}))},jd=(function(e){Xa(t,e);function t(n){var r=e.call(this,n)||this;return r.code="LOAD_SCRIPT_ERROR",r}return t})(Error),cn,dn,Ee;(function(e){e.dev="dev",e.staging="staging",e.demo="demo",e.prod="prod",e.sandbox="sandbox"})(Ee||(Ee={}));var $2=(cn={},cn[Ee.dev]="https://checkout-staging.airwallex.com",cn[Ee.staging]="https://checkout-staging.airwallex.com",cn[Ee.demo]="https://checkout-demo.airwallex.com",cn[Ee.prod]="https://checkout.airwallex.com",cn[Ee.sandbox]="https://checkout.sandbox.airwallex.com",cn),M2=(dn={},dn[Ee.dev]="https://static-staging.airwallex.com",dn[Ee.staging]="https://static-staging.airwallex.com",dn[Ee.demo]="https://static-demo.airwallex.com",dn[Ee.prod]="https://static.airwallex.com",dn[Ee.sandbox]="https://static.sandbox.airwallex.com",dn),zd="sdkController",qd="payments",F2={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"},L2={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"},Wd={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]},O2={billing:["payments"]},Gd=["payments","sca","billing"],B2=(function(e){Xa(t,e);function t(n){var r=e.call(this,n)||this;return r.code="INVALID_STATIC_RESOURCE_ERROR",r}return t})(Error),V2=Date.now(),U2=function(e){return Object.keys(Wd).includes(e)},H2=function(e){return e===void 0&&(e=500),new Promise(function(t){return window.setTimeout(t,e)})},Yd=function(e){return L2[e]},K2=function(e,t){var n=e===qd?$2:M2;return n[t]||n.prod},Zd=function(e){var t=e.reduce(function(n,r){return n.concat(U2(r)?Wd[r]:r)},[]);return Array.from(new Set(t)).map(function(n){return{elementName:n,sdkName:Yd(n)}})},j2=function(e){return Array.from(new Set(Zd(e).map(function(t){var n=t.sdkName;return n}).filter(function(t){return Gd.includes(t)})))},Ir=function(e){return e==="payments"?"payment":e},Qd=function(e){var t=e.name,n=e.env,r=n===void 0?Ee.prod:n,o=K2(t,r),i=F2[t];if(!i)throw ln("[components-sdk] Element static resource not found",{sdkName:t}),new B2("Element ".concat(t," static resource URL is invalid."));return"".concat(o).concat(i,"?ts=").concat(V2)},z2=function(){return Gd.reduce(function(e,t){var n;return ct(ct({},e),(n={},n[t]=window._AirwallexSDKs.__controller__.internalSDKs[t],n))},{})},q2=function(e){return O2[e]||[]},Ht=function(){return Math.floor(performance.now())},W2=function(e){var t=document.createElement("script");t.src=e,t.type="module";var n=document.head||document.body;return n.appendChild(t),t},G2=3,Y2=function(e){return Dr(void 0,void 0,void 0,function(){var t,n;return Ar(this,function(r){switch(r.label){case 0:if(typeof window>"u")throw new Error("Please load script in browser environment");t=0,n=function(){return Dr(void 0,void 0,void 0,function(){var o,i,a;return Ar(this,function(s){return o=Ht(),t>0&&e.includes("?ts=")&&(i=new URL(e,window.location.href),i.searchParams.set("ts","".concat(Date.now())),e=i.toString()),a=W2(e),[2,new Promise(function(l,c){a.addEventListener("load",function(){var d=Ht();Nr("[components-sdk] SDK script loaded",{scriptUrl:e,start:o,latency:d-o,end:d,retryCount:t}),l(!0)}),a.addEventListener("error",function(d){a.remove(),console.error(d);var p=Ht();ln("[components-sdk] Failed to load script",{scriptUrl:e,error:d,start:o,latency:p-o,end:p,retryCount:t}),c(new jd("Failed to load Airwallex SDK scripts: ".concat(e)))})})]})})},r.label=1;case 1:if(!(t<G2))return[3,7];r.label=2;case 2:return r.trys.push([2,4,,6]),[4,n()];case 3:return[2,r.sent()];case 4:return r.sent(),t++,[4,H2()];case 5:return r.sent(),[3,6];case 6:return[3,1];case 7:throw ln("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:t}),new jd("Failed to load Airwallex SDK scripts: ".concat(e))}})})},Jd=(function(e){Xa(t,e);function t(n){var r=e.call(this,n)||this;return r.code="INSTANCE_NOT_FOUND_ERROR",r}return t})(Error),Ho,Xd=new Map,es=function(e){var t=e.env,n=e.scriptName,r=Qd({name:n,env:t}),o=Xd.get(n);if(o)return o;var i=Y2(r);return Xd.set(n,i),i},ts=function(e){var t=e.env,n=e.scriptName;return Dr(void 0,void 0,void 0,function(){var r;return Ar(this,function(o){switch(o.label){case 0:return r=q2(n),r.length>0?[4,Promise.all(r.map(function(i){return es({env:t,scriptName:i})}))]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2,es({env:t,scriptName:n})]}})})},eu=function(e){return Dr(void 0,void 0,void 0,function(){return Ar(this,function(t){if(typeof window>"u")throw new Error("Please call the `init()` function in a browser environment.");return I2(e.env,e.clientId),Nr("[components-sdk] SDK init start",{options:Uo(e),start:Ht()}),Ho=new Promise(function(n,r){var o,i=ct(ct({},e),{env:e.env&&Ee[e.env]?e.env:Ee.prod});window.AirwallexComponentsSDK.__env__=i.env;var a=es({env:i.env,scriptName:zd}).then(function(){return window._AirwallexSDKs.__controller__.init(i)}),s=(o=e.enabledElements)!==null&&o!==void 0?o:[],l=j2(s),c=l.map(function(h){return ts({env:i.env,scriptName:h}).then(function(){return a}).then(function(){var m=window._AirwallexSDKs[Ir(h)];if(!m)throw ln("[components-sdk] SDK instance not found",{functionsNamespace:h,windowSDKInstanceName:Ir(h)}),new Jd("SDK instance not found");return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:h,instance:m})})}),d=Zd(s),p=d.map(function(h){var m=h.sdkName,f=h.elementName;return ts({scriptName:m,env:i.env}).then(function(){return a}).then(function(){var y=window._AirwallexSDKs[Ir(m)];if(!y)throw ln("[components-sdk] SDK instance not found",{sdkName:m,windowSDKInstanceName:Ir(m)}),new Jd("SDK instance not found");return window._AirwallexSDKs.__controller__.registerElement({sdkName:m,elementName:f,instance:y})})});Promise.all(Kd(Kd([a],c,!0),p)).then(function(){Nr("[components-sdk] SDK initialized",{options:Uo(e),start:Ht()}),n(z2())}).catch(function(h){h.code||ln("[components-sdk] Unexpected errors when init",{error:h}),r(h)})}),[2,Ho]})})},Rr=function(e,t){return Dr(void 0,void 0,void 0,function(){var n,r,o,i,a;return Ar(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Element type is missing. Please specify a valid element.");if(Nr("[components-sdk] SDK createElement start",{elementName:e,options:Uo(t),timestamp:Ht()}),!Ho)throw R2("[components-sdk] Did not call init before createElement"),new Error("Please initialize the Element before creating it.");return[4,Ho];case 1:if(s.sent(),n=Yd(e),!n)throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."));r=Ht(),s.label=2;case 2:return s.trys.push([2,6,,7]),[4,ts({scriptName:n,env:window.AirwallexComponentsSDK.__env__||Ee.prod})];case 3:return s.sent(),[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:e,instance:window._AirwallexSDKs[Ir(n)]})];case 4:return s.sent(),[4,window._AirwallexSDKs.__controller__.createElement(e,t)];case 5:return o=s.sent(),i=Ht(),Nr("[components-sdk] SDK createElement being called",{elementName:e,options:Uo(t),start:r,latency:i-r,end:i}),[3,7];case 6:if(a=s.sent(),!a.code)ln("[components-sdk] Unexpected errors when createElement",{error:a});else throw a;return[3,7];case 7:return[2,o]}})})},Z2=[zd,qd],tu=function(){Z2.forEach(function(e){var t=Qd({name:e,env:Ee.prod}),n=document.createElement("link");n.href=t,n.rel="modulepreload",n.as="script";var r=document.head||document.body;r.appendChild(n)})},Q2=typeof document>"u"||typeof window>"u";Q2||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",tu):tu()),typeof window<"u"&&(window.AirwallexComponentsSDK||Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:!1},_AirwallexSDKs:{value:{},writable:!1}}),window.AirwallexComponentsSDK.init=eu,window.AirwallexComponentsSDK.createElement=Rr);const ns={base:{fontSize:"14px",color:"#09090b","::placeholder":{color:"#a1a1aa"}}},J2={visa:"visa",mastercard:"mastercard",amex:"amex",jcb:"jcb",cup:"unionpay"};let rs=null;function nu(e){return rs||(rs=eu({env:Nu(e),enabledElements:["payments"],locale:"en"}).then(()=>{})),rs}async function X2(e){await nu(e.apiBase);const t=Mu("fy-awx-auth"),n=k("div",{class:"h-10 rounded-lg border border-zinc-200 px-3"}),r=k("div",{class:"h-10 rounded-lg border border-zinc-200 px-3"}),o=k("div",{class:"h-10 rounded-lg border border-zinc-200 px-3"}),i=k("form",{class:"mt-4 flex flex-col gap-3"},[os("Card number",n),k("div",{class:"grid grid-cols-2 gap-3"},[os("Expiry",r),os("CVC",o)]),k("div",{id:t})]),a=ei(`Pay ${fn(e.amount,e.currency)}`);i.append(a),e.container.append(i);const s={id:e.intentId,client_secret:e.clientSecret,currency:e.currency},l=e.allowedBrands?.map(m=>J2[m.toLowerCase()]).filter(Boolean),[c,d,p]=await Promise.all([Rr("cardNumber",{intent:s,style:ns,authFormContainer:t,allowedCardNetworks:l?.length?l:void 0,autoCapture:e.autoCapture}),Rr("expiry",{style:ns}),Rr("cvc",{style:ns})]);if(!c||!d||!p)throw new Error("Could not create card input fields.");c.mount(n),d.mount(r),p.mount(o);const h=async m=>{m.preventDefault(),a.disabled=!0;try{await c.confirm({intent_id:e.intentId,client_secret:e.clientSecret}),e.onSuccess()}catch(f){e.onError(f instanceof Error?f.message:"Card payment failed"),a.disabled=!1}};return i.addEventListener("submit",h),a.addEventListener("click",h),()=>{i.removeEventListener("submit",h),c.destroy?.(),d.destroy?.(),p.destroy?.()}}async function e4(e){if(e.wallet==="applepay"&&!Zo())return e.container.append(Oe("Apple Pay is not supported in this browser.")),()=>{};if(e.wallet==="googlepay"&&!Qo())return e.container.append(Oe("Google Pay is not supported in this browser.")),()=>{};await nu(e.apiBase);const t=k("div",{class:"mt-4 min-h-[48px]"}),n=Hn(`Loading ${e.wallet==="applepay"?"Apple Pay":"Google Pay"}…`);e.container.append(n,t);const r=Fr(e.currency),o={value:e.amount,currency:e.currency},i=e.wallet==="applepay"?"applePayButton":"googlePayButton",a=await Rr(i,{intent_id:e.intentId,client_secret:e.clientSecret,countryCode:r,amount:o,autoCapture:e.autoCapture,buttonType:"pay",buttonColor:"black"});if(!a)return n.remove(),e.container.append(Oe("Could not create wallet button.")),()=>{};a.mount(t),n.remove();const s=()=>e.onSuccess(),l=c=>{e.onError(c?.detail?.message||"Wallet payment failed.")};return a.on("success",s),a.on("error",l),()=>{a.destroy?.()}}function os(e,t){return k("label",{class:"flex flex-col gap-1 text-sm font-medium text-zinc-700"},[k("span",{text:e}),t])}function t4(e,t,n){const r=k("p",{class:"mt-2 text-sm text-zinc-500"});e.append(r);function o(){const a=t-Date.now();if(a<=0){r.textContent="This QR code has expired.",n();return}const s=Math.floor(a/1e3),l=Math.floor(s/3600),c=Math.floor(s%3600/60),d=s%60,p=h=>String(h).padStart(2,"0");r.textContent=l>0?`Expires in ${l}:${p(c)}:${p(d)}`:`Expires in ${p(c)}:${p(d)}`}o();const i=window.setInterval(o,1e3);return()=>window.clearInterval(i)}const n4=3e3,r4=7200*1e3,o4=600*1e3,i4={wechatpay:"Open the WeChat app on your phone, scan this QR code, and complete the payment.",paynow:"Open your banking or PayNow app, scan this QR code, and complete the payment.",alipaycn:"Open the Alipay app on your phone, scan this QR code, and complete the payment.",alipayhk:"Open the AlipayHK app on your phone, scan this QR code, and complete the payment.",alipay:"Open the Alipay app on your phone and complete the payment."};function Ko(e){return e.client}function is(e,t){return e.apiVersion==="v2"&&(t==="card"||$s(t))}async function ru(e,t,n){return Ko(e).createPayment({amount:t.amount,currency:t.currency,orderId:t.orderId,items:t.items,returnUrl:t.returnUrl,autoCapture:t.autoCapture,metadata:t.metadata,existingOrderId:t.existingOrderId,existingPaymentId:t.existingPaymentId,paymentMethod:n})}function ou(e){const t=e.result.provider||e.result.payment.platform,n=e.result.paymentData||e.result.paymentIntent||{},r=e.result.paymentIntent||n,o=r?.next_action,i=e.result.paymentData?.action,a=o?.qrcode||i?.qrCodeData,s=o?.type==="redirect_iframe"||i?.type==="redirect_iframe",l=o?.type==="redirect"?o.url:i?.type==="redirect"||i?.type==="redirect_iframe"?typeof i.url=="string"?i.url:void 0:!a&&!s?o?.url:void 0,c=Br(l),d=e.method.type,p=[];if(d==="card"){if(Cd(t)){const f=k("div",{class:"mt-4"});return e.host.append(f),vd({container:f,client:Ko(e.ctx),paymentId:String(e.result.payment.id),methodType:d,paymentData:n,amount:e.options.amount,currency:e.options.currency,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError}).then(y=>p.push(y)).catch(y=>{e.onError(y instanceof Error?y.message:"Failed to load card form")}),()=>p.forEach(y=>y())}const h=r?.id,m=r?.client_secret;return!h||!m?(e.host.append(Oe("Card payment is unavailable — missing payment intent credentials.")),()=>{}):(X2({container:e.host,apiBase:e.ctx.apiBase,intentId:h,clientSecret:m,currency:e.options.currency,amount:e.options.amount,autoCapture:e.options.autoCapture,allowedBrands:e.method.brands,onSuccess:e.onSuccess,onError:e.onError}).then(f=>p.push(f)).catch(f=>{e.onError(f instanceof Error?f.message:"Failed to load card form")}),()=>p.forEach(f=>f()))}if($s(d)){if(Cd(t)){const f=k("div",{class:"mt-4"});return e.host.append(f),vd({container:f,client:Ko(e.ctx),paymentId:String(e.result.payment.id),methodType:d,paymentData:n,amount:e.options.amount,currency:e.options.currency,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError}).then(y=>p.push(y)).catch(y=>{e.onError(y instanceof Error?y.message:"Failed to load wallet")}),()=>p.forEach(y=>y())}const h=r?.id,m=r?.client_secret;return!h||!m?(e.host.append(Oe(`${e.method.name} is unavailable — missing payment intent credentials.`)),()=>{}):(e4({container:e.host,apiBase:e.ctx.apiBase,wallet:d,intentId:h,clientSecret:m,currency:e.options.currency,amount:e.options.amount,autoCapture:e.options.autoCapture,allowedBrands:e.method.brands,onSuccess:e.onSuccess,onError:e.onError}).then(f=>p.push(f)).catch(f=>{e.onError(f instanceof Error?f.message:"Failed to load wallet")}),()=>p.forEach(f=>f()))}if(a&&(Sh(d)||Ms(d)))return a4({host:e.host,ctx:e.ctx,qrcode:a,method:e.method,paymentId:String(e.result.payment.id),onSuccess:e.onSuccess,onError:e.onError});if(Ms(d)&&(c||s)){if(s&&c)return Fn({url:c,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError});if(c)return e.host.append(k("p",{class:"mt-4 text-sm text-zinc-600",text:"Redirecting…"})),window.location.assign(c),()=>{}}if(c)return e.host.append(k("p",{class:"mt-4 text-sm text-zinc-600",text:"Redirecting…"})),window.location.assign(c),()=>{};if(s&&o?.url){const h=Br(o.url);if(h)return Fn({url:h,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError})}return e.host.append(Oe("This payment method could not be displayed.")),()=>{}}function a4(e){const t=e.method.type==="wechatpay"?r4:o4,n=Date.now()+t,r=i4[e.method.type.toLowerCase()]??"Scan this QR code with your mobile app to complete the payment.",o=k("div",{class:"mt-4 flex flex-col items-center"});o.append(Xo(e.method.type,e.method.name)),o.append(k("p",{class:"mt-3 text-sm text-zinc-600 text-center",text:r}));let i=!1,a=!1;const s=k("canvas",{class:"mt-4 rounded-lg border border-zinc-200 bg-white"});try{s4(s,e.qrcode),o.append(s)}catch{return o.append(Oe("Could not display QR code.")),e.host.append(o),()=>{}}const l=k("div");o.append(l);const c=t4(l,n,()=>{i=!0,e.onError("This QR code has expired.")});e.host.append(o);const d=Ko(e.ctx),p=window.setInterval(async()=>{if(i||a)return;const h=await d.getPayment(e.paymentId);if(!h)return;const m=Ch(h);m==="success"?(a=!0,e.onSuccess()):m==="failed"&&(a=!0,e.onError(h.paymentAttempt?.failure_details?.message||_h(h)))},n4);return()=>{c(),window.clearInterval(p)}}function s4(e,t){const n=fh(t,"raw",{ecc:"high",scale:1}),r=e.getContext("2d",{alpha:!1});if(!r)throw new Error("canvas");const o=window.devicePixelRatio||1,i=240;e.width=i*o,e.height=i*o,e.style.width=`${i}px`,e.style.height=`${i}px`,r.scale(o,o),r.fillStyle="#fff",r.fillRect(0,0,i,i);const a=Math.floor(i/n.length),s=Math.floor((i-n.length*a)/2);r.fillStyle="#111";for(let l=0;l<n.length;l++)for(let c=0;c<n[l].length;c++)n[l]?.[c]&&r.fillRect(s+c*a,s+l*a,a,a)}function iu(e){const t=k("div",{class:"mt-4"});e.host.append(t);const n=[];return Oy({container:t,ctx:e.ctx,method:e.method,options:e.options,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError}).then(r=>n.push(r)).catch(r=>{e.onError(r instanceof Error?r.message:"Failed to load payment form")}),()=>n.forEach(r=>r())}class l4 extends Vr{constructor(){super(...arguments),this.methods=[],this.selected=null,this.step="list",this.stopPay=null,this.loading=!1,this.loadingMethods=!1,this.payResult=null}onUnmount(){this.stopPay?.(),this.stopPay=null,super.onUnmount()}render(){if(this.root){if(this.step==="pay"&&this.selected){this.drawPay(this.payResult??void 0);return}if(this.methods.length){this.drawList();return}this.loadingMethods||(this.loadingMethods=!0,this.root.replaceChildren(Hn("Loading payment methods…")),this.ctx.client.getPaymentMethods({amount:this.options.amount,currency:this.options.currency}).then(t=>{this.methods=Jo(ms(t,this.options.allowedPaymentMethods)),this.selected=this.methods[0]??null,this.drawList()}).catch(t=>{this.root&&this.root.replaceChildren(Oe(t instanceof Error?t.message:"Could not load payment methods"))}).finally(()=>{this.loadingMethods=!1}))}}drawList(){if(!this.root)return;if(!this.methods.length){this.root.replaceChildren(Oe("No payment methods are available for this outlet."));return}const t=k("div",{class:"flex flex-col gap-2",role:"radiogroup"});for(const o of this.methods){const i=this.selected?.type===o.type,a=k("button",{type:"button",role:"radio","aria-checked":i?"true":"false",class:Or("flex w-full items-start gap-3 rounded-xl border p-3 text-left transition",i?"border-blue-600 bg-blue-50":"border-zinc-200 hover:border-zinc-300")});a.append(Xo(o.type,o.name));const s=k("div",{class:"min-w-0 flex-1"});s.append(k("p",{class:"text-sm font-medium",text:o.name}));const l=gs(o.brands);l&&s.append(l),a.append(s),a.addEventListener("click",()=>{this.selected=o,this.emit("select",o),this.drawList()}),t.append(a)}const n=ei(this.loading?"Continuing…":"Continue",{disabled:this.loading||!this.selected,onClick:()=>{this.startPay()}}),r=k("div",{class:"flex flex-col gap-4"},[k("h3",{class:"text-base font-semibold",text:"Select a payment method"}),k("p",{class:"text-sm text-zinc-500",text:`Amount due ${fn(this.options.amount,this.options.currency)}`}),t,n]);this.showWordmark&&r.append(k("div",{class:"mt-2 flex justify-center"},[yn()])),this.root.replaceChildren(r)}async startPay(){if(!this.selected||this.loading)return;if(is(this.ctx,this.selected.type)){this.step="pay",this.payResult=null,this.drawPay();return}this.loading=!0,this.drawList();const t=await ru(this.ctx,this.options,this.selected);if(this.loading=!1,!t.ok){this.drawList(),this.root?.append(Oe(t.message)),this.emit("error",{message:t.message});return}this.step="pay",this.payResult=t.data,this.drawPay(t.data)}drawPay(t){if(!this.root||!this.selected)return;this.stopPay?.();const n=ei("← Change payment method",{variant:"ghost",onClick:()=>{this.stopPay?.(),this.stopPay=null,this.payResult=null,this.step="list",this.drawList()}}),r=k("div");if(this.root.replaceChildren(n,k("h3",{class:"mt-2 text-base font-semibold",text:`Pay with ${this.selected.name}`}),k("p",{class:"mt-1 text-sm text-zinc-500",text:`Paying ${fn(this.options.amount,this.options.currency)}`}),r),this.showWordmark&&this.root.append(k("div",{class:"mt-6 flex justify-center"},[yn()])),is(this.ctx,this.selected.type)&&!t){this.stopPay=iu({host:r,ctx:this.ctx,method:this.selected,options:this.options,onSuccess:o=>this.emit("success",{paymentId:o,orderId:this.options.orderId,resultCode:"Authorised",status:"success"}),onError:o=>this.emit("error",{message:o})});return}if(!t){r.append(Hn("Starting payment…")),this.startPay();return}this.stopPay=ou({host:r,ctx:this.ctx,method:this.selected,options:this.options,result:t,onSuccess:()=>this.emit("success",{paymentId:String(t.payment.id),orderId:this.options.orderId,resultCode:"Authorised",status:"success"}),onError:o=>this.emit("error",{message:o})})}}class c4 extends Vr{constructor(){super(...arguments),this.selected=null,this.methods=[],this.loadingMethods=!1}render(){if(this.root){if(this.methods.length){this.drawList(this.methods);return}this.loadingMethods||(this.loadingMethods=!0,this.root.replaceChildren(Hn("Loading payment methods…")),this.ctx.client.getPaymentMethods({amount:this.options.amount,currency:this.options.currency}).then(t=>{this.methods=Jo(ms(t)),this.drawList(this.methods)}).catch(t=>{this.root&&this.root.replaceChildren(Oe(t instanceof Error?t.message:"Could not load payment methods"))}).finally(()=>{this.loadingMethods=!1}))}}drawList(t){if(!this.root)return;if(!t.length){this.root.replaceChildren(Oe("No payment methods are available for this outlet."));return}(!this.selected||!t.some(r=>r.type===this.selected?.type))&&(this.selected=t[0]);const n=k("div",{class:"flex flex-col gap-2",role:"radiogroup"});for(const r of t){const o=this.selected?.type===r.type,i=k("button",{type:"button",role:"radio","aria-checked":o?"true":"false",class:Or("flex w-full items-start gap-3 rounded-xl border p-3 text-left transition",o?"border-blue-600 bg-blue-50":"border-zinc-200 hover:border-zinc-300")});i.append(Xo(r.type,r.name));const a=k("div",{class:"min-w-0 flex-1"});a.append(k("p",{class:"text-sm font-medium",text:r.name}));const s=gs(r.brands);s&&a.append(s),i.append(a),i.addEventListener("click",()=>{this.selected=r,this.emit("select",r),this.emit("change",{paymentMethod:r}),this.drawList(t)}),n.append(i)}this.root.replaceChildren(n)}}class yt extends Vr{constructor(){super(...arguments),this.stopPay=null}withForcedType(t){return this.lockedType=t,this}onUnmount(){this.stopPay?.(),this.stopPay=null,super.onUnmount()}render(){if(!this.root)return;this.stopPay?.();const t=this.options,n=this.resolveMethod(t);if(!n){this.root.replaceChildren(Oe("A paymentMethod is required for this element."));return}if(this.root.replaceChildren(k("div",{class:"flex flex-col gap-2"},[k("h3",{class:"text-base font-semibold",text:`Pay with ${n.name}`}),k("p",{class:"text-sm text-zinc-500",text:`Paying ${fn(t.amount,t.currency)}`}),Hn("Starting payment…")])),is(this.ctx,n.type)){const r=k("div");this.root.replaceChildren(k("h3",{class:"text-base font-semibold",text:`Pay with ${n.name}`}),k("p",{class:"mt-1 text-sm text-zinc-500",text:`Paying ${fn(t.amount,t.currency)}`}),r),this.showWordmark&&this.root.append(k("div",{class:"mt-6 flex justify-center"},[yn()])),this.stopPay=iu({host:r,ctx:this.ctx,method:n,options:t,onSuccess:o=>this.emitSuccess(o,t.orderId),onError:o=>this.emit("error",{message:o})});return}ru(this.ctx,t,n).then(r=>{if(!this.root)return;if(!r.ok){this.root.replaceChildren(Oe(r.message)),this.emit("error",{message:r.message});return}const o=k("div");this.root.replaceChildren(k("h3",{class:"text-base font-semibold",text:`Pay with ${n.name}`}),k("p",{class:"mt-1 text-sm text-zinc-500",text:`Paying ${fn(t.amount,t.currency)}`}),o),this.showWordmark&&this.root.append(k("div",{class:"mt-6 flex justify-center"},[yn()])),this.stopPay=ou({host:o,ctx:this.ctx,method:n,options:t,result:r.data,onSuccess:()=>this.emitSuccess(r.data.payment.id,t.orderId),onError:i=>this.emit("error",{message:i})})})}resolveMethod(t){return this.lockedType?t.paymentMethod??{type:this.lockedType,name:d4(this.lockedType)}:t.paymentMethod??null}emitSuccess(t,n){const r={paymentId:t,orderId:n,resultCode:"Authorised",status:"success"};this.emit("success",r)}}function d4(e){return{card:"Credit Card",applepay:"Apple Pay",googlepay:"Google Pay",paynow:"PayNow",wechatpay:"WeChat Pay",alipay:"Alipay",alipaycn:"Alipay CN",alipayhk:"Alipay HK"}[e]??e}class u4 extends yt{resolveMethod(t){return t.paymentMethod??{type:"card",name:"Credit Card"}}}class h4 extends yt{}class p4 extends yt{}class m4 extends yt{resolveMethod(t){const n=t.paymentMethod;return n||{type:"alipay",name:"Alipay"}}}class f4 extends yt{}class y4 extends yt{constructor(...t){super(...t),this.withForcedType("paynow")}}class g4 extends yt{constructor(...t){super(...t),this.withForcedType("wechatpay")}}class b4 extends yt{constructor(...t){super(...t),this.withForcedType("applepay")}}class v4 extends yt{constructor(...t){super(...t),this.withForcedType("googlepay")}}class C4 extends yt{constructor(...t){super(...t),this.withForcedType("alipaycn")}}class _4 extends yt{constructor(...t){super(...t),this.withForcedType("alipayhk")}}class w4 extends Vr{render(){if(!this.root)return;const t=this.options.status??"pending",o=k("div",{class:"flex flex-col items-center gap-2 py-8 text-center"},[k("h3",{class:`text-lg font-semibold ${t==="success"?"text-emerald-600":t==="failed"?"text-red-600":"text-zinc-600"}`,text:t==="success"?"Payment successful":t==="failed"?"Payment failed":"Payment pending"}),this.options.message?k("p",{class:"text-sm text-zinc-500",text:this.options.message}):null,this.options.paymentId?k("p",{class:"text-xs text-zinc-400",text:`Payment ${this.options.paymentId}`}):null]);this.showWordmark&&o.append(k("div",{class:"mt-4"},[yn()])),this.root.replaceChildren(o)}}function S4(e,t,n){switch(e){case"checkout":return new l4(e,t,n);case"payment-method-list":return new c4(e,t,n);case"card":return new u4(e,t,n);case"qr":return new h4(e,t,n);case"wallet":return new p4(e,t,n);case"alipay":return new m4(e,t,n);case"redirect":return new f4(e,t,n);case"payment-result":return new w4(e,t,n);case"paynow":return new y4(e,t,n);case"wechatpay":return new g4(e,t,n);case"applepay":return new b4(e,t,n);case"googlepay":return new v4(e,t,n);case"alipaycn":return new C4(e,t,n);case"alipayhk":return new _4(e,t,n);default:throw new Error(`[@finyxpay/ui] Unknown element type: "${e}"`)}}function au(e){return e==="v2"?"v2":"v4"}class as{constructor(t){if(this.methodsCache=null,!t.apiKey?.trim())throw new Error("[@finyxpay/ui] A public API key is required.");this.apiKey=t.apiKey.trim(),this.apiBase=Yo(this.apiKey,t.apiBase),this.locale=t.locale??"en",this.appearance={showWordmark:!0,...t.appearance},this.apiVersion=au(t.apiVersion),this.client=Du(this.apiKey,this.apiBase,this.apiVersion),this.apiVersion==="v4"&&this.client.getPaymentMethods().then(n=>{this.methodsCache=n}).catch(()=>{})}context(){return{apiKey:this.apiKey,apiBase:this.apiBase,locale:this.locale,appearance:this.appearance,apiVersion:this.apiVersion,client:this.client}}async createElement(t,n){return S4(t,n,this.context())}async getPaymentMethods(t){if(this.methodsCache)return this.methodsCache;const n=await this.client.getPaymentMethods(t);return this.methodsCache=n,n}}let Kt=null;async function su(e){const t=au(e.apiVersion);return Kt&&Kt.apiKey===e.apiKey.trim()&&Kt.apiVersion===t||(Kt=new as(e)),Kt}function k4(){if(!Kt)throw new Error("[@finyxpay/ui] Call init({ apiKey }) before createElement.");return Kt}async function lu(e,t){return k4().createElement(e,t)}const E4={init:su,createElement:lu,Finyx:as,resolveApiBase:Yo,resolveElementType:Rs};typeof window<"u"&&(window.Finyx=E4),ze.Finyx=as,ze.createElement=lu,ze.filterPaymentMethodsByBrowserSupport=Jo,ze.init=su,ze.isApplePaySupported=Zo,ze.isGooglePaySupported=Qo,ze.resolveApiBase=Yo,ze.resolveElementType=Rs,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})}));
141
+ `).concat(Ln(e.error||""));Vo.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:t}})},$d=function(e){var t=e&&Ln(e.reason);Vo.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:t}})},Md=function(e){var t=e?.target||e?.srcElement;if(t){var n=t?.src||t?.href,r=t.tagName,o="unknown";if(typeof n=="string"&&r){if(window.location.href.indexOf(n)>-1)return;if(/\.js$/.test(n))o="script";else if(/\.css$/.test(n))o="css";else switch(r.toLowerCase()){case"script":o="script";break;case"link":o="css";break;case"img":o="image";break;case"audio":case"video":o="media";break;default:return}Vo.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:o,error:"".concat(r," load fail: ").concat(n)}})}}},h2=new Er({name:"errorDetectionPlugin",setUp:function(e){Vo=e,window.addEventListener("error",Rd),window.addEventListener("unhandledrejection",$d),window.document.addEventListener("error",Md,!0)},destroy:function(){window.removeEventListener("unhandledrejection",$d),window.document.removeEventListener("error",Md,!0),window.removeEventListener("error",Rd)}}),p2=["img","css","script","link","audio","video","iframe"],Ya="resource",m2=function(e){var t=e.name;return{url:i2(t),method:"get",duration:Number(e.duration.toFixed(2)),type:"static",isHttps:s2(t),urlQuery:a2(t),domainLookup:Td(e.domainLookupEnd-e.domainLookupStart),connectTime:Td(e.connectEnd-e.connectStart)}},Za=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];p2.indexOf(o.initiatorType)!==-1&&l2(o.name,t)&&t.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:m2(o)}})}},Qa,xr,f2=new Er({name:"assetsSpeedPlugin",setUp:function(e){if(o2()){var t=0;window.performance.onresourcetimingbufferfull=function(){t=0,window.performance.clearResourceTimings()},typeof window.PerformanceObserver=="function"?(Za(window.performance.getEntriesByType(Ya),e),xr=new window.PerformanceObserver(function(n){Za(n.getEntries(),e)}),xr.observe({entryTypes:[Ya]})):Qa=setInterval(function(){var n=window.performance.getEntriesByType(Ya),r=n.slice(t);t=n.length,Za(r,e)},3e3)}},destroy:function(){xr?.disconnect(),Qa&&clearInterval(Qa)}}),Pr,y2=new Er({name:"onPageChangePlugin",setUp:(function(){var e=_r(function(t){var n,r,o,i,a;return Sr(this,function(s){return r=(n=location)===null||n===void 0?void 0:n.href,o=document.querySelector("body"),i=function(l){var c=l.prevHref,d,p,h,m,f;t.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:c,href:((d=location)===null||d===void 0?void 0:d.href)||"",hostname:(p=location)===null||p===void 0?void 0:p.hostname,pathName:(h=location)===null||h===void 0?void 0:h.pathname,protocol:(m=location)===null||m===void 0?void 0:m.protocol,search:(f=location)===null||f===void 0?void 0:f.search}})},i({prevHref:""}),Pr=new MutationObserver(function(){if(location.href!==r){var l=r;r=location.href,i({prevHref:l})}}),a={subtree:!0,childList:!0},Pr.observe(o||document,a),[2]})});return function(t){return e.apply(this,arguments)}})(),destroy:function(){Pr?.disconnect()}}),Tr,g2=new Er({name:"onPageRetentionPlugin",setUp:(function(){var e=_r(function(t){var n,r,o,i,a,s,l;return Sr(this,function(c){return typeof document.visibilityState>"u"?[2]:(r=(n=location)===null||n===void 0?void 0:n.href,o=document.querySelector("body"),a=function(){i=Date.now()},a(),document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"?s({href:location.href,leftReason:"visibilityChange"}):document.visibilityState==="visible"&&a()}),window.addEventListener("beforeunload",function(){s({href:location.href,sendImmediate:!0,leftReason:"pageClose"})}),s=function(d){var p=d.href,h=d.sendImmediate,m=d.leftReason;if(i){var f=Date.now()-i;if(f!==0){i=void 0;var y={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:p,duration:f,leftReason:m}};if(h){t.ImmediatePipeline(y);return}t.normalLogPipeLine(y)}}},Tr=new MutationObserver(function(){if(location.href!==r){var d=r;r=location.href,s({href:d,leftReason:"nextPage"}),a()}}),l={subtree:!0,childList:!0},Tr.observe(o||document,l),[2])})});return function(t){return e.apply(this,arguments)}})(),destroy:function(){Tr?.disconnect()}}),Fd=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)},Ld=function(e,t){var n=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/],r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];return r.some(function(o){return o.test(e)})?!1:Ga(e,t||n)},b2=function(e){var t=e.startTime,n=e.endTime,r=e.entries;if(r.length!==0){if(r.length===1)return r[0];var o=r.filter(function(i){return i.startTime>=t&&n&&i.responseEnd<=n}).sort(function(i,a){return i.startTime-a.startTime});return o?.[0]}},Od=function(e){return Math.round(e*100)/100},v2=function(e){var t=e.startTime,n=e.duration,r=e.responseStart,o=e.connectEnd,i=e.connectStart,a=e.domainLookupEnd,s=e.domainLookupStart,l=e.requestStart,c=e.secureConnectionStart,d=e.redirectEnd,p=e.redirectStart,h=e.responseStatus,m=e.responseEnd,f=e.encodedBodySize,y=e.decodedBodySize,b=e.transferSize,v=e.deliveryType,C=e.initiatorType;return{startTime:Od(t),totalDuration:Od(n),timeToFirstByte:On(r,t),tcpDuration:On(o,i),dnsDuration:On(a,s),tlsDuration:On(l,c),redirectDuration:On(d,p),responseDuration:On(m,r),encodeResponseSize:f,decodeResponseSize:y,transferSize:b,deliveryType:v,statusCode:h,initiatorType:C}},Bd=function(e,t){var n=e.url,r=e.method,o=e.errorType,i=e.errorDetail,a=b2(e),s=new URL(n,window.location.href),l=s.href,c=s.protocol,d=a?v2(a):{},p={severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:ft(Lo(ft({httpUrl:l,method:r,scheme:c},o&&{errorType:o},i&&{errorDetail:i},d),{statusCode:d?.statusCode||e?.responseStatus,startTime:d?.startTime||e?.startTime,initiatorType:d?.initiatorType||e?.initiatorType}),t)};return p},Vd=function(e){return e&&(typeof e>"u"?"undefined":wr(e))==="object"&&"errors"in e&&Array.isArray(e.errors)&&e.errors.every(function(t){return t&&(typeof t>"u"?"undefined":wr(t))==="object"&&"message"in t})},lt="awx_airtracker_api_performance_queue",Ud="awx_airtracker_api_performance_plugin_loaded",C2=300,_2=1e4,Ke=typeof window<"u"?window:typeof global<"u"?global:{};Ke[lt]=Ke[lt]||[];var Bn=function(e,t,n){setTimeout(function(){var r=Bd(e,n);t.observerPipeline(r),Ke[lt]=Ke[lt].filter(function(o){return o.id!==e.id})},C2)},Hd=function(e,t){setTimeout(function(){var n=Ke[lt].find(function(o){return o.id===e});if(n){var r=Bd(n,{exceptionType:"timeout-without-response"});t.observerPipeline(r),Ke[lt]=Ke[lt].filter(function(o){return o.id!==e})}},_2)},w2=function(e){var t=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(o,i,a,s,l){try{var c,d=Fd();this.__requestId=d;var p=Ut(i,URL)?i.href:new URL(i,window.location.href).href;if(!Ld(p,(c=e.config)===null||c===void 0?void 0:c.enableRecordAPIPerformanceWhitelist))return t.call(this,o,i,a??!0,s,l);var h={id:d,startTime:performance.now(),method:o,url:p,entries:[],initiatorType:"xmlhttprequest"};return Ke[lt].push(h),Hd(d,e),t.call(this,o,i,a??!0,s,l)}catch(m){return e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:m}}),t.call(this,o,i,a??!0,s,l)}},XMLHttpRequest.prototype.send=function(){for(var o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];try{var l=Ke[lt].find(function(d){return d.id===o.__requestId});if(!l)return n.apply(this,a);var c=this;return this.addEventListener("loadend",_r(function(){var d,p,h,m,f,y,b;return Sr(this,function(v){switch(v.label){case 0:if(d=performance.now(),p=d-l.startTime,h=c.status,h===0)return[2];l.endTime=d,l.duration=p,l.responseStatus=h,v.label=1;case 1:return v.trys.push([1,6,,7]),c.responseType===""||c.responseType==="text"?(m=c.responseText,[3,5]):[3,2];case 2:return c.responseType!=="json"?[3,3]:(m=c.response,[3,5]);case 3:return c.responseType!=="blob"?[3,5]:(f=c.response,f?.type!=="application/json"?[3,5]:[4,f.text()]);case 4:m=v.sent(),v.label=5;case 5:return y=m&&typeof m=="string"?JSON.parse(m):m,y&&Vd(y)&&(l.errorType="graphqlError",l.errorDetail=y.errors),[3,7];case 6:return b=v.sent(),e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:l?.url,error:b}}),[3,7];case 7:return Bn(l,e),[2]}})})),this.addEventListener("error",function(){Bn(l,e,{exceptionType:"network-error"})}),this.addEventListener("abort",function(){Bn(l,e,{exceptionType:"abort-error"})}),this.addEventListener("timeout",function(){Bn(l,e,{exceptionType:"timeout-error"})}),n.apply(this,a)}catch(d){throw e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:d}}),d}}},S2=function(e){var t=window.fetch;window.fetch=_r(function(){var n,r,o,i,a,s,l,c,d,p,h,m,f,y,b,v,C=arguments;return Sr(this,function(_){switch(_.label){case 0:for(n=C.length,r=new Array(n),o=0;o<n;o++)r[o]=C[o];return s=new URL(Ut(r[0],Request)?r[0].url:String(r[0]),window.location.href).href,Ld(s,(i=e.config)===null||i===void 0?void 0:i.enableRecordAPIPerformanceWhitelist)?[3,2]:[4,t.apply(this,r)];case 1:return[2,_.sent()];case 2:return _.trys.push([2,9,,10]),c=performance.now(),d=Fd(),a={id:d,startTime:c,method:((l=Ut(r[0],Request)?r[0]:r[1])===null||l===void 0?void 0:l.method)||"GET",url:s,entries:[],initiatorType:"fetch"},Ke[lt].push(a),Hd(d,e),[4,t.apply(this,r)];case 3:p=_.sent(),h=performance.now(),a.endTime=h,a.duration=h-c,a.responseStatus=p.status,m=p.clone(),_.label=4;case 4:return _.trys.push([4,7,,8]),m.ok?[4,m.json()]:[3,6];case 5:f=_.sent(),f&&Vd(f)&&(a.errorType="graphqlError",a.errorDetail=f.errors),_.label=6;case 6:return[3,8];case 7:return y=_.sent(),e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a?.url,error:y}}),[3,8];case 8:return Bn(a,e),[2,p];case 9:throw b=_.sent(),a&&a.id&&Ke[lt].find(function(S){return S.id===a?.id})?(v="fetch-error",Ut(b,TypeError)?v="network-error":Ut(b,DOMException)&&b.name==="AbortError"&&(v="abort-error"),Bn(a,e,{exceptionType:v})):e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:b}}),b;case 10:return[2]}})})},k2=function(e){var t;if(w2(e),S2(e),!((t=window)===null||t===void 0)&&t.PerformanceObserver){var n=new window.PerformanceObserver(function(r){var o=r.getEntries();o.forEach(function(i){var a=i;if(a.initiatorType==="fetch"||a.initiatorType==="xmlhttprequest"){var s=Ke[lt].filter(function(l){return l.url===a.name});s.forEach(function(l){l.entries.push(a)})}})});n.observe({entryTypes:["resource"],buffered:!0})}else e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})},E2=new Er({name:"apiPerformancePlugin",setUp:(function(){var e=_r(function(t){var n,r;return Sr(this,function(o){return Ke[Ud]?[2]:(!((n=t.config)===null||n===void 0)&&n.enableRecordAPIPerformance&&Math.random()<(((r=t.config)===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)||0)&&(Ke[Ud]=!0,k2(t)),[2])})});return function(t){return e.apply(this,arguments)}})()}),x2="3.1.0",P2=(function(){function e(t){var n=this,r=t.config,o=t.plugins,i=o===void 0?[]:o;za(this,e),this.config=Wy,this.lifeCycle=new u2,this.plugins=[],this._commonData=Gy,this._MFECommonDataMap={},this.timeMap={},this.packedDataConvert=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d,p,h=ft({severity:s,eventName:l,currentHref:n.config.hideSearchParams?(((d=location)===null||d===void 0?void 0:d.href)||"").split("?")[0]||"":((p=location)===null||p===void 0?void 0:p.href)||""},c);return n.config.isWebappContainer&&(h.MFEName=kr(n)),h},this.normalPipelineObj=Id([Ad(this,8),d2(this),Dd(this)]),this.observerPipelineObj=Id([Ad(this,8),c2(this)]),this.immediateSendPipe=Dd(this),this.observerPipeline=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d=n.packedDataConvert({severity:s,eventName:l,extraInfo:c});return n.observerPipelineObj(d)},this.normalLogPipeLine=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d=n.packedDataConvert({severity:s,eventName:l,extraInfo:c});return n.config.disableThrottle?n.immediateSendPipe(d):n.normalPipelineObj(d)},this.ImmediatePipeline=function(a){var s=a.severity,l=a.eventName,c=a.extraInfo,d=n.packedDataConvert({severity:s,eventName:l,extraInfo:c});return n.immediateSendPipe(d)},this.plugins=Sd(i),this.setConfig(r),this.initCommonData(r),this.lifeCycle.emit(It.onInit),r.enableErrorMonitoring&&this.plugins.push(h2),(r?.assetSpeedMonitoringWhiteList&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer)&&this.plugins.push(f2),r?.enableDetectPageChange&&this.plugins.push(y2),r?.enableRecordPageRetention&&this.plugins.push(g2),r?.enableRecordAPIPerformance&&r?.enableRecordAPIPerformancePercentage&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1&&this.plugins.push(E2),this.installPlugins()}return qa(e,[{key:"installPlugins",value:function(){var n=this;this.plugins.forEach(function(r){r.patch(n)})}},{key:"commonData",get:function(){return this._commonData}},{key:"MFECommonDataMap",get:function(){return this._MFECommonDataMap}},{key:"initCommonData",value:function(n){this._commonData.sessionId=n.useSessionStorageForSessionId?Xy():Bo(),this._commonData.deviceId=e2()||sn,this._commonData.riskDeviceId=t2(),this._commonData.networkType=n2()||"unknown",this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||sn,this._commonData.appVersion=n.appVersion,this._commonData.appName=n.appName,this._commonData.sdkVersion=x2,this.lifeCycle.emit(It.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function(n){this.lifeCycle.emit(It.onCommonUpdated,this._commonData),this._commonData.env=n.env||this._commonData.env,this._commonData.appName=n.appName||this._commonData.appName,this._commonData.env=n.env||this._commonData.env,this._commonData.accountId=n.accountId||this._commonData.accountId,this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function(n){this.lifeCycle.emit(It.onCommonUpdated,this._commonData),this._commonData=ft({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function(n){var r=this;this.lifeCycle.emit(It.onCommonUpdated,this._commonData),setTimeout(function(){n.forEach(function(o){delete r._commonData[o]})},1e3)}},{key:"addToMFECommonData",value:function(n){var r=n.MFEName,o=n.MFECommonData,i;this.config.isWebappContainer&&(!r||!o||(this._MFECommonDataMap=Lo(ft({},this._MFECommonDataMap||{}),Wa({},r,ft({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[r])||{},o)))))}},{key:"setConfig",value:function(n){var r=this;if(!this.config.isWebappContainer){var o=function(i,a){r.config[i]=a};Object.entries(n).forEach(function(i){var a=wd(i,2),s=a[0],l=a[1];(typeof l>"u"?"undefined":wr(l))!==void 0&&o(s,l)}),this.lifeCycle.emit(It.onConfigInit,this.config),this.updateCommonDataBasedOnConfig(n)}}},{key:"verbose",value:function(n,r){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:r})}},{key:"httpLog",value:function(n,r){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:r})}},{key:"info",value:function(n,r){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:r})}},{key:"warn",value:function(n,r){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:r})}},{key:"error",value:function(n,r){console.error("error",n),this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:r})}},{key:"businessLog",value:function(n,r){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:Lo(ft({},r),{isBusinessLog:!0})})}},{key:"reportDuration",value:function(n,r,o){if(typeof n!="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof r!="number"){console.warn("reportDuration: duration (second param) must be number");return}if(r<0||r>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:ft({duration:r},o)})}},{key:"getTimerKey",value:function(n){var r=kr(this);return this.config.isWebappContainer?"".concat(r,"_").concat(n):n}},{key:"timeStart",value:function(n){if(typeof n!="string"){console.warn("time: first param must be a string");return}this.timeMap[this.getTimerKey(n)]&&console.warn("Timer ".concat(n," already exists")),this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function(n,r){if(typeof n!="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var o=Date.now()-this.timeMap[this.getTimerKey(n)]+(r||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:o}}),delete this.timeMap[this.getTimerKey(n)]}else console.warn("Timer key :".concat(n," does not exist"))}},{key:"addToAssetSpeedWhiteListByMFE",value:function(n){var r=n.MFEName,o=n.whiteList,i;if(this.config.isWebappContainer&&!(!r||!o?.length))if(this.config.assetSpeedMonitoringWhiteListByMFE||(this.config.assetSpeedMonitoringWhiteListByMFE={}),!(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0)&&i[r]))this.config.assetSpeedMonitoringWhiteListByMFE=Lo(ft({},this.config.assetSpeedMonitoringWhiteListByMFE),Wa({},r,o));else{var a,s,l;(l=this.config.assetSpeedMonitoringWhiteListByMFE)===null||l===void 0||(s=l[r])===null||s===void 0||(a=s).push.apply(a,Sd(o))}}},{key:"destroy",value:function(){this.config.isWebappContainer||this.plugins.forEach(function(n){n.uninstall()})}}]),e})(),T2=P2,Ja=function(e,t){return Ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Ja(e,t)};function Xa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ja(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ct=function(){return ct=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ct.apply(this,arguments)};function Dr(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(d){try{c(r.next(d))}catch(p){a(p)}}function l(d){try{c(r.throw(d))}catch(p){a(p)}}function c(d){d.done?i(d.value):o(d.value).then(s,l)}c((r=r.apply(e,[])).next())})}function Ar(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(d){return l([c,d])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(d){c=[6,d],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Kd(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var D2="1.35.0",A2={version:D2},N2={dev:an.staging,staging:an.staging,demo:an.demo,prod:an.production},I2=function(e,t){return e===void 0&&(e=an.production),window._AirwallexSDKs.airTracker||(window._AirwallexSDKs.airTracker=new T2({config:{appName:"components-sdk",appVersion:A2.version,env:N2[e]||an.production}}),window._AirwallexSDKs.airTracker.updateCommonData({clientId:t})),window._AirwallexSDKs.airTracker},Uo=function(e){if(typeof e!="object")return e;try{var t=JSON.parse(JSON.stringify(e));return Object.keys(t).forEach(function(n){typeof n=="string"&&["auth","code"].some(function(r){return n.includes(r)})&&(t[n]="***")}),t}catch{return e}},ln=function(e,t){var n,r;(r=(n=window._AirwallexSDKs)===null||n===void 0?void 0:n.airTracker)===null||r===void 0||r.error(e,ct(ct({},t),{context:"components-sdk"}))},R2=function(e,t){var n;(n=window._AirwallexSDKs.airTracker)===null||n===void 0||n.warn(e,ct(ct({},t),{context:"components-sdk"}))},Nr=function(e,t){var n;(n=window._AirwallexSDKs.airTracker)===null||n===void 0||n.info(e,ct(ct({},t),{context:"components-sdk"}))},jd=(function(e){Xa(t,e);function t(n){var r=e.call(this,n)||this;return r.code="LOAD_SCRIPT_ERROR",r}return t})(Error),cn,dn,Ee;(function(e){e.dev="dev",e.staging="staging",e.demo="demo",e.prod="prod",e.sandbox="sandbox"})(Ee||(Ee={}));var $2=(cn={},cn[Ee.dev]="https://checkout-staging.airwallex.com",cn[Ee.staging]="https://checkout-staging.airwallex.com",cn[Ee.demo]="https://checkout-demo.airwallex.com",cn[Ee.prod]="https://checkout.airwallex.com",cn[Ee.sandbox]="https://checkout.sandbox.airwallex.com",cn),M2=(dn={},dn[Ee.dev]="https://static-staging.airwallex.com",dn[Ee.staging]="https://static-staging.airwallex.com",dn[Ee.demo]="https://static-demo.airwallex.com",dn[Ee.prod]="https://static.airwallex.com",dn[Ee.sandbox]="https://static.sandbox.airwallex.com",dn),zd="sdkController",qd="payments",F2={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"},L2={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"},Wd={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]},O2={billing:["payments"]},Gd=["payments","sca","billing"],B2=(function(e){Xa(t,e);function t(n){var r=e.call(this,n)||this;return r.code="INVALID_STATIC_RESOURCE_ERROR",r}return t})(Error),V2=Date.now(),U2=function(e){return Object.keys(Wd).includes(e)},H2=function(e){return e===void 0&&(e=500),new Promise(function(t){return window.setTimeout(t,e)})},Yd=function(e){return L2[e]},K2=function(e,t){var n=e===qd?$2:M2;return n[t]||n.prod},Zd=function(e){var t=e.reduce(function(n,r){return n.concat(U2(r)?Wd[r]:r)},[]);return Array.from(new Set(t)).map(function(n){return{elementName:n,sdkName:Yd(n)}})},j2=function(e){return Array.from(new Set(Zd(e).map(function(t){var n=t.sdkName;return n}).filter(function(t){return Gd.includes(t)})))},Ir=function(e){return e==="payments"?"payment":e},Qd=function(e){var t=e.name,n=e.env,r=n===void 0?Ee.prod:n,o=K2(t,r),i=F2[t];if(!i)throw ln("[components-sdk] Element static resource not found",{sdkName:t}),new B2("Element ".concat(t," static resource URL is invalid."));return"".concat(o).concat(i,"?ts=").concat(V2)},z2=function(){return Gd.reduce(function(e,t){var n;return ct(ct({},e),(n={},n[t]=window._AirwallexSDKs.__controller__.internalSDKs[t],n))},{})},q2=function(e){return O2[e]||[]},Ht=function(){return Math.floor(performance.now())},W2=function(e){var t=document.createElement("script");t.src=e,t.type="module";var n=document.head||document.body;return n.appendChild(t),t},G2=3,Y2=function(e){return Dr(void 0,void 0,void 0,function(){var t,n;return Ar(this,function(r){switch(r.label){case 0:if(typeof window>"u")throw new Error("Please load script in browser environment");t=0,n=function(){return Dr(void 0,void 0,void 0,function(){var o,i,a;return Ar(this,function(s){return o=Ht(),t>0&&e.includes("?ts=")&&(i=new URL(e,window.location.href),i.searchParams.set("ts","".concat(Date.now())),e=i.toString()),a=W2(e),[2,new Promise(function(l,c){a.addEventListener("load",function(){var d=Ht();Nr("[components-sdk] SDK script loaded",{scriptUrl:e,start:o,latency:d-o,end:d,retryCount:t}),l(!0)}),a.addEventListener("error",function(d){a.remove(),console.error(d);var p=Ht();ln("[components-sdk] Failed to load script",{scriptUrl:e,error:d,start:o,latency:p-o,end:p,retryCount:t}),c(new jd("Failed to load Airwallex SDK scripts: ".concat(e)))})})]})})},r.label=1;case 1:if(!(t<G2))return[3,7];r.label=2;case 2:return r.trys.push([2,4,,6]),[4,n()];case 3:return[2,r.sent()];case 4:return r.sent(),t++,[4,H2()];case 5:return r.sent(),[3,6];case 6:return[3,1];case 7:throw ln("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:t}),new jd("Failed to load Airwallex SDK scripts: ".concat(e))}})})},Jd=(function(e){Xa(t,e);function t(n){var r=e.call(this,n)||this;return r.code="INSTANCE_NOT_FOUND_ERROR",r}return t})(Error),Ho,Xd=new Map,es=function(e){var t=e.env,n=e.scriptName,r=Qd({name:n,env:t}),o=Xd.get(n);if(o)return o;var i=Y2(r);return Xd.set(n,i),i},ts=function(e){var t=e.env,n=e.scriptName;return Dr(void 0,void 0,void 0,function(){var r;return Ar(this,function(o){switch(o.label){case 0:return r=q2(n),r.length>0?[4,Promise.all(r.map(function(i){return es({env:t,scriptName:i})}))]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2,es({env:t,scriptName:n})]}})})},eu=function(e){return Dr(void 0,void 0,void 0,function(){return Ar(this,function(t){if(typeof window>"u")throw new Error("Please call the `init()` function in a browser environment.");return I2(e.env,e.clientId),Nr("[components-sdk] SDK init start",{options:Uo(e),start:Ht()}),Ho=new Promise(function(n,r){var o,i=ct(ct({},e),{env:e.env&&Ee[e.env]?e.env:Ee.prod});window.AirwallexComponentsSDK.__env__=i.env;var a=es({env:i.env,scriptName:zd}).then(function(){return window._AirwallexSDKs.__controller__.init(i)}),s=(o=e.enabledElements)!==null&&o!==void 0?o:[],l=j2(s),c=l.map(function(h){return ts({env:i.env,scriptName:h}).then(function(){return a}).then(function(){var m=window._AirwallexSDKs[Ir(h)];if(!m)throw ln("[components-sdk] SDK instance not found",{functionsNamespace:h,windowSDKInstanceName:Ir(h)}),new Jd("SDK instance not found");return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:h,instance:m})})}),d=Zd(s),p=d.map(function(h){var m=h.sdkName,f=h.elementName;return ts({scriptName:m,env:i.env}).then(function(){return a}).then(function(){var y=window._AirwallexSDKs[Ir(m)];if(!y)throw ln("[components-sdk] SDK instance not found",{sdkName:m,windowSDKInstanceName:Ir(m)}),new Jd("SDK instance not found");return window._AirwallexSDKs.__controller__.registerElement({sdkName:m,elementName:f,instance:y})})});Promise.all(Kd(Kd([a],c,!0),p)).then(function(){Nr("[components-sdk] SDK initialized",{options:Uo(e),start:Ht()}),n(z2())}).catch(function(h){h.code||ln("[components-sdk] Unexpected errors when init",{error:h}),r(h)})}),[2,Ho]})})},Rr=function(e,t){return Dr(void 0,void 0,void 0,function(){var n,r,o,i,a;return Ar(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Element type is missing. Please specify a valid element.");if(Nr("[components-sdk] SDK createElement start",{elementName:e,options:Uo(t),timestamp:Ht()}),!Ho)throw R2("[components-sdk] Did not call init before createElement"),new Error("Please initialize the Element before creating it.");return[4,Ho];case 1:if(s.sent(),n=Yd(e),!n)throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."));r=Ht(),s.label=2;case 2:return s.trys.push([2,6,,7]),[4,ts({scriptName:n,env:window.AirwallexComponentsSDK.__env__||Ee.prod})];case 3:return s.sent(),[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:e,instance:window._AirwallexSDKs[Ir(n)]})];case 4:return s.sent(),[4,window._AirwallexSDKs.__controller__.createElement(e,t)];case 5:return o=s.sent(),i=Ht(),Nr("[components-sdk] SDK createElement being called",{elementName:e,options:Uo(t),start:r,latency:i-r,end:i}),[3,7];case 6:if(a=s.sent(),!a.code)ln("[components-sdk] Unexpected errors when createElement",{error:a});else throw a;return[3,7];case 7:return[2,o]}})})},Z2=[zd,qd],tu=function(){Z2.forEach(function(e){var t=Qd({name:e,env:Ee.prod}),n=document.createElement("link");n.href=t,n.rel="modulepreload",n.as="script";var r=document.head||document.body;r.appendChild(n)})},Q2=typeof document>"u"||typeof window>"u";Q2||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",tu):tu()),typeof window<"u"&&(window.AirwallexComponentsSDK||Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:!1},_AirwallexSDKs:{value:{},writable:!1}}),window.AirwallexComponentsSDK.init=eu,window.AirwallexComponentsSDK.createElement=Rr);const ns={base:{fontSize:"14px",color:"#09090b","::placeholder":{color:"#a1a1aa"}}},J2={visa:"visa",mastercard:"mastercard",amex:"amex",jcb:"jcb",cup:"unionpay"};let rs=null;function nu(e){return rs||(rs=eu({env:Nu(e),enabledElements:["payments"],locale:"en"}).then(()=>{})),rs}async function X2(e){await nu(e.apiBase);const t=Mu("fy-awx-auth"),n=k("div",{class:"h-10 rounded-lg border border-zinc-200 px-3"}),r=k("div",{class:"h-10 rounded-lg border border-zinc-200 px-3"}),o=k("div",{class:"h-10 rounded-lg border border-zinc-200 px-3"}),i=k("form",{class:"mt-4 flex flex-col gap-3"},[os("Card number",n),k("div",{class:"grid grid-cols-2 gap-3"},[os("Expiry",r),os("CVC",o)]),k("div",{id:t})]),a=ei(`Pay ${fn(e.amount,e.currency)}`);i.append(a),e.container.append(i);const s={id:e.intentId,client_secret:e.clientSecret,currency:e.currency},l=e.allowedBrands?.map(m=>J2[m.toLowerCase()]).filter(Boolean),[c,d,p]=await Promise.all([Rr("cardNumber",{intent:s,style:ns,authFormContainer:t,allowedCardNetworks:l?.length?l:void 0,autoCapture:e.autoCapture}),Rr("expiry",{style:ns}),Rr("cvc",{style:ns})]);if(!c||!d||!p)throw new Error("Could not create card input fields.");c.mount(n),d.mount(r),p.mount(o);const h=async m=>{m.preventDefault(),a.disabled=!0;try{await c.confirm({intent_id:e.intentId,client_secret:e.clientSecret}),e.onSuccess()}catch(f){e.onError(f instanceof Error?f.message:"Card payment failed"),a.disabled=!1}};return i.addEventListener("submit",h),a.addEventListener("click",h),()=>{i.removeEventListener("submit",h),c.destroy?.(),d.destroy?.(),p.destroy?.()}}async function e4(e){if(e.wallet==="applepay"&&!Zo())return e.container.append(Oe("Apple Pay is not supported in this browser.")),()=>{};if(e.wallet==="googlepay"&&!Qo())return e.container.append(Oe("Google Pay is not supported in this browser.")),()=>{};await nu(e.apiBase);const t=k("div",{class:"mt-4 min-h-[48px]"}),n=Hn(`Loading ${e.wallet==="applepay"?"Apple Pay":"Google Pay"}…`);e.container.append(n,t);const r=Fr(e.currency),o={value:e.amount,currency:e.currency},i=e.wallet==="applepay"?"applePayButton":"googlePayButton",a=await Rr(i,{intent_id:e.intentId,client_secret:e.clientSecret,countryCode:r,amount:o,autoCapture:e.autoCapture,buttonType:"pay",buttonColor:"black"});if(!a)return n.remove(),e.container.append(Oe("Could not create wallet button.")),()=>{};a.mount(t),n.remove();const s=()=>e.onSuccess(),l=c=>{e.onError(c?.detail?.message||"Wallet payment failed.")};return a.on("success",s),a.on("error",l),()=>{a.destroy?.()}}function os(e,t){return k("label",{class:"flex flex-col gap-1 text-sm font-medium text-zinc-700"},[k("span",{text:e}),t])}function t4(e,t,n){const r=k("p",{class:"mt-2 text-sm text-zinc-500"});e.append(r);function o(){const a=t-Date.now();if(a<=0){r.textContent="This QR code has expired.",n();return}const s=Math.floor(a/1e3),l=Math.floor(s/3600),c=Math.floor(s%3600/60),d=s%60,p=h=>String(h).padStart(2,"0");r.textContent=l>0?`Expires in ${l}:${p(c)}:${p(d)}`:`Expires in ${p(c)}:${p(d)}`}o();const i=window.setInterval(o,1e3);return()=>window.clearInterval(i)}const n4=3e3,r4=7200*1e3,o4=600*1e3,i4={wechatpay:"Open the WeChat app on your phone, scan this QR code, and complete the payment.",paynow:"Open your banking or PayNow app, scan this QR code, and complete the payment.",alipaycn:"Open the Alipay app on your phone, scan this QR code, and complete the payment.",alipayhk:"Open the AlipayHK app on your phone, scan this QR code, and complete the payment.",alipay:"Open the Alipay app on your phone and complete the payment."};function Ko(e){return e.client}function is(e,t){return e.apiVersion==="v2"&&(t==="card"||$s(t))}async function ru(e,t,n){return Ko(e).createPayment({amount:t.amount,currency:t.currency,orderId:t.orderId,items:t.items,returnUrl:t.returnUrl??"",autoCapture:t.autoCapture,metadata:t.metadata,existingOrderId:t.existingOrderId,existingPaymentId:t.existingPaymentId,paymentMethod:n})}function ou(e){const t=e.result.provider||e.result.payment.platform,n=e.result.paymentData||e.result.paymentIntent||{},r=e.result.paymentIntent||n,o=r?.next_action,i=e.result.paymentData?.action,a=o?.qrcode||i?.qrCodeData,s=o?.type==="redirect_iframe"||i?.type==="redirect_iframe",l=o?.type==="redirect"?o.url:i?.type==="redirect"||i?.type==="redirect_iframe"?typeof i.url=="string"?i.url:void 0:!a&&!s?o?.url:void 0,c=Br(l),d=e.method.type,p=[];if(d==="card"){if(Cd(t)){const f=k("div",{class:"mt-4"});return e.host.append(f),vd({container:f,client:Ko(e.ctx),paymentId:String(e.result.payment.id),methodType:d,paymentData:n,amount:e.options.amount,currency:e.options.currency,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError}).then(y=>p.push(y)).catch(y=>{e.onError(y instanceof Error?y.message:"Failed to load card form")}),()=>p.forEach(y=>y())}const h=r?.id,m=r?.client_secret;return!h||!m?(e.host.append(Oe("Card payment is unavailable — missing payment intent credentials.")),()=>{}):(X2({container:e.host,apiBase:e.ctx.apiBase,intentId:h,clientSecret:m,currency:e.options.currency,amount:e.options.amount,autoCapture:e.options.autoCapture,allowedBrands:e.method.brands,onSuccess:e.onSuccess,onError:e.onError}).then(f=>p.push(f)).catch(f=>{e.onError(f instanceof Error?f.message:"Failed to load card form")}),()=>p.forEach(f=>f()))}if($s(d)){if(Cd(t)){const f=k("div",{class:"mt-4"});return e.host.append(f),vd({container:f,client:Ko(e.ctx),paymentId:String(e.result.payment.id),methodType:d,paymentData:n,amount:e.options.amount,currency:e.options.currency,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError}).then(y=>p.push(y)).catch(y=>{e.onError(y instanceof Error?y.message:"Failed to load wallet")}),()=>p.forEach(y=>y())}const h=r?.id,m=r?.client_secret;return!h||!m?(e.host.append(Oe(`${e.method.name} is unavailable — missing payment intent credentials.`)),()=>{}):(e4({container:e.host,apiBase:e.ctx.apiBase,wallet:d,intentId:h,clientSecret:m,currency:e.options.currency,amount:e.options.amount,autoCapture:e.options.autoCapture,allowedBrands:e.method.brands,onSuccess:e.onSuccess,onError:e.onError}).then(f=>p.push(f)).catch(f=>{e.onError(f instanceof Error?f.message:"Failed to load wallet")}),()=>p.forEach(f=>f()))}if(a&&(Sh(d)||Ms(d)))return a4({host:e.host,ctx:e.ctx,qrcode:a,method:e.method,paymentId:String(e.result.payment.id),onSuccess:e.onSuccess,onError:e.onError});if(Ms(d)&&(c||s)){if(s&&c)return Fn({url:c,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError});if(c)return e.host.append(k("p",{class:"mt-4 text-sm text-zinc-600",text:"Redirecting…"})),window.location.assign(c),()=>{}}if(c)return e.host.append(k("p",{class:"mt-4 text-sm text-zinc-600",text:"Redirecting…"})),window.location.assign(c),()=>{};if(s&&o?.url){const h=Br(o.url);if(h)return Fn({url:h,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError})}return e.host.append(Oe("This payment method could not be displayed.")),()=>{}}function a4(e){const t=e.method.type==="wechatpay"?r4:o4,n=Date.now()+t,r=i4[e.method.type.toLowerCase()]??"Scan this QR code with your mobile app to complete the payment.",o=k("div",{class:"mt-4 flex flex-col items-center"});o.append(Xo(e.method.type,e.method.name)),o.append(k("p",{class:"mt-3 text-sm text-zinc-600 text-center",text:r}));let i=!1,a=!1;const s=k("canvas",{class:"mt-4 rounded-lg border border-zinc-200 bg-white"});try{s4(s,e.qrcode),o.append(s)}catch{return o.append(Oe("Could not display QR code.")),e.host.append(o),()=>{}}const l=k("div");o.append(l);const c=t4(l,n,()=>{i=!0,e.onError("This QR code has expired.")});e.host.append(o);const d=Ko(e.ctx),p=window.setInterval(async()=>{if(i||a)return;const h=await d.getPayment(e.paymentId);if(!h)return;const m=Ch(h);m==="success"?(a=!0,e.onSuccess()):m==="failed"&&(a=!0,e.onError(h.paymentAttempt?.failure_details?.message||_h(h)))},n4);return()=>{c(),window.clearInterval(p)}}function s4(e,t){const n=fh(t,"raw",{ecc:"high",scale:1}),r=e.getContext("2d",{alpha:!1});if(!r)throw new Error("canvas");const o=window.devicePixelRatio||1,i=240;e.width=i*o,e.height=i*o,e.style.width=`${i}px`,e.style.height=`${i}px`,r.scale(o,o),r.fillStyle="#fff",r.fillRect(0,0,i,i);const a=Math.floor(i/n.length),s=Math.floor((i-n.length*a)/2);r.fillStyle="#111";for(let l=0;l<n.length;l++)for(let c=0;c<n[l].length;c++)n[l]?.[c]&&r.fillRect(s+c*a,s+l*a,a,a)}function iu(e){const t=k("div",{class:"mt-4"});e.host.append(t);const n=[];return Oy({container:t,ctx:e.ctx,method:e.method,options:e.options,showWordmark:e.ctx.appearance.showWordmark!==!1,onSuccess:e.onSuccess,onError:e.onError}).then(r=>n.push(r)).catch(r=>{e.onError(r instanceof Error?r.message:"Failed to load payment form")}),()=>n.forEach(r=>r())}class l4 extends Vr{constructor(){super(...arguments),this.methods=[],this.selected=null,this.step="list",this.stopPay=null,this.loading=!1,this.loadingMethods=!1,this.payResult=null}onUnmount(){this.stopPay?.(),this.stopPay=null,super.onUnmount()}render(){if(this.root){if(this.step==="pay"&&this.selected){this.drawPay(this.payResult??void 0);return}if(this.methods.length){this.drawList();return}this.loadingMethods||(this.loadingMethods=!0,this.root.replaceChildren(Hn("Loading payment methods…")),this.ctx.client.getPaymentMethods({amount:this.options.amount,currency:this.options.currency}).then(t=>{this.methods=Jo(ms(t,this.options.allowedPaymentMethods)),this.selected=this.methods[0]??null,this.drawList()}).catch(t=>{this.root&&this.root.replaceChildren(Oe(t instanceof Error?t.message:"Could not load payment methods"))}).finally(()=>{this.loadingMethods=!1}))}}drawList(){if(!this.root)return;if(!this.methods.length){this.root.replaceChildren(Oe("No payment methods are available for this outlet."));return}const t=k("div",{class:"flex flex-col gap-2",role:"radiogroup"});for(const o of this.methods){const i=this.selected?.type===o.type,a=k("button",{type:"button",role:"radio","aria-checked":i?"true":"false",class:Or("flex w-full items-start gap-3 rounded-xl border p-3 text-left transition",i?"border-blue-600 bg-blue-50":"border-zinc-200 hover:border-zinc-300")});a.append(Xo(o.type,o.name));const s=k("div",{class:"min-w-0 flex-1"});s.append(k("p",{class:"text-sm font-medium",text:o.name}));const l=gs(o.brands);l&&s.append(l),a.append(s),a.addEventListener("click",()=>{this.selected=o,this.emit("select",o),this.drawList()}),t.append(a)}const n=ei(this.loading?"Continuing…":"Continue",{disabled:this.loading||!this.selected,onClick:()=>{this.startPay()}}),r=k("div",{class:"flex flex-col gap-4"},[k("h3",{class:"text-base font-semibold",text:"Select a payment method"}),k("p",{class:"text-sm text-zinc-500",text:`Amount due ${fn(this.options.amount,this.options.currency)}`}),t,n]);this.showWordmark&&r.append(k("div",{class:"mt-2 flex justify-center"},[yn()])),this.root.replaceChildren(r)}async startPay(){if(!this.selected||this.loading)return;if(is(this.ctx,this.selected.type)){this.step="pay",this.payResult=null,this.drawPay();return}this.loading=!0,this.drawList();const t=await ru(this.ctx,this.options,this.selected);if(this.loading=!1,!t.ok){this.drawList(),this.root?.append(Oe(t.message)),this.emit("error",{message:t.message});return}this.step="pay",this.payResult=t.data,this.drawPay(t.data)}drawPay(t){if(!this.root||!this.selected)return;this.stopPay?.();const n=ei("← Change payment method",{variant:"ghost",onClick:()=>{this.stopPay?.(),this.stopPay=null,this.payResult=null,this.step="list",this.drawList()}}),r=k("div");if(this.root.replaceChildren(n,k("h3",{class:"mt-2 text-base font-semibold",text:`Pay with ${this.selected.name}`}),k("p",{class:"mt-1 text-sm text-zinc-500",text:`Paying ${fn(this.options.amount,this.options.currency)}`}),r),this.showWordmark&&this.root.append(k("div",{class:"mt-6 flex justify-center"},[yn()])),is(this.ctx,this.selected.type)&&!t){this.stopPay=iu({host:r,ctx:this.ctx,method:this.selected,options:this.options,onSuccess:o=>this.emit("success",{paymentId:o,orderId:this.options.orderId,resultCode:"Authorised",status:"success"}),onError:o=>this.emit("error",{message:o})});return}if(!t){r.append(Hn("Starting payment…")),this.startPay();return}this.stopPay=ou({host:r,ctx:this.ctx,method:this.selected,options:this.options,result:t,onSuccess:()=>this.emit("success",{paymentId:String(t.payment.id),orderId:this.options.orderId,resultCode:"Authorised",status:"success"}),onError:o=>this.emit("error",{message:o})})}}class c4 extends Vr{constructor(){super(...arguments),this.selected=null,this.methods=[],this.loadingMethods=!1}render(){if(this.root){if(this.methods.length){this.drawList(this.methods);return}this.loadingMethods||(this.loadingMethods=!0,this.root.replaceChildren(Hn("Loading payment methods…")),this.ctx.client.getPaymentMethods({amount:this.options.amount,currency:this.options.currency}).then(t=>{this.methods=Jo(ms(t)),this.drawList(this.methods)}).catch(t=>{this.root&&this.root.replaceChildren(Oe(t instanceof Error?t.message:"Could not load payment methods"))}).finally(()=>{this.loadingMethods=!1}))}}drawList(t){if(!this.root)return;if(!t.length){this.root.replaceChildren(Oe("No payment methods are available for this outlet."));return}(!this.selected||!t.some(r=>r.type===this.selected?.type))&&(this.selected=t[0]);const n=k("div",{class:"flex flex-col gap-2",role:"radiogroup"});for(const r of t){const o=this.selected?.type===r.type,i=k("button",{type:"button",role:"radio","aria-checked":o?"true":"false",class:Or("flex w-full items-start gap-3 rounded-xl border p-3 text-left transition",o?"border-blue-600 bg-blue-50":"border-zinc-200 hover:border-zinc-300")});i.append(Xo(r.type,r.name));const a=k("div",{class:"min-w-0 flex-1"});a.append(k("p",{class:"text-sm font-medium",text:r.name}));const s=gs(r.brands);s&&a.append(s),i.append(a),i.addEventListener("click",()=>{this.selected=r,this.emit("select",r),this.emit("change",{paymentMethod:r}),this.drawList(t)}),n.append(i)}this.root.replaceChildren(n)}}class yt extends Vr{constructor(){super(...arguments),this.stopPay=null}withForcedType(t){return this.lockedType=t,this}onUnmount(){this.stopPay?.(),this.stopPay=null,super.onUnmount()}render(){if(!this.root)return;this.stopPay?.();const t=this.options,n=this.resolveMethod(t);if(!n){this.root.replaceChildren(Oe("A paymentMethod is required for this element."));return}if(this.root.replaceChildren(k("div",{class:"flex flex-col gap-2"},[k("h3",{class:"text-base font-semibold",text:`Pay with ${n.name}`}),k("p",{class:"text-sm text-zinc-500",text:`Paying ${fn(t.amount,t.currency)}`}),Hn("Starting payment…")])),is(this.ctx,n.type)){const r=k("div");this.root.replaceChildren(k("h3",{class:"text-base font-semibold",text:`Pay with ${n.name}`}),k("p",{class:"mt-1 text-sm text-zinc-500",text:`Paying ${fn(t.amount,t.currency)}`}),r),this.showWordmark&&this.root.append(k("div",{class:"mt-6 flex justify-center"},[yn()])),this.stopPay=iu({host:r,ctx:this.ctx,method:n,options:t,onSuccess:o=>this.emitSuccess(o,t.orderId),onError:o=>this.emit("error",{message:o})});return}ru(this.ctx,t,n).then(r=>{if(!this.root)return;if(!r.ok){this.root.replaceChildren(Oe(r.message)),this.emit("error",{message:r.message});return}const o=k("div");this.root.replaceChildren(k("h3",{class:"text-base font-semibold",text:`Pay with ${n.name}`}),k("p",{class:"mt-1 text-sm text-zinc-500",text:`Paying ${fn(t.amount,t.currency)}`}),o),this.showWordmark&&this.root.append(k("div",{class:"mt-6 flex justify-center"},[yn()])),this.stopPay=ou({host:o,ctx:this.ctx,method:n,options:t,result:r.data,onSuccess:()=>this.emitSuccess(r.data.payment.id,t.orderId),onError:i=>this.emit("error",{message:i})})})}resolveMethod(t){return this.lockedType?t.paymentMethod??{type:this.lockedType,name:d4(this.lockedType)}:t.paymentMethod??null}emitSuccess(t,n){const r={paymentId:t,orderId:n,resultCode:"Authorised",status:"success"};this.emit("success",r)}}function d4(e){return{card:"Credit Card",applepay:"Apple Pay",googlepay:"Google Pay",paynow:"PayNow",wechatpay:"WeChat Pay",alipay:"Alipay",alipaycn:"Alipay CN",alipayhk:"Alipay HK"}[e]??e}class u4 extends yt{resolveMethod(t){return t.paymentMethod??{type:"card",name:"Credit Card"}}}class h4 extends yt{}class p4 extends yt{}class m4 extends yt{resolveMethod(t){const n=t.paymentMethod;return n||{type:"alipay",name:"Alipay"}}}class f4 extends yt{}class y4 extends yt{constructor(...t){super(...t),this.withForcedType("paynow")}}class g4 extends yt{constructor(...t){super(...t),this.withForcedType("wechatpay")}}class b4 extends yt{constructor(...t){super(...t),this.withForcedType("applepay")}}class v4 extends yt{constructor(...t){super(...t),this.withForcedType("googlepay")}}class C4 extends yt{constructor(...t){super(...t),this.withForcedType("alipaycn")}}class _4 extends yt{constructor(...t){super(...t),this.withForcedType("alipayhk")}}class w4 extends Vr{render(){if(!this.root)return;const t=this.options.status??"pending",o=k("div",{class:"flex flex-col items-center gap-2 py-8 text-center"},[k("h3",{class:`text-lg font-semibold ${t==="success"?"text-emerald-600":t==="failed"?"text-red-600":"text-zinc-600"}`,text:t==="success"?"Payment successful":t==="failed"?"Payment failed":"Payment pending"}),this.options.message?k("p",{class:"text-sm text-zinc-500",text:this.options.message}):null,this.options.paymentId?k("p",{class:"text-xs text-zinc-400",text:`Payment ${this.options.paymentId}`}):null]);this.showWordmark&&o.append(k("div",{class:"mt-4"},[yn()])),this.root.replaceChildren(o)}}function S4(e,t,n){switch(e){case"checkout":return new l4(e,t,n);case"payment-method-list":return new c4(e,t,n);case"card":return new u4(e,t,n);case"qr":return new h4(e,t,n);case"wallet":return new p4(e,t,n);case"alipay":return new m4(e,t,n);case"redirect":return new f4(e,t,n);case"payment-result":return new w4(e,t,n);case"paynow":return new y4(e,t,n);case"wechatpay":return new g4(e,t,n);case"applepay":return new b4(e,t,n);case"googlepay":return new v4(e,t,n);case"alipaycn":return new C4(e,t,n);case"alipayhk":return new _4(e,t,n);default:throw new Error(`[@finyxpay/ui] Unknown element type: "${e}"`)}}function au(e){return e==="v2"?"v2":"v4"}class as{constructor(t){if(this.methodsCache=null,!t.apiKey?.trim())throw new Error("[@finyxpay/ui] A public API key is required.");this.apiKey=t.apiKey.trim(),this.apiBase=Yo(this.apiKey,t.apiBase),this.locale=t.locale??"en",this.appearance={showWordmark:!0,...t.appearance},this.apiVersion=au(t.apiVersion),this.client=Du(this.apiKey,this.apiBase,this.apiVersion),this.apiVersion==="v4"&&this.client.getPaymentMethods().then(n=>{this.methodsCache=n}).catch(()=>{})}context(){return{apiKey:this.apiKey,apiBase:this.apiBase,locale:this.locale,appearance:this.appearance,apiVersion:this.apiVersion,client:this.client}}async createElement(t,n){return S4(t,n,this.context())}async getPaymentMethods(t){if(this.methodsCache)return this.methodsCache;const n=await this.client.getPaymentMethods(t);return this.methodsCache=n,n}}let Kt=null;async function su(e){const t=au(e.apiVersion);return Kt&&Kt.apiKey===e.apiKey.trim()&&Kt.apiVersion===t||(Kt=new as(e)),Kt}function k4(){if(!Kt)throw new Error("[@finyxpay/ui] Call init({ apiKey }) before createElement.");return Kt}async function lu(e,t){return k4().createElement(e,t)}const E4={init:su,createElement:lu,Finyx:as,resolveApiBase:Yo,resolveElementType:Rs};typeof window<"u"&&(window.Finyx=E4),ze.Finyx=as,ze.createElement=lu,ze.filterPaymentMethodsByBrowserSupport=Jo,ze.init=su,ze.isApplePaySupported=Zo,ze.isGooglePaySupported=Qo,ze.resolveApiBase=Yo,ze.resolveElementType=Rs,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})}));
142
142
  //# sourceMappingURL=finyx.umd.cjs.map