@openrails/billing-ui 0.280.0 → 0.281.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{admin-attempts-CP5CWyNR.js → admin-attempts-DjgBAbx9.js} +71 -72
- package/dist/admin-attempts-DjgBAbx9.js.map +1 -0
- package/dist/{admin-auth-DlIOmwPo.js → admin-auth-BUUdvmqC.js} +3 -4
- package/dist/admin-auth-BUUdvmqC.js.map +1 -0
- package/dist/{admin-badge-DR_8AhdC.js → admin-badge-CAlUmS2s.js} +3 -4
- package/dist/admin-badge-CAlUmS2s.js.map +1 -0
- package/dist/{admin-button-DBzTD6By.js → admin-button-Bn4otsuw.js} +3 -4
- package/dist/admin-button-Bn4otsuw.js.map +1 -0
- package/dist/{admin-capabilities-CZdT1Pxe.js → admin-capabilities-DS-X-__V.js} +3 -4
- package/dist/admin-capabilities-DS-X-__V.js.map +1 -0
- package/dist/{admin-card-mZl4-s5d.js → admin-card-BHKW1dfB.js} +3 -4
- package/dist/admin-card-BHKW1dfB.js.map +1 -0
- package/dist/{admin-catalog-DpTjS0Yo.js → admin-catalog-BdLDhr8R.js} +309 -312
- package/dist/admin-catalog-BdLDhr8R.js.map +1 -0
- package/dist/{admin-confirm-katGq0Qo.js → admin-confirm-DWq-edDC.js} +2 -3
- package/dist/admin-confirm-DWq-edDC.js.map +1 -0
- package/dist/{admin-csv-CPoNZj2D.js → admin-csv-CRrmaR6a.js} +2 -3
- package/dist/admin-csv-CRrmaR6a.js.map +1 -0
- package/dist/{admin-cursor-pager-C-KjCIy9.js → admin-cursor-pager-Qo9Sq6lN.js} +6 -8
- package/dist/admin-cursor-pager-Qo9Sq6lN.js.map +1 -0
- package/dist/{admin-customers-BE3N839X.js → admin-customers-BZP6Jv-i.js} +21 -22
- package/dist/admin-customers-BZP6Jv-i.js.map +1 -0
- package/dist/{admin-dashboard-BxjkV15J.js → admin-dashboard-BJSonknv.js} +150 -153
- package/dist/admin-dashboard-BJSonknv.js.map +1 -0
- package/dist/{admin-data-table-D89AwWz_.js → admin-data-table-BiFmcf0Z.js} +19 -26
- package/dist/admin-data-table-BiFmcf0Z.js.map +1 -0
- package/dist/admin-detail-C03O0R6e.js +1351 -0
- package/dist/{admin-detail-P-UnNvXJ.js.map → admin-detail-C03O0R6e.js.map} +1 -1
- package/dist/{admin-detail-Ln56otK0.js → admin-detail-C6VH3i2v.js} +74 -75
- package/dist/admin-detail-C6VH3i2v.js.map +1 -0
- package/dist/{admin-detail-C8lD7U2t.js → admin-detail-CQws8363.js} +199 -202
- package/dist/admin-detail-CQws8363.js.map +1 -0
- package/dist/admin-detail-NApy5bio.js +337 -0
- package/dist/admin-detail-NApy5bio.js.map +1 -0
- package/dist/{admin-detail-D6zD085K.js → admin-detail-cijme9Lc.js} +92 -94
- package/dist/admin-detail-cijme9Lc.js.map +1 -0
- package/dist/{admin-dialog-Dn2FRJu4.js → admin-dialog-CgYGInHi.js} +4 -5
- package/dist/admin-dialog-CgYGInHi.js.map +1 -0
- package/dist/{admin-dialog-width-CC7QHT1p.js → admin-dialog-width-C_WFpow0.js} +2 -3
- package/dist/admin-dialog-width-C_WFpow0.js.map +1 -0
- package/dist/{admin-dom-C7Y7A6Wa.js → admin-dom-BP9QROfy.js} +2 -3
- package/dist/admin-dom-BP9QROfy.js.map +1 -0
- package/dist/{admin-dropdown-menu-DLUn6Uj3.js → admin-dropdown-menu-CU9RxoEJ.js} +3 -4
- package/dist/admin-dropdown-menu-CU9RxoEJ.js.map +1 -0
- package/dist/{admin-dunning-COaHzrmN.js → admin-dunning-D8lAP7OA.js} +3 -4
- package/dist/admin-dunning-D8lAP7OA.js.map +1 -0
- package/dist/{admin-fact-card-DKvBnUXB.js → admin-fact-card-lN-MsuSp.js} +3 -4
- package/dist/admin-fact-card-lN-MsuSp.js.map +1 -0
- package/dist/{admin-form-field-errors-hbUMIriS.js → admin-form-field-errors-Cuhy38F1.js} +2 -3
- package/dist/admin-form-field-errors-Cuhy38F1.js.map +1 -0
- package/dist/{admin-format-BbiTCqUG.js → admin-format-D9Ablh0P.js} +3 -5
- package/dist/admin-format-D9Ablh0P.js.map +1 -0
- package/dist/{admin-health-DmnI4e8K.js → admin-health-CnagC763.js} +91 -93
- package/dist/admin-health-CnagC763.js.map +1 -0
- package/dist/{admin-imports-C0aMP6sj.js → admin-imports-SM_fKKgW.js} +92 -93
- package/dist/admin-imports-SM_fKKgW.js.map +1 -0
- package/dist/{admin-input-JKrQIGfD.js → admin-input-B_EUzCAE.js} +3 -4
- package/dist/admin-input-B_EUzCAE.js.map +1 -0
- package/dist/{admin-invoice-profile-model-Cgjy3zV8.js → admin-invoice-profile-model-CNsvK89v.js} +2 -3
- package/dist/admin-invoice-profile-model-CNsvK89v.js.map +1 -0
- package/dist/{admin-label-CHWsVIZC.js → admin-label-DQsOkp1p.js} +3 -4
- package/dist/admin-label-DQsOkp1p.js.map +1 -0
- package/dist/{admin-linked-table-row-BMZYYsuk.js → admin-linked-table-row-BFsgc9tz.js} +5 -6
- package/dist/admin-linked-table-row-BFsgc9tz.js.map +1 -0
- package/dist/{admin-map-dialog-BHUGdCcv.js → admin-map-dialog-Dt3gTuTD.js} +26 -27
- package/dist/admin-map-dialog-Dt3gTuTD.js.map +1 -0
- package/dist/{admin-mapping-csv-FtkyTBmk.js → admin-mapping-csv-DzpB9HQn.js} +1 -2
- package/dist/admin-mapping-csv-DzpB9HQn.js.map +1 -0
- package/dist/admin-metering-DM4KhjOq.js +1717 -0
- package/dist/admin-metering-DM4KhjOq.js.map +1 -0
- package/dist/{admin-missing-record-BPFs3MmO.js → admin-missing-record-G2Jz-VUn.js} +3 -4
- package/dist/admin-missing-record-G2Jz-VUn.js.map +1 -0
- package/dist/{admin-ops-CL2kjDwi.js → admin-ops-mwzj-jpg.js} +99 -100
- package/dist/admin-ops-mwzj-jpg.js.map +1 -0
- package/dist/{admin-orders-C1Sf2qhc.js → admin-orders-D_aqV66h.js} +41 -42
- package/dist/admin-orders-D_aqV66h.js.map +1 -0
- package/dist/{admin-parked-a0tB5bhG.js → admin-parked-2FjIfyMg.js} +47 -48
- package/dist/admin-parked-2FjIfyMg.js.map +1 -0
- package/dist/{admin-payments-DJcjwRA4.js → admin-payments-B4hh31PR.js} +36 -37
- package/dist/admin-payments-B4hh31PR.js.map +1 -0
- package/dist/{admin-price-detail-BOmeWw15.js → admin-price-detail--5Bovz20.js} +88 -90
- package/dist/admin-price-detail--5Bovz20.js.map +1 -0
- package/dist/{admin-price-format-CqOmHrIn.js → admin-price-format-C-pus9FL.js} +4 -6
- package/dist/admin-price-format-C-pus9FL.js.map +1 -0
- package/dist/admin-price-wizard-Cj_Bgh-V.js +354 -0
- package/dist/admin-price-wizard-Cj_Bgh-V.js.map +1 -0
- package/dist/{admin-proposals-DVrl-ym4.js → admin-proposals-DPRFoWel.js} +114 -116
- package/dist/admin-proposals-DPRFoWel.js.map +1 -0
- package/dist/{admin-provider-prices-BVVogH7Q.js → admin-provider-prices-B8Oc86dP.js} +74 -75
- package/dist/admin-provider-prices-B8Oc86dP.js.map +1 -0
- package/dist/{admin-range-picker-C6BtSm2B.js → admin-range-picker-CSWcCYkg.js} +8 -11
- package/dist/admin-range-picker-CSWcCYkg.js.map +1 -0
- package/dist/admin-records-CWbfqyT8.js +390 -0
- package/dist/admin-records-CWbfqyT8.js.map +1 -0
- package/dist/{admin-reports-CtPoiceH.js → admin-reports-CAHWO_d6.js} +59 -60
- package/dist/admin-reports-CAHWO_d6.js.map +1 -0
- package/dist/{admin-select-6Yuh5M1Q.js → admin-select-DSGCZFiZ.js} +3 -4
- package/dist/admin-select-DSGCZFiZ.js.map +1 -0
- package/dist/{admin-settings-DscHu4ww.js → admin-settings-BrvNTJlM.js} +640 -645
- package/dist/admin-settings-BrvNTJlM.js.map +1 -0
- package/dist/{admin-shared-BywM-MMp.js → admin-shared-DdN2hyaR.js} +23 -25
- package/dist/admin-shared-DdN2hyaR.js.map +1 -0
- package/dist/{admin-skeleton-lndmw89u.js → admin-skeleton-DOfsDIu0.js} +3 -4
- package/dist/admin-skeleton-DOfsDIu0.js.map +1 -0
- package/dist/{admin-status-badge-IL8ofZ_6.js → admin-status-badge-BLEGt2Fw.js} +6 -7
- package/dist/{admin-status-badge-IL8ofZ_6.js.map → admin-status-badge-BLEGt2Fw.js.map} +1 -1
- package/dist/{admin-subscriptions-Cd5CGrue.js → admin-subscriptions-PL5G3f0O.js} +38 -39
- package/dist/admin-subscriptions-PL5G3f0O.js.map +1 -0
- package/dist/{admin-switch-DpwQSzEm.js → admin-switch-aOiQQzST.js} +3 -4
- package/dist/admin-switch-aOiQQzST.js.map +1 -0
- package/dist/{admin-table-D-GdGM1m.js → admin-table-DIKl2rpV.js} +3 -4
- package/dist/admin-table-DIKl2rpV.js.map +1 -0
- package/dist/{admin-tabs-B--1flzO.js → admin-tabs-DR74xX0-.js} +8 -10
- package/dist/admin-tabs-DR74xX0-.js.map +1 -0
- package/dist/{admin-textarea-xsp5V9xM.js → admin-textarea-W52-l_0n.js} +3 -4
- package/dist/admin-textarea-W52-l_0n.js.map +1 -0
- package/dist/{admin-tile-grids-CzGpidd9.js → admin-tile-grids-Gc67MtA6.js} +2 -3
- package/dist/admin-tile-grids-Gc67MtA6.js.map +1 -0
- package/dist/{admin-typed-confirm-dialog-NiEDwX_0.js → admin-typed-confirm-dialog-B_00EHlT.js} +13 -14
- package/dist/admin-typed-confirm-dialog-B_00EHlT.js.map +1 -0
- package/dist/{admin-utils-wuPUD0uh.js → admin-utils-CX097OR7.js} +23 -47
- package/dist/{admin-utils-wuPUD0uh.js.map → admin-utils-CX097OR7.js.map} +1 -1
- package/dist/{admin-widget-viz-kHHVmDEx.js → admin-widget-viz-DVV9aTQp.js} +21 -24
- package/dist/admin-widget-viz-DVV9aTQp.js.map +1 -0
- package/dist/admin.js +60 -84
- package/dist/admin.js.map +1 -1
- package/dist/client/generated/wire.d.ts +1 -0
- package/dist/{client-ctrbivyN.js → client-DwsFGm4M.js} +6 -11
- package/dist/client-DwsFGm4M.js.map +1 -0
- package/dist/client.js +1 -2
- package/dist/{create-card-BEILS1VB-DeyyfyFD.js → create-card-BEILS1VB-B1MQg0iK.js} +3 -4
- package/dist/create-card-BEILS1VB-B1MQg0iK.js.map +1 -0
- package/dist/{create-card-display-Dv5pcpzc-BWB6vzo2.js → create-card-display-Dv5pcpzc-DotrmqWH.js} +5 -9
- package/dist/create-card-display-Dv5pcpzc-DotrmqWH.js.map +1 -0
- package/dist/{create-copy-button-CAYmfugS-qNapojfj.js → create-copy-button-CAYmfugS-CAgco7FO.js} +3 -4
- package/dist/create-copy-button-CAYmfugS-CAgco7FO.js.map +1 -0
- package/dist/{dist-CslWupfi.js → dist-BPWQ2tCx.js} +6 -7
- package/dist/dist-BPWQ2tCx.js.map +1 -0
- package/dist/{hooks-KpTetx6F.js → hooks-C-MhXjQh.js} +13 -22
- package/dist/hooks-C-MhXjQh.js.map +1 -0
- package/dist/{index-rGw83t5v-BE6naeQR.js → index-rGw83t5v-ydBZxXI_.js} +10 -24
- package/dist/index-rGw83t5v-ydBZxXI_.js.map +1 -0
- package/dist/index.js +67 -124
- package/dist/index.js.map +1 -1
- package/dist/locales/de.js +1 -2
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.js +1 -2
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +1 -2
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +1 -2
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +1 -2
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +1 -2
- package/dist/locales/zh.js.map +1 -1
- package/dist/react.js +1 -2
- package/package.json +2 -2
- package/dist/admin-attempts-CP5CWyNR.js.map +0 -1
- package/dist/admin-auth-DlIOmwPo.js.map +0 -1
- package/dist/admin-badge-DR_8AhdC.js.map +0 -1
- package/dist/admin-button-DBzTD6By.js.map +0 -1
- package/dist/admin-capabilities-CZdT1Pxe.js.map +0 -1
- package/dist/admin-card-mZl4-s5d.js.map +0 -1
- package/dist/admin-catalog-DpTjS0Yo.js.map +0 -1
- package/dist/admin-confirm-katGq0Qo.js.map +0 -1
- package/dist/admin-csv-CPoNZj2D.js.map +0 -1
- package/dist/admin-cursor-pager-C-KjCIy9.js.map +0 -1
- package/dist/admin-customers-BE3N839X.js.map +0 -1
- package/dist/admin-dashboard-BxjkV15J.js.map +0 -1
- package/dist/admin-data-table-D89AwWz_.js.map +0 -1
- package/dist/admin-detail-BKe9xqPd.js +0 -338
- package/dist/admin-detail-BKe9xqPd.js.map +0 -1
- package/dist/admin-detail-C8lD7U2t.js.map +0 -1
- package/dist/admin-detail-D6zD085K.js.map +0 -1
- package/dist/admin-detail-Ln56otK0.js.map +0 -1
- package/dist/admin-detail-P-UnNvXJ.js +0 -1357
- package/dist/admin-dialog-Dn2FRJu4.js.map +0 -1
- package/dist/admin-dialog-width-CC7QHT1p.js.map +0 -1
- package/dist/admin-dom-C7Y7A6Wa.js.map +0 -1
- package/dist/admin-dropdown-menu-DLUn6Uj3.js.map +0 -1
- package/dist/admin-dunning-COaHzrmN.js.map +0 -1
- package/dist/admin-fact-card-DKvBnUXB.js.map +0 -1
- package/dist/admin-form-field-errors-hbUMIriS.js.map +0 -1
- package/dist/admin-format-BbiTCqUG.js.map +0 -1
- package/dist/admin-health-DmnI4e8K.js.map +0 -1
- package/dist/admin-imports-C0aMP6sj.js.map +0 -1
- package/dist/admin-input-JKrQIGfD.js.map +0 -1
- package/dist/admin-invoice-profile-model-Cgjy3zV8.js.map +0 -1
- package/dist/admin-label-CHWsVIZC.js.map +0 -1
- package/dist/admin-linked-table-row-BMZYYsuk.js.map +0 -1
- package/dist/admin-map-dialog-BHUGdCcv.js.map +0 -1
- package/dist/admin-mapping-csv-FtkyTBmk.js.map +0 -1
- package/dist/admin-metering-CDqueHUh.js +0 -1721
- package/dist/admin-metering-CDqueHUh.js.map +0 -1
- package/dist/admin-missing-record-BPFs3MmO.js.map +0 -1
- package/dist/admin-ops-CL2kjDwi.js.map +0 -1
- package/dist/admin-orders-C1Sf2qhc.js.map +0 -1
- package/dist/admin-parked-a0tB5bhG.js.map +0 -1
- package/dist/admin-payments-DJcjwRA4.js.map +0 -1
- package/dist/admin-price-detail-BOmeWw15.js.map +0 -1
- package/dist/admin-price-format-CqOmHrIn.js.map +0 -1
- package/dist/admin-price-wizard-B6s5OJeO.js +0 -356
- package/dist/admin-price-wizard-B6s5OJeO.js.map +0 -1
- package/dist/admin-proposals-DVrl-ym4.js.map +0 -1
- package/dist/admin-provider-prices-BVVogH7Q.js.map +0 -1
- package/dist/admin-range-picker-C6BtSm2B.js.map +0 -1
- package/dist/admin-records-DKtcgN11.js +0 -391
- package/dist/admin-records-DKtcgN11.js.map +0 -1
- package/dist/admin-reports-CtPoiceH.js.map +0 -1
- package/dist/admin-select-6Yuh5M1Q.js.map +0 -1
- package/dist/admin-settings-DscHu4ww.js.map +0 -1
- package/dist/admin-shared-BywM-MMp.js.map +0 -1
- package/dist/admin-skeleton-lndmw89u.js.map +0 -1
- package/dist/admin-subscriptions-Cd5CGrue.js.map +0 -1
- package/dist/admin-switch-DpwQSzEm.js.map +0 -1
- package/dist/admin-table-D-GdGM1m.js.map +0 -1
- package/dist/admin-tabs-B--1flzO.js.map +0 -1
- package/dist/admin-textarea-xsp5V9xM.js.map +0 -1
- package/dist/admin-tile-grids-CzGpidd9.js.map +0 -1
- package/dist/admin-typed-confirm-dialog-NiEDwX_0.js.map +0 -1
- package/dist/admin-widget-viz-kHHVmDEx.js.map +0 -1
- package/dist/client-ctrbivyN.js.map +0 -1
- package/dist/create-card-BEILS1VB-DeyyfyFD.js.map +0 -1
- package/dist/create-card-display-Dv5pcpzc-BWB6vzo2.js.map +0 -1
- package/dist/create-copy-button-CAYmfugS-qNapojfj.js.map +0 -1
- package/dist/dist-CslWupfi.js.map +0 -1
- package/dist/hooks-KpTetx6F.js.map +0 -1
- package/dist/index-rGw83t5v-BE6naeQR.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-rGw83t5v-ydBZxXI_.js","names":["copyOpts","PAN_PATTERNS","REDACT_PATTERNS","isPANField","pattern","key","isRedactField","maskPAN","digits","value","first6","last4","maskedLength","looksLikePAN","sanitizeValue","sanitizeDeep","depth","data","ancestors","result","item","sanitized","sanitizedValue","sanitizeMetadata","metadata","len","formatTimestamp","now","createDebugLogger","enabled","timestamp","packageName","action","generateId","random","randomPart","LANGUAGE_TAG","isLanguageTag","log","createBasisTheoryError","error","message","code","details","BasisTheoryError","ValidationError","field","CoordinatorError","ElementError","elementId","ConfigurationError","HttpClientError","status","headers","ALLOWED_PROXY_SCHEMES","ALLOWED_METHODS","FORBIDDEN_PROXY_HEADERS","validateProxyHeaders","parseIPv4","clean","hostname","num","parts","octets","part","isPrivateIPv4","a","b","isBlockedIPv6","ipv4MappedDotted","ipv4Part","ipv4Octets","ipv4MappedHex","highPart","lowPart","high","low","validateSsrfProtection","parsed","validateProxyUrl","url","validateProxyTarget","hasUrl","proxyKey","FORBIDDEN_DESTINATION_HEADERS","header","validateDestinationHeaders","validateDestinationRequest","options","validateProxyOptions","DEFAULT_RETRY_CONFIG","getRetryDelay","delay","config","attempt","sleep","resolve","ms","createPostMessageClient","pendingRequests","eventSubscribers","log2","isValidOrigin","origin","handleMessage","event","type","iframe","nonce","pending","reconstructedError","payload","subscribers","err","retryConfig","sendRequestOnce","timeout","reject","transfer","maxRetries","lastError","errorMessage","start","latency","errorMsg","callback","createMounter","applyIframeStyles","container","CMD_REGISTER_ELEMENT","CMD_BIND_ELEMENT_PORT","CMD_BIND_COORDINATOR_PORT","bindCoordinatorPort","coordinatorRequest","elementType","channel","coordinatorBind","elementBind","client","createIframe","createEventDispatcher","createBaseDetail","dispatch","eventType","detail","changeDetail","cardDetail","createCardNumberElement","mounter","isMounted","eventDispatcher","eventTarget","id","coordinatorElementId","setupEventListeners","h","selector","parentOrigin","iframeUrl","sdkConfig","readyPromise","ensureCoordinatorReady","notifyCoordinatorElementUnmount","updatePayload","newOptions","listener","createCVVElement","createExpiryElement","createTextElement","serializedTransform","serializedMask","isPrimitive","isElement","v","resolveElementReferences","resolved","DEFAULT_THEME","mergeWithDefaultTheme","userTheme","warnUnknownKeys","obj","knownKeys","deprecatedKeys","label","VALID_ENVIRONMENTS","KNOWN_SDK_KEYS","DEPRECATED_SDK_KEYS","validateAPIKey","apiKey","validateSDKConfig","baseUrl","themeMode","direction","resolvedBaseUrl","whitelabelDomain","domainOrigin","pathname","finalBaseUrl","COMMON_ELEMENT_KEYS","VALID_ENTER_KEY_HINTS","CARD_ENTER_KEY_HINT_FIELDS","validateEnterKeyHintValue","ELEMENT_TYPE_KEYS","CARD_DISPLAY_FIELDS","CARD_DISPLAY_LABEL_MAX_LENGTH","validateElementOptions","validKeys","enterKeyHint","nonBooleanKey","cardDisplayOptions","fieldOptions","cardOptions","brand","BasisTheory","elements","coordinatorIframe","coordinatorClient","coordinatorReadyPromise","coordinatorInitStarted","coordinatorLoadTimeout","rejectCoordinatorLoad","destroyed","assertNotDestroyed","guardSync","args","fn","guardAsync","currentThemeMode","createLazyElementWrapper","realElement","loadPromise","loadRealElement","lazyFactory","elementApiKey","elementConfig","elementOptions","ensureCoordinator","notifyUnmount","ensureLoaded","wrapper","opts","unsubscribe","cancelled","refElement","sendCoordinatorRequest","command","options2","cardElementFactory","copyButtonElementFactory","cardDisplayElementFactory","lazyCardElement","lazyCopyButtonElement","lazyCardDisplayElement","syncFactories","lazyFactories","ensureCoordinatorInitialized","initializeCoordinator","coordinatorUrl","sdk","syncFactory","localElementId","element","el","cardBrand","cvvLengths","cvvElement","resolvedPayload","token","request","resolvedRequest","tokenData","publicKeyPEM","keyId","resolvedTokenData","encrypted","session","resolvedData","intent","invokeProxy","resolvedBody","proxyVerb","method","invokeClient","body","transportError","withBody","withoutBody","mode","updatePromises","updatePromise","CACHE_CLEAR_TIMEOUT_MS","cacheCleared","capTimeout","cap","queuedCommands","cmd"],"sources":["../node_modules/.pnpm/@basis-theory+web-elements@3.2.0/node_modules/@basis-theory/web-elements/dist/index-rGw83t5v.js"],"sourcesContent":["const PAN_PATTERNS = [\n /cardnumber/i,\n /^pan$/i,\n /accountnumber/i,\n /^number$/i\n // Common in card objects\n];\nconst REDACT_PATTERNS = [\n /cvv/i,\n /cvc/i,\n /cvv2/i,\n /securitycode/i,\n /pin/i,\n /password/i,\n /secret/i,\n /token/i,\n /ssn/i,\n /track/i,\n /session_key/i,\n /^apikey$/i\n];\nconst isPANField = (key) => {\n return PAN_PATTERNS.some((pattern) => pattern.test(key));\n};\nconst isRedactField = (key) => {\n return REDACT_PATTERNS.some((pattern) => pattern.test(key));\n};\nconst maskPAN = (value) => {\n const digits = value.replace(/\\D/g, \"\");\n if (digits.length < 10) {\n return \"***\";\n }\n const first6 = digits.substring(0, 6);\n const last4 = digits.substring(digits.length - 4);\n const maskedLength = Math.max(digits.length - 10, 6);\n const masked = \"*\".repeat(maskedLength);\n return `${first6}${masked}${last4}`;\n};\nconst looksLikePAN = (value) => {\n const digits = value.replace(/[\\s-]/g, \"\");\n return /^\\d{13,19}$/.test(digits);\n};\nconst sanitizeValue = (key, value) => {\n if (value === null || value === void 0) {\n return value;\n }\n if (typeof value === \"function\") {\n return \"[Function]\";\n }\n if (typeof value === \"symbol\") {\n return \"[Symbol]\";\n }\n if (value instanceof RegExp) {\n return \"[RegExp]\";\n }\n if (value instanceof Date) {\n return value;\n }\n if (isPANField(key)) {\n if (typeof value === \"string\") {\n return maskPAN(value);\n }\n return \"***\";\n }\n if (isRedactField(key)) {\n return \"***\";\n }\n if (typeof value === \"string\" && looksLikePAN(value)) {\n return maskPAN(value);\n }\n return value;\n};\nconst sanitizeDeep = (data, depth = 0, ancestors = /* @__PURE__ */ new WeakSet()) => {\n if (depth >= 5) {\n return \"[Max Depth]\";\n }\n if (data === null || data === void 0) {\n return data;\n }\n if (typeof data === \"string\") {\n return looksLikePAN(data) ? maskPAN(data) : data;\n }\n if (typeof data !== \"object\") {\n return data;\n }\n if (data instanceof RegExp) {\n return \"[RegExp]\";\n }\n if (data instanceof Date) {\n return data;\n }\n if (ancestors.has(data)) {\n return \"[Circular]\";\n }\n ancestors.add(data);\n let result;\n if (Array.isArray(data)) {\n result = data.map((item) => sanitizeDeep(item, depth + 1, ancestors));\n } else {\n const sanitized = {};\n for (const [key, value] of Object.entries(data)) {\n const sanitizedValue = sanitizeValue(key, value);\n if (sanitizedValue !== null && typeof sanitizedValue === \"object\") {\n sanitized[key] = sanitizeDeep(sanitizedValue, depth + 1, ancestors);\n } else {\n sanitized[key] = sanitizedValue;\n }\n }\n result = sanitized;\n }\n ancestors.delete(data);\n return result;\n};\nconst sanitizeMetadata = (metadata) => {\n const result = {};\n for (const [key, value] of Object.entries(metadata)) {\n if (isPANField(key) || isRedactField(key)) {\n const len = typeof value === \"string\" ? value.length : typeof value === \"number\" ? String(value).length : 0;\n result[`${key}_length`] = len;\n } else {\n result[key] = sanitizeDeep(value);\n }\n }\n return result;\n};\nconst formatTimestamp = () => {\n const now = /* @__PURE__ */ new Date();\n const hours = String(now.getHours()).padStart(2, \"0\");\n const minutes = String(now.getMinutes()).padStart(2, \"0\");\n const seconds = String(now.getSeconds()).padStart(2, \"0\");\n const milliseconds = String(now.getMilliseconds()).padStart(3, \"0\");\n return `${hours}:${minutes}:${seconds}.${milliseconds}`;\n};\nconst createDebugLogger = (packageName, enabled) => {\n if (!enabled) {\n return () => {\n };\n }\n return (action, metadata) => {\n const timestamp = formatTimestamp();\n const sanitized = metadata ? sanitizeMetadata(metadata) : {};\n console.log(`🔍 [${timestamp}] [${packageName}] ${action}`, sanitized);\n };\n};\nconst generateId = () => {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n const random = () => Math.random().toString(36).substring(2);\n const randomPart = (random() + random() + random() + random()).substring(0, 32);\n return `${randomPart.substring(0, 8)}-${randomPart.substring(8, 12)}-${randomPart.substring(12, 16)}-${randomPart.substring(16, 20)}-${randomPart.substring(20, 32)}`;\n};\nconst LANGUAGE_TAG = /^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{1,8})*$/;\nconst isLanguageTag = (value) => typeof value === \"string\" && LANGUAGE_TAG.test(value);\nconst log = (action, metadata) => {\n};\nconst createBasisTheoryError = (code, message, details) => {\n const error = new Error(message);\n error.name = \"BasisTheoryError\";\n error.code = code;\n error.details = details;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(error, createBasisTheoryError);\n }\n error.toJSON = () => ({\n name: error.name,\n code: error.code,\n message: error.message,\n ...error.details && { details: error.details }\n });\n return error;\n};\nconst BasisTheoryError = (code, message, details) => {\n const error = createBasisTheoryError(code, message, details);\n error.name = \"BasisTheoryError\";\n return error;\n};\nconst ValidationError = (message, field, details) => {\n const error = createBasisTheoryError(\"VALIDATION_ERROR\", message, field ? { field, ...details } : details);\n error.name = \"ValidationError\";\n error.field = field;\n return error;\n};\nconst CoordinatorError = (message, details) => {\n const error = createBasisTheoryError(\"COORDINATOR_ERROR\", message, details);\n error.name = \"CoordinatorError\";\n return error;\n};\nconst ElementError = (message, elementId, details) => {\n const error = createBasisTheoryError(\"ELEMENT_ERROR\", message, elementId ? { elementId, ...details } : details);\n error.name = \"ElementError\";\n error.elementId = elementId;\n return error;\n};\nconst ConfigurationError = (message, details) => {\n const error = createBasisTheoryError(\"CONFIGURATION_ERROR\", message, details);\n error.name = \"ConfigurationError\";\n return error;\n};\nconst HttpClientError = (message, status, data, headers) => {\n const error = createBasisTheoryError(\"HTTP_CLIENT_ERROR\", message, {\n status\n });\n error.name = \"HttpClientError\";\n error.status = status;\n error.data = data;\n error.headers = headers;\n return error;\n};\nconst ALLOWED_PROXY_SCHEMES = /* @__PURE__ */ new Set([\"https:\"]);\nconst ALLOWED_METHODS = /* @__PURE__ */ new Set([\n \"GET\",\n \"POST\",\n \"PUT\",\n \"PATCH\",\n \"DELETE\"\n]);\nconst FORBIDDEN_PROXY_HEADERS = /* @__PURE__ */ new Set([\n // Request smuggling prevention\n \"host\",\n \"content-length\",\n \"transfer-encoding\",\n \"te\",\n \"trailer\",\n // Connection manipulation prevention\n \"connection\",\n \"upgrade\",\n \"keep-alive\",\n \"proxy-connection\",\n // Proxy bypass prevention\n \"via\",\n \"proxy-authorization\",\n // BasisTheory credential protection\n \"bt-api-key\",\n \"bt-proxy-key\",\n \"bt-proxy-url\",\n \"bt-idempotency-key\",\n // Forwarded headers\n \"x-forwarded-for\",\n \"x-forwarded-host\",\n \"x-real-ip\",\n // SDK owns serialization format — body is always JSON.stringify'd\n \"content-type\"\n]);\nconst validateProxyHeaders = (headers) => {\n if (!headers)\n return;\n for (const [key, value] of Object.entries(headers)) {\n if (/[\\r\\n]/.test(value)) {\n throw ValidationError(`Header '${key}' value contains illegal CRLF`, \"headers\");\n }\n if (/[\\r\\n]/.test(key)) {\n throw ValidationError(`Header name '${key}' contains illegal CRLF`, \"headers\");\n }\n if (FORBIDDEN_PROXY_HEADERS.has(key.toLowerCase().trim())) {\n throw ValidationError(`Header '${key}' is not allowed in proxy requests`, \"headers\");\n }\n }\n};\nconst parseIPv4 = (hostname) => {\n const clean = hostname.replace(/^\\[|\\]$/g, \"\");\n if (/^(0x[\\da-f]+|\\d+)$/i.test(clean)) {\n const num = clean.toLowerCase().startsWith(\"0x\") ? parseInt(clean, 16) : parseInt(clean, 10);\n if (num >= 0 && num <= 4294967295) {\n return [\n num >>> 24 & 255,\n num >>> 16 & 255,\n num >>> 8 & 255,\n num & 255\n ];\n }\n return null;\n }\n const parts = clean.split(\".\");\n if (parts.length !== 4) {\n return null;\n }\n const octets = [];\n for (const part of parts) {\n let value;\n if (part.toLowerCase().startsWith(\"0x\")) {\n value = parseInt(part, 16);\n } else if (part.startsWith(\"0\") && part.length > 1 && !/[89]/.test(part)) {\n value = parseInt(part, 8);\n } else {\n value = parseInt(part, 10);\n }\n if (isNaN(value) || value < 0 || value > 255) {\n return null;\n }\n octets.push(value);\n }\n return octets;\n};\nconst isPrivateIPv4 = (octets) => {\n const a = octets[0];\n const b = octets[1];\n if (a === void 0 || b === void 0)\n return true;\n if (a === 127)\n return true;\n if (a === 10)\n return true;\n if (a === 172 && b >= 16 && b <= 31)\n return true;\n if (a === 192 && b === 168)\n return true;\n if (a === 169 && b === 254)\n return true;\n if (a === 0)\n return true;\n return false;\n};\nconst isBlockedIPv6 = (hostname) => {\n const clean = hostname.replace(/^\\[|\\]$/g, \"\").toLowerCase();\n if (clean === \"::1\" || clean === \"0:0:0:0:0:0:0:1\" || clean === \"0000:0000:0000:0000:0000:0000:0000:0001\") {\n return true;\n }\n if (clean.startsWith(\"fe8\") || clean.startsWith(\"fe9\") || clean.startsWith(\"fea\") || clean.startsWith(\"feb\")) {\n return true;\n }\n if (clean.startsWith(\"fc\") || clean.startsWith(\"fd\")) {\n return true;\n }\n const ipv4MappedDotted = clean.match(/^::ffff:(\\d+\\.\\d+\\.\\d+\\.\\d+)$/);\n if (ipv4MappedDotted) {\n const ipv4Part = ipv4MappedDotted[1];\n if (ipv4Part) {\n const ipv4Octets = parseIPv4(ipv4Part);\n if (ipv4Octets && isPrivateIPv4(ipv4Octets)) {\n return true;\n }\n }\n }\n const ipv4MappedHex = clean.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);\n if (ipv4MappedHex) {\n const highPart = ipv4MappedHex[1];\n const lowPart = ipv4MappedHex[2];\n if (!highPart || !lowPart) {\n return true;\n }\n const high = parseInt(highPart, 16);\n const low = parseInt(lowPart, 16);\n const octets = [\n high >>> 8 & 255,\n high & 255,\n low >>> 8 & 255,\n low & 255\n ];\n if (isPrivateIPv4(octets)) {\n return true;\n }\n }\n return false;\n};\nconst validateSsrfProtection = (parsed) => {\n const hostname = parsed.hostname.toLowerCase();\n if (parsed.username || parsed.password) {\n throw ValidationError(\"URL must not contain userinfo (username/password)\", \"url\");\n }\n if (hostname === \"localhost\") {\n throw ValidationError(\"URL must not target localhost\", \"url\");\n }\n if (hostname.startsWith(\"[\") || isBlockedIPv6(hostname)) {\n if (isBlockedIPv6(hostname)) {\n throw ValidationError(\"URL must not target loopback or link-local IPv6 addresses\", \"url\");\n }\n }\n const ipv4Octets = parseIPv4(hostname);\n if (ipv4Octets && isPrivateIPv4(ipv4Octets)) {\n throw ValidationError(\"URL must not target private or internal IP addresses\", \"url\");\n }\n};\nconst validateProxyUrl = (url) => {\n let parsed;\n try {\n parsed = new URL(url);\n } catch {\n throw ValidationError(\"Invalid URL format\", \"url\");\n }\n if (!ALLOWED_PROXY_SCHEMES.has(parsed.protocol)) {\n throw ValidationError(`URL scheme '${parsed.protocol}' is not allowed. Only https: is permitted`, \"url\");\n }\n validateSsrfProtection(parsed);\n};\nconst validateProxyTarget = (url, proxyKey) => {\n const hasUrl = typeof url === \"string\" && url.length > 0;\n const hasKey = typeof proxyKey === \"string\" && proxyKey.length > 0;\n if (hasUrl === hasKey) {\n throw ValidationError(\"Specify exactly one of url or proxyKey\", \"url/proxyKey\");\n }\n if (hasUrl) {\n validateProxyUrl(url);\n }\n};\nconst FORBIDDEN_DESTINATION_HEADERS = new Set([...FORBIDDEN_PROXY_HEADERS].filter((header) => header !== \"content-type\"));\nconst validateDestinationHeaders = (headers) => {\n if (!headers)\n return;\n for (const [key, value] of Object.entries(headers)) {\n if (/[\\r\\n]/.test(value)) {\n throw ValidationError(`Header '${key}' value contains illegal CRLF`, \"headers\");\n }\n if (/[\\r\\n]/.test(key)) {\n throw ValidationError(`Header name '${key}' contains illegal CRLF`, \"headers\");\n }\n if (FORBIDDEN_DESTINATION_HEADERS.has(key.toLowerCase().trim())) {\n throw ValidationError(`Header '${key}' is not allowed in HTTP client requests`, \"headers\");\n }\n }\n};\nconst validateDestinationRequest = (options) => {\n if (options !== void 0 && (typeof options !== \"object\" || options === null)) {\n throw ValidationError(\"HTTP client options must be a plain object\", \"options\");\n }\n if ((options == null ? void 0 : options.method) !== void 0 && !ALLOWED_METHODS.has(options.method)) {\n throw ValidationError(`Method '${options.method}' is not allowed`, \"method\");\n }\n if (typeof (options == null ? void 0 : options.url) !== \"string\" || options.url.length === 0) {\n throw ValidationError(\"url is required\", \"url\");\n }\n validateProxyUrl(options.url);\n validateDestinationHeaders(options == null ? void 0 : options.headers);\n};\nconst validateProxyOptions = (options) => {\n if (options !== void 0 && (typeof options !== \"object\" || options === null)) {\n throw ValidationError(\"Proxy options must be a plain object\", \"options\");\n }\n if ((options == null ? void 0 : options.method) !== void 0 && !ALLOWED_METHODS.has(options.method)) {\n throw ValidationError(`Method '${options.method}' is not allowed`, \"method\");\n }\n validateProxyTarget(options == null ? void 0 : options.url, options == null ? void 0 : options.proxyKey);\n validateProxyHeaders(options == null ? void 0 : options.headers);\n};\nconst DEFAULT_RETRY_CONFIG = {\n maxRetries: 2,\n initialDelay: 500,\n maxDelay: 3e3,\n backoffFactor: 2\n};\nconst getRetryDelay = (attempt, config) => {\n const delay = config.initialDelay * Math.pow(config.backoffFactor, attempt);\n return Math.min(delay, config.maxDelay);\n};\nconst sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\nconst createPostMessageClient = (iframe, config) => {\n const pendingRequests = /* @__PURE__ */ new Map();\n const eventSubscribers = /* @__PURE__ */ new Map();\n const log2 = createDebugLogger(\"PostMessageClient\", config.debug || false);\n const isValidOrigin = (origin) => {\n return origin === config.targetOrigin;\n };\n const handleMessage = (event) => {\n const { nonce, type, payload, error } = event.data || {};\n if (!type) {\n return;\n }\n if (!isValidOrigin(event.origin)) {\n log2(\"Rejected message (origin mismatch)\", {\n receivedOrigin: event.origin,\n expectedOrigin: config.targetOrigin,\n messageType: type\n });\n return;\n }\n if (event.source !== iframe.contentWindow) {\n return;\n }\n if (nonce) {\n const pending = pendingRequests.get(nonce);\n if (pending) {\n log2(\"Message received\", {\n origin: event.origin,\n expectedOrigin: config.targetOrigin,\n type,\n nonce\n });\n clearTimeout(pending.timeout);\n pendingRequests.delete(nonce);\n if (error) {\n const reconstructedError = BasisTheoryError(error.code, `[${error.code}] ${error.message}`);\n Object.assign(reconstructedError, {\n ...error.status !== void 0 && { status: error.status },\n ...error.statusCode !== void 0 && {\n statusCode: error.statusCode\n },\n ...error.validationErrors && {\n validationErrors: error.validationErrors\n },\n ...error.body && { body: error.body },\n ...error.retryCount !== void 0 && {\n retryCount: error.retryCount\n },\n ...error.data !== void 0 && { data: error.data },\n ...error.headers && { headers: error.headers },\n ...error.details && { details: error.details }\n });\n pending.reject(reconstructedError);\n } else {\n pending.resolve(payload);\n }\n return;\n }\n return;\n }\n const subscribers = eventSubscribers.get(type);\n if (subscribers && subscribers.size > 0) {\n log2(\"Event received\", {\n origin: event.origin,\n expectedOrigin: config.targetOrigin,\n type,\n nonce,\n subscriberCount: subscribers.size\n });\n subscribers.forEach((callback) => {\n try {\n callback(payload);\n } catch (err) {\n log2(\"Error in event subscriber\", {\n type,\n error: err.message\n });\n }\n });\n } else if (!nonce) {\n log2(\"Event received but no subscribers\", {\n type,\n availableSubscribers: Array.from(eventSubscribers.keys())\n });\n }\n };\n window.addEventListener(\"message\", handleMessage);\n const retryConfig = typeof config.retries === \"number\" ? { ...DEFAULT_RETRY_CONFIG, maxRetries: config.retries } : typeof config.retries === \"object\" ? config.retries : DEFAULT_RETRY_CONFIG;\n const sendRequestOnce = (type, payload, transfer) => {\n return new Promise((resolve, reject) => {\n const nonce = generateId();\n const timestamp = Date.now();\n if (!iframe.contentWindow) {\n reject(BasisTheoryError(\"IFRAME_NOT_READY\", \"Iframe not ready\"));\n return;\n }\n const timeout = setTimeout(() => {\n pendingRequests.delete(nonce);\n reject(BasisTheoryError(\"REQUEST_TIMEOUT\", `Request timeout: ${type} (${config.timeout || 5e3}ms)`));\n }, config.timeout || 5e3);\n pendingRequests.set(nonce, { resolve, reject, timeout, timestamp });\n log2(\"Sending request\", { type, nonce });\n const message = { type, nonce, timestamp, payload };\n if (transfer == null ? void 0 : transfer.length) {\n iframe.contentWindow.postMessage(message, config.targetOrigin, transfer);\n } else {\n iframe.contentWindow.postMessage(message, config.targetOrigin);\n }\n });\n };\n const sendRequest = async (type, payload, options) => {\n var _a;\n const maxRetries = ((_a = options == null ? void 0 : options.transfer) == null ? void 0 : _a.length) ? 0 : (options == null ? void 0 : options.retries) !== void 0 ? options.retries : retryConfig.maxRetries;\n let lastError = null;\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n return await sendRequestOnce(type, payload, options == null ? void 0 : options.transfer);\n } catch (error) {\n lastError = error;\n const errorMessage = error.message;\n const isHandlerError = errorMessage.startsWith(\"[HANDLER_ERROR]\");\n const isClientDestroyed = errorMessage === \"Client destroyed\";\n const isIframeNotReady = errorMessage === \"Iframe not ready\";\n if (isHandlerError || isClientDestroyed || isIframeNotReady) {\n log2(\"Not retrying error\", {\n error: errorMessage,\n reason: \"Non-retriable error\"\n });\n throw error;\n }\n if (attempt < maxRetries) {\n const delay = getRetryDelay(attempt, retryConfig);\n log2(\"Retrying request\", {\n attempt: attempt + 1,\n maxRetries,\n delayMs: delay,\n error: errorMessage\n });\n await sleep(delay);\n }\n }\n }\n throw lastError || new Error(`Request failed after ${maxRetries} retries: ${type}`);\n };\n const ping = async (timeout = 1e3) => {\n const start = Date.now();\n log2(\"Starting health check\", {\n timeoutMs: timeout,\n iframeReady: !!iframe.contentWindow,\n targetOrigin: config.targetOrigin\n });\n try {\n await sendRequestOnce(\"SYS_PING\", void 0);\n const latency = Date.now() - start;\n log2(\"Health check passed\", { latencyMs: latency });\n return latency;\n } catch (error) {\n const errorMsg = `Health check failed after ${Date.now() - start}ms: ${error.message}. Target: ${config.targetOrigin}`;\n if (config.debug) {\n log2(`❌ [PostMessage Client] ${errorMsg}`);\n log2(`📊 [PostMessage Client] Pending requests: ${pendingRequests.size}`);\n }\n throw BasisTheoryError(\"HEALTH_CHECK_FAILED\", errorMsg);\n }\n };\n const subscribe = (type, callback) => {\n if (!eventSubscribers.has(type)) {\n eventSubscribers.set(type, /* @__PURE__ */ new Set());\n }\n eventSubscribers.get(type).add(callback);\n return () => {\n const subscribers = eventSubscribers.get(type);\n if (subscribers) {\n subscribers.delete(callback);\n if (subscribers.size === 0) {\n eventSubscribers.delete(type);\n }\n }\n };\n };\n const destroy = () => {\n window.removeEventListener(\"message\", handleMessage);\n pendingRequests.forEach(({ timeout, reject }) => {\n clearTimeout(timeout);\n reject(BasisTheoryError(\"CLIENT_DESTROYED\", \"Client destroyed\"));\n });\n pendingRequests.clear();\n eventSubscribers.clear();\n };\n return {\n sendRequest,\n ping,\n subscribe,\n destroy,\n getPendingCount: () => pendingRequests.size\n };\n};\nconst createMounter = () => {\n const applyIframeStyles = (iframe) => {\n iframe.style.border = \"none\";\n iframe.style.width = \"100%\";\n iframe.style.height = \"100%\";\n iframe.style.display = \"block\";\n };\n return {\n mount: async (container, iframe, _config) => {\n applyIframeStyles(iframe);\n container.appendChild(iframe);\n },\n unmount: (iframe) => {\n iframe.remove();\n }\n };\n};\nconst CMD_REGISTER_ELEMENT = \"CMD_REGISTER_ELEMENT\";\nconst CMD_BIND_ELEMENT_PORT = \"CMD_BIND_ELEMENT_PORT\";\nconst CMD_BIND_COORDINATOR_PORT = \"CMD_BIND_COORDINATOR_PORT\";\nconst bindCoordinatorPort = async ({\n elementId,\n elementType,\n client,\n coordinatorRequest\n}) => {\n await coordinatorRequest(CMD_REGISTER_ELEMENT, {\n elementId,\n type: elementType\n });\n const channel = new MessageChannel();\n const coordinatorBind = await coordinatorRequest(\n CMD_BIND_ELEMENT_PORT,\n { elementId },\n { retries: 0, transfer: [channel.port2] }\n );\n if (!(coordinatorBind == null ? void 0 : coordinatorBind.success)) {\n channel.port1.close();\n throw ElementError(\n `Coordinator rejected the element port (${(coordinatorBind == null ? void 0 : coordinatorBind.error) ?? \"UNKNOWN\"})`,\n elementId,\n { elementType }\n );\n }\n const elementBind = await client.sendRequest(\n CMD_BIND_COORDINATOR_PORT,\n { elementId },\n { retries: 0, transfer: [channel.port1] }\n ).catch((error) => {\n log(\"Failed to hand coordinator port to element\", {\n error: error.message\n });\n return { success: false, error: error.message };\n });\n if (!(elementBind == null ? void 0 : elementBind.success)) {\n await coordinatorRequest(\"CMD_BROADCAST_ELEMENT_UNMOUNT\", {\n elementId\n }).catch(() => void 0);\n throw ElementError(\n `Element rejected the coordinator port (${(elementBind == null ? void 0 : elementBind.error) ?? \"UNKNOWN\"})`,\n elementId,\n { elementType }\n );\n }\n};\nconst createIframe = (config) => {\n const iframe = document.createElement(\"iframe\");\n iframe.src = config.src;\n iframe.setAttribute(\"sandbox\", config.sandbox);\n iframe.title = config.title;\n iframe.setAttribute(\"allow\", config.allow ?? \"payment *\");\n iframe.setAttribute(\"importance\", \"high\");\n iframe.style.opacity = \"0\";\n return iframe;\n};\nconst createEventDispatcher = (config) => {\n const { elementType, elementId, client, eventTarget } = config;\n const createBaseDetail = () => ({\n elementType,\n elementId,\n timestamp: Date.now()\n });\n const dispatch = (eventType, detail) => {\n const event = new CustomEvent(eventType, {\n detail: {\n ...createBaseDetail(),\n ...detail\n }\n });\n eventTarget.dispatchEvent(event);\n };\n const setupSubscriptions = () => {\n client.subscribe(\"EVENT_READY\", () => {\n dispatch(\"ready\", {});\n });\n client.subscribe(\"EVENT_VALUE_CHANGED\", (payload) => {\n const changeDetail = {\n isValid: payload.isValid,\n isEmpty: payload.isEmpty,\n error: payload.error || null\n };\n if (elementType === \"cardNumber\") {\n const cardDetail = {\n ...changeDetail,\n cardBrand: payload.cardBrand,\n last4: payload.last4,\n bin: payload.bin,\n cvvLengths: payload.cvvLengths,\n potentialBrands: payload.potentialBrands,\n matchStrength: payload.matchStrength,\n networks: payload.networks,\n selectedNetwork: payload.selectedNetwork,\n binDetails: payload.binDetails\n };\n dispatch(\"change\", cardDetail);\n } else if (elementType === \"card\") {\n dispatch(\"change\", {\n ...changeDetail,\n cardBrand: payload.cardBrand,\n last4: payload.last4,\n bin: payload.bin,\n networks: payload.networks,\n selectedNetwork: payload.selectedNetwork,\n binDetails: payload.binDetails,\n errors: payload.errors || null\n });\n } else {\n dispatch(\"change\", changeDetail);\n }\n });\n client.subscribe(\n \"EVENT_NETWORK_CHANGED\",\n (payload) => {\n if (elementType !== \"cardNumber\" && elementType !== \"card\") {\n return;\n }\n const detail = {\n network: payload.network,\n previousNetwork: payload.previousNetwork,\n availableNetworks: payload.availableNetworks ?? [],\n selectionMode: payload.selectionMode ?? \"auto\"\n };\n dispatch(\"networkChanged\", detail);\n }\n );\n client.subscribe(\"EVENT_FOCUS\", () => {\n dispatch(\"focus\", {});\n });\n client.subscribe(\"EVENT_BLUR\", () => {\n dispatch(\"blur\", {});\n });\n client.subscribe(\n \"EVENT_ERROR\",\n (payload) => {\n dispatch(\"error\", {\n code: payload.code,\n message: payload.message,\n status: payload.status,\n validationErrors: payload.validationErrors,\n metadata: payload.metadata || {}\n });\n }\n );\n };\n const dispatchError = (code, message, error) => {\n dispatch(\"error\", {\n code,\n message,\n metadata: {\n source: \"initialization\",\n originalError: error\n }\n });\n };\n return {\n setupSubscriptions,\n dispatchError\n };\n};\nconst createCardNumberElement = (apiKey, sdkConfig, options = {}, coordinatorElementId, ensureCoordinatorReady, notifyCoordinatorElementUnmount, coordinatorRequest) => {\n let iframe = null;\n let client = null;\n let mounter = null;\n let isMounted = false;\n let container = null;\n let eventDispatcher = null;\n const eventTarget = new EventTarget();\n const id = coordinatorElementId;\n const type = \"cardNumber\";\n const setupEventListeners = () => {\n if (!client) {\n return;\n }\n eventDispatcher = createEventDispatcher({\n elementType: type,\n elementId: id,\n client,\n eventTarget\n });\n eventDispatcher.setupSubscriptions();\n client.subscribe(\"EVENT_CONTENT_HEIGHT\", (payload) => {\n const h = payload == null ? void 0 : payload.heightPx;\n if (iframe && typeof h === \"number\" && h > 0) {\n iframe.style.height = `${Math.ceil(h)}px`;\n }\n });\n };\n return {\n id,\n type,\n get mounted() {\n return isMounted;\n },\n get loaded() {\n return isMounted;\n },\n mount: async (selector) => {\n if (isMounted) {\n throw ElementError(\"Element is already mounted\");\n }\n container = typeof selector === \"string\" ? document.querySelector(selector) : selector;\n if (!container) {\n throw ElementError(`Container not found: ${selector}`);\n }\n const parentOrigin = window.location.origin;\n const iframeUrl = new URL(\n `${sdkConfig.elementsBaseUrl}/card-number.html`\n );\n iframeUrl.searchParams.set(\"parentOrigin\", parentOrigin);\n iframeUrl.searchParams.set(\"elementId\", id);\n iframeUrl.searchParams.set(\n \"measurePerformance\",\n String(sdkConfig.measurePerformance || false)\n );\n iframeUrl.searchParams.set(\"debug\", String(sdkConfig.debug || false));\n iframe = createIframe({\n src: iframeUrl.toString(),\n sandbox: \"allow-scripts allow-same-origin\",\n title: options.ariaLabel || \"Card Number Input\"\n });\n iframe.setAttribute(\"data-bt-element-id\", id);\n iframe.setAttribute(\"data-theme-mode\", sdkConfig.themeMode || \"auto\");\n client = createPostMessageClient(iframe, {\n targetOrigin: sdkConfig.iframeOrigin,\n timeout: sdkConfig.timeoutMs,\n retries: sdkConfig.retryConfig.maxRetries,\n debug: sdkConfig.debug\n });\n mounter = createMounter();\n setupEventListeners();\n const readyPromise = new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(\n ElementError(\n `Iframe EVENT_READY not received within ${sdkConfig.timeoutMs}ms`,\n id,\n { elementType: type, timeoutMs: sdkConfig.timeoutMs }\n )\n );\n }, sdkConfig.timeoutMs);\n const handleReady = () => {\n clearTimeout(timeout);\n resolve();\n };\n eventTarget.addEventListener(\"ready\", handleReady, { once: true });\n });\n mounter.mount(container, iframe, {\n timeoutMs: sdkConfig.timeoutMs\n });\n isMounted = true;\n try {\n await ensureCoordinatorReady();\n await readyPromise;\n await bindCoordinatorPort({\n elementId: id,\n elementType: type,\n client,\n coordinatorRequest\n });\n await client.sendRequest(\"CMD_SET_CONFIG\", {\n elementId: id,\n // Include element ID for validation\n apiKey,\n environment: sdkConfig.environment,\n apiTimeout: sdkConfig.timeoutMs,\n apiRetries: sdkConfig.retryConfig.maxRetries,\n theme: sdkConfig.theme,\n darkTheme: sdkConfig.darkTheme,\n themeMode: sdkConfig.themeMode,\n direction: sdkConfig.direction,\n language: sdkConfig.language,\n placeholder: options.placeholder,\n disabled: options.disabled,\n readOnly: options.readOnly,\n debug: sdkConfig.debug,\n binLookup: options.binLookup,\n coBadge: options.coBadge,\n enterKeyHint: options.enterKeyHint,\n iconPosition: options.iconPosition || \"right\"\n });\n if (iframe) iframe.style.opacity = \"1\";\n } catch (error) {\n if (eventDispatcher) {\n eventDispatcher.dispatchError(\n \"MOUNT_ERROR\",\n error.message,\n error\n );\n }\n isMounted = false;\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n throw error;\n }\n },\n unmount: () => {\n if (!isMounted) {\n throw ElementError(\"Element is not mounted\");\n }\n notifyCoordinatorElementUnmount(id).catch((error) => {\n log(\"Failed to notify coordinator of element unmount\", {\n error: error.message\n });\n });\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n iframe.style.height = \"\";\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n isMounted = false;\n },\n update: async (newOptions) => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before updating\");\n }\n const updatePayload = {\n elementId: id\n };\n if (newOptions.placeholder !== void 0) {\n updatePayload.placeholder = newOptions.placeholder;\n }\n if (newOptions.disabled !== void 0) {\n updatePayload.disabled = newOptions.disabled;\n }\n if (newOptions.readOnly !== void 0) {\n updatePayload.readOnly = newOptions.readOnly;\n }\n if (newOptions.binLookup !== void 0) {\n updatePayload.binLookup = newOptions.binLookup;\n }\n if (newOptions.coBadge !== void 0) {\n updatePayload.coBadge = newOptions.coBadge;\n }\n if (newOptions.iconPosition !== void 0) {\n updatePayload.iconPosition = newOptions.iconPosition;\n }\n if (\"enterKeyHint\" in newOptions) {\n updatePayload.enterKeyHint = newOptions.enterKeyHint;\n }\n if (newOptions.themeMode !== void 0) {\n updatePayload.themeMode = newOptions.themeMode;\n updatePayload.theme = sdkConfig.theme;\n updatePayload.darkTheme = sdkConfig.darkTheme;\n }\n await client.sendRequest(\"CMD_UPDATE_CONFIG\", updatePayload);\n },\n focus: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before focusing\");\n }\n client.sendRequest(\"CMD_FOCUS\", {});\n },\n blur: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before blurring\");\n }\n client.sendRequest(\"CMD_BLUR\", {});\n },\n clear: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before clearing\");\n }\n client.sendRequest(\"CMD_CLEAR\", {});\n },\n setNetwork: async (network) => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before setNetwork\");\n }\n await client.sendRequest(\"CMD_SET_NETWORK\", { network });\n },\n on: (eventType, listener) => {\n eventTarget.addEventListener(\n eventType,\n listener\n );\n return () => eventTarget.removeEventListener(\n eventType,\n listener\n );\n }\n };\n};\nconst createCVVElement = (apiKey, sdkConfig, options = {}, coordinatorElementId, ensureCoordinatorReady, notifyCoordinatorElementUnmount, coordinatorRequest) => {\n let iframe = null;\n let client = null;\n let mounter = null;\n let isMounted = false;\n let container = null;\n let eventDispatcher = null;\n const eventTarget = new EventTarget();\n const id = coordinatorElementId;\n const type = \"cvv\";\n const setupEventListeners = () => {\n if (!client) return;\n eventDispatcher = createEventDispatcher({\n elementType: type,\n elementId: id,\n client,\n eventTarget\n });\n eventDispatcher.setupSubscriptions();\n };\n return {\n id,\n type,\n get mounted() {\n return isMounted;\n },\n get loaded() {\n return isMounted;\n },\n mount: async (selector) => {\n if (isMounted) {\n throw ElementError(\"Element is already mounted\", id);\n }\n container = typeof selector === \"string\" ? document.querySelector(selector) : selector;\n if (!container) {\n throw ElementError(`Container not found: ${selector}`);\n }\n const parentOrigin = window.location.origin;\n const iframeUrl = new URL(`${sdkConfig.elementsBaseUrl}/cvv.html`);\n iframeUrl.searchParams.set(\"parentOrigin\", parentOrigin);\n iframeUrl.searchParams.set(\"elementId\", id);\n iframeUrl.searchParams.set(\n \"measurePerformance\",\n String(sdkConfig.measurePerformance || false)\n );\n iframeUrl.searchParams.set(\"debug\", String(sdkConfig.debug || false));\n iframe = createIframe({\n src: iframeUrl.toString(),\n sandbox: \"allow-scripts allow-same-origin\",\n title: options.ariaLabel || \"CVV Input\"\n });\n iframe.setAttribute(\"data-bt-element-id\", id);\n client = createPostMessageClient(iframe, {\n targetOrigin: sdkConfig.iframeOrigin,\n timeout: sdkConfig.timeoutMs,\n retries: sdkConfig.retryConfig.maxRetries,\n debug: sdkConfig.debug\n });\n mounter = createMounter();\n setupEventListeners();\n const readyPromise = new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(\n ElementError(\n `Iframe EVENT_READY not received within ${sdkConfig.timeoutMs}ms`,\n id,\n { elementType: type, timeoutMs: sdkConfig.timeoutMs }\n )\n );\n }, sdkConfig.timeoutMs);\n const handleReady = () => {\n clearTimeout(timeout);\n resolve();\n };\n eventTarget.addEventListener(\"ready\", handleReady, { once: true });\n });\n mounter.mount(container, iframe, {\n timeoutMs: sdkConfig.timeoutMs\n });\n isMounted = true;\n try {\n await ensureCoordinatorReady();\n await readyPromise;\n await bindCoordinatorPort({\n elementId: id,\n elementType: type,\n client,\n coordinatorRequest\n });\n await client.sendRequest(\"CMD_SET_CONFIG\", {\n elementId: id,\n // Include element ID for validation\n theme: sdkConfig.theme,\n darkTheme: sdkConfig.darkTheme,\n themeMode: sdkConfig.themeMode,\n direction: sdkConfig.direction,\n language: sdkConfig.language,\n apiKey,\n environment: sdkConfig.environment,\n apiTimeout: sdkConfig.timeoutMs,\n apiRetries: sdkConfig.retryConfig.maxRetries,\n placeholder: options.placeholder,\n disabled: options.disabled,\n readOnly: options.readOnly,\n showToggle: options.showToggle,\n conceal: options.conceal,\n enterKeyHint: options.enterKeyHint,\n debug: sdkConfig.debug\n });\n if (iframe) iframe.style.opacity = \"1\";\n } catch (error) {\n if (eventDispatcher) {\n eventDispatcher.dispatchError(\n \"MOUNT_ERROR\",\n error.message,\n error\n );\n }\n isMounted = false;\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n throw error;\n }\n },\n unmount: () => {\n if (!isMounted) {\n throw ElementError(\"Element is not mounted\");\n }\n notifyCoordinatorElementUnmount(id).catch((error) => {\n log(\"Failed to notify coordinator of element unmount\", {\n error: error.message\n });\n });\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n isMounted = false;\n },\n update: async (newOptions) => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before updating\", id);\n }\n const updatePayload = {\n placeholder: newOptions.placeholder,\n disabled: newOptions.disabled,\n readOnly: newOptions.readOnly,\n // Forwarded only when the caller named it, so an explicit\n // `enterKeyHint: undefined` clears the hint but a partial update keeps it\n ...\"enterKeyHint\" in newOptions && {\n enterKeyHint: newOptions.enterKeyHint\n },\n ...\"conceal\" in newOptions && { conceal: newOptions.conceal },\n // ✅ SDK auto-coordination: Pass brand info for dynamic maxlength\n cardBrand: newOptions.cardBrand,\n cvvLengths: newOptions.cvvLengths\n };\n if (newOptions.themeMode !== void 0) {\n updatePayload.themeMode = newOptions.themeMode;\n updatePayload.theme = sdkConfig.theme;\n updatePayload.darkTheme = sdkConfig.darkTheme;\n }\n await client.sendRequest(\"CMD_UPDATE_CONFIG\", updatePayload);\n },\n focus: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before focusing\", id);\n }\n client.sendRequest(\"CMD_FOCUS\", {});\n },\n blur: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before blurring\", id);\n }\n client.sendRequest(\"CMD_BLUR\", {});\n },\n clear: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before clearing\", id);\n }\n client.sendRequest(\"CMD_CLEAR\", {});\n },\n on: (eventType, listener) => {\n eventTarget.addEventListener(\n eventType,\n listener\n );\n return () => eventTarget.removeEventListener(\n eventType,\n listener\n );\n }\n };\n};\nconst createExpiryElement = (apiKey, sdkConfig, options = {}, coordinatorElementId, ensureCoordinatorReady, notifyCoordinatorElementUnmount, coordinatorRequest) => {\n let iframe = null;\n let client = null;\n let mounter = null;\n let isMounted = false;\n let container = null;\n let eventDispatcher = null;\n const eventTarget = new EventTarget();\n const id = coordinatorElementId;\n const type = \"expiry\";\n const setupEventListeners = () => {\n if (!client) return;\n eventDispatcher = createEventDispatcher({\n elementType: type,\n elementId: id,\n client,\n eventTarget\n });\n eventDispatcher.setupSubscriptions();\n };\n return {\n id,\n type,\n get mounted() {\n return isMounted;\n },\n get loaded() {\n return isMounted;\n },\n mount: async (selector) => {\n if (isMounted) {\n throw ElementError(\"Element is already mounted\", id);\n }\n container = typeof selector === \"string\" ? document.querySelector(selector) : selector;\n if (!container) {\n throw ElementError(`Container not found: ${selector}`);\n }\n const parentOrigin = window.location.origin;\n const iframeUrl = new URL(`${sdkConfig.elementsBaseUrl}/expiry.html`);\n iframeUrl.searchParams.set(\"parentOrigin\", parentOrigin);\n iframeUrl.searchParams.set(\"elementId\", id);\n iframeUrl.searchParams.set(\n \"measurePerformance\",\n String(sdkConfig.measurePerformance || false)\n );\n iframeUrl.searchParams.set(\"debug\", String(sdkConfig.debug || false));\n iframe = createIframe({\n src: iframeUrl.toString(),\n sandbox: \"allow-scripts allow-same-origin\",\n title: options.ariaLabel || \"Expiry Date Input\"\n });\n iframe.setAttribute(\"data-bt-element-id\", id);\n client = createPostMessageClient(iframe, {\n targetOrigin: sdkConfig.iframeOrigin,\n timeout: sdkConfig.timeoutMs,\n retries: sdkConfig.retryConfig.maxRetries,\n debug: sdkConfig.debug\n });\n mounter = createMounter();\n setupEventListeners();\n const readyPromise = new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(\n ElementError(\n `Iframe EVENT_READY not received within ${sdkConfig.timeoutMs}ms`,\n id,\n { elementType: type, timeoutMs: sdkConfig.timeoutMs }\n )\n );\n }, sdkConfig.timeoutMs);\n const handleReady = () => {\n clearTimeout(timeout);\n resolve();\n };\n eventTarget.addEventListener(\"ready\", handleReady, { once: true });\n });\n mounter.mount(container, iframe, {\n timeoutMs: sdkConfig.timeoutMs\n });\n isMounted = true;\n try {\n await ensureCoordinatorReady();\n await readyPromise;\n await bindCoordinatorPort({\n elementId: id,\n elementType: type,\n client,\n coordinatorRequest\n });\n await client.sendRequest(\"CMD_SET_CONFIG\", {\n elementId: id,\n // Include element ID for validation\n theme: sdkConfig.theme,\n darkTheme: sdkConfig.darkTheme,\n themeMode: sdkConfig.themeMode,\n direction: sdkConfig.direction,\n language: sdkConfig.language,\n apiKey,\n environment: sdkConfig.environment,\n apiTimeout: sdkConfig.timeoutMs,\n apiRetries: sdkConfig.retryConfig.maxRetries,\n placeholder: options.placeholder,\n disabled: options.disabled,\n readOnly: options.readOnly,\n enterKeyHint: options.enterKeyHint,\n debug: sdkConfig.debug\n });\n if (iframe) iframe.style.opacity = \"1\";\n } catch (error) {\n if (eventDispatcher) {\n eventDispatcher.dispatchError(\n \"MOUNT_ERROR\",\n error.message,\n error\n );\n }\n isMounted = false;\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n throw error;\n }\n },\n unmount: () => {\n if (!isMounted) {\n throw ElementError(\"Element is not mounted\");\n }\n notifyCoordinatorElementUnmount(id).catch((error) => {\n log(\"Failed to notify coordinator of element unmount\", {\n error: error.message\n });\n });\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n isMounted = false;\n },\n update: async (newOptions) => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before updating\", id);\n }\n const updatePayload = {\n placeholder: newOptions.placeholder,\n disabled: newOptions.disabled,\n readOnly: newOptions.readOnly,\n // Forwarded only when the caller named it, so an explicit\n // `enterKeyHint: undefined` clears the hint but a partial update keeps it\n ...\"enterKeyHint\" in newOptions && {\n enterKeyHint: newOptions.enterKeyHint\n }\n };\n if (newOptions.themeMode !== void 0) {\n updatePayload.themeMode = newOptions.themeMode;\n updatePayload.theme = sdkConfig.theme;\n updatePayload.darkTheme = sdkConfig.darkTheme;\n }\n await client.sendRequest(\"CMD_UPDATE_CONFIG\", updatePayload);\n },\n focus: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before focusing\", id);\n }\n client.sendRequest(\"CMD_FOCUS\", {});\n },\n blur: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before blurring\", id);\n }\n client.sendRequest(\"CMD_BLUR\", {});\n },\n clear: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before clearing\", id);\n }\n client.sendRequest(\"CMD_CLEAR\", {});\n },\n on: (eventType, listener) => {\n eventTarget.addEventListener(\n eventType,\n listener\n );\n return () => eventTarget.removeEventListener(\n eventType,\n listener\n );\n }\n };\n};\nconst createTextElement = (apiKey, sdkConfig, options = {}, coordinatorElementId, ensureCoordinatorReady, notifyCoordinatorElementUnmount, coordinatorRequest) => {\n let iframe = null;\n let client = null;\n let mounter = null;\n let isMounted = false;\n let container = null;\n let eventDispatcher = null;\n const eventTarget = new EventTarget();\n const id = coordinatorElementId;\n const type = \"text\";\n if (options.transform) {\n if (!Array.isArray(options.transform) || options.transform.length !== 2 || !(options.transform[0] instanceof RegExp) || typeof options.transform[1] !== \"string\") {\n throw new TypeError(\n 'transform must be a tuple of [RegExp, string]. Example: [/-/g, \"\"]'\n );\n }\n }\n const setupEventListeners = () => {\n if (!client) return;\n eventDispatcher = createEventDispatcher({\n elementType: type,\n elementId: id,\n client,\n eventTarget\n });\n eventDispatcher.setupSubscriptions();\n };\n return {\n id,\n type,\n get mounted() {\n return isMounted;\n },\n get loaded() {\n return isMounted;\n },\n mount: async (selector) => {\n if (isMounted) {\n throw ElementError(\"Element is already mounted\", id);\n }\n container = typeof selector === \"string\" ? document.querySelector(selector) : selector;\n if (!container) {\n throw ElementError(`Container not found: ${selector}`);\n }\n const parentOrigin = window.location.origin;\n const iframeUrl = new URL(`${sdkConfig.elementsBaseUrl}/text.html`);\n iframeUrl.searchParams.set(\"parentOrigin\", parentOrigin);\n iframeUrl.searchParams.set(\"elementId\", id);\n iframeUrl.searchParams.set(\n \"measurePerformance\",\n String(sdkConfig.measurePerformance || false)\n );\n iframeUrl.searchParams.set(\"debug\", String(sdkConfig.debug || false));\n iframe = createIframe({\n src: iframeUrl.toString(),\n sandbox: \"allow-scripts allow-same-origin\",\n title: options.ariaLabel || \"Text Input\"\n });\n iframe.setAttribute(\"data-bt-element-id\", id);\n client = createPostMessageClient(iframe, {\n targetOrigin: sdkConfig.iframeOrigin,\n timeout: sdkConfig.timeoutMs,\n retries: sdkConfig.retryConfig.maxRetries,\n debug: sdkConfig.debug\n });\n mounter = createMounter();\n setupEventListeners();\n const readyPromise = new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(\n ElementError(\n `Iframe EVENT_READY not received within ${sdkConfig.timeoutMs}ms`,\n id,\n { elementType: type, timeoutMs: sdkConfig.timeoutMs }\n )\n );\n }, sdkConfig.timeoutMs);\n const handleReady = () => {\n clearTimeout(timeout);\n resolve();\n };\n eventTarget.addEventListener(\"ready\", handleReady, { once: true });\n });\n mounter.mount(container, iframe, {\n timeoutMs: sdkConfig.timeoutMs\n });\n isMounted = true;\n try {\n await ensureCoordinatorReady();\n await readyPromise;\n await bindCoordinatorPort({\n elementId: id,\n elementType: type,\n client,\n coordinatorRequest\n });\n const serializedTransform = options.transform ? {\n pattern: options.transform[0].source,\n flags: options.transform[0].flags,\n replacement: options.transform[1]\n } : void 0;\n const serializedMask = options.mask ? options.mask.map((item) => {\n if (typeof item === \"string\") {\n return item;\n } else if (item instanceof RegExp) {\n return { source: item.source, flags: item.flags };\n }\n return item;\n }) : void 0;\n await client.sendRequest(\"CMD_SET_CONFIG\", {\n elementId: id,\n // Include element ID for validation\n theme: sdkConfig.theme,\n darkTheme: sdkConfig.darkTheme,\n themeMode: sdkConfig.themeMode,\n direction: sdkConfig.direction,\n language: sdkConfig.language,\n apiKey,\n environment: sdkConfig.environment,\n apiTimeout: sdkConfig.timeoutMs,\n apiRetries: sdkConfig.retryConfig.maxRetries,\n placeholder: options.placeholder,\n disabled: options.disabled,\n readOnly: options.readOnly,\n // Text-specific options\n validation: options.validation,\n required: options.required,\n maxLength: options.maxLength,\n password: options.password,\n inputMode: options.inputMode,\n enterKeyHint: options.enterKeyHint,\n mask: serializedMask,\n transform: serializedTransform,\n debug: sdkConfig.debug\n });\n if (iframe) iframe.style.opacity = \"1\";\n } catch (error) {\n if (eventDispatcher) {\n eventDispatcher.dispatchError(\n \"MOUNT_ERROR\",\n error.message,\n error\n );\n }\n isMounted = false;\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n throw error;\n }\n },\n unmount: () => {\n if (!isMounted) {\n throw ElementError(\"Element is not mounted\");\n }\n notifyCoordinatorElementUnmount(id).catch((error) => {\n log(\"Failed to notify coordinator of element unmount\", {\n error: error.message\n });\n });\n if (client) {\n client.destroy();\n client = null;\n }\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n eventDispatcher = null;\n container = null;\n isMounted = false;\n },\n update: async (newOptions) => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before updating\", id);\n }\n const updatePayload = {\n placeholder: newOptions.placeholder,\n disabled: newOptions.disabled,\n readOnly: newOptions.readOnly,\n // Text-specific UI updates (not data schema)\n required: newOptions.required,\n maxLength: newOptions.maxLength,\n password: newOptions.password,\n inputMode: newOptions.inputMode,\n // Forwarded only when the caller named it, so an explicit\n // `enterKeyHint: undefined` clears the hint but a partial update keeps it\n ...\"enterKeyHint\" in newOptions && {\n enterKeyHint: newOptions.enterKeyHint\n }\n };\n if (newOptions.themeMode !== void 0) {\n updatePayload.themeMode = newOptions.themeMode;\n updatePayload.theme = sdkConfig.theme;\n updatePayload.darkTheme = sdkConfig.darkTheme;\n }\n await client.sendRequest(\"CMD_UPDATE_CONFIG\", updatePayload);\n },\n focus: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before focusing\", id);\n }\n client.sendRequest(\"CMD_FOCUS\", {});\n },\n blur: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before blurring\", id);\n }\n client.sendRequest(\"CMD_BLUR\", {});\n },\n clear: () => {\n if (!isMounted || !client) {\n throw ElementError(\"Element must be mounted before clearing\", id);\n }\n client.sendRequest(\"CMD_CLEAR\", {});\n },\n on: (eventType, listener) => {\n eventTarget.addEventListener(\n eventType,\n listener\n );\n return () => eventTarget.removeEventListener(\n eventType,\n listener\n );\n }\n };\n};\nconst isPrimitive = (value) => value === null || value === void 0 || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\nconst isElement = (value) => {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value;\n return typeof v.mount === \"function\" && typeof v.update === \"function\" && typeof v.on === \"function\";\n};\nconst resolveElementReferences = (value) => {\n if (isPrimitive(value)) return value;\n if (isElement(value)) {\n if (!value.id) {\n throw ElementError(\n \"Element is missing id property. Ensure createElement is called after the SDK loads and all elements are mounted before calling tokenize().\"\n );\n }\n return value.id;\n }\n if (Array.isArray(value)) return value.map(resolveElementReferences);\n if (typeof value === \"object\" && value !== null) {\n const resolved = {};\n for (const [key, v] of Object.entries(value)) {\n resolved[key] = resolveElementReferences(v);\n }\n return resolved;\n }\n return value;\n};\nconst DEFAULT_THEME = {\n colors: {\n primary: \"#3b82f6\",\n // blue-500\n error: \"#ef4444\",\n // red-500\n success: \"#10b981\",\n // emerald-500\n text: {\n primary: \"#1f2937\",\n // gray-800\n secondary: \"#6b7280\",\n // gray-500\n placeholder: \"#9ca3af\",\n // gray-400\n disabled: \"#d1d5db\"\n // gray-300\n },\n background: {\n default: \"#ffffff\",\n hover: \"#f9fafb\",\n // gray-50\n focus: \"#eff6ff\",\n // blue-50\n disabled: \"#f9fafb\"\n // gray-50\n },\n border: {\n default: \"#d1d5db\",\n // gray-300\n hover: \"#9ca3af\",\n // gray-400\n focus: \"#3b82f6\",\n // blue-500\n error: \"#ef4444\"\n // red-500\n }\n },\n typography: {\n fontFamily: '\"Inter\", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n fontSize: {\n sm: \"14px\",\n base: \"16px\",\n lg: \"18px\"\n },\n fontWeight: {\n normal: \"400\",\n medium: \"500\",\n semibold: \"600\"\n },\n lineHeight: {\n tight: \"1.25\",\n normal: \"1.5\",\n relaxed: \"1.75\"\n }\n },\n spacing: {\n xs: \"4px\",\n sm: \"8px\",\n md: \"12px\",\n lg: \"16px\",\n xl: \"24px\"\n },\n borders: {\n radius: {\n none: \"0\",\n sm: \"2px\",\n base: \"4px\",\n md: \"6px\",\n lg: \"8px\",\n full: \"9999px\"\n },\n width: {\n thin: \"1px\",\n base: \"2px\",\n thick: \"3px\"\n }\n },\n shadows: {\n none: \"none\",\n sm: \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n base: \"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)\",\n md: \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)\",\n lg: \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)\",\n focus: \"0 0 0 3px rgba(59, 130, 246, 0.1)\"\n // blue-500 with alpha\n },\n transitions: {\n fast: \"150ms cubic-bezier(0.4, 0, 0.2, 1)\",\n base: \"200ms cubic-bezier(0.4, 0, 0.2, 1)\",\n slow: \"300ms cubic-bezier(0.4, 0, 0.2, 1)\"\n }\n};\nconst mergeWithDefaultTheme = (userTheme) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;\n if (!userTheme) return DEFAULT_THEME;\n return {\n colors: {\n primary: ((_a = userTheme.colors) == null ? void 0 : _a.primary) ?? DEFAULT_THEME.colors.primary,\n error: ((_b = userTheme.colors) == null ? void 0 : _b.error) ?? DEFAULT_THEME.colors.error,\n success: ((_c = userTheme.colors) == null ? void 0 : _c.success) ?? DEFAULT_THEME.colors.success,\n text: {\n ...DEFAULT_THEME.colors.text,\n ...(_d = userTheme.colors) == null ? void 0 : _d.text\n },\n background: {\n ...DEFAULT_THEME.colors.background,\n ...(_e = userTheme.colors) == null ? void 0 : _e.background\n },\n border: {\n ...DEFAULT_THEME.colors.border,\n ...(_f = userTheme.colors) == null ? void 0 : _f.border\n }\n },\n typography: {\n ...DEFAULT_THEME.typography,\n ...userTheme.typography,\n fontSize: {\n ...DEFAULT_THEME.typography.fontSize,\n ...(_g = userTheme.typography) == null ? void 0 : _g.fontSize\n },\n fontWeight: {\n ...DEFAULT_THEME.typography.fontWeight,\n ...(_h = userTheme.typography) == null ? void 0 : _h.fontWeight\n },\n lineHeight: {\n ...DEFAULT_THEME.typography.lineHeight,\n ...(_i = userTheme.typography) == null ? void 0 : _i.lineHeight\n }\n },\n spacing: { ...DEFAULT_THEME.spacing, ...userTheme.spacing },\n borders: {\n radius: {\n ...DEFAULT_THEME.borders.radius,\n ...(_j = userTheme.borders) == null ? void 0 : _j.radius\n },\n width: {\n ...DEFAULT_THEME.borders.width,\n ...(_k = userTheme.borders) == null ? void 0 : _k.width\n }\n },\n shadows: { ...DEFAULT_THEME.shadows, ...userTheme.shadows },\n transitions: { ...DEFAULT_THEME.transitions, ...userTheme.transitions }\n };\n};\nconst warnUnknownKeys = (label, obj, knownKeys, deprecatedKeys) => {\n for (const key of Object.keys(obj)) {\n if (knownKeys.has(key)) {\n continue;\n }\n if (deprecatedKeys == null ? void 0 : deprecatedKeys.has(key)) {\n console.warn(\n `[BasisTheory] Deprecated option \"${key}\" in ${label}. ${deprecatedKeys.get(key)}`\n );\n continue;\n }\n console.warn(\n `[BasisTheory] Unknown option \"${key}\" in ${label}. This option will be ignored. See https://developers.basistheory.com/docs/ for supported options.`\n );\n }\n};\nconst VALID_ENVIRONMENTS = [\"us\", \"eu\", \"test\"];\nconst KNOWN_SDK_KEYS = /* @__PURE__ */ new Set([\n \"elementsBaseUrl\",\n \"whitelabelDomain\",\n \"apiBaseUrl\",\n \"environment\",\n \"debug\",\n \"allowClipboard\",\n \"allowHttpClient\",\n \"measurePerformance\",\n \"timeoutMs\",\n \"retryConfig\",\n \"themeMode\",\n \"direction\",\n \"language\",\n \"theme\",\n \"darkTheme\",\n \"sessionAuthorizationUrl\"\n]);\nconst DEPRECATED_SDK_KEYS = /* @__PURE__ */ new Map([\n [\"iframeOrigin\", 'Use \"elementsBaseUrl\" instead.']\n]);\nconst validateAPIKey = (apiKey) => {\n if (!apiKey || typeof apiKey !== \"string\" || apiKey.trim().length === 0) {\n throw ConfigurationError(\"API key is required\");\n }\n};\nconst validateSDKConfig = (options = {}) => {\n var _a, _b, _c;\n warnUnknownKeys(\n \"SDKOptions\",\n options,\n KNOWN_SDK_KEYS,\n DEPRECATED_SDK_KEYS\n );\n const baseUrl = options.elementsBaseUrl || options.iframeOrigin;\n if (baseUrl !== void 0) {\n if (typeof baseUrl !== \"string\" || baseUrl.trim().length === 0) {\n throw ConfigurationError(\"elementsBaseUrl must be a non-empty string\");\n }\n try {\n new URL(baseUrl);\n } catch {\n throw ConfigurationError(\"elementsBaseUrl must be a valid URL\");\n }\n }\n if (options.apiBaseUrl !== void 0) {\n if (typeof options.apiBaseUrl !== \"string\" || options.apiBaseUrl.trim().length === 0) {\n throw ConfigurationError(\"apiBaseUrl must be a non-empty string\");\n }\n try {\n new URL(options.apiBaseUrl);\n } catch {\n throw ConfigurationError(\"apiBaseUrl must be a valid URL\");\n }\n }\n if (options.debug !== void 0 && typeof options.debug !== \"boolean\") {\n throw ConfigurationError(\"debug must be a boolean\");\n }\n if (options.allowClipboard !== void 0 && typeof options.allowClipboard !== \"boolean\") {\n throw ConfigurationError(\"allowClipboard must be a boolean\");\n }\n if (options.allowHttpClient !== void 0 && typeof options.allowHttpClient !== \"boolean\") {\n throw ConfigurationError(\"allowHttpClient must be a boolean\");\n }\n if (options.measurePerformance !== void 0 && typeof options.measurePerformance !== \"boolean\") {\n throw ConfigurationError(\"measurePerformance must be a boolean\");\n }\n if (options.timeoutMs !== void 0) {\n if (typeof options.timeoutMs !== \"number\" || options.timeoutMs <= 0) {\n throw ConfigurationError(\"timeoutMs must be a positive number\");\n }\n }\n const retryConfig = {\n maxRetries: ((_a = options.retryConfig) == null ? void 0 : _a.maxRetries) ?? 3,\n delayMs: ((_b = options.retryConfig) == null ? void 0 : _b.delayMs) ?? 1e3,\n backoffFactor: ((_c = options.retryConfig) == null ? void 0 : _c.backoffFactor) ?? 2\n };\n if (typeof retryConfig.maxRetries !== \"number\" || retryConfig.maxRetries < 0) {\n throw ConfigurationError(\"maxRetries must be a non-negative number\");\n }\n if (typeof retryConfig.delayMs !== \"number\" || retryConfig.delayMs <= 0) {\n throw ConfigurationError(\"retryConfig.delayMs must be a positive number\");\n }\n if (typeof retryConfig.backoffFactor !== \"number\" || retryConfig.backoffFactor < 1) {\n throw ConfigurationError(\"retryConfig.backoffFactor must be >= 1\");\n }\n const themeMode = options.themeMode || \"auto\";\n if (![\"light\", \"dark\", \"auto\"].includes(themeMode)) {\n throw ConfigurationError('themeMode must be \"light\", \"dark\", or \"auto\"');\n }\n if (options.environment !== void 0) {\n if (!VALID_ENVIRONMENTS.includes(options.environment)) {\n throw ConfigurationError(\n `environment must be ${VALID_ENVIRONMENTS.map((e) => `\"${e}\"`).join(\", \")}`\n );\n }\n }\n const direction = options.direction ?? \"ltr\";\n if (![\"ltr\", \"rtl\"].includes(direction)) {\n throw ConfigurationError('direction must be \"ltr\" or \"rtl\"');\n }\n if (options.language !== void 0 && !isLanguageTag(options.language)) {\n throw ConfigurationError(\"language must be a BCP 47 language tag\");\n }\n if (options.sessionAuthorizationUrl !== void 0) {\n if (typeof options.sessionAuthorizationUrl !== \"string\" || options.sessionAuthorizationUrl.trim() === \"\") {\n throw ConfigurationError(\"sessionAuthorizationUrl must be a non-empty string\");\n }\n try {\n const parsed = new URL(options.sessionAuthorizationUrl, window.location.origin);\n if (parsed.protocol === \"http:\" && parsed.hostname !== \"localhost\" && parsed.hostname !== \"127.0.0.1\") {\n throw ConfigurationError(\"sessionAuthorizationUrl must use https://.\");\n }\n } catch (error) {\n if (error instanceof Error && error.name === \"ConfigurationError\") {\n throw error;\n }\n }\n }\n let resolvedBaseUrl = baseUrl;\n if (resolvedBaseUrl === void 0 && options.whitelabelDomain !== void 0) {\n const { whitelabelDomain } = options;\n if (typeof whitelabelDomain !== \"string\" || whitelabelDomain.trim().length === 0) {\n throw ConfigurationError(\"whitelabelDomain must be a non-empty string\");\n }\n let domainOrigin;\n try {\n const parsed = new URL(whitelabelDomain);\n if (parsed.protocol !== \"https:\") {\n throw ConfigurationError(\"whitelabelDomain must use https://\");\n }\n domainOrigin = parsed.origin;\n } catch (error) {\n if (error instanceof Error && error.name === \"ConfigurationError\") {\n throw error;\n }\n throw ConfigurationError(\"whitelabelDomain must be a valid URL\");\n }\n const { pathname } = new URL(\"https://js.basistheory.com/3.2.0/elements\");\n resolvedBaseUrl = `${domainOrigin}${pathname}`;\n }\n const finalBaseUrl = resolvedBaseUrl || \"https://js.basistheory.com/3.2.0/elements\";\n const iframeOrigin = new URL(finalBaseUrl).origin;\n return {\n iframeOrigin,\n elementsBaseUrl: finalBaseUrl,\n apiBaseUrl: options.apiBaseUrl,\n // Optional - auto-detects if not provided\n environment: options.environment,\n // Optional - resolves as before when unset\n debug: options.debug ?? false,\n allowClipboard: options.allowClipboard ?? false,\n allowHttpClient: options.allowHttpClient ?? false,\n measurePerformance: options.measurePerformance ?? false,\n timeoutMs: options.timeoutMs || 3e4,\n // 30s default for slow 3G connections\n themeMode,\n direction,\n language: options.language,\n theme: mergeWithDefaultTheme(options.theme),\n // Light theme or only theme\n darkTheme: options.darkTheme ? mergeWithDefaultTheme(options.darkTheme) : void 0,\n // Optional dark theme\n retryConfig,\n sessionAuthorizationUrl: options.sessionAuthorizationUrl\n // Optional - required for cardDisplay\n };\n};\nconst COMMON_ELEMENT_KEYS = /* @__PURE__ */ new Set([\n \"placeholder\",\n \"ariaLabel\",\n \"disabled\",\n \"readOnly\",\n \"enterKeyHint\"\n]);\nconst VALID_ENTER_KEY_HINTS = /* @__PURE__ */ new Set([\n \"enter\",\n \"done\",\n \"go\",\n \"next\",\n \"previous\",\n \"search\",\n \"send\"\n]);\nconst CARD_ENTER_KEY_HINT_FIELDS = /* @__PURE__ */ new Set([\n \"cardNumber\",\n \"expiryDate\",\n \"cvv\",\n \"cvc\"\n]);\nconst validateEnterKeyHintValue = (value, label) => {\n if (typeof value !== \"string\" || !VALID_ENTER_KEY_HINTS.has(value)) {\n throw ConfigurationError(\n `${label} must be one of: ${Array.from(VALID_ENTER_KEY_HINTS).join(\", \")}`\n );\n }\n};\nconst ELEMENT_TYPE_KEYS = {\n cardNumber: /* @__PURE__ */ new Set([...COMMON_ELEMENT_KEYS, \"binLookup\", \"coBadge\", \"iconPosition\"]),\n cvv: /* @__PURE__ */ new Set([...COMMON_ELEMENT_KEYS, \"showToggle\", \"conceal\", \"cardBrand\", \"cvvLengths\"]),\n // Internal coordination props\n expiry: /* @__PURE__ */ new Set([...COMMON_ELEMENT_KEYS]),\n text: /* @__PURE__ */ new Set([\n ...COMMON_ELEMENT_KEYS,\n \"validation\",\n \"required\",\n \"maxLength\",\n \"password\",\n \"inputMode\",\n \"mask\",\n \"transform\"\n ]),\n card: /* @__PURE__ */ new Set([\n ...COMMON_ELEMENT_KEYS,\n \"layout\",\n \"stackAt\",\n \"iconPosition\",\n \"cardBrands\",\n \"agentTools\",\n \"cvvRequired\",\n \"binLookup\",\n \"coBadge\"\n ]),\n copyButton: /* @__PURE__ */ new Set([\n \"allowClipboard\",\n \"value\",\n \"text\",\n \"disabled\"\n ]),\n cardDisplay: /* @__PURE__ */ new Set([\n \"tokenId\",\n \"number\",\n \"cvc\",\n \"expiration\",\n \"layout\",\n \"fieldOrder\",\n \"showToggle\",\n \"allowClipboard\"\n ])\n};\nconst CARD_DISPLAY_FIELDS = [\"number\", \"expiration\", \"cvc\"];\nconst CARD_DISPLAY_LABEL_MAX_LENGTH = 100;\nconst validateElementOptions = (type, options = {}) => {\n const validKeys = ELEMENT_TYPE_KEYS[type];\n warnUnknownKeys(\n `ElementOptions (${type})`,\n options,\n validKeys\n );\n if (options.placeholder !== void 0) {\n if (type === \"card\") {\n if (typeof options.placeholder !== \"object\" || options.placeholder === null) {\n throw ConfigurationError(\"placeholder for card element must be an object with cardNumber, expiryDate, and cvv keys\");\n }\n } else if (typeof options.placeholder !== \"string\") {\n throw ConfigurationError(\"placeholder must be a string\");\n }\n }\n if (options.disabled !== void 0 && typeof options.disabled !== \"boolean\") {\n throw ConfigurationError(\"disabled must be a boolean\");\n }\n if (options.readOnly !== void 0 && typeof options.readOnly !== \"boolean\") {\n throw ConfigurationError(\"readOnly must be a boolean\");\n }\n if (options.ariaLabel !== void 0 && typeof options.ariaLabel !== \"string\") {\n throw ConfigurationError(\"ariaLabel must be a string\");\n }\n if (options.iconPosition !== void 0) {\n if (![\"left\", \"right\", \"none\"].includes(options.iconPosition)) {\n throw ConfigurationError('iconPosition must be \"left\", \"right\", or \"none\"');\n }\n }\n if (options.enterKeyHint !== void 0) {\n const enterKeyHint = options.enterKeyHint;\n if (type === \"card\" && typeof enterKeyHint === \"object\" && enterKeyHint !== null && !Array.isArray(enterKeyHint)) {\n warnUnknownKeys(\n \"enterKeyHint\",\n enterKeyHint,\n CARD_ENTER_KEY_HINT_FIELDS\n );\n Object.entries(enterKeyHint).filter(([field]) => CARD_ENTER_KEY_HINT_FIELDS.has(field)).forEach(([field, value]) => {\n if (value !== void 0) {\n validateEnterKeyHintValue(value, `enterKeyHint.${field}`);\n }\n });\n } else {\n validateEnterKeyHintValue(enterKeyHint, \"enterKeyHint\");\n }\n }\n if (type === \"cvv\") {\n const nonBooleanKey = [\"showToggle\", \"conceal\"].find(\n (key) => options[key] !== void 0 && typeof options[key] !== \"boolean\"\n );\n if (nonBooleanKey) {\n throw ConfigurationError(`${nonBooleanKey} must be a boolean`);\n }\n }\n if (type === \"text\") {\n if (options.maxLength !== void 0) {\n if (typeof options.maxLength !== \"number\" || options.maxLength <= 0) {\n throw ConfigurationError(\"maxLength must be a positive number\");\n }\n }\n if (options.password !== void 0 && typeof options.password !== \"boolean\") {\n throw ConfigurationError(\"password must be a boolean\");\n }\n if (options.required !== void 0 && typeof options.required !== \"boolean\") {\n throw ConfigurationError(\"required must be a boolean\");\n }\n if (options.validation !== void 0 && !(options.validation instanceof RegExp)) {\n throw ConfigurationError(\"validation must be a RegExp\");\n }\n if (options.transform) {\n if (!Array.isArray(options.transform) || options.transform.length !== 2 || !(options.transform[0] instanceof RegExp) || typeof options.transform[1] !== \"string\") {\n throw ConfigurationError(\n 'transform must be a tuple of [RegExp, string]. Example: [/-/g, \"\"]'\n );\n }\n }\n }\n if (type === \"copyButton\") {\n const copyOpts = options;\n if (copyOpts.allowClipboard !== true) {\n throw ConfigurationError(\n \"CopyButton requires allowClipboard: true. Clipboard access for raw card data may not be PCI compliant and must be explicitly enabled.\"\n );\n }\n }\n if (type === \"cardDisplay\") {\n const cardDisplayOptions = options;\n if (cardDisplayOptions.layout !== void 0 && ![\"stacked\", \"inline\"].includes(cardDisplayOptions.layout)) {\n throw ConfigurationError('layout must be \"stacked\" or \"inline\"');\n }\n if (cardDisplayOptions.fieldOrder !== void 0) {\n if (!Array.isArray(cardDisplayOptions.fieldOrder)) {\n throw ConfigurationError(\"fieldOrder must be an array of card display fields\");\n }\n const invalidField = cardDisplayOptions.fieldOrder.find(\n (field) => !CARD_DISPLAY_FIELDS.includes(field)\n );\n if (invalidField !== void 0) {\n throw ConfigurationError('fieldOrder entries must be \"number\", \"expiration\", or \"cvc\"');\n }\n if (new Set(cardDisplayOptions.fieldOrder).size !== cardDisplayOptions.fieldOrder.length) {\n throw ConfigurationError(\"fieldOrder must not contain duplicate fields\");\n }\n }\n if (cardDisplayOptions.showToggle !== void 0 && typeof cardDisplayOptions.showToggle !== \"boolean\") {\n throw ConfigurationError(\"showToggle must be a boolean\");\n }\n if (cardDisplayOptions.allowClipboard !== void 0 && typeof cardDisplayOptions.allowClipboard !== \"boolean\") {\n throw ConfigurationError(\"allowClipboard must be a boolean\");\n }\n CARD_DISPLAY_FIELDS.forEach((field) => {\n const fieldOptions = cardDisplayOptions[field];\n if (fieldOptions === void 0) return;\n if (typeof fieldOptions !== \"object\" || fieldOptions === null) {\n throw ConfigurationError(`${field} must be a field display configuration object`);\n }\n if (fieldOptions.display !== void 0 && ![\"masked\", \"hidden\", \"visible\"].includes(fieldOptions.display)) {\n throw ConfigurationError(`${field}.display must be \"masked\", \"hidden\", or \"visible\"`);\n }\n if (fieldOptions.label !== void 0 && fieldOptions.label !== false && typeof fieldOptions.label !== \"string\") {\n throw ConfigurationError(`${field}.label must be a string or false`);\n }\n if (typeof fieldOptions.label === \"string\" && fieldOptions.label.length > CARD_DISPLAY_LABEL_MAX_LENGTH) {\n throw ConfigurationError(\n `${field}.label must be ${CARD_DISPLAY_LABEL_MAX_LENGTH} characters or fewer`\n );\n }\n });\n }\n if (type === \"card\") {\n const cardOptions = options;\n if (cardOptions.layout !== void 0) {\n if (![\"row\", \"column\", \"auto\"].includes(cardOptions.layout)) {\n throw ConfigurationError('layout must be \"row\", \"column\", or \"auto\"');\n }\n }\n if (cardOptions.stackAt !== void 0) {\n if (typeof cardOptions.stackAt !== \"number\" || cardOptions.stackAt <= 0) {\n throw ConfigurationError(\"stackAt must be a positive number\");\n }\n }\n if (cardOptions.cardBrands !== void 0) {\n if (!Array.isArray(cardOptions.cardBrands)) {\n throw ConfigurationError(\"cardBrands must be an array of strings\");\n }\n if (cardOptions.cardBrands.some((brand) => typeof brand !== \"string\")) {\n throw ConfigurationError(\"All cardBrands must be strings\");\n }\n }\n if (cardOptions.agentTools !== void 0 && typeof cardOptions.agentTools !== \"boolean\") {\n throw ConfigurationError(\"agentTools must be a boolean\");\n }\n if (cardOptions.cvvRequired !== void 0 && typeof cardOptions.cvvRequired !== \"boolean\") {\n throw ConfigurationError(\"cvvRequired must be a boolean\");\n }\n }\n};\nconst BasisTheory = (apiKey, options = {}, queuedCommands) => {\n validateAPIKey(apiKey);\n const config = validateSDKConfig(options);\n const log2 = createDebugLogger(\"SDK\", config.debug || false);\n log2(\"SDK initialized\", {\n apiKeyPrefix: apiKey.substring(0, 7) + \"...\",\n elementsBaseUrl: config.elementsBaseUrl,\n iframeOrigin: config.iframeOrigin,\n debug: config.debug || false\n });\n const elements = /* @__PURE__ */ new Map();\n let coordinatorIframe = null;\n let coordinatorClient = null;\n let coordinatorReadyPromise = null;\n let coordinatorInitStarted = false;\n let coordinatorLoadTimeout = null;\n let rejectCoordinatorLoad = null;\n let destroyed = false;\n const assertNotDestroyed = () => {\n if (destroyed) {\n throw ConfigurationError(\n \"SDK instance has been destroyed. Create a new instance with BasisTheory()\"\n );\n }\n };\n const guardSync = (fn) => (...args) => {\n assertNotDestroyed();\n return fn(...args);\n };\n const guardAsync = (fn) => async (...args) => {\n assertNotDestroyed();\n return fn(...args);\n };\n let currentThemeMode = options.themeMode || \"auto\";\n const createLazyElementWrapper = (lazyFactory, elementType, elementId, elementApiKey, elementConfig, elementOptions, ensureCoordinator, notifyUnmount, coordinatorRequest) => {\n let realElement = null;\n let loadPromise = null;\n const loadRealElement = async () => {\n if (!loadPromise) {\n loadPromise = (async () => {\n const factory = await lazyFactory();\n realElement = factory(\n elementApiKey,\n elementConfig,\n elementOptions,\n elementId,\n ensureCoordinator,\n notifyUnmount,\n coordinatorRequest\n );\n })();\n }\n await loadPromise;\n };\n const ensureLoaded = () => {\n if (!realElement) throw ElementError(\"Element not initialized\");\n return realElement;\n };\n const wrapper = {\n id: elementId,\n type: elementType,\n get mounted() {\n return (realElement == null ? void 0 : realElement.mounted) ?? false;\n },\n get loaded() {\n return (realElement == null ? void 0 : realElement.loaded) ?? false;\n },\n mount: async (selector) => {\n await loadRealElement();\n return realElement.mount(selector);\n },\n unmount: () => ensureLoaded().unmount(),\n update: async (opts) => ensureLoaded().update(opts),\n focus: () => ensureLoaded().focus(),\n blur: () => ensureLoaded().blur(),\n clear: () => ensureLoaded().clear(),\n on: (eventType, listener) => {\n if (!realElement) {\n let unsubscribe = null;\n let cancelled = false;\n loadRealElement().then(() => {\n if (!cancelled) unsubscribe = realElement.on(eventType, listener);\n });\n return () => {\n cancelled = true;\n unsubscribe == null ? void 0 : unsubscribe();\n };\n }\n return realElement.on(eventType, listener);\n },\n setValueRef: async (refElement) => {\n if (!realElement) {\n await loadRealElement();\n }\n if (realElement && \"setValueRef\" in realElement && typeof realElement.setValueRef === \"function\") {\n return realElement.setValueRef(refElement);\n }\n throw ElementError(\"setValueRef not available on this element type\");\n }\n };\n if (elementType === \"card\") {\n Object.defineProperties(wrapper, {\n number: {\n get: () => realElement == null ? void 0 : realElement.number,\n enumerable: true\n },\n expiryDate: {\n get: () => realElement == null ? void 0 : realElement.expiryDate,\n enumerable: true\n },\n cvc: {\n get: () => realElement == null ? void 0 : realElement.cvc,\n enumerable: true\n }\n });\n }\n return wrapper;\n };\n const notifyCoordinatorElementUnmount = async (elementId) => {\n if (!coordinatorClient) {\n log2(\"Cannot notify coordinator of unmount - coordinator not initialized\", {\n elementId\n });\n return;\n }\n try {\n await coordinatorClient.sendRequest(\"CMD_BROADCAST_ELEMENT_UNMOUNT\", {\n elementId\n });\n log2(\"Notified coordinator of element unmount\", { elementId });\n } catch (error) {\n log2(\"Failed to notify coordinator of element unmount\", {\n elementId,\n error: error.message\n });\n }\n };\n const sendCoordinatorRequest = async (command, payload, options2) => {\n if (!coordinatorClient) {\n throw CoordinatorError(\"Coordinator not initialized\");\n }\n return coordinatorClient.sendRequest(command, payload, options2);\n };\n let cardElementFactory = null;\n let copyButtonElementFactory = null;\n let cardDisplayElementFactory = null;\n const lazyCardElement = async () => {\n if (!cardElementFactory) {\n const module = await import(\"./create-card-BEILS1VB.js\");\n cardElementFactory = module.createCardElement;\n }\n return cardElementFactory;\n };\n const lazyCopyButtonElement = async () => {\n if (!copyButtonElementFactory) {\n const module = await import(\"./create-copy-button-CAYmfugS.js\");\n copyButtonElementFactory = module.createCopyButtonElement;\n }\n return copyButtonElementFactory;\n };\n const lazyCardDisplayElement = async () => {\n if (!cardDisplayElementFactory) {\n const module = await import(\"./create-card-display-Dv5pcpzc.js\");\n cardDisplayElementFactory = module.createCardDisplayElement;\n }\n return cardDisplayElementFactory;\n };\n const syncFactories = {\n cardNumber: createCardNumberElement,\n cvv: createCVVElement,\n expiry: createExpiryElement,\n text: createTextElement\n };\n const lazyFactories = {\n card: lazyCardElement,\n copyButton: lazyCopyButtonElement,\n cardDisplay: lazyCardDisplayElement\n };\n const ensureCoordinatorInitialized = () => {\n if (coordinatorReadyPromise) {\n return coordinatorReadyPromise;\n }\n if (coordinatorInitStarted) {\n return coordinatorReadyPromise;\n }\n coordinatorInitStarted = true;\n coordinatorReadyPromise = initializeCoordinator();\n return coordinatorReadyPromise;\n };\n const initializeCoordinator = async () => {\n if (coordinatorIframe) {\n log2(\"Coordinator already initialized\", {\n loaded: coordinatorIframe.contentWindow !== null\n });\n return;\n }\n log2(\"Initializing coordinator iframe\", {\n elementsBaseUrl: config.elementsBaseUrl\n });\n coordinatorIframe = document.createElement(\"iframe\");\n coordinatorIframe.setAttribute(\"name\", \"bt-coordinator\");\n coordinatorIframe.setAttribute(\"title\", \"BasisTheory Coordinator\");\n coordinatorIframe.setAttribute(\"role\", \"none\");\n coordinatorIframe.style.border = \"none\";\n coordinatorIframe.style.width = \"0\";\n coordinatorIframe.style.height = \"0\";\n coordinatorIframe.style.position = \"absolute\";\n coordinatorIframe.style.top = \"-9999px\";\n coordinatorIframe.style.left = \"-9999px\";\n const baseUrl = config.elementsBaseUrl.endsWith(\"/\") ? config.elementsBaseUrl : `${config.elementsBaseUrl}/`;\n const coordinatorUrl = new URL(\"coordinator.html\", baseUrl);\n coordinatorUrl.searchParams.set(\"parentOrigin\", window.location.origin);\n coordinatorIframe.src = coordinatorUrl.toString();\n document.body.appendChild(coordinatorIframe);\n log2(\"Coordinator iframe mounted\", {\n url: coordinatorIframe.src\n });\n await new Promise((resolve, reject) => {\n rejectCoordinatorLoad = reject;\n coordinatorLoadTimeout = setTimeout(() => {\n coordinatorLoadTimeout = null;\n rejectCoordinatorLoad = null;\n reject(\n new Error(\n `Coordinator load timeout (${config.timeoutMs}ms). Try increasing timeoutMs for slow connections.`\n )\n );\n }, config.timeoutMs);\n coordinatorIframe.addEventListener(\n \"load\",\n () => {\n if (coordinatorLoadTimeout !== null) {\n clearTimeout(coordinatorLoadTimeout);\n }\n coordinatorLoadTimeout = null;\n rejectCoordinatorLoad = null;\n log2(\"Coordinator iframe loaded\");\n resolve();\n },\n { once: true }\n );\n });\n if (destroyed) {\n log2(\"Coordinator load resolved after destroy — aborting init\");\n return;\n }\n coordinatorClient = createPostMessageClient(coordinatorIframe, {\n targetOrigin: new URL(config.elementsBaseUrl).origin,\n timeout: 3e4,\n retries: 3,\n debug: config.debug || false\n });\n log2(\"Coordinator PostMessage client created\");\n await coordinatorClient.sendRequest(\"CMD_SET_CONFIG\", {\n apiKey,\n apiBaseUrl: config.apiBaseUrl,\n // Optional - auto-detects if not provided\n environment: config.environment,\n // Optional - resolves as before when unset\n apiTimeout: 3e4,\n apiRetries: 3,\n // Frozen by the coordinator on this first config; copy references are\n // refused unless it's enabled here.\n allowClipboard: config.allowClipboard,\n // Frozen alongside allowClipboard; bt.client.* is refused unless enabled here.\n allowHttpClient: config.allowHttpClient,\n debug: config.debug || false,\n theme: config.theme,\n darkTheme: config.darkTheme,\n themeMode: config.themeMode\n // sessionAuthorizationUrl is intentionally NOT sent to the coordinator:\n // the merchant-authorization fetch now runs in the parent page (see\n // create-card-display.ts), so the coordinator never needs the URL.\n });\n log2(\"Coordinator initialized successfully\");\n };\n const sdk = {\n /**\n * PERFORMANCE OPTIMIZATION (Step 2 & 3):\n * createElement is now SYNCHRONOUS - returns Element instantly\n * Coordinator initialization starts on first element (but doesn't block)\n */\n createElement: guardSync((type, elementOptions) => {\n const syncFactory = syncFactories[type];\n const lazyFactory = lazyFactories[type];\n if (!syncFactory && !lazyFactory) {\n throw ConfigurationError(`Unknown element type: ${type}`);\n }\n if (elementOptions) {\n validateElementOptions(type, elementOptions);\n }\n if (type === \"copyButton\" && !config.allowClipboard) {\n throw ConfigurationError(\n \"copyButton requires allowClipboard: true on BasisTheory() initialization. Clipboard access for raw card data may not be PCI compliant and must be enabled explicitly.\",\n { received: config.allowClipboard, expected: true, elementType: type }\n );\n }\n if (type === \"cardDisplay\" && (elementOptions == null ? void 0 : elementOptions.allowClipboard) === true && !config.allowClipboard) {\n throw ConfigurationError(\n \"cardDisplay clipboard access requires allowClipboard: true on BasisTheory() initialization. Clipboard access for raw card data may not be PCI compliant and must be enabled explicitly.\",\n { received: config.allowClipboard, expected: true, elementType: type }\n );\n }\n const localElementId = `${type}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n log2(\"Creating element (sync)\", {\n type,\n elementId: localElementId,\n coordinatorInitialized: coordinatorIframe !== null,\n isLazyLoaded: !!lazyFactory\n });\n let element;\n if (syncFactory) {\n element = syncFactory(\n apiKey,\n config,\n elementOptions,\n localElementId,\n ensureCoordinatorInitialized,\n notifyCoordinatorElementUnmount,\n sendCoordinatorRequest\n );\n } else {\n element = createLazyElementWrapper(\n lazyFactory,\n type,\n localElementId,\n apiKey,\n config,\n elementOptions,\n ensureCoordinatorInitialized,\n notifyCoordinatorElementUnmount,\n sendCoordinatorRequest\n );\n }\n elements.set(element.id, element);\n if (type === \"cardNumber\") {\n element.on(\"change\", (event) => {\n const { cardBrand, cvvLengths } = event.detail;\n log2(\"Card number change event received\", {\n cardBrand,\n cvvLengths,\n cvvElementsCount: Array.from(elements.values()).filter(\n (el) => el.type === \"cvv\"\n ).length\n });\n if (cardBrand && cardBrand !== \"Unknown\" && cvvLengths) {\n for (const [id, cvvElement] of elements) {\n if (cvvElement.type === \"cvv\" && cvvElement.mounted) {\n log2(\"Coordinating CVV element with card brand\", {\n cvvElementId: id,\n cardBrand,\n cvvLengths,\n mounted: cvvElement.mounted\n });\n cvvElement.update({\n cardBrand,\n cvvLengths\n // Send cvvLengths array instead of full brandDefinition\n }).catch((error) => {\n log2(\"Failed to update CVV element with card brand\", {\n cvvElementId: id,\n cardBrand,\n error: error.message\n });\n });\n }\n }\n }\n });\n }\n return element;\n }),\n tokenize: guardAsync(async (payload, options2) => {\n log2(\"tokenize called\", {\n hasPayload: !!payload,\n hasOptions: !!options2,\n coordinatorReady: !!coordinatorClient\n });\n if (!coordinatorClient) {\n log2(\"Waiting for coordinator initialization\");\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw CoordinatorError(\"Coordinator failed to initialize\");\n }\n try {\n const resolvedPayload = payload ? resolveElementReferences(payload) : {};\n log2(\"Element references resolved\", {\n originalPayload: !!payload,\n resolvedPayload: !!resolvedPayload\n });\n log2(\"Delegating tokenization to coordinator\");\n const token = await coordinatorClient.sendRequest(\n \"CMD_TOKENIZE\",\n {\n payload: resolvedPayload,\n options: options2\n }\n );\n log2(\"tokenize successful\", {\n tokenId: token.id\n });\n return token;\n } catch (error) {\n log2(\"tokenize failed\", {\n error: error.message\n });\n throw error;\n }\n }),\n /**\n * Token CRUD operations\n * Supports Element references - automatically resolves to secure values\n */\n tokens: {\n /**\n * Create a new token\n * Supports Element references in data (same as tokenize)\n */\n create: guardAsync(async (request) => {\n if (!request || typeof request !== \"object\" || Array.isArray(request)) {\n throw ValidationError(\"Token data must be a non-null object\");\n }\n log2(\"tokens.create called\", {\n type: request.type,\n hasData: !!request.data\n });\n if (!coordinatorClient) {\n log2(\"Waiting for coordinator initialization\");\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const resolvedRequest = {\n ...request,\n data: resolveElementReferences(request.data)\n };\n log2(\"Element references resolved for tokens.create\", {\n resolvedData: !!resolvedRequest\n });\n const token = await coordinatorClient.sendRequest(\n \"CMD_TOKENS_CREATE\",\n { data: resolvedRequest }\n );\n log2(\"tokens.create successful\", { tokenId: token.id });\n return token;\n } catch (error) {\n log2(\"tokens.create failed\", {\n error: error.message\n });\n throw error;\n }\n }),\n /**\n * Retrieve a token by ID\n *\n * @param id - Token ID to retrieve\n * @param options - Optional configuration\n * @param options.apiKey - Optional session key for authorized access (from sessions.create + authorize)\n */\n retrieve: guardAsync(async (id, options2) => {\n log2(\"tokens.retrieve called\", {\n tokenId: id,\n hasSessionKey: !!(options2 == null ? void 0 : options2.apiKey)\n });\n if (!coordinatorClient) {\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const token = await coordinatorClient.sendRequest(\n \"CMD_TOKENS_RETRIEVE\",\n {\n id,\n apiKey: options2 == null ? void 0 : options2.apiKey\n // Pass session key to coordinator\n }\n );\n log2(\"tokens.retrieve successful\", {\n tokenId: token.id\n });\n return token;\n } catch (error) {\n log2(\"tokens.retrieve failed\", {\n error: error.message\n });\n throw error;\n }\n }),\n /**\n * Update a token\n * Supports Element references in data\n */\n update: guardAsync(async (id, request) => {\n log2(\"tokens.update called\", { tokenId: id });\n if (!coordinatorClient) {\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const resolvedRequest = request.data ? { ...request, data: resolveElementReferences(request.data) } : request;\n const token = await coordinatorClient.sendRequest(\n \"CMD_TOKENS_UPDATE\",\n { id, data: resolvedRequest }\n );\n log2(\"tokens.update successful\", { tokenId: token.id });\n return token;\n } catch (error) {\n log2(\"tokens.update failed\", {\n error: error.message\n });\n throw error;\n }\n }),\n /**\n * Encrypt token data with client-side JWE\n * Uses ECDH-ES key agreement and A256GCM authenticated encryption\n * Supports Element references - automatically resolves to secure values\n *\n * @param tokenData - Single token or multiple tokens to encrypt\n * @param publicKeyPEM - X25519 public key in PEM format\n * @param keyId - Key identifier for decryption lookup\n * @returns Encrypted JWE token(s)\n */\n encrypt: guardAsync(async (tokenData, publicKeyPEM, keyId) => {\n log2(\"tokens.encrypt called\", {\n isSingleToken: \"type\" in tokenData && \"data\" in tokenData,\n keyId\n });\n if (!tokenData || typeof tokenData !== \"object\") {\n throw ValidationError(\"tokenData must be an object\");\n }\n if (!publicKeyPEM || typeof publicKeyPEM !== \"string\") {\n throw ValidationError(\"publicKeyPEM is required\");\n }\n if (!keyId || typeof keyId !== \"string\") {\n throw ValidationError(\"keyId is required\");\n }\n if (!coordinatorClient) {\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const resolvedTokenData = resolveElementReferences(tokenData);\n log2(\"Element references resolved for tokens.encrypt\", {\n originalData: !!tokenData,\n resolvedData: !!resolvedTokenData\n });\n const encrypted = await coordinatorClient.sendRequest(\"CMD_TOKENS_ENCRYPT\", {\n tokenRequests: resolvedTokenData,\n publicKeyPEM,\n keyId\n });\n log2(\"tokens.encrypt successful\", {\n isSingleToken: \"encrypted\" in encrypted && \"type\" in encrypted\n });\n return encrypted;\n } catch (error) {\n log2(\"tokens.encrypt failed\", {\n error: error.message\n });\n throw error;\n }\n })\n },\n sessions: {\n /**\n * Create a new session for temporary elevated access\n * Note: Session must be authorized by a Private Application on your backend\n */\n create: guardAsync(async () => {\n log2(\"sessions.create called\");\n if (!coordinatorClient) {\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const session = await coordinatorClient.sendRequest(\n \"CMD_SESSIONS_CREATE\",\n {}\n );\n log2(\"sessions.create successful\", {\n nonce: session.nonce,\n expiresAt: session.expires_at\n });\n return session;\n } catch (error) {\n log2(\"sessions.create failed\", {\n error: error.message\n });\n throw error;\n }\n })\n },\n tokenIntents: {\n /**\n * Create a token intent with element reference support\n */\n create: guardAsync(async (data, options2) => {\n log2(\"tokenIntents.create called\", {\n type: data.type,\n hasData: !!data.data,\n hasOptions: !!options2\n });\n if (!coordinatorClient) {\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const resolvedData = resolveElementReferences(data.data);\n log2(\"Element references resolved for token intent\");\n const intent = await coordinatorClient.sendRequest(\n \"CMD_TOKEN_INTENTS_CREATE\",\n {\n type: data.type,\n data: resolvedData,\n options: options2\n }\n );\n log2(\"tokenIntents.create successful\", {\n intentId: intent.id\n });\n return intent;\n } catch (error) {\n log2(\"tokenIntents.create failed\", {\n error: error.message\n });\n throw error;\n }\n }),\n /**\n * Get a token intent by ID\n */\n get: guardAsync(async (id, options2) => {\n log2(\"tokenIntents.get called\", {\n intentId: id\n });\n if (!coordinatorClient) {\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw new Error(\"Coordinator failed to initialize\");\n }\n try {\n const intent = await coordinatorClient.sendRequest(\n \"CMD_TOKEN_INTENTS_GET\",\n {\n id,\n options: options2\n }\n );\n log2(\"tokenIntents.get successful\", {\n intentId: intent.id\n });\n return intent;\n } catch (error) {\n log2(\"tokenIntents.get failed\", {\n error: error.message\n });\n throw error;\n }\n })\n },\n proxy: (() => {\n const invokeProxy = guardAsync(async (method, options2 = {}) => {\n validateProxyOptions({ ...options2, method });\n log2(\"proxy invoked\", {\n method,\n hasUrl: !!options2.url,\n hasProxyKey: !!options2.proxyKey,\n hasApiKey: !!options2.apiKey\n });\n if (!coordinatorClient) {\n log2(\"Waiting for coordinator initialization\");\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw CoordinatorError(\"Coordinator failed to initialize\");\n }\n const resolvedBody = options2.body !== void 0 ? resolveElementReferences(options2.body) : void 0;\n try {\n const result = await coordinatorClient.sendRequest(\n \"CMD_PROXY\",\n {\n method,\n url: options2.url,\n proxyKey: options2.proxyKey,\n headers: options2.headers,\n body: resolvedBody,\n includeResponseHeaders: options2.includeResponseHeaders,\n apiKey: options2.apiKey\n },\n { retries: 0 }\n );\n log2(\"proxy successful\", { method });\n return result;\n } catch (error) {\n log2(\"proxy failed\", {\n method,\n error: error.message\n });\n throw error;\n }\n });\n const proxyVerb = (method) => (options2) => invokeProxy(method, options2 ?? {});\n return {\n get: proxyVerb(\"GET\"),\n post: proxyVerb(\"POST\"),\n put: proxyVerb(\"PUT\"),\n patch: proxyVerb(\"PATCH\"),\n delete: proxyVerb(\"DELETE\")\n };\n })(),\n client: (() => {\n const invokeClient = guardAsync(async (method, url, body, options2 = {}) => {\n if (!config.allowHttpClient) {\n throw ConfigurationError(\n \"bt.client requires allowHttpClient: true on BasisTheory() initialization. Sending card data to a third party may affect PCI scope and must be enabled deliberately.\",\n { received: config.allowHttpClient, expected: true }\n );\n }\n validateDestinationRequest({ url, method, headers: options2 == null ? void 0 : options2.headers });\n log2(\"client invoked\", { method, hasBody: body !== void 0 });\n if (!coordinatorClient) {\n log2(\"Waiting for coordinator initialization\");\n await initializeCoordinator();\n }\n if (!coordinatorClient) {\n throw CoordinatorError(\"Coordinator failed to initialize\");\n }\n const resolvedBody = body !== void 0 ? resolveElementReferences(body) : void 0;\n try {\n const result = await coordinatorClient.sendRequest(\n \"CMD_HTTP_CLIENT\",\n {\n method,\n url,\n headers: options2 == null ? void 0 : options2.headers,\n body: resolvedBody\n },\n { retries: 0 }\n );\n log2(\"client successful\", { method });\n return result;\n } catch (error) {\n log2(\"client failed\", { method, error: error.message });\n const transportError = error;\n if (transportError.code === \"HTTP_CLIENT_ERROR\") {\n throw HttpClientError(\n transportError.message.replace(/^\\[HTTP_CLIENT_ERROR\\] /, \"\"),\n transportError.status ?? -1,\n transportError.data,\n transportError.headers\n );\n }\n throw error;\n }\n });\n const withBody = (method) => (url, body, options2) => invokeClient(method, url, body, options2 ?? {});\n const withoutBody = (method) => (url, options2) => invokeClient(method, url, void 0, options2 ?? {});\n return {\n get: withoutBody(\"GET\"),\n post: withBody(\"POST\"),\n put: withBody(\"PUT\"),\n patch: withBody(\"PATCH\"),\n delete: withoutBody(\"DELETE\")\n };\n })(),\n updateThemeMode: guardAsync(async (mode) => {\n log2(\"updateThemeMode called\", {\n oldMode: currentThemeMode,\n newMode: mode,\n mountedElements: Array.from(elements.values()).filter(\n (el) => el.mounted\n ).length\n });\n currentThemeMode = mode;\n const updatePromises = [];\n for (const [id, element] of elements) {\n if (element.mounted) {\n log2(\"Sending theme mode update to element\", {\n elementId: id,\n elementType: element.type,\n mode\n });\n const iframe = document.querySelector(\n `iframe[data-bt-element-id=\"${element.id}\"]`\n );\n if (iframe) {\n iframe.setAttribute(\"data-theme-mode\", mode);\n }\n const updatePromise = element.update({\n themeMode: mode\n }).catch((error) => {\n log2(\"Failed to update theme mode for element\", {\n elementId: id,\n error: error.message\n });\n });\n updatePromises.push(updatePromise);\n }\n }\n await Promise.all(updatePromises);\n log2(\"Theme mode updated for all mounted elements\", {\n mode,\n updatedCount: Array.from(elements.values()).filter((el) => el.mounted).length\n });\n }),\n /**\n * Destroys this instance and removes its elements from the page. Once\n * destroyed, its other methods throw; create a new instance with\n * BasisTheory() to recover. Safe to call more than once.\n */\n destroy: async () => {\n if (destroyed) {\n return;\n }\n destroyed = true;\n log2(\"Destroying SDK instance\", {\n elementCount: elements.size,\n hasCoordinator: coordinatorIframe !== null\n });\n for (const [id, element] of elements) {\n if (!element.mounted) {\n continue;\n }\n try {\n element.unmount();\n } catch (error) {\n log2(\"Failed to unmount element during destroy\", {\n elementId: id,\n error: error.message\n });\n }\n }\n elements.clear();\n if (coordinatorLoadTimeout !== null) {\n clearTimeout(coordinatorLoadTimeout);\n coordinatorLoadTimeout = null;\n }\n if (rejectCoordinatorLoad) {\n rejectCoordinatorLoad(\n ConfigurationError(\n \"SDK instance has been destroyed. Create a new instance with BasisTheory()\"\n )\n );\n rejectCoordinatorLoad = null;\n }\n if (coordinatorClient) {\n const CACHE_CLEAR_TIMEOUT_MS = 2e3;\n const cacheCleared = coordinatorClient.sendRequest(\"CMD_CLEAR_ALL_CACHE\", {}, { retries: 0 }).catch((error) => {\n log2(\"Failed to clear coordinator cache during destroy\", {\n error: error.message\n });\n });\n let capTimeout;\n const cap = new Promise((resolve) => {\n capTimeout = setTimeout(() => {\n log2(\"Coordinator cache-clear timed out during destroy\", {\n timeoutMs: CACHE_CLEAR_TIMEOUT_MS\n });\n resolve();\n }, CACHE_CLEAR_TIMEOUT_MS);\n });\n await Promise.race([cacheCleared, cap]);\n if (capTimeout !== void 0) {\n clearTimeout(capTimeout);\n }\n }\n if (coordinatorClient) {\n coordinatorClient.destroy();\n coordinatorClient = null;\n }\n if (coordinatorIframe) {\n coordinatorIframe.remove();\n coordinatorIframe = null;\n }\n coordinatorReadyPromise = null;\n coordinatorInitStarted = false;\n log2(\"SDK instance destroyed\");\n }\n };\n if (queuedCommands && queuedCommands.length > 0) {\n log2(\"Draining command queue from loader\", {\n queueLength: queuedCommands.length,\n commands: queuedCommands.map((cmd) => cmd.method)\n });\n for (const cmd of queuedCommands) {\n try {\n const method = sdk[cmd.method];\n if (!method) {\n throw new Error(`Unknown method: ${cmd.method}`);\n }\n log2(\"Replaying queued command\", {\n method: cmd.method,\n argsCount: cmd.args.length\n });\n const result = method(...cmd.args);\n if (result && typeof result.then === \"function\") {\n result.then((value) => {\n log2(\"Queued command completed (async)\", {\n method: cmd.method\n });\n cmd.resolve(value);\n }).catch((error) => {\n log2(\"Queued command failed (async)\", {\n method: cmd.method,\n error: error.message\n });\n cmd.reject(error);\n });\n } else {\n log2(\"Queued command completed (sync)\", {\n method: cmd.method\n });\n cmd.resolve(result);\n }\n } catch (error) {\n log2(\"Queued command failed (sync)\", {\n method: cmd.method,\n error: error.message\n });\n cmd.reject(error);\n }\n }\n log2(\"Command queue drain complete\", {\n processedCount: queuedCommands.length\n });\n }\n return sdk;\n};\nif (typeof window !== \"undefined\" && typeof document !== \"undefined\" && document.currentScript && !window.BasisTheory) {\n window.BasisTheory = BasisTheory;\n}\nconst version = \"3.2.0\";\nconst buildDate = \"2026-09-25T17:41:01.640Z\";\nif (typeof window !== \"undefined\") {\n window.__BasisTheorySDK__ = BasisTheory;\n}\nexport {\n BasisTheory as B,\n ConfigurationError as C,\n ElementError as E,\n createPostMessageClient as a,\n bindCoordinatorPort as b,\n createIframe as c,\n createEventDispatcher as d,\n createMounter as e,\n buildDate as f,\n log as l,\n version as v\n};\n"],"ignoreList":[0],"mappings":";AAAA,IAAMC,IAAe;CACnB;CACA;CACA;CACA;AAEF,GACMC,IAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACMC,KAAc,MACXF,EAAa,MAAM,MAAYG,EAAQ,KAAKC,CAAG,CAAC,GAEnDC,KAAiB,MACdJ,EAAgB,MAAM,MAAYE,EAAQ,KAAKC,CAAG,CAAC,GAEtDE,KAAW,MAAU;CACzB,IAAMC,IAASC,EAAM,QAAQ,OAAO,EAAE;CACtC,IAAID,EAAO,SAAS,IAClB,OAAO;CAET,IAAME,IAASF,EAAO,UAAU,GAAG,CAAC,GAC9BG,IAAQH,EAAO,UAAUA,EAAO,SAAS,CAAC,GAC1CI,IAAe,KAAK,IAAIJ,EAAO,SAAS,IAAI,CAAC;CAEnD,OAAO,GAAGE,IADK,IAAI,OAAOE,CACF,IAAID;AAC9B,GACME,KAAgB,MAAU;CAC9B,IAAML,IAASC,EAAM,QAAQ,UAAU,EAAE;CACzC,OAAO,cAAc,KAAKD,CAAM;AAClC,GACMM,KAAiB,GAAK,MACtBL,KAAU,OACLA,IAEL,OAAOA,KAAU,aACZ,eAEL,OAAOA,KAAU,WACZ,aAELA,aAAiB,SACZ,aAELA,aAAiB,OACZA,IAELN,EAAWE,CAAG,IACZ,OAAOI,KAAU,WACZF,EAAQE,CAAK,IAEf,QAELH,EAAcD,CAAG,IACZ,QAEL,OAAOI,KAAU,YAAYI,EAAaJ,CAAK,IAC1CF,EA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