xendit-components-web 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! Copyright (c) 2026 Xendit Inc. Licensed under the MIT License (MIT). */
2
- import"preact/debug";import"preact/devtools";import{options as e,createContext as n,render as t,createElement as i,Fragment as a,createRef as r}from"preact";import{jsx as o,jsxs as s,Fragment as l}from"preact/jsx-runtime";import{useCallback as d,useContext as c,useRef as u,useLayoutEffect as h,useState as p,useMemo as m,useImperativeHandle as f,useEffect as b}from"preact/hooks";import y from"classnames";import _,{getCountries as g,getExampleNumber as x}from"libphonenumber-js";import v,{getCountryCallingCode as w}from"libphonenumber-js/min";import k from"libphonenumber-js/mobile/examples";import{forwardRef as C}from"preact/compat";import E from"jsbarcode";import A from"qrcode";import N from"qrcode/lib/renderer/svg-tag.js";let P=!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 S=Symbol("xendit-internal"),I=e=>o("div",{class:"xendit-accordion",children:e.children}),R=e=>{const{name:n,size:t,direction:i}=e;let a,r;switch(i){case"right":a="rotate(180 12 12)";break;case"up":a="rotate(90 12 12)";break;case"down":a="rotate(-90 12 12)";break;default:a="rotate(0 12 12)"}switch(n){case"chevron":r=o("path",{d:"M15 19.5L7.5 12L15 4.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"});break;case"check":r=T(o("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":r=s(l,{children:[o("path",{d:"M18.75 5.25L5.25 18.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M18.75 18.75L5.25 5.25",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]});break;case"card":r=T(o("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":r=T(s(l,{children:[o("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"}),o("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":r=T(s(l,{children:[o("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"}),o("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":r=T(o("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":r=T(o("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":r=T(s(l,{children:[o("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"}),o("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"}),o("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":r=T(s(l,{children:[o("path",{d:"M6 9.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M6 7.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o("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"}),o("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":r=T(o("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 ${n} does not exist`)}return o("svg",{className:`xendit-icon ${e.className??""}`,width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"none",children:o("g",{transform:a,children:r})})};function T(e,n){return o("g",{transform:`scale(${1/n} ${1/n})`,children:e})}const q=e=>{const{id:n,title:t,iconName:i,subtitle:a,disabled:r,open:l,onClick:c,children:u}=e,h=l?"up":"down",p=d(()=>{r||c(n)},[r,c,n]),m=d(e=>{"Enter"!==e.key&&" "!==e.key||(p(),e.preventDefault())},[p]),f=d(()=>{p()},[p]);return s("div",{className:y("xendit-accordion-item",r?"xendit-accordion-item-disabled":"",l?"xendit-accordion-item-open":"xendit-accordion-item-closed"),children:[s("div",{className:"xendit-accordion-item-header",onClick:f,onKeyDown:m,role:"button",tabIndex:r?-1:0,children:[o(R,{className:"xendit-accordion-item-header-icon",name:i,size:24}),s("div",{className:"xendit-accordion-item-header-title xendit-text-16 xendit-text-bold",children:[t,a?o("div",{className:"xendit-accordion-item-header-subtitle xendit-text-14",children:a}):null]}),o(R,{className:"xendit-accordion-item-chevron",name:"chevron",size:24,direction:h})]}),o("div",{className:"xendit-accordion-item-content",inert:!l,children:o("div",{className:"xendit-accordion-item-padding",children:u})})]})},D=n(null);D.displayName="SessionContext";const M=n(null);M.displayName="BusinessContext";const L=n(null);L.displayName="CustomerContext";const O=n(null);O.displayName="ChannelsContext";const U=n(null);U.displayName="ChannelUiGroupsContext";const B=n(null);B.displayName="DigitalWalletsContext";const V=n(null);V.displayName="SdkContext";const W=n(null);W.displayName="CurrentChannelContext";const K=()=>{const e=c(D);if(null===e)throw new Error("useSession must be used within a XenditSessionProvider");return e},F=()=>{const e=c(O);if(null===e)throw new Error("useChannels must be used within a XenditSessionProvider");return e},$=()=>c(B),G=()=>{const e=c(V);if(null===e)throw new Error("useSdk must be used within a XenditSessionProvider");return e},z=()=>c(W),H=({children:e,data:n,sdk:t})=>{const{session:i,business:a,customer:r,channels:s,digitalWallets:l,channelUiGroups:d}=n,c=t.getCurrentChannel()?.[S]?.[0]??null;return"ACTIVE"!==t.getSdkStatus()||"ACTIVE"!==i.status?null:o(V.Provider,{value:t,children:o(W.Provider,{value:c,children:o(D.Provider,{value:i,children:o(M.Provider,{value:a,children:o(L.Provider,{value:r,children:o(O.Provider,{value:s,children:o(B.Provider,{value:l,children:o(U.Provider,{value:d,children:e})})})})})})})})},Y=300;function X(e){if(!e)throw new Error("Assertion failed: argument is null or undefined; this is a bug, please contact support.")}function j(e){if(!Array.isArray(e))throw new Error("Assertion failed: expected array; this is a bug, please contact support.")}function Q(e){if(Array.isArray(e))throw new Error("Assertion failed: expected array; this is a bug, please contact support.")}function Z(e,n){if(e!==n)throw new Error("Assertion failed; this is a bug, please contact support.")}function J(e){return new Promise(n=>setTimeout(n,1*e))}class AbortError extends Error{constructor(){super("AbortError"),this.name="AbortError"}}function ee(e){return e instanceof AbortError&&"AbortError"===e.name}function ne(e,n){return new Promise((t,i)=>{function a(){n.removeEventListener("abort",a),clearTimeout(r),i(new AbortError)}const r=setTimeout(()=>{n.removeEventListener("abort",a),t()},1*e);n.aborted?a():n.addEventListener("abort",a)})}function te(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 ie(e,n){if(e[S].options.enablePaylinks)return n.find(e=>"REDIRECT_CUSTOMER"===e.type&&"WEB_GOOGLE_PAYLINK"===e.descriptor)}const ae="mock",re={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 oe(e){return re[e]??null}function se(e,n){const t={...e};for(const e of Object.keys(n)){const i=n[e];void 0!==i&&(t[e]=i)}return t}function le(e){const n=u();return h(()=>{n.current=e}),n.current}function de(e){let n;if("string"==typeof e.channel_property)n=e.channel_property;else{n=Object.values(e.channel_property).join("__")}return n}const ce=Math.floor(255*Math.random());function ue(e){return`xendit-id-${de(e).split("").map(e=>(e.charCodeAt(0)%256^ce).toString(16)).join("")}`}function he(e){X(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 pe(){return[he(8),he(4),he(4),he(4),he(12)].join("-")}function me(){return`xendit-id-${u(he(12)).current}`}function fe(e){return"PRESENT_TO_CUSTOMER"===e.type}function be(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 ye(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 _e(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 i=n;for(;;){if(!i||"object"!=typeof i||Array.isArray(i))return;const e=t.indexOf(".");if(-1===e)return i?i[t]:void 0;{const n=t.slice(0,e);i=i?i[n]:void 0,t=t.slice(e+1)}}}function ge(e){const n=_e("card_details.card_number",e);return"string"!=typeof n?null:n}function xe(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 i=parseInt(t[2],10);if(isNaN(i)||i<=0)throw new Error("Invalid encrypted field value format.");if(n.version=i,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 ve=new WeakMap;let we=1;function ke(e,n){return X(e.length>0),X(e.length<=2),2===e.length?n?(X(!0===e[1].allow_save),e[1]):(X(!1===e[0].allow_save),e[0]):e[0]}function Ce(e,n){if("PAY"!==e.session_type)return!0;const t=e.amount,i=n.min_amount??0,a=n.max_amount??Number.MAX_VALUE;return!(t<i||t>a)}function Ee(e){Object.defineProperty(e,S,{enumerable:!1,writable:!1,configurable:!1,value:e[S]})}const Ae={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 Ne(e,n){for(const t of e)if(t.type.name===n)return!0;return!1}var Pe,Se;!function(e){e.BARE="bare",e.PRIMARY_ROUNDED="primary-rounded",e.WHITE_ROUNDED="white-rounded"}(Pe||(Pe={})),function(e){e.SM="sm",e.MD="md"}(Se||(Se={}));const Ie=e=>{const{children:n,variant:t,size:i,type:a="button",...r}=e,s={[Pe.BARE]:void 0,[Pe.PRIMARY_ROUNDED]:"xendit-button-primary-rounded",[Pe.WHITE_ROUNDED]:"xendit-button-white-rounded"}[t],l={[Se.SM]:"xendit-button-sm",[Se.MD]:void 0}[i??Se.MD];return o("button",{...r,className:y(e.className,"xendit-button",s,l),type:a,children:n})},Re=()=>{const e=.4*Math.PI,n=.4,t=Math.cos(e)*n,i=Math.sin(e)*n,a=Math.cos(0)*n,r=Math.sin(0)*n;return o("svg",{className:"xendit-button-loading-spinner",viewBox:"-0.5 -0.5 1 1",children:o("path",{d:`M ${t} ${i} A 0.4 0.4 0 0 0 ${a} ${r}`,fill:"none",stroke:"currentColor",strokeWidth:"0.1",strokeLinecap:"round"})})},Te=e=>{const{id:n,options:t,onChange:i,defaultIndex:a=-1,selectedIndex:r,placeholder:l,disabled:c,className:f,fixedOverlayWidth:b,enableSearch:y}=e,_=G().t,g=me(),x=n||g,v="number"==typeof r,[w,k]=p(a),C=v?r:w,[E,A]=p(C>=0?C:0),[N,P]=p(!1),S=N&&!c&&t.length>0,[I,T]=p(""),[q,D]=p(0),M=u(null),L=u(null),O=u(null),U=u(null),B=u(null),V=u(null),W=m(()=>{const e=t.map(Le).filter(({item:e})=>{if(""===I.trim())return!0;const n=I.toLowerCase();return e.title.toLowerCase().includes(n)||e.description?.toLowerCase().includes(n)||e.value.toLowerCase().includes(n)});return e.length>0?e:t.map(Le)},[I,t]),K=Math.max(0,Math.min(W.length-1,E));h(()=>{if(b)return void D(b);const e=M.current;if(!e)return;const n=e.getBoundingClientRect().width;if(D(n),!window.ResizeObserver)return;const t=new ResizeObserver(n=>{for(const t of n)t.target===e&&t.borderBoxSize?.length&&D(t.borderBoxSize[0].inlineSize)});return t.observe(e),()=>t.disconnect()},[b]),h(()=>{if(!S)return;const e=V.current;if(!e)return;const n=M.current;if(!n)return;if(!window.ResizeObserver)return;function t(){if(!e)return;if(!n)return;const t=n.getBoundingClientRect(),i=e.getBoundingClientRect();window.innerHeight-t.bottom<i.height?(e.style.position="fixed",e.style.bottom="0"):(e.style.position="",e.style.bottom="")}t();const i=new ResizeObserver(t);return i.observe(e),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{i.disconnect(),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[S]),h(()=>{if(!S)return;const e=e=>{const n=L.current;n&&(n.contains(e.target)||P(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[S]),h(()=>{if(!S)return;const e=e=>{const n=L.current;n&&e.relatedTarget&&(n.contains(e.relatedTarget)||P(!1))};return document.body.addEventListener("focusout",e),()=>document.body.removeEventListener("focusout",e)},[S]),h(()=>{S&&C>=0&&A(C)},[S,C]),h(()=>{if(!S)return;if(!U.current)return;if(!O.current)return;const e=O.current.parentElement;e&&(e.scrollTop=U.current.offsetTop-e.clientHeight/2+U.current.clientHeight/2)},[S,E]);const F=d(()=>{S||(P(!0),queueMicrotask(()=>B.current?.focus()))},[S]),$=d(()=>{S&&(P(!1),T(""),M.current?.focus())},[S]),z=d(()=>{S?$():F()},[$,S,F]),H=d(e=>{const n=t[e];n&&(n.disabled||(v||k(e),i(n,e),$()))},[$,v,i,t]),Y=d(e=>{const n=e.target===B.current;if("Escape"===e.key)return e.preventDefault(),void $();if("Enter"===e.key||" "===e.key){if(n&&" "===e.key)return;e.preventDefault();const t=W[K];return void(t&&H(t.originalIndex))}return"ArrowDown"===e.key?(e.preventDefault(),void A(e=>Math.min(W.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),void A(e=>Math.max(0,e-1))):"Home"===e.key?(e.preventDefault(),void A(0)):"End"===e.key?(e.preventDefault(),void A(W.length-1)):void 0},[K,$,H,W]),X=d(e=>{if(S)return Y(e);"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),F())},[Y,S,F]),j=d(e=>{e.stopPropagation(),e.preventDefault(),H(Number(e.currentTarget.dataset.index))},[H]),Q=d(e=>{T(e.currentTarget.value),A(0)},[]),Z=C>=0?t[C]:void 0;return s("div",{className:"xendit-dropdown-container",ref:L,style:{"--xendit-dropdown-width":q+"px"},children:[s("button",{id:x,ref:M,type:"button",className:`xendit-dropdown ${f} ${S?"xendit-dropdown-open":""} ${De(Z)?"xendit-dropdown-has-asset":""}`,"aria-expanded":S?"true":"false",onClick:z,onKeyDown:X,disabled:c,children:[Z?.leadingAsset??null,o("span",Z?{className:"xendit-dropdown-text xendit-text-14",children:Z.shortTitle??Z.title}:{className:"xendit-dropdown-text xendit-text-14",children:l}),o(R,{className:"xendit-dropdown-chevron",name:"chevron",size:16,direction:"down"})]}),S?s("div",{className:"xendit-dropdown-overlay",style:{width:"var(--xendit-dropdown-width)"},ref:V,children:[y?o("div",{className:"xendit-dropdown-search",children:o("input",{ref:B,placeholder:_("combobox.default_search_placeholder"),value:I,onInput:Q,onClick:Me,onKeyDown:Y})}):null,o("ul",{ref:O,role:"listbox",tabIndex:-1,onKeyDown:Y,children:W.map(({item:e,originalIndex:n},t)=>{const i=n===C,a=t===K;return o("li",{role:"option","data-index":n,"aria-disabled":!!e.disabled||void 0,"aria-selected":i,onClick:j,ref:a?U:void 0,children:s("div",{className:`xendit-dropdown-item xendit-text-14 ${a?"xendit-dropdown-item-active":""} ${e.leadingAsset?"xendit-dropdown-has-asset":""} ${e.disabled?"xendit-dropdown-item-disabled":""}`,children:[e.leadingAssetInOverlay??e.leadingAsset??null,s("div",{className:"xendit-dropdown-item-text xendit-text-14",children:[o("span",{className:"xendit-dropdown-item-title",children:e.title}),e.description&&o("span",{className:"xendit-dropdown-item-description xendit-text-12",children:e.description})]}),i?o(R,{name:"check",size:16,className:"xendit-dropdown-item-selected"}):null]})},n)})})]}):null]})},qe=e=>o("div",{className:"xendit-dropdown-container xendit-skeleton-field",children:o("button",{className:`xendit-dropdown ${e.className}`,inert:!0,id:e.id,disabled:!0,type:"button",children:o(Re,{})})});function De(e){return!!e&&!(!e.leadingAssetInOverlay&&!e.leadingAsset)}function Me(e){e.stopPropagation()}function Le(e,n){return{item:e,originalIndex:n}}function Oe(e){return function(e,n){if(e===n)throw new Error("Assertion failed; this is a bug, please contact support.")}(e.session_type,"AUTHORIZATION"),Z(e.mode,"COMPONENTS"),ye({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=>ye({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 Ue(e,n,t,i){const a=ye({groupId:e.id,label:e.label,get channels(){return(n[e.id]||[]).map(e=>Ve(e,n,t,i))},[S]:e});return Ee(a),a}function Be(e,n){return Ve(e,{},{},n)}function Ve(e,n,t,i){X(!i.pairChannels.paired[e.channel_code]);const a=ye({channelCode:i.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 Ue(t[e.ui_group],n,t,i)},minAmount:e.min_amount,maxAmount:e.max_amount,cardBrands:e.card?.brands.map(e=>({name:e.name,logoUrl:e.logo_url})),[S]:i.pairChannels.pairs[e.channel_code]??[e]});return Ee(a),a}function We(e){const n={};for(const t of e)n[t.id]=t;return n}function Ke(e,n){if(n.pairChannels.paired[e.channel_code])return!1;if(n.options.filterMinMax&&!Ce(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 Fe(e,n){const t={};for(const i of e){if(!Ke(i,n))continue;const e=i.ui_group;t[e]||(t[e]=[]),t[e].push(i)}return t}function $e(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={},i={};for(const[e,a]of n)for(const e of a){if(!1===a[0].allow_save){const n=a.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],i[n.channel_code]=!0)}}return{pairs:t,paired:i}}const Ge=e=>o("hr",{className:"xendit-dotted-line"}),ze=e=>{const{group:n,open:t}=e,i=G(),{t:a}=i,r=K(),l=F(),c=z(),f=r.session_type,b=me(),[y,_]=p(null),g=u(null),[x,v]=p(!1),w=u(null),k=m(()=>$e(l),[l]),C=m(()=>({pairChannels:k,session:{amount:r.amount,session_type:r.session_type},options:{filterMinMax:!1}}),[k,r.amount,r.session_type]),E=m(()=>l.filter(e=>Ke(e,C)&&e.ui_group===n.id),[l,n.id,C]);h(()=>{if(!g.current)return;if(!c)return;if(!t)return;E.find(e=>e.channel_code===c.channel_code)&&(w.current=i.createChannelComponent(Be(c,C)),w.current.parentElement!==g.current&&(v(!0),g.current.replaceChildren(w.current)))},[E,c,C,t,i]);const A=le(t);h(()=>{if(t&&!A&&null===c&&null!==y){const e=E.find(e=>e.channel_code===y);e&&i.setCurrentChannel(Be(e,C))}},[E,c,y,C,t,A,i]);const N=d(e=>{const n=l.find(n=>n.channel_code===e.value)||null;_(n?.channel_code??null),i.setCurrentChannel(n?Be(n,C):null)},[l,C,i]),P=m(()=>E.map(e=>({leadingAsset:o("img",{className:"xendit-dropdown-channel-logo",src:e.brand_logo_url},e.channel_code),leadingAssetInOverlay:o("img",{className:"xendit-channel-logo",src:e.brand_logo_url},e.channel_code),title:e.brand_name,value:e.channel_code,disabled:!Ce(r,e),description:He(a,r,e)||void 0})),[E,r,a]),S=1===E.length&&"CARDS"===E[0].channel_code;return s("div",{className:"xendit-channel-picker-group",children:[S?null:s("div",{className:"xendit-channel-form-field-group",children:[o("label",{htmlFor:b,className:"xendit-text-14",children:"SAVE"===f?a("payment_methods.add_payment_method",{groupName:n.label??"",ns:"session"}):a("payment_methods.pay_with")}),o(Te,{id:b,selectedIndex:function(){const e=P.findIndex(e=>e.value===c?.channel_code);if(-1!==e)return e;const n=P.findIndex(e=>e.value===y);return-1!==n?n:1===P.length?0:-1}(),options:P,disabled:P.length<=1,onChange:N,placeholder:a("payment_methods.select_channel_placeholder",{groupName:n.label,ns:"session"})})]}),!S&&x?o(Ge,{}):null,o("div",{style:{display:x?"":"none"},ref:g})]})};function He(e,n,t){return Ce(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 Ye=e=>{const n=G(),t=u(null),i=$(),a=i?.google_pay;return h(()=>{if(t.current&&a){const e=n.createDigitalWalletComponent("GOOGLE_PAY");return t.current.appendChild(e),()=>{e.remove()}}},[a,n]),o("div",{ref:t,className:"xendit-channel-picker-digital-wallet-section"})},Xe=e=>{const n=G(),t=K(),i=(()=>{const e=c(U);if(null===e)throw new Error("useChannelUiGroups must be used within a XenditSessionProvider");return e})(),a=z(),r=F(),{t:l}=G(),f=m(()=>Fe(r,{options:{filterMinMax:!1},pairChannels:$e(r),session:t}),[r,t]),b=u(null),y=m(()=>$e(r),[r]),_=m(()=>({pairChannels:y,session:{amount:t.amount,session_type:t.session_type},options:{filterMinMax:!1}}),[y,t.amount,t.session_type]),g=a?.ui_group??null,[x,v]=p(null),w=d(e=>{if(g===e||x===e)g===e&&b.current?.dispatchEvent(new XenditClearCurrentChannelEvent(e)),x===e&&v(null);else{const a=i.find(n=>n.id===e);X(a);const o=je(t,a,r,l).enabledChannels;if(0===o)return;if(1===o){const t=f[e][0];n.setCurrentChannel(Be(t,_)),v(null)}else v(e),n.setCurrentChannel(null)}},[i,r,f,_,x,n,g,t,l]);h(()=>{null!==a&&null!==x&&v(null)},[a,x]);const k=n[S].options.enableDigitalWallets??!1;return s("div",{ref:b,children:[k?o(Ye,{}):null,o(I,{children:i.filter(e=>(f[e.id]||[]).length>0).map(e=>{const n=null!==g?g===e.id:x===e.id,i=je(t,e,r,l),s=0===i.enabledChannels,d=i.firstDisabledChannelReason;return o(q,{id:e.id,title:e.label,iconName:Ze(g===e.id?a:null,f[e.id]),subtitle:d??void 0,open:n,disabled:s,onClick:w,children:o(ze,{group:e,open:n})},e.id)})})]})};function je(e,n,t,i){let a=null,r=0;for(const o of t)o.ui_group===n.id&&(Ce(e,o)?r++:null===a&&(a=He(i,e,o)));return{enabledChannels:r,firstDisabledChannelReason:a}}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 Ze(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 Je=({countryCode:e,size:n=16})=>o("div",{style:{width:`${n}px`,height:`${n}px`,borderRadius:"50%",backgroundImage:`url(https://assets.xendit.co/payment-session/flags/circle/${e.toLowerCase()}.svg)`,backgroundSize:"cover",backgroundPosition:"center"}}),en=e=>{const{field:n,onChange:t}=e,i=ue(n),a=de(n),[r,l]=p(void 0),c=nn.findIndex(e=>e.value===r),h=u(null);tn(e=>{if(h.current){const n=nn.find(n=>n.value===e);n&&m(n)}});const m=d(e=>{l(e.value),h.current&&(h.current.value=e.value),t()},[t]);return s("div",{children:[o("input",{type:"hidden",name:a,defaultValue:"",ref:h}),o(Te,{id:i,options:nn,onChange:m,placeholder:n.placeholder,selectedIndex:c,enableSearch:!0,className:"xendit-form-field-inner"})]})},nn=g().map(e=>({title:new Intl.DisplayNames(["en"],{type:"region"}).of(e),value:e,leadingAsset:o(Je,{countryCode:e})})).sort((e,n)=>e.title.localeCompare(n.title));function tn(e){const n=xt()?.cardDetails,t=n?.details?.country_codes[0],i=le(t);h(()=>{t&&t!==i&&e(t)})}const an=e=>{const{field:n,onChange:t}=e,i=ue(n),a=de(n);if(!function(e){return"dropdown"===e.type.name}(n))throw new Error("DropdownField expects field.type.name to be 'dropdown'");const r=u(null),c=m(()=>n.type.options.map(e=>({title:e.label,description:e.subtitle,value:e.value})),[n.type.options]),[f,b]=p(c[0]?.value??""),y=d(e=>{r.current&&(r.current.value=e.value),b(e.value),t()},[t]);h(()=>{c.length&&y(c[0])},[]);const _=c.findIndex(e=>e.value===f);return s(l,{children:[o(Te,{id:i,placeholder:n.placeholder,options:c,onChange:y,selectedIndex:_,className:"xendit-form-field-inner"}),o("input",{type:"hidden",name:a,defaultValue:"",ref:r})]})};const rn="undefined"!=typeof window&&window.HTMLElement?window.HTMLElement:EventTarget;class XenditFormAssociatedFocusTrap extends rn{static tag="xendit-form-associated-focus-trap";static formAssociated=!0;internals;constructor(){super(),this.internals=this.attachInternals()}}var on;on=XenditFormAssociatedFocusTrap,"undefined"!=typeof window&&window.customElements&&customElements.define(on.tag,on);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 sn=n(null);X("https://assets.xendit.co/components/secure-iframe-v0.0.21.html");const ln=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.21.html").origin,dn=({children:e})=>{const n=u(new Map),t={registerIframe:(e,t)=>{t.current&&n.current.set(e,t.current)},unregisterIframe:e=>n.current.delete(e),postMessageToIframe:(e,t)=>{const i=n.current.get(e);i?.contentWindow&&i.contentWindow.postMessage(t,ln)}};return o(sn.Provider,{value:t,children:e})};X("https://assets.xendit.co/components/secure-iframe-v0.0.21.html");const cn=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.21.html"),un=cn.toString(),hn=cn.origin,pn=e=>{const{field:n,onChange:t}=e,i=G(),a=ue(n),r=de(n),l=K(),m=u(null),f=u(null),[b,y]=p(),[_,g]=p(!1),[x,v]=p(null),{card:w}=_t()??{},k=d(e=>{if(!m.current)return;const i=m.current.contentWindow;if(e.source!==i)return;if(e.origin!==hn)return;const a=e.data;switch(a.type){case"xendit-iframe-ready":y(a.ecdhPublicKey);break;case"xendit-iframe-change":{if(!f.current)return;v(a.cardBrand);const e=a.encrypted,n=1,i=e.map(e=>{if(a.empty)return"";const t=["xendit-encrypted",n,b,e.iv,e.value];return!a.valid&&a.validationErrorCodes.length&&t.push("invalid",btoa(a.validationErrorCodes[0].localeKey)),t.join("-")});if(0===i.length)break;f.current.value=i.length>1?JSON.stringify(i):i[0],t?.();break}case"xendit-iframe-focus":g(!0);break;case"xendit-iframe-blur":g(!1),f.current?.value&&f.current?.dispatchEvent(new InternalSetFieldTouchedEvent);break;case"xendit-iframe-failed-init":console.error(`Iframe field for ${n.channel_property} failed to initialize securely`)}},[n.channel_property,b,t]),C=d(()=>{m.current?.contentWindow&&m.current.contentWindow.postMessage({type:"xendit-iframe-focus"},hn)},[]);h(()=>(window.addEventListener("message",k),()=>{window.removeEventListener("message",k)}),[k]);const E=c(sn);h(()=>(E?.registerIframe(r,m),()=>E?.unregisterIframe(r)),[r,E]);const A=new URL(un);A.searchParams.set("input_type",n.type.name),A.searchParams.set("embedder",window.location.origin),A.searchParams.set("session_id",l.payment_session_id),A.searchParams.set("pk",i[S].sdkKey.publicKey),A.searchParams.set("sig",i[S].sdkKey.signature),i[S].options.iframeFieldAppearance&&A.searchParams.set("appearance",JSON.stringify(i[S].options.iframeFieldAppearance));return s("div",{className:`xendit-iframe-container xendit-form-field-inner ${_?"xendit-field-focus":""}`,children:[o(XenditFormAssociatedFocusTrap.tag,{id:a,onFocus:C,tabIndex:-1}),o("input",{type:"hidden",name:r,defaultValue:"",ref:f}),o("iframe",{src:A.toString(),ref:m,sandbox:"allow-scripts allow-same-origin"}),"credit_card_number"===n.type.name&&w&&o(mn,{cardsBrandList:w.brands,selectedCardBrand:x})]})},mn=({cardsBrandList:e,selectedCardBrand:n})=>{if(!e)return null;const t=e.find(e=>e.name===n)?.logo_url;return o("div",{className:"xendit-card-brands-list",children:n?t&&o("img",{className:"xendit-card-brand-logo",src:t,alt:n}):e.map(({name:e,logo_url:n})=>o("img",{className:"xendit-card-brand-logo",src:n,alt:e},e))})},fn=e=>{const{field:n,onChange:t}=e,i=ue(n),a=de(n),r=K(),l=u(null),[c,h]=p(r.country),f=m(()=>{const e=bn.findIndex(e=>e.value===c);return-1===e?0:e},[c]),b=bn[f],[y,_]=p(""),g=u(null),v=d((e,n)=>{const t=yn(e,n);return t?t.number:`+${e.dial}${n}`},[]),C=d((e,n)=>{l.current&&(l.current.value=v(e,n))},[v]);function E(e){const n=e;h(n.value),C(n,y),t()}return tn(e=>{const n=bn.find(n=>n.value===e);n&&n.value!==c&&!y&&E(n)}),s("div",{className:"xendit-input-phone",children:[o(Te,{options:bn,selectedIndex:f,onChange:E,fixedOverlayWidth:300,enableSearch:!0,className:"xendit-form-field-inner"}),o("input",{id:i,ref:g,type:"tel",inputMode:"tel",placeholder:x(b.value,k)?.formatInternational()?.replace(`+${w(b.value)} `,"")||"",className:"xendit-text-14 xendit-form-field-inner xendit-phone-number-input",onBlur:function(e){!function(){const e=yn(b,y);if(e){const n=e.formatInternational();_(n.replace(`+${w(b.value)} `,""))}}(),e.currentTarget?.value&&l.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){const n=e.target.value;_(n),C(b,n),t()},value:y,autoComplete:"tel"}),o("input",{type:"hidden",name:a,ref:l})]})},bn=nn.map(e=>{const n=w(e.value);return n?{...e,shortTitle:`+${n}`,title:`${e.title} (+${n})`,dial:n}:null}).filter(e=>Boolean(e)),yn=(e,n)=>{const t=_(n,e.value);return t&&t.isPossible()?t:null};function _n(e){return{title:e.name,value:e.value}}const gn=[{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(_n),xn=[{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(_n),vn=[{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})),wn=e=>{const{field:n,onChange:t}=e,i=ue(n),a=de(n),r=K(),c=_t()?.form,p=it(),m=u(null),f=d(()=>{m.current&&(m.current.value=""),t()},[t]),b=d(e=>{m.current&&(m.current.value=e.value),t(),m.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[t]),y=d(e=>{m.current&&(m.current.value=e.target.value),t(),m.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[t]),_=function(e){switch(e){case"US":return gn;case"CA":return xn;case"GB":return vn;default:return null}}(function(e,n,t,i){if(n)for(let i=0;i<n.length;i++){const a=n[i];if(i>0&&a===e){const e=n[i-1];if("country"===e.type.name){const n=_e(e.channel_property,t);if(n&&"string"==typeof n)return n}}}return i.country}(n,c??[],p??{},r)),g=le(_);return h(()=>{g!==_&&f()},[f,_,g]),s(l,{children:[o("input",{type:"hidden",name:a,defaultValue:"",ref:m}),_?o(Te,{id:i,options:_,onChange:b,placeholder:n.placeholder,enableSearch:!0,className:"xendit-form-field-inner"},(x=_,ve.has(x)||ve.set(x,we++),ve.get(x).toString())):o("input",{type:"text",id:i,onChange:y,placeholder:n.placeholder,className:"xendit-form-field-inner xendit-text-14"})]});var x};const kn=e=>{const{field:n,onChange:t}=e,i=ue(n),a=de(n),r=u(null);return o("input",{id:i,name:a,ref:r,type:"text",placeholder:n.placeholder,className:"xendit-form-field-inner xendit-text-14",onBlur:function(e){e.currentTarget?.value&&r.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){t()},minLength:Cn(n)?n.type.min_length:void 0,maxLength:Cn(n)?n.type.max_length:void 0,autoComplete:Cn(n)?n.type.autocomplete:void 0})};function Cn(e){return"text"===e.type.name}const En={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"},An={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$"},Nn={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$"},Pn={BHD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function Sn(e,n){let t;const i=e<0,a=En[n]??"en",r=Pn[n]??2;if(t=new Intl.NumberFormat(a,{style:"decimal",minimumFractionDigits:r,maximumFractionDigits:20}).format(Math.abs(e)),t=t.replace(/(\.|,)000?$/,""),An[n]){const e=An[n]??n;t=(Nn[n]??"$1").replace("$",e).replace("1",t)}else t=n+" "+t;return i&&(t="-"+t),t}const In=e=>{const{field:n,onChange:t}=e,{t:i}=G(),a=K(),r=ue(n),c=de(n),f=u(null),b=_t();X(b);const y=m(()=>Ne(b.form,"credit_card_number"),[b.form]),_=xt()?.paymentOptions,g=_?.options?.installment_plans,[x,v]=p(null),w=m(()=>{const e=g?.map(e=>({title:i("installment_plan.pay_in_installments",{installments:e.terms,amount:Sn(e.installment_amount,a.currency)}),subtitle:e.interest_rate,value:Rn(e)}))??[];return y&&e.unshift({title:i("installment_plan.pay_in_full",{amount:Sn(a.amount,a.currency)}),value:""}),e},[y,g,a.amount,a.currency,i]);let k=w?.findIndex(e=>e.value===x);-1===k&&(k=0);const C=d(()=>{v(null),f.current&&(f.current.value="")},[]),E=d(e=>{if(f.current){const n=g?.find(n=>Rn(n)===e.value);n?n.code?f.current.value=JSON.stringify([n.terms,n.interval,n.code]):f.current.value=JSON.stringify([n.terms,n.interval]):f.current.value="",f.current?.dispatchEvent(new InternalSetFieldTouchedEvent)}v(e.value),t()},[g,t]);h(()=>{w.length&&E(w[0])},[]);const A=le(w);return h(()=>{w===A||g?.some(e=>Rn(e)===x)||(w.length?E(w[0]):C())},[C,w,E,g,A,x]),s(l,{children:[_?o(Te,{id:r,placeholder:n.placeholder,onChange:E,options:w,selectedIndex:k,className:"xendit-form-field-inner"}):o(qe,{id:r,className:"xendit-form-field-inner"}),o("input",{type:"hidden",name:c,ref:f})]})};function Rn(e){return`${e.terms}_${e.interval}_${e.code??""}`}const Tn=e=>{const{field:n,className:t}=e;return o("div",{className:`${t} xendit-channel-form-field xendit-form-field-span-${n.span}`,children:function(){switch(n.type.name){case"credit_card_number":case"credit_card_expiry":case"credit_card_cvn":return o(pn,{...e});case"phone_number":return o(fn,{...e});case"text":case"email":case"postal_code":return o(kn,{...e});case"dropdown":return o(an,{...e});case"installment_plan":return o(In,{...e});case"country":return o(en,{...e});case"province":return o(wn,{...e})}throw n.type,new Error(`Unsupported field type: ${n.type.name}`)}()})};const qn={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_barcode.merchant_name":"Seller","action_barcode.amount_to_pay":"Amount to Pay","action_barcode.barcode_content":"Payment Code","action_barcode.unable_to_generate":"Unable to generate barcode","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 Dn=(e,n,t)=>n?(e=>"object"==typeof e&&null!==e&&"localeKey"in e)(n)?e(n.localeKey,{field:t.label}):n.value:null;function Mn(e){return e.startsWith("/")&&e.endsWith("/")?e.slice(1,-1):e}function Ln(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=xe(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=v(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(Mn(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 On(e,n){const t=Array.isArray(e.channel_property)?e.channel_property:[e.channel_property];for(const i of t){let t=Un(n,i);if(void 0===t&&(t=""),"string"!=typeof t)continue;const a=Ln(e,t);if(a)return a}}function Un(e,n){const t=n.split("."),i=e[t[0]];if(void 0!==i){if("object"!=typeof i||Array.isArray(i)){if(1!==t.length)throw new Error(`Attempted to read channel property "${n}" expecting an object but found a primitive value; this is a bug, please contact support.`);return i}return Un(i,t.slice(1).join("."))}}const Bn=n(null),Vn=({scenarios:e,onSelect:n,children:t})=>{const[i,a]=p(!1),r=u(null);return h(()=>{if(!i)return;const e=e=>{const n=r.current;n&&(n.contains(e.target)||a(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]),o("div",{ref:r,children:o(Bn.Provider,{value:{open:i,setOpen:a,scenarios:e,onSelect:n},children:t})})},Wn=({children:e})=>o("div",{className:"xendit-form-simulation-root",children:e}),Kn=({children:e})=>{const{open:n,setOpen:t}=c(Bn)||{};return o("button",{type:"button",className:"xendit-form-simulation-trigger",onClick:()=>t?.(!n),children:e})},Fn=()=>{const e=c(Bn);X(e);const{open:n,setOpen:t,scenarios:i,onSelect:a}=e,{t:r}=G();return n&&i?s("div",{className:"xendit-form-simulation-popover",children:[o("div",{className:"xendit-text-12 xendit-text-semibold",children:r("simulation.simulate_test_scenario")}),o(Te,{onChange:e=>{a?.(e.value),t?.(!1)},placeholder:r("simulation.select_scenario"),options:i.scenarios.map(e=>({title:e.description,value:e.name,leadingAsset:o("img",{src:e.imageUrl,className:"xendit-channel-logo"})}))}),i?.docsLink?s("div",{className:"xendit-text-14",children:[r("simulation.want_to_test_all_scenarios")," ",o("a",{href:i.docsLink,target:"_blank",rel:"noopener noreferrer",className:"xendit-text-link",children:r("simulation.see_all_scenarios")})]}):null]}):null},$n="field-radius-bl-0",Gn="field-radius-br-0",zn="field-radius-tl-0",Hn="field-radius-tr-0",Yn="field-collapse-r",Xn="field-collapse-l",jn="field-collapse-t",Qn="field-collapse-b",Zn=({fieldGroup:e,groupIndex:n,handleFieldChanged:t,channelProperties:i,simulationScenarios:a})=>{const{t:r}=G(),l=u(null),[d,c]=p({}),m=e.map(e=>e.span),f=Math.ceil(e.reduce((e,n)=>e+n.span,0)/2);h(()=>{const e=l.current;if(e)return e.addEventListener(InternalSetFieldTouchedEvent.type,n),()=>{e.removeEventListener(InternalSetFieldTouchedEvent.type,n)};function n(e){const n=e.target.name;c(e=>({...e,[n]:!0}))}},[]);const b=(()=>{for(const n of e){if(!d[de(n)])continue;const e=On(n,i??{});if(e)return o("span",{className:"xendit-error-message xendit-text-12",children:Dn(r,e,n)})}return null})();return o(dn,{children:s("div",{className:"xendit-channel-form-field-group",children:[s("div",{className:"xendit-channel-form-field-group-label-container",children:[o("label",{htmlFor:ue(e[0]),className:"xendit-text-14",children:e[0].group_label??e[0].label??""}),a?o(Jn,{simulationScenarios:a,fieldGroup:e}):null]}),o("div",{ref:l,className:"xendit-form-field-group "+(b?"invalid":""),children:e.map((e,n)=>{const i=(e=>{const n=m.slice(0,e).reduce((e,n)=>e+n,0),t=0===e?0:Math.floor(n/2);return{fieldPositionBySpan:n,fieldRow:t,fieldColumn:n%2,isLastRow:t===f-1}})(n),a=((e,n,t)=>{const{fieldPositionBySpan:i,fieldRow:a,fieldColumn:r,isLastRow:o}=t;return y({[$n]:f>a+1||i%2==1,[Gn]:!!m[n+1],[zn]:n>0,[Hn]:!(0===a&&1===r||0===a&&0===r&&2===e.span),[Yn]:1===e.span&&0===r,[Xn]:1===e.span&&1===r,[jn]:i>=2,[Qn]:!o})})(e,n,i);return o(Tn,{className:a,field:e,onChange:t},n)})},n),b]})})},Jn=({simulationScenarios:e,fieldGroup:n})=>{const t=c(sn),{t:i}=G();return o(Vn,{scenarios:e,onSelect:i=>{const a=e.scenarios.find(e=>e.name===i);if(a?.values)for(const[e,i]of Object.entries(a.values)){const a=n.find(n=>de(n)===e);a&&("credit_card_number"!==a.type.name&&"credit_card_expiry"!==a.type.name&&"credit_card_cvn"!==a.type.name||t?.postMessageToIframe(e,{type:"xendit-iframe-populate-for-simulation",scenario:i}))}},children:s(Wn,{children:[o(Kn,{children:o("div",{className:"xendit-text-12 xendit-text-semibold xendit-text-link",children:i("simulation.simulate_scenario")})}),o(Fn,{})]})})},et={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"},nt=C(({form:e,onChannelPropertiesChanged:n},t)=>{const i=K(),a=_t(),r=G(),s=xt(),l=u(null),[c,h]=p(null);f(t,()=>({setAllFieldsTouched(){const e=l.current;e&&Array.from(e.elements).filter(e=>e instanceof HTMLInputElement).forEach(e=>{e.name&&e.dispatchEvent(new InternalSetFieldTouchedEvent)})}}));const y=d(()=>{if(!l.current)return{};return function(e){const n={};for(const[t,i]of e){if(i instanceof Blob)continue;const e=t.split("__"),a=at(e,i);e:for(const t of e){const e=t.split(".");let i=n;for(;e.length>1;){const n=e.shift();let t=i[n];if(void 0===t&&(t=i[n]={}),t&&"object"==typeof t){if(Array.isArray(t))continue e;i=t}}const r=a.length?a.shift():"";i[e[0]]=r}}return n}(new FormData(l.current).entries())},[]),_=d(()=>{if(!l.current)return;const e=y();h(e),n(e)},[y,n]),g=function(e,n,t,i){const a=m(()=>rt(e.session_type,n,t,i),[i,t,n,e.session_type]);return a}(i,e,c||{},s??null),x=le(g);b(()=>{(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})(x||[],g)||_()},[g,_,x]);const v=d(e=>r.supportsSimulationScenarios()&&"CARDS"===a?.channel_code&&e.some(e=>"credit_card_number"===e.type.name)?et:null,[a,r]),w=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}(g).filter(e=>e.length);return 0===w.length?null:o("div",{class:"xendit-channel-form",children:o("form",{ref:l,children:o(tt.Provider,{value:c,children:w.map((e,n)=>o(Zn,{fieldGroup:e,groupIndex:n,handleFieldChanged:_,channelProperties:c,simulationScenarios:v(e)},n))})})})}),tt=n(null),it=()=>c(tt);function at(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 rt(e,n,t,i){const a=Ne(n,"credit_card_number"),r=i?.cardDetails?.details?.require_billing_information,o=!!i?.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&&a)return!1;for(const e of n.display_if||[]){const[n,i,a]=e,r=Un(t,n);switch(i){case"equals":if(r!==a)return!1;break;case"not_equals":if(r===a)return!1}}return!0})}const ot=e=>{const n=u(null),t=u(null),i=void 0!==HTMLElement.prototype.animate;return h(()=>{i&&(n.current?.animate(st,lt),t.current?.animate(dt,ct))},[i]),s("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s("g",{opacity:"0.5",children:[o("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"}),o("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"})]}),s("g",{ref:t,style:{transformOrigin:"20px 20px"},children:[o("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"}),s("g",{style:{transformOrigin:"10px 30px"},ref:n,children:[o("path",{d:"M26.7697 20.5301V12.7301H18.9697",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M17.4102 22.0901L26.7702 12.7301",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})},st=[{transform:"scale(0.1)"},{transform:"scale(1)"}],lt={duration:500,easing:"ease-out"},dt=[{transform:"rotate(0deg)"},{transform:"rotate(5deg)"},{transform:"rotate(-5deg)"},{transform:"rotate(0deg)"}],ct={duration:1e3,easing:"ease-out",iterations:1/0,delay:2e3},ut=[{transform:"translateY(0)"},{transform:"translateY(44px)"}],ht={duration:1e3,delay:1e3,easing:"ease-out"},pt={duration:1e3,direction:"reverse",delay:500,easing:"ease-in"},mt=[{opacity:1},{opacity:0},{opacity:1}],ft={duration:1e3},bt=e=>{const{id:n,label:t,checked:i,onChange:a,disabled:r}=e,l=me(),d=n||l;return s("div",{className:"xendit-checkbox",children:[s("div",{className:"xendit-checkbox-box",children:[o("input",{id:d,type:"checkbox",onChange:e=>{a?.(e)},checked:i,disabled:r}),o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:"xendit-checkbox-graphic",children:o("polyline",{points:"40 144 96 200 224 72",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"16"})})]}),o("label",{htmlFor:d,className:"xendit-text-14",children:t})]})},yt=n(null),_t=()=>{const e=c(yt);if(void 0===e)throw new Error("useChannel must be used within a ChannelProvider");return e},gt=n(null);gt.displayName="ChannelComponentDataContext";const xt=()=>c(gt),vt=e=>{const{channelOrPair:n,channelData:t,savePaymentMethod:i,formRef:a}=e,r=u(null),l=G(),{t:d}=l,c=K(),p=n[0],m=n.length>1,f=ke(n,i),b=function(e){if(e&&2===e.length)return[e[0],e[1]];return null}(f.instructions),y="OPTIONAL"===c.allow_save_payment_method&&(f.allow_save||m);return h(()=>{b||f.form.length||f.banner||console.error(`Missing display data for ${f.channel_code}, this is a bug, please contact support`)},[b,f.banner,f.channel_code,f.form]),o(yt.Provider,{value:f,children:o(gt.Provider,{value:t,children:s("div",{className:"xendit-payment-channel",ref:r,children:[o(nt,{ref:a,form:f.form,onChannelPropertiesChanged:e=>{let n=e;if("CARDS"===p.channel_code&&e.installment_configuration){const t=Object.fromEntries(Object.entries(e.installment_configuration).filter(([e,n])=>""!==n));n=0===Object.keys(t).length?{...e,installment_configuration:void 0}:{...e,installment_configuration:t}}const t=new XenditChannelPropertiesChangedEvent(p.channel_code,n);r.current?.dispatchEvent(t)}}),f.banner?o(kt,{banner:f.banner}):null,y&&o(bt,{label:d("payment.save_checkbox_label"),onChange:e=>{const n=e.target?.checked;l?.dispatchEvent(new InternalUpdateChannelComponentData(p.channel_code,{savePaymentMethod:n}))},checked:i}),b?s("div",{className:"xendit-payment-channel-instructions",children:[wt[f.pm_type??""]??o(ot,{}),o("div",{className:"xendit-payment-channel-instructions-text xendit-text-12",children:b.map((e,n)=>o("p",{className:0===n?"xendit-text-semibold":void 0,children:e},n))})]}):null]})})})},wt={EWALLET:o(ot,{}),QR_CODE:o(e=>{const n=u(null),t=u(null),i=me(),a=void 0!==HTMLElement.prototype.animate;return h(()=>{if(a&&n.current){const e=()=>{if(!n.current)return;const i=n.current.animate(ut,ht);setTimeout(()=>{t.current?.animate(mt,ft)},1e3),i.onfinish=()=>{const i=n.current?.animate(ut,pt);setTimeout(()=>{t.current?.animate(mt,ft)},500),i&&(i.onfinish=e)}};e()}},[a]),s("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:[s("g",{"clip-path":`url(#${i})`,children:[o("rect",{x:"8",y:"8",width:"24",height:"24",fill:"var(--xendit-color-icon-secondary)",ref:t}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("rect",{x:"3",y:"-4",width:"34",height:"4",rx:"1.75",ref:n})]}),o("defs",{children:o("clipPath",{id:i,children:o("rect",{width:"40",height:"40",fill:"white"})})})]})},{})},kt=e=>{const n="number"==typeof e.banner.aspect_ratio?String(e.banner.aspect_ratio):void 0;return e.banner?.link_url?o("a",{href:e.banner.link_url,target:"_blank",rel:"noopener noreferrer",children:o("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:n}})}):o("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:n}})};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 Ct(e){const n=new URLSearchParams;return n.append("payload",JSON.stringify(e)),n}function Et(e,n,t){return async function(...i){let a,r,o,s,l;switch(e){case"GET":[a,r,o,l]=i;break;case"POST":[a,s,r,o,l]=i;break;default:throw new Error(`Unable to call endpoint with method ${e}; this is a bug, please contact support.`)}const d="v0.0.21";X(d),X(d.startsWith("v"));const c=a.hostId;if(c===ae)throw new Error("A network request was made in mock mode; this is a bug.");const u=oe(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?Ct(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 At=Et("GET",e=>`/api/sessions/${e}`),Nt=Et("POST",()=>"/api/sessions/payment_tokens"),Pt=Et("POST",()=>"/api/sessions/payment_requests"),St=Et("POST",e=>`/api/sessions/${e.sessionAuthKey}/payment_requests/${e.paymentRequestId}/simulate`),It=Et("GET",e=>`/api/sessions/${e}/poll`,e=>new URLSearchParams(e?{token_request_id:e}:{})),Rt=Et("POST",e=>`/api/sessions/${e}/card_info`),Tt=Et("POST",e=>`/api/sessions/${e}/payment_options`);function qt(e,n,t){return{impl:e,key:n??"",child:t,instance:void 0}}class BehaviorTree{fn;bb;root=qt(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,Dt(e);const n=this.root??void 0,t=this.fn(this.bb);this.root=t,Mt(n,t,this.bb,0)}}finally{this.updating=!1}}findBehavior(e){return Ut(this.root,e)}}function Dt(e){if(e>32)throw new Error("Max recursion depth exceeded; this is a bug, please contact support.")}function Mt(e,n,t,i){if(Dt(i),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&&Ot(e,i+1),n&&Lt(n,t,i+1);else if(Array.isArray(e)||Array.isArray(n)){j(e),j(n);const a=Math.max(e.length,n.length);for(let r=0;r<a;r++)Mt(e[r],n[r],t,i+1)}else n&&(n.instance=e?.instance),e&&(e.instance=void 0),Mt(e?.child,n?.child,t,i+1),n?.instance?.update?.()}function Lt(e,n,t){if(Dt(t),Array.isArray(e))for(const i of e)i&&Lt(i,n,t+1);else e.instance=new e.impl(n,e.key),e.instance.enter?.(),e.child&&Lt(e.child,n,t+1)}function Ot(e,n){if(Dt(n),Array.isArray(e))for(const t of e)t&&Ot(t,n+1);else e.child&&Ot(e.child,n+1),e.instance?.exit?.(),e.instance=void 0}function Ut(e,n){if(Array.isArray(e))for(const t of e){if(!t)continue;const e=Ut(t,n);if(e)return e}else{if(e.impl===n)return e.instance??null;if(e.child)return Ut(e.child,n)}return null}class ActionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){}}const Bt=e=>s("div",{className:"xendit-redirect-instructions",children:[o("div",{className:"xendit-redirect-instructions-logo",children:o("img",{src:e.logoUrl,alt:e.logoAlt})}),s("div",{className:"xendit-redirect-instructions-text",children:[o("div",{className:"xendit-text-16",children:e.title}),e.subtitle?o("div",{className:"xendit-text-14 xendit-text-secondary",children:e.subtitle}):null]}),e.redirectUrl?o("a",{href:e.redirectUrl,className:"xendit-redirect-instructions-button xendit-text-14",children:e.redirectButtonLabel??""}):null]}),Vt=e=>{const n=e.t,t=e.channel,i=t.brand_name;return o(Bt,{title:n("action_deeplink.title"),subtitle:n("action_deeplink.instructions",{channelName:i}),logoUrl:t.brand_logo_url,logoAlt:n("image_alt.channel_logo",{channelName:i}),redirectUrl:e.redirectUrl,redirectButtonLabel:n("action_deeplink.button",{channelName:i})})},Wt=e=>{const{title:n,onClose:t,children:i,seamless:a,borderColor:r}=e,l=u(!1),c=u(!1),p=u(null),m=u(null),f=void 0!==HTMLElement.prototype.animate,b=d(()=>{l.current||(l.current=!0,t())},[t]),y=d(()=>{if(!p.current||!m.current||c.current)return;if(c.current=!0,!f)return void b();m.current.animate?.(Gt,Ft);const e=p.current.animate?.(Ht,Ft);e.onfinish=b},[b,f]);return h(()=>{f&&(m.current?.animate?.($t,Kt),p.current?.animate?.(zt,Kt))},[f]),h(()=>{e.close&&y()},[e.close,y]),o("div",{className:"xendit-dialog-backdrop",ref:m,children:s("div",{className:"xendit-dialog",ref:p,style:r?{border:`4px solid ${r}`}:void 0,children:[a?null:s("div",{className:"xendit-dialog-header xendit-text-16 xendit-text-semibold",children:[n,o("button",{"aria-label":"Close",onClick:y,children:o(R,{name:"x",size:20})})]}),o("div",{className:"xendit-dialog-body",style:e.noPadding?{padding:"0"}:void 0,children:i}),a?o("button",{"aria-label":"Close",onClick:y,className:"xendit-dialog-floating-close",children:o(R,{name:"x",size:20})}):null]})})},Kt={duration:500,easing:"cubic-bezier(.32,.23,0,.92)",fill:"forwards"},Ft={duration:200,easing:"linear",fill:"forwards"},$t=[{backgroundColor:"rgba(0, 0, 0, 0)"},{backgroundColor:"rgba(0, 0, 0, 0.2)",offset:.1},{backgroundColor:"rgba(0, 0, 0, 0.6)"}],Gt=$t.slice().reverse(),zt=[{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:1,transform:""}],Ht=[{opacity:1,transform:""},{opacity:0,transform:"scale(0.92) translateY(-10px)"}];function Yt(e){const{sdk:n,title:t,onClose:i,width:a,height:r,borderColor:s}=e,l=u(null);return h(()=>{const e=n.createActionContainerComponent(S);return l.current?.replaceChildren(e),()=>{n.destroyComponent(e)}},[n]),o(Wt,{title:t,onClose:i,close:e.close,borderColor:s,noPadding:e.defaultActionContainerType===Xt.QrWithCustomArt,seamless:!0,children:o("div",{className:"xendit-default-action-container",ref:l,style:{width:a?`calc(min(100vw - 64px, ${a}px))`:"calc(100vw - 64px)",height:r?`calc(min(100vh - 64px, ${r}px))`:void 0}})})}var Xt;!function(e){e.QrWithCustomArt="qr-with-custom-art",e.Generic="generic"}(Xt||(Xt={}));class ContainerActionBehavior{bb;cleanupFn=null;defaultContainerHeight=0;defaultContainerWidth=400;title="Complete your payment";constructor(e){this.bb=e}ensureHasActionContainer(e=Xt.Generic){if(X(this.bb.channel),this.bb.sdk[S].liveComponents.actionContainer)return()=>{this.emptyActionContainer()};let n=!1,a=!1;const r=document.createElement("div");r.setAttribute("class","xendit-default-action-container");const o={sdk:this.bb.sdk,title:this.title,width:this.defaultContainerWidth,height:this.defaultContainerHeight,borderColor:void 0,defaultActionContainerType:e,onClose:()=>{n=!0,t(null,r),r.remove(),a||this.bb.sdk.abortSubmission()}};return t(i(Yt,o),r),document.body.appendChild(r),e=>{e||(a=!0),n||t(i(Yt,{...o,close:!0}),r)}}cleanupActionContainer(e){this.cleanupFn&&(this.cleanupFn(e),this.cleanupFn=null)}emptyActionContainer(){const e=this.bb.sdk[S].liveComponents.actionContainer;e&&t(null,e)}updateActionContainerBrandColor(){X(this.bb.channel);const e=this.bb.sdk[S].liveComponents.actionContainer;e&&e.style.setProperty("--xendit-channel-brand-color",this.bb.channel.brand_color)}populateActionContainer(e){const n=this.bb.sdk[S].liveComponents.actionContainer;if(!n)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(),t(e(),n)}exit(){this.cleanupActionContainer(!1),this.emptyActionContainer()}}class ActionDeepLinkBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){X(this.bb.world);const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];if(Z(e?.type,"REDIRECT_CUSTOMER"),"DEEPLINK_URL"!==e.descriptor&&"WEB_URL"!==e.descriptor)throw new Error("Unexpected action type in ActionDeepLinkBehavior");const n=this.bb.sdk.t.bind(this.bb.sdk),t=this.bb.channel;X(t),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>i(Vt,{t:n,channel:t,redirectUrl:e.value}))}exit(){super.exit()}}const jt=e=>{const n=e.t,t=e.channel,i=t.brand_name;return o(Bt,{title:n("action_empty_list_push_notification.title"),subtitle:n("action_empty_list_push_notification.subtext",{channelName:i}),logoUrl:t.brand_logo_url,logoAlt:n("image_alt.channel_logo",{channelName:i}),redirectUrl:null,redirectButtonLabel:null})};var Qt;function Zt(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 Jt(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 ei(e,n,t){const{session:i,paymentEntity:a}=e;switch(X(i),X(a),X(n),t){case"PENDING":return ni(i);case"PENDING_PAYMENT_ENTITY_ONLY":return function(e,n){const t=n.type===Qt.PaymentRequest?n.entity:void 0,i=n.type===Qt.PaymentToken?n.entity:void 0;return{session:e,payment_request:ti(t,"PENDING"),payment_token:ti(i,"PENDING")}}(i,a);case"SUCCESS":return"PENDING"===n._mock_action_type?ni(i):function(e,n){const t=n.type===Qt.PaymentRequest?n.entity:void 0,i=n.type===Qt.PaymentToken?n.entity:void 0;return{session:{...e,status:"COMPLETED",payment_request_id:t?.payment_request_id,payment_token_id:i?.payment_token_id},payment_request:ti(t,"SUCCEEDED"),payment_token:ti(i,"ACTIVE"),succeeded_channel:{channel_code:n.entity.channel_code,logo_url:"https://placehold.co/48"}}}(i,a);case"FAILURE":return function(e,n){const t=n.type===Qt.PaymentRequest?n.entity:void 0,i=n.type===Qt.PaymentToken?n.entity:void 0;return{session:{...e,status:"ACTIVE"},payment_request:ti(t,"FAILED"),payment_token:ti(i,"FAILED")}}(i,a)}}function ni(e){return{session:{...e,status:"PENDING"}}}function ti(e,n){return e?{...e,status:n}:e}function ii(e,n){return"PENDING"===n?{payment_request_id:`pr-${pe()}`,status:"PENDING",channel_code:e,actions:[],session_token_request_id:pe()}:n?{payment_request_id:`pr-${pe()}`,status:"REQUIRES_ACTION",channel_code:e,actions:ai(n),session_token_request_id:pe()}:{payment_request_id:`pr-${pe()}`,status:"SUCCEEDED",channel_code:e,actions:[],session_token_request_id:pe()}}function ai(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(){X(this.bb.world),this.bb.hackyOvoActionLatch=!0;const e=this.bb.sdk.t.bind(this.bb.sdk),n=this.bb.channel;X(n),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>i(jt,{t:e,channel:n})),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(ei(this.bb.world,this.bb.channel,"PENDING_PAYMENT_ENTITY_ONLY")))}exit(){this.bb.hackyOvoActionLatch=void 0,super.exit()}}function ri(e){const{url:n,channelCode:t,mock:i,onIframeComplete:a}=e,r=u(null),s=d(e=>{if(!r.current)return;const n=r.current.contentWindow;e.source===n&&"xendit-iframe-action-complete"===e.data?.type&&a(e.data)},[a]);if(h(()=>(window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}),[s]),i){const e=oi("CARDS"===t?"a 3DS authentication page":"an authentication page");return o("iframe",{ref:r,srcDoc:e,className:"xendit-action-iframe"})}return o("iframe",{ref:r,src:n,className:"xendit-action-iframe"})}const oi=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(()=>(X(this.bb.channel),i(ri,{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){X(this.bb.world?.paymentEntity),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(ei(this.bb.world,this.bb.channel,e)))}exit(){super.exit()}}const si={format:"CODE128",renderer:"svg",width:2,height:132,displayValue:!0,fontOptions:"",font:"Roboto",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:14,background:"#ffffff",lineColor:"#000000",margin:8},li=({instructions:e})=>{switch(e.length){case 0:return null;case 1:return o(di,{instruction:e[0]});default:return o(ci,{instructions:e})}},di=e=>s("div",{children:[o("p",{className:"xendit-instructions-single-tab-heading",children:e.instruction.title}),o(ui,{instruction:e.instruction})]}),ci=e=>{const[n,t]=p(0);return s("div",{children:[o("div",{className:"xendit-instructions-tab-list",children:e.instructions.map((e,i)=>o("button",{className:y("xendit-instructions-tab-button",{"xendit-instructions-active-tab":n===i}),onClick:()=>t(i),children:e.title},i))}),o(ui,{instruction:e.instructions[n]})]})},ui=e=>o("ol",{className:"xendit-instructions-numbered-list","data-testid":"instructions-steps",children:e.instruction.content.map((e,n)=>{const t=Array.isArray(e)?e:[e];return o("li",{className:"xendit-instructions-step-li",children:o("div",{className:"xendit-instructions-step-box",children:t.map((e,n)=>o(a,{children:fi(e)},n))})},n)})});function hi(e){return Array.from(e).map((e,n)=>{switch(e.nodeType){case Node.TEXT_NODE:return null===e.textContent?null:e.textContent;case Node.ELEMENT_NODE:return function(e,n){const t=y({"xendit-instructions-bold":"B"===e.nodeName,"xendit-instructions-italics":"I"===e.nodeName});return t?o("span",{className:t,children:hi(e.childNodes)},n):hi(e.childNodes)}(e,n);default:return null}})}const pi="undefined"!=typeof DOMParser?new DOMParser:null;function mi(e){try{if(!pi)return e;return hi(pi.parseFromString(e,"text/html").body.childNodes)}catch(n){return e}}function fi(e){if("string"==typeof e)return o("p",{className:"xendit-instructions-step-item",children:mi(e)});switch(e.type){case"text":return function(e){return o("p",{children:mi(e.text)})}(e);case"image":return function(e){return o("div",{children:o("img",{src:e.src,alt:e.alt||"",style:{height:`${e.height??24}px`}})})}(e);case"bullets":return function(e){return o("ul",{className:"xendit-instructions-bullet-list",children:e.items.map((e,n)=>o("li",{children:mi(e)},n))})}(e);case"form":return function(e){return s("div",{className:"xendit-instructions-form-card",children:[e.heading?o("h3",{className:"xendit-instructions-form-heading",children:mi(e.heading)}):null,e.fields.map((e,n)=>s("div",{className:"xendit-instructions-form-field",children:[o("div",{className:"xendit-instructions-form-field-label",children:mi(e.label)}),o("div",{className:"xendit-instructions-form-field-value",children:mi(e.value)})]},n))]})}(e);case"table":return function(e){return s("table",{className:"xendit-instructions-table",children:[o("thead",{children:o("tr",{children:e.headers.map((e,n)=>o("th",{className:"xendit-instructions-table-header",children:mi(e)},n))})}),o("tbody",{children:e.rows.map((e,n)=>o("tr",{children:e.map((e,n)=>o("td",{className:"xendit-instructions-table-cell",children:mi(e)},n))},n))})]})}(e)}return null}function bi(e){const{amount:n,channelLogo:t,currency:i,onAffirm:a,barcodeContent:r,merchantName:l,instructions:c,title:u,t:h}=e,[f,b]=p(!1),y=d(()=>{b(!0),a()},[a]),_=[{heading:h("action_barcode.merchant_name"),value:l},{heading:h("action_barcode.barcode_content"),value:r},{heading:h("action_barcode.amount_to_pay"),value:Sn(n,i)}],g=m(()=>{try{return function(e){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");return E(n,e,si),n}(r)}catch(e){console.log("Error generating barcode SVG:",e);const n=document.createElement("div");return n.innerText=h("action_barcode.unable_to_generate"),n}},[r,h]);return s("div",{className:"xendit-action-present-to-customer",children:[o("img",{src:t,alt:"Channel Logo",className:"xendit-action-barcode-channel-logo"}),o("div",{className:"xendit-action-title",children:u}),o("div",{"data-testid":"barcode",className:"xendit-action-barcode-barcode-container",role:"button",tabIndex:0,ref:e=>{!e||1===e.childNodes.length&&e.firstChild===g||e?.replaceChildren(g)}}),o("div",{className:"xendit-action-barcode-content",children:o("div",{className:"xendit-action-barcode-details",children:_.map((e,n)=>o("div",{className:"xendit-action-barcode-detail-item",children:s("div",{className:"xendit-action-barcode-detail-content",children:[o("div",{className:"xendit-action-barcode-heading xendit-text-12 xendit-text-semibold",children:e.heading}),o("div",{className:"xendit-action-barcode-value xendit-text-semibold",children:e.value})]})},n))})}),s("div",{className:"xendit-action-present-to-customer-affirm",children:[o(Ie,{variant:Pe.WHITE_ROUNDED,disabled:f,onClick:y,className:"xendit-button-block",children:f?o(Re,{}):h("action.payment_made")}),o("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:h("action.payment_confirmation_instructions")})]}),o(li,{instructions:c})]})}class ActionBarcodeBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];Z(e?.type,"PRESENT_TO_CUSTOMER"),X(this.bb.world),X(this.bb.channel);const n={amount:this.bb.world.session.amount,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,onAffirm:this.affirmPayment.bind(this),barcodeContent:e.value,merchantName:this.bb.world.business.name??"",paymentCode:e.value,instructions:e.instructions??[],title:e.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>i(bi,n))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class ActionPaylinkBehavior{bb;actionIndex;el=null;constructor(e,n){this.bb=e,this.actionIndex=n}enter(){X(this.bb.world),X(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");Z(e.type,"REDIRECT_CUSTOMER"),Z(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 yi(e){return e&&e.merchantAccountInformation&&"object"==typeof e.merchantAccountInformation?e.merchantAccountInformation["ID.CO.QRIS.WWW"]?_i:e.merchantAccountInformation.A0000006150001?gi:null:null}function _i(e){const{channelLogo:n,channelName:t,merchantName:i,amountText:a,parsedQr:r,t:l}=e;const d=function(){const e=r?.merchantAccountInformation;if("string"==typeof e)return;const n=e?.["ID.CO.QRIS.WWW"];return"string"!=typeof n&&n?.nmid?`NMID: ${n.nmid}`:void 0}(),c="#DB4849",u="24px";return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:u,paddingRight:u,overflow:"hidden"},children:[o("img",{src:n,alt:l("image_alt.channel_logo",{channelName:t}),style:{height:"64px",alignSelf:"center"}}),s("div",{className:"xendit-text-center xendit-text-16",style:{display:"flex",flexDirection:"column",gap:"4px",marginTop:"16px"},children:[o("div",{className:"xendit-text-semibold",children:i}),d?o("div",{children:d}):null]}),s("div",{style:{position:"relative",margin:`-${u}`,marginBottom:"0",padding:u},children:[s("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:[e.qr,o("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:u},children:a})]}),o("svg",{style:{position:"absolute",top:"-9%",left:0,width:"60%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:o("polygon",{fill:c,points:"0,0 50,50 0,100"})}),o("svg",{style:{position:"absolute",bottom:0,right:0,width:"30%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:o("polygon",{fill:c,points:"0,100 100,100 100,0"})})]})]})}function gi(e){const{merchantName:n,amountText:t}=e,i="#ED3066";return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"40px",overflow:"hidden"},children:[o("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),o("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:t}),o("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px"},children:n}),s("svg",{viewBox:"0 0 180 180",style:{aspectRatio:"1",margin:"32px 14% 24px"},children:[o("rect",{width:"180",height:"180",fill:i,rx:13}),o("rect",{x:"10",y:"10",width:"160",height:"140",fill:"white",rx:4}),o("path",{d:"M0 180 L20 180 L0 160 Z",fill:i}),o("path",{d:"M10 150 L30 150 L10 130 Z",fill:"white"}),o("foreignObject",{x:"40",y:"30",width:"100",height:"100",children:o("div",{style:{"--xendit-qr-foreground-color":i},children:e.qr})}),o("foreignObject",{x:"0",y:"160",height:"10px",width:"180px",style:{overflow:"visible"},children:o("div",{style:{display:"flex",flexDirection:"column",height:"10px"},children:s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"209",height:"19",fill:"none",viewBox:"0 0 209 19",style:{width:"auto"},children:[o("title",{children:"Malaysia National QR"}),o("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 xi(e,n){const t=A.create(e),i=N.render(t,{margin:n.margin}),a=(new DOMParser).parseFromString(i,"image/svg+xml").documentElement;a.style.width="100%",a.style.height="100%",a.setAttribute("width",String(t.modules.size+2*n.margin)),a.setAttribute("height",String(t.modules.size+2*n.margin));const r=a.querySelector("[stroke]");r?.setAttribute("stroke",n.colors[0]);const o=a.querySelector("[fill]");return o?.setAttribute("fill",n.colors[1]),a}function vi(){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 wi(e){return e.split("").map(e=>/[a-zA-Z0-9]/.test(e)?e.toLowerCase():"-").join("").replace(/-+/g,"-")}function ki(e){const{amount:n,businessName:t,channelName:i,channelLogo:a,currency:r,onAffirm:c,qrString:h,parsedQr:f,t:b}=e,[y,_]=p(!1),g=d(()=>{_(!0),c()},[c]),x=m(()=>{try{return xi(h,Ci)}catch(e){console.log("Error generating QR code SVG:",e);const n=document.createElement("div");return n.innerText=b("action_qr.unable_to_generate"),n}},[h,b]),v=u(!1),w=d(e=>{if(e instanceof PointerEvent&&"touch"!==e.pointerType)return;if(v.current)return;e.currentTarget.animate?.([{transform:"scale(1)"},{transform:"scale(0.95)"},{transform:"scale(1)"}],{duration:150,easing:"ease-in-out"});const a=xi(h,Ei),o=[wi(t),wi(i),wi(r),wi(String(n)),wi(vi())].join("-");v.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),i=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(i),r=new Image;return r.src=a,new Promise((e,t)=>{r.onload=function(){let i=r.naturalWidth,o=r.naturalHeight;if(0!==i)for(;i<256;)i*=2,o*=2;document.body.appendChild(r);const s=document.createElement("canvas");s.width=i,s.height=o;const l=s.getContext("2d");if(!l)return t(new Error("Failed to get canvas context"));l.drawImage(r,0,0,i,o),URL.revokeObjectURL(a);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(a),t(new Error("Failed to generate image"))}})}(a,`${o}.png`).catch(e=>{console.error("Error downloading QR code:",e)})},[n,t,i,r,h]);if(e.hideUi)return o("div",{"data-testid":"qr-code",ref:e=>{!e||1===e.childNodes.length&&e.firstChild===x||e?.replaceChildren(x)}});const k=o("div",{"data-testid":"qr-code",className:"xendit-action-qr-qrcode-container",role:"button",tabIndex:0,onClick:w,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),w(e))},ref:e=>{!e||1===e.childNodes.length&&e.firstChild===x||e?.replaceChildren(x)}}),C=s("div",{className:"xendit-action-present-to-customer-affirm",children:[o(Ie,{variant:Pe.WHITE_ROUNDED,disabled:y,onClick:g,className:"xendit-button-block",children:y?o(Re,{}):b("action.payment_made")}),o("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:b("action.payment_confirmation_instructions")})]}),E=Sn(n,r),A=yi(f);return A?s(l,{children:[o(A,{channelLogo:a,channelName:i,merchantName:t,amountText:E,parsedQr:f,qr:k,t:b}),o("div",{style:{padding:"48px",paddingTop:"8px",paddingBottom:"24px"},children:C})]}):s("div",{className:"xendit-action-present-to-customer",children:[o("img",{src:a,alt:b("image_alt.channel_logo",{channelName:i}),className:"xendit-action-qr-channel-logo"}),s("div",{className:"xendit-action-qr-content",children:[o("div",{className:"xendit-text-16 xendit-text-center xendit-qr-merchant-info",children:o("div",{className:"xendit-text-semibold",children:t})}),k,o("div",{className:"xendit-text-16 xendit-text-semibold xendit-text-center",children:E})]}),C]})}const Ci={margin:0,colors:["var(--xendit-qr-foreground-color)","var(--xendit-qr-background-color)"]},Ei={margin:2,colors:["#000","#FFF"]},Ai={"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"}}}},Ni={"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 Pi(e){return/^[\uD800-\uDBFF]$/.test(e)}function Si(e){const n=new Set,t=[];for(;e.length;){const i=e.substring(0,2);if(!/^\d{2}$/.test(i))throw new Error("Invalid EMVCo QR string, invalid tag");if(n.has(i))throw new Error(`Duplicate tag ${i} in EMVCo QR string`);n.add(i);const a=e.substring(2,4);if(!/^\d{2}$/.test(a))throw new Error("Invalid EMVCo QR string, invalid length");const r=parseInt(a,10);if(!r)throw new Error(`Invalid EMVCo QR string, expected length but got ${a}`);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,Pi(n)?l+=.5:l+=1}t.push({key:i,value:o}),e=e.substring(4+s)}return t}function Ii(e,n,t,i){e[`field${t}`]=i;const a=n[t];if(!a)return;const r="template"===a.type&&a.templateClass?Ri(a.templateClass,i).result:i;e[a.name]=r}function Ri(e,n){const t=Si(n),i={};for(const{key:n,value:a}of t)Ii(i,e,n,a);return{result:i,raw:t}}function Ti(e,n,t){const i=Si(t),a=i.find(({key:e})=>"00"===e)?.value;if(!a)throw new Error(`Missing field 00 in merchant account information template for field ${n}`);const r=Ni[a];return r&&(e[a]=Ri(r,t).result),e}class ActionQrBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];Z(e?.type,"PRESENT_TO_CUSTOMER"),X(this.bb.world),X(this.bb.channel),X(this.bb.world.paymentEntity);let n=null;try{n=function(e){const{result:n,raw:t}=Ri(Ai,e);n.merchantAccountInformation={};for(const e of t){const t=Number(e.key);t>=26&&t<=51&&Ti(n.merchantAccountInformation,e.key,e.value)}return n}(e.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;n={merchantAccountInformation:{[e]:{globallyUniqueIdentifier:e}}}}const t=function(e){return null!==yi(e)}(n),a=this.bb.sdk[S].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"===a?.getAttribute("data-qr-code-only")||!1,onAffirm:this.affirmPayment.bind(this),qrString:e.value,parsedQr:n,title:e.action_subtitle,t:this.bb.sdk.t.bind(this.bb.sdk)},o=t?Xt.QrWithCustomArt:Xt.Generic;this.cleanupFn=this.ensureHasActionContainer(o),this.populateActionContainer(()=>i(ki,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 qi=n({fire:()=>{},clear:()=>{},text:""}),Di=({children:e})=>{const[n,t]=p(""),i=d(e=>{t(e);const n=setTimeout(()=>{t("")},2e3);return()=>clearTimeout(n)},[]),a=d(()=>{t("")},[]);return o(qi.Provider,{value:{text:n,fire:i,clear:a},children:o("div",{style:{position:"relative"},children:e})})},Mi=()=>{const{text:e,clear:n}=c(qi);return h(()=>{if(e){const e=()=>{n()};return document.body.addEventListener("mousedown",e),()=>{document.body.removeEventListener("mousedown",e)}}},[n,e]),e?o("div",{className:"xendit-tooltip",children:e}):null};function Li(e){const{amount:n,channelLogo:t,currency:i,onAffirm:a,vaNumber:r,merchantName:l,instructions:c,title:u,t:h}=e,[m,f]=p(!1),b=d(()=>{f(!0),a()},[a]),y=[{heading:h("action_va.merchant_name"),value:l},{heading:h("action_va.virtual_account_number"),value:r,enableCopy:!0},{heading:h("action_va.amount_to_pay"),value:Sn(n,i),enableCopy:!0}];return s("div",{className:"xendit-action-present-to-customer",children:[o("img",{src:t,alt:"Channel Logo",className:"xendit-action-qr-channel-logo"}),o("div",{className:"xendit-action-title",children:u}),o("div",{className:"xendit-action-va-content",children:o("div",{className:"xendit-action-va-details",children:y.map((e,n)=>s("div",{className:"xendit-action-va-detail-item",children:[s("div",{className:"xendit-action-va-detail-content",children:[o("div",{className:"xendit-action-va-heading xendit-text-12 xendit-text-semibold",children:e.heading}),o("div",{className:"xendit-action-va-value xendit-text-semibold",children:e.value})]}),e.enableCopy?s(Di,{children:[o(Oi,{value:e.value,t:h}),o(Mi,{})]}):null]},n))})}),s("div",{className:"xendit-action-present-to-customer-affirm",children:[o(Ie,{variant:Pe.WHITE_ROUNDED,disabled:m,onClick:b,className:"xendit-button-block",children:m?o(Re,{}):h("action.payment_made")}),o("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:h("action.payment_confirmation_instructions")})]}),o(li,{instructions:c})]})}const Oi=({value:e,t:n})=>{const{fire:t}=c(qi);return s(Ie,{variant:Pe.WHITE_ROUNDED,size:Se.SM,onClick:()=>{navigator.clipboard.writeText(e),t(n("action_va.copied_to_clipboard"))},children:[n("action_va.copy"),o(R,{name:"copy",size:16})]})};class ActionVaBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];Z(e?.type,"PRESENT_TO_CUSTOMER"),X(this.bb.world),X(this.bb.channel);const n={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:e.value,merchantName:this.bb.world.business.name??"",instructions:e.instructions??[],title:e.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>i(Li,n))}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=ge(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=ne(300,n.signal).then(()=>{if(this.bb.mock){const n=xe(e).cipherText;try{return JSON.parse(atob(n))}catch{}return{schemes:["VISA"],country_codes:["ID"],require_billing_information:!1}}{const t=xe(e).withoutValidationError;return Rt(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(!ee(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,i){this.sdkKey=e,this.sdk=n,this.sessionTokenRequestId=t,this.onPollResult=i}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 i=e;for(let e=1;e<n;e++)i*=t,await J(i),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 J(Y),e=this.sdk.nextMockUpdate,this.sdk.nextMockUpdate=null}else try{e=await It(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=Zt(e.payment_token):e.payment_request&&(n=Zt(e.payment_request)),this.onPollResult(e,n),await J(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(X(this.bb.world?.paymentEntity),this.bb.world?.paymentEntity.entity.status){case"ACTIVE":case"AUTHORIZED":case"SUCCEEDED":case"PENDING":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(ei(this.bb.world,this.bb.channel,"SUCCESS")));break;case"FAILED":case"CANCELED":case"EXPIRED":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(ei(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(X(this.bb.world),X(this.bb.channel),Ne(this.bb.channel.form,"credit_card_number")){if(e=ge(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(!xe(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,i,a,r){if(r)return ne(Y,a).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 Tt(e,{channel_code:t,channel_properties:i?{card_number:i}:void 0},e.sessionAuthKey,null,a)}(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(!ee(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 Ui(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(),X(this.bb.world?.session);const e=this.bb.world.paymentEntity;"COMPLETED"!==this.bb.world.session.status&&e&&Ui(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,i,a){return n?(await ne(Y,a),ii(t.channel_code,t._mock_action_type)):await St(e,{channel_code:t.channel_code},{sessionAuthKey:e.sessionAuthKey,paymentRequestId:i},void 0,a)}(this.bb.sdkKey,this.bb.mock,this.bb.channel,e,n.signal).then(()=>{this.bb.mock&&this.bb.world&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(ei(this.bb.world,this.bb.channel,"SUCCESS"))),this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}).catch(e=>{ee(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,X(this.bb.world?.session);const e=this.bb.sdk.t,n=this.bb.world.paymentEntity;let t,i,a;var r;"COMPLETED"!==this.bb.world.session.status&&"PENDING"!==this.bb.world.session.status&&n&&Ui(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?(i=this.submissionError.text,a={type:"ERROR",code:this.submissionError.code}):(i=function(e){return[e("default_error.title"),e("default_error.message_1"),e("default_error.message_2")]}(e),a={type:"NETWORK_ERROR",code:"NETWORK_ERROR"})):t=this.submission?"REQUEST_ABORTED":"ACTION_ABORTED":(t=`PAYMENT_${n.type}_${n.entity.status}`,i=function(e,n,t,i){const a=e(Jt(n,t,"title")),r=i?e(function(e){return`failure_code.${e.toLowerCase()}`}(i),e("failure_code_unknown",{failureCode:i})):e(Jt(n,t,"subtext"));return[a,r]}(e,n.type,n.entity.status,n.entity.failure_code),a={type:"FAILURE",code:n.entity.failure_code??"UNKNOWN"}),this.bb.dispatchEvent(new XenditSubmissionEndEvent(t,i,a)),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,i=this.bb.channel._mock_action_type,a=this.bb.channelProperties??{},r=new AbortController,o=async function(e,n,t,i,a,r,o,s){let l;if(n)switch(t){case"PAY":await ne(Y,o.signal),l=ii(i,a);break;case"SAVE":case"SUBSCRIPTION":await ne(Y,o.signal),l=function(e,n){return"PENDING"===n?{payment_token_id:`pt-${pe()}`,status:"PENDING",channel_code:e,actions:ai(n),session_token_request_id:pe()}:n?{payment_token_id:`pt-${pe()}`,status:"REQUIRES_ACTION",channel_code:e,actions:ai(n),session_token_request_id:pe()}:{payment_token_id:`pt-${pe()}`,status:"ACTIVE",channel_code:e,actions:[],session_token_request_id:pe()}}(i,a);break;default:throw new Error(`The session type ${t} is not supported.`)}else switch(t){case"PAY":l=await Pt(e,{session_id:e.sessionAuthKey,channel_code:i,channel_properties:r,save_payment_method:s},null,null,o.signal);break;case"SAVE":case"SUBSCRIPTION":l=await Nt(e,{session_id:e.sessionAuthKey,channel_code:i,channel_properties:r},null,null,o.signal);break;default:throw new Error(`The session type ${t} is not supported.`)}return Zt(l)}(this.bb.sdkKey,this.bb.mock,n,t,i,a,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=>{ee(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 Bi(e){switch(e.sdkStatus){case"LOADING":return qt(SdkLoadingBehavior);case"ACTIVE":return qt(SdkActiveBehavior,"active",function(e){switch(X(e.world?.session),e.world.session.status){case"ACTIVE":return qt(SessionActiveBehavior,"active",e.submissionRequested?function(e){return X(e.world),qt(SubmissionBehavior,"submission",e.world.paymentEntity&&null!==e.world.sessionTokenRequestId?function(e){function n(){return X(e.world?.paymentEntity),ie(e.sdk,e.world.paymentEntity.entity.actions)?function(e){X(e.world?.paymentEntity);const n=ie(e.sdk,e.world.paymentEntity.entity.actions);X(n);const t=e.world.paymentEntity.entity.actions.indexOf(n);return qt(ActionPaylinkBehavior,String(t))}(e):void 0}if(X(e.world?.paymentEntity),e.hackyOvoActionLatch&&"PENDING"===e.world.paymentEntity.entity.status)return qt(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[qt(ActionEmptyListPushNotificationBehavior,""),n()]);switch(e.world.paymentEntity.entity.status){case"PENDING":return qt(PaymentEntityPendingBehavior);case"REQUIRES_ACTION":return qt(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[Vi(e),n()]);case"FAILED":case"EXPIRED":case"CANCELED":return qt(PaymentEntityFailedBehavior);case"ACCEPTING_PAYMENTS":throw new Error("Status ACCEPTING_PAYMENTS should not happen");case"AUTHORIZED":case"ACTIVE":case"SUCCEEDED":return qt(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,i){t||(t={});for(const a of rt(e,n.form,t,i))if(On(a,t))return!1;return!0}(e.world.session.session_type,e.channel,e.channelProperties,e.channelData),t=qt(n?ChannelValidBehavior:ChannelInvalidBehavior),i=Ne(e.channel.form,"credit_card_number")?qt(CardInfoBehavior,e.channel.channel_code):void 0,a=Ne(e.channel.form,"installment_plan")?qt(PaymentOptionsBehavior,e.channel.channel_code):void 0;return[t,i,a]}(e));case"COMPLETED":return qt(SessionCompletedBehavior);case"EXPIRED":case"CANCELED":return qt(SessionFailedBehavior,e.world.session.status);case"PENDING":return qt(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 qt(SdkFatalErrorBehavior);default:throw e.sdkStatus,new Error(`Unknown SDK status: ${e.sdkStatus}`)}}function Vi(e){if(X(e.world?.paymentEntity),e.actionCompleted)return qt(ActionCompletedBehavior);const n=te(e.world.paymentEntity.entity.actions);if(!n)return qt(ActionEmptyListPushNotificationBehavior,"");const t=e.world.paymentEntity.entity.actions.indexOf(n),i=!!ie(e.sdk,e.world.paymentEntity.entity.actions);let a;switch(e.simulatePaymentRequested&&fe(n)&&(a=qt(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)?qt(ActionIframeBehavior,n.value):i?qt(ActionDeepLinkBehavior,String(t)):qt(ActionRedirectBehavior,n.value);case"DEEPLINK_URL":return qt(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 qt(ActionQrBehavior,String(t),a);case"PAYMENT_CODE":return qt(ActionBarcodeBehavior,String(t),a);case"VIRTUAL_ACCOUNT_NUMBER":return qt(ActionVaBehavior,String(t),a)}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 Wi=e=>{const{onReady:n,options:t}=e,i=G(),a=i.t,r=K(),s=(()=>{const e=c(M);if(null===e)throw new Error("useBusiness must be used within a XenditSessionProvider");return e})(),l=$(),p=l?.google_pay;X(p);const f=u(!1),b=u(null),y=u(null),_=m(()=>p.allowed_payment_methods.map(e=>e.payment_method_specification),[p.allowed_payment_methods]),g=m(()=>({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:_,emailRequired:!0,merchantInfo:{merchantId:p.merchant_id,merchantName:s.name??""},transactionInfo:{transactionId:r.payment_session_id,totalPriceStatus:"FINAL",totalPrice:String(r.amount),currencyCode:r.currency}}),[s.name,p.merchant_id,_,r.amount,r.currency,r.payment_session_id]),x=m(()=>({buttonColor:"default",buttonType:"plain",buttonRadius:999,buttonSizeMode:"fill",buttonBorderType:"no_border",...t}),[t]);h(()=>{const e=window.google?.payments?.api?.PaymentsClient;e?y.current=new e({environment:i.isMock()?"TEST":"PRODUCTION"}):console.error("XenditComponents: Google Pay button was requested but the Google Pay SDK is not loaded.")},[i]);const v=d(()=>{X(y.current),y.current.loadPaymentData(g).then(function(e){const n=function(e){X(p);const n=i.getActiveChannels();for(const t of p.allowed_payment_methods)if(t.payment_method_specification.type===e.paymentMethodData.type)return Ki(n,t.channel_code);throw new Error(`No matching channel found for selected Google Pay payment method ${e.paymentMethodData.type}`)}(e);X(n);let t={};"CARDS"===n.channelCode&&(t={google_pay:JSON.stringify(e)}),i.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 r={code:`GOOGLE_PAY_${n}`,text:[a(t(n,"title"),a("google_pay_errors.unknown_error.title")),a(t(n,"message"),a("google_pay_errors.unknown_error.message",{statusCode:n}))]},o=p.allowed_payment_methods[0];X(o);const s=Ki(i.getActiveChannels(),o.channel_code);i.submitDigitalWallet("GOOGLE_PAY",s,{},r)})},[p,g,i,a]);return h(()=>{y.current&&(f.current||y.current.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:_}).then(function(e){e.result&&(f.current||(f.current=!0,n()))}).catch(function(e){console.error("XenditComponents: Error when checking if Google Pay is ready",e)}))},[_,n]),h(()=>{if(!y.current)return;const e=y.current.createButton({...x,buttonLocale:r.locale,allowedPaymentMethods:_,onClick:v});b.current&&b.current.replaceChildren(e)},[x,_,v,r.locale]),o("div",{ref:b})};function Ki(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 Fi=e=>{const{scriptTagRegex:n,checkLoaded:t,children:i}=e,[,a]=p({}),r=t();return h(()=>{if(r)return;const e=Array.from(document.scripts).find(e=>n.test(e.src));if(e){const n=()=>{a({})};return e.addEventListener("load",n),()=>{e.removeEventListener("load",n)}}},[a,r,n]),h(()=>{if(!r){const e=setTimeout(()=>{a({})},1e3);return()=>clearTimeout(e)}}),r?i:null},$i=e=>{const{digitalWalletCode:n,digitalWalletOptions:t}=e,i=u(null),a=d(()=>{i.current?.parentElement?.style.setProperty("display","block")},[]);let r=null;if("GOOGLE_PAY"===n)r=o(Fi,{scriptTagRegex:Gi.GOOGLE_PAY.scriptTagRegex,checkLoaded:Gi.GOOGLE_PAY.checkLoaded,children:o(Wi,{onReady:a,options:t})});return o("div",{ref:i,children:r})},Gi={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.")};[S];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]!==ae&&null===oe(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[S]={sdkKey:n,options:e,worldState:null,liveComponents:{channelPicker:null,paymentChannels:new Map,actionContainer:null,digitalWalletContainer:new Map},behaviorTree:new BehaviorTree(Bi,{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},Ee(this),this.addEventListener("fatal-error",e=>{const n=e;this[S].eventListenersPresent.get("fatal-error")||console.error(`XenditComponents: A "fatal-error" event occurred but no event listener was attached: ${n.message}`)}),this[S].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 At(this[S].sdkKey,this[S].sdkKey.sessionAuthKey),e.channels=e.channels.filter(e=>Ae[e.channel_code])}catch(e){return this[S].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[S].behaviorTree.bb.sdkFatalErrorMessage=be(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[S].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[S].sdkKey.hostId}supportsSimulationScenarios(){return this.isMock()||"pd"===this[S].sdkKey.hostId||"sd"===this[S].sdkKey.hostId}findChannel(e){this.assertInitialized();return this[S].worldState.channels.find(n=>n.channel_code===e)??null}onUpdateWorldState(e){const n=e.data;this[S].worldState=se(this[S].worldState??{},n);const t=this[S].worldState.session.locale;this.t=function(e){const n=qn[e];return function(...t){let i,a,r={};switch(t.length){case 1:i=t[0];break;case 2:"string"==typeof t[1]?(i=t[0],a=t[1]):(i=t[0],r=t[1]);break;case 3:i=t[0],a=t[1],r=t[2];break;default:throw new Error("Invalid arguments for t function")}let o=n?.[i];return void 0===o&&void 0!==a&&(o=a),o?o.replace(/\{\{(\w+)\}\}/g,(e,n)=>r[n]?String(r[n]):""):(console.warn(`Missing localization for key: ${i} in locale: ${e}`),i)}}(t),this.behaviorTreeUpdate(),this.rerenderAllComponents()}onUpdateChannelComponentData(e){const n=e.channelCode,t=e.data,i=this[S].liveComponents.paymentChannels.get(n);i&&(i.data=se(i.data,t),this.behaviorTreeUpdate(),this.rerenderAllComponents())}behaviorTreeUpdate(){const e=this[S].behaviorTree.bb;if("LOADING"===e.sdkStatus&&this[S].worldState&&(e.sdkStatus="ACTIVE"),e.world=this[S].worldState,this[S].currentDigitalWalletSubmission)e.channel=this.findChannel(this[S].currentDigitalWalletSubmission.channelCode),e.channelProperties=this[S].currentDigitalWalletSubmission.channelProperties,e.channelData=null,e.channelIsDigitalWallet=!0,e.instantSubmissionError=this[S].currentDigitalWalletSubmission.instantSubmissionError;else{const n=this[S].currentChannelCode?this[S].liveComponents.paymentChannels.get(this[S].currentChannelCode):null;e.channel=n?ke(n.channel[S],n.data.savePaymentMethod):null,e.channelProperties=n?n.channelProperties:null,e.channelData=n?n.data:null,e.channelIsDigitalWallet=!1}try{this[S].behaviorTree.update()}catch(e){this[S].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[S].behaviorTree.bb.sdkFatalErrorMessage=be(e),this[S].behaviorTree.update()}}getSdkStatus(){return this[S].behaviorTree.bb.sdkStatus}rerenderAllComponents(){this.renderChannelPicker();for(const e of this[S].liveComponents.paymentChannels.keys())this.renderPaymentChannel(e);for(const e of this[S].liveComponents.digitalWalletContainer.keys())this.renderDigitalWalletComponent(e)}getSession(){return this.assertInitialized(),Oe(this[S].worldState.session)}getCustomer(){return this.assertInitialized(),this[S].worldState.customer?(Z((e=this[S].worldState.customer).type,"INDIVIDUAL"),X(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 i=We(n),a=Fe(e,t);return n.filter(e=>a[e.id]?.length).map(e=>Ue(e,a,i,t))}(this[S].worldState.channels,this[S].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[S].worldState.session,pairChannels:$e(this[S].worldState.channels)})}getActiveChannels(e){return this.assertInitialized(),function(e,n,t){const i=We(n),a=Fe(e,t);return e.filter(e=>Ke(e,t)).map(e=>Ve(e,a,i,t))}(this[S].worldState.channels,this[S].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[S].worldState.session,pairChannels:$e(this[S].worldState.channels)})}createChannelPickerComponent(){this[S].liveComponents.channelPicker&&this.destroyComponent(this[S].liveComponents.channelPicker);const e=document.createElement("xendit-channel-picker");return e.setAttribute("translate","no"),this[S].liveComponents.channelPicker=e,this[S].worldState&&this.renderChannelPicker(),this.setupUiEventsForChannelPicker(e),e}renderChannelPicker(){this.assertInitialized();const e=this[S].liveComponents.channelPicker;e&&t(i(H,{data:this[S].worldState,sdk:this,children:i(Xe,{})}),e)}setupUiEventsForChannelPicker(e){e.addEventListener(XenditClearCurrentChannelEvent.type,e=>{this.assertInitialized();const n=e,t=this[S].currentChannelCode;if(!t)return;const i=this[S].worldState.channels.find(e=>e.channel_code===t);i&&i.ui_group===n.uiGroup&&this.setCurrentChannel(null)})}createChannelComponent(e,n=!0){if(this.assertInitialized(),!Ce(this[S].worldState.session,e[S][0]))throw new Error("Cannot create channel component: `session.amount` is outside of the channel's min/max amount.");const t=e[S][0].channel_code;n&&(this[S].currentChannelCode=t);const i=this[S].liveComponents.paymentChannels.get(t),a=r();let o;return i?o=i.element:(o=document.createElement("xendit-payment-channel"),o.setAttribute("data-channel-code",t),o.setAttribute("inert",""),o.setAttribute("translate","no"),o.style.setProperty("--xendit-channel-brand-color",e[S][0].brand_color),this.setupUiEventsForPaymentChannel(o),this[S].liveComponents.paymentChannels.set(t,{element:o,channel:e,channelProperties:null,channelFormRef:a,data:{savePaymentMethod:!1,cardDetails:null,paymentOptions:null}})),this.renderPaymentChannel(t),n&&(this.behaviorTreeUpdate(),this.syncInertAttribute()),this.dispatchEvent(new InternalNeedsRerenderEvent),o}renderPaymentChannel(e){this.assertInitialized();const n=this[S].liveComponents.paymentChannels.get(e);if(!n)return;const a=n.channel;t(i(H,{data:this[S].worldState,sdk:this,children:i(vt,{channelOrPair:a[S],channelData:n.data,savePaymentMethod:n.data.savePaymentMethod,formRef:n.channelFormRef})}),n.element)}getActiveDigitalWallets(){return this.assertInitialized(),this[S].worldState.digitalWallets?function(e,n,t,i){const a=[],r=We(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 X(t),t}),o=Fe(t,i);a.push({digitalWalletCode:"GOOGLE_PAY",get channels(){return t.map(e=>Ve(e,o,r,i))},[S]:!0})}return a}(this[S].worldState.digitalWallets,this[S].worldState.channels,this[S].worldState.channelUiGroups,{options:{filterMinMax:!1},pairChannels:$e(this[S].worldState.channels),session:this[S].worldState.session}):[]}createDigitalWalletComponent(e,n){this.assertInitialized();const t=this[S].liveComponents.digitalWalletContainer.get(e);t&&this.destroyComponent(t.element);const i=document.createElement("xendit-digital-wallet");return i.setAttribute("translate","no"),i.style.setProperty("display","none"),this[S].liveComponents.digitalWalletContainer.set(e,{element:i,options:n}),this.renderDigitalWalletComponent(e),i}renderDigitalWalletComponent(e){this.assertInitialized();const n=this[S].liveComponents.digitalWalletContainer.get(e);n&&t(i(H,{data:this[S].worldState,sdk:this,children:i($i,{digitalWalletCode:e,digitalWalletOptions:n.options})}),n.element)}getCurrentChannel(){const e=this[S].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[S].currentChannelCode,t=e?.[S][0].channel_code??null;if(n!==t){if(this[S].currentChannelCode=t,e&&t){(this[S].liveComponents.paymentChannels.get(t)??null)||this.createChannelComponent(e,!1)}this.behaviorTreeUpdate(),this.syncInertAttribute(),this.renderChannelPicker()}}syncInertAttribute(){const e=this[S].behaviorTree.bb.submissionRequested,n=this[S].liveComponents.paymentChannels;for(const[t,i]of n){(Array.isArray(i.channel.channelCode)?i.channel.channelCode[0]:i.channel.channelCode)!==this[S].currentChannelCode||e?i.element.setAttribute("inert",""):i.element.hasAttribute("inert")&&i.element.removeAttribute("inert")}}setupUiEventsForPaymentChannel(e){e.addEventListener(XenditChannelPropertiesChangedEvent.type,e=>{const n=e,t=n.channel,i=this[S].liveComponents.paymentChannels.get(t);i&&(i.channelProperties=n.channelProperties,this.behaviorTreeUpdate())})}showValidationErrors(){if(!this[S].behaviorTree.findBehavior(ChannelInvalidBehavior))return;const e=this[S].currentChannelCode;if(!e)return;const n=this[S].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===S,t=n?void 0:e,i=this[S].behaviorTree.findBehavior(PaymentEntityRequiresActionBehavior);if(!n&&i&&!i.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[S].liveComponents.actionContainer&&this.destroyComponent(this[S].liveComponents.actionContainer);const a=document.createElement("xendit-action-container");return a.setAttribute("translate","no"),t?.qrCode&&void 0!==t.qrCode.qrCodeOnly&&a.setAttribute("data-qr-code-only",t.qrCode.qrCodeOnly.toString()),this[S].liveComponents.actionContainer=a,a}destroyComponent(e){if(!e.tagName.startsWith("XENDIT-"))throw new Error("Unable to destroy component; only elements created by this SDK can be destroyed.");if(this[S].liveComponents.channelPicker===e)return this[S].liveComponents.channelPicker=null,t(null,e),void e.remove();for(const[n,i]of this[S].liveComponents.paymentChannels)if(i.element===e)return this[S].liveComponents.paymentChannels.delete(n),this[S].currentChannelCode===n&&this.setCurrentChannel(null),t(null,e),void e.remove();if(this[S].liveComponents.actionContainer===e)return this[S].liveComponents.actionContainer=null,t(null,e),void e.remove();for(const[n,i]of this[S].liveComponents.digitalWalletContainer)if(i.element===e)return this[S].liveComponents.digitalWalletContainer.delete(n),t(null,e),void e.remove();throw new Error("Unable to destroy component; component not found. It may have already been destroyed.")}submit(){this.assertInitialized();if(!this[S].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[S].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[S].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[S].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[S].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[S].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}submitDigitalWallet(e,n,t,i=null){this.assertInitialized(),this.setCurrentChannel(null),this[S].currentDigitalWalletSubmission={digitalWalletCode:e,channelCode:n[S][0].channel_code,channelProperties:t,instantSubmissionError:i},this.addEventListener(XenditSubmissionEndEvent.type,()=>{this[S].currentDigitalWalletSubmission=null},{once:!0}),this[S].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}abortSubmission(){this.assertInitialized();this[S].behaviorTree.findBehavior(SubmissionBehavior)&&(this[S].behaviorTree.bb.submissionRequested=!1,this.behaviorTreeUpdate())}simulatePayment(){if(this.assertInitialized(),"PAY"!==this[S].worldState.session.session_type)throw new Error('Unable to simulate payment, the session type is not "PAY".');if(!this[S].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[S].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=te(e.entity.actions);if(!n||!fe(n))throw new Error("Unable to simulate payment; the action does not support simulation.");this[S].behaviorTree.bb.simulatePaymentRequested=!0,this.behaviorTreeUpdate()}pollImmediately(){if(this.assertInitialized(),"ACTIVE"!==this[S].worldState.session.status)throw new Error("Unable to poll immediately; the session is not longer active.");this[S].behaviorTree.bb.pollImmediatelyRequested=!0,this.behaviorTreeUpdate()}getState(){const e=this[S].currentChannelCode,n=this[S].liveComponents.paymentChannels.get(e??"");return{channelCode:e,channelProperties:n?.channelProperties||null,behaviorTree:this[S].behaviorTree}}addEventListener(e,n,t){return this[S].eventListenersPresent.set(e,!0),super.addEventListener(e,n,t)}removeEventListener(e,n,t){return super.removeEventListener(e,n,t)}static amountFormat(e,n){return Sn(e,n)}}class XenditComponentsTest extends XenditComponents{nextMockUpdate=null;constructor(e){super({...e,componentsSdkKey:`session-${he(32)}-mock-MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCADI5pdf6KmN8+Fxl2ES3yolUKXunNeY3gGScGNEvDcrcHAPKxIInAo5DVnDvTtYtqZvx/bu7HLeBJNMXwHhie/uyNEtT8dSaLc9bd0WSlYdxI+iUsTv2Qu0LiiPrZs-NKf7whM9meUs/eRCvG0oc180MDiyeli3kH6EQ3ZahECHsZQi5G2IpH6vk3cYMtf01Y1L4OBn1SZCOv1kwpjIUet4DJeoTwwq2nM5b+K7rD+/WFTi3AEX4NWJNkKi0a91`}),this.addEventListener(InternalScheduleMockUpdateEvent.type,this.setNextMockUpdate.bind(this))}async initializeAsync(){await J(Y);const e=(await import("./test-data.mjs")).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||(P||(P=!0,e.debounceRendering=e=>queueMicrotask(e)),function(){const e=document.createElement("style");e.textContent="/* variables */\n:root {\n --xendit-font-family: sans-serif;\n --xendit-color-primary: #1762ee;\n --xendit-color-text: #252525;\n --xendit-color-text-secondary: #585858;\n --xendit-color-text-placeholder: #7d7d7d;\n --xendit-color-disabled: #f7f7f7;\n --xendit-color-danger: #d1414d;\n --xendit-color-border: #f3f3f3;\n --xendit-color-background: #ffffff;\n --xendit-focus-shadow: 0px 0px 0px 2px\n color-mix(in srgb, var(--xendit-color-primary) 15%, transparent);\n --xendit-card-shadow: 0px 4px 8px 0px #25252514;\n --xendit-dialog-shadow: 8px 8px 12px 8px #25252529;\n --xendit-animation-duration: 0.3s;\n --xendit-animation-ease: ease-in-out;\n --xendit-radius-1: 8px;\n --xendit-z-index-focus: 2;\n --xendit-z-index-overlay: 3;\n\n /* Browser-specific border collapse margins */\n --xendit-border-collapse-offset: -0.5px; /* Default for Chrome/Edge */\n --xendit-border-collapse-webkit-gecko: -1.5px; /* Fix Safari and Firefox subpixel rendering */\n\n /* QR code colors */\n --xendit-qr-foreground-color: #000000;\n --xendit-qr-background-color: #ffffff;\n\n /* icon colors */\n --xendit-color-icon-primary: #7c7c7c;\n --xendit-color-icon-secondary: #f1f1f1;\n}\n\n/* Set default font for root components */\nxendit-channel-picker,\nxendit-action-container,\nxendit-payment-channel {\n display: block;\n unicode-bidi: isolate;\n font-family: var(--xendit-font-family);\n color: var(--xendit-color-text);\n touch-action: manipulation;\n}\n\n.xendit-default-action-container {\n font-family: var(--xendit-font-family);\n touch-action: manipulation;\n}\n\nxendit-action-container {\n position: relative;\n flex: 1; /* Action container usually wants to stretch to fit, assuming the parent is a flexbox. */\n touch-action: manipulation;\n}\n\nxendit-payment-channel button,\nxendit-payment-channel textarea,\nxendit-payment-channel select,\nxendit-payment-channel input,\nxendit-payment-channel input::placeholder {\n font-family: inherit;\n}\n\nxendit-payment-channel input::placeholder,\nxendit-payment-channel textarea::placeholder,\nxendit-payment-channel select::placeholder {\n color: var(--xendit-color-text-placeholder);\n}\n\n/* Reusable typography classes */\n.xendit-text-12 {\n font-size: 12px;\n line-height: 16px;\n letter-spacing: -0.01px;\n}\n\n.xendit-text-14 {\n font-size: 14px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-16 {\n font-size: 16px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-18 {\n font-size: 18px;\n line-height: 24px;\n letter-spacing: -0.26px;\n}\n\n.xendit-text-20 {\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -0.33px;\n}\n\n.xendit-text-12,\n.xendit-text-14,\n.xendit-text-16 {\n font-weight: 400;\n}\n\n.xendit-text-semibold {\n font-weight: 600;\n}\n\n.xendit-text-bold {\n font-weight: 700;\n}\n\n.xendit-text-link {\n color: var(--xendit-color-primary);\n}\n.xendit-text-secondary {\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-text-center {\n text-align: center;\n}\n\n.xendit-dotted-line {\n height: 1px;\n border: none;\n background: repeating-linear-gradient(\n to right,\n var(--xendit-color-border) 0px 4px,\n transparent 4px 8px\n );\n margin: 0;\n}\n\n/* Accordion component */\n\n.xendit-accordion {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n background: var(--xendit-color-background);\n}\n\n.xendit-accordion-item:not(:first-child) {\n border-top: 1px solid var(--xendit-color-border);\n border-top-left-radius: var(--xendit-radius-1);\n border-top-right-radius: var(--xendit-radius-1);\n}\n\n.xendit-accordion-item-header {\n display: grid;\n grid-template-columns: auto 1fr auto;\n grid-gap: 16px;\n align-items: center;\n cursor: pointer;\n padding: 24px 16px;\n color: var(--xendit-color-text);\n border-radius: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.xendit-accordion-item-header-title {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header-title,\n.xendit-accordion-item-disabled .xendit-accordion-item-header-icon {\n opacity: 0.5;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-header {\n color: var(--xendit-color-primary);\n}\n\n.xendit-accordion-item-chevron {\n color: var(--xendit-color-text);\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-chevron {\n display: none;\n}\n\n.xendit-accordion-item-chevron g {\n transition: transform var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item-header:focus-visible {\n border-radius: 8px;\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n}\n\n.xendit-accordion-item-content {\n overflow: hidden;\n transition: height var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item.xendit-accordion-item-closed\n .xendit-accordion-item-content {\n height: 0;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-content {\n height: calc-size(auto, size);\n}\n\n.xendit-accordion-item-padding {\n padding: 16px;\n}\n\n/* Channel picker digital wallet section */\n\n.xendit-channel-picker-digital-wallet-section {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n gap: 8px;\n margin-bottom: 8px;\n}\n\n/* Channel picker group */\n\n.xendit-channel-picker-group {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-picker-group select {\n border: 1px solid var(--xendit-color-border);\n border-radius: 8px;\n padding: 12px;\n appearance: none;\n outline: none;\n}\n\n.xendit-channel-picker-group select:focus {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-channel-logo {\n width: 24px;\n height: 16px;\n margin: -5px 0;\n padding: 4px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n object-fit: contain;\n}\n\n/* Payment channel */\n\nxendit-payment-channel[inert] {\n filter: opacity(0.5) grayscale(1);\n}\n\n.xendit-payment-channel {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-payment-channel-banner {\n width: 100%;\n height: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 12px;\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-payment-channel-instructions-logo {\n height: 40px;\n width: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions-text {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 4px;\n}\n\n.xendit-payment-channel-instructions-text p {\n margin: 0;\n}\n\n/* Forms */\n\n.xendit-channel-form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-form > form {\n display: contents;\n}\n\n.xendit-form-field-group {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.xendit-channel-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group {\n display: grid;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group-label-container {\n display: flex;\n justify-content: space-between;\n gap: 16px;\n}\n\n.xendit-channel-form-field-group label {\n width: fit-content;\n cursor: pointer;\n}\n\n.xendit-form-field-group.invalid\n .xendit-channel-form-field\n .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-danger);\n}\n\n.xendit-channel-form-field .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-border);\n background: var(--xendit-color-background);\n border-radius: 8px;\n appearance: none;\n}\n\n.xendit-channel-form-field.field-radius-tl-0 .xendit-form-field-inner {\n border-top-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-tr-0 .xendit-form-field-inner {\n border-top-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-bl-0 .xendit-form-field-inner {\n border-bottom-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-br-0 .xendit-form-field-inner {\n border-bottom-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-collapse-l,\n.xendit-channel-form-field.field-collapse-l {\n margin-left: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-r,\n.xendit-channel-form-field.field-collapse-r {\n margin-right: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: calc(var(--xendit-border-collapse-offset) * 2);\n width: calc(100% + abs(var(--xendit-border-collapse-offset) * 2));\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container {\n margin-right: 0;\n}\n\n.xendit-channel-form-field.field-collapse-t .xendit-form-field-inner {\n margin-top: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-b .xendit-form-field-inner {\n margin-bottom: var(--xendit-border-collapse-offset);\n}\n\n/* Safari and Firefox specific adjustments */\n@supports (font: -apple-system-body) or (-moz-appearance: none) {\n .xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: 0;\n width: 100%;\n }\n\n .xendit-channel-form-field.field-collapse-b input,\n .xendit-channel-form-field.field-collapse-b button {\n margin-bottom: var(--xendit-border-collapse-webkit-gecko);\n height: calc(100% + abs(var(--xendit-border-collapse-webkit-gecko) * 2));\n }\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container:focus {\n border-right: none;\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container:focus {\n border-left: none;\n}\n\n.xendit-card-brand-logo {\n width: 24px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n padding: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n}\n\n.xendit-card-brands-list {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n gap: 4px;\n}\n\n.xendit-channel-form-field .xendit-form-field-inner:focus,\n.xendit-channel-form-field .xendit-form-field-inner.xendit-field-focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-channel-form-field button.xendit-dropdown-open {\n z-index: var(--xendit-z-index-focus);\n}\n\n.xendit-channel-form-field input.xendit-form-field-inner {\n padding: 12px;\n}\n\n.xendit-channel-form-field .xendit-iframe-container {\n display: flex;\n height: 40px;\n width: 100%;\n padding: 0;\n overflow: hidden;\n box-sizing: border-box;\n}\n\n.xendit-channel-form-field .xendit-iframe-container iframe {\n height: 40px;\n width: 100%;\n border: none;\n min-width: 0;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-1 {\n grid-column: span 1;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-2 {\n grid-column: span 2;\n}\n\n.xendit-checkbox {\n display: flex;\n align-items: center;\n}\n\n.xendit-checkbox-box {\n display: flex;\n}\n\n.xendit-checkbox input {\n width: 16px;\n height: 16px;\n margin: 0;\n cursor: pointer;\n}\n\n.xendit-checkbox label {\n cursor: pointer;\n padding-left: 8px;\n}\n\n.xendit-checkbox input {\n opacity: 0;\n position: absolute;\n}\n\n.xendit-checkbox input + .xendit-checkbox-graphic {\n width: 16px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n box-sizing: border-box;\n color: transparent;\n}\n\n.xendit-checkbox input:checked + .xendit-checkbox-graphic {\n color: var(--xendit-color-background);\n background-color: var(--xendit-color-primary);\n border-color: var(--xendit-color-primary);\n}\n\n.xendit-checkbox input:focus + .xendit-checkbox-graphic {\n border: 1px solid var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n/* Dialog */\n\n.xendit-dialog-backdrop {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n padding: 48px;\n justify-content: center;\n align-items: center;\n}\n\n.xendit-dialog {\n position: relative;\n}\n\n.xendit-dialog-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: var(--xendit-color-text);\n padding: 16px;\n gap: 16px;\n line-height: 20px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dialog-header button {\n display: flex;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-floating-close {\n 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\n/* qr actions */\n.xendit-action-qr-content {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n max-width: 384px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n overflow: hidden;\n}\n.xendit-qr-merchant-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n.xendit-action-qr-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-qr-qrcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n}\n\n/* barcode actions */\n.xendit-action-barcode-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-barcode-barcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n justify-content: center;\n}\n\n/* va actions */\n.xendit-action-va-content,\n.xendit-action-barcode-content {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n padding-bottom: 24px;\n}\n.xendit-action-va-details,\n.xendit-action-barcode-details {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-va-detail-item,\n.xendit-action-barcode-detail-item {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.xendit-action-va-detail-content,\n.xendit-action-barcode-detail-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.xendit-action-va-heading,\n.xendit-action-barcode-heading {\n color: var(--xendit-color-text-placeholder);\n}\n.xendit-action-va-tag {\n color: var(--xendit-color-text-placeholder);\n background-color: #fafafa;\n padding: 2px 4px;\n border-radius: 4px;\n}\n\n/* redirect, deeplink, and push notification actions */\n.xendit-redirect-instructions {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n gap: 24px;\n}\n\n.xendit-redirect-instructions-logo {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 112px;\n height: 112px;\n border: 2px solid var(--xendit-color-border);\n border-radius: 50%;\n overflow: hidden;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-logo img {\n width: 96px;\n height: 96px;\n object-fit: contain;\n}\n\n.xendit-redirect-instructions-text {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-redirect-instructions-button {\n display: inline-block;\n border-radius: 99px;\n color: white;\n padding: 12px 16px;\n background-color: var(--xendit-channel-brand-color, #000);\n text-decoration: none;\n white-space: nowrap;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-button:hover,\n.xendit-redirect-instructions-button:active {\n filter: brightness(1.1);\n}\n\n/* googlepay */\n\n.gpay-card-info-container-fill {\n display: flex;\n}\n";const n=document.querySelector("style, link");n?n.insertAdjacentElement("beforebegin",e):document.head.appendChild(e)}());export{XenditActionBeginEvent,XenditActionEndEvent,XenditComponents,XenditComponentsTest,XenditFatalErrorEvent,XenditInitEvent,XenditNotReadyEvent,XenditPaymentRequestCreatedEvent,XenditPaymentRequestDiscardedEvent,XenditPaymentTokenCreatedEvent,XenditPaymentTokenDiscardedEvent,XenditReadyEvent,XenditSessionCompleteEvent,XenditSessionExpiredOrCanceledEvent,XenditSessionNotPendingEvent,XenditSessionPendingEvent,XenditSubmissionBeginEvent,XenditSubmissionEndEvent,XenditWillRedirectEvent,pe as a,he as r};
2
+ import"preact/debug";import"preact/devtools";import{options as e,createContext as n,render as t,createElement as a,Fragment as i,createRef as r}from"preact";import{jsx as o,jsxs as s,Fragment as l}from"preact/jsx-runtime";import{useCallback as d,useContext as c,useRef as u,useLayoutEffect as h,useState as p,useMemo as m,useImperativeHandle as _,useEffect as f}from"preact/hooks";import b from"classnames";import y,{getCountries as g,getExampleNumber as v}from"libphonenumber-js";import x,{getCountryCallingCode as w}from"libphonenumber-js/min";import k from"libphonenumber-js/mobile/examples";import{forwardRef as C,useState as E,useImperativeHandle as N}from"preact/compat";import A from"jsbarcode";import I from"qrcode";import S from"qrcode/lib/renderer/svg-tag.js";let P=!1;class XenditInitEvent extends Event{static type="init";constructor(){super(XenditInitEvent.type,{})}}class XenditFatalErrorEvent extends Event{message;static type="fatal-error";constructor(e){super(XenditFatalErrorEvent.type,{}),this.message=e}}class XenditReadyEvent extends Event{channelCode;static type="submission-ready";constructor(e){super(XenditReadyEvent.type,{}),this.channelCode=e}}class XenditNotReadyEvent extends Event{static type="submission-not-ready";constructor(){super(XenditNotReadyEvent.type,{})}}class XenditSubmissionBeginEvent extends Event{static type="submission-begin";constructor(){super(XenditSubmissionBeginEvent.type,{})}}class XenditSubmissionEndEvent extends Event{reason;userErrorMessage;developerErrorMessage;static type="submission-end";constructor(e,n,t){super(XenditSubmissionEndEvent.type,{}),this.reason=e,this.userErrorMessage=n,this.developerErrorMessage=t}}class XenditActionBeginEvent extends Event{static type="action-begin";constructor(){super(XenditActionBeginEvent.type,{})}}class XenditActionEndEvent extends Event{static type="action-end";constructor(){super(XenditActionEndEvent.type,{})}}class XenditWillRedirectEvent extends Event{static type="will-redirect";constructor(){super(XenditWillRedirectEvent.type,{})}}class XenditSessionCompleteEvent extends Event{succeededChannel;static type="session-complete";constructor(e){super(XenditSessionCompleteEvent.type,{}),this.succeededChannel=e}}class XenditSessionExpiredOrCanceledEvent extends Event{static type="session-expired-or-canceled";constructor(){super(XenditSessionExpiredOrCanceledEvent.type,{})}}class XenditSessionPendingEvent extends Event{static type="session-pending";constructor(){super(XenditSessionPendingEvent.type,{})}}class XenditSessionNotPendingEvent extends Event{static type="session-not-pending";constructor(){super(XenditSessionNotPendingEvent.type,{})}}class XenditPaymentRequestCreatedEvent extends Event{paymentRequestId;static type="payment-request-created";constructor(e){super(XenditPaymentRequestCreatedEvent.type,{}),this.paymentRequestId=e}}class XenditPaymentTokenCreatedEvent extends Event{paymentTokenId;static type="payment-token-created";constructor(e){super(XenditPaymentTokenCreatedEvent.type,{}),this.paymentTokenId=e}}class XenditPaymentRequestDiscardedEvent extends Event{paymentRequestId;static type="payment-request-discarded";constructor(e){super(XenditPaymentRequestDiscardedEvent.type,{}),this.paymentRequestId=e}}class XenditPaymentTokenDiscardedEvent extends Event{paymentTokenId;static type="payment-token-discarded";constructor(e){super(XenditPaymentTokenDiscardedEvent.type,{}),this.paymentTokenId=e}}const T=Symbol("xendit-internal"),R=e=>o("div",{class:"xendit-accordion",children:e.children}),D=e=>{const{name:n,size:t,direction:a}=e;let i,r;switch(a){case"right":i="rotate(180 12 12)";break;case"up":i="rotate(90 12 12)";break;case"down":i="rotate(-90 12 12)";break;default:i="rotate(0 12 12)"}switch(n){case"chevron":r=o("path",{d:"M15 19.5L7.5 12L15 4.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"});break;case"check":r=q(o("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":r=s(l,{children:[o("path",{d:"M18.75 5.25L5.25 18.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M18.75 18.75L5.25 5.25",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]});break;case"card":r=q(o("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":r=q(s(l,{children:[o("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"}),o("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":r=q(s(l,{children:[o("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"}),o("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":r=q(o("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":r=q(o("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":r=q(s(l,{children:[o("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"}),o("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"}),o("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":r=q(s(l,{children:[o("path",{d:"M6 9.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M6 7.5H10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o("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"}),o("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":r=q(o("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 ${n} does not exist`)}return o("svg",{className:`xendit-icon ${e.className??""}`,width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"none",children:o("g",{transform:i,children:r})})};function q(e,n){return o("g",{transform:`scale(${1/n} ${1/n})`,children:e})}const B=e=>{const{id:n,title:t,iconName:a,subtitle:i,disabled:r,open:l,onClick:c,children:u}=e,h=l?"up":"down",p=d(()=>{r||c(n)},[r,c,n]),m=d(e=>{"Enter"!==e.key&&" "!==e.key||(p(),e.preventDefault())},[p]),_=d(()=>{p()},[p]);return s("div",{className:b("xendit-accordion-item",r?"xendit-accordion-item-disabled":"",l?"xendit-accordion-item-open":"xendit-accordion-item-closed"),children:[s("div",{className:"xendit-accordion-item-header",onClick:_,onKeyDown:m,role:"button",tabIndex:r?-1:0,children:[o(D,{className:"xendit-accordion-item-header-icon",name:a,size:24}),s("div",{className:"xendit-accordion-item-header-title xendit-text-16 xendit-text-bold",children:[t,i?o("div",{className:"xendit-accordion-item-header-subtitle xendit-text-14",children:i}):null]}),o(D,{className:"xendit-accordion-item-chevron",name:"chevron",size:24,direction:h})]}),o("div",{className:"xendit-accordion-item-content",inert:!l,children:o("div",{className:"xendit-accordion-item-padding",children:u})})]})},L=n(null);L.displayName="SessionContext";const M=n(null);M.displayName="BusinessContext";const O=n(void 0);O.displayName="CustomerContext";const U=n(null);U.displayName="ChannelsContext";const K=n(null);K.displayName="ChannelUiGroupsContext";const V=n(null);V.displayName="DigitalWalletsContext";const F=n(null);F.displayName="SdkContext";const W=n(null);W.displayName="CurrentChannelContext";const G=()=>{const e=c(L);if(null===e)throw new Error("useSession must be used within a XenditSessionProvider");return e},z=()=>{const e=c(U);if(null===e)throw new Error("useChannels must be used within a XenditSessionProvider");return e},X=()=>c(V),H=()=>{const e=c(F);if(null===e)throw new Error("useSdk must be used within a XenditSessionProvider");return e},$=()=>c(W),Y=({children:e,data:n,sdk:t})=>{const{session:a,business:i,customer:r,channels:s,digitalWallets:l,channelUiGroups:d}=n,c=t.getCurrentChannel()?.[T]?.[0]??null;return"ACTIVE"!==t.getSdkStatus()||"ACTIVE"!==a.status?null:o(F.Provider,{value:t,children:o(W.Provider,{value:c,children:o(L.Provider,{value:a,children:o(M.Provider,{value:i,children:o(O.Provider,{value:r,children:o(U.Provider,{value:s,children:o(V.Provider,{value:l,children:o(K.Provider,{value:d,children:e})})})})})})})})},j=300;function Q(e){if(!e)throw new Error("Assertion failed: argument is null or undefined; this is a bug, please contact support.")}function Z(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 ee(e,n){if(e!==n)throw new Error("Assertion failed; this is a bug, please contact support.")}function ne(e){return new Promise(n=>setTimeout(n,1*e))}class AbortError extends Error{constructor(){super("AbortError"),this.name="AbortError"}}function te(e){return e instanceof AbortError&&"AbortError"===e.name}function ae(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 ie(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 re(e,n){if(e[T].options.enablePaylinks)return n.find(e=>"REDIRECT_CUSTOMER"===e.type&&"WEB_GOOGLE_PAYLINK"===e.descriptor)}const oe="mock",se={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 le(e){return se[e]??null}function de(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 ce(e){const n=u();return h(()=>{n.current=e}),n.current}function ue(e){let n;if("string"==typeof e.channel_property)n=e.channel_property;else{n=Object.values(e.channel_property).join("__")}return n}const he=Math.floor(255*Math.random());function pe(e){return`xendit-id-${ue(e).split("").map(e=>(e.charCodeAt(0)%256^he).toString(16)).join("")}`}function me(e){Q(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 _e(){return[me(8),me(4),me(4),me(4),me(12)].join("-")}function fe(){return`xendit-id-${u(me(12)).current}`}function be(e){return"PRESENT_TO_CUSTOMER"===e.type}function ye(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 ge(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 ve(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 xe(e){const n=ve("card_details.card_number",e);return"string"!=typeof n?null:n}function we(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 ke=new WeakMap;let Ce=1;function Ee(e,n){return Q(e.length>0),Q(e.length<=2),2===e.length?n?(Q(!0===e[1].allow_save),e[1]):(Q(!1===e[0].allow_save),e[0]):e[0]}function Ne(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 Ae(e){Object.defineProperty(e,T,{enumerable:!1,writable:!1,configurable:!1,value:e[T]})}const Ie={AFFIN_FPX:!0,AFFIN_FPX_BUSINESS:!0,AGRO_FPX:!0,AGRO_FPX_BUSINESS:!0,ALIPAY:!0,ALLIANCE_FPX:!0,ALLIANCE_FPX_BUSINESS:!0,AMBANK_FPX:!0,AMBANK_FPX_BUSINESS:!0,APPOTA:!0,ASTRAPAY:!0,BAY_CARD_INSTALLMENT:!0,BAY_GBW_DIRECT_DEBIT:!0,BAY_GBW_MOBILE_BANKING:!0,BBL_CARD_INSTALLMENT:!0,BBL_DIRECT_DEBIT:!0,BBL_GBW_DIRECT_DEBIT:!0,BBL_GBW_MOBILE_BANKING:!0,BBL_MOBILE_BANKING:!0,BDO_DIRECT_DEBIT:!0,BDO_EPAY:!0,BDO_ONLINE_BANKING:!0,BNP_FPX_BUSINESS:!0,BOC_FPX:!0,BOC_ONLINE_BANKING:!0,BPI_DIRECT_DEBIT:!0,BPI_ONLINE_BANKING:!0,BPI_RECURRING:!0,BRI_DIRECT_DEBIT:!0,BSN_FPX:!0,CARDS:!0,CHINABANK_DIRECT_DEBIT:!0,CHINABANK_ONLINE_BANKING:!0,CIMB_DIRECT_DEBIT:!0,CIMB_FPX:!0,CIMB_FPX_BUSINESS:!0,CITIBANK_FPX_BUSINESS:!0,DANA:!0,DEUTSCHE_FPX_BUSINESS:!0,DUITNOW_PAY:!0,GCASH:!0,GCASH_LINK_AND_PAY:!0,GOPAY:!0,GOPAY_RECURRING:!0,GRABPAY:!0,HLB_FPX:!0,HLB_FPX_BUSINESS:!0,HSBC_FPX:!0,HSBC_FPX_BUSINESS:!0,INSTAPAY_ONLINE_BANKING:!0,ISLAM_FPX:!0,ISLAM_FPX_BUSINESS:!0,JENIUSPAY:!0,KBANK_CARD_INSTALLMENT:!0,KBANK_GBW_MOBILE_BANKING:!0,KBANK_MOBILE_BANKING:!0,KFH_FPX:!0,KFH_FPX_BUSINESS:!0,KRUNGSRI_DIRECT_DEBIT:!0,KRUNGSRI_MOBILE_BANKING:!0,KTB_CARD_INSTALLMENT:!0,KTB_DIRECT_DEBIT:!0,KTB_GBW_DIRECT_DEBIT:!0,KTB_GBW_MOBILE_BANKING:!0,KTB_MOBILE_BANKING:!0,LANDBANK_ONLINE_BANKING:!0,LINEPAY:!0,LINKAJA:!0,MANDIRI_DIRECT_DEBIT:!0,MAYB2E_FPX:!0,MAYB2E_FPX_BUSINESS:!0,MAYB2U_FPX:!0,MAYBANK_ONLINE_BANKING:!0,METROBANK_ONLINE_BANKING:!0,MOMO:!0,MUAMALAT_FPX:!0,MUAMALAT_FPX_BUSINESS:!0,NEXCASH:!0,OCBC_FPX:!0,OCBC_FPX_BUSINESS:!0,OVO:!0,PAYMAYA:!0,PESONET_ONLINE_BANKING:!0,PNB_ONLINE_BANKING:!0,PROMPTPAY:!0,PSBANK_ONLINE_BANKING:!0,PUBLIC_FPX:!0,PUBLIC_FPX_BUSINESS:!0,QR_PH:!0,QRIS:!0,RAKYAT_FPX:!0,RAKYAT_FPX_BUSINESS:!0,RCBC_DIRECT_DEBIT:!0,RCBC_ONLINE_BANKING:!0,RHB_FPX:!0,RHB_FPX_BUSINESS:!0,ROBINSONS_BANK_ONLINE_BANKING:!0,SCB_CARD_INSTALLMENT:!0,SCB_DIRECT_DEBIT:!0,SCB_GBW_DIRECT_DEBIT:!0,SCB_GBW_MOBILE_BANKING:!0,SCB_MOBILE_BANKING:!0,SCH_FPX:!0,SCH_FPX_BUSINESS:!0,SECURITY_BANK_ONLINE_BANKING:!0,SGQR:!0,SHOPEEPAY:!0,TOUCHNGO:!0,TRUEMONEY:!0,TTB_CARD_INSTALLMENT:!0,UBP_DIRECT_DEBIT:!0,UBP_EADA:!0,UNIONBANK_ONLINE_BANKING:!0,UOB_FPX:!0,UOB_FPX_BUSINESS:!0,VIETTELPAY:!0,VNPTWALLET:!0,WECHATPAY:!0,ZALOPAY:!0};function Se(e,n){for(const t of e)if(t.type.name===n)return!0;return!1}var Pe,Te;!function(e){e.BARE="bare",e.PRIMARY_ROUNDED="primary-rounded",e.WHITE_ROUNDED="white-rounded"}(Pe||(Pe={})),function(e){e.SM="sm",e.MD="md"}(Te||(Te={}));const Re=e=>{const{children:n,variant:t,size:a,type:i="button",...r}=e,s={[Pe.BARE]:void 0,[Pe.PRIMARY_ROUNDED]:"xendit-button-primary-rounded",[Pe.WHITE_ROUNDED]:"xendit-button-white-rounded"}[t],l={[Te.SM]:"xendit-button-sm",[Te.MD]:void 0}[a??Te.MD];return o("button",{...r,className:b(e.className,"xendit-button",s,l),type:i,children:n})},De=()=>{const e=.4*Math.PI,n=.4,t=Math.cos(e)*n,a=Math.sin(e)*n,i=Math.cos(0)*n,r=Math.sin(0)*n;return o("svg",{className:"xendit-button-loading-spinner",viewBox:"-0.5 -0.5 1 1",children:o("path",{d:`M ${t} ${a} A 0.4 0.4 0 0 0 ${i} ${r}`,fill:"none",stroke:"currentColor",strokeWidth:"0.1",strokeLinecap:"round"})})},qe=e=>{const{id:n,options:t,onChange:a,defaultIndex:i=-1,selectedIndex:r,placeholder:l,disabled:c,className:_,fixedOverlayWidth:f,enableSearch:b}=e,y=H().t,g=fe(),v=n||g,x="number"==typeof r,[w,k]=p(i),C=x?r:w,[E,N]=p(C>=0?C:0),[A,I]=p(!1),S=A&&!c&&t.length>0,[P,T]=p(""),[R,q]=p(0),B=u(null),L=u(null),M=u(null),O=u(null),U=u(null),K=u(null),V=m(()=>{const e=t.map(Oe).filter(({item:e})=>{if(""===P.trim())return!0;const n=P.toLowerCase();return e.title.toLowerCase().includes(n)||e.description?.toLowerCase().includes(n)||e.value.toLowerCase().includes(n)});return e.length>0?e:t.map(Oe)},[P,t]),F=Math.max(0,Math.min(V.length-1,E));h(()=>{if(f)return void q(f);const e=B.current;if(!e)return;const n=e.getBoundingClientRect().width;if(q(n),!window.ResizeObserver)return;const t=new ResizeObserver(n=>{for(const t of n)t.target===e&&t.borderBoxSize?.length&&q(t.borderBoxSize[0].inlineSize)});return t.observe(e),()=>t.disconnect()},[f]),h(()=>{if(!S)return;const e=K.current;if(!e)return;const n=B.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)}},[S]),h(()=>{if(!S)return;const e=e=>{const n=L.current;n&&(n.contains(e.target)||I(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[S]),h(()=>{if(!S)return;const e=e=>{const n=L.current;n&&e.relatedTarget&&(n.contains(e.relatedTarget)||I(!1))};return document.body.addEventListener("focusout",e),()=>document.body.removeEventListener("focusout",e)},[S]),h(()=>{S&&C>=0&&N(C)},[S,C]),h(()=>{if(!S)return;if(!O.current)return;if(!M.current)return;const e=M.current.parentElement;e&&(e.scrollTop=O.current.offsetTop-e.clientHeight/2+O.current.clientHeight/2)},[S,E]);const W=d(()=>{S||(I(!0),queueMicrotask(()=>U.current?.focus()))},[S]),G=d(()=>{S&&(I(!1),T(""),B.current?.focus())},[S]),z=d(()=>{S?G():W()},[G,S,W]),X=d(e=>{const n=t[e];n&&(n.disabled||(x||k(e),a(n,e),G()))},[G,x,a,t]),$=d(e=>{const n=e.target===U.current;if("Escape"===e.key)return e.preventDefault(),void G();if("Enter"===e.key||" "===e.key){if(n&&" "===e.key)return;e.preventDefault();const t=V[F];return void(t&&X(t.originalIndex))}return"ArrowDown"===e.key?(e.preventDefault(),void N(e=>Math.min(V.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),void N(e=>Math.max(0,e-1))):"Home"===e.key?(e.preventDefault(),void N(0)):"End"===e.key?(e.preventDefault(),void N(V.length-1)):void 0},[F,G,X,V]),Y=d(e=>{if(S)return $(e);"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),W())},[$,S,W]),j=d(e=>{e.stopPropagation(),e.preventDefault(),X(Number(e.currentTarget.dataset.index))},[X]),Q=d(e=>{T(e.currentTarget.value),N(0)},[]),Z=C>=0?t[C]:void 0;return s("div",{className:"xendit-dropdown-container",ref:L,style:{"--xendit-dropdown-width":R+"px",minWidth:e.noOverflow?void 0:"0"},children:[s("button",{id:v,ref:B,type:"button",className:`xendit-dropdown ${_} ${S?"xendit-dropdown-open":""} ${Le(Z)?"xendit-dropdown-has-asset":""}`,"aria-expanded":S?"true":"false",onClick:z,onKeyDown:Y,disabled:c,children:[Z?.leadingAsset??null,o("span",Z?{className:"xendit-dropdown-text xendit-text-14",children:Z.shortTitle??Z.title}:{className:"xendit-dropdown-text xendit-text-14",children:l}),o(D,{className:"xendit-dropdown-chevron",name:"chevron",size:16,direction:"down"})]}),S?s("div",{className:"xendit-dropdown-overlay",style:{width:"var(--xendit-dropdown-width)"},ref:K,children:[b?o("div",{className:"xendit-dropdown-search",children:o("input",{ref:U,placeholder:y("combobox.default_search_placeholder"),value:P,onInput:Q,onClick:Me,onKeyDown:$})}):null,o("ul",{ref:M,role:"listbox",tabIndex:-1,onKeyDown:$,children:V.map(({item:e,originalIndex:n},t)=>{const a=n===C,i=t===F;return o("li",{role:"option","data-index":n,"aria-disabled":!!e.disabled||void 0,"aria-selected":a,onClick:j,ref:i?O:void 0,children:s("div",{className:`xendit-dropdown-item xendit-text-14 ${i?"xendit-dropdown-item-active":""} ${e.leadingAsset?"xendit-dropdown-has-asset":""} ${e.disabled?"xendit-dropdown-item-disabled":""}`,children:[e.leadingAssetInOverlay??e.leadingAsset??null,s("div",{className:"xendit-dropdown-item-text xendit-text-14",children:[o("span",{className:"xendit-dropdown-item-title",children:e.title}),e.description&&o("span",{className:"xendit-dropdown-item-description xendit-text-12",children:e.description})]}),a?o(D,{name:"check",size:16,className:"xendit-dropdown-item-selected"}):null]})},n)})})]}):null]})},Be=e=>o("div",{className:"xendit-dropdown-container xendit-skeleton-field",children:o("button",{className:`xendit-dropdown ${e.className}`,inert:!0,id:e.id,disabled:!0,type:"button",children:o(De,{})})});function Le(e){return!!e&&!(!e.leadingAssetInOverlay&&!e.leadingAsset)}function Me(e){e.stopPropagation()}function Oe(e,n){return{item:e,originalIndex:n}}function Ue(e){return function(e,n){if(e===n)throw new Error("Assertion failed; this is a bug, please contact support.")}(e.session_type,"AUTHORIZATION"),ee(e.mode,"COMPONENTS"),ge({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=>ge({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 Ke(e,n,t,a){const i=ge({groupId:e.id,label:e.label,get channels(){return(n[e.id]||[]).map(e=>Fe(e,n,t,a))},[T]:e});return Ae(i),i}function Ve(e,n){return Fe(e,{},{},n)}function Fe(e,n,t,a){Q(!a.pairChannels.paired[e.channel_code]);const i=ge({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 Ke(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})),[T]:a.pairChannels.pairs[e.channel_code]??[e]});return Ae(i),i}function We(e){const n={};for(const t of e)n[t.id]=t;return n}function Ge(e,n){if(n.pairChannels.paired[e.channel_code])return!1;if(n.options.filterMinMax&&!Ne(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 ze(e,n){const t={};for(const a of e){if(!Ge(a,n))continue;const e=a.ui_group;t[e]||(t[e]=[]),t[e].push(a)}return t}function Xe(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 He=e=>o("hr",{className:"xendit-dotted-line"}),$e=e=>{const{group:n,open:t}=e,a=H(),{t:i}=a,r=G(),l=z(),c=$(),_=r.session_type,f=fe(),[b,y]=p(null),g=u(null),[v,x]=p(!1),w=u(null),k=m(()=>Xe(l),[l]),C=m(()=>({pairChannels:k,session:{amount:r.amount,session_type:r.session_type},options:{filterMinMax:!1}}),[k,r.amount,r.session_type]),E=m(()=>l.filter(e=>Ge(e,C)&&e.ui_group===n.id),[l,n.id,C]);h(()=>{if(!g.current)return;if(!c)return;if(!t)return;E.find(e=>e.channel_code===c.channel_code)&&(w.current=a.createChannelComponent(Ve(c,C)),w.current.parentElement!==g.current&&(x(!0),g.current.replaceChildren(w.current)))},[E,c,C,t,a]);const N=ce(t);h(()=>{if(t&&!N&&null===c&&null!==b){const e=E.find(e=>e.channel_code===b);e&&a.setCurrentChannel(Ve(e,C))}},[E,c,b,C,t,N,a]);const A=d(e=>{const n=l.find(n=>n.channel_code===e.value)||null;y(n?.channel_code??null),a.setCurrentChannel(n?Ve(n,C):null)},[l,C,a]),I=m(()=>E.map(e=>({leadingAsset:o("img",{className:"xendit-dropdown-channel-logo",src:e.brand_logo_url},e.channel_code),leadingAssetInOverlay:o("img",{className:"xendit-channel-logo",src:e.brand_logo_url},e.channel_code),title:e.brand_name,value:e.channel_code,disabled:!Ne(r,e),description:Ye(i,r,e)||void 0})),[E,r,i]),S=1===E.length&&"CARDS"===E[0].channel_code;return s("div",{className:"xendit-channel-picker-group",children:[S?null:s("div",{className:"xendit-channel-form-field-group",children:[o("label",{htmlFor:f,className:"xendit-text-14",children:"SAVE"===_?i("payment_methods.add_payment_method",{groupName:n.label??"",ns:"session"}):i("payment_methods.pay_with")}),o(qe,{id:f,selectedIndex:function(){const e=I.findIndex(e=>e.value===c?.channel_code);if(-1!==e)return e;const n=I.findIndex(e=>e.value===b);return-1!==n?n:1===I.length?0:-1}(),options:I,disabled:I.length<=1,onChange:A,placeholder:i("payment_methods.select_channel_placeholder",{groupName:n.label,ns:"session"})})]}),!S&&v?o(He,{}):null,o("div",{style:{display:v?"":"none"},ref:g})]})};function Ye(e,n,t){return Ne(n,t)?null:t.min_amount&&n.amount<t.min_amount?e("payment_methods.channel_disabled_amount_too_small"):e("payment_methods.channel_disabled_amount_too_large")}const je=e=>{const{onReady:n,options:t}=e,a=H(),i=a.t,r=G(),s=(()=>{const e=c(M);if(null===e)throw new Error("useBusiness must be used within a XenditSessionProvider");return e})(),l=z(),p=X(),_=p?.google_pay;Q(_);const f=u(!1),b=u(null),y=u(null),g=m(()=>_.allowed_payment_methods.filter(e=>{const n=l.find(n=>n.channel_code===e.channel_code);if(!n)throw new Error("Channel found in Google Pay config not found in channels list");return Ne(r,n)}).map(e=>e.payment_method_specification),[_.allowed_payment_methods]),v=m(()=>({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:g,emailRequired:!0,merchantInfo:{merchantId:_.merchant_id,merchantName:s.name??""},transactionInfo:{transactionId:r.payment_session_id,totalPriceStatus:"FINAL",totalPrice:String(r.amount),currencyCode:r.currency}}),[s.name,_.merchant_id,g,r.amount,r.currency,r.payment_session_id]),x=m(()=>({buttonColor:"default",buttonType:"plain",buttonRadius:999,buttonSizeMode:"fill",buttonBorderType:"no_border",...t}),[t]);h(()=>{const e=window.google?.payments?.api?.PaymentsClient;if(!e)return void console.error("XenditComponents: Google Pay button was requested but the Google Pay SDK is not loaded.");const n=a.isMock()||a.isDevelopmentEnv();y.current=new e({environment:n?"TEST":"PRODUCTION"})},[a]);const w=d(()=>{Q(y.current),y.current.loadPaymentData(v).then(function(e){const n=function(e){Q(_);const n=a.getActiveChannels();for(const t of _.allowed_payment_methods)if(t.payment_method_specification.type===e.paymentMethodData.type)return Qe(n,t.channel_code);throw new Error(`No matching channel found for selected Google Pay payment method ${e.paymentMethodData.type}`)}(e);Q(n);let t={};"CARDS"===n.channelCode&&(t={google_pay:JSON.stringify(e)}),a.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 r={code:`GOOGLE_PAY_${n}`,text:[i(t(n,"title"),i("google_pay_errors.unknown_error.title")),i(t(n,"message"),i("google_pay_errors.unknown_error.message",{statusCode:n}))]},o=_.allowed_payment_methods[0];Q(o);const s=Qe(a.getActiveChannels(),o.channel_code);a.submitDigitalWallet("GOOGLE_PAY",s,{},r)})},[_,v,a,i]);return h(()=>{y.current&&(f.current||0!==g.length&&y.current.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:g}).then(function(e){e.result&&(f.current||(f.current=!0,n()))}).catch(function(e){console.error("XenditComponents: Error when checking if Google Pay is ready",e)}))},[g,n]),h(()=>{if(!y.current)return;if(0===g.length)return;const e=y.current.createButton({...x,buttonLocale:r.locale,allowedPaymentMethods:g,onClick:w});b.current&&b.current.replaceChildren(e)},[x,g,w,r.locale]),o("div",{ref:b})};function Qe(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 Ze=e=>{const{scriptTagRegex:n,checkLoaded:t,children:a}=e,[,i]=p({}),r=t();return h(()=>{if(r)return;const e=Array.from(document.scripts).find(e=>n.test(e.src));if(e){const n=()=>{i({})};return e.addEventListener("load",n),()=>{e.removeEventListener("load",n)}}},[i,r,n]),h(()=>{if(!r){const e=setTimeout(()=>{i({})},1e3);return()=>clearTimeout(e)}}),r?a:null},Je=e=>{const{digitalWalletCode:n,digitalWalletOptions:t}=e,a=u(null),i=d(()=>{a.current&&(a.current.parentElement?.style.setProperty("display","block"),a.current.dispatchEvent(new InternalDigitalWalletReady(n)))},[n]);let r=null;if("GOOGLE_PAY"===n)r=o(Ze,{scriptTagRegex:en.GOOGLE_PAY.scriptTagRegex,checkLoaded:en.GOOGLE_PAY.checkLoaded,children:o(je,{onReady:i,options:t})});return o("div",{ref:a,children:r})},en={GOOGLE_PAY:{scriptTagRegex:/https:\/\/pay.google.com\/.*\/js\/pay.js/,checkLoaded:()=>"undefined"!=typeof google&&void 0!==google.payments}};class InternalDigitalWalletReady extends Event{digitalWalletCode;static type="xendit-internal-digital-wallet-ready";constructor(e){super(InternalDigitalWalletReady.type,{bubbles:!0}),this.digitalWalletCode=e}}const nn=e=>{const n=H(),t=u(null),a=X(),i=a?.google_pay,[r,s]=p(!1);return h(()=>{if(t.current&&i){const e=n.createDigitalWalletComponent("GOOGLE_PAY");return t.current.appendChild(e),()=>{e.remove()}}},[i,n]),h(()=>{t.current&&t.current.addEventListener(InternalDigitalWalletReady.type,e=>{s(!0)})},[]),o("div",{ref:t,className:r?"xendit-channel-picker-digital-wallet-section":void 0})},tn=e=>{const n=H(),t=G(),a=(()=>{const e=c(K);if(null===e)throw new Error("useChannelUiGroups must be used within a XenditSessionProvider");return e})(),i=$(),r=z(),{t:l}=H(),_=m(()=>ze(r,{options:{filterMinMax:!1},pairChannels:Xe(r),session:t}),[r,t]),f=u(null),b=m(()=>Xe(r),[r]),y=m(()=>({pairChannels:b,session:{amount:t.amount,session_type:t.session_type},options:{filterMinMax:!1}}),[b,t.amount,t.session_type]),g=i?.ui_group??null,[v,x]=p(null),w=d(e=>{if(g===e||v===e)g===e&&f.current?.dispatchEvent(new XenditClearCurrentChannelEvent(e)),v===e&&x(null);else{const i=a.find(n=>n.id===e);Q(i);const o=an(t,i,r,l).enabledChannels;if(0===o)return;if(1===o){const t=_[e][0];n.setCurrentChannel(Ve(t,y)),x(null)}else x(e),n.setCurrentChannel(null)}},[a,r,_,y,v,n,g,t,l]);h(()=>{null!==i&&null!==v&&x(null)},[i,v]);const k=n[T].options.enableDigitalWallets??!1;return s("div",{ref:f,children:[k?o(nn,{}):null,o(R,{children:a.filter(e=>(_[e.id]||[]).length>0).map(e=>{const n=null!==g?g===e.id:v===e.id,a=an(t,e,r,l),s=0===a.enabledChannels,d=a.firstDisabledChannelReason;return o(B,{id:e.id,title:e.label,iconName:on(g===e.id?i:null,_[e.id]),subtitle:d??void 0,open:n,disabled:s,onClick:w,children:o($e,{group:e,open:n})},e.id)})})]})};function an(e,n,t,a){let i=null,r=0;for(const o of t)o.ui_group===n.id&&(Ne(e,o)?r++:null===i&&(i=Ye(a,e,o)));return{enabledChannels:r,firstDisabledChannelReason:i}}const rn={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 on(e,n){if(e&&e.pm_type&&rn[e.pm_type])return rn[e.pm_type];for(const e of n)if(e.pm_type&&rn[e.pm_type])return rn[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 sn=({countryCode:e,size:n=16})=>o("div",{style:{width:`${n}px`,height:`${n}px`,borderRadius:"50%",backgroundImage:`url(https://assets.xendit.co/payment-session/flags/circle/${e.toLowerCase()}.svg)`,backgroundSize:"cover",backgroundPosition:"center"}}),ln=e=>{const{field:n,onChange:t}=e,a=pe(n),i=ue(n),[r,l]=p(n.initial_value),c=dn.findIndex(e=>e.value===r),m=u(null);cn(e=>{if(m.current){const n=dn.find(n=>n.value===e);n&&_(n)}});const _=d(e=>{l(e.value),m.current&&(m.current.value=e.value),t()},[t]);return h(()=>{n.initial_value&&(m.current&&(m.current.value=r||""),t())},[]),s("div",{children:[o("input",{type:"hidden",name:i,defaultValue:"",ref:m}),o(qe,{id:a,options:dn,onChange:_,placeholder:n.placeholder,selectedIndex:c,enableSearch:!0,className:"xendit-form-field-inner"})]})},dn=g().map(e=>({title:new Intl.DisplayNames(["en"],{type:"region"}).of(e),value:e,leadingAsset:o(sn,{countryCode:e})})).sort((e,n)=>e.title.localeCompare(n.title));function cn(e){const n=It()?.cardDetails,t=n?.details?.country_codes[0],a=ce(t);h(()=>{t&&t!==a&&e(t)})}const un=e=>{const{field:n,onChange:t}=e,a=pe(n),i=ue(n);if(!function(e){return"dropdown"===e.type.name}(n))throw new Error("DropdownField expects field.type.name to be 'dropdown'");const r=u(null),c=m(()=>n.type.options.map(e=>({title:e.label,description:e.subtitle,value:e.value,leadingAsset:e.icon_url?o("img",{style:{height:"16px",width:"16px",objectFit:"contain"},src:e.icon_url}):null})),[n.type.options]),[_,f]=p(n.initial_value??""),b=d(e=>{r.current&&(r.current.value=e.value),f(e.value),t()},[t]),y=c.findIndex(e=>e.value===_);return h(()=>{n.initial_value&&b(c[y])},[]),s(l,{children:[o(qe,{id:a,placeholder:n.placeholder,options:c,onChange:b,selectedIndex:y,className:"xendit-form-field-inner"}),o("input",{type:"hidden",name:i,defaultValue:"",ref:r})]})};const hn="undefined"!=typeof window&&window.HTMLElement?window.HTMLElement:EventTarget;class XenditFormAssociatedFocusTrap extends hn{static tag="xendit-form-associated-focus-trap";static formAssociated=!0;internals;constructor(){super(),this.internals=this.attachInternals()}}var pn;pn=XenditFormAssociatedFocusTrap,"undefined"!=typeof window&&window.customElements&&customElements.define(pn.tag,pn);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 mn=n(null);Q("https://assets.xendit.co/components/secure-iframe-v0.0.23.html");const _n=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.23.html").origin,fn=({children:e})=>{const n=u(new Map),t={registerIframe:(e,t)=>{t.current&&n.current.set(e,t.current)},unregisterIframe:e=>n.current.delete(e),postMessageToIframe:(e,t)=>{const a=n.current.get(e);a?.contentWindow&&a.contentWindow.postMessage(t,_n)}};return o(mn.Provider,{value:t,children:e})};Q("https://assets.xendit.co/components/secure-iframe-v0.0.23.html");const bn=new URL("https://assets.xendit.co/components/secure-iframe-v0.0.23.html"),yn=bn.toString(),gn=bn.origin,vn=e=>{const{field:n,onChange:t}=e,a=H(),i=pe(n),r=ue(n),l=G(),m=u(null),_=u(null),[f,b]=p(),[y,g]=p(!1),{card:v}=Nt()??{},x=It(),w=x?.cardDetails?.details?.schemes,k=w?.find(e=>v?.brands?.some(n=>n.name===e))??null,C=d(e=>{if(!m.current)return;const a=m.current.contentWindow;if(e.source!==a)return;if(e.origin!==gn)return;const i=e.data;switch(i.type){case"xendit-iframe-ready":b(i.ecdhPublicKey);break;case"xendit-iframe-change":{if(!_.current)return;const e=i.encrypted,n=1,a=e.map(e=>{if(i.empty)return"";const t=["xendit-encrypted",n,f,e.iv,e.value];return!i.valid&&i.validationErrorCodes.length&&t.push("invalid",btoa(i.validationErrorCodes[0].localeKey)),t.join("-")});if(0===a.length)break;_.current.value=a.length>1?JSON.stringify(a):a[0],t?.();break}case"xendit-iframe-focus":g(!0);break;case"xendit-iframe-blur":g(!1),_.current?.value&&_.current?.dispatchEvent(new InternalSetFieldTouchedEvent);break;case"xendit-iframe-failed-init":console.error(`Iframe field for ${n.channel_property} failed to initialize securely`)}},[n.channel_property,f,t]),E=d(()=>{m.current?.contentWindow&&m.current.contentWindow.postMessage({type:"xendit-iframe-focus"},gn)},[]);h(()=>(window.addEventListener("message",C),()=>{window.removeEventListener("message",C)}),[C]);const N=c(mn);h(()=>(N?.registerIframe(r,m),()=>N?.unregisterIframe(r)),[r,N]);const A=new URL(yn);A.searchParams.set("input_type",n.type.name),A.searchParams.set("embedder",window.location.origin),A.searchParams.set("session_id",l.payment_session_id),A.searchParams.set("pk",a[T].sdkKey.publicKey),A.searchParams.set("sig",a[T].sdkKey.signature),a[T].options.iframeFieldAppearance&&A.searchParams.set("appearance",JSON.stringify(a[T].options.iframeFieldAppearance));return s("div",{className:`xendit-iframe-container xendit-form-field-inner ${y?"xendit-field-focus":""}`,children:[o(XenditFormAssociatedFocusTrap.tag,{id:i,onFocus:E,tabIndex:-1}),o("input",{type:"hidden",name:r,defaultValue:"",ref:_}),o("iframe",{src:A.toString(),ref:m,sandbox:"allow-scripts allow-same-origin"}),"credit_card_number"===n.type.name&&v&&o(xn,{cardsBrandList:v.brands,selectedCardBrand:k})]})},xn=({cardsBrandList:e,selectedCardBrand:n})=>{if(!e)return null;const t=e.find(e=>e.name===n)?.logo_url;return o("div",{className:"xendit-card-brands-list",children:n?t&&o("img",{className:"xendit-card-brand-logo",src:t,alt:n}):e.map(({name:e,logo_url:n})=>o("img",{className:"xendit-card-brand-logo",src:n,alt:e},e))})},wn=e=>{const{field:n,onChange:t}=e,a=pe(n),i=ue(n),r=G(),l=u(null),c=m(()=>function(e,n){const t={country:n,localNumber:""};if(!e)return t;const a=y(e);if(!a)return t;const i=kn.find(e=>e.value===a.country);if(!i)return t;if(!Cn(i,a.nationalNumber))return t;const r=a.formatInternational(),o=w(i.value);return{country:i.value,localNumber:r.replace(`+${o} `,"")}}(n.initial_value,r.country),[n.initial_value,r.country]),[_,f]=p(c.country),b=m(()=>{const e=kn.findIndex(e=>e.value===_);return-1===e?0:e},[_]),g=kn[b],[x,C]=p(c.localNumber),E=u(null),N=d((e,n)=>{const t=Cn(e,n);return t?t.number:`+${e.dial}${n}`},[]),A=d((e,n)=>{l.current&&(l.current.value=N(e,n))},[N]);function I(e){const n=e;f(n.value),A(n,x),t()}return cn(e=>{const n=kn.find(n=>n.value===e);n&&n.value!==_&&!x&&I(n)}),h(()=>{n.initial_value&&(l.current&&(l.current.value=n.initial_value),t())},[]),s("div",{className:"xendit-input-phone",children:[o(qe,{options:kn,selectedIndex:b,onChange:I,fixedOverlayWidth:300,enableSearch:!0,noOverflow:!0,className:"xendit-form-field-inner"}),o("input",{id:a,ref:E,type:"tel",inputMode:"tel",placeholder:v(g.value,k)?.formatInternational()?.replace(`+${w(g.value)} `,"")||"",className:"xendit-text-14 xendit-form-field-inner xendit-phone-number-input",onBlur:function(e){!function(e=g,n=x){const t=Cn(e,n);if(t){const n=t.formatInternational();C(n.replace(`+${w(e.value)} `,""))}}(),e.currentTarget?.value&&l.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){const n=e.target.value;C(n),A(g,n),t()},value:x,autoComplete:"tel"}),o("input",{type:"hidden",name:i,ref:l})]})},kn=dn.map(e=>{const n=w(e.value);return n?{...e,shortTitle:`+${n}`,title:`${e.title} (+${n})`,dial:n}:null}).filter(e=>Boolean(e)),Cn=(e,n)=>{const t=y(n,e.value);return t&&t.isPossible()?t:null};function En(e){return{title:e.name,value:e.value}}const Nn=[{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(En),An=[{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(En),In=[{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})),Sn=e=>{const{field:n,onChange:t}=e,a=pe(n),i=ue(n),r=G(),c=Nt()?.form,m=ct(),[_,f]=p(n.initial_value),b=u(null),y=d(()=>{f(""),b.current&&(b.current.value=""),t()},[t]),g=d(e=>{f(e.value),b.current&&(b.current.value=e.value),t(),b.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[t]),v=d(e=>{f(e.currentTarget.value),b.current&&(b.current.value=e.target.value),t(),b.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},[t]),x=function(e){switch(e){case"US":return Nn;case"CA":return An;case"GB":return In;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=ve(e.channel_property,t);if(n&&"string"==typeof n)return n}}}return a.country}(n,c??[],m??{},r)),w=x?x.findIndex(e=>e.value===_):-1,k=ce(x),C=u(!1);return h(()=>{if(C.current){if(x!==k){if(-1!==w)return;y()}}else C.current=!0},[y,x,k,w]),h(()=>{n.initial_value&&(b.current&&(b.current.value=_),t())},[]),s(l,{children:[o("input",{type:"hidden",name:i,defaultValue:"",ref:b}),x?o(qe,{id:a,options:x,selectedIndex:w,onChange:g,placeholder:n.placeholder,enableSearch:!0,className:"xendit-form-field-inner"},(E=x,ke.has(E)||ke.set(E,Ce++),ke.get(E).toString())):o("input",{type:"text",id:a,value:_,onChange:v,placeholder:n.placeholder,className:"xendit-form-field-inner xendit-text-14"})]});var E};const Pn=e=>{const{field:n,onChange:t}=e,a=pe(n),i=ue(n),r=u(null),[s,l]=p(n.initial_value??"");return o("input",{id:a,name:i,ref:r,type:"text",placeholder:n.placeholder,className:"xendit-form-field-inner xendit-text-14",value:s,onBlur:function(e){e.currentTarget?.value&&r.current?.dispatchEvent(new InternalSetFieldTouchedEvent)},onChange:function(e){l(e.currentTarget.value),t()},minLength:Tn(n)?n.type.min_length:void 0,maxLength:Tn(n)?n.type.max_length:void 0,autoComplete:Tn(n)?n.type.autocomplete:void 0})};function Tn(e){return"text"===e.type.name}const Rn={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"},Dn={USD:"US$",CAD:"CA$",EUR:"€",AFN:"؋",ALL:"Lek",AMD:"֏",ARS:"AR$",AUD:"AU$",AZN:"₼",BAM:"KM",BDT:"৳",BIF:"FBu",BND:"BN$",BOB:"Bs",BRL:"R$",BWP:"P",BYN:"Br",BZD:"BZ$",CDF:"FrCD",CHF:"CHF",CLP:"CL$",CNY:"CN¥",COP:"CO$",CRC:"₡",CVE:"CV$",CZK:"Kč",DJF:"Fdj",DKK:"kr",DOP:"RD$",ERN:"Nfk",ETB:"Br",GBP:"£",GEL:"₾",GHS:"GH₵",GNF:"FG",GTQ:"Q",HKD:"HK$",HNL:"L",HUF:"Ft",IDR:"Rp",ILS:"₪",INR:"₹",IRR:"IRR",ISK:"kr",JMD:"J$",JPY:"¥",KES:"Ksh",KHR:"៛",KMF:"FC",KRW:"₩",KZT:"₸",LKR:"SL Re",MDL:"lei",MGA:"MGA",MKD:"MKD",MMK:"K",MOP:"MOP$",MUR:"₨",MXN:"MXN$",MYR:"RM",MZN:"MTn",NAD:"N$",NGN:"₦",NIO:"C$",NOK:"kr",NPR:"रु",NZD:"NZ$",PAB:"B/.",PEN:"S/.",PHP:"₱",PKR:"₨",PLN:"zł",PYG:"₲",RON:"RON",RSD:"RSD",RUB:"₽",RWF:"FR",SDG:"SDG",SEK:"kr",SGD:"S$",SOS:"Ssh",THB:"฿",TOP:"T$",TRY:"TL",TTD:"TT$",TWD:"NT$",TZS:"TSh",UAH:"₴",UGX:"USh",UYU:"$U",UZS:"сум",VND:"₫",XAF:"FCFA",XOF:"CFA",ZAR:"R",ZMW:"K",ZWL:"ZWL$"},qn={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$"},Bn={BHD:3,JOD:3,KWD:3,LYD:3,OMR:3,TND:3};function Ln(e,n){let t;const a=e<0,i=Rn[n]??"en",r=Bn[n]??2;if(t=new Intl.NumberFormat(i,{style:"decimal",minimumFractionDigits:r,maximumFractionDigits:20}).format(Math.abs(e)),t=t.replace(/(\.|,)000?$/,""),Dn[n]){const e=Dn[n]??n;t=(qn[n]??"$1").replace("$",e).replace("1",t)}else t=n+" "+t;return a&&(t="-"+t),t}const Mn=e=>{const{field:n,onChange:t}=e,{t:a}=H(),i=G(),r=pe(n),c=ue(n),_=u(null),f=Nt();Q(f);const b=m(()=>Se(f.form,"credit_card_number"),[f.form]),y=It()?.paymentOptions,g=y?.options?.installment_plans,[v,x]=p(null),w=m(()=>{const e=g?.map(e=>({title:a("installment_plan.pay_in_installments",{installments:e.terms,amount:Ln(e.installment_amount,i.currency)}),subtitle:e.interest_rate,value:On(e)}))??[];return b&&e.unshift({title:a("installment_plan.pay_in_full",{amount:Ln(i.amount,i.currency)}),value:""}),e},[b,g,i.amount,i.currency,a]);let k=w?.findIndex(e=>e.value===v);-1===k&&(k=0);const C=d(()=>{x(null),_.current&&(_.current.value="")},[]),E=d(e=>{if(_.current){const n=g?.find(n=>On(n)===e.value);n?n.code?_.current.value=JSON.stringify([n.terms,n.interval,n.code]):_.current.value=JSON.stringify([n.terms,n.interval]):_.current.value="",_.current?.dispatchEvent(new InternalSetFieldTouchedEvent)}x(e.value),t()},[g,t]);h(()=>{w.length&&E(w[0])},[]);const N=ce(w);return h(()=>{w===N||g?.some(e=>On(e)===v)||(w.length?E(w[0]):C())},[C,w,E,g,N,v]),s(l,{children:[y?o(qe,{id:r,placeholder:n.placeholder,onChange:E,options:w,selectedIndex:k,className:"xendit-form-field-inner"}):o(Be,{id:r,className:"xendit-form-field-inner"}),o("input",{type:"hidden",name:c,ref:_})]})};function On(e){return`${e.terms}_${e.interval}_${e.code??""}`}const Un=e=>{const{field:n,className:t}=e;return o("div",{className:`${t} xendit-channel-form-field xendit-form-field-span-${n.span}`,children:function(){switch(n.type.name){case"credit_card_number":case"credit_card_expiry":case"credit_card_cvn":return o(vn,{...e});case"phone_number":return o(wn,{...e});case"text":case"email":case"postal_code":return o(Pn,{...e});case"dropdown":return o(un,{...e});case"installment_plan":return o(Mn,{...e});case"country":return o(ln,{...e});case"province":return o(Sn,{...e})}throw n.type,new Error(`Unsupported field type: ${n.type.name}`)}()})};const Kn={en:{session:{"action.payment_confirmation_instructions":"Once you've paid, click the button above to get your payment confirmation.","action.payment_made":"I've made this payment","action_barcode.amount_to_pay":"Amount to pay","action_barcode.barcode_content":"Payment Code","action_barcode.merchant_name":"Seller","action_barcode.unable_to_generate":"Unable to generate barcode","action_deeplink.button":"Open App","action_deeplink.instructions":"Please complete your payment on {{channelName}} app.","action_deeplink.title":"Awaiting payment...","action_empty_list_push_notification.subtext":"Check the notification in your {{channelName}} app to complete your payment.","action_empty_list_push_notification.title":"Awaiting payment...","action_qr.unable_to_generate":"Unable to generate QR code","action_va.amount_to_pay":"Amount to Pay","action_va.copied_to_clipboard":"Copied to clipboard","action_va.copy":"Copy","action_va.merchant_name":"Virtual Account Name","action_va.virtual_account_number":"Virtual Account Number","combobox.default_search_placeholder":"Search...","default_error.message_1":"There was a problem with the request.","default_error.message_2":"Please try again later.","default_error.title":"Error","failure_code.account_access_blocked":"Your payment was declined. Please try again or use a different payment method.","failure_code.account_already_linked":"Your account has already been linked. Please use a different payment method.","failure_code.account_not_activated":"Your payment couldn’t be processed because your account hasn’t been activated. Please activate your account and try again.","failure_code.authentication_failed":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.capture_amount_exceeded":"Your payment couldn't be processed. Please make sure your payment details are correct and try again, or use a different payment method.","failure_code.card_declined":"Your card was declined. Please try again with another card or payment method.","failure_code.channel_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.declined_by_issuer":"Your payment was declined. Please try again or use a different payment method.","failure_code.declined_by_processor":"Your payment was declined. Please try again or use a different payment method.","failure_code.expired_card":"Your card was declined because it is expired. Please try again or use a different payment method.","failure_code.expired_otp":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.failure_details_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.inactive_or_unauthorized_card":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.insufficient_balance":"Your payment couldn’t be processed because your account balance is insufficient. Please make sure you have enough funds and try again.","failure_code.invalid_account_details":"Your payment information is incorrect. Please double-check your card details or try a different payment method.","failure_code.invalid_cvv":"The CVN entered was incorrect. Please try again.","failure_code.invalid_merchant_settings":"Your payment couldn’t be processed. Please contact the seller or try a different payment method.","failure_code.invalid_otp":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.invalid_token":"Your payment couldn’t be processed because your verification code is invalid. Please try again or use a different payment method.","failure_code.issuer_unavailable":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.otp_attempt_counts_exceeded":"Your payment couldn’t be processed because there were too many failed OTP attempts. Please make the payment again or use a different payment method.","failure_code.partner_timeout_error":"Your payment couldn't be processed. Please try again or use a different payment method.","failure_code.payment_amount_limits_exceeded":"Your payment couldn’t be processed because you’ve exceeded your transaction limit. Please use a different payment method.","failure_code.payment_attempt_counts_exceeded":"Your payment couldn’t be processed due to too many failed attempts.","failure_code.payment_request_expired":"Your payment couldn’t be processed because the link has expired. Please try again or use a different payment method.","failure_code.processor_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.server_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.stolen_card":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.suspected_fraudulent":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.timeout_error":"Your payment couldn’t be processed. Please try again or use a different payment method.","failure_code.user_declined_payment":"Your payment was declined. Please try again or use a different payment method.","failure_code.user_device_unreachable":"Your payment couldn’t be processed due to a network issue. Please try again or use a different payment method.","failure_code.user_did_not_authorize":"Your payment couldn’t be processed because it wasn’t authorized in time. Please try again.",failure_code_unknown:"A failure occurred with code {{failureCode}}","google_pay_errors.buyer_account_error.message":"Your Google account is unable to make this payment. Use a different Google account or a different payment method.","google_pay_errors.buyer_account_error.title":"Google Pay Error","google_pay_errors.developer_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.developer_error.title":"Google Pay Error","google_pay_errors.internal_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.internal_error.title":"Google Pay Error","google_pay_errors.merchant_account_error.message":"Something went wrong with Google Pay. Please try again or use a different payment method.","google_pay_errors.merchant_account_error.title":"Google Pay Error","google_pay_errors.unknown_error.message":"An unknown error occurred with Google Pay. The error code is {{statusCode}}.","google_pay_errors.unknown_error.title":"Google Pay Error","image_alt.channel_logo":"{{channelName}} logo","installment_plan.pay_in_full":"Pay in Full — {{amount}}","installment_plan.pay_in_installments":"{{installments}}x Installments — {{amount}}","payment.save_checkbox_label":"Save this payment method for recurring payments","payment_methods.add_payment_method":"Add payment method","payment_methods.channel_disabled_amount_too_large":"Not available for this payment","payment_methods.channel_disabled_amount_too_small":"Not available for this payment","payment_methods.pay_with":"Pay with","payment_methods.select_channel_placeholder":"Select {{groupName}}","payment_request_status.canceled.subtext":"Please try to check out again or contact the seller if the problem persists.","payment_request_status.canceled.title":"This page is no longer available","payment_request_status.expired.subtext":"Your payment couldn’t be processed. Please try again or use a different payment method.","payment_request_status.expired.title":"Payment unsuccessful","payment_request_status.failed.subtext":"Your payment couldn't be processed. Please try a different payment method or submit an inquiry to the seller by sharing your Unique Identifiers.","payment_request_status.failed.title":"Payment failed","payment_token_status.canceled.subtext":"Please try again or use a different payment method.","payment_token_status.canceled.title":"Payment method couldn't be added","payment_token_status.expired.subtext":"Please try again or use a different payment method.","payment_token_status.expired.title":"Payment method couldn't be added","payment_token_status.failed.subtext":"Your payment couldn't be processed. Please try a different payment method or submit an inquiry to the seller by sharing your Unique Identifiers.","payment_token_status.failed.title":"Payment method couldn't be added","simulation.see_all_scenarios":"See the full list here.","simulation.select_scenario":"Select a scenario","simulation.simulate_scenario":"Simulate scenario","simulation.simulate_test_scenario":"Simulate a test scenario","simulation.want_to_test_all_scenarios":"Want to test different scenarios?","customer_details.form_name":"Your Name","customer_details.name":"Name","validation.card_brand_not_allowed":"This card brand is not accepted.","validation.card_cvn_invalid":"CVN is not valid","validation.card_expiry_invalid":"Card expiry is not valid","validation.card_number_incomplete":"Card number is incomplete","validation.card_number_invalid":"Card number is not valid","validation.generic_invalid":"{{field}} is not valid. Please check and try again.","validation.required":"{{field}} is required.","validation.text_too_long":"{{field}} is too long","validation.text_too_short":"{{field}} is too short"}}.session,id:{session:{"action.payment_confirmation_instructions":"Setelah Anda bayar, klik tombol di atas untuk mendapatkan konfirmasi pembayaran Anda.","action.payment_made":"Saya telah melakukan pembayaran ini","action_barcode.amount_to_pay":"Jumlah Pembayaran","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"Buka Aplikasi","action_deeplink.instructions":"Silakan selesaikan pembayaran Anda di aplikasi {{channelName}}.","action_deeplink.title":"Menunggu pembayaran...","action_empty_list_push_notification.subtext":"Cek notifikasi di aplikasi {{channelName}} Anda untuk menyelesaikan pembayaran.","action_empty_list_push_notification.title":"Menunggu pembayaran...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"Jumlah Pembayaran","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"Nomor Virtual Account","combobox.default_search_placeholder":"Cari...","default_error.message_1":"Ada masalah dengan permintaan ini.","default_error.message_2":"Silakan coba lagi nanti.","default_error.title":"Error","failure_code.account_access_blocked":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.account_already_linked":"Akun Anda sudah di-link. Silakan gunakan metode pembayaran lain.","failure_code.account_not_activated":"Pembayaran Anda tidak dapat diproses karena akun Anda belum diaktifkan. Harap aktifkan akun Anda dan coba lagi.","failure_code.authentication_failed":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.capture_amount_exceeded":"Pembayaran Anda tidak dapat diproses. Pastikan detail pembayaran Anda benar dan coba lagi, atau gunakan metode pembayaran lain.","failure_code.card_declined":"Kartu Anda ditolak. Silakan coba lagi dengan kartu atau metode pembayaran lain.","failure_code.channel_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.declined_by_issuer":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.declined_by_processor":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.expired_card":"Kartu Anda ditolak karena sudah kedaluwarsa. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.expired_otp":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.failure_details_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.inactive_or_unauthorized_card":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.insufficient_balance":"Pembayaran Anda tidak dapat diproses karena saldo akun Anda tidak mencukupi. Pastikan Anda memiliki dana yang cukup dan coba lagi.","failure_code.invalid_account_details":"Informasi pembayaran Anda salah. Harap periksa kembali detail kartu Anda atau coba gunakan metode pembayaran lain.","failure_code.invalid_cvv":"CVN yang dimasukkan salah. Silakan coba lagi.","failure_code.invalid_merchant_settings":"Pembayaran Anda tidak dapat diproses. Silakan hubungi penjual atau coba metode pembayaran lain.","failure_code.invalid_otp":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.invalid_token":"Pembayaran Anda tidak dapat diproses karena kode verifikasi tidak valid. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.issuer_unavailable":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.otp_attempt_counts_exceeded":"Pembayaran Anda tidak dapat diproses karena terlalu banyak percobaan OTP yang gagal. Harap lakukan pembayaran lagi atau gunakan metode pembayaran lain.","failure_code.partner_timeout_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.payment_amount_limits_exceeded":"Pembayaran Anda tidak dapat diproses karena Anda telah melampaui batas transaksi. Silakan gunakan metode pembayaran lain.","failure_code.payment_attempt_counts_exceeded":"Pembayaran Anda tidak dapat diproses karena terlalu banyak percobaan yang gagal.","failure_code.payment_request_expired":"Pembayaran Anda tidak dapat diproses karena link telah kedaluwarsa. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.processor_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.server_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.stolen_card":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.suspected_fraudulent":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.timeout_error":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_declined_payment":"Pembayaran Anda ditolak. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_device_unreachable":"Pembayaran Anda tidak dapat diproses karena masalah jaringan. Silakan coba lagi atau gunakan metode pembayaran lain.","failure_code.user_did_not_authorize":"Pembayaran Anda tidak dapat diproses karena waktu pembayaran telah habis. Silakan coba lagi.",failure_code_unknown:"Terjadi kegagalan dengan kode {{failureCode}}","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"Logo {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"Simpan metode pembayaran ini untuk pembayaran berulang","payment_methods.add_payment_method":"Tambah metode pembayaran","payment_methods.channel_disabled_amount_too_large":"Tidak tersedia untuk pembayaran ini","payment_methods.channel_disabled_amount_too_small":"Tidak tersedia untuk pembayaran ini","payment_methods.pay_with":"Bayar dengan","payment_methods.select_channel_placeholder":"Pilih {{groupName}}","payment_request_status.canceled.subtext":"Silakan coba check out lagi atau hubungi penjual jika masalah terus berlanjut.","payment_request_status.canceled.title":"Halaman ini tidak tersedia lagi","payment_request_status.expired.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba lagi atau gunakan metode pembayaran lain.","payment_request_status.expired.title":"Pembayaran tidak berhasil","payment_request_status.failed.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba metode pembayaran lain atau ajukan pertanyaan kepada penjual dengan membagikan ID Unik Anda.","payment_request_status.failed.title":"Pembayaran gagal","payment_token_status.canceled.subtext":"Silakan coba lagi atau gunakan metode pembayaran lain.","payment_token_status.canceled.title":"Metode pembayaran tidak dapat ditambahkan","payment_token_status.expired.subtext":"Silakan coba lagi atau gunakan metode pembayaran lain.","payment_token_status.expired.title":"Metode pembayaran tidak dapat ditambahkan","payment_token_status.failed.subtext":"Pembayaran Anda tidak dapat diproses. Silakan coba metode pembayaran lain atau ajukan pertanyaan kepada penjual dengan membagikan ID Unik Anda.","payment_token_status.failed.title":"Metode pembayaran tidak dapat ditambahkan","customer_details.form_name":"Nama Anda","customer_details.name":"Nama","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"Merek kartu ini tidak diterima.","validation.card_cvn_invalid":"CVN tidak valid","validation.card_expiry_invalid":"Tanggal kedaluwarsa kartu tidak valid","validation.card_number_incomplete":"Nomor kartu tidak lengkap","validation.card_number_invalid":"Nomor kartu tidak valid","validation.generic_invalid":"{{field}} tidak valid. Silakan cek dan coba lagi.","validation.required":"{{field}} wajib diisi.","validation.text_too_long":"{{field}} terlalu panjang","validation.text_too_short":"{{field}} terlalu pendek"}}.session,th:{session:{"action.payment_confirmation_instructions":"เมื่อคุณชำระเงินแล้ว คลิกที่ปุ่มด้านบนเพื่อยืนยันการชำระเงิน","action.payment_made":"ฉันได้ชำระเงินแล้ว","action_barcode.amount_to_pay":"จำนวนเงินที่ต้องชำระ","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"","action_deeplink.instructions":"โปรดชำระเงินให้เสร็จสิ้นบนแอป {{channelName}}","action_deeplink.title":"","action_empty_list_push_notification.subtext":"ตรวจสอบการแจ้งเตือนในแอป {{channelName}} ของคุณเพื่อดำเนินการชำระเงินให้เสร็จสิ้น","action_empty_list_push_notification.title":"กําลังรอการชําระเงิน...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"ยอดชำระ","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"หมายเลข Virtual Account","combobox.default_search_placeholder":"ค้นหา...","default_error.message_1":"มีปัญหาในการประมวลผลคำขอ","default_error.message_2":"โปรดลองอีกครั้งในภายหลัง","default_error.title":"ข้อผิดพลาด","failure_code.account_access_blocked":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.account_already_linked":"บัญชีนี้มีการเชื่อมต่อไว้แล้ว กรุณาเลือกวิธีการชำระเงินอื่น","failure_code.account_not_activated":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากบัญชีของคุณยังไม่ได้เปิดใช้งาน กรุณาเปิดใช้งานบัญชีและลองใหม่อีกครั้ง","failure_code.authentication_failed":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.capture_amount_exceeded":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาตรวจสอบรายละเอียดการชำระเงินให้ถูกต้องแล้วลองใหม่อีกครั้ง หรือใช้วิธีการชำระเงินอื่น","failure_code.card_declined":"บัตรของคุณถูกปฏิเสธ กรุณาลองใหม่ด้วยบัตรหรือวิธีการชำระเงินอื่น","failure_code.channel_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.declined_by_issuer":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.declined_by_processor":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.expired_card":"บัตรของคุณถูกปฏิเสธเนื่องจากบัตรหมดอายุ กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","failure_code.expired_otp":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.failure_details_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.inactive_or_unauthorized_card":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.insufficient_balance":"ไม่สามารถดำเนินการชำระเงินได้ เนื่องจากยอดเงินในบัญชีไม่เพียงพอ กรุณาตรวจสอบให้แน่ใจว่ามียอดเงินเพียงพอแล้วลองใหม่อีกครั้ง","failure_code.invalid_account_details":"ข้อมูลการชำระเงินไม่ถูกต้อง กรุณาตรวจสอบรายละเอียดบัตรอีกครั้ง หรือใช้วิธีการชำระเงินอื่น","failure_code.invalid_cvv":"CVN ที่กรอกไม่ถูกต้อง กรุณาลองใหม่อีกครั้ง","failure_code.invalid_merchant_settings":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาติดต่อผู้ขายหรือลองใช้วิธีชำระเงินอื่น","failure_code.invalid_otp":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.invalid_token":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากรหัสยืนยันของคุณไม่ถูกต้อง กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.issuer_unavailable":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.otp_attempt_counts_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากมีการกรอกรหัส OTP ผิดพลาดมากเกินไป กรุณาชำระเงินใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.partner_timeout_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.payment_amount_limits_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากคุณทำธุรกรรมเกินขีดจำกัด กรุณาใช้วิธีชำระเงินอื่น","failure_code.payment_attempt_counts_exceeded":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากพยายามล้มเหลวหลายครั้งเกินไป","failure_code.payment_request_expired":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากลิงก์หมดอายุแล้ว กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.processor_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.server_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.stolen_card":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.suspected_fraudulent":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือเลือกวิธีการชำระเงินอื่น","failure_code.timeout_error":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_declined_payment":"การชำระเงินของคุณถูกปฏิเสธ กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_device_unreachable":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากปัญหาเครือข่าย กรุณาลองใหม่อีกครั้งหรือใช้วิธีชำระเงินอื่น","failure_code.user_did_not_authorize":"ไม่สามารถดำเนินการชำระเงินได้เนื่องจากไม่ได้รับการอนุมัติภายในเวลาที่กำหนด กรุณาลองใหม่อีกครั้ง",failure_code_unknown:"เกิดข้อผิดพลาดขึ้น (รหัส: {{failureCode}})","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"โลโก้ {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"บันทึกวิธีการชําระเงินนี้สําหรับการชําระเงินอัตโนมัติ","payment_methods.add_payment_method":"เพิ่มวิธีการชำระเงิน","payment_methods.channel_disabled_amount_too_large":"ไม่สามารถใช้ได้กับการชำระเงินนี้","payment_methods.channel_disabled_amount_too_small":"ไม่สามารถใช้ได้กับการชำระเงินนี้","payment_methods.pay_with":"ชำระเงินด้วย","payment_methods.select_channel_placeholder":"เลือก {{groupName}}","payment_request_status.canceled.subtext":"กรุณาลองชำระเงินอีกครั้ง หรือ ติดต่อผู้ขายหากปัญหายังคงเกิดขึ้น","payment_request_status.canceled.title":"หน้านี้ไม่สามารถใช้งานได้แล้ว","payment_request_status.expired.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใหม่อีกครั้งหรือลองใช้วิธีชำระเงินอื่น","payment_request_status.expired.title":"ชำระเงินไม่สำเร็จ","payment_request_status.failed.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใช้วิธีการชำระเงินอื่น หรือส่งคำถามไปยังผู้ขายโดยแชร์ Unique Identifiers ของคุณ","payment_request_status.failed.title":"ชำระเงินไม่สำเร็จ","payment_token_status.canceled.subtext":"กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","payment_token_status.canceled.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","payment_token_status.expired.subtext":"กรุณาลองใหม่อีกครั้งหรือใช้วิธีการชําระเงินอื่น","payment_token_status.expired.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","payment_token_status.failed.subtext":"ไม่สามารถดำเนินการชำระเงินได้ กรุณาลองใช้วิธีการชำระเงินอื่น หรือส่งคำถามไปยังผู้ขายโดยแชร์ Unique Identifiers ของคุณ","payment_token_status.failed.title":"ไม่สามารถเพิ่มวิธีการชําระเงินได้","customer_details.form_name":"ชื่อของคุณ","customer_details.name":"ชื่อ","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"ไม่รับบัตรเครดิตยี่ห้อนี้","validation.card_cvn_invalid":"CVN ไม่ถูกต้อง","validation.card_expiry_invalid":"วันหมดอายุของบัตรไม่ถูกต้อง","validation.card_number_incomplete":"หมายเลขบัตรไม่ครบถ้วน","validation.card_number_invalid":"หมายเลขบัตรไม่ถูกต้อง","validation.generic_invalid":"{{field}} ไม่ถูกต้อง","validation.required":"กรุณากรอก {{field}}","validation.text_too_long":"{{field}} ยาวเกินไป","validation.text_too_short":"{{field}} สั้นเกินไป"}}.session,vi:{session:{"action.payment_confirmation_instructions":"Sau khi bạn đã thanh toán, hãy nhấp nút phía trên để nhận xác nhận thanh toán.","action.payment_made":"Tôi đã thực hiện thanh toán này","action_barcode.amount_to_pay":"Số tiền cần thanh toán","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"Mở ứng dụng","action_deeplink.instructions":"Vui lòng hoàn tất thanh toán trên ứng dụng {{channelName}}.","action_deeplink.title":"Đang chờ thanh toán...","action_empty_list_push_notification.subtext":"Vui lòng kiểm tra thông báo trong ứng dụng {{channelName}} để hoàn tất thanh toán.","action_empty_list_push_notification.title":"Đang chờ thanh toán...","action_qr.unable_to_generate":"","action_va.amount_to_pay":"Số tiền cần thanh toán","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"Số tài khoản định danh (Virtual Account)","combobox.default_search_placeholder":"Tìm kiếm...","default_error.message_1":"Có vấn đề với yêu cầu.","default_error.message_2":"Vui lòng thử lại sau.","default_error.title":"Lỗi","failure_code.account_access_blocked":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.account_already_linked":"Tài khoản của bạn đã được liên kết. Vui lòng dùng phương thức khác.","failure_code.account_not_activated":"Không thể thực hiện thanh toán vì tài khoản chưa được kích hoạt. Vui lòng kích hoạt và thử lại.","failure_code.authentication_failed":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.capture_amount_exceeded":"Không thể thực hiện thanh toán. Vui lòng kiểm tra thông tin thanh toán và thử lại, hoặc dùng phương thức khác.","failure_code.card_declined":"Thẻ của bạn đã bị từ chối. Vui lòng thử lại bằng thẻ khác hoặc phương thức khác.","failure_code.channel_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.declined_by_issuer":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.declined_by_processor":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.expired_card":"Thẻ của bạn bị từ chối do đã hết hạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.expired_otp":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.failure_details_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.inactive_or_unauthorized_card":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.insufficient_balance":"Không thể thực hiện thanh toán vì số dư tài khoản không đủ. Vui lòng nạp thêm tiền và thử lại.","failure_code.invalid_account_details":"Thông tin thanh toán không chính xác. Vui lòng kiểm tra lại hoặc dùng phương thức khác.","failure_code.invalid_cvv":"Mã CVN nhập không đúng. Vui lòng thử lại.","failure_code.invalid_merchant_settings":"Không thể thực hiện thanh toán. Vui lòng liên hệ người bán hoặc dùng phương thức khác.","failure_code.invalid_otp":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.invalid_token":"Không thể thực hiện thanh toán vì mã xác minh không hợp lệ. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.issuer_unavailable":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.otp_attempt_counts_exceeded":"Không thể thực hiện thanh toán vì đã nhập sai OTP quá nhiều lần. Vui lòng thanh toán lại hoặc dùng phương thức khác.","failure_code.partner_timeout_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.payment_amount_limits_exceeded":"Không thể thực hiện thanh toán vì bạn đã vượt quá hạn mức giao dịch. Vui lòng dùng phương thức khác.","failure_code.payment_attempt_counts_exceeded":"Không thể thực hiện thanh toán do quá nhiều lần thử thất bại.","failure_code.payment_request_expired":"Không thể thực hiện thanh toán vì liên kết đã hết hạn. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.processor_error":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.server_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.stolen_card":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.suspected_fraudulent":"Không thể xử lý thanh toán của bạn. Vui lòng thử lại hoặc sử dụng phương thức thanh toán khác.","failure_code.timeout_error":"Không thể thực hiện thanh toán. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_declined_payment":"Thanh toán của bạn bị từ chối. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_device_unreachable":"Không thể thực hiện thanh toán do sự cố mạng. Vui lòng thử lại hoặc dùng phương thức khác.","failure_code.user_did_not_authorize":"Không thể thực hiện thanh toán vì không được xác nhận kịp thời. Vui lòng thử lại.",failure_code_unknown:"Có lỗi xảy ra với mã {{failureCode}}","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"Logo {{channelName}}","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"Lưu phương thức thanh toán này cho các thanh toán định kỳ","payment_methods.add_payment_method":"Thêm phương thức thanh toán","payment_methods.channel_disabled_amount_too_large":"Không khả dụng cho khoản thanh toán này","payment_methods.channel_disabled_amount_too_small":"Không khả dụng cho khoản thanh toán này","payment_methods.pay_with":"Thanh toán bằng","payment_methods.select_channel_placeholder":"Chọn {{groupName}}","payment_request_status.canceled.subtext":"Vui lòng thử thanh toán lại hoặc liên hệ người bán nếu vấn đề vẫn tiếp diễn.","payment_request_status.canceled.title":"Trang này không còn khả dụng","payment_request_status.expired.subtext":"Thanh toán của bạn không thể xử lý. Vui lòng thử lại hoặc chọn phương thức khác.","payment_request_status.expired.title":"Thanh toán không thành công","payment_request_status.failed.subtext":"Không thể thực hiện thanh toán. Vui lòng thử phương thức khác hoặc gửi yêu cầu đến người bán bằng cách chia sẻ Mã định danh duy nhất.","payment_request_status.failed.title":"Thanh toán thất bại","payment_token_status.canceled.subtext":"Vui lòng thử lại hoặc dùng phương thức khác.","payment_token_status.canceled.title":"Không thể thêm phương thức thanh toán","payment_token_status.expired.subtext":"Vui lòng thử lại hoặc dùng phương thức khác.","payment_token_status.expired.title":"Không thể thêm phương thức thanh toán","payment_token_status.failed.subtext":"Không thể thực hiện thanh toán. Vui lòng thử phương thức khác hoặc gửi yêu cầu đến người bán bằng cách chia sẻ Mã định danh duy nhất.","payment_token_status.failed.title":"Không thể thêm phương thức thanh toán","customer_details.form_name":"Tên của bạn","customer_details.name":"Tên","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"Thương hiệu thẻ này không được chấp nhận.","validation.card_cvn_invalid":"CVN không hợp lệ","validation.card_expiry_invalid":"Ngày hết hạn thẻ không hợp lệ","validation.card_number_incomplete":"Số thẻ chưa đầy đủ","validation.card_number_invalid":"Số thẻ không hợp lệ","validation.generic_invalid":"{{field}} không hợp lệ","validation.required":"Vui lòng nhập {{field}}","validation.text_too_long":"{{field}} quá dài","validation.text_too_short":"{{field}} quá ngắn"}}.session,es:{session:{"action.payment_confirmation_instructions":"","action.payment_made":"","action_barcode.amount_to_pay":"","action_barcode.barcode_content":"","action_barcode.merchant_name":"","action_barcode.unable_to_generate":"","action_deeplink.button":"","action_deeplink.instructions":"","action_deeplink.title":"","action_empty_list_push_notification.subtext":"","action_empty_list_push_notification.title":"","action_qr.unable_to_generate":"","action_va.amount_to_pay":"","action_va.copied_to_clipboard":"","action_va.copy":"","action_va.merchant_name":"","action_va.virtual_account_number":"","combobox.default_search_placeholder":"","default_error.message_1":"","default_error.message_2":"","default_error.title":"","failure_code.account_access_blocked":"","failure_code.account_already_linked":"","failure_code.account_not_activated":"","failure_code.authentication_failed":"","failure_code.capture_amount_exceeded":"","failure_code.card_declined":"","failure_code.channel_unavailable":"","failure_code.declined_by_issuer":"","failure_code.declined_by_processor":"","failure_code.expired_card":"","failure_code.expired_otp":"","failure_code.failure_details_unavailable":"","failure_code.inactive_or_unauthorized_card":"","failure_code.insufficient_balance":"","failure_code.invalid_account_details":"","failure_code.invalid_cvv":"","failure_code.invalid_merchant_settings":"","failure_code.invalid_otp":"","failure_code.invalid_token":"","failure_code.issuer_unavailable":"","failure_code.otp_attempt_counts_exceeded":"","failure_code.partner_timeout_error":"","failure_code.payment_amount_limits_exceeded":"","failure_code.payment_attempt_counts_exceeded":"","failure_code.payment_request_expired":"","failure_code.processor_error":"","failure_code.server_error":"","failure_code.stolen_card":"","failure_code.suspected_fraudulent":"","failure_code.timeout_error":"","failure_code.user_declined_payment":"","failure_code.user_device_unreachable":"","failure_code.user_did_not_authorize":"",failure_code_unknown:"","google_pay_errors.buyer_account_error.message":"","google_pay_errors.buyer_account_error.title":"","google_pay_errors.developer_error.message":"","google_pay_errors.developer_error.title":"","google_pay_errors.internal_error.message":"","google_pay_errors.internal_error.title":"","google_pay_errors.merchant_account_error.message":"","google_pay_errors.merchant_account_error.title":"","google_pay_errors.unknown_error.message":"","google_pay_errors.unknown_error.title":"","image_alt.channel_logo":"","installment_plan.pay_in_full":"","installment_plan.pay_in_installments":"","payment.save_checkbox_label":"","payment_methods.add_payment_method":"","payment_methods.channel_disabled_amount_too_large":"","payment_methods.channel_disabled_amount_too_small":"","payment_methods.pay_with":"","payment_methods.select_channel_placeholder":"","payment_request_status.canceled.subtext":"","payment_request_status.canceled.title":"","payment_request_status.expired.subtext":"","payment_request_status.expired.title":"","payment_request_status.failed.subtext":"","payment_request_status.failed.title":"","payment_token_status.canceled.subtext":"","payment_token_status.canceled.title":"","payment_token_status.expired.subtext":"","payment_token_status.expired.title":"","payment_token_status.failed.subtext":"","payment_token_status.failed.title":"","simulation.see_all_scenarios":"","simulation.select_scenario":"","simulation.simulate_scenario":"","simulation.simulate_test_scenario":"","simulation.want_to_test_all_scenarios":"","validation.card_brand_not_allowed":"","validation.card_cvn_invalid":"","validation.card_expiry_invalid":"","validation.card_number_incomplete":"","validation.card_number_invalid":"","validation.generic_invalid":"","validation.required":"","validation.text_too_long":"","validation.text_too_short":""}}.session};const Vn=(e,n,t)=>n?(e=>"object"==typeof e&&null!==e&&"localeKey"in e)(n)?e(n.localeKey,{field:"string"==typeof t?t:t.label}):n.value:null;function Fn(e){return e.startsWith("/")&&e.endsWith("/")?e.slice(1,-1):e}function Wn(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=we(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=x(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(Fn(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 Gn(e,n){const t=Array.isArray(e.channel_property)?e.channel_property:[e.channel_property];for(const a of t){let t=zn(n,a);if(void 0===t&&(t=""),"string"!=typeof t)continue;const i=Wn(e,t);if(i)return i}}function zn(e,n){const t=n.split("."),a=t[0].endsWith("[]");if(a){if(1!==t.length)throw new Error("Array channel properties cannot have nested keys");t[0]=t[0].slice(0,-2)}const i=e[t[0]];if(void 0!==i){if(a&&Array.isArray(i))return i;if("object"!=typeof i||Array.isArray(i)){if(1!==t.length)throw new Error(`Attempted to read channel property "${n}" expecting an object but found a primitive value; this is a bug, please contact support.`);return i}return zn(i,t.slice(1).join("."))}}const Xn=n(null),Hn=({scenarios:e,onSelect:n,children:t})=>{const[a,i]=p(!1),r=u(null);return h(()=>{if(!a)return;const e=e=>{const n=r.current;n&&(n.contains(e.target)||i(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]),o("div",{ref:r,children:o(Xn.Provider,{value:{open:a,setOpen:i,scenarios:e,onSelect:n},children:t})})},$n=({children:e})=>o("div",{className:"xendit-form-simulation-root",children:e}),Yn=({children:e})=>{const{open:n,setOpen:t}=c(Xn)||{};return o("button",{type:"button",className:"xendit-form-simulation-trigger",onClick:()=>t?.(!n),children:e})},jn=()=>{const e=c(Xn);Q(e);const{open:n,setOpen:t,scenarios:a,onSelect:i}=e,{t:r}=H();return n&&a?s("div",{className:"xendit-form-simulation-popover",children:[o("div",{className:"xendit-text-12 xendit-text-semibold",children:r("simulation.simulate_test_scenario")}),o(qe,{onChange:e=>{i?.(e.value),t?.(!1)},placeholder:r("simulation.select_scenario"),options:a.scenarios.map(e=>({title:e.description,value:e.name,leadingAsset:o("img",{src:e.imageUrl,className:"xendit-channel-logo"})}))}),a?.docsLink?s("div",{className:"xendit-text-14",children:[r("simulation.want_to_test_all_scenarios")," ",o("a",{href:a.docsLink,target:"_blank",rel:"noopener noreferrer",className:"xendit-text-link",children:r("simulation.see_all_scenarios")})]}):null]}):null},Qn="field-radius-bl-0",Zn="field-radius-br-0",Jn="field-radius-tl-0",et="field-radius-tr-0",nt="field-collapse-r",tt="field-collapse-l",at="field-collapse-t",it="field-collapse-b",rt=({fieldGroup:e,groupIndex:n,handleFieldChanged:t,channelProperties:a,simulationScenarios:i})=>{const{t:r}=H(),l=It(),d=Nt(),c=u(null),[m,_]=p({}),f=e.map(e=>e.span),y=Math.ceil(e.reduce((e,n)=>e+n.span,0)/2);h(()=>{const e=c.current;if(e)return e.addEventListener(InternalSetFieldTouchedEvent.type,n),()=>{e.removeEventListener(InternalSetFieldTouchedEvent.type,n)};function n(e){const n=e.target.name;_(e=>({...e,[n]:!0}))}},[]);const g=(()=>{for(const n of e){if(!m[ue(n)])continue;const e=Gn(n,a??{});if(e)return o("span",{className:"xendit-error-message xendit-text-12",children:Vn(r,e,n)})}for(const n of e){if("credit_card_number"!==n.type.name)continue;if(!m[ue(n)])continue;const e=d?.card?.brands,t=l?.cardDetails?.details?.schemes;if(e?.length&&t?.length&&!t.some(n=>e.some(e=>e.name===n)))return o("span",{className:"xendit-error-message xendit-text-12",children:Vn(r,{localeKey:"validation.card_brand_not_allowed"},n)})}return null})();return o(fn,{children:s("div",{className:"xendit-channel-form-field-group",children:[s("div",{className:"xendit-channel-form-field-group-label-container",children:[o("label",{htmlFor:pe(e[0]),className:"xendit-text-14",children:e[0].group_label??e[0].label??""}),i?o(ot,{simulationScenarios:i,fieldGroup:e}):null]}),o("div",{ref:c,className:"xendit-form-field-group "+(g?"invalid":""),children:e.map((e,n)=>{const a=(e=>{const n=f.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===y-1}})(n),i=((e,n,t)=>{const{fieldPositionBySpan:a,fieldRow:i,fieldColumn:r,isLastRow:o}=t;return b({[Qn]:y>i+1||a%2==1,[Zn]:!!f[n+1],[Jn]:n>0,[et]:!(0===i&&1===r||0===i&&0===r&&2===e.span),[nt]:1===e.span&&0===r,[tt]:1===e.span&&1===r,[at]:a>=2,[it]:!o})})(e,n,a);return o(Un,{className:i,field:e,onChange:t},n)})},n),g]})})},ot=({simulationScenarios:e,fieldGroup:n})=>{const t=c(mn),{t:a}=H();return o(Hn,{scenarios:e,onSelect:a=>{const i=e.scenarios.find(e=>e.name===a);if(i?.values)for(const[e,a]of Object.entries(i.values)){const i=n.find(n=>ue(n)===e);i&&("credit_card_number"!==i.type.name&&"credit_card_expiry"!==i.type.name&&"credit_card_cvn"!==i.type.name||t?.postMessageToIframe(e,{type:"xendit-iframe-populate-for-simulation",scenario:a}))}},children:s($n,{children:[o(Yn,{children:o("div",{className:"xendit-text-12 xendit-text-semibold xendit-text-link",children:a("simulation.simulate_scenario")})}),o(jn,{})]})})},st={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"},lt=C(({form:e,onChannelPropertiesChanged:n},t)=>{const a=G(),i=Nt(),r=H(),s=It(),l=u(null),[c,b]=p(null);_(t,()=>({setAllFieldsTouched(){const e=l.current;e&&Array.from(e.elements).filter(e=>e instanceof HTMLInputElement).forEach(e=>{e.name&&e.dispatchEvent(new InternalSetFieldTouchedEvent)})}}));const y=d(()=>{if(!l.current)return{};return function(e){const n={};for(const[t,a]of e){if(a instanceof Blob)continue;const e=t.split("__"),i=ut(e,a);e:for(const t of e){const e=t.split(".");let a=n;for(;e.length>1;){const n=e.shift();let t=a[n];if(void 0===t&&(t=a[n]={}),t&&"object"==typeof t){if(Array.isArray(t))continue e;a=t}}const r=i.length?i.shift():"";e[0].endsWith("[]")?a[e[0].slice(0,-2)]=[r]:a[e[0]]=r}}return n}(new FormData(l.current).entries())},[]),g=d(()=>{if(!l.current)return;const e=y();b(e),n(e)},[y,n]);h(()=>{g()},[]);const v=function(e,n,t,a){const i=m(()=>ht(e.session_type,n,t,a),[a,t,n,e.session_type]);return i}(a,e,c||{},s??null),x=ce(v);f(()=>{(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})(x||[],v)||g()},[v,g,x]);const w=d(e=>r.supportsSimulationScenarios()&&"CARDS"===i?.channel_code&&e.some(e=>"credit_card_number"===e.type.name)?st:null,[i,r]),k=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}(v).filter(e=>e.length);return 0===k.length?null:o("div",{class:"xendit-channel-form",children:o("form",{ref:l,children:o(dt.Provider,{value:c,children:k.map((e,n)=>o(rt,{fieldGroup:e,groupIndex:n,handleFieldChanged:g,channelProperties:c,simulationScenarios:w(e)},n))})})})}),dt=n(null),ct=()=>c(dt);function ut(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 ht(e,n,t,a){const i=Se(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=zn(t,n);switch(a){case"equals":if(r!==i)return!1;break;case"not_equals":if(r===i)return!1}}return!0})}const pt=e=>{const n=u(null),t=u(null),a=void 0!==HTMLElement.prototype.animate;return h(()=>{a&&(n.current?.animate(mt,_t),t.current?.animate(ft,bt))},[a]),s("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s("g",{opacity:"0.5",children:[o("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"}),o("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"})]}),s("g",{ref:t,style:{transformOrigin:"20px 20px"},children:[o("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"}),s("g",{style:{transformOrigin:"10px 30px"},ref:n,children:[o("path",{d:"M26.7697 20.5301V12.7301H18.9697",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M17.4102 22.0901L26.7702 12.7301",stroke:"#7C7C7C",strokeWidth:"1.872",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})},mt=[{transform:"scale(0.1)"},{transform:"scale(1)"}],_t={duration:500,easing:"ease-out"},ft=[{transform:"rotate(0deg)"},{transform:"rotate(5deg)"},{transform:"rotate(-5deg)"},{transform:"rotate(0deg)"}],bt={duration:1e3,easing:"ease-out",iterations:1/0,delay:2e3},yt=[{transform:"translateY(0)"},{transform:"translateY(44px)"}],gt={duration:1e3,delay:1e3,easing:"ease-out"},vt={duration:1e3,direction:"reverse",delay:500,easing:"ease-in"},xt=[{opacity:1},{opacity:0},{opacity:1}],wt={duration:1e3},kt=e=>{const{id:n,label:t,checked:a,onChange:i,disabled:r}=e,l=fe(),d=n||l;return s("div",{className:"xendit-checkbox",children:[s("div",{className:"xendit-checkbox-box",children:[o("input",{id:d,type:"checkbox",onChange:e=>{i?.(e)},checked:a,disabled:r}),o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:"xendit-checkbox-graphic",children:o("polyline",{points:"40 144 96 200 224 72",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"16"})})]}),o("label",{htmlFor:d,className:"xendit-text-14",children:t})]})},Ct=C(({onChange:e,value:n},t)=>{const{t:a}=H(),[i,r]=E({});N(t,()=>({setAllFieldsTouched(){r({given_names:!0})}}));const l=(()=>{if(0===Object.keys(i).length)return null;const e=function(e){if(0===e.given_names.length)return{localeKey:"validation.required"}}(n);return e?o("span",{className:"xendit-error-message xendit-text-12",children:Vn(a,e,"Name")}):null})();return o("form",{children:s("div",{className:"xendit-channel-form-field-group",children:[o("div",{className:"xendit-channel-form-field-group-label-container",children:o("label",{htmlFor:"given_names",className:"xendit-text-14",children:a("customer_details.name")})}),o("div",{className:"xendit-form-field-group "+(l?"invalid":""),children:o("div",{className:"xendit-channel-form-field xendit-form-field-span-2",children:o("input",{id:"given_names",name:"given_names",type:"text",placeholder:a("customer_details.form_name"),className:"xendit-form-field-inner xendit-text-14",onBlur:e=>{const n=e.target;r(e=>({...e,[n.name]:!0}))},onChange:n=>{const t=n.target;e({given_names:t.value})},required:!0,autoComplete:"given-name"})})}),l]})})}),Et=n(null),Nt=()=>{const e=c(Et);if(void 0===e)throw new Error("useChannel must be used within a ChannelProvider");return e},At=n(null);At.displayName="ChannelComponentDataContext";const It=()=>c(At),St=e=>{const{channelOrPair:n,channelData:t,savePaymentMethod:a,formRef:i,customerDetailsFormRef:r}=e,l=u(null),d=H(),{t:p}=d,m=G(),_=(()=>{const e=c(O);if(void 0===e)throw new Error("useCustomer must be used within a XenditSessionProvider");return e})(),f=n[0],b=n.length>1,y=Ee(n,a),g=y.requires_customer_details&&!_,v=function(e){if(e&&2===e.length)return[e[0],e[1]];return null}(y.instructions),x="OPTIONAL"===m.allow_save_payment_method&&(y.allow_save||b);return h(()=>{v||y.form.length||y.banner||console.error(`Missing display data for ${y.channel_code}, this is a bug, please contact support`)},[v,y.banner,y.channel_code,y.form]),o(Et.Provider,{value:y,children:o(At.Provider,{value:t,children:s("div",{className:"xendit-payment-channel",ref:l,children:[o(lt,{ref:i,form:y.form,onChannelPropertiesChanged:e=>{let n=e;if("CARDS"===f.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(f.channel_code,n);l.current?.dispatchEvent(t)}}),g&&o(Ct,{ref:r,onChange:e=>{d?.dispatchEvent(new InternalUpdateChannelComponentData(f.channel_code,{customerDetails:e}))},value:t.customerDetails||{given_names:""}}),y.banner?o(Tt,{banner:y.banner}):null,x&&o(kt,{label:p("payment.save_checkbox_label"),onChange:e=>{const n=e.target?.checked;d?.dispatchEvent(new InternalUpdateChannelComponentData(f.channel_code,{savePaymentMethod:n}))},checked:a}),v?s("div",{className:"xendit-payment-channel-instructions",children:[Pt[y.pm_type??""]??o(pt,{}),o("div",{className:"xendit-payment-channel-instructions-text xendit-text-12",children:v.map((e,n)=>o("p",{className:0===n?"xendit-text-semibold":void 0,children:e},n))})]}):null]})})})},Pt={EWALLET:o(pt,{}),QR_CODE:o(e=>{const n=u(null),t=u(null),a=fe(),i=void 0!==HTMLElement.prototype.animate;return h(()=>{if(i&&n.current){const e=()=>{if(!n.current)return;const a=n.current.animate(yt,gt);setTimeout(()=>{t.current?.animate(xt,wt)},1e3),a.onfinish=()=>{const a=n.current?.animate(yt,vt);setTimeout(()=>{t.current?.animate(xt,wt)},500),a&&(a.onfinish=e)}};e()}},[i]),s("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:[s("g",{"clip-path":`url(#${a})`,children:[o("rect",{x:"8",y:"8",width:"24",height:"24",fill:"var(--xendit-color-icon-secondary)",ref:t}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("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"}),o("rect",{x:"3",y:"-4",width:"34",height:"4",rx:"1.75",ref:n})]}),o("defs",{children:o("clipPath",{id:a,children:o("rect",{width:"40",height:"40",fill:"white"})})})]})},{})},Tt=e=>{const n="number"==typeof e.banner.aspect_ratio?String(e.banner.aspect_ratio):void 0;return e.banner?.link_url?o("a",{href:e.banner.link_url,target:"_blank",rel:"noopener noreferrer",children:o("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:n}})}):o("img",{src:e.banner.image_url,alt:e.banner.alt_text,className:"xendit-payment-channel-banner",style:{aspectRatio:n}})};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 Rt(e){const n=new URLSearchParams;return n.append("payload",JSON.stringify(e)),n}function Dt(e,n,t){return async function(...a){let i,r,o,s,l;switch(e){case"GET":[i,r,o,l]=a;break;case"POST":[i,s,r,o,l]=a;break;default:throw new Error(`Unable to call endpoint with method ${e}; this is a bug, please contact support.`)}const d="v0.0.23";Q(d),Q(d.startsWith("v"));const c=i.hostId;if(c===oe)throw new Error("A network request was made in mock mode; this is a bug.");const u=le(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?Rt(s):void 0,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:l},_=await fetch(h,m);if(!_.ok){const e=await _.json();if(!e||!e.error_code)throw new Error("Unexpected error response from server");throw new NetworkError(e)}return _.json()}}const qt=Dt("GET",e=>`/api/sessions/${e}`),Bt=Dt("POST",()=>"/api/sessions/payment_tokens"),Lt=Dt("POST",()=>"/api/sessions/payment_requests"),Mt=Dt("POST",e=>`/api/sessions/${e.sessionAuthKey}/payment_requests/${e.paymentRequestId}/simulate`),Ot=Dt("GET",e=>`/api/sessions/${e}/poll`,e=>new URLSearchParams(e?{token_request_id:e}:{})),Ut=Dt("POST",e=>`/api/sessions/${e}/card_info`),Kt=Dt("POST",e=>`/api/sessions/${e}/payment_options`);function Vt(e,n,t){return{impl:e,key:n??"",child:t,instance:void 0}}class BehaviorTree{fn;bb;root=Vt(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,Ft(e);const n=this.root??void 0,t=this.fn(this.bb);this.root=t,Wt(n,t,this.bb,0)}}finally{this.updating=!1}}findBehavior(e){return Xt(this.root,e)}}function Ft(e){if(e>32)throw new Error("Max recursion depth exceeded; this is a bug, please contact support.")}function Wt(e,n,t,a){if(Ft(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&&zt(e,a+1),n&&Gt(n,t,a+1);else if(Array.isArray(e)||Array.isArray(n)){Z(e),Z(n);const i=Math.max(e.length,n.length);for(let r=0;r<i;r++)Wt(e[r],n[r],t,a+1)}else n&&(n.instance=e?.instance),e&&(e.instance=void 0),Wt(e?.child,n?.child,t,a+1),n?.instance?.update?.()}function Gt(e,n,t){if(Ft(t),Array.isArray(e))for(const a of e)a&&Gt(a,n,t+1);else e.instance=new e.impl(n,e.key),e.instance.enter?.(),e.child&&Gt(e.child,n,t+1)}function zt(e,n){if(Ft(n),Array.isArray(e))for(const t of e)t&&zt(t,n+1);else e.child&&zt(e.child,n+1),e.instance?.exit?.(),e.instance=void 0}function Xt(e,n){if(Array.isArray(e))for(const t of e){if(!t)continue;const e=Xt(t,n);if(e)return e}else{if(e.impl===n)return e.instance??null;if(e.child)return Xt(e.child,n)}return null}class ActionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){}}const Ht=e=>s("div",{className:"xendit-redirect-instructions",children:[o("div",{className:"xendit-redirect-instructions-logo",children:o("img",{src:e.logoUrl,alt:e.logoAlt})}),s("div",{className:"xendit-redirect-instructions-text",children:[o("div",{className:"xendit-text-16",children:e.title}),e.subtitle?o("div",{className:"xendit-text-14 xendit-text-secondary",children:e.subtitle}):null]}),e.redirectUrl?o("a",{href:e.redirectUrl,className:"xendit-redirect-instructions-button xendit-text-14",children:e.redirectButtonLabel??""}):null]}),$t=e=>{const n=e.t,t=e.channel,a=t.brand_name;return o(Ht,{title:n("action_deeplink.title"),subtitle:n("action_deeplink.instructions",{channelName:a}),logoUrl:t.brand_logo_url,logoAlt:n("image_alt.channel_logo",{channelName:a}),redirectUrl:e.redirectUrl,redirectButtonLabel:n("action_deeplink.button",{channelName:a})})},Yt=e=>{const{title:n,onClose:t,children:a,seamless:i,borderColor:r,noCloseButton:l}=e,c=u(!1),p=u(!1),m=u(null),_=u(null),f=void 0!==HTMLElement.prototype.animate,b=d(()=>{c.current||(c.current=!0,t())},[t]),y=d(()=>{if(!m.current||!_.current||p.current)return;if(p.current=!0,!f)return void b();_.current.animate?.(Jt,Qt);const e=m.current.animate?.(na,Qt);e.onfinish=b},[b,f]);h(()=>{f&&(_.current?.animate?.(Zt,jt),m.current?.animate?.(ea,jt))},[f]),h(()=>{const e=_.current;if(!e)return;const n=e=>{y()};return e.addEventListener(InternalDialogCloseEvent.eventName,n),()=>{e.removeEventListener(InternalDialogCloseEvent.eventName,n)}},[y]);const g=d(e=>{e.target?.dispatchEvent(new InternalDialogCloseEvent)},[]);return h(()=>{e.close&&y()},[e.close,y]),o("div",{className:"xendit-dialog-backdrop",ref:_,children:s("div",{className:"xendit-dialog",ref:m,style:r?{border:`4px solid ${r}`}:void 0,children:[l||i?null:s("div",{className:"xendit-dialog-header xendit-text-16 xendit-text-semibold",children:[n,o("button",{"aria-label":"Close",onClick:y,children:o(D,{name:"x",size:20})})]}),o("div",{className:"xendit-dialog-body",style:e.noPadding?{padding:"0"}:void 0,children:a}),!l&&i?o("button",{"aria-label":"Close",onClick:g,className:"xendit-dialog-floating-close",children:o(D,{name:"x",size:20})}):null]})})};class InternalDialogCloseEvent extends Event{static eventName="xendit-internal-dialog-close";constructor(){super(InternalDialogCloseEvent.eventName,{bubbles:!0})}}const jt={duration:500,easing:"cubic-bezier(.32,.23,0,.92)",fill:"forwards"},Qt={duration:200,easing:"linear",fill:"forwards"},Zt=[{backgroundColor:"rgba(0, 0, 0, 0)"},{backgroundColor:"rgba(0, 0, 0, 0.2)",offset:.1},{backgroundColor:"rgba(0, 0, 0, 0.6)"}],Jt=Zt.slice().reverse(),ea=[{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:0,transform:"scale(0.98) translateY(-40px) rotateX(15deg)"},{opacity:1,transform:""}],na=[{opacity:1,transform:""},{opacity:0,transform:"scale(0.92) translateY(-10px)"}];function ta(e){const{sdk:n,title:t,onClose:a,width:i,height:r,borderColor:s}=e,l=u(null);h(()=>{const e=n.createActionContainerComponent(T);return l.current?.replaceChildren(e),()=>{n.destroyComponent(e)}},[n]);const d=e.defaultActionContainerType===aa.QrWithCustomArt;return o(Yt,{title:t,onClose:a,close:e.close,borderColor:s,noPadding:d,noCloseButton:d,seamless:!0,children:o("div",{className:"xendit-default-action-container",ref:l,style:{width:i?`calc(min(100vw - 64px, ${i}px))`:"calc(100vw - 64px)",height:r?`calc(min(100vh - 64px, ${r}px))`:void 0}})})}var aa;!function(e){e.QrWithCustomArt="qr-with-custom-art",e.Generic="generic"}(aa||(aa={}));class ContainerActionBehavior{bb;cleanupFn=null;defaultContainerHeight=0;defaultContainerWidth=400;title="Complete your payment";constructor(e){this.bb=e}ensureHasActionContainer(e=aa.Generic){if(Q(this.bb.channel),this.bb.sdk[T].liveComponents.actionContainer)return()=>{this.emptyActionContainer()};let n=!1,i=!1;const r=document.createElement("div");r.setAttribute("class","xendit-default-action-container");const o={sdk:this.bb.sdk,title:this.title,width:this.defaultContainerWidth,height:this.defaultContainerHeight,borderColor:void 0,defaultActionContainerType:e,onClose:()=>{n=!0,t(null,r),r.remove(),i||this.bb.sdk.abortSubmission()}};return t(a(ta,o),r),document.body.appendChild(r),e=>{e||(i=!0),n||t(a(ta,{...o,close:!0}),r)}}cleanupActionContainer(e){this.cleanupFn&&(this.cleanupFn(e),this.cleanupFn=null)}emptyActionContainer(){const e=this.bb.sdk[T].liveComponents.actionContainer;e&&t(null,e)}updateActionContainerBrandColor(){Q(this.bb.channel);const e=this.bb.sdk[T].liveComponents.actionContainer;e&&e.style.setProperty("--xendit-channel-brand-color",this.bb.channel.brand_color)}populateActionContainer(e){const n=this.bb.sdk[T].liveComponents.actionContainer;if(!n)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(),t(e(),n)}exit(){this.cleanupActionContainer(!1),this.emptyActionContainer()}}class ActionDeepLinkBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){Q(this.bb.world);const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];if(ee(e?.type,"REDIRECT_CUSTOMER"),"DEEPLINK_URL"!==e.descriptor&&"WEB_URL"!==e.descriptor)throw new Error("Unexpected action type in ActionDeepLinkBehavior");const n=this.bb.sdk.t.bind(this.bb.sdk),t=this.bb.channel;Q(t),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>a($t,{t:n,channel:t,redirectUrl:e.value}))}exit(){super.exit()}}const ia=e=>{const n=e.t,t=e.channel,a=t.brand_name;return o(Ht,{title:n("action_empty_list_push_notification.title"),subtitle:n("action_empty_list_push_notification.subtext",{channelName:a}),logoUrl:t.brand_logo_url,logoAlt:n("image_alt.channel_logo",{channelName:a}),redirectUrl:null,redirectButtonLabel:null})};var ra;function oa(e){return"payment_request_id"in e?{id:e.payment_request_id,type:ra.PaymentRequest,entity:e}:{id:e.payment_token_id,type:ra.PaymentToken,entity:e}}function sa(e,n,t){return`${e===ra.PaymentRequest?"payment_request":"payment_token"}_status.${n.toLowerCase()}.${t}`}!function(e){e.PaymentRequest="REQUEST",e.PaymentToken="TOKEN"}(ra||(ra={}));function la(e,n,t){const{session:a,paymentEntity:i}=e;switch(Q(a),Q(i),Q(n),t){case"PENDING":return da(a);case"PENDING_PAYMENT_ENTITY_ONLY":return function(e,n){const t=n.type===ra.PaymentRequest?n.entity:void 0,a=n.type===ra.PaymentToken?n.entity:void 0;return{session:e,payment_request:ca(t,"PENDING"),payment_token:ca(a,"PENDING")}}(a,i);case"SUCCESS":return"PENDING"===n._mock_action_type?da(a):function(e,n){const t=n.type===ra.PaymentRequest?n.entity:void 0,a=n.type===ra.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:ca(t,"SUCCEEDED"),payment_token:ca(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===ra.PaymentRequest?n.entity:void 0,a=n.type===ra.PaymentToken?n.entity:void 0;return{session:{...e,status:"ACTIVE"},payment_request:ca(t,"FAILED"),payment_token:ca(a,"FAILED")}}(a,i)}}function da(e){return{session:{...e,status:"PENDING"}}}function ca(e,n){return e?{...e,status:n}:e}function ua(e,n){return"PENDING"===n?{payment_request_id:`pr-${_e()}`,status:"PENDING",channel_code:e,actions:[],session_token_request_id:_e()}:n?{payment_request_id:`pr-${_e()}`,status:"REQUIRES_ACTION",channel_code:e,actions:ha(n),session_token_request_id:_e()}:{payment_request_id:`pr-${_e()}`,status:"SUCCEEDED",channel_code:e,actions:[],session_token_request_id:_e()}}function ha(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(){Q(this.bb.world),this.bb.hackyOvoActionLatch=!0;const e=this.bb.sdk.t.bind(this.bb.sdk),n=this.bb.channel;Q(n),this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>a(ia,{t:e,channel:n})),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(la(this.bb.world,this.bb.channel,"PENDING_PAYMENT_ENTITY_ONLY")))}exit(){this.bb.hackyOvoActionLatch=void 0,super.exit()}}function pa(e){const{url:n,channelCode:t,mock:a,onIframeComplete:i}=e,r=u(null),s=d(e=>{if(!r.current)return;const n=r.current.contentWindow;e.source===n&&"xendit-iframe-action-complete"===e.data?.type&&i(e.data)},[i]);if(h(()=>(window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}),[s]),a){const e=ma("CARDS"===t?"a 3DS authentication page":"an authentication page");return o("iframe",{ref:r,srcDoc:e,className:"xendit-action-iframe"})}return o("iframe",{ref:r,src:n,className:"xendit-action-iframe"})}const ma=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(()=>(Q(this.bb.channel),a(pa,{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){Q(this.bb.world?.paymentEntity),this.bb.mock&&this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(la(this.bb.world,this.bb.channel,e)))}exit(){super.exit()}}const _a={format:"CODE128",renderer:"svg",width:2,height:132,displayValue:!0,fontOptions:"",font:"Roboto",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:14,background:"#ffffff",lineColor:"#000000",margin:8},fa=({instructions:e})=>{switch(e.length){case 0:return null;case 1:return o(ba,{instruction:e[0]});default:return o(ya,{instructions:e})}},ba=e=>s("div",{children:[o("p",{className:"xendit-instructions-single-tab-heading",children:e.instruction.title}),o(ga,{instruction:e.instruction})]}),ya=e=>{const[n,t]=p(0);return s("div",{children:[o("div",{className:"xendit-instructions-tab-list",children:e.instructions.map((e,a)=>o("button",{className:b("xendit-instructions-tab-button",{"xendit-instructions-active-tab":n===a}),onClick:()=>t(a),children:e.title},a))}),o(ga,{instruction:e.instructions[n]})]})},ga=e=>o("ol",{className:"xendit-instructions-numbered-list","data-testid":"instructions-steps",children:e.instruction.content.map((e,n)=>{const t=Array.isArray(e)?e:[e];return o("li",{className:"xendit-instructions-step-li",children:o("div",{className:"xendit-instructions-step-box",children:t.map((e,n)=>o(i,{children:ka(e)},n))})},n)})});function va(e){return Array.from(e).map((e,n)=>{switch(e.nodeType){case Node.TEXT_NODE:return null===e.textContent?null:e.textContent;case Node.ELEMENT_NODE:return function(e,n){const t=b({"xendit-instructions-bold":"B"===e.nodeName,"xendit-instructions-italics":"I"===e.nodeName});return t?o("span",{className:t,children:va(e.childNodes)},n):va(e.childNodes)}(e,n);default:return null}})}const xa="undefined"!=typeof DOMParser?new DOMParser:null;function wa(e){try{if(!xa)return e;return va(xa.parseFromString(e,"text/html").body.childNodes)}catch(n){return e}}function ka(e){if("string"==typeof e)return o("p",{className:"xendit-instructions-step-item",children:wa(e)});switch(e.type){case"text":return function(e){return o("p",{children:wa(e.text)})}(e);case"image":return function(e){return o("div",{children:o("img",{src:e.src,alt:e.alt||"",style:{height:`${e.height??24}px`}})})}(e);case"bullets":return function(e){return o("ul",{className:"xendit-instructions-bullet-list",children:e.items.map((e,n)=>o("li",{children:wa(e)},n))})}(e);case"form":return function(e){return s("div",{className:"xendit-instructions-form-card",children:[e.heading?o("h3",{className:"xendit-instructions-form-heading",children:wa(e.heading)}):null,e.fields.map((e,n)=>s("div",{className:"xendit-instructions-form-field",children:[o("div",{className:"xendit-instructions-form-field-label",children:wa(e.label)}),o("div",{className:"xendit-instructions-form-field-value",children:wa(e.value)})]},n))]})}(e);case"table":return function(e){return s("table",{className:"xendit-instructions-table",children:[o("thead",{children:o("tr",{children:e.headers.map((e,n)=>o("th",{className:"xendit-instructions-table-header",children:wa(e)},n))})}),o("tbody",{children:e.rows.map((e,n)=>o("tr",{children:e.map((e,n)=>o("td",{className:"xendit-instructions-table-cell",children:wa(e)},n))},n))})]})}(e)}return null}function Ca(e){const{amount:n,channelLogo:t,currency:a,onAffirm:i,barcodeContent:r,merchantName:l,instructions:c,title:u,t:h}=e,[_,f]=p(!1),b=d(()=>{f(!0),i()},[i]),y=[{heading:h("action_barcode.merchant_name"),value:l},{heading:h("action_barcode.barcode_content"),value:r},{heading:h("action_barcode.amount_to_pay"),value:Ln(n,a)}],g=m(()=>{try{return function(e){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");return A(n,e,_a),n}(r)}catch(e){console.log("Error generating barcode SVG:",e);const n=document.createElement("div");return n.innerText=h("action_barcode.unable_to_generate"),n}},[r,h]);return s("div",{className:"xendit-action-present-to-customer",children:[o("img",{src:t,alt:"Channel Logo",className:"xendit-action-barcode-channel-logo"}),o("div",{className:"xendit-action-title",children:u}),o("div",{"data-testid":"barcode",className:"xendit-action-barcode-barcode-container",role:"button",tabIndex:0,ref:e=>{!e||1===e.childNodes.length&&e.firstChild===g||e?.replaceChildren(g)}}),o("div",{className:"xendit-action-barcode-content",children:o("div",{className:"xendit-action-barcode-details",children:y.map((e,n)=>o("div",{className:"xendit-action-barcode-detail-item",children:s("div",{className:"xendit-action-barcode-detail-content",children:[o("div",{className:"xendit-action-barcode-heading xendit-text-12 xendit-text-semibold",children:e.heading}),o("div",{className:"xendit-action-barcode-value xendit-text-semibold",children:e.value})]})},n))})}),s("div",{className:"xendit-action-present-to-customer-affirm",children:[o(Re,{variant:Pe.WHITE_ROUNDED,disabled:_,onClick:b,className:"xendit-button-block",children:_?o(De,{}):h("action.payment_made")}),o("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:h("action.payment_confirmation_instructions")})]}),o(fa,{instructions:c})]})}class ActionBarcodeBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];ee(e?.type,"PRESENT_TO_CUSTOMER"),Q(this.bb.world),Q(this.bb.channel);const n={amount:this.bb.world.session.amount,channelLogo:this.bb.channel.brand_logo_url,currency:this.bb.world.session.currency,onAffirm:this.affirmPayment.bind(this),barcodeContent:e.value,merchantName:this.bb.world.business.name??"",paymentCode:e.value,instructions:e.instructions??[],title:e.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>a(Ca,n))}affirmPayment(){this.bb.sdk.isProdLive()?this.bb.pollImmediatelyRequested=!0:this.bb.simulatePaymentRequested=!0,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}}class ActionPaylinkBehavior{bb;actionIndex;el=null;constructor(e,n){this.bb=e,this.actionIndex=n}enter(){Q(this.bb.world),Q(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");ee(e.type,"REDIRECT_CUSTOMER"),ee(e.descriptor,"WEB_GOOGLE_PAYLINK");const n=document.createElement("link");n.rel="facilitated-payment",n.href=e.value,this.el=n,document.head.appendChild(n)}exit(){this.el?.remove(),this.el=null}}const Ea={"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"}}}},Na={"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 Aa(e){return/^[\uD800-\uDBFF]$/.test(e)}function Ia(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,Aa(n)?l+=.5:l+=1}t.push({key:a,value:o}),e=e.substring(4+s)}return t}function Sa(e,n,t,a){e[`field${t}`]=a;const i=n[t];if(!i)return;const r="template"===i.type&&i.templateClass?Pa(i.templateClass,a).result:a;e[i.name]=r}function Pa(e,n){const t=Ia(n),a={};for(const{key:n,value:i}of t)Sa(a,e,n,i);return{result:a,raw:t}}function Ta(e,n,t){const a=Ia(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=Na[i];return r&&(e[i]=Pa(r,t).result),e}function Ra(e){return"QRIS"===e?Da:"SGQR"===e?qa:"DUITNOW_QR"===e?Ba:"PROMPTPAY"===e?La:"QRPH"===e?Ma:null}function Da(e){const{channelLogo:n,channelName:t,merchantName:a,amountText:i,t:r,nmid:l}=e,d="#DB4849",c="24px";return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:c,paddingRight:c,overflow:"hidden"},children:[Ua.closeButton({}),o("img",{src:n,alt:r("image_alt.channel_logo",{channelName:t}),style:{height:"64px",alignSelf:"center"}}),s("div",{className:"xendit-text-center xendit-text-16",style:{display:"flex",flexDirection:"column",gap:"4px",marginTop:"16px"},children:[o("div",{className:"xendit-text-semibold",children:a}),l?s("div",{className:"xendit-text-14",children:["NMID: ",l]}):null]}),s("div",{style:{position:"relative",margin:`-${c}`,marginBottom:"0",padding:c},children:[s("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:[e.qr,o("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:c},children:i})]}),o("svg",{style:{position:"absolute",top:"-9%",left:0,width:"60%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:o("polygon",{fill:d,points:"0,0 50,50 0,100"})}),o("svg",{style:{position:"absolute",bottom:0,right:0,width:"30%",height:"auto",pointerEvents:"none"},viewBox:"0 0 100 100",children:o("polygon",{fill:d,points:"0,100 100,100 100,0"})})]})]})}function qa(e){const{merchantName:n,amountText:t,channelLogo:a,channelName:i,t:r}=e;return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:"24px",paddingRight:"24px",overflow:"hidden"},children:[o("img",{src:a,alt:r("image_alt.channel_logo",{channelName:i}),style:{height:"56px",alignSelf:"center",marginBottom:"8px"}}),Ua.closeButton({}),o("div",{style:{padding:"20px",backgroundColor:"white",zIndex:1,position:"relative",borderRadius:"4px",display:"flex",flexDirection:"column",gap:"16px"},children:o("div",{style:{"--xendit-qr-foreground-color":"#7C2279"},children:e.qr})}),o("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),o("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:t}),o("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px",marginBottom:"16px"},children:n})]})}function Ba(e){const{merchantName:n,amountText:t}=e,a="#ED3066";return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"40px",overflow:"hidden"},children:[Ua.closeButton({}),o("div",{className:"xendit-text-center xendit-text-16",children:"Scan To Pay"}),o("div",{className:"xendit-text-semibold xendit-text-center",style:{fontSize:"24px",lineHeight:"24px",marginTop:"12px"},children:t}),o("div",{className:"xendit-text-center xendit-text-16 xendit-text-semibold",style:{marginTop:"8px"},children:n}),s("svg",{viewBox:"0 0 180 180",style:{aspectRatio:"1",margin:"32px 14% 24px"},children:[o("rect",{width:"180",height:"180",fill:a,rx:13}),o("rect",{x:"10",y:"10",width:"160",height:"140",fill:"white",rx:4}),o("path",{d:"M0 180 L20 180 L0 160 Z",fill:a}),o("path",{d:"M10 150 L30 150 L10 130 Z",fill:"white"}),o("foreignObject",{x:"40",y:"30",width:"100",height:"100",children:o("div",{style:{"--xendit-qr-foreground-color":a},children:e.qr})}),o("foreignObject",{x:"0",y:"160",height:"10px",width:"180px",style:{overflow:"visible"},children:o("div",{style:{display:"flex",flexDirection:"column",height:"10px"},children:Ua.malaysiaNationalQrText({width:"auto"})})})]})]})}function La(e){const{merchantName:n,amountText:t,channelLogo:a,channelName:i,t:r}=e;return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",overflow:"hidden"},children:[s("div",{style:{backgroundColor:"#1C3C63",padding:"8px",height:"64px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"},children:[Ua.promptpay({height:"48px"}),Ua.closeButton({color:"white"})]}),s("div",{style:{display:"flex",flexDirection:"column",padding:"0 16px"},children:[o("img",{src:a,alt:r("image_alt.channel_logo",{channelName:i}),style:{height:"56px",alignSelf:"center",marginTop:"16px"}}),o("div",{style:{padding:"16px 42px"},children:e.qr}),s("div",{className:"xendit-text-center xendit-text-semibold",style:{fontSize:"20px",lineHeight:"24px",marginBottom:"12px",display:"flex",flexDirection:"column",gap:"8px"},children:[t,o("div",{className:"xendit-text-16",children:n})]})]})]})}function Ma(e){const{merchantName:n,amountText:t,channelLogo:a,channelName:i,t:r}=e;return s("div",{style:{display:"flex",flexDirection:"column",position:"relative",paddingTop:"24px",paddingLeft:"24px",paddingRight:"24px",paddingBottom:"12px",overflow:"hidden"},children:[o("img",{src:a,alt:r("image_alt.channel_logo",{channelName:i}),style:{height:"48px",alignSelf:"center",marginBottom:"16px"}}),Ua.closeButton({}),s("div",{style:{backgroundColor:"white",border:"4px solid rgb(0,0,0,0.15)",zIndex:1,position:"relative",borderRadius:"12px",display:"flex",flexDirection:"column",gap:"16px",padding:"24px"},children:[s("div",{className:"xendit-text-center",style:{display:"flex",flexDirection:"column",gap:"16px"},children:[o("div",{className:"xendit-text-semibold",style:{fontSize:"20px",lineHeight:"28px"},children:n}),o("div",{className:"xendit-text-bold",style:{fontSize:"24px",lineHeight:"32px"},children:t})]}),s("div",{style:{position:"relative"},children:[e.qr,Ua.qrph({position:"absolute",top:"50%",left:"50%",width:"12%",height:"12%",aspectRatio:"1",transform:"translate(-50%, -50%)",zIndex:"3",backgroundColor:"white",padding:"8px",borderRadius:"6px"})]})]})]})}function Oa(e){e.target?.dispatchEvent(new InternalDialogCloseEvent)}const Ua={closeButton:e=>o("button",{"aria-label":"Close",onClick:Oa,className:"xendit-dialog-floating-close",style:e,children:o(D,{name:"x",size:20})}),sgqr:e=>o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"83",height:"40",fill:"none",style:e,children:o("path",{fill:"#FD0031",d:"M18.395 39.983c-1.224-.14-2.626-.38-3.422-.587-3.582-.931-6.767-2.787-9.275-5.403-2.74-2.858-4.46-6.15-5.268-10.084C.174 22.663 0 21.206 0 20.11c0-1.08.183-2.682.33-3.479.426-2.313 1.002-4.05 1.922-5.793 2.09-3.962 5.07-6.896 8.903-8.768C15.535-.069 20.427-.564 25.188.65c.627.16 1.23.33 1.339.378.109.049.466.189.793.311 1.247.468 4.159 2.023 4.066 2.173-.022.036.02.066.093.066.149 0 .554.297 1.143.838.215.197.408.343.428.323.085-.085 1.9 1.72 2.529 2.515.833 1.051 1.838 2.587 2.344 3.583 1.04 2.045 1.845 4.59 1.99 6.29.034.381.078.827.099.99.301 2.344-.09 5.848-.936 8.368-.52 1.549-1.374 3.302-2.212 4.541-3.84 5.68-9.678 8.864-16.436 8.966-.955.014-1.87.011-2.033-.008m-3.521-11.997a4.97 4.97 0 0 0 2.763-2.024c.525-.767.739-1.481.747-2.498.006-.77-.029-.97-.26-1.464-.625-1.341-1.287-1.932-2.865-2.556-.537-.213-1.018-.387-1.068-.387-.193 0-2.957-.924-3.333-1.114-.519-.262-.864-.535-1.013-.8-.285-.508-.048-1.383.475-1.756.386-.274.82-.588 1.777-.588.68 0 1.93.388 3.025.94 1.057.53 1.241.621 1.339.469.023-.036.182-.319.404-.614.59-.783.897-1.342.832-1.512-.085-.22-.783-.692-1.713-1.16-1.789-.901-4.057-1.193-5.523-.71-1.955.642-3.242 1.871-3.68 3.513-.284 1.066-.054 2.359.603 3.384.707 1.104 1.445 1.467 5.606 2.76 1.291.402 1.656.595 2.01 1.066.822 1.092.13 2.172-1.585 2.47-.81.141-1.74.052-2.655-.255-.72-.241-1.972-.906-2.464-1.308-.154-.127-.335-.23-.401-.23-.097 0-1.142 1.204-1.599 1.843-.146.204.02.414.795 1 .693.525 1.724 1.069 2.591 1.368 1.351.467 3.915.547 5.192.163m13.686.177c1.398-.22 3.134-.984 4.219-1.856l.59-.475.082-.739c.09-.818.026-5.764-.078-5.93-.043-.072-1.146-.106-3.381-.106h-3.317l-.01.619c-.006.34-.028.94-.05 1.331-.024.447.002.737.07.779.059.036.928.06 1.931.05l1.824-.016-.019 1.267c-.021 1.454.04 1.345-1.068 1.891-.412.185-1.417.367-2.231.367-1.306 0-1.558-.027-2.061-.223-.742-.288-1.009-.457-1.592-1.008-.946-.893-1.469-2.297-1.468-3.943 0-1.703.476-2.94 1.52-3.95 1.032-.997 1.761-1.267 3.403-1.262 1.36.005 2.474.36 3.674 1.174.203.138.42.25.48.249.176-.003 1.647-1.844 1.647-2.062 0-.57-2.065-1.734-3.818-2.153-.966-.231-1.233-.256-2.33-.213-.924.035-1.405.103-1.885.266-2.384.811-4.35 2.497-5.259 4.51-.562 1.243-.798 3.178-.597 4.897.233 2.004 1.233 3.701 2.976 5.05.813.63 2.018 1.195 2.979 1.397.96.203 2.775.245 3.769.089m26.951-.466c-.28-.26-.638-.613-.794-.787-.304-.338-.413-.34-.89-.01-.82.568-2.916 1.168-4.076 1.168-1.205 0-3.068-.358-4.134-.95-1.996-1.107-3.6-3.424-3.882-5.96-.421-3.777 1.39-6.944 4.74-8.292 1.087-.438 2.055-.643 3.01-.636 2.095.015 4.211.768 5.616 2 .712.624 1.63 2.082 2.015 3.2.249.723.501 2.097.501 2.73 0 1.134-.536 3.078-1.147 4.157-.187.33-.34.64-.34.687s.279.316.62.598c.999.825 1 .828.322 1.665-.513.634-.805.9-.99.9-.033 0-.29-.212-.57-.47m-3.984-2.258c.727-.362.805-.61.32-1.01-.18-.15-.641-.564-1.023-.922-.863-.809-.804-.931-.554-1.218.144-.165.835-.956.941-1.084.242-.29.67-.002 2.108 1.398.607.592.783.546 1.223-.317.327-.643.352-1.452.384-1.827.023-.269-.013-1.368-.085-1.694-.65-2.936-3.836-4.965-6.546-4.167-1.22.359-2.147.982-2.857 1.92-.874 1.156-1.161 2.046-1.155 3.579.006 1.816.463 2.952 1.676 4.167 1.241 1.243 2.006 1.542 3.833 1.496 1.043-.026 1.204-.056 1.735-.321m8.396 2.254-1.017-.028V12.423l1.711-.002c2.44-.002 6.251.191 7.066.358 1.721.352 2.764 1.24 3.381 2.877.264.699.322 1.883.133 2.702-.157.68-.635 1.63-1.05 2.089-.432.478-1.36 1.107-1.985 1.345-.236.09-.43.224-.43.3 0 .074.211.435.469.803.257.367.788 1.135 1.18 1.707.678.99 1.064 1.533 1.808 2.536.182.247.312.468.288.492-.071.071-2.179.136-2.52.077-.278-.048-.507-.332-2.08-2.579-.974-1.388-1.84-2.562-1.928-2.609-.14-.075-1.422-.117-3.092-.1l-.57.005v2.612c0 2.409-.014 2.616-.174 2.649-.095.02-.63.024-1.19.008m7.165-7.829c.69-.327 1.353-.996 1.544-1.558.337-.987-.015-2.293-.78-2.897-.694-.547-1.127-.627-3.838-.716-1.364-.044-2.515-.044-2.56 0-.06.059-.114 3.938-.073 5.28.004.16.194.173 2.559.173h2.553z"})}),promptpay:e=>s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"158",height:"48",fill:"none",style:e,children:[o("title",{children:"Thai QR Payment"}),o("path",{fill:"#fff",d:"M66.998 27.875h5.312s2.406.204 3.508 1.709c.744 1.015.904 3.592 0 4.825-1.315 1.792-3.508 1.91-3.508 1.91h-2.806v5.93h-2.506zm7.016 4.121c.013-2.277-4.51-1.81-4.51-1.81v3.62s4.495.606 4.51-1.81m1.904 10.253 5.713-14.374h1.804l5.712 14.374h-2.806l-1.203-3.317h-5.211l-1.203 3.317zm8.419-5.428-1.804-5.026-1.804 5.026zm8.72-.2-5.313-8.746h3.107l3.458 5.93 3.458-5.93h3.106l-5.311 8.745v5.63h-2.506zm9.721-8.746h3.508l3.758 10.052 3.758-10.052h3.508v14.374h-2.505V31.795l-3.609 9.148h-2.305l-3.608-9.148V42.25h-2.505zm18.14 0h9.521v2.312h-6.815v3.82h6.414v2.11h-6.414v3.82h6.815v2.313h-9.521zm12.728 14.374V27.875h2.506l5.913 9.851v-9.851h2.506v14.374h-2.506l-5.913-9.85v9.85zm17.339-12.062h-4.41v-2.312h11.426v2.312h-4.41v12.062h-2.606zm-12.199-8.746s-1.371 1.096-4.538 1.125c-4.245-.098-6.073-2.265-7.306-5.755-.933-3.267-.053-9.45 5.368-10.801.12-.03 4.794-1.17 7.856 2.077 3.438 3.814 2.405 10.02.687 11.663-.01.038 2.014 2.208 2.014 2.208l-1.65 1.762zm-2.033-2.122-2.073-2.009 1.746-1.777 2.139 2.021s.849-.739.826-3.423c-.017-1.88-.617-3.54-1.654-4.431-1.354-1.163-3.965-1.431-5.62-.578-1.409.725-2.225 2.063-2.493 4.084-.395 2.711.753 5.79 3.552 6.645 1.247.358 2.568.315 3.577-.532m9.02 2.926V6.061h5.012s1.956-.045 3.107.503c2.368 1.127 2.895 2.537 2.906 4.272.003 3.071-2.906 4.071-2.906 4.071l4.109 7.338h-3.213l-4.003-6.835h-1.905v6.835zm7.065-9.55c1.231-.51 1.773-2.837-.186-3.719-.864-.389-3.772-.301-3.772-.301v4.322s3.204.242 3.958-.301m-80.829-4.02h-5.011V6.06h13.03v2.614h-5.012v13.57h-3.007zM82.432 6.06h2.807v6.635h7.216V6.06h2.806v16.184h-2.806v-6.634h-7.216v6.634h-2.807zm21.749 0h2.105l6.514 16.184h-3.207l-1.503-3.418h-5.713l-1.504 3.418h-3.207zm3.107 9.952-2.055-5.529-2.054 5.529zm7.817-9.952h2.907v16.184h-2.907s.025-16.184 0-16.184"}),o("path",{fill:"#fff",stroke:"#00427a","stroke-width":".879",d:"M12.552 47.472s-5.185-.205-8.519-3.518S.525 35.41.525 35.41V12.59s.221-5.224 3.508-8.544 8.52-3.518 8.52-3.518h22.85s5.209.163 8.519 3.518 3.508 8.545 3.508 8.545v20.708l14.332 14.173z"}),o("path",{fill:"#00a796",d:"M26.602 42.245v-8.544h2.37c2.781 0 3.153-.15 3.766-.957.603-.792.873-1.295.88-3.645.002-1.204 0-2.435 0-2.435l14.799 15.581z"}),o("path",{fill:"#00427a",d:"M10.598 41.825c-2.198-.713-3.83-2.34-4.576-4.563-.281-.838-.315-1.102-.268-5.371.02-1.786.042-5.282 0-5.227h8.519v2.379c0 2.564.1 2.887.85 3.698.661.714 1.243.96 3.553.96h2.613v8.544h-5.045c-4.33 0-4.998-.21-5.646-.42M5.754 18.499c0-4.572.018-6.837.247-7.65.614-2.182 2.227-3.908 4.402-4.714.756-.28 1.048-.38 5.774-.38h5.111v8.544h-2.485c-2.594 0-2.899.105-3.676.886-.748.753-.745 1.127-.854 3.745v2.406h-8.52zm27.862 2.837s.006-1.225 0-2.726c-.01-2.47-.478-2.923-.959-3.427-.48-.505-.668-.874-3.35-.884-.943-.003-2.707 0-2.707 0V5.755h4.25c2.453 0 4.771.063 5.313.145 1.34.204 2.72.892 3.682 1.839.921.906 1.816 2.611 2.017 3.846.073.443.274 2.04.273 3.552-.003 2.768 0 6.199 0 6.199z"})]}),malaysiaNationalQrText:e=>s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"209",height:"19",fill:"none",viewBox:"0 0 209 19",style:e,children:[o("title",{children:"Malaysia National QR"}),o("path",{fill:"#fff",d:"M1.16 14.58q-.56 0-.86-.32t-.3-.88V1.36Q0 .78.32.48.64.16 1.2.16q.5 0 .78.2.3.18.54.64l4.94 9.14h-.64L11.76 1q.24-.46.52-.64.28-.2.78-.2.56 0 .86.32.3.3.3.88v12.02q0 .56-.3.88-.28.32-.86.32-.56 0-.86-.32t-.3-.88V4.12h.44l-4.2 7.66a1.6 1.6 0 0 1-.42.5q-.22.16-.6.16t-.62-.16a1.6 1.6 0 0 1-.42-.5L1.84 4.1h.48v9.28q0 .56-.3.88-.28.32-.86.32m19.643.04q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m11.558 0q-1.66 0-2.5-.94-.84-.96-.84-2.8V1.42q0-.62.32-.94t.92-.32.92.32q.34.32.34.94v9.34q0 .92.38 1.36.4.44 1.12.44h.3l.28-.04q.28-.04.38.16.1.18.1.76 0 .5-.2.78-.201.28-.66.34l-.42.04q-.22.02-.44.02m6.766 0q-1.06 0-1.9-.4a3.45 3.45 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m10.6 3.56q-.44 0-.72-.24a.91.91 0 0 1-.34-.6q-.04-.38.14-.8l1.36-3.02v1.04l-3.64-8.42q-.18-.44-.12-.82a.89.89 0 0 1 .36-.6q.32-.24.86-.24.46 0 .74.22.28.2.5.78l2.7 6.74h-.6l2.76-6.76q.22-.56.52-.76.3-.22.8-.22.44 0 .7.24.26.22.32.6.06.36-.14.8l-4.86 11.1q-.26.56-.56.76t-.78.2m11.932-3.56a10 10 0 0 1-1.82-.18 5.4 5.4 0 0 1-1.72-.62 1.26 1.26 0 0 1-.46-.46 1.14 1.14 0 0 1-.1-.54 1 1 0 0 1 .2-.48.83.83 0 0 1 .44-.26q.28-.06.6.1a7.3 7.3 0 0 0 1.5.54q.7.14 1.38.14.96 0 1.42-.32.48-.34.48-.88 0-.46-.32-.7-.3-.26-.92-.38l-2-.38q-1.24-.24-1.9-.9-.64-.68-.64-1.74 0-.96.52-1.66.54-.7 1.48-1.08t2.16-.38q.88 0 1.64.2.78.18 1.5.58.3.16.4.42.12.26.06.54-.06.26-.24.48a.84.84 0 0 1-.46.26q-.26.04-.6-.12a5.4 5.4 0 0 0-1.2-.46 4.5 4.5 0 0 0-1.08-.14q-.98 0-1.46.34-.46.34-.46.9 0 .42.28.7t.86.38l2 .38q1.3.24 1.96.88.68.64.68 1.72 0 1.46-1.14 2.3-1.14.82-3.04.82m7.926-.06q-.6 0-.92-.36t-.32-1V5.86q0-.66.32-1 .32-.36.92-.36t.92.36q.34.34.34 1v7.34q0 .64-.32 1t-.94.36m0-11.92q-.7 0-1.1-.34-.38-.36-.38-.98 0-.64.38-.98.4-.34 1.1-.34.72 0 1.1.34t.38.98q0 .62-.38.98-.38.34-1.1.34m7.578 11.98q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.24 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.58 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.159-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44a2.9 2.9 0 0 1 1.4 1.34q.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m15.587-.04q-.58 0-.9-.32-.3-.32-.3-.92V1.44q0-.62.3-.94.32-.34.82-.34.46 0 .68.18.24.16.56.56l7.66 9.94h-.52V1.38q0-.58.3-.9.32-.32.9-.32t.88.32.3.9v12q0 .56-.28.88t-.76.32q-.46 0-.74-.18-.26-.18-.58-.58l-7.64-9.94h.5v9.46q0 .6-.3.92t-.88.32m17.241.04q-1.06 0-1.9-.4a3.44 3.44 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.24 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.58 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.76.76 0 0 1-.44-.32 1.05 1.05 0 0 1-.16-.56q0-.3.16-.58.159-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44.94.44 1.4 1.34.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16q-.14.7-.56 1.22a2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m12.697 0q-1.3 0-2.18-.44-.86-.44-1.28-1.28-.42-.86-.42-2.12V6.52h-1.04q-.48 0-.74-.24-.26-.26-.26-.7 0-.46.26-.7t.74-.24h1.04V2.82q0-.62.32-.94.34-.32.94-.32t.92.32.32.94v1.82h2.12q.48 0 .74.24t.26.7q0 .44-.26.7-.26.24-.74.24h-2.12v4.12q0 .96.42 1.44t1.36.48q.34 0 .6-.06t.46-.08q.24-.02.4.16.16.16.16.68 0 .4-.14.72-.12.3-.46.42-.26.08-.68.14-.42.08-.74.08m5.19-.06q-.6 0-.92-.36t-.32-1V5.86q0-.66.32-1 .32-.36.92-.36t.92.36q.34.34.34 1v7.34q0 .64-.32 1t-.94.36m0-11.92q-.7 0-1.1-.34-.38-.36-.38-.98 0-.64.38-.98.4-.34 1.1-.34.72 0 1.1.34t.38.98q0 .62-.38.98-.38.34-1.1.34m8.818 11.98q-1.521 0-2.64-.62a4.33 4.33 0 0 1-1.74-1.76q-.62-1.16-.62-2.72 0-1.18.34-2.1a4.5 4.5 0 0 1 1.02-1.6q.66-.68 1.58-1.02.92-.36 2.06-.36 1.52 0 2.64.62 1.119.62 1.74 1.76.62 1.14.62 2.7 0 1.18-.36 2.12a4.5 4.5 0 0 1-1 1.62q-.66.66-1.58 1.02-.92.34-2.06.34m0-1.9q.74 0 1.3-.36t.86-1.06q.32-.72.32-1.78 0-1.6-.68-2.38-.681-.8-1.8-.8-.74 0-1.3.36-.56.34-.88 1.06-.3.7-.3 1.76 0 1.58.68 2.4.68.8 1.8.8m8.803 1.86q-.6 0-.92-.32-.32-.34-.32-.96V5.74q0-.62.32-.94t.9-.32.9.32.32.94V7.1l-.22-.5q.44-1.06 1.36-1.6.94-.56 2.12-.56t1.94.44 1.14 1.34q.38.88.38 2.24v4.84q0 .62-.32.96-.32.32-.92.32t-.94-.32q-.32-.34-.32-.96V8.58q0-1.14-.44-1.66-.42-.52-1.32-.52-1.1 0-1.76.7-.64.68-.64 1.82v4.38q0 1.28-1.26 1.28m14.179.04q-1.06 0-1.9-.4a3.45 3.45 0 0 1-1.3-1.12 2.8 2.8 0 0 1-.46-1.58q0-1.08.56-1.7.56-.64 1.82-.92t3.38-.28h1v1.44h-.98q-1.239 0-1.98.12t-1.06.42q-.3.28-.3.8 0 .66.46 1.08t1.28.42q.66 0 1.16-.3.52-.32.82-.86t.3-1.24V8.2q0-1-.44-1.44t-1.48-.44q-.579 0-1.26.14-.66.14-1.4.48-.38.18-.68.1a.77.77 0 0 1-.44-.32 1.06 1.06 0 0 1-.16-.56q0-.3.16-.58.16-.3.54-.44a9 9 0 0 1 1.76-.54 8.6 8.6 0 0 1 1.56-.16q1.44 0 2.36.44.94.44 1.4 1.34.46.88.46 2.28v4.8q0 .62-.3.96-.3.32-.86.32t-.88-.32q-.3-.34-.3-.96v-.96h.16a2.8 2.8 0 0 1-.56 1.22 2.7 2.7 0 0 1-1.02.78q-.62.28-1.42.28m11.558 0q-1.66 0-2.5-.94-.84-.96-.84-2.8V1.42q0-.62.32-.94t.92-.32.92.32q.34.32.34.94v9.34q0 .92.38 1.36.4.44 1.12.44h.3l.28-.04q.28-.04.38.16.1.18.1.76 0 .5-.2.78-.201.28-.66.34l-.42.04a5 5 0 0 1-.44.02m21.436 2.06q.28.44.22.8t-.32.6a1.13 1.13 0 0 1-.64.32 1.25 1.25 0 0 1-.76-.08q-.38-.14-.64-.56l-1.38-2.22a1.84 1.84 0 0 0-.76-.7q-.46-.22-1.14-.22l1.98-.78q.94 0 1.5.34.56.32 1.08 1.14zm-5.4-2.06q-2.04 0-3.58-.9-1.52-.9-2.36-2.52-.84-1.64-.84-3.84 0-1.66.48-2.98.48-1.34 1.36-2.28a5.9 5.9 0 0 1 2.14-1.46q1.26-.52 2.8-.52 2.06 0 3.58.9 1.52.88 2.36 2.5t.84 3.82q0 1.66-.48 3a6.5 6.5 0 0 1-1.38 2.3 5.9 5.9 0 0 1-2.14 1.48q-1.24.5-2.78.5m0-2.2q1.3 0 2.2-.6.92-.6 1.4-1.74.5-1.14.5-2.72 0-2.4-1.08-3.72-1.06-1.32-3.02-1.32-1.28 0-2.2.6-.92.58-1.42 1.72-.48 1.12-.48 2.72 0 2.38 1.08 3.72t3.02 1.34m11.163 2.16q-.62 0-.96-.34-.32-.36-.32-.98V1.62q0-.64.34-.96.34-.34.96-.34h4.82q2.32 0 3.58 1.12 1.26 1.1 1.26 3.1 0 1.3-.58 2.24-.56.94-1.64 1.44t-2.62.5l.18-.3h.66q.82 0 1.42.4.621.4 1.08 1.26l1.5 2.78q.24.42.22.82a.93.93 0 0 1-.3.66q-.28.24-.82.24t-.88-.22q-.339-.24-.6-.72l-2.02-3.72q-.36-.68-.86-.9-.48-.24-1.24-.24h-1.9v4.48q0 .62-.32.98-.32.34-.96.34m1.28-7.7h3.12q1.38 0 2.08-.56.72-.58.72-1.72 0-1.12-.72-1.68-.7-.58-2.08-.58h-3.12z"})]}),qrph:e=>s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",style:e,children:[o("path",{fill:"#f4ea11",d:"M21.394 32.393c5.599 0 10.137-4.553 10.137-10.17 0-5.615-4.538-10.168-10.137-10.168s-10.138 4.553-10.138 10.169 4.539 10.169 10.138 10.169"}),o("path",{fill:"#1f4485","fill-rule":"evenodd",d:"m23.73.545 5.235 3.8-5.236 3.799C21.811 8.085 12.962 8.12 9.4 8.136a1.545 1.545 0 0 0-1.54 1.501c-.12 3.68-.401 13.243-.284 18.174H0V7.138C0 .88 6.239.545 6.239.545z","clip-rule":"evenodd"}),o("path",{fill:"#cf2130","fill-rule":"evenodd",d:"M35.649 16.636h7.13V35.41c-.42 4.05-3.48 6.964-7.13 8.046H20.052l-5.347-3.8 5.347-3.352s9.29-.002 13.815-.447q1.177-.51 1.336-1.788a171 171 0 0 0 .446-17.432","clip-rule":"evenodd"})]})};function Ka(e,n){const t=I.create(e),a=S.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 Va(){const e=new Date;return new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",day:"2-digit",month:"2-digit",year:"numeric"}).format(e)}function Fa(e){return e.split("").map(e=>/[a-zA-Z0-9]/.test(e)?e.toLowerCase():"-").join("").replace(/-+/g,"-")}function Wa(e){const{amount:n,businessName:t,channelCodeForQrArt:a,channelName:i,channelLogo:r,currency:c,onAffirm:h,qrString:_,t:f}=e,[b,y]=p(!1),g=d(()=>{y(!0),h()},[h]),v=m(()=>{try{return Ka(_,Ga)}catch(e){console.log("Error generating QR code SVG:",e);const n=document.createElement("div");return n.innerText=f("action_qr.unable_to_generate"),n}},[_,f]),x=m(()=>{try{const e=function(e){const{result:n,raw:t}=Pa(Ea,e);n.merchantAccountInformation={};for(const e of t){const t=Number(e.key);t>=26&&t<=51&&Ta(n.merchantAccountInformation,e.key,e.value)}return n}(_).merchantAccountInformation;if(!e||"string"==typeof e)return;const n=e["ID.CO.QRIS.WWW"];if(!n||"string"==typeof n)return;const t=n.nmid;return"string"==typeof t?t:void 0}catch{return}},[_]),w=u(!1),k=d(e=>{if(e instanceof PointerEvent&&"touch"!==e.pointerType)return;if(w.current)return;e.currentTarget.animate?.([{transform:"scale(1)"},{transform:"scale(0.95)"},{transform:"scale(1)"}],{duration:150,easing:"ease-in-out"});const a=Ka(_,za),r=[Fa(t),Fa(i),Fa(c),Fa(String(n)),Fa(Va())].join("-");w.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"))}})}(a,`${r}.png`).catch(e=>{console.error("Error downloading QR code:",e)})},[n,t,i,c,_]);if(e.hideUi)return o("div",{"data-testid":"qr-code",ref:e=>{!e||1===e.childNodes.length&&e.firstChild===v||e?.replaceChildren(v)}});const C=o("div",{"data-testid":"qr-code",className:"xendit-action-qr-qrcode-container",role:"button",tabIndex:0,onClick:k,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k(e))},ref:e=>{!e||1===e.childNodes.length&&e.firstChild===v||e?.replaceChildren(v)}}),E=s("div",{className:"xendit-action-present-to-customer-affirm",children:[o(Re,{variant:Pe.WHITE_ROUNDED,disabled:b,onClick:g,className:"xendit-button-block",children:b?o(De,{}):f("action.payment_made")}),o("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:f("action.payment_confirmation_instructions")})]}),N=Ln(n,c),A=Ra(a);return A?s(l,{children:[o(A,{channelLogo:r,channelName:i,merchantName:t,amountText:N,qr:C,t:f,nmid:x}),o("div",{style:{padding:"48px",paddingTop:"8px",paddingBottom:"24px"},children:E})]}):s("div",{className:"xendit-action-present-to-customer",children:[o("img",{src:r,alt:f("image_alt.channel_logo",{channelName:i}),className:"xendit-action-qr-channel-logo"}),s("div",{className:"xendit-action-qr-content",children:[o("div",{className:"xendit-text-16 xendit-text-center xendit-qr-merchant-info",children:o("div",{className:"xendit-text-semibold",children:t})}),C,o("div",{className:"xendit-text-16 xendit-text-semibold xendit-text-center",children:N})]}),E]})}const Ga={margin:0,colors:["var(--xendit-qr-foreground-color)","var(--xendit-qr-background-color)"]},za={margin:2,colors:["#000","#FFF"]};class ActionQrBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];ee(e?.type,"PRESENT_TO_CUSTOMER"),Q(this.bb.world),Q(this.bb.channel),Q(this.bb.world.paymentEntity);let n=this.bb.channel.channel_code;this.bb.mock&&"string"==typeof this.bb.channelProperties?.mock_channel_code_for_qr_art&&(n=this.bb.channelProperties.mock_channel_code_for_qr_art);const t=null!==Ra(n);const i=this.bb.sdk[T].liveComponents.actionContainer,r={amount:this.bb.world.session.amount,businessName:this.bb.world.business.name??"",channelCodeForQrArt:n,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:e.value,title:e.action_subtitle,t:this.bb.sdk.t.bind(this.bb.sdk)},o=t?aa.QrWithCustomArt:aa.Generic;this.cleanupFn=this.ensureHasActionContainer(o),this.populateActionContainer(()=>a(Wa,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 Xa=n({fire:()=>{},clear:()=>{},text:""}),Ha=({children:e})=>{const[n,t]=p(""),a=d(e=>{t(e);const n=setTimeout(()=>{t("")},2e3);return()=>clearTimeout(n)},[]),i=d(()=>{t("")},[]);return o(Xa.Provider,{value:{text:n,fire:a,clear:i},children:o("div",{style:{position:"relative"},children:e})})},$a=()=>{const{text:e,clear:n}=c(Xa);return h(()=>{if(e){const e=()=>{n()};return document.body.addEventListener("mousedown",e),()=>{document.body.removeEventListener("mousedown",e)}}},[n,e]),e?o("div",{className:"xendit-tooltip",children:e}):null};function Ya(e){const{amount:n,channelLogo:t,currency:a,onAffirm:i,vaNumber:r,merchantName:l,instructions:c,title:u,t:h}=e,[m,_]=p(!1),f=d(()=>{_(!0),i()},[i]),b=[{heading:h("action_va.merchant_name"),value:l},{heading:h("action_va.virtual_account_number"),value:r,enableCopy:!0},{heading:h("action_va.amount_to_pay"),value:Ln(n,a),enableCopy:!0}];return s("div",{className:"xendit-action-present-to-customer",children:[o("img",{src:t,alt:"Channel Logo",className:"xendit-action-qr-channel-logo"}),o("div",{className:"xendit-action-title",children:u}),o("div",{className:"xendit-action-va-content",children:o("div",{className:"xendit-action-va-details",children:b.map((e,n)=>s("div",{className:"xendit-action-va-detail-item",children:[s("div",{className:"xendit-action-va-detail-content",children:[o("div",{className:"xendit-action-va-heading xendit-text-12 xendit-text-semibold",children:e.heading}),o("div",{className:"xendit-action-va-value xendit-text-semibold",children:e.value})]}),e.enableCopy?s(Ha,{children:[o(ja,{value:e.value,t:h}),o($a,{})]}):null]},n))})}),s("div",{className:"xendit-action-present-to-customer-affirm",children:[o(Re,{variant:Pe.WHITE_ROUNDED,disabled:m,onClick:f,className:"xendit-button-block",children:m?o(De,{}):h("action.payment_made")}),o("div",{className:"xendit-text-12 xendit-text-secondary xendit-text-center",children:h("action.payment_confirmation_instructions")})]}),o(fa,{instructions:c})]})}const ja=({value:e,t:n})=>{const{fire:t}=c(Xa);return s(Re,{variant:Pe.WHITE_ROUNDED,size:Te.SM,onClick:()=>{navigator.clipboard.writeText(e),t(n("action_va.copied_to_clipboard"))},children:[n("action_va.copy"),o(D,{name:"copy",size:16})]})};class ActionVaBehavior extends ContainerActionBehavior{bb;actionIndex;constructor(e,n){super(e),this.bb=e,this.actionIndex=n}enter(){const e=this.bb.world?.paymentEntity?.entity.actions[Number(this.actionIndex)];ee(e?.type,"PRESENT_TO_CUSTOMER"),Q(this.bb.world),Q(this.bb.channel);const n={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:e.value,merchantName:this.bb.world.business.name??"",instructions:e.instructions??[],title:e.action_title,t:this.bb.sdk.t.bind(this.bb.sdk)};this.cleanupFn=this.ensureHasActionContainer(),this.populateActionContainer(()=>a(Ya,n))}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=xe(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=ae(300,n.signal).then(()=>{if(this.bb.mock){const n=we(e).cipherText;try{return JSON.parse(atob(n))}catch{}return{schemes:["VISA"],country_codes:["ID"],require_billing_information:!1}}{const t=we(e).withoutValidationError;return Ut(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(!te(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 ne(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 ne(j),e=this.sdk.nextMockUpdate,this.sdk.nextMockUpdate=null}else try{e=await Ot(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=oa(e.payment_token):e.payment_request&&(n=oa(e.payment_request)),this.onPollResult(e,n),await ne(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(Q(this.bb.world?.paymentEntity),this.bb.world?.paymentEntity.entity.status){case"ACTIVE":case"AUTHORIZED":case"SUCCEEDED":case"PENDING":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(la(this.bb.world,this.bb.channel,"SUCCESS")));break;case"FAILED":case"CANCELED":case"EXPIRED":this.bb.dispatchEvent(new InternalScheduleMockUpdateEvent(la(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(Q(this.bb.world),Q(this.bb.channel),Se(this.bb.channel.form,"credit_card_number")){if(e=xe(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(!we(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 ae(j,i).then(()=>function(e,n){return{channel_code:e,country:n.country,currency:n.currency,amount:n.amount,installment_plans:[{interval:"MONTH",interval_count:1,terms:3,installment_amount:Math.floor(n.amount/3),total_amount:n.amount,description:"Unused",code:"3M",interest_rate:1},{interval:"MONTH",interval_count:1,terms:6,installment_amount:Math.floor(n.amount/6),total_amount:n.amount,description:"Unused",code:"6M",interest_rate:1},{interval:"MONTH",interval_count:1,terms:9,installment_amount:Math.floor(n.amount/9),total_amount:n.amount,description:"Unused",interest_rate:1,code:void 0}]}}(t,n));return Kt(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(!te(e))throw e});this.paymentOptionsRequest={cardNumber:e??void 0,promise:t,abortController:n}}}class SdkActiveBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditInitEvent),this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}exit(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}}class SdkFatalErrorBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditFatalErrorEvent(this.bb.sdkFatalErrorMessage??"Unknown error"))}}class SdkLoadingBehavior{bb;constructor(e){this.bb=e}enter(){}}class SessionActiveBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}exit(){this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}}class SessionCompletedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionCompleteEvent(this.bb.world?.succeededChannel?.channel_code||null))}}class SessionFailedBehavior{bb;constructor(e){this.bb=e}enter(){this.bb.dispatchEvent(new XenditSessionExpiredOrCanceledEvent)}}function Qa(e,n){switch(e.type){case ra.PaymentRequest:n(new XenditPaymentRequestDiscardedEvent(e.id));break;case ra.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(),Q(this.bb.world?.session);const e=this.bb.world.paymentEntity;"COMPLETED"!==this.bb.world.session.status&&e&&Qa(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!==ra.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 ae(j,i),ua(t.channel_code,t._mock_action_type)):await Mt(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(la(this.bb.world,this.bb.channel,"SUCCESS"))),this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)}).catch(e=>{te(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,Q(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&&Qa(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(sa(n,t,"title")),r=a?e(function(e){return`failure_code.${e.toLowerCase()}`}(a),e("failure_code_unknown",{failureCode:a})):e(sa(n,t,"subtext"));return[i,r]}(e,n.type,n.entity.status,n.entity.failure_code),i={type:"FAILURE",code:n.entity.failure_code??"UNKNOWN"}),this.bb.dispatchEvent(new XenditSubmissionEndEvent(t,a,i)),this.submission&&(this.submission?.abortController.abort(new AbortError),this.submission=null),this.bb.submissionRequested=!1,this.bb.dispatchEvent(new InternalNeedsRerenderEvent)}submit(){if(!this.bb.world?.session)throw new Error("Session object missing");if(!this.bb.channel)throw new Error("Channel missing");if(this.bb.instantSubmissionError)return this.bb.submissionRequested=!1,this.submissionError=this.bb.instantSubmissionError,this.bb.instantSubmissionError=null,void this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent);const e="OPTIONAL"===this.bb.world.session.allow_save_payment_method&&this.bb.channel?.allow_save,n=this.bb.channel?.requires_customer_details&&!this.bb.world.customer,t=this.bb.world?.session?.session_type,a=this.bb.channel.channel_code,i=this.bb.channel._mock_action_type,r=this.bb.channelProperties??{},o=new AbortController,s=async function(e,n,t,a,i,r,o,s,l){let d;if(n)switch(t){case"PAY":await ae(j,o.signal),d=ua(a,i);break;case"SAVE":case"SUBSCRIPTION":await ae(j,o.signal),d=function(e,n){return"PENDING"===n?{payment_token_id:`pt-${_e()}`,status:"PENDING",channel_code:e,actions:ha(n),session_token_request_id:_e()}:n?{payment_token_id:`pt-${_e()}`,status:"REQUIRES_ACTION",channel_code:e,actions:ha(n),session_token_request_id:_e()}:{payment_token_id:`pt-${_e()}`,status:"ACTIVE",channel_code:e,actions:[],session_token_request_id:_e()}}(a,i);break;default:throw new Error(`The session type ${t} is not supported.`)}else switch(t){case"PAY":d=await Lt(e,{session_id:e.sessionAuthKey,channel_code:a,channel_properties:r,save_payment_method:s,customer:l},null,null,o.signal);break;case"SAVE":case"SUBSCRIPTION":d=await Bt(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 oa(d)}(this.bb.sdkKey,this.bb.mock,t,a,i,r,o,e?this.bb.channelData?.savePaymentMethod??!1:void 0,n?this.bb.channelData?.customerDetails??{given_names:""}:void 0).then(e=>{switch(this.submission=null,e.type){case ra.PaymentRequest:this.bb.dispatchEvent(new XenditPaymentRequestCreatedEvent(e.id));break;case ra.PaymentToken:this.bb.dispatchEvent(new XenditPaymentTokenCreatedEvent(e.id))}this.bb.dispatchEvent(new InternalUpdateWorldState({paymentEntity:e,sessionTokenRequestId:e.entity.session_token_request_id}))}).catch(e=>{te(e)||(console.error("Submission failed:",e),this.exited||(this.bb.submissionRequested=!1,this.submissionError=e instanceof NetworkError?{text:[e.errorResponse.error_content?.title,e.errorResponse.error_content?.message_1,e.errorResponse.error_content?.message_2].filter(e=>void 0!==e),code:e.errorResponse.error_code}:e,this.bb.dispatchEvent(new InternalBehaviorTreeUpdateEvent)))});this.submission={abortController:o,promise:s}}}function Za(e){switch(e.sdkStatus){case"LOADING":return Vt(SdkLoadingBehavior);case"ACTIVE":return Vt(SdkActiveBehavior,"active",function(e){switch(Q(e.world?.session),e.world.session.status){case"ACTIVE":return Vt(SessionActiveBehavior,"active",e.submissionRequested?function(e){return Q(e.world),Vt(SubmissionBehavior,"submission",e.world.paymentEntity&&null!==e.world.sessionTokenRequestId?function(e){function n(){return Q(e.world?.paymentEntity),re(e.sdk,e.world.paymentEntity.entity.actions)?function(e){Q(e.world?.paymentEntity);const n=re(e.sdk,e.world.paymentEntity.entity.actions);Q(n);const t=e.world.paymentEntity.entity.actions.indexOf(n);return Vt(ActionPaylinkBehavior,String(t))}(e):void 0}if(Q(e.world?.paymentEntity),e.hackyOvoActionLatch&&"PENDING"===e.world.paymentEntity.entity.status)return Vt(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[Vt(ActionEmptyListPushNotificationBehavior,""),n()]);switch(e.world.paymentEntity.entity.status){case"PENDING":return Vt(PaymentEntityPendingBehavior);case"REQUIRES_ACTION":return Vt(PaymentEntityRequiresActionBehavior,e.world.paymentEntity.id,[Ja(e),n()]);case"FAILED":case"EXPIRED":case"CANCELED":return Vt(PaymentEntityFailedBehavior);case"ACCEPTING_PAYMENTS":throw new Error("Status ACCEPTING_PAYMENTS should not happen");case"AUTHORIZED":case"ACTIVE":case"SUCCEEDED":return Vt(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 ht(e,n.form,t,a))if(Gn(i,t))return!1;const i=n.card?.brands,r=a?.cardDetails?.details?.schemes;if(i?.length&&r?.length){const e=i.map(e=>e.name);if(!r.some(n=>e.includes(n)))return!1}return!0}(e.world.session.session_type,e.channel,e.channelProperties,e.channelData),t=e.channel.requires_customer_details&&!e.world.customer;let a=!0;t&&(a=0!==e.channelData?.customerDetails?.given_names?.trim().length);const i=Vt(n&&a?ChannelValidBehavior:ChannelInvalidBehavior),r=Se(e.channel.form,"credit_card_number")?Vt(CardInfoBehavior,e.channel.channel_code):void 0,o=Se(e.channel.form,"installment_plan")?Vt(PaymentOptionsBehavior,e.channel.channel_code):void 0;return[i,r,o]}(e));case"COMPLETED":return Vt(SessionCompletedBehavior);case"EXPIRED":case"CANCELED":return Vt(SessionFailedBehavior,e.world.session.status);case"PENDING":return Vt(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 Vt(SdkFatalErrorBehavior);default:throw e.sdkStatus,new Error(`Unknown SDK status: ${e.sdkStatus}`)}}function Ja(e){if(Q(e.world?.paymentEntity),e.actionCompleted)return Vt(ActionCompletedBehavior);const n=ie(e.world.paymentEntity.entity.actions);if(!n)return Vt(ActionEmptyListPushNotificationBehavior,"");const t=e.world.paymentEntity.entity.actions.indexOf(n),a=!!re(e.sdk,e.world.paymentEntity.entity.actions);let i;switch(e.simulatePaymentRequested&&be(n)&&(i=Vt(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)?Vt(ActionIframeBehavior,n.value):a?Vt(ActionDeepLinkBehavior,String(t)):Vt(ActionRedirectBehavior,n.value);case"DEEPLINK_URL":return Vt(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 Vt(ActionQrBehavior,String(t),i);case"PAYMENT_CODE":return Vt(ActionBarcodeBehavior,String(t),i);case"VIRTUAL_ACCOUNT_NUMBER":return Vt(ActionVaBehavior,String(t),i)}break;case"API_POST_REQUEST":switch(n.descriptor){case"CAPTURE_PAYMENT":case"VALIDATE_OTP":case"RESEND_OTP":throw new Error(`Unsupported action type ${n.type} ${n.descriptor}`)}}throw new Error(`Unknown action type: ${n.type} ${n.descriptor}`)}class XenditComponents extends EventTarget{t=e=>{throw new Error("Localization used before initialization; this is a bug.")};[T];constructor(e){if(super(),"undefined"==typeof window||"undefined"==typeof document)throw new Error("XenditComponents can only be instantiated in a browser");if("null"===window.location.origin)throw new Error("XenditComponents cannot be used when the page origin is null");const n=function(e){if(!e)throw new Error("The componentsSdkKey option is missing; check the constructor parameters.");const n=e.split("-");if(n.length<4||n[2]!==oe&&null===le(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[T]={sdkKey:n,options:e,worldState:null,liveComponents:{channelPicker:null,paymentChannels:new Map,actionContainer:null,digitalWalletContainer:new Map},behaviorTree:new BehaviorTree(Za,{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},Ae(this),this.addEventListener("fatal-error",e=>{const n=e;this[T].eventListenersPresent.get("fatal-error")||console.error(`XenditComponents: A "fatal-error" event occurred but no event listener was attached: ${n.message}`)}),this[T].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 qt(this[T].sdkKey,this[T].sdkKey.sessionAuthKey),e.channels=e.channels.filter(e=>Ie[e.channel_code])}catch(e){return this[T].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[T].behaviorTree.bb.sdkFatalErrorMessage=ye(e),void this.behaviorTreeUpdate()}this.dispatchEvent(new InternalUpdateWorldState({business:e.business,customer:e.customer,session:e.session,channels:e.channels,channelUiGroups:e.channel_ui_groups,digitalWallets:e.digital_wallets??null,paymentEntity:null,sessionTokenRequestId:null,succeededChannel:e.succeeded_channel??null}))}assertInitialized(){if(!this[T].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[T].sdkKey.hostId}isDevelopmentEnv(){return"pd"===this[T].sdkKey.hostId||"sd"===this[T].sdkKey.hostId}supportsSimulationScenarios(){return this.isMock()||this.isDevelopmentEnv()}findChannel(e){this.assertInitialized();return this[T].worldState.channels.find(n=>n.channel_code===e)??null}onUpdateWorldState(e){const n=e.data;this[T].worldState=de(this[T].worldState??{},n);const t=this[T].worldState.session.locale;this.t=function(e){const n=Kn[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[T].liveComponents.paymentChannels.get(n);a&&(a.data=de(a.data,t),this.behaviorTreeUpdate(),this.rerenderAllComponents())}behaviorTreeUpdate(){const e=this[T].behaviorTree.bb;if("LOADING"===e.sdkStatus&&this[T].worldState&&(e.sdkStatus="ACTIVE"),e.world=this[T].worldState,this[T].currentDigitalWalletSubmission)e.channel=this.findChannel(this[T].currentDigitalWalletSubmission.channelCode),e.channelProperties=this[T].currentDigitalWalletSubmission.channelProperties,e.channelData=null,e.channelIsDigitalWallet=!0,e.instantSubmissionError=this[T].currentDigitalWalletSubmission.instantSubmissionError;else{const n=this[T].currentChannelCode?this[T].liveComponents.paymentChannels.get(this[T].currentChannelCode):null;e.channel=n?Ee(n.channel[T],n.data.savePaymentMethod):null,e.channelProperties=n?n.channelProperties:null,e.channelData=n?n.data:null,e.channelIsDigitalWallet=!1}try{this[T].behaviorTree.update()}catch(e){this[T].behaviorTree.bb.sdkStatus="FATAL_ERROR",this[T].behaviorTree.bb.sdkFatalErrorMessage=ye(e),this[T].behaviorTree.update()}}getSdkStatus(){return this[T].behaviorTree.bb.sdkStatus}rerenderAllComponents(){this.renderChannelPicker();for(const e of this[T].liveComponents.paymentChannels.keys())this.renderPaymentChannel(e);for(const e of this[T].liveComponents.digitalWalletContainer.keys())this.renderDigitalWalletComponent(e)}getSession(){return this.assertInitialized(),Ue(this[T].worldState.session)}getCustomer(){return this.assertInitialized(),this[T].worldState.customer?(e=this[T].worldState.customer)?(ee(e.type,"INDIVIDUAL"),Q(e.individual_detail),{id:e.id,type:e.type,email:e.email??void 0,mobileNumber:e.mobile_number??void 0,individualDetail:{givenNames:e.individual_detail.given_names??void 0,surname:e.individual_detail.surname??void 0}}):null:null;var e}getActiveChannelGroups(e){return this.assertInitialized(),function(e,n,t){const a=We(n),i=ze(e,t);return n.filter(e=>i[e.id]?.length).map(e=>Ke(e,i,a,t))}(this[T].worldState.channels,this[T].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[T].worldState.session,pairChannels:Xe(this[T].worldState.channels)})}getActiveChannels(e){return this.assertInitialized(),function(e,n,t){const a=We(n),i=ze(e,t);return e.filter(e=>Ge(e,t)).map(e=>Fe(e,i,a,t))}(this[T].worldState.channels,this[T].worldState.channelUiGroups,{options:{filter:e?.filter,filterMinMax:e?.filterMinMax??!0},session:this[T].worldState.session,pairChannels:Xe(this[T].worldState.channels)})}createChannelPickerComponent(){this[T].liveComponents.channelPicker&&this.destroyComponent(this[T].liveComponents.channelPicker);const e=document.createElement("xendit-channel-picker");return e.setAttribute("translate","no"),this[T].liveComponents.channelPicker=e,this[T].worldState&&this.renderChannelPicker(),this.setupUiEventsForChannelPicker(e),e}renderChannelPicker(){this.assertInitialized();const e=this[T].liveComponents.channelPicker;e&&t(a(Y,{data:this[T].worldState,sdk:this,children:a(tn,{})}),e)}setupUiEventsForChannelPicker(e){e.addEventListener(XenditClearCurrentChannelEvent.type,e=>{this.assertInitialized();const n=e,t=this[T].currentChannelCode;if(!t)return;const a=this[T].worldState.channels.find(e=>e.channel_code===t);a&&a.ui_group===n.uiGroup&&this.setCurrentChannel(null)})}createChannelComponent(e,n=!0){if(this.assertInitialized(),!Ne(this[T].worldState.session,e[T][0]))throw new Error("Cannot create channel component: `session.amount` is outside of the channel's min/max amount.");const t=e[T][0].channel_code;n&&(this[T].currentChannelCode=t);const a=this[T].liveComponents.paymentChannels.get(t),i=r(),o=r();let s;return a?s=a.element:(s=document.createElement("xendit-payment-channel"),s.setAttribute("data-channel-code",t),s.setAttribute("inert",""),s.setAttribute("translate","no"),s.style.setProperty("--xendit-channel-brand-color",e[T][0].brand_color),this.setupUiEventsForPaymentChannel(s),this[T].liveComponents.paymentChannels.set(t,{element:s,channel:e,channelProperties:null,channelFormRef:i,customerDetailsFormRef:o,data:{savePaymentMethod:!1,cardDetails:null,paymentOptions:null,customerDetails:e[T][0].requires_customer_details?{given_names:""}:null}})),this.renderPaymentChannel(t),n&&(this.behaviorTreeUpdate(),this.syncInertAttribute()),this.dispatchEvent(new InternalNeedsRerenderEvent),s}renderPaymentChannel(e){this.assertInitialized();const n=this[T].liveComponents.paymentChannels.get(e);if(!n)return;const i=n.channel;t(a(Y,{data:this[T].worldState,sdk:this,children:a(St,{channelOrPair:i[T],channelData:n.data,savePaymentMethod:n.data.savePaymentMethod,formRef:n.channelFormRef,customerDetailsFormRef:n.customerDetailsFormRef})}),n.element)}getActiveDigitalWallets(){return this.assertInitialized(),this[T].worldState.digitalWallets?function(e,n,t,a){const i=[],r=We(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 Q(t),t}),o=ze(t,a);i.push({digitalWalletCode:"GOOGLE_PAY",get channels(){return t.map(e=>Fe(e,o,r,a))},[T]:!0})}return i}(this[T].worldState.digitalWallets,this[T].worldState.channels,this[T].worldState.channelUiGroups,{options:{filterMinMax:!1},pairChannels:Xe(this[T].worldState.channels),session:this[T].worldState.session}):[]}createDigitalWalletComponent(e,n){this.assertInitialized();const t=this[T].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[T].liveComponents.digitalWalletContainer.set(e,{element:a,options:n}),this.renderDigitalWalletComponent(e),a}renderDigitalWalletComponent(e){this.assertInitialized();const n=this[T].liveComponents.digitalWalletContainer.get(e);n&&t(a(Y,{data:this[T].worldState,sdk:this,children:a(Je,{digitalWalletCode:e,digitalWalletOptions:n.options})}),n.element)}getCurrentChannel(){const e=this[T].currentChannelCode;return e?this.getActiveChannels().find(n=>{if(n.channelCode===e||Array.isArray(n.channelCode)&&n.channelCode.includes(e))return!0})??null:null}setCurrentChannel(e){if(this[T].behaviorTree.bb.submissionRequested)throw new Error("Cannot change the payment channel while a submission is in progress.");const n=this[T].currentChannelCode,t=e?.[T][0].channel_code??null;if(n!==t){if(this[T].currentChannelCode=t,e&&t){(this[T].liveComponents.paymentChannels.get(t)??null)||this.createChannelComponent(e,!1)}this.behaviorTreeUpdate(),this.syncInertAttribute(),this.renderChannelPicker()}}syncInertAttribute(){const e=this[T].behaviorTree.bb.submissionRequested,n=this[T].liveComponents.paymentChannels;for(const[t,a]of n){(Array.isArray(a.channel.channelCode)?a.channel.channelCode[0]:a.channel.channelCode)!==this[T].currentChannelCode||e?a.element.setAttribute("inert",""):a.element.hasAttribute("inert")&&a.element.removeAttribute("inert")}const t=this[T].liveComponents.channelPicker;t&&(e?t.setAttribute("inert",""):t.removeAttribute("inert"))}setupUiEventsForPaymentChannel(e){e.addEventListener(XenditChannelPropertiesChangedEvent.type,e=>{const n=e,t=n.channel,a=this[T].liveComponents.paymentChannels.get(t);a&&(a.channelProperties=n.channelProperties,this.behaviorTreeUpdate())})}showValidationErrors(){if(!this[T].behaviorTree.findBehavior(ChannelInvalidBehavior))return;const e=this[T].currentChannelCode;if(!e)return;const n=this[T].liveComponents.paymentChannels.get(e);if(!n)throw new Error("Current channel is set but component is missing; this is a bug, please contact support.");const t=n.channelFormRef.current;t?.setAllFieldsTouched();const a=n.customerDetailsFormRef.current;a?.setAllFieldsTouched()}createActionContainerComponent(e){this.assertInitialized();const n=e===T,t=n?void 0:e,a=this[T].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[T].liveComponents.actionContainer&&this.destroyComponent(this[T].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[T].liveComponents.actionContainer=i,i}destroyComponent(e){if(!e.tagName.startsWith("XENDIT-"))throw new Error("Unable to destroy component; only elements created by this SDK can be destroyed.");if(this[T].liveComponents.channelPicker===e)return this[T].liveComponents.channelPicker=null,t(null,e),void e.remove();for(const[n,a]of this[T].liveComponents.paymentChannels)if(a.element===e)return this[T].liveComponents.paymentChannels.delete(n),this[T].currentChannelCode===n&&this.setCurrentChannel(null),t(null,e),void e.remove();if(this[T].liveComponents.actionContainer===e)return this[T].liveComponents.actionContainer=null,t(null,e),void e.remove();for(const[n,a]of this[T].liveComponents.digitalWalletContainer)if(a.element===e)return this[T].liveComponents.digitalWalletContainer.delete(n),t(null,e),void e.remove();throw new Error("Unable to destroy component; component not found. It may have already been destroyed.")}submit(){this.assertInitialized();if(!this[T].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[T].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[T].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[T].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[T].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[T].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}submitDigitalWallet(e,n,t,a=null){this.assertInitialized(),this.setCurrentChannel(null),this[T].currentDigitalWalletSubmission={digitalWalletCode:e,channelCode:n[T][0].channel_code,channelProperties:t,instantSubmissionError:a},this.addEventListener(XenditSubmissionEndEvent.type,()=>{this[T].currentDigitalWalletSubmission=null},{once:!0}),this[T].behaviorTree.bb.submissionRequested=!0,this.behaviorTreeUpdate(),this.syncInertAttribute()}abortSubmission(){this.assertInitialized();this[T].behaviorTree.findBehavior(SubmissionBehavior)&&(this[T].behaviorTree.bb.submissionRequested=!1,this.behaviorTreeUpdate())}simulatePayment(){if(this.assertInitialized(),"PAY"!==this[T].worldState.session.session_type)throw new Error('Unable to simulate payment, the session type is not "PAY".');if(!this[T].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[T].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=ie(e.entity.actions);if(!n||!be(n))throw new Error("Unable to simulate payment; the action does not support simulation.");this[T].behaviorTree.bb.simulatePaymentRequested=!0,this.behaviorTreeUpdate()}pollImmediately(){if(this.assertInitialized(),"ACTIVE"!==this[T].worldState.session.status)throw new Error("Unable to poll immediately; the session is not longer active.");this[T].behaviorTree.bb.pollImmediatelyRequested=!0,this.behaviorTreeUpdate()}getState(){const e=this[T].currentChannelCode,n=this[T].liveComponents.paymentChannels.get(e??"");return{channelCode:e,channelProperties:n?.channelProperties||null,behaviorTree:this[T].behaviorTree}}addEventListener(e,n,t){return this[T].eventListenersPresent.set(e,!0),super.addEventListener(e,n,t)}removeEventListener(e,n,t){return super.removeEventListener(e,n,t)}static amountFormat=ei}class XenditComponentsTest extends XenditComponents{nextMockUpdate=null;constructor(e){super({...e,componentsSdkKey:`session-${me(32)}-mock-MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEyCADI5pdf6KmN8+Fxl2ES3yolUKXunNeY3gGScGNEvDcrcHAPKxIInAo5DVnDvTtYtqZvx/bu7HLeBJNMXwHhie/uyNEtT8dSaLc9bd0WSlYdxI+iUsTv2Qu0LiiPrZs-NKf7whM9meUs/eRCvG0oc180MDiyeli3kH6EQ3ZahECHsZQi5G2IpH6vk3cYMtf01Y1L4OBn1SZCOv1kwpjIUet4DJeoTwwq2nM5b+K7rD+/WFTi3AEX4NWJNkKi0a91`}),this.addEventListener(InternalScheduleMockUpdateEvent.type,this.setNextMockUpdate.bind(this))}async initializeAsync(){await ne(j);const e=(await import("./test-data.mjs")).makeTestBffData();this.dispatchEvent(new InternalUpdateWorldState({business:e.business,customer:e.customer,session:e.session,channels:e.channels,channelUiGroups:e.channel_ui_groups,digitalWallets:e.digital_wallets??null,paymentEntity:null,sessionTokenRequestId:null,succeededChannel:null}))}isMock(){return!0}setNextMockUpdate(e){const n=e;this.nextMockUpdate=n.mockData}}function ei(e,n){return Ln(e,n)}"undefined"==typeof window||"undefined"==typeof document||(P||(P=!0,e.debounceRendering=e=>queueMicrotask(e)),function(){const e=document.createElement("style");e.textContent="/* variables */\n:root {\n --xendit-font-family: sans-serif;\n --xendit-color-primary: #1762ee;\n --xendit-color-text: #252525;\n --xendit-color-text-secondary: #585858;\n --xendit-color-text-placeholder: #7d7d7d;\n --xendit-color-disabled: #f7f7f7;\n --xendit-color-danger: #d1414d;\n --xendit-color-border: #f3f3f3;\n --xendit-color-background: #ffffff;\n --xendit-focus-shadow: 0px 0px 0px 2px\n color-mix(in srgb, var(--xendit-color-primary) 15%, transparent);\n --xendit-card-shadow: 0px 4px 8px 0px #25252514;\n --xendit-dialog-shadow: 8px 8px 12px 8px #25252529;\n --xendit-animation-duration: 0.3s;\n --xendit-animation-ease: ease-in-out;\n --xendit-radius-1: 8px;\n --xendit-z-index-focus: 2;\n --xendit-z-index-overlay: 3;\n\n /* Browser-specific border collapse margins */\n --xendit-border-collapse-offset: -0.5px; /* Default for Chrome/Edge */\n --xendit-border-collapse-webkit-gecko: -1.5px; /* Fix Safari and Firefox subpixel rendering */\n\n /* QR code colors */\n --xendit-qr-foreground-color: #000000;\n --xendit-qr-background-color: #ffffff;\n\n /* icon colors */\n --xendit-color-icon-primary: #7c7c7c;\n --xendit-color-icon-secondary: #f1f1f1;\n}\n\n/* Set default font for root components */\nxendit-channel-picker,\nxendit-action-container,\nxendit-payment-channel {\n display: block;\n unicode-bidi: isolate;\n font-family: var(--xendit-font-family);\n color: var(--xendit-color-text);\n touch-action: manipulation;\n transition: filter var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-default-action-container {\n font-family: var(--xendit-font-family);\n touch-action: manipulation;\n}\n\nxendit-action-container {\n position: relative;\n flex: 1; /* Action container usually wants to stretch to fit, assuming the parent is a flexbox. */\n touch-action: manipulation;\n}\n\nxendit-payment-channel button,\nxendit-payment-channel textarea,\nxendit-payment-channel select,\nxendit-payment-channel input,\nxendit-payment-channel input::placeholder {\n font-family: inherit;\n}\n\nxendit-payment-channel input::placeholder,\nxendit-payment-channel textarea::placeholder,\nxendit-payment-channel select::placeholder {\n color: var(--xendit-color-text-placeholder);\n}\n\n/* Reusable typography classes */\n.xendit-text-12 {\n font-size: 12px;\n line-height: 16px;\n letter-spacing: -0.01px;\n}\n\n.xendit-text-14 {\n font-size: 14px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-16 {\n font-size: 16px;\n line-height: 16px;\n letter-spacing: -0.09px;\n}\n\n.xendit-text-18 {\n font-size: 18px;\n line-height: 24px;\n letter-spacing: -0.26px;\n}\n\n.xendit-text-20 {\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -0.33px;\n}\n\n.xendit-text-12,\n.xendit-text-14,\n.xendit-text-16 {\n font-weight: 400;\n}\n\n.xendit-text-semibold {\n font-weight: 600;\n}\n\n.xendit-text-bold {\n font-weight: 700;\n}\n\n.xendit-text-link {\n color: var(--xendit-color-primary);\n}\n.xendit-text-secondary {\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-text-center {\n text-align: center;\n}\n\n.xendit-dotted-line {\n height: 1px;\n border: none;\n background: repeating-linear-gradient(\n to right,\n var(--xendit-color-border) 0px 4px,\n transparent 4px 8px\n );\n margin: 0;\n}\n\n/* Accordion component */\n\n.xendit-accordion {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n background: var(--xendit-color-background);\n}\n\n.xendit-accordion-item:not(:first-child) {\n border-top: 1px solid var(--xendit-color-border);\n border-top-left-radius: var(--xendit-radius-1);\n border-top-right-radius: var(--xendit-radius-1);\n}\n\n.xendit-accordion-item-header {\n display: grid;\n grid-template-columns: auto 1fr auto;\n grid-gap: 16px;\n align-items: center;\n cursor: pointer;\n padding: 24px 16px;\n color: var(--xendit-color-text);\n border-radius: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.xendit-accordion-item-header-title {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-header-title,\n.xendit-accordion-item-disabled .xendit-accordion-item-header-icon {\n opacity: 0.5;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-header {\n color: var(--xendit-color-primary);\n}\n\n.xendit-accordion-item-chevron {\n color: var(--xendit-color-text);\n}\n\n.xendit-accordion-item-disabled .xendit-accordion-item-chevron {\n display: none;\n}\n\n.xendit-accordion-item-chevron g {\n transition: transform var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item-header:focus-visible {\n border-radius: 8px;\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n}\n\n.xendit-accordion-item-content {\n overflow: hidden;\n transition: height var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n\n.xendit-accordion-item.xendit-accordion-item-closed\n .xendit-accordion-item-content {\n height: 0;\n}\n\n.xendit-accordion-item.xendit-accordion-item-open\n .xendit-accordion-item-content {\n height: calc-size(auto, size);\n}\n\n.xendit-accordion-item-padding {\n padding: 16px;\n}\n\n/* Channel picker digital wallet section */\n\n.xendit-channel-picker-digital-wallet-section {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n gap: 8px;\n margin-bottom: 8px;\n}\n\n/* Channel picker group */\n\n.xendit-channel-picker-group {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-picker-group select {\n border: 1px solid var(--xendit-color-border);\n border-radius: 8px;\n padding: 12px;\n appearance: none;\n outline: none;\n}\n\n.xendit-channel-picker-group select:focus {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-channel-logo {\n width: 24px;\n height: 16px;\n margin: -5px 0;\n padding: 4px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n object-fit: contain;\n}\n\n/* Payment channel */\n\nxendit-payment-channel[inert],\nxendit-channel-picker[inert] {\n filter: opacity(0.5) grayscale(1);\n}\n\n.xendit-payment-channel {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-payment-channel-banner {\n width: 100%;\n height: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 12px;\n color: var(--xendit-color-text-secondary);\n}\n\n.xendit-payment-channel-instructions-logo {\n height: 40px;\n width: auto;\n object-fit: contain;\n}\n\n.xendit-payment-channel-instructions-text {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 4px;\n}\n\n.xendit-payment-channel-instructions-text p {\n margin: 0;\n}\n\n/* Forms */\n\n.xendit-channel-form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.xendit-channel-form > form {\n display: contents;\n}\n\n.xendit-form-field-group {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.xendit-channel-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group {\n display: grid;\n gap: 8px;\n}\n\n.xendit-channel-form-field-group-label-container {\n display: flex;\n justify-content: space-between;\n gap: 16px;\n}\n\n.xendit-channel-form-field-group label {\n width: fit-content;\n cursor: pointer;\n}\n\n.xendit-form-field-group.invalid\n .xendit-channel-form-field\n .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-danger);\n}\n\n.xendit-channel-form-field .xendit-form-field-inner {\n border: 1px solid var(--xendit-color-border);\n background: var(--xendit-color-background);\n border-radius: 8px;\n appearance: none;\n}\n\n.xendit-channel-form-field.field-radius-tl-0 .xendit-form-field-inner {\n border-top-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-tr-0 .xendit-form-field-inner {\n border-top-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-bl-0 .xendit-form-field-inner {\n border-bottom-left-radius: 0;\n}\n\n.xendit-channel-form-field.field-radius-br-0 .xendit-form-field-inner {\n border-bottom-right-radius: 0;\n}\n\n.xendit-channel-form-field.field-collapse-l,\n.xendit-channel-form-field.field-collapse-l {\n margin-left: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-r,\n.xendit-channel-form-field.field-collapse-r {\n margin-right: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: calc(var(--xendit-border-collapse-offset) * 2);\n width: calc(100% + abs(var(--xendit-border-collapse-offset) * 2));\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container {\n margin-right: 0;\n}\n\n.xendit-channel-form-field.field-collapse-t .xendit-form-field-inner {\n margin-top: var(--xendit-border-collapse-offset);\n}\n\n.xendit-channel-form-field.field-collapse-b .xendit-form-field-inner {\n margin-bottom: var(--xendit-border-collapse-offset);\n}\n\n/* Safari and Firefox specific adjustments */\n@supports (font: -apple-system-body) or (-moz-appearance: none) {\n .xendit-channel-form-field.field-collapse-l .xendit-iframe-container {\n margin-left: 0;\n width: 100%;\n }\n\n .xendit-channel-form-field.field-collapse-b input,\n .xendit-channel-form-field.field-collapse-b button {\n margin-bottom: var(--xendit-border-collapse-webkit-gecko);\n height: calc(100% + abs(var(--xendit-border-collapse-webkit-gecko) * 2));\n }\n}\n\n.xendit-channel-form-field.field-collapse-r .xendit-iframe-container:focus {\n border-right: none;\n}\n\n.xendit-channel-form-field.field-collapse-l .xendit-iframe-container:focus {\n border-left: none;\n}\n\n.xendit-card-brand-logo {\n width: 24px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n padding: 4px;\n background-color: white; /* always white, not --xendit-color-background */\n}\n\n.xendit-card-brands-list {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n gap: 4px;\n}\n\n.xendit-channel-form-field .xendit-form-field-inner:focus,\n.xendit-channel-form-field .xendit-form-field-inner.xendit-field-focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-channel-form-field button.xendit-dropdown-open {\n z-index: var(--xendit-z-index-focus);\n}\n\n.xendit-channel-form-field input.xendit-form-field-inner {\n padding: 12px;\n}\n\n.xendit-channel-form-field .xendit-iframe-container {\n display: flex;\n height: 40px;\n width: 100%;\n padding: 0;\n overflow: hidden;\n box-sizing: border-box;\n}\n\n.xendit-channel-form-field .xendit-iframe-container iframe {\n height: 40px;\n width: 100%;\n border: none;\n min-width: 0;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-1 {\n grid-column: span 1;\n}\n\n.xendit-channel-form-field.xendit-form-field-span-2 {\n grid-column: span 2;\n}\n\n.xendit-checkbox {\n display: flex;\n align-items: center;\n}\n\n.xendit-checkbox-box {\n display: flex;\n}\n\n.xendit-checkbox input {\n width: 16px;\n height: 16px;\n margin: 0;\n cursor: pointer;\n}\n\n.xendit-checkbox label {\n cursor: pointer;\n padding-left: 8px;\n}\n\n.xendit-checkbox input {\n opacity: 0;\n position: absolute;\n}\n\n.xendit-checkbox input + .xendit-checkbox-graphic {\n width: 16px;\n height: 16px;\n border: 1px solid var(--xendit-color-border);\n border-radius: 4px;\n box-sizing: border-box;\n color: transparent;\n}\n\n.xendit-checkbox input:checked + .xendit-checkbox-graphic {\n color: var(--xendit-color-background);\n background-color: var(--xendit-color-primary);\n border-color: var(--xendit-color-primary);\n}\n\n.xendit-checkbox input:focus + .xendit-checkbox-graphic {\n border: 1px solid var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n/* Dialog */\n\n.xendit-dialog-backdrop {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n padding: 48px;\n justify-content: center;\n align-items: center;\n}\n\n.xendit-dialog {\n position: relative;\n}\n\n.xendit-dialog-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: var(--xendit-color-text);\n padding: 16px;\n gap: 16px;\n line-height: 20px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dialog-header button {\n display: flex;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-floating-close {\n display: none;\n}\n\n.xendit-dialog .xendit-dialog-floating-close {\n display: flex;\n}\n\n.xendit-dialog-floating-close {\n position: absolute;\n top: 24px;\n right: 24px;\n background: none;\n border: none;\n color: var(--xendit-color-text);\n cursor: pointer;\n padding: 0;\n}\n\n.xendit-dialog-body {\n display: flex;\n padding: 24px;\n background-color: var(--xendit-color-background);\n border-radius: 8px;\n box-shadow: var(--xendit-dialog-shadow);\n}\n\n.xendit-error-message {\n color: var(--xendit-color-danger);\n}\n\n/* Phone input Dropdown */\n.xendit-input-phone {\n display: flex;\n gap: 8px;\n}\n\n.xendit-phone-number-input {\n width: 100%;\n}\n\n/* Phone input Dropdown ends */\n\n/* Dropdown */\n.xendit-dropdown {\n width: 100%;\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n text-align: left;\n background-color: var(--xendit-color-background);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n justify-content: space-between;\n cursor: pointer;\n padding: 0;\n outline: none;\n overflow: hidden;\n}\n\n.xendit-dropdown:focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n outline: none;\n z-index: var(--xendit-z-index-focus);\n position: relative;\n}\n\n.xendit-dropdown.xendit-dropdown-has-asset {\n grid-template-columns: auto 1fr auto;\n padding-left: 12px;\n}\n\n.xendit-dropdown-channel-logo {\n height: 24px;\n width: 32px;\n object-fit: contain;\n padding: 2px 0px;\n padding-right: 12px;\n border-right: 1px solid var(--xendit-color-border);\n}\n\n.xendit-dropdown-text {\n padding: 12px;\n padding-right: 0;\n white-space: nowrap;\n overflow: clip;\n}\n\n.xendit-dropdown-chevron {\n height: 38px;\n width: 38px;\n padding: 12px;\n box-sizing: border-box;\n}\n\n.xendit-dropdown:disabled {\n background: var(--xendit-color-disabled);\n cursor: default;\n}\n\n.xendit-dropdown-overlay {\n contain: style;\n position: absolute;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 320px;\n padding: 4px;\n margin: 4px 0;\n box-sizing: border-box;\n background-color: var(--xendit-color-background);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n list-style: none;\n box-shadow: var(--xendit-card-shadow);\n overflow-y: auto;\n overscroll-behavior: none;\n}\n\n.xendit-dropdown-overlay ul {\n list-style: none;\n padding: 4px;\n margin: 0;\n}\n\n.xendit-dropdown-search {\n position: sticky;\n top: 0;\n z-index: 1;\n}\n\n.xendit-dropdown-search input {\n width: 100%;\n padding: 8px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n box-sizing: border-box;\n outline: none;\n}\n\n.xendit-dropdown-search input:focus {\n border-color: var(--xendit-color-primary);\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-dropdown-item {\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n gap: 8px;\n padding: 8px 12px 8px 4px;\n border-radius: var(--xendit-radius-1);\n cursor: pointer;\n z-index: 0;\n --xendit-dropdown-item-hover-color: var(--xendit-color-background);\n --xendit-dropdown-item-hover-bg-color: var(--xendit-color-primary);\n}\n\n.xendit-dropdown-item-disabled {\n --xendit-dropdown-item-hover-color: var(--xendit-color-text);\n --xendit-dropdown-item-hover-bg-color: var(--xendit-color-disabled);\n}\n\n.xendit-dropdown-item-active {\n box-shadow: var(--xendit-focus-shadow);\n}\n\n.xendit-dropdown-item:hover {\n background-color: var(--xendit-dropdown-item-hover-bg-color);\n}\n\n.xendit-dropdown-item:hover .xendit-dropdown-item-text,\n.xendit-dropdown-item:hover .xendit-dropdown-item-description {\n color: var(--xendit-dropdown-item-hover-color);\n}\n\n.xendit-dropdown-item-selected {\n color: var(--xendit-color-primary);\n}\n\n.xendit-dropdown-item:hover .xendit-dropdown-item-selected {\n color: var(--xendit-dropdown-item-hover-color);\n}\n\n.xendit-dropdown-item.xendit-dropdown-has-asset {\n grid-template-columns: auto 1fr auto;\n}\n\n.xendit-dropdown-item-text {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.xendit-dropdown-item-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.xendit-dropdown-item-disabled:hover,\n.xendit-dropdown-item-disabled.xendit-dropdown-item-active {\n background-color: var(--xendit-color-disabled);\n}\n\n/* Dropdown ends */\n\n/* Button */\n.xendit-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 12px 16px;\n font-family: var(--xendit-font-family);\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n letter-spacing: -0.09px;\n cursor: pointer;\n transition: background-color var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n}\n.xendit-button-primary-rounded {\n border: 1px solid transparent;\n background-color: var(--xendit-color-primary);\n color: var(--xendit-color-background);\n border-radius: var(--xendit-radius-1);\n}\n.xendit-button-white-rounded {\n background-color: var(--xendit-color-background);\n color: var(--xendit-color-text);\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n}\n.xendit-button-white-rounded:hover {\n background-color: var(--xendit-color-border);\n}\n.xendit-button-block {\n width: 100%;\n}\n.xendit-button-sm {\n padding: 8px 12px;\n font-size: 12px;\n line-height: 16px;\n}\n\n@keyframes xendit-button-loading-spinner-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.xendit-button-loading-spinner {\n width: 16px;\n height: 16px;\n animation: xendit-button-loading-spinner-spin 1s linear infinite;\n}\n\n.xendit-skeleton-field button {\n height: 42px;\n background-color: var(--xendit-color-disabled);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--xendit-color-text-secondary);\n}\n\n/* Button ends */\n\n/* Form Simulation Helper */\n.xendit-form-simulation-root {\n position: relative;\n}\n.xendit-form-simulation-trigger {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n}\n.xendit-form-simulation-popover {\n position: absolute;\n top: 100%;\n right: 0;\n\n width: 350px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-radius: 4px;\n padding: 12px;\n border: 1px solid var(--xendit-color-border);\n background: color-mix(\n in srgb,\n var(--xendit-color-background),\n transparent 40%\n );\n backdrop-filter: blur(6px);\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-form-simulation-popover .xendit-dropdown-overlay {\n width: auto;\n}\n\n.xendit-form-simulation-scenario-icon {\n height: 28px;\n width: 40px;\n border-radius: 4px;\n border: 1px solid var(--xendit-color-border);\n object-fit: contain;\n background-color: white;\n}\n\n/* Form Simulation Helper ends */\n\n.xendit-tooltip {\n position: absolute;\n top: 100%;\n right: 50%;\n transform: translateX(50%);\n background-color: black;\n color: white;\n padding: 8px 12px;\n border-radius: var(--xendit-radius-1);\n white-space: nowrap;\n z-index: 1000;\n font-weight: 600;\n font-size: 14px;\n line-height: 16px;\n animation: xendit-tooltip-fade-in var(--xendit-animation-duration)\n var(--xendit-animation-ease);\n opacity: 1;\n}\n\n@keyframes xendit-tooltip-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Instructions */\n\n.xendit-instructions-bold {\n font-weight: 600;\n}\n.xendit-instructions-bullet-list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin: 8px 0;\n}\n.xendit-instructions-bullet-list::marker {\n color: var(--xendit-color-text-secondary);\n}\n.xendit-instructions-form-card {\n display: flex;\n flex-direction: column;\n padding: 16px;\n border-radius: 12px;\n border: 1px solid var(--xendit-color-border);\n gap: 4px;\n width: 321px;\n}\n.xendit-instructions-form-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 8px 0;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n.xendit-instructions-form-field-label {\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n color: var(--xendit-color-text-secondary);\n}\n.xendit-instructions-form-field-value {\n font-size: 14px;\n line-height: 20px;\n color: var(--xendit-color-text);\n}\n.xendit-instructions-form-heading {\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n margin: 4px 0;\n}\n.xendit-instructions-italics {\n font-style: italic;\n}\n.xendit-instructions-numbered-list {\n display: flex;\n flex-direction: column;\n gap: 16px;\n list-style-type: decimal;\n padding-left: 40px;\n}\n.xendit-instructions-single-tab-heading {\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n margin-bottom: 16px;\n}\n.xendit-instructions-step-box {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.xendit-instructions-step-li {\n font-size: 14px;\n line-height: 20px;\n}\n.xendit-instructions-step-li p {\n margin: 0;\n}\n.xendit-instructions-step-li::marker {\n margin-left: 20px;\n}\n.xendit-instructions-tab-button {\n font-family: var(--xendit-font-family);\n font-size: 14px;\n padding: 8px 4px;\n background-color: transparent;\n border: none;\n border-top: 3px solid transparent;\n border-bottom: 3px solid transparent;\n cursor: pointer;\n}\n.xendit-instructions-active-tab {\n border-bottom-color: var(--xendit-color-primary);\n color: var(--xendit-color-primary);\n font-weight: 600;\n}\n.xendit-instructions-tab-list {\n display: flex;\n gap: 16px;\n margin-bottom: 16px;\n border-bottom: 1px solid var(--xendit-color-border);\n}\n.xendit-instructions-table {\n font-size: 14px;\n line-height: 16px;\n width: 100%;\n border-collapse: collapse;\n}\n.xendit-instructions-table-cell {\n padding: 4px;\n border: 1px solid black;\n}\n.xendit-instructions-table-header {\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n padding: 4px;\n border: 1px solid black;\n}\n\n/* Instructions ends */\n\n.xendit-default-action-container {\n display: flex;\n flex-direction: column;\n border: none;\n}\n\n.xendit-action-title {\n font-weight: 600;\n font-size: 20px;\n line-height: 28px;\n text-align: center;\n}\n\n.xendit-action-iframe {\n border: none;\n width: 100%;\n height: 100%;\n}\n\n.xendit-action-present-to-customer {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-present-to-customer-affirm {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n/* qr actions */\n.xendit-action-qr-content {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n max-width: 384px;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n overflow: hidden;\n}\n.xendit-qr-merchant-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n.xendit-action-qr-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-qr-qrcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n}\n\n/* barcode actions */\n.xendit-action-barcode-channel-logo {\n height: 64px;\n align-self: center;\n object-fit: contain;\n}\n.xendit-action-barcode-barcode-container {\n width: 100%;\n position: relative;\n z-index: var(--xendit-z-index-overlay);\n display: flex;\n justify-content: center;\n}\n\n/* va actions */\n.xendit-action-va-content,\n.xendit-action-barcode-content {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--xendit-color-border);\n border-radius: var(--xendit-radius-1);\n padding: 16px;\n padding-bottom: 24px;\n}\n.xendit-action-va-details,\n.xendit-action-barcode-details {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.xendit-action-va-detail-item,\n.xendit-action-barcode-detail-item {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.xendit-action-va-detail-content,\n.xendit-action-barcode-detail-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.xendit-action-va-heading,\n.xendit-action-barcode-heading {\n color: var(--xendit-color-text-placeholder);\n}\n.xendit-action-va-tag {\n color: var(--xendit-color-text-placeholder);\n background-color: #fafafa;\n padding: 2px 4px;\n border-radius: 4px;\n}\n\n/* redirect, deeplink, and push notification actions */\n.xendit-redirect-instructions {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n gap: 24px;\n}\n\n.xendit-redirect-instructions-logo {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 112px;\n height: 112px;\n border: 2px solid var(--xendit-color-border);\n border-radius: 50%;\n overflow: hidden;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-logo img {\n width: 96px;\n height: 96px;\n object-fit: contain;\n}\n\n.xendit-redirect-instructions-text {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.xendit-redirect-instructions-button {\n display: inline-block;\n border-radius: 99px;\n color: white;\n padding: 12px 16px;\n background-color: var(--xendit-channel-brand-color, #000);\n text-decoration: none;\n white-space: nowrap;\n box-shadow: var(--xendit-card-shadow);\n}\n\n.xendit-redirect-instructions-button:hover,\n.xendit-redirect-instructions-button:active {\n filter: brightness(1.1);\n}\n\n/* googlepay */\n\n.gpay-card-info-container-fill {\n display: flex;\n}\n";const n=document.querySelector("style, link");n?n.insertAdjacentElement("beforebegin",e):document.head.appendChild(e)}());export{XenditActionBeginEvent,XenditActionEndEvent,XenditComponents,XenditComponentsTest,XenditFatalErrorEvent,XenditInitEvent,XenditNotReadyEvent,XenditPaymentRequestCreatedEvent,XenditPaymentRequestDiscardedEvent,XenditPaymentTokenCreatedEvent,XenditPaymentTokenDiscardedEvent,XenditReadyEvent,XenditSessionCompleteEvent,XenditSessionExpiredOrCanceledEvent,XenditSessionNotPendingEvent,XenditSessionPendingEvent,XenditSubmissionBeginEvent,XenditSubmissionEndEvent,XenditWillRedirectEvent,_e as a,ei as amountFormat,me as r};
3
3
  //# sourceMappingURL=index.mjs.map