@primer-io/primer-js 0.2.0 → 0.3.1
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/chunks/{ar.6MRFCKX4.js → ar.KRXB3WQO.js} +1 -1
- package/dist/chunks/{bg.HRSMU7Y5.js → bg.6SKJRXIR.js} +1 -1
- package/dist/chunks/{ca.3FSHJL7U.js → ca.SANDLFEK.js} +1 -1
- package/dist/chunks/chunk.DV3REKZU.js +1 -0
- package/dist/chunks/{cs.WAO4WFS3.js → cs.FC4I5M3C.js} +1 -1
- package/dist/chunks/{da.4OFYGDVA.js → da.YI32NZ7B.js} +1 -1
- package/dist/chunks/{de.3FZS52IN.js → de.7M7UFQB7.js} +1 -1
- package/dist/chunks/{el.A4R7VG5T.js → el.XSGTYDZR.js} +1 -1
- package/dist/chunks/en-GB.VO4GDE3X.js +1 -0
- package/dist/chunks/en.MNFLVOE3.js +1 -0
- package/dist/chunks/{es-AR.QKHDL4JV.js → es-AR.TBWVUZEF.js} +1 -1
- package/dist/chunks/{es-MX.GG7MJMG2.js → es-MX.6EMWUABR.js} +1 -1
- package/dist/chunks/{es.FEZ6BF3S.js → es.XZLDFHYI.js} +1 -1
- package/dist/chunks/{et-EE.FJLPTMF3.js → et-EE.JBSFMKZ2.js} +1 -1
- package/dist/chunks/{fi-FI.DM5R27A5.js → fi-FI.I75VK2ID.js} +1 -1
- package/dist/chunks/{fr.YZV52NTA.js → fr.JBNP6RXT.js} +1 -1
- package/dist/chunks/{he.6SCF3XZZ.js → he.PW253QAL.js} +1 -1
- package/dist/chunks/{hr.PPDZ7AAS.js → hr.LM4RITYJ.js} +1 -1
- package/dist/chunks/{hu.6WOPSGLW.js → hu.JGCKQA6J.js} +1 -1
- package/dist/chunks/{id.NS22WGWL.js → id.VBXULDDY.js} +1 -1
- package/dist/chunks/{it.42TO3R4G.js → it.7Q6BFLDK.js} +1 -1
- package/dist/chunks/{ja.UEGHEUAP.js → ja.QOC76SSC.js} +1 -1
- package/dist/chunks/{ko.HTMDY6RY.js → ko.BANZIFNH.js} +1 -1
- package/dist/chunks/{lt-LT.4U3GBQTQ.js → lt-LT.Q2SRJOKH.js} +1 -1
- package/dist/chunks/{lt.73ME4TDM.js → lt.XMNFEN5T.js} +1 -1
- package/dist/chunks/{lv-LV.JRWO2BF6.js → lv-LV.3AJDTMU5.js} +1 -1
- package/dist/chunks/{lv.KROS45TV.js → lv.TFPDXNEV.js} +1 -1
- package/dist/chunks/{ms.HE3SWJFQ.js → ms.FPTX4NM4.js} +1 -1
- package/dist/chunks/{nb.TR6TEKBY.js → nb.CAFSKRQ2.js} +1 -1
- package/dist/chunks/{nl.V5QP6OXL.js → nl.7BPSDYTC.js} +1 -1
- package/dist/chunks/{nl_NL.FCVWIF3Y.js → nl_NL.6ZVCFPVW.js} +1 -1
- package/dist/chunks/{pl.DQZDG7LR.js → pl.RF34QM23.js} +1 -1
- package/dist/chunks/{pt-BR.CR4ROBVE.js → pt-BR.AKDHLRUA.js} +1 -1
- package/dist/chunks/{pt.JRWVFJPX.js → pt.VBALOWHZ.js} +1 -1
- package/dist/chunks/{ro.NRMWYY3F.js → ro.WN7VCF27.js} +1 -1
- package/dist/chunks/{ru.OWSKHXVO.js → ru.ICXGVGRR.js} +1 -1
- package/dist/chunks/{sk.YGBRNNWT.js → sk.SIP5JIOX.js} +1 -1
- package/dist/chunks/{sl.IRTDTNTP.js → sl.R77UEKCA.js} +1 -1
- package/dist/chunks/{sr-RS.AWGLHKVE.js → sr-RS.6M2YSTDX.js} +1 -1
- package/dist/chunks/{sv.O4BXFGNF.js → sv.33ZY4CDS.js} +1 -1
- package/dist/chunks/{th.GZCEBRT2.js → th.M27YUIZC.js} +1 -1
- package/dist/chunks/{tr.ZDILMEEO.js → tr.Q2SIY6NA.js} +1 -1
- package/dist/chunks/{uk-UA.JUUBOEW3.js → uk-UA.EJZOGSJR.js} +1 -1
- package/dist/chunks/{vi.IN7CFTLL.js → vi.3RROGLXM.js} +1 -1
- package/dist/chunks/zf.GGWFQ3Y7.js +1 -0
- package/dist/chunks/{zh-CN.RBRAS4RP.js → zh-CN.MQHNRMN4.js} +1 -1
- package/dist/chunks/{zh-HK.4CK7LBWM.js → zh-HK.WNR7XUSX.js} +1 -1
- package/dist/chunks/{zh-TW.374TMWNJ.js → zh-TW.GNCY2PNY.js} +1 -1
- package/dist/custom-elements.json +1318 -847
- package/dist/jsx/index.d.ts +85 -87
- package/dist/primer-loader.d.ts +858 -2484
- package/dist/primer-loader.js +138 -2662
- package/dist/primer-react-wrappers.js +121 -2106
- package/dist/vscode.html-custom-data.json +54 -30
- package/dist/web-types.json +195 -117
- package/package.json +7 -2
- package/dist/chunks/chunk.I6YWTZRK.js +0 -1
- package/dist/chunks/en-GB.ILZ7SXSW.js +0 -1
- package/dist/chunks/en.7GZJA7MN.js +0 -1
- package/dist/chunks/zf.YT47ULXR.js +0 -1
package/dist/primer-loader.js
CHANGED
|
@@ -1,26 +1,115 @@
|
|
|
1
|
-
import{a as qr,b as s}from"./chunks/chunk.I6YWTZRK.js";var At=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var Xe=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer:state-change",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer:methods-update",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer:ready",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer:card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer:card-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer:card-error",{errors:t})}};var Ae=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var Qe=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(a,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=a,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(a,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){let a=e;this.context=a.context,this.callback=a.callback,this.subscribe=a.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ae(this.context,this.host,this.t,this.subscribe))}};var _t=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var fr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},L=class extends _t{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let a=o.contextTarget??o.composedPath()[0];a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let a=new Set;for(let[n,{consumerHost:u}]of this.subscriptions)a.has(n)||(a.add(n),u.dispatchEvent(new Ae(this.context,u,n,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new fr(this.context,this.host))}};function f({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Qe(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new Qe(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var Pt="cardNetworksContext";var _e="clientOptionsContext";var Pe="computedStylesContext";var $="headlessInstanceContext";var kt="klarnaCategoriesContext";var Y="managerContext";var et="paymentMethodsContext";var T="sdkStateContext";var U="vaultManagerContext";var ke="vaultManagerCvvContext";var C=class C{static log(t,...e){C.enabled&&console.log(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.log,...e)}static info(t,...e){C.enabled&&console.info(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.info,...e)}static warn(t,...e){C.enabled&&console.warn(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.warn,...e)}static error(t,...e){C.enabled&&console.error(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.error,...e)}static debug(t,...e){C.enabled&&console.debug(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.debug,...e)}static table(t,e){C.enabled&&console.table(t,e)}static time(t){C.enabled&&console.time(`${C.brandTag} ${t}`)}static timeEnd(t){C.enabled&&console.timeEnd(`${C.brandTag} ${t}`)}};C.enabled=!0,C.defaultFont="font-family: Consolas, monospace; font-size: 12px;",C.brandTag="[PRIMER]",C.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+C.defaultFont,C.styles={log:"color: #4CAF50; "+C.defaultFont,info:"color: #2196F3; "+C.defaultFont,warn:"color: #FF9800; "+C.defaultFont,error:"color: #F44336; "+C.defaultFont,debug:"color: #9C27B0; "+C.defaultFont};var b=C;function Uo(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let u=t(o,n,a);o=u,r(u)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function at(i){return(t,e,r)=>{let o=i[e.type];if(!o)throw new Error(`No handler for action type: ${e.type}`);return o(t,e,r)}}var He=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=Uo(e,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},wt=class{constructor(t){this.host=t;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(t){this._controllers.push(t)}hostConnected(){this._controllers.forEach(t=>{t.hostConnected&&t.hostConnected()})}hostDisconnected(){this._controllers.forEach(t=>{t.hostDisconnected&&t.hostDisconnected()})}};var Lt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Fo={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,t)=>(b.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Lt,RESET_ERROR:i=>({...i,error:null,failure:null})},Bo=at(Fo),Tt=class extends He{constructor(t){super(t,Lt,Bo,null,e=>{t.sdkContextController.setSdkState(e),t.primerEventsController.dispatchSdkState(e)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(b.warn("Force completing loading state"),this.completeLoading())}};var It=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new L(t,{context:T,initialValue:Lt}),this.paymentMethodsProvider=new L(t,{context:et,initialValue:null}),this.paymentManagerProvider=new L(t,{context:Y,initialValue:new Map}),this.cardNetworksContext=new L(t,{context:Pt,initialValue:null}),this.vaultManagerProvider=new L(t,{context:U,initialValue:null}),this.vaultManagerCvvProvider=new L(t,{context:ke,initialValue:null}),this.clientOptionsContext=new L(t,{context:_e,initialValue:null}),this.klarnaCategoriesProvider=new L(t,{context:kt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new L(t,{context:$,initialValue:null}),this.computedStylesProvider=new L(t,{context:Pe,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var ze=class ze{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){b.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||b.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=ze.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),ze.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){b.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);e.push([a,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of ze.cssVarCache.keys()){let e=ze.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};ze.cssVarCache=new Map;var Nt=ze;var $t=globalThis,Rt=$t.ShadowRoot&&($t.ShadyCSS===void 0||$t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Jr=Symbol(),Wr=new WeakMap,Ot=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Jr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Rt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Wr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Wr.set(e,t))}return t}toString(){return this.cssText}},Zr=i=>new Ot(typeof i=="string"?i:i+"",void 0,Jr);var yr=(i,t)=>{if(Rt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=$t.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Dt=Rt?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Zr(e)})(i):i;var{is:Ko,defineProperty:jo,getOwnPropertyDescriptor:Go,getOwnPropertyNames:qo,getOwnPropertySymbols:Wo,getPrototypeOf:Jo}=Object,we=globalThis,Xr=we.trustedTypes,Zo=Xr?Xr.emptyScript:"",Xo=we.reactiveElementPolyfillSupport,st=(i,t)=>i,vr={toAttribute(i,t){switch(t){case Boolean:i=i?Zo:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},Vt=(i,t)=>!Ko(i,t),Qr={attribute:!0,type:String,converter:vr,reflect:!1,hasChanged:Vt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),we.litPropertyMetadata??(we.litPropertyMetadata=new WeakMap);var Ye=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Qr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&jo(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=Go(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let u=o?.call(this);a.call(this,n),this.requestUpdate(t,u,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Qr}static _$Ei(){if(this.hasOwnProperty(st("elementProperties")))return;let t=Jo(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(st("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(st("properties"))){let e=this.properties,r=[...qo(e),...Wo(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(Dt(o))}else t!==void 0&&e.push(Dt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:vr).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:vr;this._$Em=o,this[o]=n.fromAttribute(e,a.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??Vt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};Ye.elementStyles=[],Ye.shadowRootOptions={mode:"open"},Ye[st("elementProperties")]=new Map,Ye[st("finalized")]=new Map,Xo?.({ReactiveElement:Ye}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var Te={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},E=Symbol(),M=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??ei,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let a=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(e===E)this.i=0;else{if(a===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},ei=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!Vt(e,t[r]));var Qo={SET_LOADING:(i,t)=>({...i,isLoading:t.payload}),SET_UPDATING:(i,t)=>({...i,isUpdating:t.payload}),INITIALIZE_VAULT_MANAGER:(i,t,e)=>({...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,t)=>({...i,vaultedPaymentMethods:t.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>ti},ea={INITIALIZE_CVV:(i,t,e)=>({...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,t)=>({...i,formIsDirty:t.payload}),SET_CVV_INPUT:(i,t)=>({...i,cvvInput:t.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,t)=>({...i,selectedVaultedPaymentMethod:t.payload}),RESET_CVV:()=>ri},ta=at(Qo),ra=at(ea),ti={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},ri={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},br=class extends He{constructor(t,e){super(t,ti,ta,e,r=>{t.sdkContextController.setVaultManager(r)})}setLoading(t){this.dispatch({type:"SET_LOADING",payload:t})}setUpdating(t){this.dispatch({type:"SET_UPDATING",payload:t})}initializeVaultManager(t,e,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:t,vaultEnabled:e,cvvRecapture:r})}updatePaymentMethods(t){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:t})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},xr=class extends He{constructor(t,e){super(t,ri,ra,e,r=>{t.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(t){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:t})}setFormDirty(t){this.dispatch({type:"SET_FORM_DIRTY",payload:t})}setCvvInputState(t){this.dispatch({type:"SET_CVV_INPUT",payload:t})}setSelectedPaymentMethod(t){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},nt=class extends wt{constructor(e){super(e);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(e),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=e=>{this.itemController.setCvvInputState(e)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let e=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!e||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(e.id,r?{cvv:o.valueToken}:void 0)}catch(a){b.error("VaultManagerController: Error starting vaulted payment flow",a),this.coreController.setError(a instanceof Error?a:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new br(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new xr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new M(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),E;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),b.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){b.error("VaultManagerController: Failed to initialize vault",a),this.coreController.setError(a instanceof Error?a:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return b.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)}};var lt="lit-localize-status";var ii=i=>typeof i!="string"&&"strTag"in i,Ht=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var dt=i=>ii(i)?Ht(i.strings,i.values):i;var y=dt,oi=!1;function Cr(i){if(oi)throw new Error("lit-localize can only be configured once");y=i,oi=!0}var Er=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(lt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(lt,this.__litLocalizeEventHandler)}},ia=i=>i.addController(new Er(i)),ai=ia;var S=()=>(i,t)=>(i.addInitializer(ai),i);var pt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var ne=[];for(let i=0;i<256;i++)ne[i]=(i>>4&15).toString(16)+(i&15).toString(16);function si(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,u=0,g=52210;for(let A=0;A<i.length;A++)e^=i.charCodeAt(A),t=e*435,r=o*435,a=n*435,u=g*435,a+=e<<8,u+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,g=u+(a>>>16)&65535,n=a&65535;return ne[g>>8]+ne[g&255]+ne[n>>8]+ne[n&255]+ne[o>>8]+ne[o&255]+ne[e>>8]+ne[e&255]}var oa="",aa="h",sa="s";function ni(i,t){return(t?aa:sa)+si(typeof i=="string"?i:i.join(oa))}var li=new WeakMap,di=new Map;function pi(i,t,e){if(i){let r=e?.id??na(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Ht(o.strings,t.values,o.values);{let a=li.get(o);return a===void 0&&(a=o.values,li.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return dt(t)}function na(i){let t=typeof i=="string"?i:i.strings,e=di.get(t);return e===void 0&&(e=ni(t,typeof i!="string"&&!("strTag"in i)),di.set(t,e)),e}function Sr(i){window.dispatchEvent(new CustomEvent(lt,{detail:i}))}var Yt="",Mr,ci,Ut,Ar,mi,Ue=new pt;Ue.resolve();var zt=0,hi=i=>(Cr((t,e)=>pi(mi,t,e)),Yt=ci=i.sourceLocale,Ut=new Set(i.targetLocales),Ut.add(i.sourceLocale),Ar=i.loadLocale,{getLocale:la,setLocale:da}),la=()=>Yt,da=i=>{if(i===(Mr??Yt))return Ue.promise;if(!Ut||!Ar)throw new Error("Internal error");if(!Ut.has(i))throw new Error("Invalid locale code");zt++;let t=zt;return Mr=i,Ue.settled&&(Ue=new pt),Sr({status:"loading",loadingLocale:i}),(i===ci?Promise.resolve({templates:void 0}):Ar(i)).then(r=>{zt===t&&(Yt=i,Mr=void 0,mi=r.templates,Sr({status:"ready",readyLocale:i}),Ue.resolve())},r=>{zt===t&&(Sr({status:"error",errorLocale:i,errorMessage:r.toString()}),Ue.reject(r))}),Ue.promise};var _r="en",Pr=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],ui="You must call `loadLocale` first to set up the localized template.",gi,Ft,fi=i=>{let t=hi({sourceLocale:_r,targetLocales:Pr,loadLocale:i});gi=t.getLocale,Ft=t.setLocale};var kr=i=>{fi(i)},wr=i=>{if(!Ft)throw new Error(ui);return Ft(i)};var ct=new Set(Pr);ct.add(_r);var Tr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(ct.has(t))return!0;let e=t.split("-")[0];return!!ct.has(e)},Lr=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(ct.has(t))return t;let e=t.split("-")[0];return ct.has(e)?e:"en-GB"};var Bt=globalThis,Kt=Bt.ShadowRoot&&(Bt.ShadyCSS===void 0||Bt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ir=Symbol(),yi=new WeakMap,mt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ir)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Kt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=yi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&yi.set(e,t))}return t}toString(){return this.cssText}},vi=i=>new mt(typeof i=="string"?i:i+"",void 0,Ir),c=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,a)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[a+1],i[0]);return new mt(e,i,Ir)},bi=(i,t)=>{if(Kt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Bt.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Nr=Kt?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return vi(e)})(i):i;var{is:pa,defineProperty:ca,getOwnPropertyDescriptor:ma,getOwnPropertyNames:ha,getOwnPropertySymbols:ua,getPrototypeOf:ga}=Object,Le=globalThis,xi=Le.trustedTypes,fa=xi?xi.emptyScript:"",ya=Le.reactiveElementPolyfillSupport,ht=(i,t)=>i,ut={toAttribute(i,t){switch(t){case Boolean:i=i?fa:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},jt=(i,t)=>!pa(i,t),Ci={attribute:!0,type:String,converter:ut,reflect:!1,useDefault:!1,hasChanged:jt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Le.litPropertyMetadata??(Le.litPropertyMetadata=new WeakMap);var le=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ci){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&ca(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=ma(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:o,set(n){let u=o?.call(this);a?.call(this,n),this.requestUpdate(t,u,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ci}static _$Ei(){if(this.hasOwnProperty(ht("elementProperties")))return;let t=ga(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ht("properties"))){let e=this.properties,r=[...ha(e),...ua(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(Nr(o))}else t!==void 0&&e.push(Nr(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bi(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:ut).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:ut;this._$Em=o,this[o]=n.fromAttribute(e,a.type)??this._$Ej?.get(o)??null,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let o=this.constructor,a=this[t];if(r??(r=o.getPropertyOptions(t)),!((r.hasChanged??jt)(a,e)||r.useDefault&&r.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:o,wrapped:a},n){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),a!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r){let{wrapped:n}=a,u=this[o];n!==!0||this._$AL.has(o)||u===void 0||this.C(o,void 0,a,u)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};le.elementStyles=[],le.shadowRootOptions={mode:"open"},le[ht("elementProperties")]=new Map,le[ht("finalized")]=new Map,ya?.({ReactiveElement:le}),(Le.reactiveElementVersions??(Le.reactiveElementVersions=[])).push("2.1.0");var ft=globalThis,Gt=ft.trustedTypes,Ei=Gt?Gt.createPolicy("lit-html",{createHTML:i=>i}):void 0,Or="$lit$",de=`lit$${Math.random().toFixed(9).slice(2)}$`,Rr="?"+de,va=`<${Rr}>`,Ke=document,yt=()=>Ke.createComment(""),vt=i=>i===null||typeof i!="object"&&typeof i!="function",Dr=Array.isArray,ki=i=>Dr(i)||typeof i?.[Symbol.iterator]=="function",$r=`[
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ai=/'/g,_i=/"/g,wi=/^(?:script|style|textarea|title)$/i,Vr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=Vr(1),ce=Vr(2),_l=Vr(3),pe=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Pi=new WeakMap,Be=Ke.createTreeWalker(Ke,129);function Ti(i,t){if(!Dr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ei!==void 0?Ei.createHTML(t):t}var Li=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=gt;for(let u=0;u<e;u++){let g=i[u],A,w,P=-1,O=0;for(;O<g.length&&(n.lastIndex=O,w=n.exec(g),w!==null);)O=n.lastIndex,n===gt?w[1]==="!--"?n=Si:w[1]!==void 0?n=Mi:w[2]!==void 0?(wi.test(w[2])&&(o=RegExp("</"+w[2],"g")),n=Fe):w[3]!==void 0&&(n=Fe):n===Fe?w[0]===">"?(n=o??gt,P=-1):w[1]===void 0?P=-2:(P=n.lastIndex-w[2].length,A=w[1],n=w[3]===void 0?Fe:w[3]==='"'?_i:Ai):n===_i||n===Ai?n=Fe:n===Si||n===Mi?n=gt:(n=Fe,o=void 0);let Me=n===Fe&&i[u+1].startsWith("/>")?" ":"";a+=n===gt?g+va:P>=0?(r.push(A),g.slice(0,P)+Or+g.slice(P)+de+Me):g+de+(P===-2?u:Me)}return[Ti(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},bt=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,u=t.length-1,g=this.parts,[A,w]=Li(t,e);if(this.el=i.createElement(A,r),Be.currentNode=this.el.content,e===2||e===3){let P=this.el.content.firstChild;P.replaceWith(...P.childNodes)}for(;(o=Be.nextNode())!==null&&g.length<u;){if(o.nodeType===1){if(o.hasAttributes())for(let P of o.getAttributeNames())if(P.endsWith(Or)){let O=w[n++],Me=o.getAttribute(P).split(de),Mt=/([.?@])?(.*)/.exec(O);g.push({type:1,index:a,name:Mt[2],strings:Me,ctor:Mt[1]==="."?Wt:Mt[1]==="?"?Jt:Mt[1]==="@"?Zt:Ge}),o.removeAttribute(P)}else P.startsWith(de)&&(g.push({type:6,index:a}),o.removeAttribute(P));if(wi.test(o.tagName)){let P=o.textContent.split(de),O=P.length-1;if(O>0){o.textContent=Gt?Gt.emptyScript:"";for(let Me=0;Me<O;Me++)o.append(P[Me],yt()),Be.nextNode(),g.push({type:2,index:++a});o.append(P[O],yt())}}}else if(o.nodeType===8)if(o.data===Rr)g.push({type:2,index:a});else{let P=-1;for(;(P=o.data.indexOf(de,P+1))!==-1;)g.push({type:7,index:a}),P+=de.length-1}a++}}static createElement(t,e){let r=Ke.createElement("template");return r.innerHTML=t,r}};function je(i,t,e=i,r){if(t===pe)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=vt(t)?void 0:t._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=je(i,o._$AS(i,t.values),o,r)),t}var qt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??Ke).importNode(e,!0);Be.currentNode=o;let a=Be.nextNode(),n=0,u=0,g=r[0];for(;g!==void 0;){if(n===g.index){let A;g.type===2?A=new tt(a,a.nextSibling,this,t):g.type===1?A=new g.ctor(a,g.name,g.strings,this,t):g.type===6&&(A=new Xt(a,this,t)),this._$AV.push(A),g=r[++u]}n!==g?.index&&(a=Be.nextNode(),n++)}return Be.currentNode=Ke,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},tt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=je(this,t,e),vt(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==pe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ki(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&vt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ke.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=bt.createElement(Ti(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new qt(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=Pi.get(t.strings);return e===void 0&&Pi.set(t.strings,e=new bt(t)),e}k(t){Dr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let a of t)o===e.length?e.push(r=new i(this.O(yt()),this.O(yt()),this,this.options)):r=e[o],r._$AI(a),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ge=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=p}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=je(this,t,e,0),n=!vt(t)||t!==this._$AH&&t!==pe,n&&(this._$AH=t);else{let u=t,g,A;for(t=a[0],g=0;g<a.length-1;g++)A=je(this,u[r+g],e,g),A===pe&&(A=this._$AH[g]),n||(n=!vt(A)||A!==this._$AH[g]),A===p?t=p:t!==p&&(t+=(A??"")+a[g+1]),this._$AH[g]=A}n&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Wt=class extends Ge{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},Jt=class extends Ge{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},Zt=class extends Ge{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=je(this,t,e,0)??p)===pe)return;let r=this._$AH,o=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==p&&(r===p||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Xt=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){je(this,t)}},Ii={M:Or,P:de,A:Rr,C:1,L:Li,R:qt,D:ki,V:je,I:tt,H:Ge,N:Jt,U:Zt,B:Wt,F:Xt},ba=ft.litHtmlPolyfillSupport;ba?.(bt,tt),(ft.litHtmlVersions??(ft.litHtmlVersions=[])).push("3.3.0");var Ni=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new tt(t.insertBefore(yt(),a),a,void 0,e??{})}return o._$AI(i),o};var xt=globalThis,m=class extends le{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ni(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return pe}};m._$litElement$=!0,m.finalized=!0,xt.litElementHydrateSupport?.({LitElement:m});var xa=xt.litElementPolyfillSupport;xa?.({LitElement:m});(xt.litElementVersions??(xt.litElementVersions=[])).push("4.2.0");var h=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ca={attribute:!0,type:String,converter:ut,reflect:!1,hasChanged:jt},Ea=(i=Ca,t,e)=>{let{kind:r,metadata:o}=e,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),a.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(u){let g=t.get.call(this);t.set.call(this,u),this.requestUpdate(n,g,i)},init(u){return u!==void 0&&this.C(n,void 0,i,u),u}}}if(r==="setter"){let{name:n}=e;return function(u){let g=this[n];t.call(this,u),this.requestUpdate(n,g,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?Ea(i,t,e):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,t,e)}function x(i){return l({...i,state:!0,attribute:!1})}var qe=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Ie(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:u}=typeof r=="object"?e:o??(()=>{let g=Symbol();return{get(){return this[g]},set(A){this[g]=A}}})();return qe(e,r,{get(){let g=n.call(this);return g===void 0&&(g=a(this),(g!==null||this.hasUpdated)&&u.call(this,g)),g}})}return qe(e,r,{get(){return a(this)}})}}function _(i,t,e){return i?t(i):e?.(i)}var v=c`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`;var Oi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Qt=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var er=class{constructor(t){this.paymentMethods=null;this.headlessInstance=t}setPaymentMethods(t){this.paymentMethods=t}async refreshSession(){if(!this.headlessInstance){b.error("PrimerJS: Cannot refresh session: Headless instance not available");return}try{await this.headlessInstance.refreshClientSession()}catch(t){throw b.error("PrimerJS: Error refreshing client session:",t),t}}getPaymentMethods(){return this.paymentMethods?this.paymentMethods.toArray():(b.warn("PrimerJS: Payment methods not available"),[])}handlePaymentStart(){this.onPaymentStart&&this.onPaymentStart()}handleBeforePaymentCreate(t,e){if(this.onPaymentPrepare){let r={continuePaymentCreation:()=>{b.info("PrimerJS: Payment creation continuing"),e.continuePaymentCreation()},abortPaymentCreation:()=>{b.info("PrimerJS: Payment creation aborted"),e.abortPaymentCreation()}};this.onPaymentPrepare(t,r)}else b.info("PrimerJS: No payment prepare handler, continuing by default"),e.continuePaymentCreation()}handlePaymentComplete(t){this.onPaymentComplete&&this.onPaymentComplete({payment:t,status:"success"})}handlePaymentFailure(t,e){this.onPaymentComplete&&this.onPaymentComplete({payment:e||null,status:"error",error:t})}};var tr=typeof window<"u"&&typeof window.document<"u";function Sa(i){return document.querySelector(`script[src^="${i}"]`)}function Ma(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function Ri(i,t=!1){if(!tr)throw new Error("Cannot load script in server environment");let e=Sa(i)??Ma(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var rr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.primerJS=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new M(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new M(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(b.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),b.info("SDK instance cleaned up")}catch(t){b.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null,this.primerJS=null}async _loadV2Sdk(t=Oi){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){b.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await Ri(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return b.warn("Component disconnected, aborting SDK initialization"),E;if(!t||!e)return E;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window;this.primerJS=new er(null);let o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(b.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(b.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.primerJS&&this.primerJS.handlePaymentComplete(n))},onCheckoutFail:(n,u)=>{this.isDisconnected||(b.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.primerJS&&this.primerJS.handlePaymentFailure(n,u.payment))},onBeforePaymentCreate:(n,u)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),this.primerJS?this.primerJS.handleBeforePaymentCreate(n,u):u?.continuePaymentCreation())},onPaymentMethodAction:(n,u)=>{this.isDisconnected||n==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||(this.host.sdkStateController.resetError(),this.primerJS&&this.primerJS.handlePaymentStart())}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,this.primerJS&&Object.defineProperty(this.primerJS,"headlessInstance",{value:o,writable:!1}),await o.start(),this.isDisconnected)return this.cleanupResources(),E;this.host.sdkContextController.setClientOptions(e),this.primerJS&&this.host.primerEventsController.dispatchCheckoutInitialized(this.primerJS);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(b.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return E;if(!t||!e.length)return E;let r=new Map,o=new Map;try{for(let n of e){if(this.isDisconnected)break;let u=await this.initializePaymentMethodManager(n)();n&&u&&(r.set(n.type,n),o.set(n.type,u))}if(this.isDisconnected)return E;let a=new Qt(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.primerJS&&this.primerJS.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),b.info("Initialized payment methods:",a.toArray()),r}catch(a){if(a instanceof Error)throw this.host.sdkStateController.setError(a),a;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:a=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:a,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(e,{onCardNetworksChange:async n=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:e,manager:a}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return b.error(`Failed to initialize manager for ${e}:`,o),null}}}};var ir=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Aa=qr({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.6MRFCKX4.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.HRSMU7Y5.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.3FSHJL7U.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.WAO4WFS3.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.4OFYGDVA.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.3FZS52IN.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.A4R7VG5T.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.ILZ7SXSW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.7GZJA7MN.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.QKHDL4JV.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.GG7MJMG2.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.FEZ6BF3S.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.FJLPTMF3.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.DM5R27A5.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.YZV52NTA.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.6SCF3XZZ.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.PPDZ7AAS.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.6WOPSGLW.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.NS22WGWL.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.42TO3R4G.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.UEGHEUAP.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.HTMDY6RY.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.4U3GBQTQ.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.73ME4TDM.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.JRWO2BF6.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.KROS45TV.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.HE3SWJFQ.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.TR6TEKBY.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.V5QP6OXL.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.FCVWIF3Y.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.DQZDG7LR.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.CR4ROBVE.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.JRWVFJPX.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.NRMWYY3F.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.OWSKHXVO.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.YGBRNNWT.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.IRTDTNTP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.AWGLHKVE.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.O4BXFGNF.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.GZCEBRT2.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.ZDILMEEO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.JUUBOEW3.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.IN7CFTLL.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.YT47ULXR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.RBRAS4RP.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.4CK7LBWM.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.374TMWNJ.js")});kr(i=>Aa(`../../localization/lit-localize/locales/${i}.ts`));var or={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},W=class extends m{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new It(this),this.sdkStateController=new Tt(this),this.primerEventsController=new Xe(this),this.styleProcessingController=new Nt(this),this.vaultManagerController=new nt(this),this.cardNetworkController=new At(this),this.achPaymentEventsController=new ir(this),new rr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===or.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(Tr(this.options?.locale)?this.locale=Lr(this.options?.locale):b.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),wr(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(b.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.currentState,r=e.isLoading,o=e.error,a=!r&&!o;return d`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import{a as Di,b as s,c as R}from"./chunks/chunk.DV3REKZU.js";var Gt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var mt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer:state-change",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer:methods-update",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer:ready",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer:card-network-change",t)}dispatchCardSubmit(t){this.dispatchEvent("primer:card-submit",{source:t})}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer:card-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer:card-error",{errors:t})}};var Ue=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var ut=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(a,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=a,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(a,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){let a=e;this.context=a.context,this.callback=a.callback,this.subscribe=a.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ue(this.context,this.host,this.t,this.subscribe))}};var qt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var Kr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},z=class extends qt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let a=o.contextTarget??o.composedPath()[0];a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let a=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)a.has(n)||(a.add(n),l.dispatchEvent(new Ue(this.context,l,n,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Kr(this.context,this.host))}};function C({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new ut(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new ut(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var Wt="cardNetworksContext";var pe="clientOptionsContext";var He="computedStylesContext";var U="headlessInstanceContext";var Jt="klarnaCategoriesContext";var Z="managerContext";var ht="paymentMethodsContext";var Y="sdkStateContext";var X="vaultManagerContext";var me="vaultManagerCvvContext";var V=class V{static log(t,...e){V.enabled}static info(t,...e){V.enabled}static warn(t,...e){V.enabled}static error(t,...e){V.enabled}static debug(t,...e){V.enabled}static table(t,e){V.enabled}static time(t){V.enabled}static timeEnd(t){V.enabled}};V.enabled=!0,V.defaultFont="font-family: Consolas, monospace; font-size: 12px;",V.brandTag="[PRIMER]",V.brandStyle=`background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; ${V.defaultFont}`,V.styles={log:`color: #4CAF50; ${V.defaultFont}`,info:`color: #2196F3; ${V.defaultFont}`,warn:`color: #FF9800; ${V.defaultFont}`,error:`color: #F44336; ${V.defaultFont}`,debug:`color: #9C27B0; ${V.defaultFont}`};var A=V;function mn(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let l=t(o,n,a);o=l,r(l)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function St(i){return(t,e,r)=>{let o=i[e.type];if(!o)throw new Error(`No handler for action type: ${e.type}`);return o(t,e,r)}}var Xe=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=mn(e,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},Zt=class{constructor(t){this.host=t;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(t){this._controllers.push(t)}hostConnected(){this._controllers.forEach(t=>{t.hostConnected&&t.hostConnected()})}hostDisconnected(){this._controllers.forEach(t=>{t.hostDisconnected&&t.hostDisconnected()})}};var Qt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},un={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,t)=>(A.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Qt,RESET_ERROR:i=>({...i,error:null,failure:null})},hn=St(un),Xt=class extends Xe{constructor(t){super(t,Qt,hn,null,e=>{t.sdkContextController.setSdkState(e),t.primerEventsController.dispatchSdkState(e)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(A.warn("Force completing loading state"),this.completeLoading())}};var er=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new z(t,{context:Y,initialValue:Qt}),this.paymentMethodsProvider=new z(t,{context:ht,initialValue:null}),this.paymentManagerProvider=new z(t,{context:Z,initialValue:new Map}),this.cardNetworksContext=new z(t,{context:Wt,initialValue:null}),this.vaultManagerProvider=new z(t,{context:X,initialValue:null}),this.vaultManagerCvvProvider=new z(t,{context:me,initialValue:null}),this.clientOptionsContext=new z(t,{context:pe,initialValue:null}),this.klarnaCategoriesProvider=new z(t,{context:Jt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new z(t,{context:U,initialValue:null}),this.computedStylesProvider=new z(t,{context:He,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var Qe=class Qe{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){A.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||A.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Qe.cssVarCache.get(t);return e||(e=`--${t.replace(/([A-Z])/g,(r,o)=>`-${o.toLowerCase()}`)}`,Qe.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){A.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);e.push([a,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of Qe.cssVarCache.keys()){let e=Qe.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Qe.cssVarCache=new Map;var tr=Qe;var rr=globalThis,or=rr.ShadowRoot&&(rr.ShadyCSS===void 0||rr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vi=Symbol(),$i=new WeakMap,ir=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Vi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(or&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=$i.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&$i.set(e,t))}return t}toString(){return this.cssText}},Yi=i=>new ir(typeof i=="string"?i:i+"",void 0,Vi);var Gr=(i,t)=>{if(or)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=rr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},ar=or?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Yi(e)})(i):i;var{is:fn,defineProperty:yn,getOwnPropertyDescriptor:gn,getOwnPropertyNames:vn,getOwnPropertySymbols:bn,getPrototypeOf:Cn}=Object,ze=globalThis,Ui=ze.trustedTypes,xn=Ui?Ui.emptyScript:"",En=ze.reactiveElementPolyfillSupport,Pt=(i,t)=>i,qr={toAttribute(i,t){switch(t){case Boolean:i=i?xn:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},nr=(i,t)=>!fn(i,t),Hi={attribute:!0,type:String,converter:qr,reflect:!1,hasChanged:nr};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ze.litPropertyMetadata??(ze.litPropertyMetadata=new WeakMap);var et=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Hi){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&yn(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=gn(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let l=o?.call(this);a.call(this,n),this.requestUpdate(t,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Hi}static _$Ei(){if(this.hasOwnProperty(Pt("elementProperties")))return;let t=Cn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Pt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Pt("properties"))){let e=this.properties,r=[...vn(e),...bn(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(ar(o))}else t!==void 0&&e.push(ar(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Gr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:qr).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:qr;this._$Em=o,this[o]=n.fromAttribute(e,a.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??nr)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};et.elementStyles=[],et.shadowRootOptions={mode:"open"},et[Pt("elementProperties")]=new Map,et[Pt("finalized")]=new Map,En?.({ReactiveElement:et}),(ze.reactiveElementVersions??(ze.reactiveElementVersions=[])).push("2.0.4");var Be={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},M=Symbol(),L=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??zi,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let a=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(e===M)this.i=0;else{if(a===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},zi=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!nr(e,t[r]));var An={SET_LOADING:(i,t)=>({...i,isLoading:t.payload}),SET_UPDATING:(i,t)=>({...i,isUpdating:t.payload}),INITIALIZE_VAULT_MANAGER:(i,t,e)=>({...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,showEmptyState:t.showEmptyState,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,t)=>({...i,vaultedPaymentMethods:t.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>Bi},_n={INITIALIZE_CVV:(i,t,e)=>({...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,t)=>({...i,formIsDirty:t.payload}),SET_CVV_INPUT:(i,t)=>({...i,cvvInput:t.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,t)=>({...i,selectedVaultedPaymentMethod:t.payload}),RESET_CVV:()=>Fi},Sn=St(An),Pn=St(_n),Bi={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,showEmptyState:!0,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},Fi={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Wr=class extends Xe{constructor(t,e){super(t,Bi,Sn,e,r=>{t.sdkContextController.setVaultManager(r)})}setLoading(t){this.dispatch({type:"SET_LOADING",payload:t})}setUpdating(t){this.dispatch({type:"SET_UPDATING",payload:t})}initializeVaultManager(t,e,r,o){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:t,vaultEnabled:e,cvvRecapture:r,showEmptyState:o})}updatePaymentMethods(t){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:t})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Jr=class extends Xe{constructor(t,e){super(t,Fi,Pn,e,r=>{t.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(t){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:t})}setFormDirty(t){this.dispatch({type:"SET_FORM_DIRTY",payload:t})}setCvvInputState(t){this.dispatch({type:"SET_CVV_INPUT",payload:t})}setSelectedPaymentMethod(t){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},wt=class extends Zt{constructor(e){super(e);this._vaultManager=null;this._options=null;this.createCvvInput=e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)};this.deleteVaultedPaymentMethod=async e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(e),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=e=>{this.itemController.setCvvInputState(e)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let e=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!e||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(e.id,r?{cvv:o.valueToken}:void 0)}catch(a){A.error("VaultManagerController: Error starting vaulted payment flow",a),this.coreController.setError(a instanceof Error?a:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new Wr(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput}),this.itemController=new Jr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new L(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),M;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv,o.showEmptyState??!0),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),A.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){A.error("VaultManagerController: Failed to initialize vault",a),this.coreController.setError(a instanceof Error?a:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return A.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}};var Mt="lit-localize-status";var ji=i=>typeof i!="string"&&"strTag"in i,sr=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var Tt=i=>ji(i)?sr(i.strings,i.values):i;var x=Tt,Ki=!1;function Zr(i){if(Ki)throw new Error("lit-localize can only be configured once");x=i,Ki=!0}var Xr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Mt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Mt,this.__litLocalizeEventHandler)}},wn=i=>i.addController(new Xr(i)),Gi=wn;var w=()=>(i,t)=>(i.addInitializer(Gi),i);var kt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var _e=[];for(let i=0;i<256;i++)_e[i]=(i>>4&15).toString(16)+(i&15).toString(16);function qi(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,l=0,d=52210;for(let m=0;m<i.length;m++)e^=i.charCodeAt(m),t=e*435,r=o*435,a=n*435,l=d*435,a+=e<<8,l+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,d=l+(a>>>16)&65535,n=a&65535;return _e[d>>8]+_e[d&255]+_e[n>>8]+_e[n&255]+_e[o>>8]+_e[o&255]+_e[e>>8]+_e[e&255]}var Mn="",Tn="h",kn="s";function Wi(i,t){return(t?Tn:kn)+qi(typeof i=="string"?i:i.join(Mn))}var Ji=new WeakMap,Zi=new Map;function Xi(i,t,e){if(i){let r=e?.id??In(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return sr(o.strings,t.values,o.values);{let a=Ji.get(o);return a===void 0&&(a=o.values,Ji.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return Tt(t)}function In(i){let t=typeof i=="string"?i:i.strings,e=Zi.get(t);return e===void 0&&(e=Wi(t,typeof i!="string"&&!("strTag"in i)),Zi.set(t,e)),e}function Qr(i){window.dispatchEvent(new CustomEvent(Mt,{detail:i}))}var dr="",ei,Qi,cr,ti,eo,tt=new kt;tt.resolve();var lr=0,to=i=>(Zr((t,e)=>Xi(eo,t,e)),dr=Qi=i.sourceLocale,cr=new Set(i.targetLocales),cr.add(i.sourceLocale),ti=i.loadLocale,{getLocale:Ln,setLocale:Nn}),Ln=()=>dr,Nn=i=>{if(i===(ei??dr))return tt.promise;if(!cr||!ti)throw new Error("Internal error");if(!cr.has(i))throw new Error("Invalid locale code");lr++;let t=lr;return ei=i,tt.settled&&(tt=new kt),Qr({status:"loading",loadingLocale:i}),(i===Qi?Promise.resolve({templates:void 0}):ti(i)).then(r=>{lr===t&&(dr=i,ei=void 0,eo=r.templates,Qr({status:"ready",readyLocale:i}),tt.resolve())},r=>{lr===t&&(Qr({status:"error",errorLocale:i,errorMessage:r.toString()}),tt.reject(r))}),tt.promise};var ri="en",ii=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],ro="You must call `loadLocale` first to set up the localized template.",io,pr,oo=i=>{let t=to({sourceLocale:ri,targetLocales:ii,loadLocale:i});io=t.getLocale,pr=t.setLocale};var oi=i=>{oo(i)},ai=i=>{if(!pr)throw new Error(ro);return pr(i)};var It=new Set(ii);It.add(ri);var ni=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(It.has(t))return!0;let e=t.split("-")[0];return!!It.has(e)},si=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(It.has(t))return t;let e=t.split("-")[0];return It.has(e)?e:"en-GB"};var mr=globalThis,ur=mr.ShadowRoot&&(mr.ShadyCSS===void 0||mr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,li=Symbol(),ao=new WeakMap,Lt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==li)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ur&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=ao.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ao.set(e,t))}return t}toString(){return this.cssText}},ue=i=>new Lt(typeof i=="string"?i:i+"",void 0,li),y=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,a)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[a+1],i[0]);return new Lt(e,i,li)},no=(i,t)=>{if(ur)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=mr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},di=ur?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ue(e)})(i):i;var{is:On,defineProperty:Rn,getOwnPropertyDescriptor:Dn,getOwnPropertyNames:$n,getOwnPropertySymbols:Vn,getPrototypeOf:Yn}=Object,Fe=globalThis,so=Fe.trustedTypes,Un=so?so.emptyScript:"",Hn=Fe.reactiveElementPolyfillSupport,Nt=(i,t)=>i,Ot={toAttribute(i,t){switch(t){case Boolean:i=i?Un:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},hr=(i,t)=>!On(i,t),lo={attribute:!0,type:String,converter:Ot,reflect:!1,useDefault:!1,hasChanged:hr};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Fe.litPropertyMetadata??(Fe.litPropertyMetadata=new WeakMap);var Se=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=lo){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&Rn(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=Dn(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:o,set(n){let l=o?.call(this);a?.call(this,n),this.requestUpdate(t,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??lo}static _$Ei(){if(this.hasOwnProperty(Nt("elementProperties")))return;let t=Yn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Nt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nt("properties"))){let e=this.properties,r=[...$n(e),...Vn(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(di(o))}else t!==void 0&&e.push(di(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return no(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:Ot).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Ot;this._$Em=o,this[o]=n.fromAttribute(e,a.type)??this._$Ej?.get(o)??null,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let o=this.constructor,a=this[t];if(r??(r=o.getPropertyOptions(t)),!((r.hasChanged??hr)(a,e)||r.useDefault&&r.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:o,wrapped:a},n){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),a!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r){let{wrapped:n}=a,l=this[o];n!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,a,l)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};Se.elementStyles=[],Se.shadowRootOptions={mode:"open"},Se[Nt("elementProperties")]=new Map,Se[Nt("finalized")]=new Map,Hn?.({ReactiveElement:Se}),(Fe.reactiveElementVersions??(Fe.reactiveElementVersions=[])).push("2.1.0");var Dt=globalThis,fr=Dt.trustedTypes,co=fr?fr.createPolicy("lit-html",{createHTML:i=>i}):void 0,pi="$lit$",Pe=`lit$${Math.random().toFixed(9).slice(2)}$`,mi="?"+Pe,zn=`<${mi}>`,ot=document,$t=()=>ot.createComment(""),Vt=i=>i===null||typeof i!="object"&&typeof i!="function",ui=Array.isArray,yo=i=>ui(i)||typeof i?.[Symbol.iterator]=="function",ci=`[
|
|
2
|
+
\f\r]`,Rt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,po=/-->/g,mo=/>/g,rt=RegExp(`>|${ci}(?:([^\\s"'>=/]+)(${ci}*=${ci}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),uo=/'/g,ho=/"/g,go=/^(?:script|style|textarea|title)$/i,hi=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=hi(1),he=hi(2),qc=hi(3),we=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),fo=new WeakMap,it=ot.createTreeWalker(ot,129);function vo(i,t){if(!ui(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return co!==void 0?co.createHTML(t):t}var bo=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=Rt;for(let l=0;l<e;l++){let d=i[l],m,h,f=-1,b=0;for(;b<d.length&&(n.lastIndex=b,h=n.exec(d),h!==null);)b=n.lastIndex,n===Rt?h[1]==="!--"?n=po:h[1]!==void 0?n=mo:h[2]!==void 0?(go.test(h[2])&&(o=RegExp("</"+h[2],"g")),n=rt):h[3]!==void 0&&(n=rt):n===rt?h[0]===">"?(n=o??Rt,f=-1):h[1]===void 0?f=-2:(f=n.lastIndex-h[2].length,m=h[1],n=h[3]===void 0?rt:h[3]==='"'?ho:uo):n===ho||n===uo?n=rt:n===po||n===mo?n=Rt:(n=rt,o=void 0);let S=n===rt&&i[l+1].startsWith("/>")?" ":"";a+=n===Rt?d+zn:f>=0?(r.push(m),d.slice(0,f)+pi+d.slice(f)+Pe+S):d+Pe+(f===-2?l:S)}return[vo(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Yt=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,l=t.length-1,d=this.parts,[m,h]=bo(t,e);if(this.el=i.createElement(m,r),it.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=it.nextNode())!==null&&d.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(pi)){let b=h[n++],S=o.getAttribute(f).split(Pe),T=/([.?@])?(.*)/.exec(b);d.push({type:1,index:a,name:T[2],strings:S,ctor:T[1]==="."?gr:T[1]==="?"?vr:T[1]==="@"?br:nt}),o.removeAttribute(f)}else f.startsWith(Pe)&&(d.push({type:6,index:a}),o.removeAttribute(f));if(go.test(o.tagName)){let f=o.textContent.split(Pe),b=f.length-1;if(b>0){o.textContent=fr?fr.emptyScript:"";for(let S=0;S<b;S++)o.append(f[S],$t()),it.nextNode(),d.push({type:2,index:++a});o.append(f[b],$t())}}}else if(o.nodeType===8)if(o.data===mi)d.push({type:2,index:a});else{let f=-1;for(;(f=o.data.indexOf(Pe,f+1))!==-1;)d.push({type:7,index:a}),f+=Pe.length-1}a++}}static createElement(t,e){let r=ot.createElement("template");return r.innerHTML=t,r}};function at(i,t,e=i,r){if(t===we)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=Vt(t)?void 0:t._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=at(i,o._$AS(i,t.values),o,r)),t}var yr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??ot).importNode(e,!0);it.currentNode=o;let a=it.nextNode(),n=0,l=0,d=r[0];for(;d!==void 0;){if(n===d.index){let m;d.type===2?m=new ft(a,a.nextSibling,this,t):d.type===1?m=new d.ctor(a,d.name,d.strings,this,t):d.type===6&&(m=new Cr(a,this,t)),this._$AV.push(m),d=r[++l]}n!==d?.index&&(a=it.nextNode(),n++)}return it.currentNode=ot,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ft=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=at(this,t,e),Vt(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==we&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):yo(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&Vt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ot.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Yt.createElement(vo(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new yr(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=fo.get(t.strings);return e===void 0&&fo.set(t.strings,e=new Yt(t)),e}k(t){ui(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let a of t)o===e.length?e.push(r=new i(this.O($t()),this.O($t()),this,this.options)):r=e[o],r._$AI(a),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},nt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=at(this,t,e,0),n=!Vt(t)||t!==this._$AH&&t!==we,n&&(this._$AH=t);else{let l=t,d,m;for(t=a[0],d=0;d<a.length-1;d++)m=at(this,l[r+d],e,d),m===we&&(m=this._$AH[d]),n||(n=!Vt(m)||m!==this._$AH[d]),m===u?t=u:t!==u&&(t+=(m??"")+a[d+1]),this._$AH[d]=m}n&&!o&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},gr=class extends nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},vr=class extends nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},br=class extends nt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=at(this,t,e,0)??u)===we)return;let r=this._$AH,o=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==u&&(r===u||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Cr=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){at(this,t)}},Co={M:pi,P:Pe,A:mi,C:1,L:bo,R:yr,D:yo,V:at,I:ft,H:nt,N:vr,U:br,B:gr,F:Cr},Bn=Dt.litHtmlPolyfillSupport;Bn?.(Yt,ft),(Dt.litHtmlVersions??(Dt.litHtmlVersions=[])).push("3.3.0");var xo=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new ft(t.insertBefore($t(),a),a,void 0,e??{})}return o._$AI(i),o};var Ut=globalThis,g=class extends Se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=xo(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return we}};g._$litElement$=!0,g.finalized=!0,Ut.litElementHydrateSupport?.({LitElement:g});var Fn=Ut.litElementPolyfillSupport;Fn?.({LitElement:g});(Ut.litElementVersions??(Ut.litElementVersions=[])).push("4.2.0");var v=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var jn={attribute:!0,type:String,converter:Ot,reflect:!1,hasChanged:hr},Kn=(i=jn,t,e)=>{let{kind:r,metadata:o}=e,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),a.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(l){let d=t.get.call(this);t.set.call(this,l),this.requestUpdate(n,d,i)},init(l){return l!==void 0&&this.C(n,void 0,i,l),l}}}if(r==="setter"){let{name:n}=e;return function(l){let d=this[n];t.call(this,l),this.requestUpdate(n,d,i)}}throw Error("Unsupported decorator location: "+r)};function c(i){return(t,e)=>typeof e=="object"?Kn(i,t,e):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,t,e)}function _(i){return c({...i,state:!0,attribute:!1})}var st=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function je(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:l}=typeof r=="object"?e:o??(()=>{let d=Symbol();return{get(){return this[d]},set(m){this[d]=m}}})();return st(e,r,{get(){let d=n.call(this);return d===void 0&&(d=a(this),(d!==null||this.hasUpdated)&&l.call(this,d)),d}})}return st(e,r,{get(){return a(this)}})}}function I(i,t,e){return i?t(i):e?.(i)}var E=y` * { box-sizing: border-box; } `,Eo=y` :host { display: block; isolation: isolate; position: relative; width: 100%; //Keep the CSS loader in the same position - check css-loader-inline.ts min-height: 64px; } `;var Ao="https://sdk.primer.io/web/v2-latest/Primer.min.js",fe="20px";var xr=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var Er=class{constructor(t){this.paymentMethods=null;this.headlessInstance=t}setPaymentMethods(t){this.paymentMethods=t}async refreshSession(){if(!this.headlessInstance){A.error("PrimerJS: Cannot refresh session: Headless instance not available");return}try{await this.headlessInstance.refreshClientSession()}catch(t){throw A.error("PrimerJS: Error refreshing client session:",t),t}}getPaymentMethods(){return this.paymentMethods?this.paymentMethods.toArray():(A.warn("PrimerJS: Payment methods not available"),[])}handlePaymentStart(){this.onPaymentStart&&this.onPaymentStart()}handleBeforePaymentCreate(t,e){if(this.onPaymentPrepare){let r={continuePaymentCreation:()=>{A.info("PrimerJS: Payment creation continuing"),e.continuePaymentCreation()},abortPaymentCreation:()=>{A.info("PrimerJS: Payment creation aborted"),e.abortPaymentCreation()}};this.onPaymentPrepare(t,r)}else A.info("PrimerJS: No payment prepare handler, continuing by default"),e.continuePaymentCreation()}handlePaymentComplete(t){this.onPaymentComplete&&this.onPaymentComplete({payment:t,status:"success"})}handlePaymentFailure(t,e){this.onPaymentComplete&&this.onPaymentComplete({payment:e||null,status:"error",error:t})}};var Ar=typeof window<"u"&&typeof window.document<"u";function Gn(i){return document.querySelector(`script[src^="${i}"]`)}function qn(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function _o(i,t=!1){if(!Ar)throw new Error("Cannot load script in server environment");let e=Gn(i)??qn(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o(new Error(`Failed to load script: ${i}`))},e.parentNode||document.head.appendChild(e)})}var Wn={"../../node_modules/card-validator/dist/card-number.js":function(i,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.cardNumber=void 0;var r=e("../../node_modules/card-validator/dist/luhn-10.js"),o=e("../../node_modules/credit-card-type/dist/index.js");function a(l,d,m){return{card:l,isPotentiallyValid:d,isValid:m}}function n(l,d){d===void 0&&(d={});var m,h,f;if(typeof l!="string"&&typeof l!="number")return a(null,!1,!1);var b=String(l).replace(/-|\s/g,"");if(!/^\d*$/.test(b))return a(null,!1,!1);var S=o(b);if(S.length===0)return a(null,!1,!1);if(S.length!==1)return a(null,!0,!1);var T=S[0];if(d.maxLength&&b.length>d.maxLength)return a(T,!1,!1);h=d.skipLuhnValidation===!0||T.type===o.types.UNIONPAY&&d.luhnValidateUnionPay!==!0?!0:r(b),f=Math.max.apply(null,T.lengths),d.maxLength&&(f=Math.min(d.maxLength,f));for(var k=0;k<T.lengths.length;k++)if(T.lengths[k]===b.length)return m=b.length<f||h,a(T,m,h);return a(T,b.length<f,!1)}t.cardNumber=n},"../../node_modules/card-validator/dist/cardholder-name.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.cardholderName=void 0;var e=/^[\d\s-]*$/,r=255;function o(n,l){return{isValid:n,isPotentiallyValid:l}}function a(n){return typeof n!="string"?o(!1,!1):n.length===0?o(!1,!0):n.length>r?o(!1,!1):e.test(n)?o(!1,!0):o(!0,!0)}t.cardholderName=a},"../../node_modules/card-validator/dist/cvv.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.cvv=void 0;var e=3;function r(l,d){for(var m=0;m<l.length;m++)if(d===l[m])return!0;return!1}function o(l){for(var d=e,m=0;m<l.length;m++)d=l[m]>d?l[m]:d;return d}function a(l,d){return{isValid:l,isPotentiallyValid:d}}function n(l,d){return d===void 0&&(d=e),d=d instanceof Array?d:[d],typeof l!="string"||!/^\d*$/.test(l)?a(!1,!1):r(d,l.length)?a(!0,!0):l.length<Math.min.apply(null,d)?a(!1,!0):l.length>o(d)?a(!1,!1):a(!0,!0)}t.cvv=n},"../../node_modules/card-validator/dist/expiration-date.js":function(i,t,e){var r=this&&this.__assign||function(){return r=Object.assign||function(m){for(var h,f=1,b=arguments.length;f<b;f++){h=arguments[f];for(var S in h)Object.prototype.hasOwnProperty.call(h,S)&&(m[S]=h[S])}return m},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.expirationDate=void 0;var o=e("../../node_modules/card-validator/dist/lib/parse-date.js"),a=e("../../node_modules/card-validator/dist/expiration-month.js"),n=e("../../node_modules/card-validator/dist/expiration-year.js");function l(m,h,f,b){return{isValid:m,isPotentiallyValid:h,month:f,year:b}}function d(m,h){var f;if(typeof m=="string")m=m.replace(/^(\d\d) (\d\d(\d\d)?)$/,"$1/$2"),f=(0,o.parseDate)(String(m));else{if(m===null||typeof m!="object")return l(!1,!1,null,null);var b=r({},m);f={month:String(b.month),year:String(b.year)}}var S=(0,a.expirationMonth)(f.month),T=(0,n.expirationYear)(f.year,h);if(S.isValid){if(T.isCurrentYear){var k=S.isValidForThisYear;return l(k,k,f.month,f.year)}if(T.isValid)return l(!0,!0,f.month,f.year)}return S.isPotentiallyValid&&T.isPotentiallyValid?l(!1,!0,null,null):l(!1,!1,null,null)}t.expirationDate=d},"../../node_modules/card-validator/dist/expiration-month.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.expirationMonth=void 0;function e(o,a,n){return{isValid:o,isPotentiallyValid:a,isValidForThisYear:n||!1}}function r(o){var a=new Date().getMonth()+1;if(typeof o!="string")return e(!1,!1);if(o.replace(/\s/g,"")===""||o==="0")return e(!1,!0);if(!/^\d*$/.test(o))return e(!1,!1);var n=parseInt(o,10);if(isNaN(Number(o)))return e(!1,!1);var l=n>0&&n<13;return e(l,l,l&&n>=a)}t.expirationMonth=r},"../../node_modules/card-validator/dist/expiration-year.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.expirationYear=void 0;var e=19;function r(a,n,l){return{isValid:a,isPotentiallyValid:n,isCurrentYear:l||!1}}function o(a,n){n===void 0&&(n=e);var l;if(typeof a!="string")return r(!1,!1);if(a.replace(/\s/g,"")==="")return r(!1,!0);if(!/^\d*$/.test(a))return r(!1,!1);var d=a.length;if(d<2)return r(!1,!0);var m=new Date().getFullYear();if(d===3){var h=a.slice(0,2),f=String(m).slice(0,2);return r(!1,h===f)}if(d>4)return r(!1,!1);var b=parseInt(a,10),S=Number(String(m).substr(2,2)),T=!1;if(d===2){if(String(m).substr(0,2)===a)return r(!1,!0);l=S===b,T=b>=S&&b<=S+n}else d===4&&(l=m===b,T=b>=m&&b<=m+n);return r(T,T,l)}t.expirationYear=o},"../../node_modules/card-validator/dist/index.js":function(i,t,e){var r=this&&this.__createBinding||(Object.create?function(k,O,P,N){N===void 0&&(N=P);var $=Object.getOwnPropertyDescriptor(O,P);(!$||("get"in $?!O.__esModule:$.writable||$.configurable))&&($={enumerable:!0,get:function(){return O[P]}}),Object.defineProperty(k,N,$)}:function(k,O,P,N){N===void 0&&(N=P),k[N]=O[P]}),o=this&&this.__setModuleDefault||(Object.create?function(k,O){Object.defineProperty(k,"default",{enumerable:!0,value:O})}:function(k,O){k.default=O}),a=this&&this.__importStar||function(k){if(k&&k.__esModule)return k;var O={};if(k!=null)for(var P in k)P!=="default"&&Object.prototype.hasOwnProperty.call(k,P)&&r(O,k,P);return o(O,k),O},n=a(e("../../node_modules/credit-card-type/dist/index.js")),l=e("../../node_modules/card-validator/dist/cardholder-name.js"),d=e("../../node_modules/card-validator/dist/card-number.js"),m=e("../../node_modules/card-validator/dist/expiration-date.js"),h=e("../../node_modules/card-validator/dist/expiration-month.js"),f=e("../../node_modules/card-validator/dist/expiration-year.js"),b=e("../../node_modules/card-validator/dist/cvv.js"),S=e("../../node_modules/card-validator/dist/postal-code.js"),T={creditCardType:n,cardholderName:l.cardholderName,number:d.cardNumber,expirationDate:m.expirationDate,expirationMonth:h.expirationMonth,expirationYear:f.expirationYear,cvv:b.cvv,postalCode:S.postalCode};i.exports=T},"../../node_modules/card-validator/dist/lib/is-array.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isArray=void 0,t.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},"../../node_modules/card-validator/dist/lib/parse-date.js":function(i,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.parseDate=void 0;var r=e("../../node_modules/card-validator/dist/expiration-year.js"),o=e("../../node_modules/card-validator/dist/lib/is-array.js");function a(l){var d=Number(l[0]),m;return d===0?2:d>1||d===1&&Number(l[1])>2?1:d===1?(m=l.substr(1),(0,r.expirationYear)(m).isPotentiallyValid?1:2):l.length===5?1:l.length>5?2:1}function n(l){var d;if(/^\d{4}-\d{1,2}$/.test(l)?d=l.split("-").reverse():/\//.test(l)?d=l.split(/\s*\/\s*/g):/\s/.test(l)&&(d=l.split(/ +/g)),(0,o.isArray)(d))return{month:d[0]||"",year:d.slice(1).join()};var m=a(l),h=l.substr(0,m);return{month:h,year:l.substr(h.length)}}t.parseDate=n},"../../node_modules/card-validator/dist/luhn-10.js":function(i){function t(e){for(var r=0,o=!1,a=e.length-1,n;a>=0;)n=parseInt(e.charAt(a),10),o&&(n*=2,n>9&&(n=n%10+1)),o=!o,r+=n,a--;return r%10===0}i.exports=t},"../../node_modules/card-validator/dist/postal-code.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.postalCode=void 0;var e=3,r=new RegExp(/^[a-z0-9]+$/i);function o(n,l){return{isValid:n,isPotentiallyValid:l}}function a(n,l){l===void 0&&(l={});var d=l.minLength||e;return typeof n!="string"?o(!1,!1):n.length<d||!r.test(n.trim().slice(0,d))?o(!1,!0):o(!0,!0)}t.postalCode=a},"../../node_modules/credit-card-type/dist/index.js":function(i,t,e){var r=this&&this.__assign||function(){return r=Object.assign||function(P){for(var N,$=1,Ye=arguments.length;$<Ye;$++){N=arguments[$];for(var _t in N)Object.prototype.hasOwnProperty.call(N,_t)&&(P[_t]=N[_t])}return P},r.apply(this,arguments)},o=e("../../node_modules/credit-card-type/dist/lib/card-types.js"),a=e("../../node_modules/credit-card-type/dist/lib/add-matching-cards-to-results.js"),n=e("../../node_modules/credit-card-type/dist/lib/is-valid-input-type.js"),l=e("../../node_modules/credit-card-type/dist/lib/find-best-match.js"),d=e("../../node_modules/credit-card-type/dist/lib/clone.js"),m={},h={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},f=[h.VISA,h.MASTERCARD,h.AMERICAN_EXPRESS,h.DINERS_CLUB,h.DISCOVER,h.JCB,h.UNIONPAY,h.MAESTRO,h.ELO,h.MIR,h.HIPER,h.HIPERCARD],b=(0,d.clone)(f);function S(P){return m[P]||o[P]}function T(){return b.map(function(P){return(0,d.clone)(S(P))})}function k(P,N){N===void 0&&(N=!1);var $=b.indexOf(P);if(!N&&$===-1)throw new Error('"'+P+'" is not a supported card type.');return $}function O(P){var N=[];if(!(0,n.isValidInputType)(P))return N;if(P.length===0)return T();b.forEach(function(Ye){var _t=S(Ye);(0,a.addMatchingCardsToResults)(P,_t,N)});var $=(0,l.findBestMatch)(N);return $?[$]:N}O.getTypeInfo=function(P){return(0,d.clone)(S(P))},O.removeCard=function(P){var N=k(P);b.splice(N,1)},O.addCard=function(P){var N=k(P.type,!0);m[P.type]=P,N===-1&&b.push(P.type)},O.updateCard=function(P,N){var $=m[P]||o[P];if(!$)throw new Error('"'.concat(P,"\" is not a recognized type. Use `addCard` instead.'"));if(N.type&&$.type!==N.type)throw new Error("Cannot overwrite type parameter.");var Ye=(0,d.clone)($);Ye=r(r({},Ye),N),m[Ye.type]=Ye},O.changeOrder=function(P,N){var $=k(P);b.splice($,1),b.splice(N,0,P)},O.resetModifications=function(){b=(0,d.clone)(f),m={}},O.types=h,i.exports=O},"../../node_modules/credit-card-type/dist/lib/add-matching-cards-to-results.js":function(i,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.addMatchingCardsToResults=void 0;var r=e("../../node_modules/credit-card-type/dist/lib/clone.js"),o=e("../../node_modules/credit-card-type/dist/lib/matches.js");function a(n,l,d){var m,h;for(m=0;m<l.patterns.length;m++){var f=l.patterns[m];if((0,o.matches)(n,f)){var b=(0,r.clone)(l);h=Array.isArray(f)?String(f[0]).length:String(f).length,n.length>=h&&(b.matchStrength=h),d.push(b);break}}}t.addMatchingCardsToResults=a},"../../node_modules/credit-card-type/dist/lib/card-types.js":function(i){var t={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[62207,62209],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292,810,[8110,8131],[8132,8151],[8152,8163],[8164,8171]],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,504174],[504176,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,63737423,63743358,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}};i.exports=t},"../../node_modules/credit-card-type/dist/lib/clone.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0;function e(r){return r?JSON.parse(JSON.stringify(r)):null}t.clone=e},"../../node_modules/credit-card-type/dist/lib/find-best-match.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.findBestMatch=void 0;function e(o){var a=o.filter(function(n){return n.matchStrength}).length;return a>0&&a===o.length}function r(o){return e(o)?o.reduce(function(a,n){return!a||Number(a.matchStrength)<Number(n.matchStrength)?n:a}):null}t.findBestMatch=r},"../../node_modules/credit-card-type/dist/lib/is-valid-input-type.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidInputType=void 0;function e(r){return typeof r=="string"||r instanceof String}t.isValidInputType=e},"../../node_modules/credit-card-type/dist/lib/matches.js":function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.matches=void 0;function e(a,n,l){var d=String(n).length,m=a.substr(0,d),h=parseInt(m,10);return n=parseInt(String(n).substr(0,m.length),10),l=parseInt(String(l).substr(0,m.length),10),h>=n&&h<=l}function r(a,n){return n=String(n),n.substring(0,a.length)===a.substring(0,n.length)}function o(a,n){return Array.isArray(n)?e(a,n[0],n[1]):r(a,n)}t.matches=o}},So={};function Me(i){var t=So[i];if(t!==void 0)return t.exports;var e=So[i]={exports:{}};return Wn[i].call(e.exports,e,e.exports,Me),e.exports}Me.n=i=>{var t=i&&i.__esModule?()=>i.default:()=>i;return Me.d(t,{a:t}),t};Me.d=(i,t)=>{for(var e in t)Me.o(t,e)&&!Me.o(i,e)&&Object.defineProperty(i,e,{enumerable:!0,get:t[e]})};Me.o=(i,t)=>Object.prototype.hasOwnProperty.call(i,t);var yt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",PAY_NL_RIVERTY:"PAY_NL_RIVERTY",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",DLOCAL_PIX:"DLOCAL_PIX",ALMA:"ALMA"};function Jn(i,t){return{"Content-Type":"application/json","primer-client-token":i,"primer-sdk-client":"WEB","primer-sdk-version":"0.0.0-local","primer-sdk-checkout-session-id":t,"x-api-version":"2.4"}}var Bt=()=>Ro.randomUUID?.()||Zn(),Zn=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(i^Xn()>>i/4).toString(16)),Xn=()=>(Ro.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,Ro=typeof crypto<"u"?crypto:{};function Qn(i,t){return async(e,r)=>new Promise(o=>{let a=Bt(),n={id:t,type:"http-request",url:e,init:r,requestId:a};i.contentWindow?.postMessage(n,"*");let l=d=>{d.data.type==="http-response"&&d.data.requestId===a&&(window.removeEventListener("message",l),o(d.data))};window.addEventListener("message",l)})}var vt=class{constructor(t,e="",r={}){R(this,"fetch");R(this,"baseUrl");R(this,"defaultHeaders");this.fetch=t,this.baseUrl=e,this.defaultHeaders=Object.freeze({...r})}setDefaultHeader(t,e){this.defaultHeaders={...this.defaultHeaders,[t]:e}}async get(t,e){return this.fetch(t,{...e,method:"GET",headers:{...this.defaultHeaders,...e?.headers}})}async post(t,e,r){return this.fetch(t,{...r,method:"POST",body:JSON.stringify(e),headers:{...this.defaultHeaders,...r?.headers}})}async delete(t,e){return this.fetch(t,{...e,method:"DELETE",headers:{...this.defaultHeaders,...e?.headers}})}},fi=class extends vt{async getConfiguration(){return this.get(this.baseUrl)}},yi=class extends vt{async getPaymentInstruments(){return this.get(`${this.baseUrl}/payment-instruments`)}async postPaymentInstruments(t){return this.post(`${this.baseUrl}/payment-instruments`,t==="pci-card-form-data"?t:{paymentInstrument:t})}async postCreatePayment(t){return this.post(`${this.baseUrl}/payments`,{paymentMethodToken:t})}async postResumePayment(t,e){return this.post(`${this.baseUrl}/payments/${t}/resume`,{resumeToken:e})}async post3dsAuth(t,e){return this.post(`${this.baseUrl}/3ds/${t}/auth`,e)}async post3dsContinue(t){return this.post(`${this.baseUrl}/3ds/${t}/continue`,{platform:"WEB",status:"FAILURE"})}async get3dsResumeStatus(t){return this.get(t)}async deletePaymentInstrument(t){return this.delete(`${this.baseUrl}/payment-instruments/${t}/vault`)}async postClientSessionActions(t){return this.post(`${this.baseUrl}/client-session/actions`,{actions:t})}async getResumeStatus(t){return this.get(t)}},Do="3.7.7",es=Do,bt=typeof Buffer=="function",Po=typeof TextDecoder=="function"?new TextDecoder:void 0,wo=typeof TextEncoder=="function"?new TextEncoder:void 0,ts="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ht=Array.prototype.slice.call(ts),_r=(i=>{let t={};return i.forEach((e,r)=>t[e]=r),t})(Ht),rs=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,B=String.fromCharCode.bind(String),Mo=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),$o=i=>i.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),Vo=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Yo=i=>{let t,e,r,o,a="",n=i.length%3;for(let l=0;l<i.length;){if((e=i.charCodeAt(l++))>255||(r=i.charCodeAt(l++))>255||(o=i.charCodeAt(l++))>255)throw new TypeError("invalid character found");t=e<<16|r<<8|o,a+=Ht[t>>18&63]+Ht[t>>12&63]+Ht[t>>6&63]+Ht[63&t]}return n?a.slice(0,n-3)+"===".substring(n):a},Si=typeof btoa=="function"?i=>btoa(i):bt?i=>Buffer.from(i,"binary").toString("base64"):Yo,gi=bt?i=>Buffer.from(i).toString("base64"):i=>{let e=[];for(let r=0,o=i.length;r<o;r+=4096)e.push(B.apply(null,i.subarray(r,r+4096)));return Si(e.join(""))},wr=(i,t=!1)=>t?$o(gi(i)):gi(i),is=i=>{if(i.length<2){var t=i.charCodeAt(0);return t<128?i:t<2048?B(192|t>>>6)+B(128|63&t):B(224|t>>>12&15)+B(128|t>>>6&63)+B(128|63&t)}var t=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return B(240|t>>>18&7)+B(128|t>>>12&63)+B(128|t>>>6&63)+B(128|63&t)},os=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Uo=i=>i.replace(os,is),To=bt?i=>Buffer.from(i,"utf8").toString("base64"):wo?i=>gi(wo.encode(i)):i=>Si(Uo(i)),gt=(i,t=!1)=>t?$o(To(i)):To(i),ko=i=>gt(i,!0),as=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ns=i=>{switch(i.length){case 4:var t=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),e=t-65536;return B((e>>>10)+55296)+B((1023&e)+56320);case 3:return B((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return B((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},Ho=i=>i.replace(as,ns),zo=i=>{if(i=i.replace(/\s+/g,""),!rs.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(3&i.length));let t,e="",r,o;for(let a=0;a<i.length;)t=_r[i.charAt(a++)]<<18|_r[i.charAt(a++)]<<12|(r=_r[i.charAt(a++)])<<6|(o=_r[i.charAt(a++)]),e+=r===64?B(t>>16&255):o===64?B(t>>16&255,t>>8&255):B(t>>16&255,t>>8&255,255&t);return e},Pi=typeof atob=="function"?i=>atob(Vo(i)):bt?i=>Buffer.from(i,"base64").toString("binary"):zo,Bo=bt?i=>Mo(Buffer.from(i,"base64")):i=>Mo(Pi(i).split("").map(t=>t.charCodeAt(0))),Fo=i=>Bo(jo(i)),ss=bt?i=>Buffer.from(i,"base64").toString("utf8"):Po?i=>Po.decode(Bo(i)):i=>Ho(Pi(i)),jo=i=>Vo(i.replace(/[-_]/g,t=>t=="-"?"+":"/")),vi=i=>ss(jo(i)),ls=i=>{if(typeof i!="string")return!1;let t=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},Ko=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),Go=function(){let i=(t,e)=>Object.defineProperty(String.prototype,t,Ko(e));i("fromBase64",function(){return vi(this)}),i("toBase64",function(t){return gt(this,t)}),i("toBase64URI",function(){return gt(this,!0)}),i("toBase64URL",function(){return gt(this,!0)}),i("toUint8Array",function(){return Fo(this)})},qo=function(){let i=(t,e)=>Object.defineProperty(Uint8Array.prototype,t,Ko(e));i("toBase64",function(t){return wr(this,t)}),i("toBase64URI",function(){return wr(this,!0)}),i("toBase64URL",function(){return wr(this,!0)})},ds=()=>{Go(),qo()},Wo={version:Do,VERSION:es,atob:Pi,atobPolyfill:zo,btoa:Si,btoaPolyfill:Yo,fromBase64:vi,toBase64:gt,encode:gt,encodeURI:ko,encodeURL:ko,utob:Uo,btou:Ho,decode:vi,isValid:ls,fromUint8Array:wr,toUint8Array:Fo,extendString:Go,extendUint8Array:qo,extendBuiltins:ds},Mr={encode:cs,decode:Wo.decode};function cs(i,t={}){let{urlSafe:e=!1}=t;return Wo.encode(i,e)}function ps(i,t){return!(i.intent!==`${t}_REDIRECTION`||!("statusUrl"in i)||!("redirectUrl"in i)||!i.redirectUrl||!i.statusUrl)}function Tr(i){let t=hs(i),e=1e3*t.exp;if(Date.now()>e)throw new Error(`${ms}. Expiration date: ${new Date(e).toISOString()}`);return t}var Jo="The provided `clientToken`",ms=`${Jo} has expired`,us=`${Jo} is malformed`;function hs(i){try{let[t,e]=i.split("."),r=e||t;return JSON.parse(Mr.decode(r))}catch{throw new Error(us)}}var Zo="https://sdk.primer.io/web/hosted-pages/v0-latest",fs=`${Zo}/api-controller.html`,ys=`${Zo}/hosted-input.html`;function Xo(i,t){return btoa(JSON.stringify({checkoutSessionId:i,name:t}))}async function gs(i){return new Promise((t,e)=>{let r=Xo(i,"api"),o=`${fs}#${r}`,a=document.querySelector(`iframe[src="${o}"]`)??document.createElement("iframe");a.parentElement?t(a):(a.style.display="none",a.onload=()=>t(a),a.onerror=n=>{e(new Error(`Failed to initialize Primer SDK: ${n}`))},a.src=o,document.body.appendChild(a))})}var bi=class extends vt{async postClientSessionActions(t){return t.length===0?Promise.resolve({data:void 0,headers:{},status:200,id:"",requestId:"",type:"http-response"}):this.post(`${this.baseUrl}/client-session/actions`,{actions:t})}async selectPaymentMethod(t,e={}){return this.postClientSessionActions([{type:"SELECT_PAYMENT_METHOD",params:{...e,paymentMethodType:t}}])}async unselectPaymentMethod(){return this.postClientSessionActions([{type:"UNSELECT_PAYMENT_METHOD"}])}async selectCardNetwork(t){return this.selectPaymentMethod(yt.PAYMENT_CARD,{binData:this.buildCardBinData(t)})}async setBillingAddress(t){let e=this.removeEmptyStringFromObject(t);return this.postClientSessionActions([{type:"SET_BILLING_ADDRESS",params:{billingAddress:e}}])}async setShippingAddress(t,e,r){let o=[];return t&&Object.keys(t).some(n=>!!t[n])&&o.push({type:"SET_SHIPPING_ADDRESS",params:{shippingAddress:t}}),e&&o.push({type:"SET_MOBILE_NUMBER",params:{mobileNumber:e}}),r&&o.push({type:"SET_EMAIL_ADDRESS",params:{emailAddress:r}}),this.postClientSessionActions(o)}async selectShippingMethod(t){return this.postClientSessionActions([{type:"SELECT_SHIPPING_METHOD",params:{shippingMethodId:t}}])}async setCustomerDetails({emailAddress:t,firstName:e,lastName:r}){let o=[];return t&&o.push({type:"SET_EMAIL_ADDRESS",params:{emailAddress:t}}),e&&o.push({type:"SET_CUSTOMER_FIRST_NAME",params:{firstName:e}}),r&&o.push({type:"SET_CUSTOMER_LAST_NAME",params:{lastName:r}}),this.postClientSessionActions(o)}buildCardBinData(t){let e=this.getCardNetworkName(t);return{network:e,issuer_name:null,product_code:e,product_name:e,product_usage_type:"UNKNOWN",account_number_type:"UNKNOWN",issuer_country_code:null,account_funding_type:"UNKNOWN",issuer_currency_code:null,regional_restriction:"UNKNOWN",prepaid_reloadable_indicator:"NOT_APPLICABLE"}}getCardNetworkName(t){return{visa:"VISA",mastercard:"MASTERCARD",amex:"AMERICAN_EXPRESS",discover:"DISCOVER"}[t.toLowerCase()]||t}removeEmptyStringFromObject(t){let e={...t};for(let r in e)e[r]===""?delete e[r]:typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])&&(e[r]=this.removeEmptyStringFromObject(e[r]));return e}},Ci=class extends vt{async createPaypalOrder(t){return this.post(`${this.baseUrl}/paypal/orders/create`,t)}async createApplePaySession(t){return this.post(`${this.baseUrl}/apple-pay/sessions`,t)}};async function vs(i){let t=Bt(),e=Tr(i),r=await gs(t),o=Qn(r,t),a=Jn(e.accessToken,t),n=new fi(o,e.configurationUrl,a),{data:l,error:d}=await n.getConfiguration();if(d||!l)throw new Error(`Failed to fetch configuration: ${d}`);let m=new yi(o,l.pciUrl,a),h=new Ci(o,l.coreUrl,a),f=new bi(o,l.pciUrl,a);return{apiControllerIframe:r,configuration:l,checkoutSessionId:t,configurationApi:n,pciApi:m,coreApi:h,clientSessionApi:f,updateClientToken:b=>{try{let S=Tr(b);n.setDefaultHeader("primer-client-token",S.accessToken),m.setDefaultHeader("primer-client-token",S.accessToken),h.setDefaultHeader("primer-client-token",S.accessToken),f.setDefaultHeader("primer-client-token",S.accessToken)}catch{}}}}var xi=class{constructor(t){R(this,"context");this.context=t}};function Qo(){return{javaEnabled:typeof window.navigator.javaEnabled=="function"?window.navigator.javaEnabled():!1,language:window.navigator.language,colorDepth:window.screen.colorDepth,screenHeight:window.screen.height,screenWidth:window.screen.width,timezoneOffset:new Date().getTimezoneOffset(),userAgent:window.navigator.userAgent}}function ea(i){return i?new Promise(t=>{setTimeout(t,i)}):Promise.resolve()}var Ei=class extends xi{async handleRequiredAction(t){let e=t.requiredAction?.clientToken;if(!e)throw new Error("No client token provided");let r=Tr(e);if(!("intent"in r)||r.intent!=="3DS_AUTHENTICATION")throw new Error("Invalid client token");let{error:o,data:a}=await this.context.pciApi.post3dsAuth(r.tokenId,{device:Qo()});if(o||!a||!a.authentication)throw o??new Error("Unable to authenticate");let n=a;a.authentication.responseCode==="METHOD"?n=await this.handleMethod(r.tokenId,a.authentication):a.authentication.responseCode==="CHALLENGE"&&(n=await this.handleChallenge(r.tokenId,a.authentication));let l=await this.context.pciApi.postResumePayment(t.id,n.resumeToken);if(l.error||!l.data)throw l.error??new Error("Unable to resume payment");return l.data}async handleMethod(t,e){let r="primer-3ds-method-box",o="primer-3ds-method-iframe",a="primer-3ds-method-form",n="threeDSMethodData",l=document.createElement("div");l.id=r,l.style.position="absolute",l.style.width="2px",l.style.height="2px",l.style.left="-10000px";let d=document.createElement("iframe");d.style.display="none",d.id=o,d.name=o,l.appendChild(d);let m=document.createElement("form"),h=document.createElement("input");h.type="hidden",h.id=n,h.name=n,h.value=Mr.encode(JSON.stringify({threeDSServerTransID:e.transactionId,threeDSMethodNotificationURL:e.notificationUrl}),{urlSafe:!0}).replace(/=+$/g,""),m.appendChild(h),m.id=a,m.name=a,m.action=e.acsMethodUrl,m.target=o,m.method="post",l.appendChild(m),document.body.appendChild(l),m.submit();let{data:f,error:b}=await this.pollStatus(e.statusUrl,"METHOD",1e3).promise;return l.remove(),b||!f?this.continueAuth(t):f}pollStatus(t,e="METHOD",r=1e3,o=66e4){let a=!0;return{promise:new Promise(async n=>{let l=setTimeout(()=>{a=!1,n({error:new Error("Operation timed out"),data:null})},o);try{for(;a;){let d=await this.context.pciApi.get3dsResumeStatus(t);if(d.error){clearTimeout(l),n(d);return}if(await ea(r),d.data&&d.data.authentication.responseCode!==e){clearTimeout(l),n(d);return}}}catch(d){clearTimeout(l),n({error:d,data:null})}}),abort:()=>{a=!1}}}async continueAuth(t){let{data:e,error:r}=await this.context.pciApi.post3dsContinue(t);return r||!e?{resumeToken:Bt(),authentication:{responseCode:"SKIPPED",skippedReasonCode:"NEGOTIATION_ERROR",skippedReasonText:"Failed to negotiate with 3DS server"}}:e}async handleChallenge(t,e){let r=`3ds-challenge-iframe-${Bt()}`,o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)";let a=document.createElement("div");a.style.height="min(calc(100vh - 16px), 600px)",a.style.width="min(calc(100vw - 16px), 500px)",a.style.display="grid",a.style.placeContent="center",a.style.backgroundColor="#ffffff",a.style.borderRadius="3px",a.style.position="relative",a.style.boxShadow="1px 1px 5px 3px rgba(0, 0, 0, 0.05)",a.style.overflow="hidden",o.appendChild(a);let n=document.createElement("iframe");n.id=r,n.name=r,n.width="100%",n.height="100%",n.setAttribute("width","100%"),n.setAttribute("height","100%"),n.setAttribute("frameBorder","0"),n.setAttribute("border","0"),n.style.position="absolute",n.style.top="0",n.style.left="0";let l=document.createElement("form");if(l.style.width="1px",l.style.height="1px",l.style.position="absolute",l.style.left="-10000px",l.action=e.acsChallengeUrl,l.target=r,l.method="post",/^1/.test(e.protocolVersion)){let f=document.createElement("input"),b=document.createElement("input");f.type="hidden",f.name="PaReq",f.id="PaReq",f.value=e.acsChallengeData??"",b.type="hidden",b.name="TermUrl",b.id="TermUrl",b.value=e.notificationUrl??"",l.appendChild(f),l.appendChild(b)}else{let f=document.createElement("input"),b=document.createElement("input");f.type="hidden",f.name="creq",f.id="creq",f.value=Mr.encode(JSON.stringify({threeDSServerTransID:e.transactionId,acsTransID:e.acsTransactionId,messageVersion:e.protocolVersion,messageType:"CReq",challengeWindowSize:"05"}),{urlSafe:!0}),b.type="hidden",b.name="threeDSSessionData",b.id="threeDSSessionData",l.appendChild(f),l.appendChild(b)}a.appendChild(l),a.appendChild(n),document.body.appendChild(o),l.submit();let h=await this.pollStatus(e.statusUrl,"CHALLENGE",2500,66e4).promise;return o.remove(),h.error||!h.data?this.continueAuth(t):h.data}},lt=class{constructor(t,e){R(this,"config");R(this,"context");this.config=Object.freeze(t),this.context=e}async setup(){return!0}async start(){}async render(t){}async handleRequiredAction(t){return t.requiredAction?.name==="3DS_AUTHENTICATION"?new Ei(this.context).handleRequiredAction(t):t}async createPayment(t){let{error:e,data:r}=await this.context.pciApi.postCreatePayment(t);if(e||!r)throw e??new Error("Unable to create payment");return r.requiredAction?.clientToken&&this.context.updateClientToken(r.requiredAction.clientToken),r}async resumePayment(t,e){let{error:r,data:o}=await this.context.pciApi.postResumePayment(t,e);if(r||!o)throw r??new Error("Unable to resume payment");return o}},bs=Me("../../node_modules/card-validator/dist/index.js"),Cs=Me.n(bs);function xs(i){let t=Cs().number(i);return{isValid:t.isValid||!1,card:{type:t.card?.type||null,code:t.card?.code||{name:"CVV",size:4},lengths:t.card?.lengths||[16],gaps:t.card?.gaps||[4,8,12]}}}var Ai=class{constructor(t){R(this,"listeners",new Set);R(this,"state");R(this,"initialState");this.initialState=t,this.state=Object.freeze(structuredClone(t))}reset(){this.setState(structuredClone(this.initialState))}getState(){return this.state}setState(t){this.state=Object.freeze({...this.state,...t}),this.notify()}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){this.listeners.forEach(t=>t(this.state))}},zt=class extends Ai{constructor(e,r){super(e);R(this,"options");R(this,"channel");R(this,"key");this.key=r.id+r.name,this.options=r,this.channel=new BroadcastChannel(this.key),this.channel.addEventListener("message",this.onMessage.bind(this)),this.options.crossOriginTarget&&window.addEventListener("message",this.onMessage.bind(this))}setState(e){this.internalSetState(e)}onMessage(e){e.data.key===this.key&&this.internalSetState(e.data.state,e.data.type)}internalSetState(e,r){this.options.main?this.setMainState(e):this.setNonMainState(e,r)}setMainState(e){super.setState(e),this.postMessage({type:"post-state",key:this.key,state:super.getState()})}setNonMainState(e,r){if(r!=="patch-state"){if(r==="post-state")return void super.setState(e);this.postMessage({type:"patch-state",key:this.key,state:e})}}postMessage(e){this.channel.postMessage(e),this.options.crossOriginTarget?.postMessage(e,"*")}},Sr={placeholder:"",ariaLabel:"",style:{}};function Es(i,t,e=!1){return{pciStore:new zt({cardNumber:"",cardSecurityCode:"",cardExpiryDate:"",cardHolderName:""},{main:e,id:i,name:"card-form-pci"}),publicStore:new zt({cardNumber:{valid:!1,dirty:!1,touched:!1,focused:!1,error:""},cardSecurityCode:{valid:!1,dirty:!1,touched:!1,focused:!1,error:""},cardExpiryDate:{valid:!1,dirty:!1,touched:!1,focused:!1,error:""},cardHolderName:{valid:!1,dirty:!1,touched:!1,focused:!1,error:""},type:xs("")},{main:e,id:i,name:"card-form-public",crossOriginTarget:t}),optionsStore:new zt({cardNumber:structuredClone(Sr),cardSecurityCode:structuredClone(Sr),cardExpiryDate:structuredClone(Sr),cardHolderName:structuredClone(Sr)},{main:e,id:i,name:"card-form-options",crossOriginTarget:t})}}function As(i){return{cardNumber:Pr(i,"cardNumber"),cardSecurityCode:Pr(i,"cardSecurityCode"),cardExpiryDate:Pr(i,"cardExpiryDate"),cardHolderName:Pr(i,"cardHolderName")}}function Pr(i,t){let e=document.createElement("iframe"),r=Xo(i,t);return e.src=`${ys}#${r}`,e.setAttribute("tabindex","0"),e.setAttribute("frameBorder","0"),e.style.border="none",e.style.boxSizing="border-box",e.style.height="20px",e.style.width="100%",e.style.colorScheme="auto",e}var kr=class extends lt{constructor(e,r){super(e,r);R(this,"iframes");R(this,"store");this.store=Es(r.checkoutSessionId,r.apiControllerIframe.contentWindow),this.iframes=As(r.checkoutSessionId)}async tokenize(){let{error:e,data:r}=await this.context.pciApi.postPaymentInstruments("pci-card-form-data");if(e||!r)throw e??new Error("Unable to tokenize payment method");return r}},_s=100;function Ss({height:i,name:t,url:e="",width:r}){let o=new Set,a=window.open(e,t,ws({height:i,width:r}));if(!a)return;function n(){a?.close(),l()}function l(){o.forEach(d=>d()),o.clear(),window.removeEventListener("beforeunload",n)}return window.addEventListener("beforeunload",n),Ps(a).then(l),{close:n,focus(){a.focus()},get isOpen(){return a?.closed===!1},onClose(d){return o.add(d),()=>{o.delete(d)}},setContent(d){a.document.write(d)},setUrl(d){a.location.replace(d)}}}var Ps=i=>new Promise(t=>{let e=setInterval(()=>{i.closed&&(clearInterval(e),t())},_s)});function ws(i){let t=Ms({parent:{left:window.screenLeft,top:window.screenTop,height:window.outerHeight,width:window.outerWidth},popup:i});return Ts(t)}var Ms=({parent:i,popup:t})=>({left:i.left+(i.width-t.width)/2,top:i.top+(i.height-t.height)/2,height:t.height,width:t.width}),Ts=i=>Object.entries(i).map(t=>t.join("=")).join(","),_i=class extends lt{constructor(){super(...arguments);R(this,"popup")}async start(){this.openPopup()}async tokenize(){let{error:e,data:r}=await this.context.pciApi.postPaymentInstruments({type:"OFF_SESSION_PAYMENT",paymentMethodType:this.config.type,paymentMethodConfigId:this.config.id,sessionInfo:{locale:"en",platform:"WEB",browserInfo:Qo()}});if(e||!r)throw e??new Error("Unable to tokenize payment method");return r}async handleRequiredAction(e){let r=e.requiredAction?.clientToken;if(!r)throw new Error("No client token provided");let o=Tr(r);if(!ps(o,this.config.type))throw new Error("Invalid client token");this.popup?.setUrl(o.redirectUrl);let a=new Promise(h=>{this.popup?.onClose(()=>h({id:""}))}),{promise:n,abort:l}=this.pollStatus(o.statusUrl),d=await Promise.race([a,n]);if(l(),this.popup?.close(),"error"in d)throw d.error;let m=d.id;if(!m){let h=await this.context.pciApi.getResumeStatus(o.statusUrl);if(h.error||!h.data?.id)throw h.error??new Error("Unable to get resume token");m=h.data.id}return await this.resumePayment(e.id,m)}pollStatus(e){let r=!0;return{promise:new Promise(async o=>{for(;r;){let{data:a,error:n}=await this.context.pciApi.getResumeStatus(e);if(n)return void o({error:n});if(await ea(1e3),a?.status==="COMPLETE")return void o({id:a.id})}}),abort:()=>{r=!1}}}openPopup(){let{name:e,displayMetadata:{button:r,overlay:o,popup:a}}=this.config;this.popup=Ss({name:e,height:a?.height??500,width:a?.width??1e3});let n=o?.logo.colored||r?.iconUrl.colored||o?.logo.light||r?.iconUrl.light||o?.logo.dark||r?.iconUrl.dark;this.popup?.setContent(ks({name:e,logoSrc:n,logoAlt:e,message:`Loading ${e}...`}))}},ks=({name:i,logoSrc:t,logoAlt:e,message:r})=>`<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<style>
|
|
7
|
+
@keyframes rotate {
|
|
8
|
+
100% {
|
|
9
|
+
transform: rotate(360deg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@keyframes dash {
|
|
14
|
+
0% {
|
|
15
|
+
stroke-dasharray: 1, 150;
|
|
16
|
+
stroke-dashoffset: 0;
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
stroke-dasharray: 90, 150;
|
|
20
|
+
stroke-dashoffset: -35;
|
|
21
|
+
}
|
|
22
|
+
100% {
|
|
23
|
+
stroke-dasharray: 90, 150;
|
|
24
|
+
stroke-dashoffset: -124;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
body {
|
|
29
|
+
display: grid;
|
|
30
|
+
place-content: center;
|
|
31
|
+
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
width: 100vw;
|
|
36
|
+
height: 100vh;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.spinner-container {
|
|
40
|
+
display: grid;
|
|
41
|
+
place-content: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.spinner-container .spinner {
|
|
45
|
+
animation: rotate 1.2s linear infinite;
|
|
46
|
+
z-index: 2;
|
|
47
|
+
|
|
48
|
+
width: 32px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.spinner-container .path {
|
|
52
|
+
stroke: #dbdbdb;
|
|
53
|
+
stroke-linecap: round;
|
|
54
|
+
animation: dash 1.5s ease-in-out infinite;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.content {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
align-items: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.logo {
|
|
64
|
+
max-width: 80px;
|
|
65
|
+
max-height: 50px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.logo-container {
|
|
69
|
+
height: 50px;
|
|
70
|
+
min-width: 50px;
|
|
71
|
+
margin-bottom: 32px;
|
|
72
|
+
border-radius: 8px;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
padding-left: 10px;
|
|
77
|
+
padding-right: 10px;
|
|
78
|
+
border: 1px solid #9f9f9f45;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.message {
|
|
82
|
+
margin-bottom: 32px;
|
|
83
|
+
|
|
84
|
+
font-family: sans-serif;
|
|
85
|
+
text-align: center;
|
|
86
|
+
color: #8c8c8c;
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
89
|
+
<title>${i}</title>
|
|
90
|
+
</head>
|
|
91
|
+
<body>
|
|
92
|
+
<div class="content">
|
|
93
|
+
<div class="logo-container" style="background: {background}">
|
|
94
|
+
<img class="logo" src="${t}" alt="${e}" />
|
|
95
|
+
</div>
|
|
96
|
+
<div class="message">${r}</div>
|
|
97
|
+
<div class="spinner-container" aria-label="Loading">
|
|
98
|
+
<svg class="spinner" viewBox="0 0 50 50">
|
|
99
|
+
<circle
|
|
100
|
+
class="path"
|
|
101
|
+
cx="25"
|
|
102
|
+
cy="25"
|
|
103
|
+
r="20"
|
|
104
|
+
fill="none"
|
|
105
|
+
stroke-width="5"
|
|
106
|
+
></circle>
|
|
107
|
+
</svg>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</body>
|
|
111
|
+
</html>
|
|
112
|
+
`;function Is(i,t){var e={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(i);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(i,r[o])&&(e[r[o]]=i[r[o]]);return e}function Ls(i,t){var e=document.querySelector('script[src="'.concat(i,'"]'));if(e===null)return null;var r=ta(i,t),o=e.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(r.dataset).length)return null;var a=!0;return Object.keys(o.dataset).forEach(function(n){o.dataset[n]!==r.dataset[n]&&(a=!1)}),a?e:null}function Ns(i){var t=i.url,e=i.attributes,r=i.onSuccess,o=i.onError,a=ta(t,e);a.onerror=o,a.onload=r,document.head.insertBefore(a,document.head.firstElementChild)}function Os(i){var t=i.sdkBaseUrl,e=i.environment,r=Is(i,["sdkBaseUrl","environment"]),o=t||$s(e),a=r,n=Object.keys(a).filter(function(m){return a[m]!==void 0&&a[m]!==null&&a[m]!==""}).reduce(function(m,h){var f=a[h].toString();return h=Rs(h),h.substring(0,4)==="data"||h==="crossorigin"?m.attributes[h]=f:m.queryParams[h]=f,m},{queryParams:{},attributes:{}}),l=n.queryParams,d=n.attributes;return l["merchant-id"]&&l["merchant-id"].indexOf(",")!==-1&&(d["data-merchant-id"]=l["merchant-id"],l["merchant-id"]="*"),{url:"".concat(o,"?").concat(Ds(l)),attributes:d}}function Rs(i){var t=function(e,r){return(r?"-":"")+e.toLowerCase()};return i.replace(/[A-Z]+(?![a-z])|[A-Z]/g,t)}function Ds(i){var t="";return Object.keys(i).forEach(function(e){t.length!==0&&(t+="&"),t+=e+"="+i[e]}),t}function $s(i){return i==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}function ta(i,t){t===void 0&&(t={});var e=document.createElement("script");return e.src=i,Object.keys(t).forEach(function(r){e.setAttribute(r,t[r]),r==="data-csp-nonce"&&e.setAttribute("nonce",t["data-csp-nonce"])}),e}function Vs(i,t){if(t===void 0&&(t=Promise),ra(i,t),typeof document>"u")return t.resolve(null);var e=Os(i),r=e.url,o=e.attributes,a=o["data-namespace"]||"paypal",n=Io(a);return o["data-js-sdk-library"]||(o["data-js-sdk-library"]="paypal-js"),Ls(r,o)&&n?t.resolve(n):Ys({url:r,attributes:o},t).then(function(){var l=Io(a);if(l)return l;throw new Error("The window.".concat(a," global variable is not available."))})}function Ys(i,t){t===void 0&&(t=Promise),ra(i,t);var e=i.url,r=i.attributes;if(typeof e!="string"||e.length===0)throw new Error("Invalid url.");if(r!==void 0&&typeof r!="object")throw new Error("Expected attributes to be an object.");return new t(function(o,a){if(typeof document>"u")return o();Ns({url:e,attributes:r,onSuccess:function(){return o()},onError:function(){var n=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return a(n)}})})}function Io(i){return window[i]}function ra(i,t){if(typeof i!="object"||i===null)throw new Error("Expected an options object.");var e=i.environment;if(e&&e!=="production"&&e!=="sandbox")throw new Error('The `environment` option must be either "production" or "sandbox".');if(t!==void 0&&typeof t!="function")throw new Error("Expected PromisePonyfill to be a function.")}var Ir=class extends lt{constructor(){super(...arguments);R(this,"paypalInstance");R(this,"dataNamespace",Bt());R(this,"callbacks",{onStart:()=>{},onError:()=>{},onSuccess:()=>{}})}setCallbacks(e){this.callbacks=e}async tokenize(){throw new Error("PayPal does not support direct tokenization")}async setup(){let{clientId:e,intent:r}=this.config.options;if(!e||!r)return!1;try{let o=await Vs({dataNamespace:this.dataNamespace,clientId:e,currency:this.context.configuration.clientSession.order.currencyCode,components:["buttons","funding-eligibility"],disableFunding:["bancontact","card","credit"],intent:r??"authorize"});return o?(this.paypalInstance=o,!0):!1}catch{return!1}}async render(e){if(!this.paypalInstance.Buttons)return;let r=this.paypalInstance.Buttons({style:{color:"gold",shape:"rect",label:"paypal",tagline:!1},createOrder:this.handleCreateOrder.bind(this),onInit:this.handleInit.bind(this),onClick:this.handleClick.bind(this),onApprove:this.handleApprove.bind(this),onCancel:this.handleCancel.bind(this),onError:this.handleError.bind(this)});if(!r.isEligible())throw new Error("PayPal Buttons are not eligible for rendering");await r.render(e)}handleInit(e,r){}handleClick(e,r){return r.resolve()}async handleCreateOrder(){this.callbacks.onStart(),await this.context.clientSessionApi.selectPaymentMethod(this.config.type);let{data:e,error:r}=await this.context.coreApi.createPaypalOrder(this.buildCreateOrderRequestBody());if(r||!e)throw r??new Error("Unable to create PayPal order");return e.orderId}async handleApprove(e,r){let o=null;try{o=await r?.order?.get()??null}catch{}let{error:a,data:n}=await this.context.pciApi.postPaymentInstruments({external_payer_info:{email:o?.payment_source?.paypal?.email_address,external_payer_id:e.payerID??void 0},paypal_order_id:e.orderID,paypal_status:o?.status});if(a||!n)throw a??new Error("Unable to create payment instrument");let l=await this.createPayment(n.token);this.callbacks.onSuccess(l)}handleCancel(){this.context.clientSessionApi.unselectPaymentMethod()}handleError(e){}buildCreateOrderRequestBody(){let{order:{currencyCode:e,merchantAmount:r,totalOrderAmount:o,shipping:a,lineItems:n=[],fees:l=[]}}=this.context.configuration.clientSession;if(!e)throw new Error("Currency code is not provided");let d={amount:r??o,currencyCode:e,paymentMethodConfigId:this.config.id,amountBreakdown:{}},m=!n.some(({description:h})=>!h);if(m&&(d.items=n.map(({description:h,taxAmount:f,amount:b,quantity:S})=>{let T=f?Math.floor(f/S):0;return{name:h,unit_amount:{value:b,currency_code:e},quantity:S.toString(),tax:{value:T,currency_code:e}}})),m&&n.length){let h=n.reduce((T,{amount:k,quantity:O})=>T+k*O,0),f=l?.reduce?.((T,{amount:k})=>T+(k??0),0),b=n?.reduce((T,{discountAmount:k})=>T+(k??0),0),S=n?.reduce((T,{taxAmount:k,quantity:O})=>T+(k??0*O),0);d.amountBreakdown={item_total:{value:h,currency_code:e},tax_total:{value:S,currency_code:e},handling:{value:f??0,currency_code:e},shipping:{value:a?.amount??0,currency_code:e},discount:{value:b,currency_code:e}}}return d}},Lo=5,Lr=class extends lt{constructor(){super(...arguments);R(this,"applePaySession",null);R(this,"callbacks",{onStart:()=>{},onError:()=>{},onSuccess:()=>{}})}setCallbacks(e){this.callbacks=e}async tokenize(){throw new Error("ApplePay does not support direct tokenization")}async setup(){try{if(!ApplePaySession||!ApplePaySession.supportsVersion(Lo)||!ApplePaySession.canMakePayments())return!1;let e=window.location.hostname;if(!(this.config.options.merchantDomains||[]).includes(e))return!1}catch{return!1}return!0}async render(e){let r=document.createElement("button");r.setAttribute("style","display: inline-block;width: 100%;cursor: pointer;height: 40px;-webkit-appearance: -apple-pay-button;-apple-pay-button-type: plain;-apple-pay-button-style: black"),r.setAttribute("type","button"),r.classList.add("primer-apple-pay-button"),r.addEventListener("click",this.handleButtonClick.bind(this)),e.appendChild(r)}async handleButtonClick(){try{this.callbacks.onStart(),this.applePaySession=new ApplePaySession(Lo,this.createPaymentRequest()),this.applePaySession.onvalidatemerchant=this.handleValidateMerchant.bind(this),this.applePaySession.onpaymentauthorized=this.handlePaymentAuthorized.bind(this),this.applePaySession.onpaymentmethodselected=this.handlePaymentMethodSelected.bind(this),this.applePaySession.oncancel=this.handleCancel.bind(this),this.applePaySession.begin()}catch{}}async handleValidateMerchant({validationURL:e}){if(this.applePaySession)try{let{data:r,error:o}=await this.context.coreApi.createApplePaySession({validationUrl:e,paymentMethodConfigId:this.config.id,merchantDomain:window.location.hostname});if(o||!r||!this.applePaySession)throw o??new Error("Failed to validate merchant");this.applePaySession.completeMerchantValidation(r)}catch{this.abort()}}async handlePaymentMethodSelected(){if(this.applePaySession)try{let{merchantAmount:e,totalOrderAmount:r}=this.context.configuration.clientSession.order;this.applePaySession.completePaymentMethodSelection({newTotal:{label:this.config.options.merchantName,amount:this.formatAmount(e??r),type:"final"}})}catch{this.abort()}}async handlePaymentAuthorized({payment:e}){if(this.applePaySession)try{let r={paymentMethodConfigId:this.config.id,token:e.token},o=await this.context.pciApi.postPaymentInstruments(r),a=await this.createPayment(o.data.token),n=await this.handleRequiredAction(a);n.status==="SUCCESS"?(this.applePaySession.completePayment(ApplePaySession.STATUS_SUCCESS),this.callbacks.onSuccess(n)):(this.applePaySession.completePayment(ApplePaySession.STATUS_FAILURE),this.callbacks.onError()),this.applePaySession=null}catch{this.applePaySession&&(this.applePaySession.completePayment(ApplePaySession.STATUS_FAILURE),this.applePaySession=null),this.callbacks.onError()}}handleCancel(){this.applePaySession=null,this.callbacks.onError()}abort(){this.applePaySession?.abort(),this.applePaySession=null,this.callbacks.onError()}createPaymentRequest(){let{countryCode:e,currencyCode:r,merchantAmount:o,totalOrderAmount:a}=this.context.configuration.clientSession.order;if(!e||!r)throw new Error("Country code and currency code are required");let n=["visa","masterCard","amex"],l=this.formatAmount(o??a);return{countryCode:e,currencyCode:r,merchantCapabilities:["supports3DS"],supportedNetworks:n,total:{amount:l,label:this.config.options.merchantName,type:"pending"}}}formatAmount(e){return(e/100).toFixed(2)}};function Us(i,t={}){return new Promise((e,r)=>{if(document.querySelector(`script[src="${i}"]`))return void e();let o=document.createElement("script");o.src=i,Object.entries(t).forEach(([a,n])=>{o.setAttribute(a,n)}),o.onload=()=>{e()},o.onerror=()=>{r(new Error(`Failed to load script: ${i}`))},document.head.appendChild(o)})}var No=2,Oo=0,Nr=class extends lt{constructor(){super(...arguments);R(this,"client");R(this,"callbacks",{onStart:()=>{},onError:()=>{},onSuccess:()=>{}});R(this,"allowedPaymentMethod",{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}})}setCallbacks(e){this.callbacks=e}async tokenize(){throw new Error("Google Pay does not support direct tokenization")}async setup(){try{await Us("https://pay.google.com/gp/p/js/pay.js")}catch{return!1}if(!window.google||!window.google.payments||(this.client=new google.payments.api.PaymentsClient({environment:"TEST"}),!this.client.isReadyToPay(this.buildIsReadyToPayRequest())))return!1;let{countryCode:e,currencyCode:r}=this.context.configuration.clientSession.order;return!(!e||!r)}async render(e){let r=this.client.createButton({buttonType:"buy",buttonColor:"black",buttonSizeMode:"fill",buttonRootNode:e instanceof ShadowRoot?e:void 0,onClick:this.handleButtonClick.bind(this)});e.appendChild(r)}async handleButtonClick(){this.callbacks.onStart();try{let e=this.buildPaymentDataRequest(),r=await this.client.loadPaymentData(e),{data:o,error:a}=await this.context.pciApi.postPaymentInstruments({flow:"GATEWAY",network:r.paymentMethodData.info?.cardNetwork??"OTHER",merchant_id:this.config.options.merchantId,encrypted_payload:Mr.encode(r.paymentMethodData.tokenizationData.token)});if(a||!o)throw a??new Error("Failed to tokenize payment data");let n=await this.createPayment(o.token);n.status==="SUCCESS"?this.callbacks.onSuccess(n):this.callbacks.onError()}catch(e){throw this.callbacks.onError(),e}}async handlePaymentDataChanged(e){return{}}buildIsReadyToPayRequest(){return{apiVersion:No,apiVersionMinor:Oo,allowedPaymentMethods:[this.allowedPaymentMethod]}}buildPaymentDataRequest(){let{countryCode:e,currencyCode:r,merchantAmount:o,totalOrderAmount:a}=this.context.configuration.clientSession.order;return{apiVersion:No,apiVersionMinor:Oo,transactionInfo:{countryCode:e,currencyCode:r,displayItems:[],totalPriceStatus:"FINAL",totalPrice:this.formatAmount(o??a),totalPriceLabel:"Total"},merchantInfo:{merchantId:this.config.options.merchantId,merchantName:this.config.options.merchantName},allowedPaymentMethods:[{...this.allowedPaymentMethod,tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"primer",gatewayMerchantId:this.config.options.merchantId}}}]}}formatAmount(e){return(e/100).toFixed(2)}};async function Hs(i){let t=i.configuration.paymentMethods.map(r=>{if(r.implementationType==="WEB_REDIRECT")return new _i(r,i);if(r.type===yt.PAYMENT_CARD)return new kr(r,i);if(r.type===yt.PAYPAL)return new Ir(r,i);if(r.type===yt.APPLE_PAY)return new Lr(r,i);if(r.type===yt.GOOGLE_PAY)return new Nr(r,i)}).map(r=>r?.setup().then(o=>o?r:null));return(await Promise.all(t)).filter(r=>!!r)}async function zs(i){let t=await vs(i),e=await Hs(t);return{context:t,paymentMethods:e}}async function Bs(i){try{await i.start();let t=await i.tokenize(),e=await i.createPayment(t.token);return await i.handleRequiredAction(e)}catch(t){throw t}}async function ia(i,t){let{paymentMethods:e,context:r}=await zs(i);return t.onAvailablePaymentMethodsLoad?.(e.map(o=>({type:o.config.type,managerType:o.config.type===yt.PAYMENT_CARD?"CARD":o.config.implementationType==="NATIVE_SDK"?"NATIVE":"REDIRECT"}))),{start:()=>Promise.resolve(),createPaymentMethodManager:async o=>{let a=e.find(({config:n})=>n.type===o);return a?a instanceof kr?Ks(t,r,a):a instanceof Ir||a instanceof Lr||a instanceof Nr?Fs(t,r,a):js(t,r,a):null},getSDKUtilities:()=>({getCardNetworkAsset:o=>{},getUIOrderAmount:()=>{},getCDNAssets:o=>{},getPaymentMethodConfiguration:o=>e.find(({config:a})=>a.type===o)?.config}),createVaultManager:()=>{}}}function Fs(i,t,e){return{createButton:()=>({render:async r=>{e.setCallbacks({onStart:()=>{i.onBeforePaymentCreate?.(),i.onPaymentCreationStart?.()},onSuccess(o){i.onCheckoutComplete?.({payment:o})},onError(){i.onCheckoutFail?.(new Error("Payment creation failed"),{})}}),await e.render(r)}})}}function js(i,t,e){return{start:()=>oa(i,e)}}function Ks(i,t,e){return{createHostedInputs:()=>{let r=o=>{let a=new Map,n=e.store.publicStore.getState()[o];return e.store.publicStore.subscribe(l=>{let d=l[o];d.error===n.error&&d.dirty===n.dirty&&d.valid===n.valid&&d.touched===n.touched&&d.focused===n.focused||(d.focused!==n.focused&&(d.focused?a.get("focus")?.():a.get("blur")?.()),a.get("change")?.(d),n=d)}),{getOptions:()=>({}),setOptions:l=>{},render:(l,d)=>{let m=e.iframes[o];if(!m)return Promise.resolve();let h;return h=typeof l=="string"?document.querySelector(l):l,h&&(h.appendChild(m),m.onload=()=>{e.store.optionsStore.setState({[o]:d})}),Promise.resolve()},addEventListener:(l,d)=>{a.set(l,d)},focus:()=>{},blur:()=>{},setDisabled:l=>{}}};return{cardNumberInput:r("cardNumber"),cardHolderNameInput:r("cardHolderName"),expiryInput:r("cardExpiryDate"),cvvInput:r("cardSecurityCode")}},removeHostedInputs:()=>{e.iframes.cardNumber.remove(),e.iframes.cardSecurityCode.remove(),e.iframes.cardExpiryDate.remove(),e.iframes.cardHolderName.remove()},submit:()=>oa(i,e),validate:()=>Promise.resolve({valid:!0,validationErrors:[]}),reset:()=>{}}}var oa=async(i,t)=>{i.onBeforePaymentCreate?.(),i.onPaymentCreationStart?.();let e=null,r=null;try{r=await Bs(t)}catch(o){e=o}finally{if(e||!r){i.onCheckoutFail?.(new Error("Payment creation failed"),{});return}if(r.status==="FAILED")return void i.onCheckoutFail?.(new Error("Payment failed"),{payment:r??{}});i.onCheckoutComplete?.({payment:r})}};var Or=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.primerJS=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new L(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new L(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(A.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),A.info("SDK instance cleaned up")}catch(t){A.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null,this.primerJS=null}async _loadV2Sdk(t=Ao){let e=window;if(e.Primer&&typeof e.Primer.preloadPrimer=="function"){A.info("SDK already loaded, skipping load script"),await e.Primer.preloadPrimer();return}await _o(t),await e.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return A.warn("Component disconnected, aborting SDK initialization"),M;if(!t||!e)return M;this.cleanupResources();try{let r;e.sdkCore?r={createHeadless:ia}:(await this._loadV2Sdk(),r=window.Primer),this.primerJS=new Er(null);let o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(A.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(A.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.primerJS&&this.primerJS.handlePaymentComplete(n))},onCheckoutFail:(n,l)=>{this.isDisconnected||(A.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.primerJS&&this.primerJS.handlePaymentFailure(n,l.payment))},onBeforePaymentCreate:(n,l)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),this.primerJS?this.primerJS.handleBeforePaymentCreate(n,l):l?.continuePaymentCreation())},onPaymentMethodAction:(n,l)=>{this.isDisconnected||n==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||(this.host.sdkStateController.resetError(),this.primerJS&&this.primerJS.handlePaymentStart())}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,this.primerJS&&Object.defineProperty(this.primerJS,"headlessInstance",{value:o,writable:!1}),await o.start(),this.isDisconnected)return this.cleanupResources(),M;this.host.sdkContextController.setClientOptions(e),this.primerJS&&this.host.primerEventsController.dispatchCheckoutInitialized(this.primerJS);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options?.captureVaultedCardCvv,showEmptyState:e.vault?.showEmptyState}),o}catch(r){throw r instanceof Error&&(A.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return M;if(!t||!e.length)return M;let r=new Map,o=new Map;try{for(let n of e){if(this.isDisconnected)break;let l=await this.initializePaymentMethodManager(n)();n&&l&&(r.set(n.type,n),o.set(n.type,l))}if(this.isDisconnected)return M;let a=new xr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.primerJS&&this.primerJS.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),A.info("Initialized payment methods:",a.toArray()),r}catch(a){if(a instanceof Error)throw this.host.sdkStateController.setError(a),a;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:a=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:a,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(e,{onCardNetworksChange:n=>{this.isDisconnected||this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:e,manager:a}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return A.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Rr=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Gs=Di({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.KRXB3WQO.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.6SKJRXIR.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.SANDLFEK.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.FC4I5M3C.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.YI32NZ7B.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.7M7UFQB7.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.XSGTYDZR.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.VO4GDE3X.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.MNFLVOE3.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.TBWVUZEF.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.6EMWUABR.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.XZLDFHYI.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.JBSFMKZ2.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.I75VK2ID.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.JBNP6RXT.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.PW253QAL.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.LM4RITYJ.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.JGCKQA6J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.VBXULDDY.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.7Q6BFLDK.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.QOC76SSC.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.BANZIFNH.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.Q2SRJOKH.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.XMNFEN5T.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.3AJDTMU5.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.TFPDXNEV.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.FPTX4NM4.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.CAFSKRQ2.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.7BPSDYTC.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.6ZVCFPVW.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.RF34QM23.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.AKDHLRUA.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.VBALOWHZ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.WN7VCF27.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.ICXGVGRR.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.SIP5JIOX.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.R77UEKCA.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.6M2YSTDX.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.33ZY4CDS.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.M27YUIZC.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.Q2SIY6NA.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.EJZOGSJR.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.3RROGLXM.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.GGWFQ3Y7.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.MQHNRMN4.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.WNR7XUSX.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.GNCY2PNY.js")});oi(i=>Gs(`../../localization/lit-localize/locales/${i}.ts`));var qs={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},re=class extends g{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this.disableLoader=!1;this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new er(this),this.sdkStateController=new Xt(this),this.primerEventsController=new mt(this),this.styleProcessingController=new tr(this),this.vaultManagerController=new wt(this),this.cardNetworkController=new Gt(this),this.achPaymentEventsController=new Rr(this),new Or(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===qs.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(ni(this.options?.locale)?this.locale=si(this.options?.locale):A.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),ai(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(A.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.currentState,r=e.isLoading,o=e.error,a=!r&&!o;return p` ${I(r,()=>u)} ${I(o,()=>p`<primer-checkout-error></primer-checkout-error>`)} ${I(a,()=>p`<slot name="main" @slotchange=${this.onSlotChange}></slot>${I(this.hasAssignedContent,()=>u,()=>p`<primer-main></primer-main>`)} `,()=>u)} `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};re.styles=[E,Eo],s([c({type:String,attribute:"custom-styles"})],re.prototype,"customStyles",2),s([c({type:String,attribute:"client-token"})],re.prototype,"clientToken",2),s([c({type:Object})],re.prototype,"options",2),s([c({type:Boolean,attribute:"loader-disabled"})],re.prototype,"disableLoader",2),s([c({type:Boolean,reflect:!0,attribute:"js-initialized"})],re.prototype,"_jsInitialized",2),s([je("slot")],re.prototype,"defaultSlot",2),s([_()],re.prototype,"previousLoadingState",2),re=s([w(),v("primer-checkout")],re);function Ws(i){return document.querySelector(`#${i}`)}function Js(i,t){let e=document.createElement("style");return e.textContent=i,e.id=t,e}function Ft(i,t,e=!0){if(!Ar||Ws(t))return;let o=Js(i,t);e&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var aa=`
|
|
24
113
|
@keyframes primer-css-spinner-rotate {
|
|
25
114
|
0% {
|
|
26
115
|
transform: rotate(0deg);
|
|
@@ -56,2162 +145,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
56
145
|
animation: primer-css-spinner-rotate 1.2s linear infinite;
|
|
57
146
|
z-index: 9999;
|
|
58
147
|
}
|
|
59
|
-
`;var Vi=`/**
|
|
60
|
-
* Do not edit directly, this file was auto-generated.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
:root, primer-checkout {
|
|
64
|
-
--primer-color-background-transparent-default: rgba(255, 255, 255, 0);
|
|
65
|
-
--primer-color-border-transparent-default: rgba(255, 255, 255, 0);
|
|
66
|
-
--primer-color-gray-100: #f5f5f5;
|
|
67
|
-
--primer-color-gray-200: #eeeeee;
|
|
68
|
-
--primer-color-gray-300: #e0e0e0;
|
|
69
|
-
--primer-color-gray-400: #bdbdbd;
|
|
70
|
-
--primer-color-gray-500: #9e9e9e;
|
|
71
|
-
--primer-color-gray-600: #757575;
|
|
72
|
-
--primer-color-gray-900: #212121;
|
|
73
|
-
--primer-color-gray-000: #ffffff;
|
|
74
|
-
--primer-color-brand: #2f98ff;
|
|
75
|
-
--primer-color-red-100: #ffecec;
|
|
76
|
-
--primer-color-red-500: #ff7279;
|
|
77
|
-
--primer-color-red-900: #b4324b;
|
|
78
|
-
--primer-color-blue-500: #399dff;
|
|
79
|
-
--primer-color-blue-900: #2270f4;
|
|
80
|
-
--primer-radius-base: 4px;
|
|
81
|
-
--primer-typography-brand: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
82
|
-
--primer-typography-title-xlarge-letter-spacing: -0.6px;
|
|
83
|
-
--primer-typography-title-xlarge-weight: 550;
|
|
84
|
-
--primer-typography-title-xlarge-size: 24px;
|
|
85
|
-
--primer-typography-title-xlarge-line-height: 32px;
|
|
86
|
-
--primer-typography-title-large-letter-spacing: -0.2px;
|
|
87
|
-
--primer-typography-title-large-weight: 550;
|
|
88
|
-
--primer-typography-title-large-size: 16px;
|
|
89
|
-
--primer-typography-title-large-line-height: 20px;
|
|
90
|
-
--primer-typography-body-large-letter-spacing: -0.2px;
|
|
91
|
-
--primer-typography-body-large-weight: 400;
|
|
92
|
-
--primer-typography-body-large-size: 16px;
|
|
93
|
-
--primer-typography-body-large-line-height: 20px;
|
|
94
|
-
--primer-typography-body-medium-letter-spacing: 0px;
|
|
95
|
-
--primer-typography-body-medium-weight: 400;
|
|
96
|
-
--primer-typography-body-medium-size: 14px;
|
|
97
|
-
--primer-typography-body-medium-line-height: 20px;
|
|
98
|
-
--primer-typography-body-small-letter-spacing: 0px;
|
|
99
|
-
--primer-typography-body-small-weight: 400;
|
|
100
|
-
--primer-typography-body-small-size: 12px;
|
|
101
|
-
--primer-typography-body-small-line-height: 16px;
|
|
102
|
-
--primer-space-base: 4px;
|
|
103
|
-
--primer-size-base: 4px;
|
|
104
|
-
--primer-animation-duration: 200ms;
|
|
105
|
-
--primer-animation-easing: cubic-bezier(0.44, 0, 0.4, 1);
|
|
106
|
-
--primer-color-background-outlined-default: var(--primer-color-gray-000);
|
|
107
|
-
--primer-color-background-outlined-disabled: var(--primer-color-gray-100);
|
|
108
|
-
--primer-color-background-transparent-hover: var(--primer-color-gray-100);
|
|
109
|
-
--primer-color-background-transparent-active: var(--primer-color-gray-200);
|
|
110
|
-
--primer-color-background-transparent-loading: var(--primer-color-gray-100);
|
|
111
|
-
--primer-color-background-transparent-focus: var(--primer-color-background-transparent-default);
|
|
112
|
-
--primer-color-background-transparent-disabled: var(--primer-color-gray-100);
|
|
113
|
-
--primer-color-background-transparent-selected: var(--primer-color-gray-100);
|
|
114
|
-
--primer-color-text-primary: var(--primer-color-gray-900);
|
|
115
|
-
--primer-color-text-placeholder: var(--primer-color-gray-500);
|
|
116
|
-
--primer-color-text-disabled: var(--primer-color-gray-400);
|
|
117
|
-
--primer-color-text-negative: var(--primer-color-red-900);
|
|
118
|
-
--primer-color-text-link: var(--primer-color-blue-900);
|
|
119
|
-
--primer-color-text-secondary: var(--primer-color-gray-600);
|
|
120
|
-
--primer-color-border-outlined-default: var(--primer-color-gray-300);
|
|
121
|
-
--primer-color-border-outlined-hover: var(--primer-color-gray-400);
|
|
122
|
-
--primer-color-border-outlined-active: var(--primer-color-gray-500);
|
|
123
|
-
--primer-color-border-outlined-disabled: var(--primer-color-gray-200);
|
|
124
|
-
--primer-color-border-outlined-loading: var(--primer-color-gray-200);
|
|
125
|
-
--primer-color-border-outlined-selected: var(--primer-color-brand);
|
|
126
|
-
--primer-color-border-outlined-error: var(--primer-color-red-500);
|
|
127
|
-
--primer-color-border-transparent-hover: var(--primer-color-border-transparent-default);
|
|
128
|
-
--primer-color-border-transparent-active: var(--primer-color-border-transparent-default);
|
|
129
|
-
--primer-color-border-transparent-disabled: var(--primer-color-border-transparent-default);
|
|
130
|
-
--primer-color-border-transparent-selected: var(--primer-color-border-transparent-default);
|
|
131
|
-
--primer-color-icon-primary: var(--primer-color-gray-900);
|
|
132
|
-
--primer-color-icon-disabled: var(--primer-color-gray-400);
|
|
133
|
-
--primer-color-icon-negative: var(--primer-color-red-500);
|
|
134
|
-
--primer-color-focus: var(--primer-color-brand);
|
|
135
|
-
--primer-color-loader: var(--primer-color-brand);
|
|
136
|
-
--primer-radius-medium: 8px;
|
|
137
|
-
--primer-radius-small: 4px;
|
|
138
|
-
--primer-radius-large: 12px;
|
|
139
|
-
--primer-radius-xsmall: 2px;
|
|
140
|
-
--primer-typography-title-xlarge-font: var(--primer-typography-brand);
|
|
141
|
-
--primer-typography-title-large-font: var(--primer-typography-brand);
|
|
142
|
-
--primer-typography-body-large-font: var(--primer-typography-brand);
|
|
143
|
-
--primer-typography-body-medium-font: var(--primer-typography-brand);
|
|
144
|
-
--primer-typography-body-small-font: var(--primer-typography-brand);
|
|
145
|
-
--primer-space-xxsmall: 2px;
|
|
146
|
-
--primer-space-xsmall: 4px;
|
|
147
|
-
--primer-space-small: 8px;
|
|
148
|
-
--primer-space-medium: 12px;
|
|
149
|
-
--primer-space-large: 16px;
|
|
150
|
-
--primer-space-xlarge: 20px;
|
|
151
|
-
--primer-size-small: 16px;
|
|
152
|
-
--primer-size-medium: 20px;
|
|
153
|
-
--primer-size-large: 24px;
|
|
154
|
-
--primer-size-xlarge: 32px;
|
|
155
|
-
--primer-size-xxlarge: 40px;
|
|
156
|
-
--primer-size-xxxlarge: 56px;
|
|
157
|
-
--primer-color-background-outlined-focus: var(--primer-color-background-outlined-default);
|
|
158
|
-
--primer-color-background-outlined-loading: var(--primer-color-background-outlined-disabled);
|
|
159
|
-
--primer-color-background-outlined-active: var(--primer-color-background-outlined-default);
|
|
160
|
-
--primer-color-background-outlined-hover: var(--primer-color-background-outlined-default);
|
|
161
|
-
--primer-color-background-outlined-selected: var(--primer-color-background-outlined-default);
|
|
162
|
-
--primer-color-background-outlined-error: var(--primer-color-background-outlined-default);
|
|
163
|
-
--primer-color-border-outlined-focus: var(--primer-color-focus);
|
|
164
|
-
--primer-color-border-transparent-focus: var(--primer-color-focus);
|
|
165
|
-
--primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
|
|
166
|
-
}
|
|
167
|
-
`,Hi=`/**
|
|
168
|
-
* Do not edit directly, this file was auto-generated.
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
:root, primer-checkout.primer-dark-theme {
|
|
172
|
-
--primer-color-gray-100: #292929;
|
|
173
|
-
--primer-color-gray-200: #424242;
|
|
174
|
-
--primer-color-gray-300: #575757;
|
|
175
|
-
--primer-color-gray-400: #858585;
|
|
176
|
-
--primer-color-gray-500: #767577;
|
|
177
|
-
--primer-color-gray-600: #c7c7c7;
|
|
178
|
-
--primer-color-gray-900: #efefef;
|
|
179
|
-
--primer-color-gray-000: #171619;
|
|
180
|
-
--primer-color-brand: #2f98ff;
|
|
181
|
-
--primer-color-red-100: #321c20;
|
|
182
|
-
--primer-color-red-500: #e46d70;
|
|
183
|
-
--primer-color-red-900: #f6bfbf;
|
|
184
|
-
--primer-color-blue-500: #3f93e4;
|
|
185
|
-
--primer-color-blue-900: #4aaeff;
|
|
186
|
-
}
|
|
187
|
-
`;var ka="primer-light-theme-css",wa="primer-dark-theme-css";function Hr(){Ct(Vi,ka,!0)}function zr(){Ct(Hi,wa,!0)}function zi(){Hr(),zr()}function Yi(){Ct(Di,"primer-css-loader-styles",!1)}function Ui(){zi()}function Ta(){Hr()}function La(){zr()}var Fi=c`
|
|
188
|
-
:host {
|
|
189
|
-
display: inline-flex;
|
|
190
|
-
align-items: center;
|
|
191
|
-
justify-content: center;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.spinner-container {
|
|
195
|
-
display: flex;
|
|
196
|
-
align-items: center;
|
|
197
|
-
justify-content: center;
|
|
198
|
-
width: var(--spinner-size, var(--primer-size-medium));
|
|
199
|
-
height: var(--spinner-size, var(--primer-size-medium));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.spinner-container:not(.compact) {
|
|
203
|
-
margin: var(--primer-space-small) 0;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.spinner-container.compact {
|
|
207
|
-
margin: 0;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.spinner {
|
|
211
|
-
animation: spinner-rotate 1.2s linear infinite;
|
|
212
|
-
width: 100%;
|
|
213
|
-
height: 100%;
|
|
214
|
-
color: var(--spinner-color, var(--primer-color-loader));
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.path {
|
|
218
|
-
fill: currentColor;
|
|
219
|
-
transform-origin: center;
|
|
220
|
-
transition: fill var(--primer-animation-duration, 200ms)
|
|
221
|
-
var(--primer-animation-easing, ease);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
@keyframes spinner-rotate {
|
|
225
|
-
0% {
|
|
226
|
-
transform: rotate(0deg);
|
|
227
|
-
}
|
|
228
|
-
100% {
|
|
229
|
-
transform: rotate(360deg);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
`;var Yr={small:16,medium:24,large:32},re=class extends m{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Yr)return Yr[this.size];let e=parseInt(this.size,10);return isNaN(e)?Yr.medium:e}render(){let e=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),d`
|
|
233
|
-
<div class="spinner-container ${this.compact?"compact":""}">
|
|
234
|
-
<svg
|
|
235
|
-
class="spinner"
|
|
236
|
-
width="${e}"
|
|
237
|
-
height="${e}"
|
|
238
|
-
viewBox="${o}"
|
|
239
|
-
fill="none"
|
|
240
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
241
|
-
role="status"
|
|
242
|
-
aria-label="Loading"
|
|
243
|
-
>
|
|
244
|
-
<path
|
|
245
|
-
d="M4.27827 10.002C4.27827 6.84166 6.84019 4.27973 10.0005 4.27973C10.7676 4.27973 11.3894 3.6579 11.3894 2.89084C11.3894 2.12378 10.7676 1.50195 10.0005 1.50195C5.30607 1.50195 1.50049 5.30753 1.50049 10.002C1.50049 14.6964 5.30607 18.502 10.0005 18.502C14.6949 18.502 18.5005 14.6964 18.5005 10.002C18.5005 9.23489 17.8787 8.61306 17.1116 8.61306C16.3445 8.61306 15.7227 9.23489 15.7227 10.002C15.7227 13.1622 13.1608 15.7242 10.0005 15.7242C6.84019 15.7242 4.27827 13.1622 4.27827 10.002Z"
|
|
246
|
-
fill="currentColor"
|
|
247
|
-
class="path"
|
|
248
|
-
/>
|
|
249
|
-
</svg>
|
|
250
|
-
</div>
|
|
251
|
-
`}};re.styles=[Fi],s([l({type:String})],re.prototype,"color",2),s([l({type:String})],re.prototype,"size",2),s([l({type:Boolean})],re.prototype,"compact",2),re=s([h("primer-spinner")],re);var Ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},me=i=>(...t)=>({_$litDirective$:i,values:t}),rt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var R=me(class extends rt{constructor(i){if(super(i),i.type!==Ne.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=i.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let o=!!t[r];o===this.st.has(r)||this.nt?.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return pe}});var Bi=c`
|
|
252
|
-
* {
|
|
253
|
-
box-sizing: border-box;
|
|
254
|
-
}
|
|
255
|
-
:host {
|
|
256
|
-
display: block;
|
|
257
|
-
width: 100%;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.input-slot.focus-within,
|
|
261
|
-
.input-slot:focus-within {
|
|
262
|
-
outline: 2px solid var(--primer-color-border-outlined-focus);
|
|
263
|
-
outline-offset: -2px;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
:host([has-error]) .input-slot.focus-within,
|
|
267
|
-
:host([has-error]) .input-slot:focus-within {
|
|
268
|
-
outline: 2px solid var(--primer-color-border-outlined-error);
|
|
269
|
-
background-color: var(--primer-color-background-outlined-error);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
:host([has-error]) .input-slot {
|
|
273
|
-
border-color: var(--primer-color-border-outlined-error);
|
|
274
|
-
background-color: var(--primer-color-background-outlined-error);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.input-wrapper {
|
|
278
|
-
display: flex;
|
|
279
|
-
flex-direction: column;
|
|
280
|
-
gap: var(--primer-space-xsmall);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.input-slot {
|
|
284
|
-
padding: var(--primer-space-medium) var(--primer-space-medium);
|
|
285
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
286
|
-
border-radius: var(--primer-radius-small);
|
|
287
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
288
|
-
height: calc(
|
|
289
|
-
var(--primer-typography-body-large-line-height) +
|
|
290
|
-
var(--primer-space-medium) + var(--primer-space-medium) + 2px
|
|
291
|
-
);
|
|
292
|
-
display: flex;
|
|
293
|
-
cursor: text; /* Indicate text input interactivity */
|
|
294
|
-
/* 2px is the border width */
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.input-slot ::slotted(*) {
|
|
298
|
-
width: 100%;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.input-slot:hover {
|
|
302
|
-
border-color: var(--primer-color-border-outlined-hover);
|
|
303
|
-
background-color: var(--primer-color-background-outlined-hover);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.input-slot:active {
|
|
307
|
-
border-color: var(--primer-color-border-outlined-active);
|
|
308
|
-
background-color: var(--primer-color-background-outlined-active);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.input-slot:disabled {
|
|
312
|
-
background-color: var(--primer-color-background-outlined-disabled);
|
|
313
|
-
border-color: var(--primer-color-border-outlined-disabled);
|
|
314
|
-
cursor: not-allowed;
|
|
315
|
-
}
|
|
316
|
-
`;var ie=class extends m{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of e){let a=o.querySelector("primer-input");if(a)return a}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return d`
|
|
317
|
-
<div class="input-wrapper">
|
|
318
|
-
<slot name="label"></slot>
|
|
319
|
-
<div class="${R(e)}" @click="${this.handleWrapperClick}">
|
|
320
|
-
<slot name="input"></slot>
|
|
321
|
-
</div>
|
|
322
|
-
<slot name="error"></slot>
|
|
323
|
-
</div>
|
|
324
|
-
`}};ie.styles=[Bi],s([l({type:Boolean})],ie.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],ie.prototype,"hasError",2),s([Ie('slot[name="input"]')],ie.prototype,"inputSlot",2),ie=s([h("primer-input-wrapper")],ie);var Ki=c`
|
|
325
|
-
:host {
|
|
326
|
-
display: inline-block;
|
|
327
|
-
font-weight: var(--primer-typography-body-small-weight);
|
|
328
|
-
font-size: var(--primer-typography-body-small-size);
|
|
329
|
-
letter-spacing: var(--primer-typography-body-small-letter-spacing);
|
|
330
|
-
line-height: var(--primer-typography-body-small-line-height);
|
|
331
|
-
color: var(--primer-color-text-primary);
|
|
332
|
-
font-family: var(--primer-typography-body-small-font);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
:host([disabled]) {
|
|
336
|
-
color: var(--primer-color-text-disabled);
|
|
337
|
-
}
|
|
338
|
-
`;var he=class extends m{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};he.styles=[Ki],s([l({type:String,reflect:!0})],he.prototype,"for",2),s([l({type:Boolean,reflect:!0})],he.prototype,"disabled",2),he=s([h("primer-input-label")],he);var ji=c`
|
|
339
|
-
:host {
|
|
340
|
-
display: contents;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
button {
|
|
344
|
-
align-items: center;
|
|
345
|
-
border-radius: var(--primer-radius-medium);
|
|
346
|
-
border: none;
|
|
347
|
-
cursor: pointer;
|
|
348
|
-
display: flex;
|
|
349
|
-
font-family: var(--primer-typography-title-large-font);
|
|
350
|
-
font-size: var(--primer-typography-title-large-size);
|
|
351
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
352
|
-
gap: var(--primer-space-small);
|
|
353
|
-
justify-content: center;
|
|
354
|
-
letter-spacing: var(--primer-typography-title-large-letter-spacing);
|
|
355
|
-
line-height: var(--primer-typography-title-large-line-height);
|
|
356
|
-
outline: none;
|
|
357
|
-
padding: var(--primer-space-medium) var(--primer-space-medium);
|
|
358
|
-
position: relative;
|
|
359
|
-
transition: all 0.2s ease-in-out;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.button-content {
|
|
363
|
-
display: flex;
|
|
364
|
-
height: 100%;
|
|
365
|
-
align-items: center;
|
|
366
|
-
gap: var(--primer-space-small);
|
|
367
|
-
justify-content: center;
|
|
368
|
-
transition: opacity var(--primer-animation-duration)
|
|
369
|
-
var(--primer-animation-easing);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/* Reduce opacity of text during loading for better focus on the spinner */
|
|
373
|
-
.button-content.loading {
|
|
374
|
-
opacity: 0.65;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
:host([selectable]) button {
|
|
378
|
-
justify-content: space-between;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/* Primary variant */
|
|
382
|
-
:host([variant='primary']) button {
|
|
383
|
-
background-color: var(--primer-color-brand);
|
|
384
|
-
/* This is correct (color-background for color) because Button is kind of a special component */
|
|
385
|
-
color: var(--primer-color-background-outlined-default);
|
|
386
|
-
}
|
|
387
|
-
:host([variant='primary']:not([disabled]):not([loading])) button:hover {
|
|
388
|
-
filter: brightness(105%);
|
|
389
|
-
}
|
|
390
|
-
:host([variant='primary']:not([disabled]):not([loading])) button:active {
|
|
391
|
-
filter: brightness(98%);
|
|
392
|
-
}
|
|
393
|
-
:host([variant='primary']) button:focus-visible {
|
|
394
|
-
outline: 2px solid var(--primer-color-brand);
|
|
395
|
-
outline-offset: 2px;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/* Disabled state for primary button */
|
|
399
|
-
:host([variant='primary'][disabled]:not([loading])) button,
|
|
400
|
-
:host([variant='primary']:not([loading])) button:disabled {
|
|
401
|
-
color: var(--primer-color-text-disabled);
|
|
402
|
-
background-color: var(--primer-color-background-outlined-disabled);
|
|
403
|
-
cursor: not-allowed;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/* Loading state for primary button - OVERRIDES disabled styles with higher specificity */
|
|
407
|
-
:host([variant='primary'][loading]) button {
|
|
408
|
-
background-color: var(--primer-color-brand);
|
|
409
|
-
opacity: 0.8;
|
|
410
|
-
color: var(--primer-color-background-outlined-default);
|
|
411
|
-
cursor: wait;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
/* Secondary variant */
|
|
415
|
-
:host([variant='secondary']) button {
|
|
416
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
417
|
-
color: var(--primer-color-text-primary);
|
|
418
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
419
|
-
}
|
|
420
|
-
:host([variant='secondary']:not([disabled]):not([loading])) button:hover {
|
|
421
|
-
background-color: var(--primer-color-background-outlined-hover);
|
|
422
|
-
}
|
|
423
|
-
:host([variant='secondary']:not([disabled]):not([loading])) button:active {
|
|
424
|
-
background-color: var(--primer-color-background-outlined-active);
|
|
425
|
-
}
|
|
426
|
-
:host([variant='secondary']) button:focus-visible {
|
|
427
|
-
outline: 2px solid var(--primer-color-border-outlined-focus);
|
|
428
|
-
outline-offset: 2px;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/* Disabled state for secondary button */
|
|
432
|
-
:host([variant='secondary'][disabled]:not([loading])) button,
|
|
433
|
-
:host([variant='secondary']:not([loading])) button:disabled {
|
|
434
|
-
background-color: var(--primer-color-background-outlined-disabled);
|
|
435
|
-
border-color: var(--primer-color-border-outlined-disabled);
|
|
436
|
-
color: var(--primer-color-text-disabled);
|
|
437
|
-
cursor: not-allowed;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/* Loading state for secondary button - OVERRIDES disabled styles */
|
|
441
|
-
:host([variant='secondary'][loading]) button {
|
|
442
|
-
background-color: var(--primer-color-gray-100);
|
|
443
|
-
border-color: var(--primer-color-gray-300);
|
|
444
|
-
color: var(--primer-color-gray-600);
|
|
445
|
-
cursor: wait;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
/* Tertiary variant */
|
|
449
|
-
:host([variant='tertiary']) button {
|
|
450
|
-
background-color: var(--primer-color-background-transparent-default);
|
|
451
|
-
border: 1px solid var(--primer-color-border-transparent-default);
|
|
452
|
-
color: var(--primer-color-text-primary);
|
|
453
|
-
border-radius: var(--primer-radius-small);
|
|
454
|
-
padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall);
|
|
455
|
-
}
|
|
456
|
-
:host([variant='tertiary']:not([disabled]):not([loading])) button:hover {
|
|
457
|
-
border-radius: var(--primer-radius-small);
|
|
458
|
-
background-color: var(--primer-color-background-transparent-hover);
|
|
459
|
-
border: 1px solid var(--primer-color-border-transparent-hover);
|
|
460
|
-
color: var(--primer-color-text-primary);
|
|
461
|
-
}
|
|
462
|
-
:host([variant='tertiary']:not([disabled]):not([loading])) button:active {
|
|
463
|
-
background-color: var(--primer-color-background-transparent-active);
|
|
464
|
-
border-color: var(--primer-color-border-transparent-active);
|
|
465
|
-
border-radius: var(--primer-radius-small);
|
|
466
|
-
color: var(--primer-color-text-primary);
|
|
467
|
-
}
|
|
468
|
-
:host([variant='tertiary']) button:focus-visible {
|
|
469
|
-
border-radius: var(--primer-radius-small);
|
|
470
|
-
background-color: var(--primer-color-background-transparent-focus);
|
|
471
|
-
outline: 2px solid var(--primer-color-border-transparent-focus);
|
|
472
|
-
outline-offset: 2px;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/* Disabled state for tertiary button */
|
|
476
|
-
:host([variant='tertiary'][disabled]:not([loading])) button,
|
|
477
|
-
:host([variant='tertiary']:not([loading])) button:disabled {
|
|
478
|
-
background-color: var(--primer-color-border-transparent-disabled);
|
|
479
|
-
color: var(--primer-color-text-disabled);
|
|
480
|
-
cursor: not-allowed;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/* Loading state for tertiary button - OVERRIDES disabled styles */
|
|
484
|
-
:host([variant='tertiary'][loading]) button {
|
|
485
|
-
background-color: var(--primer-color-gray-100);
|
|
486
|
-
color: var(--primer-color-gray-600);
|
|
487
|
-
cursor: wait;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/* Checked state styling */
|
|
491
|
-
:host([selectionState='checked']) button {
|
|
492
|
-
border: 1px solid var(--primer-color-brand);
|
|
493
|
-
background-color: var(--primer-color-gray-100);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/* Loading state - center spinner with content */
|
|
497
|
-
:host([loading]) primer-spinner {
|
|
498
|
-
margin-right: var(--primer-space-xsmall);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/* Special case for tertiary variant loading state spinner size */
|
|
502
|
-
:host([variant='tertiary'][loading]) primer-spinner {
|
|
503
|
-
transform: scale(0.85);
|
|
504
|
-
}
|
|
505
|
-
`;var K=class extends m{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?p:d`
|
|
506
|
-
<primer-icon
|
|
507
|
-
name="checkmark"
|
|
508
|
-
size="sm"
|
|
509
|
-
color="var(--primer-color-icon-primary)"
|
|
510
|
-
></primer-icon>
|
|
511
|
-
`}renderSpinner(){if(!this.loading)return p;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),d`
|
|
512
|
-
<primer-spinner
|
|
513
|
-
size="small"
|
|
514
|
-
color="${e}"
|
|
515
|
-
compact
|
|
516
|
-
></primer-spinner>
|
|
517
|
-
`}render(){return d`
|
|
518
|
-
<button
|
|
519
|
-
type=${this.buttonType}
|
|
520
|
-
?disabled=${this.disabled||this.loading}
|
|
521
|
-
@click=${this.handleClick}
|
|
522
|
-
part="button"
|
|
523
|
-
aria-checked=${this.selectionState==="checked"}
|
|
524
|
-
aria-busy=${this.loading}
|
|
525
|
-
>
|
|
526
|
-
${this.renderSpinner()}
|
|
527
|
-
<span class="button-content ${this.loading?"loading":""}">
|
|
528
|
-
<slot></slot>
|
|
529
|
-
</span>
|
|
530
|
-
${this.renderCheckmark()}
|
|
531
|
-
</button>
|
|
532
|
-
`}};K.styles=[v,ji],s([l({type:String,reflect:!0})],K.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],K.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],K.prototype,"loading",2),s([l({type:String,attribute:"type"})],K.prototype,"buttonType",2),s([l({type:String,reflect:!0})],K.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],K.prototype,"selectable",2),K=s([h("primer-button")],K);var Gi=c`
|
|
533
|
-
:host {
|
|
534
|
-
display: contents;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
:host(:not([active])) {
|
|
538
|
-
display: none;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
.error {
|
|
542
|
-
color: var(--primer-color-text-negative);
|
|
543
|
-
font-size: var(--primer-typography-body-small-size);
|
|
544
|
-
line-height: var(--primer-typography-body-small-line-height);
|
|
545
|
-
display: block;
|
|
546
|
-
font-family: var(--primer-typography-body-small-font);
|
|
547
|
-
}
|
|
548
|
-
`;var ue=class extends m{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
|
|
549
|
-
<span
|
|
550
|
-
class="error"
|
|
551
|
-
role="alert"
|
|
552
|
-
aria-live="polite"
|
|
553
|
-
id="${this.for||""}"
|
|
554
|
-
>
|
|
555
|
-
<slot></slot>
|
|
556
|
-
</span>
|
|
557
|
-
`}};ue.styles=[Gi],s([l({type:String,reflect:!0})],ue.prototype,"for",2),s([l({type:Boolean,reflect:!0})],ue.prototype,"active",2),ue=s([h("primer-input-error")],ue);var qi={pencil:ce`
|
|
558
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
559
|
-
<path d="M12.3292 1.82659C12.142 1.63935 11.8779 1.53418 11.6028 1.53418C11.3277 1.53418 11.0636 1.63935 10.8764 1.82659L2.92969 9.77325V13.0666H6.22306L14.1698 5.11992C14.357 4.93268 14.4622 4.66859 14.4622 4.39352C14.4622 4.11844 14.357 3.85435 14.1698 3.66711L12.3292 1.82659ZM5.77375 11.7333H4.26302V10.2225L10.8764 3.60919L12.3871 5.11992L5.77375 11.7333Z" fill="currentColor"/>
|
|
560
|
-
</svg>
|
|
561
|
-
`,trash:ce`
|
|
562
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
563
|
-
<path d="M13.8333 2.99992H11.5V2.49992C11.5 2.05789 11.3244 1.63397 11.0118 1.32141C10.6993 1.00885 10.2754 0.833252 9.83333 0.833252H6.16667C5.72464 0.833252 5.30072 1.00885 4.98816 1.32141C4.67559 1.63397 4.5 2.05789 4.5 2.49992V2.99992H2.16667C1.98986 2.99992 1.82029 3.07015 1.69526 3.19518C1.57024 3.32021 1.5 3.48978 1.5 3.66659C1.5 3.8434 1.57024 4.01297 1.69526 4.138C1.82029 4.26302 1.98986 4.33326 2.16667 4.33326H2.83333V12.4999C2.83333 12.942 3.00893 13.3659 3.32149 13.6784C3.63405 13.991 4.05797 14.1666 4.5 14.1666H11.5C11.942 14.1666 12.3659 13.991 12.6785 13.6784C12.9911 13.3659 13.1667 12.942 13.1667 12.4999V4.33326H13.8333C14.0101 4.33326 14.1797 4.26302 14.3047 4.138C14.4298 4.01297 14.5 3.8434 14.5 3.66659C14.5 3.48978 14.4298 3.32021 14.3047 3.19518C14.1797 3.07015 14.0101 2.99992 13.8333 2.99992ZM5.83333 2.49992C5.83333 2.32311 5.90357 2.15354 6.0286 2.02851C6.15362 1.90349 6.32319 1.83325 6.5 1.83325H9.5C9.67681 1.83325 9.84638 1.90349 9.9714 2.02851C10.0964 2.15354 10.1667 2.32311 10.1667 2.49992V2.99992H5.83333V2.49992ZM11.8333 12.4999C11.8333 12.6767 11.7631 12.8463 11.6381 12.9713C11.513 13.0964 11.3435 13.1666 11.1667 13.1666H4.83333C4.65652 13.1666 4.48695 13.0964 4.36193 12.9713C4.2369 12.8463 4.16667 12.6767 4.16667 12.4999V4.33326H11.8333V12.4999Z" fill="currentColor"/>
|
|
564
|
-
<path d="M6.5 10.9999C6.67681 10.9999 6.84638 10.9297 6.9714 10.8047C7.09643 10.6796 7.16667 10.5101 7.16667 10.3333V7.33325C7.16667 7.15644 7.09643 6.98687 6.9714 6.86184C6.84638 6.73682 6.67681 6.66658 6.5 6.66658C6.32319 6.66658 6.15362 6.73682 6.0286 6.86184C5.90357 6.98687 5.83333 7.15644 5.83333 7.33325V10.3333C5.83333 10.5101 5.90357 10.6796 6.0286 10.8047C6.15362 10.9297 6.32319 10.9999 6.5 10.9999Z" fill="currentColor"/>
|
|
565
|
-
<path d="M9.5 10.9999C9.67681 10.9999 9.84638 10.9297 9.9714 10.8047C10.0964 10.6796 10.1667 10.5101 10.1667 10.3333V7.33325C10.1667 7.15644 10.0964 6.98687 9.9714 6.86184C9.84638 6.73682 9.67681 6.66658 9.5 6.66658C9.32319 6.66658 9.15362 6.73682 9.0286 6.86184C8.90357 6.98687 8.83333 7.15644 8.83333 7.33325V10.3333C8.83333 10.5101 8.90357 10.6796 9.0286 10.8047C9.15362 10.9297 9.32319 10.9999 9.5 10.9999Z" fill="currentColor"/>
|
|
566
|
-
</svg>
|
|
567
|
-
`,"successful-check":ce`
|
|
568
|
-
<svg
|
|
569
|
-
viewBox="0 0 56 56"
|
|
570
|
-
fill="none"
|
|
571
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
572
|
-
>
|
|
573
|
-
<g id="icon/check-circle-large">
|
|
574
|
-
<path
|
|
575
|
-
id="vector"
|
|
576
|
-
fill-rule="evenodd"
|
|
577
|
-
clip-rule="evenodd"
|
|
578
|
-
d="M20.1762 29.5746L24.8429 34.2413C25.295 34.7007 26.0387 34.7007 26.4908 34.2413L35.8241 24.9079C36.2835 24.4559 36.2835 23.7121 35.8241 23.26C35.372 22.8007 34.6283 22.8007 34.1762 23.26L25.6668 31.7694L21.8241 27.9267C21.372 27.4673 20.6283 27.4673 20.1762 27.9267C19.7168 28.3788 19.7168 29.1225 20.1762 29.5746ZM28.0002 47.4173C38.3106 47.4173 46.6668 39.0611 46.6668 28.7507C46.6668 18.4402 38.3106 10.084 28.0002 10.084C17.6897 10.084 9.3335 18.4402 9.3335 28.7507C9.3335 39.0611 17.6897 47.4173 28.0002 47.4173Z"
|
|
579
|
-
/>
|
|
580
|
-
</g>
|
|
581
|
-
</svg>
|
|
582
|
-
`,"failure-icon":ce`
|
|
583
|
-
<svg
|
|
584
|
-
viewBox="0 0 40 40"
|
|
585
|
-
fill="none"
|
|
586
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
587
|
-
>
|
|
588
|
-
<path
|
|
589
|
-
fill-rule="evenodd"
|
|
590
|
-
clip-rule="evenodd"
|
|
591
|
-
d="M20.0008 23.3333C20.4614 23.3333 20.7873 22.9606 20.7873 22.5V15C20.7873 14.5394 20.4146 14.1666 20.0008 14.1666C19.587 14.1666 19.1675 14.5416 19.1675 15V22.5C19.1675 22.9583 19.5425 23.3333 20.0008 23.3333ZM32.9331 27.3594L22.5269 9.75935C22.0008 8.86821 21.0529 8.33488 20.0008 8.33331C18.9487 8.33331 18.006 8.8656 17.4748 9.75831L7.06331 27.3625C6.53987 28.2463 6.53206 29.3073 7.04134 30.201C7.568 31.1198 8.51904 31.6666 9.58935 31.6666H30.4175C31.4857 31.6666 32.4357 31.1182 32.9597 30.1995C33.4696 29.3073 33.4591 28.2448 32.9331 27.3594ZM18.7977 26.6666C18.7977 25.976 19.3107 25.4166 20.0008 25.4166C20.6935 25.4166 21.2508 25.9739 21.2039 26.6666C21.2039 27.3568 20.6909 27.9166 20.0008 27.9166C19.3576 27.9166 18.7977 27.3568 18.7977 26.6666Z"
|
|
592
|
-
/>
|
|
593
|
-
</svg>
|
|
594
|
-
`,"payment-card":ce`
|
|
595
|
-
<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
596
|
-
<rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
|
|
597
|
-
<rect y="6.74805" width="28" height="4" fill="#212121"/>
|
|
598
|
-
<rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
|
|
599
|
-
</svg>
|
|
600
|
-
`,"chevron-down":ce`
|
|
601
|
-
<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
602
|
-
<path d="M4.41978 4.90118C4.32079 5.02361 4.16188 5.08353 4.00037 5.08353C3.83887 5.08353 3.67996 5.02361 3.55753 4.90118L0.63995 1.9836C0.395733 1.73939 0.395733 1.34382 0.63995 1.09947C0.884167 0.855124 1.27973 0.855254 1.52408 1.09947L4.00037 3.57524L6.47589 1.09973C6.72011 0.855515 7.11567 0.855515 7.36002 1.09973C7.60437 1.34395 7.60424 1.73952 7.36002 1.98386L4.41978 4.90118Z" fill="#212121"/>
|
|
603
|
-
</svg>`,checkmark:ce`
|
|
604
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
605
|
-
<path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" fill="#212121"/>
|
|
606
|
-
</svg>
|
|
607
|
-
`,close:ce`
|
|
608
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
609
|
-
<path
|
|
610
|
-
d="M14.7551 13.734C15.0479 14.0269 15.0479 14.502 14.7551 14.7949C14.4622 15.0879 13.987 15.0878 13.6941 14.7949L10.0005 11.0738L6.28054 14.7937C5.98767 15.0866 5.51249 15.0866 5.21959 14.7937C4.92668 14.5008 4.92671 14.0256 5.21959 13.7327L8.94075 10.0141L5.21856 6.26604C4.92568 5.97316 4.92568 5.49798 5.21856 5.20508C5.51143 4.91217 5.98661 4.91221 6.27951 5.20508L10.0005 8.95438L13.7204 5.23446C14.0132 4.94159 14.4884 4.94159 14.7813 5.23446C15.0742 5.52734 15.0742 6.00252 14.7813 6.29542L11.0602 10.0141L14.7551 13.734Z"
|
|
611
|
-
fill="#212121"
|
|
612
|
-
/>
|
|
613
|
-
</svg>
|
|
614
|
-
`};var Wi=c`
|
|
615
|
-
:host {
|
|
616
|
-
display: inline-block;
|
|
617
|
-
line-height: 0; /* so you don’t get extra space around the icon */
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
/* Styling svgs rendered by passing *name* attribute - from our library file */
|
|
621
|
-
:host([size='sm']) svg {
|
|
622
|
-
width: 20px;
|
|
623
|
-
height: 20px;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
:host([size='md']) svg {
|
|
627
|
-
width: 42px;
|
|
628
|
-
height: 42px;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
:host([size='lg']) svg {
|
|
632
|
-
width: 56px;
|
|
633
|
-
height: 56px;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
svg {
|
|
637
|
-
/* --internal used for abstracting away the icon component */
|
|
638
|
-
fill: var(--internal-icon-color, currentColor);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
/* For slotted icons */
|
|
642
|
-
:host([size='sm']) ::slotted(svg) {
|
|
643
|
-
width: 20px;
|
|
644
|
-
height: 20px;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
:host([size='lg']) ::slotted(svg) {
|
|
648
|
-
width: 56px;
|
|
649
|
-
height: 56px;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
::slotted(svg) {
|
|
653
|
-
/* --internal used for abstracting away the icon component */
|
|
654
|
-
fill: var(--internal-icon-color, currentColor);
|
|
655
|
-
}
|
|
656
|
-
`;var oe=class extends m{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?qi[this.name]:null;return d`
|
|
657
|
-
<div style="--internal-icon-color: ${this.color}">
|
|
658
|
-
${e||d`<slot></slot>`}
|
|
659
|
-
</div>
|
|
660
|
-
`}};oe.styles=[Wi],s([l({type:String,reflect:!0})],oe.prototype,"color",2),s([l({type:String,reflect:!0})],oe.prototype,"size",2),s([l({reflect:!0})],oe.prototype,"name",2),oe=s([h("primer-icon")],oe);var Ji=c`
|
|
661
|
-
:host {
|
|
662
|
-
display: flex;
|
|
663
|
-
flex-direction: column;
|
|
664
|
-
align-items: center;
|
|
665
|
-
gap: var(--primer-space-xsmall);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
p {
|
|
669
|
-
margin: 0;
|
|
670
|
-
|
|
671
|
-
color: var(--primer-color-text-primary);
|
|
672
|
-
text-align: center;
|
|
673
|
-
font-size: var(--primer-typography-body-large-size);
|
|
674
|
-
font-family: var(--primer-typography-body-large-font);
|
|
675
|
-
font-weight: var(--primer-typography-body-large-weight);
|
|
676
|
-
line-height: var(--primer-typography-body-large-line-height);
|
|
677
|
-
letter-spacing: var(--primer-typography-body-large-letter-spacing);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
p.secondary {
|
|
681
|
-
color: var(--primer-color-text-secondary);
|
|
682
|
-
text-align: center;
|
|
683
|
-
font-family: var(--primer-typography-body-medium-font, Inter);
|
|
684
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
685
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
686
|
-
line-height: var(--primer-typography-body-medium-line-height);
|
|
687
|
-
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
688
|
-
}
|
|
689
|
-
`;var ge=class extends m{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
|
|
690
|
-
<!-- Successful view -->
|
|
691
|
-
<primer-icon
|
|
692
|
-
size="lg"
|
|
693
|
-
name="successful-check"
|
|
694
|
-
color="var(--primer-color-icon-positive)"
|
|
695
|
-
>
|
|
696
|
-
</primer-icon>
|
|
697
|
-
<p>Checkout complete!</p>
|
|
698
|
-
<p class="secondary">
|
|
699
|
-
You'll be redirected to the order confirmation page soon.
|
|
700
|
-
</p>
|
|
701
|
-
`:d`
|
|
702
|
-
<primer-icon
|
|
703
|
-
size="lg"
|
|
704
|
-
name="failure-icon"
|
|
705
|
-
color="var(--primer-color-icon-negative)"
|
|
706
|
-
>
|
|
707
|
-
</primer-icon>
|
|
708
|
-
<p>Payment failed</p>
|
|
709
|
-
${this.description?d`<p class="secondary">${this.description}</p>`:d`<p class="secondary">Something went wrong.</p>`}
|
|
710
|
-
`}};ge.styles=[Ji],s([l({type:String,reflect:!0})],ge.prototype,"type",2),s([l({type:String,reflect:!0})],ge.prototype,"description",2),ge=s([h("primer-checkout-state")],ge);var Zi=c`
|
|
711
|
-
:host {
|
|
712
|
-
display: contents;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
input {
|
|
716
|
-
width: 100%;
|
|
717
|
-
padding: 0;
|
|
718
|
-
border: none;
|
|
719
|
-
height: var(--primer-typography-body-large-line-height);
|
|
720
|
-
font-size: var(--primer-typography-body-large-size);
|
|
721
|
-
font-family: var(--primer-typography-body-large-font);
|
|
722
|
-
color: var(--primer-color-text-primary);
|
|
723
|
-
background-color: transparent;
|
|
724
|
-
outline: none;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
input::placeholder {
|
|
728
|
-
color: var(--primer-color-text-placeholder);
|
|
729
|
-
font-size: var(--primer-typography-body-large-size);
|
|
730
|
-
font-family: var(--primer-typography-body-large-font);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
:host([disabled]) input {
|
|
734
|
-
color: var(--primer-color-text-disabled);
|
|
735
|
-
cursor: not-allowed;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
:host([disabled]) input::placeholder {
|
|
739
|
-
color: var(--primer-color-text-disabled);
|
|
740
|
-
}
|
|
741
|
-
`;var Ia=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Na(i){return Ia.includes(i)}var k=class extends m{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,o){this.inputElement?.setSelectionRange(e,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return d`
|
|
742
|
-
<input
|
|
743
|
-
part="input"
|
|
744
|
-
class=${r}
|
|
745
|
-
.value=${this.value}
|
|
746
|
-
.type=${this.type}
|
|
747
|
-
?disabled=${this.disabled}
|
|
748
|
-
?required=${this.required}
|
|
749
|
-
?readonly=${this.readonly}
|
|
750
|
-
placeholder=${this.placeholder}
|
|
751
|
-
pattern=${this.pattern}
|
|
752
|
-
minlength=${this.minlength??""}
|
|
753
|
-
maxlength=${this.maxlength??""}
|
|
754
|
-
min=${this.min}
|
|
755
|
-
max=${this.max}
|
|
756
|
-
step=${this.step}
|
|
757
|
-
autocomplete=${this.autocomplete}
|
|
758
|
-
name=${this.name}
|
|
759
|
-
id=${this.id}
|
|
760
|
-
@input=${this.handleInput}
|
|
761
|
-
@change=${this.handleChange}
|
|
762
|
-
@focus=${this.handleFocus}
|
|
763
|
-
@blur=${this.handleBlur}
|
|
764
|
-
@invalid=${this.handleInvalid}
|
|
765
|
-
/>
|
|
766
|
-
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};k.styles=[Zi],s([Ie("input")],k.prototype,"inputElement",2),s([l({type:String,reflect:!0})],k.prototype,"value",2),s([l({type:String,reflect:!0})],k.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],k.prototype,"disabled",2),s([l({type:String,reflect:!0})],k.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Na(e)?(e&&e!=="text"&&b.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],k.prototype,"type",2),s([l({type:Boolean,reflect:!0})],k.prototype,"required",2),s([l({type:Boolean,reflect:!0})],k.prototype,"readonly",2),s([l({type:String,reflect:!0})],k.prototype,"pattern",2),s([l({type:Number,reflect:!0})],k.prototype,"minlength",2),s([l({type:Number,reflect:!0})],k.prototype,"maxlength",2),s([l({type:String,reflect:!0})],k.prototype,"min",2),s([l({type:String,reflect:!0})],k.prototype,"max",2),s([l({type:String,reflect:!0})],k.prototype,"step",2),s([l({type:String,reflect:!0})],k.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],k.prototype,"id",2),s([x()],k.prototype,"hasFocus",2),s([x()],k.prototype,"hasError",2),k=s([h("primer-input")],k);var Xi=c`
|
|
767
|
-
:host {
|
|
768
|
-
display: block;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
.collapsable {
|
|
772
|
-
width: 100%;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
/* Make the button display with full width */
|
|
776
|
-
primer-button::part(button) {
|
|
777
|
-
width: 100%;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
.collapsable-wrapper {
|
|
781
|
-
display: grid;
|
|
782
|
-
grid-template-rows: 0fr;
|
|
783
|
-
transition: grid-template-rows var(--primer-animation-duration)
|
|
784
|
-
var(--primer-animation-easing);
|
|
785
|
-
overflow: hidden;
|
|
786
|
-
border-top: none;
|
|
787
|
-
margin-top: -1px;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
.collapsable-wrapper.expanded {
|
|
791
|
-
grid-template-rows: 1fr;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
.collapsable-content {
|
|
795
|
-
min-height: 0;
|
|
796
|
-
overflow: hidden;
|
|
797
|
-
padding: var(--primer-space-medium, 12px) 0;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
.icon-container {
|
|
801
|
-
display: flex;
|
|
802
|
-
align-items: center;
|
|
803
|
-
justify-content: center;
|
|
804
|
-
transition: transform var(--primer-animation-duration)
|
|
805
|
-
var(--primer-animation-easing);
|
|
806
|
-
font-size: 0.75em;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
.icon-container.expanded {
|
|
810
|
-
transform: rotate(180deg);
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
/* Disable animation for users who prefer reduced motion */
|
|
814
|
-
@media (prefers-reduced-motion: reduce) {
|
|
815
|
-
.collapsable-wrapper,
|
|
816
|
-
.icon-container {
|
|
817
|
-
transition: none;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
`;var F=class extends m{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,o=this.header||e;return d`
|
|
821
|
-
<div class="collapsable">
|
|
822
|
-
<primer-button
|
|
823
|
-
variant=${this.buttonVariant}
|
|
824
|
-
buttonType="button"
|
|
825
|
-
@click=${this.toggleExpanded}
|
|
826
|
-
aria-expanded=${this.isExpanded}
|
|
827
|
-
aria-controls="collapsable-content"
|
|
828
|
-
aria-label=${r}
|
|
829
|
-
>
|
|
830
|
-
<span>${o}</span>
|
|
831
|
-
</primer-button>
|
|
832
|
-
|
|
833
|
-
<div
|
|
834
|
-
class="collapsable-wrapper ${this.isExpanded?"expanded":""}"
|
|
835
|
-
id="collapsable-content"
|
|
836
|
-
role="region"
|
|
837
|
-
aria-labelledby="collapsable-header"
|
|
838
|
-
>
|
|
839
|
-
<div class="collapsable-content">
|
|
840
|
-
<slot></slot>
|
|
841
|
-
</div>
|
|
842
|
-
</div>
|
|
843
|
-
</div>
|
|
844
|
-
`}};F.styles=[Xi],s([l({type:String})],F.prototype,"header",2),s([l({type:Boolean})],F.prototype,"expanded",2),s([l({type:String})],F.prototype,"expandText",2),s([l({type:String})],F.prototype,"collapseText",2),s([l({type:String})],F.prototype,"ariaLabel",2),s([l({type:String})],F.prototype,"buttonVariant",2),s([x()],F.prototype,"isExpanded",2),F=s([h("primer-collapsable")],F);var Qi=c`
|
|
845
|
-
:host {
|
|
846
|
-
display: block;
|
|
847
|
-
width: 100%;
|
|
848
|
-
box-sizing: border-box;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
.error-message {
|
|
852
|
-
display: flex;
|
|
853
|
-
align-items: flex-start;
|
|
854
|
-
padding: var(--primer-space-medium);
|
|
855
|
-
background-color: var(--primer-color-red-100);
|
|
856
|
-
border-radius: var(--primer-radius-medium);
|
|
857
|
-
border: 1px solid var(--primer-color-border-outlined-error);
|
|
858
|
-
margin-top: var(--primer-space-small);
|
|
859
|
-
box-sizing: border-box;
|
|
860
|
-
width: 100%;
|
|
861
|
-
|
|
862
|
-
/* Add animation properties */
|
|
863
|
-
opacity: 1;
|
|
864
|
-
transform: translateY(0);
|
|
865
|
-
transition:
|
|
866
|
-
opacity var(--primer-animation-duration) var(--primer-animation-easing),
|
|
867
|
-
transform var(--primer-animation-duration) var(--primer-animation-easing);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
.error-message.hidden {
|
|
871
|
-
opacity: 0;
|
|
872
|
-
transform: translateY(-var(--primer-space-medium));
|
|
873
|
-
pointer-events: none;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
.error-icon {
|
|
877
|
-
flex-shrink: 0;
|
|
878
|
-
margin-right: var(--primer-space-medium);
|
|
879
|
-
color: var(--primer-color-icon-negative);
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
.error-content {
|
|
883
|
-
flex: 1;
|
|
884
|
-
font-family: var(--primer-typography-body-medium-font);
|
|
885
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
886
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
887
|
-
line-height: var(--primer-typography-body-medium-line-height);
|
|
888
|
-
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
889
|
-
color: var(--primer-color-text-negative);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/* Respect user's preference for reduced motion */
|
|
893
|
-
@media (prefers-reduced-motion: reduce) {
|
|
894
|
-
.error-message {
|
|
895
|
-
transition: opacity var(--primer-animation-duration)
|
|
896
|
-
var(--primer-animation-easing);
|
|
897
|
-
transform: none;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
.error-message.hidden {
|
|
901
|
-
transform: none;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
`;var X=class extends m{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(e){e.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return p;let e={"error-message":!0,hidden:!this.visible};return d`
|
|
905
|
-
<div
|
|
906
|
-
part="error-message"
|
|
907
|
-
class=${R(e)}
|
|
908
|
-
aria-live="assertive"
|
|
909
|
-
aria-atomic="true"
|
|
910
|
-
>
|
|
911
|
-
<div part="error-icon" class="error-icon">
|
|
912
|
-
<primer-icon
|
|
913
|
-
name="failure-icon"
|
|
914
|
-
size="sm"
|
|
915
|
-
color="var(--primer-color-icon-negative)"
|
|
916
|
-
></primer-icon>
|
|
917
|
-
</div>
|
|
918
|
-
<div part="error-content" class="error-content">${this.message}</div>
|
|
919
|
-
</div>
|
|
920
|
-
`}};X.styles=[Qi],s([l({type:String})],X.prototype,"message",2),s([l({type:Boolean,reflect:!0})],X.prototype,"visible",2),s([l({type:String,reflect:!0})],X.prototype,"role",2),s([x()],X.prototype,"showMessage",2),X=s([h("primer-error-message")],X);var eo=c`
|
|
921
|
-
:host {
|
|
922
|
-
display: none;
|
|
923
|
-
}
|
|
924
|
-
`;var $e=class extends m{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let e=document.querySelector(`#${this.id}`);return e||(e=document.createElement("div"),e.id=this.id,document.body.appendChild(e),this._setupEventListeners(e)),e}_setupEventListeners(e){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{e.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(e){let o=e.target.assignedNodes();if(!o.length)return;let a=this.getContainer();o.forEach(n=>a.appendChild(n))}render(){return d`<slot @slotchange=${this._handleSlotChange}></slot>`}};$e.styles=[eo],s([x()],$e.prototype,"id",2),$e=s([h("primer-portal")],$e);var to=c`
|
|
925
|
-
:host {
|
|
926
|
-
display: contents;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
.backdrop {
|
|
930
|
-
position: absolute;
|
|
931
|
-
top: 0;
|
|
932
|
-
left: 0;
|
|
933
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
934
|
-
z-index: 1000;
|
|
935
|
-
display: flex;
|
|
936
|
-
justify-content: center;
|
|
937
|
-
align-items: center;
|
|
938
|
-
width: 100vw;
|
|
939
|
-
height: 100vh;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
.dialog {
|
|
943
|
-
background-color: white;
|
|
944
|
-
padding: var(--primer-space-medium);
|
|
945
|
-
border-radius: var(--primer-radius-medium);
|
|
946
|
-
max-width: 600px;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
.header {
|
|
950
|
-
display: flex;
|
|
951
|
-
justify-content: flex-end;
|
|
952
|
-
}
|
|
953
|
-
`;var We=class extends m{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
|
|
954
|
-
<div
|
|
955
|
-
class=${R({backdrop:!0})}
|
|
956
|
-
@click=${t=>{t.preventDefault()}}
|
|
957
|
-
>
|
|
958
|
-
<div class="dialog">
|
|
959
|
-
<div class="header">
|
|
960
|
-
<primer-button variant="tertiary" @click=${this._handleCloseClick}>
|
|
961
|
-
<primer-icon name="close"></primer-icon>
|
|
962
|
-
</primer-button>
|
|
963
|
-
</div>
|
|
964
|
-
<div class="content">
|
|
965
|
-
<slot></slot>
|
|
966
|
-
</div>
|
|
967
|
-
</div>
|
|
968
|
-
</div>
|
|
969
|
-
`}};We.styles=[to],We=s([h("primer-dialog")],We);var ro=c`
|
|
970
|
-
:host {
|
|
971
|
-
display: contents;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
.klarna-container {
|
|
975
|
-
display: flex;
|
|
976
|
-
flex-direction: column;
|
|
977
|
-
width: 100%;
|
|
978
|
-
transition: all var(--primer-animation-duration)
|
|
979
|
-
var(--primer-animation-easing);
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
.klarna-container.expanded {
|
|
983
|
-
border-radius: var(--primer-radius-medium);
|
|
984
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
985
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
986
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
987
|
-
padding: var(--primer-space-large);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
.klarna-button-header {
|
|
991
|
-
padding: 0;
|
|
992
|
-
display: flex;
|
|
993
|
-
align-items: center;
|
|
994
|
-
justify-content: space-between;
|
|
995
|
-
width: 100%;
|
|
996
|
-
gap: var(--primer-space-small);
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
.klarna-accordion-icon {
|
|
1000
|
-
position: absolute;
|
|
1001
|
-
right: var(--primer-space-medium);
|
|
1002
|
-
font-size: var(--primer-typography-body-small-size);
|
|
1003
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
1004
|
-
color: var(--primer-color-text-secondary);
|
|
1005
|
-
transition: all var(--primer-animation-duration)
|
|
1006
|
-
var(--primer-animation-easing);
|
|
1007
|
-
display: inline-flex;
|
|
1008
|
-
align-items: center;
|
|
1009
|
-
justify-content: center;
|
|
1010
|
-
width: 24px;
|
|
1011
|
-
height: 24px;
|
|
1012
|
-
margin-left: var(--primer-space-small);
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
.klarna-accordion-icon.expanded {
|
|
1016
|
-
transform: rotate(180deg);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
.klarna-expanded-content {
|
|
1020
|
-
width: 100%;
|
|
1021
|
-
display: grid;
|
|
1022
|
-
grid-template-rows: 0fr;
|
|
1023
|
-
transition: grid-template-rows var(--primer-animation-duration)
|
|
1024
|
-
var(--primer-animation-easing);
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
.klarna-expanded-content.visible {
|
|
1028
|
-
margin-top: var(--primer-space-large);
|
|
1029
|
-
border-top: 1px solid var(--primer-color-border-outlined-default);
|
|
1030
|
-
grid-template-rows: 1fr;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
.klarna-accordion-content {
|
|
1034
|
-
overflow: hidden;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
@keyframes fadeIn {
|
|
1038
|
-
from {
|
|
1039
|
-
opacity: 0;
|
|
1040
|
-
transform: translateY(-10px);
|
|
1041
|
-
}
|
|
1042
|
-
to {
|
|
1043
|
-
opacity: 1;
|
|
1044
|
-
transform: translateY(0);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
.category-selection {
|
|
1049
|
-
display: flex;
|
|
1050
|
-
flex-wrap: wrap;
|
|
1051
|
-
gap: var(--primer-space-small);
|
|
1052
|
-
margin: var(--primer-space-large) 0;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
.category-button {
|
|
1056
|
-
padding: var(--primer-space-medium) var(--primer-space-large);
|
|
1057
|
-
border-radius: var(--primer-radius-base);
|
|
1058
|
-
background-color: var(--primer-color-background-outlined-loading);
|
|
1059
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1060
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1061
|
-
cursor: pointer;
|
|
1062
|
-
transition: all var(--primer-animation-duration)
|
|
1063
|
-
var(--primer-animation-easing);
|
|
1064
|
-
flex: 1;
|
|
1065
|
-
min-width: 100px;
|
|
1066
|
-
text-align: center;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
.category-button.selected {
|
|
1070
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
1071
|
-
border-color: var(--primer-color-brand);
|
|
1072
|
-
color: var(--primer-color-brand);
|
|
1073
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
.category-button:hover:not(.selected) {
|
|
1077
|
-
background-color: var(--primer-color-background-outlined-hover);
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
.klarna-category-container {
|
|
1081
|
-
min-height: 74px;
|
|
1082
|
-
width: 100%;
|
|
1083
|
-
border-radius: var(--primer-radius-small);
|
|
1084
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1085
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
1086
|
-
padding: var(--primer-space-medium);
|
|
1087
|
-
margin-bottom: var(--primer-space-large);
|
|
1088
|
-
transition: height var(--primer-animation-duration)
|
|
1089
|
-
var(--primer-animation-easing);
|
|
1090
|
-
overflow: hidden;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
.klarna-button::part(button) {
|
|
1094
|
-
display: flex;
|
|
1095
|
-
flex: 1;
|
|
1096
|
-
gap: var(--primer-space-small);
|
|
1097
|
-
height: calc(
|
|
1098
|
-
var(--primer-typography-title-large-line-height) +
|
|
1099
|
-
calc(2 * var(--primer-space-medium))
|
|
1100
|
-
);
|
|
1101
|
-
width: 100%;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
.klarna-button primer-icon {
|
|
1105
|
-
margin-right: var(--primer-space-medium);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
.klarna-button:hover {
|
|
1109
|
-
background-color: var(--primer-color-background-outlined-hover);
|
|
1110
|
-
border-color: var(--primer-color-border-outlined-hover);
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
.klarna-pay-button {
|
|
1114
|
-
padding: var(--primer-space-medium) var(--primer-space-large);
|
|
1115
|
-
display: flex;
|
|
1116
|
-
align-items: center;
|
|
1117
|
-
justify-content: center;
|
|
1118
|
-
border-radius: var(--primer-radius-small);
|
|
1119
|
-
background-color: var(--primer-color-brand);
|
|
1120
|
-
color: var(--primer-color-background-outlined-default);
|
|
1121
|
-
border: none;
|
|
1122
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1123
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
1124
|
-
width: 100%;
|
|
1125
|
-
cursor: pointer;
|
|
1126
|
-
transition: all var(--primer-animation-duration)
|
|
1127
|
-
var(--primer-animation-easing);
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
.klarna-pay-button:hover:not(.disabled) {
|
|
1131
|
-
filter: brightness(105%);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.klarna-pay-button.loading {
|
|
1135
|
-
opacity: 0.7;
|
|
1136
|
-
pointer-events: none;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
.klarna-pay-button.disabled {
|
|
1140
|
-
opacity: 0.5;
|
|
1141
|
-
cursor: not-allowed;
|
|
1142
|
-
filter: brightness(85%);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
.loading {
|
|
1146
|
-
text-align: center;
|
|
1147
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1148
|
-
color: var(--primer-color-text-secondary);
|
|
1149
|
-
padding: var(--primer-space-medium);
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
.error {
|
|
1153
|
-
color: var(--primer-color-text-negative);
|
|
1154
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1155
|
-
padding: var(--primer-space-medium);
|
|
1156
|
-
text-align: center;
|
|
1157
|
-
border: 1px solid var(--primer-color-border-outlined-error);
|
|
1158
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
1159
|
-
border-radius: var(--primer-radius-small);
|
|
1160
|
-
}
|
|
1161
|
-
`;var D=class extends m{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=y("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new M(this,{task:async([e,r])=>{if(!e||!r)return E;let o=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){b.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){b.error("Failed to render Klarna category",e)}}selectCategory(e){this.selectedCategory=e,this.renderSelectedCategory()}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?d`<div class="loading">
|
|
1162
|
-
<primer-spinner size="small"></primer-spinner>
|
|
1163
|
-
</div>`:d`
|
|
1164
|
-
<div class="category-selection">
|
|
1165
|
-
${e.map(o=>d`
|
|
1166
|
-
<button
|
|
1167
|
-
class=${R({"category-button":!0,selected:o.id===this.selectedCategory})}
|
|
1168
|
-
@click=${()=>{this.selectCategory(o.id)}}
|
|
1169
|
-
>
|
|
1170
|
-
${o.name}
|
|
1171
|
-
</button>
|
|
1172
|
-
`)}
|
|
1173
|
-
</div>
|
|
1174
|
-
`}renderExpandedContent(){return d`
|
|
1175
|
-
${this.renderCategorySelection()}
|
|
1176
|
-
${this.selectedCategory?d`
|
|
1177
|
-
<div
|
|
1178
|
-
id="klarna-category-container"
|
|
1179
|
-
class="klarna-category-container"
|
|
1180
|
-
></div>
|
|
1181
|
-
`:p}
|
|
1182
|
-
|
|
1183
|
-
<button
|
|
1184
|
-
class=${R({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1185
|
-
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1186
|
-
@click=${()=>this.startKlarnaPayment()}
|
|
1187
|
-
>
|
|
1188
|
-
${y("confirm",{id:"confirm"})}
|
|
1189
|
-
</button>
|
|
1190
|
-
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return d`<div class="error">
|
|
1191
|
-
Error loading Klarna: ${r}
|
|
1192
|
-
</div>`},complete:({manager:e,klarnaIcon:r})=>e?d`
|
|
1193
|
-
<div class="klarna-container ${this.isExpanded?"expanded":""}">
|
|
1194
|
-
<div class="klarna-button-header">
|
|
1195
|
-
<primer-button
|
|
1196
|
-
buttonType="button"
|
|
1197
|
-
variant="secondary"
|
|
1198
|
-
class="klarna-button"
|
|
1199
|
-
@click=${this.toggleExpand}
|
|
1200
|
-
aria-expanded=${this.isExpanded}
|
|
1201
|
-
aria-controls="collapsable-content"
|
|
1202
|
-
aria-label=${this.headerAriaLabel}
|
|
1203
|
-
>
|
|
1204
|
-
<img src=${r} alt="Klarna logo" />
|
|
1205
|
-
<span>${y("pay_with",{id:"pay_with"})} Klarna</span>
|
|
1206
|
-
<span
|
|
1207
|
-
class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
|
|
1208
|
-
>
|
|
1209
|
-
▼
|
|
1210
|
-
</span>
|
|
1211
|
-
</primer-button>
|
|
1212
|
-
</div>
|
|
1213
|
-
|
|
1214
|
-
<div
|
|
1215
|
-
class="klarna-expanded-content ${this.isExpanded?"visible":""}"
|
|
1216
|
-
>
|
|
1217
|
-
<div class="klarna-accordion-content">
|
|
1218
|
-
${this.renderExpandedContent()}
|
|
1219
|
-
</div>
|
|
1220
|
-
</div>
|
|
1221
|
-
</div>
|
|
1222
|
-
`:p})}};D.styles=[v,ro],s([f({context:Y,subscribe:!0}),l()],D.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0}),l()],D.prototype,"sdkState",2),s([f({context:$,subscribe:!0}),l({type:Object})],D.prototype,"headlessUtils",2),s([f({context:kt,subscribe:!0}),l()],D.prototype,"klarnaCategories",2),s([x()],D.prototype,"selectedCategory",2),s([x()],D.prototype,"isExpanded",2),s([x()],D.prototype,"headerAriaLabel",2),s([Ie("#klarna-category-container")],D.prototype,"klarnaContainer",2),D=s([h("primer-klarna"),S()],D);var io=c`
|
|
1223
|
-
:host {
|
|
1224
|
-
display: contents;
|
|
1225
|
-
}
|
|
1226
|
-
`;var fe=class extends m{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return p;let e=this.paymentMethods?.get(this.type);if(!e)return p;switch(e?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
|
|
1227
|
-
.paymentMethod=${e}
|
|
1228
|
-
></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
|
|
1229
|
-
.paymentMethod=${e}
|
|
1230
|
-
></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
|
|
1231
|
-
<primer-dynamic-payment
|
|
1232
|
-
.paymentMethod=${e}
|
|
1233
|
-
></primer-dynamic-payment>
|
|
1234
|
-
`;default:return p}}};fe.styles=[io],s([l({type:String})],fe.prototype,"type",2),s([f({context:et,subscribe:!0}),l()],fe.prototype,"paymentMethods",2),fe=s([h("primer-payment-method")],fe);var oo=c`
|
|
1235
|
-
:host {
|
|
1236
|
-
display: flex;
|
|
1237
|
-
flex-direction: column;
|
|
1238
|
-
gap: var(--primer-space-medium);
|
|
1239
|
-
width: 100%;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
h2 {
|
|
1243
|
-
margin: 0;
|
|
1244
|
-
padding: 0;
|
|
1245
|
-
border-radius: var(--primer-radius-medium);
|
|
1246
|
-
font-weight: var(--primer-typography-title-xlarge-weight);
|
|
1247
|
-
font-size: var(--primer-typography-title-xlarge-size);
|
|
1248
|
-
letter-spacing: var(--primer-typography-title-xlarge-letter-spacing);
|
|
1249
|
-
line-height: var(--primer-typography-title-xlarge-line-height);
|
|
1250
|
-
font-family: var(--primer-typography-title-xlarge-font);
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
p {
|
|
1254
|
-
margin: 0;
|
|
1255
|
-
padding: 0;
|
|
1256
|
-
border-radius: var(--primer-radius-medium);
|
|
1257
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
1258
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1259
|
-
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
1260
|
-
line-height: var(--primer-typography-body-medium-line-height);
|
|
1261
|
-
font-family: var(--primer-typography-body-medium-font);
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
form {
|
|
1265
|
-
display: flex;
|
|
1266
|
-
flex-direction: column;
|
|
1267
|
-
gap: var(--primer-space-medium);
|
|
1268
|
-
width: 100%;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
.form-row {
|
|
1272
|
-
display: flex;
|
|
1273
|
-
gap: var(--primer-space-small);
|
|
1274
|
-
width: 100%;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
.form-row primer-input-wrapper {
|
|
1278
|
-
flex: 1;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
.error-message {
|
|
1282
|
-
color: var(--primer-color-text-negative);
|
|
1283
|
-
background-color: var(--primer-color-red-100);
|
|
1284
|
-
padding: var(--primer-space-small);
|
|
1285
|
-
border-radius: var(--primer-radius-small);
|
|
1286
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
1287
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1288
|
-
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
1289
|
-
line-height: var(--primer-typography-body-medium-line-height);
|
|
1290
|
-
font-family: var(--primer-typography-body-medium-font);
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
.loading-container {
|
|
1294
|
-
display: flex;
|
|
1295
|
-
flex-direction: column;
|
|
1296
|
-
align-items: center;
|
|
1297
|
-
justify-content: center;
|
|
1298
|
-
gap: var(--primer-space-medium);
|
|
1299
|
-
padding: var(--primer-space-large);
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
.button-group {
|
|
1303
|
-
display: flex;
|
|
1304
|
-
gap: var(--primer-space-small);
|
|
1305
|
-
margin-top: var(--primer-space-medium);
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
/* Apply responsive styles for small screens */
|
|
1309
|
-
@media (max-width: 600px) {
|
|
1310
|
-
.form-row {
|
|
1311
|
-
flex-direction: column;
|
|
1312
|
-
gap: var(--primer-space-medium);
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
.button-group {
|
|
1316
|
-
flex-direction: column;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
`;function ao(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var ar=class{constructor(t,e){this.formState=ao();this.host=t,this.validate=e,t.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(t,e){let r=this.formState[t];r.value=e,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(t,e=!1){e&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),t.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:t}})),this.host.requestUpdate()}setFieldTouched(t){this.formState[t].touched||(this.formState[t].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=ao(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var j=class extends m{constructor(){super(...arguments);this.formController=new ar(this,e=>this._paymentMethodManagerTask.value.setAndValidate(e));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new M(this,{task:async([e])=>e!=="STRIPE_ACH"?E:this.paymentManagers.get(e)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(e,r){let o=e.target;this.formController.setFieldValue(r,o.value)}_handleBlur(e){this.formController.setFieldTouched(e)}_handleError(e){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error occurred")}}))}async _handleSubmitButtonClick(e){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await e.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(e);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(e){try{await e.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}renderForm(e){return d`
|
|
1320
|
-
<h2>
|
|
1321
|
-
${y("payWithAch",{id:"payWithAch"})}
|
|
1322
|
-
</h2>
|
|
1323
|
-
<p>
|
|
1324
|
-
${y("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
|
|
1325
|
-
</p>
|
|
1326
|
-
|
|
1327
|
-
<form @submit=${r=>r.preventDefault()}>
|
|
1328
|
-
<div class="form-row">
|
|
1329
|
-
<primer-input-wrapper
|
|
1330
|
-
.hasError=${this.formController.hasError.firstName}
|
|
1331
|
-
>
|
|
1332
|
-
<primer-input-label slot="label">
|
|
1333
|
-
${y("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
|
|
1334
|
-
</primer-input-label>
|
|
1335
|
-
<primer-input
|
|
1336
|
-
slot="input"
|
|
1337
|
-
.value=${this.formController.formState.firstName.value}
|
|
1338
|
-
@input=${r=>this._handleInput(r,"firstName")}
|
|
1339
|
-
@blur=${()=>this._handleBlur("firstName")}
|
|
1340
|
-
?disabled=${this.isSubmitting}
|
|
1341
|
-
></primer-input>
|
|
1342
|
-
<primer-input-error slot="error">
|
|
1343
|
-
${this.formController.hasError.firstName?this.formController.formState.firstName.error:p}
|
|
1344
|
-
</primer-input-error>
|
|
1345
|
-
</primer-input-wrapper>
|
|
1346
|
-
<primer-input-wrapper
|
|
1347
|
-
.hasError=${this.formController.hasError.lastName}
|
|
1348
|
-
>
|
|
1349
|
-
<primer-input-label slot="label">
|
|
1350
|
-
${y("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
|
|
1351
|
-
</primer-input-label>
|
|
1352
|
-
<primer-input
|
|
1353
|
-
slot="input"
|
|
1354
|
-
.value=${this.formController.formState.lastName.value}
|
|
1355
|
-
@input=${r=>this._handleInput(r,"lastName")}
|
|
1356
|
-
@blur=${()=>this._handleBlur("lastName")}
|
|
1357
|
-
?disabled=${this.isSubmitting}
|
|
1358
|
-
>
|
|
1359
|
-
</primer-input>
|
|
1360
|
-
<primer-input-error slot="error">
|
|
1361
|
-
${this.formController.hasError.lastName?this.formController.formState.lastName.error:p}
|
|
1362
|
-
</primer-input-error>
|
|
1363
|
-
</primer-input-wrapper>
|
|
1364
|
-
</div>
|
|
1365
|
-
<primer-input-wrapper
|
|
1366
|
-
.hasError=${this.formController.hasError.emailAddress}
|
|
1367
|
-
>
|
|
1368
|
-
<primer-input-label slot="label">
|
|
1369
|
-
${y("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
|
|
1370
|
-
</primer-input-label>
|
|
1371
|
-
<primer-input
|
|
1372
|
-
slot="input"
|
|
1373
|
-
type="email"
|
|
1374
|
-
.value=${this.formController.formState.emailAddress.value}
|
|
1375
|
-
@input=${r=>this._handleInput(r,"emailAddress")}
|
|
1376
|
-
@blur=${()=>this._handleBlur("emailAddress")}
|
|
1377
|
-
?disabled=${this.isSubmitting}
|
|
1378
|
-
></primer-input>
|
|
1379
|
-
<primer-input-error slot="error">
|
|
1380
|
-
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:p}
|
|
1381
|
-
</primer-input-error>
|
|
1382
|
-
</primer-input-wrapper>
|
|
1383
|
-
<p>
|
|
1384
|
-
${y("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
|
|
1385
|
-
</p>
|
|
1386
|
-
<primer-button
|
|
1387
|
-
buttonType="submit"
|
|
1388
|
-
variant="primary"
|
|
1389
|
-
@click=${()=>this._handleSubmitButtonClick(e)}
|
|
1390
|
-
?disabled=${this.isSubmitting}
|
|
1391
|
-
?loading=${this.isSubmitting}
|
|
1392
|
-
>
|
|
1393
|
-
${y("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
|
|
1394
|
-
</primer-button>
|
|
1395
|
-
</form>
|
|
1396
|
-
`}renderMandate(){return d`
|
|
1397
|
-
<h2>
|
|
1398
|
-
${y("payWithAch",{id:"payWithAch"})}
|
|
1399
|
-
</h2>
|
|
1400
|
-
|
|
1401
|
-
<p>
|
|
1402
|
-
${this.clientOptions?.stripe?.mandateData.fullMandateText??y("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
|
|
1403
|
-
</p>
|
|
1404
|
-
|
|
1405
|
-
<div class="button-group">
|
|
1406
|
-
<primer-button
|
|
1407
|
-
variant="primary"
|
|
1408
|
-
@click=${this._handleConfirmMandate.bind(this)}
|
|
1409
|
-
?disabled=${this.isSubmitting}
|
|
1410
|
-
?loading=${this.isSubmitting}
|
|
1411
|
-
>
|
|
1412
|
-
${y("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
|
|
1413
|
-
</primer-button>
|
|
1414
|
-
|
|
1415
|
-
<primer-button
|
|
1416
|
-
variant="tertiary"
|
|
1417
|
-
@click=${this._handleDeclineMandate.bind(this)}
|
|
1418
|
-
?disabled=${this.isSubmitting}
|
|
1419
|
-
>
|
|
1420
|
-
${y("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
|
|
1421
|
-
</primer-button>
|
|
1422
|
-
</div>
|
|
1423
|
-
`}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():p})}};j.styles=[v,oo],s([l({type:Object})],j.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0}),l({attribute:!1})],j.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0}),l({attribute:!1})],j.prototype,"sdkState",2),s([f({context:_e,subscribe:!0}),l({attribute:!1})],j.prototype,"clientOptions",2),s([x()],j.prototype,"screen",2),s([x()],j.prototype,"isSubmitting",2),j=s([h("primer-ach-payment"),S()],j);var so=c`
|
|
1424
|
-
:host {
|
|
1425
|
-
height: calc(
|
|
1426
|
-
var(--primer-typography-title-large-line-height) +
|
|
1427
|
-
calc(2 * var(--primer-space-medium))
|
|
1428
|
-
);
|
|
1429
|
-
display: flex;
|
|
1430
|
-
|
|
1431
|
-
/* Default value for the background color CSS variable */
|
|
1432
|
-
--dynamic-payment-button-bg-color: var(
|
|
1433
|
-
--primer-color-background-outlined-default
|
|
1434
|
-
);
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
primer-button {
|
|
1438
|
-
width: 100%;
|
|
1439
|
-
height: 100%;
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
primer-button::part(button) {
|
|
1443
|
-
background-color: var(--dynamic-payment-button-bg-color);
|
|
1444
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1445
|
-
color: var(--primer-color-text-primary);
|
|
1446
|
-
flex: 1;
|
|
1447
|
-
padding: 1px;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
.image-container {
|
|
1451
|
-
display: flex;
|
|
1452
|
-
justify-content: center;
|
|
1453
|
-
height: 100%;
|
|
1454
|
-
}
|
|
1455
|
-
/* Target the img specifically inside our component */
|
|
1456
|
-
img {
|
|
1457
|
-
height: 100%;
|
|
1458
|
-
}
|
|
1459
|
-
`;function Et(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var J=class extends m{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new M(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new M(this,{task:async([e,r])=>{if(!e||!r)return E;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:E},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new M(this,{task:async([e,r])=>!e||!r?E:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Et(e):"";return r==="payWith"&&(r="pay_with"),y(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
|
|
1460
|
-
<primer-portal>
|
|
1461
|
-
<primer-dialog @primer-dialog-close="${()=>this.open=!1}">
|
|
1462
|
-
<primer-ach-payment
|
|
1463
|
-
.paymentMethod=${this.paymentMethod}
|
|
1464
|
-
@primer-ach-error=${()=>this.open=!1}
|
|
1465
|
-
@primer-ach-mandate-confirmed=${()=>this.open=!1}
|
|
1466
|
-
@primer-ach-mandate-declined=${()=>this.open=!1}
|
|
1467
|
-
></primer-ach-payment>
|
|
1468
|
-
</primer-dialog>
|
|
1469
|
-
</primer-portal>
|
|
1470
|
-
`:p}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
|
|
1471
|
-
<primer-button
|
|
1472
|
-
@click="${()=>this.start()}"
|
|
1473
|
-
class=${R({loading:!!this.sdkState?.isProcessing,reverse:!0})}
|
|
1474
|
-
title="${y("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1475
|
-
>
|
|
1476
|
-
<span class="image-container">
|
|
1477
|
-
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1478
|
-
</span>
|
|
1479
|
-
${e.displayName}
|
|
1480
|
-
</primer-button>
|
|
1481
|
-
${this.renderDialog()}
|
|
1482
|
-
`)})}};J.styles=[v,so],s([l({type:Object})],J.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0})],J.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0})],J.prototype,"sdkState",2),s([f({context:$,subscribe:!0})],J.prototype,"headlessUtils",2),s([x()],J.prototype,"open",2),J=s([h("primer-dynamic-payment"),S()],J);var no=c`
|
|
1483
|
-
:host {
|
|
1484
|
-
height: calc(
|
|
1485
|
-
var(--primer-typography-title-large-line-height) +
|
|
1486
|
-
calc(2 * var(--primer-space-medium))
|
|
1487
|
-
);
|
|
1488
|
-
display: flex;
|
|
1489
|
-
|
|
1490
|
-
/* Default value for the background color CSS variable */
|
|
1491
|
-
--redirect-payment-button-bg-color: var(
|
|
1492
|
-
--primer-color-background-outlined-default
|
|
1493
|
-
);
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
primer-button {
|
|
1497
|
-
width: 100%;
|
|
1498
|
-
height: 100%;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
primer-button::part(button) {
|
|
1502
|
-
background-color: var(--redirect-payment-button-bg-color);
|
|
1503
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1504
|
-
color: var(--primer-color-text-primary);
|
|
1505
|
-
flex: 1;
|
|
1506
|
-
padding: var(--primer-space-small);
|
|
1507
|
-
display: flex;
|
|
1508
|
-
align-items: center;
|
|
1509
|
-
justify-content: center;
|
|
1510
|
-
gap: var(--primer-space-small);
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
/* Default layout: icon on the left (START) */
|
|
1514
|
-
primer-button {
|
|
1515
|
-
display: flex;
|
|
1516
|
-
flex-direction: row;
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
/* When icon position is END */
|
|
1520
|
-
primer-button.icon-end {
|
|
1521
|
-
flex-direction: row-reverse;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
.image-container {
|
|
1525
|
-
display: flex;
|
|
1526
|
-
justify-content: center;
|
|
1527
|
-
align-items: center;
|
|
1528
|
-
min-width: 100px;
|
|
1529
|
-
height: 100%;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
.button-text {
|
|
1533
|
-
font-family: var(--primer-typography-font-family);
|
|
1534
|
-
font-size: var(--primer-typography-title-small-font-size);
|
|
1535
|
-
font-weight: var(--primer-typography-title-small-font-weight);
|
|
1536
|
-
line-height: var(--primer-typography-title-small-line-height);
|
|
1537
|
-
letter-spacing: var(--primer-typography-title-small-letter-spacing);
|
|
1538
|
-
white-space: nowrap;
|
|
1539
|
-
overflow: hidden;
|
|
1540
|
-
text-overflow: ellipsis;
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
/* Target the img specifically inside our component */
|
|
1544
|
-
img {
|
|
1545
|
-
max-width: 100px;
|
|
1546
|
-
width: 100%;
|
|
1547
|
-
height: auto;
|
|
1548
|
-
object-fit: cover;
|
|
1549
|
-
max-height: 100%;
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
/* For image container sizing */
|
|
1553
|
-
.image-container {
|
|
1554
|
-
flex-shrink: 0;
|
|
1555
|
-
flex-grow: 1;
|
|
1556
|
-
}
|
|
1557
|
-
`;var Q=class extends m{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new M(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new M(this,{task:async([e,r])=>{if(!e||!r)return E;let o=r.getPaymentMethodConfiguration(e);if(!o)return E;let a=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,n=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:a,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:n}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new M(this,{task:async([e,r])=>!e||!r?E:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Et(e):"";return r==="payWith"&&(r="pay_with"),y(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>{this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":e.iconPosition==="END","image-only":!e.displayName},o=e.displayName?d`
|
|
1558
|
-
<span class="image-container">
|
|
1559
|
-
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1560
|
-
</span>
|
|
1561
|
-
<span class="button-text">${e.displayName}</span>
|
|
1562
|
-
`:d`
|
|
1563
|
-
<span class="image-container">
|
|
1564
|
-
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1565
|
-
</span>
|
|
1566
|
-
`;return d`
|
|
1567
|
-
<primer-button
|
|
1568
|
-
@click="${()=>this.startRedirectPayment()}"
|
|
1569
|
-
class=${R(r)}
|
|
1570
|
-
title="${y("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1571
|
-
>
|
|
1572
|
-
${o}
|
|
1573
|
-
</primer-button>
|
|
1574
|
-
`}})}};Q.styles=[v,no],s([l({type:Object})],Q.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0})],Q.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0})],Q.prototype,"sdkState",2),s([f({context:$,subscribe:!0})],Q.prototype,"headlessUtils",2),Q=s([h("primer-redirect-payment"),S()],Q);var Je={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"};function Ur(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function $a(i){return i?i===i.toUpperCase()?Ur(i):i:""}function lo(i,t){return[i,t].filter(Boolean).join(" ")}function Oa(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function po(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function Ra(i){let t=i.paymentInstrumentData,e=$a(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${po(r)}`:e)||" Card"}`,a=Oa(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:a}}function Da(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account",n=lo(r,o);return{description:a,secondaryDescription:n}}function Va(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),n=lo(r,o);return{description:a,secondaryDescription:n}}function Ha(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;a||(r&&e?a=`${r} ${po(e)}`:r?a=r:a="Bank Account");let n=o?`${Ur(o)} Account`:"";return{description:a,secondaryDescription:n}}function za(i){let t=i.paymentInstrumentType,e=Ur(t.replace(/_/g," "));return{description:i.userDescription||e}}var Ya={[Je.CARD]:Ra,[Je.PAYPAL_VAULTED]:Da,[Je.KLARNA_CUSTOMER_TOKEN]:Va,[Je.AUTOMATED_CLEARING_HOUSE]:Ha};function sr(i){try{let t=Ya[i.paymentInstrumentType];return t?t(i):za(i)}catch(t){return b.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var co=c`
|
|
1575
|
-
:host {
|
|
1576
|
-
display: block;
|
|
1577
|
-
width: 100%;
|
|
1578
|
-
position: relative;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
.vault-manager {
|
|
1582
|
-
display: flex;
|
|
1583
|
-
flex-direction: column;
|
|
1584
|
-
position: relative;
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
.vault-manager-content {
|
|
1588
|
-
display: flex;
|
|
1589
|
-
flex-direction: column;
|
|
1590
|
-
width: 100%;
|
|
1591
|
-
position: relative;
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
/* Content container using CSS Grid for height animation */
|
|
1595
|
-
.content-container {
|
|
1596
|
-
display: grid;
|
|
1597
|
-
grid-template-rows: 1fr;
|
|
1598
|
-
transition: grid-template-rows var(--primer-animation-duration)
|
|
1599
|
-
var(--primer-animation-easing);
|
|
1600
|
-
width: 100%;
|
|
1601
|
-
position: relative;
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
/* Required to make grid animation work - ensures content can expand/collapse properly */
|
|
1605
|
-
.content-container > * {
|
|
1606
|
-
min-height: 0;
|
|
1607
|
-
overflow: hidden;
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
/* Submit button container */
|
|
1611
|
-
.submit-button-container {
|
|
1612
|
-
display: grid;
|
|
1613
|
-
grid-template-rows: 1fr;
|
|
1614
|
-
transition: grid-template-rows var(--primer-animation-duration)
|
|
1615
|
-
var(--primer-animation-easing);
|
|
1616
|
-
overflow: hidden;
|
|
1617
|
-
margin-top: var(--primer-space-small);
|
|
1618
|
-
width: 100%;
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
/* Ensure the submit button has full width */
|
|
1622
|
-
.submit-button {
|
|
1623
|
-
width: 100%;
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
/* Make sure pay button inside the submit component is full width */
|
|
1627
|
-
primer-vault-payment-submit::part(button),
|
|
1628
|
-
::slotted(primer-button) {
|
|
1629
|
-
width: 100%;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
/* Payment methods list */
|
|
1633
|
-
.payment-methods-list {
|
|
1634
|
-
display: flex;
|
|
1635
|
-
flex-direction: column;
|
|
1636
|
-
gap: var(--primer-space-small);
|
|
1637
|
-
width: 100%;
|
|
1638
|
-
position: relative;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
/* Delete confirmation container */
|
|
1642
|
-
.delete-confirmation-container {
|
|
1643
|
-
width: 100%;
|
|
1644
|
-
position: relative;
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
/* Loading overlay styles */
|
|
1648
|
-
.loading-overlay {
|
|
1649
|
-
position: absolute;
|
|
1650
|
-
top: 0;
|
|
1651
|
-
left: 0;
|
|
1652
|
-
width: 100%;
|
|
1653
|
-
height: 100%;
|
|
1654
|
-
display: flex;
|
|
1655
|
-
align-items: center;
|
|
1656
|
-
justify-content: center;
|
|
1657
|
-
background-color: rgba(255, 255, 255, 0.7);
|
|
1658
|
-
z-index: 10;
|
|
1659
|
-
border-radius: var(--primer-radius-medium);
|
|
1660
|
-
backdrop-filter: blur(2px);
|
|
1661
|
-
opacity: 0; /* Start invisible */
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
/* Add styles for when updating is active */
|
|
1665
|
-
.is-updating {
|
|
1666
|
-
pointer-events: none; /* Prevent interaction when updating */
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
/*
|
|
1670
|
-
* Component-specific styles to ensure smooth animations
|
|
1671
|
-
* These components need display:block to work with the grid layout
|
|
1672
|
-
*/
|
|
1673
|
-
primer-vault-payment-method-item,
|
|
1674
|
-
primer-vault-empty-state,
|
|
1675
|
-
primer-vault-delete-confirmation {
|
|
1676
|
-
display: block;
|
|
1677
|
-
width: 100%;
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
/* Disable animations for reduced motion preference */
|
|
1681
|
-
@media (prefers-reduced-motion: reduce) {
|
|
1682
|
-
.content-container,
|
|
1683
|
-
.submit-button-container,
|
|
1684
|
-
primer-vault-payment-method-item,
|
|
1685
|
-
primer-vault-payment-submit,
|
|
1686
|
-
primer-vault-empty-state,
|
|
1687
|
-
primer-vault-delete-confirmation {
|
|
1688
|
-
transition: none;
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
`;var{I:ju}=Ii;var mo=i=>i.strings===void 0;var St=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),St(r,t);return!0},nr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},ho=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),Ba(t)}};function Ua(i){this._$AN!==void 0?(nr(this),this._$AM=i,ho(this)):this._$AM=i}function Fa(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let a=e;a<r.length;a++)St(r[a],!1),nr(r[a]);else r!=null&&(St(r,!1),nr(r));else St(this,i)}var Ba=i=>{i.type==Ne.CHILD&&(i._$AP??(i._$AP=Fa),i._$AQ??(i._$AQ=Ua))},Oe=class extends rt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ho(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(St(this,t),nr(this))}setValue(t){if(mo(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var lr=new WeakMap,it=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,lr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var uo=0,Fr=new Map,go=new WeakSet,Br=()=>new Promise(i=>requestAnimationFrame(i));var fo=(i,t)=>{let e=i-t;return e===0?void 0:e},yo=(i,t)=>{let e=i/t;return e===1?void 0:e},dr={left:(i,t)=>{let e=fo(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=fo(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=yo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=yo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},bo={duration:333,easing:"ease-in-out"},xo=["left","top","width","height","opacity","color","background"],vo=new WeakMap,pr=class extends Oe{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Ne.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(t=>{this.l=t})}async resolveFinished(){this.l?.(),this.l=void 0}render(t){return p}getController(){return lr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,vo.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};let e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=xo),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(dr[o]?void 0:r[o]),n=Number(a);t[o]=isNaN(n)?a+"":n}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((a,n)=>a===o[n]))return!1}else if(o===r)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Br;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,e);this.log("measured",[this.A,o,a,n]),t=this.calculateKeyframes(a,n)}else{let a=Fr.get(this.options.inId);if(a){Fr.delete(this.options.inId);let{from:n,to:u}=this.N(a,o,e);t=this.calculateKeyframes(n,u),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,uo++,t.forEach(g=>g.zIndex=uo)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&Fr.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Br(),this.i?.isConnected){let e=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,e),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,a=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&a===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),a!==0&&(this.element.style.top=a+"px")}}let t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(t){t&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e?.parentNode){let r=vo.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=go.has(this.u);return t||this.u.updateComplete.then(()=>{go.add(this.u)}),t}j(t,e=this.O()){let r={...bo};return e.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t={...t},e={...e};let o=r.map(u=>u.animatingProperties).filter(u=>u!==void 0),a=1,n=1;return o.length>0&&(o.forEach(u=>{u.width&&(a/=u.width),u.height&&(n/=u.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=a*t.left,e.left=a*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=n*t.top,e.top=n*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},a={},n=!1,u={};for(let g in e){let A=t[g],w=e[g];if(g in dr){let P=dr[g];if(A===void 0||w===void 0)continue;let O=P(A,w);O.transform!==void 0&&(u[g]=O.value,n=!0,o.transform=`${o.transform??""} ${O.transform}`,O.overrideFrom!==void 0&&Object.assign(o,O.overrideFrom))}else A!==w&&A!==void 0&&w!==void 0&&(n=!0,o[g]=A,a[g]=w)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=u,n?[o,a]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}},Re=me(pr);var Ka=["top","right","bottom","left"],cr=class extends Oe{constructor(t){if(super(t),t.type!==Ne.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return p}update(t,[e,r]){return this.u===void 0&&(this.u=t.options?.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r??["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){let t=typeof this.C=="function"?this.C():this.C?.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();this.F?.forEach(a=>{let n=Ka.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},ja=me(cr);var G=class extends m{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new it(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=y("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(e){this.errorMessage=e instanceof Error?e.message:y("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(e){let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:y("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===e);if(!r)return"";try{return sr(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
|
|
1692
|
-
<div
|
|
1693
|
-
class="loading-overlay"
|
|
1694
|
-
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1695
|
-
>
|
|
1696
|
-
<primer-spinner
|
|
1697
|
-
size="medium"
|
|
1698
|
-
color="var(--primer-color-loader)"
|
|
1699
|
-
></primer-spinner>
|
|
1700
|
-
</div>
|
|
1701
|
-
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return p;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
|
|
1702
|
-
<div class="delete-confirmation-container">
|
|
1703
|
-
<primer-vault-delete-confirmation
|
|
1704
|
-
.isDeleting=${this.isDeleting}
|
|
1705
|
-
.paymentMethodId=${this.deletePaymentMethodId}
|
|
1706
|
-
.paymentMethodName=${e}
|
|
1707
|
-
@confirm-delete=${this.handleConfirmDelete}
|
|
1708
|
-
@cancel-delete=${this.handleCancelDelete}
|
|
1709
|
-
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1710
|
-
></primer-vault-delete-confirmation>
|
|
1711
|
-
</div>
|
|
1712
|
-
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?p:d`
|
|
1713
|
-
<primer-vault-payment-method-item
|
|
1714
|
-
.paymentMethod=${e}
|
|
1715
|
-
.isEditMode=${this.isEditMode}
|
|
1716
|
-
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
1717
|
-
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1718
|
-
></primer-vault-payment-method-item>
|
|
1719
|
-
`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
|
|
1720
|
-
<div class="payment-methods-list">
|
|
1721
|
-
${e.map(o=>this.renderPaymentMethodItem(o))}
|
|
1722
|
-
${_(r,()=>d`
|
|
1723
|
-
<div class="submit-button-container">
|
|
1724
|
-
<primer-vault-payment-submit
|
|
1725
|
-
class="submit-button"
|
|
1726
|
-
@primer-vault-payment-error=${this.handlePaymentError}
|
|
1727
|
-
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1728
|
-
></primer-vault-payment-submit>
|
|
1729
|
-
</div>
|
|
1730
|
-
`,()=>p)}
|
|
1731
|
-
</div>
|
|
1732
|
-
`}render(){if(!this.vaultManagerContext?.enabled)return p;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
|
|
1733
|
-
<div class="vault-manager ${o?"is-updating":""}">
|
|
1734
|
-
<primer-vault-manager-header
|
|
1735
|
-
.isEditMode=${this.isEditMode}
|
|
1736
|
-
.hasPaymentMethods=${e}
|
|
1737
|
-
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
1738
|
-
></primer-vault-manager-header>
|
|
1739
|
-
|
|
1740
|
-
${_(this.errorMessage,()=>d`
|
|
1741
|
-
<primer-vault-error-message
|
|
1742
|
-
.errorMessage=${this.errorMessage}
|
|
1743
|
-
@close-error=${this.handleCloseError}
|
|
1744
|
-
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1745
|
-
></primer-vault-error-message>
|
|
1746
|
-
`,()=>p)}
|
|
1747
|
-
|
|
1748
|
-
<div class="vault-manager-content">
|
|
1749
|
-
${_(!r&&!e,()=>d`
|
|
1750
|
-
<div class="content-container">
|
|
1751
|
-
<primer-vault-empty-state
|
|
1752
|
-
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1753
|
-
></primer-vault-empty-state>
|
|
1754
|
-
</div>
|
|
1755
|
-
`,()=>p)}
|
|
1756
|
-
${_(!r&&e,()=>d`
|
|
1757
|
-
<div class="content-container">
|
|
1758
|
-
${_(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
1759
|
-
</div>
|
|
1760
|
-
`,()=>p)}
|
|
1761
|
-
</div>
|
|
1762
|
-
|
|
1763
|
-
${_(o,()=>this.renderLoadingOverlay(),()=>p)}
|
|
1764
|
-
</div>
|
|
1765
|
-
`}};G.styles=[v,co],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1})],G.prototype,"vaultManagerContext",2),s([x()],G.prototype,"isEditMode",2),s([x()],G.prototype,"deletePaymentMethodId",2),s([x()],G.prototype,"isDeleting",2),s([x()],G.prototype,"errorMessage",2),s([l({type:Number})],G.prototype,"animationDuration",2),G=s([h("primer-vault-manager"),S()],G);function Co(i){return i.paymentInstrumentType===Je.CARD}var Eo=c`
|
|
1766
|
-
:host {
|
|
1767
|
-
display: flex;
|
|
1768
|
-
width: 100%;
|
|
1769
|
-
flex-direction: column;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
.payment-method-wrapper {
|
|
1773
|
-
display: flex;
|
|
1774
|
-
flex-direction: column;
|
|
1775
|
-
width: 100%;
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
.payment-method-container {
|
|
1779
|
-
display: flex;
|
|
1780
|
-
width: 100%;
|
|
1781
|
-
align-items: center;
|
|
1782
|
-
gap: var(--primer-space-small);
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
/* Target the button part from primer-button using ::part selector */
|
|
1786
|
-
primer-button::part(button) {
|
|
1787
|
-
width: 100%;
|
|
1788
|
-
justify-content: flex-start;
|
|
1789
|
-
display: flex;
|
|
1790
|
-
text-align: left;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
/* Card icons */
|
|
1794
|
-
.payment-method-icon {
|
|
1795
|
-
height: var(--primer-space-xlarge);
|
|
1796
|
-
object-fit: contain;
|
|
1797
|
-
flex-shrink: 0;
|
|
1798
|
-
transition: transform var(--primer-animation-duration)
|
|
1799
|
-
var(--primer-animation-easing);
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
.payment-method-icon-generic {
|
|
1803
|
-
display: flex;
|
|
1804
|
-
align-items: center;
|
|
1805
|
-
justify-content: center;
|
|
1806
|
-
color: var(--primer-color-gray-500);
|
|
1807
|
-
height: var(--primer-space-xlarge);
|
|
1808
|
-
flex-shrink: 0;
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
.payment-method-details {
|
|
1812
|
-
flex: 1;
|
|
1813
|
-
display: flex;
|
|
1814
|
-
gap: var(--primer-space-xsmall);
|
|
1815
|
-
align-items: flex-start;
|
|
1816
|
-
transition: transform var(--primer-animation-duration)
|
|
1817
|
-
var(--primer-animation-easing);
|
|
1818
|
-
margin-left: var(--primer-space-small);
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
.payment-method-description {
|
|
1822
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
1823
|
-
color: var(--primer-color-text-primary);
|
|
1824
|
-
transition: color var(--primer-animation-duration)
|
|
1825
|
-
var(--primer-animation-easing);
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
.payment-method-secondary-description {
|
|
1829
|
-
font-size: var(--primer-typography-body-small-size);
|
|
1830
|
-
color: var(--primer-color-text-secondary);
|
|
1831
|
-
transition: color var(--primer-animation-duration)
|
|
1832
|
-
var(--primer-animation-easing);
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
.payment-method-button {
|
|
1836
|
-
flex: 1;
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
/* Delete button - for edit mode */
|
|
1840
|
-
.delete-button {
|
|
1841
|
-
background-color: transparent;
|
|
1842
|
-
border: none;
|
|
1843
|
-
color: var(--primer-color-red-500);
|
|
1844
|
-
cursor: pointer;
|
|
1845
|
-
padding: var(--primer-space-xsmall);
|
|
1846
|
-
border-radius: var(--primer-radius-small);
|
|
1847
|
-
flex-shrink: 0;
|
|
1848
|
-
display: flex;
|
|
1849
|
-
align-items: center;
|
|
1850
|
-
justify-content: center;
|
|
1851
|
-
height: var(--primer-size-medium);
|
|
1852
|
-
width: var(--primer-size-medium);
|
|
1853
|
-
margin-left: var(--primer-space-small);
|
|
1854
|
-
transition:
|
|
1855
|
-
background-color var(--primer-animation-duration)
|
|
1856
|
-
var(--primer-animation-easing),
|
|
1857
|
-
transform var(--primer-animation-duration) var(--primer-animation-easing);
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
.delete-button:hover {
|
|
1861
|
-
background-color: var(--primer-color-red-100);
|
|
1862
|
-
transform: scale(1.05);
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
.delete-button:active {
|
|
1866
|
-
transform: scale(0.95);
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
.delete-button primer-icon {
|
|
1870
|
-
color: var(--primer-color-red-500);
|
|
1871
|
-
}
|
|
1872
|
-
`;var B=class extends m{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new M(this,{task:async([e,r,o])=>{if(!e||!r||!o)return E;let a="";if(Co(e))a=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let g=await r.getCDNAssets(e.paymentMethodType);g&&(a=g.assets?.icon?`${g.goatCdnUrl}/${g.assets.icon}`:"")}let n=o.cvvRecapture,u=sr(e);return{icon:a,shouldShowCVV:n,...u}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let e=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!e&&e.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(e){let r=e.icon?d`<img
|
|
1873
|
-
class="payment-method-icon"
|
|
1874
|
-
src=${e.icon}
|
|
1875
|
-
alt=${e.description}
|
|
1876
|
-
/>`:d`
|
|
1877
|
-
<div class="payment-method-icon payment-method-icon-generic">
|
|
1878
|
-
<primer-icon name="payment-card" size="sm"></primer-icon>
|
|
1879
|
-
</div>
|
|
1880
|
-
`;return d`
|
|
1881
|
-
${r}
|
|
1882
|
-
<div class="payment-method-details">
|
|
1883
|
-
<div class="payment-method-description">${e.description}</div>
|
|
1884
|
-
${e.secondaryDescription?d`<div class="payment-method-secondary-description">
|
|
1885
|
-
${e.secondaryDescription}
|
|
1886
|
-
</div>`:p}
|
|
1887
|
-
</div>
|
|
1888
|
-
`}render(){return this._getAssetsTask.render({error:()=>p,complete:e=>{let r=this.isSelected()?"checked":"default";return d`
|
|
1889
|
-
<div class="payment-method-wrapper">
|
|
1890
|
-
<div class="payment-method-container">
|
|
1891
|
-
<primer-button
|
|
1892
|
-
variant="secondary"
|
|
1893
|
-
class="payment-method-button"
|
|
1894
|
-
selectable
|
|
1895
|
-
?disabled=${this.isEditMode}
|
|
1896
|
-
selectionState=${r}
|
|
1897
|
-
@click=${this.handleClick}
|
|
1898
|
-
>
|
|
1899
|
-
${this.renderPaymentMethodContent(e)}
|
|
1900
|
-
</primer-button>
|
|
1901
|
-
|
|
1902
|
-
${this.isEditMode?d`
|
|
1903
|
-
<button
|
|
1904
|
-
class="delete-button"
|
|
1905
|
-
@click=${this.handleDeleteClick}
|
|
1906
|
-
aria-label=${`${y("delete",{id:"delete"})} ${e.description}`}
|
|
1907
|
-
>
|
|
1908
|
-
<primer-icon name="trash" size="sm"></primer-icon>
|
|
1909
|
-
</button>
|
|
1910
|
-
`:p}
|
|
1911
|
-
</div>
|
|
1912
|
-
|
|
1913
|
-
${_(e.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>d`<primer-vault-cvv-input
|
|
1914
|
-
.paymentMethod="${this.paymentMethod}"
|
|
1915
|
-
></primer-vault-cvv-input>`,()=>p)}
|
|
1916
|
-
</div>
|
|
1917
|
-
`}})}};B.styles=[v,Eo],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],B.prototype,"vaultManagerContext",2),s([f({context:ke,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],B.prototype,"vaultItemContext",2),s([f({context:$,subscribe:!0}),l({type:Object})],B.prototype,"headlessUtils",2),s([l({type:Object,attribute:!1})],B.prototype,"paymentMethod",2),s([l({type:Boolean,reflect:!0})],B.prototype,"isEditMode",2),B=s([h("primer-vault-payment-method-item"),S()],B);var So=c`
|
|
1918
|
-
:host {
|
|
1919
|
-
display: block;
|
|
1920
|
-
width: 100%;
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
.vault-manager-header {
|
|
1924
|
-
display: flex;
|
|
1925
|
-
justify-content: space-between;
|
|
1926
|
-
align-items: center;
|
|
1927
|
-
margin-bottom: var(--primer-space-medium);
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
.vault-manager-header h3 {
|
|
1931
|
-
font-size: var(--primer-typography-title-large-size);
|
|
1932
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
1933
|
-
font-family: var(--primer-typography-title-large-font);
|
|
1934
|
-
color: var(--primer-color-text-primary);
|
|
1935
|
-
margin: 0;
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
.edit-button {
|
|
1939
|
-
display: flex;
|
|
1940
|
-
align-items: center;
|
|
1941
|
-
justify-content: center;
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
.edit-button.active {
|
|
1945
|
-
color: var(--primer-color-brand);
|
|
1946
|
-
}
|
|
1947
|
-
`;var ee=class extends m{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return d`
|
|
1948
|
-
<div class="vault-manager-header">
|
|
1949
|
-
<h3>${y("previouslyUsed",{id:"previouslyUsed"})}</h3>
|
|
1950
|
-
|
|
1951
|
-
${this.hasPaymentMethods?d`
|
|
1952
|
-
<primer-button
|
|
1953
|
-
class="edit-button ${this.isEditMode?"active":""}"
|
|
1954
|
-
@click=${this.toggleEditMode}
|
|
1955
|
-
aria-label=${this.isEditMode?y("confirm",{id:"confirm"}):y("editPaymentMethods",{id:"editPaymentMethods"})}
|
|
1956
|
-
>
|
|
1957
|
-
${this.isEditMode?d`<primer-icon name="checkmark" size="sm"></primer-icon>`:d`<primer-icon name="pencil" size="sm"></primer-icon>`}
|
|
1958
|
-
</primer-button>
|
|
1959
|
-
`:p}
|
|
1960
|
-
</div>
|
|
1961
|
-
`}};ee.styles=[v,So],s([l({type:Boolean})],ee.prototype,"isEditMode",2),s([l({type:Boolean})],ee.prototype,"hasPaymentMethods",2),ee=s([h("primer-vault-manager-header"),S()],ee);var Mo=c`
|
|
1962
|
-
:host {
|
|
1963
|
-
display: block;
|
|
1964
|
-
width: 100%;
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
.delete-confirmation {
|
|
1968
|
-
margin-top: var(--primer-space-small);
|
|
1969
|
-
padding: var(--primer-space-medium);
|
|
1970
|
-
background-color: var(--primer-color-gray-000);
|
|
1971
|
-
border: 1px solid var(--primer-color-red-500);
|
|
1972
|
-
border-radius: var(--primer-radius-medium);
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
.delete-message {
|
|
1976
|
-
margin-bottom: var(--primer-space-medium);
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
.delete-text {
|
|
1980
|
-
margin: 0;
|
|
1981
|
-
color: var(--primer-color-text-secondary);
|
|
1982
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
.delete-actions {
|
|
1986
|
-
display: flex;
|
|
1987
|
-
justify-content: flex-end;
|
|
1988
|
-
gap: var(--primer-space-small);
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
.delete-confirm {
|
|
1992
|
-
background-color: var(--primer-color-red-500);
|
|
1993
|
-
color: var(--primer-color-gray-000);
|
|
1994
|
-
border: none;
|
|
1995
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
1996
|
-
border-radius: var(--primer-radius-small);
|
|
1997
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
1998
|
-
cursor: pointer;
|
|
1999
|
-
transition: background-color var(--primer-animation-duration)
|
|
2000
|
-
var(--primer-animation-easing);
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
.delete-confirm:hover:not(:disabled) {
|
|
2004
|
-
background-color: var(--primer-color-red-900);
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
.delete-confirm:disabled {
|
|
2008
|
-
opacity: 0.7;
|
|
2009
|
-
cursor: not-allowed;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
.delete-cancel {
|
|
2013
|
-
background-color: transparent;
|
|
2014
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2015
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2016
|
-
border-radius: var(--primer-radius-small);
|
|
2017
|
-
color: var(--primer-color-text-primary);
|
|
2018
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
2019
|
-
cursor: pointer;
|
|
2020
|
-
transition: background-color var(--primer-animation-duration)
|
|
2021
|
-
var(--primer-animation-easing);
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
.delete-cancel:hover:not(:disabled) {
|
|
2025
|
-
background-color: var(--primer-color-gray-100);
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
.delete-cancel:disabled {
|
|
2029
|
-
opacity: 0.7;
|
|
2030
|
-
cursor: not-allowed;
|
|
2031
|
-
}
|
|
2032
|
-
`;var q=class extends m{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let e=this.paymentMethodName;return d`
|
|
2033
|
-
<div class="delete-confirmation">
|
|
2034
|
-
<div class="delete-message">
|
|
2035
|
-
<p class="delete-text">${e}</p>
|
|
2036
|
-
</div>
|
|
2037
|
-
<div class="delete-actions">
|
|
2038
|
-
<button
|
|
2039
|
-
class="delete-confirm"
|
|
2040
|
-
@click=${this.handleConfirmClick}
|
|
2041
|
-
?disabled=${this.isDeleting}
|
|
2042
|
-
>
|
|
2043
|
-
${this.isDeleting?y("deleting",{id:"deleting"}):y("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
|
|
2044
|
-
</button>
|
|
2045
|
-
<button
|
|
2046
|
-
class="delete-cancel"
|
|
2047
|
-
@click=${this.handleCancelClick}
|
|
2048
|
-
?disabled=${this.isDeleting}
|
|
2049
|
-
>
|
|
2050
|
-
${y("cancel",{id:"cancel"})}
|
|
2051
|
-
</button>
|
|
2052
|
-
</div>
|
|
2053
|
-
</div>
|
|
2054
|
-
`}};q.styles=[v,Mo],s([l({type:Boolean})],q.prototype,"isDeleting",2),s([l({type:String})],q.prototype,"paymentMethodId",2),s([l({type:String})],q.prototype,"paymentMethodName",2),s([f({context:U,subscribe:!0})],q.prototype,"vaultManager",2),q=s([h("primer-vault-delete-confirmation"),S()],q);var Ao=c`
|
|
2055
|
-
:host {
|
|
2056
|
-
display: block;
|
|
2057
|
-
width: 100%;
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
.empty-state {
|
|
2061
|
-
padding: var(--primer-space-xlarge) 0;
|
|
2062
|
-
text-align: center;
|
|
2063
|
-
color: var(--primer-color-text-secondary);
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
.empty-state p {
|
|
2067
|
-
margin: 0;
|
|
2068
|
-
}
|
|
2069
|
-
`;var ye=class extends m{render(){return d`
|
|
2070
|
-
<div class="empty-state">
|
|
2071
|
-
<p>
|
|
2072
|
-
${y("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
2073
|
-
</p>
|
|
2074
|
-
</div>
|
|
2075
|
-
`}};ye.styles=[v,Ao],ye=s([h("primer-vault-empty-state"),S()],ye);var _o=c`
|
|
2076
|
-
:host {
|
|
2077
|
-
display: block;
|
|
2078
|
-
width: 100%;
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
.error-message {
|
|
2082
|
-
display: flex;
|
|
2083
|
-
background-color: var(--primer-color-red-100);
|
|
2084
|
-
padding: var(--primer-space-medium);
|
|
2085
|
-
border-radius: var(--primer-radius-small);
|
|
2086
|
-
margin-bottom: var(--primer-space-medium);
|
|
2087
|
-
justify-content: space-between;
|
|
2088
|
-
align-items: center;
|
|
2089
|
-
border: 1px solid var(--primer-color-red-500);
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
.error-content {
|
|
2093
|
-
display: flex;
|
|
2094
|
-
align-items: center;
|
|
2095
|
-
gap: var(--primer-space-small);
|
|
2096
|
-
}
|
|
2097
|
-
|
|
2098
|
-
.error-message p {
|
|
2099
|
-
margin: 0;
|
|
2100
|
-
color: var(--primer-color-text-negative);
|
|
2101
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
2102
|
-
}
|
|
2103
|
-
|
|
2104
|
-
.error-message button {
|
|
2105
|
-
background: transparent;
|
|
2106
|
-
border: none;
|
|
2107
|
-
color: var(--primer-color-text-negative);
|
|
2108
|
-
cursor: pointer;
|
|
2109
|
-
padding: var(--primer-space-xsmall);
|
|
2110
|
-
display: flex;
|
|
2111
|
-
align-items: center;
|
|
2112
|
-
justify-content: center;
|
|
2113
|
-
border-radius: var(--primer-radius-small);
|
|
2114
|
-
transition: background-color var(--primer-animation-duration)
|
|
2115
|
-
var(--primer-animation-easing);
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
.error-message button:hover {
|
|
2119
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
2120
|
-
}
|
|
2121
|
-
`;var ae=class extends m{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return d`
|
|
2122
|
-
<div class="error-message">
|
|
2123
|
-
<div class="error-content">
|
|
2124
|
-
<primer-icon
|
|
2125
|
-
name="warning"
|
|
2126
|
-
size="sm"
|
|
2127
|
-
color="var(--primer-color-red-500)"
|
|
2128
|
-
></primer-icon>
|
|
2129
|
-
<p>${this.errorMessage}</p>
|
|
2130
|
-
</div>
|
|
2131
|
-
<button
|
|
2132
|
-
@click=${this.handleDismiss}
|
|
2133
|
-
aria-label=${y("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2134
|
-
>
|
|
2135
|
-
<primer-icon name="close" size="sm"></primer-icon>
|
|
2136
|
-
</button>
|
|
2137
|
-
</div>
|
|
2138
|
-
`}};ae.styles=[v,_o],s([l({type:String})],ae.prototype,"errorMessage",2),ae=s([h("primer-vault-error-message"),S()],ae);var Po=c`
|
|
2139
|
-
:host {
|
|
2140
|
-
display: contents;
|
|
2141
|
-
}
|
|
2142
|
-
`;var I=class extends m{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async e=>{if(e.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:y("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:p;return d`
|
|
2143
|
-
<primer-button
|
|
2144
|
-
buttonType="submit"
|
|
2145
|
-
variant=${this.variant}
|
|
2146
|
-
@click=${this.handleClick}
|
|
2147
|
-
.disabled=${this.isButtonDisabled}
|
|
2148
|
-
.loading=${this.sdkState?.isProcessing}
|
|
2149
|
-
data-submit
|
|
2150
|
-
>
|
|
2151
|
-
${this.buttonText}${r}
|
|
2152
|
-
</primer-button>
|
|
2153
|
-
`}};I.styles=[v,Po],s([l({type:String})],I.prototype,"buttonText",1),s([f({context:$,subscribe:!0}),l({type:Object})],I.prototype,"headlessInstance",2),s([f({context:T,subscribe:!0}),l()],I.prototype,"sdkState",2),s([f({context:ke,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],I.prototype,"vaultItemContext",2),s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1})],I.prototype,"vaultManager",2),s([f({context:_e,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],I.prototype,"clientOptions",2),s([l({type:String})],I.prototype,"variant",2),s([l({type:Boolean})],I.prototype,"disabled",2),I=s([h("primer-vault-payment-submit"),S()],I);function mr(i){return i?{paddingHorizontal:0,placeholder:{color:i.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim()},height:i.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim(),color:i.getPropertyValue("--primer-color-text-primary").trim()}:null}var ko=c`
|
|
2154
|
-
:host {
|
|
2155
|
-
display: block;
|
|
2156
|
-
margin-top: var(--primer-space-medium);
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
|
-
.cvv-input-container {
|
|
2160
|
-
margin-bottom: var(--primer-space-medium);
|
|
2161
|
-
}
|
|
2162
|
-
`;var N=class extends m{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new M(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===null?E:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new M(this,{task:async([e])=>{if(!e)return E;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=mr(this.computedStyles),a=o?{input:{base:o}}:void 0,n={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:a};this.cvvInput=await e.createCvvInput?.(n)??null,this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>p,complete:()=>d`
|
|
2163
|
-
<div class="cvv-input-container">
|
|
2164
|
-
<primer-input-wrapper
|
|
2165
|
-
.hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
|
|
2166
|
-
>
|
|
2167
|
-
<primer-input-label slot="label">CVV</primer-input-label>
|
|
2168
|
-
<div slot="input" id="${this.cvvContainerId}"></div>
|
|
2169
|
-
${_(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>d`
|
|
2170
|
-
<primer-input-error slot="error">
|
|
2171
|
-
${this.cvvError}
|
|
2172
|
-
</primer-input-error>
|
|
2173
|
-
`)}
|
|
2174
|
-
</primer-input-wrapper>
|
|
2175
|
-
</div>
|
|
2176
|
-
`})}};N.styles=[v,ko],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],N.prototype,"vaultManagerFormContext",2),s([f({context:ke,subscribe:!0}),l({type:Object,attribute:!1})],N.prototype,"vaultManagerCvvContext",2),s([f({context:Pe,subscribe:!0}),l()],N.prototype,"computedStyles",2),s([l({type:Object})],N.prototype,"paymentMethod",2),s([x()],N.prototype,"cvvError",2),s([x()],N.prototype,"cvvInputIsDirty",2),s([x()],N.prototype,"cvvInputIsBlurred",2),s([x()],N.prototype,"cvvInput",2),N=s([h("primer-vault-cvv-input"),S()],N);var hr="card-form-context";var wo=c`
|
|
2177
|
-
:host {
|
|
2178
|
-
display: contents;
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
form {
|
|
2182
|
-
display: flex;
|
|
2183
|
-
flex-direction: column;
|
|
2184
|
-
gap: var(--primer-space-medium);
|
|
2185
|
-
width: 100%;
|
|
2186
|
-
}
|
|
2187
|
-
|
|
2188
|
-
.card-form {
|
|
2189
|
-
display: flex;
|
|
2190
|
-
flex-direction: column;
|
|
2191
|
-
gap: var(--primer-space-medium);
|
|
2192
|
-
margin-bottom: var(--primer-space-medium);
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
.card-form-row {
|
|
2196
|
-
display: flex;
|
|
2197
|
-
gap: var(--primer-space-small);
|
|
2198
|
-
}
|
|
2199
|
-
`;var te=class extends m{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new L(this,{context:hr,initialValue:null});this.eventsController=new Xe(this);this.setupCardFormTask=new M(this,{task:async([e])=>{if(!e?.manager)return E;let{manager:r}=e,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:u=>r.setCardholderName(u),setCardNetwork:u=>{this.selectedCardNetwork=u},validate:()=>r.validate(),submit:u=>r.submit(u),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}updated(e){super.updated(e),e.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),o=r==="button",a=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||a&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===Te.ERROR||this.setupCardFormTask.status===Te.INITIAL?p:d`
|
|
2200
|
-
<form @submit=${this.handleFormSubmit}>
|
|
2201
|
-
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
2202
|
-
${this.setupCardFormTask.render({complete:()=>_(this.hasAssignedContent,()=>p,()=>d`
|
|
2203
|
-
<div class="card-form">
|
|
2204
|
-
<primer-input-card-number></primer-input-card-number>
|
|
2205
|
-
<div class="card-form-row">
|
|
2206
|
-
<primer-input-card-expiry></primer-input-card-expiry>
|
|
2207
|
-
<primer-input-cvv></primer-input-cvv>
|
|
2208
|
-
</div>
|
|
2209
|
-
<primer-input-card-holder-name></primer-input-card-holder-name>
|
|
2210
|
-
</div>
|
|
2211
|
-
<primer-card-form-submit></primer-card-form-submit>
|
|
2212
|
-
`)})}
|
|
2213
|
-
</form>
|
|
2214
|
-
`}};te.styles=[v,wo],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],te.prototype,"hideLabels",2),s([x()],te.prototype,"hasAssignedContent",2),s([x()],te.prototype,"selectedCardNetwork",2),s([f({context:Y,subscribe:!0}),l({type:Object})],te.prototype,"paymentManagers",2),te=s([h("primer-card-form"),S()],te);function To(i,t){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
|
|
148
|
+
`;var na=':root,primer-checkout{--primer-color-background-transparent-default:rgba(255,255,255,0);--primer-color-border-transparent-default:rgba(255,255,255,0);--primer-color-gray-100:#f5f5f5;--primer-color-gray-200:#eeeeee;--primer-color-gray-300:#e0e0e0;--primer-color-gray-400:#bdbdbd;--primer-color-gray-500:#9e9e9e;--primer-color-gray-600:#757575;--primer-color-gray-900:#212121;--primer-color-gray-000:#ffffff;--primer-color-brand:#2f98ff;--primer-color-red-100:#ffecec;--primer-color-red-500:#ff7279;--primer-color-red-900:#b4324b;--primer-color-blue-500:#399dff;--primer-color-blue-900:#2270f4;--primer-radius-base:4px;--primer-typography-brand:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;--primer-typography-title-xlarge-letter-spacing:-0.6px;--primer-typography-title-xlarge-weight:550;--primer-typography-title-xlarge-size:24px;--primer-typography-title-xlarge-line-height:32px;--primer-typography-title-large-letter-spacing:-0.2px;--primer-typography-title-large-weight:550;--primer-typography-title-large-size:16px;--primer-typography-title-large-line-height:20px;--primer-typography-body-large-letter-spacing:-0.2px;--primer-typography-body-large-weight:400;--primer-typography-body-large-size:16px;--primer-typography-body-large-line-height:20px;--primer-typography-body-medium-letter-spacing:0px;--primer-typography-body-medium-weight:400;--primer-typography-body-medium-size:14px;--primer-typography-body-medium-line-height:20px;--primer-typography-body-small-letter-spacing:0px;--primer-typography-body-small-weight:400;--primer-typography-body-small-size:12px;--primer-typography-body-small-line-height:16px;--primer-space-base:4px;--primer-size-base:4px;--primer-animation-duration:200ms;--primer-animation-easing:cubic-bezier(0.44,0,0.4,1);--primer-color-background-outlined-default:var(--primer-color-gray-000);--primer-color-background-outlined-disabled:var(--primer-color-gray-100);--primer-color-background-transparent-hover:var(--primer-color-gray-100);--primer-color-background-transparent-active:var(--primer-color-gray-200);--primer-color-background-transparent-loading:var(--primer-color-gray-100);--primer-color-background-transparent-focus:var(--primer-color-background-transparent-default);--primer-color-background-transparent-disabled:var(--primer-color-gray-100);--primer-color-background-transparent-selected:var(--primer-color-gray-100);--primer-color-text-primary:var(--primer-color-gray-900);--primer-color-text-placeholder:var(--primer-color-gray-500);--primer-color-text-disabled:var(--primer-color-gray-400);--primer-color-text-negative:var(--primer-color-red-900);--primer-color-text-link:var(--primer-color-blue-900);--primer-color-text-secondary:var(--primer-color-gray-600);--primer-color-border-outlined-default:var(--primer-color-gray-300);--primer-color-border-outlined-hover:var(--primer-color-gray-400);--primer-color-border-outlined-active:var(--primer-color-gray-500);--primer-color-border-outlined-disabled:var(--primer-color-gray-200);--primer-color-border-outlined-loading:var(--primer-color-gray-200);--primer-color-border-outlined-selected:var(--primer-color-brand);--primer-color-border-outlined-error:var(--primer-color-red-500);--primer-color-border-transparent-hover:var(--primer-color-border-transparent-default);--primer-color-border-transparent-active:var(--primer-color-border-transparent-default);--primer-color-border-transparent-disabled:var(--primer-color-border-transparent-default);--primer-color-border-transparent-selected:var(--primer-color-border-transparent-default);--primer-color-icon-primary:var(--primer-color-gray-900);--primer-color-icon-disabled:var(--primer-color-gray-400);--primer-color-icon-negative:var(--primer-color-red-500);--primer-color-focus:var(--primer-color-brand);--primer-color-loader:var(--primer-color-brand);--primer-radius-medium:8px;--primer-radius-small:4px;--primer-radius-large:12px;--primer-radius-xsmall:2px;--primer-typography-title-xlarge-font:var(--primer-typography-brand);--primer-typography-title-large-font:var(--primer-typography-brand);--primer-typography-body-large-font:var(--primer-typography-brand);--primer-typography-body-medium-font:var(--primer-typography-brand);--primer-typography-body-small-font:var(--primer-typography-brand);--primer-space-xxsmall:2px;--primer-space-xsmall:4px;--primer-space-small:8px;--primer-space-medium:12px;--primer-space-large:16px;--primer-space-xlarge:20px;--primer-size-small:16px;--primer-size-medium:20px;--primer-size-large:24px;--primer-size-xlarge:32px;--primer-size-xxlarge:40px;--primer-size-xxxlarge:56px;--primer-color-background-outlined-focus:var(--primer-color-background-outlined-default);--primer-color-background-outlined-loading:var(--primer-color-background-outlined-disabled);--primer-color-background-outlined-active:var(--primer-color-background-outlined-default);--primer-color-background-outlined-hover:var(--primer-color-background-outlined-default);--primer-color-background-outlined-selected:var(--primer-color-background-outlined-default);--primer-color-background-outlined-error:var(--primer-color-background-outlined-default);--primer-color-border-outlined-focus:var(--primer-color-focus);--primer-color-border-transparent-focus:var(--primer-color-focus);--primer-color-border-transparent-loading:var(--primer-color-border-transparent-disabled)}',sa=":root,primer-checkout.primer-dark-theme{--primer-color-gray-100:#292929;--primer-color-gray-200:#424242;--primer-color-gray-300:#575757;--primer-color-gray-400:#858585;--primer-color-gray-500:#767577;--primer-color-gray-600:#c7c7c7;--primer-color-gray-900:#efefef;--primer-color-gray-000:#171619;--primer-color-brand:#2f98ff;--primer-color-red-100:#321c20;--primer-color-red-500:#e46d70;--primer-color-red-900:#f6bfbf;--primer-color-blue-500:#3f93e4;--primer-color-blue-900:#4aaeff}";var Zs="primer-light-theme-css",Xs="primer-dark-theme-css";function wi(){Ft(na,Zs,!0)}function Mi(){Ft(sa,Xs,!0)}function la(){wi(),Mi()}function da(){Ft(aa,"primer-css-loader-styles",!1)}function ca(){la()}function Qs(){wi()}function el(){Mi()}var pa=y` :host { display: inline-flex; align-items: center; justify-content: center; } .spinner-container { display: flex; align-items: center; justify-content: center; width: var(--spinner-size, var(--primer-size-medium)); height: var(--spinner-size, var(--primer-size-medium)); } .spinner-container:not(.compact) { margin: var(--primer-space-small) 0; } .spinner-container.compact { margin: 0; } .spinner { animation: spinner-rotate 1.2s linear infinite; width: 100%; height: 100%; color: var(--spinner-color, var(--primer-color-loader)); } .path { fill: currentColor; transform-origin: center; transition: fill var(--primer-animation-duration, 200ms) var(--primer-animation-easing, ease); } @keyframes spinner-rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } `;var Ti={small:16,medium:24,large:32},ye=class extends g{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ti)return Ti[this.size];let e=parseInt(this.size,10);return isNaN(e)?Ti.medium:e}render(){let e=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),p`<div class="spinner-container ${this.compact?"compact":""}"><svg class="spinner" width="${e}" height="${e}" viewBox="${o}" fill="none" xmlns="http://www.w3.org/2000/svg" role="status" aria-label="Loading" ><path d="M4.27827 10.002C4.27827 6.84166 6.84019 4.27973 10.0005 4.27973C10.7676 4.27973 11.3894 3.6579 11.3894 2.89084C11.3894 2.12378 10.7676 1.50195 10.0005 1.50195C5.30607 1.50195 1.50049 5.30753 1.50049 10.002C1.50049 14.6964 5.30607 18.502 10.0005 18.502C14.6949 18.502 18.5005 14.6964 18.5005 10.002C18.5005 9.23489 17.8787 8.61306 17.1116 8.61306C16.3445 8.61306 15.7227 9.23489 15.7227 10.002C15.7227 13.1622 13.1608 15.7242 10.0005 15.7242C6.84019 15.7242 4.27827 13.1622 4.27827 10.002Z" fill="currentColor" class="path" /></svg></div>`}};ye.styles=[pa],s([c({type:String})],ye.prototype,"color",2),s([c({type:String})],ye.prototype,"size",2),s([c({type:Boolean})],ye.prototype,"compact",2),ye=s([v("primer-spinner")],ye);var Ke={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Te=i=>(...t)=>({_$litDirective$:i,values:t}),Ct=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var q=Te(class extends Ct{constructor(i){if(super(i),i.type!==Ke.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=i.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let o=!!t[r];o===this.st.has(r)||this.nt?.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return we}});var ma=y` * { box-sizing: border-box; } :host { display: block; width: 100%; } .input-slot.focus-within, .input-slot:focus-within { outline: 2px solid var(--primer-color-border-outlined-focus); outline-offset: -2px; } :host([has-error]) .input-slot.focus-within, :host([has-error]) .input-slot:focus-within { outline: 2px solid var(--primer-color-border-outlined-error); background-color: var(--primer-color-background-outlined-error); } :host([has-error]) .input-slot { border-color: var(--primer-color-border-outlined-error); background-color: var(--primer-color-background-outlined-error); } .input-wrapper { display: flex; flex-direction: column; gap: var(--primer-space-xsmall); } .input-slot { padding: var(--primer-space-medium) var(--primer-space-medium); border: 1px solid var(--primer-color-border-outlined-default); border-radius: var(--primer-radius-small); background-color: var(--primer-color-background-outlined-default); height: calc( var(--primer-typography-body-large-line-height) + var(--primer-space-medium) + var(--primer-space-medium) + 2px ); display: flex; cursor: text; /* Indicate text input interactivity */ /* 2px is the border width */ } .input-slot ::slotted(*) { width: 100%; } .input-slot:hover { border-color: var(--primer-color-border-outlined-hover); background-color: var(--primer-color-background-outlined-hover); } .input-slot:active { border-color: var(--primer-color-border-outlined-active); background-color: var(--primer-color-background-outlined-active); } .input-slot:disabled { background-color: var(--primer-color-background-outlined-disabled); border-color: var(--primer-color-border-outlined-disabled); cursor: not-allowed; } `;var ge=class extends g{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1;this.handleWrapperClick=e=>{if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of e){let a=o.querySelector("primer-input");if(a)return a}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return p`<div class="input-wrapper"><slot name="label"></slot><div class="${q(e)}" @click="${this.handleWrapperClick}"><slot name="input"></slot></div><slot name="error"></slot></div>`}};ge.styles=[ma],s([c({type:Boolean})],ge.prototype,"focusWithin",2),s([c({type:Boolean,reflect:!0,attribute:"has-error"})],ge.prototype,"hasError",2),s([je('slot[name="input"]')],ge.prototype,"inputSlot",2),ge=s([v("primer-input-wrapper")],ge);var ua=y` :host { display: inline-block; font-weight: var(--primer-typography-body-small-weight); font-size: var(--primer-typography-body-small-size); letter-spacing: var(--primer-typography-body-small-letter-spacing); line-height: var(--primer-typography-body-small-line-height); color: var(--primer-color-text-primary); font-family: var(--primer-typography-body-small-font); } :host([disabled]) { color: var(--primer-color-text-disabled); } `;var ke=class extends g{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return p`<label for=${this.for}><slot></slot></label>`}};ke.styles=[ua],s([c({type:String,reflect:!0})],ke.prototype,"for",2),s([c({type:Boolean,reflect:!0})],ke.prototype,"disabled",2),ke=s([v("primer-input-label")],ke);var ha=y` :host { display: contents; } button { align-items: center; border-radius: var(--primer-radius-medium); border: none; cursor: pointer; display: flex; font-family: var(--primer-typography-title-large-font); font-size: var(--primer-typography-title-large-size); font-weight: var(--primer-typography-title-large-weight); gap: var(--primer-space-small); justify-content: center; letter-spacing: var(--primer-typography-title-large-letter-spacing); line-height: var(--primer-typography-title-large-line-height); outline: none; padding: var(--primer-space-medium) var(--primer-space-medium); position: relative; } .button-content { display: flex; height: 100%; width: 100%; align-items: center; gap: var(--primer-space-small); justify-content: center; transition: opacity var(--primer-animation-duration) var(--primer-animation-easing); } .button-content-base { width: 100%; height: 100%; gap: var(--primer-space-small); transition: opacity var(--primer-animation-duration) var(--primer-animation-easing); } /* Reduce opacity of text during loading for better focus on the spinner */ .button-content.loading { opacity: 0.65; } :host([selectable]) button { justify-content: space-between; } /* Primary variant */ :host([variant='primary']) button { background-color: var(--primer-color-brand); /* This is correct (color-background for color) because Button is kind of a special component */ color: var(--primer-color-background-outlined-default); } :host([variant='primary']:not([disabled]):not([loading])) button:hover { filter: brightness(105%); } :host([variant='primary']:not([disabled]):not([loading])) button:active { filter: brightness(98%); } :host([variant='primary']) button:focus-visible { outline: 2px solid var(--primer-color-brand); outline-offset: 2px; } /* Disabled state for primary button */ :host([variant='primary'][disabled]:not([loading])) button, :host([variant='primary']:not([loading])) button:disabled { color: var(--primer-color-text-disabled); background-color: var(--primer-color-background-outlined-disabled); cursor: not-allowed; } /* Loading state for primary button - OVERRIDES disabled styles with higher specificity */ :host([variant='primary'][loading]) button { background-color: var(--primer-color-brand); opacity: 0.8; color: var(--primer-color-background-outlined-default); cursor: wait; } /* Secondary variant */ :host([variant='secondary']) button { background-color: var(--primer-color-background-outlined-default); color: var(--primer-color-text-primary); border: 1px solid var(--primer-color-border-outlined-default); } :host([variant='secondary']:not([disabled]):not([loading])) button:hover { background-color: var(--primer-color-background-outlined-hover); } :host([variant='secondary']:not([disabled]):not([loading])) button:active { background-color: var(--primer-color-background-outlined-active); } :host([variant='secondary']) button:focus-visible { outline: 2px solid var(--primer-color-border-outlined-focus); outline-offset: 2px; } /* Disabled state for secondary button */ :host([variant='secondary'][disabled]:not([loading])) button, :host([variant='secondary']:not([loading])) button:disabled { background-color: var(--primer-color-background-outlined-disabled); border-color: var(--primer-color-border-outlined-disabled); color: var(--primer-color-text-disabled); cursor: not-allowed; } /* Loading state for secondary button - OVERRIDES disabled styles */ :host([variant='secondary'][loading]) button { background-color: var(--primer-color-gray-100); border-color: var(--primer-color-gray-300); color: var(--primer-color-gray-600); cursor: wait; } /* Tertiary variant */ :host([variant='tertiary']) button { background-color: var(--primer-color-background-transparent-default); border: 1px solid var(--primer-color-border-transparent-default); color: var(--primer-color-text-primary); border-radius: var(--primer-radius-small); padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall); } :host([variant='tertiary']:not([disabled]):not([loading])) button:hover { border-radius: var(--primer-radius-small); background-color: var(--primer-color-background-transparent-hover); border: 1px solid var(--primer-color-border-transparent-hover); color: var(--primer-color-text-primary); } :host([variant='tertiary']:not([disabled]):not([loading])) button:active { background-color: var(--primer-color-background-transparent-active); border-color: var(--primer-color-border-transparent-active); border-radius: var(--primer-radius-small); color: var(--primer-color-text-primary); } :host([variant='tertiary']) button:focus-visible { border-radius: var(--primer-radius-small); background-color: var(--primer-color-background-transparent-focus); outline: 2px solid var(--primer-color-border-transparent-focus); outline-offset: 2px; } /* Disabled state for tertiary button */ :host([variant='tertiary'][disabled]:not([loading])) button, :host([variant='tertiary']:not([loading])) button:disabled { background-color: var(--primer-color-border-transparent-disabled); color: var(--primer-color-text-disabled); cursor: not-allowed; } /* Loading state for tertiary button - OVERRIDES disabled styles */ :host([variant='tertiary'][loading]) button { background-color: var(--primer-color-gray-100); color: var(--primer-color-gray-600); cursor: wait; } /* Checked state styling */ :host([selectionState='checked']) button { border: 2px solid var(--primer-color-brand); background-color: var(--primer-color-gray-100); } /* Loading state - center spinner with content */ :host([loading]) primer-spinner { margin-right: var(--primer-space-xsmall); } /* Special case for tertiary variant loading state spinner size */ :host([variant='tertiary'][loading]) primer-spinner { transform: scale(0.85); } `;var Q=class extends g{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1;this.flex=!0;this.handleClick=()=>{!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?u:p`<primer-icon name="checkmark" size="sm" color="var(--primer-color-brand)" ></primer-icon>`}renderSpinner(){if(!this.loading)return u;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),p`<primer-spinner size="small" color="${e}" compact ></primer-spinner>`}render(){return p`<button type=${this.buttonType} ?disabled=${this.disabled||this.loading} @click=${this.handleClick} part="button" aria-checked=${this.selectionState==="checked"} aria-busy=${this.loading} >${this.renderSpinner()} ${this.flex?p`<span class="button-content ${this.loading?"loading":""}"><slot></slot></span>`:p`<span class="button-content-base ${this.loading?"loading":""}" ><slot></slot></span>`} ${this.renderCheckmark()}</button>`}};Q.styles=[E,ha],s([c({type:String,reflect:!0})],Q.prototype,"variant",2),s([c({type:Boolean,reflect:!0})],Q.prototype,"disabled",2),s([c({type:Boolean,reflect:!0})],Q.prototype,"loading",2),s([c({type:String,attribute:"type"})],Q.prototype,"buttonType",2),s([c({type:String,reflect:!0})],Q.prototype,"selectionState",2),s([c({type:Boolean,reflect:!0})],Q.prototype,"selectable",2),s([c({type:Boolean,reflect:!0})],Q.prototype,"flex",2),Q=s([v("primer-button")],Q);var fa=y` :host { display: contents; } :host(:not([active])) { display: none; } .error { color: var(--primer-color-text-negative); font-size: var(--primer-typography-body-small-size); line-height: var(--primer-typography-body-small-line-height); display: block; font-family: var(--primer-typography-body-small-font); } `;var Ie=class extends g{constructor(){super(...arguments);this.for="";this.active=!0}render(){return p`<span class="error" role="alert" aria-live="polite" id="${this.for||""}" ><slot></slot></span>`}};Ie.styles=[fa],s([c({type:String,reflect:!0})],Ie.prototype,"for",2),s([c({type:Boolean,reflect:!0})],Ie.prototype,"active",2),Ie=s([v("primer-input-error")],Ie);var ya={trash:he`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.8333 2.99992H11.5V2.49992C11.5 2.05789 11.3244 1.63397 11.0118 1.32141C10.6993 1.00885 10.2754 0.833252 9.83333 0.833252H6.16667C5.72464 0.833252 5.30072 1.00885 4.98816 1.32141C4.67559 1.63397 4.5 2.05789 4.5 2.49992V2.99992H2.16667C1.98986 2.99992 1.82029 3.07015 1.69526 3.19518C1.57024 3.32021 1.5 3.48978 1.5 3.66659C1.5 3.8434 1.57024 4.01297 1.69526 4.138C1.82029 4.26302 1.98986 4.33326 2.16667 4.33326H2.83333V12.4999C2.83333 12.942 3.00893 13.3659 3.32149 13.6784C3.63405 13.991 4.05797 14.1666 4.5 14.1666H11.5C11.942 14.1666 12.3659 13.991 12.6785 13.6784C12.9911 13.3659 13.1667 12.942 13.1667 12.4999V4.33326H13.8333C14.0101 4.33326 14.1797 4.26302 14.3047 4.138C14.4298 4.01297 14.5 3.8434 14.5 3.66659C14.5 3.48978 14.4298 3.32021 14.3047 3.19518C14.1797 3.07015 14.0101 2.99992 13.8333 2.99992ZM5.83333 2.49992C5.83333 2.32311 5.90357 2.15354 6.0286 2.02851C6.15362 1.90349 6.32319 1.83325 6.5 1.83325H9.5C9.67681 1.83325 9.84638 1.90349 9.9714 2.02851C10.0964 2.15354 10.1667 2.32311 10.1667 2.49992V2.99992H5.83333V2.49992ZM11.8333 12.4999C11.8333 12.6767 11.7631 12.8463 11.6381 12.9713C11.513 13.0964 11.3435 13.1666 11.1667 13.1666H4.83333C4.65652 13.1666 4.48695 13.0964 4.36193 12.9713C4.2369 12.8463 4.16667 12.6767 4.16667 12.4999V4.33326H11.8333V12.4999Z" fill="currentColor"/><path d="M6.5 10.9999C6.67681 10.9999 6.84638 10.9297 6.9714 10.8047C7.09643 10.6796 7.16667 10.5101 7.16667 10.3333V7.33325C7.16667 7.15644 7.09643 6.98687 6.9714 6.86184C6.84638 6.73682 6.67681 6.66658 6.5 6.66658C6.32319 6.66658 6.15362 6.73682 6.0286 6.86184C5.90357 6.98687 5.83333 7.15644 5.83333 7.33325V10.3333C5.83333 10.5101 5.90357 10.6796 6.0286 10.8047C6.15362 10.9297 6.32319 10.9999 6.5 10.9999Z" fill="currentColor"/><path d="M9.5 10.9999C9.67681 10.9999 9.84638 10.9297 9.9714 10.8047C10.0964 10.6796 10.1667 10.5101 10.1667 10.3333V7.33325C10.1667 7.15644 10.0964 6.98687 9.9714 6.86184C9.84638 6.73682 9.67681 6.66658 9.5 6.66658C9.32319 6.66658 9.15362 6.73682 9.0286 6.86184C8.90357 6.98687 8.83333 7.15644 8.83333 7.33325V10.3333C8.83333 10.5101 8.90357 10.6796 9.0286 10.8047C9.15362 10.9297 9.32319 10.9999 9.5 10.9999Z" fill="currentColor"/></svg>`,"successful-check":he`<svg viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg" ><g id="icon/check-circle-large"><path id="vector" fill-rule="evenodd" clip-rule="evenodd" d="M20.1762 29.5746L24.8429 34.2413C25.295 34.7007 26.0387 34.7007 26.4908 34.2413L35.8241 24.9079C36.2835 24.4559 36.2835 23.7121 35.8241 23.26C35.372 22.8007 34.6283 22.8007 34.1762 23.26L25.6668 31.7694L21.8241 27.9267C21.372 27.4673 20.6283 27.4673 20.1762 27.9267C19.7168 28.3788 19.7168 29.1225 20.1762 29.5746ZM28.0002 47.4173C38.3106 47.4173 46.6668 39.0611 46.6668 28.7507C46.6668 18.4402 38.3106 10.084 28.0002 10.084C17.6897 10.084 9.3335 18.4402 9.3335 28.7507C9.3335 39.0611 17.6897 47.4173 28.0002 47.4173Z" /></g></svg>`,"failure-icon":he`<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" ><path fill-rule="evenodd" clip-rule="evenodd" d="M20.0008 23.3333C20.4614 23.3333 20.7873 22.9606 20.7873 22.5V15C20.7873 14.5394 20.4146 14.1666 20.0008 14.1666C19.587 14.1666 19.1675 14.5416 19.1675 15V22.5C19.1675 22.9583 19.5425 23.3333 20.0008 23.3333ZM32.9331 27.3594L22.5269 9.75935C22.0008 8.86821 21.0529 8.33488 20.0008 8.33331C18.9487 8.33331 18.006 8.8656 17.4748 9.75831L7.06331 27.3625C6.53987 28.2463 6.53206 29.3073 7.04134 30.201C7.568 31.1198 8.51904 31.6666 9.58935 31.6666H30.4175C31.4857 31.6666 32.4357 31.1182 32.9597 30.1995C33.4696 29.3073 33.4591 28.2448 32.9331 27.3594ZM18.7977 26.6666C18.7977 25.976 19.3107 25.4166 20.0008 25.4166C20.6935 25.4166 21.2508 25.9739 21.2039 26.6666C21.2039 27.3568 20.6909 27.9166 20.0008 27.9166C19.3576 27.9166 18.7977 27.3568 18.7977 26.6666Z" /></svg>`,"payment-card":he`<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg"><rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/><rect y="6.74805" width="28" height="4" fill="#212121"/><rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/></svg>`,"chevron-down":he`<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.41978 4.90118C4.32079 5.02361 4.16188 5.08353 4.00037 5.08353C3.83887 5.08353 3.67996 5.02361 3.55753 4.90118L0.63995 1.9836C0.395733 1.73939 0.395733 1.34382 0.63995 1.09947C0.884167 0.855124 1.27973 0.855254 1.52408 1.09947L4.00037 3.57524L6.47589 1.09973C6.72011 0.855515 7.11567 0.855515 7.36002 1.09973C7.60437 1.34395 7.60424 1.73952 7.36002 1.98386L4.41978 4.90118Z" fill="#212121"/></svg>`,checkmark:he`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" /></svg>`,close:he`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M14.7551 13.734C15.0479 14.0269 15.0479 14.502 14.7551 14.7949C14.4622 15.0879 13.987 15.0878 13.6941 14.7949L10.0005 11.0738L6.28054 14.7937C5.98767 15.0866 5.51249 15.0866 5.21959 14.7937C4.92668 14.5008 4.92671 14.0256 5.21959 13.7327L8.94075 10.0141L5.21856 6.26604C4.92568 5.97316 4.92568 5.49798 5.21856 5.20508C5.51143 4.91217 5.98661 4.91221 6.27951 5.20508L10.0005 8.95438L13.7204 5.23446C14.0132 4.94159 14.4884 4.94159 14.7813 5.23446C15.0742 5.52734 15.0742 6.00252 14.7813 6.29542L11.0602 10.0141L14.7551 13.734Z" fill="#212121" /></svg>`,edit:he`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.9355 3.19972C11.7814 2.35335 13.1541 2.35335 13.9999 3.19972L14.3642 3.56456C15.21 4.41103 15.21 5.78338 14.3642 6.62925L8.42804 12.5684C8.16615 12.8272 7.84406 13.0169 7.48886 13.1192L4.47866 13.9802C4.2258 14.0524 3.95489 13.9802 3.76825 13.7694C3.58463 13.6099 3.51239 13.339 3.58463 13.0861L4.44555 10.0759C4.5479 9.72072 4.73754 9.39863 4.99642 9.13674L10.9355 3.19972ZM12.9524 4.22139C12.6965 3.93933 12.239 3.93933 11.956 4.22139L11.08 5.09705L12.4677 6.48476L13.3437 5.5817C13.6267 5.32583 13.6267 4.86828 13.3437 4.58622L12.9524 4.22139ZM5.83626 10.4733L5.33055 12.2342L7.09151 11.7285C7.21192 11.6954 7.31728 11.6322 7.40458 11.5449L11.4473 7.50521L10.0596 6.11751L6.01988 10.1602C5.93259 10.2475 5.86937 10.3529 5.83626 10.4733Z" fill="#212121"/><path d="M3.5 16.7126C3.5 16.3138 3.82335 15.9904 4.22222 15.9904H15.7778C16.1767 15.9904 16.5 16.3138 16.5 16.7126C16.5 17.1115 16.1767 17.4349 15.7778 17.4349H4.22222C3.82335 17.4349 3.5 17.1115 3.5 16.7126Z" fill="#212121"/></svg>`,lock:he`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.91621 7.08223V8.33262H12.0842V7.08223C12.0842 5.93082 11.1516 4.99824 10.0002 4.99824C8.84879 4.99824 7.91621 5.93082 7.91621 7.08223ZM6.24902 8.33262V7.08223C6.24902 5.01127 7.92924 3.33105 10.0002 3.33105C12.0712 3.33105 13.7514 5.01127 13.7514 7.08223V8.33262H14.1682C15.0877 8.33262 15.8354 9.08025 15.8354 9.9998V15.0014C15.8354 15.9209 15.0877 16.6686 14.1682 16.6686H5.83223C4.91267 16.6686 4.16504 15.9209 4.16504 15.0014V9.9998C4.16504 9.08025 4.91267 8.33262 5.83223 8.33262H6.24902Z" fill="#212121" fill-opacity="0.62"/></svg>`};var ga=y` :host { display: inline-block; line-height: 0; /* so you don’t get extra space around the icon */ } /* Styling svgs rendered by passing *name* attribute - from our library file */ :host([size='sm']) svg { width: 20px; height: 20px; } :host([size='md']) svg { width: 42px; height: 42px; } :host([size='lg']) svg { width: 56px; height: 56px; } svg { /* --internal used for abstracting away the icon component */ fill: var(--internal-icon-color, currentColor); } /* For slotted icons */ :host([size='sm']) ::slotted(svg) { width: 20px; height: 20px; } :host([size='lg']) ::slotted(svg) { width: 56px; height: 56px; } ::slotted(svg) { /* --internal used for abstracting away the icon component */ fill: var(--internal-icon-color, currentColor); } `;var ve=class extends g{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?ya[this.name]:null;return p`<div style="--internal-icon-color: ${this.color}">${e||p`<slot></slot>`}</div>`}};ve.styles=[ga],s([c({type:String,reflect:!0})],ve.prototype,"color",2),s([c({type:String,reflect:!0})],ve.prototype,"size",2),s([c({reflect:!0})],ve.prototype,"name",2),ve=s([v("primer-icon")],ve);var va=y` :host { display: flex; flex-direction: column; align-items: center; gap: var(--primer-space-xsmall); } p { margin: 0; color: var(--primer-color-text-primary); text-align: center; font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); font-weight: var(--primer-typography-body-large-weight); line-height: var(--primer-typography-body-large-line-height); letter-spacing: var(--primer-typography-body-large-letter-spacing); } p.secondary { color: var(--primer-color-text-secondary); text-align: center; font-family: var(--primer-typography-body-medium-font, Inter); font-size: var(--primer-typography-body-medium-size); font-weight: var(--primer-typography-body-medium-weight); line-height: var(--primer-typography-body-medium-line-height); letter-spacing: var(--primer-typography-body-medium-letter-spacing); } `;var Le=class extends g{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?p`<primer-icon size="lg" name="successful-check" color="var(--primer-color-icon-positive)" ></primer-icon><p>Checkout complete!</p><p class="secondary"> You'll be redirected to the order confirmation page soon. </p>`:p`<primer-icon size="lg" name="failure-icon" color="var(--primer-color-icon-negative)" ></primer-icon><p>Payment failed</p>${this.description?p`<p class="secondary">${this.description}</p>`:p`<p class="secondary">Something went wrong.</p>`} `}};Le.styles=[va],s([c({type:String,reflect:!0})],Le.prototype,"type",2),s([c({type:String,reflect:!0})],Le.prototype,"description",2),Le=s([v("primer-checkout-state")],Le);var ba=y` :host { display: contents; } input { width: 100%; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none; } input::placeholder { color: var(--primer-color-text-placeholder); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); } :host([disabled]) input { color: var(--primer-color-text-disabled); cursor: not-allowed; } :host([disabled]) input::placeholder { color: var(--primer-color-text-disabled); } `;var tl=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function rl(i){return tl.includes(i)}var D=class extends g{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this._id="";this.hasFocus=!1;this.hasError=!1;this.handleInput=e=>{e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)};this.handleChange=e=>{e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)};this.handleFocus=()=>{this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))};this.handleBlur=()=>{this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))};this.handleInvalid=e=>{e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}}get id(){return this._id}set id(e){this._id=e,this.setAttribute("id",e)}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,o){this.inputElement?.setSelectionRange(e,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return p`<input part="input" class=${r} .value=${this.value} .type=${this.type} ?disabled=${this.disabled} ?required=${this.required} ?readonly=${this.readonly} placeholder=${this.placeholder} pattern=${this.pattern} minlength=${this.minlength??""} maxlength=${this.maxlength??""} min=${this.min} max=${this.max} step=${this.step} autocomplete=${this.autocomplete} name=${this.name} id=${this.id} @input=${this.handleInput} @change=${this.handleChange} @focus=${this.handleFocus} @blur=${this.handleBlur} @invalid=${this.handleInvalid} />`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};D.styles=[ba],s([je("input")],D.prototype,"inputElement",2),s([c({type:String,reflect:!0})],D.prototype,"value",2),s([c({type:String,reflect:!0})],D.prototype,"placeholder",2),s([c({type:Boolean,reflect:!0})],D.prototype,"disabled",2),s([c({type:String,reflect:!0})],D.prototype,"name",2),s([c({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!rl(e)?(e&&e!=="text"&&A.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],D.prototype,"type",2),s([c({type:Boolean,reflect:!0})],D.prototype,"required",2),s([c({type:Boolean,reflect:!0})],D.prototype,"readonly",2),s([c({type:String,reflect:!0})],D.prototype,"pattern",2),s([c({type:Number,reflect:!0})],D.prototype,"minlength",2),s([c({type:Number,reflect:!0})],D.prototype,"maxlength",2),s([c({type:String,reflect:!0})],D.prototype,"min",2),s([c({type:String,reflect:!0})],D.prototype,"max",2),s([c({type:String,reflect:!0})],D.prototype,"step",2),s([c({type:String,reflect:!0})],D.prototype,"autocomplete",2),s([_()],D.prototype,"hasFocus",2),s([_()],D.prototype,"hasError",2),D=s([v("primer-input")],D);var Ca=y` :host { display: block; } .collapsable { width: 100%; } /* Make the button display with full width */ primer-button::part(button) { width: 100%; } .collapsable-wrapper { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--primer-animation-duration) var(--primer-animation-easing); overflow: hidden; border-top: none; margin-top: -1px; } .collapsable-wrapper.expanded { grid-template-rows: 1fr; } .collapsable-content { min-height: 0; overflow: hidden; padding: var(--primer-space-medium, 12px) 0; } .icon-container { display: flex; align-items: center; justify-content: center; transition: transform var(--primer-animation-duration) var(--primer-animation-easing); font-size: 0.75em; } .icon-container.expanded { transform: rotate(180deg); } /* Disable animation for users who prefer reduced motion */ @media (prefers-reduced-motion: reduce) { .collapsable-wrapper, .icon-container { transition: none; } } `;var ee=class extends g{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1;this.toggleExpanded=()=>{this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,o=this.header||e;return p`<div class="collapsable"><primer-button variant=${this.buttonVariant} buttonType="button" @click=${this.toggleExpanded} aria-expanded=${this.isExpanded} aria-controls="collapsable-content" aria-label=${r} ><span>${o}</span></primer-button><div class="collapsable-wrapper ${this.isExpanded?"expanded":""}" id="collapsable-content" role="region" aria-labelledby="collapsable-header" ><div class="collapsable-content"><slot></slot></div></div></div>`}};ee.styles=[Ca],s([c({type:String})],ee.prototype,"header",2),s([c({type:Boolean})],ee.prototype,"expanded",2),s([c({type:String})],ee.prototype,"expandText",2),s([c({type:String})],ee.prototype,"collapseText",2),s([c({type:String})],ee.prototype,"ariaLabel",2),s([c({type:String})],ee.prototype,"buttonVariant",2),s([_()],ee.prototype,"isExpanded",2),ee=s([v("primer-collapsable")],ee);var xa=y` :host { display: block; width: 100%; box-sizing: border-box; } .error-message { display: flex; align-items: flex-start; padding: var(--primer-space-medium); background-color: var(--primer-color-red-100); border-radius: var(--primer-radius-medium); border: 1px solid var(--primer-color-border-outlined-error); margin-top: var(--primer-space-small); box-sizing: border-box; width: 100%; /* Add animation properties */ opacity: 1; transform: translateY(0); transition: opacity var(--primer-animation-duration) var(--primer-animation-easing), transform var(--primer-animation-duration) var(--primer-animation-easing); } .error-message.hidden { opacity: 0; transform: translateY(-var(--primer-space-medium)); pointer-events: none; } .error-icon { flex-shrink: 0; margin-right: var(--primer-space-medium); color: var(--primer-color-icon-negative); } .error-content { flex: 1; font-family: var(--primer-typography-body-medium-font); font-size: var(--primer-typography-body-medium-size); font-weight: var(--primer-typography-body-medium-weight); line-height: var(--primer-typography-body-medium-line-height); letter-spacing: var(--primer-typography-body-medium-letter-spacing); color: var(--primer-color-text-negative); } /* Respect user's preference for reduced motion */ @media (prefers-reduced-motion: reduce) { .error-message { transition: opacity var(--primer-animation-duration) var(--primer-animation-easing); transform: none; } .error-message.hidden { transform: none; } } `;var be=class extends g{constructor(){super();this.message="";this.visible=!1;this._role="alert";this.showMessage=!1;this.role="alert"}get role(){return this._role}set role(e){this._role=e,this.setAttribute("role",e)}updated(e){e.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return u;let e={"error-message":!0,hidden:!this.visible};return p`<div part="error-message" class=${q(e)} aria-live="assertive" aria-atomic="true" ><div part="error-icon" class="error-icon"><primer-icon name="failure-icon" size="sm" color="var(--primer-color-icon-negative)" ></primer-icon></div><div part="error-content" class="error-content">${this.message}</div></div>`}};be.styles=[xa],s([c({type:String})],be.prototype,"message",2),s([c({type:Boolean,reflect:!0})],be.prototype,"visible",2),s([_()],be.prototype,"showMessage",2),be=s([v("primer-error-message")],be);var Ea=y` :host { display: none; } `;var Ge=class extends g{constructor(){super(...arguments);this._id=`d${Math.random().toString(36).substring(7)}`;this._handleSlotChange=e=>{let o=e.target.assignedNodes();if(!o.length)return;let a=this.getContainer();o.forEach(n=>a.appendChild(n))}}get id(){return this._id}getContainer(){let e=document.querySelector(`#${this._id}`);return e||(e=document.createElement("div"),e.id=this._id,document.body.appendChild(e),this._setupEventListeners(e)),e}_setupEventListeners(e){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{e.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}render(){return p`<slot @slotchange=${this._handleSlotChange}></slot>`}};Ge.styles=[Ea],s([_()],Ge.prototype,"_id",2),Ge=s([v("primer-portal")],Ge);var Aa=y` :host { display: contents; } .backdrop { position: absolute; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.5); z-index: 1000; display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; } .dialog { background-color: white; padding: var(--primer-space-medium); border-radius: var(--primer-radius-medium); max-width: 600px; } .header { display: flex; justify-content: flex-end; } `;var dt=class extends g{constructor(){super(...arguments);this._handleCloseClick=()=>{this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}}render(){return p`<div class=${q({backdrop:!0})} @click=${e=>{e.preventDefault()}} ><div class="dialog"><div class="header"><primer-button variant="tertiary" @click=${this._handleCloseClick}><primer-icon name="close"></primer-icon></primer-button></div><div class="content"><slot></slot></div></div></div>`}};dt.styles=[Aa],dt=s([v("primer-dialog")],dt);var _a=y` :host { display: contents; } .klarna-container { display: flex; flex-direction: column; width: 100%; transition: all var(--primer-animation-duration) var(--primer-animation-easing); } .klarna-container.expanded { border-radius: var(--primer-radius-medium); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); background-color: var(--primer-color-background-outlined-default); border: 1px solid var(--primer-color-border-outlined-default); padding: var(--primer-space-large); } .klarna-button-header { padding: 0; display: flex; align-items: center; justify-content: space-between; width: 100%; gap: var(--primer-space-small); } .klarna-accordion-icon { position: absolute; right: var(--primer-space-medium); font-size: var(--primer-typography-body-small-size); font-weight: var(--primer-typography-title-large-weight); color: var(--primer-color-text-secondary); transition: all var(--primer-animation-duration) var(--primer-animation-easing); display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: var(--primer-space-small); } .klarna-accordion-icon.expanded { transform: rotate(180deg); } .klarna-expanded-content { width: 100%; display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--primer-animation-duration) var(--primer-animation-easing); } .klarna-expanded-content.visible { margin-top: var(--primer-space-large); border-top: 1px solid var(--primer-color-border-outlined-default); grid-template-rows: 1fr; } .klarna-accordion-content { overflow: hidden; } @keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } } .category-selection { display: flex; flex-wrap: wrap; gap: var(--primer-space-small); margin: var(--primer-space-large) 0; } .category-button { padding: var(--primer-space-medium) var(--primer-space-large); border-radius: var(--primer-radius-base); background-color: var(--primer-color-background-outlined-loading); border: 1px solid var(--primer-color-border-outlined-default); font-size: var(--primer-typography-body-medium-size); cursor: pointer; transition: all var(--primer-animation-duration) var(--primer-animation-easing); flex: 1; min-width: 100px; text-align: center; } .category-button.selected { background-color: var(--primer-color-background-outlined-default); border-color: var(--primer-color-brand); color: var(--primer-color-brand); font-weight: var(--primer-typography-title-large-weight); } .category-button:hover:not(.selected):not(:disabled) { background-color: var(--primer-color-background-outlined-hover); } .category-button:disabled { background-color: var(--primer-color-background-outlined-disabled); border-color: var(--primer-color-border-outlined-disabled); color: var(--primer-color-text-disabled); cursor: not-allowed; } .klarna-category-container { min-height: 74px; width: 100%; border-radius: var(--primer-radius-small); border: 1px solid var(--primer-color-border-outlined-default); background-color: var(--primer-color-background-outlined-default); padding: var(--primer-space-medium); margin-bottom: var(--primer-space-large); transition: height var(--primer-animation-duration) var(--primer-animation-easing); overflow: hidden; } .klarna-button::part(button) { display: flex; flex: 1; gap: var(--primer-space-small); height: calc( ${ue(fe)} + calc(2 * var(--primer-space-medium)) ); width: 100%; } .klarna-button primer-icon { margin-right: var(--primer-space-medium); } .klarna-button:hover { background-color: var(--primer-color-background-outlined-hover); border-color: var(--primer-color-border-outlined-hover); } .klarna-pay-button { padding: var(--primer-space-medium) var(--primer-space-large); display: flex; align-items: center; justify-content: center; border-radius: var(--primer-radius-small); background-color: var(--primer-color-brand); color: var(--primer-color-background-outlined-default); border: none; font-size: var(--primer-typography-body-medium-size); font-weight: var(--primer-typography-body-medium-weight); width: 100%; cursor: pointer; transition: all var(--primer-animation-duration) var(--primer-animation-easing); } .klarna-pay-button:hover:not(.disabled) { filter: brightness(105%); } .klarna-pay-button.loading { opacity: 0.7; pointer-events: none; } .klarna-pay-button.disabled { background-color: var(--primer-color-background-outlined-disabled); border-color: var(--primer-color-border-outlined-disabled); color: var(--primer-color-text-disabled); cursor: not-allowed; } .loading { text-align: center; font-size: var(--primer-typography-body-medium-size); color: var(--primer-color-text-secondary); padding: var(--primer-space-medium); } .error { color: var(--primer-color-text-negative); font-size: var(--primer-typography-body-medium-size); padding: var(--primer-space-medium); text-align: center; border: 1px solid var(--primer-color-border-outlined-error); background-color: var(--primer-color-background-outlined-default); border-radius: var(--primer-radius-small); } /* Overall disabled state for entire Klarna component */ :host([disabled]) { cursor: not-allowed; } :host([disabled]) .klarna-button { pointer-events: none; cursor: not-allowed; } :host([disabled]) .category-button { pointer-events: none; cursor: not-allowed; } :host([disabled]) .klarna-pay-button { pointer-events: none; cursor: not-allowed; } /* Ensure disabled state is visible on container when expanded */ :host([disabled]) .klarna-container.expanded { background-color: var(--primer-color-background-outlined-disabled); border-color: var(--primer-color-border-outlined-disabled); opacity: 0.7; } `;var j=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.disabled=!1;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=x("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new L(this,{task:async([e,r])=>{if(!e||!r)return M;let o=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]});this.toggleExpand=()=>{this.disabled||(this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null))}}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){A.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){A.error("Failed to render Klarna category",e)}}selectCategory(e){this.disabled||(this.selectedCategory=e,this.renderSelectedCategory())}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?p`<div class="loading"><primer-spinner size="small"></primer-spinner></div>`:p`<div class="category-selection">${e.map(o=>p`<button class=${q({"category-button":!0,selected:o.id===this.selectedCategory})} @click=${()=>{this.selectCategory(o.id)}} ?disabled=${this.disabled} >${o.name}</button>`)}</div>`}renderExpandedContent(){return p` ${this.renderCategorySelection()} ${this.selectedCategory?p`<div id="klarna-category-container" class="klarna-category-container" ></div>`:u}<button class=${q({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory||this.disabled})} ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing||this.disabled} @click=${()=>this.startKlarnaPayment()} >${x("confirm",{id:"confirm"})}</button>`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return p`<div class="error"> Error loading Klarna: ${r}</div>`},complete:({manager:e,klarnaIcon:r})=>e?p`<div class="klarna-container ${this.isExpanded?"expanded":""}"><div class="klarna-button-header"><primer-button buttonType="button" variant="secondary" class="klarna-button" @click=${this.toggleExpand} aria-expanded=${this.isExpanded} aria-controls="collapsable-content" aria-label=${this.headerAriaLabel} ?disabled=${this.disabled} ><img src=${r} alt="Klarna logo" /><span>${x("pay_with",{id:"pay_with"})} Klarna</span><span class="klarna-accordion-icon ${this.isExpanded?"expanded":""}" > ▼ </span></primer-button></div><div class="klarna-expanded-content ${this.isExpanded?"visible":""}" ><div class="klarna-accordion-content">${this.renderExpandedContent()}</div></div></div>`:u})}};j.styles=[E,_a],s([C({context:Z,subscribe:!0}),c()],j.prototype,"paymentManagers",2),s([C({context:Y,subscribe:!0}),c()],j.prototype,"sdkState",2),s([C({context:U,subscribe:!0}),c({type:Object})],j.prototype,"headlessUtils",2),s([C({context:Jt,subscribe:!0}),c()],j.prototype,"klarnaCategories",2),s([c({type:Boolean,attribute:"disabled"})],j.prototype,"disabled",2),s([_()],j.prototype,"selectedCategory",2),s([_()],j.prototype,"isExpanded",2),s([_()],j.prototype,"headerAriaLabel",2),s([je("#klarna-category-container")],j.prototype,"klarnaContainer",2),j=s([v("primer-klarna"),w()],j);var Sa=y` :host { display: contents; } `;var Ce=class extends g{constructor(){super(...arguments);this.type=void 0;this.disabled=!1;this.paymentMethods=null}render(){if(!this.type)return u;let e=this.paymentMethods?.get(this.type);if(!e)return u;switch(e?.managerType){case"CARD":return p`<primer-card-form ?disabled=${this.disabled} ></primer-card-form>`;case"NATIVE":return p`<primer-native-payment .paymentMethod=${e} ?disabled=${this.disabled} ></primer-native-payment>`;case"REDIRECT":return p`<primer-redirect-payment .paymentMethod=${e} ?disabled=${this.disabled} ></primer-redirect-payment>`;case"KLARNA":return p`<primer-klarna ?disabled=${this.disabled}></primer-klarna>`;case"ACH":return p`<primer-dynamic-payment .paymentMethod=${e} ></primer-dynamic-payment>`;default:return u}}};Ce.styles=[Sa],s([c({type:String})],Ce.prototype,"type",2),s([c({type:Boolean,attribute:"disabled"})],Ce.prototype,"disabled",2),s([C({context:ht,subscribe:!0}),c()],Ce.prototype,"paymentMethods",2),Ce=s([v("primer-payment-method")],Ce);var Pa=y` :host { display: flex; flex-direction: column; gap: var(--primer-space-medium); width: 100%; } h2 { margin: 0; padding: 0; border-radius: var(--primer-radius-medium); font-weight: var(--primer-typography-title-xlarge-weight); font-size: var(--primer-typography-title-xlarge-size); letter-spacing: var(--primer-typography-title-xlarge-letter-spacing); line-height: var(--primer-typography-title-xlarge-line-height); font-family: var(--primer-typography-title-xlarge-font); } p { margin: 0; padding: 0; border-radius: var(--primer-radius-medium); font-weight: var(--primer-typography-body-medium-weight); font-size: var(--primer-typography-body-medium-size); letter-spacing: var(--primer-typography-body-medium-letter-spacing); line-height: var(--primer-typography-body-medium-line-height); font-family: var(--primer-typography-body-medium-font); } form { display: flex; flex-direction: column; gap: var(--primer-space-medium); width: 100%; } .form-row { display: flex; gap: var(--primer-space-small); width: 100%; } .form-row primer-input-wrapper { flex: 1; } .error-message { color: var(--primer-color-text-negative); background-color: var(--primer-color-red-100); padding: var(--primer-space-small); border-radius: var(--primer-radius-small); font-weight: var(--primer-typography-body-medium-weight); font-size: var(--primer-typography-body-medium-size); letter-spacing: var(--primer-typography-body-medium-letter-spacing); line-height: var(--primer-typography-body-medium-line-height); font-family: var(--primer-typography-body-medium-font); } .loading-container { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--primer-space-medium); padding: var(--primer-space-large); } .button-group { display: flex; gap: var(--primer-space-small); margin-top: var(--primer-space-medium); } /* Apply responsive styles for small screens */ @media (max-width: 600px) { .form-row { flex-direction: column; gap: var(--primer-space-medium); } .button-group { flex-direction: column; } } `;function wa(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var Dr=class{constructor(t,e){this.formState=wa();this.host=t,this.validate=e,t.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(t,e){let r=this.formState[t];r.value=e,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(t,e=!1){e&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),t.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:t}})),this.host.requestUpdate()}setFieldTouched(t){this.formState[t].touched||(this.formState[t].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=wa(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var ie=class extends g{constructor(){super(...arguments);this.formController=new Dr(this,e=>this._paymentMethodManagerTask.value.setAndValidate(e));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new L(this,{task:([e])=>e!=="STRIPE_ACH"?M:this.paymentManagers.get(e)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(e,r){let o=e.target;this.formController.setFieldValue(r,o.value)}_handleBlur(e){this.formController.setFieldTouched(e)}_handleError(e){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error occurred")}}))}async _handleSubmitButtonClick(e){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await e.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(e);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(e){try{await e.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}renderForm(e){return p`<h2>${x("payWithAch",{id:"payWithAch"})}</h2><p>${x("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}</p><form @submit=${r=>r.preventDefault()}><div class="form-row"><primer-input-wrapper .hasError=${this.formController.hasError.firstName} ><primer-input-label slot="label">${x("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}</primer-input-label><primer-input slot="input" .value=${this.formController.formState.firstName.value} @input=${r=>this._handleInput(r,"firstName")} @blur=${()=>this._handleBlur("firstName")} ?disabled=${this.isSubmitting} ></primer-input><primer-input-error slot="error">${this.formController.hasError.firstName?this.formController.formState.firstName.error:u}</primer-input-error></primer-input-wrapper><primer-input-wrapper .hasError=${this.formController.hasError.lastName} ><primer-input-label slot="label">${x("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}</primer-input-label><primer-input slot="input" .value=${this.formController.formState.lastName.value} @input=${r=>this._handleInput(r,"lastName")} @blur=${()=>this._handleBlur("lastName")} ?disabled=${this.isSubmitting} ></primer-input><primer-input-error slot="error">${this.formController.hasError.lastName?this.formController.formState.lastName.error:u}</primer-input-error></primer-input-wrapper></div><primer-input-wrapper .hasError=${this.formController.hasError.emailAddress} ><primer-input-label slot="label">${x("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}</primer-input-label><primer-input slot="input" type="email" .value=${this.formController.formState.emailAddress.value} @input=${r=>this._handleInput(r,"emailAddress")} @blur=${()=>this._handleBlur("emailAddress")} ?disabled=${this.isSubmitting} ></primer-input><primer-input-error slot="error">${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:u}</primer-input-error></primer-input-wrapper><p>${x("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}</p><primer-button buttonType="submit" variant="primary" @click=${()=>this._handleSubmitButtonClick(e)} ?disabled=${this.isSubmitting} ?loading=${this.isSubmitting} >${x("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}</primer-button></form>`}renderMandate(){return p`<h2>${x("payWithAch",{id:"payWithAch"})}</h2><p>${this.clientOptions?.stripe?.mandateData.fullMandateText??x("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}</p><div class="button-group"><primer-button variant="primary" @click=${this._handleConfirmMandate.bind(this)} ?disabled=${this.isSubmitting} ?loading=${this.isSubmitting} >${x("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}</primer-button><primer-button variant="tertiary" @click=${this._handleDeclineMandate.bind(this)} ?disabled=${this.isSubmitting} >${x("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}</primer-button></div>`}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():u})}};ie.styles=[E,Pa],s([c({type:Object})],ie.prototype,"paymentMethod",2),s([C({context:Z,subscribe:!0}),c({attribute:!1})],ie.prototype,"paymentManagers",2),s([C({context:Y,subscribe:!0}),c({attribute:!1})],ie.prototype,"sdkState",2),s([C({context:pe,subscribe:!0}),c({attribute:!1})],ie.prototype,"clientOptions",2),s([_()],ie.prototype,"screen",2),s([_()],ie.prototype,"isSubmitting",2),ie=s([v("primer-ach-payment"),w()],ie);var Ma=y` :host { height: calc( ${ue(fe)} + calc(2 * var(--primer-space-medium)) ); display: flex; /* Default value for the background color CSS variable */ --dynamic-payment-button-bg-color: var( --primer-color-background-outlined-default ); } primer-button { width: 100%; height: 100%; } primer-button::part(button) { background-color: var(--dynamic-payment-button-bg-color); border: 1px solid var(--primer-color-border-outlined-default); color: var(--primer-color-text-primary); flex: 1; padding: 1px; } .image-container { display: flex; justify-content: center; height: 100%; } /* Target the img specifically inside our component */ img { height: 100%; } `;function jt(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var ae=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new L(this,{task:([e,r])=>!e||!r?M:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new L(this,{task:([e,r])=>{if(!e||!r)return M;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:M},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new L(this,{task:([e,r])=>!e||!r?M:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?jt(e):"";return r==="payWith"&&(r="pay_with"),x(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?p`<primer-portal><primer-dialog @primer-dialog-close="${()=>this.open=!1}"><primer-ach-payment .paymentMethod=${this.paymentMethod} @primer-ach-error=${()=>this.open=!1} @primer-ach-mandate-confirmed=${()=>this.open=!1} @primer-ach-mandate-declined=${()=>this.open=!1} ></primer-ach-payment></primer-dialog></primer-portal>`:u}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),p`<primer-button @click="${()=>this.start()}" class=${q({loading:!!this.sdkState?.isProcessing,reverse:!0})} title="${x("pay_with",{id:"pay_with"})} ${e.name}" ><span class="image-container"><img src="${e.iconUrl}" alt="${e.name}" /></span>${e.displayName}</primer-button>${this.renderDialog()} `)})}};ae.styles=[E,Ma],s([c({type:Object})],ae.prototype,"paymentMethod",2),s([C({context:Z,subscribe:!0})],ae.prototype,"paymentManagers",2),s([C({context:Y,subscribe:!0})],ae.prototype,"sdkState",2),s([C({context:U,subscribe:!0})],ae.prototype,"headlessUtils",2),s([_()],ae.prototype,"open",2),ae=s([v("primer-dynamic-payment"),w()],ae);var Ta=y` :host { height: calc( ${ue(fe)} + calc(2 * var(--primer-space-medium)) ); display: flex; /* Default value for the background color CSS variable */ --redirect-payment-button-bg-color: var( --primer-color-background-outlined-default ); } primer-button { width: 100%; height: 100%; } primer-button::part(button) { background-color: var(--redirect-payment-button-bg-color); border: 1px solid var(--primer-color-border-outlined-default); color: var(--primer-color-text-primary); flex: 1; padding: var(--primer-space-small); display: flex; align-items: center; justify-content: center; gap: var(--primer-space-small); } /* Default layout: icon on the left (START) */ primer-button { display: flex; flex-direction: row; } /* When icon position is END */ primer-button.icon-end { flex-direction: row-reverse; } .image-container { display: flex; justify-content: center; align-items: center; min-width: 100px; height: 100%; } .button-text { font-family: var(--primer-typography-font-family); font-size: var(--primer-typography-title-small-font-size); font-weight: var(--primer-typography-title-small-font-weight); line-height: var(--primer-typography-title-small-line-height); letter-spacing: var(--primer-typography-title-small-letter-spacing); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* Target the img specifically inside our component */ img { max-width: 100px; width: 100%; height: auto; object-fit: cover; max-height: 100%; } /* For image container sizing */ .image-container { flex-shrink: 0; flex-grow: 1; } /* Disabled state styling - subtle visual feedback */ :host([disabled]) { opacity: 0.6; cursor: not-allowed; } :host([disabled]) primer-button::part(button) { pointer-events: none; cursor: not-allowed; } :host([disabled]) img { filter: grayscale(100%); } `;var ne=class extends g{constructor(){super(...arguments);this.disabled=!1;this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new L(this,{task:([e,r])=>!e||!r?M:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new L(this,{task:([e,r])=>{if(!e||!r)return M;let o=r.getPaymentMethodConfiguration(e);if(!o)return M;let a=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,n=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:a,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:n}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new L(this,{task:([e,r])=>!e||!r?M:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?jt(e):"";return r==="payWith"&&(r="pay_with"),x(r,{id:r})}startRedirectPayment(){this.disabled||this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>{this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":e.iconPosition==="END","image-only":!e.displayName},o=e.displayName?p`<span class="image-container"><img src="${e.iconUrl}" alt="${e.name}" /></span><span class="button-text">${e.displayName}</span>`:p`<span class="image-container"><img src="${e.iconUrl}" alt="${e.name}" /></span>`;return p`<primer-button @click="${()=>this.startRedirectPayment()}" class=${q(r)} title="${x("pay_with",{id:"pay_with"})} ${e.name}" ?disabled=${this.disabled} >${o}</primer-button>`}})}};ne.styles=[E,Ta],s([c({type:Object})],ne.prototype,"paymentMethod",2),s([c({type:Boolean,attribute:"disabled"})],ne.prototype,"disabled",2),s([C({context:Z,subscribe:!0})],ne.prototype,"paymentManagers",2),s([C({context:Y,subscribe:!0})],ne.prototype,"sdkState",2),s([C({context:U,subscribe:!0})],ne.prototype,"headlessUtils",2),ne=s([v("primer-redirect-payment"),w()],ne);var ct={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",PAY_NL_RIVERTY:"PAY_NL_RIVERTY",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN",DLOCAL_PIX:"DLOCAL_PIX",ALMA:"ALMA"};function ka(i){return i.paymentInstrumentType===ct.CARD}async function $r(i,t,e){if(!i||!t||!e)return{icon:"",shouldShowCVV:!1,type:"other",description:""};let r="";if(ka(i))r=t.getCardNetworkAsset(i.paymentInstrumentData.network).cardUrl;else{let n=await t.getCDNAssets(i.paymentMethodType);n&&(r=n.assets?.icon?`${n.goatCdnUrl}/${n.assets.icon}`:"")}let o=e.cvvRecapture,a=ki(i);return{icon:r,shouldShowCVV:o,...a}}function Ia(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function il(i){return i?i===i.toUpperCase()?Ia(i):i:""}function La(i,t){return[i,t].filter(Boolean).join(" ")}function ol(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function Na(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function al(i){let t=i.paymentInstrumentData,e=t.cardholderName,r=t.last4Digits,o=ol(t.expirationMonth,t.expirationYear),a=il(t.network),n=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${a} ${Na(r)}`:a)||" Card"}`;return{type:"card",cardholderName:e,last4:r,expiresDate:o,network:a,description:n}}function nl(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account";return{type:"other",fullName:La(r,o),email:e,paymentMethodType:"PayPal",description:a}}function sl(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account");return{type:"other",fullName:La(r,o),email:e,paymentMethodType:"Klarna",description:a}}function ll(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;return a||(r&&e?a=`${r} ${Na(e)}`:r?a=r:a="Bank Account"),{type:"other",fullName:"",bankName:r,last4:e,accountType:o,paymentMethodType:"ACH",description:a}}function dl(i){let t=i.paymentInstrumentType,e=Ia(t.replace(/_/g," "));return{type:"other",description:i.userDescription||e}}var cl={[ct.CARD]:al,[ct.PAYPAL_VAULTED]:nl,[ct.KLARNA_CUSTOMER_TOKEN]:sl,[ct.AUTOMATED_CLEARING_HOUSE]:ll};function ki(i){try{let t=cl[i.paymentInstrumentType];return t?t(i):dl(i)}catch(t){return A.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{type:"other",description:i.userDescription||i.id||"Payment Method"}}}var Oa=y` :host { display: block; width: 100%; position: relative; } .vault-manager { display: flex; flex-direction: column; position: relative; } .vault-manager-content { display: flex; flex-direction: column; width: 100%; position: relative; } /* Content container using CSS Grid for height animation */ .content-container { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--primer-animation-duration) var(--primer-animation-easing); width: 100%; position: relative; } /* Required to make grid animation work - ensures content can expand/collapse properly */ .content-container > * { min-height: 0; overflow: hidden; } /* Submit button container */ .submit-button-container { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--primer-animation-duration) var(--primer-animation-easing); overflow: hidden; margin-top: var(--primer-space-small); width: 100%; } /* Ensure the submit button has full width */ .submit-button { width: 100%; } /* Make sure pay button inside the submit component is full width */ primer-vault-payment-submit::part(button), ::slotted(primer-button) { width: 100%; } /* Payment methods list */ .payment-methods-list { display: flex; flex-direction: column; gap: var(--primer-space-small); width: 100%; position: relative; } /* Delete confirmation container */ .delete-confirmation-container { width: 100%; position: relative; display: flex; flex-direction: column; gap: var(--primer-space-small); } /* Loading overlay styles */ .loading-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background-color: rgba(255, 255, 255, 0.7); z-index: 10; border-radius: var(--primer-radius-medium); backdrop-filter: blur(2px); opacity: 0; /* Start invisible */ } /* Add styles for when updating is active */ .is-updating { pointer-events: none; /* Prevent interaction when updating */ } /* * Component-specific styles to ensure smooth animations * These components need display:block to work with the grid layout */ primer-vault-payment-method-item, primer-vault-empty-state, primer-vault-delete-confirmation { display: block; width: 100%; } /* Disable animations for reduced motion preference */ @media (prefers-reduced-motion: reduce) { .content-container, .submit-button-container, primer-vault-payment-method-item, primer-vault-payment-submit, primer-vault-empty-state, primer-vault-delete-confirmation { transition: none; } } primer-button::part(button) { align-items: center; width: 100%; justify-content: flex-start; display: flex; text-align: left; padding: var(--primer-space-medium); } `;var{I:_g}=Co;var Ra=i=>i.strings===void 0;var Kt=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Kt(r,t);return!0},Vr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},Da=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),ul(t)}};function pl(i){this._$AN!==void 0?(Vr(this),this._$AM=i,Da(this)):this._$AM=i}function ml(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let a=e;a<r.length;a++)Kt(r[a],!1),Vr(r[a]);else r!=null&&(Kt(r,!1),Vr(r));else Kt(this,i)}var ul=i=>{i.type==Ke.CHILD&&(i._$AP??(i._$AP=ml),i._$AQ??(i._$AQ=pl))},qe=class extends Ct{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Da(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Kt(this,t),Vr(this))}setValue(t){if(Ra(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Yr=new WeakMap,xt=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,Yr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var $a=0,Ii=new Map,Va=new WeakSet,Li=()=>new Promise(i=>requestAnimationFrame(i));var Ya=(i,t)=>{let e=i-t;return e===0?void 0:e},Ua=(i,t)=>{let e=i/t;return e===1?void 0:e},Ur={left:(i,t)=>{let e=Ya(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=Ya(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=Ua(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=Ua(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},za={duration:333,easing:"ease-in-out"},Ba=["left","top","width","height","opacity","color","background"],Ha=new WeakMap,Hr=class extends qe{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Ke.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(t=>{this.l=t})}async resolveFinished(){this.l?.(),this.l=void 0}render(t){return u}getController(){return Yr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,Ha.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};let e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=Ba),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(Ur[o]?void 0:r[o]),n=Number(a);t[o]=isNaN(n)?a+"":n}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((a,n)=>a===o[n]))return!1}else if(o===r)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Li;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,e);this.log("measured",[this.A,o,a,n]),t=this.calculateKeyframes(a,n)}else{let a=Ii.get(this.options.inId);if(a){Ii.delete(this.options.inId);let{from:n,to:l}=this.N(a,o,e);t=this.calculateKeyframes(n,l),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,$a++,t.forEach(d=>d.zIndex=$a)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&Ii.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Li(),this.i?.isConnected){let e=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,e),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,a=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&a===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),a!==0&&(this.element.style.top=a+"px")}}let t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(t){t&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e?.parentNode){let r=Ha.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=Va.has(this.u);return t||this.u.updateComplete.then(()=>{Va.add(this.u)}),t}j(t,e=this.O()){let r={...za};return e.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t={...t},e={...e};let o=r.map(l=>l.animatingProperties).filter(l=>l!==void 0),a=1,n=1;return o.length>0&&(o.forEach(l=>{l.width&&(a/=l.width),l.height&&(n/=l.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=a*t.left,e.left=a*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=n*t.top,e.top=n*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},a={},n=!1,l={};for(let d in e){let m=t[d],h=e[d];if(d in Ur){let f=Ur[d];if(m===void 0||h===void 0)continue;let b=f(m,h);b.transform!==void 0&&(l[d]=b.value,n=!0,o.transform=`${o.transform??""} ${b.transform}`,b.overrideFrom!==void 0&&Object.assign(o,b.overrideFrom))}else m!==h&&m!==void 0&&h!==void 0&&(n=!0,o[d]=m,a[d]=h)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=l,n?[o,a]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(t,e){this.shouldLog&&this.isDisabled()}},We=Te(Hr);var hl=["top","right","bottom","left"],zr=class extends qe{constructor(t){if(super(t),t.type!==Ke.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return u}update(t,[e,r]){return this.u===void 0&&(this.u=t.options?.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r??["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){let t=typeof this.C=="function"?this.C():this.C?.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();this.F?.forEach(a=>{let n=hl.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},fl=Te(zr);var K=class extends g{constructor(){super();this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;this.deleteAssetConfig=null;this.handleToggleEditMode=e=>{this.isEditMode=e.detail,this.deletePaymentMethodId=null,this.isEditMode&&this.vaultItemContext&&this.vaultItemContext.setSelectedVaultedPaymentMethod(null)};this.handleDeletePaymentMethod=async e=>{if(this.deletePaymentMethodId=e.detail,this.deletePaymentMethodId&&this.vaultManagerContext&&this.headlessUtils){let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===this.deletePaymentMethodId);r&&(this.deleteAssetConfig=await $r(r,this.headlessUtils,this.vaultManagerContext))}};this.handleCancelDelete=()=>{this.deletePaymentMethodId=null,this.deleteAssetConfig=null};this.handleConfirmDelete=async()=>{if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=x("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null,this.deleteAssetConfig=null}catch(e){this.errorMessage=e instanceof Error?e.message:x("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}};this.handlePaymentError=e=>{let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:x("payment_processing_error",{id:"payment_processing_error"})};this.handleCloseError=()=>{this.errorMessage=""};new xt(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===e);if(!r)return"";try{return ki(r).description||""}catch{return""}}renderLoadingOverlay(){return p`<div class="loading-overlay" ${We({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})} ><primer-spinner size="medium" color="var(--primer-color-loader)" ></primer-spinner></div>`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId||!this.deleteAssetConfig)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return p`<div class="delete-confirmation-container"><primer-button disabled variant="secondary"><primer-payment-method-content .assetConfig=${this.deleteAssetConfig} ></primer-payment-method-content></primer-button><primer-vault-delete-confirmation .isDeleting=${this.isDeleting} .paymentMethodId=${this.deletePaymentMethodId} .paymentMethodName=${e} @confirm-delete=${this.handleConfirmDelete} @cancel-delete=${this.handleCancelDelete} ${We({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})} ></primer-vault-delete-confirmation></div>`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:p`<primer-vault-payment-method-item .paymentMethod=${e} .isEditMode=${this.isEditMode} @delete-payment-method=${this.handleDeletePaymentMethod} ${We({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})} ></primer-vault-payment-method-item>`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return p`<div class="payment-methods-list">${e.map(o=>this.renderPaymentMethodItem(o))} ${I(r,()=>p`<div class="submit-button-container"><primer-vault-payment-submit class="submit-button" @primer-vault-payment-error=${this.handlePaymentError} ${We({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})} ></primer-vault-payment-submit></div>`,()=>u)}</div>`}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return p` ${I(!this.vaultManagerContext?.showEmptyState&&!e,()=>u,()=>p`<slot name="vault-empty-state"><div class="vault-manager ${o?"is-updating":""}"><primer-vault-manager-header .isEditMode=${this.isEditMode} .hasPaymentMethods=${e} @toggle-edit-mode=${this.handleToggleEditMode} ></primer-vault-manager-header>${I(this.errorMessage,()=>p`<primer-vault-error-message .errorMessage=${this.errorMessage} @close-error=${this.handleCloseError} ${We({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})} ></primer-vault-error-message>`,()=>u)}<div class="vault-manager-content">${I(!r&&!e,()=>p`<div class="content-container"><primer-vault-empty-state ${We({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})} ></primer-vault-empty-state></div>`,()=>u)} ${I(!r&&e,()=>p`<div class="content-container">${I(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}</div>`,()=>u)}</div>${I(o,()=>this.renderLoadingOverlay(),()=>u)}</div></slot>`)} `}};K.styles=[E,Oa],s([C({context:X,subscribe:!0}),c({type:Object,attribute:!1})],K.prototype,"vaultManagerContext",2),s([C({context:me,subscribe:!0}),c({type:Object,attribute:!1})],K.prototype,"vaultItemContext",2),s([C({context:U,subscribe:!0}),c({type:Object,attribute:!1})],K.prototype,"headlessUtils",2),s([_()],K.prototype,"isEditMode",2),s([_()],K.prototype,"deletePaymentMethodId",2),s([_()],K.prototype,"isDeleting",2),s([_()],K.prototype,"errorMessage",2),s([c({type:Number})],K.prototype,"animationDuration",2),s([_()],K.prototype,"deleteAssetConfig",2),K=s([v("primer-vault-manager"),w()],K);var Fa=y` :host { display: flex; width: 100%; flex-direction: column; } .payment-method-wrapper { display: flex; flex-direction: column; width: 100%; } .payment-method-container { display: flex; width: 100%; align-items: center; gap: var(--primer-space-small); } /* Target the button part from primer-button with 'with-cvv' class using ::part selector */ primer-button::part(button) { align-items: center; width: 100%; justify-content: flex-start; display: flex; text-align: left; padding: var(--primer-space-medium); } /* render checkmark icon on baseline (on the top) */ primer-button.with-cvv::part(button) { align-items: baseline; } /* Card icons */ .payment-method-icon { height: var(--primer-space-xlarge); object-fit: contain; flex-shrink: 0; transition: transform var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-icon-generic { display: flex; align-items: center; justify-content: center; color: var(--primer-color-gray-500); height: var(--primer-space-xlarge); flex-shrink: 0; } .payment-method-details { flex: 1; display: flex; gap: var(--primer-space-xsmall); align-items: flex-start; transition: transform var(--primer-animation-duration) var(--primer-animation-easing); margin-left: var(--primer-space-small); } .payment-method-card { flex: 1; width: 100%; display: flex; flex-direction: column; gap: var(--primer-space-xsmall); transition: transform var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-description { font-weight: var(--primer-typography-title-large-weight); color: var(--primer-color-text-primary); transition: color var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-secondary-description { font-size: var(--primer-typography-body-small-size); color: var(--primer-color-text-secondary); transition: color var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-row { display: grid; grid-template-columns: 200px 100px; justify-content: space-between; align-items: center; } .cell-2 { grid-column: 2; display: flex; justify-content: flex-end; align-items: center; } .mt-2 { margin-top: var(--primer-space-medium); } .payment-method-header { font-weight: var(--primer-typography-body-large-weight); font-size: var(--primer-typography-body-large-size); line-height: var(--primer-typography-body-large-line-height); color: var(--primer-color-text-primary); letter-spacing: var(--primer-typography-body-large-letter-spacing); } .payment-method-subtitle { color: var(--primer-color-text-secondary); font-size: var(--primer-typography-body-small-size); line-height: var(--primer-typography-body-small-line-height); font-weight: var(--primer-typography-body-small-weight); letter-spacing: var(--primer-typography-body-small-letter-spacing); } .payment-method-button { flex: 1; } .flex { display: flex; align-items: flex-end; gap: var(--primer-space-xsmall); } .flex-center { display: flex; align-items: center; justify-content: center; gap: var(--primer-space-small); } /* Delete button - for edit mode */ .delete-button { display: flex; align-items: center; justify-content: center; } .delete-button:active { transform: scale(0.95); } `;var te=class extends g{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new L(this,{task:async([e,r,o])=>await $r(e,r,o),args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]});this.handleClick=()=>{this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))};this.handleDeleteClick=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let e=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!e&&e.id===this.paymentMethod.id}render(){return this._getAssetsTask.render({error:()=>u,complete:e=>{let r=this.isSelected()?"checked":"default",o=!1,a=e?.description;return p`<div class="payment-method-wrapper"><div class="payment-method-container"><primer-button variant="secondary" class="payment-method-button ${e.shouldShowCVV?"with-cvv":""}" selectable ?disabled=${this.isEditMode} selectionState=${r} .flex=${o} @click=${this.handleClick} ><primer-payment-method-content .assetConfig=${e} ></primer-payment-method-content>${I(e.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>p`<div class="payment-method-row mt-2"><span class="flex-center"><primer-icon name="lock" size="sm"></primer-icon><span class="payment-method-subtitle"> Input the card CVV for a secure payment</span ></span><span class="cell-2"><primer-vault-cvv-input .paymentMethod="${this.paymentMethod}" ><span slot="label"></span></primer-vault-cvv-input></span></div>`,()=>u)}</primer-button>${this.isEditMode?p`<primer-button variant="tertiary" class="delete-button" @click=${this.handleDeleteClick} aria-label=${`${x("delete",{id:"delete"})} ${a}`} ><primer-icon name="close" size="sm"></primer-icon></primer-button>`:u}</div></div>`}})}};te.styles=[E,Fa],s([C({context:X,subscribe:!0}),c({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],te.prototype,"vaultManagerContext",2),s([C({context:me,subscribe:!0}),c({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],te.prototype,"vaultItemContext",2),s([C({context:U,subscribe:!0}),c({type:Object})],te.prototype,"headlessUtils",2),s([c({type:Object,attribute:!1})],te.prototype,"paymentMethod",2),s([c({type:Boolean,reflect:!0})],te.prototype,"isEditMode",2),te=s([v("primer-vault-payment-method-item"),w()],te);var ja=y` :host { display: block; width: 100%; } .vault-manager-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--primer-space-medium); } .vault-manager-header h3 { font-size: var(--primer-typography-title-large-size); font-weight: var(--primer-typography-title-large-weight); font-family: var(--primer-typography-title-large-font); color: var(--primer-color-text-primary); margin: 0; } .edit-button { display: flex; align-items: center; justify-content: center; } `;var de=class extends g{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1;this.toggleEditMode=()=>{this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}}render(){return p`<div class="vault-manager-header"><h3>${x("previouslyUsed",{id:"previouslyUsed"})}</h3>${this.hasPaymentMethods?p`<primer-button variant="tertiary" class="edit-button ${this.isEditMode?"active":""}" @click=${this.toggleEditMode} aria-label=${this.isEditMode?x("confirm",{id:"confirm"}):x("editPaymentMethods",{id:"editPaymentMethods"})} >${this.isEditMode?p`<primer-icon name="checkmark" size="sm"></primer-icon>`:p`<primer-icon name="edit" size="sm"></primer-icon>`}</primer-button>`:u}</div>`}};de.styles=[E,ja],s([c({type:Boolean})],de.prototype,"isEditMode",2),s([c({type:Boolean})],de.prototype,"hasPaymentMethods",2),de=s([v("primer-vault-manager-header"),w()],de);var Ka=y` :host { display: block; width: 100%; } .delete-confirmation-text { color: var(--primer-color-text-secondary); font-size: var(--primer-typography-body-small-size); font-weight: var(--primer-typography-body-small-weight); line-height: var(--primer-typography-body-small-line-height); letter-spacing: var(--primer-typography-body-small-letter-spacing); } .delete-confirmation { margin-top: var(--primer-space-medium); background-color: var(--primer-color-gray-000); } .delete-message { margin-bottom: var(--primer-space-medium); } .delete-text { margin: 0; color: var(--primer-color-text-secondary); font-size: var(--primer-typography-body-medium-size); } .delete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--primer-space-small); } .delete-confirm { background-color: var(--primer-color-red-500); color: var(--primer-color-gray-000); border: none; padding: var(--primer-space-small) var(--primer-space-medium); border-radius: var(--primer-radius-small); font-weight: var(--primer-typography-body-medium-weight); cursor: pointer; transition: background-color var(--primer-animation-duration) var(--primer-animation-easing); } .delete-confirm:hover:not(:disabled) { background-color: var(--primer-color-red-900); } .delete-confirm:disabled { opacity: 0.7; cursor: not-allowed; } .delete-cancel { background-color: transparent; border: 1px solid var(--primer-color-border-outlined-default); padding: var(--primer-space-small) var(--primer-space-medium); border-radius: var(--primer-radius-small); color: var(--primer-color-text-primary); font-weight: var(--primer-typography-body-medium-weight); cursor: pointer; transition: background-color var(--primer-animation-duration) var(--primer-animation-easing); } .delete-cancel:hover:not(:disabled) { background-color: var(--primer-color-gray-100); } .delete-cancel:disabled { opacity: 0.7; cursor: not-allowed; } `;var oe=class extends g{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null;this.handleConfirmClick=()=>{this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))};this.handleCancelClick=()=>{this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}}render(){return p`<div class="delete-confirmation"><p class="delete-confirmation-text"> Are you sure you want to delete this payment method? </p><div class="delete-actions"><primer-button variant="secondary" @click=${this.handleCancelClick} ?disabled=${this.isDeleting} >${x("cancel",{id:"cancel"})}</primer-button><primer-button @click=${this.handleConfirmClick} ?disabled=${this.isDeleting} >${this.isDeleting?x("deleting",{id:"deleting"}):x("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}</primer-button></div></div>`}};oe.styles=[E,Ka],s([c({type:Boolean})],oe.prototype,"isDeleting",2),s([c({type:String})],oe.prototype,"paymentMethodId",2),s([c({type:String})],oe.prototype,"paymentMethodName",2),s([C({context:X,subscribe:!0})],oe.prototype,"vaultManager",2),oe=s([v("primer-vault-delete-confirmation"),w()],oe);var Ga=y` :host { display: block; width: 100%; } .empty-state { padding: var(--primer-space-xlarge) 0; text-align: center; color: var(--primer-color-text-secondary); } .empty-state p { margin: 0; } `;var Ne=class extends g{render(){return p`<div class="empty-state"><p>${x("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}</p></div>`}};Ne.styles=[E,Ga],Ne=s([v("primer-vault-empty-state"),w()],Ne);var qa=y` :host { display: block; width: 100%; } .error-message { display: flex; background-color: var(--primer-color-red-100); padding: var(--primer-space-medium); border-radius: var(--primer-radius-small); margin-bottom: var(--primer-space-medium); justify-content: space-between; align-items: center; border: 1px solid var(--primer-color-red-500); } .error-content { display: flex; align-items: center; gap: var(--primer-space-small); } .error-message p { margin: 0; color: var(--primer-color-text-negative); font-size: var(--primer-typography-body-medium-size); } .error-message button { background: transparent; border: none; color: var(--primer-color-text-negative); cursor: pointer; padding: var(--primer-space-xsmall); display: flex; align-items: center; justify-content: center; border-radius: var(--primer-radius-small); transition: background-color var(--primer-animation-duration) var(--primer-animation-easing); } .error-message button:hover { background-color: rgba(0, 0, 0, 0.05); } `;var xe=class extends g{constructor(){super(...arguments);this.errorMessage="";this.handleDismiss=()=>{this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}}render(){return p`<div class="error-message"><div class="error-content"><primer-icon name="warning" size="sm" color="var(--primer-color-red-500)" ></primer-icon><p>${this.errorMessage}</p></div><button @click=${this.handleDismiss} aria-label=${x("closeErrorMessage",{id:"closeErrorMessage"})} ><primer-icon name="close" size="sm"></primer-icon></button></div>`}};xe.styles=[E,qa],s([c({type:String})],xe.prototype,"errorMessage",2),xe=s([v("primer-vault-error-message"),w()],xe);var Wa=y` :host { display: contents; } `;var F=class extends g{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async e=>{if(e.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:x("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u;return p`<primer-button buttonType="submit" variant=${this.variant} @click=${this.handleClick} .disabled=${this.isButtonDisabled} .loading=${this.sdkState?.isProcessing} data-submit >${this.buttonText}${r}</primer-button>`}};F.styles=[E,Wa],s([c({type:String})],F.prototype,"buttonText",1),s([C({context:U,subscribe:!0}),c({type:Object})],F.prototype,"headlessInstance",2),s([C({context:Y,subscribe:!0}),c()],F.prototype,"sdkState",2),s([C({context:me,subscribe:!0}),c({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],F.prototype,"vaultItemContext",2),s([C({context:X,subscribe:!0}),c({type:Object,attribute:!1})],F.prototype,"vaultManager",2),s([C({context:pe,subscribe:!0}),c({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],F.prototype,"clientOptions",2),s([c({type:String})],F.prototype,"variant",2),s([c({type:Boolean})],F.prototype,"disabled",2),F=s([v("primer-vault-payment-submit"),w()],F);function Br(i){return i?{paddingHorizontal:0,placeholder:{color:i.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim()},height:i.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim(),color:i.getPropertyValue("--primer-color-text-primary").trim()}:null}var Ja=y` :host { display: block; margin-top: var(--primer-space-medium); } .cvv-input-container { margin-bottom: var(--primer-space-medium); } `;var H=class extends g{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this.isFocused=!1;this._setupCVVIframe=new L(this,{task:([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===null?M:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new L(this,{task:async([e])=>{if(!e)return M;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=Br(this.computedStyles),a=o?{input:{base:o}}:void 0,n={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:a};this.cvvInput=await e.createCvvInput?.(n)??null,this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}),this.cvvInput.addListener("focus",()=>{this.onFocus()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null,this.isFocused=!1)}onFocus(){this.isFocused=!0}render(){return this._setupCVVIframe.render({error:()=>u,complete:()=>p`<div class="cvv-input-container"><primer-input-wrapper .focusWithin=${this.isFocused} .hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)} ><slot name="label" slot="label"><primer-input-label>CVV</primer-input-label></slot><div slot="input" id="${this.cvvContainerId}"></div>${I(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>p`<primer-input-error slot="error">${this.cvvError}</primer-input-error>`)}</primer-input-wrapper></div>`})}};H.styles=[E,Ja],s([C({context:X,subscribe:!0}),c({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],H.prototype,"vaultManagerFormContext",2),s([C({context:me,subscribe:!0}),c({type:Object,attribute:!1})],H.prototype,"vaultManagerCvvContext",2),s([C({context:He,subscribe:!0}),c()],H.prototype,"computedStyles",2),s([c({type:Object})],H.prototype,"paymentMethod",2),s([_()],H.prototype,"cvvError",2),s([_()],H.prototype,"cvvInputIsDirty",2),s([_()],H.prototype,"cvvInputIsBlurred",2),s([_()],H.prototype,"cvvInput",2),s([_()],H.prototype,"isFocused",2),H=s([v("primer-vault-cvv-input"),w()],H);var Za=y` :host { display: flex; width: 100%; align-items: center; } /* Card icons */ .payment-method-icon { height: var(--primer-space-xlarge); object-fit: contain; flex-shrink: 0; transition: transform var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-icon-generic { display: flex; align-items: center; justify-content: center; color: var(--primer-color-gray-500); height: var(--primer-space-xlarge); flex-shrink: 0; } .payment-method-details { flex: 1; display: flex; flex-direction: column; gap: var(--primer-space-xsmall); align-items: flex-start; transition: transform var(--primer-animation-duration) var(--primer-animation-easing); margin-left: var(--primer-space-small); } .payment-method-card { flex: 1; width: 100%; display: flex; flex-direction: column; gap: var(--primer-space-xsmall); transition: transform var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-description { font-weight: var(--primer-typography-title-large-weight); color: var(--primer-color-text-primary); transition: color var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-secondary-description { font-size: var(--primer-typography-body-small-size); color: var(--primer-color-text-secondary); transition: color var(--primer-animation-duration) var(--primer-animation-easing); } .payment-method-row { display: grid; grid-template-columns: 200px 100px; justify-content: space-between; align-items: center; } .cell-2 { grid-column: 2; display: flex; justify-content: flex-end; align-items: center; } .payment-method-header { font-weight: var(--primer-typography-body-large-weight); font-size: var(--primer-typography-body-large-size); line-height: var(--primer-typography-body-large-line-height); color: var(--primer-color-text-primary); letter-spacing: var(--primer-typography-body-large-letter-spacing); } .payment-method-subtitle { color: var(--primer-color-text-secondary); font-size: var(--primer-typography-body-small-size); line-height: var(--primer-typography-body-small-line-height); font-weight: var(--primer-typography-body-small-weight); letter-spacing: var(--primer-typography-body-small-letter-spacing); } .flex { display: flex; align-items: flex-end; gap: var(--primer-space-xsmall); } .payment-method-card-other { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: var(--primer-space-medium); align-items: center; justify-content: space-between; } .payment-method-right-column-text { font-size: var(--primer-typography-body-medium-size); font-weight: var(--primer-typography-body-medium-weight); line-height: var(--primer-typography-body-medium-line-height); letter-spacing: var(--primer-typography-body-medium-letter-spacing); } `;var Ee=class extends g{constructor(){super(...arguments);this.assetConfig=null}render(){if(!this.assetConfig)return u;let e=this.assetConfig.description,r=this.assetConfig.icon,o=I(this.assetConfig.icon,()=>p`<img class="payment-method-icon" src=${r} alt=${e} />`,()=>p`<div class="payment-method-icon payment-method-icon-generic"><primer-icon name="payment-card" size="sm"></primer-icon></div>`);return this.assetConfig.type==="other"&&this.assetConfig.paymentMethodType!=="ACH"?p`<div class="payment-method-card-other"><div class="left-column"><div class="payment-method-header">${this.assetConfig.fullName}</div><div class="flex">${o}<span class="payment-method-subtitle" >${this.assetConfig.paymentMethodType}</span ></div></div><div class="payment-method-right-column-text">${this.assetConfig.email||`\u2022\u2022\u2022\u2022 ${this.assetConfig.last4}`}</div></div>`:this.assetConfig.type==="other"&&this.assetConfig.paymentMethodType==="ACH"?p`<span class="payment-method-card"><div class="payment-method-row"><span class="payment-method-header" >${this.assetConfig.fullName}</span ><span class="payment-method-header cell-2" >•••• ${this.assetConfig.last4}</span ></div><div class="payment-method-row"><span class="flex">${o}<span class="payment-method-subtitle" >${this.assetConfig.bankName}</span ></span><span class="payment-method-subtitle cell-2" >${this.assetConfig.accountType}</span ></div></span>`:this.assetConfig.type==="card"?p`<span class="payment-method-card"><div class="payment-method-row"><span class="payment-method-header" >${this.assetConfig.cardholderName}</span ><span class="payment-method-header cell-2" >•••• ${this.assetConfig.last4}</span ></div><div class="payment-method-row"><span class="flex">${o}<span class="payment-method-subtitle" >${this.assetConfig.network}</span ></span><span class="payment-method-subtitle cell-2" >${this.assetConfig.expiresDate}</span ></div></span>`:u}};Ee.styles=[E,Za],s([c({type:Object,attribute:!1})],Ee.prototype,"assetConfig",2),Ee=s([v("primer-payment-method-content")],Ee);var Et="card-form-context";var Xa=y` :host { display: contents; } form { display: flex; flex-direction: column; gap: var(--primer-space-medium); width: 100%; } .card-form { display: flex; flex-direction: column; gap: var(--primer-space-medium); margin-bottom: var(--primer-space-medium); } .card-form-row { display: flex; gap: var(--primer-space-small); } `;var se=class extends g{constructor(){super(...arguments);this.hideLabels=!1;this.disabled=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new z(this,{context:Et,initialValue:null});this.eventsController=new mt(this);this.setupCardFormTask=new L(this,{task:([e])=>{if(!e?.manager)return M;let{manager:r}=e,o=r.createHostedInputs(),{cardNumberInput:a,expiryInput:n,cvvInput:l}=o;return this.cardFormProvider.setValue({cardHolderNameInput:o.cardHolderNameInput,cardNumberInput:a,expiryInput:n,cvvInput:l,setCardholderName:d=>r.setCardholderName(d),setCardNetwork:d=>{this.selectedCardNetwork=d},validate:()=>r.validate(),submit:d=>r.submit(d),hideLabels:this.hideLabels,disabled:this.disabled}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;let a=o;this.isSubmitButton(a)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}updated(e){super.updated(e),(e.has("hideLabels")||e.has("disabled"))&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels,disabled:this.disabled})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer:card-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer:card-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),o=r==="button",a=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||a&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e||this.disabled)return;let r=await e.validate?.();if(r?.valid){let o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===Be.ERROR||this.setupCardFormTask.status===Be.INITIAL?u:p`<form @submit=${this.handleFormSubmit}><slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>${this.setupCardFormTask.render({complete:()=>I(this.hasAssignedContent,()=>u,()=>p`<div class="card-form"><primer-input-card-number></primer-input-card-number><div class="card-form-row"><primer-input-card-expiry></primer-input-card-expiry><primer-input-cvv></primer-input-cvv></div><primer-input-card-holder-name></primer-input-card-holder-name></div><primer-card-form-submit></primer-card-form-submit>`)})}</form>`}};se.styles=[E,Xa],s([c({type:Boolean,attribute:"hide-labels",reflect:!0})],se.prototype,"hideLabels",2),s([c({type:Boolean,attribute:"disabled"})],se.prototype,"disabled",2),s([_()],se.prototype,"hasAssignedContent",2),s([_()],se.prototype,"selectedCardNetwork",2),s([C({context:Z,subscribe:!0}),c({type:Object})],se.prototype,"paymentManagers",2),se=s([v("primer-card-form"),w()],se);function Qa(i,t){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
|
|
2215
149
|
input[data-custom-input]::placeholder {
|
|
2216
150
|
color: var(--primer-color-text-placeholder);
|
|
2217
151
|
font-size: var(--primer-typography-body-large-size);
|
|
@@ -2220,486 +154,28 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2220
154
|
input[data-custom-input]:focus {
|
|
2221
155
|
outline: none;
|
|
2222
156
|
}
|
|
2223
|
-
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Lo(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var ur=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new M(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return E;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):E}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,To(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(a=>requestAnimationFrame(()=>a())),this._hostedInput=t;let r=mr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",a=>{this._meta=a,Lo(this._meta,a)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var V=class extends m{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:y(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new ur(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===Te.ERROR)return p;let e=this.getError();return d`
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
.card-number-container {
|
|
2250
|
-
display: flex;
|
|
2251
|
-
align-items: center;
|
|
2252
|
-
width: 100%;
|
|
2253
|
-
position: relative;
|
|
2254
|
-
gap: var(--primer-space-small);
|
|
2255
|
-
}
|
|
2256
|
-
|
|
2257
|
-
#cardNumber {
|
|
2258
|
-
flex: 1;
|
|
2259
|
-
display: flex;
|
|
2260
|
-
width: 100%;
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
.network-selector-container {
|
|
2264
|
-
display: flex;
|
|
2265
|
-
align-items: center;
|
|
2266
|
-
z-index: 2;
|
|
2267
|
-
}
|
|
2268
|
-
`;var De=c`
|
|
2269
|
-
.card-input-slot {
|
|
2270
|
-
display: flex;
|
|
2271
|
-
}
|
|
2272
|
-
`;var ve=class extends V{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===Te.ERROR)return p;let e=this.getError();return d`
|
|
2273
|
-
<primer-input-wrapper
|
|
2274
|
-
.focusWithin="${this.hostedInputController.isFocused}"
|
|
2275
|
-
.hasError=${!!e}
|
|
2276
|
-
>
|
|
2277
|
-
${_(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
2278
|
-
>${this.label}</primer-input-label
|
|
2279
|
-
>`,()=>p)}
|
|
2280
|
-
<div
|
|
2281
|
-
slot="input"
|
|
2282
|
-
class="card-number-container"
|
|
2283
|
-
aria-label="${this.ariaLabel}"
|
|
2284
|
-
>
|
|
2285
|
-
<div id="${this.config.containerSelector.substring(1)}"></div>
|
|
2286
|
-
<div class="network-selector-container">
|
|
2287
|
-
<primer-card-network-selector
|
|
2288
|
-
@network-selected=${this.handleNetworkSelected}
|
|
2289
|
-
></primer-card-network-selector>
|
|
2290
|
-
</div>
|
|
2291
|
-
</div>
|
|
2292
|
-
${_(e,r=>d`
|
|
2293
|
-
<primer-input-error slot="error">
|
|
2294
|
-
${y(r,{id:r})}
|
|
2295
|
-
</primer-input-error>
|
|
2296
|
-
`,()=>p)}
|
|
2297
|
-
</primer-input-wrapper>
|
|
2298
|
-
`}render(){return this.renderInput()}};ve.styles=[v,De,Io],ve=s([h("primer-input-card-number"),S()],ve);var No=c`
|
|
2299
|
-
:host {
|
|
2300
|
-
display: contents;
|
|
2301
|
-
}
|
|
2302
|
-
`;var be=class extends V{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};be.styles=[v,De,No],be=s([h("primer-input-cvv"),S()],be);var $o=c`
|
|
2303
|
-
:host {
|
|
2304
|
-
display: contents;
|
|
2305
|
-
}
|
|
2306
|
-
`;var xe=class extends V{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};xe.styles=[v,De,$o],xe=s([h("primer-input-card-expiry"),S()],xe);var Oo=c`
|
|
2307
|
-
:host {
|
|
2308
|
-
display: contents;
|
|
2309
|
-
}
|
|
2310
|
-
`;var Ce=class extends V{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};Ce.styles=[v,De,Oo],Ce=s([h("primer-input-card-holder-name"),S()],Ce);var Ro=c`
|
|
2311
|
-
:host {
|
|
2312
|
-
display: contents;
|
|
2313
|
-
}
|
|
2314
|
-
`;var H=class extends m{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=e=>{if(e.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:y("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:p;return d`
|
|
2315
|
-
<primer-button
|
|
2316
|
-
type="submit"
|
|
2317
|
-
variant=${this.variant}
|
|
2318
|
-
?disabled=${this.disabled}
|
|
2319
|
-
@click=${this.handleClick}
|
|
2320
|
-
.loading=${!!this.sdkState?.isProcessing}
|
|
2321
|
-
data-submit
|
|
2322
|
-
>
|
|
2323
|
-
${this.buttonText}${r}
|
|
2324
|
-
</primer-button>
|
|
2325
|
-
`}};H.styles=[v,Ro],s([l({type:String})],H.prototype,"buttonText",1),s([f({context:$,subscribe:!0}),l({type:Object})],H.prototype,"headlessInstance",2),s([f({context:_e,subscribe:!0}),l({type:Object})],H.prototype,"clientOptions",2),s([f({context:T,subscribe:!0}),l()],H.prototype,"sdkState",2),s([l({type:String})],H.prototype,"variant",2),s([l({type:Boolean})],H.prototype,"disabled",2),H=s([h("primer-card-form-submit"),S()],H);var Gr=()=>new jr,jr=class{},Kr=new WeakMap,gr=me(class extends Oe{render(i){return p}update(i,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),p}rt(i){if(this.isConnected||(i=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Kr.get(t);e===void 0&&(e=new WeakMap,Kr.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){return typeof this.G=="function"?Kr.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Do=c`
|
|
2326
|
-
:host {
|
|
2327
|
-
display: flex;
|
|
2328
|
-
align-items: center;
|
|
2329
|
-
position: relative;
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
.network-selector {
|
|
2333
|
-
display: flex;
|
|
2334
|
-
align-items: center;
|
|
2335
|
-
cursor: pointer;
|
|
2336
|
-
background: none;
|
|
2337
|
-
padding: unset;
|
|
2338
|
-
border: none;
|
|
2339
|
-
transition: opacity var(--primer-animation-duration)
|
|
2340
|
-
var(--primer-animation-easing);
|
|
2341
|
-
outline: none;
|
|
2342
|
-
gap: var(--primer-space-xsmall);
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
.network-selector:hover {
|
|
2346
|
-
opacity: 0.8;
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
.network-selector:focus-visible {
|
|
2350
|
-
outline: 2px solid var(--primer-color-focus);
|
|
2351
|
-
border-radius: var(--primer-radius-xsmall);
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
.network-icon {
|
|
2355
|
-
width: var(--primer-size-large);
|
|
2356
|
-
height: var(
|
|
2357
|
-
--primer-size-medium
|
|
2358
|
-
); /* Added explicit height to maintain aspect ratio */
|
|
2359
|
-
object-fit: contain;
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
.caret {
|
|
2363
|
-
margin-left: var(--primer-space-xsmall);
|
|
2364
|
-
transition: transform var(--primer-animation-duration)
|
|
2365
|
-
var(--primer-animation-easing);
|
|
2366
|
-
color: var(--primer-color-icon-primary);
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
.caret.open {
|
|
2370
|
-
transform: rotate(180deg);
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
.dropdown {
|
|
2374
|
-
position: absolute;
|
|
2375
|
-
top: 100%;
|
|
2376
|
-
right: 0;
|
|
2377
|
-
width: max-content;
|
|
2378
|
-
min-width: calc(var(--primer-size-xxxlarge) * 3);
|
|
2379
|
-
background: var(--primer-color-gray-000);
|
|
2380
|
-
border-radius: var(--primer-radius-small);
|
|
2381
|
-
box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large)
|
|
2382
|
-
rgba(0, 0, 0, 0.15);
|
|
2383
|
-
z-index: 10;
|
|
2384
|
-
overflow: hidden;
|
|
2385
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
.dropdown:not(.open) {
|
|
2389
|
-
display: none;
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
.dropdown.open {
|
|
2393
|
-
display: block;
|
|
2394
|
-
max-height: calc(var(--primer-size-xxxlarge) * 4);
|
|
2395
|
-
overflow-y: auto;
|
|
2396
|
-
}
|
|
2397
|
-
|
|
2398
|
-
.network-option {
|
|
2399
|
-
display: flex;
|
|
2400
|
-
align-items: center;
|
|
2401
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2402
|
-
cursor: pointer;
|
|
2403
|
-
transition: background-color var(--primer-animation-duration)
|
|
2404
|
-
var(--primer-animation-easing);
|
|
2405
|
-
position: relative;
|
|
2406
|
-
outline: none;
|
|
2407
|
-
background-color: transparent;
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
/* Only apply hover effect when not in keyboard navigation mode */
|
|
2411
|
-
.network-option:hover {
|
|
2412
|
-
background-color: var(--primer-color-gray-100);
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
/* Apply focused style only when the focused class is present (keyboard navigation) */
|
|
2416
|
-
.network-option.focused {
|
|
2417
|
-
background-color: var(--primer-color-gray-100);
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
.network-option:focus-visible {
|
|
2421
|
-
outline: 2px solid var(--primer-color-focus);
|
|
2422
|
-
outline-offset: -2px;
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
.network-option-icon {
|
|
2426
|
-
width: var(--primer-size-medium);
|
|
2427
|
-
height: var(--primer-size-small);
|
|
2428
|
-
margin-right: var(--primer-space-small);
|
|
2429
|
-
object-fit: contain;
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
.network-name {
|
|
2433
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
2434
|
-
font-family: var(--primer-typography-body-medium-font);
|
|
2435
|
-
line-height: var(--primer-typography-body-medium-line-height);
|
|
2436
|
-
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
2437
|
-
white-space: nowrap;
|
|
2438
|
-
color: var(--primer-color-text-primary);
|
|
2439
|
-
flex: 1;
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
.checkmark {
|
|
2443
|
-
margin-left: var(--primer-space-small);
|
|
2444
|
-
color: var(--primer-color-brand);
|
|
2445
|
-
width: var(--primer-size-small);
|
|
2446
|
-
height: var(--primer-size-small);
|
|
2447
|
-
}
|
|
2448
|
-
`;var z=class extends m{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Gr();this.dropdownRef=Gr();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return d`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return d`
|
|
2449
|
-
<button
|
|
2450
|
-
${gr(this.buttonRef)}
|
|
2451
|
-
class="network-selector"
|
|
2452
|
-
@click=${this.toggleDropdown}
|
|
2453
|
-
@keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
2454
|
-
aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
2455
|
-
aria-expanded=${o?this.isDropdownOpen:p}
|
|
2456
|
-
aria-haspopup=${o?"true":p}
|
|
2457
|
-
aria-controls=${o?"network-dropdown":p}
|
|
2458
|
-
>
|
|
2459
|
-
<img
|
|
2460
|
-
class="network-icon"
|
|
2461
|
-
src=${this.getNetworkIconUrl(r)}
|
|
2462
|
-
alt=${r.displayName}
|
|
2463
|
-
/>
|
|
2464
|
-
${_(o,()=>d`
|
|
2465
|
-
<primer-icon
|
|
2466
|
-
class="caret ${this.isDropdownOpen?"open":""}"
|
|
2467
|
-
size="sm"
|
|
2468
|
-
name="chevron-down"
|
|
2469
|
-
></primer-icon>
|
|
2470
|
-
`,()=>p)}
|
|
2471
|
-
</button>
|
|
2472
|
-
|
|
2473
|
-
${_(this.isDropdownOpen,()=>d`
|
|
2474
|
-
<div
|
|
2475
|
-
${gr(this.dropdownRef)}
|
|
2476
|
-
id="network-dropdown"
|
|
2477
|
-
class="dropdown open"
|
|
2478
|
-
role="listbox"
|
|
2479
|
-
aria-label="Select card network"
|
|
2480
|
-
>
|
|
2481
|
-
${e.map((a,n)=>d`
|
|
2482
|
-
<div
|
|
2483
|
-
${gr(u=>this.setNetworkOptionRef(u,n))}
|
|
2484
|
-
class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
|
|
2485
|
-
@click=${u=>this.selectNetwork(u,a)}
|
|
2486
|
-
@keydown=${u=>{(u.key==="Enter"||u.key===" ")&&this.selectNetwork(u,a)}}
|
|
2487
|
-
role="option"
|
|
2488
|
-
aria-selected=${a.network===r.network}
|
|
2489
|
-
tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
|
|
2490
|
-
>
|
|
2491
|
-
<img
|
|
2492
|
-
class="network-option-icon"
|
|
2493
|
-
src=${this.getNetworkIconUrl(a)}
|
|
2494
|
-
alt=${a.displayName}
|
|
2495
|
-
/>
|
|
2496
|
-
<span class="network-name">${a.displayName}</span>
|
|
2497
|
-
${_(a.network===r.network,()=>d`
|
|
2498
|
-
<primer-icon
|
|
2499
|
-
class="checkmark"
|
|
2500
|
-
name="checkmark"
|
|
2501
|
-
size="sm"
|
|
2502
|
-
></primer-icon>
|
|
2503
|
-
`,()=>p)}
|
|
2504
|
-
</div>
|
|
2505
|
-
`)}
|
|
2506
|
-
</div>
|
|
2507
|
-
`,()=>p)}
|
|
2508
|
-
`}};z.styles=[v,Do],s([f({context:Pt,subscribe:!0})],z.prototype,"cardNetworks",2),s([f({context:$,subscribe:!0})],z.prototype,"headlessUtils",2),s([x()],z.prototype,"selectedCardNetwork",2),s([x()],z.prototype,"isDropdownOpen",2),s([x()],z.prototype,"focusedNetworkIndex",2),s([x()],z.prototype,"isKeyboardNavigation",2),z=s([h("primer-card-network-selector")],z);var Vo=c`
|
|
2509
|
-
:host {
|
|
2510
|
-
display: block;
|
|
2511
|
-
margin-top: var(--primer-space-medium);
|
|
2512
|
-
margin-bottom: var(--primer-space-medium);
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
|
-
.other-payment-methods-container {
|
|
2516
|
-
width: 100%;
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
.other-payment-methods-content {
|
|
2520
|
-
padding: var(--primer-space-medium) 0;
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
.primer-loader {
|
|
2524
|
-
display: flex;
|
|
2525
|
-
justify-content: center;
|
|
2526
|
-
align-items: center;
|
|
2527
|
-
}
|
|
2528
|
-
`;var Ve=class extends m{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?p:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
|
|
2529
|
-
<div class="other-payment-methods-container">
|
|
2530
|
-
<primer-collapsable
|
|
2531
|
-
buttonVariant="secondary"
|
|
2532
|
-
.expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
|
|
2533
|
-
.header="${y("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
2534
|
-
>
|
|
2535
|
-
<div class="other-payment-methods-content">
|
|
2536
|
-
<slot name="other-payments"></slot>
|
|
2537
|
-
</div>
|
|
2538
|
-
</primer-collapsable>
|
|
2539
|
-
</div>
|
|
2540
|
-
`}};Ve.styles=[Vo],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1})],Ve.prototype,"vaultManager",2),Ve=s([h("primer-show-other-payments")],Ve);var Ho=c`
|
|
2541
|
-
:host {
|
|
2542
|
-
height: calc(
|
|
2543
|
-
var(--primer-typography-title-large-line-height) +
|
|
2544
|
-
calc(2 * var(--primer-space-medium))
|
|
2545
|
-
);
|
|
2546
|
-
display: flex;
|
|
2547
|
-
}
|
|
2548
|
-
|
|
2549
|
-
.native-button-container {
|
|
2550
|
-
width: 100%;
|
|
2551
|
-
height: 100%;
|
|
2552
|
-
flex: 1;
|
|
2553
|
-
}
|
|
2554
|
-
`;var se=class extends m{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new M(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return E;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new M(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return E;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=e.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),e}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>p,complete:()=>d`
|
|
2555
|
-
<!-- The native button container is rendered first -->
|
|
2556
|
-
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
2557
|
-
`,pending:()=>p})}};se.styles=[v,Ho],s([l({type:Object})],se.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0}),l()],se.prototype,"paymentManagers",2),s([f({context:Pe,subscribe:!0}),l()],se.prototype,"computedStyles",2),se=s([h("primer-native-payment")],se);var ot=class extends m{render(){return d`
|
|
2558
|
-
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
2559
|
-
`}};ot=s([h("primer-checkout-complete")],ot);var Ze=class extends m{constructor(){super(...arguments);this.sdkState=null}render(){return d`
|
|
2560
|
-
<primer-checkout-state
|
|
2561
|
-
type="failure"
|
|
2562
|
-
description=${this.sdkState?.error?.message||""}
|
|
2563
|
-
></primer-checkout-state>
|
|
2564
|
-
`}};s([f({context:T,subscribe:!0}),l()],Ze.prototype,"sdkState",2),Ze=s([h("primer-checkout-error")],Ze);var zo=c`
|
|
2565
|
-
:host {
|
|
2566
|
-
display: block;
|
|
2567
|
-
width: 100%;
|
|
2568
|
-
}
|
|
2569
|
-
`;var Ee=class extends m{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?d`
|
|
2570
|
-
<primer-error-message
|
|
2571
|
-
message="${y(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
2572
|
-
?visible="${this.shouldShowError}"
|
|
2573
|
-
></primer-error-message>
|
|
2574
|
-
`:p}};Ee.styles=[zo],s([f({context:T,subscribe:!0}),x()],Ee.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],Ee.prototype,"showProcessingErrors",2),Ee=s([h("primer-error-message-container")],Ee);var Yo=c`
|
|
2575
|
-
:host {
|
|
2576
|
-
display: contents;
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
.primer-main-list {
|
|
2580
|
-
display: flex;
|
|
2581
|
-
flex-direction: column;
|
|
2582
|
-
gap: var(--primer-space-small);
|
|
2583
|
-
}
|
|
2584
|
-
|
|
2585
|
-
.primer-is-processing {
|
|
2586
|
-
opacity: 0.5;
|
|
2587
|
-
pointer-events: none;
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
primer-vault-manager {
|
|
2591
|
-
margin-bottom: var(--primer-space-xlarge);
|
|
2592
|
-
}
|
|
2593
|
-
`;var Se=class extends m{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?d`
|
|
2594
|
-
<slot name="checkout-complete">
|
|
2595
|
-
<primer-checkout-complete></primer-checkout-complete>
|
|
2596
|
-
</slot>
|
|
2597
|
-
`:d`
|
|
2598
|
-
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
2599
|
-
${_(this.hasAssignedContent,()=>p,()=>d`
|
|
2600
|
-
<div
|
|
2601
|
-
class=${R({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
2602
|
-
>
|
|
2603
|
-
<primer-vault-manager></primer-vault-manager>
|
|
2604
|
-
<primer-show-other-payments>
|
|
2605
|
-
<div slot="other-payments" class="primer-main-list">
|
|
2606
|
-
${this.paymentMethods?.toArray().map(e=>d`
|
|
2607
|
-
<primer-payment-method
|
|
2608
|
-
type=${e.type}
|
|
2609
|
-
></primer-payment-method>
|
|
2610
|
-
`)}
|
|
2611
|
-
</div>
|
|
2612
|
-
</primer-show-other-payments>
|
|
2613
|
-
<primer-error-message-container></primer-error-message-container>
|
|
2614
|
-
</div>
|
|
2615
|
-
`)}
|
|
2616
|
-
`}};Se.styles=[v,Yo],s([f({context:et,subscribe:!0}),l()],Se.prototype,"paymentMethods",2),s([f({context:T,subscribe:!0}),l()],Se.prototype,"sdkState",2),Se=s([h("primer-main")],Se);async function CE(){Yi(),Ui()}export{j as AchPayment,K as Button,te as CardForm,be as CardFormCVV,z as CardFormCardNetworkSelector,ve as CardFormCardNumber,ue as CardFormError,xe as CardFormExpiry,Ce as CardFormName,H as CardFormSubmit,F as Collapsable,We as Dialog,J as DynamicPayment,X as ErrorMessage,Ee as ErrorMessageContainer,Qt as InitializedPayments,k as Input,he as InputLabel,ie as InputWrapper,se as NativePayment,fe as PaymentMethod,$e as Portal,ot as PrimerCheckoutComplete,W as PrimerCheckoutComponent,Ze as PrimerCheckoutFailure,ge as PrimerCheckoutState,oe as PrimerIcon,D as PrimerKlarna,Se as PrimerMain,Q as RedirectPayment,Ve as ShowOtherPayments,re as Spinner,N as VaultCvvInput,q as VaultDeleteConfirmation,ye as VaultEmptyState,ae as VaultErrorMessage,G as VaultManager,ee as VaultManagerHeader,B as VaultPaymentMethodItem,I as VaultPaymentSubmit,La as injectDarkTheme,Ta as injectLightTheme,Yi as injectLoaderStyles,Ui as injectThemeStyles,CE as loadPrimer};
|
|
2617
|
-
/*! Bundled license information:
|
|
2618
|
-
|
|
2619
|
-
@lit/context/lib/context-request-event.js:
|
|
2620
|
-
@lit/context/lib/create-context.js:
|
|
2621
|
-
@lit/context/lib/controllers/context-consumer.js:
|
|
2622
|
-
@lit/context/lib/value-notifier.js:
|
|
2623
|
-
@lit/context/lib/controllers/context-provider.js:
|
|
2624
|
-
@lit/context/lib/context-root.js:
|
|
2625
|
-
@lit/localize/internal/locale-status-event.js:
|
|
2626
|
-
@lit/localize/internal/str-tag.js:
|
|
2627
|
-
@lit/localize/internal/types.js:
|
|
2628
|
-
@lit/localize/internal/default-msg.js:
|
|
2629
|
-
@lit/localize/internal/localized-controller.js:
|
|
2630
|
-
@lit/localize/internal/localized-decorator.js:
|
|
2631
|
-
@lit/localize/internal/runtime-msg.js:
|
|
2632
|
-
@lit/localize/init/runtime.js:
|
|
2633
|
-
@lit/localize/init/transform.js:
|
|
2634
|
-
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
2635
|
-
lit-html/directives/when.js:
|
|
2636
|
-
(**
|
|
2637
|
-
* @license
|
|
2638
|
-
* Copyright 2021 Google LLC
|
|
2639
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2640
|
-
*)
|
|
2641
|
-
|
|
2642
|
-
@lit/context/lib/decorators/provide.js:
|
|
2643
|
-
@lit/reactive-element/reactive-element.js:
|
|
2644
|
-
@lit/task/task.js:
|
|
2645
|
-
@lit/reactive-element/reactive-element.js:
|
|
2646
|
-
lit-html/lit-html.js:
|
|
2647
|
-
lit-element/lit-element.js:
|
|
2648
|
-
@lit/reactive-element/decorators/custom-element.js:
|
|
2649
|
-
@lit/reactive-element/decorators/property.js:
|
|
2650
|
-
@lit/reactive-element/decorators/state.js:
|
|
2651
|
-
@lit/reactive-element/decorators/event-options.js:
|
|
2652
|
-
@lit/reactive-element/decorators/base.js:
|
|
2653
|
-
@lit/reactive-element/decorators/query.js:
|
|
2654
|
-
@lit/reactive-element/decorators/query-all.js:
|
|
2655
|
-
@lit/reactive-element/decorators/query-async.js:
|
|
2656
|
-
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
2657
|
-
lit-html/directive.js:
|
|
2658
|
-
lit-html/async-directive.js:
|
|
2659
|
-
(**
|
|
2660
|
-
* @license
|
|
2661
|
-
* Copyright 2017 Google LLC
|
|
2662
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2663
|
-
*)
|
|
2664
|
-
|
|
2665
|
-
@lit/context/lib/decorators/consume.js:
|
|
2666
|
-
lit-html/is-server.js:
|
|
2667
|
-
(**
|
|
2668
|
-
* @license
|
|
2669
|
-
* Copyright 2022 Google LLC
|
|
2670
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2671
|
-
*)
|
|
2672
|
-
|
|
2673
|
-
@lit/reactive-element/css-tag.js:
|
|
2674
|
-
@lit/reactive-element/css-tag.js:
|
|
2675
|
-
(**
|
|
2676
|
-
* @license
|
|
2677
|
-
* Copyright 2019 Google LLC
|
|
2678
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2679
|
-
*)
|
|
2680
|
-
|
|
2681
|
-
@lit/localize/internal/deferred.js:
|
|
2682
|
-
@lit/localize/internal/id-generation.js:
|
|
2683
|
-
@lit/localize/lit-localize.js:
|
|
2684
|
-
lit-html/directive-helpers.js:
|
|
2685
|
-
lit-html/directives/ref.js:
|
|
2686
|
-
(**
|
|
2687
|
-
* @license
|
|
2688
|
-
* Copyright 2020 Google LLC
|
|
2689
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2690
|
-
*)
|
|
2691
|
-
|
|
2692
|
-
@lit/localize/internal/fnv1a64.js:
|
|
2693
|
-
(**
|
|
2694
|
-
* @license
|
|
2695
|
-
* Copyright 2014 Travis Webb
|
|
2696
|
-
* SPDX-License-Identifier: MIT
|
|
2697
|
-
*)
|
|
2698
|
-
|
|
2699
|
-
lit-html/directives/class-map.js:
|
|
2700
|
-
(**
|
|
2701
|
-
* @license
|
|
2702
|
-
* Copyright 2018 Google LLC
|
|
2703
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2704
|
-
*)
|
|
2705
|
-
*/
|
|
157
|
+
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function en(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var Fr=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new L(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:e.cardHolderNameInput??"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return M;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):M}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,Qa(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(a=>requestAnimationFrame(()=>a())),this._hostedInput=t;let r=Br(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",a=>{this._meta=a,en(this._meta,a)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var W=class extends g{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.handleWrapperClick=()=>{this.hostedInputController.focusInput()};this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:x(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new Fr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===Be.ERROR)return u;let e=this.getError();return p`<primer-input-wrapper .focusWithin="${this.hostedInputController.isFocused}" .hasError=${!!e} @wrapper-click="${this.handleWrapperClick}" >${I(!this.cardFormContext?.hideLabels,()=>p`<primer-input-label slot="label" >${this.label}</primer-input-label >`,()=>u)}<div slot="input" class="card-input-slot" id="${this.config.containerSelector.substring(1)}" aria-label="${this.ariaLabel}" ></div>${I(e,()=>p`<primer-input-error slot="error">${x(e,{id:e})}</primer-input-error>`,()=>u)}</primer-input-wrapper>`}};s([C({context:Et,subscribe:!0})],W.prototype,"cardFormContext",2),s([C({context:He,subscribe:!0}),c()],W.prototype,"computedStyles",2),s([c({type:String})],W.prototype,"label",1),s([c({type:String})],W.prototype,"placeholder",1),s([c({type:String,attribute:"aria-label"})],W.prototype,"ariaLabel",1);var tn=y` :host { display: contents; } .card-number-container { display: flex; align-items: center; width: 100%; position: relative; gap: var(--primer-space-small); } #cardNumber { flex: 1; display: flex; width: 100%; } .network-selector-container { display: flex; align-items: center; z-index: 2; } `;var Je=y` .card-input-slot { display: flex; } `;var Oe=class extends W{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.handleNetworkSelected=e=>{let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)};this.childUpdated()}renderInput(){if(this.hostedInputController.setupTask.status===Be.ERROR)return u;let e=this.getError();return p`<primer-input-wrapper .focusWithin="${this.hostedInputController.isFocused}" .hasError=${!!e} >${I(!this.cardFormContext?.hideLabels,()=>p`<primer-input-label slot="label" >${this.label}</primer-input-label >`,()=>u)}<div slot="input" class="card-number-container" aria-label="${this.ariaLabel}" ><div id="${this.config.containerSelector.substring(1)}"></div><div class="network-selector-container"><primer-card-network-selector @network-selected=${this.handleNetworkSelected} ></primer-card-network-selector></div></div>${I(e,r=>p`<primer-input-error slot="error">${x(r,{id:r})}</primer-input-error>`,()=>u)}</primer-input-wrapper>`}render(){return this.renderInput()}};Oe.styles=[E,Je,tn],Oe=s([v("primer-input-card-number"),w()],Oe);var rn=y` :host { display: contents; } `;var Re=class extends W{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Re.styles=[E,Je,rn],Re=s([v("primer-input-cvv"),w()],Re);var on=y` :host { display: contents; } `;var De=class extends W{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};De.styles=[E,Je,on],De=s([v("primer-input-card-expiry"),w()],De);var an=y` :host { display: contents; } `;var $e=class extends W{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};$e.styles=[E,Je,an],$e=s([v("primer-input-card-holder-name"),w()],$e);var nn=y` :host { display: contents; } `;var G=class extends g{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.cardFormContext=null;this.variant="primary";this.disabled=!1;this.handleClick=e=>{if(e.preventDefault(),this.disabled)return;let r=new CustomEvent("primer:card-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:x("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u,o=this.disabled||this.cardFormContext?.disabled||!1;return p`<primer-button type="submit" variant=${this.variant} ?disabled=${o} @click=${this.handleClick} .loading=${!!this.sdkState?.isProcessing} data-submit >${this.buttonText}${r}</primer-button>`}};G.styles=[E,nn],s([c({type:String})],G.prototype,"buttonText",1),s([C({context:U,subscribe:!0}),c({type:Object})],G.prototype,"headlessInstance",2),s([C({context:pe,subscribe:!0}),c({type:Object})],G.prototype,"clientOptions",2),s([C({context:Y,subscribe:!0}),c()],G.prototype,"sdkState",2),s([C({context:Et,subscribe:!0}),c()],G.prototype,"cardFormContext",2),s([c({type:String})],G.prototype,"variant",2),s([c({type:Boolean})],G.prototype,"disabled",2),G=s([v("primer-card-form-submit"),w()],G);var Ri=()=>new Oi,Oi=class{},Ni=new WeakMap,jr=Te(class extends qe{render(i){return u}update(i,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),u}rt(i){if(this.isConnected||(i=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Ni.get(t);e===void 0&&(e=new WeakMap,Ni.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){return typeof this.G=="function"?Ni.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var sn=y` :host { display: flex; align-items: center; position: relative; } .network-selector { display: flex; align-items: center; cursor: pointer; background: none; padding: unset; border: none; transition: opacity var(--primer-animation-duration) var(--primer-animation-easing); outline: none; gap: var(--primer-space-xsmall); } .network-selector:hover { opacity: 0.8; } .network-selector:focus-visible { outline: 2px solid var(--primer-color-focus); border-radius: var(--primer-radius-xsmall); } .network-icon { width: var(--primer-size-large); height: var( --primer-size-medium ); /* Added explicit height to maintain aspect ratio */ object-fit: contain; } .caret { margin-left: var(--primer-space-xsmall); transition: transform var(--primer-animation-duration) var(--primer-animation-easing); color: var(--primer-color-icon-primary); } .caret.open { transform: rotate(180deg); } .dropdown { position: absolute; top: 100%; right: 0; width: max-content; min-width: calc(var(--primer-size-xxxlarge) * 3); background: var(--primer-color-gray-000); border-radius: var(--primer-radius-small); box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large) rgba(0, 0, 0, 0.15); z-index: 10; overflow: hidden; border: 1px solid var(--primer-color-border-outlined-default); } .dropdown:not(.open) { display: none; } .dropdown.open { display: block; max-height: calc(var(--primer-size-xxxlarge) * 4); overflow-y: auto; } .network-option { display: flex; align-items: center; padding: var(--primer-space-small) var(--primer-space-medium); cursor: pointer; transition: background-color var(--primer-animation-duration) var(--primer-animation-easing); position: relative; outline: none; background-color: transparent; } /* Only apply hover effect when not in keyboard navigation mode */ .network-option:hover { background-color: var(--primer-color-gray-100); } /* Apply focused style only when the focused class is present (keyboard navigation) */ .network-option.focused { background-color: var(--primer-color-gray-100); } .network-option:focus-visible { outline: 2px solid var(--primer-color-focus); outline-offset: -2px; } .network-option-icon { width: var(--primer-size-medium); height: var(--primer-size-small); margin-right: var(--primer-space-small); object-fit: contain; } .network-name { font-size: var(--primer-typography-body-medium-size); font-family: var(--primer-typography-body-medium-font); line-height: var(--primer-typography-body-medium-line-height); letter-spacing: var(--primer-typography-body-medium-letter-spacing); white-space: nowrap; color: var(--primer-color-text-primary); flex: 1; } .checkmark { margin-left: var(--primer-space-small); color: var(--primer-color-brand); width: var(--primer-size-small); height: var(--primer-size-small); } `;var J=class extends g{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Ri();this.dropdownRef=Ri();this.networkOptionRefs=[];this.toggleDropdown=e=>{this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))};this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return p`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return p`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return p`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return p`<button ${jr(this.buttonRef)} class="network-selector" @click=${this.toggleDropdown} @keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}} aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`} aria-expanded=${o?this.isDropdownOpen:u} aria-haspopup=${o?"true":u} aria-controls=${o?"network-dropdown":u} ><img class="network-icon" src=${this.getNetworkIconUrl(r)} alt=${r.displayName} />${I(o,()=>p`<primer-icon class="caret ${this.isDropdownOpen?"open":""}" size="sm" name="chevron-down" ></primer-icon>`,()=>u)}</button>${I(this.isDropdownOpen,()=>p`<div ${jr(this.dropdownRef)} id="network-dropdown" class="dropdown open" role="listbox" aria-label="Select card network" >${e.map((a,n)=>p`<div ${jr(l=>this.setNetworkOptionRef(l,n))} class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}" @click=${l=>this.selectNetwork(l,a)} @keydown=${l=>{(l.key==="Enter"||l.key===" ")&&this.selectNetwork(l,a)}} role="option" aria-selected=${a.network===r.network} tabindex="${n===this.focusedNetworkIndex?"0":"-1"}" ><img class="network-option-icon" src=${this.getNetworkIconUrl(a)} alt=${a.displayName} /><span class="network-name">${a.displayName}</span>${I(a.network===r.network,()=>p`<primer-icon class="checkmark" name="checkmark" size="sm" ></primer-icon>`,()=>u)}</div>`)}</div>`,()=>u)} `}};J.styles=[E,sn],s([C({context:Wt,subscribe:!0})],J.prototype,"cardNetworks",2),s([C({context:U,subscribe:!0})],J.prototype,"headlessUtils",2),s([_()],J.prototype,"selectedCardNetwork",2),s([_()],J.prototype,"isDropdownOpen",2),s([_()],J.prototype,"focusedNetworkIndex",2),s([_()],J.prototype,"isKeyboardNavigation",2),J=s([v("primer-card-network-selector")],J);var ln=y` :host { display: block; margin-top: var(--primer-space-medium); margin-bottom: var(--primer-space-medium); } .other-payment-methods-container { width: 100%; } .other-payment-methods-content { padding: var(--primer-space-medium) 0; } .primer-loader { display: flex; justify-content: center; align-items: center; } `;var Ze=class extends g{constructor(){super(...arguments);this.vaultManager=null}render(){if(this.vaultManager?.isLoading)return u;let e=this.vaultManager?.showEmptyState&&this.vaultManager?.vaultedPaymentMethods.length;return!this.vaultManager||!this.vaultManager.enabled||!e?p`<slot name="other-payments"></slot>`:p`<div class="other-payment-methods-container"><primer-collapsable buttonVariant="secondary" .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}" .header="${x("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}" ><div class="other-payment-methods-content"><slot name="other-payments"></slot></div></primer-collapsable></div>`}};Ze.styles=[ln],s([C({context:X,subscribe:!0}),c({type:Object,attribute:!1})],Ze.prototype,"vaultManager",2),Ze=s([v("primer-show-other-payments")],Ze);var dn=y` :host { height: calc( ${ue(fe)} + calc(2 * var(--primer-space-medium)) ); display: flex; } .native-button-container { width: 100%; height: 100%; flex: 1; position: relative; } /* Disabled state styling - handled via JavaScript overlay for iframe compatibility */ :host([disabled]) { cursor: not-allowed; } `;var ce=class extends g{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this.disabled=!1;this._buttonId="button-container";this.loadManagerTask=new L(this,{args:()=>[this.paymentMethod?.type],task:([e])=>{if(!e)return M;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),this.nativeButtonTask=new L(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return M;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=e.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),this.disabled&&await a.setDisabled(this.disabled),this.disabled&&(await this.updateComplete,this.updateDisabledOverlay()),a}})}attributeChangedCallback(e,r,o){if(super.attributeChangedCallback(e,r,o),e==="disabled"&&r!==o){let a=o!==null,n=this.nativeButtonTask.value;n&&n.setDisabled(a)}}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(fe),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`),e.has("disabled")&&this.updateDisabledOverlay()}updateDisabledOverlay(){this.paymentMethod?.type==="GOOGLE_PAY"?this.updateGooglePayOverlay():this.updateRegularOverlay()}updateGooglePayOverlay(){let e=null;if(e=this.shadowRoot?.getRootNode()?.querySelector(".gpay-card-info-container-fill"),e||(e=document.querySelector(".gpay-card-info-container-fill")),e||(e=this.shadowRoot?.querySelector(".gpay-card-info-container-fill")),!e){setTimeout(()=>this.updateGooglePayOverlay(),100);return}let o=e.querySelector(".disabled-overlay");if(o&&o.remove(),this.disabled){let a=document.createElement("div");a.className="disabled-overlay",a.style.cssText=`
|
|
158
|
+
position: absolute;
|
|
159
|
+
top: 0;
|
|
160
|
+
left: 0;
|
|
161
|
+
right: 0;
|
|
162
|
+
bottom: 0;
|
|
163
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
164
|
+
border-radius: var(--primer-radius-medium);
|
|
165
|
+
cursor: not-allowed;
|
|
166
|
+
z-index: 1000;
|
|
167
|
+
pointer-events: all;
|
|
168
|
+
backdrop-filter: grayscale(100%);
|
|
169
|
+
`,e.style.position="relative",e.appendChild(a)}}updateRegularOverlay(){let e=this.shadowRoot?.querySelector(".native-button-container");if(!e)return;let r=e.querySelector(".disabled-overlay");if(r&&r.remove(),this.disabled){let o=document.createElement("div");o.className="disabled-overlay",o.style.cssText=`
|
|
170
|
+
position: absolute;
|
|
171
|
+
top: 0;
|
|
172
|
+
left: 0;
|
|
173
|
+
right: 0;
|
|
174
|
+
bottom: 0;
|
|
175
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
176
|
+
border-radius: var(--primer-radius-medium);
|
|
177
|
+
cursor: not-allowed;
|
|
178
|
+
z-index: 1000;
|
|
179
|
+
pointer-events: all;
|
|
180
|
+
backdrop-filter: grayscale(100%);
|
|
181
|
+
`,e.appendChild(o)}}render(){return this.loadManagerTask.render({error:()=>u,complete:()=>p`<div class="native-button-container" id="${this._buttonId}"></div>`,pending:()=>u})}};ce.styles=[E,dn],s([c({type:Object})],ce.prototype,"paymentMethod",2),s([C({context:Z,subscribe:!0}),c()],ce.prototype,"paymentManagers",2),s([C({context:He,subscribe:!0}),c()],ce.prototype,"computedStyles",2),s([c({type:Boolean,attribute:"disabled"})],ce.prototype,"disabled",2),ce=s([v("primer-native-payment")],ce);var At=class extends g{render(){return p`<primer-checkout-state type="complete"></primer-checkout-state>`}};At=s([v("primer-checkout-complete")],At);var pt=class extends g{constructor(){super(...arguments);this.sdkState=null}render(){return p`<primer-checkout-state type="failure" description=${this.sdkState?.error?.message||""} ></primer-checkout-state>`}};s([C({context:Y,subscribe:!0}),c()],pt.prototype,"sdkState",2),pt=s([v("primer-checkout-error")],pt);var cn=y` :host { display: block; width: 100%; } `;var Ve=class extends g{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?p`<primer-error-message message="${x(this.sdkState.failure?.message??"",{id:"tokenizationError"})}" ?visible="${this.shouldShowError}" ></primer-error-message>`:u}};Ve.styles=[cn],s([C({context:Y,subscribe:!0}),_()],Ve.prototype,"sdkState",2),s([c({type:Boolean,attribute:"show-processing-errors"})],Ve.prototype,"showProcessingErrors",2),Ve=s([v("primer-error-message-container")],Ve);var pn=y` :host { display: contents; } .primer-main-list { display: flex; flex-direction: column; gap: var(--primer-space-small); } .primer-is-processing { opacity: 0.5; pointer-events: none; } primer-vault-manager { margin-bottom: var(--primer-space-xlarge); } `;var Ae=class extends g{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null;this.clientOptions=null}render(){return this.sdkState?.isSuccessful?p`<slot name="checkout-complete"><primer-checkout-complete></primer-checkout-complete></slot>`:p`<slot name="payments" @slotchange=${this.onSlotChange}></slot>${I(this.hasAssignedContent,()=>u,()=>p`<div class=${q({"primer-is-processing":!!this.sdkState?.isProcessing})} ><primer-vault-manager></primer-vault-manager><primer-show-other-payments><div slot="other-payments" class="primer-main-list">${this.paymentMethods?.toArray().map(e=>p`<primer-payment-method type=${e.type} ?disabled=${this.clientOptions?.disabledPayments===!0} ></primer-payment-method>`)}</div></primer-show-other-payments><primer-error-message-container></primer-error-message-container></div>`)} `}};Ae.styles=[E,pn],s([C({context:ht,subscribe:!0}),c()],Ae.prototype,"paymentMethods",2),s([C({context:Y,subscribe:!0}),c()],Ae.prototype,"sdkState",2),s([C({context:pe,subscribe:!0}),c()],Ae.prototype,"clientOptions",2),Ae=s([v("primer-main")],Ae);function y_(){da(),ca()}export{ie as AchPayment,Q as Button,se as CardForm,Re as CardFormCVV,J as CardFormCardNetworkSelector,Oe as CardFormCardNumber,Ie as CardFormError,De as CardFormExpiry,$e as CardFormName,G as CardFormSubmit,ee as Collapsable,dt as Dialog,ae as DynamicPayment,be as ErrorMessage,Ve as ErrorMessageContainer,xr as InitializedPayments,D as Input,ke as InputLabel,ge as InputWrapper,ce as NativePayment,Ce as PaymentMethod,Ee as PaymentMethodContentComponent,Ge as Portal,At as PrimerCheckoutComplete,re as PrimerCheckoutComponent,pt as PrimerCheckoutFailure,Le as PrimerCheckoutState,ve as PrimerIcon,j as PrimerKlarna,Ae as PrimerMain,ne as RedirectPayment,Ze as ShowOtherPayments,ye as Spinner,H as VaultCvvInput,oe as VaultDeleteConfirmation,Ne as VaultEmptyState,xe as VaultErrorMessage,K as VaultManager,de as VaultManagerHeader,te as VaultPaymentMethodItem,F as VaultPaymentSubmit,el as injectDarkTheme,Qs as injectLightTheme,da as injectLoaderStyles,ca as injectThemeStyles,y_ as loadPrimer};
|