@primer-io/primer-js 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import{a as hi,b as s}from"./chunks/chunk.I6YWTZRK.js";var Dt=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}setCardNetworksLoading(){let e={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(e)}updateCardNetworksState(e){this.host.primerEventsController.dispatchCardNetworkChange(e),this.host.sdkContextController.setCardNetworks(e)}async processCardNetworkChangeEvent(e){let{detectedCardNetworks:t,selectableCardNetworks:r}=e,o=t.preferred??t.items[0],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var tt=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}dispatchEvent(e,t){this.host.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}dispatchSdkState(e){this.dispatchEvent("primer-state-changed",e)}dispatchPaymentMethods(e){this.dispatchEvent("primer-payment-methods-updated",e)}dispatchCheckoutInitialized(e){this.dispatchEvent("primer-checkout-initialized",e)}dispatchCardNetworkChange(e){this.dispatchEvent("primer-card-network-change",e)}dispatchOnCheckoutComplete(e){this.dispatchEvent("primer-oncheckout-complete",{payment:e})}dispatchOnCheckoutFailure(e,t){this.dispatchEvent("primer-oncheckout-failure",{error:e,payment:t})}dispatchFormSubmitSuccess(e){this.dispatchEvent("primer-card-submit-success",{result:e})}dispatchFormSubmitErrors(e){this.dispatchEvent("primer-card-submit-errors",{errors:e})}};var ke=class extends Event{constructor(e,t,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=o??!1}};var rt=class{constructor(e,t,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=e,t.context!==void 0){let a=t;this.context=a.context,this.callback=a.callback,this.subscribe=a.subscribe??!1}else this.context=t,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 ke(this.context,this.host,this.t,this.subscribe))}};var Vt=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:o}=this.subscriptions.get(e);e(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var Ir=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},N=class extends Vt{constructor(e,t,r){super(t.context!==void 0?t.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:m}]of this.subscriptions)a.has(n)||(a.add(n),m.dispatchEvent(new ke(this.context,m,n,!0)));o.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,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 Ir(this.context,this.host))}};function f({context:i,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new rt(this,{context:i,callback:o=>{t.set.call(this,o)},subscribe:e})}):t.constructor.addInitializer(o=>{new rt(o,{context:i,callback:a=>{o[r]=a},subscribe:e})})}}var Ht="cardNetworksContext";var Pe="clientOptionsContext";var we="computedStylesContext";var D="headlessInstanceContext";var Yt="klarnaCategoriesContext";var F="managerContext";var it="paymentMethodsContext";var $="sdkStateContext";var B="vaultManagerContext";var Te="vaultManagerCvvContext";var A=class A{static log(e,...t){A.enabled&&console.log(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.log,...t)}static info(e,...t){A.enabled&&console.info(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.info,...t)}static warn(e,...t){A.enabled&&console.warn(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.warn,...t)}static error(e,...t){A.enabled&&console.error(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.error,...t)}static debug(e,...t){A.enabled&&console.debug(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.debug,...t)}static table(e,t){A.enabled&&console.table(e,t)}static time(e){A.enabled&&console.time(`${A.brandTag} ${e}`)}static timeEnd(e){A.enabled&&console.timeEnd(`${A.brandTag} ${e}`)}};A.enabled=!0,A.defaultFont="font-family: Consolas, monospace; font-size: 12px;",A.brandTag="[PRIMER]",A.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+A.defaultFont,A.styles={log:"color: #4CAF50; "+A.defaultFont,info:"color: #2196F3; "+A.defaultFont,warn:"color: #FF9800; "+A.defaultFont,error:"color: #F44336; "+A.defaultFont,debug:"color: #9C27B0; "+A.defaultFont};var S=A;function ga(i,e,t,r){let o=i,a=t;return{dispatch:n=>{let m=e(o,n,a);o=m,r(m)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function ct(i){return(e,t,r)=>{let o=i[t.type];if(!o)throw new Error(`No handler for action type: ${t.type}`);return o(e,t,r)}}var Ve=class{constructor(e,t,r,o,a=()=>{this.host.requestUpdate()}){this.host=e;this.stateHandler=a;this.host.addController(this),this._dispatcher=ga(t,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(e){this._dispatcher.dispatch(e)}setCallbacks(e){this._dispatcher.setCallbacks(e)}hostConnected(){}hostDisconnected(){}},zt=class{constructor(e){this.host=e;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(e){this._controllers.push(e)}hostConnected(){this._controllers.forEach(e=>{e.hostConnected&&e.hostConnected()})}hostDisconnected(){this._controllers.forEach(e=>{e.hostDisconnected&&e.hostDisconnected()})}};var Ft={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},fa={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,e)=>(S.error(e.payload.message),{...i,isProcessing:!1,error:e.payload}),SET_FAILURE:(i,e)=>({...i,isProcessing:!1,failure:e.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Ft,RESET_ERROR:i=>({...i,error:null,failure:null})},va=ct(fa),Ut=class extends Ve{constructor(e){super(e,Ft,va,null,t=>{e.sdkContextController.setSdkState(t),e.primerEventsController.dispatchSdkState(t)})}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(e){this.dispatch({type:"SET_ERROR",payload:e})}setFailure(e,t,r){this.dispatch({type:"SET_FAILURE",payload:{code:e,message:t,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(S.warn("Force completing loading state"),this.completeLoading())}};var Bt=class{constructor(e){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=e).addController(this),this.sdkStateProvider=new N(e,{context:$,initialValue:Ft}),this.paymentMethodsProvider=new N(e,{context:it,initialValue:null}),this.paymentManagerProvider=new N(e,{context:F,initialValue:new Map}),this.cardNetworksContext=new N(e,{context:Ht,initialValue:null}),this.vaultManagerProvider=new N(e,{context:B,initialValue:null}),this.vaultManagerCvvProvider=new N(e,{context:Te,initialValue:null}),this.clientOptionsContext=new N(e,{context:Pe,initialValue:null}),this.klarnaCategoriesProvider=new N(e,{context:Yt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new N(e,{context:D,initialValue:null}),this.computedStylesProvider=new N(e,{context:we,initialValue:null})}hostConnected(){}setSdkState(e){this.sdkStateProvider?.setValue(e)}setPaymentMethods(e){this.paymentMethodsProvider?.setValue(e)}setPaymentManagers(e){this.paymentManagerProvider?.setValue(e)}setCardNetworks(e){this.cardNetworksContext?.setValue(e)}setVaultManager(e){this.vaultManagerProvider?.setValue(e)}setKlarnaCategories(e){this.klarnaCategoriesProvider?.setValue(e)}setClientOptions(e){this.clientOptionsContext?.setValue(e)}setHeadlessUtils(e){this.headlessUtilsProvider?.setValue(e)}setComputedStyles(e){this.computedStylesProvider?.setValue(e)}setVaultManagerCvv(e){this.vaultManagerCvvProvider?.setValue(e)}};var He=class He{constructor(e){(this.host=e).addController(this)}processCustomStyles(e){try{let t=JSON.parse(e);this.applyStyles(t)}catch(t){S.error("Error parsing customStyles property.",t instanceof Error?t:new Error(String(t)))}}isValidCssProperty(e){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)}isValidCssValue(e){let r=/^[\w\s#.,%()\-+/!]+$/.test(e);return r||S.warn(`Rejected potentially unsafe CSS value: ${e}`),r}getCssVarName(e){let t=He.cssVarCache.get(e);return t||(t="--"+e.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),He.cssVarCache.set(e,t)),t}applyStyles(e){let t=[];for(let r of Object.keys(e)){let o=e[r];if(!o)continue;if(!this.isValidCssProperty(r)){S.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);t.push([a,o])}if(t.length>0)for(let[r,o]of t)this.host.style.setProperty(r,o)}removeStyle(e){let t=this.getCssVarName(e);this.host.style.removeProperty(t)}clearAllStyles(){for(let e of He.cssVarCache.keys()){let t=He.cssVarCache.get(e);t&&this.host.style.removeProperty(t)}}hostDisconnected(){}};He.cssVarCache=new Map;var Kt=He;var jt=globalThis,Gt=jt.ShadowRoot&&(jt.ShadyCSS===void 0||jt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nr=Symbol(),gi=new WeakMap,mt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Nr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Gt&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=gi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&gi.set(t,e))}return e}toString(){return this.cssText}},fi=i=>new mt(typeof i=="string"?i:i+"",void 0,Nr),u=(i,...e)=>{let t=i.length===1?i[0]:e.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(t,i,Nr)},Or=(i,e)=>{if(Gt)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=jt.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,i.appendChild(r)}},qt=Gt?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return fi(t)})(i):i;var{is:ya,defineProperty:ba,getOwnPropertyDescriptor:xa,getOwnPropertyNames:Ca,getOwnPropertySymbols:Ea,getPrototypeOf:Aa}=Object,Le=globalThis,vi=Le.trustedTypes,_a=vi?vi.emptyScript:"",Ma=Le.reactiveElementPolyfillSupport,ut=(i,e)=>i,ht={toAttribute(i,e){switch(e){case Boolean:i=i?_a:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},ot=(i,e)=>!ya(i,e),yi={attribute:!0,type:String,converter:ht,reflect:!1,hasChanged:ot};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Le.litPropertyMetadata??(Le.litPropertyMetadata=new WeakMap);var pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=yi){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,t);o!==void 0&&ba(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:a}=xa(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get(){return o?.call(this)},set(n){let m=o?.call(this);a.call(this,n),this.requestUpdate(e,m,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??yi}static _$Ei(){if(this.hasOwnProperty(ut("elementProperties")))return;let e=Aa(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ut("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ut("properties"))){let t=this.properties,r=[...Ca(t),...Ea(t)];for(let o of r)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,o]of t)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let o=this._$Eu(t,r);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(qt(o))}else e!==void 0&&t.push(qt(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Or(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:ht).toAttribute(t,r.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);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:ht;this._$Em=o,this[o]=n.fromAttribute(t,a.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??ot)(this[e],t))return;this.P(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!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 e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}};pe.elementStyles=[],pe.shadowRootOptions={mode:"open"},pe[ut("elementProperties")]=new Map,pe[ut("finalized")]=new Map,Ma?.({ReactiveElement:pe}),(Le.reactiveElementVersions??(Le.reactiveElementVersions=[])).push("2.0.4");var $e={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},_=Symbol(),k=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((e,t)=>{this.o=e,this.h=t}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(e,t,r){this.p=0,this.i=0,(this._=e).addController(this);let o=typeof t=="object"?t:{task:t,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??bi,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 e=this.j();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async S(){let e=this.T(),t=this.O;this.O=e,e===t||e===void 0||t!==void 0&&this.m(t,e)||await this.run(e)}async run(e){let t,r;e??(e=this.T()),this.O=e,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{t=await this.v(e,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(t===_)this.i=0;else{if(a===!1){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=t,this.l=r}this._.requestUpdate()}}abort(e){this.i===1&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},bi=(i,e)=>i===e||i.length===e.length&&i.every((t,r)=>!ot(t,e[r]));var Sa={SET_LOADING:(i,e)=>({...i,isLoading:e.payload}),SET_UPDATING:(i,e)=>({...i,isUpdating:e.payload}),INITIALIZE_VAULT_MANAGER:(i,e,t)=>({...i,enabled:e.vaultEnabled,cvvRecapture:e.cvvRecapture,deleteVaultedPaymentMethod:t.deleteVaultedPaymentMethod,startVaultedPaymentFlow:t.startVaultedPaymentFlow,createCvvInput:t.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,e)=>({...i,vaultedPaymentMethods:e.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>xi},ka={INITIALIZE_CVV:(i,e,t)=>({...i,setCvvInput:t.setCvvInput,setSelectedVaultedPaymentMethod:t.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,e)=>({...i,formIsDirty:e.payload}),SET_CVV_INPUT:(i,e)=>({...i,cvvInput:e.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,e)=>({...i,selectedVaultedPaymentMethod:e.payload}),RESET_CVV:()=>Ci},Pa=ct(Sa),wa=ct(ka),xi={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},Ci={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Rr=class extends Ve{constructor(e,t){super(e,xi,Pa,t,r=>{e.sdkContextController.setVaultManager(r)})}setLoading(e){this.dispatch({type:"SET_LOADING",payload:e})}setUpdating(e){this.dispatch({type:"SET_UPDATING",payload:e})}initializeVaultManager(e,t,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:t,cvvRecapture:r})}updatePaymentMethods(e){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:e})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Dr=class extends Ve{constructor(e,t){super(e,Ci,wa,t,r=>{e.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(e){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:e})}setFormDirty(e){this.dispatch({type:"SET_FORM_DIRTY",payload:e})}setCvvInputState(e){this.dispatch({type:"SET_CVV_INPUT",payload:e})}setSelectedPaymentMethod(e){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:e})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},gt=class extends zt{constructor(t){super(t);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=t=>{this.itemController.setCvvInputState(t)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!t||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,r?{cvv:o.valueToken}:void 0)}catch(a){S.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=t=>{this.itemController.setSelectedPaymentMethod(t),this.itemController.setFormDirty(!1)};this.coreController=new Rr(t,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Dr(t,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new k(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),_;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),S.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){S.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(t,r){this.vaultManager=t,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,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(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{t||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return S.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(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(t)}};var ft="lit-localize-status";var Ei=i=>typeof i!="string"&&"strTag"in i,Wt=(i,e,t)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=e[t?t[o-1]:o-1],r+=i[o];return r};var vt=i=>Ei(i)?Wt(i.strings,i.values):i;var v=vt,Ai=!1;function Vr(i){if(Ai)throw new Error("lit-localize can only be configured once");v=i,Ai=!0}var Hr=class{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(ft,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(ft,this.__litLocalizeEventHandler)}},Ta=i=>i.addController(new Hr(i)),_i=Ta;var M=()=>(i,e)=>(i.addInitializer(_i),i);var yt=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}};var ce=[];for(let i=0;i<256;i++)ce[i]=(i>>4&15).toString(16)+(i&15).toString(16);function Mi(i){let e=0,t=8997,r=0,o=33826,a=0,n=40164,m=0,p=52210;for(let b=0;b<i.length;b++)t^=i.charCodeAt(b),e=t*435,r=o*435,a=n*435,m=p*435,a+=t<<8,m+=o<<8,r+=e>>>16,t=e&65535,a+=r>>>16,o=r&65535,p=m+(a>>>16)&65535,n=a&65535;return ce[p>>8]+ce[p&255]+ce[n>>8]+ce[n&255]+ce[o>>8]+ce[o&255]+ce[t>>8]+ce[t&255]}var La="",$a="h",Ia="s";function Si(i,e){return(e?$a:Ia)+Mi(typeof i=="string"?i:i.join(La))}var ki=new WeakMap,Pi=new Map;function wi(i,e,t){if(i){let r=t?.id??Na(e),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Wt(o.strings,e.values,o.values);{let a=ki.get(o);return a===void 0&&(a=o.values,ki.set(o,a)),{...o,values:a.map(n=>e.values[n])}}}}return vt(e)}function Na(i){let e=typeof i=="string"?i:i.strings,t=Pi.get(e);return t===void 0&&(t=Si(e,typeof i!="string"&&!("strTag"in i)),Pi.set(e,t)),t}function Yr(i){window.dispatchEvent(new CustomEvent(ft,{detail:i}))}var Xt="",zr,Ti,Qt,Ur,Li,Ye=new yt;Ye.resolve();var Zt=0,$i=i=>(Vr((e,t)=>wi(Li,e,t)),Xt=Ti=i.sourceLocale,Qt=new Set(i.targetLocales),Qt.add(i.sourceLocale),Ur=i.loadLocale,{getLocale:Oa,setLocale:Ra}),Oa=()=>Xt,Ra=i=>{if(i===(zr??Xt))return Ye.promise;if(!Qt||!Ur)throw new Error("Internal error");if(!Qt.has(i))throw new Error("Invalid locale code");Zt++;let e=Zt;return zr=i,Ye.settled&&(Ye=new yt),Yr({status:"loading",loadingLocale:i}),(i===Ti?Promise.resolve({templates:void 0}):Ur(i)).then(r=>{Zt===e&&(Xt=i,zr=void 0,Li=r.templates,Yr({status:"ready",readyLocale:i}),Ye.resolve())},r=>{Zt===e&&(Yr({status:"error",errorLocale:i,errorMessage:r.toString()}),Ye.reject(r))}),Ye.promise};var Fr="en",Br=["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"],Ii="You must call `loadLocale` first to set up the localized template.",Ni,Jt,Oi=i=>{let e=$i({sourceLocale:Fr,targetLocales:Br,loadLocale:i});Ni=e.getLocale,Jt=e.setLocale};var Kr=i=>{Oi(i)},jr=i=>{if(!Jt)throw new Error(Ii);return Jt(i)};var bt=new Set(Br);bt.add(Fr);var Gr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let e=i.replace("_","-");if(bt.has(e))return!0;let t=e.split("-")[0];return!!bt.has(t)},qr=i=>{if(i==="en")return"en-GB";let e=i.replace("_","-");if(bt.has(e))return e;let t=e.split("-")[0];return bt.has(t)?t:"en-GB"};var Ct=globalThis,er=Ct.trustedTypes,Ri=er?er.createPolicy("lit-html",{createHTML:i=>i}):void 0,Zr="$lit$",me=`lit$${Math.random().toFixed(9).slice(2)}$`,Xr="?"+me,Da=`<${Xr}>`,Fe=document,Et=()=>Fe.createComment(""),At=i=>i===null||typeof i!="object"&&typeof i!="function",Qr=Array.isArray,Ui=i=>Qr(i)||typeof i?.[Symbol.iterator]=="function",Wr=`[
2
- \f\r]`,xt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Di=/-->/g,Vi=/>/g,ze=RegExp(`>|${Wr}(?:([^\\s"'>=/]+)(${Wr}*=${Wr}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Hi=/'/g,Yi=/"/g,Fi=/^(?:script|style|textarea|title)$/i,Jr=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=Jr(1),he=Jr(2),Kl=Jr(3),ue=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),zi=new WeakMap,Ue=Fe.createTreeWalker(Fe,129);function Bi(i,e){if(!Qr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var Ki=(i,e)=>{let t=i.length-1,r=[],o,a=e===2?"<svg>":e===3?"<math>":"",n=xt;for(let m=0;m<t;m++){let p=i[m],b,E,y=-1,w=0;for(;w<p.length&&(n.lastIndex=w,E=n.exec(p),E!==null);)w=n.lastIndex,n===xt?E[1]==="!--"?n=Di:E[1]!==void 0?n=Vi:E[2]!==void 0?(Fi.test(E[2])&&(o=RegExp("</"+E[2],"g")),n=ze):E[3]!==void 0&&(n=ze):n===ze?E[0]===">"?(n=o??xt,y=-1):E[1]===void 0?y=-2:(y=n.lastIndex-E[2].length,b=E[1],n=E[3]===void 0?ze:E[3]==='"'?Yi:Hi):n===Yi||n===Hi?n=ze:n===Di||n===Vi?n=xt:(n=ze,o=void 0);let I=n===ze&&i[m+1].startsWith("/>")?" ":"";a+=n===xt?p+Da:y>=0?(r.push(b),p.slice(0,y)+Zr+p.slice(y)+me+I):p+me+(y===-2?m:I)}return[Bi(i,a+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},_t=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let a=0,n=0,m=e.length-1,p=this.parts,[b,E]=Ki(e,t);if(this.el=i.createElement(b,r),Ue.currentNode=this.el.content,t===2||t===3){let y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(o=Ue.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let y of o.getAttributeNames())if(y.endsWith(Zr)){let w=E[n++],I=o.getAttribute(y).split(me),de=/([.?@])?(.*)/.exec(w);p.push({type:1,index:a,name:de[2],strings:I,ctor:de[1]==="."?rr:de[1]==="?"?ir:de[1]==="@"?or:Ke}),o.removeAttribute(y)}else y.startsWith(me)&&(p.push({type:6,index:a}),o.removeAttribute(y));if(Fi.test(o.tagName)){let y=o.textContent.split(me),w=y.length-1;if(w>0){o.textContent=er?er.emptyScript:"";for(let I=0;I<w;I++)o.append(y[I],Et()),Ue.nextNode(),p.push({type:2,index:++a});o.append(y[w],Et())}}}else if(o.nodeType===8)if(o.data===Xr)p.push({type:2,index:a});else{let y=-1;for(;(y=o.data.indexOf(me,y+1))!==-1;)p.push({type:7,index:a}),y+=me.length-1}a++}}static createElement(e,t){let r=Fe.createElement("template");return r.innerHTML=e,r}};function Be(i,e,t=i,r){if(e===ue)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,a=At(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=Be(i,o._$AS(i,e.values),o,r)),e}var tr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??Fe).importNode(t,!0);Ue.currentNode=o;let a=Ue.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let b;p.type===2?b=new at(a,a.nextSibling,this,e):p.type===1?b=new p.ctor(a,p.name,p.strings,this,e):p.type===6&&(b=new ar(a,this,e)),this._$AV.push(b),p=r[++m]}n!==p?.index&&(a=Ue.nextNode(),n++)}return Ue.currentNode=Fe,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},at=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Be(this,e,t),At(e)?e===c||e==null||e===""?(this._$AH!==c&&this._$AR(),this._$AH=c):e!==this._$AH&&e!==ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ui(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==c&&At(this._$AH)?this._$AA.nextSibling.data=e:this.T(Fe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=_t.createElement(Bi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let a=new tr(o,this),n=a.u(this.options);a.p(t),this.T(n),this._$AH=a}}_$AC(e){let t=zi.get(e.strings);return t===void 0&&zi.set(e.strings,t=new _t(e)),t}k(e){Qr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let a of e)o===t.length?t.push(r=new i(this.O(Et()),this.O(Et()),this,this.options)):r=t[o],r._$AI(a),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ke=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,a){this.type=1,this._$AH=c,this._$AN=void 0,this.element=e,this.name=t,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=c}_$AI(e,t=this,r,o){let a=this.strings,n=!1;if(a===void 0)e=Be(this,e,t,0),n=!At(e)||e!==this._$AH&&e!==ue,n&&(this._$AH=e);else{let m=e,p,b;for(e=a[0],p=0;p<a.length-1;p++)b=Be(this,m[r+p],t,p),b===ue&&(b=this._$AH[p]),n||(n=!At(b)||b!==this._$AH[p]),b===c?e=c:e!==c&&(e+=(b??"")+a[p+1]),this._$AH[p]=b}n&&!o&&this.j(e)}j(e){e===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},rr=class extends Ke{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===c?void 0:e}},ir=class extends Ke{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==c)}},or=class extends Ke{constructor(e,t,r,o,a){super(e,t,r,o,a),this.type=5}_$AI(e,t=this){if((e=Be(this,e,t,0)??c)===ue)return;let r=this._$AH,o=e===c&&r!==c||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==c&&(r===c||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ar=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Be(this,e)}},ji={M:Zr,P:me,A:Xr,C:1,L:Ki,R:tr,D:Ui,V:Be,I:at,H:Ke,N:ir,U:or,B:rr,F:ar},Va=Ct.litHtmlPolyfillSupport;Va?.(_t,at),(Ct.litHtmlVersions??(Ct.litHtmlVersions=[])).push("3.2.1");var Gi=(i,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let a=t?.renderBefore??null;r._$litPart$=o=new at(e.insertBefore(Et(),a),a,void 0,t??{})}return o._$AI(i),o};var h=class extends pe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Gi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ue}};h._$litElement$=!0,h.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:h});var Ha=globalThis.litElementPolyfillSupport;Ha?.({LitElement:h});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var g=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};var Ya={attribute:!0,type:String,converter:ht,reflect:!1,hasChanged:ot},za=(i=Ya,e,t)=>{let{kind:r,metadata:o}=t,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),a.set(t.name,i),r==="accessor"){let{name:n}=t;return{set(m){let p=e.get.call(this);e.set.call(this,m),this.requestUpdate(n,p,i)},init(m){return m!==void 0&&this.P(n,void 0,i),m}}}if(r==="setter"){let{name:n}=t;return function(m){let p=this[n];e.call(this,m),this.requestUpdate(n,p,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(e,t)=>typeof t=="object"?za(i,e,t):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,e,t)}function C(i){return l({...i,state:!0,attribute:!1})}var je=(i,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,t),t);function Ie(i,e){return(t,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(e){let{get:n,set:m}=typeof r=="object"?t:o??(()=>{let p=Symbol();return{get(){return this[p]},set(b){this[p]=b}}})();return je(t,r,{get(){let p=n.call(this);return p===void 0&&(p=a(this),(p!==null||this.hasUpdated)&&m.call(this,p)),p}})}return je(t,r,{get(){return a(this)}})}}function P(i,e,t){return i?e(i):t?.(i)}var x=u`
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]`,gt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Si=/-->/g,Mi=/>/g,Fe=RegExp(`>|${$r}(?:([^\\s"'>=/]+)(${$r}*=${$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
4
  * {
5
5
  box-sizing: border-box;
6
6
  }
7
- `,qi=u`
7
+ `,$i=c`
8
8
  :host {
9
9
  display: block;
10
10
  isolation: isolate;
@@ -13,14 +13,14 @@ import{a as hi,b as s}from"./chunks/chunk.I6YWTZRK.js";var Dt=class{constructor(
13
13
  //Keep the CSS loader in the same position - check css-loader-inline.ts
14
14
  min-height: 64px;
15
15
  }
16
- `;var Wi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var sr=class{constructor(e){this._methods=e}get(e){return this._methods.get(e)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var nr=typeof window<"u"&&typeof window.document<"u";function Ua(i){return document.querySelector(`script[src^="${i}"]`)}function Fa(i,e){let t=document.createElement("script");return t.setAttribute("src",i),t.setAttribute("async",""),t.setAttribute("crossorigin","anonymous"),e&&t.setAttribute("type","module"),t}function Zi(i,e=!1){if(!nr)throw new Error("Cannot load script in server environment");let t=Ua(i)??Fa(i,e);return new Promise((r,o)=>{t.onload=()=>{r()},t.onerror=()=>{o()},t.parentNode||document.head.appendChild(t)})}var lr=class{constructor(e){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=e).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new k(e,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new k(e,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(e){this._paymentsList=e,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&&(S.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(),S.info("SDK instance cleaned up")}catch(e){S.error("Error cleaning up SDK instance:",e)}this.currentSdkInstance=null}async _loadV2Sdk(e=Wi){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){S.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await Zi(e),await window.Primer.preloadPrimer()}initializeHeadless(){return async([e,t])=>{if(this.isDisconnected)return S.warn("Component disconnected, aborting SDK initialization"),_;if(!e||!t)return _;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(e,{...t,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(S.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(S.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(n))},onCheckoutFail:(n,m)=>{this.isDisconnected||(S.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(n,m.payment))},onBeforePaymentCreate:(n,m)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),m?.continuePaymentCreation())},onPaymentMethodAction:(n,m)=>{this.isDisconnected||n==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||this.host.sdkStateController.resetError()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),_;this.host.sdkContextController.setClientOptions(t),this.host.primerEventsController.dispatchCheckoutInitialized(o);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:t.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(S.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([e,t])=>{if(this.isDisconnected)return _;if(!e||!t.length)return _;let r=new Map,o=new Map;try{for(let n of t){if(this.isDisconnected)break;let m=await this.initializePaymentMethodManager(n)();n&&m&&(r.set(n.type,n),o.set(n.type,m))}if(this.isDisconnected)return _;let a=new sr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),S.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(e){let{type:t,managerType:r}=e;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:t,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(t,{onCardNetworksChange:async n=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:t,manager:a}:null}let o=await this.createPaymentMethodManager(t);return o?{type:t,manager:o}:null}catch(o){return S.error(`Failed to initialize manager for ${t}:`,o),null}}}};var dr=class{constructor(e){this.host=e,e.addController(this)}_error(e){let{error:t}=e.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",t.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 Ba=hi({"../../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=>Ba(`../../localization/lit-localize/locales/${i}.ts`));var pr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},X=class extends h{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=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new Bt(this),this.sdkStateController=new Ut(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Kt(this),this.vaultManagerController=new gt(this),this.cardNetworkController=new Dt(this),this.achPaymentEventsController=new dr(this),new lr(this)}set jsInitialized(t){this.requestUpdate(),this._jsInitialized=t}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(t,r,o){t===pr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(t,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(t){t.has("options")&&(this.options?.locale&&(Gr(this.options?.locale)?this.locale=qr(this.options?.locale):S.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),jr(this.locale||"en-GB"))}updated(){let t=getComputedStyle(this);this.sdkContextController.setComputedStyles(t),this.checkLoadingStateChange()}checkLoadingStateChange(){let t=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!t&&(this.jsInitialized=!0),this.previousLoadingState=t,t&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(S.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!t&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let t=this.sdkStateController.currentState,r=t.isLoading,o=t.error,a=!r&&!o;return d`
17
- ${P(r,()=>c)}
18
- ${P(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
19
- ${P(a,()=>d`
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
+ ${_(r,()=>p)}
18
+ ${_(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
19
+ ${_(a,()=>d`
20
20
  <slot name="main" @slotchange=${this.onSlotChange}></slot>
21
- ${P(this.hasAssignedContent,()=>c,()=>d`<primer-main></primer-main>`)}
22
- `,()=>c)}
23
- `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};X.styles=[x,qi],s([l({type:String,attribute:pr.CUSTOM_STYLES})],X.prototype,"customStyles",2),s([l({type:String,attribute:pr.CLIENT_TOKEN})],X.prototype,"clientToken",2),s([l({type:Object})],X.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:pr.JS_INIT})],X.prototype,"_jsInitialized",2),s([Ie("slot")],X.prototype,"defaultSlot",2),s([C()],X.prototype,"previousLoadingState",2),X=s([M(),g("primer-checkout")],X);function Ka(i){return document.querySelector(`#${i}`)}function ja(i,e){let t=document.createElement("style");return t.textContent=i,t.id=e,t}function Mt(i,e,t=!0){if(!nr||Ka(e))return;let o=ja(i,e);t&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var Xi=`
21
+ ${_(this.hasAssignedContent,()=>p,()=>d`<primer-main></primer-main>`)}
22
+ `,()=>p)}
23
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};W.styles=[v,$i],s([l({type:String,attribute:or.CUSTOM_STYLES})],W.prototype,"customStyles",2),s([l({type:String,attribute:or.CLIENT_TOKEN})],W.prototype,"clientToken",2),s([l({type:Object})],W.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:or.JS_INIT})],W.prototype,"_jsInitialized",2),s([Ie("slot")],W.prototype,"defaultSlot",2),s([x()],W.prototype,"previousLoadingState",2),W=s([S(),h("primer-checkout")],W);function _a(i){return document.querySelector(`#${i}`)}function Pa(i,t){let e=document.createElement("style");return e.textContent=i,e.id=t,e}function Ct(i,t,e=!0){if(!tr||_a(t))return;let o=Pa(i,t);e&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var Di=`
24
24
  @keyframes primer-css-spinner-rotate {
25
25
  0% {
26
26
  transform: rotate(0deg);
@@ -56,7 +56,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
56
56
  animation: primer-css-spinner-rotate 1.2s linear infinite;
57
57
  z-index: 9999;
58
58
  }
59
- `;var Qi=`/**
59
+ `;var Vi=`/**
60
60
  * Do not edit directly, this file was auto-generated.
61
61
  */
62
62
 
@@ -164,7 +164,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
164
164
  --primer-color-border-transparent-focus: var(--primer-color-focus);
165
165
  --primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
166
166
  }
167
- `,Ji=`/**
167
+ `,Hi=`/**
168
168
  * Do not edit directly, this file was auto-generated.
169
169
  */
170
170
 
@@ -184,7 +184,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
184
184
  --primer-color-blue-500: #3f93e4;
185
185
  --primer-color-blue-900: #4aaeff;
186
186
  }
187
- `;var Ga="primer-light-theme-css",qa="primer-dark-theme-css";function ei(){Mt(Qi,Ga,!0)}function ti(){Mt(Ji,qa,!0)}function eo(){ei(),ti()}function to(){Mt(Xi,"primer-css-loader-styles",!1)}function ro(){eo()}function Wa(){ei()}function Za(){ti()}var io=u`
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
188
  :host {
189
189
  display: inline-flex;
190
190
  align-items: center;
@@ -229,12 +229,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
229
229
  transform: rotate(360deg);
230
230
  }
231
231
  }
232
- `;var ri={small:16,medium:24,large:32},oe=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in ri)return ri[this.size];let t=parseInt(this.size,10);return isNaN(t)?ri.medium:t}render(){let t=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${t}px`),d`
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
233
  <div class="spinner-container ${this.compact?"compact":""}">
234
234
  <svg
235
235
  class="spinner"
236
- width="${t}"
237
- height="${t}"
236
+ width="${e}"
237
+ height="${e}"
238
238
  viewBox="${o}"
239
239
  fill="none"
240
240
  xmlns="http://www.w3.org/2000/svg"
@@ -248,7 +248,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
248
248
  />
249
249
  </svg>
250
250
  </div>
251
- `}};oe.styles=[io],s([l({type:String})],oe.prototype,"color",2),s([l({type:String})],oe.prototype,"size",2),s([l({type:Boolean})],oe.prototype,"compact",2),oe=s([g("primer-spinner")],oe);var cr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},St=i=>(...e)=>({_$litDirective$:i,values:e}),st=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var V=St(class extends st{constructor(i){if(super(i),i.type!==cr.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(e=>i[e]).join(" ")+" "}update(i,[e]){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 e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=i.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let o=!!e[r];o===this.st.has(r)||this.nt?.has(r)||(o?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return ue}});var oo=u`
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
252
  * {
253
253
  box-sizing: border-box;
254
254
  }
@@ -313,15 +313,15 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
313
313
  border-color: var(--primer-color-border-outlined-disabled);
314
314
  cursor: not-allowed;
315
315
  }
316
- `;var ae=class extends h{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(t){if(t.target!==t.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 t=this.inputSlot.assignedElements({flatten:!0}),r=t.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of t){let a=o.querySelector("primer-input");if(a)return a}return null}render(){let t={"input-slot":!0,"focus-within":this.focusWithin};return d`
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
317
  <div class="input-wrapper">
318
318
  <slot name="label"></slot>
319
- <div class="${V(t)}" @click="${this.handleWrapperClick}">
319
+ <div class="${R(e)}" @click="${this.handleWrapperClick}">
320
320
  <slot name="input"></slot>
321
321
  </div>
322
322
  <slot name="error"></slot>
323
323
  </div>
324
- `}};ae.styles=[oo],s([l({type:Boolean})],ae.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],ae.prototype,"hasError",2),s([Ie('slot[name="input"]')],ae.prototype,"inputSlot",2),ae=s([g("primer-input-wrapper")],ae);var ao=u`
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
325
  :host {
326
326
  display: inline-block;
327
327
  font-weight: var(--primer-typography-body-small-weight);
@@ -335,7 +335,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
335
335
  :host([disabled]) {
336
336
  color: var(--primer-color-text-disabled);
337
337
  }
338
- `;var ge=class extends h{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};ge.styles=[ao],s([l({type:String,reflect:!0})],ge.prototype,"for",2),s([l({type:Boolean,reflect:!0})],ge.prototype,"disabled",2),ge=s([g("primer-input-label")],ge);var so=u`
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
339
  :host {
340
340
  display: contents;
341
341
  }
@@ -502,16 +502,16 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
502
502
  :host([variant='tertiary'][loading]) primer-spinner {
503
503
  transform: scale(0.85);
504
504
  }
505
- `;var G=class extends h{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?c:d`
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
506
  <primer-icon
507
507
  name="checkmark"
508
508
  size="sm"
509
509
  color="var(--primer-color-icon-primary)"
510
510
  ></primer-icon>
511
- `}renderSpinner(){if(!this.loading)return c;let t;return this.variant==="primary"?t="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(t="var(--primer-color-gray-900)"),d`
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
512
  <primer-spinner
513
513
  size="small"
514
- color="${t}"
514
+ color="${e}"
515
515
  compact
516
516
  ></primer-spinner>
517
517
  `}render(){return d`
@@ -529,7 +529,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
529
529
  </span>
530
530
  ${this.renderCheckmark()}
531
531
  </button>
532
- `}};G.styles=[x,so],s([l({type:String,reflect:!0})],G.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],G.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],G.prototype,"loading",2),s([l({type:String,attribute:"type"})],G.prototype,"buttonType",2),s([l({type:String,reflect:!0})],G.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],G.prototype,"selectable",2),G=s([g("primer-button")],G);var no=u`
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
533
  :host {
534
534
  display: contents;
535
535
  }
@@ -545,7 +545,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
545
545
  display: block;
546
546
  font-family: var(--primer-typography-body-small-font);
547
547
  }
548
- `;var fe=class extends h{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
548
+ `;var ue=class extends m{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
549
549
  <span
550
550
  class="error"
551
551
  role="alert"
@@ -554,17 +554,17 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
554
554
  >
555
555
  <slot></slot>
556
556
  </span>
557
- `}};fe.styles=[no],s([l({type:String,reflect:!0})],fe.prototype,"for",2),s([l({type:Boolean,reflect:!0})],fe.prototype,"active",2),fe=s([g("primer-input-error")],fe);var lo={pencil:he`
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
558
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
559
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
560
  </svg>
561
- `,trash:he`
561
+ `,trash:ce`
562
562
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
563
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
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
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
566
  </svg>
567
- `,"successful-check":he`
567
+ `,"successful-check":ce`
568
568
  <svg
569
569
  viewBox="0 0 56 56"
570
570
  fill="none"
@@ -579,7 +579,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
579
579
  />
580
580
  </g>
581
581
  </svg>
582
- `,"failure-icon":he`
582
+ `,"failure-icon":ce`
583
583
  <svg
584
584
  viewBox="0 0 40 40"
585
585
  fill="none"
@@ -591,27 +591,27 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
591
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
592
  />
593
593
  </svg>
594
- `,"payment-card":he`
594
+ `,"payment-card":ce`
595
595
  <svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
596
596
  <rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
597
597
  <rect y="6.74805" width="28" height="4" fill="#212121"/>
598
598
  <rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
599
599
  </svg>
600
- `,"chevron-down":he`
600
+ `,"chevron-down":ce`
601
601
  <svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
602
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:he`
603
+ </svg>`,checkmark:ce`
604
604
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
605
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
606
  </svg>
607
- `,close:he`
607
+ `,close:ce`
608
608
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
609
609
  <path
610
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
611
  fill="#212121"
612
612
  />
613
613
  </svg>
614
- `};var po=u`
614
+ `};var Wi=c`
615
615
  :host {
616
616
  display: inline-block;
617
617
  line-height: 0; /* so you don’t get extra space around the icon */
@@ -653,11 +653,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
653
653
  /* --internal used for abstracting away the icon component */
654
654
  fill: var(--internal-icon-color, currentColor);
655
655
  }
656
- `;var se=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let t=this.name?lo[this.name]:null;return d`
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
657
  <div style="--internal-icon-color: ${this.color}">
658
- ${t||d`<slot></slot>`}
658
+ ${e||d`<slot></slot>`}
659
659
  </div>
660
- `}};se.styles=[po],s([l({type:String,reflect:!0})],se.prototype,"color",2),s([l({type:String,reflect:!0})],se.prototype,"size",2),s([l({reflect:!0})],se.prototype,"name",2),se=s([g("primer-icon")],se);var co=u`
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
661
  :host {
662
662
  display: flex;
663
663
  flex-direction: column;
@@ -686,7 +686,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
686
686
  line-height: var(--primer-typography-body-medium-line-height);
687
687
  letter-spacing: var(--primer-typography-body-medium-letter-spacing);
688
688
  }
689
- `;var ve=class extends h{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
689
+ `;var ge=class extends m{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
690
690
  <!-- Successful view -->
691
691
  <primer-icon
692
692
  size="lg"
@@ -707,7 +707,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
707
707
  </primer-icon>
708
708
  <p>Payment failed</p>
709
709
  ${this.description?d`<p class="secondary">${this.description}</p>`:d`<p class="secondary">Something went wrong.</p>`}
710
- `}};ve.styles=[co],s([l({type:String,reflect:!0})],ve.prototype,"type",2),s([l({type:String,reflect:!0})],ve.prototype,"description",2),ve=s([g("primer-checkout-state")],ve);var mo=u`
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
711
  :host {
712
712
  display: contents;
713
713
  }
@@ -738,7 +738,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
738
738
  :host([disabled]) input::placeholder {
739
739
  color: var(--primer-color-text-disabled);
740
740
  }
741
- `;var Xa=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Qa(i){return Xa.includes(i)}var T=class extends h{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(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(t){t.stopPropagation();let r=t.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(t){t.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(t){this.inputElement?.focus(t)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(t,r,o){this.inputElement?.setSelectionRange(t,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 t={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(t).filter(([,o])=>o).map(([o])=>o).join(" ");return d`
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
742
  <input
743
743
  part="input"
744
744
  class=${r}
@@ -763,7 +763,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
763
763
  @blur=${this.handleBlur}
764
764
  @invalid=${this.handleInvalid}
765
765
  />
766
- `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};T.styles=[mo],s([Ie("input")],T.prototype,"inputElement",2),s([l({type:String,reflect:!0})],T.prototype,"value",2),s([l({type:String,reflect:!0})],T.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],T.prototype,"disabled",2),s([l({type:String,reflect:!0})],T.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:t=>!t||!Qa(t)?(t&&t!=="text"&&S.warn(`Invalid input type: ${t}. Defaulting to 'text'.`),"text"):t}})],T.prototype,"type",2),s([l({type:Boolean,reflect:!0})],T.prototype,"required",2),s([l({type:Boolean,reflect:!0})],T.prototype,"readonly",2),s([l({type:String,reflect:!0})],T.prototype,"pattern",2),s([l({type:Number,reflect:!0})],T.prototype,"minlength",2),s([l({type:Number,reflect:!0})],T.prototype,"maxlength",2),s([l({type:String,reflect:!0})],T.prototype,"min",2),s([l({type:String,reflect:!0})],T.prototype,"max",2),s([l({type:String,reflect:!0})],T.prototype,"step",2),s([l({type:String,reflect:!0})],T.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],T.prototype,"id",2),s([C()],T.prototype,"hasFocus",2),s([C()],T.prototype,"hasError",2),T=s([g("primer-input")],T);var uo=u`
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
767
  :host {
768
768
  display: block;
769
769
  }
@@ -817,7 +817,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
817
817
  transition: none;
818
818
  }
819
819
  }
820
- `;var K=class extends h{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(t){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:t}}))}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 t=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||t,o=this.header||t;return d`
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
821
  <div class="collapsable">
822
822
  <primer-button
823
823
  variant=${this.buttonVariant}
@@ -841,7 +841,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
841
841
  </div>
842
842
  </div>
843
843
  </div>
844
- `}};K.styles=[uo],s([l({type:String})],K.prototype,"header",2),s([l({type:Boolean})],K.prototype,"expanded",2),s([l({type:String})],K.prototype,"expandText",2),s([l({type:String})],K.prototype,"collapseText",2),s([l({type:String})],K.prototype,"ariaLabel",2),s([l({type:String})],K.prototype,"buttonVariant",2),s([C()],K.prototype,"isExpanded",2),K=s([g("primer-collapsable")],K);var ho=u`
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
845
  :host {
846
846
  display: block;
847
847
  width: 100%;
@@ -901,10 +901,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
901
901
  transform: none;
902
902
  }
903
903
  }
904
- `;var ee=class extends h{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(t){t.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 c;let t={"error-message":!0,hidden:!this.visible};return d`
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
905
  <div
906
906
  part="error-message"
907
- class=${V(t)}
907
+ class=${R(e)}
908
908
  aria-live="assertive"
909
909
  aria-atomic="true"
910
910
  >
@@ -917,11 +917,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
917
917
  </div>
918
918
  <div part="error-content" class="error-content">${this.message}</div>
919
919
  </div>
920
- `}};ee.styles=[ho],s([l({type:String})],ee.prototype,"message",2),s([l({type:Boolean,reflect:!0})],ee.prototype,"visible",2),s([l({type:String,reflect:!0})],ee.prototype,"role",2),s([C()],ee.prototype,"showMessage",2),ee=s([g("primer-error-message")],ee);var go=u`
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
921
  :host {
922
922
  display: none;
923
923
  }
924
- `;var Ne=class extends h{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let t=document.querySelector(`#${this.id}`);return t||(t=document.createElement("div"),t.id=this.id,document.body.appendChild(t),this._setupEventListeners(t)),t}_setupEventListeners(t){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{t.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(t){let o=t.target.assignedNodes();if(!o.length)return;let a=this.getContainer();o.forEach(n=>a.appendChild(n))}render(){return d`<slot @slotchange=${this._handleSlotChange}></slot>`}};Ne.styles=[go],s([C()],Ne.prototype,"id",2),Ne=s([g("primer-portal")],Ne);var fo=u`
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
925
  :host {
926
926
  display: contents;
927
927
  }
@@ -950,10 +950,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
950
950
  display: flex;
951
951
  justify-content: flex-end;
952
952
  }
953
- `;var Ge=class extends h{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
953
+ `;var We=class extends m{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
954
954
  <div
955
- class=${V({backdrop:!0})}
956
- @click=${e=>{e.preventDefault()}}
955
+ class=${R({backdrop:!0})}
956
+ @click=${t=>{t.preventDefault()}}
957
957
  >
958
958
  <div class="dialog">
959
959
  <div class="header">
@@ -966,7 +966,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
966
966
  </div>
967
967
  </div>
968
968
  </div>
969
- `}};Ge.styles=[fo],Ge=s([g("primer-dialog")],Ge);var vo=u`
969
+ `}};We.styles=[to],We=s([h("primer-dialog")],We);var ro=c`
970
970
  :host {
971
971
  display: contents;
972
972
  }
@@ -1158,13 +1158,13 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1158
1158
  background-color: var(--primer-color-background-outlined-default);
1159
1159
  border-radius: var(--primer-radius-small);
1160
1160
  }
1161
- `;var H=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=v("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new k(this,{task:async([t,r])=>{if(!t||!r)return _;let o=await r.getCDNAssets("KLARNA");return{manager:t.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(t){S.error("Failed to start Klarna payment",t)}}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:t=>{t>0&&(this.klarnaContainer.style.height=`${t}px`)}})}catch(t){S.error("Failed to render Klarna category",t)}}selectCategory(t){this.selectedCategory=t,this.renderSelectedCategory()}updated(t){t.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let t=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?d`<div class="loading">
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
1162
  <primer-spinner size="small"></primer-spinner>
1163
1163
  </div>`:d`
1164
1164
  <div class="category-selection">
1165
- ${t.map(o=>d`
1165
+ ${e.map(o=>d`
1166
1166
  <button
1167
- class=${V({"category-button":!0,selected:o.id===this.selectedCategory})}
1167
+ class=${R({"category-button":!0,selected:o.id===this.selectedCategory})}
1168
1168
  @click=${()=>{this.selectCategory(o.id)}}
1169
1169
  >
1170
1170
  ${o.name}
@@ -1178,18 +1178,18 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1178
1178
  id="klarna-category-container"
1179
1179
  class="klarna-category-container"
1180
1180
  ></div>
1181
- `:c}
1181
+ `:p}
1182
1182
 
1183
1183
  <button
1184
- class=${V({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1184
+ class=${R({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1185
1185
  ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
1186
1186
  @click=${()=>this.startKlarnaPayment()}
1187
1187
  >
1188
- ${v("confirm",{id:"confirm"})}
1188
+ ${y("confirm",{id:"confirm"})}
1189
1189
  </button>
1190
- `}render(){return this._paymentMethodManagerTask.render({error:t=>{let r=t instanceof Error?t.message:"Unknown error in Klarna";return d`<div class="error">
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
1191
  Error loading Klarna: ${r}
1192
- </div>`},complete:({manager:t,klarnaIcon:r})=>t?d`
1192
+ </div>`},complete:({manager:e,klarnaIcon:r})=>e?d`
1193
1193
  <div class="klarna-container ${this.isExpanded?"expanded":""}">
1194
1194
  <div class="klarna-button-header">
1195
1195
  <primer-button
@@ -1202,7 +1202,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1202
1202
  aria-label=${this.headerAriaLabel}
1203
1203
  >
1204
1204
  <img src=${r} alt="Klarna logo" />
1205
- <span>${v("pay_with",{id:"pay_with"})} Klarna</span>
1205
+ <span>${y("pay_with",{id:"pay_with"})} Klarna</span>
1206
1206
  <span
1207
1207
  class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1208
1208
  >
@@ -1219,19 +1219,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1219
1219
  </div>
1220
1220
  </div>
1221
1221
  </div>
1222
- `:c})}};H.styles=[x,vo],s([f({context:F,subscribe:!0}),l()],H.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0}),l()],H.prototype,"sdkState",2),s([f({context:D,subscribe:!0}),l({type:Object})],H.prototype,"headlessUtils",2),s([f({context:Yt,subscribe:!0}),l()],H.prototype,"klarnaCategories",2),s([C()],H.prototype,"selectedCategory",2),s([C()],H.prototype,"isExpanded",2),s([C()],H.prototype,"headerAriaLabel",2),s([Ie("#klarna-category-container")],H.prototype,"klarnaContainer",2),H=s([g("primer-klarna"),M()],H);var yo=u`
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
1223
  :host {
1224
1224
  display: contents;
1225
1225
  }
1226
- `;var ye=class extends h{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return c;let t=this.paymentMethods?.get(this.type);if(!t)return c;switch(t?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
1227
- .paymentMethod=${t}
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
1228
  ></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
1229
- .paymentMethod=${t}
1229
+ .paymentMethod=${e}
1230
1230
  ></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
1231
1231
  <primer-dynamic-payment
1232
- .paymentMethod=${t}
1232
+ .paymentMethod=${e}
1233
1233
  ></primer-dynamic-payment>
1234
- `;default:return c}}};ye.styles=[yo],s([l({type:String})],ye.prototype,"type",2),s([f({context:it,subscribe:!0}),l()],ye.prototype,"paymentMethods",2),ye=s([g("primer-payment-method")],ye);var bo=u`
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
1235
  :host {
1236
1236
  display: flex;
1237
1237
  flex-direction: column;
@@ -1316,12 +1316,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1316
1316
  flex-direction: column;
1317
1317
  }
1318
1318
  }
1319
- `;function xo(){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 mr=class{constructor(e,t){this.formState=xo();this.host=e,this.validate=t,e.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(e,t){let r=this.formState[e];r.value=t,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(e,t=!1){t&&(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),e.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:e}})),this.host.requestUpdate()}setFieldTouched(e){this.formState[e].touched||(this.formState[e].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=xo(),this.host.requestUpdate()}isValidFieldName(e){return!!e&&["firstName","lastName","emailAddress"].includes(e)}hostConnected(){}hostDisconnected(){}};var q=class extends h{constructor(){super(...arguments);this.formController=new mr(this,t=>this._paymentMethodManagerTask.value.setAndValidate(t));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new k(this,{task:async([t])=>t!=="STRIPE_ACH"?_:this.paymentManagers.get(t)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(t,r){let o=t.target;this.formController.setFieldValue(r,o.value)}_handleBlur(t){this.formController.setFieldTouched(t)}_handleError(t){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error occurred")}}))}async _handleSubmitButtonClick(t){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await t.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(t);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(t){try{await t.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(t){this._handleError(t)}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(t){this._handleError(t)}finally{this.isSubmitting=!1}}}renderForm(t){return d`
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
1320
  <h2>
1321
- ${v("payWithAch",{id:"payWithAch"})}
1321
+ ${y("payWithAch",{id:"payWithAch"})}
1322
1322
  </h2>
1323
1323
  <p>
1324
- ${v("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
1324
+ ${y("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
1325
1325
  </p>
1326
1326
 
1327
1327
  <form @submit=${r=>r.preventDefault()}>
@@ -1330,7 +1330,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1330
1330
  .hasError=${this.formController.hasError.firstName}
1331
1331
  >
1332
1332
  <primer-input-label slot="label">
1333
- ${v("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
1333
+ ${y("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
1334
1334
  </primer-input-label>
1335
1335
  <primer-input
1336
1336
  slot="input"
@@ -1340,14 +1340,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1340
1340
  ?disabled=${this.isSubmitting}
1341
1341
  ></primer-input>
1342
1342
  <primer-input-error slot="error">
1343
- ${this.formController.hasError.firstName?this.formController.formState.firstName.error:c}
1343
+ ${this.formController.hasError.firstName?this.formController.formState.firstName.error:p}
1344
1344
  </primer-input-error>
1345
1345
  </primer-input-wrapper>
1346
1346
  <primer-input-wrapper
1347
1347
  .hasError=${this.formController.hasError.lastName}
1348
1348
  >
1349
1349
  <primer-input-label slot="label">
1350
- ${v("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
1350
+ ${y("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
1351
1351
  </primer-input-label>
1352
1352
  <primer-input
1353
1353
  slot="input"
@@ -1358,7 +1358,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1358
1358
  >
1359
1359
  </primer-input>
1360
1360
  <primer-input-error slot="error">
1361
- ${this.formController.hasError.lastName?this.formController.formState.lastName.error:c}
1361
+ ${this.formController.hasError.lastName?this.formController.formState.lastName.error:p}
1362
1362
  </primer-input-error>
1363
1363
  </primer-input-wrapper>
1364
1364
  </div>
@@ -1366,7 +1366,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1366
1366
  .hasError=${this.formController.hasError.emailAddress}
1367
1367
  >
1368
1368
  <primer-input-label slot="label">
1369
- ${v("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
1369
+ ${y("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
1370
1370
  </primer-input-label>
1371
1371
  <primer-input
1372
1372
  slot="input"
@@ -1377,29 +1377,29 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1377
1377
  ?disabled=${this.isSubmitting}
1378
1378
  ></primer-input>
1379
1379
  <primer-input-error slot="error">
1380
- ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:c}
1380
+ ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:p}
1381
1381
  </primer-input-error>
1382
1382
  </primer-input-wrapper>
1383
1383
  <p>
1384
- ${v("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
1384
+ ${y("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
1385
1385
  </p>
1386
1386
  <primer-button
1387
1387
  buttonType="submit"
1388
1388
  variant="primary"
1389
- @click=${()=>this._handleSubmitButtonClick(t)}
1389
+ @click=${()=>this._handleSubmitButtonClick(e)}
1390
1390
  ?disabled=${this.isSubmitting}
1391
1391
  ?loading=${this.isSubmitting}
1392
1392
  >
1393
- ${v("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
1393
+ ${y("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
1394
1394
  </primer-button>
1395
1395
  </form>
1396
1396
  `}renderMandate(){return d`
1397
1397
  <h2>
1398
- ${v("payWithAch",{id:"payWithAch"})}
1398
+ ${y("payWithAch",{id:"payWithAch"})}
1399
1399
  </h2>
1400
1400
 
1401
1401
  <p>
1402
- ${this.clientOptions?.stripe?.mandateData.fullMandateText??v("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
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
1403
  </p>
1404
1404
 
1405
1405
  <div class="button-group">
@@ -1409,7 +1409,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1409
1409
  ?disabled=${this.isSubmitting}
1410
1410
  ?loading=${this.isSubmitting}
1411
1411
  >
1412
- ${v("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
1412
+ ${y("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
1413
1413
  </primer-button>
1414
1414
 
1415
1415
  <primer-button
@@ -1417,10 +1417,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1417
1417
  @click=${this._handleDeclineMandate.bind(this)}
1418
1418
  ?disabled=${this.isSubmitting}
1419
1419
  >
1420
- ${v("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
1420
+ ${y("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
1421
1421
  </primer-button>
1422
1422
  </div>
1423
- `}render(){return this._paymentMethodManagerTask.render({complete:t=>t?this.screen==="form"?this.renderForm(t):this.renderMandate():c})}};q.styles=[x,bo],s([l({type:Object})],q.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0}),l({attribute:!1})],q.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0}),l({attribute:!1})],q.prototype,"sdkState",2),s([f({context:Pe,subscribe:!0}),l({attribute:!1})],q.prototype,"clientOptions",2),s([C()],q.prototype,"screen",2),s([C()],q.prototype,"isSubmitting",2),q=s([g("primer-ach-payment"),M()],q);var Co=u`
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
1424
  :host {
1425
1425
  height: calc(
1426
1426
  var(--primer-typography-title-large-line-height) +
@@ -1456,7 +1456,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1456
1456
  img {
1457
1457
  height: 100%;
1458
1458
  }
1459
- `;function kt(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())}var Q=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new k(this,{task:async([t,r])=>!t||!r?_:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new k(this,{task:async([t,r])=>{if(!t||!r)return _;let o=r.getPaymentMethodConfiguration(t);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}:_},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new k(this,{task:async([t,r])=>!t||!r?_:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?kt(t):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
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
1460
  <primer-portal>
1461
1461
  <primer-dialog @primer-dialog-close="${()=>this.open=!1}">
1462
1462
  <primer-ach-payment
@@ -1467,19 +1467,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1467
1467
  ></primer-ach-payment>
1468
1468
  </primer-dialog>
1469
1469
  </primer-portal>
1470
- `:c}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:t})=>(this.style.setProperty("--dynamic-payment-button-bg-color",t.backgroundColor),d`
1470
+ `:p}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
1471
1471
  <primer-button
1472
1472
  @click="${()=>this.start()}"
1473
- class=${V({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1474
- title="${v("pay_with",{id:"pay_with"})} ${t.name}"
1473
+ class=${R({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1474
+ title="${y("pay_with",{id:"pay_with"})} ${e.name}"
1475
1475
  >
1476
1476
  <span class="image-container">
1477
- <img src="${t.iconUrl}" alt="${t.name}" />
1477
+ <img src="${e.iconUrl}" alt="${e.name}" />
1478
1478
  </span>
1479
- ${t.displayName}
1479
+ ${e.displayName}
1480
1480
  </primer-button>
1481
1481
  ${this.renderDialog()}
1482
- `)})}};Q.styles=[x,Co],s([l({type:Object})],Q.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0})],Q.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0})],Q.prototype,"sdkState",2),s([f({context:D,subscribe:!0})],Q.prototype,"headlessUtils",2),s([C()],Q.prototype,"open",2),Q=s([g("primer-dynamic-payment"),M()],Q);var Eo=u`
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
1483
  :host {
1484
1484
  height: calc(
1485
1485
  var(--primer-typography-title-large-line-height) +
@@ -1554,24 +1554,24 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1554
1554
  flex-shrink: 0;
1555
1555
  flex-grow: 1;
1556
1556
  }
1557
- `;var te=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new k(this,{task:async([t,r])=>!t||!r?_:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new k(this,{task:async([t,r])=>{if(!t||!r)return _;let o=r.getPaymentMethodConfiguration(t);if(!o)return _;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 k(this,{task:async([t,r])=>!t||!r?_:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?kt(t):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:t})=>{this.style.setProperty("--redirect-payment-button-bg-color",t.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":t.iconPosition==="END","image-only":!t.displayName},o=t.displayName?d`
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
1558
  <span class="image-container">
1559
- <img src="${t.iconUrl}" alt="${t.name}" />
1559
+ <img src="${e.iconUrl}" alt="${e.name}" />
1560
1560
  </span>
1561
- <span class="button-text">${t.displayName}</span>
1561
+ <span class="button-text">${e.displayName}</span>
1562
1562
  `:d`
1563
1563
  <span class="image-container">
1564
- <img src="${t.iconUrl}" alt="${t.name}" />
1564
+ <img src="${e.iconUrl}" alt="${e.name}" />
1565
1565
  </span>
1566
1566
  `;return d`
1567
1567
  <primer-button
1568
1568
  @click="${()=>this.startRedirectPayment()}"
1569
- class=${V(r)}
1570
- title="${v("pay_with",{id:"pay_with"})} ${t.name}"
1569
+ class=${R(r)}
1570
+ title="${y("pay_with",{id:"pay_with"})} ${e.name}"
1571
1571
  >
1572
1572
  ${o}
1573
1573
  </primer-button>
1574
- `}})}};te.styles=[x,Eo],s([l({type:Object})],te.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0})],te.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0})],te.prototype,"sdkState",2),s([f({context:D,subscribe:!0})],te.prototype,"headlessUtils",2),te=s([g("primer-redirect-payment"),M()],te);var qe={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 ii(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Ja(i){return i?i===i.toUpperCase()?ii(i):i:""}function Ao(i,e){return[i,e].filter(Boolean).join(" ")}function es(i,e){return!i||!e?"":`Expires ${i}/${e.slice(-2)}`}function _o(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function ts(i){let e=i.paymentInstrumentData,t=Ja(e.network),r=e.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${t} ${_o(r)}`:t)||" Card"}`,a=es(e.expirationMonth,e.expirationYear);return{description:o,secondaryDescription:a}}function rs(i){let e=i.paymentInstrumentData,t=e.externalPayerInfo?.email||"",r=e.externalPayerInfo?.firstName||"",o=e.externalPayerInfo?.lastName||"",a=i.userDescription||t||"PayPal Account",n=Ao(r,o);return{description:a,secondaryDescription:n}}function is(i){let e=i.paymentInstrumentData,t=e.sessionData?.billingAddress?.email||"",r=e.sessionData?.billingAddress?.firstName||"",o=e.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(t?`Klarna - ${t}`:"Klarna Account"),n=Ao(r,o);return{description:a,secondaryDescription:n}}function os(i){let e=i.paymentInstrumentData,t=e.accountNumberLastFourDigits||"",r=e.bankName||"",o=e.accountType||"",a=i.userDescription;a||(r&&t?a=`${r} ${_o(t)}`:r?a=r:a="Bank Account");let n=o?`${ii(o)} Account`:"";return{description:a,secondaryDescription:n}}function as(i){let e=i.paymentInstrumentType,t=ii(e.replace(/_/g," "));return{description:i.userDescription||t}}var ss={[qe.CARD]:ts,[qe.PAYPAL_VAULTED]:rs,[qe.KLARNA_CUSTOMER_TOKEN]:is,[qe.AUTOMATED_CLEARING_HOUSE]:os};function ur(i){try{let e=ss[i.paymentInstrumentType];return e?e(i):as(i)}catch(e){return S.error("FormatUtils",`Error formatting payment method ${i.id}:`,e),{description:i.userDescription||i.id||"Payment Method"}}}var Mo=u`
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
1575
  :host {
1576
1576
  display: block;
1577
1577
  width: 100%;
@@ -1688,83 +1688,81 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1688
1688
  transition: none;
1689
1689
  }
1690
1690
  }
1691
- `;var wt=globalThis,hr=wt.trustedTypes,So=hr?hr.createPolicy("lit-html",{createHTML:i=>i}):void 0,ai="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,si="?"+be,ns=`<${si}>`,Xe=document,gr=()=>Xe.createComment(""),Tt=i=>i===null||typeof i!="object"&&typeof i!="function",ni=Array.isArray,$o=i=>ni(i)||typeof i?.[Symbol.iterator]=="function",oi=`[
1692
- \f\r]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ko=/-->/g,Po=/>/g,We=RegExp(`>|${oi}(?:([^\\s"'>=/]+)(${oi}*=${oi}*(?:[^
1693
- \f\r"'\`<>=]|("|')|))|$)`,"g"),wo=/'/g,To=/"/g,Io=/^(?:script|style|textarea|title)$/i,li=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),rg=li(1),ig=li(2),og=li(3),Lt=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),Lo=new WeakMap,Ze=Xe.createTreeWalker(Xe,129);function No(i,e){if(!ni(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return So!==void 0?So.createHTML(e):e}var Oo=(i,e)=>{let t=i.length-1,r=[],o,a=e===2?"<svg>":e===3?"<math>":"",n=Pt;for(let m=0;m<t;m++){let p=i[m],b,E,y=-1,w=0;for(;w<p.length&&(n.lastIndex=w,E=n.exec(p),E!==null);)w=n.lastIndex,n===Pt?E[1]==="!--"?n=ko:E[1]!==void 0?n=Po:E[2]!==void 0?(Io.test(E[2])&&(o=RegExp("</"+E[2],"g")),n=We):E[3]!==void 0&&(n=We):n===We?E[0]===">"?(n=o??Pt,y=-1):E[1]===void 0?y=-2:(y=n.lastIndex-E[2].length,b=E[1],n=E[3]===void 0?We:E[3]==='"'?To:wo):n===To||n===wo?n=We:n===ko||n===Po?n=Pt:(n=We,o=void 0);let I=n===We&&i[m+1].startsWith("/>")?" ":"";a+=n===Pt?p+ns:y>=0?(r.push(b),p.slice(0,y)+ai+p.slice(y)+be+I):p+be+(y===-2?m:I)}return[No(i,a+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},$t=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let a=0,n=0,m=e.length-1,p=this.parts,[b,E]=Oo(e,t);if(this.el=i.createElement(b,r),Ze.currentNode=this.el.content,t===2||t===3){let y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(o=Ze.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let y of o.getAttributeNames())if(y.endsWith(ai)){let w=E[n++],I=o.getAttribute(y).split(be),de=/([.?@])?(.*)/.exec(w);p.push({type:1,index:a,name:de[2],strings:I,ctor:de[1]==="."?vr:de[1]==="?"?yr:de[1]==="@"?br:Je}),o.removeAttribute(y)}else y.startsWith(be)&&(p.push({type:6,index:a}),o.removeAttribute(y));if(Io.test(o.tagName)){let y=o.textContent.split(be),w=y.length-1;if(w>0){o.textContent=hr?hr.emptyScript:"";for(let I=0;I<w;I++)o.append(y[I],gr()),Ze.nextNode(),p.push({type:2,index:++a});o.append(y[w],gr())}}}else if(o.nodeType===8)if(o.data===si)p.push({type:2,index:a});else{let y=-1;for(;(y=o.data.indexOf(be,y+1))!==-1;)p.push({type:7,index:a}),y+=be.length-1}a++}}static createElement(e,t){let r=Xe.createElement("template");return r.innerHTML=e,r}};function Qe(i,e,t=i,r){if(e===Lt)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,a=Tt(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=Qe(i,o._$AS(i,e.values),o,r)),e}var fr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??Xe).importNode(t,!0);Ze.currentNode=o;let a=Ze.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let b;p.type===2?b=new It(a,a.nextSibling,this,e):p.type===1?b=new p.ctor(a,p.name,p.strings,this,e):p.type===6&&(b=new xr(a,this,e)),this._$AV.push(b),p=r[++m]}n!==p?.index&&(a=Ze.nextNode(),n++)}return Ze.currentNode=Xe,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},It=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=L,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Qe(this,e,t),Tt(e)?e===L||e==null||e===""?(this._$AH!==L&&this._$AR(),this._$AH=L):e!==this._$AH&&e!==Lt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):$o(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==L&&Tt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=$t.createElement(No(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let a=new fr(o,this),n=a.u(this.options);a.p(t),this.T(n),this._$AH=a}}_$AC(e){let t=Lo.get(e.strings);return t===void 0&&Lo.set(e.strings,t=new $t(e)),t}k(e){ni(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let a of e)o===t.length?t.push(r=new i(this.O(gr()),this.O(gr()),this,this.options)):r=t[o],r._$AI(a),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,a){this.type=1,this._$AH=L,this._$AN=void 0,this.element=e,this.name=t,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=L}_$AI(e,t=this,r,o){let a=this.strings,n=!1;if(a===void 0)e=Qe(this,e,t,0),n=!Tt(e)||e!==this._$AH&&e!==Lt,n&&(this._$AH=e);else{let m=e,p,b;for(e=a[0],p=0;p<a.length-1;p++)b=Qe(this,m[r+p],t,p),b===Lt&&(b=this._$AH[p]),n||(n=!Tt(b)||b!==this._$AH[p]),b===L?e=L:e!==L&&(e+=(b??"")+a[p+1]),this._$AH[p]=b}n&&!o&&this.j(e)}j(e){e===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},vr=class extends Je{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===L?void 0:e}},yr=class extends Je{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==L)}},br=class extends Je{constructor(e,t,r,o,a){super(e,t,r,o,a),this.type=5}_$AI(e,t=this){if((e=Qe(this,e,t,0)??L)===Lt)return;let r=this._$AH,o=e===L&&r!==L||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==L&&(r===L||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},xr=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Qe(this,e)}},Ro={M:ai,P:be,A:si,C:1,L:Oo,R:fr,D:$o,V:Qe,I:It,H:Je,N:yr,U:br,B:vr,F:xr},ls=wt.litHtmlPolyfillSupport;ls?.($t,It),(wt.litHtmlVersions??(wt.litHtmlVersions=[])).push("3.3.0");var nt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Nt=i=>(...e)=>({_$litDirective$:i,values:e}),Cr=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:mg}=Ro;var Do=i=>i.strings===void 0;var Ot=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),Ot(r,e);return!0},Er=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},Vo=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),cs(e)}};function ds(i){this._$AN!==void 0?(Er(this),this._$AM=i,Vo(this)):this._$AM=i}function ps(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let a=t;a<r.length;a++)Ot(r[a],!1),Er(r[a]);else r!=null&&(Ot(r,!1),Er(r));else Ot(this,i)}var cs=i=>{i.type==nt.CHILD&&(i._$AP??(i._$AP=ps),i._$AQ??(i._$AQ=ds))},lt=class extends Cr{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Vo(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ot(this,e),Er(this))}setValue(e){if(Do(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var Ar=new WeakMap,dt=class{constructor(e,t){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=e,this.defaultOptions=t.defaultOptions||{},this.startPaused=!!t.startPaused,this.disabled=!!t.disabled,this.onComplete=t.onComplete,Ar.set(this.host,this)}async add(e){this.clients.add(e),this.startPaused&&e.webAnimation?.pause(),this.pendingComplete=!0,await e.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(e){this.clients.delete(e)}pause(){this.clients.forEach(e=>e.webAnimation?.pause())}play(){this.clients.forEach(e=>e.webAnimation?.play())}cancel(){this.clients.forEach(e=>e.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(e=>e.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(e=>e.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(e=>e.finished))}};var Ho=0,di=new Map,Yo=new WeakSet,pi=()=>new Promise(i=>requestAnimationFrame(i));var zo=(i,e)=>{let t=i-e;return t===0?void 0:t},Uo=(i,e)=>{let t=i/e;return t===1?void 0:t},_r={left:(i,e)=>{let t=zo(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateX(${t}px)`}},top:(i,e)=>{let t=zo(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateY(${t}px)`}},width:(i,e)=>{let t;e===0&&(e=1,t={width:"1px"});let r=Uo(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,e)=>{let t;e===0&&(e=1,t={height:"1px"});let r=Uo(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},Bo={duration:333,easing:"ease-in-out"},Ko=["left","top","width","height","opacity","color","background"],Fo=new WeakMap,Mr=class extends lt{constructor(e){if(super(e),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,e.type===nt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){this.l?.(),this.l=void 0}render(e){return L}getController(){return Ar.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(e,[t]){let r=this.u===void 0;return r&&(this.u=e.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=e.element,Fo.set(this.element,this)),this.optionsOrCallback=t,(r||typeof t!="function")&&this.p(t),this.render(t)}p(e){e=e??{};let t=this.getController();t!==void 0&&((e={...t.defaultOptions,...e}).keyframeOptions={...t.defaultOptions.keyframeOptions,...e.keyframeOptions}),e.properties??(e.properties=Ko),this.options=e}m(){let e={},t=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=t[o]??(_r[o]?void 0:r[o]),n=Number(a);e[o]=isNaN(n)?a+"":n}),e}v(){let e,t=!0;return this.options.guard&&(e=this.options.guard(),t=((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})(e,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&t&&this.element.isConnected,this.h&&(this._=Array.isArray(e)?Array.from(e):e),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 e;this.prepare(),await pi;let t=this.O(),r=this.j(this.options.keyframeOptions,t),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,t);this.log("measured",[this.A,o,a,n]),e=this.calculateKeyframes(a,n)}else{let a=di.get(this.options.inId);if(a){di.delete(this.options.inId);let{from:n,to:m}=this.N(a,o,t);e=this.calculateKeyframes(n,m),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,Ho++,e.forEach(p=>p.zIndex=Ho)}else this.options.in&&(e=[...this.options.in,{}])}this.animate(e,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&&di.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await pi(),this.i?.isConnected){let t=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,t),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 e=this.j(this.options.keyframeOptions);await this.animate(this.options.out,e),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(e){e&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let e=[];for(let t=this.element.parentNode;t;t=t?.parentNode){let r=Fo.get(t);r&&!r.isDisabled()&&r&&e.push(r)}return e}get isHostRendered(){let e=Yo.has(this.u);return e||this.u.updateComplete.then(()=>{Yo.add(this.u)}),e}j(e,t=this.O()){let r={...Bo};return t.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,e),r}N(e,t,r){e={...e},t={...t};let o=r.map(m=>m.animatingProperties).filter(m=>m!==void 0),a=1,n=1;return o.length>0&&(o.forEach(m=>{m.width&&(a/=m.width),m.height&&(n/=m.height)}),e.left!==void 0&&t.left!==void 0&&(e.left=a*e.left,t.left=a*t.left),e.top!==void 0&&t.top!==void 0&&(e.top=n*e.top,t.top=n*t.top)),{from:e,to:t}}calculateKeyframes(e,t,r=!1){let o={},a={},n=!1,m={};for(let p in t){let b=e[p],E=t[p];if(p in _r){let y=_r[p];if(b===void 0||E===void 0)continue;let w=y(b,E);w.transform!==void 0&&(m[p]=w.value,n=!0,o.transform=`${o.transform??""} ${w.transform}`,w.overrideFrom!==void 0&&Object.assign(o,w.overrideFrom))}else b!==E&&b!==void 0&&E!==void 0&&(n=!0,o[p]=b,a[p]=E)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=m,n?[o,a]:void 0}async animate(e,t=this.options.keyframeOptions){this.start(),this.frames=e;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=e=this.options.onFrames(this),this.log("modified frames",e)),e!==void 0)){this.log("animate",[e,t]),r=!0,this.webAnimation=this.element.animate(e,t);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(e,t){this.shouldLog&&!this.isDisabled()&&console.log(e,this.options.id,t)}},Oe=Nt(Mr);var ms=["top","right","bottom","left"],Sr=class extends lt{constructor(e){if(super(e),e.type!==nt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(e,t){return L}update(e,[t,r]){return this.u===void 0&&(this.u=e.options?.host,this.u.addController(this)),this.S=e.element,this.C=t,this.F=r??["left","top","width","height"],this.render(t,r)}hostUpdated(){this.$()}$(){let e=typeof this.C=="function"?this.C():this.C?.value,t=e.offsetParent;if(e===void 0||!t)return;let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();this.F?.forEach(a=>{let n=ms.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},us=Nt(Sr);var W=class extends h{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new dt(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(t){this.isEditMode=t.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(t){this.deletePaymentMethodId=t.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=v("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(t){this.errorMessage=t instanceof Error?t.message:v("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(t){let r=t.detail?.error;this.errorMessage=r instanceof Error?r.message:v("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(t){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===t);if(!r)return"";try{return ur(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
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`
1694
1692
  <div
1695
1693
  class="loading-overlay"
1696
- ${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1694
+ ${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1697
1695
  >
1698
1696
  <primer-spinner
1699
1697
  size="medium"
1700
1698
  color="var(--primer-color-loader)"
1701
1699
  ></primer-spinner>
1702
1700
  </div>
1703
- `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return c;let t=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
1701
+ `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return p;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
1704
1702
  <div class="delete-confirmation-container">
1705
1703
  <primer-vault-delete-confirmation
1706
1704
  .isDeleting=${this.isDeleting}
1707
1705
  .paymentMethodId=${this.deletePaymentMethodId}
1708
- .paymentMethodName=${t}
1706
+ .paymentMethodName=${e}
1709
1707
  @confirm-delete=${this.handleConfirmDelete}
1710
1708
  @cancel-delete=${this.handleCancelDelete}
1711
- ${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1709
+ ${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1712
1710
  ></primer-vault-delete-confirmation>
1713
1711
  </div>
1714
- `}renderPaymentMethodItem(t){return this.deletePaymentMethodId===t.id?c:d`
1712
+ `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?p:d`
1715
1713
  <primer-vault-payment-method-item
1716
- .paymentMethod=${t}
1714
+ .paymentMethod=${e}
1717
1715
  .isEditMode=${this.isEditMode}
1718
1716
  @delete-payment-method=${this.handleDeletePaymentMethod}
1719
- ${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1717
+ ${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1720
1718
  ></primer-vault-payment-method-item>
1721
- `}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return d`
1719
+ `}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
1722
1720
  <div class="payment-methods-list">
1723
- ${t.map(o=>this.renderPaymentMethodItem(o))}
1724
- ${P(r,()=>d`
1721
+ ${e.map(o=>this.renderPaymentMethodItem(o))}
1722
+ ${_(r,()=>d`
1725
1723
  <div class="submit-button-container">
1726
1724
  <primer-vault-payment-submit
1727
1725
  class="submit-button"
1728
1726
  @primer-vault-payment-error=${this.handlePaymentError}
1729
- ${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1727
+ ${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1730
1728
  ></primer-vault-payment-submit>
1731
1729
  </div>
1732
- `,()=>c)}
1730
+ `,()=>p)}
1733
1731
  </div>
1734
- `}render(){if(!this.vaultManagerContext?.enabled)return c;let t=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
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`
1735
1733
  <div class="vault-manager ${o?"is-updating":""}">
1736
1734
  <primer-vault-manager-header
1737
1735
  .isEditMode=${this.isEditMode}
1738
- .hasPaymentMethods=${t}
1736
+ .hasPaymentMethods=${e}
1739
1737
  @toggle-edit-mode=${this.handleToggleEditMode}
1740
1738
  ></primer-vault-manager-header>
1741
1739
 
1742
- ${P(this.errorMessage,()=>d`
1740
+ ${_(this.errorMessage,()=>d`
1743
1741
  <primer-vault-error-message
1744
1742
  .errorMessage=${this.errorMessage}
1745
1743
  @close-error=${this.handleCloseError}
1746
- ${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1744
+ ${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1747
1745
  ></primer-vault-error-message>
1748
- `,()=>c)}
1746
+ `,()=>p)}
1749
1747
 
1750
1748
  <div class="vault-manager-content">
1751
- ${P(!r&&!t,()=>d`
1749
+ ${_(!r&&!e,()=>d`
1752
1750
  <div class="content-container">
1753
1751
  <primer-vault-empty-state
1754
- ${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1752
+ ${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1755
1753
  ></primer-vault-empty-state>
1756
1754
  </div>
1757
- `,()=>c)}
1758
- ${P(!r&&t,()=>d`
1755
+ `,()=>p)}
1756
+ ${_(!r&&e,()=>d`
1759
1757
  <div class="content-container">
1760
- ${P(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
1758
+ ${_(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
1761
1759
  </div>
1762
- `,()=>c)}
1760
+ `,()=>p)}
1763
1761
  </div>
1764
1762
 
1765
- ${P(o,()=>this.renderLoadingOverlay(),()=>c)}
1763
+ ${_(o,()=>this.renderLoadingOverlay(),()=>p)}
1766
1764
  </div>
1767
- `}};W.styles=[x,Mo],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1})],W.prototype,"vaultManagerContext",2),s([C()],W.prototype,"isEditMode",2),s([C()],W.prototype,"deletePaymentMethodId",2),s([C()],W.prototype,"isDeleting",2),s([C()],W.prototype,"errorMessage",2),s([l({type:Number})],W.prototype,"animationDuration",2),W=s([g("primer-vault-manager"),M()],W);function jo(i){return i.paymentInstrumentType===qe.CARD}var Go=u`
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`
1768
1766
  :host {
1769
1767
  display: flex;
1770
1768
  width: 100%;
@@ -1871,10 +1869,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1871
1869
  .delete-button primer-icon {
1872
1870
  color: var(--primer-color-red-500);
1873
1871
  }
1874
- `;var j=class extends h{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new k(this,{task:async([t,r,o])=>{if(!t||!r||!o)return _;let a="";if(jo(t))a=r.getCardNetworkAsset(t.paymentInstrumentData.network).cardUrl;else{let p=await r.getCDNAssets(t.paymentMethodType);p&&(a=p.assets?.icon?`${p.goatCdnUrl}/${p.assets.icon}`:"")}let n=o.cvvRecapture,m=ur(t);return{icon:a,shouldShowCVV:n,...m}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let t=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!t&&t.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(t){let r=t.icon?d`<img
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
1875
1873
  class="payment-method-icon"
1876
- src=${t.icon}
1877
- alt=${t.description}
1874
+ src=${e.icon}
1875
+ alt=${e.description}
1878
1876
  />`:d`
1879
1877
  <div class="payment-method-icon payment-method-icon-generic">
1880
1878
  <primer-icon name="payment-card" size="sm"></primer-icon>
@@ -1882,12 +1880,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1882
1880
  `;return d`
1883
1881
  ${r}
1884
1882
  <div class="payment-method-details">
1885
- <div class="payment-method-description">${t.description}</div>
1886
- ${t.secondaryDescription?d`<div class="payment-method-secondary-description">
1887
- ${t.secondaryDescription}
1888
- </div>`:c}
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}
1889
1887
  </div>
1890
- `}render(){return this._getAssetsTask.render({error:()=>c,complete:t=>{let r=this.isSelected()?"checked":"default";return d`
1888
+ `}render(){return this._getAssetsTask.render({error:()=>p,complete:e=>{let r=this.isSelected()?"checked":"default";return d`
1891
1889
  <div class="payment-method-wrapper">
1892
1890
  <div class="payment-method-container">
1893
1891
  <primer-button
@@ -1898,25 +1896,25 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1898
1896
  selectionState=${r}
1899
1897
  @click=${this.handleClick}
1900
1898
  >
1901
- ${this.renderPaymentMethodContent(t)}
1899
+ ${this.renderPaymentMethodContent(e)}
1902
1900
  </primer-button>
1903
1901
 
1904
1902
  ${this.isEditMode?d`
1905
1903
  <button
1906
1904
  class="delete-button"
1907
1905
  @click=${this.handleDeleteClick}
1908
- aria-label=${`${v("delete",{id:"delete"})} ${t.description}`}
1906
+ aria-label=${`${y("delete",{id:"delete"})} ${e.description}`}
1909
1907
  >
1910
1908
  <primer-icon name="trash" size="sm"></primer-icon>
1911
1909
  </button>
1912
- `:c}
1910
+ `:p}
1913
1911
  </div>
1914
1912
 
1915
- ${P(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>d`<primer-vault-cvv-input
1913
+ ${_(e.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>d`<primer-vault-cvv-input
1916
1914
  .paymentMethod="${this.paymentMethod}"
1917
- ></primer-vault-cvv-input>`,()=>c)}
1915
+ ></primer-vault-cvv-input>`,()=>p)}
1918
1916
  </div>
1919
- `}})}};j.styles=[x,Go],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.cvvRecapture!==r?.cvvRecapture}})],j.prototype,"vaultManagerContext",2),s([f({context:Te,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],j.prototype,"vaultItemContext",2),s([f({context:D,subscribe:!0}),l({type:Object})],j.prototype,"headlessUtils",2),s([l({type:Object,attribute:!1})],j.prototype,"paymentMethod",2),s([l({type:Boolean,reflect:!0})],j.prototype,"isEditMode",2),j=s([g("primer-vault-payment-method-item"),M()],j);var qo=u`
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`
1920
1918
  :host {
1921
1919
  display: block;
1922
1920
  width: 100%;
@@ -1946,21 +1944,21 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1946
1944
  .edit-button.active {
1947
1945
  color: var(--primer-color-brand);
1948
1946
  }
1949
- `;var re=class extends h{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`
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`
1950
1948
  <div class="vault-manager-header">
1951
- <h3>${v("previouslyUsed",{id:"previouslyUsed"})}</h3>
1949
+ <h3>${y("previouslyUsed",{id:"previouslyUsed"})}</h3>
1952
1950
 
1953
1951
  ${this.hasPaymentMethods?d`
1954
1952
  <primer-button
1955
1953
  class="edit-button ${this.isEditMode?"active":""}"
1956
1954
  @click=${this.toggleEditMode}
1957
- aria-label=${this.isEditMode?v("confirm",{id:"confirm"}):v("editPaymentMethods",{id:"editPaymentMethods"})}
1955
+ aria-label=${this.isEditMode?y("confirm",{id:"confirm"}):y("editPaymentMethods",{id:"editPaymentMethods"})}
1958
1956
  >
1959
1957
  ${this.isEditMode?d`<primer-icon name="checkmark" size="sm"></primer-icon>`:d`<primer-icon name="pencil" size="sm"></primer-icon>`}
1960
1958
  </primer-button>
1961
- `:c}
1959
+ `:p}
1962
1960
  </div>
1963
- `}};re.styles=[x,qo],s([l({type:Boolean})],re.prototype,"isEditMode",2),s([l({type:Boolean})],re.prototype,"hasPaymentMethods",2),re=s([g("primer-vault-manager-header"),M()],re);var Wo=u`
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`
1964
1962
  :host {
1965
1963
  display: block;
1966
1964
  width: 100%;
@@ -2031,10 +2029,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2031
2029
  opacity: 0.7;
2032
2030
  cursor: not-allowed;
2033
2031
  }
2034
- `;var Z=class extends h{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 t=this.paymentMethodName;return d`
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`
2035
2033
  <div class="delete-confirmation">
2036
2034
  <div class="delete-message">
2037
- <p class="delete-text">${t}</p>
2035
+ <p class="delete-text">${e}</p>
2038
2036
  </div>
2039
2037
  <div class="delete-actions">
2040
2038
  <button
@@ -2042,18 +2040,18 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2042
2040
  @click=${this.handleConfirmClick}
2043
2041
  ?disabled=${this.isDeleting}
2044
2042
  >
2045
- ${this.isDeleting?v("deleting",{id:"deleting"}):v("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
2043
+ ${this.isDeleting?y("deleting",{id:"deleting"}):y("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
2046
2044
  </button>
2047
2045
  <button
2048
2046
  class="delete-cancel"
2049
2047
  @click=${this.handleCancelClick}
2050
2048
  ?disabled=${this.isDeleting}
2051
2049
  >
2052
- ${v("cancel",{id:"cancel"})}
2050
+ ${y("cancel",{id:"cancel"})}
2053
2051
  </button>
2054
2052
  </div>
2055
2053
  </div>
2056
- `}};Z.styles=[x,Wo],s([l({type:Boolean})],Z.prototype,"isDeleting",2),s([l({type:String})],Z.prototype,"paymentMethodId",2),s([l({type:String})],Z.prototype,"paymentMethodName",2),s([f({context:B,subscribe:!0})],Z.prototype,"vaultManager",2),Z=s([g("primer-vault-delete-confirmation"),M()],Z);var Zo=u`
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`
2057
2055
  :host {
2058
2056
  display: block;
2059
2057
  width: 100%;
@@ -2068,13 +2066,13 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2068
2066
  .empty-state p {
2069
2067
  margin: 0;
2070
2068
  }
2071
- `;var xe=class extends h{render(){return d`
2069
+ `;var ye=class extends m{render(){return d`
2072
2070
  <div class="empty-state">
2073
2071
  <p>
2074
- ${v("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
2072
+ ${y("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
2075
2073
  </p>
2076
2074
  </div>
2077
- `}};xe.styles=[x,Zo],xe=s([g("primer-vault-empty-state"),M()],xe);var Xo=u`
2075
+ `}};ye.styles=[v,Ao],ye=s([h("primer-vault-empty-state"),S()],ye);var _o=c`
2078
2076
  :host {
2079
2077
  display: block;
2080
2078
  width: 100%;
@@ -2120,7 +2118,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2120
2118
  .error-message button:hover {
2121
2119
  background-color: rgba(0, 0, 0, 0.05);
2122
2120
  }
2123
- `;var ne=class extends h{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return d`
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`
2124
2122
  <div class="error-message">
2125
2123
  <div class="error-content">
2126
2124
  <primer-icon
@@ -2132,16 +2130,16 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2132
2130
  </div>
2133
2131
  <button
2134
2132
  @click=${this.handleDismiss}
2135
- aria-label=${v("closeErrorMessage",{id:"closeErrorMessage"})}
2133
+ aria-label=${y("closeErrorMessage",{id:"closeErrorMessage"})}
2136
2134
  >
2137
2135
  <primer-icon name="close" size="sm"></primer-icon>
2138
2136
  </button>
2139
2137
  </div>
2140
- `}};ne.styles=[x,Xo],s([l({type:String})],ne.prototype,"errorMessage",2),ne=s([g("primer-vault-error-message"),M()],ne);var Qo=u`
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`
2141
2139
  :host {
2142
2140
  display: contents;
2143
2141
  }
2144
- `;var O=class extends h{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 t=>{if(t.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:v("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:c;return d`
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`
2145
2143
  <primer-button
2146
2144
  buttonType="submit"
2147
2145
  variant=${this.variant}
@@ -2152,7 +2150,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2152
2150
  >
2153
2151
  ${this.buttonText}${r}
2154
2152
  </primer-button>
2155
- `}};O.styles=[x,Qo],s([l({type:String})],O.prototype,"buttonText",1),s([f({context:D,subscribe:!0}),l({type:Object})],O.prototype,"headlessInstance",2),s([f({context:$,subscribe:!0}),l()],O.prototype,"sdkState",2),s([f({context:Te,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],O.prototype,"vaultItemContext",2),s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1})],O.prototype,"vaultManager",2),s([f({context:Pe,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],O.prototype,"clientOptions",2),s([l({type:String})],O.prototype,"variant",2),s([l({type:Boolean})],O.prototype,"disabled",2),O=s([g("primer-vault-payment-submit"),M()],O);function kr(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 Jo=u`
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`
2156
2154
  :host {
2157
2155
  display: block;
2158
2156
  margin-top: var(--primer-space-medium);
@@ -2161,21 +2159,21 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2161
2159
  .cvv-input-container {
2162
2160
  margin-bottom: var(--primer-space-medium);
2163
2161
  }
2164
- `;var R=class extends h{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 k(this,{task:async([t,r])=>!t||!r||t.paymentMethodType!=="PAYMENT_CARD"||!t.paymentInstrumentData?.network||r.createCvvInput===null?_:{network:t.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new k(this,{task:async([t])=>{if(!t)return _;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=kr(this.computedStyles),a=o?{input:{base:o}}:void 0,n={cardNetwork:t.network,container:r,name:"cvv",placeholder:"123",style:a};this.cvvInput=await t.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:()=>c,complete:()=>d`
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`
2165
2163
  <div class="cvv-input-container">
2166
2164
  <primer-input-wrapper
2167
2165
  .hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
2168
2166
  >
2169
2167
  <primer-input-label slot="label">CVV</primer-input-label>
2170
2168
  <div slot="input" id="${this.cvvContainerId}"></div>
2171
- ${P(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>d`
2169
+ ${_(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>d`
2172
2170
  <primer-input-error slot="error">
2173
2171
  ${this.cvvError}
2174
2172
  </primer-input-error>
2175
2173
  `)}
2176
2174
  </primer-input-wrapper>
2177
2175
  </div>
2178
- `})}};R.styles=[x,Jo],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.createCvvInput!==r?.createCvvInput}})],R.prototype,"vaultManagerFormContext",2),s([f({context:Te,subscribe:!0}),l({type:Object,attribute:!1})],R.prototype,"vaultManagerCvvContext",2),s([f({context:we,subscribe:!0}),l()],R.prototype,"computedStyles",2),s([l({type:Object})],R.prototype,"paymentMethod",2),s([C()],R.prototype,"cvvError",2),s([C()],R.prototype,"cvvInputIsDirty",2),s([C()],R.prototype,"cvvInputIsBlurred",2),s([C()],R.prototype,"cvvInput",2),R=s([g("primer-vault-cvv-input"),M()],R);var Pr="card-form-context";var ea=u`
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`
2179
2177
  :host {
2180
2178
  display: contents;
2181
2179
  }
@@ -2198,10 +2196,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2198
2196
  display: flex;
2199
2197
  gap: var(--primer-space-small);
2200
2198
  }
2201
- `;var ie=class extends h{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new N(this,{context:Pr,initialValue:null});this.eventsController=new tt(this);this.setupCardFormTask=new k(this,{task:async([t])=>{if(!t?.manager)return _;let{manager:r}=t,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:m=>r.setCardholderName(m),setCardNetwork:m=>{this.selectedCardNetwork=m},validate:()=>r.validate(),submit:m=>r.submit(m),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=t=>{let o=t.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(t.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=t=>{t.stopPropagation(),this.submitCardPayment()};this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=t=>{t.preventDefault(),t.stopPropagation(),this.submitCardPayment()}}updated(t){super.updated(t),t.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(t){let r=t.tagName.toLowerCase(),o=r==="button",a=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||a&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))}async submitCardPayment(){let t=this.cardFormProvider.value;if(!t)return;let r=await t.validate?.();if(r?.valid){let o=await t.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...t,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===$e.ERROR||this.setupCardFormTask.status===$e.INITIAL?c:d`
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`
2202
2200
  <form @submit=${this.handleFormSubmit}>
2203
2201
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
2204
- ${this.setupCardFormTask.render({complete:()=>P(this.hasAssignedContent,()=>c,()=>d`
2202
+ ${this.setupCardFormTask.render({complete:()=>_(this.hasAssignedContent,()=>p,()=>d`
2205
2203
  <div class="card-form">
2206
2204
  <primer-input-card-number></primer-input-card-number>
2207
2205
  <div class="card-form-row">
@@ -2213,7 +2211,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2213
2211
  <primer-card-form-submit></primer-card-form-submit>
2214
2212
  `)})}
2215
2213
  </form>
2216
- `}};ie.styles=[x,ea],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],ie.prototype,"hideLabels",2),s([C()],ie.prototype,"hasAssignedContent",2),s([C()],ie.prototype,"selectedCardNetwork",2),s([f({context:F,subscribe:!0}),l({type:Object})],ie.prototype,"paymentManagers",2),ie=s([g("primer-card-form"),M()],ie);function ta(i,e){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",""),!e.shadowRoot?.querySelector("style[data-custom-input-style]")){let t=document.createElement("style");t.setAttribute("data-custom-input-style",""),t.textContent=`
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=`
2217
2215
  input[data-custom-input]::placeholder {
2218
2216
  color: var(--primer-color-text-placeholder);
2219
2217
  font-size: var(--primer-typography-body-large-size);
@@ -2222,28 +2220,28 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2222
2220
  input[data-custom-input]:focus {
2223
2221
  outline: none;
2224
2222
  }
2225
- `,e.shadowRoot?e.shadowRoot.appendChild(t):e.appendChild(t)}}function ra(i,e){return i.active===e.active&&i.dirty===e.dirty&&i.error===e.error&&i.errorCode===e.errorCode&&i.submitted===e.submitted&&i.touched===e.touched&&i.valid===e.valid}var wr=class{constructor(e,t){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=e,this.config=t,this.host.addController(this),this.setupTask=new k(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:e}=this.config,t=this.host.cardFormContext;return t?{cardNumber:t.cardNumberInput,cvv:t.cvvInput,expire:t.expiryInput,cardholderName:"cardholderName"}[e]:void 0}async setupHostedInput([e]){if(!e)return _;await this.host.updateComplete;let t=this.getTargetContainer();return t?e==="cardholderName"?this.setupStandardInput(t):this.setupHostedIframeInput(e,t):_}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(e){let t=document.createElement("input");return t.type="text",t.placeholder=this.host.placeholder,ta(t,this.host),(this.host.ariaLabel||this.host.label)&&t.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(t),e.innerHTML="",e.appendChild(t),this._standardInput=t,!0}setupInputEventListeners(e){e.addEventListener("input",t=>{let r=t.target;this.config.onInput?.(r.value)}),e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(e,t){await new Promise(a=>requestAnimationFrame(()=>a())),this._hostedInput=e;let r=kr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),e.addEventListener("change",a=>{this._meta=a,ra(this._meta,a)&&this.host.requestUpdate()}),await e.render(t,{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 Y=class extends h{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(t){return t?typeof t=="string"?t:v(t.id,{id:t.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(t){let r=this.label;t!==""?(this._userAssignedProps.add("label"),this._internalLabel=t):(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(t){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=t,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(t){let r=this.ariaLabel;t!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=t):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new wr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let t=this.hostedInputController.meta;return t.submitted||t.dirty&&t.touched?t.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===$e.ERROR)return c;let t=this.getError();return d`
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`
2226
2224
  <primer-input-wrapper
2227
2225
  .focusWithin="${this.hostedInputController.isFocused}"
2228
- .hasError=${!!t}
2226
+ .hasError=${!!e}
2229
2227
  @wrapper-click="${this.handleWrapperClick}"
2230
2228
  >
2231
- ${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
2229
+ ${_(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
2232
2230
  >${this.label}</primer-input-label
2233
- >`,()=>c)}
2231
+ >`,()=>p)}
2234
2232
  <div
2235
2233
  slot="input"
2236
2234
  class="card-input-slot"
2237
2235
  id="${this.config.containerSelector.substring(1)}"
2238
2236
  aria-label="${this.ariaLabel}"
2239
2237
  ></div>
2240
- ${P(t,()=>d`
2238
+ ${_(e,()=>d`
2241
2239
  <primer-input-error slot="error">
2242
- ${v(t,{id:t})}
2240
+ ${y(e,{id:e})}
2243
2241
  </primer-input-error>
2244
- `,()=>c)}
2242
+ `,()=>p)}
2245
2243
  </primer-input-wrapper>
2246
- `}};s([f({context:Pr,subscribe:!0})],Y.prototype,"cardFormContext",2),s([f({context:we,subscribe:!0}),l()],Y.prototype,"computedStyles",2),s([l({type:String})],Y.prototype,"label",1),s([l({type:String})],Y.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],Y.prototype,"ariaLabel",1);var ia=u`
2244
+ `}};s([f({context:hr,subscribe:!0})],V.prototype,"cardFormContext",2),s([f({context:Pe,subscribe:!0}),l()],V.prototype,"computedStyles",2),s([l({type:String})],V.prototype,"label",1),s([l({type:String})],V.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],V.prototype,"ariaLabel",1);var Io=c`
2247
2245
  :host {
2248
2246
  display: contents;
2249
2247
  }
@@ -2267,18 +2265,18 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2267
2265
  align-items: center;
2268
2266
  z-index: 2;
2269
2267
  }
2270
- `;var Re=u`
2268
+ `;var De=c`
2271
2269
  .card-input-slot {
2272
2270
  display: flex;
2273
2271
  }
2274
- `;var Ce=class extends Y{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(t){let{network:r}=t.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===$e.ERROR)return c;let t=this.getError();return d`
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`
2275
2273
  <primer-input-wrapper
2276
2274
  .focusWithin="${this.hostedInputController.isFocused}"
2277
- .hasError=${!!t}
2275
+ .hasError=${!!e}
2278
2276
  >
2279
- ${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
2277
+ ${_(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
2280
2278
  >${this.label}</primer-input-label
2281
- >`,()=>c)}
2279
+ >`,()=>p)}
2282
2280
  <div
2283
2281
  slot="input"
2284
2282
  class="card-number-container"
@@ -2291,29 +2289,29 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2291
2289
  ></primer-card-network-selector>
2292
2290
  </div>
2293
2291
  </div>
2294
- ${P(t,r=>d`
2292
+ ${_(e,r=>d`
2295
2293
  <primer-input-error slot="error">
2296
- ${v(r,{id:r})}
2294
+ ${y(r,{id:r})}
2297
2295
  </primer-input-error>
2298
- `,()=>c)}
2296
+ `,()=>p)}
2299
2297
  </primer-input-wrapper>
2300
- `}render(){return this.renderInput()}};Ce.styles=[x,Re,ia],Ce=s([g("primer-input-card-number"),M()],Ce);var oa=u`
2298
+ `}render(){return this.renderInput()}};ve.styles=[v,De,Io],ve=s([h("primer-input-card-number"),S()],ve);var No=c`
2301
2299
  :host {
2302
2300
  display: contents;
2303
2301
  }
2304
- `;var Ee=class extends Y{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Ee.styles=[x,Re,oa],Ee=s([g("primer-input-cvv"),M()],Ee);var aa=u`
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`
2305
2303
  :host {
2306
2304
  display: contents;
2307
2305
  }
2308
- `;var Ae=class extends Y{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()}};Ae.styles=[x,Re,aa],Ae=s([g("primer-input-card-expiry"),M()],Ae);var sa=u`
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`
2309
2307
  :host {
2310
2308
  display: contents;
2311
2309
  }
2312
- `;var _e=class extends Y{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:t=>this.handleInput(t)};this.childUpdated()}handleInput(t){this.cardFormContext?.setCardholderName?.(t)}render(){return this.renderInput()}};_e.styles=[x,Re,sa],_e=s([g("primer-input-card-holder-name"),M()],_e);var na=u`
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`
2313
2311
  :host {
2314
2312
  display: contents;
2315
2313
  }
2316
- `;var z=class extends h{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=t=>{if(t.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:v("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:c;return d`
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`
2317
2315
  <primer-button
2318
2316
  type="submit"
2319
2317
  variant=${this.variant}
@@ -2324,7 +2322,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2324
2322
  >
2325
2323
  ${this.buttonText}${r}
2326
2324
  </primer-button>
2327
- `}};z.styles=[x,na],s([l({type:String})],z.prototype,"buttonText",1),s([f({context:D,subscribe:!0}),l({type:Object})],z.prototype,"headlessInstance",2),s([f({context:Pe,subscribe:!0}),l({type:Object})],z.prototype,"clientOptions",2),s([f({context:$,subscribe:!0}),l()],z.prototype,"sdkState",2),s([l({type:String})],z.prototype,"variant",2),s([l({type:Boolean})],z.prototype,"disabled",2),z=s([g("primer-card-form-submit"),M()],z);var{I:Sx}=ji;var la=i=>i.strings===void 0;var Rt=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),Rt(r,e);return!0},Tr=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},da=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),fs(e)}};function hs(i){this._$AN!==void 0?(Tr(this),this._$AM=i,da(this)):this._$AM=i}function gs(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let a=t;a<r.length;a++)Rt(r[a],!1),Tr(r[a]);else r!=null&&(Rt(r,!1),Tr(r));else Rt(this,i)}var fs=i=>{i.type==cr.CHILD&&(i._$AP??(i._$AP=gs),i._$AQ??(i._$AQ=hs))},Lr=class extends st{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),da(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Rt(this,e),Tr(this))}setValue(e){if(la(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var ui=()=>new mi,mi=class{},ci=new WeakMap,$r=St(class extends Lr{render(i){return c}update(i,[e]){let t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),c}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=ci.get(e);t===void 0&&(t=new WeakMap,ci.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?ci.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var pa=u`
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`
2328
2326
  :host {
2329
2327
  display: flex;
2330
2328
  align-items: center;
@@ -2447,45 +2445,45 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2447
2445
  width: var(--primer-size-small);
2448
2446
  height: var(--primer-size-small);
2449
2447
  }
2450
- `;var U=class extends h{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=ui();this.dropdownRef=ui();this.networkOptionRefs=[];this.handleClickOutside=t=>{this.isDropdownOpen&&(this.contains(t.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=t=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(t.target)||this===t.target||this.isDropdownOpen&&t.target===document.body)))switch(this.isKeyboardNavigation=!0,t.key){case"ArrowDown":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":t.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?(t.preventDefault(),this.selectNetwork(t,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(t.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(t.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=t=>{this.isDropdownOpen&&this.handleKeyDown(t)}}toggleDropdown(t){this.isKeyboardNavigation=!1,t.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(t){return this.headlessUtils?.getCardNetworkAsset(t.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let t=this.getDetectedNetwork();if(!t)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===t.network);return r>=0?r:0}selectNetwork(t,r){t.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(t,r){this.networkOptionRefs[r]=t}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 t=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&t.length===0)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(t.length>0?t[0]:null);if(!r)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=t.length>1;return d`
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`
2451
2449
  <button
2452
- ${$r(this.buttonRef)}
2450
+ ${gr(this.buttonRef)}
2453
2451
  class="network-selector"
2454
2452
  @click=${this.toggleDropdown}
2455
2453
  @keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
2456
2454
  aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
2457
- aria-expanded=${o?this.isDropdownOpen:c}
2458
- aria-haspopup=${o?"true":c}
2459
- aria-controls=${o?"network-dropdown":c}
2455
+ aria-expanded=${o?this.isDropdownOpen:p}
2456
+ aria-haspopup=${o?"true":p}
2457
+ aria-controls=${o?"network-dropdown":p}
2460
2458
  >
2461
2459
  <img
2462
2460
  class="network-icon"
2463
2461
  src=${this.getNetworkIconUrl(r)}
2464
2462
  alt=${r.displayName}
2465
2463
  />
2466
- ${P(o,()=>d`
2464
+ ${_(o,()=>d`
2467
2465
  <primer-icon
2468
2466
  class="caret ${this.isDropdownOpen?"open":""}"
2469
2467
  size="sm"
2470
2468
  name="chevron-down"
2471
2469
  ></primer-icon>
2472
- `,()=>c)}
2470
+ `,()=>p)}
2473
2471
  </button>
2474
2472
 
2475
- ${P(this.isDropdownOpen,()=>d`
2473
+ ${_(this.isDropdownOpen,()=>d`
2476
2474
  <div
2477
- ${$r(this.dropdownRef)}
2475
+ ${gr(this.dropdownRef)}
2478
2476
  id="network-dropdown"
2479
2477
  class="dropdown open"
2480
2478
  role="listbox"
2481
2479
  aria-label="Select card network"
2482
2480
  >
2483
- ${t.map((a,n)=>d`
2481
+ ${e.map((a,n)=>d`
2484
2482
  <div
2485
- ${$r(m=>this.setNetworkOptionRef(m,n))}
2483
+ ${gr(u=>this.setNetworkOptionRef(u,n))}
2486
2484
  class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
2487
- @click=${m=>this.selectNetwork(m,a)}
2488
- @keydown=${m=>{(m.key==="Enter"||m.key===" ")&&this.selectNetwork(m,a)}}
2485
+ @click=${u=>this.selectNetwork(u,a)}
2486
+ @keydown=${u=>{(u.key==="Enter"||u.key===" ")&&this.selectNetwork(u,a)}}
2489
2487
  role="option"
2490
2488
  aria-selected=${a.network===r.network}
2491
2489
  tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
@@ -2496,18 +2494,18 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2496
2494
  alt=${a.displayName}
2497
2495
  />
2498
2496
  <span class="network-name">${a.displayName}</span>
2499
- ${P(a.network===r.network,()=>d`
2497
+ ${_(a.network===r.network,()=>d`
2500
2498
  <primer-icon
2501
2499
  class="checkmark"
2502
2500
  name="checkmark"
2503
2501
  size="sm"
2504
2502
  ></primer-icon>
2505
- `,()=>c)}
2503
+ `,()=>p)}
2506
2504
  </div>
2507
2505
  `)}
2508
2506
  </div>
2509
- `,()=>c)}
2510
- `}};U.styles=[x,pa],s([f({context:Ht,subscribe:!0})],U.prototype,"cardNetworks",2),s([f({context:D,subscribe:!0})],U.prototype,"headlessUtils",2),s([C()],U.prototype,"selectedCardNetwork",2),s([C()],U.prototype,"isDropdownOpen",2),s([C()],U.prototype,"focusedNetworkIndex",2),s([C()],U.prototype,"isKeyboardNavigation",2),U=s([g("primer-card-network-selector")],U);var ca=u`
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`
2511
2509
  :host {
2512
2510
  display: block;
2513
2511
  margin-top: var(--primer-space-medium);
@@ -2527,19 +2525,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2527
2525
  justify-content: center;
2528
2526
  align-items: center;
2529
2527
  }
2530
- `;var De=class extends h{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?c:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
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`
2531
2529
  <div class="other-payment-methods-container">
2532
2530
  <primer-collapsable
2533
2531
  buttonVariant="secondary"
2534
2532
  .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
2535
- .header="${v("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2533
+ .header="${y("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2536
2534
  >
2537
2535
  <div class="other-payment-methods-content">
2538
2536
  <slot name="other-payments"></slot>
2539
2537
  </div>
2540
2538
  </primer-collapsable>
2541
2539
  </div>
2542
- `}};De.styles=[ca],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1})],De.prototype,"vaultManager",2),De=s([g("primer-show-other-payments")],De);var ma=u`
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`
2543
2541
  :host {
2544
2542
  height: calc(
2545
2543
  var(--primer-typography-title-large-line-height) +
@@ -2553,27 +2551,27 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2553
2551
  height: 100%;
2554
2552
  flex: 1;
2555
2553
  }
2556
- `;var le=class extends h{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new k(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return _;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new k(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return _;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=t.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),t}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let t=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return t+2*r}createRenderOptions(t){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:t}}:r==="PAYPAL"?{style:{buttonHeight:t}}:{style:{buttonHeight:t}}}updated(t){t.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>c,complete:()=>d`
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`
2557
2555
  <!-- The native button container is rendered first -->
2558
2556
  <div class="native-button-container" id="${this._buttonId}"></div>
2559
- `,pending:()=>c})}};le.styles=[x,ma],s([l({type:Object})],le.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0}),l()],le.prototype,"paymentManagers",2),s([f({context:we,subscribe:!0}),l()],le.prototype,"computedStyles",2),le=s([g("primer-native-payment")],le);var pt=class extends h{render(){return d`
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`
2560
2558
  <primer-checkout-state type="complete"></primer-checkout-state>
2561
- `}};pt=s([g("primer-checkout-complete")],pt);var et=class extends h{constructor(){super(...arguments);this.sdkState=null}render(){return d`
2559
+ `}};ot=s([h("primer-checkout-complete")],ot);var Ze=class extends m{constructor(){super(...arguments);this.sdkState=null}render(){return d`
2562
2560
  <primer-checkout-state
2563
2561
  type="failure"
2564
2562
  description=${this.sdkState?.error?.message||""}
2565
2563
  ></primer-checkout-state>
2566
- `}};s([f({context:$,subscribe:!0}),l()],et.prototype,"sdkState",2),et=s([g("primer-checkout-error")],et);var ua=u`
2564
+ `}};s([f({context:T,subscribe:!0}),l()],Ze.prototype,"sdkState",2),Ze=s([h("primer-checkout-error")],Ze);var zo=c`
2567
2565
  :host {
2568
2566
  display: block;
2569
2567
  width: 100%;
2570
2568
  }
2571
- `;var Me=class extends h{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`
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`
2572
2570
  <primer-error-message
2573
- message="${v(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2571
+ message="${y(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2574
2572
  ?visible="${this.shouldShowError}"
2575
2573
  ></primer-error-message>
2576
- `:c}};Me.styles=[ua],s([f({context:$,subscribe:!0}),C()],Me.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],Me.prototype,"showProcessingErrors",2),Me=s([g("primer-error-message-container")],Me);var ha=u`
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`
2577
2575
  :host {
2578
2576
  display: contents;
2579
2577
  }
@@ -2592,22 +2590,22 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2592
2590
  primer-vault-manager {
2593
2591
  margin-bottom: var(--primer-space-xlarge);
2594
2592
  }
2595
- `;var Se=class extends h{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?d`
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`
2596
2594
  <slot name="checkout-complete">
2597
2595
  <primer-checkout-complete></primer-checkout-complete>
2598
2596
  </slot>
2599
2597
  `:d`
2600
2598
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
2601
- ${P(this.hasAssignedContent,()=>c,()=>d`
2599
+ ${_(this.hasAssignedContent,()=>p,()=>d`
2602
2600
  <div
2603
- class=${V({"primer-is-processing":!!this.sdkState?.isProcessing})}
2601
+ class=${R({"primer-is-processing":!!this.sdkState?.isProcessing})}
2604
2602
  >
2605
2603
  <primer-vault-manager></primer-vault-manager>
2606
2604
  <primer-show-other-payments>
2607
2605
  <div slot="other-payments" class="primer-main-list">
2608
- ${this.paymentMethods?.toArray().map(t=>d`
2606
+ ${this.paymentMethods?.toArray().map(e=>d`
2609
2607
  <primer-payment-method
2610
- type=${t.type}
2608
+ type=${e.type}
2611
2609
  ></primer-payment-method>
2612
2610
  `)}
2613
2611
  </div>
@@ -2615,335 +2613,93 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2615
2613
  <primer-error-message-container></primer-error-message-container>
2616
2614
  </div>
2617
2615
  `)}
2618
- `}};Se.styles=[x,ha],s([f({context:it,subscribe:!0}),l()],Se.prototype,"paymentMethods",2),s([f({context:$,subscribe:!0}),l()],Se.prototype,"sdkState",2),Se=s([g("primer-main")],Se);async function qE(){to(),ro()}export{q as AchPayment,G as Button,ie as CardForm,Ee as CardFormCVV,U as CardFormCardNetworkSelector,Ce as CardFormCardNumber,fe as CardFormError,Ae as CardFormExpiry,_e as CardFormName,z as CardFormSubmit,K as Collapsable,Ge as Dialog,Q as DynamicPayment,ee as ErrorMessage,Me as ErrorMessageContainer,sr as InitializedPayments,T as Input,ge as InputLabel,ae as InputWrapper,le as NativePayment,ye as PaymentMethod,Ne as Portal,pt as PrimerCheckoutComplete,X as PrimerCheckoutComponent,et as PrimerCheckoutFailure,ve as PrimerCheckoutState,se as PrimerIcon,H as PrimerKlarna,Se as PrimerMain,te as RedirectPayment,De as ShowOtherPayments,oe as Spinner,R as VaultCvvInput,Z as VaultDeleteConfirmation,xe as VaultEmptyState,ne as VaultErrorMessage,W as VaultManager,re as VaultManagerHeader,j as VaultPaymentMethodItem,O as VaultPaymentSubmit,Za as injectDarkTheme,Wa as injectLightTheme,to as injectLoaderStyles,ro as injectThemeStyles,qE as loadPrimer};
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};
2619
2617
  /*! Bundled license information:
2620
2618
 
2621
2619
  @lit/context/lib/context-request-event.js:
2622
- (**
2623
- * @license
2624
- * Copyright 2021 Google LLC
2625
- * SPDX-License-Identifier: BSD-3-Clause
2626
- *)
2627
-
2628
2620
  @lit/context/lib/create-context.js:
2629
- (**
2630
- * @license
2631
- * Copyright 2021 Google LLC
2632
- * SPDX-License-Identifier: BSD-3-Clause
2633
- *)
2634
-
2635
2621
  @lit/context/lib/controllers/context-consumer.js:
2636
- (**
2637
- * @license
2638
- * Copyright 2021 Google LLC
2639
- * SPDX-License-Identifier: BSD-3-Clause
2640
- *)
2641
-
2642
2622
  @lit/context/lib/value-notifier.js:
2643
- (**
2644
- * @license
2645
- * Copyright 2021 Google LLC
2646
- * SPDX-License-Identifier: BSD-3-Clause
2647
- *)
2648
-
2649
2623
  @lit/context/lib/controllers/context-provider.js:
2650
- (**
2651
- * @license
2652
- * Copyright 2021 Google LLC
2653
- * SPDX-License-Identifier: BSD-3-Clause
2654
- *)
2655
-
2656
2624
  @lit/context/lib/context-root.js:
2657
- (**
2658
- * @license
2659
- * Copyright 2021 Google LLC
2660
- * SPDX-License-Identifier: BSD-3-Clause
2661
- *)
2662
-
2663
- @lit/context/lib/decorators/provide.js:
2664
- (**
2665
- * @license
2666
- * Copyright 2017 Google LLC
2667
- * SPDX-License-Identifier: BSD-3-Clause
2668
- *)
2669
-
2670
- @lit/context/lib/decorators/consume.js:
2671
- (**
2672
- * @license
2673
- * Copyright 2022 Google LLC
2674
- * SPDX-License-Identifier: BSD-3-Clause
2675
- *)
2676
-
2677
- @lit/reactive-element/css-tag.js:
2678
- (**
2679
- * @license
2680
- * Copyright 2019 Google LLC
2681
- * SPDX-License-Identifier: BSD-3-Clause
2682
- *)
2683
-
2684
- @lit/reactive-element/reactive-element.js:
2685
- (**
2686
- * @license
2687
- * Copyright 2017 Google LLC
2688
- * SPDX-License-Identifier: BSD-3-Clause
2689
- *)
2690
-
2691
- @lit/task/task.js:
2692
- (**
2693
- * @license
2694
- * Copyright 2017 Google LLC
2695
- * SPDX-License-Identifier: BSD-3-Clause
2696
- *)
2697
-
2698
2625
  @lit/localize/internal/locale-status-event.js:
2699
- (**
2700
- * @license
2701
- * Copyright 2021 Google LLC
2702
- * SPDX-License-Identifier: BSD-3-Clause
2703
- *)
2704
-
2705
2626
  @lit/localize/internal/str-tag.js:
2706
- (**
2707
- * @license
2708
- * Copyright 2021 Google LLC
2709
- * SPDX-License-Identifier: BSD-3-Clause
2710
- *)
2711
-
2712
2627
  @lit/localize/internal/types.js:
2713
- (**
2714
- * @license
2715
- * Copyright 2021 Google LLC
2716
- * SPDX-License-Identifier: BSD-3-Clause
2717
- *)
2718
-
2719
2628
  @lit/localize/internal/default-msg.js:
2720
- (**
2721
- * @license
2722
- * Copyright 2021 Google LLC
2723
- * SPDX-License-Identifier: BSD-3-Clause
2724
- *)
2725
-
2726
2629
  @lit/localize/internal/localized-controller.js:
2727
- (**
2728
- * @license
2729
- * Copyright 2021 Google LLC
2730
- * SPDX-License-Identifier: BSD-3-Clause
2731
- *)
2732
-
2733
2630
  @lit/localize/internal/localized-decorator.js:
2734
- (**
2735
- * @license
2736
- * Copyright 2021 Google LLC
2737
- * SPDX-License-Identifier: BSD-3-Clause
2738
- *)
2739
-
2740
- @lit/localize/internal/deferred.js:
2741
- (**
2742
- * @license
2743
- * Copyright 2020 Google LLC
2744
- * SPDX-License-Identifier: BSD-3-Clause
2745
- *)
2746
-
2747
- @lit/localize/internal/fnv1a64.js:
2748
- (**
2749
- * @license
2750
- * Copyright 2014 Travis Webb
2751
- * SPDX-License-Identifier: MIT
2752
- *)
2753
-
2754
- @lit/localize/internal/id-generation.js:
2755
- (**
2756
- * @license
2757
- * Copyright 2020 Google LLC
2758
- * SPDX-License-Identifier: BSD-3-Clause
2759
- *)
2760
-
2761
2631
  @lit/localize/internal/runtime-msg.js:
2762
- (**
2763
- * @license
2764
- * Copyright 2021 Google LLC
2765
- * SPDX-License-Identifier: BSD-3-Clause
2766
- *)
2767
-
2768
2632
  @lit/localize/init/runtime.js:
2769
- (**
2770
- * @license
2771
- * Copyright 2021 Google LLC
2772
- * SPDX-License-Identifier: BSD-3-Clause
2773
- *)
2774
-
2775
2633
  @lit/localize/init/transform.js:
2634
+ @lit/reactive-element/decorators/query-assigned-elements.js:
2635
+ lit-html/directives/when.js:
2776
2636
  (**
2777
2637
  * @license
2778
2638
  * Copyright 2021 Google LLC
2779
2639
  * SPDX-License-Identifier: BSD-3-Clause
2780
2640
  *)
2781
2641
 
2782
- @lit/localize/lit-localize.js:
2783
- (**
2784
- * @license
2785
- * Copyright 2020 Google LLC
2786
- * SPDX-License-Identifier: BSD-3-Clause
2787
- *)
2788
-
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:
2789
2646
  lit-html/lit-html.js:
2790
- (**
2791
- * @license
2792
- * Copyright 2017 Google LLC
2793
- * SPDX-License-Identifier: BSD-3-Clause
2794
- *)
2795
-
2796
2647
  lit-element/lit-element.js:
2797
- (**
2798
- * @license
2799
- * Copyright 2017 Google LLC
2800
- * SPDX-License-Identifier: BSD-3-Clause
2801
- *)
2802
-
2803
- lit-html/is-server.js:
2804
- (**
2805
- * @license
2806
- * Copyright 2022 Google LLC
2807
- * SPDX-License-Identifier: BSD-3-Clause
2808
- *)
2809
-
2810
2648
  @lit/reactive-element/decorators/custom-element.js:
2811
- (**
2812
- * @license
2813
- * Copyright 2017 Google LLC
2814
- * SPDX-License-Identifier: BSD-3-Clause
2815
- *)
2816
-
2817
2649
  @lit/reactive-element/decorators/property.js:
2818
- (**
2819
- * @license
2820
- * Copyright 2017 Google LLC
2821
- * SPDX-License-Identifier: BSD-3-Clause
2822
- *)
2823
-
2824
2650
  @lit/reactive-element/decorators/state.js:
2825
- (**
2826
- * @license
2827
- * Copyright 2017 Google LLC
2828
- * SPDX-License-Identifier: BSD-3-Clause
2829
- *)
2830
-
2831
2651
  @lit/reactive-element/decorators/event-options.js:
2832
- (**
2833
- * @license
2834
- * Copyright 2017 Google LLC
2835
- * SPDX-License-Identifier: BSD-3-Clause
2836
- *)
2837
-
2838
2652
  @lit/reactive-element/decorators/base.js:
2839
- (**
2840
- * @license
2841
- * Copyright 2017 Google LLC
2842
- * SPDX-License-Identifier: BSD-3-Clause
2843
- *)
2844
-
2845
2653
  @lit/reactive-element/decorators/query.js:
2846
- (**
2847
- * @license
2848
- * Copyright 2017 Google LLC
2849
- * SPDX-License-Identifier: BSD-3-Clause
2850
- *)
2851
-
2852
2654
  @lit/reactive-element/decorators/query-all.js:
2853
- (**
2854
- * @license
2855
- * Copyright 2017 Google LLC
2856
- * SPDX-License-Identifier: BSD-3-Clause
2857
- *)
2858
-
2859
2655
  @lit/reactive-element/decorators/query-async.js:
2860
- (**
2861
- * @license
2862
- * Copyright 2017 Google LLC
2863
- * SPDX-License-Identifier: BSD-3-Clause
2864
- *)
2865
-
2866
- @lit/reactive-element/decorators/query-assigned-elements.js:
2867
- (**
2868
- * @license
2869
- * Copyright 2021 Google LLC
2870
- * SPDX-License-Identifier: BSD-3-Clause
2871
- *)
2872
-
2873
2656
  @lit/reactive-element/decorators/query-assigned-nodes.js:
2874
- (**
2875
- * @license
2876
- * Copyright 2017 Google LLC
2877
- * SPDX-License-Identifier: BSD-3-Clause
2878
- *)
2879
-
2880
- lit-html/directives/when.js:
2881
- (**
2882
- * @license
2883
- * Copyright 2021 Google LLC
2884
- * SPDX-License-Identifier: BSD-3-Clause
2885
- *)
2886
-
2887
- lit-html/directive.js:
2888
- (**
2889
- * @license
2890
- * Copyright 2017 Google LLC
2891
- * SPDX-License-Identifier: BSD-3-Clause
2892
- *)
2893
-
2894
- lit-html/directives/class-map.js:
2895
- (**
2896
- * @license
2897
- * Copyright 2018 Google LLC
2898
- * SPDX-License-Identifier: BSD-3-Clause
2899
- *)
2900
-
2901
- lit-html/lit-html.js:
2902
- (**
2903
- * @license
2904
- * Copyright 2017 Google LLC
2905
- * SPDX-License-Identifier: BSD-3-Clause
2906
- *)
2907
-
2908
2657
  lit-html/directive.js:
2658
+ lit-html/async-directive.js:
2909
2659
  (**
2910
2660
  * @license
2911
2661
  * Copyright 2017 Google LLC
2912
2662
  * SPDX-License-Identifier: BSD-3-Clause
2913
2663
  *)
2914
2664
 
2915
- lit-html/directive-helpers.js:
2665
+ @lit/context/lib/decorators/consume.js:
2666
+ lit-html/is-server.js:
2916
2667
  (**
2917
2668
  * @license
2918
- * Copyright 2020 Google LLC
2669
+ * Copyright 2022 Google LLC
2919
2670
  * SPDX-License-Identifier: BSD-3-Clause
2920
2671
  *)
2921
2672
 
2922
- lit-html/async-directive.js:
2673
+ @lit/reactive-element/css-tag.js:
2674
+ @lit/reactive-element/css-tag.js:
2923
2675
  (**
2924
2676
  * @license
2925
- * Copyright 2017 Google LLC
2677
+ * Copyright 2019 Google LLC
2926
2678
  * SPDX-License-Identifier: BSD-3-Clause
2927
2679
  *)
2928
2680
 
2681
+ @lit/localize/internal/deferred.js:
2682
+ @lit/localize/internal/id-generation.js:
2683
+ @lit/localize/lit-localize.js:
2929
2684
  lit-html/directive-helpers.js:
2685
+ lit-html/directives/ref.js:
2930
2686
  (**
2931
2687
  * @license
2932
2688
  * Copyright 2020 Google LLC
2933
2689
  * SPDX-License-Identifier: BSD-3-Clause
2934
2690
  *)
2935
2691
 
2936
- lit-html/async-directive.js:
2692
+ @lit/localize/internal/fnv1a64.js:
2937
2693
  (**
2938
2694
  * @license
2939
- * Copyright 2017 Google LLC
2940
- * SPDX-License-Identifier: BSD-3-Clause
2695
+ * Copyright 2014 Travis Webb
2696
+ * SPDX-License-Identifier: MIT
2941
2697
  *)
2942
2698
 
2943
- lit-html/directives/ref.js:
2699
+ lit-html/directives/class-map.js:
2944
2700
  (**
2945
2701
  * @license
2946
- * Copyright 2020 Google LLC
2702
+ * Copyright 2018 Google LLC
2947
2703
  * SPDX-License-Identifier: BSD-3-Clause
2948
2704
  *)
2949
2705
  */