xendit-components-web 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +2 -2
- package/package.json +1 -2
- package/sdk/dist/cjs/index.cjs +1 -1
- package/sdk/dist/cjs/index.cjs.map +1 -1
- package/sdk/dist/cjs/test-data.cjs +1 -1
- package/sdk/dist/cjs/test-data.cjs.map +1 -1
- package/sdk/dist/esm-bundled/index.mjs +2 -2
- package/sdk/dist/esm-bundled/index.mjs.map +1 -1
- package/sdk/dist/esm-bundled/test-data.mjs +1 -1
- package/sdk/dist/esm-bundled/test-data.mjs.map +1 -1
- package/sdk/dist/esm-external/index.mjs +1 -1
- package/sdk/dist/esm-external/index.mjs.map +1 -1
- package/sdk/dist/esm-external/test-data.mjs +1 -1
- package/sdk/dist/esm-external/test-data.mjs.map +1 -1
- package/sdk/dist/index.umd.js +2 -2
- package/sdk/dist/index.umd.js.map +1 -1
package/sdk/dist/cjs/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright (c) 2026 Xendit Inc. Licensed under the MIT License (MIT). */
|
|
2
|
-
"use strict";require("preact/debug"),require("preact/devtools");var e=require("preact"),n=require("preact/jsx-runtime"),t=require("preact/hooks"),a=require("classnames"),i=require("libphonenumber-js"),r=require("libphonenumber-js/min"),o=require("libphonenumber-js/mobile/examples"),s=require("preact/compat"),l=require("jsbarcode"),d=require("qrcode"),c=require("qrcode/lib/renderer/svg-tag.js");let u=!1;class XenditInitEvent extends Event{static type="init";constructor(){super(XenditInitEvent.type,{})}}class XenditFatalErrorEvent extends Event{message;static type="fatal-error";constructor(e){super(XenditFatalErrorEvent.type,{}),this.message=e}}class XenditReadyEvent extends Event{channelCode;static type="submission-ready";constructor(e){super(XenditReadyEvent.type,{}),this.channelCode=e}}class XenditNotReadyEvent extends Event{static type="submission-not-ready";constructor(){super(XenditNotReadyEvent.type,{})}}class XenditSubmissionBeginEvent extends Event{static type="submission-begin";constructor(){super(XenditSubmissionBeginEvent.type,{})}}class XenditSubmissionEndEvent extends Event{reason;userErrorMessage;developerErrorMessage;static type="submission-end";constructor(e,n,t){super(XenditSubmissionEndEvent.type,{}),this.reason=e,this.userErrorMessage=n,this.developerErrorMessage=t}}class XenditActionBeginEvent extends Event{static type="action-begin";constructor(){super(XenditActionBeginEvent.type,{})}}class XenditActionEndEvent extends Event{static type="action-end";constructor(){super(XenditActionEndEvent.type,{})}}class XenditWillRedirectEvent extends Event{static type="will-redirect";constructor(){super(XenditWillRedirectEvent.type,{})}}class XenditSessionCompleteEvent extends Event{succeededChannel;static type="session-complete";constructor(e){super(XenditSessionCompleteEvent.type,{}),this.succeededChannel=e}}class XenditSessionExpiredOrCanceledEvent extends Event{static type="session-expired-or-canceled";constructor(){super(XenditSessionExpiredOrCanceledEvent.type,{})}}class XenditSessionPendingEvent extends Event{static type="session-pending";constructor(){super(XenditSessionPendingEvent.type,{})}}class XenditSessionNotPendingEvent extends Event{static type="session-not-pending";constructor(){super(XenditSessionNotPendingEvent.type,{})}}class XenditPaymentRequestCreatedEvent extends Event{paymentRequestId;static type="payment-request-created";constructor(e){super(XenditPaymentRequestCreatedEvent.type,{}),this.paymentRequestId=e}}class XenditPaymentTokenCreatedEvent extends Event{paymentTokenId;static type="payment-token-created";constructor(e){super(XenditPaymentTokenCreatedEvent.type,{}),this.paymentTokenId=e}}class XenditPaymentRequestDiscardedEvent extends Event{paymentRequestId;static type="payment-request-discarded";constructor(e){super(XenditPaymentRequestDiscardedEvent.type,{}),this.paymentRequestId=e}}class XenditPaymentTokenDiscardedEvent extends Event{paymentTokenId;static type="payment-token-discarded";constructor(e){super(XenditPaymentTokenDiscardedEvent.type,{}),this.paymentTokenId=e}}const h=Symbol("xendit-internal"),p=e=>n.jsx("div",{class:"xendit-accordion",children:e.children}),m=e=>{const{name:t,size:a,direction:i}=e;let r,o;switch(i){case"right":r="rotate(180 12 12)";break;case"up":r="rotate(90 12 12)";break;case"down":r="rotate(-90 12 12)";break;default:r="rotate(0 12 12)"}switch(t){case"chevron":o=n.jsx("path",{d:"M15 19.5L7.5 12L15 4.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"});break;case"check":o=_(n.jsx("path",{d:"M13.5 4.5L6.5 11.5L3 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),16/24);break;case"x":o=n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M18.75 5.25L5.25 18.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),n.jsx("path",{d:"M18.75 18.75L5.25 5.25",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]});break;case"card":o=_(n.jsx("path",{fill:"currentColor",d:"M17.25 3.75H2.75A1.25 1.25 0 0 0 1.5 5v10a1.25 1.25 0 0 0 1.25 1.25h14.5A1.25 1.25 0 0 0 18.5 15V5a1.25 1.25 0 0 0-1.25-1.25m-.875 9.5a1 1 0 0 1-1 1h-2.5a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1zM1.5 8V6h17v2z"}),20/24);break;case"qr":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{fill:"currentColor",d:"M8.125 3.125h-3.75c-.69 0-1.25.56-1.25 1.25v3.75c0 .69.56 1.25 1.25 1.25h3.75c.69 0 1.25-.56 1.25-1.25v-3.75c0-.69-.56-1.25-1.25-1.25M8.125 10.625h-3.75c-.69 0-1.25.56-1.25 1.25v3.75c0 .69.56 1.25 1.25 1.25h3.75c.69 0 1.25-.56 1.25-1.25v-3.75c0-.69-.56-1.25-1.25-1.25M15.625 3.125h-3.75c-.69 0-1.25.56-1.25 1.25v3.75c0 .69.56 1.25 1.25 1.25h3.75c.69 0 1.25-.56 1.25-1.25v-3.75c0-.69-.56-1.25-1.25-1.25M11.25 14.375a.624.624 0 0 0 .625-.625v-2.5a.624.624 0 1 0-1.25 0v2.5a.624.624 0 0 0 .625.625"}),n.jsx("path",{fill:"currentColor",d:"M16.25 11.875h-1.875v-.625a.624.624 0 1 0-1.25 0v4.375H11.25a.624.624 0 1 0 0 1.25h2.5a.624.624 0 0 0 .625-.625v-3.125h1.875a.624.624 0 1 0 0-1.25M16.25 14.375a.624.624 0 0 0-.625.625v1.25a.624.624 0 1 0 1.25 0V15a.624.624 0 0 0-.625-.625"})]}),20/24);break;case"otc":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{fill:"currentColor","fill-rule":"evenodd",d:"M16.972 9.547c.092-.107.207-.021.207.12v6.924c0 .283-.23.513-.512.513h-7.18v-5.129a.513.513 0 0 0-.514-.512h-3.59a.513.513 0 0 0-.513.512v5.13H3.332a.514.514 0 0 1-.513-.514V9.853c0-.244.149-.33.331-.168.268.238.586.428.936.556a3.2 3.2 0 0 0 2.209 0c.35-.128.669-.318.936-.556a.56.56 0 0 1 .728 0c.267.238.586.428.935.556a3.2 3.2 0 0 0 2.209 0c.35-.128.669-.318.937-.556a.56.56 0 0 1 .727 0c.267.238.586.428.935.556a3.2 3.2 0 0 0 2.21 0c.349-.128.668-.318.936-.556.04-.036.081-.088.124-.138m-4.409 1.915a.513.513 0 0 0-.512.513v1.283c0 .283.23.512.512.513h2.052c.283 0 .513-.23.513-.513v-1.283a.513.513 0 0 0-.513-.512z","clip-rule":"evenodd"}),n.jsx("path",{fill:"currentColor",d:"M16.325 3c.148 0 .293.054.412.153.118.1.204.24.245.398l.99 2.872a.51.51 0 0 1-.333.654 2.4 2.4 0 0 1-.166.495c-.145.31-.357.593-.625.831a2.9 2.9 0 0 1-.936.556 3.2 3.2 0 0 1-2.209 0 2.9 2.9 0 0 1-.936-.556.56.56 0 0 0-.727 0 2.9 2.9 0 0 1-.936.556 3.2 3.2 0 0 1-2.209 0 2.9 2.9 0 0 1-.936-.556.56.56 0 0 0-.728 0 2.9 2.9 0 0 1-.935.556 3.2 3.2 0 0 1-2.21 0 2.9 2.9 0 0 1-.936-.556 2.6 2.6 0 0 1-.624-.831 2.4 2.4 0 0 1-.167-.495.51.51 0 0 1-.33-.654l.99-2.872a.77.77 0 0 1 .244-.397A.64.64 0 0 1 3.675 3z"})]}),20/24);break;case"ewallet":o=_(n.jsx("path",{fill:"currentColor","fill-rule":"evenodd",d:"M11.313 2.07c.94-.23 2.112.266 2.63 1.145H9.331c-1.242 0-2.295.021-3.171.053 1.648-.683 3.44-.78 5.153-1.198M4.338 17.855c1.061.072 2.691.145 4.971.145s3.91-.073 4.972-.145c1.168-.08 2.09-.963 2.186-2.134q.029-.335.054-.747a40 40 0 0 1-2.644-.012c-1.298-.052-2.345-1.039-2.405-2.362a26 26 0 0 1-.023-1.153q.002-.67.023-1.153c.06-1.323 1.107-2.31 2.405-2.362q.745-.029 1.494-.027.654 0 1.15.016a36 36 0 0 0-.054-.748c-.096-1.17-1.018-2.053-2.186-2.133-1.062-.073-2.692-.146-4.972-.146s-3.91.073-4.971.146c-1.169.08-2.09.962-2.187 2.133A53 53 0 0 0 2 11.447c0 1.922.073 3.326.151 4.274.096 1.171 1.018 2.053 2.187 2.134m8.675-5.325c.03.662.544 1.155 1.21 1.181q.508.022 1.274.024.766-.002 1.273-.024c.667-.026 1.18-.52 1.21-1.181q.019-.404.02-.971-.001-.569-.02-.971c-.03-.662-.544-1.156-1.21-1.182a32 32 0 0 0-1.273-.024c-.512 0-.934.01-1.274.024-.667.026-1.18.52-1.21 1.182q-.019.403-.02.97.001.569.02.972m2.041-1.749c.159 0 .311.05.424.137a.42.42 0 0 1 .175.33v.622a.42.42 0 0 1-.175.33.7.7 0 0 1-.424.136.7.7 0 0 1-.423-.137.42.42 0 0 1-.176-.33v-.621c0-.124.063-.242.176-.33a.7.7 0 0 1 .423-.137","clip-rule":"evenodd"}),20/24);break;case"bank_transfer":o=_(n.jsx("path",{fill:"currentColor",d:"M9.195 1.947a1.46 1.46 0 0 1 1.72 0l6.184 4.514c.814.593.629 1.463-.378 1.466H3.388C2.38 7.924 2.196 7.054 3.01 6.46zm.235 11.196a.2.2 0 0 1-.2.2H7.963a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2H9.23c.11 0 .2.09.2.2zm2.916 0a.2.2 0 0 1-.2.2H10.88a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2h1.267c.11 0 .2.09.2.2zm3.125 0a.2.2 0 0 1-.2.2h-1.475a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2h1.475c.11 0 .2.09.2.2zm-12.916 1.45v1.875c0 .346.28.625.625.625h13.75a.625.625 0 0 0 .625-.625v-1.875s-12.07-.128-15 0m3.958-1.45a.2.2 0 0 1-.2.2H4.838a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2h1.475c.11 0 .2.09.2.2z"}),20/24);break;case"online_banking":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M14.25 17.708a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5"}),n.jsx("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 13.958H18m-3.75-3.75a5.437 5.437 0 0 0 0 7.5 5.44 5.44 0 0 0 0-7.5"}),n.jsx("path",{fill:"currentColor",d:"M8.706 14.537c.15.97.574 1.848 1.188 2.556H3.18a.625.625 0 0 1-.625-.625v-1.875c1.115-.049 3.556-.06 6.151-.056M6.346 9.177c.092 0 .167.074.167.166v3.833a.167.167 0 0 1-.167.167H4.805a.167.167 0 0 1-.167-.167V9.343c0-.092.075-.166.167-.166zM9.263 9.177c.092 0 .167.074.167.166v1.69a5.1 5.1 0 0 0-.767 2.31H7.93a.167.167 0 0 1-.167-.167V9.343c0-.092.075-.166.167-.166zM11.484 9.177q-.428.21-.804.495v-.329c0-.092.074-.166.166-.166zM10.055 1.667c.309 0 .61.098.86.28l6.184 4.514c.814.593.629 1.463-.378 1.466H3.388c-1.007-.003-1.192-.873-.379-1.466l6.185-4.513c.25-.183.551-.281.86-.281"})]}),20/24);break;case"copy":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 9.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 7.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M10 2.5H12.5C12.6326 2.5 12.7598 2.55268 12.8536 2.64645C12.9473 2.74021 13 2.86739 13 3V13.5C13 13.6326 12.9473 13.7598 12.8536 13.8536C12.7598 13.9473 12.6326 14 12.5 14H3.5C3.36739 14 3.24021 13.9473 3.14645 13.8536C3.05268 13.7598 3 13.6326 3 13.5V3C3 2.86739 3.05268 2.74021 3.14645 2.64645C3.24021 2.55268 3.36739 2.5 3.5 2.5H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M5.5 4.5V4C5.5 3.33696 5.76339 2.70107 6.23223 2.23223C6.70107 1.76339 7.33696 1.5 8 1.5C8.66304 1.5 9.29893 1.76339 9.76777 2.23223C10.2366 2.70107 10.5 3.33696 10.5 4V4.5H5.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]}),16/24);break;case"dummy":o=_(n.jsx("path",{fill:"currentColor",d:"M17.5 11.875V15C17.5 15.3315 17.3683 15.6495 17.1339 15.8839C16.8995 16.1183 16.5815 16.25 16.25 16.25H3.75C3.41848 16.25 3.10054 16.1183 2.86612 15.8839C2.6317 15.6495 2.5 15.3315 2.5 15V11.875C2.5 11.5435 2.6317 11.2255 2.86612 10.9911C3.10054 10.7567 3.41848 10.625 3.75 10.625H16.25C16.5815 10.625 16.8995 10.7567 17.1339 10.9911C17.3683 11.2255 17.5 11.5435 17.5 11.875ZM16.25 3.75H3.75C3.41848 3.75 3.10054 3.8817 2.86612 4.11612C2.6317 4.35054 2.5 4.66848 2.5 5V8.125C2.5 8.45652 2.6317 8.77446 2.86612 9.00888C3.10054 9.2433 3.41848 9.375 3.75 9.375H16.25C16.5815 9.375 16.8995 9.2433 17.1339 9.00888C17.3683 8.77446 17.5 8.45652 17.5 8.125V5C17.5 4.66848 17.3683 4.35054 17.1339 4.11612C16.8995 3.8817 16.5815 3.75 16.25 3.75Z"}),20/24);break;default:throw new Error(`Icon with name ${t} does not exist`)}return n.jsx("svg",{className:`xendit-icon ${e.className??""}`,width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"none",children:n.jsx("g",{transform:r,children:o})})};function _(e,t){return n.jsx("g",{transform:`scale(${1/t} ${1/t})`,children:e})}const f=e=>{const{id:i,title:r,iconName:o,subtitle:s,disabled:l,open:d,onClick:c,children:u}=e,h=d?"up":"down",p=t.useCallback(()=>{l||c(i)},[l,c,i]),_=t.useCallback(e=>{"Enter"!==e.key&&" "!==e.key||(p(),e.preventDefault())},[p]),f=t.useCallback(()=>{p()},[p]);return n.jsxs("div",{className:a("xendit-accordion-item",l?"xendit-accordion-item-disabled":"",d?"xendit-accordion-item-open":"xendit-accordion-item-closed"),children:[n.jsxs("div",{className:"xendit-accordion-item-header",onClick:f,onKeyDown:_,role:"button",tabIndex:l?-1:0,children:[n.jsx(m,{className:"xendit-accordion-item-header-icon",name:o,size:24}),n.jsxs("div",{className:"xendit-accordion-item-header-title xendit-text-16 xendit-text-bold",children:[r,s?n.jsx("div",{className:"xendit-accordion-item-header-subtitle xendit-text-14",children:s}):null]}),n.jsx(m,{className:"xendit-accordion-item-chevron",name:"chevron",size:24,direction:h})]}),n.jsx("div",{className:"xendit-accordion-item-content",inert:!d,children:n.jsx("div",{className:"xendit-accordion-item-padding",children:u})})]})},x=e.createContext(null);x.displayName="SessionContext";const b=e.createContext(null);b.displayName="BusinessContext";const y=e.createContext(void 0);y.displayName="CustomerContext";const g=e.createContext(null);g.displayName="ChannelsContext";const v=e.createContext(null);v.displayName="ChannelUiGroupsContext";const k=e.createContext(null);k.displayName="DigitalWalletsContext";const w=e.createContext(null);w.displayName="SdkContext";const C=e.createContext(null);C.displayName="CurrentChannelContext";const E=()=>{const e=t.useContext(x);if(null===e)throw new Error("useSession must be used within a XenditSessionProvider");return e},N=()=>{const e=t.useContext(g);if(null===e)throw new Error("useChannels must be used within a XenditSessionProvider");return e},A=()=>t.useContext(k),S=()=>{const e=t.useContext(w);if(null===e)throw new Error("useSdk must be used within a XenditSessionProvider");return e},P=()=>t.useContext(C),R=({children:e,data:t,sdk:a})=>{const{session:i,business:r,customer:o,channels:s,digitalWallets:l,channelUiGroups:d}=t,c=a.getCurrentChannel()?.[h]?.[0]??null;return"ACTIVE"!==a.getSdkStatus()||"ACTIVE"!==i.status?null:n.jsx(w.Provider,{value:a,children:n.jsx(C.Provider,{value:c,children:n.jsx(x.Provider,{value:i,children:n.jsx(b.Provider,{value:r,children:n.jsx(y.Provider,{value:o,children:n.jsx(g.Provider,{value:s,children:n.jsx(k.Provider,{value:l,children:n.jsx(v.Provider,{value:d,children:e})})})})})})})})},j=300;function I(e){if(!e)throw new Error("Assertion failed: argument is null or undefined; this is a bug, please contact support.")}function T(e){if(!Array.isArray(e))throw new Error("Assertion failed: expected array; this is a bug, please contact support.")}function q(e){if(Array.isArray(e))throw new Error("Assertion failed: expected array; this is a bug, please contact support.")}function D(e,n){if(e!==n)throw new Error("Assertion failed; this is a bug, please contact support.")}function L(e){return new Promise(n=>setTimeout(n,1*e))}class AbortError extends Error{constructor(){super("AbortError"),this.name="AbortError"}}function M(e){return e instanceof AbortError&&"AbortError"===e.name}function O(e,n){return new Promise((t,a)=>{function i(){n.removeEventListener("abort",i),clearTimeout(r),a(new AbortError)}const r=setTimeout(()=>{n.removeEventListener("abort",i),t()},1*e);n.aborted?i():n.addEventListener("abort",i)})}function U(e){const n=e.find(e=>{switch(e.type){case"REDIRECT_CUSTOMER":switch(e.descriptor){case"WEB_URL":return!0;case"DEEPLINK_URL":return function(){const e=navigator.userAgent;if(!e)return!1;if(/android/i.test(e))return!0;if(/iPad|iPhone|iPod/.test(e))return!0;return!1}();case"WEB_GOOGLE_PAYLINK":return!1}break;case"PRESENT_TO_CUSTOMER":return!0;case"API_POST_REQUEST":return!1}return!1});return n||e[0]}function B(e,n){if(e[h].options.enablePaylinks)return n.find(e=>"REDIRECT_CUSTOMER"===e.type&&"WEB_GOOGLE_PAYLINK"===e.descriptor)}const V="mock",K={pl:"https://checkout-ui-gateway.xendit.co",pd:"https://checkout-ui-gateway-prod-dev.xendit.co",sl:"https://checkout-ui-gateway-live.stg.tidnex.dev",sd:"https://checkout-ui-gateway-dev.stg.tidnex.dev"};function z(e){return K[e]??null}function W(e,n){const t={...e};for(const e of Object.keys(n)){const a=n[e];void 0!==a&&(t[e]=a)}return t}function F(e){const n=t.useRef();return t.useLayoutEffect(()=>{n.current=e}),n.current}function X(e){let n;if("string"==typeof e.channel_property)n=e.channel_property;else{n=Object.values(e.channel_property).join("__")}return n}const H=Math.floor(255*Math.random());function G(e){return`xendit-id-${X(e).split("").map(e=>(e.charCodeAt(0)%256^H).toString(16)).join("")}`}function $(e){I(e%2==0);const n=function(e){const n=new Uint8Array(e);for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}(e/2);return Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}function Y(){return[$(8),$(4),$(4),$(4),$(12)].join("-")}function Z(){return`xendit-id-${t.useRef($(12)).current}`}function Q(e){return"PRESENT_TO_CUSTOMER"===e.type}function J(e){if(e instanceof Error)return e.stack??e.message;if("string"==typeof e)return e;try{return`Unknown error: ${JSON.stringify(e)}`}catch{return"Unknown error"}}function ee(e){for(const n of Object.keys(e)){if("symbol"==typeof n)continue;const t=Object.getOwnPropertyDescriptor(e,n);void 0!==t&&("function"!=typeof t.get&&void 0===t.value&&delete e[n])}return e}function ne(e,n){let t=e;if(!n)return;if(Array.isArray(t))throw new Error("Getting values from channel property arrays is not supported.");let a=n;for(;;){if(!a||"object"!=typeof a||Array.isArray(a))return;const e=t.indexOf(".");if(-1===e)return a?a[t]:void 0;{const n=t.slice(0,e);a=a?a[n]:void 0,t=t.slice(e+1)}}}function te(e){const n=ne("card_details.card_number",e);return"string"!=typeof n?null:n}function ae(e){const n={version:0,publicKey:"",iv:"",cipherText:"",valid:!1,validationError:null,withoutValidationError:e};if(!e)return n;const t=e.split("-");if(t.length<6)throw new Error("Invalid encrypted field value format.");if("xendit"!==t[0])throw new Error("Invalid encrypted field value format.");if("encrypted"!==t[1])throw new Error("Invalid encrypted field value format.");const a=parseInt(t[2],10);if(isNaN(a)||a<=0)throw new Error("Invalid encrypted field value format.");if(n.version=a,n.publicKey=t[3],n.iv=t[4],n.cipherText=t[5],t.length>6){if("invalid"!==t[6])throw new Error("Invalid encrypted field value format.");n.validationError=atob(t[7]),n.withoutValidationError=t.slice(0,6).join("-")}else n.valid=!0;return n}const ie=new WeakMap;let re=1;function oe(e,n){return I(e.length>0),I(e.length<=2),2===e.length?n?(I(!0===e[1].allow_save),e[1]):(I(!1===e[0].allow_save),e[0]):e[0]}function se(e,n){if("PAY"!==e.session_type)return!0;const t=e.amount,a=n.min_amount??0,i=n.max_amount??Number.MAX_VALUE;return!(t<a||t>i)}function le(e){Object.defineProperty(e,h,{enumerable:!1,writable:!1,configurable:!1,value:e[h]})}const de={CARDS:!0,QRIS:!0,QR_PH:!0,PROMPTPAY:!0,SGQR:!0,ALIPAY:!0,APPOTA:!0,ASTRAPAY:!0,DANA:!0,GCASH:!0,GRABPAY:!0,JENIUSPAY:!0,LINEPAY:!0,LINKAJA:!0,NEXCASH:!0,OVO:!0,PAYMAYA:!0,SHOPEEPAY:!0,TOUCHNGO:!0,TRUEMONEY:!0,VNPTWALLET:!0,WECHATPAY:!0,ZALOPAY:!0,GOPAY:!0,GOPAY_RECURRING:!0};function ce(e,n){for(const t of e)if(t.type.name===n)return!0;return!1}var ue,he;!function(e){e.BARE="bare",e.PRIMARY_ROUNDED="primary-rounded",e.WHITE_ROUNDED="white-rounded"}(ue||(ue={})),function(e){e.SM="sm",e.MD="md"}(he||(he={}));const pe=e=>{const{children:t,variant:i,size:r,type:o="button",...s}=e,l={[ue.BARE]:void 0,[ue.PRIMARY_ROUNDED]:"xendit-button-primary-rounded",[ue.WHITE_ROUNDED]:"xendit-button-white-rounded"}[i],d={[he.SM]:"xendit-button-sm",[he.MD]:void 0}[r??he.MD];return n.jsx("button",{...s,className:a(e.className,"xendit-button",l,d),type:o,children:t})},me=()=>{const e=.4*Math.PI,t=.4,a=Math.cos(e)*t,i=Math.sin(e)*t,r=Math.cos(0)*t,o=Math.sin(0)*t;return n.jsx("svg",{className:"xendit-button-loading-spinner",viewBox:"-0.5 -0.5 1 1",children:n.jsx("path",{d:`M ${a} ${i} A 0.4 0.4 0 0 0 ${r} ${o}`,fill:"none",stroke:"currentColor",strokeWidth:"0.1",strokeLinecap:"round"})})},_e=e=>{const{id:a,options:i,onChange:r,defaultIndex:o=-1,selectedIndex:s,placeholder:l,disabled:d,className:c,fixedOverlayWidth:u,enableSearch:h}=e,p=S().t,_=Z(),f=a||_,x="number"==typeof s,[b,y]=t.useState(o),g=x?s:b,[v,k]=t.useState(g>=0?g:0),[w,C]=t.useState(!1),E=w&&!d&&i.length>0,[N,A]=t.useState(""),[P,R]=t.useState(0),j=t.useRef(null),I=t.useRef(null),T=t.useRef(null),q=t.useRef(null),D=t.useRef(null),L=t.useRef(null),M=t.useMemo(()=>{const e=i.map(ye).filter(({item:e})=>{if(""===N.trim())return!0;const n=N.toLowerCase();return e.title.toLowerCase().includes(n)||e.description?.toLowerCase().includes(n)||e.value.toLowerCase().includes(n)});return e.length>0?e:i.map(ye)},[N,i]),O=Math.max(0,Math.min(M.length-1,v));t.useLayoutEffect(()=>{if(u)return void R(u);const e=j.current;if(!e)return;const n=e.getBoundingClientRect().width;if(R(n),!window.ResizeObserver)return;const t=new ResizeObserver(n=>{for(const t of n)t.target===e&&t.borderBoxSize?.length&&R(t.borderBoxSize[0].inlineSize)});return t.observe(e),()=>t.disconnect()},[u]),t.useLayoutEffect(()=>{if(!E)return;const e=L.current;if(!e)return;const n=j.current;if(!n)return;if(!window.ResizeObserver)return;function t(){if(!e)return;if(!n)return;const t=n.getBoundingClientRect(),a=e.getBoundingClientRect();window.innerHeight-t.bottom<a.height?(e.style.position="fixed",e.style.bottom="0"):(e.style.position="",e.style.bottom="")}t();const a=new ResizeObserver(t);return a.observe(e),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{a.disconnect(),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[E]),t.useLayoutEffect(()=>{if(!E)return;const e=e=>{const n=I.current;n&&(n.contains(e.target)||C(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E]),t.useLayoutEffect(()=>{if(!E)return;const e=e=>{const n=I.current;n&&e.relatedTarget&&(n.contains(e.relatedTarget)||C(!1))};return document.body.addEventListener("focusout",e),()=>document.body.removeEventListener("focusout",e)},[E]),t.useLayoutEffect(()=>{E&&g>=0&&k(g)},[E,g]),t.useLayoutEffect(()=>{if(!E)return;if(!q.current)return;if(!T.current)return;const e=T.current.parentElement;e&&(e.scrollTop=q.current.offsetTop-e.clientHeight/2+q.current.clientHeight/2)},[E,v]);const U=t.useCallback(()=>{E||(C(!0),queueMicrotask(()=>D.current?.focus()))},[E]),B=t.useCallback(()=>{E&&(C(!1),A(""),j.current?.focus())},[E]),V=t.useCallback(()=>{E?B():U()},[B,E,U]),K=t.useCallback(e=>{const n=i[e];n&&(n.disabled||(x||y(e),r(n,e),B()))},[B,x,r,i]),z=t.useCallback(e=>{const n=e.target===D.current;if("Escape"===e.key)return e.preventDefault(),void B();if("Enter"===e.key||" "===e.key){if(n&&" "===e.key)return;e.preventDefault();const t=M[O];return void(t&&K(t.originalIndex))}return"ArrowDown"===e.key?(e.preventDefault(),void k(e=>Math.min(M.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),void k(e=>Math.max(0,e-1))):"Home"===e.key?(e.preventDefault(),void k(0)):"End"===e.key?(e.preventDefault(),void k(M.length-1)):void 0},[O,B,K,M]),W=t.useCallback(e=>{if(E)return z(e);"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),U())},[z,E,U]),F=t.useCallback(e=>{e.stopPropagation(),e.preventDefault(),K(Number(e.currentTarget.dataset.index))},[K]),X=t.useCallback(e=>{A(e.currentTarget.value),k(0)},[]),H=g>=0?i[g]:void 0;return n.jsxs("div",{className:"xendit-dropdown-container",ref:I,style:{"--xendit-dropdown-width":P+"px"},children:[n.jsxs("button",{id:f,ref:j,type:"button",className:`xendit-dropdown ${c} ${E?"xendit-dropdown-open":""} ${xe(H)?"xendit-dropdown-has-asset":""}`,"aria-expanded":E?"true":"false",onClick:V,onKeyDown:W,disabled:d,children:[H?.leadingAsset??null,H?n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:H.shortTitle??H.title}):n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:l}),n.jsx(m,{className:"xendit-dropdown-chevron",name:"chevron",size:16,direction:"down"})]}),E?n.jsxs("div",{className:"xendit-dropdown-overlay",style:{width:"var(--xendit-dropdown-width)"},ref:L,children:[h?n.jsx("div",{className:"xendit-dropdown-search",children:n.jsx("input",{ref:D,placeholder:p("combobox.default_search_placeholder"),value:N,onInput:X,onClick:be,onKeyDown:z})}):null,n.jsx("ul",{ref:T,role:"listbox",tabIndex:-1,onKeyDown:z,children:M.map(({item:e,originalIndex:t},a)=>{const i=t===g,r=a===O;return n.jsx("li",{role:"option","data-index":t,"aria-disabled":!!e.disabled||void 0,"aria-selected":i,onClick:F,ref:r?q:void 0,children:n.jsxs("div",{className:`xendit-dropdown-item xendit-text-14 ${r?"xendit-dropdown-item-active":""} ${e.leadingAsset?"xendit-dropdown-has-asset":""} ${e.disabled?"xendit-dropdown-item-disabled":""}`,children:[e.leadingAssetInOverlay??e.leadingAsset??null,n.jsxs("div",{className:"xendit-dropdown-item-text xendit-text-14",children:[n.jsx("span",{className:"xendit-dropdown-item-title",children:e.title}),e.description&&n.jsx("span",{className:"xendit-dropdown-item-description xendit-text-12",children:e.description})]}),i?n.jsx(m,{name:"check",size:16,className:"xendit-dropdown-item-selected"}):null]})},t)})})]}):null]})},fe=e=>n.jsx("div",{className:"xendit-dropdown-container xendit-skeleton-field",children:n.jsx("button",{className:`xendit-dropdown ${e.className}`,inert:!0,id:e.id,disabled:!0,type:"button",children:n.jsx(me,{})})});function xe(e){return!!e&&!(!e.leadingAssetInOverlay&&!e.leadingAsset)}function be(e){e.stopPropagation()}function ye(e,n){return{item:e,originalIndex:n}}function ge(e){return function(e,n){if(e===n)throw new Error("Assertion failed; this is a bug, please contact support.")}(e.session_type,"AUTHORIZATION"),D(e.mode,"COMPONENTS"),ee({id:e.payment_session_id,description:e.description||void 0,sessionType:e.session_type,mode:e.mode,referenceId:e.reference_id,country:e.country,currency:e.currency,amount:e.amount,channelProperties:e.channel_properties||void 0,expiresAt:new Date(e.expires_at),locale:e.locale,status:e.status,subscription:e.subscription?{immediatePayment:e.subscription.immediate_payment,schedule:{anchorDate:new Date(e.subscription.schedule.anchor_date),interval:e.subscription.schedule.interval,intervalCount:e.subscription.schedule.interval_count,retryInterval:e.subscription.schedule.retry_interval,retryIntervalCount:e.subscription.schedule.retry_interval_count,totalRecurrence:e.subscription.schedule.total_recurrence,totalRetry:e.subscription.schedule.total_retry}}:void 0,items:e.items?.map(e=>ee({type:e.type,referenceId:e.reference_id,name:e.name,netUnitAmount:e.net_unit_amount,quantity:e.quantity,url:e.url,imageUrl:e.image_url,category:e.category,subcategory:e.subcategory,description:e.description,metadata:e.metadata}))})}function ve(e,n,t,a){const i=ee({groupId:e.id,label:e.label,get channels(){return(n[e.id]||[]).map(e=>we(e,n,t,a))},[h]:e});return le(i),i}function ke(e,n){return we(e,{},{},n)}function we(e,n,t,a){I(!a.pairChannels.paired[e.channel_code]);const i=ee({channelCode:a.pairChannels.pairs[e.channel_code]?.map(e=>e.channel_code)??e.channel_code,brandName:e.brand_name,brandColor:e.brand_color,brandLogoUrl:e.brand_logo_url,get uiGroup(){if(!t[e.ui_group])throw new Error("UI group not found");return ve(t[e.ui_group],n,t,a)},minAmount:e.min_amount,maxAmount:e.max_amount,cardBrands:e.card?.brands.map(e=>({name:e.name,logoUrl:e.logo_url})),[h]:a.pairChannels.pairs[e.channel_code]??[e]});return le(i),i}function Ce(e){const n={};for(const t of e)n[t.id]=t;return n}function Ee(e,n){if(n.pairChannels.paired[e.channel_code])return!1;if(n.options.filterMinMax&&!se(n.session,e))return!1;const t=n.options.filter;return!(t&&!function(e,n){if("string"==typeof e&&n===e)return!0;if(Array.isArray(e)&&e.includes(n))return!0;if(e instanceof RegExp&&e.test(n))return!0;return!1}(t,e.channel_code))}function Ne(e,n){const t={};for(const a of e){if(!Ee(a,n))continue;const e=a.ui_group;t[e]||(t[e]=[]),t[e].push(a)}return t}function Ae(e){const n=new Map;for(const t of e){const e=t.brand_name;n.has(e)||n.set(e,[]),n.get(e).push(t)}const t={},a={};for(const[e,i]of n)for(const e of i){if(!1===i[0].allow_save){const n=i.find(n=>e.channel_code!==n.channel_code&&e.ui_group===n.ui_group&&!0===n.allow_save);n&&(t[e.channel_code]=[e,n],a[n.channel_code]=!0)}}return{pairs:t,paired:a}}const Se=e=>n.jsx("hr",{className:"xendit-dotted-line"}),Pe=e=>{const{group:a,open:i}=e,r=S(),{t:o}=r,s=E(),l=N(),d=P(),c=s.session_type,u=Z(),[h,p]=t.useState(null),m=t.useRef(null),[_,f]=t.useState(!1),x=t.useRef(null),b=t.useMemo(()=>Ae(l),[l]),y=t.useMemo(()=>({pairChannels:b,session:{amount:s.amount,session_type:s.session_type},options:{filterMinMax:!1}}),[b,s.amount,s.session_type]),g=t.useMemo(()=>l.filter(e=>Ee(e,y)&&e.ui_group===a.id),[l,a.id,y]);t.useLayoutEffect(()=>{if(!m.current)return;if(!d)return;if(!i)return;g.find(e=>e.channel_code===d.channel_code)&&(x.current=r.createChannelComponent(ke(d,y)),x.current.parentElement!==m.current&&(f(!0),m.current.replaceChildren(x.current)))},[g,d,y,i,r]);const v=F(i);t.useLayoutEffect(()=>{if(i&&!v&&null===d&&null!==h){const e=g.find(e=>e.channel_code===h);e&&r.setCurrentChannel(ke(e,y))}},[g,d,h,y,i,v,r]);const k=t.useCallback(e=>{const n=l.find(n=>n.channel_code===e.value)||null;p(n?.channel_code??null),r.setCurrentChannel(n?ke(n,y):null)},[l,y,r]),w=t.useMemo(()=>g.map(e=>({leadingAsset:n.jsx("img",{className:"xendit-dropdown-channel-logo",src:e.brand_logo_url},e.channel_code),leadingAssetInOverlay:n.jsx("img",{className:"xendit-channel-logo",src:e.brand_logo_url},e.channel_code),title:e.brand_name,value:e.channel_code,disabled:!se(s,e),description:Re(o,s,e)||void 0})),[g,s,o]),C=1===g.length&&"CARDS"===g[0].channel_code;return n.jsxs("div",{className:"xendit-channel-picker-group",children:[C?null:n.jsxs("div",{className:"xendit-channel-form-field-group",children:[n.jsx("label",{htmlFor:u,className:"xendit-text-14",children:"SAVE"===c?o("payment_methods.add_payment_method",{groupName:a.label??"",ns:"session"}):o("payment_methods.pay_with")}),n.jsx(_e,{id:u,selectedIndex:function(){const e=w.findIndex(e=>e.value===d?.channel_code);if(-1!==e)return e;const n=w.findIndex(e=>e.value===h);return-1!==n?n:1===w.length?0:-1}(),options:w,disabled:w.length<=1,onChange:k,placeholder:o("payment_methods.select_channel_placeholder",{groupName:a.label,ns:"session"})})]}),!C&&_?n.jsx(Se,{}):null,n.jsx("div",{style:{display:_?"":"none"},ref:m})]})};function Re(e,n,t){return se(n,t)?null:t.min_amount&&n.amount<t.min_amount?e("payment_methods.channel_disabled_amount_too_small"):e("payment_methods.channel_disabled_amount_too_large")}const je=e=>{const{onReady:a,options:i}=e,r=S(),o=r.t,s=E(),l=(()=>{const e=t.useContext(b);if(null===e)throw new Error("useBusiness must be used within a XenditSessionProvider");return e})(),d=N(),c=A(),u=c?.google_pay;I(u);const h=t.useRef(!1),p=t.useRef(null),m=t.useRef(null),_=t.useMemo(()=>u.allowed_payment_methods.filter(e=>{const n=d.find(n=>n.channel_code===e.channel_code);if(!n)throw new Error("Channel found in Google Pay config not found in channels list");return se(s,n)}).map(e=>e.payment_method_specification),[u.allowed_payment_methods]),f=t.useMemo(()=>({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:_,emailRequired:!0,merchantInfo:{merchantId:u.merchant_id,merchantName:l.name??""},transactionInfo:{transactionId:s.payment_session_id,totalPriceStatus:"FINAL",totalPrice:String(s.amount),currencyCode:s.currency}}),[l.name,u.merchant_id,_,s.amount,s.currency,s.payment_session_id]),x=t.useMemo(()=>({buttonColor:"default",buttonType:"plain",buttonRadius:999,buttonSizeMode:"fill",buttonBorderType:"no_border",...i}),[i]);t.useLayoutEffect(()=>{const e=window.google?.payments?.api?.PaymentsClient;if(!e)return void console.error("XenditComponents: Google Pay button was requested but the Google Pay SDK is not loaded.");const n=r.isMock()||r.isDevelopmentEnv();m.current=new e({environment:n?"TEST":"PRODUCTION"})},[r]);const y=t.useCallback(()=>{I(m.current),m.current.loadPaymentData(f).then(function(e){const n=function(e){I(u);const n=r.getActiveChannels();for(const t of u.allowed_payment_methods)if(t.payment_method_specification.type===e.paymentMethodData.type)return Ie(n,t.channel_code);throw new Error(`No matching channel found for selected Google Pay payment method ${e.paymentMethodData.type}`)}(e);I(n);let t={};"CARDS"===n.channelCode&&(t={google_pay:JSON.stringify(e)}),r.submitDigitalWallet("GOOGLE_PAY",n,t)}).catch(function(e){const n=e.statusCode??"UNKNOWN_ERROR";if("CANCELED"===n)return;function t(e,n){return`google_pay_errors.${e.toLowerCase()}.${n}`}const a={code:`GOOGLE_PAY_${n}`,text:[o(t(n,"title"),o("google_pay_errors.unknown_error.title")),o(t(n,"message"),o("google_pay_errors.unknown_error.message",{statusCode:n}))]},i=u.allowed_payment_methods[0];I(i);const s=Ie(r.getActiveChannels(),i.channel_code);r.submitDigitalWallet("GOOGLE_PAY",s,{},a)})},[u,f,r,o]);return t.useLayoutEffect(()=>{m.current&&(h.current||0!==_.length&&m.current.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:_}).then(function(e){e.result&&(h.current||(h.current=!0,a()))}).catch(function(e){console.error("XenditComponents: Error when checking if Google Pay is ready",e)}))},[_,a]),t.useLayoutEffect(()=>{if(!m.current)return;if(0===_.length)return;const e=m.current.createButton({...x,buttonLocale:s.locale,allowedPaymentMethods:_,onClick:y});p.current&&p.current.replaceChildren(e)},[x,_,y,s.locale]),n.jsx("div",{ref:p})};function Ie(e,n){const t=e.find(e=>Array.isArray(e.channelCode)?e.channelCode.includes(n):e.channelCode===n);if(!t)throw new Error(`Channel not found for code: ${n}`);return t}const Te=e=>{const{scriptTagRegex:n,checkLoaded:a,children:i}=e,[,r]=t.useState({}),o=a();return t.useLayoutEffect(()=>{if(o)return;const e=Array.from(document.scripts).find(e=>n.test(e.src));if(e){const n=()=>{r({})};return e.addEventListener("load",n),()=>{e.removeEventListener("load",n)}}},[r,o,n]),t.useLayoutEffect(()=>{if(!o){const e=setTimeout(()=>{r({})},1e3);return()=>clearTimeout(e)}}),o?i:null},qe=e=>{const{digitalWalletCode:a,digitalWalletOptions:i}=e,r=t.useRef(null),o=t.useCallback(()=>{r.current&&(r.current.parentElement?.style.setProperty("display","block"),r.current.dispatchEvent(new InternalDigitalWalletReady(a)))},[a]);let s=null;if("GOOGLE_PAY"===a)s=n.jsx(Te,{scriptTagRegex:De.GOOGLE_PAY.scriptTagRegex,checkLoaded:De.GOOGLE_PAY.checkLoaded,children:n.jsx(je,{onReady:o,options:i})});return n.jsx("div",{ref:r,children:s})},De={GOOGLE_PAY:{scriptTagRegex:/https:\/\/pay.google.com\/.*\/js\/pay.js/,checkLoaded:()=>"undefined"!=typeof google&&void 0!==google.payments}};class InternalDigitalWalletReady extends Event{digitalWalletCode;static type="xendit-internal-digital-wallet-ready";constructor(e){super(InternalDigitalWalletReady.type,{bubbles:!0}),this.digitalWalletCode=e}}const Le=e=>{const a=S(),i=t.useRef(null),r=A(),o=r?.google_pay,[s,l]=t.useState(!1);return t.useLayoutEffect(()=>{if(i.current&&o){const e=a.createDigitalWalletComponent("GOOGLE_PAY");return i.current.appendChild(e),()=>{e.remove()}}},[o,a]),t.useLayoutEffect(()=>{i.current&&i.current.addEventListener(InternalDigitalWalletReady.type,e=>{l(!0)})},[]),n.jsx("div",{ref:i,className:s?"xendit-channel-picker-digital-wallet-section":void 0})},Me=e=>{const a=S(),i=E(),r=(()=>{const e=t.useContext(v);if(null===e)throw new Error("useChannelUiGroups must be used within a XenditSessionProvider");return e})(),o=P(),s=N(),{t:l}=S(),d=t.useMemo(()=>Ne(s,{options:{filterMinMax:!1},pairChannels:Ae(s),session:i}),[s,i]),c=t.useRef(null),u=t.useMemo(()=>Ae(s),[s]),m=t.useMemo(()=>({pairChannels:u,session:{amount:i.amount,session_type:i.session_type},options:{filterMinMax:!1}}),[u,i.amount,i.session_type]),_=o?.ui_group??null,[x,b]=t.useState(null),y=t.useCallback(e=>{if(_===e||x===e)_===e&&c.current?.dispatchEvent(new XenditClearCurrentChannelEvent(e)),x===e&&b(null);else{const n=r.find(n=>n.id===e);I(n);const t=Oe(i,n,s,l).enabledChannels;if(0===t)return;if(1===t){const n=d[e][0];a.setCurrentChannel(ke(n,m)),b(null)}else b(e),a.setCurrentChannel(null)}},[r,s,d,m,x,a,_,i,l]);t.useLayoutEffect(()=>{null!==o&&null!==x&&b(null)},[o,x]);const g=a[h].options.enableDigitalWallets??!1;return n.jsxs("div",{ref:c,children:[g?n.jsx(Le,{}):null,n.jsx(p,{children:r.filter(e=>(d[e.id]||[]).length>0).map(e=>{const t=null!==_?_===e.id:x===e.id,a=Oe(i,e,s,l),r=0===a.enabledChannels,c=a.firstDisabledChannelReason;return n.jsx(f,{id:e.id,title:e.label,iconName:Be(_===e.id?o:null,d[e.id]),subtitle:c??void 0,open:t,disabled:r,onClick:y,children:n.jsx(Pe,{group:e,open:t})},e.id)})})]})};function Oe(e,n,t,a){let i=null,r=0;for(const o of t)o.ui_group===n.id&&(se(e,o)?r++:null===i&&(i=Re(a,e,o)));return{enabledChannels:r,firstDisabledChannelReason:i}}const Ue={CARDS:"card",QR_CODE:"qr",OVER_THE_COUNTER:"otc",EWALLET:"ewallet",BANK_TRANSFER:"bank_transfer",DIRECT_DEBIT:"bank_transfer",VIRTUAL_ACCOUNT:"bank_transfer",ONLINE_BANKING:"online_banking"};function Be(e,n){if(e&&e.pm_type&&Ue[e.pm_type])return Ue[e.pm_type];for(const e of n)if(e.pm_type&&Ue[e.pm_type])return Ue[e.pm_type];return"dummy"}class XenditClearCurrentChannelEvent extends Event{static type="xendit-clear-current-channel";uiGroup;constructor(e){super(XenditClearCurrentChannelEvent.type,{bubbles:!0,composed:!0}),this.uiGroup=e}}const Ve=({countryCode:e,size:t=16})=>n.jsx("div",{style:{width:`${t}px`,height:`${t}px`,borderRadius:"50%",backgroundImage:`url(https://assets.xendit.co/payment-session/flags/circle/${e.toLowerCase()}.svg)`,backgroundSize:"cover",backgroundPosition:"center"}}),Ke=e=>{const{field:a,onChange:i}=e,r=G(a),o=X(a),[s,l]=t.useState(void 0),d=ze.findIndex(e=>e.value===s),c=t.useRef(null);We(e=>{if(c.current){const n=ze.find(n=>n.value===e);n&&u(n)}});const u=t.useCallback(e=>{l(e.value),c.current&&(c.current.value=e.value),i()},[i]);return n.jsxs("div",{children:[n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:c}),n.jsx(_e,{id:r,options:ze,onChange:u,placeholder:a.placeholder,selectedIndex:d,enableSearch:!0,className:"xendit-form-field-inner"})]})},ze=i.getCountries().map(e=>({title:new Intl.DisplayNames(["en"],{type:"region"}).of(e),value:e,leadingAsset:n.jsx(Ve,{countryCode:e})})).sort((e,n)=>e.title.localeCompare(n.title));function We(e){const n=dt()?.cardDetails,a=n?.details?.country_codes[0],i=F(a);t.useLayoutEffect(()=>{a&&a!==i&&e(a)})}const Fe=e=>{const{field:a,onChange:i}=e,r=G(a),o=X(a);if(!function(e){return"dropdown"===e.type.name}(a))throw new Error("DropdownField expects field.type.name to be 'dropdown'");const s=t.useRef(null),l=t.useMemo(()=>a.type.options.map(e=>({title:e.label,description:e.subtitle,value:e.value})),[a.type.options]),[d,c]=t.useState(l[0]?.value??""),u=t.useCallback(e=>{s.current&&(s.current.value=e.value),c(e.value),i()},[i]);t.useLayoutEffect(()=>{l.length&&u(l[0])},[]);const h=l.findIndex(e=>e.value===d);return n.jsxs(n.Fragment,{children:[n.jsx(_e,{id:r,placeholder:a.placeholder,options:l,onChange:u,selectedIndex:h,className:"xendit-form-field-inner"}),n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:s})]})};const Xe="undefined"!=typeof window&&window.HTMLElement?window.HTMLElement:EventTarget;class XenditFormAssociatedFocusTrap extends Xe{static tag="xendit-form-associated-focus-trap";static formAssociated=!0;internals;constructor(){super(),this.internals=this.attachInternals()}}var He;He=XenditFormAssociatedFocusTrap,"undefined"!=typeof window&&window.customElements&&customElements.define(He.tag,He);class InternalUpdateWorldState extends Event{data;static type="xendit-update-world-state";constructor(e){super(InternalUpdateWorldState.type,{bubbles:!1}),this.data=e}}class InternalUpdateChannelComponentData extends Event{channelCode;data;static type="xendit-update-channel-component-data";constructor(e,n){super(InternalUpdateChannelComponentData.type,{bubbles:!1}),this.channelCode=e,this.data=n}}class InternalSetFieldTouchedEvent extends Event{static type="xendit-internal-set-field-touched";constructor(){super(InternalSetFieldTouchedEvent.type,{bubbles:!0})}}class InternalBehaviorTreeUpdateEvent extends Event{static type="xendit-internal-behavior-tree-update";constructor(){super(InternalBehaviorTreeUpdateEvent.type,{})}}class InternalNeedsRerenderEvent extends Event{static type="xendit-internal-needs-rerender";constructor(){super(InternalNeedsRerenderEvent.type,{})}}class InternalScheduleMockUpdateEvent extends Event{mockData;static type="xendit-internal-schedule-mock-update";constructor(e){super(InternalScheduleMockUpdateEvent.type,{}),this.mockData=e}}const Ge=e.createContext(null);I("https://assets.xendit.co/components/secure-iframe-v0.0.22.html");const $e=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.22.html").origin,Ye=({children:e})=>{const a=t.useRef(new Map),i={registerIframe:(e,n)=>{n.current&&a.current.set(e,n.current)},unregisterIframe:e=>a.current.delete(e),postMessageToIframe:(e,n)=>{const t=a.current.get(e);t?.contentWindow&&t.contentWindow.postMessage(n,$e)}};return n.jsx(Ge.Provider,{value:i,children:e})};I("https://assets.xendit.co/components/secure-iframe-v0.0.22.html");const Ze=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.22.html"),Qe=Ze.toString(),Je=Ze.origin,en=e=>{const{field:a,onChange:i}=e,r=S(),o=G(a),s=X(a),l=E(),d=t.useRef(null),c=t.useRef(null),[u,p]=t.useState(),[m,_]=t.useState(!1),[f,x]=t.useState(null),{card:b}=st()??{},y=t.useCallback(e=>{if(!d.current)return;const n=d.current.contentWindow;if(e.source!==n)return;if(e.origin!==Je)return;const t=e.data;switch(t.type){case"xendit-iframe-ready":p(t.ecdhPublicKey);break;case"xendit-iframe-change":{if(!c.current)return;x(t.cardBrand);const e=t.encrypted,n=1,a=e.map(e=>{if(t.empty)return"";const a=["xendit-encrypted",n,u,e.iv,e.value];return!t.valid&&t.validationErrorCodes.length&&a.push("invalid",btoa(t.validationErrorCodes[0].localeKey)),a.join("-")});if(0===a.length)break;c.current.value=a.length>1?JSON.stringify(a):a[0],i?.();break}case"xendit-iframe-focus":_(!0);break;case"xendit-iframe-blur":_(!1),c.current?.value&&c.current?.dispatchEvent(new InternalSetFieldTouchedEvent);break;case"xendit-iframe-failed-init":console.error(`Iframe field for ${a.channel_property} failed to initialize securely`)}},[a.channel_property,u,i]),g=t.useCallback(()=>{d.current?.contentWindow&&d.current.contentWindow.postMessage({type:"xendit-iframe-focus"},Je)},[]);t.useLayoutEffect(()=>(window.addEventListener("message",y),()=>{window.removeEventListener("message",y)}),[y]);const v=t.useContext(Ge);t.useLayoutEffect(()=>(v?.registerIframe(s,d),()=>v?.unregisterIframe(s)),[s,v]);const k=new URL(Qe);k.searchParams.set("input_type",a.type.name),k.searchParams.set("embedder",window.location.origin),k.searchParams.set("session_id",l.payment_session_id),k.searchParams.set("pk",r[h].sdkKey.publicKey),k.searchParams.set("sig",r[h].sdkKey.signature),r[h].options.iframeFieldAppearance&&k.searchParams.set("appearance",JSON.stringify(r[h].options.iframeFieldAppearance));const w=m?"xendit-field-focus":"";return n.jsxs("div",{className:`xendit-iframe-container xendit-form-field-inner ${w}`,children:[n.jsx(XenditFormAssociatedFocusTrap.tag,{id:o,onFocus:g,tabIndex:-1}),n.jsx("input",{type:"hidden",name:s,defaultValue:"",ref:c}),n.jsx("iframe",{src:k.toString(),ref:d,sandbox:"allow-scripts allow-same-origin"}),"credit_card_number"===a.type.name&&b&&n.jsx(nn,{cardsBrandList:b.brands,selectedCardBrand:f})]})},nn=({cardsBrandList:e,selectedCardBrand:t})=>{if(!e)return null;const a=e.find(e=>e.name===t)?.logo_url;return n.jsx("div",{className:"xendit-card-brands-list",children:t?a&&n.jsx("img",{className:"xendit-card-brand-logo",src:a,alt:t}):e.map(({name:e,logo_url:t})=>n.jsx("img",{className:"xendit-card-brand-logo",src:t,alt:e},e))})},tn=e=>{const{field:a,onChange:s}=e,l=G(a),d=X(a),c=E(),u=t.useRef(null),[h,p]=t.useState(c.country),m=t.useMemo(()=>{const e=an.findIndex(e=>e.value===h);return-1===e?0:e},[h]),_=an[m],[f,x]=t.useState(""),b=t.useRef(null),y=t.useCallback((e,n)=>{const t=rn(e,n);return t?t.number:`+${e.dial}${n}`},[]),g=t.useCallback((e,n)=>{u.current&&(u.current.value=y(e,n))},[y]);function v(e){const n=e;p(n.value),g(n,f),s()}return We(e=>{const n=an.find(n=>n.value===e);n&&n.value!==h&&!f&&v(n)}),n.jsxs("div",{className:"xendit-input-phone",children:[n.jsx(_e,{options:an,selectedIndex:m,onChange:v,fixedOverlayWidth:300,enableSearch:!0,className:"xendit-form-field-inner"}),n.jsx("input",{id:l,ref:b,type:"tel",inputMode:"tel",placeholder:i.getExampleNumber(_.value,o)?.formatInternational()?.replace(`+${r.getCountryCallingCode(_.value)} `,"")||"",className:"xendit-text-14 xendit-form-field-inner xendit-phone-number-input",onBlur:function(e){!function(){const e=rn(_,f);if(e){const n=e.formatInternational();x(n.replace(`+${r.getCountryCallingCode(_.value)} `,""))}}(),e.currentTarget?.value&&u.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){const n=e.target.value;x(n),g(_,n),s()},value:f,autoComplete:"tel"}),n.jsx("input",{type:"hidden",name:d,ref:u})]})},an=ze.map(e=>{const n=r.getCountryCallingCode(e.value);return n?{...e,shortTitle:`+${n}`,title:`${e.title} (+${n})`,dial:n}:null}).filter(e=>Boolean(e)),rn=(e,n)=>{const t=i(n,e.value);return t&&t.isPossible()?t:null};function on(e){return{title:e.name,value:e.value}}const sn=[{name:"Alabama",value:"AL"},{name:"Alaska",value:"AK"},{name:"American Samoa",value:"AS"},{name:"Arizona",value:"AZ"},{name:"Arkansas",value:"AR"},{name:"California",value:"CA"},{name:"Colorado",value:"CO"},{name:"Connecticut",value:"CT"},{name:"Delaware",value:"DE"},{name:"District Of Columbia",value:"DC"},{name:"Federated States Of Micronesia",value:"FM"},{name:"Florida",value:"FL"},{name:"Georgia",value:"GA"},{name:"Guam",value:"GU"},{name:"Hawaii",value:"HI"},{name:"Idaho",value:"ID"},{name:"Illinois",value:"IL"},{name:"Indiana",value:"IN"},{name:"Iowa",value:"IA"},{name:"Kansas",value:"KS"},{name:"Kentucky",value:"KY"},{name:"Louisiana",value:"LA"},{name:"Maine",value:"ME"},{name:"Marshall Islands",value:"MH"},{name:"Maryland",value:"MD"},{name:"Massachusetts",value:"MA"},{name:"Michigan",value:"MI"},{name:"Minnesota",value:"MN"},{name:"Mississippi",value:"MS"},{name:"Missouri",value:"MO"},{name:"Montana",value:"MT"},{name:"Nebraska",value:"NE"},{name:"Nevada",value:"NV"},{name:"New Hampshire",value:"NH"},{name:"New Jersey",value:"NJ"},{name:"New Mexico",value:"NM"},{name:"New York",value:"NY"},{name:"North Carolina",value:"NC"},{name:"North Dakota",value:"ND"},{name:"Northern Mariana Islands",value:"MP"},{name:"Ohio",value:"OH"},{name:"Oklahoma",value:"OK"},{name:"Oregon",value:"OR"},{name:"Palau",value:"PW"},{name:"Pennsylvania",value:"PA"},{name:"Puerto Rico",value:"PR"},{name:"Rhode Island",value:"RI"},{name:"South Carolina",value:"SC"},{name:"South Dakota",value:"SD"},{name:"Tennessee",value:"TN"},{name:"Texas",value:"TX"},{name:"Utah",value:"UT"},{name:"Vermont",value:"VT"},{name:"Virgin Islands",value:"VI"},{name:"Virginia",value:"VA"},{name:"Washington",value:"WA"},{name:"West Virginia",value:"WV"},{name:"Wisconsin",value:"WI"},{name:"Wyoming",value:"WY"}].map(on),ln=[{name:"Alberta",value:"AB"},{name:"British Columbia",value:"BC"},{name:"Manitoba",value:"MB"},{name:"New Brunswick",value:"NB"},{name:"Newfoundland and Labrador",value:"NL"},{name:"Northwest Territories",value:"NT"},{name:"Nova Scotia",value:"NS"},{name:"Nunavut",value:"NU"},{name:"Ontario",value:"ON"},{name:"Prince Edward Island",value:"PE"},{name:"Quebec",value:"QC"},{name:"Saskatchewan",value:"SK"},{name:"Yukon Territory",value:"YT"}].map(on),dn=[{name:"Avon"},{name:"Bedfordshire"},{name:"Berkshire"},{name:"Buckinghamshire"},{name:"Cambridgeshire"},{name:"Cheshire"},{name:"Cleveland"},{name:"Cornwall"},{name:"Cumbria"},{name:"Derbyshire"},{name:"Devon"},{name:"Dorset"},{name:"Durham"},{name:"East Sussex"},{name:"Essex"},{name:"Gloucestershire"},{name:"Hampshire"},{name:"Herefordshire"},{name:"Hertfordshire"},{name:"Isle of Wight"},{name:"Kent"},{name:"Lancashire"},{name:"Leicestershire"},{name:"Lincolnshire"},{name:"London"},{name:"Merseyside"},{name:"Norfolk"},{name:"Northamptonshire"},{name:"Northumberland"},{name:"North Yorkshire"},{name:"Nottinghamshire"},{name:"Oxfordshire"},{name:"Rutland"},{name:"Shropshire"},{name:"Somerset"},{name:"South Yorkshire"},{name:"Staffordshire"},{name:"Suffolk"},{name:"Surrey"},{name:"Tyne and Wear"},{name:"Warwickshire"},{name:"West Midlands"},{name:"West Sussex"},{name:"West Yorkshire"},{name:"Wiltshire"},{name:"Worcestershire"},{name:"Clwyd"},{name:"Dyfed"},{name:"Gwent"},{name:"Gwynedd"},{name:"Mid Glamorgan"},{name:"Powys"},{name:"South Glamorgan"},{name:"West Glamorgan"},{name:"Aberdeenshire"},{name:"Angus"},{name:"Argyll"},{name:"Ayrshire"},{name:"Banffshire"},{name:"Berwickshire"},{name:"Bute"},{name:"Caithness"},{name:"Clackmannanshire"},{name:"Dumfriesshire"},{name:"Dunbartonshire"},{name:"East Lothian"},{name:"Fife"},{name:"Inverness-shire"},{name:"Kincardineshire"},{name:"Kinross-shire"},{name:"Kirkcudbrightshire"},{name:"Lanarkshire"},{name:"Midlothian"},{name:"Moray"},{name:"Nairnshire"},{name:"Orkney"},{name:"Peeblesshire"},{name:"Perthshire"},{name:"Renfrewshire"},{name:"Ross-shire"},{name:"Roxburghshire"},{name:"Selkirkshire"},{name:"Shetland"},{name:"Stirlingshire"},{name:"Sutherland"},{name:"West Lothian"},{name:"Wigtownshire"},{name:"Antrim"},{name:"Armagh"},{name:"Down"},{name:"Fermanagh"},{name:"Londonderry"},{name:"Tyrone"}].map(e=>({title:e.name,value:e.name})),cn=e=>{const{field:a,onChange:i}=e,r=G(a),o=X(a),s=E(),l=st()?.form,d=Fn(),c=t.useRef(null),u=t.useCallback(()=>{c.current&&(c.current.value=""),i()},[i]),h=t.useCallback(e=>{c.current&&(c.current.value=e.value),i(),c.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[i]),p=t.useCallback(e=>{c.current&&(c.current.value=e.target.value),i(),c.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[i]),m=function(e){switch(e){case"US":return sn;case"CA":return ln;case"GB":return dn;default:return null}}(function(e,n,t,a){if(n)for(let a=0;a<n.length;a++){const i=n[a];if(a>0&&i===e){const e=n[a-1];if("country"===e.type.name){const n=ne(e.channel_property,t);if(n&&"string"==typeof n)return n}}}return a.country}(a,l??[],d??{},s)),_=F(m);return t.useLayoutEffect(()=>{_!==m&&u()},[u,m,_]),n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:c}),m?n.jsx(_e,{id:r,options:m,onChange:h,placeholder:a.placeholder,enableSearch:!0,className:"xendit-form-field-inner"},(f=m,ie.has(f)||ie.set(f,re++),ie.get(f).toString())):n.jsx("input",{type:"text",id:r,onChange:p,placeholder:a.placeholder,className:"xendit-form-field-inner xendit-text-14"})]});var f};const un=e=>{const{field:a,onChange:i}=e,r=G(a),o=X(a),s=t.useRef(null);return n.jsx("input",{id:r,name:o,ref:s,type:"text",placeholder:a.placeholder,className:"xendit-form-field-inner xendit-text-14",onBlur:function(e){e.currentTarget?.value&&s.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){i()},minLength:hn(a)?a.type.min_length:void 0,maxLength:hn(a)?a.type.max_length:void 0,autoComplete:hn(a)?a.type.autocomplete:void 0})};function hn(e){return"text"===e.type.name}const pn={IDR:"id",VND:"vi",BRL:"pt-BR",RUB:"ru",CZK:"cs",RON:"ro",UAH:"uk",CLP:"es-CL",COP:"es-CO",UYU:"es-UY",ARS:"es-AR",INR:"hi-IN",NPR:"hi-IN",LKR:"hi-IN",BDT:"hi-IN"},mn={USD:"US$",CAD:"CA$",EUR:"€",AFN:"؋",ALL:"Lek",AMD:"֏",ARS:"AR$",AUD:"AU$",AZN:"₼",BAM:"KM",BDT:"৳",BIF:"FBu",BND:"BN$",BOB:"Bs",BRL:"R$",BWP:"P",BYN:"Br",BZD:"BZ$",CDF:"FrCD",CHF:"CHF",CLP:"CL$",CNY:"CN¥",COP:"CO$",CRC:"₡",CVE:"CV$",CZK:"Kč",DJF:"Fdj",DKK:"kr",DOP:"RD$",ERN:"Nfk",ETB:"Br",GBP:"£",GEL:"₾",GHS:"GH₵",GNF:"FG",GTQ:"Q",HKD:"HK$",HNL:"L",HUF:"Ft",IDR:"Rp",ILS:"₪",INR:"₹",IRR:"IRR",ISK:"kr",JMD:"J$",JPY:"¥",KES:"Ksh",KHR:"៛",KMF:"FC",KRW:"₩",KZT:"₸",LKR:"SL Re",MDL:"lei",MGA:"MGA",MKD:"MKD",MMK:"K",MOP:"MOP$",MUR:"₨",MXN:"MXN$",MYR:"RM",MZN:"MTn",NAD:"N$",NGN:"₦",NIO:"C$",NOK:"kr",NPR:"रु",NZD:"NZ$",PAB:"B/.",PEN:"S/.",PHP:"₱",PKR:"₨",PLN:"zł",PYG:"₲",RON:"RON",RSD:"RSD",RUB:"₽",RWF:"FR",SDG:"SDG",SEK:"kr",SGD:"S$",SOS:"Ssh",THB:"฿",TOP:"T$",TRY:"TL",TTD:"TT$",TWD:"NT$",TZS:"TSh",UAH:"₴",UGX:"USh",UYU:"$U",UZS:"сум",VND:"₫",XAF:"FCFA",XOF:"CFA",ZAR:"R",ZMW:"K",ZWL:"ZWL$"},_n={ALL:"1 $",BAM:"1 $",BYN:"1 $",CZK:"1 $",DKK:"1 $",GEL:"1 $",HUF:"1 $",ISK:"1 $",IRR:"1 $",KHR:"1$",MDL:"1 $",MKD:"1 $",NOK:"1 $",PLN:"1 $",RON:"1 $",RSD:"1 $",RUB:"1$",SEK:"1 $",UZS:"1 $",VND:"1$"},fn={BHD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function xn(e,n){let t;const a=e<0,i=pn[n]??"en",r=fn[n]??2;if(t=new Intl.NumberFormat(i,{style:"decimal",minimumFractionDigits:r,maximumFractionDigits:20}).format(Math.abs(e)),t=t.replace(/(\.|,)000?$/,""),mn[n]){const e=mn[n]??n;t=(_n[n]??"$1").replace("$",e).replace("1",t)}else t=n+" "+t;return a&&(t="-"+t),t}const bn=e=>{const{field:a,onChange:i}=e,{t:r}=S(),o=E(),s=G(a),l=X(a),d=t.useRef(null),c=st();I(c);const u=t.useMemo(()=>ce(c.form,"credit_card_number"),[c.form]),h=dt()?.paymentOptions,p=h?.options?.installment_plans,[m,_]=t.useState(null),f=t.useMemo(()=>{const e=p?.map(e=>({title:r("installment_plan.pay_in_installments",{installments:e.terms,amount:xn(e.installment_amount,o.currency)}),subtitle:e.interest_rate,value:yn(e)}))??[];return u&&e.unshift({title:r("installment_plan.pay_in_full",{amount:xn(o.amount,o.currency)}),value:""}),e},[u,p,o.amount,o.currency,r]);let x=f?.findIndex(e=>e.value===m);-1===x&&(x=0);const b=t.useCallback(()=>{_(null),d.current&&(d.current.value="")},[]),y=t.useCallback(e=>{if(d.current){const n=p?.find(n=>yn(n)===e.value);n?n.code?d.current.value=JSON.stringify([n.terms,n.interval,n.code]):d.current.value=JSON.stringify([n.terms,n.interval]):d.current.value="",d.current?.dispatchEvent(new InternalSetFieldTouchedEvent)}_(e.value),i()},[p,i]);t.useLayoutEffect(()=>{f.length&&y(f[0])},[]);const g=F(f);return t.useLayoutEffect(()=>{f===g||p?.some(e=>yn(e)===m)||(f.length?y(f[0]):b())},[b,f,y,p,g,m]),n.jsxs(n.Fragment,{children:[h?n.jsx(_e,{id:s,placeholder:a.placeholder,onChange:y,options:f,selectedIndex:x,className:"xendit-form-field-inner"}):n.jsx(fe,{id:s,className:"xendit-form-field-inner"}),n.jsx("input",{type:"hidden",name:l,ref:d})]})};function yn(e){return`${e.terms}_${e.interval}_${e.code??""}`}const gn=e=>{const{field:t,className:a}=e;return n.jsx("div",{className:`${a} xendit-channel-form-field xendit-form-field-span-${t.span}`,children:function(){switch(t.type.name){case"credit_card_number":case"credit_card_expiry":case"credit_card_cvn":return n.jsx(en,{...e});case"phone_number":return n.jsx(tn,{...e});case"text":case"email":case"postal_code":return n.jsx(un,{...e});case"dropdown":return n.jsx(Fe,{...e});case"installment_plan":return n.jsx(bn,{...e});case"country":return n.jsx(Ke,{...e});case"province":return n.jsx(cn,{...e})}throw t.type,new Error(`Unsupported field type: ${t.type.name}`)}()})};const vn={en:{session:{"action.payment_confirmation_instructions":"Once you've paid, click the button above to get your payment confirmation.","action.payment_made":"I've made this payment","action_barcode.amount_to_pay":"Amount to pay","action_barcode.barcode_content":"Payment Code","action_barcode.merchant_name":"Seller","action_barcode.unable_to_generate":"Unable to generate barcode","action_deeplink.button":"Open App","action_deeplink.instructions":"Please complete your payment on {{channelName}} app.","action_deeplink.title":"Awaiting payment...","action_empty_list_push_notification.subtext":"Check the notification in your {{channelName}} app to complete your payment.","action_empty_list_push_notification.title":"Awaiting payment...","action_qr.unable_to_generate":"Unable to generate QR code","action_va.amount_to_pay":"Amount to Pay","action_va.copied_to_clipboard":"Copied to clipboard","action_va.copy":"Copy","action_va.merchant_name":"Virtual Account Name","action_va.virtual_account_number":"Virtual Account Number","combobox.default_search_placeholder":"Search...","default_error.message_1":"There was a problem with the request.","default_error.message_2":"Please try again later.","default_error.title":"Error","failure_code.account_access_blocked":"Your payment was declined. Please try again or use a different payment method.","failure_code.account_already_linked":"Your account has already been linked. Please use a different payment method.","failure_code.account_not_activated":"Your payment couldn’t be processed because your account hasn’t been activated. Please activate your account and try again.","failure_code.authentication_failed":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.capture_amount_exceeded":"Your payment couldn't be processed. Please make sure your payment details are correct and try again, or use a different payment method.","failure_code.card_declined":"Your card was declined. Please try again with another card or payment method.","failure_code.channel_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.declined_by_issuer":"Your payment was declined. Please try again or use a different payment method.","failure_code.declined_by_processor":"Your payment was declined. Please try again or use a different payment method.","failure_code.expired_card":"Your card was declined because it is expired. Please try again or use a different payment method.","failure_code.expired_otp":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.failure_details_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.inactive_or_unauthorized_card":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.insufficient_balance":"Your payment couldn’t be processed because your account balance is insufficient. Please make sure you have enough funds and try again.","failure_code.invalid_account_details":"Your payment information is incorrect. Please double-check your card details or try a different payment method.","failure_code.invalid_cvv":"The CVN entered was incorrect. Please try again.","failure_code.invalid_merchant_settings":"Your payment couldn’t be processed. Please contact the seller or try a different payment method.","failure_code.invalid_otp":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.invalid_token":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.issuer_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.otp_attempt_counts_exceeded":"Your payment couldn’t be processed because there were too many failed OTP attempts. Please make the payment again or use a different payment method.","failure_code.partner_timeout_error":"Your payment couldn't be processed. Please try again or use a different payment method.","failure_code.payment_amount_limits_exceeded":"Your payment couldn’t be processed because you’ve exceeded your transaction limit. Please use a different payment method.","failure_code.payment_attempt_counts_exceeded":"Your payment couldn’t be processed due to too many failed attempts.","failure_code.payment_request_expired":"Your payment couldn’t be processed because the link has expired. Please try again or use a different payment method.","failure_code.processor_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.server_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.stolen_card":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.suspected_fraudulent":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.timeout_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.user_declined_payment":"Your payment was declined. Please try again or use a different payment method.","failure_code.user_device_unreachable":"Your payment couldn’t be processed due to a network issue. Please try again or use a different payment method.","failure_code.user_did_not_authorize":"Your payment couldn’t be processed because it wasn’t authorized in time. Please try again.",failure_code_unknown:"A failure occurred with code {{failureCode}}","google_pay_errors.buyer_account_error.message":"Your Google account is unable to make this payment. Use a different Google account or a different payment method.","google_pay_errors.buyer_account_error.title":"Google Pay Error","google_pay_errors.developer_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.developer_error.title":"Google Pay Error","google_pay_errors.internal_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.internal_error.title":"Google Pay Error","google_pay_errors.merchant_account_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.merchant_account_error.title":"Google Pay Error","google_pay_errors.unknown_error.message":"An unknown error occurred with Google Pay. The error code is {{statusCode}}.","google_pay_errors.unknown_error.title":"Google Pay Error","image_alt.channel_logo":"{{channelName}} logo","installment_plan.pay_in_full":"Pay in Full — {{amount}}","installment_plan.pay_in_installments":"{{installments}}x Installments — {{amount}}","payment.save_checkbox_label":"Save this payment method for recurring payments","payment_methods.add_payment_method":"Add payment method","payment_methods.channel_disabled_amount_too_large":"Not available for this payment","payment_methods.channel_disabled_amount_too_small":"Not available for this payment","payment_methods.pay_with":"Pay with","payment_methods.select_channel_placeholder":"Select {{groupName}}","payment_request_status.canceled.subtext":"Please try to check out again or contact the seller if the problem persists.","payment_request_status.canceled.title":"This page is no longer available","payment_request_status.expired.subtext":"Your payment couldn’t be processed. Please try again or use a different payment method.","payment_request_status.expired.title":"Payment unsuccessful","payment_request_status.failed.subtext":"Your payment couldn't be processed. Please try a different payment method or submit an inquiry to the seller by sharing your Unique Identifiers.","payment_request_status.failed.title":"Payment failed","payment_token_status.canceled.subtext":"Please try again or use a different payment method.","payment_token_status.canceled.title":"Payment method couldn't be added","payment_token_status.expired.subtext":"Please try again or use a different payment method.","payment_token_status.expired.title":"Payment method couldn't be added","payment_token_status.failed.subtext":"Your payment couldn't be processed. Please try a different payment method or submit an inquiry to the seller by sharing your Unique Identifiers.","payment_token_status.failed.title":"Payment method couldn't be added","simulation.see_all_scenarios":"See the full list here.","simulation.select_scenario":"Select a scenario","simulation.simulate_scenario":"Simulate scenario","simulation.simulate_test_scenario":"Simulate a test scenario","simulation.want_to_test_all_scenarios":"Want to test different scenarios?","customer_details.form_name":"Your Name","customer_details.name":"Name","validation.card_cvn_invalid":"CVN is not valid","validation.card_expiry_invalid":"Card expiry is not valid","validation.card_number_incomplete":"Card number is incomplete","validation.card_number_invalid":"Card number is not valid","validation.generic_invalid":"{{field}} is not valid. Please check and try again.","validation.required":"{{field}} is required.","validation.text_too_long":"{{field}} is too long","validation.text_too_short":"{{field}} is too short"}}.session,id:{session:{"action.payment_confirmation_instructions":"Setelah Anda bayar, klik tombol di atas untuk mendapatkan konfirmasi pembayaran Anda.","action.payment_made":"Saya telah melakukan pembayaran ini","action_barcode.amount_to_pay":"Jumlah Pembayaran","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"Buka Aplikasi","action_deeplink.instructions":"Silakan selesaikan pembayaran Anda di aplikasi {{channelName}}.","action_deeplink.title":"Menunggu pembayaran...","action_empty_list_push_notification.subtext":"Cek notifikasi di aplikasi {{channelName}} Anda untuk menyelesaikan pembayaran.","action_empty_list_push_notification.title":"Menunggu pembayaran...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"Jumlah Pembayaran","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"Nomor Virtual Account","combobox.default_search_placeholder":"Cari...","default_error.message_1":"Ada masalah dengan permintaan ini.","default_error.message_2":"Silakan coba lagi nanti.","default_error.title":"Error","failure_code.account_access_blocked":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.account_already_linked":"Akun Anda sudah di-link. Silakan gunakan metode pembayaran lain.","failure_code.account_not_activated":"Pembayaran Anda tidak dapat diproses karena akun Anda belum diaktifkan. Harap aktifkan akun Anda dan coba lagi.","failure_code.authentication_failed":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.capture_amount_exceeded":"Pembayaran Anda tidak dapat diproses. Pastikan detail pembayaran Anda benar dan coba lagi, atau gunakan metode pembayaran lain.","failure_code.card_declined":"Kartu Anda ditolak. Silakan coba lagi dengan kartu atau metode pembayaran lain.","failure_code.channel_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.declined_by_issuer":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.declined_by_processor":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.expired_card":"Kartu Anda ditolak karena sudah kedaluwarsa. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.expired_otp":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.failure_details_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.inactive_or_unauthorized_card":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.insufficient_balance":"Pembayaran Anda tidak dapat diproses karena saldo akun Anda tidak mencukupi. Pastikan Anda memiliki dana yang cukup dan coba lagi.","failure_code.invalid_account_details":"Informasi pembayaran Anda salah. Harap periksa kembali detail kartu Anda atau coba gunakan metode pembayaran lain.","failure_code.invalid_cvv":"CVN yang dimasukkan salah. Silakan coba lagi.","failure_code.invalid_merchant_settings":"Pembayaran Anda tidak dapat diproses. Silakan hubungi penjual atau coba metode pembayaran lain.","failure_code.invalid_otp":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.invalid_token":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.issuer_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.otp_attempt_counts_exceeded":"Pembayaran Anda tidak dapat diproses karena terlalu banyak percobaan OTP yang gagal. Harap lakukan pembayaran lagi atau gunakan metode pembayaran lain.","failure_code.partner_timeout_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.payment_amount_limits_exceeded":"Pembayaran Anda tidak dapat diproses karena Anda telah melampaui batas transaksi. Silakan gunakan metode pembayaran lain.","failure_code.payment_attempt_counts_exceeded":"Pembayaran Anda tidak dapat diproses karena terlalu banyak percobaan yang gagal.","failure_code.payment_request_expired":"Pembayaran Anda tidak dapat diproses karena link telah kedaluwarsa. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.processor_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.server_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.stolen_card":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.suspected_fraudulent":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.timeout_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_declined_payment":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_device_unreachable":"Pembayaran Anda tidak dapat diproses karena masalah jaringan. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_did_not_authorize":"Pembayaran Anda tidak dapat diproses karena waktu pembayaran telah habis. Silakan coba lagi.",failure_code_unknown:"Terjadi kegagalan dengan kode {{failureCode}}","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"Logo {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"Simpan metode pembayaran ini untuk pembayaran berulang","payment_methods.add_payment_method":"Tambah metode pembayaran","payment_methods.channel_disabled_amount_too_large":"Tidak tersedia untuk pembayaran ini","payment_methods.channel_disabled_amount_too_small":"Tidak tersedia untuk pembayaran ini","payment_methods.pay_with":"Bayar dengan","payment_methods.select_channel_placeholder":"Pilih {{groupName}}","payment_request_status.canceled.subtext":"Silakan coba check out lagi atau hubungi penjual jika masalah terus berlanjut.","payment_request_status.canceled.title":"Halaman ini tidak tersedia lagi","payment_request_status.expired.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","payment_request_status.expired.title":"Pembayaran tidak berhasil","payment_request_status.failed.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba metode pembayaran lain atau ajukan pertanyaan kepada penjual dengan membagikan ID Unik Anda.","payment_request_status.failed.title":"Pembayaran gagal","payment_token_status.canceled.subtext":"Silakan coba lagi atau gunakan metode pembayaran lain.","payment_token_status.canceled.title":"Metode pembayaran tidak dapat ditambahkan","payment_token_status.expired.subtext":"Silakan coba lagi atau gunakan metode pembayaran lain.","payment_token_status.expired.title":"Metode pembayaran tidak dapat ditambahkan","payment_token_status.failed.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba metode pembayaran lain atau ajukan pertanyaan kepada penjual dengan membagikan ID Unik Anda.","payment_token_status.failed.title":"Metode pembayaran tidak dapat ditambahkan","customer_details.form_name":"Nama Anda","customer_details.name":"Nama","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_cvn_invalid":"CVN tidak valid","validation.card_expiry_invalid":"Tanggal kedaluwarsa kartu tidak valid","validation.card_number_incomplete":"Nomor kartu tidak lengkap","validation.card_number_invalid":"Nomor kartu tidak valid","validation.generic_invalid":"{{field}} tidak valid. Silakan cek dan coba lagi.","validation.required":"{{field}} wajib diisi.","validation.text_too_long":"{{field}} terlalu panjang","validation.text_too_short":"{{field}} terlalu pendek"}}.session,th:{session:{"action.payment_confirmation_instructions":"เมื่อคุณชำระเงินแล้ว คลิกที่ปุ่มด้านบนเพื่อยืนยันการชำระเงิน","action.payment_made":"ฉันได้ชำระเงินแล้ว","action_barcode.amount_to_pay":"จำนวนเงินที่ต้องชำระ","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"","action_deeplink.instructions":"โปรดชำระเงินให้เสร็จสิ้นบนแอป {{channelName}}","action_deeplink.title":"","action_empty_list_push_notification.subtext":"ตรวจสอบการแจ้งเตือนในแอป {{channelName}} ของคุณเพื่อดำเนินการชำระเงินให้เสร็จสิ้น","action_empty_list_push_notification.title":"กําลังรอการชําระเงิน...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"ยอดชำระ","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"หมายเลข Virtual Account","combobox.default_search_placeholder":"ค้นหา...","default_error.message_1":"มีปัญหาในการประมวลผลคำขอ","default_error.message_2":"โปรดลองอีกครั้งในภายหลัง","default_error.title":"ข้อผิดพลาด","failure_code.account_access_blocked":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.account_already_linked":"บัญชีนี้มีการเชื่อมต่อไว้แล้ว กรุณาเลือกวิธีการชำระเงินอื่น","failure_code.account_not_activated":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากบัญชีของคุณยังไม่ได้เปิดใช้งาน กรุณาเปิดใช้งานบัญชีและลองใหม่อีกครั้ง","failure_code.authentication_failed":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.capture_amount_exceeded":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาตรวจสอบรายละเอียดการชำระเงินให้ถูกต้องแล้วลองใหม่อีกครั้ง หรือใช้วิธีการชำระเงินอื่น","failure_code.card_declined":"บัตรของคุณถูกปฏิเสธ กรุณาลองใหม่ด้วยบัตรหรือวิธีการชำระเงินอื่น","failure_code.channel_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.declined_by_issuer":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.declined_by_processor":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.expired_card":"บัตรของคุณถูกปฏิเสธเนื่องจากบัตรหมดอายุ กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","failure_code.expired_otp":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.failure_details_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.inactive_or_unauthorized_card":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.insufficient_balance":"ไม่สามารถดำเนินการชำระเงินได้ เนื่องจากยอดเงินในบัญชีไม่เพียงพอ กรุณาตรวจสอบให้แน่ใจว่ามียอดเงินเพียงพอแล้วลองใหม่อีกครั้ง","failure_code.invalid_account_details":"ข้อมูลการชำระเงินไม่ถูกต้อง กรุณาตรวจสอบรายละเอียดบัตรอีกครั้ง หรือใช้วิธีการชำระเงินอื่น","failure_code.invalid_cvv":"CVN ที่กรอกไม่ถูกต้อง กรุณาลองใหม่อีกครั้ง","failure_code.invalid_merchant_settings":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาติดต่อผู้ขายหรือลองใช้วิธีชำระเงินอื่น","failure_code.invalid_otp":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.invalid_token":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.issuer_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.otp_attempt_counts_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากมีการกรอกรหัส OTP ผิดพลาดมากเกินไป กรุณาชำระเงินใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.partner_timeout_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.payment_amount_limits_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากคุณทำธุรกรรมเกินขีดจำกัด กรุณาใช้วิธีชำระเงินอื่น","failure_code.payment_attempt_counts_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากพยายามล้มเหลวหลายครั้งเกินไป","failure_code.payment_request_expired":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากลิงก์หมดอายุแล้ว กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.processor_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.server_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.stolen_card":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.suspected_fraudulent":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.timeout_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_declined_payment":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_device_unreachable":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากปัญหาเครือข่าย กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_did_not_authorize":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากไม่ได้รับการอนุมัติภายในเวลาที่กำหนด กรุณาลองใหม่อีกครั้ง",failure_code_unknown:"เกิดข้อผิดพลาดขึ้น (รหัส: {{failureCode}})","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"โลโก้ {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"บันทึกวิธีการชําระเงินนี้สําหรับการชําระเงินอัตโนมัติ","payment_methods.add_payment_method":"เพิ่มวิธีการชำระเงิน","payment_methods.channel_disabled_amount_too_large":"ไม่สามารถใช้ได้กับการชำระเงินนี้","payment_methods.channel_disabled_amount_too_small":"ไม่สามารถใช้ได้กับการชำระเงินนี้","payment_methods.pay_with":"ชำระเงินด้วย","payment_methods.select_channel_placeholder":"เลือก {{groupName}}","payment_request_status.canceled.subtext":"กรุณาลองชำระเงินอีกครั้ง หรือ ติดต่อผู้ขายหากปัญหายังคงเกิดขึ้น","payment_request_status.canceled.title":"หน้านี้ไม่สามารถใช้งานได้แล้ว","payment_request_status.expired.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือลองใช้วิธีชำระเงินอื่น","payment_request_status.expired.title":"ชำระเงินไม่สำเร็จ","payment_request_status.failed.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใช้วิธีการชำระเงินอื่น หรือส่งคำถามไปยังผู้ขายโดยแชร์ Unique Identifiers ของคุณ","payment_request_status.failed.title":"ชำระเงินไม่สำเร็จ","payment_token_status.canceled.subtext":"กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","payment_token_status.canceled.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","payment_token_status.expired.subtext":"กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","payment_token_status.expired.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","payment_token_status.failed.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใช้วิธีการชำระเงินอื่น หรือส่งคำถามไปยังผู้ขายโดยแชร์ Unique Identifiers ของคุณ","payment_token_status.failed.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","customer_details.form_name":"ชื่อของคุณ","customer_details.name":"ชื่อ","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_cvn_invalid":"CVN ไม่ถูกต้อง","validation.card_expiry_invalid":"วันหมดอายุของบัตรไม่ถูกต้อง","validation.card_number_incomplete":"หมายเลขบัตรไม่ครบถ้วน","validation.card_number_invalid":"หมายเลขบัตรไม่ถูกต้อง","validation.generic_invalid":"{{field}} ไม่ถูกต้อง","validation.required":"กรุณากรอก {{field}}","validation.text_too_long":"{{field}} ยาวเกินไป","validation.text_too_short":"{{field}} สั้นเกินไป"}}.session,vi:{session:{"action.payment_confirmation_instructions":"Sau khi bạn đã thanh toán, hãy nhấp nút phía trên để nhận xác nhận thanh toán.","action.payment_made":"Tôi đã thực hiện thanh toán này","action_barcode.amount_to_pay":"Số tiền cần thanh toán","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"Mở ứng dụng","action_deeplink.instructions":"Vui lòng hoàn tất thanh toán trên ứng dụng {{channelName}}.","action_deeplink.title":"Đang chờ thanh toán...","action_empty_list_push_notification.subtext":"Vui lòng kiểm tra thông báo trong ứng dụng {{channelName}} để hoàn tất thanh toán.","action_empty_list_push_notification.title":"Đang chờ thanh toán...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"Số tiền cần thanh toán","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"Số tài khoản định danh (Virtual Account)","combobox.default_search_placeholder":"Tìm kiếm...","default_error.message_1":"Có vấn đề với yêu cầu.","default_error.message_2":"Vui lòng thử lại sau.","default_error.title":"Lỗi","failure_code.account_access_blocked":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.account_already_linked":"Tài khoản của bạn đã được liên kết. Vui lòng dùng phương thức khác.","failure_code.account_not_activated":"Không thể thực hiện thanh toán vì tài khoản chưa được kích hoạt. Vui lòng kích hoạt và thử lại.","failure_code.authentication_failed":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.capture_amount_exceeded":"Không thể thực hiện thanh toán. Vui lòng kiểm tra thông tin thanh toán và thử lại, hoặc dùng phương thức khác.","failure_code.card_declined":"Thẻ của bạn đã bị từ chối. Vui lòng thử lại bằng thẻ khác hoặc phương thức khác.","failure_code.channel_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.declined_by_issuer":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.declined_by_processor":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.expired_card":"Thẻ của bạn bị từ chối do đã hết hạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.expired_otp":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.failure_details_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.inactive_or_unauthorized_card":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.insufficient_balance":"Không thể thực hiện thanh toán vì số dư tài khoản không đủ. Vui lòng nạp thêm tiền và thử lại.","failure_code.invalid_account_details":"Thông tin thanh toán không chính xác. Vui lòng kiểm tra lại hoặc dùng phương thức khác.","failure_code.invalid_cvv":"Mã CVN nhập không đúng. Vui lòng thử lại.","failure_code.invalid_merchant_settings":"Không thể thực hiện thanh toán. Vui lòng liên hệ người bán hoặc dùng phương thức khác.","failure_code.invalid_otp":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.invalid_token":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.issuer_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.otp_attempt_counts_exceeded":"Không thể thực hiện thanh toán vì đã nhập sai OTP quá nhiều lần. Vui lòng thanh toán lại hoặc dùng phương thức khác.","failure_code.partner_timeout_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.payment_amount_limits_exceeded":"Không thể thực hiện thanh toán vì bạn đã vượt quá hạn mức giao dịch. Vui lòng dùng phương thức khác.","failure_code.payment_attempt_counts_exceeded":"Không thể thực hiện thanh toán do quá nhiều lần thử thất bại.","failure_code.payment_request_expired":"Không thể thực hiện thanh toán vì liên kết đã hết hạn. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.processor_error":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.server_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.stolen_card":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.suspected_fraudulent":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.timeout_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_declined_payment":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_device_unreachable":"Không thể thực hiện thanh toán do sự cố mạng. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_did_not_authorize":"Không thể thực hiện thanh toán vì không được xác nhận kịp thời. Vui lòng thử lại.",failure_code_unknown:"Có lỗi xảy ra với mã {{failureCode}}","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"Logo {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"Lưu phương thức thanh toán này cho các thanh toán định kỳ","payment_methods.add_payment_method":"Thêm phương thức thanh toán","payment_methods.channel_disabled_amount_too_large":"Không khả dụng cho khoản thanh toán này","payment_methods.channel_disabled_amount_too_small":"Không khả dụng cho khoản thanh toán này","payment_methods.pay_with":"Thanh toán bằng","payment_methods.select_channel_placeholder":"Chọn {{groupName}}","payment_request_status.canceled.subtext":"Vui lòng thử thanh toán lại hoặc liên hệ người bán nếu vấn đề vẫn tiếp diễn.","payment_request_status.canceled.title":"Trang này không còn khả dụng","payment_request_status.expired.subtext":"Thanh toán của bạn không thể xử lý. Vui lòng thử lại hoặc chọn phương thức khác.","payment_request_status.expired.title":"Thanh toán không thành công","payment_request_status.failed.subtext":"Không thể thực hiện thanh toán. Vui lòng thử phương thức khác hoặc gửi yêu cầu đến người bán bằng cách chia sẻ Mã định danh duy nhất.","payment_request_status.failed.title":"Thanh toán thất bại","payment_token_status.canceled.subtext":"Vui lòng thử lại hoặc dùng phương thức khác.","payment_token_status.canceled.title":"Không thể thêm phương thức thanh toán","payment_token_status.expired.subtext":"Vui lòng thử lại hoặc dùng phương thức khác.","payment_token_status.expired.title":"Không thể thêm phương thức thanh toán","payment_token_status.failed.subtext":"Không thể thực hiện thanh toán. Vui lòng thử phương thức khác hoặc gửi yêu cầu đến người bán bằng cách chia sẻ Mã định danh duy nhất.","payment_token_status.failed.title":"Không thể thêm phương thức thanh toán","customer_details.form_name":"Tên của bạn","customer_details.name":"Tên","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_cvn_invalid":"CVN không hợp lệ","validation.card_expiry_invalid":"Ngày hết hạn thẻ không hợp lệ","validation.card_number_incomplete":"Số thẻ chưa đầy đủ","validation.card_number_invalid":"Số thẻ không hợp lệ","validation.generic_invalid":"{{field}} không hợp lệ","validation.required":"Vui lòng nhập {{field}}","validation.text_too_long":"{{field}} quá dài","validation.text_too_short":"{{field}} quá ngắn"}}.session,es:{session:{"action.payment_confirmation_instructions":"","action.payment_made":"","action_barcode.amount_to_pay":"","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"","action_deeplink.instructions":"","action_deeplink.title":"","action_empty_list_push_notification.subtext":"","action_empty_list_push_notification.title":"","action_qr.unable_to_generate":"","action_va.amount_to_pay":"","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"","combobox.default_search_placeholder":"","default_error.message_1":"","default_error.message_2":"","default_error.title":"","failure_code.account_access_blocked":"","failure_code.account_already_linked":"","failure_code.account_not_activated":"","failure_code.authentication_failed":"","failure_code.capture_amount_exceeded":"","failure_code.card_declined":"","failure_code.channel_unavailable":"","failure_code.declined_by_issuer":"","failure_code.declined_by_processor":"","failure_code.expired_card":"","failure_code.expired_otp":"","failure_code.failure_details_unavailable":"","failure_code.inactive_or_unauthorized_card":"","failure_code.insufficient_balance":"","failure_code.invalid_account_details":"","failure_code.invalid_cvv":"","failure_code.invalid_merchant_settings":"","failure_code.invalid_otp":"","failure_code.invalid_token":"","failure_code.issuer_unavailable":"","failure_code.otp_attempt_counts_exceeded":"","failure_code.partner_timeout_error":"","failure_code.payment_amount_limits_exceeded":"","failure_code.payment_attempt_counts_exceeded":"","failure_code.payment_request_expired":"","failure_code.processor_error":"","failure_code.server_error":"","failure_code.stolen_card":"","failure_code.suspected_fraudulent":"","failure_code.timeout_error":"","failure_code.user_declined_payment":"","failure_code.user_device_unreachable":"","failure_code.user_did_not_authorize":"",failure_code_unknown:"","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"","payment_methods.add_payment_method":"","payment_methods.channel_disabled_amount_too_large":"","payment_methods.channel_disabled_amount_too_small":"","payment_methods.pay_with":"","payment_methods.select_channel_placeholder":"","payment_request_status.canceled.subtext":"","payment_request_status.canceled.title":"","payment_request_status.expired.subtext":"","payment_request_status.expired.title":"","payment_request_status.failed.subtext":"","payment_request_status.failed.title":"","payment_token_status.canceled.subtext":"","payment_token_status.canceled.title":"","payment_token_status.expired.subtext":"","payment_token_status.expired.title":"","payment_token_status.failed.subtext":"","payment_token_status.failed.title":"","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_cvn_invalid":"","validation.card_expiry_invalid":"","validation.card_number_incomplete":"","validation.card_number_invalid":"","validation.generic_invalid":"","validation.required":"","validation.text_too_long":"","validation.text_too_short":""}}.session};const kn=(e,n,t)=>n?(e=>"object"==typeof e&&null!==e&&"localeKey"in e)(n)?e(n.localeKey,{field:"string"==typeof t?t:t.label}):n.value:null;function wn(e){return e.startsWith("/")&&e.endsWith("/")?e.slice(1,-1):e}function Cn(e,n){if(0===n.length)return e.required?{localeKey:"validation.required"}:void 0;switch(e.type.name){case"credit_card_number":case"credit_card_expiry":case"credit_card_cvn":return function(e){const n=ae(e);if(!n.valid){if(n.validationError)return{localeKey:n.validationError};throw new Error("Unexpected value in encrypted field, this is a bug, please contact support.")}}(n);case"phone_number":return(e=>{const n=r(e);if(!n||!n.isValid())return{localeKey:"validation.generic_invalid"}})(n);case"email":return(e=>{if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[A-Za-z]{2,}$/.test(e))return{localeKey:"validation.generic_invalid"}})(n);case"postal_code":return(e=>{if(!/^(?![-\s]+)[A-Za-z0-9\s-]+$/.test(e))return{localeKey:"validation.generic_invalid"}})(n);case"text":return((e,n)=>{if(Array.isArray(e.type.regex_validators))for(const t of e.type.regex_validators)if(!new RegExp(wn(t.regex)).test(n))return{value:t.message};return void 0!==e.type.min_length&&n.length<e.type.min_length?{localeKey:"validation.text_too_short"}:n.length>e.type.max_length?{localeKey:"validation.text_too_long"}:void 0})(e,n);case"country":case"province":case"installment_plan":case"dropdown":return;default:throw e.type,new Error(`Unsupported input type: ${e.type.name}; this is a bug, please contact support.`)}}function En(e,n){const t=Array.isArray(e.channel_property)?e.channel_property:[e.channel_property];for(const a of t){let t=Nn(n,a);if(void 0===t&&(t=""),"string"!=typeof t)continue;const i=Cn(e,t);if(i)return i}}function Nn(e,n){const t=n.split("."),a=e[t[0]];if(void 0!==a){if("object"!=typeof a||Array.isArray(a)){if(1!==t.length)throw new Error(`Attempted to read channel property "${n}" expecting an object but found a primitive value; this is a bug, please contact support.`);return a}return Nn(a,t.slice(1).join("."))}}const An=e.createContext(null),Sn=({scenarios:e,onSelect:a,children:i})=>{const[r,o]=t.useState(!1),s=t.useRef(null);return t.useLayoutEffect(()=>{if(!r)return;const e=e=>{const n=s.current;n&&(n.contains(e.target)||o(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),n.jsx("div",{ref:s,children:n.jsx(An.Provider,{value:{open:r,setOpen:o,scenarios:e,onSelect:a},children:i})})},Pn=({children:e})=>n.jsx("div",{className:"xendit-form-simulation-root",children:e}),Rn=({children:e})=>{const{open:a,setOpen:i}=t.useContext(An)||{};return n.jsx("button",{type:"button",className:"xendit-form-simulation-trigger",onClick:()=>i?.(!a),children:e})},jn=()=>{const e=t.useContext(An);I(e);const{open:a,setOpen:i,scenarios:r,onSelect:o}=e,{t:s}=S();return a&&r?n.jsxs("div",{className:"xendit-form-simulation-popover",children:[n.jsx("div",{className:"xendit-text-12 xendit-text-semibold",children:s("simulation.simulate_test_scenario")}),n.jsx(_e,{onChange:e=>{o?.(e.value),i?.(!1)},placeholder:s("simulation.select_scenario"),options:r.scenarios.map(e=>({title:e.description,value:e.name,leadingAsset:n.jsx("img",{src:e.imageUrl,className:"xendit-channel-logo"})}))}),r?.docsLink?n.jsxs("div",{className:"xendit-text-14",children:[s("simulation.want_to_test_all_scenarios")," ",n.jsx("a",{href:r.docsLink,target:"_blank",rel:"noopener noreferrer",className:"xendit-text-link",children:s("simulation.see_all_scenarios")})]}):null]}):null},In="field-radius-bl-0",Tn="field-radius-br-0",qn="field-radius-tl-0",Dn="field-radius-tr-0",Ln="field-collapse-r",Mn="field-collapse-l",On="field-collapse-t",Un="field-collapse-b",Bn=({fieldGroup:e,groupIndex:i,handleFieldChanged:r,channelProperties:o,simulationScenarios:s})=>{const{t:l}=S(),d=t.useRef(null),[c,u]=t.useState({}),h=e.map(e=>e.span),p=Math.ceil(e.reduce((e,n)=>e+n.span,0)/2);t.useLayoutEffect(()=>{const e=d.current;if(e)return e.addEventListener(InternalSetFieldTouchedEvent.type,n),()=>{e.removeEventListener(InternalSetFieldTouchedEvent.type,n)};function n(e){const n=e.target.name;u(e=>({...e,[n]:!0}))}},[]);const m=(()=>{for(const t of e){if(!c[X(t)])continue;const e=En(t,o??{});if(e)return n.jsx("span",{className:"xendit-error-message xendit-text-12",children:kn(l,e,t)})}return null})();return n.jsx(Ye,{children:n.jsxs("div",{className:"xendit-channel-form-field-group",children:[n.jsxs("div",{className:"xendit-channel-form-field-group-label-container",children:[n.jsx("label",{htmlFor:G(e[0]),className:"xendit-text-14",children:e[0].group_label??e[0].label??""}),s?n.jsx(Vn,{simulationScenarios:s,fieldGroup:e}):null]}),n.jsx("div",{ref:d,className:"xendit-form-field-group "+(m?"invalid":""),children:e.map((e,t)=>{const i=(e=>{const n=h.slice(0,e).reduce((e,n)=>e+n,0),t=0===e?0:Math.floor(n/2);return{fieldPositionBySpan:n,fieldRow:t,fieldColumn:n%2,isLastRow:t===p-1}})(t),o=((e,n,t)=>{const{fieldPositionBySpan:i,fieldRow:r,fieldColumn:o,isLastRow:s}=t;return a({[In]:p>r+1||i%2==1,[Tn]:!!h[n+1],[qn]:n>0,[Dn]:!(0===r&&1===o||0===r&&0===o&&2===e.span),[Ln]:1===e.span&&0===o,[Mn]:1===e.span&&1===o,[On]:i>=2,[Un]:!s})})(e,t,i);return n.jsx(gn,{className:o,field:e,onChange:r},t)})},i),m]})})},Vn=({simulationScenarios:e,fieldGroup:a})=>{const i=t.useContext(Ge),{t:r}=S();return n.jsx(Sn,{scenarios:e,onSelect:n=>{const t=e.scenarios.find(e=>e.name===n);if(t?.values)for(const[e,n]of Object.entries(t.values)){const t=a.find(n=>X(n)===e);t&&("credit_card_number"!==t.type.name&&"credit_card_expiry"!==t.type.name&&"credit_card_cvn"!==t.type.name||i?.postMessageToIframe(e,{type:"xendit-iframe-populate-for-simulation",scenario:n}))}},children:n.jsxs(Pn,{children:[n.jsx(Rn,{children:n.jsx("div",{className:"xendit-text-12 xendit-text-semibold xendit-text-link",children:r("simulation.simulate_scenario")})}),n.jsx(jn,{})]})})},Kn={scenarios:[{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"3DS Challenge",name:"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa",values:{"card_details.card_number":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa","card_details.expiry_month__card_details.expiry_year":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa","card_details.cvn":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_visa",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_visa","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_visa","card_details.cvn":"3_ds_frictionless_authentication_is_successful_visa"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"3DS Challenge",name:"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard",values:{"card_details.card_number":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard","card_details.expiry_month__card_details.expiry_year":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard","card_details.cvn":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_mastercard",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_mastercard","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_mastercard","card_details.cvn":"3_ds_frictionless_authentication_is_successful_mastercard"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_visa2",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_visa2","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_visa2","card_details.cvn":"3_ds_frictionless_authentication_is_successful_visa2"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_mastercard2",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_mastercard2","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_mastercard2","card_details.cvn":"3_ds_frictionless_authentication_is_successful_mastercard2"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"Failure",name:"failing_transaction_visa",values:{"card_details.card_number":"failing_transaction_visa","card_details.expiry_month__card_details.expiry_year":"failing_transaction_visa","card_details.cvn":"failing_transaction_visa"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"Failure",name:"failing_transaction_mastercard",values:{"card_details.card_number":"failing_transaction_mastercard","card_details.expiry_month__card_details.expiry_year":"failing_transaction_mastercard","card_details.cvn":"failing_transaction_mastercard"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/AMEX.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn",values:{"card_details.card_number":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn","card_details.cvn":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/AMEX.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2",values:{"card_details.card_number":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2","card_details.cvn":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/AMEX.svg",description:"3DS Challenge",name:"3_ds_challenge_use_a_4_digit_cvn",values:{"card_details.card_number":"3_ds_challenge_use_a_4_digit_cvn","card_details.expiry_month__card_details.expiry_year":"3_ds_challenge_use_a_4_digit_cvn","card_details.cvn":"3_ds_challenge_use_a_4_digit_cvn"}}],docsLink:"https://docs.xendit.co/docs/cards-simulate-card-scenarios"},zn=s.forwardRef(({form:e,onChannelPropertiesChanged:a},i)=>{const r=E(),o=st(),s=S(),l=dt(),d=t.useRef(null),[c,u]=t.useState(null);t.useImperativeHandle(i,()=>({setAllFieldsTouched(){const e=d.current;e&&Array.from(e.elements).filter(e=>e instanceof HTMLInputElement).forEach(e=>{e.name&&e.dispatchEvent(new InternalSetFieldTouchedEvent)})}}));const h=t.useCallback(()=>{if(!d.current)return{};return function(e){const n={};for(const[t,a]of e){if(a instanceof Blob)continue;const e=t.split("__"),i=Xn(e,a);e:for(const t of e){const e=t.split(".");let a=n;for(;e.length>1;){const n=e.shift();let t=a[n];if(void 0===t&&(t=a[n]={}),t&&"object"==typeof t){if(Array.isArray(t))continue e;a=t}}const r=i.length?i.shift():"";a[e[0]]=r}}return n}(new FormData(d.current).entries())},[]),p=t.useCallback(()=>{if(!d.current)return;const e=h();u(e),a(e)},[h,a]),m=function(e,n,a,i){const r=t.useMemo(()=>Hn(e.session_type,n,a,i),[i,a,n,e.session_type]);return r}(r,e,c||{},l??null),_=F(m);t.useEffect(()=>{(function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0})(_||[],m)||p()},[m,p,_]);const f=t.useCallback(e=>s.supportsSimulationScenarios()&&"CARDS"===o?.channel_code&&e.some(e=>"credit_card_number"===e.type.name)?Kn:null,[o,s]),x=function(e){const n=[[]];for(const t of e)1!==t.span||1!==n[n.length-1].length||1!==n[n.length-1][0].span?t.join?n[n.length-1].push(t):n.push([t]):n[n.length-1].push(t);return n}(m).filter(e=>e.length);return 0===x.length?null:n.jsx("div",{class:"xendit-channel-form",children:n.jsx("form",{ref:d,children:n.jsx(Wn.Provider,{value:c,children:x.map((e,t)=>n.jsx(Bn,{fieldGroup:e,groupIndex:t,handleFieldChanged:p,channelProperties:c,simulationScenarios:f(e)},t))})})})}),Wn=e.createContext(null),Fn=()=>t.useContext(Wn);function Xn(e,n){if(0===e.length)return[];if(1===e.length)return[n];if(""===n)return[];try{return JSON.parse(n)}catch(e){return[n]}}function Hn(e,n,t,a){const i=ce(n,"credit_card_number"),r=a?.cardDetails?.details?.require_billing_information,o=!!a?.paymentOptions?.options?.installment_plans?.length;return n.filter(n=>{if(n.flags?.require_billing_information){if("PAY"!==e)return!1;if(!r)return!1}if("installment_plan"===n.type.name&&!o&&i)return!1;for(const e of n.display_if||[]){const[n,a,i]=e,r=Nn(t,n);switch(a){case"equals":if(r!==i)return!1;break;case"not_equals":if(r===i)return!1}}return!0})}const Gn=e=>{const a=t.useRef(null),i=t.useRef(null),r=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{r&&(a.current?.animate($n,Yn),i.current?.animate(Zn,Qn))},[r]),n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[n.jsxs("g",{opacity:"0.5",children:[n.jsx("path",{d:"M8.79453 10.2303C7.1791 10.2303 5.86953 11.5399 5.86953 13.1553V28.9503C5.86953 31.535 7.96484 33.6303 10.5495 33.6303H26.3445C27.96 33.6303 29.2695 32.3208 29.2695 30.7053",fill:"#F1F1F1"}),n.jsx("path",{d:"M8.79453 10.2303V10.2303C7.1791 10.2303 5.86953 11.5399 5.86953 13.1553V28.9503C5.86953 31.535 7.96484 33.6303 10.5495 33.6303H26.3445C27.96 33.6303 29.2695 32.3208 29.2695 30.7053V30.7053",stroke:"#D0D0D0",strokeWidth:"1.755",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsxs("g",{ref:i,style:{transformOrigin:"20px 20px"},children:[n.jsx("path",{d:"M28.8177 6.00256H14.7777C12.193 6.00256 10.0977 8.09787 10.0977 10.6826V24.7226C10.0977 27.3073 12.193 29.4026 14.7777 29.4026H28.8177C31.4023 29.4026 33.4977 27.3073 33.4977 24.7226V10.6826C33.4977 8.09787 31.4024 6.00256 28.8177 6.00256Z",fill:"white",stroke:"#EDEDED",strokeWidth:"1.755",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsxs("g",{style:{transformOrigin:"10px 30px"},ref:a,children:[n.jsx("path",{d:"M26.7697 20.5301V12.7301H18.9697",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M17.4102 22.0901L26.7702 12.7301",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})},$n=[{transform:"scale(0.1)"},{transform:"scale(1)"}],Yn={duration:500,easing:"ease-out"},Zn=[{transform:"rotate(0deg)"},{transform:"rotate(5deg)"},{transform:"rotate(-5deg)"},{transform:"rotate(0deg)"}],Qn={duration:1e3,easing:"ease-out",iterations:1/0,delay:2e3},Jn=[{transform:"translateY(0)"},{transform:"translateY(44px)"}],et={duration:1e3,delay:1e3,easing:"ease-out"},nt={duration:1e3,direction:"reverse",delay:500,easing:"ease-in"},tt=[{opacity:1},{opacity:0},{opacity:1}],at={duration:1e3},it=e=>{const{id:t,label:a,checked:i,onChange:r,disabled:o}=e,s=Z(),l=t||s;return n.jsxs("div",{className:"xendit-checkbox",children:[n.jsxs("div",{className:"xendit-checkbox-box",children:[n.jsx("input",{id:l,type:"checkbox",onChange:e=>{r?.(e)},checked:i,disabled:o}),n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:"xendit-checkbox-graphic",children:n.jsx("polyline",{points:"40 144 96 200 224 72",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"16"})})]}),n.jsx("label",{htmlFor:l,className:"xendit-text-14",children:a})]})},rt=s.forwardRef(({onChange:e,value:t},a)=>{const{t:i}=S(),[r,o]=s.useState({});s.useImperativeHandle(a,()=>({setAllFieldsTouched(){o({given_names:!0})}}));const l=(()=>{if(0===Object.keys(r).length)return null;const e=function(e){if(0===e.given_names.length)return{localeKey:"validation.required"}}(t);return e?n.jsx("span",{className:"xendit-error-message xendit-text-12",children:kn(i,e,"Name")}):null})();return n.jsx("form",{children:n.jsxs("div",{className:"xendit-channel-form-field-group",children:[n.jsx("div",{className:"xendit-channel-form-field-group-label-container",children:n.jsx("label",{htmlFor:"given_names",className:"xendit-text-14",children:i("customer_details.name")})}),n.jsx("div",{className:"xendit-form-field-group "+(l?"invalid":""),children:n.jsx("div",{className:"xendit-channel-form-field xendit-form-field-span-2",children:n.jsx("input",{id:"given_names",name:"given_names",type:"text",placeholder:i("customer_details.form_name"),className:"xendit-form-field-inner xendit-text-14",onBlur:e=>{const n=e.target;o(e=>({...e,[n.name]:!0}))},onChange:n=>{const t=n.target;e({given_names:t.value})},required:!0,autoComplete:"given-name"})})}),l]})})}),ot=e.createContext(null),st=()=>{const e=t.useContext(ot);if(void 0===e)throw new Error("useChannel must be used within a ChannelProvider");return e},lt=e.createContext(null);lt.displayName="ChannelComponentDataContext";const dt=()=>t.useContext(lt),ct=e=>{const{channelOrPair:a,channelData:i,savePaymentMethod:r,formRef:o,customerDetailsFormRef:s}=e,l=t.useRef(null),d=S(),{t:c}=d,u=E(),h=(()=>{const e=t.useContext(y);if(void 0===e)throw new Error("useCustomer must be used within a XenditSessionProvider");return e})(),p=a[0],m=a.length>1,_=oe(a,r),f=_.requires_customer_details&&!h,x=function(e){if(e&&2===e.length)return[e[0],e[1]];return null}(_.instructions),b="OPTIONAL"===u.allow_save_payment_method&&(_.allow_save||m);return t.useLayoutEffect(()=>{x||_.form.length||_.banner||console.error(`Missing display data for ${_.channel_code}, this is a bug, please contact support`)},[x,_.banner,_.channel_code,_.form]),n.jsx(ot.Provider,{value:_,children:n.jsx(lt.Provider,{value:i,children:n.jsxs("div",{className:"xendit-payment-channel",ref:l,children:[n.jsx(zn,{ref:o,form:_.form,onChannelPropertiesChanged:e=>{let n=e;if("CARDS"===p.channel_code&&e.installment_configuration){const t=Object.fromEntries(Object.entries(e.installment_configuration).filter(([e,n])=>""!==n));n=0===Object.keys(t).length?{...e,installment_configuration:void 0}:{...e,installment_configuration:t}}const t=new XenditChannelPropertiesChangedEvent(p.channel_code,n);l.current?.dispatchEvent(t)}}),f&&n.jsx(rt,{ref:s,onChange:e=>{d?.dispatchEvent(new InternalUpdateChannelComponentData(p.channel_code,{customerDetails:e}))},value:i.customerDetails||{given_names:""}}),_.banner?n.jsx(ht,{banner:_.banner}):null,b&&n.jsx(it,{label:c("payment.save_checkbox_label"),onChange:e=>{const n=e.target?.checked;d?.dispatchEvent(new InternalUpdateChannelComponentData(p.channel_code,{savePaymentMethod:n}))},checked:r}),x?n.jsxs("div",{className:"xendit-payment-channel-instructions",children:[ut[_.pm_type??""]??n.jsx(Gn,{}),n.jsx("div",{className:"xendit-payment-channel-instructions-text xendit-text-12",children:x.map((e,t)=>n.jsx("p",{className:0===t?"xendit-text-semibold":void 0,children:e},t))})]}):null]})})})},ut={EWALLET:n.jsx(Gn,{}),QR_CODE:n.jsx(e=>{const a=t.useRef(null),i=t.useRef(null),r=Z(),o=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{if(o&&a.current){const e=()=>{if(!a.current)return;const n=a.current.animate(Jn,et);setTimeout(()=>{i.current?.animate(tt,at)},1e3),n.onfinish=()=>{const n=a.current?.animate(Jn,nt);setTimeout(()=>{i.current?.animate(tt,at)},500),n&&(n.onfinish=e)}};e()}},[o]),n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"var(--xendit-color-icon-primary)",xmlns:"http://www.w3.org/2000/svg",...e,children:[n.jsxs("g",{"clip-path":`url(#${r})`,children:[n.jsx("rect",{x:"8",y:"8",width:"24",height:"24",fill:"var(--xendit-color-icon-secondary)",ref:i}),n.jsx("path",{d:"M11.5 13.1528C11.5 12.24 12.24 11.5 13.1528 11.5H17.4028C18.3156 11.5 19.0556 12.24 19.0556 13.1528V17.4028C19.0556 18.3156 18.3156 19.0556 17.4028 19.0556H13.1528C12.24 19.0556 11.5 18.3156 11.5 17.4028V13.1528Z"}),n.jsx("path",{d:"M20.9444 13.1528C20.9444 12.24 21.6844 11.5 22.5972 11.5H26.8472C27.76 11.5 28.5 12.24 28.5 13.1528V17.4028C28.5 18.3156 27.76 19.0556 26.8472 19.0556H22.5972C21.6844 19.0556 20.9444 18.3156 20.9444 17.4028V13.1528Z"}),n.jsx("path",{d:"M11.5 22.5972C11.5 21.6844 12.24 20.9444 13.1528 20.9444H17.4028C18.3156 20.9444 19.0556 21.6844 19.0556 22.5972V26.8472C19.0556 27.76 18.3156 28.5 17.4028 28.5H13.1528C12.24 28.5 11.5 27.76 11.5 26.8472V22.5972Z"}),n.jsx("path",{d:"M20.9444 22.5972C20.9444 21.6844 21.6844 20.9444 22.5972 20.9444H26.8472C27.76 20.9444 28.5 21.6844 28.5 22.5972V26.8472C28.5 27.76 27.76 28.5 26.8472 28.5H22.5972C21.6844 28.5 20.9444 27.76 20.9444 26.8472V22.5972Z"}),n.jsx("path",{d:"M7.875 23C8.35825 23 8.75 23.3918 8.75 23.875V30.2754C8.75021 30.6755 9.07451 30.9998 9.47461 31H15.875C16.3582 31 16.75 31.3918 16.75 31.875C16.75 32.3582 16.3582 32.75 15.875 32.75H9.47461C8.10801 32.7498 7.00021 31.642 7 30.2754V23.875C7 23.3918 7.39175 23 7.875 23Z"}),n.jsx("path",{d:"M31.875 23C32.3582 23 32.75 23.3918 32.75 23.875V30.2754C32.7498 31.642 31.642 32.7498 30.2754 32.75H23.875C23.3918 32.75 23 32.3582 23 31.875C23 31.3918 23.3918 31 23.875 31H30.2754C30.6755 30.9998 30.9998 30.6755 31 30.2754V23.875C31 23.3918 31.3918 23 31.875 23Z"}),n.jsx("path",{d:"M15.875 7C16.3582 7 16.75 7.39175 16.75 7.875C16.75 8.35825 16.3582 8.75 15.875 8.75H9.47461C9.07451 8.75021 8.75021 9.07451 8.75 9.47461V15.875C8.75 16.3582 8.35825 16.75 7.875 16.75C7.39175 16.75 7 16.3582 7 15.875V9.47461C7.00021 8.10801 8.10801 7.00021 9.47461 7H15.875Z"}),n.jsx("path",{d:"M30.2754 7C31.642 7.00021 32.7498 8.10801 32.75 9.47461V15.875C32.75 16.3582 32.3582 16.75 31.875 16.75C31.3918 16.75 31 16.3582 31 15.875V9.47461C30.9998 9.07451 30.6755 8.75021 30.2754 8.75H23.875C23.3918 8.75 23 8.35825 23 7.875C23 7.39175 23.3918 7 23.875 7H30.2754Z"}),n.jsx("rect",{x:"3",y:"-4",width:"34",height:"4",rx:"1.75",ref:a})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:r,children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})})]})},{})},ht=e=>{const t="number"==typeof e.banner.aspect_ratio?String(e.banner.aspect_ratio):void 0;return e.banner?.link_url?n.jsx("a",{href:e.banner.link_url,target:"_blank",rel:"noopener noreferrer",children:n.jsx("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:t}})}):n.jsx("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:t}})};class XenditChannelPropertiesChangedEvent extends Event{static type="xendit-channel-properties-changed";channel;channelProperties;constructor(e,n){super(XenditChannelPropertiesChangedEvent.type,{bubbles:!0,composed:!0}),this.channel=e,this.channelProperties=n}}class NetworkError extends Error{errorResponse;constructor(e){super(e.message),this.errorResponse=e}}function pt(e){const n=new URLSearchParams;return n.append("payload",JSON.stringify(e)),n}function mt(e,n,t){return async function(...a){let i,r,o,s,l;switch(e){case"GET":[i,r,o,l]=a;break;case"POST":[i,s,r,o,l]=a;break;default:throw new Error(`Unable to call endpoint with method ${e}; this is a bug, please contact support.`)}const d="v0.0.22";I(d),I(d.startsWith("v"));const c=i.hostId;if(c===V)throw new Error("A network request was made in mock mode; this is a bug.");const u=z(c);if(!u)throw new Error(`Unknown hostId ${c} in sdkKey; this is a bug, please contact support.`);const h=new URL(n(r),u);if(t&&!o)throw new Error("Query string argument is missing; this is a bug, please contact support.");const p=t?.(o)??new URLSearchParams;p.set("components_version",d),h.search=p.toString();const m={method:e,body:s?pt(s):void 0,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:l},_=await fetch(h,m);if(!_.ok){const e=await _.json();if(!e||!e.error_code)throw new Error("Unexpected error response from server");throw new NetworkError(e)}return _.json()}}const _t=mt("GET",e=>`/api/sessions/${e}`),ft=mt("POST",()=>"/api/sessions/payment_tokens"),xt=mt("POST",()=>"/api/sessions/payment_requests"),bt=mt("POST",e=>`/api/sessions/${e.sessionAuthKey}/payment_requests/${e.paymentRequestId}/simulate`),yt=mt("GET",e=>`/api/sessions/${e}/poll`,e=>new URLSearchParams(e?{token_request_id:e}:{})),gt=mt("POST",e=>`/api/sessions/${e}/card_info`),vt=mt("POST",e=>`/api/sessions/${e}/payment_options`);function kt(e,n,t){return{impl:e,key:n??"",child:t,instance:void 0}}class BehaviorTree{fn;bb;root=kt(class{});updating=!1;again=!1;constructor(e,n){this.fn=e,this.bb=n}update(){if(this.again=!0,this.updating)return;let e=0;try{for(this.updating=!0;this.again;){this.again=!1,e+=1,wt(e);const n=this.root??void 0,t=this.fn(this.bb);this.root=t,Ct(n,t,this.bb,0)}}finally{this.updating=!1}}findBehavior(e){return At(this.root,e)}}function wt(e){if(e>32)throw new Error("Max recursion depth exceeded; this is a bug, please contact support.")}function Ct(e,n,t,a){if(wt(a),function(e,n){return void 0===e||void 0===n||Array.isArray(e)!==Array.isArray(n)||(!Array.isArray(e)||!Array.isArray(n))&&(q(e),q(n),e.impl!==n.impl||e.key!==n.key)}(e,n))e&&Nt(e,a+1),n&&Et(n,t,a+1);else if(Array.isArray(e)||Array.isArray(n)){T(e),T(n);const i=Math.max(e.length,n.length);for(let r=0;r<i;r++)Ct(e[r],n[r],t,a+1)}else n&&(n.instance=e?.instance),e&&(e.instance=void 0),Ct(e?.child,n?.child,t,a+1),n?.instance?.update?.()}function Et(e,n,t){if(wt(t),Array.isArray(e))for(const a of e)a&&Et(a,n,t+1);else e.instance=new e.impl(n,e.key),e.instance.enter?.(),e.child&&Et(e.child,n,t+1)}function Nt(e,n){if(wt(n),Array.isArray(e))for(const t of e)t&&Nt(t,n+1);else e.child&&Nt(e.child,n+1),e.instance?.exit?.(),e.instance=void 0}function At(e,n){if(Array.isArray(e))for(const t of e){if(!t)continue;const e=At(t,n);if(e)return e}else{if(e.impl===n)return e.instance??null;if(e.child)return At(e.child,n)}return null}class ActionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){}}const St=e=>n.jsxs("div",{className:"xendit-redirect-instructions",children:[n.jsx("div",{className:"xendit-redirect-instructions-logo",children:n.jsx("img",{src:e.logoUrl,alt:e.logoAlt})}),n.jsxs("div",{className:"xendit-redirect-instructions-text",children:[n.jsx("div",{className:"xendit-text-16",children:e.title}),e.subtitle?n.jsx("div",{className:"xendit-text-14 xendit-text-secondary",children:e.subtitle}):null]}),e.redirectUrl?n.jsx("a",{href:e.redirectUrl,className:"xendit-redirect-instructions-button xendit-text-14",children:e.redirectButtonLabel??""}):null]}),Pt=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(St,{title:t("action_deeplink.title"),subtitle:t("action_deeplink.instructions",{channelName:i}),logoUrl:a.brand_logo_url,logoAlt:t("image_alt.channel_logo",{channelName:i}),redirectUrl:e.redirectUrl,redirectButtonLabel:t("action_deeplink.button",{channelName:i})})},Rt=e=>{const{title:a,onClose:i,children:r,seamless:o,borderColor:s,noCloseButton:l}=e,d=t.useRef(!1),c=t.useRef(!1),u=t.useRef(null),h=t.useRef(null),p=void 0!==HTMLElement.prototype.animate,_=t.useCallback(()=>{d.current||(d.current=!0,i())},[i]),f=t.useCallback(()=>{if(!u.current||!h.current||c.current)return;if(c.current=!0,!p)return void _();h.current.animate?.(qt,It);const e=u.current.animate?.(Lt,It);e.onfinish=_},[_,p]);t.useLayoutEffect(()=>{p&&(h.current?.animate?.(Tt,jt),u.current?.animate?.(Dt,jt))},[p]),t.useLayoutEffect(()=>{const e=h.current;if(!e)return;const n=e=>{f()};return e.addEventListener(InternalDialogCloseEvent.eventName,n),()=>{e.removeEventListener(InternalDialogCloseEvent.eventName,n)}},[f]);const x=t.useCallback(e=>{e.target?.dispatchEvent(new InternalDialogCloseEvent)},[]);return t.useLayoutEffect(()=>{e.close&&f()},[e.close,f]),n.jsx("div",{className:"xendit-dialog-backdrop",ref:h,children:n.jsxs("div",{className:"xendit-dialog",ref:u,style:s?{border:`4px solid ${s}`}:void 0,children:[l||o?null:n.jsxs("div",{className:"xendit-dialog-header xendit-text-16 xendit-text-semibold",children:[a,n.jsx("button",{"aria-label":"Close",onClick:f,children:n.jsx(m,{name:"x",size:20})})]}),n.jsx("div",{className:"xendit-dialog-body",style:e.noPadding?{padding:"0"}:void 0,children:r}),!l&&o?n.jsx("button",{"aria-label":"Close",onClick:x,className:"xendit-dialog-floating-close",children:n.jsx(m,{name:"x",size:20})}):null]})})};class InternalDialogCloseEvent extends Event{static eventName="xendit-internal-dialog-close";constructor(){super(InternalDialogCloseEvent.eventName,{bubbles:!0})}}const jt={duration:500,easing:"cubic-bezier(.32,.23,0,.92)",fill:"forwards"},It={duration:200,easing:"linear",fill:"forwards"},Tt=[{backgroundColor:"rgba(0, 0, 0, 0)"},{backgroundColor:"rgba(0, 0, 0, 0.2)",offset:.1},{backgroundColor:"rgba(0, 0, 0, 0.6)"}],qt=Tt.slice().reverse(),Dt=[{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:1,transform:""}],Lt=[{opacity:1,transform:""},{opacity:0,transform:"scale(0.92) translateY(-10px)"}];function Mt(e){const{sdk:a,title:i,onClose:r,width:o,height:s,borderColor:l}=e,d=t.useRef(null);t.useLayoutEffect(()=>{const e=a.createActionContainerComponent(h);return d.current?.replaceChildren(e),()=>{a.destroyComponent(e)}},[a]);const c=e.defaultActionContainerType===Ot.QrWithCustomArt;return n.jsx(Rt,{title:i,onClose:r,close:e.close,borderColor:l,noPadding:c,noCloseButton:c,seamless:!0,children:n.jsx("div",{className:"xendit-default-action-container",ref:d,style:{width:o?`calc(min(100vw - 64px, ${o}px))`:"calc(100vw - 64px)",height:s?`calc(min(100vh - 64px, ${s}px))`:void 0}})})}var Ot;!function(e){e.QrWithCustomArt="qr-with-custom-art",e.Generic="generic"}(Ot||(Ot={}));class ContainerActionBehavior{bb;cleanupFn=null;defaultContainerHeight=0;defaultContainerWidth=400;title="Complete your payment";constructor(e){this.bb=e}ensureHasActionContainer(n=Ot.Generic){if(I(this.bb.channel),this.bb.sdk[h].liveComponents.actionContainer)return()=>{this.emptyActionContainer()};let t=!1,a=!1;const i=document.createElement("div");i.setAttribute("class","xendit-default-action-container");const r={sdk:this.bb.sdk,title:this.title,width:this.defaultContainerWidth,height:this.defaultContainerHeight,borderColor:void 0,defaultActionContainerType:n,onClose:()=>{t=!0,e.render(null,i),i.remove(),a||this.bb.sdk.abortSubmission()}};return e.render(e.createElement(Mt,r),i),document.body.appendChild(i),n=>{n||(a=!0),t||e.render(e.createElement(Mt,{...r,close:!0}),i)}}cleanupActionContainer(e){this.cleanupFn&&(this.cleanupFn(e),this.cleanupFn=null)}emptyActionContainer(){const n=this.bb.sdk[h].liveComponents.actionContainer;n&&e.render(null,n)}updateActionContainerBrandColor(){I(this.bb.channel);const e=this.bb.sdk[h].liveComponents.actionContainer;e&&e.style.setProperty("--xendit-channel-brand-color",this.bb.channel.brand_color)}populateActionContainer(n){const t=this.bb.sdk[h].liveComponents.actionContainer;if(!t)throw new Error("Trying to populate action container, but it is missing; A default action container should have been created. This is a bug, please contact support.");this.updateActionContainerBrandColor(),e.render(n(),t)}exit(){this.cleanupActionContainer(!1),this.emptyActionContainer()}}class ActionDeepLinkBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){I(this.bb.world);const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];if(D(n?.type,"REDIRECT_CUSTOMER"),"DEEPLINK_URL"!==n.descriptor&&"WEB_URL"!==n.descriptor)throw new Error("Unexpected action type in ActionDeepLinkBehavior");const t=this.bb.sdk.t.bind(this.bb.sdk),a=this.bb.channel;I(a),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(Pt,{t:t,channel:a,redirectUrl:n.value}))}exit(){super.exit()}}const Ut=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(St,{title:t("action_empty_list_push_notification.title"),subtitle:t("action_empty_list_push_notification.subtext",{channelName:i}),logoUrl:a.brand_logo_url,logoAlt:t("image_alt.channel_logo",{channelName:i}),redirectUrl:null,redirectButtonLabel:null})};var Bt;function Vt(e){return"payment_request_id"in e?{id:e.payment_request_id,type:Bt.PaymentRequest,entity:e}:{id:e.payment_token_id,type:Bt.PaymentToken,entity:e}}function Kt(e,n,t){return`${e===Bt.PaymentRequest?"payment_request":"payment_token"}_status.${n.toLowerCase()}.${t}`}!function(e){e.PaymentRequest="REQUEST",e.PaymentToken="TOKEN"}(Bt||(Bt={}));function zt(e,n,t){const{session:a,paymentEntity:i}=e;switch(I(a),I(i),I(n),t){case"PENDING":return Wt(a);case"PENDING_PAYMENT_ENTITY_ONLY":return function(e,n){const t=n.type===Bt.PaymentRequest?n.entity:void 0,a=n.type===Bt.PaymentToken?n.entity:void 0;return{session:e,payment_request:Ft(t,"PENDING"),payment_token:Ft(a,"PENDING")}}(a,i);case"SUCCESS":return"PENDING"===n._mock_action_type?Wt(a):function(e,n){const t=n.type===Bt.PaymentRequest?n.entity:void 0,a=n.type===Bt.PaymentToken?n.entity:void 0;return{session:{...e,status:"COMPLETED",payment_request_id:t?.payment_request_id,payment_token_id:a?.payment_token_id},payment_request:Ft(t,"SUCCEEDED"),payment_token:Ft(a,"ACTIVE"),succeeded_channel:{channel_code:n.entity.channel_code,logo_url:"https://placehold.co/48"}}}(a,i);case"FAILURE":return function(e,n){const t=n.type===Bt.PaymentRequest?n.entity:void 0,a=n.type===Bt.PaymentToken?n.entity:void 0;return{session:{...e,status:"ACTIVE"},payment_request:Ft(t,"FAILED"),payment_token:Ft(a,"FAILED")}}(a,i)}}function Wt(e){return{session:{...e,status:"PENDING"}}}function Ft(e,n){return e?{...e,status:n}:e}function Xt(e,n){return"PENDING"===n?{payment_request_id:`pr-${Y()}`,status:"PENDING",channel_code:e,actions:[],session_token_request_id:Y()}:n?{payment_request_id:`pr-${Y()}`,status:"REQUIRES_ACTION",channel_code:e,actions:Ht(n),session_token_request_id:Y()}:{payment_request_id:`pr-${Y()}`,status:"SUCCEEDED",channel_code:e,actions:[],session_token_request_id:Y()}}function Ht(e){if(!e)return[];return(Array.isArray(e)?e:[e]).map(e=>function(e){if("PENDING"===e)throw new Error("PENDING mock action type should not generate an action");switch(e){case"IFRAME":return{type:"REDIRECT_CUSTOMER",descriptor:"WEB_URL",value:"https://example.com/iframe",iframe_capable:!0};case"REDIRECT":return{type:"REDIRECT_CUSTOMER",descriptor:"WEB_URL",value:"https://example.com/redirect",iframe_capable:!1};case"PAYLINK":return{type:"REDIRECT_CUSTOMER",descriptor:"WEB_GOOGLE_PAYLINK",value:"https://example.com/paylink"};case"DEEP_LINK":return{type:"REDIRECT_CUSTOMER",descriptor:"DEEPLINK_URL",value:"mockapp://mock-deep-link"};case"PUSH_NOTIFICATION":return null;case"QR":return{type:"PRESENT_TO_CUSTOMER",descriptor:"QR_STRING",value:"https://example.com/qr-code-data",action_title:"Pay with QR Code",action_subtitle:"Scan the QR code below",action_graphic:"",instructions:null};case"BARCODE":return{type:"PRESENT_TO_CUSTOMER",descriptor:"PAYMENT_CODE",value:"1234567890",action_title:"Pay at a Store",action_subtitle:"Show this barcode to the cashier",action_graphic:"",instructions:null};case"VA":return{type:"PRESENT_TO_CUSTOMER",descriptor:"VIRTUAL_ACCOUNT_NUMBER",value:"1234567890",action_title:"Pay with Virtual Account",action_subtitle:"Protect yourself from fraud - ensure all details are correct",action_graphic:"",instructions:[{title:"Mobile Banking",content:[{type:"text",text:"Open Mobile App"},{type:"text",text:"Select <b>Mock VA</b>, then select <b>Transfer</b>"},{type:"text",text:"Enter your Virtual Account Number, for example 3816523906568, then press <b>OK</b>"},{type:"text",text:"Click on <b>Send</b> button at the top right corner to proceed"},{type:"text",text:"Click <b>OK</b> to proceed"},{type:"text",text:"Enter your PIN to authorize the transaction"}]},{title:"Internet Banking",content:[{type:"text",text:"Login to the website"},{type:"text",text:"Select <b>Transfer</b>, then select <b>Transfer to Mock VA Virtual Account</b>"},{type:"text",text:"Enter the Virtual Account Number, for example 3816523906568"},{type:"text",text:"Select <b>Continue</b> to proceed your payment"}]},{title:"ATM",content:[{type:"text",text:"Insert your ATM card and PIN"},{type:"text",text:"Enter your ATM PIN"},{type:"text",text:"Select <b>Transfer</b>"},{type:"text",text:"Select <b>To Mock VA Virtual Account</b>"},{type:"text",text:"Enter Virtual Account Number, for example 3816523906568. Press <b>Correct</b> to proceed"},{type:"text",text:"Verify Virtual Account details and then enter amount to be transferred and select <b>Correct</b> to confirm"},{type:"text",text:"Confirm your transaction details displayed"},{type:"text",text:"Select <b>Yes</b> if the details are correct or <b>No</b> if the details are not correct"}]}]}}throw new Error(`Unknown mock action type: ${e}`)}(e)).filter(e=>null!==e)}class ActionEmptyListPushNotificationBehavior extends ContainerActionBehavior{bb;constructor(e){super(e),this.bb=e}enter(){I(this.bb.world),this.bb.hackyOvoActionLatch=!0;const n=this.bb.sdk.t.bind(this.bb.sdk),t=this.bb.channel;I(t),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(Ut,{t:n,channel:t})),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(zt(this.bb.world,this.bb.channel,"PENDING_PAYMENT_ENTITY_ONLY")))}exit(){this.bb.hackyOvoActionLatch=void 0,super.exit()}}function Gt(e){const{url:a,channelCode:i,mock:r,onIframeComplete:o}=e,s=t.useRef(null),l=t.useCallback(e=>{if(!s.current)return;const n=s.current.contentWindow;e.source===n&&"xendit-iframe-action-complete"===e.data?.type&&o(e.data)},[o]);if(t.useLayoutEffect(()=>(window.addEventListener("message",l),()=>{window.removeEventListener("message",l)}),[l]),r){const e=$t("CARDS"===i?"a 3DS authentication page":"an authentication page");return n.jsx("iframe",{ref:s,srcDoc:e,className:"xendit-action-iframe"})}return n.jsx("iframe",{ref:s,src:a,className:"xendit-action-iframe"})}const $t=e=>`\n <html>\n <head>\n <title>Xendit Mock Action Iframe</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n font-size: 14px;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 12px;\n }\n p {\n margin: 0;\n }\n .buttons {\n display: flex;\n gap: 8px;\n }\n button {\n font-size: 12px;\n display: flex;\n align-items: center;\n text-align: left;\n background-color: white;\n border: 1px solid rgba(243, 243, 243);\n border-radius: 4px;\n justify-content: space-between;\n padding: 4px;\n cursor: pointer;\n }\n button:hover {\n border-color: #1762ee;\n background-color: #1762ee;\n color: white;\n }\n </style>\n </head>\n <body>\n <p>This is a mock action page.</p>\n <p>Normally, this would be ${e}.</p>\n <p>Click a button below to simulate the result of the action.</p>\n <div class="buttons">\n <button onclick="parent.postMessage({type: 'xendit-iframe-action-complete', mockStatus: 'success'}, '*')">\n Simulate Success\n </button>\n <button onclick="parent.postMessage({type: 'xendit-iframe-action-complete', mockStatus: 'fail'}, '*')">\n Simulate Failure\n </button>\n </div>\n </body>\n </html>\n`;class ActionIframeBehavior extends ContainerActionBehavior{bb;url;constructor(e,n){super(e),this.bb=e,this.url=n,this.defaultContainerHeight=600}enter(){this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>(I(this.bb.channel),e.createElement(Gt,{url:this.url,channelCode:this.bb.channel.channel_code,mock:this.bb.mock,onIframeComplete:e=>{this.cleanupActionContainer(!1);const n="success"===e.mockStatus?"SUCCESS":"FAILURE";this.updateMocksOnIframeCompletion(n),this.bb.actionCompleted=!0,this.bb.pollImmediatelyRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}})))}updateMocksOnIframeCompletion(e){I(this.bb.world?.paymentEntity),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(zt(this.bb.world,this.bb.channel,e)))}exit(){super.exit()}}const Yt={format:"CODE128",renderer:"svg",width:2,height:132,displayValue:!0,fontOptions:"",font:"Roboto",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:14,background:"#ffffff",lineColor:"#000000",margin:8},Zt=({instructions:e})=>{switch(e.length){case 0:return null;case 1:return n.jsx(Qt,{instruction:e[0]});default:return n.jsx(Jt,{instructions:e})}},Qt=e=>n.jsxs("div",{children:[n.jsx("p",{className:"xendit-instructions-single-tab-heading",children:e.instruction.title}),n.jsx(ea,{instruction:e.instruction})]}),Jt=e=>{const[i,r]=t.useState(0);return n.jsxs("div",{children:[n.jsx("div",{className:"xendit-instructions-tab-list",children:e.instructions.map((e,t)=>n.jsx("button",{className:a("xendit-instructions-tab-button",{"xendit-instructions-active-tab":i===t}),onClick:()=>r(t),children:e.title},t))}),n.jsx(ea,{instruction:e.instructions[i]})]})},ea=t=>n.jsx("ol",{className:"xendit-instructions-numbered-list","data-testid":"instructions-steps",children:t.instruction.content.map((t,a)=>{const i=Array.isArray(t)?t:[t];return n.jsx("li",{className:"xendit-instructions-step-li",children:n.jsx("div",{className:"xendit-instructions-step-box",children:i.map((t,a)=>n.jsx(e.Fragment,{children:ia(t)},a))})},a)})});function na(e){return Array.from(e).map((e,t)=>{switch(e.nodeType){case Node.TEXT_NODE:return null===e.textContent?null:e.textContent;case Node.ELEMENT_NODE:return function(e,t){const i=a({"xendit-instructions-bold":"B"===e.nodeName,"xendit-instructions-italics":"I"===e.nodeName});return i?n.jsx("span",{className:i,children:na(e.childNodes)},t):na(e.childNodes)}(e,t);default:return null}})}const ta="undefined"!=typeof DOMParser?new DOMParser:null;function aa(e){try{if(!ta)return e;return na(ta.parseFromString(e,"text/html").body.childNodes)}catch(n){return e}}function ia(e){if("string"==typeof e)return n.jsx("p",{className:"xendit-instructions-step-item",children:aa(e)});switch(e.type){case"text":return function(e){return n.jsx("p",{children:aa(e.text)})}(e);case"image":return function(e){return n.jsx("div",{children:n.jsx("img",{src:e.src,alt:e.alt||"",style:{height:`${e.height??24}px`}})})}(e);case"bullets":return function(e){return n.jsx("ul",{className:"xendit-instructions-bullet-list",children:e.items.map((e,t)=>n.jsx("li",{children:aa(e)},t))})}(e);case"form":return function(e){return n.jsxs("div",{className:"xendit-instructions-form-card",children:[e.heading?n.jsx("h3",{className:"xendit-instructions-form-heading",children:aa(e.heading)}):null,e.fields.map((e,t)=>n.jsxs("div",{className:"xendit-instructions-form-field",children:[n.jsx("div",{className:"xendit-instructions-form-field-label",children:aa(e.label)}),n.jsx("div",{className:"xendit-instructions-form-field-value",children:aa(e.value)})]},t))]})}(e);case"table":return function(e){return n.jsxs("table",{className:"xendit-instructions-table",children:[n.jsx("thead",{children:n.jsx("tr",{children:e.headers.map((e,t)=>n.jsx("th",{className:"xendit-instructions-table-header",children:aa(e)},t))})}),n.jsx("tbody",{children:e.rows.map((e,t)=>n.jsx("tr",{children:e.map((e,t)=>n.jsx("td",{className:"xendit-instructions-table-cell",children:aa(e)},t))},t))})]})}(e)}return null}function ra(e){const{amount:a,channelLogo:i,currency:r,onAffirm:o,barcodeContent:s,merchantName:d,instructions:c,title:u,t:h}=e,[p,m]=t.useState(!1),_=t.useCallback(()=>{m(!0),o()},[o]),f=[{heading:h("action_barcode.merchant_name"),value:d},{heading:h("action_barcode.barcode_content"),value:s},{heading:h("action_barcode.amount_to_pay"),value:xn(a,r)}],x=t.useMemo(()=>{try{return function(e){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");return l(n,e,Yt),n}(s)}catch(e){console.log("Error generating barcode SVG:",e);const n=document.createElement("div");return n.innerText=h("action_barcode.unable_to_generate"),n}},[s,h]);return n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:i,alt:"Channel Logo",className:"xendit-action-barcode-channel-logo"}),n.jsx("div",{className:"xendit-action-title",children:u}),n.jsx("div",{"data-testid":"barcode",className:"xendit-action-barcode-barcode-container",role:"button",tabIndex:0,ref:e=>{!e||1===e.childNodes.length&&e.firstChild===x||e?.replaceChildren(x)}}),n.jsx("div",{className:"xendit-action-barcode-content",children:n.jsx("div",{className:"xendit-action-barcode-details",children:f.map((e,t)=>n.jsx("div",{className:"xendit-action-barcode-detail-item",children:n.jsxs("div",{className:"xendit-action-barcode-detail-content",children:[n.jsx("div",{className:"xendit-action-barcode-heading xendit-text-12 xendit-text-semibold",children:e.heading}),n.jsx("div",{className:"xendit-action-barcode-value xendit-text-semibold",children:e.value})]})},t))})}),n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(pe,{variant:ue.WHITE_ROUNDED,disabled:p,onClick:_,className:"xendit-button-block",children:p?n.jsx(me,{}):h("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:h("action.payment_confirmation_instructions")})]}),n.jsx(Zt,{instructions:c})]})}class ActionBarcodeBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];D(n?.type,"PRESENT_TO_CUSTOMER"),I(this.bb.world),I(this.bb.channel);const t={amount:this.bb.world.session.amount,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,onAffirm:this.affirmPayment.bind(this),barcodeContent:n.value,merchantName:this.bb.world.business.name??"",paymentCode:n.value,instructions:n.instructions??[],title:n.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(ra,t))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class ActionPaylinkBehavior{bb;actionIndex;el=null;constructor(e,n){this.bb=e,this.actionIndex=n}enter(){I(this.bb.world),I(this.bb.world.paymentEntity);const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];if(!e)throw new Error("Action not found for paylink behavior");D(e.type,"REDIRECT_CUSTOMER"),D(e.descriptor,"WEB_GOOGLE_PAYLINK");const n=document.createElement("link");n.rel="facilitated-payment",n.href=e.value,this.el=n,document.head.appendChild(n)}exit(){this.el?.remove(),this.el=null}}function oa(e){return"QRIS"===e?sa:"SGQR"===e?la:"DUITNOW_QR"===e?da:"PROMPTPAY"===e?ca:"QRPH"===e?ua:null}function sa(e){const{channelLogo:t,channelName:a,merchantName:i,amountText:r,t:o}=e,s="#DB4849",l="24px";return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:l,paddingRight:l,overflow:"hidden"},children:[pa.closeButton({}),n.jsx("img",{src:t,alt:o("image_alt.channel_logo",{channelName:a}),style:{height:"64px",alignSelf:"center"}}),n.jsx("div",{className:"xendit-text-center xendit-text-16",style:{display:"flex",flexDirection:"column",gap:"4px",marginTop:"16px"},children:n.jsx("div",{className:"xendit-text-semibold",children:i})}),n.jsxs("div",{style:{position:"relative",margin:`-${l}`,marginBottom:"0",padding:l},children:[n.jsxs("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:[e.qr,n.jsx("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:l},children:r})]}),n.jsx("svg",{style:{position:"absolute",top:"-9%",left:0,width:"60%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:n.jsx("polygon",{fill:s,points:"0,0 50,50 0,100"})}),n.jsx("svg",{style:{position:"absolute",bottom:0,right:0,width:"30%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:n.jsx("polygon",{fill:s,points:"0,100 100,100 100,0"})})]})]})}function la(e){const{merchantName:t,amountText:a,channelLogo:i,channelName:r,t:o}=e;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:"24px",paddingRight:"24px",overflow:"hidden"},children:[n.jsx("img",{src:i,alt:o("image_alt.channel_logo",{channelName:r}),style:{height:"56px",alignSelf:"center",marginBottom:"8px"}}),pa.closeButton({}),n.jsx("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:n.jsx("div",{style:{"--xendit-qr-foreground-color":"#7C2279"},children:e.qr})}),n.jsx("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),n.jsx("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:a}),n.jsx("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px",marginBottom:"16px"},children:t})]})}function da(e){const{merchantName:t,amountText:a}=e,i="#ED3066";return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"40px",overflow:"hidden"},children:[pa.closeButton({}),n.jsx("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),n.jsx("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:a}),n.jsx("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px"},children:t}),n.jsxs("svg",{viewBox:"0 0 180 180",style:{aspectRatio:"1",margin:"32px 14% 24px"},children:[n.jsx("rect",{width:"180",height:"180",fill:i,rx:13}),n.jsx("rect",{x:"10",y:"10",width:"160",height:"140",fill:"white",rx:4}),n.jsx("path",{d:"M0 180 L20 180 L0 160 Z",fill:i}),n.jsx("path",{d:"M10 150 L30 150 L10 130 Z",fill:"white"}),n.jsx("foreignObject",{x:"40",y:"30",width:"100",height:"100",children:n.jsx("div",{style:{"--xendit-qr-foreground-color":i},children:e.qr})}),n.jsx("foreignObject",{x:"0",y:"160",height:"10px",width:"180px",style:{overflow:"visible"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",height:"10px"},children:pa.malaysiaNationalQrText({width:"auto"})})})]})]})}function ca(e){const{merchantName:t,amountText:a,channelLogo:i,channelName:r,t:o}=e;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",overflow:"hidden"},children:[n.jsxs("div",{style:{backgroundColor:"#1C3C63",padding:"8px",height:"64px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"},children:[pa.promptpay({height:"48px"}),pa.closeButton({color:"white"})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"0 16px"},children:[n.jsx("img",{src:i,alt:o("image_alt.channel_logo",{channelName:r}),style:{height:"56px",alignSelf:"center",marginTop:"16px"}}),n.jsx("div",{style:{padding:"16px 42px"},children:e.qr}),n.jsxs("div",{className:"xendit-text-center xendit-text-semibold",style:{fontSize:"20px",lineHeight:"24px",marginBottom:"12px",display:"flex",flexDirection:"column",gap:"8px"},children:[a,n.jsx("div",{className:"xendit-text-16",children:t})]})]})]})}function ua(e){const{merchantName:t,amountText:a,channelLogo:i,channelName:r,t:o}=e;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:"24px",paddingRight:"24px",paddingBottom:"12px",overflow:"hidden"},children:[n.jsx("img",{src:i,alt:o("image_alt.channel_logo",{channelName:r}),style:{height:"48px",alignSelf:"center",marginBottom:"16px"}}),pa.closeButton({}),n.jsxs("div",{style:{backgroundColor:"white",border:"4px solid rgb(0,0,0,0.15)",zIndex:1,position:"relative",borderRadius:"12px",display:"flex",flexDirection:"column",gap:"16px",padding:"24px"},children:[n.jsxs("div",{className:"xendit-text-center",style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsx("div",{className:"xendit-text-semibold",style:{fontSize:"20px",lineHeight:"28px"},children:t}),n.jsx("div",{className:"xendit-text-bold",style:{fontSize:"24px",lineHeight:"32px"},children:a})]}),n.jsxs("div",{style:{position:"relative"},children:[e.qr,pa.qrph({position:"absolute",top:"50%",left:"50%",width:"12%",height:"12%",aspectRatio:"1",transform:"translate(-50%, -50%)",zIndex:"3",backgroundColor:"white",padding:"8px",borderRadius:"6px"})]})]})]})}function ha(e){e.target?.dispatchEvent(new InternalDialogCloseEvent)}const pa={closeButton:e=>n.jsx("button",{"aria-label":"Close",onClick:ha,className:"xendit-dialog-floating-close",style:e,children:n.jsx(m,{name:"x",size:20})}),sgqr:e=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"83",height:"40",fill:"none",style:e,children:n.jsx("path",{fill:"#FD0031",d:"M18.395 39.983c-1.224-.14-2.626-.38-3.422-.587-3.582-.931-6.767-2.787-9.275-5.403-2.74-2.858-4.46-6.15-5.268-10.084C.174 22.663 0 21.206 0 20.11c0-1.08.183-2.682.33-3.479.426-2.313 1.002-4.05 1.922-5.793 2.09-3.962 5.07-6.896 8.903-8.768C15.535-.069 20.427-.564 25.188.65c.627.16 1.23.33 1.339.378.109.049.466.189.793.311 1.247.468 4.159 2.023 4.066 2.173-.022.036.02.066.093.066.149 0 .554.297 1.143.838.215.197.408.343.428.323.085-.085 1.9 1.72 2.529 2.515.833 1.051 1.838 2.587 2.344 3.583 1.04 2.045 1.845 4.59 1.99 6.29.034.381.078.827.099.99.301 2.344-.09 5.848-.936 8.368-.52 1.549-1.374 3.302-2.212 4.541-3.84 5.68-9.678 8.864-16.436 8.966-.955.014-1.87.011-2.033-.008m-3.521-11.997a4.97 4.97 0 0 0 2.763-2.024c.525-.767.739-1.481.747-2.498.006-.77-.029-.97-.26-1.464-.625-1.341-1.287-1.932-2.865-2.556-.537-.213-1.018-.387-1.068-.387-.193 0-2.957-.924-3.333-1.114-.519-.262-.864-.535-1.013-.8-.285-.508-.048-1.383.475-1.756.386-.274.82-.588 1.777-.588.68 0 1.93.388 3.025.94 1.057.53 1.241.621 1.339.469.023-.036.182-.319.404-.614.59-.783.897-1.342.832-1.512-.085-.22-.783-.692-1.713-1.16-1.789-.901-4.057-1.193-5.523-.71-1.955.642-3.242 1.871-3.68 3.513-.284 1.066-.054 2.359.603 3.384.707 1.104 1.445 1.467 5.606 2.76 1.291.402 1.656.595 2.01 1.066.822 1.092.13 2.172-1.585 2.47-.81.141-1.74.052-2.655-.255-.72-.241-1.972-.906-2.464-1.308-.154-.127-.335-.23-.401-.23-.097 0-1.142 1.204-1.599 1.843-.146.204.02.414.795 1 .693.525 1.724 1.069 2.591 1.368 1.351.467 3.915.547 5.192.163m13.686.177c1.398-.22 3.134-.984 4.219-1.856l.59-.475.082-.739c.09-.818.026-5.764-.078-5.93-.043-.072-1.146-.106-3.381-.106h-3.317l-.01.619c-.006.34-.028.94-.05 1.331-.024.447.002.737.07.779.059.036.928.06 1.931.05l1.824-.016-.019 1.267c-.021 1.454.04 1.345-1.068 1.891-.412.185-1.417.367-2.231.367-1.306 0-1.558-.027-2.061-.223-.742-.288-1.009-.457-1.592-1.008-.946-.893-1.469-2.297-1.468-3.943 0-1.703.476-2.94 1.52-3.95 1.032-.997 1.761-1.267 3.403-1.262 1.36.005 2.474.36 3.674 1.174.203.138.42.25.48.249.176-.003 1.647-1.844 1.647-2.062 0-.57-2.065-1.734-3.818-2.153-.966-.231-1.233-.256-2.33-.213-.924.035-1.405.103-1.885.266-2.384.811-4.35 2.497-5.259 4.51-.562 1.243-.798 3.178-.597 4.897.233 2.004 1.233 3.701 2.976 5.05.813.63 2.018 1.195 2.979 1.397.96.203 2.775.245 3.769.089m26.951-.466c-.28-.26-.638-.613-.794-.787-.304-.338-.413-.34-.89-.01-.82.568-2.916 1.168-4.076 1.168-1.205 0-3.068-.358-4.134-.95-1.996-1.107-3.6-3.424-3.882-5.96-.421-3.777 1.39-6.944 4.74-8.292 1.087-.438 2.055-.643 3.01-.636 2.095.015 4.211.768 5.616 2 .712.624 1.63 2.082 2.015 3.2.249.723.501 2.097.501 2.73 0 1.134-.536 3.078-1.147 4.157-.187.33-.34.64-.34.687s.279.316.62.598c.999.825 1 .828.322 1.665-.513.634-.805.9-.99.9-.033 0-.29-.212-.57-.47m-3.984-2.258c.727-.362.805-.61.32-1.01-.18-.15-.641-.564-1.023-.922-.863-.809-.804-.931-.554-1.218.144-.165.835-.956.941-1.084.242-.29.67-.002 2.108 1.398.607.592.783.546 1.223-.317.327-.643.352-1.452.384-1.827.023-.269-.013-1.368-.085-1.694-.65-2.936-3.836-4.965-6.546-4.167-1.22.359-2.147.982-2.857 1.92-.874 1.156-1.161 2.046-1.155 3.579.006 1.816.463 2.952 1.676 4.167 1.241 1.243 2.006 1.542 3.833 1.496 1.043-.026 1.204-.056 1.735-.321m8.396 2.254-1.017-.028V12.423l1.711-.002c2.44-.002 6.251.191 7.066.358 1.721.352 2.764 1.24 3.381 2.877.264.699.322 1.883.133 2.702-.157.68-.635 1.63-1.05 2.089-.432.478-1.36 1.107-1.985 1.345-.236.09-.43.224-.43.3 0 .074.211.435.469.803.257.367.788 1.135 1.18 1.707.678.99 1.064 1.533 1.808 2.536.182.247.312.468.288.492-.071.071-2.179.136-2.52.077-.278-.048-.507-.332-2.08-2.579-.974-1.388-1.84-2.562-1.928-2.609-.14-.075-1.422-.117-3.092-.1l-.57.005v2.612c0 2.409-.014 2.616-.174 2.649-.095.02-.63.024-1.19.008m7.165-7.829c.69-.327 1.353-.996 1.544-1.558.337-.987-.015-2.293-.78-2.897-.694-.547-1.127-.627-3.838-.716-1.364-.044-2.515-.044-2.56 0-.06.059-.114 3.938-.073 5.28.004.16.194.173 2.559.173h2.553z"})}),promptpay:e=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"158",height:"48",fill:"none",style:e,children:[n.jsx("title",{children:"Thai QR Payment"}),n.jsx("path",{fill:"#fff",d:"M66.998 27.875h5.312s2.406.204 3.508 1.709c.744 1.015.904 3.592 0 4.825-1.315 1.792-3.508 1.91-3.508 1.91h-2.806v5.93h-2.506zm7.016 4.121c.013-2.277-4.51-1.81-4.51-1.81v3.62s4.495.606 4.51-1.81m1.904 10.253 5.713-14.374h1.804l5.712 14.374h-2.806l-1.203-3.317h-5.211l-1.203 3.317zm8.419-5.428-1.804-5.026-1.804 5.026zm8.72-.2-5.313-8.746h3.107l3.458 5.93 3.458-5.93h3.106l-5.311 8.745v5.63h-2.506zm9.721-8.746h3.508l3.758 10.052 3.758-10.052h3.508v14.374h-2.505V31.795l-3.609 9.148h-2.305l-3.608-9.148V42.25h-2.505zm18.14 0h9.521v2.312h-6.815v3.82h6.414v2.11h-6.414v3.82h6.815v2.313h-9.521zm12.728 14.374V27.875h2.506l5.913 9.851v-9.851h2.506v14.374h-2.506l-5.913-9.85v9.85zm17.339-12.062h-4.41v-2.312h11.426v2.312h-4.41v12.062h-2.606zm-12.199-8.746s-1.371 1.096-4.538 1.125c-4.245-.098-6.073-2.265-7.306-5.755-.933-3.267-.053-9.45 5.368-10.801.12-.03 4.794-1.17 7.856 2.077 3.438 3.814 2.405 10.02.687 11.663-.01.038 2.014 2.208 2.014 2.208l-1.65 1.762zm-2.033-2.122-2.073-2.009 1.746-1.777 2.139 2.021s.849-.739.826-3.423c-.017-1.88-.617-3.54-1.654-4.431-1.354-1.163-3.965-1.431-5.62-.578-1.409.725-2.225 2.063-2.493 4.084-.395 2.711.753 5.79 3.552 6.645 1.247.358 2.568.315 3.577-.532m9.02 2.926V6.061h5.012s1.956-.045 3.107.503c2.368 1.127 2.895 2.537 2.906 4.272.003 3.071-2.906 4.071-2.906 4.071l4.109 7.338h-3.213l-4.003-6.835h-1.905v6.835zm7.065-9.55c1.231-.51 1.773-2.837-.186-3.719-.864-.389-3.772-.301-3.772-.301v4.322s3.204.242 3.958-.301m-80.829-4.02h-5.011V6.06h13.03v2.614h-5.012v13.57h-3.007zM82.432 6.06h2.807v6.635h7.216V6.06h2.806v16.184h-2.806v-6.634h-7.216v6.634h-2.807zm21.749 0h2.105l6.514 16.184h-3.207l-1.503-3.418h-5.713l-1.504 3.418h-3.207zm3.107 9.952-2.055-5.529-2.054 5.529zm7.817-9.952h2.907v16.184h-2.907s.025-16.184 0-16.184"}),n.jsx("path",{fill:"#fff",stroke:"#00427a","stroke-width":".879",d:"M12.552 47.472s-5.185-.205-8.519-3.518S.525 35.41.525 35.41V12.59s.221-5.224 3.508-8.544 8.52-3.518 8.52-3.518h22.85s5.209.163 8.519 3.518 3.508 8.545 3.508 8.545v20.708l14.332 14.173z"}),n.jsx("path",{fill:"#00a796",d:"M26.602 42.245v-8.544h2.37c2.781 0 3.153-.15 3.766-.957.603-.792.873-1.295.88-3.645.002-1.204 0-2.435 0-2.435l14.799 15.581z"}),n.jsx("path",{fill:"#00427a",d:"M10.598 41.825c-2.198-.713-3.83-2.34-4.576-4.563-.281-.838-.315-1.102-.268-5.371.02-1.786.042-5.282 0-5.227h8.519v2.379c0 2.564.1 2.887.85 3.698.661.714 1.243.96 3.553.96h2.613v8.544h-5.045c-4.33 0-4.998-.21-5.646-.42M5.754 18.499c0-4.572.018-6.837.247-7.65.614-2.182 2.227-3.908 4.402-4.714.756-.28 1.048-.38 5.774-.38h5.111v8.544h-2.485c-2.594 0-2.899.105-3.676.886-.748.753-.745 1.127-.854 3.745v2.406h-8.52zm27.862 2.837s.006-1.225 0-2.726c-.01-2.47-.478-2.923-.959-3.427-.48-.505-.668-.874-3.35-.884-.943-.003-2.707 0-2.707 0V5.755h4.25c2.453 0 4.771.063 5.313.145 1.34.204 2.72.892 3.682 1.839.921.906 1.816 2.611 2.017 3.846.073.443.274 2.04.273 3.552-.003 2.768 0 6.199 0 6.199z"})]}),malaysiaNationalQrText:e=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"209",height:"19",fill:"none",viewBox:"0 0 209 19",style:e,children:[n.jsx("title",{children:"Malaysia National QR"}),n.jsx("path",{fill:"#fff",d:"M1.16 14.58q-.56 0-.86-.32t-.3-.88V1.36Q0 .78.32.48.64.16 1.2.16q.5 0 .78.2.3.18.54.64l4.94 9.14h-.64L11.76 1q.24-.46.52-.64.28-.2.78-.2.56 0 .86.32.3.3.3.88v12.02q0 .56-.3.88-.28.32-.86.32-.56 0-.86-.32t-.3-.88V4.12h.44l-4.2 7.66a1.6 1.6 0 0 1-.42.5q-.22.16-.6.16t-.62-.16a1.6 1.6 0 0 1-.42-.5L1.84 4.1h.48v9.28q0 .56-.3.88-.28.32-.86.32m19.643.04q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m11.558 0q-1.66 0-2.5-.94-.84-.96-.84-2.8V1.42q0-.62.32-.94t.92-.32.92.32q.34.32.34.94v9.34q0 .92.38 1.36.4.44 1.12.44h.3l.28-.04q.28-.04.38.16.1.18.1.76 0 .5-.2.78-.201.28-.66.34l-.42.04q-.22.02-.44.02m6.766 0q-1.06 0-1.9-.4a3.45 3.45 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m10.6 3.56q-.44 0-.72-.24a.91.91 0 0 1-.34-.6q-.04-.38.14-.8l1.36-3.02v1.04l-3.64-8.42q-.18-.44-.12-.82a.89.89 0 0 1 .36-.6q.32-.24.86-.24.46 0 .74.22.28.2.5.78l2.7 6.74h-.6l2.76-6.76q.22-.56.52-.76.3-.22.8-.22.44 0 .7.24.26.22.32.6.06.36-.14.8l-4.86 11.1q-.26.56-.56.76t-.78.2m11.932-3.56a10 10 0 0 1-1.82-.18 5.4 5.4 0 0 1-1.72-.62 1.26 1.26 0 0 1-.46-.46 1.14 1.14 0 0 1-.1-.54 1 1 0 0 1 .2-.48.83.83 0 0 1 .44-.26q.28-.06.6.1a7.3 7.3 0 0 0 1.5.54q.7.14 1.38.14.96 0 1.42-.32.48-.34.48-.88 0-.46-.32-.7-.3-.26-.92-.38l-2-.38q-1.24-.24-1.9-.9-.64-.68-.64-1.74 0-.96.52-1.66.54-.7 1.48-1.08t2.16-.38q.88 0 1.64.2.78.18 1.5.58.3.16.4.42.12.26.06.54-.06.26-.24.48a.84.84 0 0 1-.46.26q-.26.04-.6-.12a5.4 5.4 0 0 0-1.2-.46 4.5 4.5 0 0 0-1.08-.14q-.98 0-1.46.34-.46.34-.46.9 0 .42.28.7t.86.38l2 .38q1.3.24 1.96.88.68.64.68 1.72 0 1.46-1.14 2.3-1.14.82-3.04.82m7.926-.06q-.6 0-.92-.36t-.32-1V5.86q0-.66.32-1 .32-.36.92-.36t.92.36q.34.34.34 1v7.34q0 .64-.32 1t-.94.36m0-11.92q-.7 0-1.1-.34-.38-.36-.38-.98 0-.64.38-.98.4-.34 1.1-.34.72 0 1.1.34t.38.98q0 .62-.38.98-.38.34-1.1.34m7.578 11.98q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.24 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.58 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.159-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m15.587-.04q-.58 0-.9-.32-.3-.32-.3-.92V1.44q0-.62.3-.94.32-.34.82-.34.46 0 .68.18.24.16.56.56l7.66 9.94h-.52V1.38q0-.58.3-.9.32-.32.9-.32t.88.32.3.9v12q0 .56-.28.88t-.76.32q-.46 0-.74-.18-.26-.18-.58-.58l-7.64-9.94h.5v9.46q0 .6-.3.92t-.88.32m17.241.04q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.24 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.58 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.76.76 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.159-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44.94.44 1.4 1.34.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m12.697 0q-1.3 0-2.18-.44-.86-.44-1.28-1.28-.42-.86-.42-2.12V6.52h-1.04q-.48 0-.74-.24-.26-.26-.26-.7 0-.46.26-.7t.74-.24h1.04V2.82q0-.62.32-.94.34-.32.94-.32t.92.32.32.94v1.82h2.12q.48 0 .74.24t.26.7q0 .44-.26.7-.26.24-.74.24h-2.12v4.12q0 .96.42 1.44t1.36.48q.34 0 .6-.06t.46-.08q.24-.02.4.16.16.16.16.68 0 .4-.14.72-.12.3-.46.42-.26.08-.68.14-.42.08-.74.08m5.19-.06q-.6 0-.92-.36t-.32-1V5.86q0-.66.32-1 .32-.36.92-.36t.92.36q.34.34.34 1v7.34q0 .64-.32 1t-.94.36m0-11.92q-.7 0-1.1-.34-.38-.36-.38-.98 0-.64.38-.98.4-.34 1.1-.34.72 0 1.1.34t.38.98q0 .62-.38.98-.38.34-1.1.34m8.818 11.98q-1.521 0-2.64-.62a4.33 4.33 0 0 1-1.74-1.76q-.62-1.16-.62-2.72 0-1.18.34-2.1a4.5 4.5 0 0 1 1.02-1.6q.66-.68 1.58-1.02.92-.36 2.06-.36 1.52 0 2.64.62 1.119.62 1.74 1.76.62 1.14.62 2.7 0 1.18-.36 2.12a4.5 4.5 0 0 1-1 1.62q-.66.66-1.58 1.02-.92.34-2.06.34m0-1.9q.74 0 1.3-.36t.86-1.06q.32-.72.32-1.78 0-1.6-.68-2.38-.681-.8-1.8-.8-.74 0-1.3.36-.56.34-.88 1.06-.3.7-.3 1.76 0 1.58.68 2.4.68.8 1.8.8m8.803 1.86q-.6 0-.92-.32-.32-.34-.32-.96V5.74q0-.62.32-.94t.9-.32.9.32.32.94V7.1l-.22-.5q.44-1.06 1.36-1.6.94-.56 2.12-.56t1.94.44 1.14 1.34q.38.88.38 2.24v4.84q0 .62-.32.96-.32.32-.92.32t-.94-.32q-.32-.34-.32-.96V8.58q0-1.14-.44-1.66-.42-.52-1.32-.52-1.1 0-1.76.7-.64.68-.64 1.82v4.38q0 1.28-1.26 1.28m14.179.04q-1.06 0-1.9-.4a3.45 3.45 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.06 1.06 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44.94.44 1.4 1.34.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16a2.8 2.8 0 0 1-.56 1.22 2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m11.558 0q-1.66 0-2.5-.94-.84-.96-.84-2.8V1.42q0-.62.32-.94t.92-.32.92.32q.34.32.34.94v9.34q0 .92.38 1.36.4.44 1.12.44h.3l.28-.04q.28-.04.38.16.1.18.1.76 0 .5-.2.78-.201.28-.66.34l-.42.04a5 5 0 0 1-.44.02m21.436 2.06q.28.44.22.8t-.32.6a1.13 1.13 0 0 1-.64.32 1.25 1.25 0 0 1-.76-.08q-.38-.14-.64-.56l-1.38-2.22a1.84 1.84 0 0 0-.76-.7q-.46-.22-1.14-.22l1.98-.78q.94 0 1.5.34.56.32 1.08 1.14zm-5.4-2.06q-2.04 0-3.58-.9-1.52-.9-2.36-2.52-.84-1.64-.84-3.84 0-1.66.48-2.98.48-1.34 1.36-2.28a5.9 5.9 0 0 1 2.14-1.46q1.26-.52 2.8-.52 2.06 0 3.58.9 1.52.88 2.36 2.5t.84 3.82q0 1.66-.48 3a6.5 6.5 0 0 1-1.38 2.3 5.9 5.9 0 0 1-2.14 1.48q-1.24.5-2.78.5m0-2.2q1.3 0 2.2-.6.92-.6 1.4-1.74.5-1.14.5-2.72 0-2.4-1.08-3.72-1.06-1.32-3.02-1.32-1.28 0-2.2.6-.92.58-1.42 1.72-.48 1.12-.48 2.72 0 2.38 1.08 3.72t3.02 1.34m11.163 2.16q-.62 0-.96-.34-.32-.36-.32-.98V1.62q0-.64.34-.96.34-.34.96-.34h4.82q2.32 0 3.58 1.12 1.26 1.1 1.26 3.1 0 1.3-.58 2.24-.56.94-1.64 1.44t-2.62.5l.18-.3h.66q.82 0 1.42.4.621.4 1.08 1.26l1.5 2.78q.24.42.22.82a.93.93 0 0 1-.3.66q-.28.24-.82.24t-.88-.22q-.339-.24-.6-.72l-2.02-3.72q-.36-.68-.86-.9-.48-.24-1.24-.24h-1.9v4.48q0 .62-.32.98-.32.34-.96.34m1.28-7.7h3.12q1.38 0 2.08-.56.72-.58.72-1.72 0-1.12-.72-1.68-.7-.58-2.08-.58h-3.12z"})]}),qrph:e=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",style:e,children:[n.jsx("path",{fill:"#f4ea11",d:"M21.394 32.393c5.599 0 10.137-4.553 10.137-10.17 0-5.615-4.538-10.168-10.137-10.168s-10.138 4.553-10.138 10.169 4.539 10.169 10.138 10.169"}),n.jsx("path",{fill:"#1f4485","fill-rule":"evenodd",d:"m23.73.545 5.235 3.8-5.236 3.799C21.811 8.085 12.962 8.12 9.4 8.136a1.545 1.545 0 0 0-1.54 1.501c-.12 3.68-.401 13.243-.284 18.174H0V7.138C0 .88 6.239.545 6.239.545z","clip-rule":"evenodd"}),n.jsx("path",{fill:"#cf2130","fill-rule":"evenodd",d:"M35.649 16.636h7.13V35.41c-.42 4.05-3.48 6.964-7.13 8.046H20.052l-5.347-3.8 5.347-3.352s9.29-.002 13.815-.447q1.177-.51 1.336-1.788a171 171 0 0 0 .446-17.432","clip-rule":"evenodd"})]})};function ma(e,n){const t=d.create(e),a=c.render(t,{margin:n.margin}),i=(new DOMParser).parseFromString(a,"image/svg+xml").documentElement;i.style.width="100%",i.style.height="100%",i.setAttribute("width",String(t.modules.size+2*n.margin)),i.setAttribute("height",String(t.modules.size+2*n.margin));const r=i.querySelector("[stroke]");r?.setAttribute("stroke",n.colors[0]);const o=i.querySelector("[fill]");return o?.setAttribute("fill",n.colors[1]),i}function _a(){const e=new Date;return new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",day:"2-digit",month:"2-digit",year:"numeric"}).format(e)}function fa(e){return e.split("").map(e=>/[a-zA-Z0-9]/.test(e)?e.toLowerCase():"-").join("").replace(/-+/g,"-")}function xa(e){const{amount:a,businessName:i,channelCodeForQrArt:r,channelName:o,channelLogo:s,currency:l,onAffirm:d,qrString:c,t:u}=e,[h,p]=t.useState(!1),m=t.useCallback(()=>{p(!0),d()},[d]),_=t.useMemo(()=>{try{return ma(c,ba)}catch(e){console.log("Error generating QR code SVG:",e);const n=document.createElement("div");return n.innerText=u("action_qr.unable_to_generate"),n}},[c,u]),f=t.useRef(!1),x=t.useCallback(e=>{if(e instanceof PointerEvent&&"touch"!==e.pointerType)return;if(f.current)return;e.currentTarget.animate?.([{transform:"scale(1)"},{transform:"scale(0.95)"},{transform:"scale(1)"}],{duration:150,easing:"ease-in-out"});const n=ma(c,ya),t=[fa(i),fa(o),fa(l),fa(String(a)),fa(_a())].join("-");f.current=!0,async function(e,n){if(!window.URL?.createObjectURL)throw new Error("Browser doesn't support URL.createObjectURL");if(!window.Blob)throw new Error("Browser doesn't support Blob");if(!document.createElement)throw new Error("Browser doesn't support createElement");const t=(new XMLSerializer).serializeToString(e),a=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(a),r=new Image;return r.src=i,new Promise((e,t)=>{r.onload=function(){let a=r.naturalWidth,o=r.naturalHeight;if(0!==a)for(;a<256;)a*=2,o*=2;document.body.appendChild(r);const s=document.createElement("canvas");s.width=a,s.height=o;const l=s.getContext("2d");if(!l)return t(new Error("Failed to get canvas context"));l.drawImage(r,0,0,a,o),URL.revokeObjectURL(i);const d=s.toDataURL("image/png"),c=document.createElement("a");c.href=d,c.download=n,document.body.appendChild(c),c.click(),document.body.removeChild(c),r.remove(),e()},r.onerror=function(e){URL.revokeObjectURL(i),t(new Error("Failed to generate image"))}})}(n,`${t}.png`).catch(e=>{console.error("Error downloading QR code:",e)})},[a,i,o,l,c]);if(e.hideUi)return n.jsx("div",{"data-testid":"qr-code",ref:e=>{!e||1===e.childNodes.length&&e.firstChild===_||e?.replaceChildren(_)}});const b=n.jsx("div",{"data-testid":"qr-code",className:"xendit-action-qr-qrcode-container",role:"button",tabIndex:0,onClick:x,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(e))},ref:e=>{!e||1===e.childNodes.length&&e.firstChild===_||e?.replaceChildren(_)}}),y=n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(pe,{variant:ue.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(me,{}):u("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:u("action.payment_confirmation_instructions")})]}),g=xn(a,l),v=oa(r);return v?n.jsxs(n.Fragment,{children:[n.jsx(v,{channelLogo:s,channelName:o,merchantName:i,amountText:g,qr:b,t:u}),n.jsx("div",{style:{padding:"48px",paddingTop:"8px",paddingBottom:"24px"},children:y})]}):n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:s,alt:u("image_alt.channel_logo",{channelName:o}),className:"xendit-action-qr-channel-logo"}),n.jsxs("div",{className:"xendit-action-qr-content",children:[n.jsx("div",{className:"xendit-text-16 xendit-text-center xendit-qr-merchant-info",children:n.jsx("div",{className:"xendit-text-semibold",children:i})}),b,n.jsx("div",{className:"xendit-text-16 xendit-text-semibold xendit-text-center",children:g})]}),y]})}const ba={margin:0,colors:["var(--xendit-qr-foreground-color)","var(--xendit-qr-background-color)"]},ya={margin:2,colors:["#000","#FFF"]};class ActionQrBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];D(n?.type,"PRESENT_TO_CUSTOMER"),I(this.bb.world),I(this.bb.channel),I(this.bb.world.paymentEntity);let t=this.bb.channel.channel_code;this.bb.mock&&"string"==typeof this.bb.channelProperties?.mock_channel_code_for_qr_art&&(t=this.bb.channelProperties.mock_channel_code_for_qr_art);const a=null!==oa(t);const i=this.bb.sdk[h].liveComponents.actionContainer,r={amount:this.bb.world.session.amount,businessName:this.bb.world.business.name??"",channelCodeForQrArt:t,channelName:this.bb.channel.brand_name,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,hideUi:"true"===i?.getAttribute("data-qr-code-only")||!1,onAffirm:this.affirmPayment.bind(this),qrString:n.value,title:n.action_subtitle,t:this.bb.sdk.t.bind(this.bb.sdk)},o=a?Ot.QrWithCustomArt:Ot.Generic;this.cleanupFn=this.ensureHasActionContainer(o),this.populateActionContainer(()=>e.createElement(xa,r))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}exit(){super.exit()}}class ActionRedirectBehavior{bb;url;constructor(e,n){this.bb=e,this.url=n}enter(){this.bb.dispatchEvent(new XenditWillRedirectEvent),window.location.href=this.url}}const ga=e.createContext({fire:()=>{},clear:()=>{},text:""}),va=({children:e})=>{const[a,i]=t.useState(""),r=t.useCallback(e=>{i(e);const n=setTimeout(()=>{i("")},2e3);return()=>clearTimeout(n)},[]),o=t.useCallback(()=>{i("")},[]);return n.jsx(ga.Provider,{value:{text:a,fire:r,clear:o},children:n.jsx("div",{style:{position:"relative"},children:e})})},ka=()=>{const{text:e,clear:a}=t.useContext(ga);return t.useLayoutEffect(()=>{if(e){const e=()=>{a()};return document.body.addEventListener("mousedown",e),()=>{document.body.removeEventListener("mousedown",e)}}},[a,e]),e?n.jsx("div",{className:"xendit-tooltip",children:e}):null};function wa(e){const{amount:a,channelLogo:i,currency:r,onAffirm:o,vaNumber:s,merchantName:l,instructions:d,title:c,t:u}=e,[h,p]=t.useState(!1),m=t.useCallback(()=>{p(!0),o()},[o]),_=[{heading:u("action_va.merchant_name"),value:l},{heading:u("action_va.virtual_account_number"),value:s,enableCopy:!0},{heading:u("action_va.amount_to_pay"),value:xn(a,r),enableCopy:!0}];return n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:i,alt:"Channel Logo",className:"xendit-action-qr-channel-logo"}),n.jsx("div",{className:"xendit-action-title",children:c}),n.jsx("div",{className:"xendit-action-va-content",children:n.jsx("div",{className:"xendit-action-va-details",children:_.map((e,t)=>n.jsxs("div",{className:"xendit-action-va-detail-item",children:[n.jsxs("div",{className:"xendit-action-va-detail-content",children:[n.jsx("div",{className:"xendit-action-va-heading xendit-text-12 xendit-text-semibold",children:e.heading}),n.jsx("div",{className:"xendit-action-va-value xendit-text-semibold",children:e.value})]}),e.enableCopy?n.jsxs(va,{children:[n.jsx(Ca,{value:e.value,t:u}),n.jsx(ka,{})]}):null]},t))})}),n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(pe,{variant:ue.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(me,{}):u("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:u("action.payment_confirmation_instructions")})]}),n.jsx(Zt,{instructions:d})]})}const Ca=({value:e,t:a})=>{const{fire:i}=t.useContext(ga);return n.jsxs(pe,{variant:ue.WHITE_ROUNDED,size:he.SM,onClick:()=>{navigator.clipboard.writeText(e),i(a("action_va.copied_to_clipboard"))},children:[a("action_va.copy"),n.jsx(m,{name:"copy",size:16})]})};class ActionVaBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];D(n?.type,"PRESENT_TO_CUSTOMER"),I(this.bb.world),I(this.bb.channel);const t={amount:this.bb.world.session.amount,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,onAffirm:this.affirmPayment.bind(this),vaNumber:n.value,merchantName:this.bb.world.business.name??"",instructions:n.instructions??[],title:n.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(wa,t))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class CardInfoBehavior{bb;channelCode;cardDetailsRequest=null;constructor(e,n){this.bb=e,this.channelCode=n}enter(){this.lookupCardDetails()}update(){this.lookupCardDetails()}exit(){this.abortLookupCardDetails()}abortLookupCardDetails(){this.cardDetailsRequest&&(this.cardDetailsRequest.abortController.abort(new AbortError),this.cardDetailsRequest=null)}lookupCardDetails(){const e=te(this.bb.channelProperties);if(!e)return;if(this.cardDetailsRequest?.cardNumber===e)return;if(this.bb.channelData?.cardDetails?.cardNumber===e)return;this.cardDetailsRequest&&this.abortLookupCardDetails();const n=new AbortController,t=O(300,n.signal).then(()=>{if(this.bb.mock){const n=ae(e).cipherText;try{return JSON.parse(atob(n))}catch{}return{schemes:["VISA"],country_codes:["ID"],require_billing_information:!1}}{const t=ae(e).withoutValidationError;return gt(this.bb.sdkKey,{card_number:t},this.bb.sdkKey.sessionAuthKey,void 0,n.signal)}}).then(n=>{this.bb.dispatchEvent(new InternalUpdateChannelComponentData(this.channelCode,{cardDetails:{cardNumber:e,details:n}}))}).catch(e=>{if(!M(e))throw e});this.cardDetailsRequest={cardNumber:e,promise:t,abortController:n}}}class ChannelInvalidBehavior{bb;channelCode;constructor(e,n){this.bb=e,this.channelCode=n}enter(){}}class ChannelValidBehavior{bb;lastChannelCode=null;constructor(e){this.bb=e}enter(){this.sendReadyEventIfChanged()}update(){this.sendReadyEventIfChanged()}sendReadyEventIfChanged(){const e=this.bb.channel?.channel_code??null;e&&e!==this.lastChannelCode&&(this.bb.dispatchEvent(new XenditReadyEvent(e)),this.lastChannelCode=e)}exit(){this.bb.dispatchEvent(new XenditNotReadyEvent)}}class PaymentEntityFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.submissionRequested=!1,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class PollWorker{sdkKey;sdk;sessionTokenRequestId;onPollResult;started=!1;stopped=!1;constructor(e,n,t,a){this.sdkKey=e,this.sdk=n,this.sessionTokenRequestId=t,this.onPollResult=a}async start(){if(this.stopped)throw new Error("PollWorker has been stopped, make a new instance instead of calling start again");this.started=!0;for await(const e of async function*(e,n,t=2){yield 0;let a=e;for(let e=1;e<n;e++)a*=t,await L(a),yield e}(5e3,100,1.06)){if(this.stopped)return;let e;if(this.sdk.isMock()){if(!(this.sdk instanceof XenditComponentsTest&&this.sdk.nextMockUpdate))continue;await L(j),e=this.sdk.nextMockUpdate,this.sdk.nextMockUpdate=null}else try{e=await yt(this.sdkKey,this.sdkKey.sessionAuthKey,this.sessionTokenRequestId)}catch(e){continue}if(this.stopped)return;if(!e.session)throw new Error("Session is not defined");let n=null;e.payment_token?n=Vt(e.payment_token):e.payment_request&&(n=Vt(e.payment_request)),this.onPollResult(e,n),await L(1)}}isPolling(){return this.started&&!this.stopped}stop(){this.started=!1,this.stopped=!0}}class PaymentEntityPendingBehavior{bb;pollWorker;constructor(e){this.bb=e,this.pollWorker=new PollWorker(this.bb.sdkKey,this.bb.sdk,this.bb.world?.sessionTokenRequestId??null,this.onPollResult)}enter(){if(this.bb.mock)switch(I(this.bb.world?.paymentEntity),this.bb.world?.paymentEntity.entity.status){case"ACTIVE":case"AUTHORIZED":case"SUCCEEDED":case"PENDING":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(zt(this.bb.world,this.bb.channel,"SUCCESS")));break;case"FAILED":case"CANCELED":case"EXPIRED":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(zt(this.bb.world,this.bb.channel,"FAILURE")))}this.pollWorker.start()}exit(){this.pollWorker.stop()}onPollResult=(e,n)=>{this.bb.dispatchEvent(new InternalUpdateWorldState({session:e.session,paymentEntity:n??void 0,succeededChannel:e.succeeded_channel??null}))}}class PaymentEntityRequiresActionBehavior{bb;pollWorker=null;canCreateActionContainer=!0;constructor(e){this.bb=e,this.resetPolling()}enter(){this.bb.dispatchEvent(new XenditActionBeginEvent),this.canCreateActionContainer=!1,this.pollWorker?.start()}update(){this.bb.pollImmediatelyRequested&&(this.bb.pollImmediatelyRequested=!1,this.resetPolling())}exit(){this.pollWorker?.stop(),this.bb.dispatchEvent(new XenditActionEndEvent),this.bb.actionCompleted=!1}onPollResult=(e,n)=>{this.bb.dispatchEvent(new InternalUpdateWorldState({session:e.session,paymentEntity:n??void 0,succeededChannel:e.succeeded_channel??null}))};resetPolling(){const e=this.pollWorker?.isPolling()??!1;this.pollWorker?.stop(),this.pollWorker=new PollWorker(this.bb.sdkKey,this.bb.sdk,this.bb.world?.sessionTokenRequestId??null,this.onPollResult),e&&this.pollWorker.start()}}class PaymentOptionsBehavior{bb;channelCode;paymentOptionsRequest=null;constructor(e,n){this.bb=e,this.channelCode=n}enter(){this.lookupPaymentOptions()}update(){this.lookupPaymentOptions()}exit(){this.abortLookupPaymentOptions()}abortLookupPaymentOptions(){this.paymentOptionsRequest&&(this.paymentOptionsRequest.abortController.abort(new AbortError),this.paymentOptionsRequest=null)}lookupPaymentOptions(){let e;if(I(this.bb.world),I(this.bb.channel),ce(this.bb.channel.form,"credit_card_number")){if(e=te(this.bb.channelProperties)??void 0,!e)return;if(this.paymentOptionsRequest?.cardNumber===e)return;if(this.bb.channelData?.paymentOptions?.cardNumber??null===e)return;if(e){if(!ae(e).valid)return}}else if(this.paymentOptionsRequest||this.bb.channelData?.paymentOptions)return;this.paymentOptionsRequest&&this.abortLookupPaymentOptions();const n=new AbortController,t=async function(e,n,t,a,i,r){if(r)return O(j,i).then(()=>function(e,n){return{channel_code:e,country:n.country,currency:n.currency,amount:n.amount,installment_plans:[{interval:"MONTH",interval_count:1,terms:3,installment_amount:Math.floor(n.amount/3),total_amount:n.amount,description:"Unused",code:"3M",interest_rate:1},{interval:"MONTH",interval_count:1,terms:6,installment_amount:Math.floor(n.amount/6),total_amount:n.amount,description:"Unused",code:"6M",interest_rate:1},{interval:"MONTH",interval_count:1,terms:9,installment_amount:Math.floor(n.amount/9),total_amount:n.amount,description:"Unused",interest_rate:1,code:void 0}]}}(t,n));return vt(e,{channel_code:t,channel_properties:a?{card_number:a}:void 0},e.sessionAuthKey,null,i)}(this.bb.sdkKey,this.bb.world.session,this.bb.channel.channel_code,e,n.signal,this.bb.mock).then(n=>{this.bb.dispatchEvent(new InternalUpdateChannelComponentData(this.channelCode,{paymentOptions:{cardNumber:e??null,options:n}}))}).catch(e=>{if(!M(e))throw e});this.paymentOptionsRequest={cardNumber:e??void 0,promise:t,abortController:n}}}class SdkActiveBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditInitEvent),this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}exit(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}}class SdkFatalErrorBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditFatalErrorEvent(this.bb.sdkFatalErrorMessage??"Unknown error"))}}class SdkLoadingBehavior{bb;constructor(e){this.bb=e}enter(){}}class SessionActiveBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}exit(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}}class SessionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionCompleteEvent(this.bb.world?.succeededChannel?.channel_code||null))}}class SessionFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionExpiredOrCanceledEvent)}}function Ea(e,n){switch(e.type){case Bt.PaymentRequest:n(new XenditPaymentRequestDiscardedEvent(e.id));break;case Bt.PaymentToken:n(new XenditPaymentTokenDiscardedEvent(e.id))}n(new InternalUpdateWorldState({paymentEntity:null,sessionTokenRequestId:null}))}class SessionPendingBehavior{bb;pollWorker;constructor(e){this.bb=e,this.pollWorker=new PollWorker(this.bb.sdkKey,this.bb.sdk,this.bb.world?.sessionTokenRequestId??null,this.onPollResult)}enter(){this.pollWorker.start(),this.bb.dispatchEvent(new XenditSessionPendingEvent)}exit(){this.pollWorker.stop(),I(this.bb.world?.session);const e=this.bb.world.paymentEntity;"COMPLETED"!==this.bb.world.session.status&&e&&Ea(e,this.bb.dispatchEvent),this.bb.dispatchEvent(new XenditSessionNotPendingEvent)}onPollResult=(e,n)=>{this.bb.dispatchEvent(new InternalUpdateWorldState({session:e.session,paymentEntity:n??void 0,succeededChannel:e.succeeded_channel??null}))}}class SimulatePaymentBehavior{bb;exited=!1;simulationRequest=null;constructor(e){this.bb=e}enter(){this.simulatePayment()}exit(){this.exited=!0,this.bb.simulatePaymentRequested=!1,this.abortSimulation()}abortSimulation(){this.simulationRequest&&(this.simulationRequest.abortController.abort(new AbortError),this.simulationRequest=null)}simulatePayment(){if(this.simulationRequest&&this.abortSimulation(),!this.bb.channel)throw new Error("Channel is missing");if(!this.bb.world)throw new Error("Invalid state");if(!this.bb.world.paymentEntity)throw new Error("Payment entity is missing");if(this.bb.world.paymentEntity.type!==Bt.PaymentRequest)throw new Error("Payment entity is not a payment request");const e=this.bb.world?.paymentEntity.id,n=new AbortController,t=async function(e,n,t,a,i){return n?(await O(j,i),Xt(t.channel_code,t._mock_action_type)):await bt(e,{channel_code:t.channel_code},{sessionAuthKey:e.sessionAuthKey,paymentRequestId:a},void 0,i)}(this.bb.sdkKey,this.bb.mock,this.bb.channel,e,n.signal).then(()=>{this.bb.mock&&this.bb.world&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(zt(this.bb.world,this.bb.channel,"SUCCESS"))),this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}).catch(e=>{M(e)||this.exited||(this.bb.simulatePaymentRequested=!1,console.error("Simulate Payment failed:",e))});this.simulationRequest={promise:t,abortController:n}}}class SubmissionBehavior{bb;exited=!1;submission=null;submissionError=null;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSubmissionBeginEvent),this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(null)),this.submit()}exit(){this.exited=!0,I(this.bb.world?.session);const e=this.bb.sdk.t,n=this.bb.world.paymentEntity;let t,a,i;var r;"COMPLETED"!==this.bb.world.session.status&&"PENDING"!==this.bb.world.session.status&&n&&Ea(n,this.bb.dispatchEvent),"ACTIVE"!==this.bb.world.session.status?t=`SESSION_${this.bb.world.session.status}`:!n||"FAILED"!==n.entity.status&&"CANCELED"!==n.entity.status&&"EXPIRED"!==n.entity.status?this.submissionError?(t="REQUEST_FAILED",!("message"in(r=this.submissionError))&&"text"in r&&"code"in r?(a=this.submissionError.text,i={type:"ERROR",code:this.submissionError.code}):(a=function(e){return[e("default_error.title"),e("default_error.message_1"),e("default_error.message_2")]}(e),i={type:"NETWORK_ERROR",code:"NETWORK_ERROR"})):t=this.submission?"REQUEST_ABORTED":"ACTION_ABORTED":(t=`PAYMENT_${n.type}_${n.entity.status}`,a=function(e,n,t,a){const i=e(Kt(n,t,"title")),r=a?e(function(e){return`failure_code.${e.toLowerCase()}`}(a),e("failure_code_unknown",{failureCode:a})):e(Kt(n,t,"subtext"));return[i,r]}(e,n.type,n.entity.status,n.entity.failure_code),i={type:"FAILURE",code:n.entity.failure_code??"UNKNOWN"}),this.bb.dispatchEvent(new XenditSubmissionEndEvent(t,a,i)),this.submission&&(this.submission?.abortController.abort(new AbortError),this.submission=null),this.bb.submissionRequested=!1,this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}submit(){if(!this.bb.world?.session)throw new Error("Session object missing");if(!this.bb.channel)throw new Error("Channel missing");if(this.bb.instantSubmissionError)return this.bb.submissionRequested=!1,this.submissionError=this.bb.instantSubmissionError,this.bb.instantSubmissionError=null,void this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent);const e="OPTIONAL"===this.bb.world.session.allow_save_payment_method&&this.bb.channel?.allow_save,n=this.bb.channel?.requires_customer_details&&!this.bb.world.customer,t=this.bb.world?.session?.session_type,a=this.bb.channel.channel_code,i=this.bb.channel._mock_action_type,r=this.bb.channelProperties??{},o=new AbortController,s=async function(e,n,t,a,i,r,o,s,l){let d;if(n)switch(t){case"PAY":await O(j,o.signal),d=Xt(a,i);break;case"SAVE":case"SUBSCRIPTION":await O(j,o.signal),d=function(e,n){return"PENDING"===n?{payment_token_id:`pt-${Y()}`,status:"PENDING",channel_code:e,actions:Ht(n),session_token_request_id:Y()}:n?{payment_token_id:`pt-${Y()}`,status:"REQUIRES_ACTION",channel_code:e,actions:Ht(n),session_token_request_id:Y()}:{payment_token_id:`pt-${Y()}`,status:"ACTIVE",channel_code:e,actions:[],session_token_request_id:Y()}}(a,i);break;default:throw new Error(`The session type ${t} is not supported.`)}else switch(t){case"PAY":d=await xt(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r,save_payment_method:s,customer:l},null,null,o.signal);break;case"SAVE":case"SUBSCRIPTION":d=await ft(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r},null,null,o.signal);break;default:throw new Error(`The session type ${t} is not supported.`)}return Vt(d)}(this.bb.sdkKey,this.bb.mock,t,a,i,r,o,e?this.bb.channelData?.savePaymentMethod??!1:void 0,n?this.bb.channelData?.customerDetails??{given_names:""}:void 0).then(e=>{switch(this.submission=null,e.type){case Bt.PaymentRequest:this.bb.dispatchEvent(new XenditPaymentRequestCreatedEvent(e.id));break;case Bt.PaymentToken:this.bb.dispatchEvent(new XenditPaymentTokenCreatedEvent(e.id))}this.bb.dispatchEvent(new InternalUpdateWorldState({paymentEntity:e,sessionTokenRequestId:e.entity.session_token_request_id}))}).catch(e=>{M(e)||(console.error("Submission failed:",e),this.exited||(this.bb.submissionRequested=!1,this.submissionError=e instanceof NetworkError?{text:[e.errorResponse.error_content?.title,e.errorResponse.error_content?.message_1,e.errorResponse.error_content?.message_2].filter(e=>void 0!==e),code:e.errorResponse.error_code}:e,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)))});this.submission={abortController:o,promise:s}}}function Na(e){switch(e.sdkStatus){case"LOADING":return kt(SdkLoadingBehavior);case"ACTIVE":return kt(SdkActiveBehavior,"active",function(e){switch(I(e.world?.session),e.world.session.status){case"ACTIVE":return kt(SessionActiveBehavior,"active",e.submissionRequested?function(e){return I(e.world),kt(SubmissionBehavior,"submission",e.world.paymentEntity&&null!==e.world.sessionTokenRequestId?function(e){function n(){return I(e.world?.paymentEntity),B(e.sdk,e.world.paymentEntity.entity.actions)?function(e){I(e.world?.paymentEntity);const n=B(e.sdk,e.world.paymentEntity.entity.actions);I(n);const t=e.world.paymentEntity.entity.actions.indexOf(n);return kt(ActionPaylinkBehavior,String(t))}(e):void 0}if(I(e.world?.paymentEntity),e.hackyOvoActionLatch&&"PENDING"===e.world.paymentEntity.entity.status)return kt(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[kt(ActionEmptyListPushNotificationBehavior,""),n()]);switch(e.world.paymentEntity.entity.status){case"PENDING":return kt(PaymentEntityPendingBehavior);case"REQUIRES_ACTION":return kt(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[Aa(e),n()]);case"FAILED":case"EXPIRED":case"CANCELED":return kt(PaymentEntityFailedBehavior);case"ACCEPTING_PAYMENTS":throw new Error("Status ACCEPTING_PAYMENTS should not happen");case"AUTHORIZED":case"ACTIVE":case"SUCCEEDED":return kt(PaymentEntityPendingBehavior,e.world.paymentEntity.id);default:throw e.world.paymentEntity.entity,new Error(`Unknown payment entity status: ${e.world.paymentEntity.entity.status}`)}}(e):void 0)}(e):function(e){if(!e.channel||!e.world?.session)return;if(e.channelIsDigitalWallet)return;const n=function(e,n,t,a){t||(t={});for(const i of Hn(e,n.form,t,a))if(En(i,t))return!1;return!0}(e.world.session.session_type,e.channel,e.channelProperties,e.channelData),t=e.channel.requires_customer_details&&!e.world.customer;let a=!0;t&&(a=0!==e.channelData?.customerDetails?.given_names?.trim().length);const i=kt(n&&a?ChannelValidBehavior:ChannelInvalidBehavior),r=ce(e.channel.form,"credit_card_number")?kt(CardInfoBehavior,e.channel.channel_code):void 0,o=ce(e.channel.form,"installment_plan")?kt(PaymentOptionsBehavior,e.channel.channel_code):void 0;return[i,r,o]}(e));case"COMPLETED":return kt(SessionCompletedBehavior);case"EXPIRED":case"CANCELED":return kt(SessionFailedBehavior,e.world.session.status);case"PENDING":return kt(SessionPendingBehavior,e.world.session.status);default:throw e.world.session.status,new Error(`Unknown session status: ${e.world.session.status}`)}}(e));case"FATAL_ERROR":return kt(SdkFatalErrorBehavior);default:throw e.sdkStatus,new Error(`Unknown SDK status: ${e.sdkStatus}`)}}function Aa(e){if(I(e.world?.paymentEntity),e.actionCompleted)return kt(ActionCompletedBehavior);const n=U(e.world.paymentEntity.entity.actions);if(!n)return kt(ActionEmptyListPushNotificationBehavior,"");const t=e.world.paymentEntity.entity.actions.indexOf(n),a=!!B(e.sdk,e.world.paymentEntity.entity.actions);let i;switch(e.simulatePaymentRequested&&Q(n)&&(i=kt(SimulatePaymentBehavior)),n.type){case"REDIRECT_CUSTOMER":switch(n.descriptor){case"WEB_URL":return function(e){return"REDIRECT_CUSTOMER"===e.type&&!1!==e.iframe_capable}(n)?kt(ActionIframeBehavior,n.value):a?kt(ActionDeepLinkBehavior,String(t)):kt(ActionRedirectBehavior,n.value);case"DEEPLINK_URL":return kt(ActionDeepLinkBehavior,String(t));case"WEB_GOOGLE_PAYLINK":throw new Error("Paylink actions should not be the primary action")}break;case"PRESENT_TO_CUSTOMER":switch(n.descriptor){case"QR_STRING":return kt(ActionQrBehavior,String(t),i);case"PAYMENT_CODE":return kt(ActionBarcodeBehavior,String(t),i);case"VIRTUAL_ACCOUNT_NUMBER":return kt(ActionVaBehavior,String(t),i)}break;case"API_POST_REQUEST":switch(n.descriptor){case"CAPTURE_PAYMENT":case"VALIDATE_OTP":case"RESEND_OTP":throw new Error(`Unsupported action type ${n.type} ${n.descriptor}`)}}throw new Error(`Unknown action type: ${n.type} ${n.descriptor}`)}class XenditComponents extends EventTarget{t=e=>{throw new Error("Localization used before initialization; this is a bug.")};[h];constructor(e){if(super(),"undefined"==typeof window||"undefined"==typeof document)throw new Error("XenditComponents can only be instantiated in a browser");const n=function(e){if(!e)throw new Error("The componentsSdkKey option is missing; check the constructor parameters.");const n=e.split("-");if(n.length<4||n[2]!==V&&null===z(n[2]))throw new Error("The componentsSdkKey option has the wrong format. Ensure you pass the value returned from the `components_sdk_key` property of the `POST /sessions` response.");return{sessionAuthKey:[n[0],n[1]].join("-"),hostId:n[2],publicKey:n[3],signature:n[4]}}(e.componentsSdkKey);this[h]={sdkKey:n,options:e,worldState:null,liveComponents:{channelPicker:null,paymentChannels:new Map,actionContainer:null,digitalWalletContainer:new Map},behaviorTree:new BehaviorTree(Na,{sdk:this,sdkKey:n,mock:this.isMock(),sdkStatus:"LOADING",sdkFatalErrorMessage:null,channel:null,channelProperties:null,channelData:null,channelIsDigitalWallet:!1,instantSubmissionError:null,dispatchEvent:this.dispatchEvent.bind(this),world:null,submissionRequested:!1,simulatePaymentRequested:!1,actionCompleted:!1,pollImmediatelyRequested:!1}),currentChannelCode:null,currentDigitalWalletSubmission:null,eventListenersPresent:new Map},le(this),this.addEventListener("fatal-error",e=>{const n=e;this[h].eventListenersPresent.get("fatal-error")||console.error(`XenditComponents: A "fatal-error" event occurred but no event listener was attached: ${n.message}`)}),this[h].eventListenersPresent.set("fatal-error",!1),this.behaviorTreeUpdate(),this.addEventListener(InternalUpdateWorldState.type,this.onUpdateWorldState.bind(this)),this.addEventListener(InternalUpdateChannelComponentData.type,this.onUpdateChannelComponentData.bind(this)),this.addEventListener(InternalBehaviorTreeUpdateEvent.type,this.behaviorTreeUpdate.bind(this));let t=!1;this.addEventListener(InternalNeedsRerenderEvent.type,()=>{t||(t=!0,queueMicrotask(()=>{t=!1,this.rerenderAllComponents(),this.syncInertAttribute()}))}),this.initializeAsync()}async initializeAsync(){let e;try{e=await _t(this[h].sdkKey,this[h].sdkKey.sessionAuthKey),e.channels=e.channels.filter(e=>de[e.channel_code])}catch(e){return this[h].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[h].behaviorTree.bb.sdkFatalErrorMessage=J(e),void this.behaviorTreeUpdate()}this.dispatchEvent(new InternalUpdateWorldState({business:e.business,customer:e.customer,session:e.session,channels:e.channels,channelUiGroups:e.channel_ui_groups,digitalWallets:e.digital_wallets??null,paymentEntity:null,sessionTokenRequestId:null,succeededChannel:e.succeeded_channel??null}))}assertInitialized(){if(!this[h].worldState)throw new Error("The session data is not loaded. Listen for the `init` event. Only `createChannelPickerComponent` can be called before initialization.")}isMock(){return!1}isProdLive(){return"pl"===this[h].sdkKey.hostId}isDevelopmentEnv(){return"pd"===this[h].sdkKey.hostId||"sd"===this[h].sdkKey.hostId}supportsSimulationScenarios(){return this.isMock()||this.isDevelopmentEnv()}findChannel(e){this.assertInitialized();return this[h].worldState.channels.find(n=>n.channel_code===e)??null}onUpdateWorldState(e){const n=e.data;this[h].worldState=W(this[h].worldState??{},n);const t=this[h].worldState.session.locale;this.t=function(e){const n=vn[e];return function(...t){let a,i,r={};switch(t.length){case 1:a=t[0];break;case 2:"string"==typeof t[1]?(a=t[0],i=t[1]):(a=t[0],r=t[1]);break;case 3:a=t[0],i=t[1],r=t[2];break;default:throw new Error("Invalid arguments for t function")}let o=n?.[a];return void 0===o&&void 0!==i&&(o=i),o?o.replace(/\{\{(\w+)\}\}/g,(e,n)=>r[n]?String(r[n]):""):(console.warn(`Missing localization for key: ${a} in locale: ${e}`),a)}}(t),this.behaviorTreeUpdate(),this.rerenderAllComponents()}onUpdateChannelComponentData(e){const n=e.channelCode,t=e.data,a=this[h].liveComponents.paymentChannels.get(n);a&&(a.data=W(a.data,t),this.behaviorTreeUpdate(),this.rerenderAllComponents())}behaviorTreeUpdate(){const e=this[h].behaviorTree.bb;if("LOADING"===e.sdkStatus&&this[h].worldState&&(e.sdkStatus="ACTIVE"),e.world=this[h].worldState,this[h].currentDigitalWalletSubmission)e.channel=this.findChannel(this[h].currentDigitalWalletSubmission.channelCode),e.channelProperties=this[h].currentDigitalWalletSubmission.channelProperties,e.channelData=null,e.channelIsDigitalWallet=!0,e.instantSubmissionError=this[h].currentDigitalWalletSubmission.instantSubmissionError;else{const n=this[h].currentChannelCode?this[h].liveComponents.paymentChannels.get(this[h].currentChannelCode):null;e.channel=n?oe(n.channel[h],n.data.savePaymentMethod):null,e.channelProperties=n?n.channelProperties:null,e.channelData=n?n.data:null,e.channelIsDigitalWallet=!1}try{this[h].behaviorTree.update()}catch(e){this[h].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[h].behaviorTree.bb.sdkFatalErrorMessage=J(e),this[h].behaviorTree.update()}}getSdkStatus(){return this[h].behaviorTree.bb.sdkStatus}rerenderAllComponents(){this.renderChannelPicker();for(const e of this[h].liveComponents.paymentChannels.keys())this.renderPaymentChannel(e);for(const e of this[h].liveComponents.digitalWalletContainer.keys())this.renderDigitalWalletComponent(e)}getSession(){return this.assertInitialized(),ge(this[h].worldState.session)}getCustomer(){return this.assertInitialized(),this[h].worldState.customer?(e=this[h].worldState.customer)?(D(e.type,"INDIVIDUAL"),I(e.individual_detail),{id:e.id,type:e.type,email:e.email??void 0,mobileNumber:e.mobile_number??void 0,individualDetail:{givenNames:e.individual_detail.given_names??void 0,surname:e.individual_detail.surname??void 0}}):null:null;var e}getActiveChannelGroups(e){return this.assertInitialized(),function(e,n,t){const a=Ce(n),i=Ne(e,t);return n.filter(e=>i[e.id]?.length).map(e=>ve(e,i,a,t))}(this[h].worldState.channels,this[h].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[h].worldState.session,pairChannels:Ae(this[h].worldState.channels)})}getActiveChannels(e){return this.assertInitialized(),function(e,n,t){const a=Ce(n),i=Ne(e,t);return e.filter(e=>Ee(e,t)).map(e=>we(e,i,a,t))}(this[h].worldState.channels,this[h].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[h].worldState.session,pairChannels:Ae(this[h].worldState.channels)})}createChannelPickerComponent(){this[h].liveComponents.channelPicker&&this.destroyComponent(this[h].liveComponents.channelPicker);const e=document.createElement("xendit-channel-picker");return e.setAttribute("translate","no"),this[h].liveComponents.channelPicker=e,this[h].worldState&&this.renderChannelPicker(),this.setupUiEventsForChannelPicker(e),e}renderChannelPicker(){this.assertInitialized();const n=this[h].liveComponents.channelPicker;n&&e.render(e.createElement(R,{data:this[h].worldState,sdk:this,children:e.createElement(Me,{})}),n)}setupUiEventsForChannelPicker(e){e.addEventListener(XenditClearCurrentChannelEvent.type,e=>{this.assertInitialized();const n=e,t=this[h].currentChannelCode;if(!t)return;const a=this[h].worldState.channels.find(e=>e.channel_code===t);a&&a.ui_group===n.uiGroup&&this.setCurrentChannel(null)})}createChannelComponent(n,t=!0){if(this.assertInitialized(),!se(this[h].worldState.session,n[h][0]))throw new Error("Cannot create channel component: `session.amount` is outside of the channel's min/max amount.");const a=n[h][0].channel_code;t&&(this[h].currentChannelCode=a);const i=this[h].liveComponents.paymentChannels.get(a),r=e.createRef(),o=e.createRef();let s;return i?s=i.element:(s=document.createElement("xendit-payment-channel"),s.setAttribute("data-channel-code",a),s.setAttribute("inert",""),s.setAttribute("translate","no"),s.style.setProperty("--xendit-channel-brand-color",n[h][0].brand_color),this.setupUiEventsForPaymentChannel(s),this[h].liveComponents.paymentChannels.set(a,{element:s,channel:n,channelProperties:null,channelFormRef:r,customerDetailsFormRef:o,data:{savePaymentMethod:!1,cardDetails:null,paymentOptions:null,customerDetails:n[h][0].requires_customer_details?{given_names:""}:null}})),this.renderPaymentChannel(a),t&&(this.behaviorTreeUpdate(),this.syncInertAttribute()),this.dispatchEvent(new InternalNeedsRerenderEvent),s}renderPaymentChannel(n){this.assertInitialized();const t=this[h].liveComponents.paymentChannels.get(n);if(!t)return;const a=t.channel;e.render(e.createElement(R,{data:this[h].worldState,sdk:this,children:e.createElement(ct,{channelOrPair:a[h],channelData:t.data,savePaymentMethod:t.data.savePaymentMethod,formRef:t.channelFormRef,customerDetailsFormRef:t.customerDetailsFormRef})}),t.element)}getActiveDigitalWallets(){return this.assertInitialized(),this[h].worldState.digitalWallets?function(e,n,t,a){const i=[],r=Ce(t);if(e.google_pay){const t=e.google_pay.allowed_payment_methods.map(e=>{const t=n.find(n=>n.channel_code===e.channel_code);return I(t),t}),o=Ne(t,a);i.push({digitalWalletCode:"GOOGLE_PAY",get channels(){return t.map(e=>we(e,o,r,a))},[h]:!0})}return i}(this[h].worldState.digitalWallets,this[h].worldState.channels,this[h].worldState.channelUiGroups,{options:{filterMinMax:!1},pairChannels:Ae(this[h].worldState.channels),session:this[h].worldState.session}):[]}createDigitalWalletComponent(e,n){this.assertInitialized();const t=this[h].liveComponents.digitalWalletContainer.get(e);t&&this.destroyComponent(t.element);const a=document.createElement("xendit-digital-wallet");return a.setAttribute("translate","no"),a.style.setProperty("display","none"),this[h].liveComponents.digitalWalletContainer.set(e,{element:a,options:n}),this.renderDigitalWalletComponent(e),a}renderDigitalWalletComponent(n){this.assertInitialized();const t=this[h].liveComponents.digitalWalletContainer.get(n);t&&e.render(e.createElement(R,{data:this[h].worldState,sdk:this,children:e.createElement(qe,{digitalWalletCode:n,digitalWalletOptions:t.options})}),t.element)}getCurrentChannel(){const e=this[h].currentChannelCode;return e?this.getActiveChannels().find(n=>{if(n.channelCode===e||Array.isArray(n.channelCode)&&n.channelCode.includes(e))return!0})??null:null}setCurrentChannel(e){const n=this[h].currentChannelCode,t=e?.[h][0].channel_code??null;if(n!==t){if(this[h].currentChannelCode=t,e&&t){(this[h].liveComponents.paymentChannels.get(t)??null)||this.createChannelComponent(e,!1)}this.behaviorTreeUpdate(),this.syncInertAttribute(),this.renderChannelPicker()}}syncInertAttribute(){const e=this[h].behaviorTree.bb.submissionRequested,n=this[h].liveComponents.paymentChannels;for(const[t,a]of n){(Array.isArray(a.channel.channelCode)?a.channel.channelCode[0]:a.channel.channelCode)!==this[h].currentChannelCode||e?a.element.setAttribute("inert",""):a.element.hasAttribute("inert")&&a.element.removeAttribute("inert")}}setupUiEventsForPaymentChannel(e){e.addEventListener(XenditChannelPropertiesChangedEvent.type,e=>{const n=e,t=n.channel,a=this[h].liveComponents.paymentChannels.get(t);a&&(a.channelProperties=n.channelProperties,this.behaviorTreeUpdate())})}showValidationErrors(){if(!this[h].behaviorTree.findBehavior(ChannelInvalidBehavior))return;const e=this[h].currentChannelCode;if(!e)return;const n=this[h].liveComponents.paymentChannels.get(e);if(!n)throw new Error("Current channel is set but component is missing; this is a bug, please contact support.");const t=n.channelFormRef.current;t?.setAllFieldsTouched();const a=n.customerDetailsFormRef.current;a?.setAllFieldsTouched()}createActionContainerComponent(e){this.assertInitialized();const n=e===h,t=n?void 0:e,a=this[h].behaviorTree.findBehavior(PaymentEntityRequiresActionBehavior);if(!n&&a&&!a.canCreateActionContainer)throw new Error("Unable to create action container; there is an action in progress. Create an action before or during the `action-begin` event.");this[h].liveComponents.actionContainer&&this.destroyComponent(this[h].liveComponents.actionContainer);const i=document.createElement("xendit-action-container");return i.setAttribute("translate","no"),t?.qrCode&&void 0!==t.qrCode.qrCodeOnly&&i.setAttribute("data-qr-code-only",t.qrCode.qrCodeOnly.toString()),this[h].liveComponents.actionContainer=i,i}destroyComponent(n){if(!n.tagName.startsWith("XENDIT-"))throw new Error("Unable to destroy component; only elements created by this SDK can be destroyed.");if(this[h].liveComponents.channelPicker===n)return this[h].liveComponents.channelPicker=null,e.render(null,n),void n.remove();for(const[t,a]of this[h].liveComponents.paymentChannels)if(a.element===n)return this[h].liveComponents.paymentChannels.delete(t),this[h].currentChannelCode===t&&this.setCurrentChannel(null),e.render(null,n),void n.remove();if(this[h].liveComponents.actionContainer===n)return this[h].liveComponents.actionContainer=null,e.render(null,n),void n.remove();for(const[t,a]of this[h].liveComponents.digitalWalletContainer)if(a.element===n)return this[h].liveComponents.digitalWalletContainer.delete(t),e.render(null,n),void n.remove();throw new Error("Unable to destroy component; component not found. It may have already been destroyed.")}submit(){this.assertInitialized();if(!this[h].behaviorTree.findBehavior(SessionActiveBehavior))throw new Error("Unable to submit; the session is not in the active state. Listen to the `session-complete` and `session-expired-or-canceled` events and display success or failure states accordingly.");const e=this[h].currentChannelCode;if(!e)throw new Error("Unable to submit; there is no current payment channel. Create a payment component with `createChannelComponent` or make an existing one active with `setCurrentChannel`.");if(!this[h].liveComponents.paymentChannels.get(e))throw new Error("Current channel is set but component is missing; this is a bug, please contact support.");this.showValidationErrors();if(this[h].behaviorTree.findBehavior(ChannelInvalidBehavior))throw new Error("Unable to submit; the form for the current channel has errors. Listen to the `submission-ready` and `submission-not-ready` events, do not allow submission while in the not-ready state.");if(!this[h].behaviorTree.findBehavior(ChannelValidBehavior))throw new Error("Unable to submit; the SDK is not in a valid state for submission. Listen to the `submission-ready` and `submission-not-ready` events, do not allow submission while in the not-ready state.");this[h].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}submitDigitalWallet(e,n,t,a=null){this.assertInitialized(),this.setCurrentChannel(null),this[h].currentDigitalWalletSubmission={digitalWalletCode:e,channelCode:n[h][0].channel_code,channelProperties:t,instantSubmissionError:a},this.addEventListener(XenditSubmissionEndEvent.type,()=>{this[h].currentDigitalWalletSubmission=null},{once:!0}),this[h].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}abortSubmission(){this.assertInitialized();this[h].behaviorTree.findBehavior(SubmissionBehavior)&&(this[h].behaviorTree.bb.submissionRequested=!1,this.behaviorTreeUpdate())}simulatePayment(){if(this.assertInitialized(),"PAY"!==this[h].worldState.session.session_type)throw new Error('Unable to simulate payment, the session type is not "PAY".');if(!this[h].behaviorTree.findBehavior(PaymentEntityRequiresActionBehavior))throw new Error("Unable to simulate payment; there is no action in progress. You can simulate payments any time between the `action-begin` and `action-end` events.");const e=this[h].worldState.paymentEntity;if(!e)throw new Error("The PeRequiresActionBehavior is present but there is no payment entity. This is a bug, please contact support.");if(!this.findChannel(e.entity.channel_code))throw new Error("Channel not found; this is a bug, please contact support.");const n=U(e.entity.actions);if(!n||!Q(n))throw new Error("Unable to simulate payment; the action does not support simulation.");this[h].behaviorTree.bb.simulatePaymentRequested=!0,this.behaviorTreeUpdate()}pollImmediately(){if(this.assertInitialized(),"ACTIVE"!==this[h].worldState.session.status)throw new Error("Unable to poll immediately; the session is not longer active.");this[h].behaviorTree.bb.pollImmediatelyRequested=!0,this.behaviorTreeUpdate()}getState(){const e=this[h].currentChannelCode,n=this[h].liveComponents.paymentChannels.get(e??"");return{channelCode:e,channelProperties:n?.channelProperties||null,behaviorTree:this[h].behaviorTree}}addEventListener(e,n,t){return this[h].eventListenersPresent.set(e,!0),super.addEventListener(e,n,t)}removeEventListener(e,n,t){return super.removeEventListener(e,n,t)}static amountFormat=Sa}class XenditComponentsTest extends XenditComponents{nextMockUpdate=null;constructor(e){super({...e,componentsSdkKey:`session-${$(32)}-mock-MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCADI5pdf6KmN8+Fxl2ES3yolUKXunNeY3gGScGNEvDcrcHAPKxIInAo5DVnDvTtYtqZvx/bu7HLeBJNMXwHhie/uyNEtT8dSaLc9bd0WSlYdxI+iUsTv2Qu0LiiPrZs-NKf7whM9meUs/eRCvG0oc180MDiyeli3kH6EQ3ZahECHsZQi5G2IpH6vk3cYMtf01Y1L4OBn1SZCOv1kwpjIUet4DJeoTwwq2nM5b+K7rD+/WFTi3AEX4NWJNkKi0a91`}),this.addEventListener(InternalScheduleMockUpdateEvent.type,this.setNextMockUpdate.bind(this))}async initializeAsync(){await L(j);const e=(await Promise.resolve().then(function(){return require("./test-data.cjs")})).makeTestBffData();this.dispatchEvent(new InternalUpdateWorldState({business:e.business,customer:e.customer,session:e.session,channels:e.channels,channelUiGroups:e.channel_ui_groups,digitalWallets:e.digital_wallets??null,paymentEntity:null,sessionTokenRequestId:null,succeededChannel:null}))}isMock(){return!0}setNextMockUpdate(e){const n=e;this.nextMockUpdate=n.mockData}}function Sa(e,n){return xn(e,n)}"undefined"==typeof window||"undefined"==typeof document||(u||(u=!0,e.options.debounceRendering=e=>queueMicrotask(e)),function(){const e=document.createElement("style");e.textContent="/* variables */\n:root {\n --xendit-font-family: sans-serif;\n --xendit-color-primary: #1762ee;\n --xendit-color-text: #252525;\n --xendit-color-text-secondary: #585858;\n --xendit-color-text-placeholder: #7d7d7d;\n --xendit-color-disabled: #f7f7f7;\n --xendit-color-danger: #d1414d;\n --xendit-color-border: #f3f3f3;\n --xendit-color-background: #ffffff;\n --xendit-focus-shadow: 0px 0px 0px 2px\n color-mix(in srgb, var(--xendit-color-primary) 15%, transparent);\n --xendit-card-shadow: 0px 4px 8px 0px #25252514;\n --xendit-dialog-shadow: 8px 8px 12px 8px #25252529;\n --xendit-animation-duration: 0.3s;\n --xendit-animation-ease: ease-in-out;\n --xendit-radius-1: 8px;\n --xendit-z-index-focus: 2;\n --xendit-z-index-overlay: 3;\n\n /* Browser-specific border collapse margins */\n --xendit-border-collapse-offset: -0.5px; /* Default for Chrome/Edge */\n --xendit-border-collapse-webkit-gecko: -1.5px; /* Fix Safari and Firefox subpixel rendering */\n\n /* QR code colors */\n --xendit-qr-foreground-color: #000000;\n --xendit-qr-background-color: #ffffff;\n\n /* icon colors */\n --xendit-color-icon-primary: #7c7c7c;\n --xendit-color-icon-secondary: #f1f1f1;\n}\n\n/* Set default font for root components */\nxendit-channel-picker,\nxendit-action-container,\nxendit-payment-channel {\n display: block;\n unicode-bidi: isolate;\n font-family: var(--xendit-font-family);\n color: var(--xendit-color-text);\n touch-action: manipulation;\n}\n\n.xendit-default-action-container {\n font-family: var(--xendit-font-family);\n touch-action: manipulation;\n}\n\nxendit-action-container {\n position: relative;\n flex: 1; /* Action container usually wants to stretch to fit, assuming the parent is a flexbox. */\n touch-action: manipulation;\n}\n\nxendit-payment-channel button,\nxendit-payment-channel textarea,\nxendit-payment-channel select,\nxendit-payment-channel input,\nxendit-payment-channel input::placeholder {\n font-family: inherit;\n}\n\nxendit-payment-channel input::placeholder,\nxendit-payment-channel textarea::placeholder,\nxendit-payment-channel select::placeholder {\n color: var(--xendit-color-text-placeholder);\n}\n\n/* Reusable typography classes */\n.xendit-text-12 {\n font-size: 12px;\n line-height: 16px;\n letter-spacing: -0.01px;\n}\n\n.xendit-text-14 {\n font-size: 14px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-16 {\n font-size: 16px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-18 {\n font-size: 18px;\n line-height: 24px;\n letter-spacing: -0.26px;\n}\n\n.xendit-text-20 {\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -0.33px;\n}\n\n.xendit-text-12,\n.xendit-text-14,\n.xendit-text-16 {\n font-weight: 400;\n}\n\n.xendit-text-semibold {\n font-weight: 600;\n}\n\n.xendit-text-bold {\n font-weight: 700;\n}\n\n.xendit-text-link {\n color: var(--xendit-color-primary);\n}\n.xendit-text-secondary {\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-text-center {\n text-align: center;\n}\n\n.xendit-dotted-line {\n height: 1px;\n border: none;\n background: repeating-linear-gradient(\n to right,\n var(--xendit-color-border) 0px 4px,\n transparent 4px 8px\n );\n margin: 0;\n}\n\n/* Accordion component */\n\n.xendit-accordion {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n background: var(--xendit-color-background);\n}\n\n.xendit-accordion-item:not(:first-child) {\n border-top: 1px solid var(--xendit-color-border);\n border-top-left-radius: var(--xendit-radius-1);\n border-top-right-radius: var(--xendit-radius-1);\n}\n\n.xendit-accordion-item-header {\n display: grid;\n grid-template-columns: auto 1fr auto;\n grid-gap: 16px;\n align-items: center;\n cursor: pointer;\n padding: 24px 16px;\n color: var(--xendit-color-text);\n border-radius: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.xendit-accordion-item-header-title {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header-title,\n.xendit-accordion-item-disabled .xendit-accordion-item-header-icon {\n opacity: 0.5;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-header {\n color: var(--xendit-color-primary);\n}\n\n.xendit-accordion-item-chevron {\n color: var(--xendit-color-text);\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-chevron {\n display: none;\n}\n\n.xendit-accordion-item-chevron g {\n transition: transform var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item-header:focus-visible {\n border-radius: 8px;\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n}\n\n.xendit-accordion-item-content {\n overflow: hidden;\n transition: height var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item.xendit-accordion-item-closed\n .xendit-accordion-item-content {\n height: 0;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-content {\n height: calc-size(auto, size);\n}\n\n.xendit-accordion-item-padding {\n padding: 16px;\n}\n\n/* Channel picker digital wallet section */\n\n.xendit-channel-picker-digital-wallet-section {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n gap: 8px;\n margin-bottom: 8px;\n}\n\n/* Channel picker group */\n\n.xendit-channel-picker-group {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-picker-group select {\n border: 1px solid var(--xendit-color-border);\n border-radius: 8px;\n padding: 12px;\n appearance: none;\n outline: none;\n}\n\n.xendit-channel-picker-group select:focus {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-channel-logo {\n width: 24px;\n height: 16px;\n margin: -5px 0;\n padding: 4px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n object-fit: contain;\n}\n\n/* Payment channel */\n\nxendit-payment-channel[inert] {\n filter: opacity(0.5) grayscale(1);\n}\n\n.xendit-payment-channel {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-payment-channel-banner {\n width: 100%;\n height: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 12px;\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-payment-channel-instructions-logo {\n height: 40px;\n width: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions-text {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 4px;\n}\n\n.xendit-payment-channel-instructions-text p {\n margin: 0;\n}\n\n/* Forms */\n\n.xendit-channel-form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-form > form {\n display: contents;\n}\n\n.xendit-form-field-group {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.xendit-channel-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group {\n display: grid;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group-label-container {\n display: flex;\n justify-content: space-between;\n gap: 16px;\n}\n\n.xendit-channel-form-field-group label {\n width: fit-content;\n cursor: pointer;\n}\n\n.xendit-form-field-group.invalid\n .xendit-channel-form-field\n .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-danger);\n}\n\n.xendit-channel-form-field .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-border);\n background: var(--xendit-color-background);\n border-radius: 8px;\n appearance: none;\n}\n\n.xendit-channel-form-field.field-radius-tl-0 .xendit-form-field-inner {\n border-top-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-tr-0 .xendit-form-field-inner {\n border-top-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-bl-0 .xendit-form-field-inner {\n border-bottom-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-br-0 .xendit-form-field-inner {\n border-bottom-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-collapse-l,\n.xendit-channel-form-field.field-collapse-l {\n margin-left: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-r,\n.xendit-channel-form-field.field-collapse-r {\n margin-right: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: calc(var(--xendit-border-collapse-offset) * 2);\n width: calc(100% + abs(var(--xendit-border-collapse-offset) * 2));\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container {\n margin-right: 0;\n}\n\n.xendit-channel-form-field.field-collapse-t .xendit-form-field-inner {\n margin-top: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-b .xendit-form-field-inner {\n margin-bottom: var(--xendit-border-collapse-offset);\n}\n\n/* Safari and Firefox specific adjustments */\n@supports (font: -apple-system-body) or (-moz-appearance: none) {\n .xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: 0;\n width: 100%;\n }\n\n .xendit-channel-form-field.field-collapse-b input,\n .xendit-channel-form-field.field-collapse-b button {\n margin-bottom: var(--xendit-border-collapse-webkit-gecko);\n height: calc(100% + abs(var(--xendit-border-collapse-webkit-gecko) * 2));\n }\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container:focus {\n border-right: none;\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container:focus {\n border-left: none;\n}\n\n.xendit-card-brand-logo {\n width: 24px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n padding: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n}\n\n.xendit-card-brands-list {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n gap: 4px;\n}\n\n.xendit-channel-form-field .xendit-form-field-inner:focus,\n.xendit-channel-form-field .xendit-form-field-inner.xendit-field-focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-channel-form-field button.xendit-dropdown-open {\n z-index: var(--xendit-z-index-focus);\n}\n\n.xendit-channel-form-field input.xendit-form-field-inner {\n padding: 12px;\n}\n\n.xendit-channel-form-field .xendit-iframe-container {\n display: flex;\n height: 40px;\n width: 100%;\n padding: 0;\n overflow: hidden;\n box-sizing: border-box;\n}\n\n.xendit-channel-form-field .xendit-iframe-container iframe {\n height: 40px;\n width: 100%;\n border: none;\n min-width: 0;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-1 {\n grid-column: span 1;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-2 {\n grid-column: span 2;\n}\n\n.xendit-checkbox {\n display: flex;\n align-items: center;\n}\n\n.xendit-checkbox-box {\n display: flex;\n}\n\n.xendit-checkbox input {\n width: 16px;\n height: 16px;\n margin: 0;\n cursor: pointer;\n}\n\n.xendit-checkbox label {\n cursor: pointer;\n padding-left: 8px;\n}\n\n.xendit-checkbox input {\n opacity: 0;\n position: absolute;\n}\n\n.xendit-checkbox input + .xendit-checkbox-graphic {\n width: 16px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n box-sizing: border-box;\n color: transparent;\n}\n\n.xendit-checkbox input:checked + .xendit-checkbox-graphic {\n color: var(--xendit-color-background);\n background-color: var(--xendit-color-primary);\n border-color: var(--xendit-color-primary);\n}\n\n.xendit-checkbox input:focus + .xendit-checkbox-graphic {\n border: 1px solid var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n/* Dialog */\n\n.xendit-dialog-backdrop {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n padding: 48px;\n justify-content: center;\n align-items: center;\n}\n\n.xendit-dialog {\n position: relative;\n}\n\n.xendit-dialog-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: var(--xendit-color-text);\n padding: 16px;\n gap: 16px;\n line-height: 20px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dialog-header button {\n display: flex;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-floating-close {\n display: none;\n}\n\n.xendit-dialog .xendit-dialog-floating-close {\n display: flex;\n}\n\n.xendit-dialog-floating-close {\n position: absolute;\n top: 24px;\n right: 24px;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-body {\n display: flex;\n padding: 24px;\n background-color: var(--xendit-color-background);\n border-radius: 8px;\n box-shadow: var(--xendit-dialog-shadow);\n}\n\n.xendit-error-message {\n color: var(--xendit-color-danger);\n}\n\n/* Phone input Dropdown */\n.xendit-input-phone {\n display: flex;\n gap: 8px;\n}\n\n.xendit-phone-number-input {\n width: 100%;\n}\n\n/* Phone input Dropdown ends */\n\n/* Dropdown */\n.xendit-dropdown {\n width: 100%;\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n text-align: left;\n background-color: var(--xendit-color-background);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n justify-content: space-between;\n cursor: pointer;\n padding: 0;\n padding-left: 12px;\n outline: none;\n}\n\n.xendit-dropdown:focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-dropdown.xendit-dropdown-has-asset {\n grid-template-columns: auto 1fr auto;\n}\n\n.xendit-dropdown-channel-logo {\n height: 24px;\n width: 32px;\n object-fit: contain;\n padding: 2px 0px;\n padding-right: 12px;\n border-right: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dropdown-text {\n padding: 12px;\n padding-right: 0;\n}\n\n.xendit-dropdown-chevron {\n height: 38px;\n width: 38px;\n padding: 12px;\n box-sizing: border-box;\n}\n\n.xendit-dropdown:disabled {\n background: var(--xendit-color-disabled);\n cursor: default;\n}\n\n.xendit-dropdown-overlay {\n contain: style;\n position: absolute;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 320px;\n padding: 4px;\n margin: 4px 0;\n box-sizing: border-box;\n background-color: var(--xendit-color-background);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n list-style: none;\n box-shadow: var(--xendit-card-shadow);\n overflow-y: auto;\n overscroll-behavior: none;\n}\n\n.xendit-dropdown-overlay ul {\n list-style: none;\n padding: 4px;\n margin: 0;\n}\n\n.xendit-dropdown-search {\n position: sticky;\n top: 0;\n z-index: 1;\n}\n\n.xendit-dropdown-search input {\n width: 100%;\n padding: 8px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n box-sizing: border-box;\n outline: none;\n}\n\n.xendit-dropdown-search input:focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-dropdown-item {\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n gap: 8px;\n padding: 8px 12px 8px 4px;\n border-radius: var(--xendit-radius-1);\n cursor: pointer;\n z-index: 0;\n --xendit-dropdown-item-hover-color: var(--xendit-color-background);\n --xendit-dropdown-item-hover-bg-color: var(--xendit-color-primary);\n}\n\n.xendit-dropdown-item-disabled {\n --xendit-dropdown-item-hover-color: var(--xendit-color-text);\n --xendit-dropdown-item-hover-bg-color: var(--xendit-color-disabled);\n}\n\n.xendit-dropdown-item-active {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-dropdown-item:hover {\n background-color: var(--xendit-dropdown-item-hover-bg-color);\n}\n\n.xendit-dropdown-item:hover .xendit-dropdown-item-text,\n.xendit-dropdown-item:hover .xendit-dropdown-item-description {\n color: var(--xendit-dropdown-item-hover-color);\n}\n\n.xendit-dropdown-item-selected {\n color: var(--xendit-color-primary);\n}\n\n.xendit-dropdown-item:hover .xendit-dropdown-item-selected {\n color: var(--xendit-dropdown-item-hover-color);\n}\n\n.xendit-dropdown-item.xendit-dropdown-has-asset {\n grid-template-columns: auto 1fr auto;\n}\n\n.xendit-dropdown-item-text {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.xendit-dropdown-item-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.xendit-dropdown-item-disabled:hover,\n.xendit-dropdown-item-disabled.xendit-dropdown-item-active {\n background-color: var(--xendit-color-disabled);\n}\n\n/* Dropdown ends */\n\n/* Button */\n.xendit-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 12px 16px;\n font-family: var(--xendit-font-family);\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n letter-spacing: -0.09px;\n cursor: pointer;\n transition: background-color var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n.xendit-button-primary-rounded {\n border: 1px solid transparent;\n background-color: var(--xendit-color-primary);\n color: var(--xendit-color-background);\n border-radius: var(--xendit-radius-1);\n}\n.xendit-button-white-rounded {\n background-color: var(--xendit-color-background);\n color: var(--xendit-color-text);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n}\n.xendit-button-white-rounded:hover {\n background-color: var(--xendit-color-border);\n}\n.xendit-button-block {\n width: 100%;\n}\n.xendit-button-sm {\n padding: 8px 12px;\n font-size: 12px;\n line-height: 16px;\n}\n\n@keyframes xendit-button-loading-spinner-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.xendit-button-loading-spinner {\n width: 16px;\n height: 16px;\n animation: xendit-button-loading-spinner-spin 1s linear infinite;\n}\n\n.xendit-skeleton-field button {\n height: 42px;\n background-color: var(--xendit-color-disabled);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--xendit-color-text-secondary);\n}\n\n/* Button ends */\n\n/* Form Simulation Helper */\n.xendit-form-simulation-root {\n position: relative;\n}\n.xendit-form-simulation-trigger {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n}\n.xendit-form-simulation-popover {\n position: absolute;\n top: 100%;\n right: 0;\n\n width: 350px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-radius: 4px;\n padding: 12px;\n border: 1px solid var(--xendit-color-border);\n background: color-mix(\n in srgb,\n var(--xendit-color-background),\n transparent 40%\n );\n backdrop-filter: blur(6px);\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-form-simulation-popover .xendit-dropdown-overlay {\n width: auto;\n}\n\n.xendit-form-simulation-scenario-icon {\n height: 28px;\n width: 40px;\n border-radius: 4px;\n border: 1px solid var(--xendit-color-border);\n object-fit: contain;\n background-color: white;\n}\n\n/* Form Simulation Helper ends */\n\n.xendit-tooltip {\n position: absolute;\n top: 100%;\n right: 50%;\n transform: translateX(50%);\n background-color: black;\n color: white;\n padding: 8px 12px;\n border-radius: var(--xendit-radius-1);\n white-space: nowrap;\n z-index: 1000;\n font-weight: 600;\n font-size: 14px;\n line-height: 16px;\n animation: xendit-tooltip-fade-in var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n opacity: 1;\n}\n\n@keyframes xendit-tooltip-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Instructions */\n\n.xendit-instructions-bold {\n font-weight: 600;\n}\n.xendit-instructions-bullet-list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin: 8px 0;\n}\n.xendit-instructions-bullet-list::marker {\n color: var(--xendit-color-text-secondary);\n}\n.xendit-instructions-form-card {\n display: flex;\n flex-direction: column;\n padding: 16px;\n border-radius: 12px;\n border: 1px solid var(--xendit-color-border);\n gap: 4px;\n width: 321px;\n}\n.xendit-instructions-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 8px 0;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n.xendit-instructions-form-field-label {\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n color: var(--xendit-color-text-secondary);\n}\n.xendit-instructions-form-field-value {\n font-size: 14px;\n line-height: 20px;\n color: var(--xendit-color-text);\n}\n.xendit-instructions-form-heading {\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n margin: 4px 0;\n}\n.xendit-instructions-italics {\n font-style: italic;\n}\n.xendit-instructions-numbered-list {\n display: flex;\n flex-direction: column;\n gap: 16px;\n list-style-type: decimal;\n padding-left: 40px;\n}\n.xendit-instructions-single-tab-heading {\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n margin-bottom: 16px;\n}\n.xendit-instructions-step-box {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.xendit-instructions-step-li {\n font-size: 14px;\n line-height: 20px;\n}\n.xendit-instructions-step-li p {\n margin: 0;\n}\n.xendit-instructions-step-li::marker {\n margin-left: 20px;\n}\n.xendit-instructions-tab-button {\n font-family: var(--xendit-font-family);\n font-size: 14px;\n padding: 8px 4px;\n background-color: transparent;\n border: none;\n border-top: 3px solid transparent;\n border-bottom: 3px solid transparent;\n cursor: pointer;\n}\n.xendit-instructions-active-tab {\n border-bottom-color: var(--xendit-color-primary);\n color: var(--xendit-color-primary);\n font-weight: 600;\n}\n.xendit-instructions-tab-list {\n display: flex;\n gap: 16px;\n margin-bottom: 16px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n.xendit-instructions-table {\n font-size: 14px;\n line-height: 16px;\n width: 100%;\n border-collapse: collapse;\n}\n.xendit-instructions-table-cell {\n padding: 4px;\n border: 1px solid black;\n}\n.xendit-instructions-table-header {\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n padding: 4px;\n border: 1px solid black;\n}\n\n/* Instructions ends */\n\n.xendit-default-action-container {\n display: flex;\n flex-direction: column;\n border: none;\n}\n\n.xendit-action-title {\n font-weight: 600;\n font-size: 20px;\n line-height: 28px;\n text-align: center;\n}\n\n.xendit-action-iframe {\n border: none;\n width: 100%;\n height: 100%;\n}\n\n.xendit-action-present-to-customer {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-present-to-customer-affirm {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n/* qr actions */\n.xendit-action-qr-content {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n max-width: 384px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n overflow: hidden;\n}\n.xendit-qr-merchant-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n.xendit-action-qr-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-qr-qrcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n}\n\n/* barcode actions */\n.xendit-action-barcode-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-barcode-barcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n justify-content: center;\n}\n\n/* va actions */\n.xendit-action-va-content,\n.xendit-action-barcode-content {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n padding-bottom: 24px;\n}\n.xendit-action-va-details,\n.xendit-action-barcode-details {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-va-detail-item,\n.xendit-action-barcode-detail-item {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.xendit-action-va-detail-content,\n.xendit-action-barcode-detail-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.xendit-action-va-heading,\n.xendit-action-barcode-heading {\n color: var(--xendit-color-text-placeholder);\n}\n.xendit-action-va-tag {\n color: var(--xendit-color-text-placeholder);\n background-color: #fafafa;\n padding: 2px 4px;\n border-radius: 4px;\n}\n\n/* redirect, deeplink, and push notification actions */\n.xendit-redirect-instructions {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n gap: 24px;\n}\n\n.xendit-redirect-instructions-logo {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 112px;\n height: 112px;\n border: 2px solid var(--xendit-color-border);\n border-radius: 50%;\n overflow: hidden;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-logo img {\n width: 96px;\n height: 96px;\n object-fit: contain;\n}\n\n.xendit-redirect-instructions-text {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-redirect-instructions-button {\n display: inline-block;\n border-radius: 99px;\n color: white;\n padding: 12px 16px;\n background-color: var(--xendit-channel-brand-color, #000);\n text-decoration: none;\n white-space: nowrap;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-button:hover,\n.xendit-redirect-instructions-button:active {\n filter: brightness(1.1);\n}\n\n/* googlepay */\n\n.gpay-card-info-container-fill {\n display: flex;\n}\n";const n=document.querySelector("style, link");n?n.insertAdjacentElement("beforebegin",e):document.head.appendChild(e)}()),exports.XenditActionBeginEvent=XenditActionBeginEvent,exports.XenditActionEndEvent=XenditActionEndEvent,exports.XenditComponents=XenditComponents,exports.XenditComponentsTest=XenditComponentsTest,exports.XenditFatalErrorEvent=XenditFatalErrorEvent,exports.XenditInitEvent=XenditInitEvent,exports.XenditNotReadyEvent=XenditNotReadyEvent,exports.XenditPaymentRequestCreatedEvent=XenditPaymentRequestCreatedEvent,exports.XenditPaymentRequestDiscardedEvent=XenditPaymentRequestDiscardedEvent,exports.XenditPaymentTokenCreatedEvent=XenditPaymentTokenCreatedEvent,exports.XenditPaymentTokenDiscardedEvent=XenditPaymentTokenDiscardedEvent,exports.XenditReadyEvent=XenditReadyEvent,exports.XenditSessionCompleteEvent=XenditSessionCompleteEvent,exports.XenditSessionExpiredOrCanceledEvent=XenditSessionExpiredOrCanceledEvent,exports.XenditSessionNotPendingEvent=XenditSessionNotPendingEvent,exports.XenditSessionPendingEvent=XenditSessionPendingEvent,exports.XenditSubmissionBeginEvent=XenditSubmissionBeginEvent,exports.XenditSubmissionEndEvent=XenditSubmissionEndEvent,exports.XenditWillRedirectEvent=XenditWillRedirectEvent,exports.amountFormat=Sa,exports.randomHexString=$,exports.randomUUID=Y;
|
|
2
|
+
"use strict";require("preact/debug"),require("preact/devtools");var e=require("preact"),n=require("preact/jsx-runtime"),t=require("preact/hooks"),a=require("classnames"),i=require("libphonenumber-js"),r=require("libphonenumber-js/min"),o=require("libphonenumber-js/mobile/examples"),s=require("preact/compat"),l=require("jsbarcode"),d=require("qrcode"),c=require("qrcode/lib/renderer/svg-tag.js");let u=!1;class XenditInitEvent extends Event{static type="init";constructor(){super(XenditInitEvent.type,{})}}class XenditFatalErrorEvent extends Event{message;static type="fatal-error";constructor(e){super(XenditFatalErrorEvent.type,{}),this.message=e}}class XenditReadyEvent extends Event{channelCode;static type="submission-ready";constructor(e){super(XenditReadyEvent.type,{}),this.channelCode=e}}class XenditNotReadyEvent extends Event{static type="submission-not-ready";constructor(){super(XenditNotReadyEvent.type,{})}}class XenditSubmissionBeginEvent extends Event{static type="submission-begin";constructor(){super(XenditSubmissionBeginEvent.type,{})}}class XenditSubmissionEndEvent extends Event{reason;userErrorMessage;developerErrorMessage;static type="submission-end";constructor(e,n,t){super(XenditSubmissionEndEvent.type,{}),this.reason=e,this.userErrorMessage=n,this.developerErrorMessage=t}}class XenditActionBeginEvent extends Event{static type="action-begin";constructor(){super(XenditActionBeginEvent.type,{})}}class XenditActionEndEvent extends Event{static type="action-end";constructor(){super(XenditActionEndEvent.type,{})}}class XenditWillRedirectEvent extends Event{static type="will-redirect";constructor(){super(XenditWillRedirectEvent.type,{})}}class XenditSessionCompleteEvent extends Event{succeededChannel;static type="session-complete";constructor(e){super(XenditSessionCompleteEvent.type,{}),this.succeededChannel=e}}class XenditSessionExpiredOrCanceledEvent extends Event{static type="session-expired-or-canceled";constructor(){super(XenditSessionExpiredOrCanceledEvent.type,{})}}class XenditSessionPendingEvent extends Event{static type="session-pending";constructor(){super(XenditSessionPendingEvent.type,{})}}class XenditSessionNotPendingEvent extends Event{static type="session-not-pending";constructor(){super(XenditSessionNotPendingEvent.type,{})}}class XenditPaymentRequestCreatedEvent extends Event{paymentRequestId;static type="payment-request-created";constructor(e){super(XenditPaymentRequestCreatedEvent.type,{}),this.paymentRequestId=e}}class XenditPaymentTokenCreatedEvent extends Event{paymentTokenId;static type="payment-token-created";constructor(e){super(XenditPaymentTokenCreatedEvent.type,{}),this.paymentTokenId=e}}class XenditPaymentRequestDiscardedEvent extends Event{paymentRequestId;static type="payment-request-discarded";constructor(e){super(XenditPaymentRequestDiscardedEvent.type,{}),this.paymentRequestId=e}}class XenditPaymentTokenDiscardedEvent extends Event{paymentTokenId;static type="payment-token-discarded";constructor(e){super(XenditPaymentTokenDiscardedEvent.type,{}),this.paymentTokenId=e}}const h=Symbol("xendit-internal"),p=e=>n.jsx("div",{class:"xendit-accordion",children:e.children}),m=e=>{const{name:t,size:a,direction:i}=e;let r,o;switch(i){case"right":r="rotate(180 12 12)";break;case"up":r="rotate(90 12 12)";break;case"down":r="rotate(-90 12 12)";break;default:r="rotate(0 12 12)"}switch(t){case"chevron":o=n.jsx("path",{d:"M15 19.5L7.5 12L15 4.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"});break;case"check":o=_(n.jsx("path",{d:"M13.5 4.5L6.5 11.5L3 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),16/24);break;case"x":o=n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M18.75 5.25L5.25 18.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),n.jsx("path",{d:"M18.75 18.75L5.25 5.25",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]});break;case"card":o=_(n.jsx("path",{fill:"currentColor",d:"M17.25 3.75H2.75A1.25 1.25 0 0 0 1.5 5v10a1.25 1.25 0 0 0 1.25 1.25h14.5A1.25 1.25 0 0 0 18.5 15V5a1.25 1.25 0 0 0-1.25-1.25m-.875 9.5a1 1 0 0 1-1 1h-2.5a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1zM1.5 8V6h17v2z"}),20/24);break;case"qr":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{fill:"currentColor",d:"M8.125 3.125h-3.75c-.69 0-1.25.56-1.25 1.25v3.75c0 .69.56 1.25 1.25 1.25h3.75c.69 0 1.25-.56 1.25-1.25v-3.75c0-.69-.56-1.25-1.25-1.25M8.125 10.625h-3.75c-.69 0-1.25.56-1.25 1.25v3.75c0 .69.56 1.25 1.25 1.25h3.75c.69 0 1.25-.56 1.25-1.25v-3.75c0-.69-.56-1.25-1.25-1.25M15.625 3.125h-3.75c-.69 0-1.25.56-1.25 1.25v3.75c0 .69.56 1.25 1.25 1.25h3.75c.69 0 1.25-.56 1.25-1.25v-3.75c0-.69-.56-1.25-1.25-1.25M11.25 14.375a.624.624 0 0 0 .625-.625v-2.5a.624.624 0 1 0-1.25 0v2.5a.624.624 0 0 0 .625.625"}),n.jsx("path",{fill:"currentColor",d:"M16.25 11.875h-1.875v-.625a.624.624 0 1 0-1.25 0v4.375H11.25a.624.624 0 1 0 0 1.25h2.5a.624.624 0 0 0 .625-.625v-3.125h1.875a.624.624 0 1 0 0-1.25M16.25 14.375a.624.624 0 0 0-.625.625v1.25a.624.624 0 1 0 1.25 0V15a.624.624 0 0 0-.625-.625"})]}),20/24);break;case"otc":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{fill:"currentColor","fill-rule":"evenodd",d:"M16.972 9.547c.092-.107.207-.021.207.12v6.924c0 .283-.23.513-.512.513h-7.18v-5.129a.513.513 0 0 0-.514-.512h-3.59a.513.513 0 0 0-.513.512v5.13H3.332a.514.514 0 0 1-.513-.514V9.853c0-.244.149-.33.331-.168.268.238.586.428.936.556a3.2 3.2 0 0 0 2.209 0c.35-.128.669-.318.936-.556a.56.56 0 0 1 .728 0c.267.238.586.428.935.556a3.2 3.2 0 0 0 2.209 0c.35-.128.669-.318.937-.556a.56.56 0 0 1 .727 0c.267.238.586.428.935.556a3.2 3.2 0 0 0 2.21 0c.349-.128.668-.318.936-.556.04-.036.081-.088.124-.138m-4.409 1.915a.513.513 0 0 0-.512.513v1.283c0 .283.23.512.512.513h2.052c.283 0 .513-.23.513-.513v-1.283a.513.513 0 0 0-.513-.512z","clip-rule":"evenodd"}),n.jsx("path",{fill:"currentColor",d:"M16.325 3c.148 0 .293.054.412.153.118.1.204.24.245.398l.99 2.872a.51.51 0 0 1-.333.654 2.4 2.4 0 0 1-.166.495c-.145.31-.357.593-.625.831a2.9 2.9 0 0 1-.936.556 3.2 3.2 0 0 1-2.209 0 2.9 2.9 0 0 1-.936-.556.56.56 0 0 0-.727 0 2.9 2.9 0 0 1-.936.556 3.2 3.2 0 0 1-2.209 0 2.9 2.9 0 0 1-.936-.556.56.56 0 0 0-.728 0 2.9 2.9 0 0 1-.935.556 3.2 3.2 0 0 1-2.21 0 2.9 2.9 0 0 1-.936-.556 2.6 2.6 0 0 1-.624-.831 2.4 2.4 0 0 1-.167-.495.51.51 0 0 1-.33-.654l.99-2.872a.77.77 0 0 1 .244-.397A.64.64 0 0 1 3.675 3z"})]}),20/24);break;case"ewallet":o=_(n.jsx("path",{fill:"currentColor","fill-rule":"evenodd",d:"M11.313 2.07c.94-.23 2.112.266 2.63 1.145H9.331c-1.242 0-2.295.021-3.171.053 1.648-.683 3.44-.78 5.153-1.198M4.338 17.855c1.061.072 2.691.145 4.971.145s3.91-.073 4.972-.145c1.168-.08 2.09-.963 2.186-2.134q.029-.335.054-.747a40 40 0 0 1-2.644-.012c-1.298-.052-2.345-1.039-2.405-2.362a26 26 0 0 1-.023-1.153q.002-.67.023-1.153c.06-1.323 1.107-2.31 2.405-2.362q.745-.029 1.494-.027.654 0 1.15.016a36 36 0 0 0-.054-.748c-.096-1.17-1.018-2.053-2.186-2.133-1.062-.073-2.692-.146-4.972-.146s-3.91.073-4.971.146c-1.169.08-2.09.962-2.187 2.133A53 53 0 0 0 2 11.447c0 1.922.073 3.326.151 4.274.096 1.171 1.018 2.053 2.187 2.134m8.675-5.325c.03.662.544 1.155 1.21 1.181q.508.022 1.274.024.766-.002 1.273-.024c.667-.026 1.18-.52 1.21-1.181q.019-.404.02-.971-.001-.569-.02-.971c-.03-.662-.544-1.156-1.21-1.182a32 32 0 0 0-1.273-.024c-.512 0-.934.01-1.274.024-.667.026-1.18.52-1.21 1.182q-.019.403-.02.97.001.569.02.972m2.041-1.749c.159 0 .311.05.424.137a.42.42 0 0 1 .175.33v.622a.42.42 0 0 1-.175.33.7.7 0 0 1-.424.136.7.7 0 0 1-.423-.137.42.42 0 0 1-.176-.33v-.621c0-.124.063-.242.176-.33a.7.7 0 0 1 .423-.137","clip-rule":"evenodd"}),20/24);break;case"bank_transfer":o=_(n.jsx("path",{fill:"currentColor",d:"M9.195 1.947a1.46 1.46 0 0 1 1.72 0l6.184 4.514c.814.593.629 1.463-.378 1.466H3.388C2.38 7.924 2.196 7.054 3.01 6.46zm.235 11.196a.2.2 0 0 1-.2.2H7.963a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2H9.23c.11 0 .2.09.2.2zm2.916 0a.2.2 0 0 1-.2.2H10.88a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2h1.267c.11 0 .2.09.2.2zm3.125 0a.2.2 0 0 1-.2.2h-1.475a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2h1.475c.11 0 .2.09.2.2zm-12.916 1.45v1.875c0 .346.28.625.625.625h13.75a.625.625 0 0 0 .625-.625v-1.875s-12.07-.128-15 0m3.958-1.45a.2.2 0 0 1-.2.2H4.838a.2.2 0 0 1-.2-.2V9.377c0-.11.09-.2.2-.2h1.475c.11 0 .2.09.2.2z"}),20/24);break;case"online_banking":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M14.25 17.708a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5"}),n.jsx("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 13.958H18m-3.75-3.75a5.437 5.437 0 0 0 0 7.5 5.44 5.44 0 0 0 0-7.5"}),n.jsx("path",{fill:"currentColor",d:"M8.706 14.537c.15.97.574 1.848 1.188 2.556H3.18a.625.625 0 0 1-.625-.625v-1.875c1.115-.049 3.556-.06 6.151-.056M6.346 9.177c.092 0 .167.074.167.166v3.833a.167.167 0 0 1-.167.167H4.805a.167.167 0 0 1-.167-.167V9.343c0-.092.075-.166.167-.166zM9.263 9.177c.092 0 .167.074.167.166v1.69a5.1 5.1 0 0 0-.767 2.31H7.93a.167.167 0 0 1-.167-.167V9.343c0-.092.075-.166.167-.166zM11.484 9.177q-.428.21-.804.495v-.329c0-.092.074-.166.166-.166zM10.055 1.667c.309 0 .61.098.86.28l6.184 4.514c.814.593.629 1.463-.378 1.466H3.388c-1.007-.003-1.192-.873-.379-1.466l6.185-4.513c.25-.183.551-.281.86-.281"})]}),20/24);break;case"copy":o=_(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 9.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 7.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M10 2.5H12.5C12.6326 2.5 12.7598 2.55268 12.8536 2.64645C12.9473 2.74021 13 2.86739 13 3V13.5C13 13.6326 12.9473 13.7598 12.8536 13.8536C12.7598 13.9473 12.6326 14 12.5 14H3.5C3.36739 14 3.24021 13.9473 3.14645 13.8536C3.05268 13.7598 3 13.6326 3 13.5V3C3 2.86739 3.05268 2.74021 3.14645 2.64645C3.24021 2.55268 3.36739 2.5 3.5 2.5H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M5.5 4.5V4C5.5 3.33696 5.76339 2.70107 6.23223 2.23223C6.70107 1.76339 7.33696 1.5 8 1.5C8.66304 1.5 9.29893 1.76339 9.76777 2.23223C10.2366 2.70107 10.5 3.33696 10.5 4V4.5H5.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]}),16/24);break;case"dummy":o=_(n.jsx("path",{fill:"currentColor",d:"M17.5 11.875V15C17.5 15.3315 17.3683 15.6495 17.1339 15.8839C16.8995 16.1183 16.5815 16.25 16.25 16.25H3.75C3.41848 16.25 3.10054 16.1183 2.86612 15.8839C2.6317 15.6495 2.5 15.3315 2.5 15V11.875C2.5 11.5435 2.6317 11.2255 2.86612 10.9911C3.10054 10.7567 3.41848 10.625 3.75 10.625H16.25C16.5815 10.625 16.8995 10.7567 17.1339 10.9911C17.3683 11.2255 17.5 11.5435 17.5 11.875ZM16.25 3.75H3.75C3.41848 3.75 3.10054 3.8817 2.86612 4.11612C2.6317 4.35054 2.5 4.66848 2.5 5V8.125C2.5 8.45652 2.6317 8.77446 2.86612 9.00888C3.10054 9.2433 3.41848 9.375 3.75 9.375H16.25C16.5815 9.375 16.8995 9.2433 17.1339 9.00888C17.3683 8.77446 17.5 8.45652 17.5 8.125V5C17.5 4.66848 17.3683 4.35054 17.1339 4.11612C16.8995 3.8817 16.5815 3.75 16.25 3.75Z"}),20/24);break;default:throw new Error(`Icon with name ${t} does not exist`)}return n.jsx("svg",{className:`xendit-icon ${e.className??""}`,width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"none",children:n.jsx("g",{transform:r,children:o})})};function _(e,t){return n.jsx("g",{transform:`scale(${1/t} ${1/t})`,children:e})}const f=e=>{const{id:i,title:r,iconName:o,subtitle:s,disabled:l,open:d,onClick:c,children:u}=e,h=d?"up":"down",p=t.useCallback(()=>{l||c(i)},[l,c,i]),_=t.useCallback(e=>{"Enter"!==e.key&&" "!==e.key||(p(),e.preventDefault())},[p]),f=t.useCallback(()=>{p()},[p]);return n.jsxs("div",{className:a("xendit-accordion-item",l?"xendit-accordion-item-disabled":"",d?"xendit-accordion-item-open":"xendit-accordion-item-closed"),children:[n.jsxs("div",{className:"xendit-accordion-item-header",onClick:f,onKeyDown:_,role:"button",tabIndex:l?-1:0,children:[n.jsx(m,{className:"xendit-accordion-item-header-icon",name:o,size:24}),n.jsxs("div",{className:"xendit-accordion-item-header-title xendit-text-16 xendit-text-bold",children:[r,s?n.jsx("div",{className:"xendit-accordion-item-header-subtitle xendit-text-14",children:s}):null]}),n.jsx(m,{className:"xendit-accordion-item-chevron",name:"chevron",size:24,direction:h})]}),n.jsx("div",{className:"xendit-accordion-item-content",inert:!d,children:n.jsx("div",{className:"xendit-accordion-item-padding",children:u})})]})},x=e.createContext(null);x.displayName="SessionContext";const b=e.createContext(null);b.displayName="BusinessContext";const y=e.createContext(void 0);y.displayName="CustomerContext";const g=e.createContext(null);g.displayName="ChannelsContext";const v=e.createContext(null);v.displayName="ChannelUiGroupsContext";const C=e.createContext(null);C.displayName="DigitalWalletsContext";const k=e.createContext(null);k.displayName="SdkContext";const E=e.createContext(null);E.displayName="CurrentChannelContext";const w=()=>{const e=t.useContext(x);if(null===e)throw new Error("useSession must be used within a XenditSessionProvider");return e},N=()=>{const e=t.useContext(g);if(null===e)throw new Error("useChannels must be used within a XenditSessionProvider");return e},A=()=>t.useContext(C),S=()=>{const e=t.useContext(k);if(null===e)throw new Error("useSdk must be used within a XenditSessionProvider");return e},I=()=>t.useContext(E),P=({children:e,data:t,sdk:a})=>{const{session:i,business:r,customer:o,channels:s,digitalWallets:l,channelUiGroups:d}=t,c=a.getCurrentChannel()?.[h]?.[0]??null;return"ACTIVE"!==a.getSdkStatus()||"ACTIVE"!==i.status?null:n.jsx(k.Provider,{value:a,children:n.jsx(E.Provider,{value:c,children:n.jsx(x.Provider,{value:i,children:n.jsx(b.Provider,{value:r,children:n.jsx(y.Provider,{value:o,children:n.jsx(g.Provider,{value:s,children:n.jsx(C.Provider,{value:l,children:n.jsx(v.Provider,{value:d,children:e})})})})})})})})},R=300;function T(e){if(!e)throw new Error("Assertion failed: argument is null or undefined; this is a bug, please contact support.")}function j(e){if(!Array.isArray(e))throw new Error("Assertion failed: expected array; this is a bug, please contact support.")}function D(e){if(Array.isArray(e))throw new Error("Assertion failed: expected array; this is a bug, please contact support.")}function q(e,n){if(e!==n)throw new Error("Assertion failed; this is a bug, please contact support.")}function L(e){return new Promise(n=>setTimeout(n,1*e))}class AbortError extends Error{constructor(){super("AbortError"),this.name="AbortError"}}function B(e){return e instanceof AbortError&&"AbortError"===e.name}function M(e,n){return new Promise((t,a)=>{function i(){n.removeEventListener("abort",i),clearTimeout(r),a(new AbortError)}const r=setTimeout(()=>{n.removeEventListener("abort",i),t()},1*e);n.aborted?i():n.addEventListener("abort",i)})}function O(e){const n=e.find(e=>{switch(e.type){case"REDIRECT_CUSTOMER":switch(e.descriptor){case"WEB_URL":return!0;case"DEEPLINK_URL":return function(){const e=navigator.userAgent;if(!e)return!1;if(/android/i.test(e))return!0;if(/iPad|iPhone|iPod/.test(e))return!0;return!1}();case"WEB_GOOGLE_PAYLINK":return!1}break;case"PRESENT_TO_CUSTOMER":return!0;case"API_POST_REQUEST":return!1}return!1});return n||e[0]}function U(e,n){if(e[h].options.enablePaylinks)return n.find(e=>"REDIRECT_CUSTOMER"===e.type&&"WEB_GOOGLE_PAYLINK"===e.descriptor)}const K="mock",F={pl:"https://checkout-ui-gateway.xendit.co",pd:"https://checkout-ui-gateway-prod-dev.xendit.co",sl:"https://checkout-ui-gateway-live.stg.tidnex.dev",sd:"https://checkout-ui-gateway-dev.stg.tidnex.dev"};function V(e){return F[e]??null}function W(e,n){const t={...e};for(const e of Object.keys(n)){const a=n[e];void 0!==a&&(t[e]=a)}return t}function X(e){const n=t.useRef();return t.useLayoutEffect(()=>{n.current=e}),n.current}function G(e){let n;if("string"==typeof e.channel_property)n=e.channel_property;else{n=Object.values(e.channel_property).join("__")}return n}const z=Math.floor(255*Math.random());function H(e){return`xendit-id-${G(e).split("").map(e=>(e.charCodeAt(0)%256^z).toString(16)).join("")}`}function $(e){T(e%2==0);const n=function(e){const n=new Uint8Array(e);for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}(e/2);return Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}function Y(){return[$(8),$(4),$(4),$(4),$(12)].join("-")}function Q(){return`xendit-id-${t.useRef($(12)).current}`}function Z(e){return"PRESENT_TO_CUSTOMER"===e.type}function J(e){if(e instanceof Error)return e.stack??e.message;if("string"==typeof e)return e;try{return`Unknown error: ${JSON.stringify(e)}`}catch{return"Unknown error"}}function ee(e){for(const n of Object.keys(e)){if("symbol"==typeof n)continue;const t=Object.getOwnPropertyDescriptor(e,n);void 0!==t&&("function"!=typeof t.get&&void 0===t.value&&delete e[n])}return e}function ne(e,n){let t=e;if(!n)return;if(Array.isArray(t))throw new Error("Getting values from channel property arrays is not supported.");let a=n;for(;;){if(!a||"object"!=typeof a||Array.isArray(a))return;const e=t.indexOf(".");if(-1===e)return a?a[t]:void 0;{const n=t.slice(0,e);a=a?a[n]:void 0,t=t.slice(e+1)}}}function te(e){const n=ne("card_details.card_number",e);return"string"!=typeof n?null:n}function ae(e){const n={version:0,publicKey:"",iv:"",cipherText:"",valid:!1,validationError:null,withoutValidationError:e};if(!e)return n;const t=e.split("-");if(t.length<6)throw new Error("Invalid encrypted field value format.");if("xendit"!==t[0])throw new Error("Invalid encrypted field value format.");if("encrypted"!==t[1])throw new Error("Invalid encrypted field value format.");const a=parseInt(t[2],10);if(isNaN(a)||a<=0)throw new Error("Invalid encrypted field value format.");if(n.version=a,n.publicKey=t[3],n.iv=t[4],n.cipherText=t[5],t.length>6){if("invalid"!==t[6])throw new Error("Invalid encrypted field value format.");n.validationError=atob(t[7]),n.withoutValidationError=t.slice(0,6).join("-")}else n.valid=!0;return n}const ie=new WeakMap;let re=1;function oe(e,n){return T(e.length>0),T(e.length<=2),2===e.length?n?(T(!0===e[1].allow_save),e[1]):(T(!1===e[0].allow_save),e[0]):e[0]}function se(e,n){if("PAY"!==e.session_type)return!0;const t=e.amount,a=n.min_amount??0,i=n.max_amount??Number.MAX_VALUE;return!(t<a||t>i)}function le(e){Object.defineProperty(e,h,{enumerable:!1,writable:!1,configurable:!1,value:e[h]})}const de={AFFIN_FPX:!0,AFFIN_FPX_BUSINESS:!0,AGRO_FPX:!0,AGRO_FPX_BUSINESS:!0,ALIPAY:!0,ALLIANCE_FPX:!0,ALLIANCE_FPX_BUSINESS:!0,AMBANK_FPX:!0,AMBANK_FPX_BUSINESS:!0,APPOTA:!0,ASTRAPAY:!0,BAY_CARD_INSTALLMENT:!0,BAY_GBW_DIRECT_DEBIT:!0,BAY_GBW_MOBILE_BANKING:!0,BBL_CARD_INSTALLMENT:!0,BBL_DIRECT_DEBIT:!0,BBL_GBW_DIRECT_DEBIT:!0,BBL_GBW_MOBILE_BANKING:!0,BBL_MOBILE_BANKING:!0,BDO_DIRECT_DEBIT:!0,BDO_EPAY:!0,BDO_ONLINE_BANKING:!0,BNP_FPX_BUSINESS:!0,BOC_FPX:!0,BOC_ONLINE_BANKING:!0,BPI_DIRECT_DEBIT:!0,BPI_ONLINE_BANKING:!0,BPI_RECURRING:!0,BRI_DIRECT_DEBIT:!0,BSN_FPX:!0,CARDS:!0,CHINABANK_DIRECT_DEBIT:!0,CHINABANK_ONLINE_BANKING:!0,CIMB_DIRECT_DEBIT:!0,CIMB_FPX:!0,CIMB_FPX_BUSINESS:!0,CITIBANK_FPX_BUSINESS:!0,DANA:!0,DEUTSCHE_FPX_BUSINESS:!0,DUITNOW_PAY:!0,GCASH:!0,GCASH_LINK_AND_PAY:!0,GOPAY:!0,GOPAY_RECURRING:!0,GRABPAY:!0,HLB_FPX:!0,HLB_FPX_BUSINESS:!0,HSBC_FPX:!0,HSBC_FPX_BUSINESS:!0,INSTAPAY_ONLINE_BANKING:!0,ISLAM_FPX:!0,ISLAM_FPX_BUSINESS:!0,JENIUSPAY:!0,KBANK_CARD_INSTALLMENT:!0,KBANK_GBW_MOBILE_BANKING:!0,KBANK_MOBILE_BANKING:!0,KFH_FPX:!0,KFH_FPX_BUSINESS:!0,KRUNGSRI_DIRECT_DEBIT:!0,KRUNGSRI_MOBILE_BANKING:!0,KTB_CARD_INSTALLMENT:!0,KTB_DIRECT_DEBIT:!0,KTB_GBW_DIRECT_DEBIT:!0,KTB_GBW_MOBILE_BANKING:!0,KTB_MOBILE_BANKING:!0,LANDBANK_ONLINE_BANKING:!0,LINEPAY:!0,LINKAJA:!0,MANDIRI_DIRECT_DEBIT:!0,MAYB2E_FPX:!0,MAYB2E_FPX_BUSINESS:!0,MAYB2U_FPX:!0,MAYBANK_ONLINE_BANKING:!0,METROBANK_ONLINE_BANKING:!0,MOMO:!0,MUAMALAT_FPX:!0,MUAMALAT_FPX_BUSINESS:!0,NEXCASH:!0,OCBC_FPX:!0,OCBC_FPX_BUSINESS:!0,OVO:!0,PAYMAYA:!0,PESONET_ONLINE_BANKING:!0,PNB_ONLINE_BANKING:!0,PROMPTPAY:!0,PSBANK_ONLINE_BANKING:!0,PUBLIC_FPX:!0,PUBLIC_FPX_BUSINESS:!0,QR_PH:!0,QRIS:!0,RAKYAT_FPX:!0,RAKYAT_FPX_BUSINESS:!0,RCBC_DIRECT_DEBIT:!0,RCBC_ONLINE_BANKING:!0,RHB_FPX:!0,RHB_FPX_BUSINESS:!0,ROBINSONS_BANK_ONLINE_BANKING:!0,SCB_CARD_INSTALLMENT:!0,SCB_DIRECT_DEBIT:!0,SCB_GBW_DIRECT_DEBIT:!0,SCB_GBW_MOBILE_BANKING:!0,SCB_MOBILE_BANKING:!0,SCH_FPX:!0,SCH_FPX_BUSINESS:!0,SECURITY_BANK_ONLINE_BANKING:!0,SGQR:!0,SHOPEEPAY:!0,TOUCHNGO:!0,TRUEMONEY:!0,TTB_CARD_INSTALLMENT:!0,UBP_DIRECT_DEBIT:!0,UBP_EADA:!0,UNIONBANK_ONLINE_BANKING:!0,UOB_FPX:!0,UOB_FPX_BUSINESS:!0,VIETTELPAY:!0,VNPTWALLET:!0,WECHATPAY:!0,ZALOPAY:!0};function ce(e,n){for(const t of e)if(t.type.name===n)return!0;return!1}var ue,he;!function(e){e.BARE="bare",e.PRIMARY_ROUNDED="primary-rounded",e.WHITE_ROUNDED="white-rounded"}(ue||(ue={})),function(e){e.SM="sm",e.MD="md"}(he||(he={}));const pe=e=>{const{children:t,variant:i,size:r,type:o="button",...s}=e,l={[ue.BARE]:void 0,[ue.PRIMARY_ROUNDED]:"xendit-button-primary-rounded",[ue.WHITE_ROUNDED]:"xendit-button-white-rounded"}[i],d={[he.SM]:"xendit-button-sm",[he.MD]:void 0}[r??he.MD];return n.jsx("button",{...s,className:a(e.className,"xendit-button",l,d),type:o,children:t})},me=()=>{const e=.4*Math.PI,t=.4,a=Math.cos(e)*t,i=Math.sin(e)*t,r=Math.cos(0)*t,o=Math.sin(0)*t;return n.jsx("svg",{className:"xendit-button-loading-spinner",viewBox:"-0.5 -0.5 1 1",children:n.jsx("path",{d:`M ${a} ${i} A 0.4 0.4 0 0 0 ${r} ${o}`,fill:"none",stroke:"currentColor",strokeWidth:"0.1",strokeLinecap:"round"})})},_e=e=>{const{id:a,options:i,onChange:r,defaultIndex:o=-1,selectedIndex:s,placeholder:l,disabled:d,className:c,fixedOverlayWidth:u,enableSearch:h}=e,p=S().t,_=Q(),f=a||_,x="number"==typeof s,[b,y]=t.useState(o),g=x?s:b,[v,C]=t.useState(g>=0?g:0),[k,E]=t.useState(!1),w=k&&!d&&i.length>0,[N,A]=t.useState(""),[I,P]=t.useState(0),R=t.useRef(null),T=t.useRef(null),j=t.useRef(null),D=t.useRef(null),q=t.useRef(null),L=t.useRef(null),B=t.useMemo(()=>{const e=i.map(ye).filter(({item:e})=>{if(""===N.trim())return!0;const n=N.toLowerCase();return e.title.toLowerCase().includes(n)||e.description?.toLowerCase().includes(n)||e.value.toLowerCase().includes(n)});return e.length>0?e:i.map(ye)},[N,i]),M=Math.max(0,Math.min(B.length-1,v));t.useLayoutEffect(()=>{if(u)return void P(u);const e=R.current;if(!e)return;const n=e.getBoundingClientRect().width;if(P(n),!window.ResizeObserver)return;const t=new ResizeObserver(n=>{for(const t of n)t.target===e&&t.borderBoxSize?.length&&P(t.borderBoxSize[0].inlineSize)});return t.observe(e),()=>t.disconnect()},[u]),t.useLayoutEffect(()=>{if(!w)return;const e=L.current;if(!e)return;const n=R.current;if(!n)return;if(!window.ResizeObserver)return;function t(){if(!e)return;if(!n)return;const t=n.getBoundingClientRect(),a=e.getBoundingClientRect();window.innerHeight-t.bottom<a.height?(e.style.position="fixed",e.style.bottom="0"):(e.style.position="",e.style.bottom="")}t();const a=new ResizeObserver(t);return a.observe(e),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{a.disconnect(),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[w]),t.useLayoutEffect(()=>{if(!w)return;const e=e=>{const n=T.current;n&&(n.contains(e.target)||E(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[w]),t.useLayoutEffect(()=>{if(!w)return;const e=e=>{const n=T.current;n&&e.relatedTarget&&(n.contains(e.relatedTarget)||E(!1))};return document.body.addEventListener("focusout",e),()=>document.body.removeEventListener("focusout",e)},[w]),t.useLayoutEffect(()=>{w&&g>=0&&C(g)},[w,g]),t.useLayoutEffect(()=>{if(!w)return;if(!D.current)return;if(!j.current)return;const e=j.current.parentElement;e&&(e.scrollTop=D.current.offsetTop-e.clientHeight/2+D.current.clientHeight/2)},[w,v]);const O=t.useCallback(()=>{w||(E(!0),queueMicrotask(()=>q.current?.focus()))},[w]),U=t.useCallback(()=>{w&&(E(!1),A(""),R.current?.focus())},[w]),K=t.useCallback(()=>{w?U():O()},[U,w,O]),F=t.useCallback(e=>{const n=i[e];n&&(n.disabled||(x||y(e),r(n,e),U()))},[U,x,r,i]),V=t.useCallback(e=>{const n=e.target===q.current;if("Escape"===e.key)return e.preventDefault(),void U();if("Enter"===e.key||" "===e.key){if(n&&" "===e.key)return;e.preventDefault();const t=B[M];return void(t&&F(t.originalIndex))}return"ArrowDown"===e.key?(e.preventDefault(),void C(e=>Math.min(B.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),void C(e=>Math.max(0,e-1))):"Home"===e.key?(e.preventDefault(),void C(0)):"End"===e.key?(e.preventDefault(),void C(B.length-1)):void 0},[M,U,F,B]),W=t.useCallback(e=>{if(w)return V(e);"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),O())},[V,w,O]),X=t.useCallback(e=>{e.stopPropagation(),e.preventDefault(),F(Number(e.currentTarget.dataset.index))},[F]),G=t.useCallback(e=>{A(e.currentTarget.value),C(0)},[]),z=g>=0?i[g]:void 0;return n.jsxs("div",{className:"xendit-dropdown-container",ref:T,style:{"--xendit-dropdown-width":I+"px",minWidth:e.noOverflow?void 0:"0"},children:[n.jsxs("button",{id:f,ref:R,type:"button",className:`xendit-dropdown ${c} ${w?"xendit-dropdown-open":""} ${xe(z)?"xendit-dropdown-has-asset":""}`,"aria-expanded":w?"true":"false",onClick:K,onKeyDown:W,disabled:d,children:[z?.leadingAsset??null,z?n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:z.shortTitle??z.title}):n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:l}),n.jsx(m,{className:"xendit-dropdown-chevron",name:"chevron",size:16,direction:"down"})]}),w?n.jsxs("div",{className:"xendit-dropdown-overlay",style:{width:"var(--xendit-dropdown-width)"},ref:L,children:[h?n.jsx("div",{className:"xendit-dropdown-search",children:n.jsx("input",{ref:q,placeholder:p("combobox.default_search_placeholder"),value:N,onInput:G,onClick:be,onKeyDown:V})}):null,n.jsx("ul",{ref:j,role:"listbox",tabIndex:-1,onKeyDown:V,children:B.map(({item:e,originalIndex:t},a)=>{const i=t===g,r=a===M;return n.jsx("li",{role:"option","data-index":t,"aria-disabled":!!e.disabled||void 0,"aria-selected":i,onClick:X,ref:r?D:void 0,children:n.jsxs("div",{className:`xendit-dropdown-item xendit-text-14 ${r?"xendit-dropdown-item-active":""} ${e.leadingAsset?"xendit-dropdown-has-asset":""} ${e.disabled?"xendit-dropdown-item-disabled":""}`,children:[e.leadingAssetInOverlay??e.leadingAsset??null,n.jsxs("div",{className:"xendit-dropdown-item-text xendit-text-14",children:[n.jsx("span",{className:"xendit-dropdown-item-title",children:e.title}),e.description&&n.jsx("span",{className:"xendit-dropdown-item-description xendit-text-12",children:e.description})]}),i?n.jsx(m,{name:"check",size:16,className:"xendit-dropdown-item-selected"}):null]})},t)})})]}):null]})},fe=e=>n.jsx("div",{className:"xendit-dropdown-container xendit-skeleton-field",children:n.jsx("button",{className:`xendit-dropdown ${e.className}`,inert:!0,id:e.id,disabled:!0,type:"button",children:n.jsx(me,{})})});function xe(e){return!!e&&!(!e.leadingAssetInOverlay&&!e.leadingAsset)}function be(e){e.stopPropagation()}function ye(e,n){return{item:e,originalIndex:n}}function ge(e){return function(e,n){if(e===n)throw new Error("Assertion failed; this is a bug, please contact support.")}(e.session_type,"AUTHORIZATION"),q(e.mode,"COMPONENTS"),ee({id:e.payment_session_id,description:e.description||void 0,sessionType:e.session_type,mode:e.mode,referenceId:e.reference_id,country:e.country,currency:e.currency,amount:e.amount,channelProperties:e.channel_properties||void 0,expiresAt:new Date(e.expires_at),locale:e.locale,status:e.status,subscription:e.subscription?{immediatePayment:e.subscription.immediate_payment,schedule:{anchorDate:new Date(e.subscription.schedule.anchor_date),interval:e.subscription.schedule.interval,intervalCount:e.subscription.schedule.interval_count,retryInterval:e.subscription.schedule.retry_interval,retryIntervalCount:e.subscription.schedule.retry_interval_count,totalRecurrence:e.subscription.schedule.total_recurrence,totalRetry:e.subscription.schedule.total_retry}}:void 0,items:e.items?.map(e=>ee({type:e.type,referenceId:e.reference_id,name:e.name,netUnitAmount:e.net_unit_amount,quantity:e.quantity,url:e.url,imageUrl:e.image_url,category:e.category,subcategory:e.subcategory,description:e.description,metadata:e.metadata}))})}function ve(e,n,t,a){const i=ee({groupId:e.id,label:e.label,get channels(){return(n[e.id]||[]).map(e=>ke(e,n,t,a))},[h]:e});return le(i),i}function Ce(e,n){return ke(e,{},{},n)}function ke(e,n,t,a){T(!a.pairChannels.paired[e.channel_code]);const i=ee({channelCode:a.pairChannels.pairs[e.channel_code]?.map(e=>e.channel_code)??e.channel_code,brandName:e.brand_name,brandColor:e.brand_color,brandLogoUrl:e.brand_logo_url,get uiGroup(){if(!t[e.ui_group])throw new Error("UI group not found");return ve(t[e.ui_group],n,t,a)},minAmount:e.min_amount,maxAmount:e.max_amount,cardBrands:e.card?.brands.map(e=>({name:e.name,logoUrl:e.logo_url})),[h]:a.pairChannels.pairs[e.channel_code]??[e]});return le(i),i}function Ee(e){const n={};for(const t of e)n[t.id]=t;return n}function we(e,n){if(n.pairChannels.paired[e.channel_code])return!1;if(n.options.filterMinMax&&!se(n.session,e))return!1;const t=n.options.filter;return!(t&&!function(e,n){if("string"==typeof e&&n===e)return!0;if(Array.isArray(e)&&e.includes(n))return!0;if(e instanceof RegExp&&e.test(n))return!0;return!1}(t,e.channel_code))}function Ne(e,n){const t={};for(const a of e){if(!we(a,n))continue;const e=a.ui_group;t[e]||(t[e]=[]),t[e].push(a)}return t}function Ae(e){const n=new Map;for(const t of e){const e=t.brand_name;n.has(e)||n.set(e,[]),n.get(e).push(t)}const t={},a={};for(const[e,i]of n)for(const e of i){if(!1===i[0].allow_save){const n=i.find(n=>e.channel_code!==n.channel_code&&e.ui_group===n.ui_group&&!0===n.allow_save);n&&(t[e.channel_code]=[e,n],a[n.channel_code]=!0)}}return{pairs:t,paired:a}}const Se=e=>n.jsx("hr",{className:"xendit-dotted-line"}),Ie=e=>{const{group:a,open:i}=e,r=S(),{t:o}=r,s=w(),l=N(),d=I(),c=s.session_type,u=Q(),[h,p]=t.useState(null),m=t.useRef(null),[_,f]=t.useState(!1),x=t.useRef(null),b=t.useMemo(()=>Ae(l),[l]),y=t.useMemo(()=>({pairChannels:b,session:{amount:s.amount,session_type:s.session_type},options:{filterMinMax:!1}}),[b,s.amount,s.session_type]),g=t.useMemo(()=>l.filter(e=>we(e,y)&&e.ui_group===a.id),[l,a.id,y]);t.useLayoutEffect(()=>{if(!m.current)return;if(!d)return;if(!i)return;g.find(e=>e.channel_code===d.channel_code)&&(x.current=r.createChannelComponent(Ce(d,y)),x.current.parentElement!==m.current&&(f(!0),m.current.replaceChildren(x.current)))},[g,d,y,i,r]);const v=X(i);t.useLayoutEffect(()=>{if(i&&!v&&null===d&&null!==h){const e=g.find(e=>e.channel_code===h);e&&r.setCurrentChannel(Ce(e,y))}},[g,d,h,y,i,v,r]);const C=t.useCallback(e=>{const n=l.find(n=>n.channel_code===e.value)||null;p(n?.channel_code??null),r.setCurrentChannel(n?Ce(n,y):null)},[l,y,r]),k=t.useMemo(()=>g.map(e=>({leadingAsset:n.jsx("img",{className:"xendit-dropdown-channel-logo",src:e.brand_logo_url},e.channel_code),leadingAssetInOverlay:n.jsx("img",{className:"xendit-channel-logo",src:e.brand_logo_url},e.channel_code),title:e.brand_name,value:e.channel_code,disabled:!se(s,e),description:Pe(o,s,e)||void 0})),[g,s,o]),E=1===g.length&&"CARDS"===g[0].channel_code;return n.jsxs("div",{className:"xendit-channel-picker-group",children:[E?null:n.jsxs("div",{className:"xendit-channel-form-field-group",children:[n.jsx("label",{htmlFor:u,className:"xendit-text-14",children:"SAVE"===c?o("payment_methods.add_payment_method",{groupName:a.label??"",ns:"session"}):o("payment_methods.pay_with")}),n.jsx(_e,{id:u,selectedIndex:function(){const e=k.findIndex(e=>e.value===d?.channel_code);if(-1!==e)return e;const n=k.findIndex(e=>e.value===h);return-1!==n?n:1===k.length?0:-1}(),options:k,disabled:k.length<=1,onChange:C,placeholder:o("payment_methods.select_channel_placeholder",{groupName:a.label,ns:"session"})})]}),!E&&_?n.jsx(Se,{}):null,n.jsx("div",{style:{display:_?"":"none"},ref:m})]})};function Pe(e,n,t){return se(n,t)?null:t.min_amount&&n.amount<t.min_amount?e("payment_methods.channel_disabled_amount_too_small"):e("payment_methods.channel_disabled_amount_too_large")}const Re=e=>{const{onReady:a,options:i}=e,r=S(),o=r.t,s=w(),l=(()=>{const e=t.useContext(b);if(null===e)throw new Error("useBusiness must be used within a XenditSessionProvider");return e})(),d=N(),c=A(),u=c?.google_pay;T(u);const h=t.useRef(!1),p=t.useRef(null),m=t.useRef(null),_=t.useMemo(()=>u.allowed_payment_methods.filter(e=>{const n=d.find(n=>n.channel_code===e.channel_code);if(!n)throw new Error("Channel found in Google Pay config not found in channels list");return se(s,n)}).map(e=>e.payment_method_specification),[u.allowed_payment_methods]),f=t.useMemo(()=>({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:_,emailRequired:!0,merchantInfo:{merchantId:u.merchant_id,merchantName:l.name??""},transactionInfo:{transactionId:s.payment_session_id,totalPriceStatus:"FINAL",totalPrice:String(s.amount),currencyCode:s.currency}}),[l.name,u.merchant_id,_,s.amount,s.currency,s.payment_session_id]),x=t.useMemo(()=>({buttonColor:"default",buttonType:"plain",buttonRadius:999,buttonSizeMode:"fill",buttonBorderType:"no_border",...i}),[i]);t.useLayoutEffect(()=>{const e=window.google?.payments?.api?.PaymentsClient;if(!e)return void console.error("XenditComponents: Google Pay button was requested but the Google Pay SDK is not loaded.");const n=r.isMock()||r.isDevelopmentEnv();m.current=new e({environment:n?"TEST":"PRODUCTION"})},[r]);const y=t.useCallback(()=>{T(m.current),m.current.loadPaymentData(f).then(function(e){const n=function(e){T(u);const n=r.getActiveChannels();for(const t of u.allowed_payment_methods)if(t.payment_method_specification.type===e.paymentMethodData.type)return Te(n,t.channel_code);throw new Error(`No matching channel found for selected Google Pay payment method ${e.paymentMethodData.type}`)}(e);T(n);let t={};"CARDS"===n.channelCode&&(t={google_pay:JSON.stringify(e)}),r.submitDigitalWallet("GOOGLE_PAY",n,t)}).catch(function(e){const n=e.statusCode??"UNKNOWN_ERROR";if("CANCELED"===n)return;function t(e,n){return`google_pay_errors.${e.toLowerCase()}.${n}`}const a={code:`GOOGLE_PAY_${n}`,text:[o(t(n,"title"),o("google_pay_errors.unknown_error.title")),o(t(n,"message"),o("google_pay_errors.unknown_error.message",{statusCode:n}))]},i=u.allowed_payment_methods[0];T(i);const s=Te(r.getActiveChannels(),i.channel_code);r.submitDigitalWallet("GOOGLE_PAY",s,{},a)})},[u,f,r,o]);return t.useLayoutEffect(()=>{m.current&&(h.current||0!==_.length&&m.current.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:_}).then(function(e){e.result&&(h.current||(h.current=!0,a()))}).catch(function(e){console.error("XenditComponents: Error when checking if Google Pay is ready",e)}))},[_,a]),t.useLayoutEffect(()=>{if(!m.current)return;if(0===_.length)return;const e=m.current.createButton({...x,buttonLocale:s.locale,allowedPaymentMethods:_,onClick:y});p.current&&p.current.replaceChildren(e)},[x,_,y,s.locale]),n.jsx("div",{ref:p})};function Te(e,n){const t=e.find(e=>Array.isArray(e.channelCode)?e.channelCode.includes(n):e.channelCode===n);if(!t)throw new Error(`Channel not found for code: ${n}`);return t}const je=e=>{const{scriptTagRegex:n,checkLoaded:a,children:i}=e,[,r]=t.useState({}),o=a();return t.useLayoutEffect(()=>{if(o)return;const e=Array.from(document.scripts).find(e=>n.test(e.src));if(e){const n=()=>{r({})};return e.addEventListener("load",n),()=>{e.removeEventListener("load",n)}}},[r,o,n]),t.useLayoutEffect(()=>{if(!o){const e=setTimeout(()=>{r({})},1e3);return()=>clearTimeout(e)}}),o?i:null},De=e=>{const{digitalWalletCode:a,digitalWalletOptions:i}=e,r=t.useRef(null),o=t.useCallback(()=>{r.current&&(r.current.parentElement?.style.setProperty("display","block"),r.current.dispatchEvent(new InternalDigitalWalletReady(a)))},[a]);let s=null;if("GOOGLE_PAY"===a)s=n.jsx(je,{scriptTagRegex:qe.GOOGLE_PAY.scriptTagRegex,checkLoaded:qe.GOOGLE_PAY.checkLoaded,children:n.jsx(Re,{onReady:o,options:i})});return n.jsx("div",{ref:r,children:s})},qe={GOOGLE_PAY:{scriptTagRegex:/https:\/\/pay.google.com\/.*\/js\/pay.js/,checkLoaded:()=>"undefined"!=typeof google&&void 0!==google.payments}};class InternalDigitalWalletReady extends Event{digitalWalletCode;static type="xendit-internal-digital-wallet-ready";constructor(e){super(InternalDigitalWalletReady.type,{bubbles:!0}),this.digitalWalletCode=e}}const Le=e=>{const a=S(),i=t.useRef(null),r=A(),o=r?.google_pay,[s,l]=t.useState(!1);return t.useLayoutEffect(()=>{if(i.current&&o){const e=a.createDigitalWalletComponent("GOOGLE_PAY");return i.current.appendChild(e),()=>{e.remove()}}},[o,a]),t.useLayoutEffect(()=>{i.current&&i.current.addEventListener(InternalDigitalWalletReady.type,e=>{l(!0)})},[]),n.jsx("div",{ref:i,className:s?"xendit-channel-picker-digital-wallet-section":void 0})},Be=e=>{const a=S(),i=w(),r=(()=>{const e=t.useContext(v);if(null===e)throw new Error("useChannelUiGroups must be used within a XenditSessionProvider");return e})(),o=I(),s=N(),{t:l}=S(),d=t.useMemo(()=>Ne(s,{options:{filterMinMax:!1},pairChannels:Ae(s),session:i}),[s,i]),c=t.useRef(null),u=t.useMemo(()=>Ae(s),[s]),m=t.useMemo(()=>({pairChannels:u,session:{amount:i.amount,session_type:i.session_type},options:{filterMinMax:!1}}),[u,i.amount,i.session_type]),_=o?.ui_group??null,[x,b]=t.useState(null),y=t.useCallback(e=>{if(_===e||x===e)_===e&&c.current?.dispatchEvent(new XenditClearCurrentChannelEvent(e)),x===e&&b(null);else{const n=r.find(n=>n.id===e);T(n);const t=Me(i,n,s,l).enabledChannels;if(0===t)return;if(1===t){const n=d[e][0];a.setCurrentChannel(Ce(n,m)),b(null)}else b(e),a.setCurrentChannel(null)}},[r,s,d,m,x,a,_,i,l]);t.useLayoutEffect(()=>{null!==o&&null!==x&&b(null)},[o,x]);const g=a[h].options.enableDigitalWallets??!1;return n.jsxs("div",{ref:c,children:[g?n.jsx(Le,{}):null,n.jsx(p,{children:r.filter(e=>(d[e.id]||[]).length>0).map(e=>{const t=null!==_?_===e.id:x===e.id,a=Me(i,e,s,l),r=0===a.enabledChannels,c=a.firstDisabledChannelReason;return n.jsx(f,{id:e.id,title:e.label,iconName:Ue(_===e.id?o:null,d[e.id]),subtitle:c??void 0,open:t,disabled:r,onClick:y,children:n.jsx(Ie,{group:e,open:t})},e.id)})})]})};function Me(e,n,t,a){let i=null,r=0;for(const o of t)o.ui_group===n.id&&(se(e,o)?r++:null===i&&(i=Pe(a,e,o)));return{enabledChannels:r,firstDisabledChannelReason:i}}const Oe={CARDS:"card",QR_CODE:"qr",OVER_THE_COUNTER:"otc",EWALLET:"ewallet",BANK_TRANSFER:"bank_transfer",DIRECT_DEBIT:"bank_transfer",VIRTUAL_ACCOUNT:"bank_transfer",ONLINE_BANKING:"online_banking"};function Ue(e,n){if(e&&e.pm_type&&Oe[e.pm_type])return Oe[e.pm_type];for(const e of n)if(e.pm_type&&Oe[e.pm_type])return Oe[e.pm_type];return"dummy"}class XenditClearCurrentChannelEvent extends Event{static type="xendit-clear-current-channel";uiGroup;constructor(e){super(XenditClearCurrentChannelEvent.type,{bubbles:!0,composed:!0}),this.uiGroup=e}}const Ke=({countryCode:e,size:t=16})=>n.jsx("div",{style:{width:`${t}px`,height:`${t}px`,borderRadius:"50%",backgroundImage:`url(https://assets.xendit.co/payment-session/flags/circle/${e.toLowerCase()}.svg)`,backgroundSize:"cover",backgroundPosition:"center"}}),Fe=e=>{const{field:a,onChange:i}=e,r=H(a),o=G(a),[s,l]=t.useState(a.initial_value),d=Ve.findIndex(e=>e.value===s),c=t.useRef(null);We(e=>{if(c.current){const n=Ve.find(n=>n.value===e);n&&u(n)}});const u=t.useCallback(e=>{l(e.value),c.current&&(c.current.value=e.value),i()},[i]);return t.useLayoutEffect(()=>{a.initial_value&&(c.current&&(c.current.value=s||""),i())},[]),n.jsxs("div",{children:[n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:c}),n.jsx(_e,{id:r,options:Ve,onChange:u,placeholder:a.placeholder,selectedIndex:d,enableSearch:!0,className:"xendit-form-field-inner"})]})},Ve=i.getCountries().map(e=>({title:new Intl.DisplayNames(["en"],{type:"region"}).of(e),value:e,leadingAsset:n.jsx(Ke,{countryCode:e})})).sort((e,n)=>e.title.localeCompare(n.title));function We(e){const n=dt()?.cardDetails,a=n?.details?.country_codes[0],i=X(a);t.useLayoutEffect(()=>{a&&a!==i&&e(a)})}const Xe=e=>{const{field:a,onChange:i}=e,r=H(a),o=G(a);if(!function(e){return"dropdown"===e.type.name}(a))throw new Error("DropdownField expects field.type.name to be 'dropdown'");const s=t.useRef(null),l=t.useMemo(()=>a.type.options.map(e=>({title:e.label,description:e.subtitle,value:e.value,leadingAsset:e.icon_url?n.jsx("img",{style:{height:"16px",width:"16px",objectFit:"contain"},src:e.icon_url}):null})),[a.type.options]),[d,c]=t.useState(a.initial_value??""),u=t.useCallback(e=>{s.current&&(s.current.value=e.value),c(e.value),i()},[i]),h=l.findIndex(e=>e.value===d);return t.useLayoutEffect(()=>{a.initial_value&&u(l[h])},[]),n.jsxs(n.Fragment,{children:[n.jsx(_e,{id:r,placeholder:a.placeholder,options:l,onChange:u,selectedIndex:h,className:"xendit-form-field-inner"}),n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:s})]})};const Ge="undefined"!=typeof window&&window.HTMLElement?window.HTMLElement:EventTarget;class XenditFormAssociatedFocusTrap extends Ge{static tag="xendit-form-associated-focus-trap";static formAssociated=!0;internals;constructor(){super(),this.internals=this.attachInternals()}}var ze;ze=XenditFormAssociatedFocusTrap,"undefined"!=typeof window&&window.customElements&&customElements.define(ze.tag,ze);class InternalUpdateWorldState extends Event{data;static type="xendit-update-world-state";constructor(e){super(InternalUpdateWorldState.type,{bubbles:!1}),this.data=e}}class InternalUpdateChannelComponentData extends Event{channelCode;data;static type="xendit-update-channel-component-data";constructor(e,n){super(InternalUpdateChannelComponentData.type,{bubbles:!1}),this.channelCode=e,this.data=n}}class InternalSetFieldTouchedEvent extends Event{static type="xendit-internal-set-field-touched";constructor(){super(InternalSetFieldTouchedEvent.type,{bubbles:!0})}}class InternalBehaviorTreeUpdateEvent extends Event{static type="xendit-internal-behavior-tree-update";constructor(){super(InternalBehaviorTreeUpdateEvent.type,{})}}class InternalNeedsRerenderEvent extends Event{static type="xendit-internal-needs-rerender";constructor(){super(InternalNeedsRerenderEvent.type,{})}}class InternalScheduleMockUpdateEvent extends Event{mockData;static type="xendit-internal-schedule-mock-update";constructor(e){super(InternalScheduleMockUpdateEvent.type,{}),this.mockData=e}}const He=e.createContext(null);T("https://assets.xendit.co/components/secure-iframe-v0.0.23.html");const $e=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.23.html").origin,Ye=({children:e})=>{const a=t.useRef(new Map),i={registerIframe:(e,n)=>{n.current&&a.current.set(e,n.current)},unregisterIframe:e=>a.current.delete(e),postMessageToIframe:(e,n)=>{const t=a.current.get(e);t?.contentWindow&&t.contentWindow.postMessage(n,$e)}};return n.jsx(He.Provider,{value:i,children:e})};T("https://assets.xendit.co/components/secure-iframe-v0.0.23.html");const Qe=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.23.html"),Ze=Qe.toString(),Je=Qe.origin,en=e=>{const{field:a,onChange:i}=e,r=S(),o=H(a),s=G(a),l=w(),d=t.useRef(null),c=t.useRef(null),[u,p]=t.useState(),[m,_]=t.useState(!1),{card:f}=st()??{},x=dt(),b=x?.cardDetails?.details?.schemes,y=b?.find(e=>f?.brands?.some(n=>n.name===e))??null,g=t.useCallback(e=>{if(!d.current)return;const n=d.current.contentWindow;if(e.source!==n)return;if(e.origin!==Je)return;const t=e.data;switch(t.type){case"xendit-iframe-ready":p(t.ecdhPublicKey);break;case"xendit-iframe-change":{if(!c.current)return;const e=t.encrypted,n=1,a=e.map(e=>{if(t.empty)return"";const a=["xendit-encrypted",n,u,e.iv,e.value];return!t.valid&&t.validationErrorCodes.length&&a.push("invalid",btoa(t.validationErrorCodes[0].localeKey)),a.join("-")});if(0===a.length)break;c.current.value=a.length>1?JSON.stringify(a):a[0],i?.();break}case"xendit-iframe-focus":_(!0);break;case"xendit-iframe-blur":_(!1),c.current?.value&&c.current?.dispatchEvent(new InternalSetFieldTouchedEvent);break;case"xendit-iframe-failed-init":console.error(`Iframe field for ${a.channel_property} failed to initialize securely`)}},[a.channel_property,u,i]),v=t.useCallback(()=>{d.current?.contentWindow&&d.current.contentWindow.postMessage({type:"xendit-iframe-focus"},Je)},[]);t.useLayoutEffect(()=>(window.addEventListener("message",g),()=>{window.removeEventListener("message",g)}),[g]);const C=t.useContext(He);t.useLayoutEffect(()=>(C?.registerIframe(s,d),()=>C?.unregisterIframe(s)),[s,C]);const k=new URL(Ze);k.searchParams.set("input_type",a.type.name),k.searchParams.set("embedder",window.location.origin),k.searchParams.set("session_id",l.payment_session_id),k.searchParams.set("pk",r[h].sdkKey.publicKey),k.searchParams.set("sig",r[h].sdkKey.signature),r[h].options.iframeFieldAppearance&&k.searchParams.set("appearance",JSON.stringify(r[h].options.iframeFieldAppearance));const E=m?"xendit-field-focus":"";return n.jsxs("div",{className:`xendit-iframe-container xendit-form-field-inner ${E}`,children:[n.jsx(XenditFormAssociatedFocusTrap.tag,{id:o,onFocus:v,tabIndex:-1}),n.jsx("input",{type:"hidden",name:s,defaultValue:"",ref:c}),n.jsx("iframe",{src:k.toString(),ref:d,sandbox:"allow-scripts allow-same-origin"}),"credit_card_number"===a.type.name&&f&&n.jsx(nn,{cardsBrandList:f.brands,selectedCardBrand:y})]})},nn=({cardsBrandList:e,selectedCardBrand:t})=>{if(!e)return null;const a=e.find(e=>e.name===t)?.logo_url;return n.jsx("div",{className:"xendit-card-brands-list",children:t?a&&n.jsx("img",{className:"xendit-card-brand-logo",src:a,alt:t}):e.map(({name:e,logo_url:t})=>n.jsx("img",{className:"xendit-card-brand-logo",src:t,alt:e},e))})},tn=e=>{const{field:a,onChange:s}=e,l=H(a),d=G(a),c=w(),u=t.useRef(null),h=t.useMemo(()=>function(e,n){const t={country:n,localNumber:""};if(!e)return t;const a=i(e);if(!a)return t;const o=an.find(e=>e.value===a.country);if(!o)return t;if(!rn(o,a.nationalNumber))return t;const s=a.formatInternational(),l=r.getCountryCallingCode(o.value);return{country:o.value,localNumber:s.replace(`+${l} `,"")}}(a.initial_value,c.country),[a.initial_value,c.country]),[p,m]=t.useState(h.country),_=t.useMemo(()=>{const e=an.findIndex(e=>e.value===p);return-1===e?0:e},[p]),f=an[_],[x,b]=t.useState(h.localNumber),y=t.useRef(null),g=t.useCallback((e,n)=>{const t=rn(e,n);return t?t.number:`+${e.dial}${n}`},[]),v=t.useCallback((e,n)=>{u.current&&(u.current.value=g(e,n))},[g]);function C(e){const n=e;m(n.value),v(n,x),s()}return We(e=>{const n=an.find(n=>n.value===e);n&&n.value!==p&&!x&&C(n)}),t.useLayoutEffect(()=>{a.initial_value&&(u.current&&(u.current.value=a.initial_value),s())},[]),n.jsxs("div",{className:"xendit-input-phone",children:[n.jsx(_e,{options:an,selectedIndex:_,onChange:C,fixedOverlayWidth:300,enableSearch:!0,noOverflow:!0,className:"xendit-form-field-inner"}),n.jsx("input",{id:l,ref:y,type:"tel",inputMode:"tel",placeholder:i.getExampleNumber(f.value,o)?.formatInternational()?.replace(`+${r.getCountryCallingCode(f.value)} `,"")||"",className:"xendit-text-14 xendit-form-field-inner xendit-phone-number-input",onBlur:function(e){!function(e=f,n=x){const t=rn(e,n);if(t){const n=t.formatInternational();b(n.replace(`+${r.getCountryCallingCode(e.value)} `,""))}}(),e.currentTarget?.value&&u.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){const n=e.target.value;b(n),v(f,n),s()},value:x,autoComplete:"tel"}),n.jsx("input",{type:"hidden",name:d,ref:u})]})},an=Ve.map(e=>{const n=r.getCountryCallingCode(e.value);return n?{...e,shortTitle:`+${n}`,title:`${e.title} (+${n})`,dial:n}:null}).filter(e=>Boolean(e)),rn=(e,n)=>{const t=i(n,e.value);return t&&t.isPossible()?t:null};function on(e){return{title:e.name,value:e.value}}const sn=[{name:"Alabama",value:"AL"},{name:"Alaska",value:"AK"},{name:"American Samoa",value:"AS"},{name:"Arizona",value:"AZ"},{name:"Arkansas",value:"AR"},{name:"California",value:"CA"},{name:"Colorado",value:"CO"},{name:"Connecticut",value:"CT"},{name:"Delaware",value:"DE"},{name:"District Of Columbia",value:"DC"},{name:"Federated States Of Micronesia",value:"FM"},{name:"Florida",value:"FL"},{name:"Georgia",value:"GA"},{name:"Guam",value:"GU"},{name:"Hawaii",value:"HI"},{name:"Idaho",value:"ID"},{name:"Illinois",value:"IL"},{name:"Indiana",value:"IN"},{name:"Iowa",value:"IA"},{name:"Kansas",value:"KS"},{name:"Kentucky",value:"KY"},{name:"Louisiana",value:"LA"},{name:"Maine",value:"ME"},{name:"Marshall Islands",value:"MH"},{name:"Maryland",value:"MD"},{name:"Massachusetts",value:"MA"},{name:"Michigan",value:"MI"},{name:"Minnesota",value:"MN"},{name:"Mississippi",value:"MS"},{name:"Missouri",value:"MO"},{name:"Montana",value:"MT"},{name:"Nebraska",value:"NE"},{name:"Nevada",value:"NV"},{name:"New Hampshire",value:"NH"},{name:"New Jersey",value:"NJ"},{name:"New Mexico",value:"NM"},{name:"New York",value:"NY"},{name:"North Carolina",value:"NC"},{name:"North Dakota",value:"ND"},{name:"Northern Mariana Islands",value:"MP"},{name:"Ohio",value:"OH"},{name:"Oklahoma",value:"OK"},{name:"Oregon",value:"OR"},{name:"Palau",value:"PW"},{name:"Pennsylvania",value:"PA"},{name:"Puerto Rico",value:"PR"},{name:"Rhode Island",value:"RI"},{name:"South Carolina",value:"SC"},{name:"South Dakota",value:"SD"},{name:"Tennessee",value:"TN"},{name:"Texas",value:"TX"},{name:"Utah",value:"UT"},{name:"Vermont",value:"VT"},{name:"Virgin Islands",value:"VI"},{name:"Virginia",value:"VA"},{name:"Washington",value:"WA"},{name:"West Virginia",value:"WV"},{name:"Wisconsin",value:"WI"},{name:"Wyoming",value:"WY"}].map(on),ln=[{name:"Alberta",value:"AB"},{name:"British Columbia",value:"BC"},{name:"Manitoba",value:"MB"},{name:"New Brunswick",value:"NB"},{name:"Newfoundland and Labrador",value:"NL"},{name:"Northwest Territories",value:"NT"},{name:"Nova Scotia",value:"NS"},{name:"Nunavut",value:"NU"},{name:"Ontario",value:"ON"},{name:"Prince Edward Island",value:"PE"},{name:"Quebec",value:"QC"},{name:"Saskatchewan",value:"SK"},{name:"Yukon Territory",value:"YT"}].map(on),dn=[{name:"Avon"},{name:"Bedfordshire"},{name:"Berkshire"},{name:"Buckinghamshire"},{name:"Cambridgeshire"},{name:"Cheshire"},{name:"Cleveland"},{name:"Cornwall"},{name:"Cumbria"},{name:"Derbyshire"},{name:"Devon"},{name:"Dorset"},{name:"Durham"},{name:"East Sussex"},{name:"Essex"},{name:"Gloucestershire"},{name:"Hampshire"},{name:"Herefordshire"},{name:"Hertfordshire"},{name:"Isle of Wight"},{name:"Kent"},{name:"Lancashire"},{name:"Leicestershire"},{name:"Lincolnshire"},{name:"London"},{name:"Merseyside"},{name:"Norfolk"},{name:"Northamptonshire"},{name:"Northumberland"},{name:"North Yorkshire"},{name:"Nottinghamshire"},{name:"Oxfordshire"},{name:"Rutland"},{name:"Shropshire"},{name:"Somerset"},{name:"South Yorkshire"},{name:"Staffordshire"},{name:"Suffolk"},{name:"Surrey"},{name:"Tyne and Wear"},{name:"Warwickshire"},{name:"West Midlands"},{name:"West Sussex"},{name:"West Yorkshire"},{name:"Wiltshire"},{name:"Worcestershire"},{name:"Clwyd"},{name:"Dyfed"},{name:"Gwent"},{name:"Gwynedd"},{name:"Mid Glamorgan"},{name:"Powys"},{name:"South Glamorgan"},{name:"West Glamorgan"},{name:"Aberdeenshire"},{name:"Angus"},{name:"Argyll"},{name:"Ayrshire"},{name:"Banffshire"},{name:"Berwickshire"},{name:"Bute"},{name:"Caithness"},{name:"Clackmannanshire"},{name:"Dumfriesshire"},{name:"Dunbartonshire"},{name:"East Lothian"},{name:"Fife"},{name:"Inverness-shire"},{name:"Kincardineshire"},{name:"Kinross-shire"},{name:"Kirkcudbrightshire"},{name:"Lanarkshire"},{name:"Midlothian"},{name:"Moray"},{name:"Nairnshire"},{name:"Orkney"},{name:"Peeblesshire"},{name:"Perthshire"},{name:"Renfrewshire"},{name:"Ross-shire"},{name:"Roxburghshire"},{name:"Selkirkshire"},{name:"Shetland"},{name:"Stirlingshire"},{name:"Sutherland"},{name:"West Lothian"},{name:"Wigtownshire"},{name:"Antrim"},{name:"Armagh"},{name:"Down"},{name:"Fermanagh"},{name:"Londonderry"},{name:"Tyrone"}].map(e=>({title:e.name,value:e.name})),cn=e=>{const{field:a,onChange:i}=e,r=H(a),o=G(a),s=w(),l=st()?.form,d=Xn(),[c,u]=t.useState(a.initial_value),h=t.useRef(null),p=t.useCallback(()=>{u(""),h.current&&(h.current.value=""),i()},[i]),m=t.useCallback(e=>{u(e.value),h.current&&(h.current.value=e.value),i(),h.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[i]),_=t.useCallback(e=>{u(e.currentTarget.value),h.current&&(h.current.value=e.target.value),i(),h.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[i]),f=function(e){switch(e){case"US":return sn;case"CA":return ln;case"GB":return dn;default:return null}}(function(e,n,t,a){if(n)for(let a=0;a<n.length;a++){const i=n[a];if(a>0&&i===e){const e=n[a-1];if("country"===e.type.name){const n=ne(e.channel_property,t);if(n&&"string"==typeof n)return n}}}return a.country}(a,l??[],d??{},s)),x=f?f.findIndex(e=>e.value===c):-1,b=X(f),y=t.useRef(!1);return t.useLayoutEffect(()=>{if(y.current){if(f!==b){if(-1!==x)return;p()}}else y.current=!0},[p,f,b,x]),t.useLayoutEffect(()=>{a.initial_value&&(h.current&&(h.current.value=c),i())},[]),n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:h}),f?n.jsx(_e,{id:r,options:f,selectedIndex:x,onChange:m,placeholder:a.placeholder,enableSearch:!0,className:"xendit-form-field-inner"},(g=f,ie.has(g)||ie.set(g,re++),ie.get(g).toString())):n.jsx("input",{type:"text",id:r,value:c,onChange:_,placeholder:a.placeholder,className:"xendit-form-field-inner xendit-text-14"})]});var g};const un=e=>{const{field:a,onChange:i}=e,r=H(a),o=G(a),s=t.useRef(null),[l,d]=t.useState(a.initial_value??"");return n.jsx("input",{id:r,name:o,ref:s,type:"text",placeholder:a.placeholder,className:"xendit-form-field-inner xendit-text-14",value:l,onBlur:function(e){e.currentTarget?.value&&s.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){d(e.currentTarget.value),i()},minLength:hn(a)?a.type.min_length:void 0,maxLength:hn(a)?a.type.max_length:void 0,autoComplete:hn(a)?a.type.autocomplete:void 0})};function hn(e){return"text"===e.type.name}const pn={IDR:"id",VND:"vi",BRL:"pt-BR",RUB:"ru",CZK:"cs",RON:"ro",UAH:"uk",CLP:"es-CL",COP:"es-CO",UYU:"es-UY",ARS:"es-AR",INR:"hi-IN",NPR:"hi-IN",LKR:"hi-IN",BDT:"hi-IN"},mn={USD:"US$",CAD:"CA$",EUR:"€",AFN:"؋",ALL:"Lek",AMD:"֏",ARS:"AR$",AUD:"AU$",AZN:"₼",BAM:"KM",BDT:"৳",BIF:"FBu",BND:"BN$",BOB:"Bs",BRL:"R$",BWP:"P",BYN:"Br",BZD:"BZ$",CDF:"FrCD",CHF:"CHF",CLP:"CL$",CNY:"CN¥",COP:"CO$",CRC:"₡",CVE:"CV$",CZK:"Kč",DJF:"Fdj",DKK:"kr",DOP:"RD$",ERN:"Nfk",ETB:"Br",GBP:"£",GEL:"₾",GHS:"GH₵",GNF:"FG",GTQ:"Q",HKD:"HK$",HNL:"L",HUF:"Ft",IDR:"Rp",ILS:"₪",INR:"₹",IRR:"IRR",ISK:"kr",JMD:"J$",JPY:"¥",KES:"Ksh",KHR:"៛",KMF:"FC",KRW:"₩",KZT:"₸",LKR:"SL Re",MDL:"lei",MGA:"MGA",MKD:"MKD",MMK:"K",MOP:"MOP$",MUR:"₨",MXN:"MXN$",MYR:"RM",MZN:"MTn",NAD:"N$",NGN:"₦",NIO:"C$",NOK:"kr",NPR:"रु",NZD:"NZ$",PAB:"B/.",PEN:"S/.",PHP:"₱",PKR:"₨",PLN:"zł",PYG:"₲",RON:"RON",RSD:"RSD",RUB:"₽",RWF:"FR",SDG:"SDG",SEK:"kr",SGD:"S$",SOS:"Ssh",THB:"฿",TOP:"T$",TRY:"TL",TTD:"TT$",TWD:"NT$",TZS:"TSh",UAH:"₴",UGX:"USh",UYU:"$U",UZS:"сум",VND:"₫",XAF:"FCFA",XOF:"CFA",ZAR:"R",ZMW:"K",ZWL:"ZWL$"},_n={ALL:"1 $",BAM:"1 $",BYN:"1 $",CZK:"1 $",DKK:"1 $",GEL:"1 $",HUF:"1 $",ISK:"1 $",IRR:"1 $",KHR:"1$",MDL:"1 $",MKD:"1 $",NOK:"1 $",PLN:"1 $",RON:"1 $",RSD:"1 $",RUB:"1$",SEK:"1 $",UZS:"1 $",VND:"1$"},fn={BHD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function xn(e,n){let t;const a=e<0,i=pn[n]??"en",r=fn[n]??2;if(t=new Intl.NumberFormat(i,{style:"decimal",minimumFractionDigits:r,maximumFractionDigits:20}).format(Math.abs(e)),t=t.replace(/(\.|,)000?$/,""),mn[n]){const e=mn[n]??n;t=(_n[n]??"$1").replace("$",e).replace("1",t)}else t=n+" "+t;return a&&(t="-"+t),t}const bn=e=>{const{field:a,onChange:i}=e,{t:r}=S(),o=w(),s=H(a),l=G(a),d=t.useRef(null),c=st();T(c);const u=t.useMemo(()=>ce(c.form,"credit_card_number"),[c.form]),h=dt()?.paymentOptions,p=h?.options?.installment_plans,[m,_]=t.useState(null),f=t.useMemo(()=>{const e=p?.map(e=>({title:r("installment_plan.pay_in_installments",{installments:e.terms,amount:xn(e.installment_amount,o.currency)}),subtitle:e.interest_rate,value:yn(e)}))??[];return u&&e.unshift({title:r("installment_plan.pay_in_full",{amount:xn(o.amount,o.currency)}),value:""}),e},[u,p,o.amount,o.currency,r]);let x=f?.findIndex(e=>e.value===m);-1===x&&(x=0);const b=t.useCallback(()=>{_(null),d.current&&(d.current.value="")},[]),y=t.useCallback(e=>{if(d.current){const n=p?.find(n=>yn(n)===e.value);n?n.code?d.current.value=JSON.stringify([n.terms,n.interval,n.code]):d.current.value=JSON.stringify([n.terms,n.interval]):d.current.value="",d.current?.dispatchEvent(new InternalSetFieldTouchedEvent)}_(e.value),i()},[p,i]);t.useLayoutEffect(()=>{f.length&&y(f[0])},[]);const g=X(f);return t.useLayoutEffect(()=>{f===g||p?.some(e=>yn(e)===m)||(f.length?y(f[0]):b())},[b,f,y,p,g,m]),n.jsxs(n.Fragment,{children:[h?n.jsx(_e,{id:s,placeholder:a.placeholder,onChange:y,options:f,selectedIndex:x,className:"xendit-form-field-inner"}):n.jsx(fe,{id:s,className:"xendit-form-field-inner"}),n.jsx("input",{type:"hidden",name:l,ref:d})]})};function yn(e){return`${e.terms}_${e.interval}_${e.code??""}`}const gn=e=>{const{field:t,className:a}=e;return n.jsx("div",{className:`${a} xendit-channel-form-field xendit-form-field-span-${t.span}`,children:function(){switch(t.type.name){case"credit_card_number":case"credit_card_expiry":case"credit_card_cvn":return n.jsx(en,{...e});case"phone_number":return n.jsx(tn,{...e});case"text":case"email":case"postal_code":return n.jsx(un,{...e});case"dropdown":return n.jsx(Xe,{...e});case"installment_plan":return n.jsx(bn,{...e});case"country":return n.jsx(Fe,{...e});case"province":return n.jsx(cn,{...e})}throw t.type,new Error(`Unsupported field type: ${t.type.name}`)}()})};const vn={en:{session:{"action.payment_confirmation_instructions":"Once you've paid, click the button above to get your payment confirmation.","action.payment_made":"I've made this payment","action_barcode.amount_to_pay":"Amount to pay","action_barcode.barcode_content":"Payment Code","action_barcode.merchant_name":"Seller","action_barcode.unable_to_generate":"Unable to generate barcode","action_deeplink.button":"Open App","action_deeplink.instructions":"Please complete your payment on {{channelName}} app.","action_deeplink.title":"Awaiting payment...","action_empty_list_push_notification.subtext":"Check the notification in your {{channelName}} app to complete your payment.","action_empty_list_push_notification.title":"Awaiting payment...","action_qr.unable_to_generate":"Unable to generate QR code","action_va.amount_to_pay":"Amount to Pay","action_va.copied_to_clipboard":"Copied to clipboard","action_va.copy":"Copy","action_va.merchant_name":"Virtual Account Name","action_va.virtual_account_number":"Virtual Account Number","combobox.default_search_placeholder":"Search...","default_error.message_1":"There was a problem with the request.","default_error.message_2":"Please try again later.","default_error.title":"Error","failure_code.account_access_blocked":"Your payment was declined. Please try again or use a different payment method.","failure_code.account_already_linked":"Your account has already been linked. Please use a different payment method.","failure_code.account_not_activated":"Your payment couldn’t be processed because your account hasn’t been activated. Please activate your account and try again.","failure_code.authentication_failed":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.capture_amount_exceeded":"Your payment couldn't be processed. Please make sure your payment details are correct and try again, or use a different payment method.","failure_code.card_declined":"Your card was declined. Please try again with another card or payment method.","failure_code.channel_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.declined_by_issuer":"Your payment was declined. Please try again or use a different payment method.","failure_code.declined_by_processor":"Your payment was declined. Please try again or use a different payment method.","failure_code.expired_card":"Your card was declined because it is expired. Please try again or use a different payment method.","failure_code.expired_otp":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.failure_details_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.inactive_or_unauthorized_card":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.insufficient_balance":"Your payment couldn’t be processed because your account balance is insufficient. Please make sure you have enough funds and try again.","failure_code.invalid_account_details":"Your payment information is incorrect. Please double-check your card details or try a different payment method.","failure_code.invalid_cvv":"The CVN entered was incorrect. Please try again.","failure_code.invalid_merchant_settings":"Your payment couldn’t be processed. Please contact the seller or try a different payment method.","failure_code.invalid_otp":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.invalid_token":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.issuer_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.otp_attempt_counts_exceeded":"Your payment couldn’t be processed because there were too many failed OTP attempts. Please make the payment again or use a different payment method.","failure_code.partner_timeout_error":"Your payment couldn't be processed. Please try again or use a different payment method.","failure_code.payment_amount_limits_exceeded":"Your payment couldn’t be processed because you’ve exceeded your transaction limit. Please use a different payment method.","failure_code.payment_attempt_counts_exceeded":"Your payment couldn’t be processed due to too many failed attempts.","failure_code.payment_request_expired":"Your payment couldn’t be processed because the link has expired. Please try again or use a different payment method.","failure_code.processor_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.server_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.stolen_card":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.suspected_fraudulent":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.timeout_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.user_declined_payment":"Your payment was declined. Please try again or use a different payment method.","failure_code.user_device_unreachable":"Your payment couldn’t be processed due to a network issue. Please try again or use a different payment method.","failure_code.user_did_not_authorize":"Your payment couldn’t be processed because it wasn’t authorized in time. Please try again.",failure_code_unknown:"A failure occurred with code {{failureCode}}","google_pay_errors.buyer_account_error.message":"Your Google account is unable to make this payment. Use a different Google account or a different payment method.","google_pay_errors.buyer_account_error.title":"Google Pay Error","google_pay_errors.developer_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.developer_error.title":"Google Pay Error","google_pay_errors.internal_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.internal_error.title":"Google Pay Error","google_pay_errors.merchant_account_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.merchant_account_error.title":"Google Pay Error","google_pay_errors.unknown_error.message":"An unknown error occurred with Google Pay. The error code is {{statusCode}}.","google_pay_errors.unknown_error.title":"Google Pay Error","image_alt.channel_logo":"{{channelName}} logo","installment_plan.pay_in_full":"Pay in Full — {{amount}}","installment_plan.pay_in_installments":"{{installments}}x Installments — {{amount}}","payment.save_checkbox_label":"Save this payment method for recurring payments","payment_methods.add_payment_method":"Add payment method","payment_methods.channel_disabled_amount_too_large":"Not available for this payment","payment_methods.channel_disabled_amount_too_small":"Not available for this payment","payment_methods.pay_with":"Pay with","payment_methods.select_channel_placeholder":"Select {{groupName}}","payment_request_status.canceled.subtext":"Please try to check out again or contact the seller if the problem persists.","payment_request_status.canceled.title":"This page is no longer available","payment_request_status.expired.subtext":"Your payment couldn’t be processed. Please try again or use a different payment method.","payment_request_status.expired.title":"Payment unsuccessful","payment_request_status.failed.subtext":"Your payment couldn't be processed. Please try a different payment method or submit an inquiry to the seller by sharing your Unique Identifiers.","payment_request_status.failed.title":"Payment failed","payment_token_status.canceled.subtext":"Please try again or use a different payment method.","payment_token_status.canceled.title":"Payment method couldn't be added","payment_token_status.expired.subtext":"Please try again or use a different payment method.","payment_token_status.expired.title":"Payment method couldn't be added","payment_token_status.failed.subtext":"Your payment couldn't be processed. Please try a different payment method or submit an inquiry to the seller by sharing your Unique Identifiers.","payment_token_status.failed.title":"Payment method couldn't be added","simulation.see_all_scenarios":"See the full list here.","simulation.select_scenario":"Select a scenario","simulation.simulate_scenario":"Simulate scenario","simulation.simulate_test_scenario":"Simulate a test scenario","simulation.want_to_test_all_scenarios":"Want to test different scenarios?","customer_details.form_name":"Your Name","customer_details.name":"Name","validation.card_brand_not_allowed":"This card brand is not accepted.","validation.card_cvn_invalid":"CVN is not valid","validation.card_expiry_invalid":"Card expiry is not valid","validation.card_number_incomplete":"Card number is incomplete","validation.card_number_invalid":"Card number is not valid","validation.generic_invalid":"{{field}} is not valid. Please check and try again.","validation.required":"{{field}} is required.","validation.text_too_long":"{{field}} is too long","validation.text_too_short":"{{field}} is too short"}}.session,id:{session:{"action.payment_confirmation_instructions":"Setelah Anda bayar, klik tombol di atas untuk mendapatkan konfirmasi pembayaran Anda.","action.payment_made":"Saya telah melakukan pembayaran ini","action_barcode.amount_to_pay":"Jumlah Pembayaran","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"Buka Aplikasi","action_deeplink.instructions":"Silakan selesaikan pembayaran Anda di aplikasi {{channelName}}.","action_deeplink.title":"Menunggu pembayaran...","action_empty_list_push_notification.subtext":"Cek notifikasi di aplikasi {{channelName}} Anda untuk menyelesaikan pembayaran.","action_empty_list_push_notification.title":"Menunggu pembayaran...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"Jumlah Pembayaran","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"Nomor Virtual Account","combobox.default_search_placeholder":"Cari...","default_error.message_1":"Ada masalah dengan permintaan ini.","default_error.message_2":"Silakan coba lagi nanti.","default_error.title":"Error","failure_code.account_access_blocked":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.account_already_linked":"Akun Anda sudah di-link. Silakan gunakan metode pembayaran lain.","failure_code.account_not_activated":"Pembayaran Anda tidak dapat diproses karena akun Anda belum diaktifkan. Harap aktifkan akun Anda dan coba lagi.","failure_code.authentication_failed":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.capture_amount_exceeded":"Pembayaran Anda tidak dapat diproses. Pastikan detail pembayaran Anda benar dan coba lagi, atau gunakan metode pembayaran lain.","failure_code.card_declined":"Kartu Anda ditolak. Silakan coba lagi dengan kartu atau metode pembayaran lain.","failure_code.channel_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.declined_by_issuer":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.declined_by_processor":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.expired_card":"Kartu Anda ditolak karena sudah kedaluwarsa. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.expired_otp":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.failure_details_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.inactive_or_unauthorized_card":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.insufficient_balance":"Pembayaran Anda tidak dapat diproses karena saldo akun Anda tidak mencukupi. Pastikan Anda memiliki dana yang cukup dan coba lagi.","failure_code.invalid_account_details":"Informasi pembayaran Anda salah. Harap periksa kembali detail kartu Anda atau coba gunakan metode pembayaran lain.","failure_code.invalid_cvv":"CVN yang dimasukkan salah. Silakan coba lagi.","failure_code.invalid_merchant_settings":"Pembayaran Anda tidak dapat diproses. Silakan hubungi penjual atau coba metode pembayaran lain.","failure_code.invalid_otp":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.invalid_token":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.issuer_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.otp_attempt_counts_exceeded":"Pembayaran Anda tidak dapat diproses karena terlalu banyak percobaan OTP yang gagal. Harap lakukan pembayaran lagi atau gunakan metode pembayaran lain.","failure_code.partner_timeout_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.payment_amount_limits_exceeded":"Pembayaran Anda tidak dapat diproses karena Anda telah melampaui batas transaksi. Silakan gunakan metode pembayaran lain.","failure_code.payment_attempt_counts_exceeded":"Pembayaran Anda tidak dapat diproses karena terlalu banyak percobaan yang gagal.","failure_code.payment_request_expired":"Pembayaran Anda tidak dapat diproses karena link telah kedaluwarsa. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.processor_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.server_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.stolen_card":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.suspected_fraudulent":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.timeout_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_declined_payment":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_device_unreachable":"Pembayaran Anda tidak dapat diproses karena masalah jaringan. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_did_not_authorize":"Pembayaran Anda tidak dapat diproses karena waktu pembayaran telah habis. Silakan coba lagi.",failure_code_unknown:"Terjadi kegagalan dengan kode {{failureCode}}","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"Logo {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"Simpan metode pembayaran ini untuk pembayaran berulang","payment_methods.add_payment_method":"Tambah metode pembayaran","payment_methods.channel_disabled_amount_too_large":"Tidak tersedia untuk pembayaran ini","payment_methods.channel_disabled_amount_too_small":"Tidak tersedia untuk pembayaran ini","payment_methods.pay_with":"Bayar dengan","payment_methods.select_channel_placeholder":"Pilih {{groupName}}","payment_request_status.canceled.subtext":"Silakan coba check out lagi atau hubungi penjual jika masalah terus berlanjut.","payment_request_status.canceled.title":"Halaman ini tidak tersedia lagi","payment_request_status.expired.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","payment_request_status.expired.title":"Pembayaran tidak berhasil","payment_request_status.failed.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba metode pembayaran lain atau ajukan pertanyaan kepada penjual dengan membagikan ID Unik Anda.","payment_request_status.failed.title":"Pembayaran gagal","payment_token_status.canceled.subtext":"Silakan coba lagi atau gunakan metode pembayaran lain.","payment_token_status.canceled.title":"Metode pembayaran tidak dapat ditambahkan","payment_token_status.expired.subtext":"Silakan coba lagi atau gunakan metode pembayaran lain.","payment_token_status.expired.title":"Metode pembayaran tidak dapat ditambahkan","payment_token_status.failed.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba metode pembayaran lain atau ajukan pertanyaan kepada penjual dengan membagikan ID Unik Anda.","payment_token_status.failed.title":"Metode pembayaran tidak dapat ditambahkan","customer_details.form_name":"Nama Anda","customer_details.name":"Nama","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"Merek kartu ini tidak diterima.","validation.card_cvn_invalid":"CVN tidak valid","validation.card_expiry_invalid":"Tanggal kedaluwarsa kartu tidak valid","validation.card_number_incomplete":"Nomor kartu tidak lengkap","validation.card_number_invalid":"Nomor kartu tidak valid","validation.generic_invalid":"{{field}} tidak valid. Silakan cek dan coba lagi.","validation.required":"{{field}} wajib diisi.","validation.text_too_long":"{{field}} terlalu panjang","validation.text_too_short":"{{field}} terlalu pendek"}}.session,th:{session:{"action.payment_confirmation_instructions":"เมื่อคุณชำระเงินแล้ว คลิกที่ปุ่มด้านบนเพื่อยืนยันการชำระเงิน","action.payment_made":"ฉันได้ชำระเงินแล้ว","action_barcode.amount_to_pay":"จำนวนเงินที่ต้องชำระ","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"","action_deeplink.instructions":"โปรดชำระเงินให้เสร็จสิ้นบนแอป {{channelName}}","action_deeplink.title":"","action_empty_list_push_notification.subtext":"ตรวจสอบการแจ้งเตือนในแอป {{channelName}} ของคุณเพื่อดำเนินการชำระเงินให้เสร็จสิ้น","action_empty_list_push_notification.title":"กําลังรอการชําระเงิน...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"ยอดชำระ","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"หมายเลข Virtual Account","combobox.default_search_placeholder":"ค้นหา...","default_error.message_1":"มีปัญหาในการประมวลผลคำขอ","default_error.message_2":"โปรดลองอีกครั้งในภายหลัง","default_error.title":"ข้อผิดพลาด","failure_code.account_access_blocked":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.account_already_linked":"บัญชีนี้มีการเชื่อมต่อไว้แล้ว กรุณาเลือกวิธีการชำระเงินอื่น","failure_code.account_not_activated":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากบัญชีของคุณยังไม่ได้เปิดใช้งาน กรุณาเปิดใช้งานบัญชีและลองใหม่อีกครั้ง","failure_code.authentication_failed":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.capture_amount_exceeded":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาตรวจสอบรายละเอียดการชำระเงินให้ถูกต้องแล้วลองใหม่อีกครั้ง หรือใช้วิธีการชำระเงินอื่น","failure_code.card_declined":"บัตรของคุณถูกปฏิเสธ กรุณาลองใหม่ด้วยบัตรหรือวิธีการชำระเงินอื่น","failure_code.channel_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.declined_by_issuer":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.declined_by_processor":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.expired_card":"บัตรของคุณถูกปฏิเสธเนื่องจากบัตรหมดอายุ กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","failure_code.expired_otp":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.failure_details_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.inactive_or_unauthorized_card":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.insufficient_balance":"ไม่สามารถดำเนินการชำระเงินได้ เนื่องจากยอดเงินในบัญชีไม่เพียงพอ กรุณาตรวจสอบให้แน่ใจว่ามียอดเงินเพียงพอแล้วลองใหม่อีกครั้ง","failure_code.invalid_account_details":"ข้อมูลการชำระเงินไม่ถูกต้อง กรุณาตรวจสอบรายละเอียดบัตรอีกครั้ง หรือใช้วิธีการชำระเงินอื่น","failure_code.invalid_cvv":"CVN ที่กรอกไม่ถูกต้อง กรุณาลองใหม่อีกครั้ง","failure_code.invalid_merchant_settings":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาติดต่อผู้ขายหรือลองใช้วิธีชำระเงินอื่น","failure_code.invalid_otp":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.invalid_token":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.issuer_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.otp_attempt_counts_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากมีการกรอกรหัส OTP ผิดพลาดมากเกินไป กรุณาชำระเงินใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.partner_timeout_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.payment_amount_limits_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากคุณทำธุรกรรมเกินขีดจำกัด กรุณาใช้วิธีชำระเงินอื่น","failure_code.payment_attempt_counts_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากพยายามล้มเหลวหลายครั้งเกินไป","failure_code.payment_request_expired":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากลิงก์หมดอายุแล้ว กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.processor_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.server_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.stolen_card":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.suspected_fraudulent":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.timeout_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_declined_payment":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_device_unreachable":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากปัญหาเครือข่าย กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_did_not_authorize":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากไม่ได้รับการอนุมัติภายในเวลาที่กำหนด กรุณาลองใหม่อีกครั้ง",failure_code_unknown:"เกิดข้อผิดพลาดขึ้น (รหัส: {{failureCode}})","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"โลโก้ {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"บันทึกวิธีการชําระเงินนี้สําหรับการชําระเงินอัตโนมัติ","payment_methods.add_payment_method":"เพิ่มวิธีการชำระเงิน","payment_methods.channel_disabled_amount_too_large":"ไม่สามารถใช้ได้กับการชำระเงินนี้","payment_methods.channel_disabled_amount_too_small":"ไม่สามารถใช้ได้กับการชำระเงินนี้","payment_methods.pay_with":"ชำระเงินด้วย","payment_methods.select_channel_placeholder":"เลือก {{groupName}}","payment_request_status.canceled.subtext":"กรุณาลองชำระเงินอีกครั้ง หรือ ติดต่อผู้ขายหากปัญหายังคงเกิดขึ้น","payment_request_status.canceled.title":"หน้านี้ไม่สามารถใช้งานได้แล้ว","payment_request_status.expired.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือลองใช้วิธีชำระเงินอื่น","payment_request_status.expired.title":"ชำระเงินไม่สำเร็จ","payment_request_status.failed.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใช้วิธีการชำระเงินอื่น หรือส่งคำถามไปยังผู้ขายโดยแชร์ Unique Identifiers ของคุณ","payment_request_status.failed.title":"ชำระเงินไม่สำเร็จ","payment_token_status.canceled.subtext":"กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","payment_token_status.canceled.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","payment_token_status.expired.subtext":"กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","payment_token_status.expired.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","payment_token_status.failed.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใช้วิธีการชำระเงินอื่น หรือส่งคำถามไปยังผู้ขายโดยแชร์ Unique Identifiers ของคุณ","payment_token_status.failed.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","customer_details.form_name":"ชื่อของคุณ","customer_details.name":"ชื่อ","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"ไม่รับบัตรเครดิตยี่ห้อนี้","validation.card_cvn_invalid":"CVN ไม่ถูกต้อง","validation.card_expiry_invalid":"วันหมดอายุของบัตรไม่ถูกต้อง","validation.card_number_incomplete":"หมายเลขบัตรไม่ครบถ้วน","validation.card_number_invalid":"หมายเลขบัตรไม่ถูกต้อง","validation.generic_invalid":"{{field}} ไม่ถูกต้อง","validation.required":"กรุณากรอก {{field}}","validation.text_too_long":"{{field}} ยาวเกินไป","validation.text_too_short":"{{field}} สั้นเกินไป"}}.session,vi:{session:{"action.payment_confirmation_instructions":"Sau khi bạn đã thanh toán, hãy nhấp nút phía trên để nhận xác nhận thanh toán.","action.payment_made":"Tôi đã thực hiện thanh toán này","action_barcode.amount_to_pay":"Số tiền cần thanh toán","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"Mở ứng dụng","action_deeplink.instructions":"Vui lòng hoàn tất thanh toán trên ứng dụng {{channelName}}.","action_deeplink.title":"Đang chờ thanh toán...","action_empty_list_push_notification.subtext":"Vui lòng kiểm tra thông báo trong ứng dụng {{channelName}} để hoàn tất thanh toán.","action_empty_list_push_notification.title":"Đang chờ thanh toán...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"Số tiền cần thanh toán","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"Số tài khoản định danh (Virtual Account)","combobox.default_search_placeholder":"Tìm kiếm...","default_error.message_1":"Có vấn đề với yêu cầu.","default_error.message_2":"Vui lòng thử lại sau.","default_error.title":"Lỗi","failure_code.account_access_blocked":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.account_already_linked":"Tài khoản của bạn đã được liên kết. Vui lòng dùng phương thức khác.","failure_code.account_not_activated":"Không thể thực hiện thanh toán vì tài khoản chưa được kích hoạt. Vui lòng kích hoạt và thử lại.","failure_code.authentication_failed":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.capture_amount_exceeded":"Không thể thực hiện thanh toán. Vui lòng kiểm tra thông tin thanh toán và thử lại, hoặc dùng phương thức khác.","failure_code.card_declined":"Thẻ của bạn đã bị từ chối. Vui lòng thử lại bằng thẻ khác hoặc phương thức khác.","failure_code.channel_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.declined_by_issuer":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.declined_by_processor":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.expired_card":"Thẻ của bạn bị từ chối do đã hết hạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.expired_otp":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.failure_details_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.inactive_or_unauthorized_card":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.insufficient_balance":"Không thể thực hiện thanh toán vì số dư tài khoản không đủ. Vui lòng nạp thêm tiền và thử lại.","failure_code.invalid_account_details":"Thông tin thanh toán không chính xác. Vui lòng kiểm tra lại hoặc dùng phương thức khác.","failure_code.invalid_cvv":"Mã CVN nhập không đúng. Vui lòng thử lại.","failure_code.invalid_merchant_settings":"Không thể thực hiện thanh toán. Vui lòng liên hệ người bán hoặc dùng phương thức khác.","failure_code.invalid_otp":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.invalid_token":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.issuer_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.otp_attempt_counts_exceeded":"Không thể thực hiện thanh toán vì đã nhập sai OTP quá nhiều lần. Vui lòng thanh toán lại hoặc dùng phương thức khác.","failure_code.partner_timeout_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.payment_amount_limits_exceeded":"Không thể thực hiện thanh toán vì bạn đã vượt quá hạn mức giao dịch. Vui lòng dùng phương thức khác.","failure_code.payment_attempt_counts_exceeded":"Không thể thực hiện thanh toán do quá nhiều lần thử thất bại.","failure_code.payment_request_expired":"Không thể thực hiện thanh toán vì liên kết đã hết hạn. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.processor_error":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.server_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.stolen_card":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.suspected_fraudulent":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.timeout_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_declined_payment":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_device_unreachable":"Không thể thực hiện thanh toán do sự cố mạng. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_did_not_authorize":"Không thể thực hiện thanh toán vì không được xác nhận kịp thời. Vui lòng thử lại.",failure_code_unknown:"Có lỗi xảy ra với mã {{failureCode}}","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"Logo {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"Lưu phương thức thanh toán này cho các thanh toán định kỳ","payment_methods.add_payment_method":"Thêm phương thức thanh toán","payment_methods.channel_disabled_amount_too_large":"Không khả dụng cho khoản thanh toán này","payment_methods.channel_disabled_amount_too_small":"Không khả dụng cho khoản thanh toán này","payment_methods.pay_with":"Thanh toán bằng","payment_methods.select_channel_placeholder":"Chọn {{groupName}}","payment_request_status.canceled.subtext":"Vui lòng thử thanh toán lại hoặc liên hệ người bán nếu vấn đề vẫn tiếp diễn.","payment_request_status.canceled.title":"Trang này không còn khả dụng","payment_request_status.expired.subtext":"Thanh toán của bạn không thể xử lý. Vui lòng thử lại hoặc chọn phương thức khác.","payment_request_status.expired.title":"Thanh toán không thành công","payment_request_status.failed.subtext":"Không thể thực hiện thanh toán. Vui lòng thử phương thức khác hoặc gửi yêu cầu đến người bán bằng cách chia sẻ Mã định danh duy nhất.","payment_request_status.failed.title":"Thanh toán thất bại","payment_token_status.canceled.subtext":"Vui lòng thử lại hoặc dùng phương thức khác.","payment_token_status.canceled.title":"Không thể thêm phương thức thanh toán","payment_token_status.expired.subtext":"Vui lòng thử lại hoặc dùng phương thức khác.","payment_token_status.expired.title":"Không thể thêm phương thức thanh toán","payment_token_status.failed.subtext":"Không thể thực hiện thanh toán. Vui lòng thử phương thức khác hoặc gửi yêu cầu đến người bán bằng cách chia sẻ Mã định danh duy nhất.","payment_token_status.failed.title":"Không thể thêm phương thức thanh toán","customer_details.form_name":"Tên của bạn","customer_details.name":"Tên","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"Thương hiệu thẻ này không được chấp nhận.","validation.card_cvn_invalid":"CVN không hợp lệ","validation.card_expiry_invalid":"Ngày hết hạn thẻ không hợp lệ","validation.card_number_incomplete":"Số thẻ chưa đầy đủ","validation.card_number_invalid":"Số thẻ không hợp lệ","validation.generic_invalid":"{{field}} không hợp lệ","validation.required":"Vui lòng nhập {{field}}","validation.text_too_long":"{{field}} quá dài","validation.text_too_short":"{{field}} quá ngắn"}}.session,es:{session:{"action.payment_confirmation_instructions":"","action.payment_made":"","action_barcode.amount_to_pay":"","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"","action_deeplink.instructions":"","action_deeplink.title":"","action_empty_list_push_notification.subtext":"","action_empty_list_push_notification.title":"","action_qr.unable_to_generate":"","action_va.amount_to_pay":"","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"","combobox.default_search_placeholder":"","default_error.message_1":"","default_error.message_2":"","default_error.title":"","failure_code.account_access_blocked":"","failure_code.account_already_linked":"","failure_code.account_not_activated":"","failure_code.authentication_failed":"","failure_code.capture_amount_exceeded":"","failure_code.card_declined":"","failure_code.channel_unavailable":"","failure_code.declined_by_issuer":"","failure_code.declined_by_processor":"","failure_code.expired_card":"","failure_code.expired_otp":"","failure_code.failure_details_unavailable":"","failure_code.inactive_or_unauthorized_card":"","failure_code.insufficient_balance":"","failure_code.invalid_account_details":"","failure_code.invalid_cvv":"","failure_code.invalid_merchant_settings":"","failure_code.invalid_otp":"","failure_code.invalid_token":"","failure_code.issuer_unavailable":"","failure_code.otp_attempt_counts_exceeded":"","failure_code.partner_timeout_error":"","failure_code.payment_amount_limits_exceeded":"","failure_code.payment_attempt_counts_exceeded":"","failure_code.payment_request_expired":"","failure_code.processor_error":"","failure_code.server_error":"","failure_code.stolen_card":"","failure_code.suspected_fraudulent":"","failure_code.timeout_error":"","failure_code.user_declined_payment":"","failure_code.user_device_unreachable":"","failure_code.user_did_not_authorize":"",failure_code_unknown:"","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"","payment_methods.add_payment_method":"","payment_methods.channel_disabled_amount_too_large":"","payment_methods.channel_disabled_amount_too_small":"","payment_methods.pay_with":"","payment_methods.select_channel_placeholder":"","payment_request_status.canceled.subtext":"","payment_request_status.canceled.title":"","payment_request_status.expired.subtext":"","payment_request_status.expired.title":"","payment_request_status.failed.subtext":"","payment_request_status.failed.title":"","payment_token_status.canceled.subtext":"","payment_token_status.canceled.title":"","payment_token_status.expired.subtext":"","payment_token_status.expired.title":"","payment_token_status.failed.subtext":"","payment_token_status.failed.title":"","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"","validation.card_cvn_invalid":"","validation.card_expiry_invalid":"","validation.card_number_incomplete":"","validation.card_number_invalid":"","validation.generic_invalid":"","validation.required":"","validation.text_too_long":"","validation.text_too_short":""}}.session};const Cn=(e,n,t)=>n?(e=>"object"==typeof e&&null!==e&&"localeKey"in e)(n)?e(n.localeKey,{field:"string"==typeof t?t:t.label}):n.value:null;function kn(e){return e.startsWith("/")&&e.endsWith("/")?e.slice(1,-1):e}function En(e,n){if(0===n.length)return e.required?{localeKey:"validation.required"}:void 0;switch(e.type.name){case"credit_card_number":case"credit_card_expiry":case"credit_card_cvn":return function(e){const n=ae(e);if(!n.valid){if(n.validationError)return{localeKey:n.validationError};throw new Error("Unexpected value in encrypted field, this is a bug, please contact support.")}}(n);case"phone_number":return(e=>{const n=r(e);if(!n||!n.isValid())return{localeKey:"validation.generic_invalid"}})(n);case"email":return(e=>{if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[A-Za-z]{2,}$/.test(e))return{localeKey:"validation.generic_invalid"}})(n);case"postal_code":return(e=>{if(!/^(?![-\s]+)[A-Za-z0-9\s-]+$/.test(e))return{localeKey:"validation.generic_invalid"}})(n);case"text":return((e,n)=>{if(Array.isArray(e.type.regex_validators))for(const t of e.type.regex_validators)if(!new RegExp(kn(t.regex)).test(n))return{value:t.message};return void 0!==e.type.min_length&&n.length<e.type.min_length?{localeKey:"validation.text_too_short"}:n.length>e.type.max_length?{localeKey:"validation.text_too_long"}:void 0})(e,n);case"country":case"province":case"installment_plan":case"dropdown":return;default:throw e.type,new Error(`Unsupported input type: ${e.type.name}; this is a bug, please contact support.`)}}function wn(e,n){const t=Array.isArray(e.channel_property)?e.channel_property:[e.channel_property];for(const a of t){let t=Nn(n,a);if(void 0===t&&(t=""),"string"!=typeof t)continue;const i=En(e,t);if(i)return i}}function Nn(e,n){const t=n.split("."),a=t[0].endsWith("[]");if(a){if(1!==t.length)throw new Error("Array channel properties cannot have nested keys");t[0]=t[0].slice(0,-2)}const i=e[t[0]];if(void 0!==i){if(a&&Array.isArray(i))return i;if("object"!=typeof i||Array.isArray(i)){if(1!==t.length)throw new Error(`Attempted to read channel property "${n}" expecting an object but found a primitive value; this is a bug, please contact support.`);return i}return Nn(i,t.slice(1).join("."))}}const An=e.createContext(null),Sn=({scenarios:e,onSelect:a,children:i})=>{const[r,o]=t.useState(!1),s=t.useRef(null);return t.useLayoutEffect(()=>{if(!r)return;const e=e=>{const n=s.current;n&&(n.contains(e.target)||o(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),n.jsx("div",{ref:s,children:n.jsx(An.Provider,{value:{open:r,setOpen:o,scenarios:e,onSelect:a},children:i})})},In=({children:e})=>n.jsx("div",{className:"xendit-form-simulation-root",children:e}),Pn=({children:e})=>{const{open:a,setOpen:i}=t.useContext(An)||{};return n.jsx("button",{type:"button",className:"xendit-form-simulation-trigger",onClick:()=>i?.(!a),children:e})},Rn=()=>{const e=t.useContext(An);T(e);const{open:a,setOpen:i,scenarios:r,onSelect:o}=e,{t:s}=S();return a&&r?n.jsxs("div",{className:"xendit-form-simulation-popover",children:[n.jsx("div",{className:"xendit-text-12 xendit-text-semibold",children:s("simulation.simulate_test_scenario")}),n.jsx(_e,{onChange:e=>{o?.(e.value),i?.(!1)},placeholder:s("simulation.select_scenario"),options:r.scenarios.map(e=>({title:e.description,value:e.name,leadingAsset:n.jsx("img",{src:e.imageUrl,className:"xendit-channel-logo"})}))}),r?.docsLink?n.jsxs("div",{className:"xendit-text-14",children:[s("simulation.want_to_test_all_scenarios")," ",n.jsx("a",{href:r.docsLink,target:"_blank",rel:"noopener noreferrer",className:"xendit-text-link",children:s("simulation.see_all_scenarios")})]}):null]}):null},Tn="field-radius-bl-0",jn="field-radius-br-0",Dn="field-radius-tl-0",qn="field-radius-tr-0",Ln="field-collapse-r",Bn="field-collapse-l",Mn="field-collapse-t",On="field-collapse-b",Un=({fieldGroup:e,groupIndex:i,handleFieldChanged:r,channelProperties:o,simulationScenarios:s})=>{const{t:l}=S(),d=dt(),c=st(),u=t.useRef(null),[h,p]=t.useState({}),m=e.map(e=>e.span),_=Math.ceil(e.reduce((e,n)=>e+n.span,0)/2);t.useLayoutEffect(()=>{const e=u.current;if(e)return e.addEventListener(InternalSetFieldTouchedEvent.type,n),()=>{e.removeEventListener(InternalSetFieldTouchedEvent.type,n)};function n(e){const n=e.target.name;p(e=>({...e,[n]:!0}))}},[]);const f=(()=>{for(const t of e){if(!h[G(t)])continue;const e=wn(t,o??{});if(e)return n.jsx("span",{className:"xendit-error-message xendit-text-12",children:Cn(l,e,t)})}for(const t of e){if("credit_card_number"!==t.type.name)continue;if(!h[G(t)])continue;const e=c?.card?.brands,a=d?.cardDetails?.details?.schemes;if(e?.length&&a?.length&&!a.some(n=>e.some(e=>e.name===n)))return n.jsx("span",{className:"xendit-error-message xendit-text-12",children:Cn(l,{localeKey:"validation.card_brand_not_allowed"},t)})}return null})();return n.jsx(Ye,{children:n.jsxs("div",{className:"xendit-channel-form-field-group",children:[n.jsxs("div",{className:"xendit-channel-form-field-group-label-container",children:[n.jsx("label",{htmlFor:H(e[0]),className:"xendit-text-14",children:e[0].group_label??e[0].label??""}),s?n.jsx(Kn,{simulationScenarios:s,fieldGroup:e}):null]}),n.jsx("div",{ref:u,className:"xendit-form-field-group "+(f?"invalid":""),children:e.map((e,t)=>{const i=(e=>{const n=m.slice(0,e).reduce((e,n)=>e+n,0),t=0===e?0:Math.floor(n/2);return{fieldPositionBySpan:n,fieldRow:t,fieldColumn:n%2,isLastRow:t===_-1}})(t),o=((e,n,t)=>{const{fieldPositionBySpan:i,fieldRow:r,fieldColumn:o,isLastRow:s}=t;return a({[Tn]:_>r+1||i%2==1,[jn]:!!m[n+1],[Dn]:n>0,[qn]:!(0===r&&1===o||0===r&&0===o&&2===e.span),[Ln]:1===e.span&&0===o,[Bn]:1===e.span&&1===o,[Mn]:i>=2,[On]:!s})})(e,t,i);return n.jsx(gn,{className:o,field:e,onChange:r},t)})},i),f]})})},Kn=({simulationScenarios:e,fieldGroup:a})=>{const i=t.useContext(He),{t:r}=S();return n.jsx(Sn,{scenarios:e,onSelect:n=>{const t=e.scenarios.find(e=>e.name===n);if(t?.values)for(const[e,n]of Object.entries(t.values)){const t=a.find(n=>G(n)===e);t&&("credit_card_number"!==t.type.name&&"credit_card_expiry"!==t.type.name&&"credit_card_cvn"!==t.type.name||i?.postMessageToIframe(e,{type:"xendit-iframe-populate-for-simulation",scenario:n}))}},children:n.jsxs(In,{children:[n.jsx(Pn,{children:n.jsx("div",{className:"xendit-text-12 xendit-text-semibold xendit-text-link",children:r("simulation.simulate_scenario")})}),n.jsx(Rn,{})]})})},Fn={scenarios:[{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"3DS Challenge",name:"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa",values:{"card_details.card_number":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa","card_details.expiry_month__card_details.expiry_year":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa","card_details.cvn":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_visa"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_visa",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_visa","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_visa","card_details.cvn":"3_ds_frictionless_authentication_is_successful_visa"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"3DS Challenge",name:"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard",values:{"card_details.card_number":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard","card_details.expiry_month__card_details.expiry_year":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard","card_details.cvn":"3_ds_challenge_authentication_is_successful_if_otp_is_correct_mastercard"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_mastercard",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_mastercard","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_mastercard","card_details.cvn":"3_ds_frictionless_authentication_is_successful_mastercard"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_visa2",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_visa2","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_visa2","card_details.cvn":"3_ds_frictionless_authentication_is_successful_visa2"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_is_successful_mastercard2",values:{"card_details.card_number":"3_ds_frictionless_authentication_is_successful_mastercard2","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_is_successful_mastercard2","card_details.cvn":"3_ds_frictionless_authentication_is_successful_mastercard2"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/VISA.svg",description:"Failure",name:"failing_transaction_visa",values:{"card_details.card_number":"failing_transaction_visa","card_details.expiry_month__card_details.expiry_year":"failing_transaction_visa","card_details.cvn":"failing_transaction_visa"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/MASTERCARD.svg",description:"Failure",name:"failing_transaction_mastercard",values:{"card_details.card_number":"failing_transaction_mastercard","card_details.expiry_month__card_details.expiry_year":"failing_transaction_mastercard","card_details.cvn":"failing_transaction_mastercard"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/AMEX.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn",values:{"card_details.card_number":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn","card_details.cvn":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/AMEX.svg",description:"3DS Frictionless, success",name:"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2",values:{"card_details.card_number":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2","card_details.expiry_month__card_details.expiry_year":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2","card_details.cvn":"3_ds_frictionless_authentication_successful_use_a_4_digit_cvn2"}},{imageUrl:"https://assets.xendit.co/payment-session/logos/AMEX.svg",description:"3DS Challenge",name:"3_ds_challenge_use_a_4_digit_cvn",values:{"card_details.card_number":"3_ds_challenge_use_a_4_digit_cvn","card_details.expiry_month__card_details.expiry_year":"3_ds_challenge_use_a_4_digit_cvn","card_details.cvn":"3_ds_challenge_use_a_4_digit_cvn"}}],docsLink:"https://docs.xendit.co/docs/cards-simulate-card-scenarios"},Vn=s.forwardRef(({form:e,onChannelPropertiesChanged:a},i)=>{const r=w(),o=st(),s=S(),l=dt(),d=t.useRef(null),[c,u]=t.useState(null);t.useImperativeHandle(i,()=>({setAllFieldsTouched(){const e=d.current;e&&Array.from(e.elements).filter(e=>e instanceof HTMLInputElement).forEach(e=>{e.name&&e.dispatchEvent(new InternalSetFieldTouchedEvent)})}}));const h=t.useCallback(()=>{if(!d.current)return{};return function(e){const n={};for(const[t,a]of e){if(a instanceof Blob)continue;const e=t.split("__"),i=Gn(e,a);e:for(const t of e){const e=t.split(".");let a=n;for(;e.length>1;){const n=e.shift();let t=a[n];if(void 0===t&&(t=a[n]={}),t&&"object"==typeof t){if(Array.isArray(t))continue e;a=t}}const r=i.length?i.shift():"";e[0].endsWith("[]")?a[e[0].slice(0,-2)]=[r]:a[e[0]]=r}}return n}(new FormData(d.current).entries())},[]),p=t.useCallback(()=>{if(!d.current)return;const e=h();u(e),a(e)},[h,a]);t.useLayoutEffect(()=>{p()},[]);const m=function(e,n,a,i){const r=t.useMemo(()=>zn(e.session_type,n,a,i),[i,a,n,e.session_type]);return r}(r,e,c||{},l??null),_=X(m);t.useEffect(()=>{(function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0})(_||[],m)||p()},[m,p,_]);const f=t.useCallback(e=>s.supportsSimulationScenarios()&&"CARDS"===o?.channel_code&&e.some(e=>"credit_card_number"===e.type.name)?Fn:null,[o,s]),x=function(e){const n=[[]];for(const t of e)1!==t.span||1!==n[n.length-1].length||1!==n[n.length-1][0].span?t.join?n[n.length-1].push(t):n.push([t]):n[n.length-1].push(t);return n}(m).filter(e=>e.length);return 0===x.length?null:n.jsx("div",{class:"xendit-channel-form",children:n.jsx("form",{ref:d,children:n.jsx(Wn.Provider,{value:c,children:x.map((e,t)=>n.jsx(Un,{fieldGroup:e,groupIndex:t,handleFieldChanged:p,channelProperties:c,simulationScenarios:f(e)},t))})})})}),Wn=e.createContext(null),Xn=()=>t.useContext(Wn);function Gn(e,n){if(0===e.length)return[];if(1===e.length)return[n];if(""===n)return[];try{return JSON.parse(n)}catch(e){return[n]}}function zn(e,n,t,a){const i=ce(n,"credit_card_number"),r=a?.cardDetails?.details?.require_billing_information,o=!!a?.paymentOptions?.options?.installment_plans?.length;return n.filter(n=>{if(n.flags?.require_billing_information){if("PAY"!==e)return!1;if(!r)return!1}if("installment_plan"===n.type.name&&!o&&i)return!1;for(const e of n.display_if||[]){const[n,a,i]=e,r=Nn(t,n);switch(a){case"equals":if(r!==i)return!1;break;case"not_equals":if(r===i)return!1}}return!0})}const Hn=e=>{const a=t.useRef(null),i=t.useRef(null),r=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{r&&(a.current?.animate($n,Yn),i.current?.animate(Qn,Zn))},[r]),n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[n.jsxs("g",{opacity:"0.5",children:[n.jsx("path",{d:"M8.79453 10.2303C7.1791 10.2303 5.86953 11.5399 5.86953 13.1553V28.9503C5.86953 31.535 7.96484 33.6303 10.5495 33.6303H26.3445C27.96 33.6303 29.2695 32.3208 29.2695 30.7053",fill:"#F1F1F1"}),n.jsx("path",{d:"M8.79453 10.2303V10.2303C7.1791 10.2303 5.86953 11.5399 5.86953 13.1553V28.9503C5.86953 31.535 7.96484 33.6303 10.5495 33.6303H26.3445C27.96 33.6303 29.2695 32.3208 29.2695 30.7053V30.7053",stroke:"#D0D0D0",strokeWidth:"1.755",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsxs("g",{ref:i,style:{transformOrigin:"20px 20px"},children:[n.jsx("path",{d:"M28.8177 6.00256H14.7777C12.193 6.00256 10.0977 8.09787 10.0977 10.6826V24.7226C10.0977 27.3073 12.193 29.4026 14.7777 29.4026H28.8177C31.4023 29.4026 33.4977 27.3073 33.4977 24.7226V10.6826C33.4977 8.09787 31.4024 6.00256 28.8177 6.00256Z",fill:"white",stroke:"#EDEDED",strokeWidth:"1.755",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsxs("g",{style:{transformOrigin:"10px 30px"},ref:a,children:[n.jsx("path",{d:"M26.7697 20.5301V12.7301H18.9697",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M17.4102 22.0901L26.7702 12.7301",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})},$n=[{transform:"scale(0.1)"},{transform:"scale(1)"}],Yn={duration:500,easing:"ease-out"},Qn=[{transform:"rotate(0deg)"},{transform:"rotate(5deg)"},{transform:"rotate(-5deg)"},{transform:"rotate(0deg)"}],Zn={duration:1e3,easing:"ease-out",iterations:1/0,delay:2e3},Jn=[{transform:"translateY(0)"},{transform:"translateY(44px)"}],et={duration:1e3,delay:1e3,easing:"ease-out"},nt={duration:1e3,direction:"reverse",delay:500,easing:"ease-in"},tt=[{opacity:1},{opacity:0},{opacity:1}],at={duration:1e3},it=e=>{const{id:t,label:a,checked:i,onChange:r,disabled:o}=e,s=Q(),l=t||s;return n.jsxs("div",{className:"xendit-checkbox",children:[n.jsxs("div",{className:"xendit-checkbox-box",children:[n.jsx("input",{id:l,type:"checkbox",onChange:e=>{r?.(e)},checked:i,disabled:o}),n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:"xendit-checkbox-graphic",children:n.jsx("polyline",{points:"40 144 96 200 224 72",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"16"})})]}),n.jsx("label",{htmlFor:l,className:"xendit-text-14",children:a})]})},rt=s.forwardRef(({onChange:e,value:t},a)=>{const{t:i}=S(),[r,o]=s.useState({});s.useImperativeHandle(a,()=>({setAllFieldsTouched(){o({given_names:!0})}}));const l=(()=>{if(0===Object.keys(r).length)return null;const e=function(e){if(0===e.given_names.length)return{localeKey:"validation.required"}}(t);return e?n.jsx("span",{className:"xendit-error-message xendit-text-12",children:Cn(i,e,"Name")}):null})();return n.jsx("form",{children:n.jsxs("div",{className:"xendit-channel-form-field-group",children:[n.jsx("div",{className:"xendit-channel-form-field-group-label-container",children:n.jsx("label",{htmlFor:"given_names",className:"xendit-text-14",children:i("customer_details.name")})}),n.jsx("div",{className:"xendit-form-field-group "+(l?"invalid":""),children:n.jsx("div",{className:"xendit-channel-form-field xendit-form-field-span-2",children:n.jsx("input",{id:"given_names",name:"given_names",type:"text",placeholder:i("customer_details.form_name"),className:"xendit-form-field-inner xendit-text-14",onBlur:e=>{const n=e.target;o(e=>({...e,[n.name]:!0}))},onChange:n=>{const t=n.target;e({given_names:t.value})},required:!0,autoComplete:"given-name"})})}),l]})})}),ot=e.createContext(null),st=()=>{const e=t.useContext(ot);if(void 0===e)throw new Error("useChannel must be used within a ChannelProvider");return e},lt=e.createContext(null);lt.displayName="ChannelComponentDataContext";const dt=()=>t.useContext(lt),ct=e=>{const{channelOrPair:a,channelData:i,savePaymentMethod:r,formRef:o,customerDetailsFormRef:s}=e,l=t.useRef(null),d=S(),{t:c}=d,u=w(),h=(()=>{const e=t.useContext(y);if(void 0===e)throw new Error("useCustomer must be used within a XenditSessionProvider");return e})(),p=a[0],m=a.length>1,_=oe(a,r),f=_.requires_customer_details&&!h,x=function(e){if(e&&2===e.length)return[e[0],e[1]];return null}(_.instructions),b="OPTIONAL"===u.allow_save_payment_method&&(_.allow_save||m);return t.useLayoutEffect(()=>{x||_.form.length||_.banner||console.error(`Missing display data for ${_.channel_code}, this is a bug, please contact support`)},[x,_.banner,_.channel_code,_.form]),n.jsx(ot.Provider,{value:_,children:n.jsx(lt.Provider,{value:i,children:n.jsxs("div",{className:"xendit-payment-channel",ref:l,children:[n.jsx(Vn,{ref:o,form:_.form,onChannelPropertiesChanged:e=>{let n=e;if("CARDS"===p.channel_code&&e.installment_configuration){const t=Object.fromEntries(Object.entries(e.installment_configuration).filter(([e,n])=>""!==n));n=0===Object.keys(t).length?{...e,installment_configuration:void 0}:{...e,installment_configuration:t}}const t=new XenditChannelPropertiesChangedEvent(p.channel_code,n);l.current?.dispatchEvent(t)}}),f&&n.jsx(rt,{ref:s,onChange:e=>{d?.dispatchEvent(new InternalUpdateChannelComponentData(p.channel_code,{customerDetails:e}))},value:i.customerDetails||{given_names:""}}),_.banner?n.jsx(ht,{banner:_.banner}):null,b&&n.jsx(it,{label:c("payment.save_checkbox_label"),onChange:e=>{const n=e.target?.checked;d?.dispatchEvent(new InternalUpdateChannelComponentData(p.channel_code,{savePaymentMethod:n}))},checked:r}),x?n.jsxs("div",{className:"xendit-payment-channel-instructions",children:[ut[_.pm_type??""]??n.jsx(Hn,{}),n.jsx("div",{className:"xendit-payment-channel-instructions-text xendit-text-12",children:x.map((e,t)=>n.jsx("p",{className:0===t?"xendit-text-semibold":void 0,children:e},t))})]}):null]})})})},ut={EWALLET:n.jsx(Hn,{}),QR_CODE:n.jsx(e=>{const a=t.useRef(null),i=t.useRef(null),r=Q(),o=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{if(o&&a.current){const e=()=>{if(!a.current)return;const n=a.current.animate(Jn,et);setTimeout(()=>{i.current?.animate(tt,at)},1e3),n.onfinish=()=>{const n=a.current?.animate(Jn,nt);setTimeout(()=>{i.current?.animate(tt,at)},500),n&&(n.onfinish=e)}};e()}},[o]),n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"var(--xendit-color-icon-primary)",xmlns:"http://www.w3.org/2000/svg",...e,children:[n.jsxs("g",{"clip-path":`url(#${r})`,children:[n.jsx("rect",{x:"8",y:"8",width:"24",height:"24",fill:"var(--xendit-color-icon-secondary)",ref:i}),n.jsx("path",{d:"M11.5 13.1528C11.5 12.24 12.24 11.5 13.1528 11.5H17.4028C18.3156 11.5 19.0556 12.24 19.0556 13.1528V17.4028C19.0556 18.3156 18.3156 19.0556 17.4028 19.0556H13.1528C12.24 19.0556 11.5 18.3156 11.5 17.4028V13.1528Z"}),n.jsx("path",{d:"M20.9444 13.1528C20.9444 12.24 21.6844 11.5 22.5972 11.5H26.8472C27.76 11.5 28.5 12.24 28.5 13.1528V17.4028C28.5 18.3156 27.76 19.0556 26.8472 19.0556H22.5972C21.6844 19.0556 20.9444 18.3156 20.9444 17.4028V13.1528Z"}),n.jsx("path",{d:"M11.5 22.5972C11.5 21.6844 12.24 20.9444 13.1528 20.9444H17.4028C18.3156 20.9444 19.0556 21.6844 19.0556 22.5972V26.8472C19.0556 27.76 18.3156 28.5 17.4028 28.5H13.1528C12.24 28.5 11.5 27.76 11.5 26.8472V22.5972Z"}),n.jsx("path",{d:"M20.9444 22.5972C20.9444 21.6844 21.6844 20.9444 22.5972 20.9444H26.8472C27.76 20.9444 28.5 21.6844 28.5 22.5972V26.8472C28.5 27.76 27.76 28.5 26.8472 28.5H22.5972C21.6844 28.5 20.9444 27.76 20.9444 26.8472V22.5972Z"}),n.jsx("path",{d:"M7.875 23C8.35825 23 8.75 23.3918 8.75 23.875V30.2754C8.75021 30.6755 9.07451 30.9998 9.47461 31H15.875C16.3582 31 16.75 31.3918 16.75 31.875C16.75 32.3582 16.3582 32.75 15.875 32.75H9.47461C8.10801 32.7498 7.00021 31.642 7 30.2754V23.875C7 23.3918 7.39175 23 7.875 23Z"}),n.jsx("path",{d:"M31.875 23C32.3582 23 32.75 23.3918 32.75 23.875V30.2754C32.7498 31.642 31.642 32.7498 30.2754 32.75H23.875C23.3918 32.75 23 32.3582 23 31.875C23 31.3918 23.3918 31 23.875 31H30.2754C30.6755 30.9998 30.9998 30.6755 31 30.2754V23.875C31 23.3918 31.3918 23 31.875 23Z"}),n.jsx("path",{d:"M15.875 7C16.3582 7 16.75 7.39175 16.75 7.875C16.75 8.35825 16.3582 8.75 15.875 8.75H9.47461C9.07451 8.75021 8.75021 9.07451 8.75 9.47461V15.875C8.75 16.3582 8.35825 16.75 7.875 16.75C7.39175 16.75 7 16.3582 7 15.875V9.47461C7.00021 8.10801 8.10801 7.00021 9.47461 7H15.875Z"}),n.jsx("path",{d:"M30.2754 7C31.642 7.00021 32.7498 8.10801 32.75 9.47461V15.875C32.75 16.3582 32.3582 16.75 31.875 16.75C31.3918 16.75 31 16.3582 31 15.875V9.47461C30.9998 9.07451 30.6755 8.75021 30.2754 8.75H23.875C23.3918 8.75 23 8.35825 23 7.875C23 7.39175 23.3918 7 23.875 7H30.2754Z"}),n.jsx("rect",{x:"3",y:"-4",width:"34",height:"4",rx:"1.75",ref:a})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:r,children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})})]})},{})},ht=e=>{const t="number"==typeof e.banner.aspect_ratio?String(e.banner.aspect_ratio):void 0;return e.banner?.link_url?n.jsx("a",{href:e.banner.link_url,target:"_blank",rel:"noopener noreferrer",children:n.jsx("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:t}})}):n.jsx("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:t}})};class XenditChannelPropertiesChangedEvent extends Event{static type="xendit-channel-properties-changed";channel;channelProperties;constructor(e,n){super(XenditChannelPropertiesChangedEvent.type,{bubbles:!0,composed:!0}),this.channel=e,this.channelProperties=n}}class NetworkError extends Error{errorResponse;constructor(e){super(e.message),this.errorResponse=e}}function pt(e){const n=new URLSearchParams;return n.append("payload",JSON.stringify(e)),n}function mt(e,n,t){return async function(...a){let i,r,o,s,l;switch(e){case"GET":[i,r,o,l]=a;break;case"POST":[i,s,r,o,l]=a;break;default:throw new Error(`Unable to call endpoint with method ${e}; this is a bug, please contact support.`)}const d="v0.0.23";T(d),T(d.startsWith("v"));const c=i.hostId;if(c===K)throw new Error("A network request was made in mock mode; this is a bug.");const u=V(c);if(!u)throw new Error(`Unknown hostId ${c} in sdkKey; this is a bug, please contact support.`);const h=new URL(n(r),u);if(t&&!o)throw new Error("Query string argument is missing; this is a bug, please contact support.");const p=t?.(o)??new URLSearchParams;p.set("components_version",d),h.search=p.toString();const m={method:e,body:s?pt(s):void 0,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:l},_=await fetch(h,m);if(!_.ok){const e=await _.json();if(!e||!e.error_code)throw new Error("Unexpected error response from server");throw new NetworkError(e)}return _.json()}}const _t=mt("GET",e=>`/api/sessions/${e}`),ft=mt("POST",()=>"/api/sessions/payment_tokens"),xt=mt("POST",()=>"/api/sessions/payment_requests"),bt=mt("POST",e=>`/api/sessions/${e.sessionAuthKey}/payment_requests/${e.paymentRequestId}/simulate`),yt=mt("GET",e=>`/api/sessions/${e}/poll`,e=>new URLSearchParams(e?{token_request_id:e}:{})),gt=mt("POST",e=>`/api/sessions/${e}/card_info`),vt=mt("POST",e=>`/api/sessions/${e}/payment_options`);function Ct(e,n,t){return{impl:e,key:n??"",child:t,instance:void 0}}class BehaviorTree{fn;bb;root=Ct(class{});updating=!1;again=!1;constructor(e,n){this.fn=e,this.bb=n}update(){if(this.again=!0,this.updating)return;let e=0;try{for(this.updating=!0;this.again;){this.again=!1,e+=1,kt(e);const n=this.root??void 0,t=this.fn(this.bb);this.root=t,Et(n,t,this.bb,0)}}finally{this.updating=!1}}findBehavior(e){return At(this.root,e)}}function kt(e){if(e>32)throw new Error("Max recursion depth exceeded; this is a bug, please contact support.")}function Et(e,n,t,a){if(kt(a),function(e,n){return void 0===e||void 0===n||Array.isArray(e)!==Array.isArray(n)||(!Array.isArray(e)||!Array.isArray(n))&&(D(e),D(n),e.impl!==n.impl||e.key!==n.key)}(e,n))e&&Nt(e,a+1),n&&wt(n,t,a+1);else if(Array.isArray(e)||Array.isArray(n)){j(e),j(n);const i=Math.max(e.length,n.length);for(let r=0;r<i;r++)Et(e[r],n[r],t,a+1)}else n&&(n.instance=e?.instance),e&&(e.instance=void 0),Et(e?.child,n?.child,t,a+1),n?.instance?.update?.()}function wt(e,n,t){if(kt(t),Array.isArray(e))for(const a of e)a&&wt(a,n,t+1);else e.instance=new e.impl(n,e.key),e.instance.enter?.(),e.child&&wt(e.child,n,t+1)}function Nt(e,n){if(kt(n),Array.isArray(e))for(const t of e)t&&Nt(t,n+1);else e.child&&Nt(e.child,n+1),e.instance?.exit?.(),e.instance=void 0}function At(e,n){if(Array.isArray(e))for(const t of e){if(!t)continue;const e=At(t,n);if(e)return e}else{if(e.impl===n)return e.instance??null;if(e.child)return At(e.child,n)}return null}class ActionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){}}const St=e=>n.jsxs("div",{className:"xendit-redirect-instructions",children:[n.jsx("div",{className:"xendit-redirect-instructions-logo",children:n.jsx("img",{src:e.logoUrl,alt:e.logoAlt})}),n.jsxs("div",{className:"xendit-redirect-instructions-text",children:[n.jsx("div",{className:"xendit-text-16",children:e.title}),e.subtitle?n.jsx("div",{className:"xendit-text-14 xendit-text-secondary",children:e.subtitle}):null]}),e.redirectUrl?n.jsx("a",{href:e.redirectUrl,className:"xendit-redirect-instructions-button xendit-text-14",children:e.redirectButtonLabel??""}):null]}),It=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(St,{title:t("action_deeplink.title"),subtitle:t("action_deeplink.instructions",{channelName:i}),logoUrl:a.brand_logo_url,logoAlt:t("image_alt.channel_logo",{channelName:i}),redirectUrl:e.redirectUrl,redirectButtonLabel:t("action_deeplink.button",{channelName:i})})},Pt=e=>{const{title:a,onClose:i,children:r,seamless:o,borderColor:s,noCloseButton:l}=e,d=t.useRef(!1),c=t.useRef(!1),u=t.useRef(null),h=t.useRef(null),p=void 0!==HTMLElement.prototype.animate,_=t.useCallback(()=>{d.current||(d.current=!0,i())},[i]),f=t.useCallback(()=>{if(!u.current||!h.current||c.current)return;if(c.current=!0,!p)return void _();h.current.animate?.(Dt,Tt);const e=u.current.animate?.(Lt,Tt);e.onfinish=_},[_,p]);t.useLayoutEffect(()=>{p&&(h.current?.animate?.(jt,Rt),u.current?.animate?.(qt,Rt))},[p]),t.useLayoutEffect(()=>{const e=h.current;if(!e)return;const n=e=>{f()};return e.addEventListener(InternalDialogCloseEvent.eventName,n),()=>{e.removeEventListener(InternalDialogCloseEvent.eventName,n)}},[f]);const x=t.useCallback(e=>{e.target?.dispatchEvent(new InternalDialogCloseEvent)},[]);return t.useLayoutEffect(()=>{e.close&&f()},[e.close,f]),n.jsx("div",{className:"xendit-dialog-backdrop",ref:h,children:n.jsxs("div",{className:"xendit-dialog",ref:u,style:s?{border:`4px solid ${s}`}:void 0,children:[l||o?null:n.jsxs("div",{className:"xendit-dialog-header xendit-text-16 xendit-text-semibold",children:[a,n.jsx("button",{"aria-label":"Close",onClick:f,children:n.jsx(m,{name:"x",size:20})})]}),n.jsx("div",{className:"xendit-dialog-body",style:e.noPadding?{padding:"0"}:void 0,children:r}),!l&&o?n.jsx("button",{"aria-label":"Close",onClick:x,className:"xendit-dialog-floating-close",children:n.jsx(m,{name:"x",size:20})}):null]})})};class InternalDialogCloseEvent extends Event{static eventName="xendit-internal-dialog-close";constructor(){super(InternalDialogCloseEvent.eventName,{bubbles:!0})}}const Rt={duration:500,easing:"cubic-bezier(.32,.23,0,.92)",fill:"forwards"},Tt={duration:200,easing:"linear",fill:"forwards"},jt=[{backgroundColor:"rgba(0, 0, 0, 0)"},{backgroundColor:"rgba(0, 0, 0, 0.2)",offset:.1},{backgroundColor:"rgba(0, 0, 0, 0.6)"}],Dt=jt.slice().reverse(),qt=[{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:1,transform:""}],Lt=[{opacity:1,transform:""},{opacity:0,transform:"scale(0.92) translateY(-10px)"}];function Bt(e){const{sdk:a,title:i,onClose:r,width:o,height:s,borderColor:l}=e,d=t.useRef(null);t.useLayoutEffect(()=>{const e=a.createActionContainerComponent(h);return d.current?.replaceChildren(e),()=>{a.destroyComponent(e)}},[a]);const c=e.defaultActionContainerType===Mt.QrWithCustomArt;return n.jsx(Pt,{title:i,onClose:r,close:e.close,borderColor:l,noPadding:c,noCloseButton:c,seamless:!0,children:n.jsx("div",{className:"xendit-default-action-container",ref:d,style:{width:o?`calc(min(100vw - 64px, ${o}px))`:"calc(100vw - 64px)",height:s?`calc(min(100vh - 64px, ${s}px))`:void 0}})})}var Mt;!function(e){e.QrWithCustomArt="qr-with-custom-art",e.Generic="generic"}(Mt||(Mt={}));class ContainerActionBehavior{bb;cleanupFn=null;defaultContainerHeight=0;defaultContainerWidth=400;title="Complete your payment";constructor(e){this.bb=e}ensureHasActionContainer(n=Mt.Generic){if(T(this.bb.channel),this.bb.sdk[h].liveComponents.actionContainer)return()=>{this.emptyActionContainer()};let t=!1,a=!1;const i=document.createElement("div");i.setAttribute("class","xendit-default-action-container");const r={sdk:this.bb.sdk,title:this.title,width:this.defaultContainerWidth,height:this.defaultContainerHeight,borderColor:void 0,defaultActionContainerType:n,onClose:()=>{t=!0,e.render(null,i),i.remove(),a||this.bb.sdk.abortSubmission()}};return e.render(e.createElement(Bt,r),i),document.body.appendChild(i),n=>{n||(a=!0),t||e.render(e.createElement(Bt,{...r,close:!0}),i)}}cleanupActionContainer(e){this.cleanupFn&&(this.cleanupFn(e),this.cleanupFn=null)}emptyActionContainer(){const n=this.bb.sdk[h].liveComponents.actionContainer;n&&e.render(null,n)}updateActionContainerBrandColor(){T(this.bb.channel);const e=this.bb.sdk[h].liveComponents.actionContainer;e&&e.style.setProperty("--xendit-channel-brand-color",this.bb.channel.brand_color)}populateActionContainer(n){const t=this.bb.sdk[h].liveComponents.actionContainer;if(!t)throw new Error("Trying to populate action container, but it is missing; A default action container should have been created. This is a bug, please contact support.");this.updateActionContainerBrandColor(),e.render(n(),t)}exit(){this.cleanupActionContainer(!1),this.emptyActionContainer()}}class ActionDeepLinkBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){T(this.bb.world);const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];if(q(n?.type,"REDIRECT_CUSTOMER"),"DEEPLINK_URL"!==n.descriptor&&"WEB_URL"!==n.descriptor)throw new Error("Unexpected action type in ActionDeepLinkBehavior");const t=this.bb.sdk.t.bind(this.bb.sdk),a=this.bb.channel;T(a),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(It,{t:t,channel:a,redirectUrl:n.value}))}exit(){super.exit()}}const Ot=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(St,{title:t("action_empty_list_push_notification.title"),subtitle:t("action_empty_list_push_notification.subtext",{channelName:i}),logoUrl:a.brand_logo_url,logoAlt:t("image_alt.channel_logo",{channelName:i}),redirectUrl:null,redirectButtonLabel:null})};var Ut;function Kt(e){return"payment_request_id"in e?{id:e.payment_request_id,type:Ut.PaymentRequest,entity:e}:{id:e.payment_token_id,type:Ut.PaymentToken,entity:e}}function Ft(e,n,t){return`${e===Ut.PaymentRequest?"payment_request":"payment_token"}_status.${n.toLowerCase()}.${t}`}!function(e){e.PaymentRequest="REQUEST",e.PaymentToken="TOKEN"}(Ut||(Ut={}));function Vt(e,n,t){const{session:a,paymentEntity:i}=e;switch(T(a),T(i),T(n),t){case"PENDING":return Wt(a);case"PENDING_PAYMENT_ENTITY_ONLY":return function(e,n){const t=n.type===Ut.PaymentRequest?n.entity:void 0,a=n.type===Ut.PaymentToken?n.entity:void 0;return{session:e,payment_request:Xt(t,"PENDING"),payment_token:Xt(a,"PENDING")}}(a,i);case"SUCCESS":return"PENDING"===n._mock_action_type?Wt(a):function(e,n){const t=n.type===Ut.PaymentRequest?n.entity:void 0,a=n.type===Ut.PaymentToken?n.entity:void 0;return{session:{...e,status:"COMPLETED",payment_request_id:t?.payment_request_id,payment_token_id:a?.payment_token_id},payment_request:Xt(t,"SUCCEEDED"),payment_token:Xt(a,"ACTIVE"),succeeded_channel:{channel_code:n.entity.channel_code,logo_url:"https://placehold.co/48"}}}(a,i);case"FAILURE":return function(e,n){const t=n.type===Ut.PaymentRequest?n.entity:void 0,a=n.type===Ut.PaymentToken?n.entity:void 0;return{session:{...e,status:"ACTIVE"},payment_request:Xt(t,"FAILED"),payment_token:Xt(a,"FAILED")}}(a,i)}}function Wt(e){return{session:{...e,status:"PENDING"}}}function Xt(e,n){return e?{...e,status:n}:e}function Gt(e,n){return"PENDING"===n?{payment_request_id:`pr-${Y()}`,status:"PENDING",channel_code:e,actions:[],session_token_request_id:Y()}:n?{payment_request_id:`pr-${Y()}`,status:"REQUIRES_ACTION",channel_code:e,actions:zt(n),session_token_request_id:Y()}:{payment_request_id:`pr-${Y()}`,status:"SUCCEEDED",channel_code:e,actions:[],session_token_request_id:Y()}}function zt(e){if(!e)return[];return(Array.isArray(e)?e:[e]).map(e=>function(e){if("PENDING"===e)throw new Error("PENDING mock action type should not generate an action");switch(e){case"IFRAME":return{type:"REDIRECT_CUSTOMER",descriptor:"WEB_URL",value:"https://example.com/iframe",iframe_capable:!0};case"REDIRECT":return{type:"REDIRECT_CUSTOMER",descriptor:"WEB_URL",value:"https://example.com/redirect",iframe_capable:!1};case"PAYLINK":return{type:"REDIRECT_CUSTOMER",descriptor:"WEB_GOOGLE_PAYLINK",value:"https://example.com/paylink"};case"DEEP_LINK":return{type:"REDIRECT_CUSTOMER",descriptor:"DEEPLINK_URL",value:"mockapp://mock-deep-link"};case"PUSH_NOTIFICATION":return null;case"QR":return{type:"PRESENT_TO_CUSTOMER",descriptor:"QR_STRING",value:"https://example.com/qr-code-data",action_title:"Pay with QR Code",action_subtitle:"Scan the QR code below",action_graphic:"",instructions:null};case"BARCODE":return{type:"PRESENT_TO_CUSTOMER",descriptor:"PAYMENT_CODE",value:"1234567890",action_title:"Pay at a Store",action_subtitle:"Show this barcode to the cashier",action_graphic:"",instructions:null};case"VA":return{type:"PRESENT_TO_CUSTOMER",descriptor:"VIRTUAL_ACCOUNT_NUMBER",value:"1234567890",action_title:"Pay with Virtual Account",action_subtitle:"Protect yourself from fraud - ensure all details are correct",action_graphic:"",instructions:[{title:"Mobile Banking",content:[{type:"text",text:"Open Mobile App"},{type:"text",text:"Select <b>Mock VA</b>, then select <b>Transfer</b>"},{type:"text",text:"Enter your Virtual Account Number, for example 3816523906568, then press <b>OK</b>"},{type:"text",text:"Click on <b>Send</b> button at the top right corner to proceed"},{type:"text",text:"Click <b>OK</b> to proceed"},{type:"text",text:"Enter your PIN to authorize the transaction"}]},{title:"Internet Banking",content:[{type:"text",text:"Login to the website"},{type:"text",text:"Select <b>Transfer</b>, then select <b>Transfer to Mock VA Virtual Account</b>"},{type:"text",text:"Enter the Virtual Account Number, for example 3816523906568"},{type:"text",text:"Select <b>Continue</b> to proceed your payment"}]},{title:"ATM",content:[{type:"text",text:"Insert your ATM card and PIN"},{type:"text",text:"Enter your ATM PIN"},{type:"text",text:"Select <b>Transfer</b>"},{type:"text",text:"Select <b>To Mock VA Virtual Account</b>"},{type:"text",text:"Enter Virtual Account Number, for example 3816523906568. Press <b>Correct</b> to proceed"},{type:"text",text:"Verify Virtual Account details and then enter amount to be transferred and select <b>Correct</b> to confirm"},{type:"text",text:"Confirm your transaction details displayed"},{type:"text",text:"Select <b>Yes</b> if the details are correct or <b>No</b> if the details are not correct"}]}]}}throw new Error(`Unknown mock action type: ${e}`)}(e)).filter(e=>null!==e)}class ActionEmptyListPushNotificationBehavior extends ContainerActionBehavior{bb;constructor(e){super(e),this.bb=e}enter(){T(this.bb.world),this.bb.hackyOvoActionLatch=!0;const n=this.bb.sdk.t.bind(this.bb.sdk),t=this.bb.channel;T(t),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(Ot,{t:n,channel:t})),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Vt(this.bb.world,this.bb.channel,"PENDING_PAYMENT_ENTITY_ONLY")))}exit(){this.bb.hackyOvoActionLatch=void 0,super.exit()}}function Ht(e){const{url:a,channelCode:i,mock:r,onIframeComplete:o}=e,s=t.useRef(null),l=t.useCallback(e=>{if(!s.current)return;const n=s.current.contentWindow;e.source===n&&"xendit-iframe-action-complete"===e.data?.type&&o(e.data)},[o]);if(t.useLayoutEffect(()=>(window.addEventListener("message",l),()=>{window.removeEventListener("message",l)}),[l]),r){const e=$t("CARDS"===i?"a 3DS authentication page":"an authentication page");return n.jsx("iframe",{ref:s,srcDoc:e,className:"xendit-action-iframe"})}return n.jsx("iframe",{ref:s,src:a,className:"xendit-action-iframe"})}const $t=e=>`\n <html>\n <head>\n <title>Xendit Mock Action Iframe</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n font-size: 14px;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 12px;\n }\n p {\n margin: 0;\n }\n .buttons {\n display: flex;\n gap: 8px;\n }\n button {\n font-size: 12px;\n display: flex;\n align-items: center;\n text-align: left;\n background-color: white;\n border: 1px solid rgba(243, 243, 243);\n border-radius: 4px;\n justify-content: space-between;\n padding: 4px;\n cursor: pointer;\n }\n button:hover {\n border-color: #1762ee;\n background-color: #1762ee;\n color: white;\n }\n </style>\n </head>\n <body>\n <p>This is a mock action page.</p>\n <p>Normally, this would be ${e}.</p>\n <p>Click a button below to simulate the result of the action.</p>\n <div class="buttons">\n <button onclick="parent.postMessage({type: 'xendit-iframe-action-complete', mockStatus: 'success'}, '*')">\n Simulate Success\n </button>\n <button onclick="parent.postMessage({type: 'xendit-iframe-action-complete', mockStatus: 'fail'}, '*')">\n Simulate Failure\n </button>\n </div>\n </body>\n </html>\n`;class ActionIframeBehavior extends ContainerActionBehavior{bb;url;constructor(e,n){super(e),this.bb=e,this.url=n,this.defaultContainerHeight=600}enter(){this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>(T(this.bb.channel),e.createElement(Ht,{url:this.url,channelCode:this.bb.channel.channel_code,mock:this.bb.mock,onIframeComplete:e=>{this.cleanupActionContainer(!1);const n="success"===e.mockStatus?"SUCCESS":"FAILURE";this.updateMocksOnIframeCompletion(n),this.bb.actionCompleted=!0,this.bb.pollImmediatelyRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}})))}updateMocksOnIframeCompletion(e){T(this.bb.world?.paymentEntity),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Vt(this.bb.world,this.bb.channel,e)))}exit(){super.exit()}}const Yt={format:"CODE128",renderer:"svg",width:2,height:132,displayValue:!0,fontOptions:"",font:"Roboto",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:14,background:"#ffffff",lineColor:"#000000",margin:8},Qt=({instructions:e})=>{switch(e.length){case 0:return null;case 1:return n.jsx(Zt,{instruction:e[0]});default:return n.jsx(Jt,{instructions:e})}},Zt=e=>n.jsxs("div",{children:[n.jsx("p",{className:"xendit-instructions-single-tab-heading",children:e.instruction.title}),n.jsx(ea,{instruction:e.instruction})]}),Jt=e=>{const[i,r]=t.useState(0);return n.jsxs("div",{children:[n.jsx("div",{className:"xendit-instructions-tab-list",children:e.instructions.map((e,t)=>n.jsx("button",{className:a("xendit-instructions-tab-button",{"xendit-instructions-active-tab":i===t}),onClick:()=>r(t),children:e.title},t))}),n.jsx(ea,{instruction:e.instructions[i]})]})},ea=t=>n.jsx("ol",{className:"xendit-instructions-numbered-list","data-testid":"instructions-steps",children:t.instruction.content.map((t,a)=>{const i=Array.isArray(t)?t:[t];return n.jsx("li",{className:"xendit-instructions-step-li",children:n.jsx("div",{className:"xendit-instructions-step-box",children:i.map((t,a)=>n.jsx(e.Fragment,{children:ia(t)},a))})},a)})});function na(e){return Array.from(e).map((e,t)=>{switch(e.nodeType){case Node.TEXT_NODE:return null===e.textContent?null:e.textContent;case Node.ELEMENT_NODE:return function(e,t){const i=a({"xendit-instructions-bold":"B"===e.nodeName,"xendit-instructions-italics":"I"===e.nodeName});return i?n.jsx("span",{className:i,children:na(e.childNodes)},t):na(e.childNodes)}(e,t);default:return null}})}const ta="undefined"!=typeof DOMParser?new DOMParser:null;function aa(e){try{if(!ta)return e;return na(ta.parseFromString(e,"text/html").body.childNodes)}catch(n){return e}}function ia(e){if("string"==typeof e)return n.jsx("p",{className:"xendit-instructions-step-item",children:aa(e)});switch(e.type){case"text":return function(e){return n.jsx("p",{children:aa(e.text)})}(e);case"image":return function(e){return n.jsx("div",{children:n.jsx("img",{src:e.src,alt:e.alt||"",style:{height:`${e.height??24}px`}})})}(e);case"bullets":return function(e){return n.jsx("ul",{className:"xendit-instructions-bullet-list",children:e.items.map((e,t)=>n.jsx("li",{children:aa(e)},t))})}(e);case"form":return function(e){return n.jsxs("div",{className:"xendit-instructions-form-card",children:[e.heading?n.jsx("h3",{className:"xendit-instructions-form-heading",children:aa(e.heading)}):null,e.fields.map((e,t)=>n.jsxs("div",{className:"xendit-instructions-form-field",children:[n.jsx("div",{className:"xendit-instructions-form-field-label",children:aa(e.label)}),n.jsx("div",{className:"xendit-instructions-form-field-value",children:aa(e.value)})]},t))]})}(e);case"table":return function(e){return n.jsxs("table",{className:"xendit-instructions-table",children:[n.jsx("thead",{children:n.jsx("tr",{children:e.headers.map((e,t)=>n.jsx("th",{className:"xendit-instructions-table-header",children:aa(e)},t))})}),n.jsx("tbody",{children:e.rows.map((e,t)=>n.jsx("tr",{children:e.map((e,t)=>n.jsx("td",{className:"xendit-instructions-table-cell",children:aa(e)},t))},t))})]})}(e)}return null}function ra(e){const{amount:a,channelLogo:i,currency:r,onAffirm:o,barcodeContent:s,merchantName:d,instructions:c,title:u,t:h}=e,[p,m]=t.useState(!1),_=t.useCallback(()=>{m(!0),o()},[o]),f=[{heading:h("action_barcode.merchant_name"),value:d},{heading:h("action_barcode.barcode_content"),value:s},{heading:h("action_barcode.amount_to_pay"),value:xn(a,r)}],x=t.useMemo(()=>{try{return function(e){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");return l(n,e,Yt),n}(s)}catch(e){console.log("Error generating barcode SVG:",e);const n=document.createElement("div");return n.innerText=h("action_barcode.unable_to_generate"),n}},[s,h]);return n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:i,alt:"Channel Logo",className:"xendit-action-barcode-channel-logo"}),n.jsx("div",{className:"xendit-action-title",children:u}),n.jsx("div",{"data-testid":"barcode",className:"xendit-action-barcode-barcode-container",role:"button",tabIndex:0,ref:e=>{!e||1===e.childNodes.length&&e.firstChild===x||e?.replaceChildren(x)}}),n.jsx("div",{className:"xendit-action-barcode-content",children:n.jsx("div",{className:"xendit-action-barcode-details",children:f.map((e,t)=>n.jsx("div",{className:"xendit-action-barcode-detail-item",children:n.jsxs("div",{className:"xendit-action-barcode-detail-content",children:[n.jsx("div",{className:"xendit-action-barcode-heading xendit-text-12 xendit-text-semibold",children:e.heading}),n.jsx("div",{className:"xendit-action-barcode-value xendit-text-semibold",children:e.value})]})},t))})}),n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(pe,{variant:ue.WHITE_ROUNDED,disabled:p,onClick:_,className:"xendit-button-block",children:p?n.jsx(me,{}):h("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:h("action.payment_confirmation_instructions")})]}),n.jsx(Qt,{instructions:c})]})}class ActionBarcodeBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];q(n?.type,"PRESENT_TO_CUSTOMER"),T(this.bb.world),T(this.bb.channel);const t={amount:this.bb.world.session.amount,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,onAffirm:this.affirmPayment.bind(this),barcodeContent:n.value,merchantName:this.bb.world.business.name??"",paymentCode:n.value,instructions:n.instructions??[],title:n.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(ra,t))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class ActionPaylinkBehavior{bb;actionIndex;el=null;constructor(e,n){this.bb=e,this.actionIndex=n}enter(){T(this.bb.world),T(this.bb.world.paymentEntity);const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];if(!e)throw new Error("Action not found for paylink behavior");q(e.type,"REDIRECT_CUSTOMER"),q(e.descriptor,"WEB_GOOGLE_PAYLINK");const n=document.createElement("link");n.rel="facilitated-payment",n.href=e.value,this.el=n,document.head.appendChild(n)}exit(){this.el?.remove(),this.el=null}}const oa={"00":{name:"payloadFormatIndicator",type:"numeric"},"01":{name:"pointOfInitiationMethod",type:"numeric"},52:{name:"merchantCategoryCode",type:"numeric"},53:{name:"transactionCurrency",type:"numeric"},54:{name:"transactionAmount",type:"ans"},55:{name:"tipOrConvenienceIndicator",type:"numeric"},56:{name:"valueOfConvenienceFeeFixed",type:"ans"},57:{name:"valueOfConvenienceFeePercentage",type:"ans"},58:{name:"countryCode",type:"ans"},59:{name:"merchantName",type:"ans"},60:{name:"merchantCity",type:"ans"},61:{name:"postalCode",type:"ans"},62:{name:"additionalData",type:"template",templateClass:{"01":{name:"billNumber",type:"ans"},"02":{name:"mobileNumber",type:"ans"},"03":{name:"storeLabel",type:"ans"},"04":{name:"loyaltyNumber",type:"ans"},"05":{name:"referenceLabel",type:"ans"},"06":{name:"customerLabel",type:"ans"},"07":{name:"terminalLabel",type:"ans"},"08":{name:"purposeOfTransaction",type:"ans"},"09":{name:"additionalConsumerDataRequest",type:"ans"}}},63:{name:"crc",type:"ans"},64:{name:"language",type:"template",templateClass:{"00":{name:"languagePreference",type:"ans"},"01":{name:"merchantNameAlternateLanguage",type:"string"},"02":{name:"merchantCityAlternateLanguage",type:"string"}}}},sa={"ID.CO.QRIS.WWW":{"00":{name:"globallyUniqueIdentifier",type:"string"},"02":{name:"nmid",type:"ans"},"03":{name:"businessType",type:"ans"}},"ID.DANA.WWW":{"00":{name:"globallyUniqueIdentifier",type:"string"},"01":{name:"merchantId",type:"ans"},"02":{name:"storeOrTerminalId",type:"ans"},"03":{name:"additionalIdentifier",type:"ans"}},"SG.SGQR":{"00":{name:"globallyUniqueIdentifier",type:"string"},"01":{name:"sgqrNumber",type:"ans"},"02":{name:"version",type:"ans"},"03":{name:"postalCode",type:"ans"},"04":{name:"level",type:"ans"},"05":{name:"unit",type:"ans"},"06":{name:"misc",type:"ans"},"07":{name:"revisionDate",type:"ans"}},"SG.PAYNOW":{"00":{name:"globallyUniqueIdentifier",type:"string"},"01":{name:"type",type:"numeric"},"02":{name:"identifier",type:"ans"},"03":{name:"editable",type:"numeric"}},"ph.ppmi.p2m":{"00":{name:"globallyUniqueIdentifier",type:"string"},"01":{name:"acquirerId",type:"ans"},"03":{name:"merchantId",type:"ans"},"05":{name:"notifyFlags",type:"numeric"}}};function la(e){return/^[\uD800-\uDBFF]$/.test(e)}function da(e){const n=new Set,t=[];for(;e.length;){const a=e.substring(0,2);if(!/^\d{2}$/.test(a))throw new Error("Invalid EMVCo QR string, invalid tag");if(n.has(a))throw new Error(`Duplicate tag ${a} in EMVCo QR string`);n.add(a);const i=e.substring(2,4);if(!/^\d{2}$/.test(i))throw new Error("Invalid EMVCo QR string, invalid length");const r=parseInt(i,10);if(!r)throw new Error(`Invalid EMVCo QR string, expected length but got ${i}`);let o="",s=0,l=0;for(;l<r;){const n=e.substring(4+s,5+s);if(""===n)throw new Error("Invalid EMVCo QR string, unexpected end of string");o+=n,s+=1,la(n)?l+=.5:l+=1}t.push({key:a,value:o}),e=e.substring(4+s)}return t}function ca(e,n,t,a){e[`field${t}`]=a;const i=n[t];if(!i)return;const r="template"===i.type&&i.templateClass?ua(i.templateClass,a).result:a;e[i.name]=r}function ua(e,n){const t=da(n),a={};for(const{key:n,value:i}of t)ca(a,e,n,i);return{result:a,raw:t}}function ha(e,n,t){const a=da(t),i=a.find(({key:e})=>"00"===e)?.value;if(!i)throw new Error(`Missing field 00 in merchant account information template for field ${n}`);const r=sa[i];return r&&(e[i]=ua(r,t).result),e}function pa(e){return"QRIS"===e?ma:"SGQR"===e?_a:"DUITNOW_QR"===e?fa:"PROMPTPAY"===e?xa:"QRPH"===e?ba:null}function ma(e){const{channelLogo:t,channelName:a,merchantName:i,amountText:r,t:o,nmid:s}=e,l="#DB4849",d="24px";return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:d,paddingRight:d,overflow:"hidden"},children:[ga.closeButton({}),n.jsx("img",{src:t,alt:o("image_alt.channel_logo",{channelName:a}),style:{height:"64px",alignSelf:"center"}}),n.jsxs("div",{className:"xendit-text-center xendit-text-16",style:{display:"flex",flexDirection:"column",gap:"4px",marginTop:"16px"},children:[n.jsx("div",{className:"xendit-text-semibold",children:i}),s?n.jsxs("div",{className:"xendit-text-14",children:["NMID: ",s]}):null]}),n.jsxs("div",{style:{position:"relative",margin:`-${d}`,marginBottom:"0",padding:d},children:[n.jsxs("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:[e.qr,n.jsx("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:d},children:r})]}),n.jsx("svg",{style:{position:"absolute",top:"-9%",left:0,width:"60%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:n.jsx("polygon",{fill:l,points:"0,0 50,50 0,100"})}),n.jsx("svg",{style:{position:"absolute",bottom:0,right:0,width:"30%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:n.jsx("polygon",{fill:l,points:"0,100 100,100 100,0"})})]})]})}function _a(e){const{merchantName:t,amountText:a,channelLogo:i,channelName:r,t:o}=e;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:"24px",paddingRight:"24px",overflow:"hidden"},children:[n.jsx("img",{src:i,alt:o("image_alt.channel_logo",{channelName:r}),style:{height:"56px",alignSelf:"center",marginBottom:"8px"}}),ga.closeButton({}),n.jsx("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:n.jsx("div",{style:{"--xendit-qr-foreground-color":"#7C2279"},children:e.qr})}),n.jsx("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),n.jsx("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:a}),n.jsx("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px",marginBottom:"16px"},children:t})]})}function fa(e){const{merchantName:t,amountText:a}=e,i="#ED3066";return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"40px",overflow:"hidden"},children:[ga.closeButton({}),n.jsx("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),n.jsx("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:a}),n.jsx("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px"},children:t}),n.jsxs("svg",{viewBox:"0 0 180 180",style:{aspectRatio:"1",margin:"32px 14% 24px"},children:[n.jsx("rect",{width:"180",height:"180",fill:i,rx:13}),n.jsx("rect",{x:"10",y:"10",width:"160",height:"140",fill:"white",rx:4}),n.jsx("path",{d:"M0 180 L20 180 L0 160 Z",fill:i}),n.jsx("path",{d:"M10 150 L30 150 L10 130 Z",fill:"white"}),n.jsx("foreignObject",{x:"40",y:"30",width:"100",height:"100",children:n.jsx("div",{style:{"--xendit-qr-foreground-color":i},children:e.qr})}),n.jsx("foreignObject",{x:"0",y:"160",height:"10px",width:"180px",style:{overflow:"visible"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",height:"10px"},children:ga.malaysiaNationalQrText({width:"auto"})})})]})]})}function xa(e){const{merchantName:t,amountText:a,channelLogo:i,channelName:r,t:o}=e;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",overflow:"hidden"},children:[n.jsxs("div",{style:{backgroundColor:"#1C3C63",padding:"8px",height:"64px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"},children:[ga.promptpay({height:"48px"}),ga.closeButton({color:"white"})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"0 16px"},children:[n.jsx("img",{src:i,alt:o("image_alt.channel_logo",{channelName:r}),style:{height:"56px",alignSelf:"center",marginTop:"16px"}}),n.jsx("div",{style:{padding:"16px 42px"},children:e.qr}),n.jsxs("div",{className:"xendit-text-center xendit-text-semibold",style:{fontSize:"20px",lineHeight:"24px",marginBottom:"12px",display:"flex",flexDirection:"column",gap:"8px"},children:[a,n.jsx("div",{className:"xendit-text-16",children:t})]})]})]})}function ba(e){const{merchantName:t,amountText:a,channelLogo:i,channelName:r,t:o}=e;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:"24px",paddingRight:"24px",paddingBottom:"12px",overflow:"hidden"},children:[n.jsx("img",{src:i,alt:o("image_alt.channel_logo",{channelName:r}),style:{height:"48px",alignSelf:"center",marginBottom:"16px"}}),ga.closeButton({}),n.jsxs("div",{style:{backgroundColor:"white",border:"4px solid rgb(0,0,0,0.15)",zIndex:1,position:"relative",borderRadius:"12px",display:"flex",flexDirection:"column",gap:"16px",padding:"24px"},children:[n.jsxs("div",{className:"xendit-text-center",style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsx("div",{className:"xendit-text-semibold",style:{fontSize:"20px",lineHeight:"28px"},children:t}),n.jsx("div",{className:"xendit-text-bold",style:{fontSize:"24px",lineHeight:"32px"},children:a})]}),n.jsxs("div",{style:{position:"relative"},children:[e.qr,ga.qrph({position:"absolute",top:"50%",left:"50%",width:"12%",height:"12%",aspectRatio:"1",transform:"translate(-50%, -50%)",zIndex:"3",backgroundColor:"white",padding:"8px",borderRadius:"6px"})]})]})]})}function ya(e){e.target?.dispatchEvent(new InternalDialogCloseEvent)}const ga={closeButton:e=>n.jsx("button",{"aria-label":"Close",onClick:ya,className:"xendit-dialog-floating-close",style:e,children:n.jsx(m,{name:"x",size:20})}),sgqr:e=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"83",height:"40",fill:"none",style:e,children:n.jsx("path",{fill:"#FD0031",d:"M18.395 39.983c-1.224-.14-2.626-.38-3.422-.587-3.582-.931-6.767-2.787-9.275-5.403-2.74-2.858-4.46-6.15-5.268-10.084C.174 22.663 0 21.206 0 20.11c0-1.08.183-2.682.33-3.479.426-2.313 1.002-4.05 1.922-5.793 2.09-3.962 5.07-6.896 8.903-8.768C15.535-.069 20.427-.564 25.188.65c.627.16 1.23.33 1.339.378.109.049.466.189.793.311 1.247.468 4.159 2.023 4.066 2.173-.022.036.02.066.093.066.149 0 .554.297 1.143.838.215.197.408.343.428.323.085-.085 1.9 1.72 2.529 2.515.833 1.051 1.838 2.587 2.344 3.583 1.04 2.045 1.845 4.59 1.99 6.29.034.381.078.827.099.99.301 2.344-.09 5.848-.936 8.368-.52 1.549-1.374 3.302-2.212 4.541-3.84 5.68-9.678 8.864-16.436 8.966-.955.014-1.87.011-2.033-.008m-3.521-11.997a4.97 4.97 0 0 0 2.763-2.024c.525-.767.739-1.481.747-2.498.006-.77-.029-.97-.26-1.464-.625-1.341-1.287-1.932-2.865-2.556-.537-.213-1.018-.387-1.068-.387-.193 0-2.957-.924-3.333-1.114-.519-.262-.864-.535-1.013-.8-.285-.508-.048-1.383.475-1.756.386-.274.82-.588 1.777-.588.68 0 1.93.388 3.025.94 1.057.53 1.241.621 1.339.469.023-.036.182-.319.404-.614.59-.783.897-1.342.832-1.512-.085-.22-.783-.692-1.713-1.16-1.789-.901-4.057-1.193-5.523-.71-1.955.642-3.242 1.871-3.68 3.513-.284 1.066-.054 2.359.603 3.384.707 1.104 1.445 1.467 5.606 2.76 1.291.402 1.656.595 2.01 1.066.822 1.092.13 2.172-1.585 2.47-.81.141-1.74.052-2.655-.255-.72-.241-1.972-.906-2.464-1.308-.154-.127-.335-.23-.401-.23-.097 0-1.142 1.204-1.599 1.843-.146.204.02.414.795 1 .693.525 1.724 1.069 2.591 1.368 1.351.467 3.915.547 5.192.163m13.686.177c1.398-.22 3.134-.984 4.219-1.856l.59-.475.082-.739c.09-.818.026-5.764-.078-5.93-.043-.072-1.146-.106-3.381-.106h-3.317l-.01.619c-.006.34-.028.94-.05 1.331-.024.447.002.737.07.779.059.036.928.06 1.931.05l1.824-.016-.019 1.267c-.021 1.454.04 1.345-1.068 1.891-.412.185-1.417.367-2.231.367-1.306 0-1.558-.027-2.061-.223-.742-.288-1.009-.457-1.592-1.008-.946-.893-1.469-2.297-1.468-3.943 0-1.703.476-2.94 1.52-3.95 1.032-.997 1.761-1.267 3.403-1.262 1.36.005 2.474.36 3.674 1.174.203.138.42.25.48.249.176-.003 1.647-1.844 1.647-2.062 0-.57-2.065-1.734-3.818-2.153-.966-.231-1.233-.256-2.33-.213-.924.035-1.405.103-1.885.266-2.384.811-4.35 2.497-5.259 4.51-.562 1.243-.798 3.178-.597 4.897.233 2.004 1.233 3.701 2.976 5.05.813.63 2.018 1.195 2.979 1.397.96.203 2.775.245 3.769.089m26.951-.466c-.28-.26-.638-.613-.794-.787-.304-.338-.413-.34-.89-.01-.82.568-2.916 1.168-4.076 1.168-1.205 0-3.068-.358-4.134-.95-1.996-1.107-3.6-3.424-3.882-5.96-.421-3.777 1.39-6.944 4.74-8.292 1.087-.438 2.055-.643 3.01-.636 2.095.015 4.211.768 5.616 2 .712.624 1.63 2.082 2.015 3.2.249.723.501 2.097.501 2.73 0 1.134-.536 3.078-1.147 4.157-.187.33-.34.64-.34.687s.279.316.62.598c.999.825 1 .828.322 1.665-.513.634-.805.9-.99.9-.033 0-.29-.212-.57-.47m-3.984-2.258c.727-.362.805-.61.32-1.01-.18-.15-.641-.564-1.023-.922-.863-.809-.804-.931-.554-1.218.144-.165.835-.956.941-1.084.242-.29.67-.002 2.108 1.398.607.592.783.546 1.223-.317.327-.643.352-1.452.384-1.827.023-.269-.013-1.368-.085-1.694-.65-2.936-3.836-4.965-6.546-4.167-1.22.359-2.147.982-2.857 1.92-.874 1.156-1.161 2.046-1.155 3.579.006 1.816.463 2.952 1.676 4.167 1.241 1.243 2.006 1.542 3.833 1.496 1.043-.026 1.204-.056 1.735-.321m8.396 2.254-1.017-.028V12.423l1.711-.002c2.44-.002 6.251.191 7.066.358 1.721.352 2.764 1.24 3.381 2.877.264.699.322 1.883.133 2.702-.157.68-.635 1.63-1.05 2.089-.432.478-1.36 1.107-1.985 1.345-.236.09-.43.224-.43.3 0 .074.211.435.469.803.257.367.788 1.135 1.18 1.707.678.99 1.064 1.533 1.808 2.536.182.247.312.468.288.492-.071.071-2.179.136-2.52.077-.278-.048-.507-.332-2.08-2.579-.974-1.388-1.84-2.562-1.928-2.609-.14-.075-1.422-.117-3.092-.1l-.57.005v2.612c0 2.409-.014 2.616-.174 2.649-.095.02-.63.024-1.19.008m7.165-7.829c.69-.327 1.353-.996 1.544-1.558.337-.987-.015-2.293-.78-2.897-.694-.547-1.127-.627-3.838-.716-1.364-.044-2.515-.044-2.56 0-.06.059-.114 3.938-.073 5.28.004.16.194.173 2.559.173h2.553z"})}),promptpay:e=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"158",height:"48",fill:"none",style:e,children:[n.jsx("title",{children:"Thai QR Payment"}),n.jsx("path",{fill:"#fff",d:"M66.998 27.875h5.312s2.406.204 3.508 1.709c.744 1.015.904 3.592 0 4.825-1.315 1.792-3.508 1.91-3.508 1.91h-2.806v5.93h-2.506zm7.016 4.121c.013-2.277-4.51-1.81-4.51-1.81v3.62s4.495.606 4.51-1.81m1.904 10.253 5.713-14.374h1.804l5.712 14.374h-2.806l-1.203-3.317h-5.211l-1.203 3.317zm8.419-5.428-1.804-5.026-1.804 5.026zm8.72-.2-5.313-8.746h3.107l3.458 5.93 3.458-5.93h3.106l-5.311 8.745v5.63h-2.506zm9.721-8.746h3.508l3.758 10.052 3.758-10.052h3.508v14.374h-2.505V31.795l-3.609 9.148h-2.305l-3.608-9.148V42.25h-2.505zm18.14 0h9.521v2.312h-6.815v3.82h6.414v2.11h-6.414v3.82h6.815v2.313h-9.521zm12.728 14.374V27.875h2.506l5.913 9.851v-9.851h2.506v14.374h-2.506l-5.913-9.85v9.85zm17.339-12.062h-4.41v-2.312h11.426v2.312h-4.41v12.062h-2.606zm-12.199-8.746s-1.371 1.096-4.538 1.125c-4.245-.098-6.073-2.265-7.306-5.755-.933-3.267-.053-9.45 5.368-10.801.12-.03 4.794-1.17 7.856 2.077 3.438 3.814 2.405 10.02.687 11.663-.01.038 2.014 2.208 2.014 2.208l-1.65 1.762zm-2.033-2.122-2.073-2.009 1.746-1.777 2.139 2.021s.849-.739.826-3.423c-.017-1.88-.617-3.54-1.654-4.431-1.354-1.163-3.965-1.431-5.62-.578-1.409.725-2.225 2.063-2.493 4.084-.395 2.711.753 5.79 3.552 6.645 1.247.358 2.568.315 3.577-.532m9.02 2.926V6.061h5.012s1.956-.045 3.107.503c2.368 1.127 2.895 2.537 2.906 4.272.003 3.071-2.906 4.071-2.906 4.071l4.109 7.338h-3.213l-4.003-6.835h-1.905v6.835zm7.065-9.55c1.231-.51 1.773-2.837-.186-3.719-.864-.389-3.772-.301-3.772-.301v4.322s3.204.242 3.958-.301m-80.829-4.02h-5.011V6.06h13.03v2.614h-5.012v13.57h-3.007zM82.432 6.06h2.807v6.635h7.216V6.06h2.806v16.184h-2.806v-6.634h-7.216v6.634h-2.807zm21.749 0h2.105l6.514 16.184h-3.207l-1.503-3.418h-5.713l-1.504 3.418h-3.207zm3.107 9.952-2.055-5.529-2.054 5.529zm7.817-9.952h2.907v16.184h-2.907s.025-16.184 0-16.184"}),n.jsx("path",{fill:"#fff",stroke:"#00427a","stroke-width":".879",d:"M12.552 47.472s-5.185-.205-8.519-3.518S.525 35.41.525 35.41V12.59s.221-5.224 3.508-8.544 8.52-3.518 8.52-3.518h22.85s5.209.163 8.519 3.518 3.508 8.545 3.508 8.545v20.708l14.332 14.173z"}),n.jsx("path",{fill:"#00a796",d:"M26.602 42.245v-8.544h2.37c2.781 0 3.153-.15 3.766-.957.603-.792.873-1.295.88-3.645.002-1.204 0-2.435 0-2.435l14.799 15.581z"}),n.jsx("path",{fill:"#00427a",d:"M10.598 41.825c-2.198-.713-3.83-2.34-4.576-4.563-.281-.838-.315-1.102-.268-5.371.02-1.786.042-5.282 0-5.227h8.519v2.379c0 2.564.1 2.887.85 3.698.661.714 1.243.96 3.553.96h2.613v8.544h-5.045c-4.33 0-4.998-.21-5.646-.42M5.754 18.499c0-4.572.018-6.837.247-7.65.614-2.182 2.227-3.908 4.402-4.714.756-.28 1.048-.38 5.774-.38h5.111v8.544h-2.485c-2.594 0-2.899.105-3.676.886-.748.753-.745 1.127-.854 3.745v2.406h-8.52zm27.862 2.837s.006-1.225 0-2.726c-.01-2.47-.478-2.923-.959-3.427-.48-.505-.668-.874-3.35-.884-.943-.003-2.707 0-2.707 0V5.755h4.25c2.453 0 4.771.063 5.313.145 1.34.204 2.72.892 3.682 1.839.921.906 1.816 2.611 2.017 3.846.073.443.274 2.04.273 3.552-.003 2.768 0 6.199 0 6.199z"})]}),malaysiaNationalQrText:e=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"209",height:"19",fill:"none",viewBox:"0 0 209 19",style:e,children:[n.jsx("title",{children:"Malaysia National QR"}),n.jsx("path",{fill:"#fff",d:"M1.16 14.58q-.56 0-.86-.32t-.3-.88V1.36Q0 .78.32.48.64.16 1.2.16q.5 0 .78.2.3.18.54.64l4.94 9.14h-.64L11.76 1q.24-.46.52-.64.28-.2.78-.2.56 0 .86.32.3.3.3.88v12.02q0 .56-.3.88-.28.32-.86.32-.56 0-.86-.32t-.3-.88V4.12h.44l-4.2 7.66a1.6 1.6 0 0 1-.42.5q-.22.16-.6.16t-.62-.16a1.6 1.6 0 0 1-.42-.5L1.84 4.1h.48v9.28q0 .56-.3.88-.28.32-.86.32m19.643.04q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m11.558 0q-1.66 0-2.5-.94-.84-.96-.84-2.8V1.42q0-.62.32-.94t.92-.32.92.32q.34.32.34.94v9.34q0 .92.38 1.36.4.44 1.12.44h.3l.28-.04q.28-.04.38.16.1.18.1.76 0 .5-.2.78-.201.28-.66.34l-.42.04q-.22.02-.44.02m6.766 0q-1.06 0-1.9-.4a3.45 3.45 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m10.6 3.56q-.44 0-.72-.24a.91.91 0 0 1-.34-.6q-.04-.38.14-.8l1.36-3.02v1.04l-3.64-8.42q-.18-.44-.12-.82a.89.89 0 0 1 .36-.6q.32-.24.86-.24.46 0 .74.22.28.2.5.78l2.7 6.74h-.6l2.76-6.76q.22-.56.52-.76.3-.22.8-.22.44 0 .7.24.26.22.32.6.06.36-.14.8l-4.86 11.1q-.26.56-.56.76t-.78.2m11.932-3.56a10 10 0 0 1-1.82-.18 5.4 5.4 0 0 1-1.72-.62 1.26 1.26 0 0 1-.46-.46 1.14 1.14 0 0 1-.1-.54 1 1 0 0 1 .2-.48.83.83 0 0 1 .44-.26q.28-.06.6.1a7.3 7.3 0 0 0 1.5.54q.7.14 1.38.14.96 0 1.42-.32.48-.34.48-.88 0-.46-.32-.7-.3-.26-.92-.38l-2-.38q-1.24-.24-1.9-.9-.64-.68-.64-1.74 0-.96.52-1.66.54-.7 1.48-1.08t2.16-.38q.88 0 1.64.2.78.18 1.5.58.3.16.4.42.12.26.06.54-.06.26-.24.48a.84.84 0 0 1-.46.26q-.26.04-.6-.12a5.4 5.4 0 0 0-1.2-.46 4.5 4.5 0 0 0-1.08-.14q-.98 0-1.46.34-.46.34-.46.9 0 .42.28.7t.86.38l2 .38q1.3.24 1.96.88.68.64.68 1.72 0 1.46-1.14 2.3-1.14.82-3.04.82m7.926-.06q-.6 0-.92-.36t-.32-1V5.86q0-.66.32-1 .32-.36.92-.36t.92.36q.34.34.34 1v7.34q0 .64-.32 1t-.94.36m0-11.92q-.7 0-1.1-.34-.38-.36-.38-.98 0-.64.38-.98.4-.34 1.1-.34.72 0 1.1.34t.38.98q0 .62-.38.98-.38.34-1.1.34m7.578 11.98q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.24 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.58 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.159-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m15.587-.04q-.58 0-.9-.32-.3-.32-.3-.92V1.44q0-.62.3-.94.32-.34.82-.34.46 0 .68.18.24.16.56.56l7.66 9.94h-.52V1.38q0-.58.3-.9.32-.32.9-.32t.88.32.3.9v12q0 .56-.28.88t-.76.32q-.46 0-.74-.18-.26-.18-.58-.58l-7.64-9.94h.5v9.46q0 .6-.3.92t-.88.32m17.241.04q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.24 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.58 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.76.76 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.159-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44.94.44 1.4 1.34.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m12.697 0q-1.3 0-2.18-.44-.86-.44-1.28-1.28-.42-.86-.42-2.12V6.52h-1.04q-.48 0-.74-.24-.26-.26-.26-.7 0-.46.26-.7t.74-.24h1.04V2.82q0-.62.32-.94.34-.32.94-.32t.92.32.32.94v1.82h2.12q.48 0 .74.24t.26.7q0 .44-.26.7-.26.24-.74.24h-2.12v4.12q0 .96.42 1.44t1.36.48q.34 0 .6-.06t.46-.08q.24-.02.4.16.16.16.16.68 0 .4-.14.72-.12.3-.46.42-.26.08-.68.14-.42.08-.74.08m5.19-.06q-.6 0-.92-.36t-.32-1V5.86q0-.66.32-1 .32-.36.92-.36t.92.36q.34.34.34 1v7.34q0 .64-.32 1t-.94.36m0-11.92q-.7 0-1.1-.34-.38-.36-.38-.98 0-.64.38-.98.4-.34 1.1-.34.72 0 1.1.34t.38.98q0 .62-.38.98-.38.34-1.1.34m8.818 11.98q-1.521 0-2.64-.62a4.33 4.33 0 0 1-1.74-1.76q-.62-1.16-.62-2.72 0-1.18.34-2.1a4.5 4.5 0 0 1 1.02-1.6q.66-.68 1.58-1.02.92-.36 2.06-.36 1.52 0 2.64.62 1.119.62 1.74 1.76.62 1.14.62 2.7 0 1.18-.36 2.12a4.5 4.5 0 0 1-1 1.62q-.66.66-1.58 1.02-.92.34-2.06.34m0-1.9q.74 0 1.3-.36t.86-1.06q.32-.72.32-1.78 0-1.6-.68-2.38-.681-.8-1.8-.8-.74 0-1.3.36-.56.34-.88 1.06-.3.7-.3 1.76 0 1.58.68 2.4.68.8 1.8.8m8.803 1.86q-.6 0-.92-.32-.32-.34-.32-.96V5.74q0-.62.32-.94t.9-.32.9.32.32.94V7.1l-.22-.5q.44-1.06 1.36-1.6.94-.56 2.12-.56t1.94.44 1.14 1.34q.38.88.38 2.24v4.84q0 .62-.32.96-.32.32-.92.32t-.94-.32q-.32-.34-.32-.96V8.58q0-1.14-.44-1.66-.42-.52-1.32-.52-1.1 0-1.76.7-.64.68-.64 1.82v4.38q0 1.28-1.26 1.28m14.179.04q-1.06 0-1.9-.4a3.45 3.45 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.06 1.06 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44.94.44 1.4 1.34.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16a2.8 2.8 0 0 1-.56 1.22 2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m11.558 0q-1.66 0-2.5-.94-.84-.96-.84-2.8V1.42q0-.62.32-.94t.92-.32.92.32q.34.32.34.94v9.34q0 .92.38 1.36.4.44 1.12.44h.3l.28-.04q.28-.04.38.16.1.18.1.76 0 .5-.2.78-.201.28-.66.34l-.42.04a5 5 0 0 1-.44.02m21.436 2.06q.28.44.22.8t-.32.6a1.13 1.13 0 0 1-.64.32 1.25 1.25 0 0 1-.76-.08q-.38-.14-.64-.56l-1.38-2.22a1.84 1.84 0 0 0-.76-.7q-.46-.22-1.14-.22l1.98-.78q.94 0 1.5.34.56.32 1.08 1.14zm-5.4-2.06q-2.04 0-3.58-.9-1.52-.9-2.36-2.52-.84-1.64-.84-3.84 0-1.66.48-2.98.48-1.34 1.36-2.28a5.9 5.9 0 0 1 2.14-1.46q1.26-.52 2.8-.52 2.06 0 3.58.9 1.52.88 2.36 2.5t.84 3.82q0 1.66-.48 3a6.5 6.5 0 0 1-1.38 2.3 5.9 5.9 0 0 1-2.14 1.48q-1.24.5-2.78.5m0-2.2q1.3 0 2.2-.6.92-.6 1.4-1.74.5-1.14.5-2.72 0-2.4-1.08-3.72-1.06-1.32-3.02-1.32-1.28 0-2.2.6-.92.58-1.42 1.72-.48 1.12-.48 2.72 0 2.38 1.08 3.72t3.02 1.34m11.163 2.16q-.62 0-.96-.34-.32-.36-.32-.98V1.62q0-.64.34-.96.34-.34.96-.34h4.82q2.32 0 3.58 1.12 1.26 1.1 1.26 3.1 0 1.3-.58 2.24-.56.94-1.64 1.44t-2.62.5l.18-.3h.66q.82 0 1.42.4.621.4 1.08 1.26l1.5 2.78q.24.42.22.82a.93.93 0 0 1-.3.66q-.28.24-.82.24t-.88-.22q-.339-.24-.6-.72l-2.02-3.72q-.36-.68-.86-.9-.48-.24-1.24-.24h-1.9v4.48q0 .62-.32.98-.32.34-.96.34m1.28-7.7h3.12q1.38 0 2.08-.56.72-.58.72-1.72 0-1.12-.72-1.68-.7-.58-2.08-.58h-3.12z"})]}),qrph:e=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",style:e,children:[n.jsx("path",{fill:"#f4ea11",d:"M21.394 32.393c5.599 0 10.137-4.553 10.137-10.17 0-5.615-4.538-10.168-10.137-10.168s-10.138 4.553-10.138 10.169 4.539 10.169 10.138 10.169"}),n.jsx("path",{fill:"#1f4485","fill-rule":"evenodd",d:"m23.73.545 5.235 3.8-5.236 3.799C21.811 8.085 12.962 8.12 9.4 8.136a1.545 1.545 0 0 0-1.54 1.501c-.12 3.68-.401 13.243-.284 18.174H0V7.138C0 .88 6.239.545 6.239.545z","clip-rule":"evenodd"}),n.jsx("path",{fill:"#cf2130","fill-rule":"evenodd",d:"M35.649 16.636h7.13V35.41c-.42 4.05-3.48 6.964-7.13 8.046H20.052l-5.347-3.8 5.347-3.352s9.29-.002 13.815-.447q1.177-.51 1.336-1.788a171 171 0 0 0 .446-17.432","clip-rule":"evenodd"})]})};function va(e,n){const t=d.create(e),a=c.render(t,{margin:n.margin}),i=(new DOMParser).parseFromString(a,"image/svg+xml").documentElement;i.style.width="100%",i.style.height="100%",i.setAttribute("width",String(t.modules.size+2*n.margin)),i.setAttribute("height",String(t.modules.size+2*n.margin));const r=i.querySelector("[stroke]");r?.setAttribute("stroke",n.colors[0]);const o=i.querySelector("[fill]");return o?.setAttribute("fill",n.colors[1]),i}function Ca(){const e=new Date;return new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",day:"2-digit",month:"2-digit",year:"numeric"}).format(e)}function ka(e){return e.split("").map(e=>/[a-zA-Z0-9]/.test(e)?e.toLowerCase():"-").join("").replace(/-+/g,"-")}function Ea(e){const{amount:a,businessName:i,channelCodeForQrArt:r,channelName:o,channelLogo:s,currency:l,onAffirm:d,qrString:c,t:u}=e,[h,p]=t.useState(!1),m=t.useCallback(()=>{p(!0),d()},[d]),_=t.useMemo(()=>{try{return va(c,wa)}catch(e){console.log("Error generating QR code SVG:",e);const n=document.createElement("div");return n.innerText=u("action_qr.unable_to_generate"),n}},[c,u]),f=t.useMemo(()=>{try{const e=function(e){const{result:n,raw:t}=ua(oa,e);n.merchantAccountInformation={};for(const e of t){const t=Number(e.key);t>=26&&t<=51&&ha(n.merchantAccountInformation,e.key,e.value)}return n}(c).merchantAccountInformation;if(!e||"string"==typeof e)return;const n=e["ID.CO.QRIS.WWW"];if(!n||"string"==typeof n)return;const t=n.nmid;return"string"==typeof t?t:void 0}catch{return}},[c]),x=t.useRef(!1),b=t.useCallback(e=>{if(e instanceof PointerEvent&&"touch"!==e.pointerType)return;if(x.current)return;e.currentTarget.animate?.([{transform:"scale(1)"},{transform:"scale(0.95)"},{transform:"scale(1)"}],{duration:150,easing:"ease-in-out"});const n=va(c,Na),t=[ka(i),ka(o),ka(l),ka(String(a)),ka(Ca())].join("-");x.current=!0,async function(e,n){if(!window.URL?.createObjectURL)throw new Error("Browser doesn't support URL.createObjectURL");if(!window.Blob)throw new Error("Browser doesn't support Blob");if(!document.createElement)throw new Error("Browser doesn't support createElement");const t=(new XMLSerializer).serializeToString(e),a=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(a),r=new Image;return r.src=i,new Promise((e,t)=>{r.onload=function(){let a=r.naturalWidth,o=r.naturalHeight;if(0!==a)for(;a<256;)a*=2,o*=2;document.body.appendChild(r);const s=document.createElement("canvas");s.width=a,s.height=o;const l=s.getContext("2d");if(!l)return t(new Error("Failed to get canvas context"));l.drawImage(r,0,0,a,o),URL.revokeObjectURL(i);const d=s.toDataURL("image/png"),c=document.createElement("a");c.href=d,c.download=n,document.body.appendChild(c),c.click(),document.body.removeChild(c),r.remove(),e()},r.onerror=function(e){URL.revokeObjectURL(i),t(new Error("Failed to generate image"))}})}(n,`${t}.png`).catch(e=>{console.error("Error downloading QR code:",e)})},[a,i,o,l,c]);if(e.hideUi)return n.jsx("div",{"data-testid":"qr-code",ref:e=>{!e||1===e.childNodes.length&&e.firstChild===_||e?.replaceChildren(_)}});const y=n.jsx("div",{"data-testid":"qr-code",className:"xendit-action-qr-qrcode-container",role:"button",tabIndex:0,onClick:b,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b(e))},ref:e=>{!e||1===e.childNodes.length&&e.firstChild===_||e?.replaceChildren(_)}}),g=n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(pe,{variant:ue.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(me,{}):u("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:u("action.payment_confirmation_instructions")})]}),v=xn(a,l),C=pa(r);return C?n.jsxs(n.Fragment,{children:[n.jsx(C,{channelLogo:s,channelName:o,merchantName:i,amountText:v,qr:y,t:u,nmid:f}),n.jsx("div",{style:{padding:"48px",paddingTop:"8px",paddingBottom:"24px"},children:g})]}):n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:s,alt:u("image_alt.channel_logo",{channelName:o}),className:"xendit-action-qr-channel-logo"}),n.jsxs("div",{className:"xendit-action-qr-content",children:[n.jsx("div",{className:"xendit-text-16 xendit-text-center xendit-qr-merchant-info",children:n.jsx("div",{className:"xendit-text-semibold",children:i})}),y,n.jsx("div",{className:"xendit-text-16 xendit-text-semibold xendit-text-center",children:v})]}),g]})}const wa={margin:0,colors:["var(--xendit-qr-foreground-color)","var(--xendit-qr-background-color)"]},Na={margin:2,colors:["#000","#FFF"]};class ActionQrBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];q(n?.type,"PRESENT_TO_CUSTOMER"),T(this.bb.world),T(this.bb.channel),T(this.bb.world.paymentEntity);let t=this.bb.channel.channel_code;this.bb.mock&&"string"==typeof this.bb.channelProperties?.mock_channel_code_for_qr_art&&(t=this.bb.channelProperties.mock_channel_code_for_qr_art);const a=null!==pa(t);const i=this.bb.sdk[h].liveComponents.actionContainer,r={amount:this.bb.world.session.amount,businessName:this.bb.world.business.name??"",channelCodeForQrArt:t,channelName:this.bb.channel.brand_name,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,hideUi:"true"===i?.getAttribute("data-qr-code-only")||!1,onAffirm:this.affirmPayment.bind(this),qrString:n.value,title:n.action_subtitle,t:this.bb.sdk.t.bind(this.bb.sdk)},o=a?Mt.QrWithCustomArt:Mt.Generic;this.cleanupFn=this.ensureHasActionContainer(o),this.populateActionContainer(()=>e.createElement(Ea,r))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}exit(){super.exit()}}class ActionRedirectBehavior{bb;url;constructor(e,n){this.bb=e,this.url=n}enter(){this.bb.dispatchEvent(new XenditWillRedirectEvent),window.location.href=this.url}}const Aa=e.createContext({fire:()=>{},clear:()=>{},text:""}),Sa=({children:e})=>{const[a,i]=t.useState(""),r=t.useCallback(e=>{i(e);const n=setTimeout(()=>{i("")},2e3);return()=>clearTimeout(n)},[]),o=t.useCallback(()=>{i("")},[]);return n.jsx(Aa.Provider,{value:{text:a,fire:r,clear:o},children:n.jsx("div",{style:{position:"relative"},children:e})})},Ia=()=>{const{text:e,clear:a}=t.useContext(Aa);return t.useLayoutEffect(()=>{if(e){const e=()=>{a()};return document.body.addEventListener("mousedown",e),()=>{document.body.removeEventListener("mousedown",e)}}},[a,e]),e?n.jsx("div",{className:"xendit-tooltip",children:e}):null};function Pa(e){const{amount:a,channelLogo:i,currency:r,onAffirm:o,vaNumber:s,merchantName:l,instructions:d,title:c,t:u}=e,[h,p]=t.useState(!1),m=t.useCallback(()=>{p(!0),o()},[o]),_=[{heading:u("action_va.merchant_name"),value:l},{heading:u("action_va.virtual_account_number"),value:s,enableCopy:!0},{heading:u("action_va.amount_to_pay"),value:xn(a,r),enableCopy:!0}];return n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:i,alt:"Channel Logo",className:"xendit-action-qr-channel-logo"}),n.jsx("div",{className:"xendit-action-title",children:c}),n.jsx("div",{className:"xendit-action-va-content",children:n.jsx("div",{className:"xendit-action-va-details",children:_.map((e,t)=>n.jsxs("div",{className:"xendit-action-va-detail-item",children:[n.jsxs("div",{className:"xendit-action-va-detail-content",children:[n.jsx("div",{className:"xendit-action-va-heading xendit-text-12 xendit-text-semibold",children:e.heading}),n.jsx("div",{className:"xendit-action-va-value xendit-text-semibold",children:e.value})]}),e.enableCopy?n.jsxs(Sa,{children:[n.jsx(Ra,{value:e.value,t:u}),n.jsx(Ia,{})]}):null]},t))})}),n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(pe,{variant:ue.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(me,{}):u("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:u("action.payment_confirmation_instructions")})]}),n.jsx(Qt,{instructions:d})]})}const Ra=({value:e,t:a})=>{const{fire:i}=t.useContext(Aa);return n.jsxs(pe,{variant:ue.WHITE_ROUNDED,size:he.SM,onClick:()=>{navigator.clipboard.writeText(e),i(a("action_va.copied_to_clipboard"))},children:[a("action_va.copy"),n.jsx(m,{name:"copy",size:16})]})};class ActionVaBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const n=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];q(n?.type,"PRESENT_TO_CUSTOMER"),T(this.bb.world),T(this.bb.channel);const t={amount:this.bb.world.session.amount,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,onAffirm:this.affirmPayment.bind(this),vaNumber:n.value,merchantName:this.bb.world.business.name??"",instructions:n.instructions??[],title:n.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>e.createElement(Pa,t))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class CardInfoBehavior{bb;channelCode;cardDetailsRequest=null;constructor(e,n){this.bb=e,this.channelCode=n}enter(){this.lookupCardDetails()}update(){this.lookupCardDetails()}exit(){this.abortLookupCardDetails()}abortLookupCardDetails(){this.cardDetailsRequest&&(this.cardDetailsRequest.abortController.abort(new AbortError),this.cardDetailsRequest=null)}lookupCardDetails(){const e=te(this.bb.channelProperties);if(!e)return;if(this.cardDetailsRequest?.cardNumber===e)return;if(this.bb.channelData?.cardDetails?.cardNumber===e)return;this.cardDetailsRequest&&this.abortLookupCardDetails();const n=new AbortController,t=M(300,n.signal).then(()=>{if(this.bb.mock){const n=ae(e).cipherText;try{return JSON.parse(atob(n))}catch{}return{schemes:["VISA"],country_codes:["ID"],require_billing_information:!1}}{const t=ae(e).withoutValidationError;return gt(this.bb.sdkKey,{card_number:t},this.bb.sdkKey.sessionAuthKey,void 0,n.signal)}}).then(n=>{this.bb.dispatchEvent(new InternalUpdateChannelComponentData(this.channelCode,{cardDetails:{cardNumber:e,details:n}}))}).catch(e=>{if(!B(e))throw e});this.cardDetailsRequest={cardNumber:e,promise:t,abortController:n}}}class ChannelInvalidBehavior{bb;channelCode;constructor(e,n){this.bb=e,this.channelCode=n}enter(){}}class ChannelValidBehavior{bb;lastChannelCode=null;constructor(e){this.bb=e}enter(){this.sendReadyEventIfChanged()}update(){this.sendReadyEventIfChanged()}sendReadyEventIfChanged(){const e=this.bb.channel?.channel_code??null;e&&e!==this.lastChannelCode&&(this.bb.dispatchEvent(new XenditReadyEvent(e)),this.lastChannelCode=e)}exit(){this.bb.dispatchEvent(new XenditNotReadyEvent)}}class PaymentEntityFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.submissionRequested=!1,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class PollWorker{sdkKey;sdk;sessionTokenRequestId;onPollResult;started=!1;stopped=!1;constructor(e,n,t,a){this.sdkKey=e,this.sdk=n,this.sessionTokenRequestId=t,this.onPollResult=a}async start(){if(this.stopped)throw new Error("PollWorker has been stopped, make a new instance instead of calling start again");this.started=!0;for await(const e of async function*(e,n,t=2){yield 0;let a=e;for(let e=1;e<n;e++)a*=t,await L(a),yield e}(5e3,100,1.06)){if(this.stopped)return;let e;if(this.sdk.isMock()){if(!(this.sdk instanceof XenditComponentsTest&&this.sdk.nextMockUpdate))continue;await L(R),e=this.sdk.nextMockUpdate,this.sdk.nextMockUpdate=null}else try{e=await yt(this.sdkKey,this.sdkKey.sessionAuthKey,this.sessionTokenRequestId)}catch(e){continue}if(this.stopped)return;if(!e.session)throw new Error("Session is not defined");let n=null;e.payment_token?n=Kt(e.payment_token):e.payment_request&&(n=Kt(e.payment_request)),this.onPollResult(e,n),await L(1)}}isPolling(){return this.started&&!this.stopped}stop(){this.started=!1,this.stopped=!0}}class PaymentEntityPendingBehavior{bb;pollWorker;constructor(e){this.bb=e,this.pollWorker=new PollWorker(this.bb.sdkKey,this.bb.sdk,this.bb.world?.sessionTokenRequestId??null,this.onPollResult)}enter(){if(this.bb.mock)switch(T(this.bb.world?.paymentEntity),this.bb.world?.paymentEntity.entity.status){case"ACTIVE":case"AUTHORIZED":case"SUCCEEDED":case"PENDING":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Vt(this.bb.world,this.bb.channel,"SUCCESS")));break;case"FAILED":case"CANCELED":case"EXPIRED":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Vt(this.bb.world,this.bb.channel,"FAILURE")))}this.pollWorker.start()}exit(){this.pollWorker.stop()}onPollResult=(e,n)=>{this.bb.dispatchEvent(new InternalUpdateWorldState({session:e.session,paymentEntity:n??void 0,succeededChannel:e.succeeded_channel??null}))}}class PaymentEntityRequiresActionBehavior{bb;pollWorker=null;canCreateActionContainer=!0;constructor(e){this.bb=e,this.resetPolling()}enter(){this.bb.dispatchEvent(new XenditActionBeginEvent),this.canCreateActionContainer=!1,this.pollWorker?.start()}update(){this.bb.pollImmediatelyRequested&&(this.bb.pollImmediatelyRequested=!1,this.resetPolling())}exit(){this.pollWorker?.stop(),this.bb.dispatchEvent(new XenditActionEndEvent),this.bb.actionCompleted=!1}onPollResult=(e,n)=>{this.bb.dispatchEvent(new InternalUpdateWorldState({session:e.session,paymentEntity:n??void 0,succeededChannel:e.succeeded_channel??null}))};resetPolling(){const e=this.pollWorker?.isPolling()??!1;this.pollWorker?.stop(),this.pollWorker=new PollWorker(this.bb.sdkKey,this.bb.sdk,this.bb.world?.sessionTokenRequestId??null,this.onPollResult),e&&this.pollWorker.start()}}class PaymentOptionsBehavior{bb;channelCode;paymentOptionsRequest=null;constructor(e,n){this.bb=e,this.channelCode=n}enter(){this.lookupPaymentOptions()}update(){this.lookupPaymentOptions()}exit(){this.abortLookupPaymentOptions()}abortLookupPaymentOptions(){this.paymentOptionsRequest&&(this.paymentOptionsRequest.abortController.abort(new AbortError),this.paymentOptionsRequest=null)}lookupPaymentOptions(){let e;if(T(this.bb.world),T(this.bb.channel),ce(this.bb.channel.form,"credit_card_number")){if(e=te(this.bb.channelProperties)??void 0,!e)return;if(this.paymentOptionsRequest?.cardNumber===e)return;if((this.bb.channelData?.paymentOptions?.cardNumber??null)===e)return;if(e){if(!ae(e).valid)return}}else if(this.paymentOptionsRequest||this.bb.channelData?.paymentOptions)return;this.paymentOptionsRequest&&this.abortLookupPaymentOptions();const n=new AbortController,t=async function(e,n,t,a,i,r){if(r)return M(R,i).then(()=>function(e,n){return{channel_code:e,country:n.country,currency:n.currency,amount:n.amount,installment_plans:[{interval:"MONTH",interval_count:1,terms:3,installment_amount:Math.floor(n.amount/3),total_amount:n.amount,description:"Unused",code:"3M",interest_rate:1},{interval:"MONTH",interval_count:1,terms:6,installment_amount:Math.floor(n.amount/6),total_amount:n.amount,description:"Unused",code:"6M",interest_rate:1},{interval:"MONTH",interval_count:1,terms:9,installment_amount:Math.floor(n.amount/9),total_amount:n.amount,description:"Unused",interest_rate:1,code:void 0}]}}(t,n));return vt(e,{channel_code:t,channel_properties:a?{card_number:a}:void 0},e.sessionAuthKey,null,i)}(this.bb.sdkKey,this.bb.world.session,this.bb.channel.channel_code,e,n.signal,this.bb.mock).then(n=>{this.bb.dispatchEvent(new InternalUpdateChannelComponentData(this.channelCode,{paymentOptions:{cardNumber:e??null,options:n}}))}).catch(e=>{if(!B(e))throw e});this.paymentOptionsRequest={cardNumber:e??void 0,promise:t,abortController:n}}}class SdkActiveBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditInitEvent),this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}exit(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}}class SdkFatalErrorBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditFatalErrorEvent(this.bb.sdkFatalErrorMessage??"Unknown error"))}}class SdkLoadingBehavior{bb;constructor(e){this.bb=e}enter(){}}class SessionActiveBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}exit(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}}class SessionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionCompleteEvent(this.bb.world?.succeededChannel?.channel_code||null))}}class SessionFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionExpiredOrCanceledEvent)}}function Ta(e,n){switch(e.type){case Ut.PaymentRequest:n(new XenditPaymentRequestDiscardedEvent(e.id));break;case Ut.PaymentToken:n(new XenditPaymentTokenDiscardedEvent(e.id))}n(new InternalUpdateWorldState({paymentEntity:null,sessionTokenRequestId:null}))}class SessionPendingBehavior{bb;pollWorker;constructor(e){this.bb=e,this.pollWorker=new PollWorker(this.bb.sdkKey,this.bb.sdk,this.bb.world?.sessionTokenRequestId??null,this.onPollResult)}enter(){this.pollWorker.start(),this.bb.dispatchEvent(new XenditSessionPendingEvent)}exit(){this.pollWorker.stop(),T(this.bb.world?.session);const e=this.bb.world.paymentEntity;"COMPLETED"!==this.bb.world.session.status&&e&&Ta(e,this.bb.dispatchEvent),this.bb.dispatchEvent(new XenditSessionNotPendingEvent)}onPollResult=(e,n)=>{this.bb.dispatchEvent(new InternalUpdateWorldState({session:e.session,paymentEntity:n??void 0,succeededChannel:e.succeeded_channel??null}))}}class SimulatePaymentBehavior{bb;exited=!1;simulationRequest=null;constructor(e){this.bb=e}enter(){this.simulatePayment()}exit(){this.exited=!0,this.bb.simulatePaymentRequested=!1,this.abortSimulation()}abortSimulation(){this.simulationRequest&&(this.simulationRequest.abortController.abort(new AbortError),this.simulationRequest=null)}simulatePayment(){if(this.simulationRequest&&this.abortSimulation(),!this.bb.channel)throw new Error("Channel is missing");if(!this.bb.world)throw new Error("Invalid state");if(!this.bb.world.paymentEntity)throw new Error("Payment entity is missing");if(this.bb.world.paymentEntity.type!==Ut.PaymentRequest)throw new Error("Payment entity is not a payment request");const e=this.bb.world?.paymentEntity.id,n=new AbortController,t=async function(e,n,t,a,i){return n?(await M(R,i),Gt(t.channel_code,t._mock_action_type)):await bt(e,{channel_code:t.channel_code},{sessionAuthKey:e.sessionAuthKey,paymentRequestId:a},void 0,i)}(this.bb.sdkKey,this.bb.mock,this.bb.channel,e,n.signal).then(()=>{this.bb.mock&&this.bb.world&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Vt(this.bb.world,this.bb.channel,"SUCCESS"))),this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}).catch(e=>{B(e)||this.exited||(this.bb.simulatePaymentRequested=!1,console.error("Simulate Payment failed:",e))});this.simulationRequest={promise:t,abortController:n}}}class SubmissionBehavior{bb;exited=!1;submission=null;submissionError=null;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSubmissionBeginEvent),this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(null)),this.submit()}exit(){this.exited=!0,T(this.bb.world?.session);const e=this.bb.sdk.t,n=this.bb.world.paymentEntity;let t,a,i;var r;"COMPLETED"!==this.bb.world.session.status&&"PENDING"!==this.bb.world.session.status&&n&&Ta(n,this.bb.dispatchEvent),"ACTIVE"!==this.bb.world.session.status?t=`SESSION_${this.bb.world.session.status}`:!n||"FAILED"!==n.entity.status&&"CANCELED"!==n.entity.status&&"EXPIRED"!==n.entity.status?this.submissionError?(t="REQUEST_FAILED",!("message"in(r=this.submissionError))&&"text"in r&&"code"in r?(a=this.submissionError.text,i={type:"ERROR",code:this.submissionError.code}):(a=function(e){return[e("default_error.title"),e("default_error.message_1"),e("default_error.message_2")]}(e),i={type:"NETWORK_ERROR",code:"NETWORK_ERROR"})):t=this.submission?"REQUEST_ABORTED":"ACTION_ABORTED":(t=`PAYMENT_${n.type}_${n.entity.status}`,a=function(e,n,t,a){const i=e(Ft(n,t,"title")),r=a?e(function(e){return`failure_code.${e.toLowerCase()}`}(a),e("failure_code_unknown",{failureCode:a})):e(Ft(n,t,"subtext"));return[i,r]}(e,n.type,n.entity.status,n.entity.failure_code),i={type:"FAILURE",code:n.entity.failure_code??"UNKNOWN"}),this.bb.dispatchEvent(new XenditSubmissionEndEvent(t,a,i)),this.submission&&(this.submission?.abortController.abort(new AbortError),this.submission=null),this.bb.submissionRequested=!1,this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}submit(){if(!this.bb.world?.session)throw new Error("Session object missing");if(!this.bb.channel)throw new Error("Channel missing");if(this.bb.instantSubmissionError)return this.bb.submissionRequested=!1,this.submissionError=this.bb.instantSubmissionError,this.bb.instantSubmissionError=null,void this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent);const e="OPTIONAL"===this.bb.world.session.allow_save_payment_method&&this.bb.channel?.allow_save,n=this.bb.channel?.requires_customer_details&&!this.bb.world.customer,t=this.bb.world?.session?.session_type,a=this.bb.channel.channel_code,i=this.bb.channel._mock_action_type,r=this.bb.channelProperties??{},o=new AbortController,s=async function(e,n,t,a,i,r,o,s,l){let d;if(n)switch(t){case"PAY":await M(R,o.signal),d=Gt(a,i);break;case"SAVE":case"SUBSCRIPTION":await M(R,o.signal),d=function(e,n){return"PENDING"===n?{payment_token_id:`pt-${Y()}`,status:"PENDING",channel_code:e,actions:zt(n),session_token_request_id:Y()}:n?{payment_token_id:`pt-${Y()}`,status:"REQUIRES_ACTION",channel_code:e,actions:zt(n),session_token_request_id:Y()}:{payment_token_id:`pt-${Y()}`,status:"ACTIVE",channel_code:e,actions:[],session_token_request_id:Y()}}(a,i);break;default:throw new Error(`The session type ${t} is not supported.`)}else switch(t){case"PAY":d=await xt(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r,save_payment_method:s,customer:l},null,null,o.signal);break;case"SAVE":case"SUBSCRIPTION":d=await ft(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r},null,null,o.signal);break;default:throw new Error(`The session type ${t} is not supported.`)}return Kt(d)}(this.bb.sdkKey,this.bb.mock,t,a,i,r,o,e?this.bb.channelData?.savePaymentMethod??!1:void 0,n?this.bb.channelData?.customerDetails??{given_names:""}:void 0).then(e=>{switch(this.submission=null,e.type){case Ut.PaymentRequest:this.bb.dispatchEvent(new XenditPaymentRequestCreatedEvent(e.id));break;case Ut.PaymentToken:this.bb.dispatchEvent(new XenditPaymentTokenCreatedEvent(e.id))}this.bb.dispatchEvent(new InternalUpdateWorldState({paymentEntity:e,sessionTokenRequestId:e.entity.session_token_request_id}))}).catch(e=>{B(e)||(console.error("Submission failed:",e),this.exited||(this.bb.submissionRequested=!1,this.submissionError=e instanceof NetworkError?{text:[e.errorResponse.error_content?.title,e.errorResponse.error_content?.message_1,e.errorResponse.error_content?.message_2].filter(e=>void 0!==e),code:e.errorResponse.error_code}:e,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)))});this.submission={abortController:o,promise:s}}}function ja(e){switch(e.sdkStatus){case"LOADING":return Ct(SdkLoadingBehavior);case"ACTIVE":return Ct(SdkActiveBehavior,"active",function(e){switch(T(e.world?.session),e.world.session.status){case"ACTIVE":return Ct(SessionActiveBehavior,"active",e.submissionRequested?function(e){return T(e.world),Ct(SubmissionBehavior,"submission",e.world.paymentEntity&&null!==e.world.sessionTokenRequestId?function(e){function n(){return T(e.world?.paymentEntity),U(e.sdk,e.world.paymentEntity.entity.actions)?function(e){T(e.world?.paymentEntity);const n=U(e.sdk,e.world.paymentEntity.entity.actions);T(n);const t=e.world.paymentEntity.entity.actions.indexOf(n);return Ct(ActionPaylinkBehavior,String(t))}(e):void 0}if(T(e.world?.paymentEntity),e.hackyOvoActionLatch&&"PENDING"===e.world.paymentEntity.entity.status)return Ct(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[Ct(ActionEmptyListPushNotificationBehavior,""),n()]);switch(e.world.paymentEntity.entity.status){case"PENDING":return Ct(PaymentEntityPendingBehavior);case"REQUIRES_ACTION":return Ct(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[Da(e),n()]);case"FAILED":case"EXPIRED":case"CANCELED":return Ct(PaymentEntityFailedBehavior);case"ACCEPTING_PAYMENTS":throw new Error("Status ACCEPTING_PAYMENTS should not happen");case"AUTHORIZED":case"ACTIVE":case"SUCCEEDED":return Ct(PaymentEntityPendingBehavior,e.world.paymentEntity.id);default:throw e.world.paymentEntity.entity,new Error(`Unknown payment entity status: ${e.world.paymentEntity.entity.status}`)}}(e):void 0)}(e):function(e){if(!e.channel||!e.world?.session)return;if(e.channelIsDigitalWallet)return;const n=function(e,n,t,a){t||(t={});for(const i of zn(e,n.form,t,a))if(wn(i,t))return!1;const i=n.card?.brands,r=a?.cardDetails?.details?.schemes;if(i?.length&&r?.length){const e=i.map(e=>e.name);if(!r.some(n=>e.includes(n)))return!1}return!0}(e.world.session.session_type,e.channel,e.channelProperties,e.channelData),t=e.channel.requires_customer_details&&!e.world.customer;let a=!0;t&&(a=0!==e.channelData?.customerDetails?.given_names?.trim().length);const i=Ct(n&&a?ChannelValidBehavior:ChannelInvalidBehavior),r=ce(e.channel.form,"credit_card_number")?Ct(CardInfoBehavior,e.channel.channel_code):void 0,o=ce(e.channel.form,"installment_plan")?Ct(PaymentOptionsBehavior,e.channel.channel_code):void 0;return[i,r,o]}(e));case"COMPLETED":return Ct(SessionCompletedBehavior);case"EXPIRED":case"CANCELED":return Ct(SessionFailedBehavior,e.world.session.status);case"PENDING":return Ct(SessionPendingBehavior,e.world.session.status);default:throw e.world.session.status,new Error(`Unknown session status: ${e.world.session.status}`)}}(e));case"FATAL_ERROR":return Ct(SdkFatalErrorBehavior);default:throw e.sdkStatus,new Error(`Unknown SDK status: ${e.sdkStatus}`)}}function Da(e){if(T(e.world?.paymentEntity),e.actionCompleted)return Ct(ActionCompletedBehavior);const n=O(e.world.paymentEntity.entity.actions);if(!n)return Ct(ActionEmptyListPushNotificationBehavior,"");const t=e.world.paymentEntity.entity.actions.indexOf(n),a=!!U(e.sdk,e.world.paymentEntity.entity.actions);let i;switch(e.simulatePaymentRequested&&Z(n)&&(i=Ct(SimulatePaymentBehavior)),n.type){case"REDIRECT_CUSTOMER":switch(n.descriptor){case"WEB_URL":return function(e){return"REDIRECT_CUSTOMER"===e.type&&!1!==e.iframe_capable}(n)?Ct(ActionIframeBehavior,n.value):a?Ct(ActionDeepLinkBehavior,String(t)):Ct(ActionRedirectBehavior,n.value);case"DEEPLINK_URL":return Ct(ActionDeepLinkBehavior,String(t));case"WEB_GOOGLE_PAYLINK":throw new Error("Paylink actions should not be the primary action")}break;case"PRESENT_TO_CUSTOMER":switch(n.descriptor){case"QR_STRING":return Ct(ActionQrBehavior,String(t),i);case"PAYMENT_CODE":return Ct(ActionBarcodeBehavior,String(t),i);case"VIRTUAL_ACCOUNT_NUMBER":return Ct(ActionVaBehavior,String(t),i)}break;case"API_POST_REQUEST":switch(n.descriptor){case"CAPTURE_PAYMENT":case"VALIDATE_OTP":case"RESEND_OTP":throw new Error(`Unsupported action type ${n.type} ${n.descriptor}`)}}throw new Error(`Unknown action type: ${n.type} ${n.descriptor}`)}class XenditComponents extends EventTarget{t=e=>{throw new Error("Localization used before initialization; this is a bug.")};[h];constructor(e){if(super(),"undefined"==typeof window||"undefined"==typeof document)throw new Error("XenditComponents can only be instantiated in a browser");if("null"===window.location.origin)throw new Error("XenditComponents cannot be used when the page origin is null");const n=function(e){if(!e)throw new Error("The componentsSdkKey option is missing; check the constructor parameters.");const n=e.split("-");if(n.length<4||n[2]!==K&&null===V(n[2]))throw new Error("The componentsSdkKey option has the wrong format. Ensure you pass the value returned from the `components_sdk_key` property of the `POST /sessions` response.");return{sessionAuthKey:[n[0],n[1]].join("-"),hostId:n[2],publicKey:n[3],signature:n[4]}}(e.componentsSdkKey);this[h]={sdkKey:n,options:e,worldState:null,liveComponents:{channelPicker:null,paymentChannels:new Map,actionContainer:null,digitalWalletContainer:new Map},behaviorTree:new BehaviorTree(ja,{sdk:this,sdkKey:n,mock:this.isMock(),sdkStatus:"LOADING",sdkFatalErrorMessage:null,channel:null,channelProperties:null,channelData:null,channelIsDigitalWallet:!1,instantSubmissionError:null,dispatchEvent:this.dispatchEvent.bind(this),world:null,submissionRequested:!1,simulatePaymentRequested:!1,actionCompleted:!1,pollImmediatelyRequested:!1}),currentChannelCode:null,currentDigitalWalletSubmission:null,eventListenersPresent:new Map},le(this),this.addEventListener("fatal-error",e=>{const n=e;this[h].eventListenersPresent.get("fatal-error")||console.error(`XenditComponents: A "fatal-error" event occurred but no event listener was attached: ${n.message}`)}),this[h].eventListenersPresent.set("fatal-error",!1),this.behaviorTreeUpdate(),this.addEventListener(InternalUpdateWorldState.type,this.onUpdateWorldState.bind(this)),this.addEventListener(InternalUpdateChannelComponentData.type,this.onUpdateChannelComponentData.bind(this)),this.addEventListener(InternalBehaviorTreeUpdateEvent.type,this.behaviorTreeUpdate.bind(this));let t=!1;this.addEventListener(InternalNeedsRerenderEvent.type,()=>{t||(t=!0,queueMicrotask(()=>{t=!1,this.rerenderAllComponents(),this.syncInertAttribute()}))}),this.initializeAsync()}async initializeAsync(){let e;try{e=await _t(this[h].sdkKey,this[h].sdkKey.sessionAuthKey),e.channels=e.channels.filter(e=>de[e.channel_code])}catch(e){return this[h].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[h].behaviorTree.bb.sdkFatalErrorMessage=J(e),void this.behaviorTreeUpdate()}this.dispatchEvent(new InternalUpdateWorldState({business:e.business,customer:e.customer,session:e.session,channels:e.channels,channelUiGroups:e.channel_ui_groups,digitalWallets:e.digital_wallets??null,paymentEntity:null,sessionTokenRequestId:null,succeededChannel:e.succeeded_channel??null}))}assertInitialized(){if(!this[h].worldState)throw new Error("The session data is not loaded. Listen for the `init` event. Only `createChannelPickerComponent` can be called before initialization.")}isMock(){return!1}isProdLive(){return"pl"===this[h].sdkKey.hostId}isDevelopmentEnv(){return"pd"===this[h].sdkKey.hostId||"sd"===this[h].sdkKey.hostId}supportsSimulationScenarios(){return this.isMock()||this.isDevelopmentEnv()}findChannel(e){this.assertInitialized();return this[h].worldState.channels.find(n=>n.channel_code===e)??null}onUpdateWorldState(e){const n=e.data;this[h].worldState=W(this[h].worldState??{},n);const t=this[h].worldState.session.locale;this.t=function(e){const n=vn[e];return function(...t){let a,i,r={};switch(t.length){case 1:a=t[0];break;case 2:"string"==typeof t[1]?(a=t[0],i=t[1]):(a=t[0],r=t[1]);break;case 3:a=t[0],i=t[1],r=t[2];break;default:throw new Error("Invalid arguments for t function")}let o=n?.[a];return void 0===o&&void 0!==i&&(o=i),o?o.replace(/\{\{(\w+)\}\}/g,(e,n)=>r[n]?String(r[n]):""):(console.warn(`Missing localization for key: ${a} in locale: ${e}`),a)}}(t),this.behaviorTreeUpdate(),this.rerenderAllComponents()}onUpdateChannelComponentData(e){const n=e.channelCode,t=e.data,a=this[h].liveComponents.paymentChannels.get(n);a&&(a.data=W(a.data,t),this.behaviorTreeUpdate(),this.rerenderAllComponents())}behaviorTreeUpdate(){const e=this[h].behaviorTree.bb;if("LOADING"===e.sdkStatus&&this[h].worldState&&(e.sdkStatus="ACTIVE"),e.world=this[h].worldState,this[h].currentDigitalWalletSubmission)e.channel=this.findChannel(this[h].currentDigitalWalletSubmission.channelCode),e.channelProperties=this[h].currentDigitalWalletSubmission.channelProperties,e.channelData=null,e.channelIsDigitalWallet=!0,e.instantSubmissionError=this[h].currentDigitalWalletSubmission.instantSubmissionError;else{const n=this[h].currentChannelCode?this[h].liveComponents.paymentChannels.get(this[h].currentChannelCode):null;e.channel=n?oe(n.channel[h],n.data.savePaymentMethod):null,e.channelProperties=n?n.channelProperties:null,e.channelData=n?n.data:null,e.channelIsDigitalWallet=!1}try{this[h].behaviorTree.update()}catch(e){this[h].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[h].behaviorTree.bb.sdkFatalErrorMessage=J(e),this[h].behaviorTree.update()}}getSdkStatus(){return this[h].behaviorTree.bb.sdkStatus}rerenderAllComponents(){this.renderChannelPicker();for(const e of this[h].liveComponents.paymentChannels.keys())this.renderPaymentChannel(e);for(const e of this[h].liveComponents.digitalWalletContainer.keys())this.renderDigitalWalletComponent(e)}getSession(){return this.assertInitialized(),ge(this[h].worldState.session)}getCustomer(){return this.assertInitialized(),this[h].worldState.customer?(e=this[h].worldState.customer)?(q(e.type,"INDIVIDUAL"),T(e.individual_detail),{id:e.id,type:e.type,email:e.email??void 0,mobileNumber:e.mobile_number??void 0,individualDetail:{givenNames:e.individual_detail.given_names??void 0,surname:e.individual_detail.surname??void 0}}):null:null;var e}getActiveChannelGroups(e){return this.assertInitialized(),function(e,n,t){const a=Ee(n),i=Ne(e,t);return n.filter(e=>i[e.id]?.length).map(e=>ve(e,i,a,t))}(this[h].worldState.channels,this[h].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[h].worldState.session,pairChannels:Ae(this[h].worldState.channels)})}getActiveChannels(e){return this.assertInitialized(),function(e,n,t){const a=Ee(n),i=Ne(e,t);return e.filter(e=>we(e,t)).map(e=>ke(e,i,a,t))}(this[h].worldState.channels,this[h].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[h].worldState.session,pairChannels:Ae(this[h].worldState.channels)})}createChannelPickerComponent(){this[h].liveComponents.channelPicker&&this.destroyComponent(this[h].liveComponents.channelPicker);const e=document.createElement("xendit-channel-picker");return e.setAttribute("translate","no"),this[h].liveComponents.channelPicker=e,this[h].worldState&&this.renderChannelPicker(),this.setupUiEventsForChannelPicker(e),e}renderChannelPicker(){this.assertInitialized();const n=this[h].liveComponents.channelPicker;n&&e.render(e.createElement(P,{data:this[h].worldState,sdk:this,children:e.createElement(Be,{})}),n)}setupUiEventsForChannelPicker(e){e.addEventListener(XenditClearCurrentChannelEvent.type,e=>{this.assertInitialized();const n=e,t=this[h].currentChannelCode;if(!t)return;const a=this[h].worldState.channels.find(e=>e.channel_code===t);a&&a.ui_group===n.uiGroup&&this.setCurrentChannel(null)})}createChannelComponent(n,t=!0){if(this.assertInitialized(),!se(this[h].worldState.session,n[h][0]))throw new Error("Cannot create channel component: `session.amount` is outside of the channel's min/max amount.");const a=n[h][0].channel_code;t&&(this[h].currentChannelCode=a);const i=this[h].liveComponents.paymentChannels.get(a),r=e.createRef(),o=e.createRef();let s;return i?s=i.element:(s=document.createElement("xendit-payment-channel"),s.setAttribute("data-channel-code",a),s.setAttribute("inert",""),s.setAttribute("translate","no"),s.style.setProperty("--xendit-channel-brand-color",n[h][0].brand_color),this.setupUiEventsForPaymentChannel(s),this[h].liveComponents.paymentChannels.set(a,{element:s,channel:n,channelProperties:null,channelFormRef:r,customerDetailsFormRef:o,data:{savePaymentMethod:!1,cardDetails:null,paymentOptions:null,customerDetails:n[h][0].requires_customer_details?{given_names:""}:null}})),this.renderPaymentChannel(a),t&&(this.behaviorTreeUpdate(),this.syncInertAttribute()),this.dispatchEvent(new InternalNeedsRerenderEvent),s}renderPaymentChannel(n){this.assertInitialized();const t=this[h].liveComponents.paymentChannels.get(n);if(!t)return;const a=t.channel;e.render(e.createElement(P,{data:this[h].worldState,sdk:this,children:e.createElement(ct,{channelOrPair:a[h],channelData:t.data,savePaymentMethod:t.data.savePaymentMethod,formRef:t.channelFormRef,customerDetailsFormRef:t.customerDetailsFormRef})}),t.element)}getActiveDigitalWallets(){return this.assertInitialized(),this[h].worldState.digitalWallets?function(e,n,t,a){const i=[],r=Ee(t);if(e.google_pay){const t=e.google_pay.allowed_payment_methods.map(e=>{const t=n.find(n=>n.channel_code===e.channel_code);return T(t),t}),o=Ne(t,a);i.push({digitalWalletCode:"GOOGLE_PAY",get channels(){return t.map(e=>ke(e,o,r,a))},[h]:!0})}return i}(this[h].worldState.digitalWallets,this[h].worldState.channels,this[h].worldState.channelUiGroups,{options:{filterMinMax:!1},pairChannels:Ae(this[h].worldState.channels),session:this[h].worldState.session}):[]}createDigitalWalletComponent(e,n){this.assertInitialized();const t=this[h].liveComponents.digitalWalletContainer.get(e);t&&this.destroyComponent(t.element);const a=document.createElement("xendit-digital-wallet");return a.setAttribute("translate","no"),a.style.setProperty("display","none"),this[h].liveComponents.digitalWalletContainer.set(e,{element:a,options:n}),this.renderDigitalWalletComponent(e),a}renderDigitalWalletComponent(n){this.assertInitialized();const t=this[h].liveComponents.digitalWalletContainer.get(n);t&&e.render(e.createElement(P,{data:this[h].worldState,sdk:this,children:e.createElement(De,{digitalWalletCode:n,digitalWalletOptions:t.options})}),t.element)}getCurrentChannel(){const e=this[h].currentChannelCode;return e?this.getActiveChannels().find(n=>{if(n.channelCode===e||Array.isArray(n.channelCode)&&n.channelCode.includes(e))return!0})??null:null}setCurrentChannel(e){if(this[h].behaviorTree.bb.submissionRequested)throw new Error("Cannot change the payment channel while a submission is in progress.");const n=this[h].currentChannelCode,t=e?.[h][0].channel_code??null;if(n!==t){if(this[h].currentChannelCode=t,e&&t){(this[h].liveComponents.paymentChannels.get(t)??null)||this.createChannelComponent(e,!1)}this.behaviorTreeUpdate(),this.syncInertAttribute(),this.renderChannelPicker()}}syncInertAttribute(){const e=this[h].behaviorTree.bb.submissionRequested,n=this[h].liveComponents.paymentChannels;for(const[t,a]of n){(Array.isArray(a.channel.channelCode)?a.channel.channelCode[0]:a.channel.channelCode)!==this[h].currentChannelCode||e?a.element.setAttribute("inert",""):a.element.hasAttribute("inert")&&a.element.removeAttribute("inert")}const t=this[h].liveComponents.channelPicker;t&&(e?t.setAttribute("inert",""):t.removeAttribute("inert"))}setupUiEventsForPaymentChannel(e){e.addEventListener(XenditChannelPropertiesChangedEvent.type,e=>{const n=e,t=n.channel,a=this[h].liveComponents.paymentChannels.get(t);a&&(a.channelProperties=n.channelProperties,this.behaviorTreeUpdate())})}showValidationErrors(){if(!this[h].behaviorTree.findBehavior(ChannelInvalidBehavior))return;const e=this[h].currentChannelCode;if(!e)return;const n=this[h].liveComponents.paymentChannels.get(e);if(!n)throw new Error("Current channel is set but component is missing; this is a bug, please contact support.");const t=n.channelFormRef.current;t?.setAllFieldsTouched();const a=n.customerDetailsFormRef.current;a?.setAllFieldsTouched()}createActionContainerComponent(e){this.assertInitialized();const n=e===h,t=n?void 0:e,a=this[h].behaviorTree.findBehavior(PaymentEntityRequiresActionBehavior);if(!n&&a&&!a.canCreateActionContainer)throw new Error("Unable to create action container; there is an action in progress. Create an action before or during the `action-begin` event.");this[h].liveComponents.actionContainer&&this.destroyComponent(this[h].liveComponents.actionContainer);const i=document.createElement("xendit-action-container");return i.setAttribute("translate","no"),t?.qrCode&&void 0!==t.qrCode.qrCodeOnly&&i.setAttribute("data-qr-code-only",t.qrCode.qrCodeOnly.toString()),this[h].liveComponents.actionContainer=i,i}destroyComponent(n){if(!n.tagName.startsWith("XENDIT-"))throw new Error("Unable to destroy component; only elements created by this SDK can be destroyed.");if(this[h].liveComponents.channelPicker===n)return this[h].liveComponents.channelPicker=null,e.render(null,n),void n.remove();for(const[t,a]of this[h].liveComponents.paymentChannels)if(a.element===n)return this[h].liveComponents.paymentChannels.delete(t),this[h].currentChannelCode===t&&this.setCurrentChannel(null),e.render(null,n),void n.remove();if(this[h].liveComponents.actionContainer===n)return this[h].liveComponents.actionContainer=null,e.render(null,n),void n.remove();for(const[t,a]of this[h].liveComponents.digitalWalletContainer)if(a.element===n)return this[h].liveComponents.digitalWalletContainer.delete(t),e.render(null,n),void n.remove();throw new Error("Unable to destroy component; component not found. It may have already been destroyed.")}submit(){this.assertInitialized();if(!this[h].behaviorTree.findBehavior(SessionActiveBehavior))throw new Error("Unable to submit; the session is not in the active state. Listen to the `session-complete` and `session-expired-or-canceled` events and display success or failure states accordingly.");const e=this[h].currentChannelCode;if(!e)throw new Error("Unable to submit; there is no current payment channel. Create a payment component with `createChannelComponent` or make an existing one active with `setCurrentChannel`.");if(!this[h].liveComponents.paymentChannels.get(e))throw new Error("Current channel is set but component is missing; this is a bug, please contact support.");this.showValidationErrors();if(this[h].behaviorTree.findBehavior(ChannelInvalidBehavior))throw new Error("Unable to submit; the form for the current channel has errors. Listen to the `submission-ready` and `submission-not-ready` events, do not allow submission while in the not-ready state.");if(!this[h].behaviorTree.findBehavior(ChannelValidBehavior))throw new Error("Unable to submit; the SDK is not in a valid state for submission. Listen to the `submission-ready` and `submission-not-ready` events, do not allow submission while in the not-ready state.");this[h].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}submitDigitalWallet(e,n,t,a=null){this.assertInitialized(),this.setCurrentChannel(null),this[h].currentDigitalWalletSubmission={digitalWalletCode:e,channelCode:n[h][0].channel_code,channelProperties:t,instantSubmissionError:a},this.addEventListener(XenditSubmissionEndEvent.type,()=>{this[h].currentDigitalWalletSubmission=null},{once:!0}),this[h].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}abortSubmission(){this.assertInitialized();this[h].behaviorTree.findBehavior(SubmissionBehavior)&&(this[h].behaviorTree.bb.submissionRequested=!1,this.behaviorTreeUpdate())}simulatePayment(){if(this.assertInitialized(),"PAY"!==this[h].worldState.session.session_type)throw new Error('Unable to simulate payment, the session type is not "PAY".');if(!this[h].behaviorTree.findBehavior(PaymentEntityRequiresActionBehavior))throw new Error("Unable to simulate payment; there is no action in progress. You can simulate payments any time between the `action-begin` and `action-end` events.");const e=this[h].worldState.paymentEntity;if(!e)throw new Error("The PeRequiresActionBehavior is present but there is no payment entity. This is a bug, please contact support.");if(!this.findChannel(e.entity.channel_code))throw new Error("Channel not found; this is a bug, please contact support.");const n=O(e.entity.actions);if(!n||!Z(n))throw new Error("Unable to simulate payment; the action does not support simulation.");this[h].behaviorTree.bb.simulatePaymentRequested=!0,this.behaviorTreeUpdate()}pollImmediately(){if(this.assertInitialized(),"ACTIVE"!==this[h].worldState.session.status)throw new Error("Unable to poll immediately; the session is not longer active.");this[h].behaviorTree.bb.pollImmediatelyRequested=!0,this.behaviorTreeUpdate()}getState(){const e=this[h].currentChannelCode,n=this[h].liveComponents.paymentChannels.get(e??"");return{channelCode:e,channelProperties:n?.channelProperties||null,behaviorTree:this[h].behaviorTree}}addEventListener(e,n,t){return this[h].eventListenersPresent.set(e,!0),super.addEventListener(e,n,t)}removeEventListener(e,n,t){return super.removeEventListener(e,n,t)}static amountFormat=qa}class XenditComponentsTest extends XenditComponents{nextMockUpdate=null;constructor(e){super({...e,componentsSdkKey:`session-${$(32)}-mock-MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCADI5pdf6KmN8+Fxl2ES3yolUKXunNeY3gGScGNEvDcrcHAPKxIInAo5DVnDvTtYtqZvx/bu7HLeBJNMXwHhie/uyNEtT8dSaLc9bd0WSlYdxI+iUsTv2Qu0LiiPrZs-NKf7whM9meUs/eRCvG0oc180MDiyeli3kH6EQ3ZahECHsZQi5G2IpH6vk3cYMtf01Y1L4OBn1SZCOv1kwpjIUet4DJeoTwwq2nM5b+K7rD+/WFTi3AEX4NWJNkKi0a91`}),this.addEventListener(InternalScheduleMockUpdateEvent.type,this.setNextMockUpdate.bind(this))}async initializeAsync(){await L(R);const e=(await Promise.resolve().then(function(){return require("./test-data.cjs")})).makeTestBffData();this.dispatchEvent(new InternalUpdateWorldState({business:e.business,customer:e.customer,session:e.session,channels:e.channels,channelUiGroups:e.channel_ui_groups,digitalWallets:e.digital_wallets??null,paymentEntity:null,sessionTokenRequestId:null,succeededChannel:null}))}isMock(){return!0}setNextMockUpdate(e){const n=e;this.nextMockUpdate=n.mockData}}function qa(e,n){return xn(e,n)}"undefined"==typeof window||"undefined"==typeof document||(u||(u=!0,e.options.debounceRendering=e=>queueMicrotask(e)),function(){const e=document.createElement("style");e.textContent="/* variables */\n:root {\n --xendit-font-family: sans-serif;\n --xendit-color-primary: #1762ee;\n --xendit-color-text: #252525;\n --xendit-color-text-secondary: #585858;\n --xendit-color-text-placeholder: #7d7d7d;\n --xendit-color-disabled: #f7f7f7;\n --xendit-color-danger: #d1414d;\n --xendit-color-border: #f3f3f3;\n --xendit-color-background: #ffffff;\n --xendit-focus-shadow: 0px 0px 0px 2px\n color-mix(in srgb, var(--xendit-color-primary) 15%, transparent);\n --xendit-card-shadow: 0px 4px 8px 0px #25252514;\n --xendit-dialog-shadow: 8px 8px 12px 8px #25252529;\n --xendit-animation-duration: 0.3s;\n --xendit-animation-ease: ease-in-out;\n --xendit-radius-1: 8px;\n --xendit-z-index-focus: 2;\n --xendit-z-index-overlay: 3;\n\n /* Browser-specific border collapse margins */\n --xendit-border-collapse-offset: -0.5px; /* Default for Chrome/Edge */\n --xendit-border-collapse-webkit-gecko: -1.5px; /* Fix Safari and Firefox subpixel rendering */\n\n /* QR code colors */\n --xendit-qr-foreground-color: #000000;\n --xendit-qr-background-color: #ffffff;\n\n /* icon colors */\n --xendit-color-icon-primary: #7c7c7c;\n --xendit-color-icon-secondary: #f1f1f1;\n}\n\n/* Set default font for root components */\nxendit-channel-picker,\nxendit-action-container,\nxendit-payment-channel {\n display: block;\n unicode-bidi: isolate;\n font-family: var(--xendit-font-family);\n color: var(--xendit-color-text);\n touch-action: manipulation;\n transition: filter var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-default-action-container {\n font-family: var(--xendit-font-family);\n touch-action: manipulation;\n}\n\nxendit-action-container {\n position: relative;\n flex: 1; /* Action container usually wants to stretch to fit, assuming the parent is a flexbox. */\n touch-action: manipulation;\n}\n\nxendit-payment-channel button,\nxendit-payment-channel textarea,\nxendit-payment-channel select,\nxendit-payment-channel input,\nxendit-payment-channel input::placeholder {\n font-family: inherit;\n}\n\nxendit-payment-channel input::placeholder,\nxendit-payment-channel textarea::placeholder,\nxendit-payment-channel select::placeholder {\n color: var(--xendit-color-text-placeholder);\n}\n\n/* Reusable typography classes */\n.xendit-text-12 {\n font-size: 12px;\n line-height: 16px;\n letter-spacing: -0.01px;\n}\n\n.xendit-text-14 {\n font-size: 14px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-16 {\n font-size: 16px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-18 {\n font-size: 18px;\n line-height: 24px;\n letter-spacing: -0.26px;\n}\n\n.xendit-text-20 {\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -0.33px;\n}\n\n.xendit-text-12,\n.xendit-text-14,\n.xendit-text-16 {\n font-weight: 400;\n}\n\n.xendit-text-semibold {\n font-weight: 600;\n}\n\n.xendit-text-bold {\n font-weight: 700;\n}\n\n.xendit-text-link {\n color: var(--xendit-color-primary);\n}\n.xendit-text-secondary {\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-text-center {\n text-align: center;\n}\n\n.xendit-dotted-line {\n height: 1px;\n border: none;\n background: repeating-linear-gradient(\n to right,\n var(--xendit-color-border) 0px 4px,\n transparent 4px 8px\n );\n margin: 0;\n}\n\n/* Accordion component */\n\n.xendit-accordion {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n background: var(--xendit-color-background);\n}\n\n.xendit-accordion-item:not(:first-child) {\n border-top: 1px solid var(--xendit-color-border);\n border-top-left-radius: var(--xendit-radius-1);\n border-top-right-radius: var(--xendit-radius-1);\n}\n\n.xendit-accordion-item-header {\n display: grid;\n grid-template-columns: auto 1fr auto;\n grid-gap: 16px;\n align-items: center;\n cursor: pointer;\n padding: 24px 16px;\n color: var(--xendit-color-text);\n border-radius: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.xendit-accordion-item-header-title {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header-title,\n.xendit-accordion-item-disabled .xendit-accordion-item-header-icon {\n opacity: 0.5;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-header {\n color: var(--xendit-color-primary);\n}\n\n.xendit-accordion-item-chevron {\n color: var(--xendit-color-text);\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-chevron {\n display: none;\n}\n\n.xendit-accordion-item-chevron g {\n transition: transform var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item-header:focus-visible {\n border-radius: 8px;\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n}\n\n.xendit-accordion-item-content {\n overflow: hidden;\n transition: height var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item.xendit-accordion-item-closed\n .xendit-accordion-item-content {\n height: 0;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-content {\n height: calc-size(auto, size);\n}\n\n.xendit-accordion-item-padding {\n padding: 16px;\n}\n\n/* Channel picker digital wallet section */\n\n.xendit-channel-picker-digital-wallet-section {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n gap: 8px;\n margin-bottom: 8px;\n}\n\n/* Channel picker group */\n\n.xendit-channel-picker-group {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-picker-group select {\n border: 1px solid var(--xendit-color-border);\n border-radius: 8px;\n padding: 12px;\n appearance: none;\n outline: none;\n}\n\n.xendit-channel-picker-group select:focus {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-channel-logo {\n width: 24px;\n height: 16px;\n margin: -5px 0;\n padding: 4px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n object-fit: contain;\n}\n\n/* Payment channel */\n\nxendit-payment-channel[inert],\nxendit-channel-picker[inert] {\n filter: opacity(0.5) grayscale(1);\n}\n\n.xendit-payment-channel {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-payment-channel-banner {\n width: 100%;\n height: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 12px;\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-payment-channel-instructions-logo {\n height: 40px;\n width: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions-text {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 4px;\n}\n\n.xendit-payment-channel-instructions-text p {\n margin: 0;\n}\n\n/* Forms */\n\n.xendit-channel-form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-form > form {\n display: contents;\n}\n\n.xendit-form-field-group {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.xendit-channel-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group {\n display: grid;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group-label-container {\n display: flex;\n justify-content: space-between;\n gap: 16px;\n}\n\n.xendit-channel-form-field-group label {\n width: fit-content;\n cursor: pointer;\n}\n\n.xendit-form-field-group.invalid\n .xendit-channel-form-field\n .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-danger);\n}\n\n.xendit-channel-form-field .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-border);\n background: var(--xendit-color-background);\n border-radius: 8px;\n appearance: none;\n}\n\n.xendit-channel-form-field.field-radius-tl-0 .xendit-form-field-inner {\n border-top-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-tr-0 .xendit-form-field-inner {\n border-top-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-bl-0 .xendit-form-field-inner {\n border-bottom-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-br-0 .xendit-form-field-inner {\n border-bottom-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-collapse-l,\n.xendit-channel-form-field.field-collapse-l {\n margin-left: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-r,\n.xendit-channel-form-field.field-collapse-r {\n margin-right: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: calc(var(--xendit-border-collapse-offset) * 2);\n width: calc(100% + abs(var(--xendit-border-collapse-offset) * 2));\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container {\n margin-right: 0;\n}\n\n.xendit-channel-form-field.field-collapse-t .xendit-form-field-inner {\n margin-top: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-b .xendit-form-field-inner {\n margin-bottom: var(--xendit-border-collapse-offset);\n}\n\n/* Safari and Firefox specific adjustments */\n@supports (font: -apple-system-body) or (-moz-appearance: none) {\n .xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: 0;\n width: 100%;\n }\n\n .xendit-channel-form-field.field-collapse-b input,\n .xendit-channel-form-field.field-collapse-b button {\n margin-bottom: var(--xendit-border-collapse-webkit-gecko);\n height: calc(100% + abs(var(--xendit-border-collapse-webkit-gecko) * 2));\n }\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container:focus {\n border-right: none;\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container:focus {\n border-left: none;\n}\n\n.xendit-card-brand-logo {\n width: 24px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n padding: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n}\n\n.xendit-card-brands-list {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n gap: 4px;\n}\n\n.xendit-channel-form-field .xendit-form-field-inner:focus,\n.xendit-channel-form-field .xendit-form-field-inner.xendit-field-focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-channel-form-field button.xendit-dropdown-open {\n z-index: var(--xendit-z-index-focus);\n}\n\n.xendit-channel-form-field input.xendit-form-field-inner {\n padding: 12px;\n}\n\n.xendit-channel-form-field .xendit-iframe-container {\n display: flex;\n height: 40px;\n width: 100%;\n padding: 0;\n overflow: hidden;\n box-sizing: border-box;\n}\n\n.xendit-channel-form-field .xendit-iframe-container iframe {\n height: 40px;\n width: 100%;\n border: none;\n min-width: 0;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-1 {\n grid-column: span 1;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-2 {\n grid-column: span 2;\n}\n\n.xendit-checkbox {\n display: flex;\n align-items: center;\n}\n\n.xendit-checkbox-box {\n display: flex;\n}\n\n.xendit-checkbox input {\n width: 16px;\n height: 16px;\n margin: 0;\n cursor: pointer;\n}\n\n.xendit-checkbox label {\n cursor: pointer;\n padding-left: 8px;\n}\n\n.xendit-checkbox input {\n opacity: 0;\n position: absolute;\n}\n\n.xendit-checkbox input + .xendit-checkbox-graphic {\n width: 16px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n box-sizing: border-box;\n color: transparent;\n}\n\n.xendit-checkbox input:checked + .xendit-checkbox-graphic {\n color: var(--xendit-color-background);\n background-color: var(--xendit-color-primary);\n border-color: var(--xendit-color-primary);\n}\n\n.xendit-checkbox input:focus + .xendit-checkbox-graphic {\n border: 1px solid var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n/* Dialog */\n\n.xendit-dialog-backdrop {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n padding: 48px;\n justify-content: center;\n align-items: center;\n}\n\n.xendit-dialog {\n position: relative;\n}\n\n.xendit-dialog-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: var(--xendit-color-text);\n padding: 16px;\n gap: 16px;\n line-height: 20px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dialog-header button {\n display: flex;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-floating-close {\n display: none;\n}\n\n.xendit-dialog .xendit-dialog-floating-close {\n display: flex;\n}\n\n.xendit-dialog-floating-close {\n position: absolute;\n top: 24px;\n right: 24px;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-body {\n display: flex;\n padding: 24px;\n background-color: var(--xendit-color-background);\n border-radius: 8px;\n box-shadow: var(--xendit-dialog-shadow);\n}\n\n.xendit-error-message {\n color: var(--xendit-color-danger);\n}\n\n/* Phone input Dropdown */\n.xendit-input-phone {\n display: flex;\n gap: 8px;\n}\n\n.xendit-phone-number-input {\n width: 100%;\n}\n\n/* Phone input Dropdown ends */\n\n/* Dropdown */\n.xendit-dropdown {\n width: 100%;\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n text-align: left;\n background-color: var(--xendit-color-background);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n justify-content: space-between;\n cursor: pointer;\n padding: 0;\n outline: none;\n overflow: hidden;\n}\n\n.xendit-dropdown:focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-dropdown.xendit-dropdown-has-asset {\n grid-template-columns: auto 1fr auto;\n padding-left: 12px;\n}\n\n.xendit-dropdown-channel-logo {\n height: 24px;\n width: 32px;\n object-fit: contain;\n padding: 2px 0px;\n padding-right: 12px;\n border-right: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dropdown-text {\n padding: 12px;\n padding-right: 0;\n white-space: nowrap;\n overflow: clip;\n}\n\n.xendit-dropdown-chevron {\n height: 38px;\n width: 38px;\n padding: 12px;\n box-sizing: border-box;\n}\n\n.xendit-dropdown:disabled {\n background: var(--xendit-color-disabled);\n cursor: default;\n}\n\n.xendit-dropdown-overlay {\n contain: style;\n position: absolute;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 320px;\n padding: 4px;\n margin: 4px 0;\n box-sizing: border-box;\n background-color: var(--xendit-color-background);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n list-style: none;\n box-shadow: var(--xendit-card-shadow);\n overflow-y: auto;\n overscroll-behavior: none;\n}\n\n.xendit-dropdown-overlay ul {\n list-style: none;\n padding: 4px;\n margin: 0;\n}\n\n.xendit-dropdown-search {\n position: sticky;\n top: 0;\n z-index: 1;\n}\n\n.xendit-dropdown-search input {\n width: 100%;\n padding: 8px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n box-sizing: border-box;\n outline: none;\n}\n\n.xendit-dropdown-search input:focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-dropdown-item {\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n gap: 8px;\n padding: 8px 12px 8px 4px;\n border-radius: var(--xendit-radius-1);\n cursor: pointer;\n z-index: 0;\n --xendit-dropdown-item-hover-color: var(--xendit-color-background);\n --xendit-dropdown-item-hover-bg-color: var(--xendit-color-primary);\n}\n\n.xendit-dropdown-item-disabled {\n --xendit-dropdown-item-hover-color: var(--xendit-color-text);\n --xendit-dropdown-item-hover-bg-color: var(--xendit-color-disabled);\n}\n\n.xendit-dropdown-item-active {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-dropdown-item:hover {\n background-color: var(--xendit-dropdown-item-hover-bg-color);\n}\n\n.xendit-dropdown-item:hover .xendit-dropdown-item-text,\n.xendit-dropdown-item:hover .xendit-dropdown-item-description {\n color: var(--xendit-dropdown-item-hover-color);\n}\n\n.xendit-dropdown-item-selected {\n color: var(--xendit-color-primary);\n}\n\n.xendit-dropdown-item:hover .xendit-dropdown-item-selected {\n color: var(--xendit-dropdown-item-hover-color);\n}\n\n.xendit-dropdown-item.xendit-dropdown-has-asset {\n grid-template-columns: auto 1fr auto;\n}\n\n.xendit-dropdown-item-text {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.xendit-dropdown-item-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.xendit-dropdown-item-disabled:hover,\n.xendit-dropdown-item-disabled.xendit-dropdown-item-active {\n background-color: var(--xendit-color-disabled);\n}\n\n/* Dropdown ends */\n\n/* Button */\n.xendit-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 12px 16px;\n font-family: var(--xendit-font-family);\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n letter-spacing: -0.09px;\n cursor: pointer;\n transition: background-color var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n.xendit-button-primary-rounded {\n border: 1px solid transparent;\n background-color: var(--xendit-color-primary);\n color: var(--xendit-color-background);\n border-radius: var(--xendit-radius-1);\n}\n.xendit-button-white-rounded {\n background-color: var(--xendit-color-background);\n color: var(--xendit-color-text);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n}\n.xendit-button-white-rounded:hover {\n background-color: var(--xendit-color-border);\n}\n.xendit-button-block {\n width: 100%;\n}\n.xendit-button-sm {\n padding: 8px 12px;\n font-size: 12px;\n line-height: 16px;\n}\n\n@keyframes xendit-button-loading-spinner-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.xendit-button-loading-spinner {\n width: 16px;\n height: 16px;\n animation: xendit-button-loading-spinner-spin 1s linear infinite;\n}\n\n.xendit-skeleton-field button {\n height: 42px;\n background-color: var(--xendit-color-disabled);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--xendit-color-text-secondary);\n}\n\n/* Button ends */\n\n/* Form Simulation Helper */\n.xendit-form-simulation-root {\n position: relative;\n}\n.xendit-form-simulation-trigger {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n}\n.xendit-form-simulation-popover {\n position: absolute;\n top: 100%;\n right: 0;\n\n width: 350px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-radius: 4px;\n padding: 12px;\n border: 1px solid var(--xendit-color-border);\n background: color-mix(\n in srgb,\n var(--xendit-color-background),\n transparent 40%\n );\n backdrop-filter: blur(6px);\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-form-simulation-popover .xendit-dropdown-overlay {\n width: auto;\n}\n\n.xendit-form-simulation-scenario-icon {\n height: 28px;\n width: 40px;\n border-radius: 4px;\n border: 1px solid var(--xendit-color-border);\n object-fit: contain;\n background-color: white;\n}\n\n/* Form Simulation Helper ends */\n\n.xendit-tooltip {\n position: absolute;\n top: 100%;\n right: 50%;\n transform: translateX(50%);\n background-color: black;\n color: white;\n padding: 8px 12px;\n border-radius: var(--xendit-radius-1);\n white-space: nowrap;\n z-index: 1000;\n font-weight: 600;\n font-size: 14px;\n line-height: 16px;\n animation: xendit-tooltip-fade-in var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n opacity: 1;\n}\n\n@keyframes xendit-tooltip-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Instructions */\n\n.xendit-instructions-bold {\n font-weight: 600;\n}\n.xendit-instructions-bullet-list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin: 8px 0;\n}\n.xendit-instructions-bullet-list::marker {\n color: var(--xendit-color-text-secondary);\n}\n.xendit-instructions-form-card {\n display: flex;\n flex-direction: column;\n padding: 16px;\n border-radius: 12px;\n border: 1px solid var(--xendit-color-border);\n gap: 4px;\n width: 321px;\n}\n.xendit-instructions-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 8px 0;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n.xendit-instructions-form-field-label {\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n color: var(--xendit-color-text-secondary);\n}\n.xendit-instructions-form-field-value {\n font-size: 14px;\n line-height: 20px;\n color: var(--xendit-color-text);\n}\n.xendit-instructions-form-heading {\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n margin: 4px 0;\n}\n.xendit-instructions-italics {\n font-style: italic;\n}\n.xendit-instructions-numbered-list {\n display: flex;\n flex-direction: column;\n gap: 16px;\n list-style-type: decimal;\n padding-left: 40px;\n}\n.xendit-instructions-single-tab-heading {\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n margin-bottom: 16px;\n}\n.xendit-instructions-step-box {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.xendit-instructions-step-li {\n font-size: 14px;\n line-height: 20px;\n}\n.xendit-instructions-step-li p {\n margin: 0;\n}\n.xendit-instructions-step-li::marker {\n margin-left: 20px;\n}\n.xendit-instructions-tab-button {\n font-family: var(--xendit-font-family);\n font-size: 14px;\n padding: 8px 4px;\n background-color: transparent;\n border: none;\n border-top: 3px solid transparent;\n border-bottom: 3px solid transparent;\n cursor: pointer;\n}\n.xendit-instructions-active-tab {\n border-bottom-color: var(--xendit-color-primary);\n color: var(--xendit-color-primary);\n font-weight: 600;\n}\n.xendit-instructions-tab-list {\n display: flex;\n gap: 16px;\n margin-bottom: 16px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n.xendit-instructions-table {\n font-size: 14px;\n line-height: 16px;\n width: 100%;\n border-collapse: collapse;\n}\n.xendit-instructions-table-cell {\n padding: 4px;\n border: 1px solid black;\n}\n.xendit-instructions-table-header {\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n padding: 4px;\n border: 1px solid black;\n}\n\n/* Instructions ends */\n\n.xendit-default-action-container {\n display: flex;\n flex-direction: column;\n border: none;\n}\n\n.xendit-action-title {\n font-weight: 600;\n font-size: 20px;\n line-height: 28px;\n text-align: center;\n}\n\n.xendit-action-iframe {\n border: none;\n width: 100%;\n height: 100%;\n}\n\n.xendit-action-present-to-customer {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-present-to-customer-affirm {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n/* qr actions */\n.xendit-action-qr-content {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n max-width: 384px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n overflow: hidden;\n}\n.xendit-qr-merchant-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n.xendit-action-qr-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-qr-qrcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n}\n\n/* barcode actions */\n.xendit-action-barcode-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-barcode-barcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n justify-content: center;\n}\n\n/* va actions */\n.xendit-action-va-content,\n.xendit-action-barcode-content {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n padding-bottom: 24px;\n}\n.xendit-action-va-details,\n.xendit-action-barcode-details {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-va-detail-item,\n.xendit-action-barcode-detail-item {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.xendit-action-va-detail-content,\n.xendit-action-barcode-detail-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.xendit-action-va-heading,\n.xendit-action-barcode-heading {\n color: var(--xendit-color-text-placeholder);\n}\n.xendit-action-va-tag {\n color: var(--xendit-color-text-placeholder);\n background-color: #fafafa;\n padding: 2px 4px;\n border-radius: 4px;\n}\n\n/* redirect, deeplink, and push notification actions */\n.xendit-redirect-instructions {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n gap: 24px;\n}\n\n.xendit-redirect-instructions-logo {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 112px;\n height: 112px;\n border: 2px solid var(--xendit-color-border);\n border-radius: 50%;\n overflow: hidden;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-logo img {\n width: 96px;\n height: 96px;\n object-fit: contain;\n}\n\n.xendit-redirect-instructions-text {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-redirect-instructions-button {\n display: inline-block;\n border-radius: 99px;\n color: white;\n padding: 12px 16px;\n background-color: var(--xendit-channel-brand-color, #000);\n text-decoration: none;\n white-space: nowrap;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-button:hover,\n.xendit-redirect-instructions-button:active {\n filter: brightness(1.1);\n}\n\n/* googlepay */\n\n.gpay-card-info-container-fill {\n display: flex;\n}\n";const n=document.querySelector("style, link");n?n.insertAdjacentElement("beforebegin",e):document.head.appendChild(e)}()),exports.XenditActionBeginEvent=XenditActionBeginEvent,exports.XenditActionEndEvent=XenditActionEndEvent,exports.XenditComponents=XenditComponents,exports.XenditComponentsTest=XenditComponentsTest,exports.XenditFatalErrorEvent=XenditFatalErrorEvent,exports.XenditInitEvent=XenditInitEvent,exports.XenditNotReadyEvent=XenditNotReadyEvent,exports.XenditPaymentRequestCreatedEvent=XenditPaymentRequestCreatedEvent,exports.XenditPaymentRequestDiscardedEvent=XenditPaymentRequestDiscardedEvent,exports.XenditPaymentTokenCreatedEvent=XenditPaymentTokenCreatedEvent,exports.XenditPaymentTokenDiscardedEvent=XenditPaymentTokenDiscardedEvent,exports.XenditReadyEvent=XenditReadyEvent,exports.XenditSessionCompleteEvent=XenditSessionCompleteEvent,exports.XenditSessionExpiredOrCanceledEvent=XenditSessionExpiredOrCanceledEvent,exports.XenditSessionNotPendingEvent=XenditSessionNotPendingEvent,exports.XenditSessionPendingEvent=XenditSessionPendingEvent,exports.XenditSubmissionBeginEvent=XenditSubmissionBeginEvent,exports.XenditSubmissionEndEvent=XenditSubmissionEndEvent,exports.XenditWillRedirectEvent=XenditWillRedirectEvent,exports.amountFormat=qa,exports.randomHexString=$,exports.randomUUID=Y;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|