xendit-components-web 0.0.18 → 0.0.19
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 +10 -2
- package/README.md +2 -2
- package/package.json +16 -16
- package/sdk/dist/cjs/index.cjs +1 -1
- package/sdk/dist/cjs/index.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-external/index.mjs +1 -1
- package/sdk/dist/esm-external/index.mjs.map +1 -1
- package/sdk/dist/index.d.ts +44 -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("qrcode"),d=require("qrcode/lib/renderer/svg-tag.js");let c=!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{static type="session-complete";constructor(){super(XenditSessionCompleteEvent.type,{})}}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 u=Symbol("xendit-internal"),h=e=>n.jsx("div",{class:"xendit-accordion",children:e.children}),p=e=>{const{name:t,size:a,direction:i}=e;let r;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)"}let o=null;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=m(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=m(n.jsx("path",{fill:"currentColor",d:"M17.5 3.75H2.5C2.16848 3.75 1.85054 3.8817 1.61612 4.11612C1.3817 4.35054 1.25 4.66848 1.25 5V15C1.25 15.3315 1.3817 15.6495 1.61612 15.8839C1.85054 16.1183 2.16848 16.25 2.5 16.25H17.5C17.8315 16.25 18.1495 16.1183 18.3839 15.8839C18.6183 15.6495 18.75 15.3315 18.75 15V5C18.75 4.66848 18.6183 4.35054 18.3839 4.11612C18.1495 3.8817 17.8315 3.75 17.5 3.75ZM10.625 13.75H9.375C9.20924 13.75 9.05027 13.6842 8.93306 13.5669C8.81585 13.4497 8.75 13.2908 8.75 13.125C8.75 12.9592 8.81585 12.8003 8.93306 12.6831C9.05027 12.5658 9.20924 12.5 9.375 12.5H10.625C10.7908 12.5 10.9497 12.5658 11.0669 12.6831C11.1842 12.8003 11.25 12.9592 11.25 13.125C11.25 13.2908 11.1842 13.4497 11.0669 13.5669C10.9497 13.6842 10.7908 13.75 10.625 13.75ZM15.625 13.75H13.125C12.9592 13.75 12.8003 13.6842 12.6831 13.5669C12.5658 13.4497 12.5 13.2908 12.5 13.125C12.5 12.9592 12.5658 12.8003 12.6831 12.6831C12.8003 12.5658 12.9592 12.5 13.125 12.5H15.625C15.7908 12.5 15.9497 12.5658 16.0669 12.6831C16.1842 12.8003 16.25 12.9592 16.25 13.125C16.25 13.2908 16.1842 13.4497 16.0669 13.5669C15.9497 13.6842 15.7908 13.75 15.625 13.75ZM2.5 6.875V5H17.5V6.875H2.5Z"}),20/24);break;case"qr":o=m(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=m(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=m(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=m(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=m(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=m(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=m(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 m(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",m=t.useCallback(()=>{l||c(i)},[l,c,i]),f=t.useCallback(e=>{"Enter"!==e.key&&" "!==e.key||(m(),e.preventDefault())},[m]),b=t.useCallback(()=>{m()},[m]);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:b,onKeyDown:f,role:"button",tabIndex:l?-1:0,children:[n.jsx(p,{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(p,{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})})]})},b=e.createContext(null);b.displayName="SessionContext";const x=e.createContext(null);x.displayName="BusinessContext";const y=e.createContext(null);y.displayName="CustomerContext";const _=e.createContext(null);_.displayName="ChannelsContext";const g=e.createContext(null);g.displayName="ChannelUiGroupsContext";const v=e.createContext(null);v.displayName="DigitalWalletsContext";const k=e.createContext(null);k.displayName="SdkContext";const C=e.createContext(null);C.displayName="CurrentChannelContext";const w=()=>{const e=t.useContext(b);if(null===e)throw new Error("useSession must be used within a XenditSessionProvider");return e},E=()=>{const e=t.useContext(_);if(null===e)throw new Error("useChannels must be used within a XenditSessionProvider");return e},A=()=>t.useContext(v),S=()=>{const e=t.useContext(k);if(null===e)throw new Error("useSdk must be used within a XenditSessionProvider");return e},N=()=>t.useContext(C),P=({children:e,data:t,sdk:a})=>{const{session:i,business:r,customer:o,channels:s,digitalWallets:l,channelUiGroups:d}=t,c=a.getCurrentChannel()?.[u]?.[0]??null;return"ACTIVE"!==a.getSdkStatus()||"ACTIVE"!==i.status?null:n.jsx(k.Provider,{value:a,children:n.jsx(C.Provider,{value:c,children:n.jsx(b.Provider,{value:i,children:n.jsx(x.Provider,{value:r,children:n.jsx(y.Provider,{value:o,children:n.jsx(_.Provider,{value:s,children:n.jsx(v.Provider,{value:l,children:n.jsx(g.Provider,{value:d,children:e})})})})})})})})},R=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 j(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 M(e){return new Promise(n=>setTimeout(n,1*e))}class AbortError extends Error{constructor(){super("AbortError"),this.name="AbortError"}}function L(e){return e instanceof AbortError&&"AbortError"===e.name}function U(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 q(e,n){if(e[u].options.enablePaylinks)return n.find(e=>"REDIRECT_CUSTOMER"===e.type&&"WEB_GOOGLE_PAYLINK"===e.descriptor)}const B="mock",V={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 K(e){return V[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 $(e){let n;if("string"==typeof e.channel_property)n=e.channel_property;else{n=Object.values(e.channel_property).join("__")}return n}const X=Math.floor(255*Math.random());function G(e){return`xendit-id-${$(e).split("").map(e=>(e.charCodeAt(0)%256^X).toString(16)).join("")}`}function H(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 z(){return[H(8),H(4),H(4),H(4),H(12)].join("-")}function Y(){return`xendit-id-${t.useRef(H(12)).current}`}function Q(e){return"PRESENT_TO_CUSTOMER"===e.type}function Z(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 J(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 ee(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 ne(e){const n=ee("card_details.card_number",e);return"string"!=typeof n?null:n}function te(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 ae=new WeakMap;let ie=1;function re(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 oe(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 se(e){Object.defineProperty(e,u,{enumerable:!1,writable:!1,configurable:!1,value:e[u]})}const le={CARDS:!0,QRIS:!0,QR_PH:!0,PROMPTPAY:!0,SGQR:!0};function de(e,n){for(const t of e)if(t.type.name===n)return!0;return!1}var ce,ue;!function(e){e.BARE="bare",e.PRIMARY_ROUNDED="primary-rounded",e.WHITE_ROUNDED="white-rounded"}(ce||(ce={})),function(e){e.SM="sm",e.MD="md"}(ue||(ue={}));const he=e=>{const{children:t,variant:i,size:r,type:o="button",...s}=e,l={[ce.BARE]:void 0,[ce.PRIMARY_ROUNDED]:"xendit-button-primary-rounded",[ce.WHITE_ROUNDED]:"xendit-button-white-rounded"}[i],d={[ue.SM]:"xendit-button-sm",[ue.MD]:void 0}[r??ue.MD];return n.jsx("button",{...s,className:a(e.className,"xendit-button",l,d),type:o,children:t})},pe=()=>{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"})})},me=e=>{const{id:a,options:i,onChange:r,defaultIndex:o=-1,selectedIndex:s,placeholder:l,disabled:d,className:c,fixedOverlayWidth:u,enableSearch:h}=e,m=S().t,f=Y(),b=a||f,x="number"==typeof s,[y,_]=t.useState(o),g=x?s:y,[v,k]=t.useState(g>=0?g:0),[C,w]=t.useState(!1),E=C&&!d&&i.length>0,[A,N]=t.useState(""),[P,R]=t.useState(0),I=t.useRef(null),T=t.useRef(null),j=t.useRef(null),D=t.useRef(null),M=t.useRef(null),L=t.useRef(null),U=t.useMemo(()=>{const e=i.map(ye).filter(({item:e})=>{if(""===A.trim())return!0;const n=A.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)},[A,i]),O=Math.max(0,Math.min(U.length-1,v));t.useLayoutEffect(()=>{if(u)return void R(u);const e=I.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=I.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=T.current;n&&(n.contains(e.target)||w(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E]),t.useLayoutEffect(()=>{if(!E)return;const e=e=>{const n=T.current;n&&e.relatedTarget&&(n.contains(e.relatedTarget)||w(!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(!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)},[E,v]);const q=t.useCallback(()=>{E||(w(!0),queueMicrotask(()=>M.current?.focus()))},[E]),B=t.useCallback(()=>{E&&(w(!1),N(""),I.current?.focus())},[E]),V=t.useCallback(()=>{E?B():q()},[B,E,q]),K=t.useCallback(e=>{const n=i[e];n&&(n.disabled||(x||_(e),r(n,e),B()))},[B,x,r,i]),W=t.useCallback(e=>{const n=e.target===M.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=U[O];return void(t&&K(t.originalIndex))}return"ArrowDown"===e.key?(e.preventDefault(),void k(e=>Math.min(U.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(U.length-1)):void 0},[O,B,K,U]),F=t.useCallback(e=>{if(E)return W(e);"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),q())},[W,E,q]),$=t.useCallback(e=>{e.stopPropagation(),e.preventDefault(),K(Number(e.currentTarget.dataset.index))},[K]),X=t.useCallback(e=>{N(e.currentTarget.value),k(0)},[]),G=g>=0?i[g]:void 0;return n.jsxs("div",{className:"xendit-dropdown-container",ref:T,style:{"--xendit-dropdown-width":P+"px"},children:[n.jsxs("button",{id:b,ref:I,type:"button",className:`xendit-dropdown ${c} ${E?"xendit-dropdown-open":""} ${be(G)?"xendit-dropdown-has-asset":""}`,"aria-expanded":E?"true":"false",onClick:V,onKeyDown:F,disabled:d,children:[G?.leadingAsset??null,G?n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:G.shortTitle??G.title}):n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:l}),n.jsx(p,{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:M,placeholder:m("combobox.default_search_placeholder"),value:A,onInput:X,onClick:xe,onKeyDown:W})}):null,n.jsx("ul",{ref:j,role:"listbox",tabIndex:-1,onKeyDown:W,children:U.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:$,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(p,{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(pe,{})})});function be(e){return!!e&&!(!e.leadingAssetInOverlay&&!e.leadingAsset)}function xe(e){e.stopPropagation()}function ye(e,n){return{item:e,originalIndex:n}}function _e(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"),J({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,items:e.items?.map(e=>J({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 ge(e,n,t,a){const i=J({groupId:e.id,label:e.label,get channels(){return(n[e.id]||[]).map(e=>ke(e,n,t,a))},[u]:e});return se(i),i}function ve(e,n){return ke(e,{},{},n)}function ke(e,n,t,a){I(!a.pairChannels.paired[e.channel_code]);const i=J({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 ge(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})),[u]:a.pairChannels.pairs[e.channel_code]??[e]});return se(i),i}function Ce(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&&!oe(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 Ee(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"}),Ne=e=>{const{group:a,open:i}=e,r=S(),{t:o}=r,s=w(),l=E(),d=N(),c=s.session_type,u=Y(),[h,p]=t.useState(null),m=t.useRef(null),[f,b]=t.useState(!1),x=t.useRef(null),y=t.useMemo(()=>Ae(l),[l]),_=t.useMemo(()=>({pairChannels:y,session:{amount:s.amount,session_type:s.session_type},options:{filterMinMax:!1}}),[y,s.amount,s.session_type]),g=t.useMemo(()=>l.filter(e=>we(e,_)&&e.ui_group===a.id),[l,a.id,_]);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(ve(d,_)),x.current.parentElement!==m.current&&(b(!0),m.current.replaceChildren(x.current)))},[g,d,_,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(ve(e,_))}},[g,d,h,_,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?ve(n,_):null)},[l,_,r]),C=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:!oe(s,e),description:Pe(o,s,e)||void 0})),[g,s,o]),A=1===g.length&&"CARDS"===g[0].channel_code;return n.jsxs("div",{className:"xendit-channel-picker-group",children:[A?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(me,{id:u,selectedIndex:function(){const e=C.findIndex(e=>e.value===d?.channel_code);if(-1!==e)return e;const n=C.findIndex(e=>e.value===h);return-1!==n?n:1===C.length?0:-1}(),options:C,disabled:C.length<=1,onChange:k,placeholder:o("payment_methods.select_channel_placeholder",{groupName:a.label,ns:"session"})})]}),!A&&f?n.jsx(Se,{}):null,n.jsx("div",{style:{display:f?"":"none"},ref:m})]})};function Pe(e,n,t){return oe(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 a=S(),i=t.useRef(null),r=A(),o=r?.google_pay;return t.useLayoutEffect(()=>{if(i.current&&o){const e=a.createDigitalWalletComponent("GOOGLE_PAY");return i.current.appendChild(e),()=>{e.remove()}}},[o,a]),n.jsx("div",{ref:i,className:"xendit-channel-picker-digital-wallet-section"})},Ie=e=>{const a=S(),i=w(),r=(()=>{const e=t.useContext(g);if(null===e)throw new Error("useChannelUiGroups must be used within a XenditSessionProvider");return e})(),o=N(),s=E(),{t:l}=S(),d=t.useMemo(()=>Ee(s,{options:{filterMinMax:!1},pairChannels:Ae(s),session:i}),[s,i]),c=t.useRef(null),p=t.useMemo(()=>Ae(s),[s]),m=t.useMemo(()=>({pairChannels:p,session:{amount:i.amount,session_type:i.session_type},options:{filterMinMax:!1}}),[p,i.amount,i.session_type]),b=o?.ui_group??null,[x,y]=t.useState(null),_=t.useCallback(e=>{if(b===e||x===e)b===e&&c.current?.dispatchEvent(new XenditClearCurrentChannelEvent(e)),x===e&&y(null);else{const n=r.find(n=>n.id===e);I(n);const t=Te(i,n,s,l).enabledChannels;if(0===t)return;if(1===t){const n=d[e][0];a.setCurrentChannel(ve(n,m)),y(null)}else y(e),a.setCurrentChannel(null)}},[r,s,d,m,x,a,b,i,l]);t.useLayoutEffect(()=>{null!==o&&null!==x&&y(null)},[o,x]);const v=a[u].options.enableDigitalWallets??!1;return n.jsxs("div",{ref:c,children:[v?n.jsx(Re,{}):null,n.jsx(h,{children:r.filter(e=>(d[e.id]||[]).length>0).map(e=>{const t=null!==b?b===e.id:x===e.id,a=Te(i,e,s,l),r=0===a.enabledChannels,c=a.firstDisabledChannelReason;return n.jsx(f,{id:e.id,title:e.label,iconName:De(b===e.id?o:null,d[e.id]),subtitle:c??void 0,open:t,disabled:r,onClick:_,children:n.jsx(Ne,{group:e,open:t})},e.id)})})]})};function Te(e,n,t,a){let i=null,r=0;for(const o of t)o.ui_group===n.id&&(oe(e,o)?r++:null===i&&(i=Pe(a,e,o)));return{enabledChannels:r,firstDisabledChannelReason:i}}const je={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 De(e,n){if(e&&e.pm_type&&je[e.pm_type])return je[e.pm_type];for(const e of n)if(e.pm_type&&je[e.pm_type])return je[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 Me=({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"}}),Le=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(a),[s,l]=t.useState(void 0),d=Ue.findIndex(e=>e.value===s),c=t.useRef(null);Oe(e=>{if(c.current){const n=Ue.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(me,{id:r,options:Ue,onChange:u,placeholder:a.placeholder,selectedIndex:d,enableSearch:!0,className:"xendit-form-field-inner"})]})},Ue=i.getCountries().map(e=>({title:new Intl.DisplayNames(["en"],{type:"region"}).of(e),value:e,leadingAsset:n.jsx(Me,{countryCode:e})})).sort((e,n)=>e.title.localeCompare(n.title));function Oe(e){const n=tt()?.cardDetails,a=n?.details?.country_codes[0],i=F(a);t.useLayoutEffect(()=>{a&&a!==i&&e(a)})}const qe=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(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(me,{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 Be="undefined"!=typeof window&&window.HTMLElement?window.HTMLElement:EventTarget;class XenditFormAssociatedFocusTrap extends Be{static tag="xendit-form-associated-focus-trap";static formAssociated=!0;internals;constructor(){super(),this.internals=this.attachInternals()}}var Ve;Ve=XenditFormAssociatedFocusTrap,"undefined"!=typeof window&&window.customElements&&customElements.define(Ve.tag,Ve);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 Ke=e.createContext(null);I("https://assets.xendit.co/components/secure-iframe-v0.0.18.html");const We=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.18.html").origin,Fe=({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,We)}};return n.jsx(Ke.Provider,{value:i,children:e})};I("https://assets.xendit.co/components/secure-iframe-v0.0.18.html");const $e=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.18.html"),Xe=$e.toString(),Ge=$e.origin,He=e=>{const{field:a,onChange:i}=e,r=S(),o=G(a),s=$(a),l=w(),d=t.useRef(null),c=t.useRef(null),[h,p]=t.useState(),[m,f]=t.useState(!1),[b,x]=t.useState(null),{card:y}=et()??{},_=t.useCallback(e=>{if(!d.current)return;const n=d.current.contentWindow;if(e.source!==n)return;if(e.origin!==Ge)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,h,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":f(!0);break;case"xendit-iframe-blur":f(!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,h,i]),g=t.useCallback(()=>{d.current?.contentWindow&&d.current.contentWindow.postMessage({type:"xendit-iframe-focus"},Ge)},[]);t.useLayoutEffect(()=>(window.addEventListener("message",_),()=>{window.removeEventListener("message",_)}),[_]);const v=t.useContext(Ke);t.useLayoutEffect(()=>(v?.registerIframe(s,d),()=>v?.unregisterIframe(s)),[s,v]);const k=new URL(Xe);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[u].sdkKey.publicKey),k.searchParams.set("sig",r[u].sdkKey.signature),r[u].options.iframeFieldAppearance&&k.searchParams.set("appearance",JSON.stringify(r[u].options.iframeFieldAppearance));const C=m?"xendit-field-focus":"";return n.jsxs("div",{className:`xendit-iframe-container xendit-form-field-inner ${C}`,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&&y&&n.jsx(ze,{cardsBrandList:y.brands,selectedCardBrand:b})]})},ze=({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))})},Ye=e=>{const{field:a,onChange:s}=e,l=G(a),d=$(a),c=w(),u=t.useRef(null),[h,p]=t.useState(c.country),m=t.useMemo(()=>{const e=Qe.findIndex(e=>e.value===h);return-1===e?0:e},[h]),f=Qe[m],[b,x]=t.useState(""),y=t.useRef(null),_=t.useCallback((e,n)=>{const t=Ze(e,n);return t?t.number:`+${e.dial}${n}`},[]),g=t.useCallback((e,n)=>{u.current&&(u.current.value=_(e,n))},[_]);function v(e){const n=e;p(n.value),g(n,b),s()}return Oe(e=>{const n=Qe.find(n=>n.value===e);n&&n.value!==h&&!b&&v(n)}),n.jsxs("div",{className:"xendit-input-phone",children:[n.jsx(me,{options:Qe,selectedIndex:m,onChange:v,fixedOverlayWidth:300,enableSearch:!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(){const e=Ze(f,b);if(e){const n=e.formatInternational();x(n.replace(`+${r.getCountryCallingCode(f.value)} `,""))}}(),e.currentTarget?.value&&u.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){const n=e.target.value;x(n),g(f,n),s()},value:b,autoComplete:"tel"}),n.jsx("input",{type:"hidden",name:d,ref:u})]})},Qe=Ue.map(e=>{const n=r.getCountryCallingCode(e.value);return n?{...e,shortTitle:`+${n}`,title:`${e.title} (+${n})`,dial:n}:null}).filter(e=>Boolean(e)),Ze=(e,n)=>{const t=i(n,e.value);return t&&t.isPossible()?t:null};function Je(e){return{title:e.name,value:e.value}}const en=[{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(Je),nn=[{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(Je),tn=[{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})),an=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(a),s=w(),l=et()?.form,d=qn(),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 en;case"CA":return nn;case"GB":return tn;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=ee(e.channel_property,t);if(n&&"string"==typeof n)return n}}}return a.country}(a,l??[],d??{},s)),f=F(m);return t.useLayoutEffect(()=>{f!==m&&u()},[u,m,f]),n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:c}),m?n.jsx(me,{id:r,options:m,onChange:h,placeholder:a.placeholder,enableSearch:!0,className:"xendit-form-field-inner"},(b=m,ae.has(b)||ae.set(b,ie++),ae.get(b).toString())):n.jsx("input",{type:"text",id:r,onChange:p,placeholder:a.placeholder,className:"xendit-form-field-inner xendit-text-14"})]});var b};const rn=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(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:on(a)?a.type.min_length:void 0,maxLength:on(a)?a.type.max_length:void 0,autoComplete:on(a)?a.type.autocomplete:void 0})};function on(e){return"text"===e.type.name}const sn={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"},ln={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:"MX$",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$"},dn={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$"},cn={BHD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function un(e,n){let t="";const a=e<0,i=sn[n]??"en",r=cn[n]??2;if(t=new Intl.NumberFormat(i,{style:"decimal",minimumFractionDigits:r,maximumFractionDigits:20}).format(Math.abs(e)),t=t.replace(/(\.|,)000?$/,""),ln[n]){const e=ln[n]??n;t=(dn[n]??"$1").replace("$",e).replace("1",t)}else t=n+" "+t;return a&&(t="-"+t),t}const hn=e=>{const{field:a,onChange:i}=e,{t:r}=S(),o=w(),s=G(a),l=$(a),d=t.useRef(null),c=et();I(c);const u=t.useMemo(()=>de(c.form,"credit_card_number"),[c.form]),h=tt()?.paymentOptions,p=h?.options?.installment_plans,[m,f]=t.useState(null),b=t.useMemo(()=>{const e=p?.map(e=>({title:r("installment_plan.pay_in_installments",{installments:e.terms,amount:un(e.installment_amount,o.currency)}),subtitle:e.interest_rate,value:pn(e)}))??[];return u&&e.unshift({title:r("installment_plan.pay_in_full",{amount:un(o.amount,o.currency)}),value:""}),e},[u,p,o.amount,o.currency,r]);let x=b?.findIndex(e=>e.value===m);-1===x&&(x=0);const y=t.useCallback(()=>{f(null),d.current&&(d.current.value="")},[]),_=t.useCallback(e=>{if(d.current){const n=p?.find(n=>pn(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)}f(e.value),i()},[p,i]);t.useLayoutEffect(()=>{b.length&&_(b[0])},[]);const g=F(b);return t.useLayoutEffect(()=>{b===g||p?.some(e=>pn(e)===m)||(b.length?_(b[0]):y())},[y,b,_,p,g,m]),n.jsxs(n.Fragment,{children:[h?n.jsx(me,{id:s,placeholder:a.placeholder,onChange:_,options:b,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 pn(e){return`${e.terms}_${e.interval}_${e.code??""}`}const mn=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(He,{...e});case"phone_number":return n.jsx(Ye,{...e});case"text":case"email":case"postal_code":return n.jsx(rn,{...e});case"dropdown":return n.jsx(qe,{...e});case"installment_plan":return n.jsx(hn,{...e});case"country":return n.jsx(Le,{...e});case"province":return n.jsx(an,{...e})}throw t.type,new Error(`Unsupported field type: ${t.type.name}`)}()})};const fn={en:{session:{"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","validation.required":"{{field}} is required","validation.text_too_long":"{{field}} is too long","validation.text_too_short":"{{field}} is too short","payment.save_checkbox_label":"Save for faster payment next time","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}}","default_error.message_1":"There was a problem with the request.","default_error.message_2":"Please try again later.","default_error.title":"Error","combobox.default_search_placeholder":"Search...","installment_plan.pay_in_full":"Pay in Full — {{amount}}","installment_plan.pay_in_installments":"{{installments}}x Installments — {{amount}}","google_pay_errors.developer_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.buyer_account_error.title":"Google Pay Error","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.merchant_account_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.internal_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.unknown_error.title":"Google Pay Error","google_pay_errors.unknown_error.message":"An unknown error occurred with Google Pay. The error code is {{statusCode}}.","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}}","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","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_va.merchant_name":"Virtual Account Name","action_va.amount_to_pay":"Amount to Pay","action_va.virtual_account_number":"Virtual Account Number","action_va.copy":"Copy","action_va.copied_to_clipboard":"Copied to clipboard","action_qr.unable_to_generate":"Unable to generate QR code","action_deeplink.button":"Open App","action_deeplink.instructions":"Please complete your payment on your {{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...","image_alt.channel_logo":"{{channelName}} logo","simulation.simulate_scenario":"Simulate scenario","simulation.simulate_test_scenario":"Simulate a test scenario","simulation.select_scenario":"Select a scenario","simulation.want_to_test_all_scenarios":"Want to test different scenarios?","simulation.see_all_scenarios":"See the full list here."}}.session,id:{session:{"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","validation.required":"{{field}} wajib diisi","validation.text_too_long":"{{field}} terlalu panjang","validation.text_too_short":"{{field}} terlalu pendek","payment.save_checkbox_label":"Simpan untuk pembayaran lebih cepat lain kali","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}}","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}}","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","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_va.amount_to_pay":"Jumlah Pembayaran","action_va.virtual_account_number":"Nomor Virtual Account","action_qr.unable_to_generate":"Tidak dapat membuat kode QR"}}.session,th:{session:{"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}} สั้นเกินไป","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}}","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}})","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":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","action.payment_confirmation_instructions":"เมื่อคุณชำระเงินแล้ว คลิกที่ปุ่มด้านบนเพื่อยืนยันการชำระเงิน","action.payment_made":"ฉันได้ชำระเงินแล้ว","action_va.amount_to_pay":"ยอดชำระ","action_va.virtual_account_number":"หมายเลข Virtual Account","action_qr.unable_to_generate":"ไม่สามารถสร้างคิวอาร์โค้ดได้"}}.session,vi:{session:{"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","payment.save_checkbox_label":"Lưu để thanh toán nhanh hơn lần sau","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}}","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}}","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","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_va.amount_to_pay":"Số tiền cần thanh toán","action_va.virtual_account_number":"Số tài khoản định danh (Virtual Account)","action_qr.unable_to_generate":"Không thể tạo mã QR"}}.session};const bn=(e,n,t)=>n?(e=>"object"==typeof e&&null!==e&&"localeKey"in e)(n)?e(n.localeKey,{field:t.label}):n.value:null;function xn(e){return e.startsWith("/")&&e.endsWith("/")?e.slice(1,-1):e}function yn(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=te(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(xn(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 _n(e,n){const t=Array.isArray(e.channel_property)?e.channel_property:[e.channel_property];for(const a of t){let t=gn(n,a);if(void 0===t&&(t=""),"string"!=typeof t)continue;const i=yn(e,t);if(i)return i}}function gn(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 gn(a,t.slice(1).join("."))}}const vn=e.createContext(null),kn=({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(vn.Provider,{value:{open:r,setOpen:o,scenarios:e,onSelect:a},children:i})})},Cn=({children:e})=>n.jsx("div",{className:"xendit-form-simulation-root",children:e}),wn=({children:e})=>{const{open:a,setOpen:i}=t.useContext(vn)||{};return n.jsx("button",{type:"button",className:"xendit-form-simulation-trigger",onClick:()=>i?.(!a),children:e})},En=()=>{const e=t.useContext(vn);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(me,{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},An="field-radius-bl-0",Sn="field-radius-br-0",Nn="field-radius-tl-0",Pn="field-radius-tr-0",Rn="field-collapse-r",In="field-collapse-l",Tn="field-collapse-t",jn="field-collapse-b",Dn=({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[$(t)])continue;const e=_n(t,o??{});if(e)return n.jsx("span",{className:"xendit-error-message xendit-text-12",children:bn(l,e,t)})}return null})();return n.jsx(Fe,{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(Mn,{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({[An]:p>r+1||i%2==1,[Sn]:!!h[n+1],[Nn]:n>0,[Pn]:!(0===r&&1===o||0===r&&0===o&&2===e.span),[Rn]:1===e.span&&0===o,[In]:1===e.span&&1===o,[Tn]:i>=2,[jn]:!s})})(e,t,i);return n.jsx(mn,{className:o,field:e,onChange:r},t)})},i),m]})})},Mn=({simulationScenarios:e,fieldGroup:a})=>{const i=t.useContext(Ke),{t:r}=S();return n.jsx(kn,{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=>$(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(Cn,{children:[n.jsx(wn,{children:n.jsx("div",{className:"xendit-text-12 xendit-text-semibold xendit-text-link",children:r("simulation.simulate_scenario")})}),n.jsx(En,{})]})})},Ln={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"},Un=s.forwardRef(({form:e,onChannelPropertiesChanged:a},i)=>{const r=w(),o=et(),s=S(),l=tt(),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=Bn(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(()=>Vn(e.session_type,n,a,i),[i,a,n,e.session_type]);return r}(r,e,c||{},l??null),f=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})(f||[],m)||p()},[m,p,f]);const b=t.useCallback(e=>s.supportsSimulationScenarios()&&"CARDS"===o?.channel_code&&e.some(e=>"credit_card_number"===e.type.name)?Ln: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(On.Provider,{value:c,children:x.map((e,t)=>n.jsx(Dn,{fieldGroup:e,groupIndex:t,handleFieldChanged:p,channelProperties:c,simulationScenarios:b(e)},t))})})})}),On=e.createContext(null),qn=()=>t.useContext(On);function Bn(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 Vn(e,n,t,a){const i=de(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=gn(t,n);switch(a){case"equals":if(r!==i)return!1;break;case"not_equals":if(r===i)return!1}}return!0})}const Kn=e=>{const a=t.useRef(null),i=t.useRef(null),r=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{r&&(a.current?.animate(Wn,Fn),i.current?.animate($n,Xn))},[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"})]})]})]})},Wn=[{transform:"scale(0.1)"},{transform:"scale(1)"}],Fn={duration:500,easing:"ease-out"},$n=[{transform:"rotate(0deg)"},{transform:"rotate(5deg)"},{transform:"rotate(-5deg)"},{transform:"rotate(0deg)"}],Xn={duration:1e3,easing:"ease-out",iterations:1/0,delay:2e3},Gn=[{transform:"translateY(0)"},{transform:"translateY(44px)"}],Hn={duration:1e3,delay:1e3,easing:"ease-out"},zn={duration:1e3,direction:"reverse",delay:500,easing:"ease-in"},Yn=[{opacity:1},{opacity:0},{opacity:1}],Qn={duration:1e3},Zn=e=>{const{id:t,label:a,checked:i,onChange:r,disabled:o}=e,s=Y(),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})]})},Jn=e.createContext(null),et=()=>{const e=t.useContext(Jn);if(void 0===e)throw new Error("useChannel must be used within a ChannelProvider");return e},nt=e.createContext(null);nt.displayName="ChannelComponentDataContext";const tt=()=>t.useContext(nt),at=e=>{const{channelOrPair:a,channelData:i,savePaymentMethod:r,formRef:o}=e,s=t.useRef(null),l=S(),{t:d}=l,c=w(),u=a[0],h=a.length>1,p=re(a,r),m=function(e){if(e&&2===e.length)return[e[0],e[1]];return null}(p.instructions),f="OPTIONAL"===c.allow_save_payment_method&&(p.allow_save||h);return t.useLayoutEffect(()=>{m||p.form.length||p.banner||console.error(`Missing display data for ${p.channel_code}, this is a bug, please contact support`)},[m,p.banner,p.channel_code,p.form]),n.jsx(Jn.Provider,{value:p,children:n.jsx(nt.Provider,{value:i,children:n.jsxs("div",{className:"xendit-payment-channel",ref:s,children:[n.jsx(Un,{ref:o,form:p.form,onChannelPropertiesChanged:e=>{let n=e;if("CARDS"===u.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(u.channel_code,n);s.current?.dispatchEvent(t)}}),p.banner?n.jsx(rt,{banner:p.banner}):null,f&&n.jsx(Zn,{label:d("payment.save_checkbox_label"),onChange:e=>{const n=e.target?.checked;l?.dispatchEvent(new InternalUpdateChannelComponentData(u.channel_code,{savePaymentMethod:n}))},checked:r}),m?n.jsxs("div",{className:"xendit-payment-channel-instructions",children:[it[p.pm_type??""]??n.jsx(Kn,{}),n.jsx("div",{className:"xendit-payment-channel-instructions-text xendit-text-12",children:m.map((e,t)=>n.jsx("p",{className:0===t?"xendit-text-semibold":void 0,children:e},t))})]}):null]})})})},it={EWALLET:n.jsx(Kn,{}),QR_CODE:n.jsx(e=>{const a=t.useRef(null),i=t.useRef(null),r=Y(),o=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{if(o&&a.current){const e=()=>{if(!a.current)return;const n=a.current.animate(Gn,Hn);setTimeout(()=>{i.current?.animate(Yn,Qn)},1e3),n.onfinish=()=>{const n=a.current?.animate(Gn,zn);setTimeout(()=>{i.current?.animate(Yn,Qn)},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"})})})]})},{})},rt=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 ot(e){const n=new URLSearchParams;return n.append("payload",JSON.stringify(e)),n}function st(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.18";I(d),I(d.startsWith("v"));const c=i.hostId;if(c===B)throw new Error("A network request was made in mock mode; this is a bug.");const u=K(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?ot(s):void 0,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:l},f=await fetch(h,m);if(!f.ok){const e=await f.json();if(!e||!e.error_code)throw new Error("Unexpected error response from server");throw new NetworkError(e)}return f.json()}}const lt=st("GET",e=>`/api/sessions/${e}`),dt=st("POST",()=>"/api/sessions/payment_tokens"),ct=st("POST",()=>"/api/sessions/payment_requests"),ut=st("POST",e=>`/api/sessions/${e.sessionAuthKey}/payment_requests/${e.paymentRequestId}/simulate`),ht=st("GET",e=>`/api/sessions/${e}/poll`,e=>new URLSearchParams(e?{token_request_id:e}:{})),pt=st("POST",e=>`/api/sessions/${e}/card_info`),mt=st("POST",e=>`/api/sessions/${e}/payment_options`);function ft(e,n,t){return{impl:e,key:n??"",child:t,instance:void 0}}class BehaviorTree{fn;bb;root=ft(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,bt(e);const n=this.root??void 0,t=this.fn(this.bb);this.root=t,xt(n,t,this.bb,0)}}finally{this.updating=!1}}findBehavior(e){return gt(this.root,e)}}function bt(e){if(e>32)throw new Error("Max recursion depth exceeded; this is a bug, please contact support.")}function xt(e,n,t,a){if(bt(a),function(e,n){return void 0===e||void 0===n||Array.isArray(e)!==Array.isArray(n)||(!Array.isArray(e)||!Array.isArray(n))&&(j(e),j(n),e.impl!==n.impl||e.key!==n.key)}(e,n))e&&_t(e,a+1),n&&yt(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++)xt(e[r],n[r],t,a+1)}else n&&(n.instance=e?.instance),e&&(e.instance=void 0),xt(e?.child,n?.child,t,a+1),n?.instance?.update?.()}function yt(e,n,t){if(bt(t),Array.isArray(e))for(const a of e)a&&yt(a,n,t+1);else e.instance=new e.impl(n,e.key),e.instance.enter?.(),e.child&&yt(e.child,n,t+1)}function _t(e,n){if(bt(n),Array.isArray(e))for(const t of e)t&&_t(t,n+1);else e.child&&_t(e.child,n+1),e.instance?.exit?.(),e.instance=void 0}function gt(e,n){if(Array.isArray(e))for(const t of e){if(!t)continue;const e=gt(t,n);if(e)return e}else{if(e.impl===n)return e.instance??null;if(e.child)return gt(e.child,n)}return null}class ActionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){}}const vt=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]}),kt=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(vt,{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})})},Ct=e=>{const{title:a,onClose:i,children:r,seamless:o,borderColor:s,noBackground:l}=e,d=t.useRef(!1),c=t.useRef(!1),u=t.useRef(null),h=t.useRef(null),m=void 0!==HTMLElement.prototype.animate,f=t.useCallback(()=>{d.current||(d.current=!0,i())},[i]),b=t.useCallback(()=>{if(!u.current||!h.current||c.current)return;if(c.current=!0,!m)return void f();h.current.animate?.(St,Et);const e=u.current.animate?.(Pt,Et);e.onfinish=f},[f,m]);return t.useLayoutEffect(()=>{m&&(h.current?.animate?.(At,wt),u.current?.animate?.(Nt,wt))},[m]),t.useLayoutEffect(()=>{e.close&&b()},[e.close,b]),n.jsx("div",{className:"xendit-dialog-backdrop",ref:h,children:n.jsxs("div",{className:"xendit-dialog "+(l?"":"xendit-dialog-with-background"),ref:u,style:s?{border:`4px solid ${s}`}:void 0,children:[o?null:n.jsxs("div",{className:"xendit-dialog-header xendit-text-16 xendit-text-semibold",children:[a,n.jsx("button",{"aria-label":"Close",onClick:b,children:n.jsx(p,{name:"x",size:20})})]}),l?r:n.jsx("div",{className:"xendit-dialog-body",children:r}),o?n.jsx("button",{"aria-label":"Close",onClick:b,className:"xendit-dialog-floating-close",children:n.jsx(p,{name:"x",size:20})}):null]})})},wt={duration:500,easing:"cubic-bezier(.32,.23,0,.92)",fill:"forwards"},Et={duration:200,easing:"linear",fill:"forwards"},At=[{backgroundColor:"rgba(0, 0, 0, 0)"},{backgroundColor:"rgba(0, 0, 0, 0.2)",offset:.1},{backgroundColor:"rgba(0, 0, 0, 0.6)"}],St=At.slice().reverse(),Nt=[{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:1,transform:""}],Pt=[{opacity:1,transform:""},{opacity:0,transform:"scale(0.92) translateY(-10px)"}];function Rt(e){const{sdk:a,title:i,onClose:r,width:o,height:s,borderColor:l}=e,d=t.useRef(null);return t.useLayoutEffect(()=>{const e=a.createActionContainerComponent(u);return d.current?.replaceChildren(e),()=>{a.destroyComponent(e)}},[a]),n.jsx(Ct,{title:i,onClose:r,close:e.close,borderColor:l,seamless:!0,noBackground:e.defaultActionContainerType===It.QrWithCustomArt,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 It;!function(e){e.QrWithCustomArt="qr-with-custom-art",e.Generic="generic"}(It||(It={}));class ContainerActionBehavior{bb;cleanupFn=null;defaultContainerHeight=0;defaultContainerWidth=400;title="Complete your payment";constructor(e){this.bb=e}ensureHasActionContainer(n=It.Generic){if(I(this.bb.channel),this.bb.sdk[u].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(Rt,r),i),document.body.appendChild(i),n=>{n||(a=!0),t||e.render(e.createElement(Rt,{...r,close:!0}),i)}}cleanupActionContainer(e){this.cleanupFn&&(this.cleanupFn(e),this.cleanupFn=null)}emptyActionContainer(){const n=this.bb.sdk[u].liveComponents.actionContainer;n&&e.render(null,n)}updateActionContainerBrandColor(){I(this.bb.channel);const e=this.bb.sdk[u].liveComponents.actionContainer;e&&e.style.setProperty("--xendit-channel-brand-color",this.bb.channel.brand_color)}populateActionContainer(n){const t=this.bb.sdk[u].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(kt,{t:t,channel:a,redirectUrl:n.value}))}exit(){super.exit()}}const Tt=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(vt,{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 jt;function Dt(e){return"payment_request_id"in e?{id:e.payment_request_id,type:jt.PaymentRequest,entity:e}:{id:e.payment_token_id,type:jt.PaymentToken,entity:e}}function Mt(e,n,t){return`${e===jt.PaymentRequest?"payment_request":"payment_token"}_status.${n.toLowerCase()}.${t}`}!function(e){e.PaymentRequest="REQUEST",e.PaymentToken="TOKEN"}(jt||(jt={}));function Lt(e,n,t){const{session:a,paymentEntity:i}=e;switch(I(a),I(i),I(n),t){case"PENDING":return Ut(a);case"PENDING_PAYMENT_ENTITY_ONLY":return function(e,n){const t=n.type===jt.PaymentRequest?n.entity:void 0,a=n.type===jt.PaymentToken?n.entity:void 0;return{session:e,payment_request:Ot(t,"PENDING"),payment_token:Ot(a,"PENDING")}}(a,i);case"SUCCESS":return"PENDING"===n._mock_action_type?Ut(a):function(e,n){const t=n.type===jt.PaymentRequest?n.entity:void 0,a=n.type===jt.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:Ot(t,"SUCCEEDED"),payment_token:Ot(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===jt.PaymentRequest?n.entity:void 0,a=n.type===jt.PaymentToken?n.entity:void 0;return{session:{...e,status:"ACTIVE"},payment_request:Ot(t,"FAILED"),payment_token:Ot(a,"FAILED")}}(a,i)}}function Ut(e){return{session:{...e,status:"PENDING"}}}function Ot(e,n){return e?{...e,status:n}:e}function qt(e,n){return"PENDING"===n?{payment_request_id:`pr-${z()}`,status:"PENDING",channel_code:e,actions:[],session_token_request_id:z()}:n?{payment_request_id:`pr-${z()}`,status:"REQUIRES_ACTION",channel_code:e,actions:Bt(n),session_token_request_id:z()}:{payment_request_id:`pr-${z()}`,status:"SUCCEEDED",channel_code:e,actions:[],session_token_request_id:z()}}function Bt(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(Tt,{t:n,channel:t})),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Lt(this.bb.world,this.bb.channel,"PENDING_PAYMENT_ENTITY_ONLY")))}exit(){this.bb.hackyOvoActionLatch=void 0,super.exit()}}function Vt(e){const{url:a,mock:i,onIframeComplete:r}=e,o=t.useRef(null),s=t.useCallback(e=>{if(!o.current)return;const n=o.current.contentWindow;e.source===n&&"xendit-iframe-action-complete"===e.data?.type&&r(e.data)},[r]);return t.useLayoutEffect(()=>(window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}),[s]),i?n.jsx("iframe",{ref:o,srcDoc:Kt,className:"xendit-action-iframe"}):n.jsx("iframe",{ref:o,src:a,className:"xendit-action-iframe"})}const Kt="\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 a 3DS authentication page.</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(()=>e.createElement(Vt,{url:this.url,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(Lt(this.bb.world,this.bb.channel,e)))}exit(){super.exit()}}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 Wt(e){const{amount:a,businessName:i,channelName:r,channelLogo:o,currency:s,onAffirm:l,qrString:d,parsedQr:c,t:u}=e,[h,p]=t.useState(!1),m=t.useCallback(()=>{p(!0),l()},[l]),f=t.useMemo(()=>{try{return Gt(d,Yt)}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}},[d,u]),b=t.useRef(!1),x=t.useCallback(e=>{if(e instanceof PointerEvent&&"touch"!==e.pointerType)return;if(b.current)return;e.currentTarget.animate?.([{transform:"scale(1)"},{transform:"scale(0.95)"},{transform:"scale(1)"}],{duration:150,easing:"ease-in-out"});const n=Gt(d,Qt),t=[zt(i),zt(r),zt(s),zt(String(a)),zt(Ht())].join("-");b.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,r,s,d]);if(e.hideUi)return n.jsx("div",{"data-testid":"qr-code",ref:e=>{!e||1===e.childNodes.length&&e.firstChild===f||e?.replaceChildren(f)}});const y=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===f||e?.replaceChildren(f)}}),_=n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(he,{variant:ce.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(pe,{}):u("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:u("action.payment_confirmation_instructions")})]}),g=un(a,s),v=Ft(c);return v?n.jsxs(n.Fragment,{children:[n.jsx(v,{channelLogo:o,channelName:r,merchantName:i,amountText:g,parsedQr:c,qr:y,t:u}),n.jsx("div",{style:{padding:"8px",background:"white",marginTop:"25px",borderRadius:"8px"},children:_})]}):n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:o,alt:u("image_alt.channel_logo",{channelName:r}),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:g})]}),_]})}function Ft(e){return e&&e.merchantAccountInformation&&"object"==typeof e.merchantAccountInformation&&e.merchantAccountInformation["ID.CO.QRIS.WWW"]?Xt:null}const $t="rgb(238, 54, 66)";function Xt(e){const{channelLogo:t,channelName:a,merchantName:i,amountText:r,parsedQr:o,t:s}=e;const l=function(){const e=o?.merchantAccountInformation;if("string"==typeof e)return;const n=e?.["ID.CO.QRIS.WWW"];return"string"!=typeof n&&n?.nmid?`NMID: ${n.nmid}`:void 0}();return n.jsxs("div",{style:{display:"flex",gap:"16px",flexDirection:"column",padding:"20px",position:"relative",borderRadius:"8px",overflow:"hidden",backgroundColor:"var(--xendit-color-background)"},children:[n.jsx("img",{src:t,alt:s("image_alt.channel_logo",{channelName:a}),style:{height:"64px",alignSelf:"flex-start"}}),n.jsxs("div",{className:"xendit-text-center xendit-text-16",style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("div",{className:"xendit-text-semibold",children:i}),l?n.jsx("div",{children:l}):null]}),n.jsxs("div",{style:{position:"relative",margin:"-20px",padding:"20px"},children:[e.qr,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:$t,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:$t,points:"0,100 100,100 100,0"})}),n.jsx("div",{className:"xendit-text-16 xendit-text-semibold xendit-text-center",children:r})]})]})}function Gt(e,n){const t=l.create(e),a=d.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]),n.borderRadius&&(i.style.borderRadius=`${n.borderRadius}px`),i}function Ht(){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 zt(e){return e.split("").map(e=>/[a-zA-Z0-9]/.test(e)?e.toLowerCase():"-").join("").replace(/-+/g,"-")}const Yt={margin:2,borderRadius:4,colors:["var(--xendit-qr-foreground-color)","var(--xendit-qr-background-color)"]},Qt={margin:2,colors:["#000","#FFF"]},Zt={"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"}}}},Jt={"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 ea(e){return/^[\uD800-\uDBFF]$/.test(e)}function na(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,ea(n)?l+=.5:l+=1}t.push({key:a,value:o}),e=e.substring(4+s)}return t}function ta(e,n,t,a){e[`field${t}`]=a;const i=n[t];if(!i)return;const r="template"===i.type&&i.templateClass?aa(i.templateClass,a).result:a;e[i.name]=r}function aa(e,n){const t=na(n),a={};for(const{key:n,value:i}of t)ta(a,e,n,i);return{result:a,raw:t}}function ia(e,n,t){const a=na(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=Jt[i];return r&&(e[i]=aa(r,t).result),e}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=null;try{t=function(e){const{result:n,raw:t}=aa(Zt,e);n.merchantAccountInformation={};for(const e of t){const t=Number(e.key);t>=26&&t<=51&&ia(n.merchantAccountInformation,e.key,e.value)}return n}(n.value)}catch{}if(this.bb.mock&&"string"==typeof this.bb.channelProperties?.mock_emvco_qr_field_26_00){const e=this.bb.channelProperties.mock_emvco_qr_field_26_00;t={merchantAccountInformation:{[e]:{globallyUniqueIdentifier:e}}}}const a=function(e){return null!==Ft(e)}(t),i=this.bb.sdk[u].liveComponents.actionContainer,r={amount:this.bb.world.session.amount,businessName:this.bb.world.business.name??"",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,parsedQr:t,title:n.action_subtitle,t:this.bb.sdk.t.bind(this.bb.sdk)},o=a?It.QrWithCustomArt:It.Generic;this.cleanupFn=this.ensureHasActionContainer(o),this.populateActionContainer(()=>e.createElement(Wt,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 ra=({instructions:e})=>{switch(e.length){case 0:return null;case 1:return n.jsx(oa,{instruction:e[0]});default:return n.jsx(sa,{instructions:e})}},oa=e=>n.jsxs("div",{children:[n.jsx("p",{className:"xendit-instructions-single-tab-heading",children:e.instruction.title}),n.jsx(la,{instruction:e.instruction})]}),sa=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(la,{instruction:e.instructions[i]})]})},la=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:ha(t)},a))})},a)})});function da(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:da(e.childNodes)},t):da(e.childNodes)}(e,t);default:return null}})}const ca="undefined"!=typeof DOMParser?new DOMParser:null;function ua(e){try{if(!ca)return e;return da(ca.parseFromString(e,"text/html").body.childNodes)}catch(n){return e}}function ha(e){if("string"==typeof e)return n.jsx("p",{className:"xendit-instructions-step-item",children:ua(e)});switch(e.type){case"text":return function(e){return n.jsx("p",{children:ua(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:ua(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:ua(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:ua(e.label)}),n.jsx("div",{className:"xendit-instructions-form-field-value",children:ua(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:ua(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:ua(e)},t))},t))})]})}(e)}return null}const pa=e.createContext({fire:()=>{},clear:()=>{},text:""}),ma=({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(pa.Provider,{value:{text:a,fire:r,clear:o},children:n.jsx("div",{style:{position:"relative"},children:e})})},fa=()=>{const{text:e,clear:a}=t.useContext(pa);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 ba(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]),f=[{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:un(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:f.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(ma,{children:[n.jsx(xa,{value:e.value,t:u}),n.jsx(fa,{})]}):null]},t))})}),n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(he,{variant:ce.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(pe,{}):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(ra,{instructions:d})]})}const xa=({value:e,t:a})=>{const{fire:i}=t.useContext(pa);return n.jsxs(he,{variant:ce.WHITE_ROUNDED,size:ue.SM,onClick:()=>{navigator.clipboard.writeText(e),i(a("action_va.copied_to_clipboard"))},children:[a("action_va.copy"),n.jsx(p,{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(ba,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=ne(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=U(300,n.signal).then(()=>{if(this.bb.mock){const n=te(e).cipherText;try{return JSON.parse(atob(n))}catch{}return{schemes:["VISA"],country_codes:["ID"],require_billing_information:!1}}{const t=te(e).withoutValidationError;return pt(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(!L(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 M(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 M(R),e=this.sdk.nextMockUpdate,this.sdk.nextMockUpdate=null}else try{e=await ht(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=Dt(e.payment_token):e.payment_request&&(n=Dt(e.payment_request)),this.onPollResult(e,n),await M(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(Lt(this.bb.world,this.bb.channel,"SUCCESS")));break;case"FAILED":case"CANCELED":case"EXPIRED":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Lt(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),de(this.bb.channel.form,"credit_card_number")){if(e=ne(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(!te(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 U(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 mt(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(!L(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)}}class SessionFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionExpiredOrCanceledEvent)}}function ya(e,n){switch(e.type){case jt.PaymentRequest:n(new XenditPaymentRequestDiscardedEvent(e.id));break;case jt.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&&ya(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!==jt.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 U(R,i),qt(t.channel_code,t._mock_action_type)):await ut(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(Lt(this.bb.world,this.bb.channel,"SUCCESS"))),this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}).catch(e=>{L(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&&ya(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(Mt(n,t,"title")),r=a?e(function(e){return`failure_code.${e.toLowerCase()}`}(a),e("failure_code_unknown",{failureCode:a})):e(Mt(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.world?.session?.session_type,t=this.bb.channel.channel_code,a=this.bb.channel._mock_action_type,i=this.bb.channelProperties??{},r=new AbortController,o=async function(e,n,t,a,i,r,o,s){let l;if(n)switch(t){case"PAY":await U(R,o.signal),l=qt(a,i);break;case"SAVE":await U(R,o.signal),l=function(e,n){return"PENDING"===n?{payment_token_id:`pt-${z()}`,status:"PENDING",channel_code:e,actions:Bt(n),session_token_request_id:z()}:n?{payment_token_id:`pt-${z()}`,status:"REQUIRES_ACTION",channel_code:e,actions:Bt(n),session_token_request_id:z()}:{payment_token_id:`pt-${z()}`,status:"ACTIVE",channel_code:e,actions:[],session_token_request_id:z()}}(a,i);break;default:throw new Error(`The session type ${t} is not supported.`)}else switch(t){case"PAY":l=await ct(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r,save_payment_method:s},null,null,o.signal);break;case"SAVE":l=await dt(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 Dt(l)}(this.bb.sdkKey,this.bb.mock,n,t,a,i,r,e?this.bb.channelData?.savePaymentMethod??!1:void 0).then(e=>{switch(this.submission=null,e.type){case jt.PaymentRequest:this.bb.dispatchEvent(new XenditPaymentRequestCreatedEvent(e.id));break;case jt.PaymentToken:this.bb.dispatchEvent(new XenditPaymentTokenCreatedEvent(e.id))}this.bb.dispatchEvent(new InternalUpdateWorldState({paymentEntity:e,sessionTokenRequestId:e.entity.session_token_request_id}))}).catch(e=>{L(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:r,promise:o}}}function _a(e){switch(e.sdkStatus){case"LOADING":return ft(SdkLoadingBehavior);case"ACTIVE":return ft(SdkActiveBehavior,"active",function(e){switch(I(e.world?.session),e.world.session.status){case"ACTIVE":return ft(SessionActiveBehavior,"active",e.submissionRequested?function(e){return I(e.world),ft(SubmissionBehavior,"submission",e.world.paymentEntity&&null!==e.world.sessionTokenRequestId?function(e){function n(){return I(e.world?.paymentEntity),q(e.sdk,e.world.paymentEntity.entity.actions)?function(e){I(e.world?.paymentEntity);const n=q(e.sdk,e.world.paymentEntity.entity.actions);I(n);const t=e.world.paymentEntity.entity.actions.indexOf(n);return ft(ActionPaylinkBehavior,String(t))}(e):void 0}if(I(e.world?.paymentEntity),e.hackyOvoActionLatch&&"PENDING"===e.world.paymentEntity.entity.status)return ft(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[ft(ActionEmptyListPushNotificationBehavior,""),n()]);switch(e.world.paymentEntity.entity.status){case"PENDING":return ft(PaymentEntityPendingBehavior);case"REQUIRES_ACTION":return ft(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[ga(e),n()]);case"FAILED":case"EXPIRED":case"CANCELED":return ft(PaymentEntityFailedBehavior);case"ACCEPTING_PAYMENTS":throw new Error("Status ACCEPTING_PAYMENTS should not happen");case"AUTHORIZED":case"ACTIVE":case"SUCCEEDED":return ft(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 Vn(e,n.form,t,a))if(_n(i,t))return!1;return!0}(e.world.session.session_type,e.channel,e.channelProperties,e.channelData),t=ft(n?ChannelValidBehavior:ChannelInvalidBehavior),a=de(e.channel.form,"credit_card_number")?ft(CardInfoBehavior,e.channel.channel_code):void 0,i=de(e.channel.form,"installment_plan")?ft(PaymentOptionsBehavior,e.channel.channel_code):void 0;return[t,a,i]}(e));case"COMPLETED":return ft(SessionCompletedBehavior);case"EXPIRED":case"CANCELED":return ft(SessionFailedBehavior,e.world.session.status);case"PENDING":return ft(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 ft(SdkFatalErrorBehavior);default:throw e.sdkStatus,new Error(`Unknown SDK status: ${e.sdkStatus}`)}}function ga(e){if(I(e.world?.paymentEntity),e.actionCompleted)return ft(ActionCompletedBehavior);const n=O(e.world.paymentEntity.entity.actions);if(!n)return ft(ActionEmptyListPushNotificationBehavior,"");const t=e.world.paymentEntity.entity.actions.indexOf(n),a=!!q(e.sdk,e.world.paymentEntity.entity.actions);let i;switch(e.simulatePaymentRequested&&Q(n)&&(i=ft(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)?ft(ActionIframeBehavior,n.value):a?ft(ActionDeepLinkBehavior,String(t)):ft(ActionRedirectBehavior,n.value);case"DEEPLINK_URL":return ft(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 ft(ActionQrBehavior,String(t),i);case"PAYMENT_CODE":throw new Error(`Unsupported action type ${n.type} ${n.descriptor}`);case"VIRTUAL_ACCOUNT_NUMBER":return ft(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}`)}const va=e=>{const{onReady:a,options:i}=e,r=S(),o=r.t,s=w(),l=(()=>{const e=t.useContext(x);if(null===e)throw new Error("useBusiness must be used within a XenditSessionProvider");return e})(),d=A(),c=d?.google_pay;I(c);const u=t.useRef(!1),h=t.useRef(null),p=t.useRef(null),m=t.useMemo(()=>c.allowed_payment_methods.map(e=>e.payment_method_specification),[c.allowed_payment_methods]),f=t.useMemo(()=>({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:m,emailRequired:!0,merchantInfo:{merchantId:c.merchant_id,merchantName:l.name??""},transactionInfo:{transactionId:s.payment_session_id,totalPriceStatus:"FINAL",totalPrice:String(s.amount),currencyCode:s.currency}}),[l.name,c.merchant_id,m,s.amount,s.currency,s.payment_session_id]),b=t.useMemo(()=>({buttonColor:"default",buttonType:"plain",buttonRadius:999,buttonSizeMode:"fill",buttonBorderType:"no_border",...i}),[i]);t.useLayoutEffect(()=>{const e=window.google?.payments?.api?.PaymentsClient;e?p.current=new e({environment:r.isMock()?"TEST":"PRODUCTION"}):console.error("XenditComponents: Google Pay button was requested but the Google Pay SDK is not loaded.")},[r]);const y=t.useCallback(()=>{I(p.current),p.current.loadPaymentData(f).then(function(e){const n=function(e){I(c);const n=r.getActiveChannels();for(const t of c.allowed_payment_methods)if(t.payment_method_specification.type===e.paymentMethodData.type)return ka(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=c.allowed_payment_methods[0];I(i);const s=ka(r.getActiveChannels(),i.channel_code);r.submitDigitalWallet("GOOGLE_PAY",s,{},a)})},[c,f,r,o]);return t.useLayoutEffect(()=>{p.current&&(u.current||p.current.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:m}).then(function(e){e.result&&(u.current||(u.current=!0,a()))}).catch(function(e){console.error("XenditComponents: Error when checking if Google Pay is ready",e)}))},[m,a]),t.useLayoutEffect(()=>{if(!p.current)return;const e=p.current.createButton({...b,buttonLocale:s.locale,allowedPaymentMethods:m,onClick:y});h.current&&h.current.replaceChildren(e)},[b,m,y,s.locale]),n.jsx("div",{ref:h})};function ka(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 Ca=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},wa=e=>{const{digitalWalletCode:a,digitalWalletOptions:i}=e,r=t.useRef(null),o=t.useCallback(()=>{r.current?.parentElement?.style.setProperty("display","block")},[]);let s=null;if("GOOGLE_PAY"===a)s=n.jsx(Ca,{scriptTagRegex:Ea.GOOGLE_PAY.scriptTagRegex,checkLoaded:Ea.GOOGLE_PAY.checkLoaded,children:n.jsx(va,{onReady:o,options:i})});return n.jsx("div",{ref:r,children:s})},Ea={GOOGLE_PAY:{scriptTagRegex:/https:\/\/pay.google.com\/.*\/js\/pay.js/,checkLoaded:()=>"undefined"!=typeof google&&void 0!==google.payments}};class XenditComponents extends EventTarget{t=e=>{throw new Error("Localization used before initialization; this is a bug.")};[u];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]!==B&&null===K(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[u]={sdkKey:n,options:e,worldState:null,liveComponents:{channelPicker:null,paymentChannels:new Map,actionContainer:null,digitalWalletContainer:new Map},behaviorTree:new BehaviorTree(_a,{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},se(this),this.addEventListener("fatal-error",e=>{const n=e;this[u].eventListenersPresent.get("fatal-error")||console.error(`XenditComponents: A "fatal-error" event occurred but no event listener was attached: ${n.message}`)}),this[u].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 lt(this[u].sdkKey,this[u].sdkKey.sessionAuthKey),e.channels=e.channels.filter(e=>le[e.channel_code])}catch(e){return this[u].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[u].behaviorTree.bb.sdkFatalErrorMessage=Z(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:null}))}assertInitialized(){if(!this[u].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[u].sdkKey.hostId}supportsSimulationScenarios(){return this.isMock()||"pd"===this[u].sdkKey.hostId||"sd"===this[u].sdkKey.hostId}findChannel(e){this.assertInitialized();return this[u].worldState.channels.find(n=>n.channel_code===e)??null}onUpdateWorldState(e){const n=e.data;this[u].worldState=W(this[u].worldState??{},n);const t=this[u].worldState.session.locale;this.t=function(e){const n=fn[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[u].liveComponents.paymentChannels.get(n);a&&(a.data=W(a.data,t),this.behaviorTreeUpdate(),this.rerenderAllComponents())}behaviorTreeUpdate(){const e=this[u].behaviorTree.bb;if("LOADING"===e.sdkStatus&&this[u].worldState&&(e.sdkStatus="ACTIVE"),e.world=this[u].worldState,this[u].currentDigitalWalletSubmission)e.channel=this.findChannel(this[u].currentDigitalWalletSubmission.channelCode),e.channelProperties=this[u].currentDigitalWalletSubmission.channelProperties,e.channelData=null,e.channelIsDigitalWallet=!0,e.instantSubmissionError=this[u].currentDigitalWalletSubmission.instantSubmissionError;else{const n=this[u].currentChannelCode?this[u].liveComponents.paymentChannels.get(this[u].currentChannelCode):null;e.channel=n?re(n.channel[u],n.data.savePaymentMethod):null,e.channelProperties=n?n.channelProperties:null,e.channelData=n?n.data:null,e.channelIsDigitalWallet=!1}try{this[u].behaviorTree.update()}catch(e){this[u].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[u].behaviorTree.bb.sdkFatalErrorMessage=Z(e),this[u].behaviorTree.update()}}getSdkStatus(){return this[u].behaviorTree.bb.sdkStatus}rerenderAllComponents(){this.renderChannelPicker();for(const e of this[u].liveComponents.paymentChannels.keys())this.renderPaymentChannel(e);for(const e of this[u].liveComponents.digitalWalletContainer.keys())this.renderDigitalWalletComponent(e)}getSession(){return this.assertInitialized(),_e(this[u].worldState.session)}getCustomer(){return this.assertInitialized(),this[u].worldState.customer?(D((e=this[u].worldState.customer).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;var e}getActiveChannelGroups(e){return this.assertInitialized(),function(e,n,t){const a=Ce(n),i=Ee(e,t);return n.filter(e=>i[e.id]?.length).map(e=>ge(e,i,a,t))}(this[u].worldState.channels,this[u].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[u].worldState.session,pairChannels:Ae(this[u].worldState.channels)})}getActiveChannels(e){return this.assertInitialized(),function(e,n,t){const a=Ce(n),i=Ee(e,t);return e.filter(e=>we(e,t)).map(e=>ke(e,i,a,t))}(this[u].worldState.channels,this[u].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[u].worldState.session,pairChannels:Ae(this[u].worldState.channels)})}createChannelPickerComponent(){this[u].liveComponents.channelPicker&&this.destroyComponent(this[u].liveComponents.channelPicker);const e=document.createElement("xendit-channel-picker");return e.setAttribute("translate","no"),this[u].liveComponents.channelPicker=e,this[u].worldState&&this.renderChannelPicker(),this.setupUiEventsForChannelPicker(e),e}renderChannelPicker(){this.assertInitialized();const n=this[u].liveComponents.channelPicker;n&&e.render(e.createElement(P,{data:this[u].worldState,sdk:this,children:e.createElement(Ie,{})}),n)}setupUiEventsForChannelPicker(e){e.addEventListener(XenditClearCurrentChannelEvent.type,e=>{this.assertInitialized();const n=e,t=this[u].currentChannelCode;if(!t)return;const a=this[u].worldState.channels.find(e=>e.channel_code===t);a&&a.ui_group===n.uiGroup&&this.setCurrentChannel(null)})}createChannelComponent(n,t=!0){if(this.assertInitialized(),!oe(this[u].worldState.session,n[u][0]))throw new Error("Cannot create channel component: `session.amount` is outside of the channel's min/max amount.");const a=n[u][0].channel_code;t&&(this[u].currentChannelCode=a);const i=this[u].liveComponents.paymentChannels.get(a);let r,o=e.createRef();return i?(r=i.element,o=i.channelFormRef):(r=document.createElement("xendit-payment-channel"),r.setAttribute("data-channel-code",a),r.setAttribute("inert",""),r.setAttribute("translate","no"),r.style.setProperty("--xendit-channel-brand-color",n[u][0].brand_color),this.setupUiEventsForPaymentChannel(r),this[u].liveComponents.paymentChannels.set(a,{element:r,channel:n,channelProperties:null,channelFormRef:o,data:{savePaymentMethod:!1,cardDetails:null,paymentOptions:null}})),this.renderPaymentChannel(a),t&&(this.behaviorTreeUpdate(),this.syncInertAttribute()),this.dispatchEvent(new InternalNeedsRerenderEvent),r}renderPaymentChannel(n){this.assertInitialized();const t=this[u].liveComponents.paymentChannels.get(n);if(!t)return;const a=t.channel;e.render(e.createElement(P,{data:this[u].worldState,sdk:this,children:e.createElement(at,{channelOrPair:a[u],channelData:t.data,savePaymentMethod:t.data.savePaymentMethod,formRef:t.channelFormRef})}),t.element)}getActiveDigitalWallets(){return this.assertInitialized(),this[u].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=Ee(t,a);i.push({digitalWalletCode:"GOOGLE_PAY",get channels(){return t.map(e=>ke(e,o,r,a))},[u]:!0})}return i}(this[u].worldState.digitalWallets,this[u].worldState.channels,this[u].worldState.channelUiGroups,{options:{filterMinMax:!1},pairChannels:Ae(this[u].worldState.channels),session:this[u].worldState.session}):[]}createDigitalWalletComponent(e,n){this.assertInitialized();const t=this[u].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[u].liveComponents.digitalWalletContainer.set(e,{element:a,options:n}),this.renderDigitalWalletComponent(e),a}renderDigitalWalletComponent(n){this.assertInitialized();const t=this[u].liveComponents.digitalWalletContainer.get(n);t&&e.render(e.createElement(P,{data:this[u].worldState,sdk:this,children:e.createElement(wa,{digitalWalletCode:n,digitalWalletOptions:t.options})}),t.element)}getCurrentChannel(){const e=this[u].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[u].currentChannelCode,t=e?.[u][0].channel_code??null;if(n===t)return;this[u].currentChannelCode=t;let a=null;e&&t&&(a=this[u].liveComponents.paymentChannels.get(t)??null,a||(this.createChannelComponent(e,!1),a=this[u].liveComponents.paymentChannels.get(t)??null)),this.behaviorTreeUpdate(),this.syncInertAttribute(),this.renderChannelPicker()}syncInertAttribute(){const e=this[u].behaviorTree.bb.submissionRequested,n=this[u].liveComponents.paymentChannels;for(const[t,a]of n){(Array.isArray(a.channel.channelCode)?a.channel.channelCode[0]:a.channel.channelCode)!==this[u].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[u].liveComponents.paymentChannels.get(t);a&&(a.channelProperties=n.channelProperties,this.behaviorTreeUpdate())})}showValidationErrors(){if(!this[u].behaviorTree.findBehavior(ChannelInvalidBehavior))return;const e=this[u].currentChannelCode;if(!e)return;const n=this[u].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()}createActionContainerComponent(e){this.assertInitialized(),this[u].liveComponents.actionContainer&&this.destroyComponent(this[u].liveComponents.actionContainer);const n=e===u,t=n?void 0:e,a=this[u].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.");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[u].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[u].liveComponents.channelPicker===n)return this[u].liveComponents.channelPicker=null,e.render(null,n),void n.remove();for(const[t,a]of this[u].liveComponents.paymentChannels)if(a.element===n)return this[u].liveComponents.paymentChannels.delete(t),this[u].currentChannelCode===t&&this.setCurrentChannel(null),e.render(null,n),void n.remove();if(this[u].liveComponents.actionContainer===n)return this[u].liveComponents.actionContainer=null,e.render(null,n),void n.remove();for(const[t,a]of this[u].liveComponents.digitalWalletContainer)if(a.element===n)return this[u].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[u].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[u].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[u].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[u].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[u].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[u].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}submitDigitalWallet(e,n,t,a=null){this.assertInitialized(),this.setCurrentChannel(null),this[u].currentDigitalWalletSubmission={digitalWalletCode:e,channelCode:n[u][0].channel_code,channelProperties:t,instantSubmissionError:a},this.addEventListener(XenditSubmissionEndEvent.type,()=>{this[u].currentDigitalWalletSubmission=null},{once:!0}),this[u].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}abortSubmission(){this.assertInitialized();this[u].behaviorTree.findBehavior(SubmissionBehavior)&&(this[u].behaviorTree.bb.submissionRequested=!1,this.behaviorTreeUpdate())}simulatePayment(){if(this.assertInitialized(),"PAY"!==this[u].worldState.session.session_type)throw new Error('Unable to simulate payment, the session type is not "PAY".');if(!this[u].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[u].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||!Q(n))throw new Error("Unable to simulate payment; the action does not support simulation.");this[u].behaviorTree.bb.simulatePaymentRequested=!0,this.behaviorTreeUpdate()}pollImmediately(){if(this.assertInitialized(),"ACTIVE"!==this[u].worldState.session.status)throw new Error("Unable to poll immediately; the session is not longer active.");this[u].behaviorTree.bb.pollImmediatelyRequested=!0,this.behaviorTreeUpdate()}getState(){const e=this[u].currentChannelCode,n=this[u].liveComponents.paymentChannels.get(e??"");return{channelCode:e,channelProperties:n?.channelProperties||null,behaviorTree:this[u].behaviorTree}}addEventListener(e,n,t){return this[u].eventListenersPresent.set(e,!0),super.addEventListener(e,n,t)}removeEventListener(e,n,t){return super.removeEventListener(e,n,t)}static amountFormat(e,n){return un(e,n)}}class XenditComponentsTest extends XenditComponents{nextMockUpdate=null;constructor(e){super({...e,componentsSdkKey:`session-${H(32)}-mock-MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCADI5pdf6KmN8+Fxl2ES3yolUKXunNeY3gGScGNEvDcrcHAPKxIInAo5DVnDvTtYtqZvx/bu7HLeBJNMXwHhie/uyNEtT8dSaLc9bd0WSlYdxI+iUsTv2Qu0LiiPrZs-NKf7whM9meUs/eRCvG0oc180MDiyeli3kH6EQ3ZahECHsZQi5G2IpH6vk3cYMtf01Y1L4OBn1SZCOv1kwpjIUet4DJeoTwwq2nM5b+K7rD+/WFTi3AEX4NWJNkKi0a91`}),this.addEventListener(InternalScheduleMockUpdateEvent.type,this.setNextMockUpdate.bind(this))}async initializeAsync(){await M(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}}"undefined"==typeof window||"undefined"==typeof document||(c||(c=!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 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.xendit-dialog-with-background {\n background-color: var(--xendit-color-background);\n border-radius: 8px;\n box-shadow: var(--xendit-dialog-shadow);\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 position: absolute;\n top: 24px;\n right: 24px;\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-body {\n display: flex;\n padding: 24px;\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.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/* va actions */\n.xendit-action-va-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 display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-va-detail-item {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.xendit-action-va-detail-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.xendit-action-va-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.randomHexString=H,exports.randomUUID=z;
|
|
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("qrcode"),d=require("qrcode/lib/renderer/svg-tag.js");let c=!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{static type="session-complete";constructor(){super(XenditSessionCompleteEvent.type,{})}}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 u=Symbol("xendit-internal"),h=e=>n.jsx("div",{class:"xendit-accordion",children:e.children}),p=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=m(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=m(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=m(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=m(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=m(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=m(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=m(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=m(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=m(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 m(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",m=t.useCallback(()=>{l||c(i)},[l,c,i]),f=t.useCallback(e=>{"Enter"!==e.key&&" "!==e.key||(m(),e.preventDefault())},[m]),b=t.useCallback(()=>{m()},[m]);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:b,onKeyDown:f,role:"button",tabIndex:l?-1:0,children:[n.jsx(p,{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(p,{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})})]})},b=e.createContext(null);b.displayName="SessionContext";const x=e.createContext(null);x.displayName="BusinessContext";const y=e.createContext(null);y.displayName="CustomerContext";const _=e.createContext(null);_.displayName="ChannelsContext";const g=e.createContext(null);g.displayName="ChannelUiGroupsContext";const v=e.createContext(null);v.displayName="DigitalWalletsContext";const k=e.createContext(null);k.displayName="SdkContext";const C=e.createContext(null);C.displayName="CurrentChannelContext";const w=()=>{const e=t.useContext(b);if(null===e)throw new Error("useSession must be used within a XenditSessionProvider");return e},E=()=>{const e=t.useContext(_);if(null===e)throw new Error("useChannels must be used within a XenditSessionProvider");return e},A=()=>t.useContext(v),S=()=>{const e=t.useContext(k);if(null===e)throw new Error("useSdk must be used within a XenditSessionProvider");return e},P=()=>t.useContext(C),N=({children:e,data:t,sdk:a})=>{const{session:i,business:r,customer:o,channels:s,digitalWallets:l,channelUiGroups:d}=t,c=a.getCurrentChannel()?.[u]?.[0]??null;return"ACTIVE"!==a.getSdkStatus()||"ACTIVE"!==i.status?null:n.jsx(k.Provider,{value:a,children:n.jsx(C.Provider,{value:c,children:n.jsx(b.Provider,{value:i,children:n.jsx(x.Provider,{value:r,children:n.jsx(y.Provider,{value:o,children:n.jsx(_.Provider,{value:s,children:n.jsx(v.Provider,{value:l,children:n.jsx(g.Provider,{value:d,children:e})})})})})})})})},R=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 j(e,n){if(e!==n)throw new Error("Assertion failed; this is a bug, please contact support.")}function D(e){return new Promise(n=>setTimeout(n,1*e))}class AbortError extends Error{constructor(){super("AbortError"),this.name="AbortError"}}function L(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[u].options.enablePaylinks)return n.find(e=>"REDIRECT_CUSTOMER"===e.type&&"WEB_GOOGLE_PAYLINK"===e.descriptor)}const B="mock",V={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 W(e){return V[e]??null}function K(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 $(e){let n;if("string"==typeof e.channel_property)n=e.channel_property;else{n=Object.values(e.channel_property).join("__")}return n}const X=Math.floor(255*Math.random());function G(e){return`xendit-id-${$(e).split("").map(e=>(e.charCodeAt(0)%256^X).toString(16)).join("")}`}function z(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 H(){return[z(8),z(4),z(4),z(4),z(12)].join("-")}function Y(){return`xendit-id-${t.useRef(z(12)).current}`}function Q(e){return"PRESENT_TO_CUSTOMER"===e.type}function Z(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 J(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 ee(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 ne(e){const n=ee("card_details.card_number",e);return"string"!=typeof n?null:n}function te(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 ae=new WeakMap;let ie=1;function re(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 oe(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 se(e){Object.defineProperty(e,u,{enumerable:!1,writable:!1,configurable:!1,value:e[u]})}const le={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 de(e,n){for(const t of e)if(t.type.name===n)return!0;return!1}var ce,ue;!function(e){e.BARE="bare",e.PRIMARY_ROUNDED="primary-rounded",e.WHITE_ROUNDED="white-rounded"}(ce||(ce={})),function(e){e.SM="sm",e.MD="md"}(ue||(ue={}));const he=e=>{const{children:t,variant:i,size:r,type:o="button",...s}=e,l={[ce.BARE]:void 0,[ce.PRIMARY_ROUNDED]:"xendit-button-primary-rounded",[ce.WHITE_ROUNDED]:"xendit-button-white-rounded"}[i],d={[ue.SM]:"xendit-button-sm",[ue.MD]:void 0}[r??ue.MD];return n.jsx("button",{...s,className:a(e.className,"xendit-button",l,d),type:o,children:t})},pe=()=>{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"})})},me=e=>{const{id:a,options:i,onChange:r,defaultIndex:o=-1,selectedIndex:s,placeholder:l,disabled:d,className:c,fixedOverlayWidth:u,enableSearch:h}=e,m=S().t,f=Y(),b=a||f,x="number"==typeof s,[y,_]=t.useState(o),g=x?s:y,[v,k]=t.useState(g>=0?g:0),[C,w]=t.useState(!1),E=C&&!d&&i.length>0,[A,P]=t.useState(""),[N,R]=t.useState(0),I=t.useRef(null),T=t.useRef(null),q=t.useRef(null),j=t.useRef(null),D=t.useRef(null),L=t.useRef(null),M=t.useMemo(()=>{const e=i.map(ye).filter(({item:e})=>{if(""===A.trim())return!0;const n=A.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)},[A,i]),O=Math.max(0,Math.min(M.length-1,v));t.useLayoutEffect(()=>{if(u)return void R(u);const e=I.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=I.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=T.current;n&&(n.contains(e.target)||w(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E]),t.useLayoutEffect(()=>{if(!E)return;const e=e=>{const n=T.current;n&&e.relatedTarget&&(n.contains(e.relatedTarget)||w(!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(!j.current)return;if(!q.current)return;const e=q.current.parentElement;e&&(e.scrollTop=j.current.offsetTop-e.clientHeight/2+j.current.clientHeight/2)},[E,v]);const U=t.useCallback(()=>{E||(w(!0),queueMicrotask(()=>D.current?.focus()))},[E]),B=t.useCallback(()=>{E&&(w(!1),P(""),I.current?.focus())},[E]),V=t.useCallback(()=>{E?B():U()},[B,E,U]),W=t.useCallback(e=>{const n=i[e];n&&(n.disabled||(x||_(e),r(n,e),B()))},[B,x,r,i]),K=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&&W(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,W,M]),F=t.useCallback(e=>{if(E)return K(e);"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),U())},[K,E,U]),$=t.useCallback(e=>{e.stopPropagation(),e.preventDefault(),W(Number(e.currentTarget.dataset.index))},[W]),X=t.useCallback(e=>{P(e.currentTarget.value),k(0)},[]),G=g>=0?i[g]:void 0;return n.jsxs("div",{className:"xendit-dropdown-container",ref:T,style:{"--xendit-dropdown-width":N+"px"},children:[n.jsxs("button",{id:b,ref:I,type:"button",className:`xendit-dropdown ${c} ${E?"xendit-dropdown-open":""} ${be(G)?"xendit-dropdown-has-asset":""}`,"aria-expanded":E?"true":"false",onClick:V,onKeyDown:F,disabled:d,children:[G?.leadingAsset??null,G?n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:G.shortTitle??G.title}):n.jsx("span",{className:"xendit-dropdown-text xendit-text-14",children:l}),n.jsx(p,{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:m("combobox.default_search_placeholder"),value:A,onInput:X,onClick:xe,onKeyDown:K})}):null,n.jsx("ul",{ref:q,role:"listbox",tabIndex:-1,onKeyDown:K,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:$,ref:r?j: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(p,{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(pe,{})})});function be(e){return!!e&&!(!e.leadingAssetInOverlay&&!e.leadingAsset)}function xe(e){e.stopPropagation()}function ye(e,n){return{item:e,originalIndex:n}}function _e(e){return function(e,n){if(e===n)throw new Error("Assertion failed; this is a bug, please contact support.")}(e.session_type,"AUTHORIZATION"),j(e.mode,"COMPONENTS"),J({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=>J({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 ge(e,n,t,a){const i=J({groupId:e.id,label:e.label,get channels(){return(n[e.id]||[]).map(e=>ke(e,n,t,a))},[u]:e});return se(i),i}function ve(e,n){return ke(e,{},{},n)}function ke(e,n,t,a){I(!a.pairChannels.paired[e.channel_code]);const i=J({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 ge(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})),[u]:a.pairChannels.pairs[e.channel_code]??[e]});return se(i),i}function Ce(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&&!oe(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 Ee(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"}),Pe=e=>{const{group:a,open:i}=e,r=S(),{t:o}=r,s=w(),l=E(),d=P(),c=s.session_type,u=Y(),[h,p]=t.useState(null),m=t.useRef(null),[f,b]=t.useState(!1),x=t.useRef(null),y=t.useMemo(()=>Ae(l),[l]),_=t.useMemo(()=>({pairChannels:y,session:{amount:s.amount,session_type:s.session_type},options:{filterMinMax:!1}}),[y,s.amount,s.session_type]),g=t.useMemo(()=>l.filter(e=>we(e,_)&&e.ui_group===a.id),[l,a.id,_]);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(ve(d,_)),x.current.parentElement!==m.current&&(b(!0),m.current.replaceChildren(x.current)))},[g,d,_,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(ve(e,_))}},[g,d,h,_,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?ve(n,_):null)},[l,_,r]),C=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:!oe(s,e),description:Ne(o,s,e)||void 0})),[g,s,o]),A=1===g.length&&"CARDS"===g[0].channel_code;return n.jsxs("div",{className:"xendit-channel-picker-group",children:[A?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(me,{id:u,selectedIndex:function(){const e=C.findIndex(e=>e.value===d?.channel_code);if(-1!==e)return e;const n=C.findIndex(e=>e.value===h);return-1!==n?n:1===C.length?0:-1}(),options:C,disabled:C.length<=1,onChange:k,placeholder:o("payment_methods.select_channel_placeholder",{groupName:a.label,ns:"session"})})]}),!A&&f?n.jsx(Se,{}):null,n.jsx("div",{style:{display:f?"":"none"},ref:m})]})};function Ne(e,n,t){return oe(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 a=S(),i=t.useRef(null),r=A(),o=r?.google_pay;return t.useLayoutEffect(()=>{if(i.current&&o){const e=a.createDigitalWalletComponent("GOOGLE_PAY");return i.current.appendChild(e),()=>{e.remove()}}},[o,a]),n.jsx("div",{ref:i,className:"xendit-channel-picker-digital-wallet-section"})},Ie=e=>{const a=S(),i=w(),r=(()=>{const e=t.useContext(g);if(null===e)throw new Error("useChannelUiGroups must be used within a XenditSessionProvider");return e})(),o=P(),s=E(),{t:l}=S(),d=t.useMemo(()=>Ee(s,{options:{filterMinMax:!1},pairChannels:Ae(s),session:i}),[s,i]),c=t.useRef(null),p=t.useMemo(()=>Ae(s),[s]),m=t.useMemo(()=>({pairChannels:p,session:{amount:i.amount,session_type:i.session_type},options:{filterMinMax:!1}}),[p,i.amount,i.session_type]),b=o?.ui_group??null,[x,y]=t.useState(null),_=t.useCallback(e=>{if(b===e||x===e)b===e&&c.current?.dispatchEvent(new XenditClearCurrentChannelEvent(e)),x===e&&y(null);else{const n=r.find(n=>n.id===e);I(n);const t=Te(i,n,s,l).enabledChannels;if(0===t)return;if(1===t){const n=d[e][0];a.setCurrentChannel(ve(n,m)),y(null)}else y(e),a.setCurrentChannel(null)}},[r,s,d,m,x,a,b,i,l]);t.useLayoutEffect(()=>{null!==o&&null!==x&&y(null)},[o,x]);const v=a[u].options.enableDigitalWallets??!1;return n.jsxs("div",{ref:c,children:[v?n.jsx(Re,{}):null,n.jsx(h,{children:r.filter(e=>(d[e.id]||[]).length>0).map(e=>{const t=null!==b?b===e.id:x===e.id,a=Te(i,e,s,l),r=0===a.enabledChannels,c=a.firstDisabledChannelReason;return n.jsx(f,{id:e.id,title:e.label,iconName:je(b===e.id?o:null,d[e.id]),subtitle:c??void 0,open:t,disabled:r,onClick:_,children:n.jsx(Pe,{group:e,open:t})},e.id)})})]})};function Te(e,n,t,a){let i=null,r=0;for(const o of t)o.ui_group===n.id&&(oe(e,o)?r++:null===i&&(i=Ne(a,e,o)));return{enabledChannels:r,firstDisabledChannelReason:i}}const qe={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 je(e,n){if(e&&e.pm_type&&qe[e.pm_type])return qe[e.pm_type];for(const e of n)if(e.pm_type&&qe[e.pm_type])return qe[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 De=({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"}}),Le=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(a),[s,l]=t.useState(void 0),d=Me.findIndex(e=>e.value===s),c=t.useRef(null);Oe(e=>{if(c.current){const n=Me.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(me,{id:r,options:Me,onChange:u,placeholder:a.placeholder,selectedIndex:d,enableSearch:!0,className:"xendit-form-field-inner"})]})},Me=i.getCountries().map(e=>({title:new Intl.DisplayNames(["en"],{type:"region"}).of(e),value:e,leadingAsset:n.jsx(De,{countryCode:e})})).sort((e,n)=>e.title.localeCompare(n.title));function Oe(e){const n=tt()?.cardDetails,a=n?.details?.country_codes[0],i=F(a);t.useLayoutEffect(()=>{a&&a!==i&&e(a)})}const Ue=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(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(me,{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 Be="undefined"!=typeof window&&window.HTMLElement?window.HTMLElement:EventTarget;class XenditFormAssociatedFocusTrap extends Be{static tag="xendit-form-associated-focus-trap";static formAssociated=!0;internals;constructor(){super(),this.internals=this.attachInternals()}}var Ve;Ve=XenditFormAssociatedFocusTrap,"undefined"!=typeof window&&window.customElements&&customElements.define(Ve.tag,Ve);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 We=e.createContext(null);I("https://assets.xendit.co/components/secure-iframe-v0.0.19.html");const Ke=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.19.html").origin,Fe=({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,Ke)}};return n.jsx(We.Provider,{value:i,children:e})};I("https://assets.xendit.co/components/secure-iframe-v0.0.19.html");const $e=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.19.html"),Xe=$e.toString(),Ge=$e.origin,ze=e=>{const{field:a,onChange:i}=e,r=S(),o=G(a),s=$(a),l=w(),d=t.useRef(null),c=t.useRef(null),[h,p]=t.useState(),[m,f]=t.useState(!1),[b,x]=t.useState(null),{card:y}=et()??{},_=t.useCallback(e=>{if(!d.current)return;const n=d.current.contentWindow;if(e.source!==n)return;if(e.origin!==Ge)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,h,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":f(!0);break;case"xendit-iframe-blur":f(!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,h,i]),g=t.useCallback(()=>{d.current?.contentWindow&&d.current.contentWindow.postMessage({type:"xendit-iframe-focus"},Ge)},[]);t.useLayoutEffect(()=>(window.addEventListener("message",_),()=>{window.removeEventListener("message",_)}),[_]);const v=t.useContext(We);t.useLayoutEffect(()=>(v?.registerIframe(s,d),()=>v?.unregisterIframe(s)),[s,v]);const k=new URL(Xe);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[u].sdkKey.publicKey),k.searchParams.set("sig",r[u].sdkKey.signature),r[u].options.iframeFieldAppearance&&k.searchParams.set("appearance",JSON.stringify(r[u].options.iframeFieldAppearance));const C=m?"xendit-field-focus":"";return n.jsxs("div",{className:`xendit-iframe-container xendit-form-field-inner ${C}`,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&&y&&n.jsx(He,{cardsBrandList:y.brands,selectedCardBrand:b})]})},He=({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))})},Ye=e=>{const{field:a,onChange:s}=e,l=G(a),d=$(a),c=w(),u=t.useRef(null),[h,p]=t.useState(c.country),m=t.useMemo(()=>{const e=Qe.findIndex(e=>e.value===h);return-1===e?0:e},[h]),f=Qe[m],[b,x]=t.useState(""),y=t.useRef(null),_=t.useCallback((e,n)=>{const t=Ze(e,n);return t?t.number:`+${e.dial}${n}`},[]),g=t.useCallback((e,n)=>{u.current&&(u.current.value=_(e,n))},[_]);function v(e){const n=e;p(n.value),g(n,b),s()}return Oe(e=>{const n=Qe.find(n=>n.value===e);n&&n.value!==h&&!b&&v(n)}),n.jsxs("div",{className:"xendit-input-phone",children:[n.jsx(me,{options:Qe,selectedIndex:m,onChange:v,fixedOverlayWidth:300,enableSearch:!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(){const e=Ze(f,b);if(e){const n=e.formatInternational();x(n.replace(`+${r.getCountryCallingCode(f.value)} `,""))}}(),e.currentTarget?.value&&u.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){const n=e.target.value;x(n),g(f,n),s()},value:b,autoComplete:"tel"}),n.jsx("input",{type:"hidden",name:d,ref:u})]})},Qe=Me.map(e=>{const n=r.getCountryCallingCode(e.value);return n?{...e,shortTitle:`+${n}`,title:`${e.title} (+${n})`,dial:n}:null}).filter(e=>Boolean(e)),Ze=(e,n)=>{const t=i(n,e.value);return t&&t.isPossible()?t:null};function Je(e){return{title:e.name,value:e.value}}const en=[{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(Je),nn=[{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(Je),tn=[{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})),an=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(a),s=w(),l=et()?.form,d=Un(),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 en;case"CA":return nn;case"GB":return tn;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=ee(e.channel_property,t);if(n&&"string"==typeof n)return n}}}return a.country}(a,l??[],d??{},s)),f=F(m);return t.useLayoutEffect(()=>{f!==m&&u()},[u,m,f]),n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"hidden",name:o,defaultValue:"",ref:c}),m?n.jsx(me,{id:r,options:m,onChange:h,placeholder:a.placeholder,enableSearch:!0,className:"xendit-form-field-inner"},(b=m,ae.has(b)||ae.set(b,ie++),ae.get(b).toString())):n.jsx("input",{type:"text",id:r,onChange:p,placeholder:a.placeholder,className:"xendit-form-field-inner xendit-text-14"})]});var b};const rn=e=>{const{field:a,onChange:i}=e,r=G(a),o=$(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:on(a)?a.type.min_length:void 0,maxLength:on(a)?a.type.max_length:void 0,autoComplete:on(a)?a.type.autocomplete:void 0})};function on(e){return"text"===e.type.name}const sn={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"},ln={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:"MX$",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$"},dn={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$"},cn={BHD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function un(e,n){let t;const a=e<0,i=sn[n]??"en",r=cn[n]??2;if(t=new Intl.NumberFormat(i,{style:"decimal",minimumFractionDigits:r,maximumFractionDigits:20}).format(Math.abs(e)),t=t.replace(/(\.|,)000?$/,""),ln[n]){const e=ln[n]??n;t=(dn[n]??"$1").replace("$",e).replace("1",t)}else t=n+" "+t;return a&&(t="-"+t),t}const hn=e=>{const{field:a,onChange:i}=e,{t:r}=S(),o=w(),s=G(a),l=$(a),d=t.useRef(null),c=et();I(c);const u=t.useMemo(()=>de(c.form,"credit_card_number"),[c.form]),h=tt()?.paymentOptions,p=h?.options?.installment_plans,[m,f]=t.useState(null),b=t.useMemo(()=>{const e=p?.map(e=>({title:r("installment_plan.pay_in_installments",{installments:e.terms,amount:un(e.installment_amount,o.currency)}),subtitle:e.interest_rate,value:pn(e)}))??[];return u&&e.unshift({title:r("installment_plan.pay_in_full",{amount:un(o.amount,o.currency)}),value:""}),e},[u,p,o.amount,o.currency,r]);let x=b?.findIndex(e=>e.value===m);-1===x&&(x=0);const y=t.useCallback(()=>{f(null),d.current&&(d.current.value="")},[]),_=t.useCallback(e=>{if(d.current){const n=p?.find(n=>pn(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)}f(e.value),i()},[p,i]);t.useLayoutEffect(()=>{b.length&&_(b[0])},[]);const g=F(b);return t.useLayoutEffect(()=>{b===g||p?.some(e=>pn(e)===m)||(b.length?_(b[0]):y())},[y,b,_,p,g,m]),n.jsxs(n.Fragment,{children:[h?n.jsx(me,{id:s,placeholder:a.placeholder,onChange:_,options:b,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 pn(e){return`${e.terms}_${e.interval}_${e.code??""}`}const mn=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(ze,{...e});case"phone_number":return n.jsx(Ye,{...e});case"text":case"email":case"postal_code":return n.jsx(rn,{...e});case"dropdown":return n.jsx(Ue,{...e});case"installment_plan":return n.jsx(hn,{...e});case"country":return n.jsx(Le,{...e});case"province":return n.jsx(an,{...e})}throw t.type,new Error(`Unsupported field type: ${t.type.name}`)}()})};const fn={en:{session:{"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","validation.required":"{{field}} is required","validation.text_too_long":"{{field}} is too long","validation.text_too_short":"{{field}} is too short","payment.save_checkbox_label":"Save for faster payment next time","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}}","default_error.message_1":"There was a problem with the request.","default_error.message_2":"Please try again later.","default_error.title":"Error","combobox.default_search_placeholder":"Search...","installment_plan.pay_in_full":"Pay in Full — {{amount}}","installment_plan.pay_in_installments":"{{installments}}x Installments — {{amount}}","google_pay_errors.developer_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.buyer_account_error.title":"Google Pay Error","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.merchant_account_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.internal_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.unknown_error.title":"Google Pay Error","google_pay_errors.unknown_error.message":"An unknown error occurred with Google Pay. The error code is {{statusCode}}.","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}}","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","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_va.merchant_name":"Virtual Account Name","action_va.amount_to_pay":"Amount to Pay","action_va.virtual_account_number":"Virtual Account Number","action_va.copy":"Copy","action_va.copied_to_clipboard":"Copied to clipboard","action_qr.unable_to_generate":"Unable to generate QR code","action_deeplink.button":"Open App","action_deeplink.instructions":"Please complete your payment on your {{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...","image_alt.channel_logo":"{{channelName}} logo","simulation.simulate_scenario":"Simulate scenario","simulation.simulate_test_scenario":"Simulate a test scenario","simulation.select_scenario":"Select a scenario","simulation.want_to_test_all_scenarios":"Want to test different scenarios?","simulation.see_all_scenarios":"See the full list here."}}.session,id:{session:{"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","validation.required":"{{field}} wajib diisi","validation.text_too_long":"{{field}} terlalu panjang","validation.text_too_short":"{{field}} terlalu pendek","payment.save_checkbox_label":"Simpan untuk pembayaran lebih cepat lain kali","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}}","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}}","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","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_va.amount_to_pay":"Jumlah Pembayaran","action_va.virtual_account_number":"Nomor Virtual Account","action_qr.unable_to_generate":"Tidak dapat membuat kode QR"}}.session,th:{session:{"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}} สั้นเกินไป","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}}","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}})","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":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","action.payment_confirmation_instructions":"เมื่อคุณชำระเงินแล้ว คลิกที่ปุ่มด้านบนเพื่อยืนยันการชำระเงิน","action.payment_made":"ฉันได้ชำระเงินแล้ว","action_va.amount_to_pay":"ยอดชำระ","action_va.virtual_account_number":"หมายเลข Virtual Account","action_qr.unable_to_generate":"ไม่สามารถสร้างคิวอาร์โค้ดได้"}}.session,vi:{session:{"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","payment.save_checkbox_label":"Lưu để thanh toán nhanh hơn lần sau","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}}","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}}","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","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_va.amount_to_pay":"Số tiền cần thanh toán","action_va.virtual_account_number":"Số tài khoản định danh (Virtual Account)","action_qr.unable_to_generate":"Không thể tạo mã QR"}}.session};const bn=(e,n,t)=>n?(e=>"object"==typeof e&&null!==e&&"localeKey"in e)(n)?e(n.localeKey,{field:t.label}):n.value:null;function xn(e){return e.startsWith("/")&&e.endsWith("/")?e.slice(1,-1):e}function yn(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=te(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(xn(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 _n(e,n){const t=Array.isArray(e.channel_property)?e.channel_property:[e.channel_property];for(const a of t){let t=gn(n,a);if(void 0===t&&(t=""),"string"!=typeof t)continue;const i=yn(e,t);if(i)return i}}function gn(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 gn(a,t.slice(1).join("."))}}const vn=e.createContext(null),kn=({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(vn.Provider,{value:{open:r,setOpen:o,scenarios:e,onSelect:a},children:i})})},Cn=({children:e})=>n.jsx("div",{className:"xendit-form-simulation-root",children:e}),wn=({children:e})=>{const{open:a,setOpen:i}=t.useContext(vn)||{};return n.jsx("button",{type:"button",className:"xendit-form-simulation-trigger",onClick:()=>i?.(!a),children:e})},En=()=>{const e=t.useContext(vn);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(me,{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},An="field-radius-bl-0",Sn="field-radius-br-0",Pn="field-radius-tl-0",Nn="field-radius-tr-0",Rn="field-collapse-r",In="field-collapse-l",Tn="field-collapse-t",qn="field-collapse-b",jn=({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[$(t)])continue;const e=_n(t,o??{});if(e)return n.jsx("span",{className:"xendit-error-message xendit-text-12",children:bn(l,e,t)})}return null})();return n.jsx(Fe,{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(Dn,{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({[An]:p>r+1||i%2==1,[Sn]:!!h[n+1],[Pn]:n>0,[Nn]:!(0===r&&1===o||0===r&&0===o&&2===e.span),[Rn]:1===e.span&&0===o,[In]:1===e.span&&1===o,[Tn]:i>=2,[qn]:!s})})(e,t,i);return n.jsx(mn,{className:o,field:e,onChange:r},t)})},i),m]})})},Dn=({simulationScenarios:e,fieldGroup:a})=>{const i=t.useContext(We),{t:r}=S();return n.jsx(kn,{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=>$(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(Cn,{children:[n.jsx(wn,{children:n.jsx("div",{className:"xendit-text-12 xendit-text-semibold xendit-text-link",children:r("simulation.simulate_scenario")})}),n.jsx(En,{})]})})},Ln={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"},Mn=s.forwardRef(({form:e,onChannelPropertiesChanged:a},i)=>{const r=w(),o=et(),s=S(),l=tt(),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=Bn(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(()=>Vn(e.session_type,n,a,i),[i,a,n,e.session_type]);return r}(r,e,c||{},l??null),f=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})(f||[],m)||p()},[m,p,f]);const b=t.useCallback(e=>s.supportsSimulationScenarios()&&"CARDS"===o?.channel_code&&e.some(e=>"credit_card_number"===e.type.name)?Ln: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(On.Provider,{value:c,children:x.map((e,t)=>n.jsx(jn,{fieldGroup:e,groupIndex:t,handleFieldChanged:p,channelProperties:c,simulationScenarios:b(e)},t))})})})}),On=e.createContext(null),Un=()=>t.useContext(On);function Bn(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 Vn(e,n,t,a){const i=de(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=gn(t,n);switch(a){case"equals":if(r!==i)return!1;break;case"not_equals":if(r===i)return!1}}return!0})}const Wn=e=>{const a=t.useRef(null),i=t.useRef(null),r=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{r&&(a.current?.animate(Kn,Fn),i.current?.animate($n,Xn))},[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"})]})]})]})},Kn=[{transform:"scale(0.1)"},{transform:"scale(1)"}],Fn={duration:500,easing:"ease-out"},$n=[{transform:"rotate(0deg)"},{transform:"rotate(5deg)"},{transform:"rotate(-5deg)"},{transform:"rotate(0deg)"}],Xn={duration:1e3,easing:"ease-out",iterations:1/0,delay:2e3},Gn=[{transform:"translateY(0)"},{transform:"translateY(44px)"}],zn={duration:1e3,delay:1e3,easing:"ease-out"},Hn={duration:1e3,direction:"reverse",delay:500,easing:"ease-in"},Yn=[{opacity:1},{opacity:0},{opacity:1}],Qn={duration:1e3},Zn=e=>{const{id:t,label:a,checked:i,onChange:r,disabled:o}=e,s=Y(),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})]})},Jn=e.createContext(null),et=()=>{const e=t.useContext(Jn);if(void 0===e)throw new Error("useChannel must be used within a ChannelProvider");return e},nt=e.createContext(null);nt.displayName="ChannelComponentDataContext";const tt=()=>t.useContext(nt),at=e=>{const{channelOrPair:a,channelData:i,savePaymentMethod:r,formRef:o}=e,s=t.useRef(null),l=S(),{t:d}=l,c=w(),u=a[0],h=a.length>1,p=re(a,r),m=function(e){if(e&&2===e.length)return[e[0],e[1]];return null}(p.instructions),f="OPTIONAL"===c.allow_save_payment_method&&(p.allow_save||h);return t.useLayoutEffect(()=>{m||p.form.length||p.banner||console.error(`Missing display data for ${p.channel_code}, this is a bug, please contact support`)},[m,p.banner,p.channel_code,p.form]),n.jsx(Jn.Provider,{value:p,children:n.jsx(nt.Provider,{value:i,children:n.jsxs("div",{className:"xendit-payment-channel",ref:s,children:[n.jsx(Mn,{ref:o,form:p.form,onChannelPropertiesChanged:e=>{let n=e;if("CARDS"===u.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(u.channel_code,n);s.current?.dispatchEvent(t)}}),p.banner?n.jsx(rt,{banner:p.banner}):null,f&&n.jsx(Zn,{label:d("payment.save_checkbox_label"),onChange:e=>{const n=e.target?.checked;l?.dispatchEvent(new InternalUpdateChannelComponentData(u.channel_code,{savePaymentMethod:n}))},checked:r}),m?n.jsxs("div",{className:"xendit-payment-channel-instructions",children:[it[p.pm_type??""]??n.jsx(Wn,{}),n.jsx("div",{className:"xendit-payment-channel-instructions-text xendit-text-12",children:m.map((e,t)=>n.jsx("p",{className:0===t?"xendit-text-semibold":void 0,children:e},t))})]}):null]})})})},it={EWALLET:n.jsx(Wn,{}),QR_CODE:n.jsx(e=>{const a=t.useRef(null),i=t.useRef(null),r=Y(),o=void 0!==HTMLElement.prototype.animate;return t.useLayoutEffect(()=>{if(o&&a.current){const e=()=>{if(!a.current)return;const n=a.current.animate(Gn,zn);setTimeout(()=>{i.current?.animate(Yn,Qn)},1e3),n.onfinish=()=>{const n=a.current?.animate(Gn,Hn);setTimeout(()=>{i.current?.animate(Yn,Qn)},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"})})})]})},{})},rt=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 ot(e){const n=new URLSearchParams;return n.append("payload",JSON.stringify(e)),n}function st(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.19";I(d),I(d.startsWith("v"));const c=i.hostId;if(c===B)throw new Error("A network request was made in mock mode; this is a bug.");const u=W(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?ot(s):void 0,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:l},f=await fetch(h,m);if(!f.ok){const e=await f.json();if(!e||!e.error_code)throw new Error("Unexpected error response from server");throw new NetworkError(e)}return f.json()}}const lt=st("GET",e=>`/api/sessions/${e}`),dt=st("POST",()=>"/api/sessions/payment_tokens"),ct=st("POST",()=>"/api/sessions/payment_requests"),ut=st("POST",e=>`/api/sessions/${e.sessionAuthKey}/payment_requests/${e.paymentRequestId}/simulate`),ht=st("GET",e=>`/api/sessions/${e}/poll`,e=>new URLSearchParams(e?{token_request_id:e}:{})),pt=st("POST",e=>`/api/sessions/${e}/card_info`),mt=st("POST",e=>`/api/sessions/${e}/payment_options`);function ft(e,n,t){return{impl:e,key:n??"",child:t,instance:void 0}}class BehaviorTree{fn;bb;root=ft(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,bt(e);const n=this.root??void 0,t=this.fn(this.bb);this.root=t,xt(n,t,this.bb,0)}}finally{this.updating=!1}}findBehavior(e){return gt(this.root,e)}}function bt(e){if(e>32)throw new Error("Max recursion depth exceeded; this is a bug, please contact support.")}function xt(e,n,t,a){if(bt(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&&_t(e,a+1),n&&yt(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++)xt(e[r],n[r],t,a+1)}else n&&(n.instance=e?.instance),e&&(e.instance=void 0),xt(e?.child,n?.child,t,a+1),n?.instance?.update?.()}function yt(e,n,t){if(bt(t),Array.isArray(e))for(const a of e)a&&yt(a,n,t+1);else e.instance=new e.impl(n,e.key),e.instance.enter?.(),e.child&&yt(e.child,n,t+1)}function _t(e,n){if(bt(n),Array.isArray(e))for(const t of e)t&&_t(t,n+1);else e.child&&_t(e.child,n+1),e.instance?.exit?.(),e.instance=void 0}function gt(e,n){if(Array.isArray(e))for(const t of e){if(!t)continue;const e=gt(t,n);if(e)return e}else{if(e.impl===n)return e.instance??null;if(e.child)return gt(e.child,n)}return null}class ActionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){}}const vt=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]}),kt=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(vt,{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})})},Ct=e=>{const{title:a,onClose:i,children:r,seamless:o,borderColor:s}=e,l=t.useRef(!1),d=t.useRef(!1),c=t.useRef(null),u=t.useRef(null),h=void 0!==HTMLElement.prototype.animate,m=t.useCallback(()=>{l.current||(l.current=!0,i())},[i]),f=t.useCallback(()=>{if(!c.current||!u.current||d.current)return;if(d.current=!0,!h)return void m();u.current.animate?.(St,Et);const e=c.current.animate?.(Nt,Et);e.onfinish=m},[m,h]);return t.useLayoutEffect(()=>{h&&(u.current?.animate?.(At,wt),c.current?.animate?.(Pt,wt))},[h]),t.useLayoutEffect(()=>{e.close&&f()},[e.close,f]),n.jsx("div",{className:"xendit-dialog-backdrop",ref:u,children:n.jsxs("div",{className:"xendit-dialog",ref:c,style:s?{border:`4px solid ${s}`}:void 0,children:[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(p,{name:"x",size:20})})]}),n.jsx("div",{className:"xendit-dialog-body",style:e.noPadding?{padding:"0"}:void 0,children:r}),o?n.jsx("button",{"aria-label":"Close",onClick:f,className:"xendit-dialog-floating-close",children:n.jsx(p,{name:"x",size:20})}):null]})})},wt={duration:500,easing:"cubic-bezier(.32,.23,0,.92)",fill:"forwards"},Et={duration:200,easing:"linear",fill:"forwards"},At=[{backgroundColor:"rgba(0, 0, 0, 0)"},{backgroundColor:"rgba(0, 0, 0, 0.2)",offset:.1},{backgroundColor:"rgba(0, 0, 0, 0.6)"}],St=At.slice().reverse(),Pt=[{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:1,transform:""}],Nt=[{opacity:1,transform:""},{opacity:0,transform:"scale(0.92) translateY(-10px)"}];function Rt(e){const{sdk:a,title:i,onClose:r,width:o,height:s,borderColor:l}=e,d=t.useRef(null);return t.useLayoutEffect(()=>{const e=a.createActionContainerComponent(u);return d.current?.replaceChildren(e),()=>{a.destroyComponent(e)}},[a]),n.jsx(Ct,{title:i,onClose:r,close:e.close,borderColor:l,noPadding:e.defaultActionContainerType===It.QrWithCustomArt,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 It;!function(e){e.QrWithCustomArt="qr-with-custom-art",e.Generic="generic"}(It||(It={}));class ContainerActionBehavior{bb;cleanupFn=null;defaultContainerHeight=0;defaultContainerWidth=400;title="Complete your payment";constructor(e){this.bb=e}ensureHasActionContainer(n=It.Generic){if(I(this.bb.channel),this.bb.sdk[u].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(Rt,r),i),document.body.appendChild(i),n=>{n||(a=!0),t||e.render(e.createElement(Rt,{...r,close:!0}),i)}}cleanupActionContainer(e){this.cleanupFn&&(this.cleanupFn(e),this.cleanupFn=null)}emptyActionContainer(){const n=this.bb.sdk[u].liveComponents.actionContainer;n&&e.render(null,n)}updateActionContainerBrandColor(){I(this.bb.channel);const e=this.bb.sdk[u].liveComponents.actionContainer;e&&e.style.setProperty("--xendit-channel-brand-color",this.bb.channel.brand_color)}populateActionContainer(n){const t=this.bb.sdk[u].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(j(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(kt,{t:t,channel:a,redirectUrl:n.value}))}exit(){super.exit()}}const Tt=e=>{const t=e.t,a=e.channel,i=a.brand_name;return n.jsx(vt,{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 qt;function jt(e){return"payment_request_id"in e?{id:e.payment_request_id,type:qt.PaymentRequest,entity:e}:{id:e.payment_token_id,type:qt.PaymentToken,entity:e}}function Dt(e,n,t){return`${e===qt.PaymentRequest?"payment_request":"payment_token"}_status.${n.toLowerCase()}.${t}`}!function(e){e.PaymentRequest="REQUEST",e.PaymentToken="TOKEN"}(qt||(qt={}));function Lt(e,n,t){const{session:a,paymentEntity:i}=e;switch(I(a),I(i),I(n),t){case"PENDING":return Mt(a);case"PENDING_PAYMENT_ENTITY_ONLY":return function(e,n){const t=n.type===qt.PaymentRequest?n.entity:void 0,a=n.type===qt.PaymentToken?n.entity:void 0;return{session:e,payment_request:Ot(t,"PENDING"),payment_token:Ot(a,"PENDING")}}(a,i);case"SUCCESS":return"PENDING"===n._mock_action_type?Mt(a):function(e,n){const t=n.type===qt.PaymentRequest?n.entity:void 0,a=n.type===qt.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:Ot(t,"SUCCEEDED"),payment_token:Ot(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===qt.PaymentRequest?n.entity:void 0,a=n.type===qt.PaymentToken?n.entity:void 0;return{session:{...e,status:"ACTIVE"},payment_request:Ot(t,"FAILED"),payment_token:Ot(a,"FAILED")}}(a,i)}}function Mt(e){return{session:{...e,status:"PENDING"}}}function Ot(e,n){return e?{...e,status:n}:e}function Ut(e,n){return"PENDING"===n?{payment_request_id:`pr-${H()}`,status:"PENDING",channel_code:e,actions:[],session_token_request_id:H()}:n?{payment_request_id:`pr-${H()}`,status:"REQUIRES_ACTION",channel_code:e,actions:Bt(n),session_token_request_id:H()}:{payment_request_id:`pr-${H()}`,status:"SUCCEEDED",channel_code:e,actions:[],session_token_request_id:H()}}function Bt(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(Tt,{t:n,channel:t})),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Lt(this.bb.world,this.bb.channel,"PENDING_PAYMENT_ENTITY_ONLY")))}exit(){this.bb.hackyOvoActionLatch=void 0,super.exit()}}function Vt(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=Wt("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 Wt=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(Vt,{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(Lt(this.bb.world,this.bb.channel,e)))}exit(){super.exit()}}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");j(e.type,"REDIRECT_CUSTOMER"),j(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 Kt(e){return e&&e.merchantAccountInformation&&"object"==typeof e.merchantAccountInformation?e.merchantAccountInformation["ID.CO.QRIS.WWW"]?Ft:e.merchantAccountInformation.A0000006150001?$t:null:null}function Ft(e){const{channelLogo:t,channelName:a,merchantName:i,amountText:r,parsedQr:o,t:s}=e;const l=function(){const e=o?.merchantAccountInformation;if("string"==typeof e)return;const n=e?.["ID.CO.QRIS.WWW"];return"string"!=typeof n&&n?.nmid?`NMID: ${n.nmid}`:void 0}(),d="#DB4849",c="24px";return n.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:c,paddingRight:c,overflow:"hidden"},children:[n.jsx("img",{src:t,alt:s("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}),l?n.jsx("div",{children:l}):null]}),n.jsxs("div",{style:{position:"relative",margin:`-${c}`,marginBottom:"0",padding:c},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:c},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:d,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:d,points:"0,100 100,100 100,0"})})]})]})}function $t(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:[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:n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"209",height:"19",fill:"none",viewBox:"0 0 209 19",style:{width:"auto"},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"})]})})})]})]})}function Xt(e,n){const t=l.create(e),a=d.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 Gt(){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 zt(e){return e.split("").map(e=>/[a-zA-Z0-9]/.test(e)?e.toLowerCase():"-").join("").replace(/-+/g,"-")}function Ht(e){const{amount:a,businessName:i,channelName:r,channelLogo:o,currency:s,onAffirm:l,qrString:d,parsedQr:c,t:u}=e,[h,p]=t.useState(!1),m=t.useCallback(()=>{p(!0),l()},[l]),f=t.useMemo(()=>{try{return Xt(d,Yt)}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}},[d,u]),b=t.useRef(!1),x=t.useCallback(e=>{if(e instanceof PointerEvent&&"touch"!==e.pointerType)return;if(b.current)return;e.currentTarget.animate?.([{transform:"scale(1)"},{transform:"scale(0.95)"},{transform:"scale(1)"}],{duration:150,easing:"ease-in-out"});const n=Xt(d,Qt),t=[zt(i),zt(r),zt(s),zt(String(a)),zt(Gt())].join("-");b.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,r,s,d]);if(e.hideUi)return n.jsx("div",{"data-testid":"qr-code",ref:e=>{!e||1===e.childNodes.length&&e.firstChild===f||e?.replaceChildren(f)}});const y=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===f||e?.replaceChildren(f)}}),_=n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(he,{variant:ce.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(pe,{}):u("action.payment_made")}),n.jsx("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:u("action.payment_confirmation_instructions")})]}),g=un(a,s),v=Kt(c);return v?n.jsxs(n.Fragment,{children:[n.jsx(v,{channelLogo:o,channelName:r,merchantName:i,amountText:g,parsedQr:c,qr:y,t:u}),n.jsx("div",{style:{padding:"48px",paddingTop:"8px",paddingBottom:"24px"},children:_})]}):n.jsxs("div",{className:"xendit-action-present-to-customer",children:[n.jsx("img",{src:o,alt:u("image_alt.channel_logo",{channelName:r}),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:g})]}),_]})}const Yt={margin:0,colors:["var(--xendit-qr-foreground-color)","var(--xendit-qr-background-color)"]},Qt={margin:2,colors:["#000","#FFF"]},Zt={"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"}}}},Jt={"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 ea(e){return/^[\uD800-\uDBFF]$/.test(e)}function na(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,ea(n)?l+=.5:l+=1}t.push({key:a,value:o}),e=e.substring(4+s)}return t}function ta(e,n,t,a){e[`field${t}`]=a;const i=n[t];if(!i)return;const r="template"===i.type&&i.templateClass?aa(i.templateClass,a).result:a;e[i.name]=r}function aa(e,n){const t=na(n),a={};for(const{key:n,value:i}of t)ta(a,e,n,i);return{result:a,raw:t}}function ia(e,n,t){const a=na(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=Jt[i];return r&&(e[i]=aa(r,t).result),e}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)];j(n?.type,"PRESENT_TO_CUSTOMER"),I(this.bb.world),I(this.bb.channel),I(this.bb.world.paymentEntity);let t=null;try{t=function(e){const{result:n,raw:t}=aa(Zt,e);n.merchantAccountInformation={};for(const e of t){const t=Number(e.key);t>=26&&t<=51&&ia(n.merchantAccountInformation,e.key,e.value)}return n}(n.value)}catch{}if(this.bb.mock&&"string"==typeof this.bb.channelProperties?.mock_emvco_qr_field_26_00){const e=this.bb.channelProperties.mock_emvco_qr_field_26_00;t={merchantAccountInformation:{[e]:{globallyUniqueIdentifier:e}}}}const a=function(e){return null!==Kt(e)}(t),i=this.bb.sdk[u].liveComponents.actionContainer,r={amount:this.bb.world.session.amount,businessName:this.bb.world.business.name??"",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,parsedQr:t,title:n.action_subtitle,t:this.bb.sdk.t.bind(this.bb.sdk)},o=a?It.QrWithCustomArt:It.Generic;this.cleanupFn=this.ensureHasActionContainer(o),this.populateActionContainer(()=>e.createElement(Ht,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 ra=({instructions:e})=>{switch(e.length){case 0:return null;case 1:return n.jsx(oa,{instruction:e[0]});default:return n.jsx(sa,{instructions:e})}},oa=e=>n.jsxs("div",{children:[n.jsx("p",{className:"xendit-instructions-single-tab-heading",children:e.instruction.title}),n.jsx(la,{instruction:e.instruction})]}),sa=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(la,{instruction:e.instructions[i]})]})},la=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:ha(t)},a))})},a)})});function da(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:da(e.childNodes)},t):da(e.childNodes)}(e,t);default:return null}})}const ca="undefined"!=typeof DOMParser?new DOMParser:null;function ua(e){try{if(!ca)return e;return da(ca.parseFromString(e,"text/html").body.childNodes)}catch(n){return e}}function ha(e){if("string"==typeof e)return n.jsx("p",{className:"xendit-instructions-step-item",children:ua(e)});switch(e.type){case"text":return function(e){return n.jsx("p",{children:ua(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:ua(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:ua(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:ua(e.label)}),n.jsx("div",{className:"xendit-instructions-form-field-value",children:ua(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:ua(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:ua(e)},t))},t))})]})}(e)}return null}const pa=e.createContext({fire:()=>{},clear:()=>{},text:""}),ma=({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(pa.Provider,{value:{text:a,fire:r,clear:o},children:n.jsx("div",{style:{position:"relative"},children:e})})},fa=()=>{const{text:e,clear:a}=t.useContext(pa);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 ba(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]),f=[{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:un(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:f.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(ma,{children:[n.jsx(xa,{value:e.value,t:u}),n.jsx(fa,{})]}):null]},t))})}),n.jsxs("div",{className:"xendit-action-present-to-customer-affirm",children:[n.jsx(he,{variant:ce.WHITE_ROUNDED,disabled:h,onClick:m,className:"xendit-button-block",children:h?n.jsx(pe,{}):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(ra,{instructions:d})]})}const xa=({value:e,t:a})=>{const{fire:i}=t.useContext(pa);return n.jsxs(he,{variant:ce.WHITE_ROUNDED,size:ue.SM,onClick:()=>{navigator.clipboard.writeText(e),i(a("action_va.copied_to_clipboard"))},children:[a("action_va.copy"),n.jsx(p,{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)];j(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(ba,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=ne(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=te(e).cipherText;try{return JSON.parse(atob(n))}catch{}return{schemes:["VISA"],country_codes:["ID"],require_billing_information:!1}}{const t=te(e).withoutValidationError;return pt(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(!L(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 D(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 D(R),e=this.sdk.nextMockUpdate,this.sdk.nextMockUpdate=null}else try{e=await ht(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=jt(e.payment_token):e.payment_request&&(n=jt(e.payment_request)),this.onPollResult(e,n),await D(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(Lt(this.bb.world,this.bb.channel,"SUCCESS")));break;case"FAILED":case"CANCELED":case"EXPIRED":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(Lt(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),de(this.bb.channel.form,"credit_card_number")){if(e=ne(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(!te(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 mt(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(!L(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)}}class SessionFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionExpiredOrCanceledEvent)}}function ya(e,n){switch(e.type){case qt.PaymentRequest:n(new XenditPaymentRequestDiscardedEvent(e.id));break;case qt.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&&ya(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!==qt.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),Ut(t.channel_code,t._mock_action_type)):await ut(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(Lt(this.bb.world,this.bb.channel,"SUCCESS"))),this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}).catch(e=>{L(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&&ya(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(Dt(n,t,"title")),r=a?e(function(e){return`failure_code.${e.toLowerCase()}`}(a),e("failure_code_unknown",{failureCode:a})):e(Dt(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.world?.session?.session_type,t=this.bb.channel.channel_code,a=this.bb.channel._mock_action_type,i=this.bb.channelProperties??{},r=new AbortController,o=async function(e,n,t,a,i,r,o,s){let l;if(n)switch(t){case"PAY":await M(R,o.signal),l=Ut(a,i);break;case"SAVE":case"SUBSCRIPTION":await M(R,o.signal),l=function(e,n){return"PENDING"===n?{payment_token_id:`pt-${H()}`,status:"PENDING",channel_code:e,actions:Bt(n),session_token_request_id:H()}:n?{payment_token_id:`pt-${H()}`,status:"REQUIRES_ACTION",channel_code:e,actions:Bt(n),session_token_request_id:H()}:{payment_token_id:`pt-${H()}`,status:"ACTIVE",channel_code:e,actions:[],session_token_request_id:H()}}(a,i);break;default:throw new Error(`The session type ${t} is not supported.`)}else switch(t){case"PAY":l=await ct(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r,save_payment_method:s},null,null,o.signal);break;case"SAVE":case"SUBSCRIPTION":l=await dt(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 jt(l)}(this.bb.sdkKey,this.bb.mock,n,t,a,i,r,e?this.bb.channelData?.savePaymentMethod??!1:void 0).then(e=>{switch(this.submission=null,e.type){case qt.PaymentRequest:this.bb.dispatchEvent(new XenditPaymentRequestCreatedEvent(e.id));break;case qt.PaymentToken:this.bb.dispatchEvent(new XenditPaymentTokenCreatedEvent(e.id))}this.bb.dispatchEvent(new InternalUpdateWorldState({paymentEntity:e,sessionTokenRequestId:e.entity.session_token_request_id}))}).catch(e=>{L(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:r,promise:o}}}function _a(e){switch(e.sdkStatus){case"LOADING":return ft(SdkLoadingBehavior);case"ACTIVE":return ft(SdkActiveBehavior,"active",function(e){switch(I(e.world?.session),e.world.session.status){case"ACTIVE":return ft(SessionActiveBehavior,"active",e.submissionRequested?function(e){return I(e.world),ft(SubmissionBehavior,"submission",e.world.paymentEntity&&null!==e.world.sessionTokenRequestId?function(e){function n(){return I(e.world?.paymentEntity),U(e.sdk,e.world.paymentEntity.entity.actions)?function(e){I(e.world?.paymentEntity);const n=U(e.sdk,e.world.paymentEntity.entity.actions);I(n);const t=e.world.paymentEntity.entity.actions.indexOf(n);return ft(ActionPaylinkBehavior,String(t))}(e):void 0}if(I(e.world?.paymentEntity),e.hackyOvoActionLatch&&"PENDING"===e.world.paymentEntity.entity.status)return ft(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[ft(ActionEmptyListPushNotificationBehavior,""),n()]);switch(e.world.paymentEntity.entity.status){case"PENDING":return ft(PaymentEntityPendingBehavior);case"REQUIRES_ACTION":return ft(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[ga(e),n()]);case"FAILED":case"EXPIRED":case"CANCELED":return ft(PaymentEntityFailedBehavior);case"ACCEPTING_PAYMENTS":throw new Error("Status ACCEPTING_PAYMENTS should not happen");case"AUTHORIZED":case"ACTIVE":case"SUCCEEDED":return ft(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 Vn(e,n.form,t,a))if(_n(i,t))return!1;return!0}(e.world.session.session_type,e.channel,e.channelProperties,e.channelData),t=ft(n?ChannelValidBehavior:ChannelInvalidBehavior),a=de(e.channel.form,"credit_card_number")?ft(CardInfoBehavior,e.channel.channel_code):void 0,i=de(e.channel.form,"installment_plan")?ft(PaymentOptionsBehavior,e.channel.channel_code):void 0;return[t,a,i]}(e));case"COMPLETED":return ft(SessionCompletedBehavior);case"EXPIRED":case"CANCELED":return ft(SessionFailedBehavior,e.world.session.status);case"PENDING":return ft(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 ft(SdkFatalErrorBehavior);default:throw e.sdkStatus,new Error(`Unknown SDK status: ${e.sdkStatus}`)}}function ga(e){if(I(e.world?.paymentEntity),e.actionCompleted)return ft(ActionCompletedBehavior);const n=O(e.world.paymentEntity.entity.actions);if(!n)return ft(ActionEmptyListPushNotificationBehavior,"");const t=e.world.paymentEntity.entity.actions.indexOf(n),a=!!U(e.sdk,e.world.paymentEntity.entity.actions);let i;switch(e.simulatePaymentRequested&&Q(n)&&(i=ft(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)?ft(ActionIframeBehavior,n.value):a?ft(ActionDeepLinkBehavior,String(t)):ft(ActionRedirectBehavior,n.value);case"DEEPLINK_URL":return ft(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 ft(ActionQrBehavior,String(t),i);case"PAYMENT_CODE":throw new Error(`Unsupported action type ${n.type} ${n.descriptor}`);case"VIRTUAL_ACCOUNT_NUMBER":return ft(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}`)}const va=e=>{const{onReady:a,options:i}=e,r=S(),o=r.t,s=w(),l=(()=>{const e=t.useContext(x);if(null===e)throw new Error("useBusiness must be used within a XenditSessionProvider");return e})(),d=A(),c=d?.google_pay;I(c);const u=t.useRef(!1),h=t.useRef(null),p=t.useRef(null),m=t.useMemo(()=>c.allowed_payment_methods.map(e=>e.payment_method_specification),[c.allowed_payment_methods]),f=t.useMemo(()=>({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:m,emailRequired:!0,merchantInfo:{merchantId:c.merchant_id,merchantName:l.name??""},transactionInfo:{transactionId:s.payment_session_id,totalPriceStatus:"FINAL",totalPrice:String(s.amount),currencyCode:s.currency}}),[l.name,c.merchant_id,m,s.amount,s.currency,s.payment_session_id]),b=t.useMemo(()=>({buttonColor:"default",buttonType:"plain",buttonRadius:999,buttonSizeMode:"fill",buttonBorderType:"no_border",...i}),[i]);t.useLayoutEffect(()=>{const e=window.google?.payments?.api?.PaymentsClient;e?p.current=new e({environment:r.isMock()?"TEST":"PRODUCTION"}):console.error("XenditComponents: Google Pay button was requested but the Google Pay SDK is not loaded.")},[r]);const y=t.useCallback(()=>{I(p.current),p.current.loadPaymentData(f).then(function(e){const n=function(e){I(c);const n=r.getActiveChannels();for(const t of c.allowed_payment_methods)if(t.payment_method_specification.type===e.paymentMethodData.type)return ka(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=c.allowed_payment_methods[0];I(i);const s=ka(r.getActiveChannels(),i.channel_code);r.submitDigitalWallet("GOOGLE_PAY",s,{},a)})},[c,f,r,o]);return t.useLayoutEffect(()=>{p.current&&(u.current||p.current.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:m}).then(function(e){e.result&&(u.current||(u.current=!0,a()))}).catch(function(e){console.error("XenditComponents: Error when checking if Google Pay is ready",e)}))},[m,a]),t.useLayoutEffect(()=>{if(!p.current)return;const e=p.current.createButton({...b,buttonLocale:s.locale,allowedPaymentMethods:m,onClick:y});h.current&&h.current.replaceChildren(e)},[b,m,y,s.locale]),n.jsx("div",{ref:h})};function ka(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 Ca=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},wa=e=>{const{digitalWalletCode:a,digitalWalletOptions:i}=e,r=t.useRef(null),o=t.useCallback(()=>{r.current?.parentElement?.style.setProperty("display","block")},[]);let s=null;if("GOOGLE_PAY"===a)s=n.jsx(Ca,{scriptTagRegex:Ea.GOOGLE_PAY.scriptTagRegex,checkLoaded:Ea.GOOGLE_PAY.checkLoaded,children:n.jsx(va,{onReady:o,options:i})});return n.jsx("div",{ref:r,children:s})},Ea={GOOGLE_PAY:{scriptTagRegex:/https:\/\/pay.google.com\/.*\/js\/pay.js/,checkLoaded:()=>"undefined"!=typeof google&&void 0!==google.payments}};class XenditComponents extends EventTarget{t=e=>{throw new Error("Localization used before initialization; this is a bug.")};[u];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]!==B&&null===W(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[u]={sdkKey:n,options:e,worldState:null,liveComponents:{channelPicker:null,paymentChannels:new Map,actionContainer:null,digitalWalletContainer:new Map},behaviorTree:new BehaviorTree(_a,{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},se(this),this.addEventListener("fatal-error",e=>{const n=e;this[u].eventListenersPresent.get("fatal-error")||console.error(`XenditComponents: A "fatal-error" event occurred but no event listener was attached: ${n.message}`)}),this[u].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 lt(this[u].sdkKey,this[u].sdkKey.sessionAuthKey),e.channels=e.channels.filter(e=>le[e.channel_code])}catch(e){return this[u].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[u].behaviorTree.bb.sdkFatalErrorMessage=Z(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:null}))}assertInitialized(){if(!this[u].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[u].sdkKey.hostId}supportsSimulationScenarios(){return this.isMock()||"pd"===this[u].sdkKey.hostId||"sd"===this[u].sdkKey.hostId}findChannel(e){this.assertInitialized();return this[u].worldState.channels.find(n=>n.channel_code===e)??null}onUpdateWorldState(e){const n=e.data;this[u].worldState=K(this[u].worldState??{},n);const t=this[u].worldState.session.locale;this.t=function(e){const n=fn[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[u].liveComponents.paymentChannels.get(n);a&&(a.data=K(a.data,t),this.behaviorTreeUpdate(),this.rerenderAllComponents())}behaviorTreeUpdate(){const e=this[u].behaviorTree.bb;if("LOADING"===e.sdkStatus&&this[u].worldState&&(e.sdkStatus="ACTIVE"),e.world=this[u].worldState,this[u].currentDigitalWalletSubmission)e.channel=this.findChannel(this[u].currentDigitalWalletSubmission.channelCode),e.channelProperties=this[u].currentDigitalWalletSubmission.channelProperties,e.channelData=null,e.channelIsDigitalWallet=!0,e.instantSubmissionError=this[u].currentDigitalWalletSubmission.instantSubmissionError;else{const n=this[u].currentChannelCode?this[u].liveComponents.paymentChannels.get(this[u].currentChannelCode):null;e.channel=n?re(n.channel[u],n.data.savePaymentMethod):null,e.channelProperties=n?n.channelProperties:null,e.channelData=n?n.data:null,e.channelIsDigitalWallet=!1}try{this[u].behaviorTree.update()}catch(e){this[u].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[u].behaviorTree.bb.sdkFatalErrorMessage=Z(e),this[u].behaviorTree.update()}}getSdkStatus(){return this[u].behaviorTree.bb.sdkStatus}rerenderAllComponents(){this.renderChannelPicker();for(const e of this[u].liveComponents.paymentChannels.keys())this.renderPaymentChannel(e);for(const e of this[u].liveComponents.digitalWalletContainer.keys())this.renderDigitalWalletComponent(e)}getSession(){return this.assertInitialized(),_e(this[u].worldState.session)}getCustomer(){return this.assertInitialized(),this[u].worldState.customer?(j((e=this[u].worldState.customer).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;var e}getActiveChannelGroups(e){return this.assertInitialized(),function(e,n,t){const a=Ce(n),i=Ee(e,t);return n.filter(e=>i[e.id]?.length).map(e=>ge(e,i,a,t))}(this[u].worldState.channels,this[u].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[u].worldState.session,pairChannels:Ae(this[u].worldState.channels)})}getActiveChannels(e){return this.assertInitialized(),function(e,n,t){const a=Ce(n),i=Ee(e,t);return e.filter(e=>we(e,t)).map(e=>ke(e,i,a,t))}(this[u].worldState.channels,this[u].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[u].worldState.session,pairChannels:Ae(this[u].worldState.channels)})}createChannelPickerComponent(){this[u].liveComponents.channelPicker&&this.destroyComponent(this[u].liveComponents.channelPicker);const e=document.createElement("xendit-channel-picker");return e.setAttribute("translate","no"),this[u].liveComponents.channelPicker=e,this[u].worldState&&this.renderChannelPicker(),this.setupUiEventsForChannelPicker(e),e}renderChannelPicker(){this.assertInitialized();const n=this[u].liveComponents.channelPicker;n&&e.render(e.createElement(N,{data:this[u].worldState,sdk:this,children:e.createElement(Ie,{})}),n)}setupUiEventsForChannelPicker(e){e.addEventListener(XenditClearCurrentChannelEvent.type,e=>{this.assertInitialized();const n=e,t=this[u].currentChannelCode;if(!t)return;const a=this[u].worldState.channels.find(e=>e.channel_code===t);a&&a.ui_group===n.uiGroup&&this.setCurrentChannel(null)})}createChannelComponent(n,t=!0){if(this.assertInitialized(),!oe(this[u].worldState.session,n[u][0]))throw new Error("Cannot create channel component: `session.amount` is outside of the channel's min/max amount.");const a=n[u][0].channel_code;t&&(this[u].currentChannelCode=a);const i=this[u].liveComponents.paymentChannels.get(a),r=e.createRef();let o;return i?o=i.element:(o=document.createElement("xendit-payment-channel"),o.setAttribute("data-channel-code",a),o.setAttribute("inert",""),o.setAttribute("translate","no"),o.style.setProperty("--xendit-channel-brand-color",n[u][0].brand_color),this.setupUiEventsForPaymentChannel(o),this[u].liveComponents.paymentChannels.set(a,{element:o,channel:n,channelProperties:null,channelFormRef:r,data:{savePaymentMethod:!1,cardDetails:null,paymentOptions:null}})),this.renderPaymentChannel(a),t&&(this.behaviorTreeUpdate(),this.syncInertAttribute()),this.dispatchEvent(new InternalNeedsRerenderEvent),o}renderPaymentChannel(n){this.assertInitialized();const t=this[u].liveComponents.paymentChannels.get(n);if(!t)return;const a=t.channel;e.render(e.createElement(N,{data:this[u].worldState,sdk:this,children:e.createElement(at,{channelOrPair:a[u],channelData:t.data,savePaymentMethod:t.data.savePaymentMethod,formRef:t.channelFormRef})}),t.element)}getActiveDigitalWallets(){return this.assertInitialized(),this[u].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=Ee(t,a);i.push({digitalWalletCode:"GOOGLE_PAY",get channels(){return t.map(e=>ke(e,o,r,a))},[u]:!0})}return i}(this[u].worldState.digitalWallets,this[u].worldState.channels,this[u].worldState.channelUiGroups,{options:{filterMinMax:!1},pairChannels:Ae(this[u].worldState.channels),session:this[u].worldState.session}):[]}createDigitalWalletComponent(e,n){this.assertInitialized();const t=this[u].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[u].liveComponents.digitalWalletContainer.set(e,{element:a,options:n}),this.renderDigitalWalletComponent(e),a}renderDigitalWalletComponent(n){this.assertInitialized();const t=this[u].liveComponents.digitalWalletContainer.get(n);t&&e.render(e.createElement(N,{data:this[u].worldState,sdk:this,children:e.createElement(wa,{digitalWalletCode:n,digitalWalletOptions:t.options})}),t.element)}getCurrentChannel(){const e=this[u].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[u].currentChannelCode,t=e?.[u][0].channel_code??null;if(n!==t){if(this[u].currentChannelCode=t,e&&t){(this[u].liveComponents.paymentChannels.get(t)??null)||this.createChannelComponent(e,!1)}this.behaviorTreeUpdate(),this.syncInertAttribute(),this.renderChannelPicker()}}syncInertAttribute(){const e=this[u].behaviorTree.bb.submissionRequested,n=this[u].liveComponents.paymentChannels;for(const[t,a]of n){(Array.isArray(a.channel.channelCode)?a.channel.channelCode[0]:a.channel.channelCode)!==this[u].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[u].liveComponents.paymentChannels.get(t);a&&(a.channelProperties=n.channelProperties,this.behaviorTreeUpdate())})}showValidationErrors(){if(!this[u].behaviorTree.findBehavior(ChannelInvalidBehavior))return;const e=this[u].currentChannelCode;if(!e)return;const n=this[u].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()}createActionContainerComponent(e){this.assertInitialized();const n=e===u,t=n?void 0:e,a=this[u].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[u].liveComponents.actionContainer&&this.destroyComponent(this[u].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[u].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[u].liveComponents.channelPicker===n)return this[u].liveComponents.channelPicker=null,e.render(null,n),void n.remove();for(const[t,a]of this[u].liveComponents.paymentChannels)if(a.element===n)return this[u].liveComponents.paymentChannels.delete(t),this[u].currentChannelCode===t&&this.setCurrentChannel(null),e.render(null,n),void n.remove();if(this[u].liveComponents.actionContainer===n)return this[u].liveComponents.actionContainer=null,e.render(null,n),void n.remove();for(const[t,a]of this[u].liveComponents.digitalWalletContainer)if(a.element===n)return this[u].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[u].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[u].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[u].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[u].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[u].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[u].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}submitDigitalWallet(e,n,t,a=null){this.assertInitialized(),this.setCurrentChannel(null),this[u].currentDigitalWalletSubmission={digitalWalletCode:e,channelCode:n[u][0].channel_code,channelProperties:t,instantSubmissionError:a},this.addEventListener(XenditSubmissionEndEvent.type,()=>{this[u].currentDigitalWalletSubmission=null},{once:!0}),this[u].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}abortSubmission(){this.assertInitialized();this[u].behaviorTree.findBehavior(SubmissionBehavior)&&(this[u].behaviorTree.bb.submissionRequested=!1,this.behaviorTreeUpdate())}simulatePayment(){if(this.assertInitialized(),"PAY"!==this[u].worldState.session.session_type)throw new Error('Unable to simulate payment, the session type is not "PAY".');if(!this[u].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[u].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||!Q(n))throw new Error("Unable to simulate payment; the action does not support simulation.");this[u].behaviorTree.bb.simulatePaymentRequested=!0,this.behaviorTreeUpdate()}pollImmediately(){if(this.assertInitialized(),"ACTIVE"!==this[u].worldState.session.status)throw new Error("Unable to poll immediately; the session is not longer active.");this[u].behaviorTree.bb.pollImmediatelyRequested=!0,this.behaviorTreeUpdate()}getState(){const e=this[u].currentChannelCode,n=this[u].liveComponents.paymentChannels.get(e??"");return{channelCode:e,channelProperties:n?.channelProperties||null,behaviorTree:this[u].behaviorTree}}addEventListener(e,n,t){return this[u].eventListenersPresent.set(e,!0),super.addEventListener(e,n,t)}removeEventListener(e,n,t){return super.removeEventListener(e,n,t)}static amountFormat(e,n){return un(e,n)}}class XenditComponentsTest extends XenditComponents{nextMockUpdate=null;constructor(e){super({...e,componentsSdkKey:`session-${z(32)}-mock-MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCADI5pdf6KmN8+Fxl2ES3yolUKXunNeY3gGScGNEvDcrcHAPKxIInAo5DVnDvTtYtqZvx/bu7HLeBJNMXwHhie/uyNEtT8dSaLc9bd0WSlYdxI+iUsTv2Qu0LiiPrZs-NKf7whM9meUs/eRCvG0oc180MDiyeli3kH6EQ3ZahECHsZQi5G2IpH6vk3cYMtf01Y1L4OBn1SZCOv1kwpjIUet4DJeoTwwq2nM5b+K7rD+/WFTi3AEX4NWJNkKi0a91`}),this.addEventListener(InternalScheduleMockUpdateEvent.type,this.setNextMockUpdate.bind(this))}async initializeAsync(){await D(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}}"undefined"==typeof window||"undefined"==typeof document||(c||(c=!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 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 position: absolute;\n top: 24px;\n right: 24px;\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-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.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/* va actions */\n.xendit-action-va-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 display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-va-detail-item {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.xendit-action-va-detail-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.xendit-action-va-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.randomHexString=z,exports.randomUUID=H;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|