@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 ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as xa}from"@lit/react";import Aa from"react";var Me=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 Bt=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-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchOnCheckoutComplete(t){this.dispatchEvent("primer-oncheckout-complete",{payment:t})}dispatchOnCheckoutFailure(t,e){this.dispatchEvent("primer-oncheckout-failure",{error:t,payment:e})}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var ft=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 Ft=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 ft(this.context,this.host,this.t,this.subscribe))}};var ke=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 xr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},I=class extends ke{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:m}]of this.subscriptions)a.has(n)||(a.add(n),m.dispatchEvent(new ft(this.context,m,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 xr(this.context,this.host))}};function v({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ft(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new Ft(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var Te="cardNetworksContext";var Kt="clientOptionsContext";var jt="computedStylesContext";var j="headlessInstanceContext";var $e="klarnaCategoriesContext";var V="managerContext";var Gt="paymentMethodsContext";var L="sdkStateContext";var qt="vaultManagerContext";var ei="vaultManagerCvvContext";var x=class x{static log(t,...e){x.enabled&&console.log(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.log,...e)}static info(t,...e){x.enabled&&console.info(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.info,...e)}static warn(t,...e){x.enabled&&console.warn(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.warn,...e)}static error(t,...e){x.enabled&&console.error(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.error,...e)}static debug(t,...e){x.enabled&&console.debug(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.debug,...e)}static table(t,e){x.enabled&&console.table(t,e)}static time(t){x.enabled&&console.time(`${x.brandTag} ${t}`)}static timeEnd(t){x.enabled&&console.timeEnd(`${x.brandTag} ${t}`)}};x.enabled=!0,x.defaultFont="font-family: Consolas, monospace; font-size: 12px;",x.brandTag="[PRIMER]",x.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+x.defaultFont,x.styles={log:"color: #4CAF50; "+x.defaultFont,info:"color: #2196F3; "+x.defaultFont,warn:"color: #FF9800; "+x.defaultFont,error:"color: #F44336; "+x.defaultFont,debug:"color: #9C27B0; "+x.defaultFont};var A=x;function Ko(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let m=t(o,n,a);o=m,r(m)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function re(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 _t=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=Ko(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(){}},Le=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 Ie={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},jo={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,t)=>(A.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Ie,RESET_ERROR:i=>({...i,error:null,failure:null})},Go=re(jo),Ne=class extends _t{constructor(t){super(t,Ie,Go,null,e=>{t.sdkContextController.setSdkState(e),t.primerEventsController.dispatchSdkState(e)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(A.warn("Force completing loading state"),this.completeLoading())}};var Re=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 I(t,{context:L,initialValue:Ie}),this.paymentMethodsProvider=new I(t,{context:Gt,initialValue:null}),this.paymentManagerProvider=new I(t,{context:V,initialValue:new Map}),this.cardNetworksContext=new I(t,{context:Te,initialValue:null}),this.vaultManagerProvider=new I(t,{context:qt,initialValue:null}),this.vaultManagerCvvProvider=new I(t,{context:ei,initialValue:null}),this.clientOptionsContext=new I(t,{context:Kt,initialValue:null}),this.klarnaCategoriesProvider=new I(t,{context:$e,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new I(t,{context:j,initialValue:null}),this.computedStylesProvider=new I(t,{context:jt,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 Et=class Et{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){A.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||A.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Et.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Et.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){A.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);e.push([a,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of Et.cssVarCache.keys()){let e=Et.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Et.cssVarCache=new Map;var Oe=Et;var De=globalThis,Ve=De.ShadowRoot&&(De.ShadyCSS===void 0||De.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ar=Symbol(),ri=new WeakMap,ie=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ar)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(Ve&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=ri.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ri.set(e,t))}return t}toString(){return this.cssText}},ii=i=>new ie(typeof i=="string"?i:i+"",void 0,Ar),h=(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 ie(e,i,Ar)},_r=(i,t)=>{if(Ve)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=De.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Ye=Ve?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ii(e)})(i):i;var{is:qo,defineProperty:Wo,getOwnPropertyDescriptor:Zo,getOwnPropertyNames:Xo,getOwnPropertySymbols:Qo,getPrototypeOf:Jo}=Object,gt=globalThis,oi=gt.trustedTypes,ta=oi?oi.emptyScript:"",ea=gt.reactiveElementPolyfillSupport,oe=(i,t)=>i,ae={toAttribute(i,t){switch(t){case Boolean:i=i?ta: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}},Wt=(i,t)=>!qo(i,t),ai={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:Wt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),gt.litPropertyMetadata??(gt.litPropertyMetadata=new WeakMap);var it=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=ai){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&&Wo(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=Zo(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let m=o?.call(this);a.call(this,n),this.requestUpdate(t,m,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ai}static _$Ei(){if(this.hasOwnProperty(oe("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(oe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oe("properties"))){let e=this.properties,r=[...Xo(e),...Qo(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(Ye(o))}else t!==void 0&&e.push(Ye(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 _r(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:ae).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:ae;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??Wt)(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){}};it.elementStyles=[],it.shadowRootOptions={mode:"open"},it[oe("elementProperties")]=new Map,it[oe("finalized")]=new Map,ea?.({ReactiveElement:it}),(gt.reactiveElementVersions??(gt.reactiveElementVersions=[])).push("2.0.4");var yt={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},E=Symbol(),P=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??si,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)}}},si=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!Wt(e,t[r]));var ra={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:()=>ni},ia={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:()=>li},oa=re(ra),aa=re(ia),ni={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},li={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Er=class extends _t{constructor(t,e){super(t,ni,oa,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"})}},Sr=class extends _t{constructor(t,e){super(t,li,aa,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"})}},se=class extends Le{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){A.error("VaultManagerController: Error starting vaulted payment flow",a),this.coreController.setError(a instanceof Error?a:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new Er(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Sr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new P(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),A.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){A.error("VaultManagerController: Failed to initialize vault",a),this.coreController.setError(a instanceof Error?a:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return A.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)}};var ne="lit-localize-status";var di=i=>typeof i!="string"&&"strTag"in i,He=(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 le=i=>di(i)?He(i.strings,i.values):i;var C=le,pi=!1;function Pr(i){if(pi)throw new Error("lit-localize can only be configured once");C=i,pi=!0}var wr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(ne,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(ne,this.__litLocalizeEventHandler)}},sa=i=>i.addController(new wr(i)),ci=sa;var T=()=>(i,t)=>(i.addInitializer(ci),i);var de=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 ot=[];for(let i=0;i<256;i++)ot[i]=(i>>4&15).toString(16)+(i&15).toString(16);function mi(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,m=0,p=52210;for(let y=0;y<i.length;y++)e^=i.charCodeAt(y),t=e*435,r=o*435,a=n*435,m=p*435,a+=e<<8,m+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,p=m+(a>>>16)&65535,n=a&65535;return ot[p>>8]+ot[p&255]+ot[n>>8]+ot[n&255]+ot[o>>8]+ot[o&255]+ot[e>>8]+ot[e&255]}var na="",la="h",da="s";function hi(i,t){return(t?la:da)+mi(typeof i=="string"?i:i.join(na))}var ui=new WeakMap,fi=new Map;function gi(i,t,e){if(i){let r=e?.id??pa(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return He(o.strings,t.values,o.values);{let a=ui.get(o);return a===void 0&&(a=o.values,ui.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return le(t)}function pa(i){let t=typeof i=="string"?i:i.strings,e=fi.get(t);return e===void 0&&(e=hi(t,typeof i!="string"&&!("strTag"in i)),fi.set(t,e)),e}function Mr(i){window.dispatchEvent(new CustomEvent(ne,{detail:i}))}var ze="",kr,yi,Be,Tr,vi,St=new de;St.resolve();var Ue=0,bi=i=>(Pr((t,e)=>gi(vi,t,e)),ze=yi=i.sourceLocale,Be=new Set(i.targetLocales),Be.add(i.sourceLocale),Tr=i.loadLocale,{getLocale:ca,setLocale:ma}),ca=()=>ze,ma=i=>{if(i===(kr??ze))return St.promise;if(!Be||!Tr)throw new Error("Internal error");if(!Be.has(i))throw new Error("Invalid locale code");Ue++;let t=Ue;return kr=i,St.settled&&(St=new de),Mr({status:"loading",loadingLocale:i}),(i===yi?Promise.resolve({templates:void 0}):Tr(i)).then(r=>{Ue===t&&(ze=i,kr=void 0,vi=r.templates,Mr({status:"ready",readyLocale:i}),St.resolve())},r=>{Ue===t&&(Mr({status:"error",errorLocale:i,errorMessage:r.toString()}),St.reject(r))}),St.promise};var $r="en",Lr=["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"],Ci="You must call `loadLocale` first to set up the localized template.",xi,Fe,Ai=i=>{let t=bi({sourceLocale:$r,targetLocales:Lr,loadLocale:i});xi=t.getLocale,Fe=t.setLocale};var Nr=i=>{Ai(i)},Ir=i=>{if(!Fe)throw new Error(Ci);return Fe(i)};var pe=new Set(Lr);pe.add($r);var Rr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(pe.has(t))return!0;let e=t.split("-")[0];return!!pe.has(e)},Or=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(pe.has(t))return t;let e=t.split("-")[0];return pe.has(e)?e:"en-GB"};var me=globalThis,Ke=me.trustedTypes,_i=Ke?Ke.createPolicy("lit-html",{createHTML:i=>i}):void 0,Vr="$lit$",at=`lit$${Math.random().toFixed(9).slice(2)}$`,Yr="?"+at,ha=`<${Yr}>`,Mt=document,he=()=>Mt.createComment(""),ue=i=>i===null||typeof i!="object"&&typeof i!="function",Hr=Array.isArray,ki=i=>Hr(i)||typeof i?.[Symbol.iterator]=="function",Dr=`[
2
- \f\r]`,ce=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ei=/-->/g,Si=/>/g,Pt=RegExp(`>|${Dr}(?:([^\\s"'>=/]+)(${Dr}*=${Dr}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Pi=/'/g,wi=/"/g,Ti=/^(?:script|style|textarea|title)$/i,Ur=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=Ur(1),nt=Ur(2),ip=Ur(3),st=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Mi=new WeakMap,wt=Mt.createTreeWalker(Mt,129);function $i(i,t){if(!Hr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return _i!==void 0?_i.createHTML(t):t}var Li=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=ce;for(let m=0;m<e;m++){let p=i[m],y,b,g=-1,M=0;for(;M<p.length&&(n.lastIndex=M,b=n.exec(p),b!==null);)M=n.lastIndex,n===ce?b[1]==="!--"?n=Ei:b[1]!==void 0?n=Si:b[2]!==void 0?(Ti.test(b[2])&&(o=RegExp("</"+b[2],"g")),n=Pt):b[3]!==void 0&&(n=Pt):n===Pt?b[0]===">"?(n=o??ce,g=-1):b[1]===void 0?g=-2:(g=n.lastIndex-b[2].length,y=b[1],n=b[3]===void 0?Pt:b[3]==='"'?wi:Pi):n===wi||n===Pi?n=Pt:n===Ei||n===Si?n=ce:(n=Pt,o=void 0);let N=n===Pt&&i[m+1].startsWith("/>")?" ":"";a+=n===ce?p+ha:g>=0?(r.push(y),p.slice(0,g)+Vr+p.slice(g)+at+N):p+at+(g===-2?m:N)}return[$i(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},fe=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,m=t.length-1,p=this.parts,[y,b]=Li(t,e);if(this.el=i.createElement(y,r),wt.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(o=wt.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let g of o.getAttributeNames())if(g.endsWith(Vr)){let M=b[n++],N=o.getAttribute(g).split(at),rt=/([.?@])?(.*)/.exec(M);p.push({type:1,index:a,name:rt[2],strings:N,ctor:rt[1]==="."?Ge:rt[1]==="?"?qe:rt[1]==="@"?We:Tt}),o.removeAttribute(g)}else g.startsWith(at)&&(p.push({type:6,index:a}),o.removeAttribute(g));if(Ti.test(o.tagName)){let g=o.textContent.split(at),M=g.length-1;if(M>0){o.textContent=Ke?Ke.emptyScript:"";for(let N=0;N<M;N++)o.append(g[N],he()),wt.nextNode(),p.push({type:2,index:++a});o.append(g[M],he())}}}else if(o.nodeType===8)if(o.data===Yr)p.push({type:2,index:a});else{let g=-1;for(;(g=o.data.indexOf(at,g+1))!==-1;)p.push({type:7,index:a}),g+=at.length-1}a++}}static createElement(t,e){let r=Mt.createElement("template");return r.innerHTML=t,r}};function kt(i,t,e=i,r){if(t===st)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=ue(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=kt(i,o._$AS(i,t.values),o,r)),t}var je=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??Mt).importNode(e,!0);wt.currentNode=o;let a=wt.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let y;p.type===2?y=new Zt(a,a.nextSibling,this,t):p.type===1?y=new p.ctor(a,p.name,p.strings,this,t):p.type===6&&(y=new Ze(a,this,t)),this._$AV.push(y),p=r[++m]}n!==p?.index&&(a=wt.nextNode(),n++)}return wt.currentNode=Mt,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++}},Zt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=c,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=kt(this,t,e),ue(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==st&&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!==c&&ue(this._$AH)?this._$AA.nextSibling.data=t:this.T(Mt.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=fe.createElement($i(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new je(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=Mi.get(t.strings);return e===void 0&&Mi.set(t.strings,e=new fe(t)),e}k(t){Hr(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(he()),this.O(he()),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))}},Tt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=c,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=c}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=kt(this,t,e,0),n=!ue(t)||t!==this._$AH&&t!==st,n&&(this._$AH=t);else{let m=t,p,y;for(t=a[0],p=0;p<a.length-1;p++)y=kt(this,m[r+p],e,p),y===st&&(y=this._$AH[p]),n||(n=!ue(y)||y!==this._$AH[p]),y===c?t=c:t!==c&&(t+=(y??"")+a[p+1]),this._$AH[p]=y}n&&!o&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ge=class extends Tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}},qe=class extends Tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==c)}},We=class extends Tt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=kt(this,t,e,0)??c)===st)return;let r=this._$AH,o=t===c&&r!==c||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==c&&(r===c||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)}},Ze=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){kt(this,t)}},Ni={M:Vr,P:at,A:Yr,C:1,L:Li,R:je,D:ki,V:kt,I:Zt,H:Tt,N:qe,U:We,B:Ge,F:Ze},ua=me.litHtmlPolyfillSupport;ua?.(fe,Zt),(me.litHtmlVersions??(me.litHtmlVersions=[])).push("3.2.1");var Ii=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new Zt(t.insertBefore(he(),a),a,void 0,e??{})}return o._$AI(i),o};var u=class extends it{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=Ii(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return st}};u._$litElement$=!0,u.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:u});var fa=globalThis.litElementPolyfillSupport;fa?.({LitElement:u});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var f=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var ga={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:Wt},ya=(i=ga,t,e)=>{let{kind:r,metadata:o}=e,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),a.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(m){let p=t.get.call(this);t.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}=e;return function(m){let p=this[n];t.call(this,m),this.requestUpdate(n,p,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?ya(i,t,e):((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,t,e)}function _(i){return l({...i,state:!0,attribute:!1})}var $t=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function vt(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:m}=typeof r=="object"?e:o??(()=>{let p=Symbol();return{get(){return this[p]},set(y){this[p]=y}}})();return $t(e,r,{get(){let p=n.call(this);return p===void 0&&(p=a(this),(p!==null||this.hasUpdated)&&m.call(this,p)),p}})}return $t(e,r,{get(){return a(this)}})}}function w(i,t,e){return i?t(i):e?.(i)}var S=h`
1
+ import{a as $r,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as ra}from"@lit/react";import ia from"react";var ge=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 Ut=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 ht=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 Ht=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 ht(this.context,this.host,this.t,this.subscribe))}};var ye=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 or=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},L=class extends ye{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:c}]of this.subscriptions)a.has(n)||(a.add(n),c.dispatchEvent(new ht(this.context,c,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 or(this.context,this.host))}};function g({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ht(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new Ht(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var ve="cardNetworksContext";var zt="clientOptionsContext";var Ft="computedStylesContext";var B="headlessInstanceContext";var be="klarnaCategoriesContext";var O="managerContext";var Bt="paymentMethodsContext";var T="sdkStateContext";var Kt="vaultManagerContext";var Rr="vaultManagerCvvContext";var b=class b{static log(t,...e){b.enabled&&console.log(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.log,...e)}static info(t,...e){b.enabled&&console.info(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.info,...e)}static warn(t,...e){b.enabled&&console.warn(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.warn,...e)}static error(t,...e){b.enabled&&console.error(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.error,...e)}static debug(t,...e){b.enabled&&console.debug(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.debug,...e)}static table(t,e){b.enabled&&console.table(t,e)}static time(t){b.enabled&&console.time(`${b.brandTag} ${t}`)}static timeEnd(t){b.enabled&&console.timeEnd(`${b.brandTag} ${t}`)}};b.enabled=!0,b.defaultFont="font-family: Consolas, monospace; font-size: 12px;",b.brandTag="[PRIMER]",b.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+b.defaultFont,b.styles={log:"color: #4CAF50; "+b.defaultFont,info:"color: #2196F3; "+b.defaultFont,warn:"color: #FF9800; "+b.defaultFont,error:"color: #F44336; "+b.defaultFont,debug:"color: #9C27B0; "+b.defaultFont};var y=b;function vo(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let c=t(o,n,a);o=c,r(c)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function Jt(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 _t=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=vo(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(){}},Ce=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 Ee={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},bo={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)=>(y.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:()=>Ee,RESET_ERROR:i=>({...i,error:null,failure:null})},Co=Jt(bo),xe=class extends _t{constructor(t){super(t,Ee,Co,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&&(y.warn("Force completing loading state"),this.completeLoading())}};var Se=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:Ee}),this.paymentMethodsProvider=new L(t,{context:Bt,initialValue:null}),this.paymentManagerProvider=new L(t,{context:O,initialValue:new Map}),this.cardNetworksContext=new L(t,{context:ve,initialValue:null}),this.vaultManagerProvider=new L(t,{context:Kt,initialValue:null}),this.vaultManagerCvvProvider=new L(t,{context:Rr,initialValue:null}),this.clientOptionsContext=new L(t,{context:zt,initialValue:null}),this.klarnaCategoriesProvider=new L(t,{context:be,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new L(t,{context:B,initialValue:null}),this.computedStylesProvider=new L(t,{context:Ft,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 At=class At{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){y.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||y.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=At.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),At.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)){y.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 At.cssVarCache.keys()){let e=At.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};At.cssVarCache=new Map;var _e=At;var Ae=globalThis,we=Ae.ShadowRoot&&(Ae.ShadyCSS===void 0||Ae.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Dr=Symbol(),Or=new WeakMap,Pe=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Dr)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(we&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Or.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Or.set(e,t))}return t}toString(){return this.cssText}},Vr=i=>new Pe(typeof i=="string"?i:i+"",void 0,Dr);var ar=(i,t)=>{if(we)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Ae.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Me=we?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Vr(e)})(i):i;var{is:xo,defineProperty:Eo,getOwnPropertyDescriptor:So,getOwnPropertyNames:_o,getOwnPropertySymbols:Ao,getPrototypeOf:Po}=Object,ut=globalThis,Yr=ut.trustedTypes,wo=Yr?Yr.emptyScript:"",Mo=ut.reactiveElementPolyfillSupport,Zt=(i,t)=>i,sr={toAttribute(i,t){switch(t){case Boolean:i=i?wo: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}},ke=(i,t)=>!xo(i,t),Ur={attribute:!0,type:String,converter:sr,reflect:!1,hasChanged:ke};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ut.litPropertyMetadata??(ut.litPropertyMetadata=new WeakMap);var Pt=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=Ur){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&&Eo(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=So(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let c=o?.call(this);a.call(this,n),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ur}static _$Ei(){if(this.hasOwnProperty(Zt("elementProperties")))return;let t=Po(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Zt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Zt("properties"))){let e=this.properties,r=[..._o(e),...Ao(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(Me(o))}else t!==void 0&&e.push(Me(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 ar(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:sr).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:sr;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??ke)(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){}};Pt.elementStyles=[],Pt.shadowRootOptions={mode:"open"},Pt[Zt("elementProperties")]=new Map,Pt[Zt("finalized")]=new Map,Mo?.({ReactiveElement:Pt}),(ut.reactiveElementVersions??(ut.reactiveElementVersions=[])).push("2.0.4");var ft={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},x=Symbol(),_=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??Hr,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===x)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)}}},Hr=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!ke(e,t[r]));var ko={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:()=>zr},To={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:()=>Fr},Lo=Jt(ko),No=Jt(To),zr={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},Fr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},nr=class extends _t{constructor(t,e){super(t,zr,Lo,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"})}},lr=class extends _t{constructor(t,e){super(t,Fr,No,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"})}},Xt=class extends Ce{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){y.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 nr(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new lr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new _(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),x;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),y.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){y.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 y.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 Qt="lit-localize-status";var Br=i=>typeof i!="string"&&"strTag"in i,Te=(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 te=i=>Br(i)?Te(i.strings,i.values):i;var v=te,Kr=!1;function dr(i){if(Kr)throw new Error("lit-localize can only be configured once");v=i,Kr=!0}var pr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Qt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Qt,this.__litLocalizeEventHandler)}},Io=i=>i.addController(new pr(i)),Gr=Io;var M=()=>(i,t)=>(i.addInitializer(Gr),i);var ee=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 tt=[];for(let i=0;i<256;i++)tt[i]=(i>>4&15).toString(16)+(i&15).toString(16);function jr(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,c=0,f=52210;for(let S=0;S<i.length;S++)e^=i.charCodeAt(S),t=e*435,r=o*435,a=n*435,c=f*435,a+=e<<8,c+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,f=c+(a>>>16)&65535,n=a&65535;return tt[f>>8]+tt[f&255]+tt[n>>8]+tt[n&255]+tt[o>>8]+tt[o&255]+tt[e>>8]+tt[e&255]}var $o="",Ro="h",Oo="s";function qr(i,t){return(t?Ro:Oo)+jr(typeof i=="string"?i:i.join($o))}var Wr=new WeakMap,Jr=new Map;function Zr(i,t,e){if(i){let r=e?.id??Do(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Te(o.strings,t.values,o.values);{let a=Wr.get(o);return a===void 0&&(a=o.values,Wr.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return te(t)}function Do(i){let t=typeof i=="string"?i:i.strings,e=Jr.get(t);return e===void 0&&(e=qr(t,typeof i!="string"&&!("strTag"in i)),Jr.set(t,e)),e}function cr(i){window.dispatchEvent(new CustomEvent(Qt,{detail:i}))}var Ne="",mr,Xr,Ie,hr,Qr,wt=new ee;wt.resolve();var Le=0,ti=i=>(dr((t,e)=>Zr(Qr,t,e)),Ne=Xr=i.sourceLocale,Ie=new Set(i.targetLocales),Ie.add(i.sourceLocale),hr=i.loadLocale,{getLocale:Vo,setLocale:Yo}),Vo=()=>Ne,Yo=i=>{if(i===(mr??Ne))return wt.promise;if(!Ie||!hr)throw new Error("Internal error");if(!Ie.has(i))throw new Error("Invalid locale code");Le++;let t=Le;return mr=i,wt.settled&&(wt=new ee),cr({status:"loading",loadingLocale:i}),(i===Xr?Promise.resolve({templates:void 0}):hr(i)).then(r=>{Le===t&&(Ne=i,mr=void 0,Qr=r.templates,cr({status:"ready",readyLocale:i}),wt.resolve())},r=>{Le===t&&(cr({status:"error",errorLocale:i,errorMessage:r.toString()}),wt.reject(r))}),wt.promise};var ur="en",fr=["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"],ei="You must call `loadLocale` first to set up the localized template.",ri,$e,ii=i=>{let t=ti({sourceLocale:ur,targetLocales:fr,loadLocale:i});ri=t.getLocale,$e=t.setLocale};var gr=i=>{ii(i)},yr=i=>{if(!$e)throw new Error(ei);return $e(i)};var re=new Set(fr);re.add(ur);var vr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(re.has(t))return!0;let e=t.split("-")[0];return!!re.has(e)},br=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(re.has(t))return t;let e=t.split("-")[0];return re.has(e)?e:"en-GB"};var Re=globalThis,Oe=Re.ShadowRoot&&(Re.ShadyCSS===void 0||Re.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cr=Symbol(),oi=new WeakMap,ie=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Cr)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(Oe&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=oi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&oi.set(e,t))}return t}toString(){return this.cssText}},ai=i=>new ie(typeof i=="string"?i:i+"",void 0,Cr),m=(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 ie(e,i,Cr)},si=(i,t)=>{if(Oe)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Re.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},xr=Oe?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ai(e)})(i):i;var{is:Uo,defineProperty:Ho,getOwnPropertyDescriptor:zo,getOwnPropertyNames:Fo,getOwnPropertySymbols:Bo,getPrototypeOf:Ko}=Object,gt=globalThis,ni=gt.trustedTypes,Go=ni?ni.emptyScript:"",jo=gt.reactiveElementPolyfillSupport,oe=(i,t)=>i,ae={toAttribute(i,t){switch(t){case Boolean:i=i?Go: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}},De=(i,t)=>!Uo(i,t),li={attribute:!0,type:String,converter:ae,reflect:!1,useDefault:!1,hasChanged:De};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),gt.litPropertyMetadata??(gt.litPropertyMetadata=new WeakMap);var et=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=li){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&&Ho(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=zo(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:o,set(n){let c=o?.call(this);a?.call(this,n),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??li}static _$Ei(){if(this.hasOwnProperty(oe("elementProperties")))return;let t=Ko(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(oe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oe("properties"))){let e=this.properties,r=[...Fo(e),...Bo(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(xr(o))}else t!==void 0&&e.push(xr(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 si(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:ae).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:ae;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??De)(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,c=this[o];n!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,a,c)}}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){}};et.elementStyles=[],et.shadowRootOptions={mode:"open"},et[oe("elementProperties")]=new Map,et[oe("finalized")]=new Map,jo?.({ReactiveElement:et}),(gt.reactiveElementVersions??(gt.reactiveElementVersions=[])).push("2.1.0");var ne=globalThis,Ve=ne.trustedTypes,di=Ve?Ve.createPolicy("lit-html",{createHTML:i=>i}):void 0,Sr="$lit$",rt=`lit$${Math.random().toFixed(9).slice(2)}$`,_r="?"+rt,qo=`<${_r}>`,Tt=document,le=()=>Tt.createComment(""),de=i=>i===null||typeof i!="object"&&typeof i!="function",Ar=Array.isArray,fi=i=>Ar(i)||typeof i?.[Symbol.iterator]=="function",Er=`[
2
+ \f\r]`,se=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pi=/-->/g,ci=/>/g,Mt=RegExp(`>|${Er}(?:([^\\s"'>=/]+)(${Er}*=${Er}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),mi=/'/g,hi=/"/g,gi=/^(?:script|style|textarea|title)$/i,Pr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=Pr(1),ot=Pr(2),Vd=Pr(3),it=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ui=new WeakMap,kt=Tt.createTreeWalker(Tt,129);function yi(i,t){if(!Ar(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return di!==void 0?di.createHTML(t):t}var vi=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=se;for(let c=0;c<e;c++){let f=i[c],S,k,A=-1,N=0;for(;N<f.length&&(n.lastIndex=N,k=n.exec(f),k!==null);)N=n.lastIndex,n===se?k[1]==="!--"?n=pi:k[1]!==void 0?n=ci:k[2]!==void 0?(gi.test(k[2])&&(o=RegExp("</"+k[2],"g")),n=Mt):k[3]!==void 0&&(n=Mt):n===Mt?k[0]===">"?(n=o??se,A=-1):k[1]===void 0?A=-2:(A=n.lastIndex-k[2].length,S=k[1],n=k[3]===void 0?Mt:k[3]==='"'?hi:mi):n===hi||n===mi?n=Mt:n===pi||n===ci?n=se:(n=Mt,o=void 0);let mt=n===Mt&&i[c+1].startsWith("/>")?" ":"";a+=n===se?f+qo:A>=0?(r.push(S),f.slice(0,A)+Sr+f.slice(A)+rt+mt):f+rt+(A===-2?c:mt)}return[yi(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},pe=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,c=t.length-1,f=this.parts,[S,k]=vi(t,e);if(this.el=i.createElement(S,r),kt.currentNode=this.el.content,e===2||e===3){let A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;(o=kt.nextNode())!==null&&f.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let A of o.getAttributeNames())if(A.endsWith(Sr)){let N=k[n++],mt=o.getAttribute(A).split(rt),fe=/([.?@])?(.*)/.exec(N);f.push({type:1,index:a,name:fe[2],strings:mt,ctor:fe[1]==="."?Ue:fe[1]==="?"?He:fe[1]==="@"?ze:Nt}),o.removeAttribute(A)}else A.startsWith(rt)&&(f.push({type:6,index:a}),o.removeAttribute(A));if(gi.test(o.tagName)){let A=o.textContent.split(rt),N=A.length-1;if(N>0){o.textContent=Ve?Ve.emptyScript:"";for(let mt=0;mt<N;mt++)o.append(A[mt],le()),kt.nextNode(),f.push({type:2,index:++a});o.append(A[N],le())}}}else if(o.nodeType===8)if(o.data===_r)f.push({type:2,index:a});else{let A=-1;for(;(A=o.data.indexOf(rt,A+1))!==-1;)f.push({type:7,index:a}),A+=rt.length-1}a++}}static createElement(t,e){let r=Tt.createElement("template");return r.innerHTML=t,r}};function Lt(i,t,e=i,r){if(t===it)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=de(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=Lt(i,o._$AS(i,t.values),o,r)),t}var Ye=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??Tt).importNode(e,!0);kt.currentNode=o;let a=kt.nextNode(),n=0,c=0,f=r[0];for(;f!==void 0;){if(n===f.index){let S;f.type===2?S=new Gt(a,a.nextSibling,this,t):f.type===1?S=new f.ctor(a,f.name,f.strings,this,t):f.type===6&&(S=new Fe(a,this,t)),this._$AV.push(S),f=r[++c]}n!==f?.index&&(a=kt.nextNode(),n++)}return kt.currentNode=Tt,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++}},Gt=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=Lt(this,t,e),de(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):fi(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&&de(this._$AH)?this._$AA.nextSibling.data=t:this.T(Tt.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=pe.createElement(yi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new Ye(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=ui.get(t.strings);return e===void 0&&ui.set(t.strings,e=new pe(t)),e}k(t){Ar(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(le()),this.O(le()),this,this.options)):r=e[o],r._$AI(a),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Nt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=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=Lt(this,t,e,0),n=!de(t)||t!==this._$AH&&t!==it,n&&(this._$AH=t);else{let c=t,f,S;for(t=a[0],f=0;f<a.length-1;f++)S=Lt(this,c[r+f],e,f),S===it&&(S=this._$AH[f]),n||(n=!de(S)||S!==this._$AH[f]),S===p?t=p:t!==p&&(t+=(S??"")+a[f+1]),this._$AH[f]=S}n&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ue=class extends Nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},He=class extends Nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},ze=class extends Nt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=Lt(this,t,e,0)??p)===it)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)}},Fe=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){Lt(this,t)}},bi={M:Sr,P:rt,A:_r,C:1,L:vi,R:Ye,D:fi,V:Lt,I:Gt,H:Nt,N:He,U:ze,B:Ue,F:Fe},Wo=ne.litHtmlPolyfillSupport;Wo?.(pe,Gt),(ne.litHtmlVersions??(ne.litHtmlVersions=[])).push("3.3.0");var Ci=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new Gt(t.insertBefore(le(),a),a,void 0,e??{})}return o._$AI(i),o};var ce=globalThis,h=class extends et{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=Ci(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};h._$litElement$=!0,h.finalized=!0,ce.litElementHydrateSupport?.({LitElement:h});var Jo=ce.litElementPolyfillSupport;Jo?.({LitElement:h});(ce.litElementVersions??(ce.litElementVersions=[])).push("4.2.0");var u=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Zo={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:De},Xo=(i=Zo,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(c){let f=t.get.call(this);t.set.call(this,c),this.requestUpdate(n,f,i)},init(c){return c!==void 0&&this.C(n,void 0,i,c),c}}}if(r==="setter"){let{name:n}=e;return function(c){let f=this[n];t.call(this,c),this.requestUpdate(n,f,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?Xo(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 C(i){return l({...i,state:!0,attribute:!1})}var It=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function yt(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:c}=typeof r=="object"?e:o??(()=>{let f=Symbol();return{get(){return this[f]},set(S){this[f]=S}}})();return It(e,r,{get(){let f=n.call(this);return f===void 0&&(f=a(this),(f!==null||this.hasUpdated)&&c.call(this,f)),f}})}return It(e,r,{get(){return a(this)}})}}function P(i,t,e){return i?t(i):e?.(i)}var E=m`
4
4
  * {
5
5
  box-sizing: border-box;
6
6
  }
7
- `,Ri=h`
7
+ `,xi=m`
8
8
  :host {
9
9
  display: block;
10
10
  isolation: isolate;
@@ -13,14 +13,14 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
13
13
  //Keep the CSS loader in the same position - check css-loader-inline.ts
14
14
  min-height: 64px;
15
15
  }
16
- `;var Oi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Xe=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 Di=typeof window<"u"&&typeof window.document<"u";function va(i){return document.querySelector(`script[src^="${i}"]`)}function ba(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 Vi(i,t=!1){if(!Di)throw new Error("Cannot load script in server environment");let e=va(i)??ba(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var Qe=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new P(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new P(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(A.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),A.info("SDK instance cleaned up")}catch(t){A.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=Oi){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){A.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await Vi(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return A.warn("Component disconnected, aborting SDK initialization"),E;if(!t||!e)return E;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(A.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(A.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(n))},onCheckoutFail:(n,m)=>{this.isDisconnected||(A.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(),E;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(o);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&&(A.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 m=await this.initializePaymentMethodManager(n)();n&&m&&(r.set(n.type,n),o.set(n.type,m))}if(this.isDisconnected)return E;let a=new Xe(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),A.info("Initialized payment methods:",a.toArray()),r}catch(a){if(a instanceof Error)throw this.host.sdkStateController.setError(a),a;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:a=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:a,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(e,{onCardNetworksChange: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 A.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Je=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 Ca=ti({"../../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")});Nr(i=>Ca(`../../localization/lit-localize/locales/${i}.ts`));var tr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},H=class extends u{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 Re(this),this.sdkStateController=new Ne(this),this.primerEventsController=new Bt(this),this.styleProcessingController=new Oe(this),this.vaultManagerController=new se(this),this.cardNetworkController=new Me(this),this.achPaymentEventsController=new Je(this),new Qe(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===tr.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&&(Rr(this.options?.locale)?this.locale=Or(this.options?.locale):A.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Ir(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(A.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.currentState,r=e.isLoading,o=e.error,a=!r&&!o;return d`
17
- ${w(r,()=>c)}
18
- ${w(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
19
- ${w(a,()=>d`
16
+ `;var Ei="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Be=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 Ke=class{constructor(t){this.paymentMethods=null;this.headlessInstance=t}setPaymentMethods(t){this.paymentMethods=t}async refreshSession(){if(!this.headlessInstance){y.error("PrimerJS: Cannot refresh session: Headless instance not available");return}try{await this.headlessInstance.refreshClientSession()}catch(t){throw y.error("PrimerJS: Error refreshing client session:",t),t}}getPaymentMethods(){return this.paymentMethods?this.paymentMethods.toArray():(y.warn("PrimerJS: Payment methods not available"),[])}handlePaymentStart(){this.onPaymentStart&&this.onPaymentStart()}handleBeforePaymentCreate(t,e){if(this.onPaymentPrepare){let r={continuePaymentCreation:()=>{y.info("PrimerJS: Payment creation continuing"),e.continuePaymentCreation()},abortPaymentCreation:()=>{y.info("PrimerJS: Payment creation aborted"),e.abortPaymentCreation()}};this.onPaymentPrepare(t,r)}else y.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 Si=typeof window<"u"&&typeof window.document<"u";function Qo(i){return document.querySelector(`script[src^="${i}"]`)}function ta(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 _i(i,t=!1){if(!Si)throw new Error("Cannot load script in server environment");let e=Qo(i)??ta(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var Ge=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 _(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new _(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&&(y.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(),y.info("SDK instance cleaned up")}catch(t){y.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null,this.primerJS=null}async _loadV2Sdk(t=Ei){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){y.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await _i(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return y.warn("Component disconnected, aborting SDK initialization"),x;if(!t||!e)return x;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window;this.primerJS=new Ke(null);let o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(y.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(y.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.primerJS&&this.primerJS.handlePaymentComplete(n))},onCheckoutFail:(n,c)=>{this.isDisconnected||(y.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.primerJS&&this.primerJS.handlePaymentFailure(n,c.payment))},onBeforePaymentCreate:(n,c)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),this.primerJS?this.primerJS.handleBeforePaymentCreate(n,c):c?.continuePaymentCreation())},onPaymentMethodAction:(n,c)=>{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(),x;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&&(y.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return x;if(!t||!e.length)return x;let r=new Map,o=new Map;try{for(let n of e){if(this.isDisconnected)break;let c=await this.initializePaymentMethodManager(n)();n&&c&&(r.set(n.type,n),o.set(n.type,c))}if(this.isDisconnected)return x;let a=new Be(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.primerJS&&this.primerJS.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),y.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 y.error(`Failed to initialize manager for ${e}:`,o),null}}}};var je=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 ea=$r({"../../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")});gr(i=>ea(`../../localization/lit-localize/locales/${i}.ts`));var qe={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},V=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=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new Se(this),this.sdkStateController=new xe(this),this.primerEventsController=new Ut(this),this.styleProcessingController=new _e(this),this.vaultManagerController=new Xt(this),this.cardNetworkController=new ge(this),this.achPaymentEventsController=new je(this),new Ge(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===qe.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&&(vr(this.options?.locale)?this.locale=br(this.options?.locale):y.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),yr(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&&(y.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
+ ${P(r,()=>p)}
18
+ ${P(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
19
+ ${P(a,()=>d`
20
20
  <slot name="main" @slotchange=${this.onSlotChange}></slot>
21
- ${w(this.hasAssignedContent,()=>c,()=>d`<primer-main></primer-main>`)}
22
- `,()=>c)}
23
- `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};H.styles=[S,Ri],s([l({type:String,attribute:tr.CUSTOM_STYLES})],H.prototype,"customStyles",2),s([l({type:String,attribute:tr.CLIENT_TOKEN})],H.prototype,"clientToken",2),s([l({type:Object})],H.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:tr.JS_INIT})],H.prototype,"_jsInitialized",2),s([vt("slot")],H.prototype,"defaultSlot",2),s([_()],H.prototype,"previousLoadingState",2),H=s([T(),f("primer-checkout")],H);var _a=xa({tagName:"primer-checkout",elementClass:H,react:Aa});import{createComponent as Ea}from"@lit/react";import Sa from"react";var Yi=h`
21
+ ${P(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)}};V.styles=[E,xi],s([l({type:String,attribute:qe.CUSTOM_STYLES})],V.prototype,"customStyles",2),s([l({type:String,attribute:qe.CLIENT_TOKEN})],V.prototype,"clientToken",2),s([l({type:Object})],V.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:qe.JS_INIT})],V.prototype,"_jsInitialized",2),s([yt("slot")],V.prototype,"defaultSlot",2),s([C()],V.prototype,"previousLoadingState",2),V=s([M(),u("primer-checkout")],V);var oa=ra({tagName:"primer-checkout",elementClass:V,react:ia});import{createComponent as aa}from"@lit/react";import sa from"react";var Ai=m`
24
24
  :host {
25
25
  display: flex;
26
26
  flex-direction: column;
@@ -49,7 +49,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
49
49
  line-height: var(--primer-typography-body-medium-line-height);
50
50
  letter-spacing: var(--primer-typography-body-medium-letter-spacing);
51
51
  }
52
- `;var lt=class extends u{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
52
+ `;var at=class extends h{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
53
53
  <!-- Successful view -->
54
54
  <primer-icon
55
55
  size="lg"
@@ -70,7 +70,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
70
70
  </primer-icon>
71
71
  <p>Payment failed</p>
72
72
  ${this.description?d`<p class="secondary">${this.description}</p>`:d`<p class="secondary">Something went wrong.</p>`}
73
- `}};lt.styles=[Yi],s([l({type:String,reflect:!0})],lt.prototype,"type",2),s([l({type:String,reflect:!0})],lt.prototype,"description",2),lt=s([f("primer-checkout-state")],lt);var Pa=Ea({tagName:"primer-checkout-state",elementClass:lt,react:Sa});import{createComponent as wa}from"@lit/react";import Ma from"react";var Hi=h`
73
+ `}};at.styles=[Ai],s([l({type:String,reflect:!0})],at.prototype,"type",2),s([l({type:String,reflect:!0})],at.prototype,"description",2),at=s([u("primer-checkout-state")],at);var na=aa({tagName:"primer-checkout-state",elementClass:at,react:sa});import{createComponent as la}from"@lit/react";import da from"react";var Pi=m`
74
74
  :host {
75
75
  display: block;
76
76
  }
@@ -124,7 +124,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
124
124
  transition: none;
125
125
  }
126
126
  }
127
- `;var Y=class extends u{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`
127
+ `;var D=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(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`
128
128
  <div class="collapsable">
129
129
  <primer-button
130
130
  variant=${this.buttonVariant}
@@ -148,7 +148,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
148
148
  </div>
149
149
  </div>
150
150
  </div>
151
- `}};Y.styles=[Hi],s([l({type:String})],Y.prototype,"header",2),s([l({type:Boolean})],Y.prototype,"expanded",2),s([l({type:String})],Y.prototype,"expandText",2),s([l({type:String})],Y.prototype,"collapseText",2),s([l({type:String})],Y.prototype,"ariaLabel",2),s([l({type:String})],Y.prototype,"buttonVariant",2),s([_()],Y.prototype,"isExpanded",2),Y=s([f("primer-collapsable")],Y);var ka=wa({tagName:"primer-collapsable",elementClass:Y,react:Ma});import{createComponent as Ta}from"@lit/react";import $a from"react";var Ui=h`
151
+ `}};D.styles=[Pi],s([l({type:String})],D.prototype,"header",2),s([l({type:Boolean})],D.prototype,"expanded",2),s([l({type:String})],D.prototype,"expandText",2),s([l({type:String})],D.prototype,"collapseText",2),s([l({type:String})],D.prototype,"ariaLabel",2),s([l({type:String})],D.prototype,"buttonVariant",2),s([C()],D.prototype,"isExpanded",2),D=s([u("primer-collapsable")],D);var pa=la({tagName:"primer-collapsable",elementClass:D,react:da});import{createComponent as ca}from"@lit/react";import ma from"react";var wi=m`
152
152
  :host {
153
153
  display: contents;
154
154
  }
@@ -177,9 +177,9 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
177
177
  display: flex;
178
178
  justify-content: flex-end;
179
179
  }
180
- `;var er={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=i=>(...t)=>({_$litDirective$:i,values:t}),Xt=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=ge(class extends Xt{constructor(i){if(super(i),i.type!==er.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 st}});var Lt=class extends u{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
180
+ `;var vt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},st=i=>(...t)=>({_$litDirective$:i,values:t}),jt=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 I=st(class extends jt{constructor(i){if(super(i),i.type!==vt.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 it}});var $t=class extends h{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
181
181
  <div
182
- class=${R({backdrop:!0})}
182
+ class=${I({backdrop:!0})}
183
183
  @click=${t=>{t.preventDefault()}}
184
184
  >
185
185
  <div class="dialog">
@@ -193,7 +193,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
193
193
  </div>
194
194
  </div>
195
195
  </div>
196
- `}};Lt.styles=[Ui],Lt=s([f("primer-dialog")],Lt);var La=Ta({tagName:"primer-dialog",elementClass:Lt,react:$a});import{createComponent as Na}from"@lit/react";import Ia from"react";var zi=h`
196
+ `}};$t.styles=[wi],$t=s([u("primer-dialog")],$t);var ha=ca({tagName:"primer-dialog",elementClass:$t,react:ma});import{createComponent as ua}from"@lit/react";import fa from"react";var Mi=m`
197
197
  :host {
198
198
  display: block;
199
199
  width: 100%;
@@ -253,10 +253,10 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
253
253
  transform: none;
254
254
  }
255
255
  }
256
- `;var W=class extends u{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 c;let e={"error-message":!0,hidden:!this.visible};return d`
256
+ `;var j=class extends h{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`
257
257
  <div
258
258
  part="error-message"
259
- class=${R(e)}
259
+ class=${I(e)}
260
260
  aria-live="assertive"
261
261
  aria-atomic="true"
262
262
  >
@@ -269,17 +269,17 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
269
269
  </div>
270
270
  <div part="error-content" class="error-content">${this.message}</div>
271
271
  </div>
272
- `}};W.styles=[zi],s([l({type:String})],W.prototype,"message",2),s([l({type:Boolean,reflect:!0})],W.prototype,"visible",2),s([l({type:String,reflect:!0})],W.prototype,"role",2),s([_()],W.prototype,"showMessage",2),W=s([f("primer-error-message")],W);var Ra=Na({tagName:"primer-error-message",elementClass:W,react:Ia});import{createComponent as Oa}from"@lit/react";import Da from"react";var Bi={pencil:nt`
272
+ `}};j.styles=[Mi],s([l({type:String})],j.prototype,"message",2),s([l({type:Boolean,reflect:!0})],j.prototype,"visible",2),s([l({type:String,reflect:!0})],j.prototype,"role",2),s([C()],j.prototype,"showMessage",2),j=s([u("primer-error-message")],j);var ga=ua({tagName:"primer-error-message",elementClass:j,react:fa});import{createComponent as ya}from"@lit/react";import va from"react";var ki={pencil:ot`
273
273
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
274
274
  <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"/>
275
275
  </svg>
276
- `,trash:nt`
276
+ `,trash:ot`
277
277
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
278
278
  <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"/>
279
279
  <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"/>
280
280
  <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"/>
281
281
  </svg>
282
- `,"successful-check":nt`
282
+ `,"successful-check":ot`
283
283
  <svg
284
284
  viewBox="0 0 56 56"
285
285
  fill="none"
@@ -294,7 +294,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
294
294
  />
295
295
  </g>
296
296
  </svg>
297
- `,"failure-icon":nt`
297
+ `,"failure-icon":ot`
298
298
  <svg
299
299
  viewBox="0 0 40 40"
300
300
  fill="none"
@@ -306,27 +306,27 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
306
306
  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"
307
307
  />
308
308
  </svg>
309
- `,"payment-card":nt`
309
+ `,"payment-card":ot`
310
310
  <svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
311
311
  <rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
312
312
  <rect y="6.74805" width="28" height="4" fill="#212121"/>
313
313
  <rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
314
314
  </svg>
315
- `,"chevron-down":nt`
315
+ `,"chevron-down":ot`
316
316
  <svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
317
317
  <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"/>
318
- </svg>`,checkmark:nt`
318
+ </svg>`,checkmark:ot`
319
319
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
320
320
  <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"/>
321
321
  </svg>
322
- `,close:nt`
322
+ `,close:ot`
323
323
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
324
324
  <path
325
325
  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"
326
326
  fill="#212121"
327
327
  />
328
328
  </svg>
329
- `};var Fi=h`
329
+ `};var Ti=m`
330
330
  :host {
331
331
  display: inline-block;
332
332
  line-height: 0; /* so you don’t get extra space around the icon */
@@ -368,11 +368,11 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
368
368
  /* --internal used for abstracting away the icon component */
369
369
  fill: var(--internal-icon-color, currentColor);
370
370
  }
371
- `;var Q=class extends u{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Bi[this.name]:null;return d`
371
+ `;var J=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?ki[this.name]:null;return d`
372
372
  <div style="--internal-icon-color: ${this.color}">
373
373
  ${e||d`<slot></slot>`}
374
374
  </div>
375
- `}};Q.styles=[Fi],s([l({type:String,reflect:!0})],Q.prototype,"color",2),s([l({type:String,reflect:!0})],Q.prototype,"size",2),s([l({reflect:!0})],Q.prototype,"name",2),Q=s([f("primer-icon")],Q);var Va=Oa({tagName:"primer-icon",elementClass:Q,react:Da});import{createComponent as Ua}from"@lit/react";import za from"react";var Ki=h`
375
+ `}};J.styles=[Ti],s([l({type:String,reflect:!0})],J.prototype,"color",2),s([l({type:String,reflect:!0})],J.prototype,"size",2),s([l({reflect:!0})],J.prototype,"name",2),J=s([u("primer-icon")],J);var ba=ya({tagName:"primer-icon",elementClass:J,react:va});import{createComponent as Ea}from"@lit/react";import Sa from"react";var Li=m`
376
376
  :host {
377
377
  display: contents;
378
378
  }
@@ -403,7 +403,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
403
403
  :host([disabled]) input::placeholder {
404
404
  color: var(--primer-color-text-disabled);
405
405
  }
406
- `;var Ya=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Ha(i){return Ya.includes(i)}var k=class extends u{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`
406
+ `;var Ca=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function xa(i){return Ca.includes(i)}var w=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(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`
407
407
  <input
408
408
  part="input"
409
409
  class=${r}
@@ -428,7 +428,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
428
428
  @blur=${this.handleBlur}
429
429
  @invalid=${this.handleInvalid}
430
430
  />
431
- `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};k.styles=[Ki],s([vt("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||!Ha(e)?(e&&e!=="text"&&A.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([_()],k.prototype,"hasFocus",2),s([_()],k.prototype,"hasError",2),k=s([f("primer-input")],k);var Ba=Ua({tagName:"primer-input",elementClass:k,react:za});import{createComponent as Fa}from"@lit/react";import Ka from"react";var ji=h`
431
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};w.styles=[Li],s([yt("input")],w.prototype,"inputElement",2),s([l({type:String,reflect:!0})],w.prototype,"value",2),s([l({type:String,reflect:!0})],w.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],w.prototype,"disabled",2),s([l({type:String,reflect:!0})],w.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!xa(e)?(e&&e!=="text"&&y.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],w.prototype,"type",2),s([l({type:Boolean,reflect:!0})],w.prototype,"required",2),s([l({type:Boolean,reflect:!0})],w.prototype,"readonly",2),s([l({type:String,reflect:!0})],w.prototype,"pattern",2),s([l({type:Number,reflect:!0})],w.prototype,"minlength",2),s([l({type:Number,reflect:!0})],w.prototype,"maxlength",2),s([l({type:String,reflect:!0})],w.prototype,"min",2),s([l({type:String,reflect:!0})],w.prototype,"max",2),s([l({type:String,reflect:!0})],w.prototype,"step",2),s([l({type:String,reflect:!0})],w.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],w.prototype,"id",2),s([C()],w.prototype,"hasFocus",2),s([C()],w.prototype,"hasError",2),w=s([u("primer-input")],w);var _a=Ea({tagName:"primer-input",elementClass:w,react:Sa});import{createComponent as Aa}from"@lit/react";import Pa from"react";var Ni=m`
432
432
  :host {
433
433
  display: contents;
434
434
  }
@@ -444,7 +444,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
444
444
  display: block;
445
445
  font-family: var(--primer-typography-body-small-font);
446
446
  }
447
- `;var dt=class extends u{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
447
+ `;var nt=class extends h{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
448
448
  <span
449
449
  class="error"
450
450
  role="alert"
@@ -453,7 +453,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
453
453
  >
454
454
  <slot></slot>
455
455
  </span>
456
- `}};dt.styles=[ji],s([l({type:String,reflect:!0})],dt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],dt.prototype,"active",2),dt=s([f("primer-input-error")],dt);var ja=Fa({tagName:"primer-input-error",elementClass:dt,react:Ka});import{createComponent as Ga}from"@lit/react";import qa from"react";var Gi=h`
456
+ `}};nt.styles=[Ni],s([l({type:String,reflect:!0})],nt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],nt.prototype,"active",2),nt=s([u("primer-input-error")],nt);var wa=Aa({tagName:"primer-input-error",elementClass:nt,react:Pa});import{createComponent as Ma}from"@lit/react";import ka from"react";var Ii=m`
457
457
  :host {
458
458
  display: inline-block;
459
459
  font-weight: var(--primer-typography-body-small-weight);
@@ -467,7 +467,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
467
467
  :host([disabled]) {
468
468
  color: var(--primer-color-text-disabled);
469
469
  }
470
- `;var pt=class extends u{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};pt.styles=[Gi],s([l({type:String,reflect:!0})],pt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],pt.prototype,"disabled",2),pt=s([f("primer-input-label")],pt);var Wa=Ga({tagName:"primer-input-label",elementClass:pt,react:qa});import{createComponent as Za}from"@lit/react";import Xa from"react";var qi=h`
470
+ `;var lt=class extends h{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};lt.styles=[Ii],s([l({type:String,reflect:!0})],lt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],lt.prototype,"disabled",2),lt=s([u("primer-input-label")],lt);var Ta=Ma({tagName:"primer-input-label",elementClass:lt,react:ka});import{createComponent as La}from"@lit/react";import Na from"react";var $i=m`
471
471
  * {
472
472
  box-sizing: border-box;
473
473
  }
@@ -532,19 +532,19 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
532
532
  border-color: var(--primer-color-border-outlined-disabled);
533
533
  cursor: not-allowed;
534
534
  }
535
- `;var J=class extends u{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`
535
+ `;var Z=class extends h{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`
536
536
  <div class="input-wrapper">
537
537
  <slot name="label"></slot>
538
- <div class="${R(e)}" @click="${this.handleWrapperClick}">
538
+ <div class="${I(e)}" @click="${this.handleWrapperClick}">
539
539
  <slot name="input"></slot>
540
540
  </div>
541
541
  <slot name="error"></slot>
542
542
  </div>
543
- `}};J.styles=[qi],s([l({type:Boolean})],J.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],J.prototype,"hasError",2),s([vt('slot[name="input"]')],J.prototype,"inputSlot",2),J=s([f("primer-input-wrapper")],J);var Qa=Za({tagName:"primer-input-wrapper",elementClass:J,react:Xa});import{createComponent as Ja}from"@lit/react";import ts from"react";var Wi=h`
543
+ `}};Z.styles=[$i],s([l({type:Boolean})],Z.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],Z.prototype,"hasError",2),s([yt('slot[name="input"]')],Z.prototype,"inputSlot",2),Z=s([u("primer-input-wrapper")],Z);var Ia=La({tagName:"primer-input-wrapper",elementClass:Z,react:Na});import{createComponent as $a}from"@lit/react";import Ra from"react";var Ri=m`
544
544
  :host {
545
545
  display: none;
546
546
  }
547
- `;var bt=class extends u{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>`}};bt.styles=[Wi],s([_()],bt.prototype,"id",2),bt=s([f("primer-portal")],bt);var es=Ja({tagName:"primer-portal",elementClass:bt,react:ts});import{createComponent as rs}from"@lit/react";import is from"react";var Zi=h`
547
+ `;var bt=class extends h{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>`}};bt.styles=[Ri],s([C()],bt.prototype,"id",2),bt=s([u("primer-portal")],bt);var Oa=$a({tagName:"primer-portal",elementClass:bt,react:Ra});import{createComponent as Da}from"@lit/react";import Va from"react";var Oi=m`
548
548
  :host {
549
549
  display: inline-flex;
550
550
  align-items: center;
@@ -589,7 +589,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
589
589
  transform: rotate(360deg);
590
590
  }
591
591
  }
592
- `;var zr={small:16,medium:24,large:32},tt=class extends u{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in zr)return zr[this.size];let e=parseInt(this.size,10);return isNaN(e)?zr.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`
592
+ `;var wr={small:16,medium:24,large:32},X=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in wr)return wr[this.size];let e=parseInt(this.size,10);return isNaN(e)?wr.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`
593
593
  <div class="spinner-container ${this.compact?"compact":""}">
594
594
  <svg
595
595
  class="spinner"
@@ -608,7 +608,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
608
608
  />
609
609
  </svg>
610
610
  </div>
611
- `}};tt.styles=[Zi],s([l({type:String})],tt.prototype,"color",2),s([l({type:String})],tt.prototype,"size",2),s([l({type:Boolean})],tt.prototype,"compact",2),tt=s([f("primer-spinner")],tt);var os=rs({tagName:"primer-spinner",elementClass:tt,react:is});import{createComponent as as}from"@lit/react";import ss from"react";var Xi=h`
611
+ `}};X.styles=[Oi],s([l({type:String})],X.prototype,"color",2),s([l({type:String})],X.prototype,"size",2),s([l({type:Boolean})],X.prototype,"compact",2),X=s([u("primer-spinner")],X);var Ya=Da({tagName:"primer-spinner",elementClass:X,react:Va});import{createComponent as Ua}from"@lit/react";import Ha from"react";var Di=m`
612
612
  :host {
613
613
  display: contents;
614
614
  }
@@ -775,13 +775,13 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
775
775
  :host([variant='tertiary'][loading]) primer-spinner {
776
776
  transform: scale(0.85);
777
777
  }
778
- `;var U=class extends u{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`
778
+ `;var Y=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?p:d`
779
779
  <primer-icon
780
780
  name="checkmark"
781
781
  size="sm"
782
782
  color="var(--primer-color-icon-primary)"
783
783
  ></primer-icon>
784
- `}renderSpinner(){if(!this.loading)return c;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`
784
+ `}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`
785
785
  <primer-spinner
786
786
  size="small"
787
787
  color="${e}"
@@ -802,7 +802,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
802
802
  </span>
803
803
  ${this.renderCheckmark()}
804
804
  </button>
805
- `}};U.styles=[S,Xi],s([l({type:String,reflect:!0})],U.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],U.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],U.prototype,"loading",2),s([l({type:String,attribute:"type"})],U.prototype,"buttonType",2),s([l({type:String,reflect:!0})],U.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],U.prototype,"selectable",2),U=s([f("primer-button")],U);var ns=as({tagName:"primer-button",elementClass:U,react:ss});import{createComponent as ls}from"@lit/react";import ds from"react";var Qi=h`
805
+ `}};Y.styles=[E,Di],s([l({type:String,reflect:!0})],Y.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],Y.prototype,"loading",2),s([l({type:String,attribute:"type"})],Y.prototype,"buttonType",2),s([l({type:String,reflect:!0})],Y.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],Y.prototype,"selectable",2),Y=s([u("primer-button")],Y);var za=Ua({tagName:"primer-button",elementClass:Y,react:Ha});import{createComponent as Fa}from"@lit/react";import Ba from"react";var Vi=m`
806
806
  :host {
807
807
  display: flex;
808
808
  flex-direction: column;
@@ -887,12 +887,12 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
887
887
  flex-direction: column;
888
888
  }
889
889
  }
890
- `;function Ji(){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 rr=class{constructor(t,e){this.formState=Ji();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=Ji(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var z=class extends u{constructor(){super(...arguments);this.formController=new rr(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 P(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`
890
+ `;function Yi(){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 We=class{constructor(t,e){this.formState=Yi();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=Yi(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var U=class extends h{constructor(){super(...arguments);this.formController=new We(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 _(this,{task:async([e])=>e!=="STRIPE_ACH"?x: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`
891
891
  <h2>
892
- ${C("payWithAch",{id:"payWithAch"})}
892
+ ${v("payWithAch",{id:"payWithAch"})}
893
893
  </h2>
894
894
  <p>
895
- ${C("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
895
+ ${v("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
896
896
  </p>
897
897
 
898
898
  <form @submit=${r=>r.preventDefault()}>
@@ -901,7 +901,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
901
901
  .hasError=${this.formController.hasError.firstName}
902
902
  >
903
903
  <primer-input-label slot="label">
904
- ${C("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
904
+ ${v("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
905
905
  </primer-input-label>
906
906
  <primer-input
907
907
  slot="input"
@@ -911,14 +911,14 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
911
911
  ?disabled=${this.isSubmitting}
912
912
  ></primer-input>
913
913
  <primer-input-error slot="error">
914
- ${this.formController.hasError.firstName?this.formController.formState.firstName.error:c}
914
+ ${this.formController.hasError.firstName?this.formController.formState.firstName.error:p}
915
915
  </primer-input-error>
916
916
  </primer-input-wrapper>
917
917
  <primer-input-wrapper
918
918
  .hasError=${this.formController.hasError.lastName}
919
919
  >
920
920
  <primer-input-label slot="label">
921
- ${C("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
921
+ ${v("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
922
922
  </primer-input-label>
923
923
  <primer-input
924
924
  slot="input"
@@ -929,7 +929,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
929
929
  >
930
930
  </primer-input>
931
931
  <primer-input-error slot="error">
932
- ${this.formController.hasError.lastName?this.formController.formState.lastName.error:c}
932
+ ${this.formController.hasError.lastName?this.formController.formState.lastName.error:p}
933
933
  </primer-input-error>
934
934
  </primer-input-wrapper>
935
935
  </div>
@@ -937,7 +937,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
937
937
  .hasError=${this.formController.hasError.emailAddress}
938
938
  >
939
939
  <primer-input-label slot="label">
940
- ${C("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
940
+ ${v("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
941
941
  </primer-input-label>
942
942
  <primer-input
943
943
  slot="input"
@@ -948,11 +948,11 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
948
948
  ?disabled=${this.isSubmitting}
949
949
  ></primer-input>
950
950
  <primer-input-error slot="error">
951
- ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:c}
951
+ ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:p}
952
952
  </primer-input-error>
953
953
  </primer-input-wrapper>
954
954
  <p>
955
- ${C("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
955
+ ${v("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
956
956
  </p>
957
957
  <primer-button
958
958
  buttonType="submit"
@@ -961,16 +961,16 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
961
961
  ?disabled=${this.isSubmitting}
962
962
  ?loading=${this.isSubmitting}
963
963
  >
964
- ${C("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
964
+ ${v("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
965
965
  </primer-button>
966
966
  </form>
967
967
  `}renderMandate(){return d`
968
968
  <h2>
969
- ${C("payWithAch",{id:"payWithAch"})}
969
+ ${v("payWithAch",{id:"payWithAch"})}
970
970
  </h2>
971
971
 
972
972
  <p>
973
- ${this.clientOptions?.stripe?.mandateData.fullMandateText??C("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
973
+ ${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")}
974
974
  </p>
975
975
 
976
976
  <div class="button-group">
@@ -980,7 +980,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
980
980
  ?disabled=${this.isSubmitting}
981
981
  ?loading=${this.isSubmitting}
982
982
  >
983
- ${C("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
983
+ ${v("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
984
984
  </primer-button>
985
985
 
986
986
  <primer-button
@@ -988,10 +988,10 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
988
988
  @click=${this._handleDeclineMandate.bind(this)}
989
989
  ?disabled=${this.isSubmitting}
990
990
  >
991
- ${C("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
991
+ ${v("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
992
992
  </primer-button>
993
993
  </div>
994
- `}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():c})}};z.styles=[S,Qi],s([l({type:Object})],z.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0}),l({attribute:!1})],z.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0}),l({attribute:!1})],z.prototype,"sdkState",2),s([v({context:Kt,subscribe:!0}),l({attribute:!1})],z.prototype,"clientOptions",2),s([_()],z.prototype,"screen",2),s([_()],z.prototype,"isSubmitting",2),z=s([f("primer-ach-payment"),T()],z);var ps=ls({tagName:"primer-ach-payment",elementClass:z,react:ds});import{createComponent as cs}from"@lit/react";import ms from"react";var ir="card-form-context";var to=h`
994
+ `}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():p})}};U.styles=[E,Vi],s([l({type:Object})],U.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0}),l({attribute:!1})],U.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0}),l({attribute:!1})],U.prototype,"sdkState",2),s([g({context:zt,subscribe:!0}),l({attribute:!1})],U.prototype,"clientOptions",2),s([C()],U.prototype,"screen",2),s([C()],U.prototype,"isSubmitting",2),U=s([u("primer-ach-payment"),M()],U);var Ka=Fa({tagName:"primer-ach-payment",elementClass:U,react:Ba});import{createComponent as Ga}from"@lit/react";import ja from"react";var Je="card-form-context";var Ui=m`
995
995
  :host {
996
996
  display: contents;
997
997
  }
@@ -1014,10 +1014,10 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1014
1014
  display: flex;
1015
1015
  gap: var(--primer-space-small);
1016
1016
  }
1017
- `;var Z=class extends u{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new I(this,{context:ir,initialValue:null});this.eventsController=new Bt(this);this.setupCardFormTask=new P(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: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=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===yt.ERROR||this.setupCardFormTask.status===yt.INITIAL?c:d`
1017
+ `;var q=class extends h{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new L(this,{context:Je,initialValue:null});this.eventsController=new Ut(this);this.setupCardFormTask=new _(this,{task:async([e])=>{if(!e?.manager)return x;let{manager:r}=e,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:c=>r.setCardholderName(c),setCardNetwork:c=>{this.selectedCardNetwork=c},validate:()=>r.validate(),submit:c=>r.submit(c),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===ft.ERROR||this.setupCardFormTask.status===ft.INITIAL?p:d`
1018
1018
  <form @submit=${this.handleFormSubmit}>
1019
1019
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1020
- ${this.setupCardFormTask.render({complete:()=>w(this.hasAssignedContent,()=>c,()=>d`
1020
+ ${this.setupCardFormTask.render({complete:()=>P(this.hasAssignedContent,()=>p,()=>d`
1021
1021
  <div class="card-form">
1022
1022
  <primer-input-card-number></primer-input-card-number>
1023
1023
  <div class="card-form-row">
@@ -1029,11 +1029,11 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1029
1029
  <primer-card-form-submit></primer-card-form-submit>
1030
1030
  `)})}
1031
1031
  </form>
1032
- `}};Z.styles=[S,to],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],Z.prototype,"hideLabels",2),s([_()],Z.prototype,"hasAssignedContent",2),s([_()],Z.prototype,"selectedCardNetwork",2),s([v({context:V,subscribe:!0}),l({type:Object})],Z.prototype,"paymentManagers",2),Z=s([f("primer-card-form"),T()],Z);var hs=cs({tagName:"primer-card-form",elementClass:Z,react:ms});import{createComponent as us}from"@lit/react";import fs from"react";var eo=h`
1032
+ `}};q.styles=[E,Ui],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],q.prototype,"hideLabels",2),s([C()],q.prototype,"hasAssignedContent",2),s([C()],q.prototype,"selectedCardNetwork",2),s([g({context:O,subscribe:!0}),l({type:Object})],q.prototype,"paymentManagers",2),q=s([u("primer-card-form"),M()],q);var qa=Ga({tagName:"primer-card-form",elementClass:q,react:ja});import{createComponent as Wa}from"@lit/react";import Ja from"react";var Hi=m`
1033
1033
  :host {
1034
1034
  display: contents;
1035
1035
  }
1036
- `;var B=class extends u{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:C("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}`:c;return d`
1036
+ `;var H=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=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:v("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`
1037
1037
  <primer-button
1038
1038
  type="submit"
1039
1039
  variant=${this.variant}
@@ -1044,7 +1044,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1044
1044
  >
1045
1045
  ${this.buttonText}${r}
1046
1046
  </primer-button>
1047
- `}};B.styles=[S,eo],s([l({type:String})],B.prototype,"buttonText",1),s([v({context:j,subscribe:!0}),l({type:Object})],B.prototype,"headlessInstance",2),s([v({context:Kt,subscribe:!0}),l({type:Object})],B.prototype,"clientOptions",2),s([v({context:L,subscribe:!0}),l()],B.prototype,"sdkState",2),s([l({type:String})],B.prototype,"variant",2),s([l({type:Boolean})],B.prototype,"disabled",2),B=s([f("primer-card-form-submit"),T()],B);var gs=us({tagName:"primer-card-form-submit",elementClass:B,react:fs});import{createComponent as Cs}from"@lit/react";import xs from"react";var{I:If}=Ni;var ro=i=>i.strings===void 0;var ye=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),ye(r,t);return!0},or=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},io=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),bs(t)}};function ys(i){this._$AN!==void 0?(or(this),this._$AM=i,io(this)):this._$AM=i}function vs(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++)ye(r[a],!1),or(r[a]);else r!=null&&(ye(r,!1),or(r));else ye(this,i)}var bs=i=>{i.type==er.CHILD&&(i._$AP??(i._$AP=vs),i._$AQ??(i._$AQ=ys))},ar=class extends Xt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),io(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ye(this,t),or(this))}setValue(t){if(ro(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 Kr=()=>new Fr,Fr=class{},Br=new WeakMap,sr=ge(class extends ar{render(i){return c}update(i,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,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 t=this.ht??globalThis,e=Br.get(t);e===void 0&&(e=new WeakMap,Br.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.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"?Br.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 oo=h`
1047
+ `}};H.styles=[E,Hi],s([l({type:String})],H.prototype,"buttonText",1),s([g({context:B,subscribe:!0}),l({type:Object})],H.prototype,"headlessInstance",2),s([g({context:zt,subscribe:!0}),l({type:Object})],H.prototype,"clientOptions",2),s([g({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([u("primer-card-form-submit"),M()],H);var Za=Wa({tagName:"primer-card-form-submit",elementClass:H,react:Ja});import{createComponent as es}from"@lit/react";import rs from"react";var{I:bf}=bi;var zi=i=>i.strings===void 0;var me=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),me(r,t);return!0},Ze=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},Fi=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),ts(t)}};function Xa(i){this._$AN!==void 0?(Ze(this),this._$AM=i,Fi(this)):this._$AM=i}function Qa(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++)me(r[a],!1),Ze(r[a]);else r!=null&&(me(r,!1),Ze(r));else me(this,i)}var ts=i=>{i.type==vt.CHILD&&(i._$AP??(i._$AP=Qa),i._$AQ??(i._$AQ=Xa))},Ct=class extends jt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Fi(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(me(this,t),Ze(this))}setValue(t){if(zi(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 Tr=()=>new kr,kr=class{},Mr=new WeakMap,Xe=st(class extends Ct{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=Mr.get(t);e===void 0&&(e=new WeakMap,Mr.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"?Mr.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 Bi=m`
1048
1048
  :host {
1049
1049
  display: flex;
1050
1050
  align-items: center;
@@ -1167,34 +1167,34 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1167
1167
  width: var(--primer-size-small);
1168
1168
  height: var(--primer-size-small);
1169
1169
  }
1170
- `;var F=class extends u{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Kr();this.dropdownRef=Kr();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`
1170
+ `;var z=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=Tr();this.dropdownRef=Tr();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`
1171
1171
  <button
1172
- ${sr(this.buttonRef)}
1172
+ ${Xe(this.buttonRef)}
1173
1173
  class="network-selector"
1174
1174
  @click=${this.toggleDropdown}
1175
1175
  @keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1176
1176
  aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1177
- aria-expanded=${o?this.isDropdownOpen:c}
1178
- aria-haspopup=${o?"true":c}
1179
- aria-controls=${o?"network-dropdown":c}
1177
+ aria-expanded=${o?this.isDropdownOpen:p}
1178
+ aria-haspopup=${o?"true":p}
1179
+ aria-controls=${o?"network-dropdown":p}
1180
1180
  >
1181
1181
  <img
1182
1182
  class="network-icon"
1183
1183
  src=${this.getNetworkIconUrl(r)}
1184
1184
  alt=${r.displayName}
1185
1185
  />
1186
- ${w(o,()=>d`
1186
+ ${P(o,()=>d`
1187
1187
  <primer-icon
1188
1188
  class="caret ${this.isDropdownOpen?"open":""}"
1189
1189
  size="sm"
1190
1190
  name="chevron-down"
1191
1191
  ></primer-icon>
1192
- `,()=>c)}
1192
+ `,()=>p)}
1193
1193
  </button>
1194
1194
 
1195
- ${w(this.isDropdownOpen,()=>d`
1195
+ ${P(this.isDropdownOpen,()=>d`
1196
1196
  <div
1197
- ${sr(this.dropdownRef)}
1197
+ ${Xe(this.dropdownRef)}
1198
1198
  id="network-dropdown"
1199
1199
  class="dropdown open"
1200
1200
  role="listbox"
@@ -1202,10 +1202,10 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1202
1202
  >
1203
1203
  ${e.map((a,n)=>d`
1204
1204
  <div
1205
- ${sr(m=>this.setNetworkOptionRef(m,n))}
1205
+ ${Xe(c=>this.setNetworkOptionRef(c,n))}
1206
1206
  class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
1207
- @click=${m=>this.selectNetwork(m,a)}
1208
- @keydown=${m=>{(m.key==="Enter"||m.key===" ")&&this.selectNetwork(m,a)}}
1207
+ @click=${c=>this.selectNetwork(c,a)}
1208
+ @keydown=${c=>{(c.key==="Enter"||c.key===" ")&&this.selectNetwork(c,a)}}
1209
1209
  role="option"
1210
1210
  aria-selected=${a.network===r.network}
1211
1211
  tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
@@ -1216,18 +1216,18 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1216
1216
  alt=${a.displayName}
1217
1217
  />
1218
1218
  <span class="network-name">${a.displayName}</span>
1219
- ${w(a.network===r.network,()=>d`
1219
+ ${P(a.network===r.network,()=>d`
1220
1220
  <primer-icon
1221
1221
  class="checkmark"
1222
1222
  name="checkmark"
1223
1223
  size="sm"
1224
1224
  ></primer-icon>
1225
- `,()=>c)}
1225
+ `,()=>p)}
1226
1226
  </div>
1227
1227
  `)}
1228
1228
  </div>
1229
- `,()=>c)}
1230
- `}};F.styles=[S,oo],s([v({context:Te,subscribe:!0})],F.prototype,"cardNetworks",2),s([v({context:j,subscribe:!0})],F.prototype,"headlessUtils",2),s([_()],F.prototype,"selectedCardNetwork",2),s([_()],F.prototype,"isDropdownOpen",2),s([_()],F.prototype,"focusedNetworkIndex",2),s([_()],F.prototype,"isKeyboardNavigation",2),F=s([f("primer-card-network-selector")],F);var As=Cs({tagName:"primer-card-network-selector",elementClass:F,react:xs});import{createComponent as _s}from"@lit/react";import Es from"react";function ao(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=`
1229
+ `,()=>p)}
1230
+ `}};z.styles=[E,Bi],s([g({context:ve,subscribe:!0})],z.prototype,"cardNetworks",2),s([g({context:B,subscribe:!0})],z.prototype,"headlessUtils",2),s([C()],z.prototype,"selectedCardNetwork",2),s([C()],z.prototype,"isDropdownOpen",2),s([C()],z.prototype,"focusedNetworkIndex",2),s([C()],z.prototype,"isKeyboardNavigation",2),z=s([u("primer-card-network-selector")],z);var is=es({tagName:"primer-card-network-selector",elementClass:z,react:rs});import{createComponent as os}from"@lit/react";import as from"react";function Ki(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=`
1231
1231
  input[data-custom-input]::placeholder {
1232
1232
  color: var(--primer-color-text-placeholder);
1233
1233
  font-size: var(--primer-typography-body-large-size);
@@ -1236,44 +1236,44 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1236
1236
  input[data-custom-input]:focus {
1237
1237
  outline: none;
1238
1238
  }
1239
- `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function so(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}function no(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 nr=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 P(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,ao(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=so(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,no(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 O=class extends u{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:C(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 nr(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===yt.ERROR)return c;let e=this.getError();return d`
1239
+ `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Gi(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}function ji(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 Qe=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 _(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 x;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):x}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,Ki(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=Gi(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,ji(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 $=class extends h{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:v(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 Qe(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===ft.ERROR)return p;let e=this.getError();return d`
1240
1240
  <primer-input-wrapper
1241
1241
  .focusWithin="${this.hostedInputController.isFocused}"
1242
1242
  .hasError=${!!e}
1243
1243
  @wrapper-click="${this.handleWrapperClick}"
1244
1244
  >
1245
- ${w(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
1245
+ ${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
1246
1246
  >${this.label}</primer-input-label
1247
- >`,()=>c)}
1247
+ >`,()=>p)}
1248
1248
  <div
1249
1249
  slot="input"
1250
1250
  class="card-input-slot"
1251
1251
  id="${this.config.containerSelector.substring(1)}"
1252
1252
  aria-label="${this.ariaLabel}"
1253
1253
  ></div>
1254
- ${w(e,()=>d`
1254
+ ${P(e,()=>d`
1255
1255
  <primer-input-error slot="error">
1256
- ${C(e,{id:e})}
1256
+ ${v(e,{id:e})}
1257
1257
  </primer-input-error>
1258
- `,()=>c)}
1258
+ `,()=>p)}
1259
1259
  </primer-input-wrapper>
1260
- `}};s([v({context:ir,subscribe:!0})],O.prototype,"cardFormContext",2),s([v({context:jt,subscribe:!0}),l()],O.prototype,"computedStyles",2),s([l({type:String})],O.prototype,"label",1),s([l({type:String})],O.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],O.prototype,"ariaLabel",1);var lo=h`
1260
+ `}};s([g({context:Je,subscribe:!0})],$.prototype,"cardFormContext",2),s([g({context:Ft,subscribe:!0}),l()],$.prototype,"computedStyles",2),s([l({type:String})],$.prototype,"label",1),s([l({type:String})],$.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],$.prototype,"ariaLabel",1);var qi=m`
1261
1261
  :host {
1262
1262
  display: contents;
1263
1263
  }
1264
- `;var Ct=h`
1264
+ `;var xt=m`
1265
1265
  .card-input-slot {
1266
1266
  display: flex;
1267
1267
  }
1268
- `;var Nt=class extends O{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()}};Nt.styles=[S,Ct,lo],Nt=s([f("primer-input-card-holder-name"),T()],Nt);var Ss=_s({tagName:"primer-input-card-holder-name",elementClass:Nt,react:Es});import{createComponent as Ps}from"@lit/react";import ws from"react";var po=h`
1268
+ `;var Rt=class extends ${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()}};Rt.styles=[E,xt,qi],Rt=s([u("primer-input-card-holder-name"),M()],Rt);var ss=os({tagName:"primer-input-card-holder-name",elementClass:Rt,react:as});import{createComponent as ns}from"@lit/react";import ls from"react";var Wi=m`
1269
1269
  :host {
1270
1270
  display: contents;
1271
1271
  }
1272
- `;var It=class extends O{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()}};It.styles=[S,Ct,po],It=s([f("primer-input-card-expiry"),T()],It);var Ms=Ps({tagName:"primer-input-card-expiry",elementClass:It,react:ws});import{createComponent as ks}from"@lit/react";import Ts from"react";var co=h`
1272
+ `;var Ot=class extends ${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()}};Ot.styles=[E,xt,Wi],Ot=s([u("primer-input-card-expiry"),M()],Ot);var ds=ns({tagName:"primer-input-card-expiry",elementClass:Ot,react:ls});import{createComponent as ps}from"@lit/react";import cs from"react";var Ji=m`
1273
1273
  :host {
1274
1274
  display: contents;
1275
1275
  }
1276
- `;var Rt=class extends O{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Rt.styles=[S,Ct,co],Rt=s([f("primer-input-cvv"),T()],Rt);var $s=ks({tagName:"primer-input-cvv",elementClass:Rt,react:Ts});import{createComponent as Ls}from"@lit/react";import Ns from"react";var mo=h`
1276
+ `;var Dt=class extends ${constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Dt.styles=[E,xt,Ji],Dt=s([u("primer-input-cvv"),M()],Dt);var ms=ps({tagName:"primer-input-cvv",elementClass:Dt,react:cs});import{createComponent as hs}from"@lit/react";import us from"react";var Zi=m`
1277
1277
  :host {
1278
1278
  display: contents;
1279
1279
  }
@@ -1297,14 +1297,14 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1297
1297
  align-items: center;
1298
1298
  z-index: 2;
1299
1299
  }
1300
- `;var Ot=class extends O{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===yt.ERROR)return c;let e=this.getError();return d`
1300
+ `;var Vt=class extends ${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===ft.ERROR)return p;let e=this.getError();return d`
1301
1301
  <primer-input-wrapper
1302
1302
  .focusWithin="${this.hostedInputController.isFocused}"
1303
1303
  .hasError=${!!e}
1304
1304
  >
1305
- ${w(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
1305
+ ${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
1306
1306
  >${this.label}</primer-input-label
1307
- >`,()=>c)}
1307
+ >`,()=>p)}
1308
1308
  <div
1309
1309
  slot="input"
1310
1310
  class="card-number-container"
@@ -1317,13 +1317,13 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1317
1317
  ></primer-card-network-selector>
1318
1318
  </div>
1319
1319
  </div>
1320
- ${w(e,r=>d`
1320
+ ${P(e,r=>d`
1321
1321
  <primer-input-error slot="error">
1322
- ${C(r,{id:r})}
1322
+ ${v(r,{id:r})}
1323
1323
  </primer-input-error>
1324
- `,()=>c)}
1324
+ `,()=>p)}
1325
1325
  </primer-input-wrapper>
1326
- `}render(){return this.renderInput()}};Ot.styles=[S,Ct,mo],Ot=s([f("primer-input-card-number"),T()],Ot);var Is=Ls({tagName:"primer-input-number",elementClass:Ot,react:Ns});import{createComponent as Rs}from"@lit/react";import Os from"react";var ho=h`
1326
+ `}render(){return this.renderInput()}};Vt.styles=[E,xt,Zi],Vt=s([u("primer-input-card-number"),M()],Vt);var fs=hs({tagName:"primer-input-number",elementClass:Vt,react:us});import{createComponent as gs}from"@lit/react";import ys from"react";var Xi=m`
1327
1327
  :host {
1328
1328
  height: calc(
1329
1329
  var(--primer-typography-title-large-line-height) +
@@ -1359,7 +1359,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1359
1359
  img {
1360
1360
  height: 100%;
1361
1361
  }
1362
- `;function ve(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var G=class extends u{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new P(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new P(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 P(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?ve(e):"";return r==="payWith"&&(r="pay_with"),C(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
1362
+ `;function he(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var K=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new _(this,{task:async([e,r])=>!e||!r?x:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new _(this,{task:async([e,r])=>{if(!e||!r)return x;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}:x},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new _(this,{task:async([e,r])=>!e||!r?x:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?he(e):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
1363
1363
  <primer-portal>
1364
1364
  <primer-dialog @primer-dialog-close="${()=>this.open=!1}">
1365
1365
  <primer-ach-payment
@@ -1370,11 +1370,11 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1370
1370
  ></primer-ach-payment>
1371
1371
  </primer-dialog>
1372
1372
  </primer-portal>
1373
- `:c}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
1373
+ `:p}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
1374
1374
  <primer-button
1375
1375
  @click="${()=>this.start()}"
1376
- class=${R({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1377
- title="${C("pay_with",{id:"pay_with"})} ${e.name}"
1376
+ class=${I({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1377
+ title="${v("pay_with",{id:"pay_with"})} ${e.name}"
1378
1378
  >
1379
1379
  <span class="image-container">
1380
1380
  <img src="${e.iconUrl}" alt="${e.name}" />
@@ -1382,17 +1382,17 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1382
1382
  ${e.displayName}
1383
1383
  </primer-button>
1384
1384
  ${this.renderDialog()}
1385
- `)})}};G.styles=[S,ho],s([l({type:Object})],G.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0})],G.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0})],G.prototype,"sdkState",2),s([v({context:j,subscribe:!0})],G.prototype,"headlessUtils",2),s([_()],G.prototype,"open",2),G=s([f("primer-dynamic-payment"),T()],G);var Ds=Rs({tagName:"primer-dynamic-payment",elementClass:G,react:Os});import{createComponent as Vs}from"@lit/react";import Ys from"react";var uo=h`
1385
+ `)})}};K.styles=[E,Xi],s([l({type:Object})],K.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0})],K.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0})],K.prototype,"sdkState",2),s([g({context:B,subscribe:!0})],K.prototype,"headlessUtils",2),s([C()],K.prototype,"open",2),K=s([u("primer-dynamic-payment"),M()],K);var vs=gs({tagName:"primer-dynamic-payment",elementClass:K,react:ys});import{createComponent as bs}from"@lit/react";import Cs from"react";var Qi=m`
1386
1386
  :host {
1387
1387
  display: block;
1388
1388
  width: 100%;
1389
1389
  }
1390
- `;var ct=class extends u{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`
1390
+ `;var dt=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`
1391
1391
  <primer-error-message
1392
- message="${C(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
1392
+ message="${v(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
1393
1393
  ?visible="${this.shouldShowError}"
1394
1394
  ></primer-error-message>
1395
- `:c}};ct.styles=[uo],s([v({context:L,subscribe:!0}),_()],ct.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],ct.prototype,"showProcessingErrors",2),ct=s([f("primer-error-message-container")],ct);var Hs=Vs({tagName:"primer-error-message-container",elementClass:ct,react:Ys});import{createComponent as Us}from"@lit/react";import zs from"react";var fo=h`
1395
+ `:p}};dt.styles=[Qi],s([g({context:T,subscribe:!0}),C()],dt.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],dt.prototype,"showProcessingErrors",2),dt=s([u("primer-error-message-container")],dt);var xs=bs({tagName:"primer-error-message-container",elementClass:dt,react:Cs});import{createComponent as Es}from"@lit/react";import Ss from"react";var to=m`
1396
1396
  :host {
1397
1397
  display: contents;
1398
1398
  }
@@ -1584,13 +1584,13 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1584
1584
  background-color: var(--primer-color-background-outlined-default);
1585
1585
  border-radius: var(--primer-radius-small);
1586
1586
  }
1587
- `;var D=class extends u{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=C("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new P(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){A.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){A.error("Failed to render Klarna category",e)}}selectCategory(e){this.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">
1587
+ `;var R=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 _(this,{task:async([e,r])=>{if(!e||!r)return x;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){y.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){y.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">
1588
1588
  <primer-spinner size="small"></primer-spinner>
1589
1589
  </div>`:d`
1590
1590
  <div class="category-selection">
1591
1591
  ${e.map(o=>d`
1592
1592
  <button
1593
- class=${R({"category-button":!0,selected:o.id===this.selectedCategory})}
1593
+ class=${I({"category-button":!0,selected:o.id===this.selectedCategory})}
1594
1594
  @click=${()=>{this.selectCategory(o.id)}}
1595
1595
  >
1596
1596
  ${o.name}
@@ -1604,14 +1604,14 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1604
1604
  id="klarna-category-container"
1605
1605
  class="klarna-category-container"
1606
1606
  ></div>
1607
- `:c}
1607
+ `:p}
1608
1608
 
1609
1609
  <button
1610
- class=${R({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1610
+ class=${I({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1611
1611
  ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
1612
1612
  @click=${()=>this.startKlarnaPayment()}
1613
1613
  >
1614
- ${C("confirm",{id:"confirm"})}
1614
+ ${v("confirm",{id:"confirm"})}
1615
1615
  </button>
1616
1616
  `}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return d`<div class="error">
1617
1617
  Error loading Klarna: ${r}
@@ -1628,7 +1628,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1628
1628
  aria-label=${this.headerAriaLabel}
1629
1629
  >
1630
1630
  <img src=${r} alt="Klarna logo" />
1631
- <span>${C("pay_with",{id:"pay_with"})} Klarna</span>
1631
+ <span>${v("pay_with",{id:"pay_with"})} Klarna</span>
1632
1632
  <span
1633
1633
  class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1634
1634
  >
@@ -1645,7 +1645,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1645
1645
  </div>
1646
1646
  </div>
1647
1647
  </div>
1648
- `:c})}};D.styles=[S,fo],s([v({context:V,subscribe:!0}),l()],D.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0}),l()],D.prototype,"sdkState",2),s([v({context:j,subscribe:!0}),l({type:Object})],D.prototype,"headlessUtils",2),s([v({context:$e,subscribe:!0}),l()],D.prototype,"klarnaCategories",2),s([_()],D.prototype,"selectedCategory",2),s([_()],D.prototype,"isExpanded",2),s([_()],D.prototype,"headerAriaLabel",2),s([vt("#klarna-category-container")],D.prototype,"klarnaContainer",2),D=s([f("primer-klarna"),T()],D);var Bs=Us({tagName:"primer-klarna",elementClass:D,react:zs});import{createComponent as Fs}from"@lit/react";import Ks from"react";var go=h`
1648
+ `:p})}};R.styles=[E,to],s([g({context:O,subscribe:!0}),l()],R.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0}),l()],R.prototype,"sdkState",2),s([g({context:B,subscribe:!0}),l({type:Object})],R.prototype,"headlessUtils",2),s([g({context:be,subscribe:!0}),l()],R.prototype,"klarnaCategories",2),s([C()],R.prototype,"selectedCategory",2),s([C()],R.prototype,"isExpanded",2),s([C()],R.prototype,"headerAriaLabel",2),s([yt("#klarna-category-container")],R.prototype,"klarnaContainer",2),R=s([u("primer-klarna"),M()],R);var _s=Es({tagName:"primer-klarna",elementClass:R,react:Ss});import{createComponent as As}from"@lit/react";import Ps from"react";var eo=m`
1649
1649
  :host {
1650
1650
  height: calc(
1651
1651
  var(--primer-typography-title-large-line-height) +
@@ -1659,14 +1659,14 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1659
1659
  height: 100%;
1660
1660
  flex: 1;
1661
1661
  }
1662
- `;var et=class extends u{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new P(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 P(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:()=>c,complete:()=>d`
1662
+ `;var Q=class extends h{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new _(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return x;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new _(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return x;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`
1663
1663
  <!-- The native button container is rendered first -->
1664
1664
  <div class="native-button-container" id="${this._buttonId}"></div>
1665
- `,pending:()=>c})}};et.styles=[S,go],s([l({type:Object})],et.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0}),l()],et.prototype,"paymentManagers",2),s([v({context:jt,subscribe:!0}),l()],et.prototype,"computedStyles",2),et=s([f("primer-native-payment")],et);var js=Fs({tagName:"primer-native-payment",elementClass:et,react:Ks});import{createComponent as Gs}from"@lit/react";import qs from"react";var yo=h`
1665
+ `,pending:()=>p})}};Q.styles=[E,eo],s([l({type:Object})],Q.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0}),l()],Q.prototype,"paymentManagers",2),s([g({context:Ft,subscribe:!0}),l()],Q.prototype,"computedStyles",2),Q=s([u("primer-native-payment")],Q);var ws=As({tagName:"primer-native-payment",elementClass:Q,react:Ps});import{createComponent as Ms}from"@lit/react";import ks from"react";var ro=m`
1666
1666
  :host {
1667
1667
  display: contents;
1668
1668
  }
1669
- `;var mt=class extends u{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return c;let e=this.paymentMethods?.get(this.type);if(!e)return c;switch(e?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
1669
+ `;var pt=class extends h{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
1670
1670
  .paymentMethod=${e}
1671
1671
  ></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
1672
1672
  .paymentMethod=${e}
@@ -1674,14 +1674,14 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1674
1674
  <primer-dynamic-payment
1675
1675
  .paymentMethod=${e}
1676
1676
  ></primer-dynamic-payment>
1677
- `;default:return c}}};mt.styles=[yo],s([l({type:String})],mt.prototype,"type",2),s([v({context:Gt,subscribe:!0}),l()],mt.prototype,"paymentMethods",2),mt=s([f("primer-payment-method")],mt);var Ws=Gs({tagName:"primer-payment-method",elementClass:mt,react:qs});import{createComponent as Zs}from"@lit/react";import Xs from"react";var Qt=class extends u{render(){return d`
1677
+ `;default:return p}}};pt.styles=[ro],s([l({type:String})],pt.prototype,"type",2),s([g({context:Bt,subscribe:!0}),l()],pt.prototype,"paymentMethods",2),pt=s([u("primer-payment-method")],pt);var Ts=Ms({tagName:"primer-payment-method",elementClass:pt,react:ks});import{createComponent as Ls}from"@lit/react";import Ns from"react";var qt=class extends h{render(){return d`
1678
1678
  <primer-checkout-state type="complete"></primer-checkout-state>
1679
- `}};Qt=s([f("primer-checkout-complete")],Qt);var Qs=Zs({tagName:"primer-checkout-complete",elementClass:Qt,react:Xs});import{createComponent as Js}from"@lit/react";import tn from"react";var Dt=class extends u{constructor(){super(...arguments);this.sdkState=null}render(){return d`
1679
+ `}};qt=s([u("primer-checkout-complete")],qt);var Is=Ls({tagName:"primer-checkout-complete",elementClass:qt,react:Ns});import{createComponent as $s}from"@lit/react";import Rs from"react";var Yt=class extends h{constructor(){super(...arguments);this.sdkState=null}render(){return d`
1680
1680
  <primer-checkout-state
1681
1681
  type="failure"
1682
1682
  description=${this.sdkState?.error?.message||""}
1683
1683
  ></primer-checkout-state>
1684
- `}};s([v({context:L,subscribe:!0}),l()],Dt.prototype,"sdkState",2),Dt=s([f("primer-checkout-error")],Dt);var en=Js({tagName:"primer-checkout-error",elementClass:Dt,react:tn});import{createComponent as rn}from"@lit/react";import on from"react";var vo=h`
1684
+ `}};s([g({context:T,subscribe:!0}),l()],Yt.prototype,"sdkState",2),Yt=s([u("primer-checkout-error")],Yt);var Os=$s({tagName:"primer-checkout-error",elementClass:Yt,react:Rs});import{createComponent as Ds}from"@lit/react";import Vs from"react";var io=m`
1685
1685
  :host {
1686
1686
  display: contents;
1687
1687
  }
@@ -1700,15 +1700,15 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1700
1700
  primer-vault-manager {
1701
1701
  margin-bottom: var(--primer-space-xlarge);
1702
1702
  }
1703
- `;var ht=class extends u{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`
1703
+ `;var ct=class extends h{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`
1704
1704
  <slot name="checkout-complete">
1705
1705
  <primer-checkout-complete></primer-checkout-complete>
1706
1706
  </slot>
1707
1707
  `:d`
1708
1708
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1709
- ${w(this.hasAssignedContent,()=>c,()=>d`
1709
+ ${P(this.hasAssignedContent,()=>p,()=>d`
1710
1710
  <div
1711
- class=${R({"primer-is-processing":!!this.sdkState?.isProcessing})}
1711
+ class=${I({"primer-is-processing":!!this.sdkState?.isProcessing})}
1712
1712
  >
1713
1713
  <primer-vault-manager></primer-vault-manager>
1714
1714
  <primer-show-other-payments>
@@ -1723,7 +1723,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1723
1723
  <primer-error-message-container></primer-error-message-container>
1724
1724
  </div>
1725
1725
  `)}
1726
- `}};ht.styles=[S,vo],s([v({context:Gt,subscribe:!0}),l()],ht.prototype,"paymentMethods",2),s([v({context:L,subscribe:!0}),l()],ht.prototype,"sdkState",2),ht=s([f("primer-main")],ht);var an=rn({tagName:"primer-main",elementClass:ht,react:on});import{createComponent as sn}from"@lit/react";import nn from"react";var bo=h`
1726
+ `}};ct.styles=[E,io],s([g({context:Bt,subscribe:!0}),l()],ct.prototype,"paymentMethods",2),s([g({context:T,subscribe:!0}),l()],ct.prototype,"sdkState",2),ct=s([u("primer-main")],ct);var Ys=Ds({tagName:"primer-main",elementClass:ct,react:Vs});import{createComponent as Us}from"@lit/react";import Hs from"react";var oo=m`
1727
1727
  :host {
1728
1728
  height: calc(
1729
1729
  var(--primer-typography-title-large-line-height) +
@@ -1798,7 +1798,7 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1798
1798
  flex-shrink: 0;
1799
1799
  flex-grow: 1;
1800
1800
  }
1801
- `;var X=class extends u{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new P(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new P(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 P(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?ve(e):"";return r==="payWith"&&(r="pay_with"),C(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>c,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`
1801
+ `;var W=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new _(this,{task:async([e,r])=>!e||!r?x:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new _(this,{task:async([e,r])=>{if(!e||!r)return x;let o=r.getPaymentMethodConfiguration(e);if(!o)return x;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 _(this,{task:async([e,r])=>!e||!r?x:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?he(e):"";return r==="payWith"&&(r="pay_with"),v(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`
1802
1802
  <span class="image-container">
1803
1803
  <img src="${e.iconUrl}" alt="${e.name}" />
1804
1804
  </span>
@@ -1810,12 +1810,12 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1810
1810
  `;return d`
1811
1811
  <primer-button
1812
1812
  @click="${()=>this.startRedirectPayment()}"
1813
- class=${R(r)}
1814
- title="${C("pay_with",{id:"pay_with"})} ${e.name}"
1813
+ class=${I(r)}
1814
+ title="${v("pay_with",{id:"pay_with"})} ${e.name}"
1815
1815
  >
1816
1816
  ${o}
1817
1817
  </primer-button>
1818
- `}})}};X.styles=[S,bo],s([l({type:Object})],X.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0})],X.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0})],X.prototype,"sdkState",2),s([v({context:j,subscribe:!0})],X.prototype,"headlessUtils",2),X=s([f("primer-redirect-payment"),T()],X);var ln=sn({tagName:"primer-redirect-payment",elementClass:X,react:nn});import{createComponent as dn}from"@lit/react";import pn from"react";var Co=h`
1818
+ `}})}};W.styles=[E,oo],s([l({type:Object})],W.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0})],W.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0})],W.prototype,"sdkState",2),s([g({context:B,subscribe:!0})],W.prototype,"headlessUtils",2),W=s([u("primer-redirect-payment"),M()],W);var zs=Us({tagName:"primer-redirect-payment",elementClass:W,react:Hs});import{createComponent as Fs}from"@lit/react";import Bs from"react";var ao=m`
1819
1819
  :host {
1820
1820
  display: block;
1821
1821
  margin-top: var(--primer-space-medium);
@@ -1835,19 +1835,19 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1835
1835
  justify-content: center;
1836
1836
  align-items: center;
1837
1837
  }
1838
- `;var xt=class extends u{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?c:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
1838
+ `;var Et=class extends h{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?p:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
1839
1839
  <div class="other-payment-methods-container">
1840
1840
  <primer-collapsable
1841
1841
  buttonVariant="secondary"
1842
1842
  .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
1843
- .header="${C("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
1843
+ .header="${v("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
1844
1844
  >
1845
1845
  <div class="other-payment-methods-content">
1846
1846
  <slot name="other-payments"></slot>
1847
1847
  </div>
1848
1848
  </primer-collapsable>
1849
1849
  </div>
1850
- `}};xt.styles=[Co],s([v({context:qt,subscribe:!0}),l({type:Object,attribute:!1})],xt.prototype,"vaultManager",2),xt=s([f("primer-show-other-payments")],xt);var cn=dn({tagName:"primer-show-other-payments",elementClass:xt,react:pn});import{createComponent as wn}from"@lit/react";import Mn from"react";var be={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 jr(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function mn(i){return i?i===i.toUpperCase()?jr(i):i:""}function xo(i,t){return[i,t].filter(Boolean).join(" ")}function hn(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function Ao(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function un(i){let t=i.paymentInstrumentData,e=mn(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${Ao(r)}`:e)||" Card"}`,a=hn(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:a}}function fn(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account",n=xo(r,o);return{description:a,secondaryDescription:n}}function gn(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=xo(r,o);return{description:a,secondaryDescription:n}}function yn(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;a||(r&&e?a=`${r} ${Ao(e)}`:r?a=r:a="Bank Account");let n=o?`${jr(o)} Account`:"";return{description:a,secondaryDescription:n}}function vn(i){let t=i.paymentInstrumentType,e=jr(t.replace(/_/g," "));return{description:i.userDescription||e}}var bn={[be.CARD]:un,[be.PAYPAL_VAULTED]:fn,[be.KLARNA_CUSTOMER_TOKEN]:gn,[be.AUTOMATED_CLEARING_HOUSE]:yn};function _o(i){try{let t=bn[i.paymentInstrumentType];return t?t(i):vn(i)}catch(t){return A.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var Eo=h`
1850
+ `}};Et.styles=[ao],s([g({context:Kt,subscribe:!0}),l({type:Object,attribute:!1})],Et.prototype,"vaultManager",2),Et=s([u("primer-show-other-payments")],Et);var Ks=Fs({tagName:"primer-show-other-payments",elementClass:Et,react:Bs});import{createComponent as rn}from"@lit/react";import on from"react";var ue={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 Lr(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Gs(i){return i?i===i.toUpperCase()?Lr(i):i:""}function so(i,t){return[i,t].filter(Boolean).join(" ")}function js(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function no(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function qs(i){let t=i.paymentInstrumentData,e=Gs(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${no(r)}`:e)||" Card"}`,a=js(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:a}}function Ws(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account",n=so(r,o);return{description:a,secondaryDescription:n}}function Js(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=so(r,o);return{description:a,secondaryDescription:n}}function Zs(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;a||(r&&e?a=`${r} ${no(e)}`:r?a=r:a="Bank Account");let n=o?`${Lr(o)} Account`:"";return{description:a,secondaryDescription:n}}function Xs(i){let t=i.paymentInstrumentType,e=Lr(t.replace(/_/g," "));return{description:i.userDescription||e}}var Qs={[ue.CARD]:qs,[ue.PAYPAL_VAULTED]:Ws,[ue.KLARNA_CUSTOMER_TOKEN]:Js,[ue.AUTOMATED_CLEARING_HOUSE]:Zs};function lo(i){try{let t=Qs[i.paymentInstrumentType];return t?t(i):Xs(i)}catch(t){return y.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var po=m`
1851
1851
  :host {
1852
1852
  display: block;
1853
1853
  width: 100%;
@@ -1964,19 +1964,17 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1964
1964
  transition: none;
1965
1965
  }
1966
1966
  }
1967
- `;var xe=globalThis,lr=xe.trustedTypes,So=lr?lr.createPolicy("lit-html",{createHTML:i=>i}):void 0,qr="$lit$",ut=`lit$${Math.random().toFixed(9).slice(2)}$`,Wr="?"+ut,Cn=`<${Wr}>`,Ht=document,dr=()=>Ht.createComment(""),Ae=i=>i===null||typeof i!="object"&&typeof i!="function",Zr=Array.isArray,$o=i=>Zr(i)||typeof i?.[Symbol.iterator]=="function",Gr=`[
1968
- \f\r]`,Ce=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Po=/-->/g,wo=/>/g,Vt=RegExp(`>|${Gr}(?:([^\\s"'>=/]+)(${Gr}*=${Gr}*(?:[^
1969
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Mo=/'/g,ko=/"/g,Lo=/^(?:script|style|textarea|title)$/i,Xr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),ix=Xr(1),ox=Xr(2),ax=Xr(3),_e=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),To=new WeakMap,Yt=Ht.createTreeWalker(Ht,129);function No(i,t){if(!Zr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return So!==void 0?So.createHTML(t):t}var Io=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=Ce;for(let m=0;m<e;m++){let p=i[m],y,b,g=-1,M=0;for(;M<p.length&&(n.lastIndex=M,b=n.exec(p),b!==null);)M=n.lastIndex,n===Ce?b[1]==="!--"?n=Po:b[1]!==void 0?n=wo:b[2]!==void 0?(Lo.test(b[2])&&(o=RegExp("</"+b[2],"g")),n=Vt):b[3]!==void 0&&(n=Vt):n===Vt?b[0]===">"?(n=o??Ce,g=-1):b[1]===void 0?g=-2:(g=n.lastIndex-b[2].length,y=b[1],n=b[3]===void 0?Vt:b[3]==='"'?ko:Mo):n===ko||n===Mo?n=Vt:n===Po||n===wo?n=Ce:(n=Vt,o=void 0);let N=n===Vt&&i[m+1].startsWith("/>")?" ":"";a+=n===Ce?p+Cn:g>=0?(r.push(y),p.slice(0,g)+qr+p.slice(g)+ut+N):p+ut+(g===-2?m:N)}return[No(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ee=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,m=t.length-1,p=this.parts,[y,b]=Io(t,e);if(this.el=i.createElement(y,r),Yt.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(o=Yt.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let g of o.getAttributeNames())if(g.endsWith(qr)){let M=b[n++],N=o.getAttribute(g).split(ut),rt=/([.?@])?(.*)/.exec(M);p.push({type:1,index:a,name:rt[2],strings:N,ctor:rt[1]==="."?cr:rt[1]==="?"?mr:rt[1]==="@"?hr:zt}),o.removeAttribute(g)}else g.startsWith(ut)&&(p.push({type:6,index:a}),o.removeAttribute(g));if(Lo.test(o.tagName)){let g=o.textContent.split(ut),M=g.length-1;if(M>0){o.textContent=lr?lr.emptyScript:"";for(let N=0;N<M;N++)o.append(g[N],dr()),Yt.nextNode(),p.push({type:2,index:++a});o.append(g[M],dr())}}}else if(o.nodeType===8)if(o.data===Wr)p.push({type:2,index:a});else{let g=-1;for(;(g=o.data.indexOf(ut,g+1))!==-1;)p.push({type:7,index:a}),g+=ut.length-1}a++}}static createElement(t,e){let r=Ht.createElement("template");return r.innerHTML=t,r}};function Ut(i,t,e=i,r){if(t===_e)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=Ae(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=Ut(i,o._$AS(i,t.values),o,r)),t}var pr=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??Ht).importNode(e,!0);Yt.currentNode=o;let a=Yt.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let y;p.type===2?y=new Se(a,a.nextSibling,this,t):p.type===1?y=new p.ctor(a,p.name,p.strings,this,t):p.type===6&&(y=new ur(a,this,t)),this._$AV.push(y),p=r[++m]}n!==p?.index&&(a=Yt.nextNode(),n++)}return Yt.currentNode=Ht,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++}},Se=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=$,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=Ut(this,t,e),Ae(t)?t===$||t==null||t===""?(this._$AH!==$&&this._$AR(),this._$AH=$):t!==this._$AH&&t!==_e&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):$o(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!==$&&Ae(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ht.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=Ee.createElement(No(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new pr(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=To.get(t.strings);return e===void 0&&To.set(t.strings,e=new Ee(t)),e}k(t){Zr(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(dr()),this.O(dr()),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))}},zt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=$,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=$}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=Ut(this,t,e,0),n=!Ae(t)||t!==this._$AH&&t!==_e,n&&(this._$AH=t);else{let m=t,p,y;for(t=a[0],p=0;p<a.length-1;p++)y=Ut(this,m[r+p],e,p),y===_e&&(y=this._$AH[p]),n||(n=!Ae(y)||y!==this._$AH[p]),y===$?t=$:t!==$&&(t+=(y??"")+a[p+1]),this._$AH[p]=y}n&&!o&&this.j(t)}j(t){t===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},cr=class extends zt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}},mr=class extends zt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==$)}},hr=class extends zt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=Ut(this,t,e,0)??$)===_e)return;let r=this._$AH,o=t===$&&r!==$||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==$&&(r===$||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)}},ur=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){Ut(this,t)}},Ro={M:qr,P:ut,A:Wr,C:1,L:Io,R:pr,D:$o,V:Ut,I:Se,H:zt,N:mr,U:hr,B:cr,F:ur},xn=xe.litHtmlPolyfillSupport;xn?.(Ee,Se),(xe.litHtmlVersions??(xe.litHtmlVersions=[])).push("3.3.0");var Jt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Pe=i=>(...t)=>({_$litDirective$:i,values:t}),fr=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{I:hx}=Ro;var Oo=i=>i.strings===void 0;var we=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),we(r,t);return!0},gr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},Do=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),En(t)}};function An(i){this._$AN!==void 0?(gr(this),this._$AM=i,Do(this)):this._$AM=i}function _n(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++)we(r[a],!1),gr(r[a]);else r!=null&&(we(r,!1),gr(r));else we(this,i)}var En=i=>{i.type==Jt.CHILD&&(i._$AP??(i._$AP=_n),i._$AQ??(i._$AQ=An))},te=class extends fr{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Do(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(we(this,t),gr(this))}setValue(t){if(Oo(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var yr=new WeakMap,ee=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,yr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var Vo=0,Qr=new Map,Yo=new WeakSet,Jr=()=>new Promise(i=>requestAnimationFrame(i));var Ho=(i,t)=>{let e=i-t;return e===0?void 0:e},Uo=(i,t)=>{let e=i/t;return e===1?void 0:e},vr={left:(i,t)=>{let e=Ho(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=Ho(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=Uo(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=Uo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},Bo={duration:333,easing:"ease-in-out"},Fo=["left","top","width","height","opacity","color","background"],zo=new WeakMap,br=class extends te{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Jt.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 $}getController(){return yr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,zo.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=Fo),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(vr[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 Jr;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=Qr.get(this.options.inId);if(a){Qr.delete(this.options.inId);let{from:n,to:m}=this.N(a,o,e);t=this.calculateKeyframes(n,m),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,Vo++,t.forEach(p=>p.zIndex=Vo)}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&&Qr.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Jr(),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=zo.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=Yo.has(this.u);return t||this.u.updateComplete.then(()=>{Yo.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(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)}),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,m={};for(let p in e){let y=t[p],b=e[p];if(p in vr){let g=vr[p];if(y===void 0||b===void 0)continue;let M=g(y,b);M.transform!==void 0&&(m[p]=M.value,n=!0,o.transform=`${o.transform??""} ${M.transform}`,M.overrideFrom!==void 0&&Object.assign(o,M.overrideFrom))}else y!==b&&y!==void 0&&b!==void 0&&(n=!0,o[p]=y,a[p]=b)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=m,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)}},At=Pe(br);var Sn=["top","right","bottom","left"],Cr=class extends te{constructor(t){if(super(t),t.type!==Jt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return $}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=Sn.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},Pn=Pe(Cr);var K=class extends u{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new ee(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=C("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:C("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:C("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 _o(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
1967
+ `;var tr=new WeakMap,Wt=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,tr.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 co=0,Nr=new Map,mo=new WeakSet,Ir=()=>new Promise(i=>requestAnimationFrame(i));var ho=(i,t)=>{let e=i-t;return e===0?void 0:e},uo=(i,t)=>{let e=i/t;return e===1?void 0:e},er={left:(i,t)=>{let e=ho(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=ho(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=uo(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=uo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},go={duration:333,easing:"ease-in-out"},yo=["left","top","width","height","opacity","color","background"],fo=new WeakMap,rr=class extends Ct{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===vt.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 tr.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,fo.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=yo),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(er[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 Ir;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=Nr.get(this.options.inId);if(a){Nr.delete(this.options.inId);let{from:n,to:c}=this.N(a,o,e);t=this.calculateKeyframes(n,c),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,co++,t.forEach(f=>f.zIndex=co)}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&&Nr.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Ir(),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=fo.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=mo.has(this.u);return t||this.u.updateComplete.then(()=>{mo.add(this.u)}),t}j(t,e=this.O()){let r={...go};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(c=>c.animatingProperties).filter(c=>c!==void 0),a=1,n=1;return o.length>0&&(o.forEach(c=>{c.width&&(a/=c.width),c.height&&(n/=c.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,c={};for(let f in e){let S=t[f],k=e[f];if(f in er){let A=er[f];if(S===void 0||k===void 0)continue;let N=A(S,k);N.transform!==void 0&&(c[f]=N.value,n=!0,o.transform=`${o.transform??""} ${N.transform}`,N.overrideFrom!==void 0&&Object.assign(o,N.overrideFrom))}else S!==k&&S!==void 0&&k!==void 0&&(n=!0,o[f]=S,a[f]=k)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=c,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)}},St=st(rr);var tn=["top","right","bottom","left"],ir=class extends Ct{constructor(t){if(super(t),t.type!==vt.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=tn.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},en=st(ir);var F=class extends h{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new Wt(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=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(e){this.errorMessage=e instanceof Error?e.message:v("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:v("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 lo(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
1970
1968
  <div
1971
1969
  class="loading-overlay"
1972
- ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1970
+ ${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1973
1971
  >
1974
1972
  <primer-spinner
1975
1973
  size="medium"
1976
1974
  color="var(--primer-color-loader)"
1977
1975
  ></primer-spinner>
1978
1976
  </div>
1979
- `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return c;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
1977
+ `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return p;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
1980
1978
  <div class="delete-confirmation-container">
1981
1979
  <primer-vault-delete-confirmation
1982
1980
  .isDeleting=${this.isDeleting}
@@ -1984,30 +1982,30 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
1984
1982
  .paymentMethodName=${e}
1985
1983
  @confirm-delete=${this.handleConfirmDelete}
1986
1984
  @cancel-delete=${this.handleCancelDelete}
1987
- ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1985
+ ${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1988
1986
  ></primer-vault-delete-confirmation>
1989
1987
  </div>
1990
- `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?c:d`
1988
+ `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?p:d`
1991
1989
  <primer-vault-payment-method-item
1992
1990
  .paymentMethod=${e}
1993
1991
  .isEditMode=${this.isEditMode}
1994
1992
  @delete-payment-method=${this.handleDeletePaymentMethod}
1995
- ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1993
+ ${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1996
1994
  ></primer-vault-payment-method-item>
1997
1995
  `}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
1998
1996
  <div class="payment-methods-list">
1999
1997
  ${e.map(o=>this.renderPaymentMethodItem(o))}
2000
- ${w(r,()=>d`
1998
+ ${P(r,()=>d`
2001
1999
  <div class="submit-button-container">
2002
2000
  <primer-vault-payment-submit
2003
2001
  class="submit-button"
2004
2002
  @primer-vault-payment-error=${this.handlePaymentError}
2005
- ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2003
+ ${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2006
2004
  ></primer-vault-payment-submit>
2007
2005
  </div>
2008
- `,()=>c)}
2006
+ `,()=>p)}
2009
2007
  </div>
2010
- `}render(){if(!this.vaultManagerContext?.enabled)return c;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
2008
+ `}render(){if(!this.vaultManagerContext?.enabled)return p;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
2011
2009
  <div class="vault-manager ${o?"is-updating":""}">
2012
2010
  <primer-vault-manager-header
2013
2011
  .isEditMode=${this.isEditMode}
@@ -2015,328 +2013,100 @@ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as
2015
2013
  @toggle-edit-mode=${this.handleToggleEditMode}
2016
2014
  ></primer-vault-manager-header>
2017
2015
 
2018
- ${w(this.errorMessage,()=>d`
2016
+ ${P(this.errorMessage,()=>d`
2019
2017
  <primer-vault-error-message
2020
2018
  .errorMessage=${this.errorMessage}
2021
2019
  @close-error=${this.handleCloseError}
2022
- ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2020
+ ${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2023
2021
  ></primer-vault-error-message>
2024
- `,()=>c)}
2022
+ `,()=>p)}
2025
2023
 
2026
2024
  <div class="vault-manager-content">
2027
- ${w(!r&&!e,()=>d`
2025
+ ${P(!r&&!e,()=>d`
2028
2026
  <div class="content-container">
2029
2027
  <primer-vault-empty-state
2030
- ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2028
+ ${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2031
2029
  ></primer-vault-empty-state>
2032
2030
  </div>
2033
- `,()=>c)}
2034
- ${w(!r&&e,()=>d`
2031
+ `,()=>p)}
2032
+ ${P(!r&&e,()=>d`
2035
2033
  <div class="content-container">
2036
- ${w(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2034
+ ${P(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2037
2035
  </div>
2038
- `,()=>c)}
2036
+ `,()=>p)}
2039
2037
  </div>
2040
2038
 
2041
- ${w(o,()=>this.renderLoadingOverlay(),()=>c)}
2039
+ ${P(o,()=>this.renderLoadingOverlay(),()=>p)}
2042
2040
  </div>
2043
- `}};K.styles=[S,Eo],s([v({context:qt,subscribe:!0}),l({type:Object,attribute:!1})],K.prototype,"vaultManagerContext",2),s([_()],K.prototype,"isEditMode",2),s([_()],K.prototype,"deletePaymentMethodId",2),s([_()],K.prototype,"isDeleting",2),s([_()],K.prototype,"errorMessage",2),s([l({type:Number})],K.prototype,"animationDuration",2),K=s([f("primer-vault-manager"),T()],K);var kn=wn({tagName:"primer-vault-manager",elementClass:K,react:Mn});export{ps as AchPayment,ns as Button,hs as CardForm,gs as CardFormSubmit,As as CardNetworkSelector,Pa as CheckoutState,ka as Collapsable,La as Dialog,Ds as DynamicPayment,Ra as ErrorMessage,Hs as ErrorMessageContainer,Va as Icon,Ba as Input,Ms as InputCardExpiry,Ss as InputCardHolderName,Is as InputCardNumber,$s as InputCvv,ja as InputError,Wa as InputLabel,Qa as InputWrapper,Bs as Klarna,js as NativePayment,Ws as PaymentMethod,es as Portal,_a as PrimerCheckout,Qs as PrimerCheckoutComplete,en as PrimerCheckoutError,an as PrimerMain,ln as RedirectPayment,cn as ShowOtherPayments,os as Spinner,kn as VaultManager};
2041
+ `}};F.styles=[E,po],s([g({context:Kt,subscribe:!0}),l({type:Object,attribute:!1})],F.prototype,"vaultManagerContext",2),s([C()],F.prototype,"isEditMode",2),s([C()],F.prototype,"deletePaymentMethodId",2),s([C()],F.prototype,"isDeleting",2),s([C()],F.prototype,"errorMessage",2),s([l({type:Number})],F.prototype,"animationDuration",2),F=s([u("primer-vault-manager"),M()],F);var an=rn({tagName:"primer-vault-manager",elementClass:F,react:on});export{Ka as AchPayment,za as Button,qa as CardForm,Za as CardFormSubmit,is as CardNetworkSelector,na as CheckoutState,pa as Collapsable,ha as Dialog,vs as DynamicPayment,ga as ErrorMessage,xs as ErrorMessageContainer,ba as Icon,_a as Input,ds as InputCardExpiry,ss as InputCardHolderName,fs as InputCardNumber,ms as InputCvv,wa as InputError,Ta as InputLabel,Ia as InputWrapper,_s as Klarna,ws as NativePayment,Ts as PaymentMethod,Oa as Portal,oa as PrimerCheckout,Is as PrimerCheckoutComplete,Os as PrimerCheckoutError,Ys as PrimerMain,zs as RedirectPayment,Ks as ShowOtherPayments,Ya as Spinner,an as VaultManager};
2044
2042
  /*! Bundled license information:
2045
2043
 
2046
2044
  @lit/context/lib/context-request-event.js:
2047
- (**
2048
- * @license
2049
- * Copyright 2021 Google LLC
2050
- * SPDX-License-Identifier: BSD-3-Clause
2051
- *)
2052
-
2053
2045
  @lit/context/lib/create-context.js:
2054
- (**
2055
- * @license
2056
- * Copyright 2021 Google LLC
2057
- * SPDX-License-Identifier: BSD-3-Clause
2058
- *)
2059
-
2060
2046
  @lit/context/lib/controllers/context-consumer.js:
2061
- (**
2062
- * @license
2063
- * Copyright 2021 Google LLC
2064
- * SPDX-License-Identifier: BSD-3-Clause
2065
- *)
2066
-
2067
2047
  @lit/context/lib/value-notifier.js:
2068
- (**
2069
- * @license
2070
- * Copyright 2021 Google LLC
2071
- * SPDX-License-Identifier: BSD-3-Clause
2072
- *)
2073
-
2074
2048
  @lit/context/lib/controllers/context-provider.js:
2075
- (**
2076
- * @license
2077
- * Copyright 2021 Google LLC
2078
- * SPDX-License-Identifier: BSD-3-Clause
2079
- *)
2080
-
2081
2049
  @lit/context/lib/context-root.js:
2082
- (**
2083
- * @license
2084
- * Copyright 2021 Google LLC
2085
- * SPDX-License-Identifier: BSD-3-Clause
2086
- *)
2087
-
2088
- @lit/context/lib/decorators/provide.js:
2089
- (**
2090
- * @license
2091
- * Copyright 2017 Google LLC
2092
- * SPDX-License-Identifier: BSD-3-Clause
2093
- *)
2094
-
2095
- @lit/context/lib/decorators/consume.js:
2096
- (**
2097
- * @license
2098
- * Copyright 2022 Google LLC
2099
- * SPDX-License-Identifier: BSD-3-Clause
2100
- *)
2101
-
2102
- @lit/reactive-element/css-tag.js:
2103
- (**
2104
- * @license
2105
- * Copyright 2019 Google LLC
2106
- * SPDX-License-Identifier: BSD-3-Clause
2107
- *)
2108
-
2109
- @lit/reactive-element/reactive-element.js:
2110
- (**
2111
- * @license
2112
- * Copyright 2017 Google LLC
2113
- * SPDX-License-Identifier: BSD-3-Clause
2114
- *)
2115
-
2116
- @lit/task/task.js:
2117
- (**
2118
- * @license
2119
- * Copyright 2017 Google LLC
2120
- * SPDX-License-Identifier: BSD-3-Clause
2121
- *)
2122
-
2123
2050
  @lit/localize/internal/locale-status-event.js:
2124
- (**
2125
- * @license
2126
- * Copyright 2021 Google LLC
2127
- * SPDX-License-Identifier: BSD-3-Clause
2128
- *)
2129
-
2130
2051
  @lit/localize/internal/str-tag.js:
2131
- (**
2132
- * @license
2133
- * Copyright 2021 Google LLC
2134
- * SPDX-License-Identifier: BSD-3-Clause
2135
- *)
2136
-
2137
2052
  @lit/localize/internal/types.js:
2138
- (**
2139
- * @license
2140
- * Copyright 2021 Google LLC
2141
- * SPDX-License-Identifier: BSD-3-Clause
2142
- *)
2143
-
2144
2053
  @lit/localize/internal/default-msg.js:
2145
- (**
2146
- * @license
2147
- * Copyright 2021 Google LLC
2148
- * SPDX-License-Identifier: BSD-3-Clause
2149
- *)
2150
-
2151
2054
  @lit/localize/internal/localized-controller.js:
2152
- (**
2153
- * @license
2154
- * Copyright 2021 Google LLC
2155
- * SPDX-License-Identifier: BSD-3-Clause
2156
- *)
2157
-
2158
2055
  @lit/localize/internal/localized-decorator.js:
2159
- (**
2160
- * @license
2161
- * Copyright 2021 Google LLC
2162
- * SPDX-License-Identifier: BSD-3-Clause
2163
- *)
2164
-
2165
- @lit/localize/internal/deferred.js:
2166
- (**
2167
- * @license
2168
- * Copyright 2020 Google LLC
2169
- * SPDX-License-Identifier: BSD-3-Clause
2170
- *)
2171
-
2172
- @lit/localize/internal/fnv1a64.js:
2173
- (**
2174
- * @license
2175
- * Copyright 2014 Travis Webb
2176
- * SPDX-License-Identifier: MIT
2177
- *)
2178
-
2179
- @lit/localize/internal/id-generation.js:
2180
- (**
2181
- * @license
2182
- * Copyright 2020 Google LLC
2183
- * SPDX-License-Identifier: BSD-3-Clause
2184
- *)
2185
-
2186
2056
  @lit/localize/internal/runtime-msg.js:
2187
- (**
2188
- * @license
2189
- * Copyright 2021 Google LLC
2190
- * SPDX-License-Identifier: BSD-3-Clause
2191
- *)
2192
-
2193
2057
  @lit/localize/init/runtime.js:
2194
- (**
2195
- * @license
2196
- * Copyright 2021 Google LLC
2197
- * SPDX-License-Identifier: BSD-3-Clause
2198
- *)
2199
-
2200
2058
  @lit/localize/init/transform.js:
2059
+ @lit/reactive-element/decorators/query-assigned-elements.js:
2060
+ lit-html/directives/when.js:
2201
2061
  (**
2202
2062
  * @license
2203
2063
  * Copyright 2021 Google LLC
2204
2064
  * SPDX-License-Identifier: BSD-3-Clause
2205
2065
  *)
2206
2066
 
2207
- @lit/localize/lit-localize.js:
2208
- (**
2209
- * @license
2210
- * Copyright 2020 Google LLC
2211
- * SPDX-License-Identifier: BSD-3-Clause
2212
- *)
2213
-
2067
+ @lit/context/lib/decorators/provide.js:
2068
+ @lit/reactive-element/reactive-element.js:
2069
+ @lit/task/task.js:
2070
+ @lit/reactive-element/reactive-element.js:
2214
2071
  lit-html/lit-html.js:
2215
- (**
2216
- * @license
2217
- * Copyright 2017 Google LLC
2218
- * SPDX-License-Identifier: BSD-3-Clause
2219
- *)
2220
-
2221
2072
  lit-element/lit-element.js:
2222
- (**
2223
- * @license
2224
- * Copyright 2017 Google LLC
2225
- * SPDX-License-Identifier: BSD-3-Clause
2226
- *)
2227
-
2228
- lit-html/is-server.js:
2229
- (**
2230
- * @license
2231
- * Copyright 2022 Google LLC
2232
- * SPDX-License-Identifier: BSD-3-Clause
2233
- *)
2234
-
2235
2073
  @lit/reactive-element/decorators/custom-element.js:
2236
- (**
2237
- * @license
2238
- * Copyright 2017 Google LLC
2239
- * SPDX-License-Identifier: BSD-3-Clause
2240
- *)
2241
-
2242
2074
  @lit/reactive-element/decorators/property.js:
2243
- (**
2244
- * @license
2245
- * Copyright 2017 Google LLC
2246
- * SPDX-License-Identifier: BSD-3-Clause
2247
- *)
2248
-
2249
2075
  @lit/reactive-element/decorators/state.js:
2250
- (**
2251
- * @license
2252
- * Copyright 2017 Google LLC
2253
- * SPDX-License-Identifier: BSD-3-Clause
2254
- *)
2255
-
2256
2076
  @lit/reactive-element/decorators/event-options.js:
2257
- (**
2258
- * @license
2259
- * Copyright 2017 Google LLC
2260
- * SPDX-License-Identifier: BSD-3-Clause
2261
- *)
2262
-
2263
2077
  @lit/reactive-element/decorators/base.js:
2264
- (**
2265
- * @license
2266
- * Copyright 2017 Google LLC
2267
- * SPDX-License-Identifier: BSD-3-Clause
2268
- *)
2269
-
2270
2078
  @lit/reactive-element/decorators/query.js:
2271
- (**
2272
- * @license
2273
- * Copyright 2017 Google LLC
2274
- * SPDX-License-Identifier: BSD-3-Clause
2275
- *)
2276
-
2277
2079
  @lit/reactive-element/decorators/query-all.js:
2278
- (**
2279
- * @license
2280
- * Copyright 2017 Google LLC
2281
- * SPDX-License-Identifier: BSD-3-Clause
2282
- *)
2283
-
2284
2080
  @lit/reactive-element/decorators/query-async.js:
2285
- (**
2286
- * @license
2287
- * Copyright 2017 Google LLC
2288
- * SPDX-License-Identifier: BSD-3-Clause
2289
- *)
2290
-
2291
- @lit/reactive-element/decorators/query-assigned-elements.js:
2292
- (**
2293
- * @license
2294
- * Copyright 2021 Google LLC
2295
- * SPDX-License-Identifier: BSD-3-Clause
2296
- *)
2297
-
2298
2081
  @lit/reactive-element/decorators/query-assigned-nodes.js:
2299
- (**
2300
- * @license
2301
- * Copyright 2017 Google LLC
2302
- * SPDX-License-Identifier: BSD-3-Clause
2303
- *)
2304
-
2305
- lit-html/directives/when.js:
2306
- (**
2307
- * @license
2308
- * Copyright 2021 Google LLC
2309
- * SPDX-License-Identifier: BSD-3-Clause
2310
- *)
2311
-
2312
2082
  lit-html/directive.js:
2083
+ lit-html/async-directive.js:
2313
2084
  (**
2314
2085
  * @license
2315
2086
  * Copyright 2017 Google LLC
2316
2087
  * SPDX-License-Identifier: BSD-3-Clause
2317
2088
  *)
2318
2089
 
2319
- lit-html/directives/class-map.js:
2320
- (**
2321
- * @license
2322
- * Copyright 2018 Google LLC
2323
- * SPDX-License-Identifier: BSD-3-Clause
2324
- *)
2325
-
2326
- lit-html/directive-helpers.js:
2090
+ @lit/context/lib/decorators/consume.js:
2091
+ lit-html/is-server.js:
2327
2092
  (**
2328
2093
  * @license
2329
- * Copyright 2020 Google LLC
2094
+ * Copyright 2022 Google LLC
2330
2095
  * SPDX-License-Identifier: BSD-3-Clause
2331
2096
  *)
2332
2097
 
2333
- lit-html/async-directive.js:
2098
+ @lit/reactive-element/css-tag.js:
2099
+ @lit/reactive-element/css-tag.js:
2334
2100
  (**
2335
2101
  * @license
2336
- * Copyright 2017 Google LLC
2102
+ * Copyright 2019 Google LLC
2337
2103
  * SPDX-License-Identifier: BSD-3-Clause
2338
2104
  *)
2339
2105
 
2106
+ @lit/localize/internal/deferred.js:
2107
+ @lit/localize/internal/id-generation.js:
2108
+ @lit/localize/lit-localize.js:
2109
+ lit-html/directive-helpers.js:
2340
2110
  lit-html/directives/ref.js:
2341
2111
  (**
2342
2112
  * @license
@@ -2344,31 +2114,17 @@ lit-html/directives/ref.js:
2344
2114
  * SPDX-License-Identifier: BSD-3-Clause
2345
2115
  *)
2346
2116
 
2347
- lit-html/lit-html.js:
2348
- (**
2349
- * @license
2350
- * Copyright 2017 Google LLC
2351
- * SPDX-License-Identifier: BSD-3-Clause
2352
- *)
2353
-
2354
- lit-html/directive.js:
2355
- (**
2356
- * @license
2357
- * Copyright 2017 Google LLC
2358
- * SPDX-License-Identifier: BSD-3-Clause
2359
- *)
2360
-
2361
- lit-html/directive-helpers.js:
2117
+ @lit/localize/internal/fnv1a64.js:
2362
2118
  (**
2363
2119
  * @license
2364
- * Copyright 2020 Google LLC
2365
- * SPDX-License-Identifier: BSD-3-Clause
2120
+ * Copyright 2014 Travis Webb
2121
+ * SPDX-License-Identifier: MIT
2366
2122
  *)
2367
2123
 
2368
- lit-html/async-directive.js:
2124
+ lit-html/directives/class-map.js:
2369
2125
  (**
2370
2126
  * @license
2371
- * Copyright 2017 Google LLC
2127
+ * Copyright 2018 Google LLC
2372
2128
  * SPDX-License-Identifier: BSD-3-Clause
2373
2129
  *)
2374
2130
  */