@primer-io/primer-js 0.1.5 → 0.1.6

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,7 +1,7 @@
1
- import{a as $o,b as _s,c as Ro,d as s}from"./chunks/chunk.G45OCYEN.js";var Zi=_s((tr,Wi)=>{(function(i,e){typeof tr=="object"&&typeof Wi=="object"?Wi.exports=e():typeof define=="function"&&define.amd?define([],e):typeof tr=="object"?tr.Primer=e():i.Primer=e()})(tr,()=>(()=>{"use strict";let i;var e,t,r={};r.d=(a,d)=>{for(var m in d)r.o(d,m)&&!r.o(a,m)&&Object.defineProperty(a,m,{enumerable:!0,get:d[m]})},r.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>ys,PaymentFlow:()=>hs,ThreeDSecureStatus:()=>gs,TokenType:()=>fs,isStripeOptionsDropInWithFullMandateText:()=>bs,PaymentInstrumentType:()=>$t,ErrorCode:()=>vs,EventTypes:()=>Es,CheckoutUXFlow:()=>us,HeadlessManagerType:()=>Cs,PaymentMethodType:()=>Rt,Primer:()=>xs});let n={LEGACY:"legacy",V_2_4:"2.4"},l=n.V_2_4,g=l;class u extends Error{static from(d,m=!1){if(d instanceof u)return d;let C=new u(d instanceof Error?d.message:String(d),m);return d instanceof Error&&d.stack&&(C.stack=d.stack,Object.assign(C,d)),C}markAsReported(){this.isReported=!0}constructor(d,m=!1){super(d),function(C,M,x){M in C?Object.defineProperty(C,M,{value:x,enumerable:!0,configurable:!0,writable:!0}):C[M]=x}(this,"isReported",void 0),this.isReported=m,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let S="https://analytics.production.data.primer.io/sdk-logs";var k=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),_=function(a){return a.START="START",a.END="END",a}({});let V={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var Y=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function he(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let On={get(a,d){let m;try{switch(a){case"PRIMER_SDK_VERSION":m="v2.53.5";break;case"PRIMER_ASSETS_URL":m=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":m=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return m||d}}.get("PRIMER_SDK_VERSION");async function ao(a,d,m){return{...m,createdAt:Date.now(),device:await he(),eventType:a,properties:d,sdkVersion:On,sdkType:"WEB"}}let no=Symbol.for("__primerAnalytics__"),It={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[no];a?It=a:window[no]=It}let so=()=>It.providers,ci=()=>It.timers,Nt=()=>It.eventsQueue,cr=new Map;function mi(a,d=!1,m=1){cr.has(a)&&(clearTimeout(cr.get(a)),cr.delete(a));let C=()=>{let x=Nt().get(a);if(x?.length){let E=!0,T=[],O=0,P=0;for(;P<x.length;){let H=x[P],z=new Blob([JSON.stringify(H)]).size;if(z>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",H),P++;continue}if(O+z>64e3&&T.length>0){try{E=navigator.sendBeacon(a,JSON.stringify(T))}catch(B){E=!1,console.error("Unable to send events",B)}if(!E)break;T=[],O=0}T.push(H),O+=z,P++}if(T.length>0&&E)try{E=navigator.sendBeacon(a,JSON.stringify(T))}catch(H){E=!1,console.error("Unable to send events",H)}E?Nt().delete(a):m<5?setTimeout(()=>mi(a,d,m+1),500*Math.pow(2,m)):console.error("Max retry attempts reached. Events will not be sent.")}};if(d)return void C();let M=setTimeout(C,500);cr.set(a,M)}let lo=!1;function ui({url:a=S,...d}){typeof document>"u"||lo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let M=mt(d.checkoutSessionId);M.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),mi(M.url,!0)}}),lo=!0);let m=M=>async x=>{if(typeof navigator>"u")return;let E=function O(P,H,z=new WeakSet,B=0,ne=10){if(B>ne||z.has(P))return P;z.add(P);let se=oe=>typeof oe=="object"&&oe!==null?O(oe,H,z,B+1,ne):H(oe);return Array.isArray(P)?P.map(se):Object.fromEntries(Object.entries(P).map(([oe,ht])=>[oe,se(ht)]))}(await ao(M,x,d),O=>{var P;return typeof(P=typeof O=="function"?O.name||"function":O)=="string"&&P.length>5120?`${P.slice(0,5120)}...`:P});Nt().has(a)||Nt().set(a,[]),Nt().get(a)?.push(E),mi(a)},C={crashEvent:m(Y.CRASH_EVENT),messageEvent:m(Y.MESSAGE_EVENT),networkCallEvent:m(Y.NETWORK_CALL_EVENT),sdkFunctionEvent:m(Y.SDK_FUNCTION_EVENT),timerStart:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,T=performance?.now?performance.now():Date.now();return ci().set(E,{start:T}),m(Y.TIMER_EVENT)({...x,id:M,timerType:_.START})},timerEnd:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,{start:T}=ci().get(E)??{};ci().delete(E);let O=performance?.now?performance.now():Date.now();return m(Y.TIMER_EVENT)({...x,id:M,timerType:_.END,duration:T?O-T:void 0})},v1Event:m(Y.V1_EVENT),url:a};return so().set(d.checkoutSessionId,C),mt(d.checkoutSessionId)}function mt(a){return new Proxy({},{get:(d,m)=>(so().get(a)??ui({checkoutSessionId:a}))[m]})}let hi=(a,d,m,C)=>({callType:m?k.REQUEST_END:k.REQUEST_START,id:a,errorBody:m?.error&&JSON.stringify(m.error,Object.getOwnPropertyNames(m.error)),method:d.method,responseCode:m?.status,url:d.url,duration:C});function Dn(a){return a?new Promise(d=>{setTimeout(d,a)}):Promise.resolve()}async function po(a,d,m,C=Dn){let M=0,x={enabled:d?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let E=await a();if(M){let T=`Request succeeded after ${M} retries.`;typeof E=="object"&&E&&"status"in E&&(T+=` Status code: ${E.status}`),m?.({messageType:"RETRY_SUCCESS",message:T,severity:"INFO"})}return E}catch(E){let T=M>=x.maxRetries,O=E.isNetworkError&&!x.retryNetworkErrors,P=E.status&&E.status>=500&&!x.retry500Errors;if(T||O||P){let B=`Failed after ${M} retries. `;throw T?B+=`Reached maximum retries (${x.maxRetries}).`:O?B+="Network error encountered and retryNetworkErrors is disabled.":P&&(B+="HTTP 500 error encountered and retry500Errors is disabled."),B+=` Last error: ${E.message}`,m?.({messageType:"RETRY_FAILED",message:B,severity:"ERROR",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),Error(B,{cause:E})}M++;let H=Math.min(x.initialBackoff*Math.pow(2,M-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),z="Unknown error";E.isNetworkError?z="Network error":E.status&&(z=`HTTP ${E.status} error`),m?.({messageType:"RETRY",message:`Retry attempt ${M}/${x.maxRetries} due to: ${z}. Error details: ${E.message}. Waiting for ${H.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),await C(H)}}let gi={cache:new Map};typeof window<"u"&&((e=window)[t="__primerCache__"]??(e[t]=gi),gi=window.__primerCache__);let ie=()=>gi.cache;function co(){if(ie().size<=30)return;let a=Date.now();for(let[d,m]of ie())m.exp<a&&ie().delete(d);if(ie().size>50)for(let[d]of ie()){if(ie().size<=50)break;ie().delete(d)}}let fi=()=>mo.randomUUID?.()||Vn(),Vn=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Hn()>>a/4).toString(16)),Hn=()=>(mo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,mo=typeof crypto<"u"?crypto:{},Un=(a,d,m)=>Yn(a,"get",d,m),Yn=async(a,d,m,C,M)=>{let x=fi(),E=performance?.now(),T=mt(a),O={method:d,url:m,body:M};T.networkCallEvent(hi(x,O));try{let P=await fetch(m,{body:M,method:d,headers:{"content-type":"application/json","x-request-id":x,...C}});if(!P.ok){let B=Error(`HTTP error! status: ${P.status}`);throw B.status=P.status,B}let H=await P.json();if(m.includes("client-sdk/configuration")){let{primerAccountId:B,clientSession:{clientSessionId:ne,customer:se}}=H;T=ui({checkoutSessionId:a,clientSessionId:ne,customerId:se?.customerId,primerAccountId:B,url:T.url})}let z=performance?.now();return T.networkCallEvent(hi(x,O,{data:H},z-E)),{data:H,headers:P.headers,status:P.status,source:"NETWORK"}}catch(P){let H=performance?.now();throw Object.assign(P,{isNetworkError:P instanceof TypeError}),T.networkCallEvent(hi(x,O,{error:P},H-E)),P}},zn=(a,d)=>new Promise((m,C)=>{let M=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,C(x)},d);a.then(m).catch(C).finally(()=>clearTimeout(M))}),Fn=(a,d)=>{let{headers:m,retryConfig:C,cacheConfig:M,timeout:x=15e3,checkoutSessionId:E}=d,T=mt(E);return function(O){if(!O)return ne=>ne();let{key:P,refresh:H=!1,usePrimerSessionCacheTtlHeader:z=!1,ttl:B=36e5}=O;return async ne=>{let se=Date.now(),oe=ie().get(P);if(!H&&oe&&oe.exp>se)return oe.promise;oe&&ie().delete(P);let ht=ne().then(Ot=>{let Io=B;return z&&(Io=1e3*(Number(Ot.headers.get("x-primer-session-cache-ttl"))||0)),function({key:No,ttl:Lo=36e5},As){Lo?ie().set(No,{promise:Promise.resolve({...As,source:"CACHE"}),exp:Date.now()+Lo}):ie().delete(No)}({key:P,ttl:Io},Ot),co(),Ot},Ot=>{throw ie().delete(P),Ot});return ie().set(P,{promise:ht,exp:se+B}),co(),ht}}(M)(()=>po(()=>zn(Un(E,a,m),x),C,O=>T.messageEvent({...O,url:a})))},ut=typeof Buffer=="function",uo=typeof TextDecoder=="function"?new TextDecoder:void 0,ho=typeof TextEncoder=="function"?new TextEncoder:void 0,Lt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),mr=(a=>{let d={};return a.forEach((m,C)=>d[m]=C),d})(Lt),Bn=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,G=String.fromCharCode.bind(String),go=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),fo=a=>a.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),vo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),yo=typeof btoa=="function"?a=>btoa(a):ut?a=>Buffer.from(a,"binary").toString("base64"):a=>{let d,m,C,M,x="",E=a.length%3;for(let T=0;T<a.length;){if((m=a.charCodeAt(T++))>255||(C=a.charCodeAt(T++))>255||(M=a.charCodeAt(T++))>255)throw TypeError("invalid character found");x+=Lt[(d=m<<16|C<<8|M)>>18&63]+Lt[d>>12&63]+Lt[d>>6&63]+Lt[63&d]}return E?x.slice(0,E-3)+"===".substring(E):x},vi=ut?a=>Buffer.from(a).toString("base64"):a=>{let d=[];for(let m=0,C=a.length;m<C;m+=4096)d.push(G.apply(null,a.subarray(m,m+4096)));return yo(d.join(""))},Pl=(a,d=!1)=>d?fo(vi(a)):vi(a),Kn=a=>{if(a.length<2){var d=a.charCodeAt(0);return d<128?a:d<2048?G(192|d>>>6)+G(128|63&d):G(224|d>>>12&15)+G(128|d>>>6&63)+G(128|63&d)}var d=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return G(240|d>>>18&7)+G(128|d>>>12&63)+G(128|d>>>6&63)+G(128|63&d)},jn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gn=a=>a.replace(jn,Kn),bo=ut?a=>Buffer.from(a,"utf8").toString("base64"):ho?a=>vi(ho.encode(a)):a=>yo(Gn(a)),qn=(a,d=!1)=>d?fo(bo(a)):bo(a),Wn=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Zn=a=>{switch(a.length){case 4:var d=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return G((d>>>10)+55296)+G((1023&d)+56320);case 3:return G((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return G((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Xn=a=>a.replace(Wn,Zn),Eo=typeof atob=="function"?a=>atob(vo(a)):ut?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Bn.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let d,m="",C,M;for(let x=0;x<a.length;)d=mr[a.charAt(x++)]<<18|mr[a.charAt(x++)]<<12|(C=mr[a.charAt(x++)])<<6|(M=mr[a.charAt(x++)]),m+=C===64?G(d>>16&255):M===64?G(d>>16&255,d>>8&255):G(d>>16&255,d>>8&255,255&d);return m},Co=ut?a=>go(Buffer.from(a,"base64")):a=>go(Eo(a).split("").map(d=>d.charCodeAt(0))),wl=a=>Co(xo(a)),Jn=ut?a=>Buffer.from(a,"base64").toString("utf8"):uo?a=>uo.decode(Co(a)):a=>Xn(Eo(a)),xo=a=>vo(a.replace(/[-_]/g,d=>d=="-"?"+":"/")),Qn=a=>Jn(xo(a)),kl=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Ao={encode:qn,decode:Qn},es={encode:function(a,d={}){let{urlSafe:m=!1}=d;return Ao.encode(a,m)},decode:Ao.decode},_o="The provided `clientToken`",ts=`${_o} has expired`,rs=`${_o} is malformed`,is=(a,d,m)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.5","primer-sdk-checkout-session-id":d,...m&&{"x-api-version":m}});async function os(a,d,m){let{accessToken:C,configurationUrl:M,analyticsUrlV2:x}=function(P){let H=function(B){try{let[ne,se]=B.split(".");return JSON.parse(es.decode(se||ne))}catch{throw Error(rs)}}(P),z=1e3*H.exp;if(Date.now()>z)throw Error(`${ts}. Expiration date: ${new Date(z).toISOString()}`);return H}(a),E=ui({checkoutSessionId:d,url:x}),T=g,O=T!==n.LEGACY?T:"2.3";E.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:P,source:H}=await Fn(`${M}/?withDisplayMetadata=true`,{checkoutSessionId:d,headers:is(C,d,O),retryConfig:{enabled:!0},cacheConfig:m});return E.timerEnd({id:"CONFIGURATION_LOADING",context:{source:H}}),P}catch(P){let H=P instanceof Error?P.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${H}`)}}function So(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function ur({checkoutSessionId:a,analytics:d,error:m,reporter:C}){d?.crashEvent?d.crashEvent({...So(m),reporter:C}):a&&yi(a,m,C)}async function yi(a,d,m){let C=await ao(Y.CRASH_EVENT,{...So(d),reporter:m},{checkoutSessionId:a});try{await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})}catch(M){console.error("Failed to post crash event",M)}}let Mo=Symbol.for("initGlobalErrorMonitoringLoaded"),To=(a,d)=>{typeof window<"u"&&window[Mo]||(window[Mo]=!0,window.addEventListener("error",m=>{!as(m)&&ns(m)&&ur({checkoutSessionId:a,analytics:d,error:m.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",m=>{let C=m.reason||Error("Unhandled promise rejection");ss(C)&&ur({checkoutSessionId:a,analytics:d,error:C,reporter:"unhandledrejection"})}))},as=a=>a.message==="Script error."||!a.filename||a.lineno===0,ns=a=>{let d=a.filename;return!!(d&&bi(d))&&!!new u(a.error).isReported||!1},ss=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let d=u.from(a);return!d.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&bi(a.fileName))||ls(d.stack).some(bi))}return!1},bi=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},ls=a=>{if(!a)return[];let d=a.split(`
2
- `),m=[],C=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let M of d){let x=M.match(C);if(x&&x[1])m.push(x[1]);else{let E=/@(.*?):\d+:\d+$/,T=M.match(E);T&&T[1]&&m.push(T[1])}}return m};function Po(a,d,m){return document.querySelector(`${a}[${d}^="${m}"]`)}async function wo(a,d,m,C,M,x){let{analytics:E,name:T=d,retryConfig:O}=x;await po(()=>new Promise((P,H)=>{let z=Po(a,m,d)||function(B,ne){let se=document.createElement(B);return Object.entries(ne).forEach(([oe,ht])=>se.setAttribute(oe,ht)),se}(a,{...C,[m]:d});z.onload=()=>{E?.sdkFunctionEvent({name:T,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${d}`]}),P()},z.onerror=()=>{z.remove(),H(Error(`${M}: ${d}`))},z.parentNode||document.head.appendChild(z)}),O,P=>E?.messageEvent({...P,url:d}))}async function ko(a){return i||(i=Promise.all([function(d,m={}){return Po("script","src",d)&&window.__Primer?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Script already loaded"]}),Promise.resolve()):wo("script",d,"src",{...m.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",m)}("https://sdk.primer.io/web/v2.53.5/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(d,m={}){return Array.from(document.styleSheets).some(C=>C.href===d)?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Stylesheet already loaded"]}),Promise.resolve()):wo("link",d,"href",{...m.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",m)}("https://sdk.primer.io/web/v2.53.5/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let d=window.__Primer;return delete window.__Primer,d}).catch(d=>{throw i=void 0,d}))}let ds=async()=>{let a=fi();try{let d=mt(a);try{To(a,d),d.sdkFunctionEvent({name:"preloadPrimer"}),d.timerStart({id:V.preloadPrimer}),await ko(d),d.timerEnd({id:V.preloadPrimer})}catch(m){let C=u.from(m);throw C.isReported||(ur({checkoutSessionId:a,analytics:d,error:C,reporter:"preloadPrimer level 1"}),C.markAsReported()),C}}catch(d){let m=u.from(d);throw m.isReported||(yi(a,m,"preloadPrimer level 0"),m.markAsReported()),m}},ps=Ei("createHeadless"),cs=Ei("showUniversalCheckout"),ms=Ei("showVaultManager");function Ei(a){return async(...[d,m,...C])=>{var M;(M=m?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${l}'.`),g=M??l;let x=fi();try{let E=mt(x);try{To(x,E),E.sdkFunctionEvent({name:a,params:[d,m,...C]}),E.timerStart({id:V[a]});let[T,O]=await Promise.all([os(d,x,m?.clientSessionCachingEnabled?{key:d,usePrimerSessionCacheTtlHeader:!0}:void 0),ko(E)]);return O[a](T,x,d,m,...C)}catch(T){let O=u.from(T);throw O.isReported||(ur({checkoutSessionId:x,analytics:E,error:O,reporter:"lazyLoad level 1"}),O.markAsReported()),O}}catch(E){let T=u.from(E);throw T.isReported||(yi(x,T,"lazyLoad level 0"),T.markAsReported()),T}}}var us=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),hs=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),gs=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let $t={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"},Rt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},fs={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};$t.PAYPAL_VAULTED,Rt.PAYPAL,$t.KLARNA_CUSTOMER_TOKEN,Rt.KLARNA,$t.AUTOMATED_CLEARING_HOUSE,Rt.STRIPE_ACH,$t.CARD,Rt.PAYMENT_CARD;var vs=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function hr(a,d,m){return d in a?Object.defineProperty(a,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):a[d]=m,a}class Ci extends u{static fromErrorCode(d,m){return new Ci(d,m)}constructor(d,m){super(m.message),hr(this,"code",void 0),hr(this,"diagnosticsId",void 0),hr(this,"data",void 0),hr(this,"isFromDeveloper",void 0),this.code=d,this.diagnosticsId=m.diagnosticsId??null,this.data=m.data,this.isFromDeveloper=m.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Ci)}}var ys=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let bs=a=>{let d=a?.mandateData;return!!d&&"fullMandateText"in d};var Es=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),Cs=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let xs={SDK_VERSION:"v2.53.5",createHeadless:ps,showUniversalCheckout:cs,showVaultManager:ms,preloadPrimer:ds};return o})())});var gr=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}setCardNetworksLoading(){let e={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(e)}updateCardNetworksState(e){this.host.primerEventsController.dispatchCardNetworkChange(e),this.host.sdkContextController.setCardNetworks(e)}async processCardNetworkChangeEvent(e){let{detectedCardNetworks:t,selectableCardNetworks:r}=e,o=t.preferred??t.items[0],n=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:n,isLoading:!1})}};var gt=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}dispatchEvent(e,t){this.host.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}dispatchSdkState(e){this.dispatchEvent("primer-state-changed",e)}dispatchPaymentMethods(e){this.dispatchEvent("primer-payment-methods-updated",e)}dispatchCheckoutInitialized(e){this.dispatchEvent("primer-checkout-initialized",e)}dispatchCardNetworkChange(e){this.dispatchEvent("primer-card-network-change",e)}dispatchFormSubmitSuccess(e){this.dispatchEvent("primer-card-submit-success",{result:e})}dispatchFormSubmitErrors(e){this.dispatchEvent("primer-card-submit-errors",{errors:e})}};var Ne=class extends Event{constructor(e,t,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=o??!1}};var ft=class{constructor(e,t,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,l)),this.unsubscribe=l},this.host=e,t.context!==void 0){let n=t;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ne(this.context,this.host,this.t,this.subscribe))}};var fr=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:o}=this.subscriptions.get(e);e(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var xi=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},q=class extends fr{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let n=o.contextTarget??o.composedPath()[0];n!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,n,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let n=new Set;for(let[l,{consumerHost:g}]of this.subscriptions)n.has(l)||(n.add(l),g.dispatchEvent(new Ne(this.context,g,l,!0)));o.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new xi(this.context,this.host))}};function b({context:i,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new ft(this,{context:i,callback:o=>{t.set.call(this,o)},subscribe:e})}):t.constructor.addInitializer(o=>{new ft(o,{context:i,callback:n=>{o[r]=n},subscribe:e})})}}var vr="cardNetworksContext";var Le="clientOptionsContext";var $e="computedStylesContext";var W="headlessInstanceContext";var yr="klarnaCategoriesContext";var J="managerContext";var vt="paymentMethodsContext";var j="sdkStateContext";var Q="vaultManagerContext";var Re="vaultManagerCvvContext";var N=class N{static log(e,...t){N.enabled&&console.log(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.log,...t)}static info(e,...t){N.enabled&&console.info(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.info,...t)}static warn(e,...t){N.enabled&&console.warn(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.warn,...t)}static error(e,...t){N.enabled&&console.error(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.error,...t)}static debug(e,...t){N.enabled&&console.debug(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.debug,...t)}static table(e,t){N.enabled&&console.table(e,t)}static time(e){N.enabled&&console.time(`${N.brandTag} ${e}`)}static timeEnd(e){N.enabled&&console.timeEnd(`${N.brandTag} ${e}`)}};N.enabled=!0,N.defaultFont="font-family: Consolas, monospace; font-size: 12px;",N.brandTag="[PRIMER]",N.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+N.defaultFont,N.styles={log:"color: #4CAF50; "+N.defaultFont,info:"color: #2196F3; "+N.defaultFont,warn:"color: #FF9800; "+N.defaultFont,error:"color: #F44336; "+N.defaultFont,debug:"color: #9C27B0; "+N.defaultFont};var R=N;function Ss(i,e,t,r){let o=i,n=t;return{dispatch:l=>{let g=e(o,l,n);o=g,r(g)},getState:()=>Object.freeze({...o}),setCallbacks:l=>{n={...n,...l}}}}function Dt(i){return(e,t,r)=>{let o=i[t.type];if(!o)throw new Error(`No handler for action type: ${t.type}`);return o(e,t,r)}}var We=class{constructor(e,t,r,o,n=()=>{this.host.requestUpdate()}){this.host=e;this.stateHandler=n;this.host.addController(this),this._dispatcher=Ss(t,r,o,l=>{this.stateHandler(l)})}get currentState(){return this._dispatcher.getState()}dispatch(e){this._dispatcher.dispatch(e)}setCallbacks(e){this._dispatcher.setCallbacks(e)}hostConnected(){}hostDisconnected(){}},br=class{constructor(e){this.host=e;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(e){this._controllers.push(e)}hostConnected(){this._controllers.forEach(e=>{e.hostConnected&&e.hostConnected()})}hostDisconnected(){this._controllers.forEach(e=>{e.hostDisconnected&&e.hostDisconnected()})}};var Cr={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Ms={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,e)=>(R.error(e.payload.message),{...i,isProcessing:!1,error:e.payload}),SET_FAILURE:(i,e)=>({...i,isProcessing:!1,failure:e.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Cr,RESET_ERROR:i=>({...i,error:null,failure:null})},Ts=Dt(Ms),Er=class extends We{constructor(e){super(e,Cr,Ts,null,t=>{e.sdkContextController.setSdkState(t),e.primerEventsController.dispatchSdkState(t)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}setFailure(e,t,r){this.dispatch({type:"SET_FAILURE",payload:{code:e,message:t,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(R.warn("Force completing loading state"),this.completeLoading())}};var xr=class{constructor(e){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=e).addController(this),this.sdkStateProvider=new q(e,{context:j,initialValue:Cr}),this.paymentMethodsProvider=new q(e,{context:vt,initialValue:null}),this.paymentManagerProvider=new q(e,{context:J,initialValue:new Map}),this.cardNetworksContext=new q(e,{context:vr,initialValue:null}),this.vaultManagerProvider=new q(e,{context:Q,initialValue:null}),this.vaultManagerCvvProvider=new q(e,{context:Re,initialValue:null}),this.clientOptionsContext=new q(e,{context:Le,initialValue:null}),this.klarnaCategoriesProvider=new q(e,{context:yr,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new q(e,{context:W,initialValue:null}),this.computedStylesProvider=new q(e,{context:$e,initialValue:null})}hostConnected(){}setSdkState(e){this.sdkStateProvider?.setValue(e)}setPaymentMethods(e){this.paymentMethodsProvider?.setValue(e)}setPaymentManagers(e){this.paymentManagerProvider?.setValue(e)}setCardNetworks(e){this.cardNetworksContext?.setValue(e)}setVaultManager(e){this.vaultManagerProvider?.setValue(e)}setKlarnaCategories(e){this.klarnaCategoriesProvider?.setValue(e)}setClientOptions(e){this.clientOptionsContext?.setValue(e)}setHeadlessUtils(e){this.headlessUtilsProvider?.setValue(e)}setComputedStyles(e){this.computedStylesProvider?.setValue(e)}setVaultManagerCvv(e){this.vaultManagerCvvProvider?.setValue(e)}};var Ze=class Ze{constructor(e){(this.host=e).addController(this)}processCustomStyles(e){try{let t=JSON.parse(e);this.applyStyles(t)}catch(t){R.error("Error parsing customStyles property.",t instanceof Error?t:new Error(String(t)))}}isValidCssProperty(e){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)}isValidCssValue(e){let r=/^[\w\s#.,%()\-+/!]+$/.test(e);return r||R.warn(`Rejected potentially unsafe CSS value: ${e}`),r}getCssVarName(e){let t=Ze.cssVarCache.get(e);return t||(t="--"+e.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ze.cssVarCache.set(e,t)),t}applyStyles(e){let t=[];for(let r of Object.keys(e)){let o=e[r];if(!o)continue;if(!this.isValidCssProperty(r)){R.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let n=this.getCssVarName(r);t.push([n,o])}if(t.length>0)for(let[r,o]of t)this.host.style.setProperty(r,o)}removeStyle(e){let t=this.getCssVarName(e);this.host.style.removeProperty(t)}clearAllStyles(){for(let e of Ze.cssVarCache.keys()){let t=Ze.cssVarCache.get(e);t&&this.host.style.removeProperty(t)}}hostDisconnected(){}};Ze.cssVarCache=new Map;var Ar=Ze;var _r=globalThis,Sr=_r.ShadowRoot&&(_r.ShadyCSS===void 0||_r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ai=Symbol(),Oo=new WeakMap,Vt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ai)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Sr&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Oo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Oo.set(t,e))}return e}toString(){return this.cssText}},Do=i=>new Vt(typeof i=="string"?i:i+"",void 0,Ai),f=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,o,n)=>r+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[n+1],i[0]);return new Vt(t,i,Ai)},_i=(i,e)=>{if(Sr)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=_r.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,i.appendChild(r)}},Mr=Sr?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Do(t)})(i):i;var{is:Ps,defineProperty:ws,getOwnPropertyDescriptor:ks,getOwnPropertyNames:Is,getOwnPropertySymbols:Ns,getPrototypeOf:Ls}=Object,Oe=globalThis,Vo=Oe.trustedTypes,$s=Vo?Vo.emptyScript:"",Rs=Oe.reactiveElementPolyfillSupport,Ht=(i,e)=>i,Ut={toAttribute(i,e){switch(e){case Boolean:i=i?$s:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},yt=(i,e)=>!Ps(i,e),Ho={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Oe.litPropertyMetadata??(Oe.litPropertyMetadata=new WeakMap);var Ce=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ho){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,t);o!==void 0&&ws(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:n}=ks(this.prototype,e)??{get(){return this[t]},set(l){this[t]=l}};return{get(){return o?.call(this)},set(l){let g=o?.call(this);n.call(this,l),this.requestUpdate(e,g,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ho}static _$Ei(){if(this.hasOwnProperty(Ht("elementProperties")))return;let e=Ls(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,r=[...Is(t),...Ns(t)];for(let o of r)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,o]of t)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let o=this._$Eu(t,r);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(Mr(o))}else e!==void 0&&t.push(Mr(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _i(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Ut).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let n=r.getPropertyOptions(o),l=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Ut;this._$Em=o,this[o]=l.fromAttribute(t,n.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??yt)(this[e],t))return;this.P(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,n]of r)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}};Ce.elementStyles=[],Ce.shadowRootOptions={mode:"open"},Ce[Ht("elementProperties")]=new Map,Ce[Ht("finalized")]=new Map,Rs?.({ReactiveElement:Ce}),(Oe.reactiveElementVersions??(Oe.reactiveElementVersions=[])).push("2.0.4");var De={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},L=Symbol(),D=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((e,t)=>{this.o=e,this.h=t}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(e,t,r){this.p=0,this.i=0,(this._=e).addController(this);let o=typeof t=="object"?t:{task:t,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Uo,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let e=this.j();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async S(){let e=this.T(),t=this.O;this.O=e,e===t||e===void 0||t!==void 0&&this.m(t,e)||await this.run(e)}async run(e){let t,r;e??(e=this.T()),this.O=e,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let n=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(l){n=!0,r=l}if(this.p===o){if(t===L)this.i=0;else{if(n===!1){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=t,this.l=r}this._.requestUpdate()}}abort(e){this.i===1&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Uo=(i,e)=>i===e||i.length===e.length&&i.every((t,r)=>!yt(t,e[r]));var Os={SET_LOADING:(i,e)=>({...i,isLoading:e.payload}),SET_UPDATING:(i,e)=>({...i,isUpdating:e.payload}),INITIALIZE_VAULT_MANAGER:(i,e,t)=>({...i,enabled:e.vaultEnabled,cvvRecapture:e.cvvRecapture,deleteVaultedPaymentMethod:t.deleteVaultedPaymentMethod,startVaultedPaymentFlow:t.startVaultedPaymentFlow,createCvvInput:t.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,e)=>({...i,vaultedPaymentMethods:e.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>Yo},Ds={INITIALIZE_CVV:(i,e,t)=>({...i,setCvvInput:t.setCvvInput,setSelectedVaultedPaymentMethod:t.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,e)=>({...i,formIsDirty:e.payload}),SET_CVV_INPUT:(i,e)=>({...i,cvvInput:e.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,e)=>({...i,selectedVaultedPaymentMethod:e.payload}),RESET_CVV:()=>zo},Vs=Dt(Os),Hs=Dt(Ds),Yo={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},zo={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Si=class extends We{constructor(e,t){super(e,Yo,Vs,t,r=>{e.sdkContextController.setVaultManager(r)})}setLoading(e){this.dispatch({type:"SET_LOADING",payload:e})}setUpdating(e){this.dispatch({type:"SET_UPDATING",payload:e})}initializeVaultManager(e,t,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:t,cvvRecapture:r})}updatePaymentMethods(e){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:e})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Mi=class extends We{constructor(e,t){super(e,zo,Hs,t,r=>{e.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(e){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:e})}setFormDirty(e){this.dispatch({type:"SET_FORM_DIRTY",payload:e})}setCvvInputState(e){this.dispatch({type:"SET_CVV_INPUT",payload:e})}setSelectedPaymentMethod(e){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:e})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},Yt=class extends br{constructor(t){super(t);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=t=>{this.itemController.setCvvInputState(t)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!t||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,r?{cvv:o.valueToken}:void 0)}catch(n){R.error("VaultManagerController: Error starting vaulted payment flow",n),this.coreController.setError(n instanceof Error?n:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.itemController.setSelectedPaymentMethod(t),this.itemController.setFormDirty(!1)};this.coreController=new Si(t,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Mi(t,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new D(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),L;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),R.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(n){R.error("VaultManagerController: Failed to initialize vault",n),this.coreController.setError(n instanceof Error?n:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,r){this.vaultManager=t,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{t||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return R.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(t)}};var zt="lit-localize-status";var Fo=i=>typeof i!="string"&&"strTag"in i,Tr=(i,e,t)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=e[t?t[o-1]:o-1],r+=i[o];return r};var Ft=i=>Fo(i)?Tr(i.strings,i.values):i;var A=Ft,Bo=!1;function Ti(i){if(Bo)throw new Error("lit-localize can only be configured once");A=i,Bo=!0}var Pi=class{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(zt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(zt,this.__litLocalizeEventHandler)}},Us=i=>i.addController(new Pi(i)),Ko=Us;var $=()=>(i,e)=>(i.addInitializer(Ko),i);var Bt=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}};var xe=[];for(let i=0;i<256;i++)xe[i]=(i>>4&15).toString(16)+(i&15).toString(16);function jo(i){let e=0,t=8997,r=0,o=33826,n=0,l=40164,g=0,u=52210;for(let S=0;S<i.length;S++)t^=i.charCodeAt(S),e=t*435,r=o*435,n=l*435,g=u*435,n+=t<<8,g+=o<<8,r+=e>>>16,t=e&65535,n+=r>>>16,o=r&65535,u=g+(n>>>16)&65535,l=n&65535;return xe[u>>8]+xe[u&255]+xe[l>>8]+xe[l&255]+xe[o>>8]+xe[o&255]+xe[t>>8]+xe[t&255]}var Ys="",zs="h",Fs="s";function Go(i,e){return(e?zs:Fs)+jo(typeof i=="string"?i:i.join(Ys))}var qo=new WeakMap,Wo=new Map;function Zo(i,e,t){if(i){let r=t?.id??Bs(e),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Tr(o.strings,e.values,o.values);{let n=qo.get(o);return n===void 0&&(n=o.values,qo.set(o,n)),{...o,values:n.map(l=>e.values[l])}}}}return Ft(e)}function Bs(i){let e=typeof i=="string"?i:i.strings,t=Wo.get(e);return t===void 0&&(t=Go(e,typeof i!="string"&&!("strTag"in i)),Wo.set(e,t)),t}function wi(i){window.dispatchEvent(new CustomEvent(zt,{detail:i}))}var wr="",ki,Xo,kr,Ii,Jo,Xe=new Bt;Xe.resolve();var Pr=0,Qo=i=>(Ti((e,t)=>Zo(Jo,e,t)),wr=Xo=i.sourceLocale,kr=new Set(i.targetLocales),kr.add(i.sourceLocale),Ii=i.loadLocale,{getLocale:Ks,setLocale:js}),Ks=()=>wr,js=i=>{if(i===(ki??wr))return Xe.promise;if(!kr||!Ii)throw new Error("Internal error");if(!kr.has(i))throw new Error("Invalid locale code");Pr++;let e=Pr;return ki=i,Xe.settled&&(Xe=new Bt),wi({status:"loading",loadingLocale:i}),(i===Xo?Promise.resolve({templates:void 0}):Ii(i)).then(r=>{Pr===e&&(wr=i,ki=void 0,Jo=r.templates,wi({status:"ready",readyLocale:i}),Xe.resolve())},r=>{Pr===e&&(wi({status:"error",errorLocale:i,errorMessage:r.toString()}),Xe.reject(r))}),Xe.promise};var Ni="en",Li=["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"],ea="You must call `loadLocale` first to set up the localized template.",ta,Ir,ra=i=>{let e=Qo({sourceLocale:Ni,targetLocales:Li,loadLocale:i});ta=e.getLocale,Ir=e.setLocale};var $i=i=>{ra(i)},Ri=i=>{if(!Ir)throw new Error(ea);return Ir(i)};var Kt=new Set(Li);Kt.add(Ni);var Oi=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let e=i.replace("_","-");if(Kt.has(e))return!0;let t=e.split("-")[0];return!!Kt.has(t)},Di=i=>{if(i==="en")return"en-GB";let e=i.replace("_","-");if(Kt.has(e))return e;let t=e.split("-")[0];return Kt.has(t)?t:"en-GB"};var Gt=globalThis,Nr=Gt.trustedTypes,ia=Nr?Nr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Hi="$lit$",Ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+Ae,Gs=`<${Ui}>`,et=document,qt=()=>et.createComment(""),Wt=i=>i===null||typeof i!="object"&&typeof i!="function",Yi=Array.isArray,da=i=>Yi(i)||typeof i?.[Symbol.iterator]=="function",Vi=`[
1
+ import{a as $o,b as _s,c as Ro,d as s}from"./chunks/chunk.G45OCYEN.js";var Zi=_s((tr,Wi)=>{(function(i,e){typeof tr=="object"&&typeof Wi=="object"?Wi.exports=e():typeof define=="function"&&define.amd?define([],e):typeof tr=="object"?tr.Primer=e():i.Primer=e()})(tr,()=>(()=>{"use strict";let i;var e,t,r={};r.d=(a,d)=>{for(var m in d)r.o(d,m)&&!r.o(a,m)&&Object.defineProperty(a,m,{enumerable:!0,get:d[m]})},r.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>ys,PaymentFlow:()=>hs,PrimerClientError:()=>gr,ThreeDSecureStatus:()=>gs,TokenType:()=>fs,isStripeOptionsDropInWithFullMandateText:()=>bs,PaymentInstrumentType:()=>$t,ErrorCode:()=>vs,EventTypes:()=>Es,CheckoutUXFlow:()=>us,HeadlessManagerType:()=>Cs,PaymentMethodType:()=>Rt,Primer:()=>xs});let n={LEGACY:"legacy",V_2_4:"2.4"},l=n.V_2_4,g=l;class u extends Error{static from(d,m=!1){if(d instanceof u)return d;let C=new u(d instanceof Error?d.message:String(d),m);return d instanceof Error&&d.stack&&(C.stack=d.stack,Object.assign(C,d)),C}markAsReported(){this.isReported=!0}constructor(d,m=!1){super(d),function(C,M,x){M in C?Object.defineProperty(C,M,{value:x,enumerable:!0,configurable:!0,writable:!0}):C[M]=x}(this,"isReported",void 0),this.isReported=m,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let S="https://analytics.production.data.primer.io/sdk-logs";var k=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),_=function(a){return a.START="START",a.END="END",a}({});let H={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var Y=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function he(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let On={get(a,d){let m;try{switch(a){case"PRIMER_SDK_VERSION":m="v2.53.6";break;case"PRIMER_ASSETS_URL":m=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":m=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return m||d}}.get("PRIMER_SDK_VERSION");async function ao(a,d,m){return{...m,createdAt:Date.now(),device:await he(),eventType:a,properties:d,sdkVersion:On,sdkType:"WEB"}}let no=Symbol.for("__primerAnalytics__"),It={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[no];a?It=a:window[no]=It}let so=()=>It.providers,mi=()=>It.timers,Nt=()=>It.eventsQueue,cr=new Map;function ui(a,d=!1,m=1){cr.has(a)&&(clearTimeout(cr.get(a)),cr.delete(a));let C=()=>{let x=Nt().get(a);if(x?.length){let E=!0,P=[],O=0,T=0;for(;T<x.length;){let U=x[T],z=new Blob([JSON.stringify(U)]).size;if(z>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",U),T++;continue}if(O+z>64e3&&P.length>0){try{E=navigator.sendBeacon(a,JSON.stringify(P))}catch(B){E=!1,console.error("Unable to send events",B)}if(!E)break;P=[],O=0}P.push(U),O+=z,T++}if(P.length>0&&E)try{E=navigator.sendBeacon(a,JSON.stringify(P))}catch(U){E=!1,console.error("Unable to send events",U)}E?Nt().delete(a):m<5?setTimeout(()=>ui(a,d,m+1),500*Math.pow(2,m)):console.error("Max retry attempts reached. Events will not be sent.")}};if(d)return void C();let M=setTimeout(C,500);cr.set(a,M)}let lo=!1;function hi({url:a=S,...d}){typeof document>"u"||lo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let M=mt(d.checkoutSessionId);M.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),ui(M.url,!0)}}),lo=!0);let m=M=>async x=>{if(typeof navigator>"u")return;let E=function O(T,U,z=new WeakSet,B=0,ne=10){if(B>ne||z.has(T))return T;z.add(T);let se=oe=>typeof oe=="object"&&oe!==null?O(oe,U,z,B+1,ne):U(oe);return Array.isArray(T)?T.map(se):Object.fromEntries(Object.entries(T).map(([oe,ht])=>[oe,se(ht)]))}(await ao(M,x,d),O=>{var T;return typeof(T=typeof O=="function"?O.name||"function":O)=="string"&&T.length>5120?`${T.slice(0,5120)}...`:T});Nt().has(a)||Nt().set(a,[]),Nt().get(a)?.push(E),ui(a)},C={crashEvent:m(Y.CRASH_EVENT),messageEvent:m(Y.MESSAGE_EVENT),networkCallEvent:m(Y.NETWORK_CALL_EVENT),sdkFunctionEvent:m(Y.SDK_FUNCTION_EVENT),timerStart:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,P=performance?.now?performance.now():Date.now();return mi().set(E,{start:P}),m(Y.TIMER_EVENT)({...x,id:M,timerType:_.START})},timerEnd:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,{start:P}=mi().get(E)??{};mi().delete(E);let O=performance?.now?performance.now():Date.now();return m(Y.TIMER_EVENT)({...x,id:M,timerType:_.END,duration:P?O-P:void 0})},v1Event:m(Y.V1_EVENT),url:a};return so().set(d.checkoutSessionId,C),mt(d.checkoutSessionId)}function mt(a){return new Proxy({},{get:(d,m)=>(so().get(a)??hi({checkoutSessionId:a}))[m]})}let gi=(a,d,m,C)=>({callType:m?k.REQUEST_END:k.REQUEST_START,id:a,errorBody:m?.error&&JSON.stringify(m.error,Object.getOwnPropertyNames(m.error)),method:d.method,responseCode:m?.status,url:d.url,duration:C});function Dn(a){return a?new Promise(d=>{setTimeout(d,a)}):Promise.resolve()}async function po(a,d,m,C=Dn){let M=0,x={enabled:d?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let E=await a();if(M){let P=`Request succeeded after ${M} retries.`;typeof E=="object"&&E&&"status"in E&&(P+=` Status code: ${E.status}`),m?.({messageType:"RETRY_SUCCESS",message:P,severity:"INFO"})}return E}catch(E){let P=M>=x.maxRetries,O=E.isNetworkError&&!x.retryNetworkErrors,T=E.status&&E.status>=500&&!x.retry500Errors;if(P||O||T){let B=`Failed after ${M} retries. `;throw P?B+=`Reached maximum retries (${x.maxRetries}).`:O?B+="Network error encountered and retryNetworkErrors is disabled.":T&&(B+="HTTP 500 error encountered and retry500Errors is disabled."),B+=` Last error: ${E.message}`,m?.({messageType:"RETRY_FAILED",message:B,severity:"ERROR",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),Error(B,{cause:E})}M++;let U=Math.min(x.initialBackoff*Math.pow(2,M-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),z="Unknown error";E.isNetworkError?z="Network error":E.status&&(z=`HTTP ${E.status} error`),m?.({messageType:"RETRY",message:`Retry attempt ${M}/${x.maxRetries} due to: ${z}. Error details: ${E.message}. Waiting for ${U.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),await C(U)}}let fi={cache:new Map};typeof window<"u"&&((e=window)[t="__primerCache__"]??(e[t]=fi),fi=window.__primerCache__);let ie=()=>fi.cache;function co(){if(ie().size<=30)return;let a=Date.now();for(let[d,m]of ie())m.exp<a&&ie().delete(d);if(ie().size>50)for(let[d]of ie()){if(ie().size<=50)break;ie().delete(d)}}let vi=()=>mo.randomUUID?.()||Vn(),Vn=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Hn()>>a/4).toString(16)),Hn=()=>(mo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,mo=typeof crypto<"u"?crypto:{},Un=(a,d,m)=>Yn(a,"get",d,m),Yn=async(a,d,m,C,M)=>{let x=vi(),E=performance?.now(),P=mt(a),O={method:d,url:m,body:M};P.networkCallEvent(gi(x,O));try{let T=await fetch(m,{body:M,method:d,headers:{"content-type":"application/json","x-request-id":x,...C}});if(!T.ok){let B=Error(`HTTP error! status: ${T.status}`);throw B.status=T.status,B}let U=await T.json();if(m.includes("client-sdk/configuration")){let{primerAccountId:B,clientSession:{clientSessionId:ne,customer:se}}=U;P=hi({checkoutSessionId:a,clientSessionId:ne,customerId:se?.customerId,primerAccountId:B,url:P.url})}let z=performance?.now();return P.networkCallEvent(gi(x,O,{data:U},z-E)),{data:U,headers:T.headers,status:T.status,source:"NETWORK"}}catch(T){let U=performance?.now();throw Object.assign(T,{isNetworkError:T instanceof TypeError}),P.networkCallEvent(gi(x,O,{error:T},U-E)),T}},zn=(a,d)=>new Promise((m,C)=>{let M=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,C(x)},d);a.then(m).catch(C).finally(()=>clearTimeout(M))}),Fn=(a,d)=>{let{headers:m,retryConfig:C,cacheConfig:M,timeout:x=15e3,checkoutSessionId:E}=d,P=mt(E);return function(O){if(!O)return ne=>ne();let{key:T,refresh:U=!1,usePrimerSessionCacheTtlHeader:z=!1,ttl:B=36e5}=O;return async ne=>{let se=Date.now(),oe=ie().get(T);if(!U&&oe&&oe.exp>se)return oe.promise;oe&&ie().delete(T);let ht=ne().then(Ot=>{let Io=B;return z&&(Io=1e3*(Number(Ot.headers.get("x-primer-session-cache-ttl"))||0)),function({key:No,ttl:Lo=36e5},As){Lo?ie().set(No,{promise:Promise.resolve({...As,source:"CACHE"}),exp:Date.now()+Lo}):ie().delete(No)}({key:T,ttl:Io},Ot),co(),Ot},Ot=>{throw ie().delete(T),Ot});return ie().set(T,{promise:ht,exp:se+B}),co(),ht}}(M)(()=>po(()=>zn(Un(E,a,m),x),C,O=>P.messageEvent({...O,url:a})))},ut=typeof Buffer=="function",uo=typeof TextDecoder=="function"?new TextDecoder:void 0,ho=typeof TextEncoder=="function"?new TextEncoder:void 0,Lt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),mr=(a=>{let d={};return a.forEach((m,C)=>d[m]=C),d})(Lt),Bn=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,G=String.fromCharCode.bind(String),go=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),fo=a=>a.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),vo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),yo=typeof btoa=="function"?a=>btoa(a):ut?a=>Buffer.from(a,"binary").toString("base64"):a=>{let d,m,C,M,x="",E=a.length%3;for(let P=0;P<a.length;){if((m=a.charCodeAt(P++))>255||(C=a.charCodeAt(P++))>255||(M=a.charCodeAt(P++))>255)throw TypeError("invalid character found");x+=Lt[(d=m<<16|C<<8|M)>>18&63]+Lt[d>>12&63]+Lt[d>>6&63]+Lt[63&d]}return E?x.slice(0,E-3)+"===".substring(E):x},yi=ut?a=>Buffer.from(a).toString("base64"):a=>{let d=[];for(let m=0,C=a.length;m<C;m+=4096)d.push(G.apply(null,a.subarray(m,m+4096)));return yo(d.join(""))},Tl=(a,d=!1)=>d?fo(yi(a)):yi(a),Kn=a=>{if(a.length<2){var d=a.charCodeAt(0);return d<128?a:d<2048?G(192|d>>>6)+G(128|63&d):G(224|d>>>12&15)+G(128|d>>>6&63)+G(128|63&d)}var d=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return G(240|d>>>18&7)+G(128|d>>>12&63)+G(128|d>>>6&63)+G(128|63&d)},jn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gn=a=>a.replace(jn,Kn),bo=ut?a=>Buffer.from(a,"utf8").toString("base64"):ho?a=>yi(ho.encode(a)):a=>yo(Gn(a)),qn=(a,d=!1)=>d?fo(bo(a)):bo(a),Wn=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Zn=a=>{switch(a.length){case 4:var d=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return G((d>>>10)+55296)+G((1023&d)+56320);case 3:return G((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return G((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Xn=a=>a.replace(Wn,Zn),Eo=typeof atob=="function"?a=>atob(vo(a)):ut?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Bn.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let d,m="",C,M;for(let x=0;x<a.length;)d=mr[a.charAt(x++)]<<18|mr[a.charAt(x++)]<<12|(C=mr[a.charAt(x++)])<<6|(M=mr[a.charAt(x++)]),m+=C===64?G(d>>16&255):M===64?G(d>>16&255,d>>8&255):G(d>>16&255,d>>8&255,255&d);return m},Co=ut?a=>go(Buffer.from(a,"base64")):a=>go(Eo(a).split("").map(d=>d.charCodeAt(0))),wl=a=>Co(xo(a)),Jn=ut?a=>Buffer.from(a,"base64").toString("utf8"):uo?a=>uo.decode(Co(a)):a=>Xn(Eo(a)),xo=a=>vo(a.replace(/[-_]/g,d=>d=="-"?"+":"/")),Qn=a=>Jn(xo(a)),kl=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Ao={encode:qn,decode:Qn},es={encode:function(a,d={}){let{urlSafe:m=!1}=d;return Ao.encode(a,m)},decode:Ao.decode},_o="The provided `clientToken`",ts=`${_o} has expired`,rs=`${_o} is malformed`,is=(a,d,m)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.6","primer-sdk-checkout-session-id":d,...m&&{"x-api-version":m}});async function os(a,d,m){let{accessToken:C,configurationUrl:M,analyticsUrlV2:x}=function(T){let U=function(B){try{let[ne,se]=B.split(".");return JSON.parse(es.decode(se||ne))}catch{throw Error(rs)}}(T),z=1e3*U.exp;if(Date.now()>z)throw Error(`${ts}. Expiration date: ${new Date(z).toISOString()}`);return U}(a),E=hi({checkoutSessionId:d,url:x}),P=g,O=P!==n.LEGACY?P:"2.3";E.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:T,source:U}=await Fn(`${M}/?withDisplayMetadata=true`,{checkoutSessionId:d,headers:is(C,d,O),retryConfig:{enabled:!0},cacheConfig:m});return E.timerEnd({id:"CONFIGURATION_LOADING",context:{source:U}}),T}catch(T){let U=T instanceof Error?T.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${U}`)}}function So(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function ur({checkoutSessionId:a,analytics:d,error:m,reporter:C}){d?.crashEvent?d.crashEvent({...So(m),reporter:C}):a&&bi(a,m,C)}async function bi(a,d,m){let C=await ao(Y.CRASH_EVENT,{...So(d),reporter:m},{checkoutSessionId:a});try{await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})}catch(M){console.error("Failed to post crash event",M)}}let Mo=Symbol.for("initGlobalErrorMonitoringLoaded"),Po=(a,d)=>{typeof window<"u"&&window[Mo]||(window[Mo]=!0,window.addEventListener("error",m=>{!as(m)&&ns(m)&&ur({checkoutSessionId:a,analytics:d,error:m.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",m=>{let C=m.reason||Error("Unhandled promise rejection");ss(C)&&ur({checkoutSessionId:a,analytics:d,error:C,reporter:"unhandledrejection"})}))},as=a=>a.message==="Script error."||!a.filename||a.lineno===0,ns=a=>{let d=a.filename;return!!(d&&Ei(d))&&!!new u(a.error).isReported||!1},ss=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let d=u.from(a);return!d.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Ei(a.fileName))||ls(d.stack).some(Ei))}return!1},Ei=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},ls=a=>{if(!a)return[];let d=a.split(`
2
+ `),m=[],C=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let M of d){let x=M.match(C);if(x&&x[1])m.push(x[1]);else{let E=/@(.*?):\d+:\d+$/,P=M.match(E);P&&P[1]&&m.push(P[1])}}return m};function To(a,d,m){return document.querySelector(`${a}[${d}^="${m}"]`)}async function wo(a,d,m,C,M,x){let{analytics:E,name:P=d,retryConfig:O}=x;await po(()=>new Promise((T,U)=>{let z=To(a,m,d)||function(B,ne){let se=document.createElement(B);return Object.entries(ne).forEach(([oe,ht])=>se.setAttribute(oe,ht)),se}(a,{...C,[m]:d});z.onload=()=>{E?.sdkFunctionEvent({name:P,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${d}`]}),T()},z.onerror=()=>{z.remove(),U(Error(`${M}: ${d}`))},z.parentNode||document.head.appendChild(z)}),O,T=>E?.messageEvent({...T,url:d}))}async function ko(a){return i||(i=Promise.all([function(d,m={}){return To("script","src",d)&&window.__Primer?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Script already loaded"]}),Promise.resolve()):wo("script",d,"src",{...m.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",m)}("https://sdk.primer.io/web/v2.53.6/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(d,m={}){return Array.from(document.styleSheets).some(C=>C.href===d)?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Stylesheet already loaded"]}),Promise.resolve()):wo("link",d,"href",{...m.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",m)}("https://sdk.primer.io/web/v2.53.6/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let d=window.__Primer;return delete window.__Primer,d}).catch(d=>{throw i=void 0,d}))}let ds=async()=>{let a=vi();try{let d=mt(a);try{Po(a,d),d.sdkFunctionEvent({name:"preloadPrimer"}),d.timerStart({id:H.preloadPrimer}),await ko(d),d.timerEnd({id:H.preloadPrimer})}catch(m){let C=u.from(m);throw C.isReported||(ur({checkoutSessionId:a,analytics:d,error:C,reporter:"preloadPrimer level 1"}),C.markAsReported()),C}}catch(d){let m=u.from(d);throw m.isReported||(bi(a,m,"preloadPrimer level 0"),m.markAsReported()),m}},ps=Ci("createHeadless"),cs=Ci("showUniversalCheckout"),ms=Ci("showVaultManager");function Ci(a){return async(...[d,m,...C])=>{var M;(M=m?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${l}'.`),g=M??l;let x=vi();try{let E=mt(x);try{Po(x,E),E.sdkFunctionEvent({name:a,params:[d,m,...C]}),E.timerStart({id:H[a]});let[P,O]=await Promise.all([os(d,x,m?.clientSessionCachingEnabled?{key:d,usePrimerSessionCacheTtlHeader:!0}:void 0),ko(E)]);return O[a](P,x,d,m,...C)}catch(P){let O=u.from(P);throw O.isReported||(ur({checkoutSessionId:x,analytics:E,error:O,reporter:"lazyLoad level 1"}),O.markAsReported()),O}}catch(E){let P=u.from(E);throw P.isReported||(bi(x,P,"lazyLoad level 0"),P.markAsReported()),P}}}var us=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),hs=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),gs=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let $t={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"},Rt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},fs={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};$t.PAYPAL_VAULTED,Rt.PAYPAL,$t.KLARNA_CUSTOMER_TOKEN,Rt.KLARNA,$t.AUTOMATED_CLEARING_HOUSE,Rt.STRIPE_ACH,$t.CARD,Rt.PAYMENT_CARD;var vs=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function hr(a,d,m){return d in a?Object.defineProperty(a,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):a[d]=m,a}class gr extends u{static fromErrorCode(d,m){return new gr(d,m)}constructor(d,m){super(m.message),hr(this,"code",void 0),hr(this,"diagnosticsId",void 0),hr(this,"data",void 0),hr(this,"isFromDeveloper",void 0),this.code=d,this.diagnosticsId=m.diagnosticsId??null,this.data=m.data,this.isFromDeveloper=m.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,gr)}}var ys=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let bs=a=>{let d=a?.mandateData;return!!d&&"fullMandateText"in d};var Es=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),Cs=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let xs={SDK_VERSION:"v2.53.6",createHeadless:ps,showUniversalCheckout:cs,showVaultManager:ms,preloadPrimer:ds};return o})())});var fr=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}setCardNetworksLoading(){let e={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(e)}updateCardNetworksState(e){this.host.primerEventsController.dispatchCardNetworkChange(e),this.host.sdkContextController.setCardNetworks(e)}async processCardNetworkChangeEvent(e){let{detectedCardNetworks:t,selectableCardNetworks:r}=e,o=t.preferred??t.items[0],n=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:n,isLoading:!1})}};var gt=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}dispatchEvent(e,t){this.host.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}dispatchSdkState(e){this.dispatchEvent("primer-state-changed",e)}dispatchPaymentMethods(e){this.dispatchEvent("primer-payment-methods-updated",e)}dispatchCheckoutInitialized(e){this.dispatchEvent("primer-checkout-initialized",e)}dispatchCardNetworkChange(e){this.dispatchEvent("primer-card-network-change",e)}dispatchOnCheckoutComplete(e){this.dispatchEvent("primer-oncheckout-complete",{payment:e})}dispatchOnCheckoutFailure(e,t){this.dispatchEvent("primer-oncheckout-failure",{error:e,payment:t})}dispatchFormSubmitSuccess(e){this.dispatchEvent("primer-card-submit-success",{result:e})}dispatchFormSubmitErrors(e){this.dispatchEvent("primer-card-submit-errors",{errors:e})}};var Ne=class extends Event{constructor(e,t,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=o??!1}};var ft=class{constructor(e,t,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,l)),this.unsubscribe=l},this.host=e,t.context!==void 0){let n=t;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ne(this.context,this.host,this.t,this.subscribe))}};var vr=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:o}=this.subscriptions.get(e);e(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var xi=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},q=class extends vr{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let n=o.contextTarget??o.composedPath()[0];n!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,n,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let n=new Set;for(let[l,{consumerHost:g}]of this.subscriptions)n.has(l)||(n.add(l),g.dispatchEvent(new Ne(this.context,g,l,!0)));o.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new xi(this.context,this.host))}};function b({context:i,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new ft(this,{context:i,callback:o=>{t.set.call(this,o)},subscribe:e})}):t.constructor.addInitializer(o=>{new ft(o,{context:i,callback:n=>{o[r]=n},subscribe:e})})}}var yr="cardNetworksContext";var Le="clientOptionsContext";var $e="computedStylesContext";var W="headlessInstanceContext";var br="klarnaCategoriesContext";var J="managerContext";var vt="paymentMethodsContext";var j="sdkStateContext";var Q="vaultManagerContext";var Re="vaultManagerCvvContext";var N=class N{static log(e,...t){N.enabled&&console.log(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.log,...t)}static info(e,...t){N.enabled&&console.info(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.info,...t)}static warn(e,...t){N.enabled&&console.warn(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.warn,...t)}static error(e,...t){N.enabled&&console.error(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.error,...t)}static debug(e,...t){N.enabled&&console.debug(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.debug,...t)}static table(e,t){N.enabled&&console.table(e,t)}static time(e){N.enabled&&console.time(`${N.brandTag} ${e}`)}static timeEnd(e){N.enabled&&console.timeEnd(`${N.brandTag} ${e}`)}};N.enabled=!0,N.defaultFont="font-family: Consolas, monospace; font-size: 12px;",N.brandTag="[PRIMER]",N.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+N.defaultFont,N.styles={log:"color: #4CAF50; "+N.defaultFont,info:"color: #2196F3; "+N.defaultFont,warn:"color: #FF9800; "+N.defaultFont,error:"color: #F44336; "+N.defaultFont,debug:"color: #9C27B0; "+N.defaultFont};var R=N;function Ss(i,e,t,r){let o=i,n=t;return{dispatch:l=>{let g=e(o,l,n);o=g,r(g)},getState:()=>Object.freeze({...o}),setCallbacks:l=>{n={...n,...l}}}}function Dt(i){return(e,t,r)=>{let o=i[t.type];if(!o)throw new Error(`No handler for action type: ${t.type}`);return o(e,t,r)}}var We=class{constructor(e,t,r,o,n=()=>{this.host.requestUpdate()}){this.host=e;this.stateHandler=n;this.host.addController(this),this._dispatcher=Ss(t,r,o,l=>{this.stateHandler(l)})}get currentState(){return this._dispatcher.getState()}dispatch(e){this._dispatcher.dispatch(e)}setCallbacks(e){this._dispatcher.setCallbacks(e)}hostConnected(){}hostDisconnected(){}},Er=class{constructor(e){this.host=e;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(e){this._controllers.push(e)}hostConnected(){this._controllers.forEach(e=>{e.hostConnected&&e.hostConnected()})}hostDisconnected(){this._controllers.forEach(e=>{e.hostDisconnected&&e.hostDisconnected()})}};var xr={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Ms={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,e)=>(R.error(e.payload.message),{...i,isProcessing:!1,error:e.payload}),SET_FAILURE:(i,e)=>({...i,isProcessing:!1,failure:e.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>xr,RESET_ERROR:i=>({...i,error:null,failure:null})},Ps=Dt(Ms),Cr=class extends We{constructor(e){super(e,xr,Ps,null,t=>{e.sdkContextController.setSdkState(t),e.primerEventsController.dispatchSdkState(t)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}setFailure(e,t,r){this.dispatch({type:"SET_FAILURE",payload:{code:e,message:t,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(R.warn("Force completing loading state"),this.completeLoading())}};var Ar=class{constructor(e){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=e).addController(this),this.sdkStateProvider=new q(e,{context:j,initialValue:xr}),this.paymentMethodsProvider=new q(e,{context:vt,initialValue:null}),this.paymentManagerProvider=new q(e,{context:J,initialValue:new Map}),this.cardNetworksContext=new q(e,{context:yr,initialValue:null}),this.vaultManagerProvider=new q(e,{context:Q,initialValue:null}),this.vaultManagerCvvProvider=new q(e,{context:Re,initialValue:null}),this.clientOptionsContext=new q(e,{context:Le,initialValue:null}),this.klarnaCategoriesProvider=new q(e,{context:br,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new q(e,{context:W,initialValue:null}),this.computedStylesProvider=new q(e,{context:$e,initialValue:null})}hostConnected(){}setSdkState(e){this.sdkStateProvider?.setValue(e)}setPaymentMethods(e){this.paymentMethodsProvider?.setValue(e)}setPaymentManagers(e){this.paymentManagerProvider?.setValue(e)}setCardNetworks(e){this.cardNetworksContext?.setValue(e)}setVaultManager(e){this.vaultManagerProvider?.setValue(e)}setKlarnaCategories(e){this.klarnaCategoriesProvider?.setValue(e)}setClientOptions(e){this.clientOptionsContext?.setValue(e)}setHeadlessUtils(e){this.headlessUtilsProvider?.setValue(e)}setComputedStyles(e){this.computedStylesProvider?.setValue(e)}setVaultManagerCvv(e){this.vaultManagerCvvProvider?.setValue(e)}};var Ze=class Ze{constructor(e){(this.host=e).addController(this)}processCustomStyles(e){try{let t=JSON.parse(e);this.applyStyles(t)}catch(t){R.error("Error parsing customStyles property.",t instanceof Error?t:new Error(String(t)))}}isValidCssProperty(e){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)}isValidCssValue(e){let r=/^[\w\s#.,%()\-+/!]+$/.test(e);return r||R.warn(`Rejected potentially unsafe CSS value: ${e}`),r}getCssVarName(e){let t=Ze.cssVarCache.get(e);return t||(t="--"+e.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ze.cssVarCache.set(e,t)),t}applyStyles(e){let t=[];for(let r of Object.keys(e)){let o=e[r];if(!o)continue;if(!this.isValidCssProperty(r)){R.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let n=this.getCssVarName(r);t.push([n,o])}if(t.length>0)for(let[r,o]of t)this.host.style.setProperty(r,o)}removeStyle(e){let t=this.getCssVarName(e);this.host.style.removeProperty(t)}clearAllStyles(){for(let e of Ze.cssVarCache.keys()){let t=Ze.cssVarCache.get(e);t&&this.host.style.removeProperty(t)}}hostDisconnected(){}};Ze.cssVarCache=new Map;var _r=Ze;var Sr=globalThis,Mr=Sr.ShadowRoot&&(Sr.ShadyCSS===void 0||Sr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ai=Symbol(),Oo=new WeakMap,Vt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ai)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Mr&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Oo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Oo.set(t,e))}return e}toString(){return this.cssText}},Do=i=>new Vt(typeof i=="string"?i:i+"",void 0,Ai),f=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,o,n)=>r+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[n+1],i[0]);return new Vt(t,i,Ai)},_i=(i,e)=>{if(Mr)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=Sr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,i.appendChild(r)}},Pr=Mr?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Do(t)})(i):i;var{is:Ts,defineProperty:ws,getOwnPropertyDescriptor:ks,getOwnPropertyNames:Is,getOwnPropertySymbols:Ns,getPrototypeOf:Ls}=Object,Oe=globalThis,Vo=Oe.trustedTypes,$s=Vo?Vo.emptyScript:"",Rs=Oe.reactiveElementPolyfillSupport,Ht=(i,e)=>i,Ut={toAttribute(i,e){switch(e){case Boolean:i=i?$s:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},yt=(i,e)=>!Ts(i,e),Ho={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Oe.litPropertyMetadata??(Oe.litPropertyMetadata=new WeakMap);var xe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ho){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,t);o!==void 0&&ws(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:n}=ks(this.prototype,e)??{get(){return this[t]},set(l){this[t]=l}};return{get(){return o?.call(this)},set(l){let g=o?.call(this);n.call(this,l),this.requestUpdate(e,g,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ho}static _$Ei(){if(this.hasOwnProperty(Ht("elementProperties")))return;let e=Ls(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,r=[...Is(t),...Ns(t)];for(let o of r)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,o]of t)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let o=this._$Eu(t,r);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(Pr(o))}else e!==void 0&&t.push(Pr(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _i(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Ut).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let n=r.getPropertyOptions(o),l=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Ut;this._$Em=o,this[o]=l.fromAttribute(t,n.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??yt)(this[e],t))return;this.P(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,n]of r)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}};xe.elementStyles=[],xe.shadowRootOptions={mode:"open"},xe[Ht("elementProperties")]=new Map,xe[Ht("finalized")]=new Map,Rs?.({ReactiveElement:xe}),(Oe.reactiveElementVersions??(Oe.reactiveElementVersions=[])).push("2.0.4");var De={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},L=Symbol(),D=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((e,t)=>{this.o=e,this.h=t}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(e,t,r){this.p=0,this.i=0,(this._=e).addController(this);let o=typeof t=="object"?t:{task:t,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Uo,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let e=this.j();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async S(){let e=this.T(),t=this.O;this.O=e,e===t||e===void 0||t!==void 0&&this.m(t,e)||await this.run(e)}async run(e){let t,r;e??(e=this.T()),this.O=e,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let n=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(l){n=!0,r=l}if(this.p===o){if(t===L)this.i=0;else{if(n===!1){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=t,this.l=r}this._.requestUpdate()}}abort(e){this.i===1&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Uo=(i,e)=>i===e||i.length===e.length&&i.every((t,r)=>!yt(t,e[r]));var Os={SET_LOADING:(i,e)=>({...i,isLoading:e.payload}),SET_UPDATING:(i,e)=>({...i,isUpdating:e.payload}),INITIALIZE_VAULT_MANAGER:(i,e,t)=>({...i,enabled:e.vaultEnabled,cvvRecapture:e.cvvRecapture,deleteVaultedPaymentMethod:t.deleteVaultedPaymentMethod,startVaultedPaymentFlow:t.startVaultedPaymentFlow,createCvvInput:t.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,e)=>({...i,vaultedPaymentMethods:e.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>Yo},Ds={INITIALIZE_CVV:(i,e,t)=>({...i,setCvvInput:t.setCvvInput,setSelectedVaultedPaymentMethod:t.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,e)=>({...i,formIsDirty:e.payload}),SET_CVV_INPUT:(i,e)=>({...i,cvvInput:e.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,e)=>({...i,selectedVaultedPaymentMethod:e.payload}),RESET_CVV:()=>zo},Vs=Dt(Os),Hs=Dt(Ds),Yo={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},zo={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Si=class extends We{constructor(e,t){super(e,Yo,Vs,t,r=>{e.sdkContextController.setVaultManager(r)})}setLoading(e){this.dispatch({type:"SET_LOADING",payload:e})}setUpdating(e){this.dispatch({type:"SET_UPDATING",payload:e})}initializeVaultManager(e,t,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:t,cvvRecapture:r})}updatePaymentMethods(e){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:e})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Mi=class extends We{constructor(e,t){super(e,zo,Hs,t,r=>{e.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(e){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:e})}setFormDirty(e){this.dispatch({type:"SET_FORM_DIRTY",payload:e})}setCvvInputState(e){this.dispatch({type:"SET_CVV_INPUT",payload:e})}setSelectedPaymentMethod(e){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:e})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},Yt=class extends Er{constructor(t){super(t);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=t=>{this.itemController.setCvvInputState(t)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!t||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,r?{cvv:o.valueToken}:void 0)}catch(n){R.error("VaultManagerController: Error starting vaulted payment flow",n),this.coreController.setError(n instanceof Error?n:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.itemController.setSelectedPaymentMethod(t),this.itemController.setFormDirty(!1)};this.coreController=new Si(t,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Mi(t,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new D(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),L;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),R.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(n){R.error("VaultManagerController: Failed to initialize vault",n),this.coreController.setError(n instanceof Error?n:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,r){this.vaultManager=t,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{t||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return R.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(t)}};var zt="lit-localize-status";var Fo=i=>typeof i!="string"&&"strTag"in i,Tr=(i,e,t)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=e[t?t[o-1]:o-1],r+=i[o];return r};var Ft=i=>Fo(i)?Tr(i.strings,i.values):i;var A=Ft,Bo=!1;function Pi(i){if(Bo)throw new Error("lit-localize can only be configured once");A=i,Bo=!0}var Ti=class{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(zt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(zt,this.__litLocalizeEventHandler)}},Us=i=>i.addController(new Ti(i)),Ko=Us;var $=()=>(i,e)=>(i.addInitializer(Ko),i);var Bt=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}};var Ae=[];for(let i=0;i<256;i++)Ae[i]=(i>>4&15).toString(16)+(i&15).toString(16);function jo(i){let e=0,t=8997,r=0,o=33826,n=0,l=40164,g=0,u=52210;for(let S=0;S<i.length;S++)t^=i.charCodeAt(S),e=t*435,r=o*435,n=l*435,g=u*435,n+=t<<8,g+=o<<8,r+=e>>>16,t=e&65535,n+=r>>>16,o=r&65535,u=g+(n>>>16)&65535,l=n&65535;return Ae[u>>8]+Ae[u&255]+Ae[l>>8]+Ae[l&255]+Ae[o>>8]+Ae[o&255]+Ae[t>>8]+Ae[t&255]}var Ys="",zs="h",Fs="s";function Go(i,e){return(e?zs:Fs)+jo(typeof i=="string"?i:i.join(Ys))}var qo=new WeakMap,Wo=new Map;function Zo(i,e,t){if(i){let r=t?.id??Bs(e),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Tr(o.strings,e.values,o.values);{let n=qo.get(o);return n===void 0&&(n=o.values,qo.set(o,n)),{...o,values:n.map(l=>e.values[l])}}}}return Ft(e)}function Bs(i){let e=typeof i=="string"?i:i.strings,t=Wo.get(e);return t===void 0&&(t=Go(e,typeof i!="string"&&!("strTag"in i)),Wo.set(e,t)),t}function wi(i){window.dispatchEvent(new CustomEvent(zt,{detail:i}))}var kr="",ki,Xo,Ir,Ii,Jo,Xe=new Bt;Xe.resolve();var wr=0,Qo=i=>(Pi((e,t)=>Zo(Jo,e,t)),kr=Xo=i.sourceLocale,Ir=new Set(i.targetLocales),Ir.add(i.sourceLocale),Ii=i.loadLocale,{getLocale:Ks,setLocale:js}),Ks=()=>kr,js=i=>{if(i===(ki??kr))return Xe.promise;if(!Ir||!Ii)throw new Error("Internal error");if(!Ir.has(i))throw new Error("Invalid locale code");wr++;let e=wr;return ki=i,Xe.settled&&(Xe=new Bt),wi({status:"loading",loadingLocale:i}),(i===Xo?Promise.resolve({templates:void 0}):Ii(i)).then(r=>{wr===e&&(kr=i,ki=void 0,Jo=r.templates,wi({status:"ready",readyLocale:i}),Xe.resolve())},r=>{wr===e&&(wi({status:"error",errorLocale:i,errorMessage:r.toString()}),Xe.reject(r))}),Xe.promise};var Ni="en",Li=["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"],ea="You must call `loadLocale` first to set up the localized template.",ta,Nr,ra=i=>{let e=Qo({sourceLocale:Ni,targetLocales:Li,loadLocale:i});ta=e.getLocale,Nr=e.setLocale};var $i=i=>{ra(i)},Ri=i=>{if(!Nr)throw new Error(ea);return Nr(i)};var Kt=new Set(Li);Kt.add(Ni);var Oi=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let e=i.replace("_","-");if(Kt.has(e))return!0;let t=e.split("-")[0];return!!Kt.has(t)},Di=i=>{if(i==="en")return"en-GB";let e=i.replace("_","-");if(Kt.has(e))return e;let t=e.split("-")[0];return Kt.has(t)?t:"en-GB"};var Gt=globalThis,Lr=Gt.trustedTypes,ia=Lr?Lr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Hi="$lit$",_e=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+_e,Gs=`<${Ui}>`,et=document,qt=()=>et.createComment(""),Wt=i=>i===null||typeof i!="object"&&typeof i!="function",Yi=Array.isArray,da=i=>Yi(i)||typeof i?.[Symbol.iterator]=="function",Vi=`[
3
3
  \f\r]`,jt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,oa=/-->/g,aa=/>/g,Je=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),na=/'/g,sa=/"/g,pa=/^(?:script|style|textarea|title)$/i,zi=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),c=zi(1),Se=zi(2),pc=zi(3),_e=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),la=new WeakMap,Qe=et.createTreeWalker(et,129);function ca(i,e){if(!Yi(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ia!==void 0?ia.createHTML(e):e}var ma=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=jt;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,V=0;for(;V<u.length&&(l.lastIndex=V,k=l.exec(u),k!==null);)V=l.lastIndex,l===jt?k[1]==="!--"?l=oa:k[1]!==void 0?l=aa:k[2]!==void 0?(pa.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=Je):k[3]!==void 0&&(l=Je):l===Je?k[0]===">"?(l=o??jt,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?Je:k[3]==='"'?sa:na):l===sa||l===na?l=Je:l===oa||l===aa?l=jt:(l=Je,o=void 0);let Y=l===Je&&i[g+1].startsWith("/>")?" ":"";n+=l===jt?u+Gs:_>=0?(r.push(S),u.slice(0,_)+Hi+u.slice(_)+Ae+Y):u+Ae+(_===-2?g:Y)}return[ca(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Zt=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=ma(e,t);if(this.el=i.createElement(S,r),Qe.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=Qe.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Hi)){let V=k[l++],Y=o.getAttribute(_).split(Ae),he=/([.?@])?(.*)/.exec(V);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?$r:he[1]==="?"?Rr:he[1]==="@"?Or:rt}),o.removeAttribute(_)}else _.startsWith(Ae)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(pa.test(o.tagName)){let _=o.textContent.split(Ae),V=_.length-1;if(V>0){o.textContent=Nr?Nr.emptyScript:"";for(let Y=0;Y<V;Y++)o.append(_[Y],qt()),Qe.nextNode(),u.push({type:2,index:++n});o.append(_[V],qt())}}}else if(o.nodeType===8)if(o.data===Ui)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(Ae,_+1))!==-1;)u.push({type:7,index:n}),_+=Ae.length-1}n++}}static createElement(e,t){let r=et.createElement("template");return r.innerHTML=e,r}};function tt(i,e,t=i,r){if(e===_e)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=Wt(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=tt(i,o._$AS(i,e.values),o,r)),e}var Lr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??et).importNode(t,!0);Qe.currentNode=o;let n=Qe.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new bt(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new Dr(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=Qe.nextNode(),l++)}return Qe.currentNode=et,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},bt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=tt(this,e,t),Wt(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==_e&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):da(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(et.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Zt.createElement(ca(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new Lr(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=la.get(e.strings);return t===void 0&&la.set(e.strings,t=new Zt(e)),t}k(e){Yi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(qt()),this.O(qt()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},rt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=tt(this,e,t,0),l=!Wt(e)||e!==this._$AH&&e!==_e,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=tt(this,g[r+u],t,u),S===_e&&(S=this._$AH[u]),l||(l=!Wt(S)||S!==this._$AH[u]),S===h?e=h:e!==h&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},$r=class extends rt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Rr=class extends rt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Or=class extends rt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=tt(this,e,t,0)??h)===_e)return;let r=this._$AH,o=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==h&&(r===h||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Dr=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){tt(this,e)}},ua={M:Hi,P:Ae,A:Ui,C:1,L:ma,R:Lr,D:da,V:tt,I:bt,H:rt,N:Rr,U:Or,B:$r,F:Dr},qs=Gt.litHtmlPolyfillSupport;qs?.(Zt,bt),(Gt.litHtmlVersions??(Gt.litHtmlVersions=[])).push("3.2.1");var ha=(i,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let n=t?.renderBefore??null;r._$litPart$=o=new bt(e.insertBefore(qt(),n),n,void 0,t??{})}return o._$AI(i),o};var v=class extends Ce{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ha(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return _e}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var Ws=globalThis.litElementPolyfillSupport;Ws?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var y=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};var Zs={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt},Xs=(i=Zs,e,t)=>{let{kind:r,metadata:o}=t,n=globalThis.litPropertyMetadata.get(o);if(n===void 0&&globalThis.litPropertyMetadata.set(o,n=new Map),n.set(t.name,i),r==="accessor"){let{name:l}=t;return{set(g){let u=e.get.call(this);e.set.call(this,g),this.requestUpdate(l,u,i)},init(g){return g!==void 0&&this.P(l,void 0,i),g}}}if(r==="setter"){let{name:l}=t;return function(g){let u=this[l];e.call(this,g),this.requestUpdate(l,u,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(e,t)=>typeof t=="object"?Xs(i,e,t):((r,o,n)=>{let l=o.hasOwnProperty(n);return o.constructor.createProperty(n,l?{...r,wrapped:!0}:r),l?Object.getOwnPropertyDescriptor(o,n):void 0})(i,e,t)}function I(i){return p({...i,state:!0,attribute:!1})}var it=(i,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,t),t);function Ve(i,e){return(t,r,o)=>{let n=l=>l.renderRoot?.querySelector(i)??null;if(e){let{get:l,set:g}=typeof r=="object"?t:o??(()=>{let u=Symbol();return{get(){return this[u]},set(S){this[u]=S}}})();return it(t,r,{get(){let u=l.call(this);return u===void 0&&(u=n(this),(u!==null||this.hasUpdated)&&g.call(this,u)),u}})}return it(t,r,{get(){return n(this)}})}}function U(i,e,t){return i?e(i):t?.(i)}var w=f`
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),na=/'/g,sa=/"/g,pa=/^(?:script|style|textarea|title)$/i,zi=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),c=zi(1),Me=zi(2),pc=zi(3),Se=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),la=new WeakMap,Qe=et.createTreeWalker(et,129);function ca(i,e){if(!Yi(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ia!==void 0?ia.createHTML(e):e}var ma=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=jt;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,H=0;for(;H<u.length&&(l.lastIndex=H,k=l.exec(u),k!==null);)H=l.lastIndex,l===jt?k[1]==="!--"?l=oa:k[1]!==void 0?l=aa:k[2]!==void 0?(pa.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=Je):k[3]!==void 0&&(l=Je):l===Je?k[0]===">"?(l=o??jt,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?Je:k[3]==='"'?sa:na):l===sa||l===na?l=Je:l===oa||l===aa?l=jt:(l=Je,o=void 0);let Y=l===Je&&i[g+1].startsWith("/>")?" ":"";n+=l===jt?u+Gs:_>=0?(r.push(S),u.slice(0,_)+Hi+u.slice(_)+_e+Y):u+_e+(_===-2?g:Y)}return[ca(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Zt=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=ma(e,t);if(this.el=i.createElement(S,r),Qe.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=Qe.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Hi)){let H=k[l++],Y=o.getAttribute(_).split(_e),he=/([.?@])?(.*)/.exec(H);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?Rr:he[1]==="?"?Or:he[1]==="@"?Dr:rt}),o.removeAttribute(_)}else _.startsWith(_e)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(pa.test(o.tagName)){let _=o.textContent.split(_e),H=_.length-1;if(H>0){o.textContent=Lr?Lr.emptyScript:"";for(let Y=0;Y<H;Y++)o.append(_[Y],qt()),Qe.nextNode(),u.push({type:2,index:++n});o.append(_[H],qt())}}}else if(o.nodeType===8)if(o.data===Ui)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(_e,_+1))!==-1;)u.push({type:7,index:n}),_+=_e.length-1}n++}}static createElement(e,t){let r=et.createElement("template");return r.innerHTML=e,r}};function tt(i,e,t=i,r){if(e===Se)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=Wt(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=tt(i,o._$AS(i,e.values),o,r)),e}var $r=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??et).importNode(t,!0);Qe.currentNode=o;let n=Qe.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new bt(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new Vr(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=Qe.nextNode(),l++)}return Qe.currentNode=et,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},bt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=tt(this,e,t),Wt(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==Se&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):da(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(et.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Zt.createElement(ca(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new $r(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=la.get(e.strings);return t===void 0&&la.set(e.strings,t=new Zt(e)),t}k(e){Yi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(qt()),this.O(qt()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},rt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=tt(this,e,t,0),l=!Wt(e)||e!==this._$AH&&e!==Se,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=tt(this,g[r+u],t,u),S===Se&&(S=this._$AH[u]),l||(l=!Wt(S)||S!==this._$AH[u]),S===h?e=h:e!==h&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Rr=class extends rt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Or=class extends rt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Dr=class extends rt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=tt(this,e,t,0)??h)===Se)return;let r=this._$AH,o=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==h&&(r===h||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Vr=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){tt(this,e)}},ua={M:Hi,P:_e,A:Ui,C:1,L:ma,R:$r,D:da,V:tt,I:bt,H:rt,N:Or,U:Dr,B:Rr,F:Vr},qs=Gt.litHtmlPolyfillSupport;qs?.(Zt,bt),(Gt.litHtmlVersions??(Gt.litHtmlVersions=[])).push("3.2.1");var ha=(i,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let n=t?.renderBefore??null;r._$litPart$=o=new bt(e.insertBefore(qt(),n),n,void 0,t??{})}return o._$AI(i),o};var v=class extends xe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ha(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Se}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var Ws=globalThis.litElementPolyfillSupport;Ws?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var y=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};var Zs={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt},Xs=(i=Zs,e,t)=>{let{kind:r,metadata:o}=t,n=globalThis.litPropertyMetadata.get(o);if(n===void 0&&globalThis.litPropertyMetadata.set(o,n=new Map),n.set(t.name,i),r==="accessor"){let{name:l}=t;return{set(g){let u=e.get.call(this);e.set.call(this,g),this.requestUpdate(l,u,i)},init(g){return g!==void 0&&this.P(l,void 0,i),g}}}if(r==="setter"){let{name:l}=t;return function(g){let u=this[l];e.call(this,g),this.requestUpdate(l,u,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(e,t)=>typeof t=="object"?Xs(i,e,t):((r,o,n)=>{let l=o.hasOwnProperty(n);return o.constructor.createProperty(n,l?{...r,wrapped:!0}:r),l?Object.getOwnPropertyDescriptor(o,n):void 0})(i,e,t)}function I(i){return p({...i,state:!0,attribute:!1})}var it=(i,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,t),t);function Ve(i,e){return(t,r,o)=>{let n=l=>l.renderRoot?.querySelector(i)??null;if(e){let{get:l,set:g}=typeof r=="object"?t:o??(()=>{let u=Symbol();return{get(){return this[u]},set(S){this[u]=S}}})();return it(t,r,{get(){let u=l.call(this);return u===void 0&&(u=n(this),(u!==null||this.hasUpdated)&&g.call(this,u)),u}})}return it(t,r,{get(){return n(this)}})}}function V(i,e,t){return i?e(i):t?.(i)}var w=f`
5
5
  * {
6
6
  box-sizing: border-box;
7
7
  }
@@ -14,14 +14,14 @@ import{a as $o,b as _s,c as Ro,d as s}from"./chunks/chunk.G45OCYEN.js";var Zi=_s
14
14
  //Keep the CSS loader in the same position - check css-loader-inline.ts
15
15
  min-height: 64px;
16
16
  }
17
- `;var fa="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Vr=class{constructor(e){this._methods=e}get(e){return this._methods.get(e)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var Hr=typeof window<"u"&&typeof window.document<"u";function Js(i){return document.querySelector(`script[src^="${i}"]`)}function Qs(i,e){let t=document.createElement("script");return t.setAttribute("src",i),t.setAttribute("async",""),t.setAttribute("crossorigin","anonymous"),e&&t.setAttribute("type","module"),t}function va(i,e=!1){if(!Hr)throw new Error("Cannot load script in server environment");let t=Js(i)??Qs(i,e);return new Promise((r,o)=>{t.onload=()=>{r()},t.onerror=()=>{o()},t.parentNode||document.head.appendChild(t)})}var Ur=class{constructor(e){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=e).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new D(e,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new D(e,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(e){this._paymentsList=e,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(R.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(),R.info("SDK instance cleaned up")}catch(e){R.error("Error cleaning up SDK instance:",e)}this.currentSdkInstance=null}async _loadV2Sdk(e=fa){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){R.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await va(e),await window.Primer.preloadPrimer()}initializeHeadless(){return async([e,t])=>{if(this.isDisconnected)return R.warn("Component disconnected, aborting SDK initialization"),L;if(!e||!t)return L;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(e,{...t,onAvailablePaymentMethodsLoad:l=>{this.isDisconnected||(R.info("Configuration payment methods:",l),this.paymentsList=l)},onCheckoutComplete:({payment:l})=>{this.isDisconnected||(R.info("Payment completed:",l),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(l,g,u)=>{this.isDisconnected||(R.error("Payment failed:",l),this.host.sdkStateController.setFailure(l.code||"UNKNOWN_ERROR",l.message||"Unknown error occurred"),u&&u.showErrorMessage())},onBeforePaymentCreate:(l,g)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),g?.continuePaymentCreation())},onPaymentMethodAction:(l,g)=>{this.isDisconnected||l==="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(),L;this.host.sdkContextController.setClientOptions(t),this.host.primerEventsController.dispatchCheckoutInitialized(o);let n=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(n),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:t.vault?.enabled,captureVaultedCardCvv:!!n.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(R.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([e,t])=>{if(this.isDisconnected)return L;if(!e||!t.length)return L;let r=new Map,o=new Map;try{for(let l of t){if(this.isDisconnected)break;let g=await this.initializePaymentMethodManager(l)();l&&g&&(r.set(l.type,l),o.set(l.type,g))}if(this.isDisconnected)return L;let n=new Vr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(n),this.host.primerEventsController.dispatchPaymentMethods(n),R.info("Initialized payment methods:",n.toArray()),r}catch(n){if(n instanceof Error)throw this.host.sdkStateController.setError(n),n;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(e){let{type:t,managerType:r}=e;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:n=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:n,isLoading:!1})}});return o?{type:t,manager:o}:null}try{if(r==="CARD"){let n=await this.createPaymentMethodManager(t,{onCardNetworksChange:async l=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(l)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return n?{type:t,manager:n}:null}let o=await this.createPaymentMethodManager(t);return o?{type:t,manager:o}:null}catch(o){return R.error(`Failed to initialize manager for ${t}:`,o),null}}}};var Yr=class{constructor(e){this.host=e,e.addController(this)}_error(e){let{error:t}=e.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",t.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var el=$o({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});$i(i=>el(`../../localization/lit-localize/locales/${i}.ts`));var zr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},le=class extends v{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new xr(this),this.sdkStateController=new Er(this),this.primerEventsController=new gt(this),this.styleProcessingController=new Ar(this),this.vaultManagerController=new Yt(this),this.cardNetworkController=new gr(this),this.achPaymentEventsController=new Yr(this),new Ur(this)}set jsInitialized(t){this.requestUpdate(),this._jsInitialized=t}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(t,r,o){t===zr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(t,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(t){t.has("options")&&(this.options?.locale&&(Oi(this.options?.locale)?this.locale=Di(this.options?.locale):R.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Ri(this.locale||"en-GB"))}updated(){let t=getComputedStyle(this);this.sdkContextController.setComputedStyles(t),this.checkLoadingStateChange()}checkLoadingStateChange(){let t=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!t&&(this.jsInitialized=!0),this.previousLoadingState=t,t&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(R.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!t&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let t=this.sdkStateController.currentState,r=t.isLoading,o=t.error,n=!r&&!o;return c`
18
- ${U(r,()=>h)}
19
- ${U(o,()=>c`<primer-checkout-error></primer-checkout-error>`)}
20
- ${U(n,()=>c`
17
+ `;var fa="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Hr=class{constructor(e){this._methods=e}get(e){return this._methods.get(e)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var Ur=typeof window<"u"&&typeof window.document<"u";function Js(i){return document.querySelector(`script[src^="${i}"]`)}function Qs(i,e){let t=document.createElement("script");return t.setAttribute("src",i),t.setAttribute("async",""),t.setAttribute("crossorigin","anonymous"),e&&t.setAttribute("type","module"),t}function va(i,e=!1){if(!Ur)throw new Error("Cannot load script in server environment");let t=Js(i)??Qs(i,e);return new Promise((r,o)=>{t.onload=()=>{r()},t.onerror=()=>{o()},t.parentNode||document.head.appendChild(t)})}var Yr=class{constructor(e){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=e).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new D(e,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new D(e,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(e){this._paymentsList=e,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(R.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(),R.info("SDK instance cleaned up")}catch(e){R.error("Error cleaning up SDK instance:",e)}this.currentSdkInstance=null}async _loadV2Sdk(e=fa){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){R.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await va(e),await window.Primer.preloadPrimer()}initializeHeadless(){return async([e,t])=>{if(this.isDisconnected)return R.warn("Component disconnected, aborting SDK initialization"),L;if(!e||!t)return L;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(e,{...t,onAvailablePaymentMethodsLoad:l=>{this.isDisconnected||(R.info("Configuration payment methods:",l),this.paymentsList=l)},onCheckoutComplete:({payment:l})=>{this.isDisconnected||(R.info("Payment completed:",l),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(l))},onCheckoutFail:(l,g)=>{this.isDisconnected||(R.error("Payment failed:",l),this.host.sdkStateController.setFailure(l.code||"UNKNOWN_ERROR",l.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(l,g.payment))},onBeforePaymentCreate:(l,g)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),g?.continuePaymentCreation())},onPaymentMethodAction:(l,g)=>{this.isDisconnected||l==="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(),L;this.host.sdkContextController.setClientOptions(t),this.host.primerEventsController.dispatchCheckoutInitialized(o);let n=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(n),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:t.vault?.enabled,captureVaultedCardCvv:!!n.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(R.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([e,t])=>{if(this.isDisconnected)return L;if(!e||!t.length)return L;let r=new Map,o=new Map;try{for(let l of t){if(this.isDisconnected)break;let g=await this.initializePaymentMethodManager(l)();l&&g&&(r.set(l.type,l),o.set(l.type,g))}if(this.isDisconnected)return L;let n=new Hr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(n),this.host.primerEventsController.dispatchPaymentMethods(n),R.info("Initialized payment methods:",n.toArray()),r}catch(n){if(n instanceof Error)throw this.host.sdkStateController.setError(n),n;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(e){let{type:t,managerType:r}=e;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:n=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:n,isLoading:!1})}});return o?{type:t,manager:o}:null}try{if(r==="CARD"){let n=await this.createPaymentMethodManager(t,{onCardNetworksChange:async l=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(l)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return n?{type:t,manager:n}:null}let o=await this.createPaymentMethodManager(t);return o?{type:t,manager:o}:null}catch(o){return R.error(`Failed to initialize manager for ${t}:`,o),null}}}};var zr=class{constructor(e){this.host=e,e.addController(this)}_error(e){let{error:t}=e.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",t.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var el=$o({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});$i(i=>el(`../../localization/lit-localize/locales/${i}.ts`));var Fr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},le=class extends v{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new Ar(this),this.sdkStateController=new Cr(this),this.primerEventsController=new gt(this),this.styleProcessingController=new _r(this),this.vaultManagerController=new Yt(this),this.cardNetworkController=new fr(this),this.achPaymentEventsController=new zr(this),new Yr(this)}set jsInitialized(t){this.requestUpdate(),this._jsInitialized=t}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(t,r,o){t===Fr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(t,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(t){t.has("options")&&(this.options?.locale&&(Oi(this.options?.locale)?this.locale=Di(this.options?.locale):R.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Ri(this.locale||"en-GB"))}updated(){let t=getComputedStyle(this);this.sdkContextController.setComputedStyles(t),this.checkLoadingStateChange()}checkLoadingStateChange(){let t=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!t&&(this.jsInitialized=!0),this.previousLoadingState=t,t&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(R.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!t&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let t=this.sdkStateController.currentState,r=t.isLoading,o=t.error,n=!r&&!o;return c`
18
+ ${V(r,()=>h)}
19
+ ${V(o,()=>c`<primer-checkout-error></primer-checkout-error>`)}
20
+ ${V(n,()=>c`
21
21
  <slot name="main" @slotchange=${this.onSlotChange}></slot>
22
- ${U(this.hasAssignedContent,()=>h,()=>c`<primer-main></primer-main>`)}
22
+ ${V(this.hasAssignedContent,()=>h,()=>c`<primer-main></primer-main>`)}
23
23
  `,()=>h)}
24
- `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};le.styles=[w,ga],s([p({type:String,attribute:zr.CUSTOM_STYLES})],le.prototype,"customStyles",2),s([p({type:String,attribute:zr.CLIENT_TOKEN})],le.prototype,"clientToken",2),s([p({type:Object})],le.prototype,"options",2),s([p({type:Boolean,reflect:!0,attribute:zr.JS_INIT})],le.prototype,"_jsInitialized",2),s([Ve("slot")],le.prototype,"defaultSlot",2),s([I()],le.prototype,"previousLoadingState",2),le=s([$(),y("primer-checkout")],le);function tl(i){return document.querySelector(`#${i}`)}function rl(i,e){let t=document.createElement("style");return t.textContent=i,t.id=e,t}function Xt(i,e,t=!0){if(!Hr||tl(e))return;let o=rl(i,e);t&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var ya=`
24
+ `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};le.styles=[w,ga],s([p({type:String,attribute:Fr.CUSTOM_STYLES})],le.prototype,"customStyles",2),s([p({type:String,attribute:Fr.CLIENT_TOKEN})],le.prototype,"clientToken",2),s([p({type:Object})],le.prototype,"options",2),s([p({type:Boolean,reflect:!0,attribute:Fr.JS_INIT})],le.prototype,"_jsInitialized",2),s([Ve("slot")],le.prototype,"defaultSlot",2),s([I()],le.prototype,"previousLoadingState",2),le=s([$(),y("primer-checkout")],le);function tl(i){return document.querySelector(`#${i}`)}function rl(i,e){let t=document.createElement("style");return t.textContent=i,t.id=e,t}function Xt(i,e,t=!0){if(!Ur||tl(e))return;let o=rl(i,e);t&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var ya=`
25
25
  @keyframes primer-css-spinner-rotate {
26
26
  0% {
27
27
  transform: rotate(0deg);
@@ -230,7 +230,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
230
230
  transform: rotate(360deg);
231
231
  }
232
232
  }
233
- `;var Ki={small:16,medium:24,large:32},Me=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ki)return Ki[this.size];let t=parseInt(this.size,10);return isNaN(t)?Ki.medium:t}render(){let t=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${t}px`),c`
233
+ `;var Ki={small:16,medium:24,large:32},Pe=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ki)return Ki[this.size];let t=parseInt(this.size,10);return isNaN(t)?Ki.medium:t}render(){let t=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${t}px`),c`
234
234
  <div class="spinner-container ${this.compact?"compact":""}">
235
235
  <svg
236
236
  class="spinner"
@@ -249,7 +249,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
249
249
  />
250
250
  </svg>
251
251
  </div>
252
- `}};Me.styles=[_a],s([p({type:String})],Me.prototype,"color",2),s([p({type:String})],Me.prototype,"size",2),s([p({type:Boolean})],Me.prototype,"compact",2),Me=s([y("primer-spinner")],Me);var Fr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Jt=i=>(...e)=>({_$litDirective$:i,values:e}),Et=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Z=Jt(class extends Et{constructor(i){if(super(i),i.type!==Fr.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(e=>i[e]).join(" ")+" "}update(i,[e]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=i.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let o=!!e[r];o===this.st.has(r)||this.nt?.has(r)||(o?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return _e}});var Sa=f`
252
+ `}};Pe.styles=[_a],s([p({type:String})],Pe.prototype,"color",2),s([p({type:String})],Pe.prototype,"size",2),s([p({type:Boolean})],Pe.prototype,"compact",2),Pe=s([y("primer-spinner")],Pe);var Br={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Jt=i=>(...e)=>({_$litDirective$:i,values:e}),Et=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Z=Jt(class extends Et{constructor(i){if(super(i),i.type!==Br.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(e=>i[e]).join(" ")+" "}update(i,[e]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=i.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let o=!!e[r];o===this.st.has(r)||this.nt?.has(r)||(o?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return Se}});var Sa=f`
253
253
  * {
254
254
  box-sizing: border-box;
255
255
  }
@@ -336,7 +336,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
336
336
  :host([disabled]) {
337
337
  color: var(--primer-color-text-disabled);
338
338
  }
339
- `;var He=class extends v{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return c`<label for=${this.for}><slot></slot></label>`}};He.styles=[Ma],s([p({type:String,reflect:!0})],He.prototype,"for",2),s([p({type:Boolean,reflect:!0})],He.prototype,"disabled",2),He=s([y("primer-input-label")],He);var Ta=f`
339
+ `;var He=class extends v{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return c`<label for=${this.for}><slot></slot></label>`}};He.styles=[Ma],s([p({type:String,reflect:!0})],He.prototype,"for",2),s([p({type:Boolean,reflect:!0})],He.prototype,"disabled",2),He=s([y("primer-input-label")],He);var Pa=f`
340
340
  :host {
341
341
  display: contents;
342
342
  }
@@ -530,7 +530,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
530
530
  </span>
531
531
  ${this.renderCheckmark()}
532
532
  </button>
533
- `}};de.styles=[w,Ta],s([p({type:String})],de.prototype,"variant",2),s([p({type:Boolean,reflect:!0})],de.prototype,"disabled",2),s([p({type:Boolean,reflect:!0})],de.prototype,"loading",2),s([p({type:String})],de.prototype,"buttonType",2),s([p({type:String,reflect:!0})],de.prototype,"selectionState",2),s([p({type:Boolean,reflect:!0})],de.prototype,"selectable",2),de=s([y("primer-button")],de);var Pa=f`
533
+ `}};de.styles=[w,Pa],s([p({type:String,reflect:!0})],de.prototype,"variant",2),s([p({type:Boolean,reflect:!0})],de.prototype,"disabled",2),s([p({type:Boolean,reflect:!0})],de.prototype,"loading",2),s([p({type:String,attribute:"type"})],de.prototype,"buttonType",2),s([p({type:String,reflect:!0})],de.prototype,"selectionState",2),s([p({type:Boolean,reflect:!0})],de.prototype,"selectable",2),de=s([y("primer-button")],de);var Ta=f`
534
534
  :host {
535
535
  display: contents;
536
536
  }
@@ -555,17 +555,17 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
555
555
  >
556
556
  <slot></slot>
557
557
  </span>
558
- `}};Ue.styles=[Pa],s([p({type:String,reflect:!0})],Ue.prototype,"for",2),s([p({type:Boolean,reflect:!0})],Ue.prototype,"active",2),Ue=s([y("primer-input-error")],Ue);var wa={pencil:Se`
558
+ `}};Ue.styles=[Ta],s([p({type:String,reflect:!0})],Ue.prototype,"for",2),s([p({type:Boolean,reflect:!0})],Ue.prototype,"active",2),Ue=s([y("primer-input-error")],Ue);var wa={pencil:Me`
559
559
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
560
560
  <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"/>
561
561
  </svg>
562
- `,trash:Se`
562
+ `,trash:Me`
563
563
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
564
564
  <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"/>
565
565
  <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"/>
566
566
  <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"/>
567
567
  </svg>
568
- `,"successful-check":Se`
568
+ `,"successful-check":Me`
569
569
  <svg
570
570
  viewBox="0 0 56 56"
571
571
  fill="none"
@@ -580,7 +580,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
580
580
  />
581
581
  </g>
582
582
  </svg>
583
- `,"failure-icon":Se`
583
+ `,"failure-icon":Me`
584
584
  <svg
585
585
  viewBox="0 0 40 40"
586
586
  fill="none"
@@ -592,20 +592,20 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
592
592
  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"
593
593
  />
594
594
  </svg>
595
- `,"payment-card":Se`
595
+ `,"payment-card":Me`
596
596
  <svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
597
597
  <rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
598
598
  <rect y="6.74805" width="28" height="4" fill="#212121"/>
599
599
  <rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
600
600
  </svg>
601
- `,"chevron-down":Se`
601
+ `,"chevron-down":Me`
602
602
  <svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
603
603
  <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"/>
604
- </svg>`,checkmark:Se`
604
+ </svg>`,checkmark:Me`
605
605
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
606
606
  <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"/>
607
607
  </svg>
608
- `,close:Se`
608
+ `,close:Me`
609
609
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
610
610
  <path
611
611
  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"
@@ -654,11 +654,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
654
654
  /* --internal used for abstracting away the icon component */
655
655
  fill: var(--internal-icon-color, currentColor);
656
656
  }
657
- `;var Pe=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let t=this.name?wa[this.name]:null;return c`
657
+ `;var we=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let t=this.name?wa[this.name]:null;return c`
658
658
  <div style="--internal-icon-color: ${this.color}">
659
659
  ${t||c`<slot></slot>`}
660
660
  </div>
661
- `}};Pe.styles=[ka],s([p({type:String})],Pe.prototype,"color",2),s([p({type:String})],Pe.prototype,"size",2),s([p({reflect:!0})],Pe.prototype,"name",2),Pe=s([y("primer-icon")],Pe);var Ia=f`
661
+ `}};we.styles=[ka],s([p({type:String,reflect:!0})],we.prototype,"color",2),s([p({type:String,reflect:!0})],we.prototype,"size",2),s([p({reflect:!0})],we.prototype,"name",2),we=s([y("primer-icon")],we);var Ia=f`
662
662
  :host {
663
663
  display: flex;
664
664
  flex-direction: column;
@@ -708,7 +708,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
708
708
  </primer-icon>
709
709
  <p>Payment failed</p>
710
710
  ${this.description?c`<p class="secondary">${this.description}</p>`:c`<p class="secondary">Something went wrong.</p>`}
711
- `}};Ye.styles=[Ia],s([p({type:String})],Ye.prototype,"type",2),s([p({type:String})],Ye.prototype,"description",2),Ye=s([y("primer-checkout-state")],Ye);var Na=f`
711
+ `}};Ye.styles=[Ia],s([p({type:String,reflect:!0})],Ye.prototype,"type",2),s([p({type:String,reflect:!0})],Ye.prototype,"description",2),Ye=s([y("primer-checkout-state")],Ye);var Na=f`
712
712
  :host {
713
713
  display: contents;
714
714
  }
@@ -1220,7 +1220,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1220
1220
  </div>
1221
1221
  </div>
1222
1222
  </div>
1223
- `:h})}};ee.styles=[w,Da],s([b({context:J,subscribe:!0}),p()],ee.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p()],ee.prototype,"sdkState",2),s([b({context:W,subscribe:!0}),p({type:Object})],ee.prototype,"headlessUtils",2),s([b({context:yr,subscribe:!0}),p()],ee.prototype,"klarnaCategories",2),s([I()],ee.prototype,"selectedCategory",2),s([I()],ee.prototype,"isExpanded",2),s([I()],ee.prototype,"headerAriaLabel",2),s([Ve("#klarna-category-container")],ee.prototype,"klarnaContainer",2),ee=s([y("primer-klarna"),$()],ee);var Va=f`
1223
+ `:h})}};ee.styles=[w,Da],s([b({context:J,subscribe:!0}),p()],ee.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p()],ee.prototype,"sdkState",2),s([b({context:W,subscribe:!0}),p({type:Object})],ee.prototype,"headlessUtils",2),s([b({context:br,subscribe:!0}),p()],ee.prototype,"klarnaCategories",2),s([I()],ee.prototype,"selectedCategory",2),s([I()],ee.prototype,"isExpanded",2),s([I()],ee.prototype,"headerAriaLabel",2),s([Ve("#klarna-category-container")],ee.prototype,"klarnaContainer",2),ee=s([y("primer-klarna"),$()],ee);var Va=f`
1224
1224
  :host {
1225
1225
  display: contents;
1226
1226
  }
@@ -1317,7 +1317,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1317
1317
  flex-direction: column;
1318
1318
  }
1319
1319
  }
1320
- `;function Ua(){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 Br=class{constructor(e,t){this.formState=Ua();this.host=e,this.validate=t,e.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(e,t){let r=this.formState[e];r.value=t,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(e,t=!1){t&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),e.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:e}})),this.host.requestUpdate()}setFieldTouched(e){this.formState[e].touched||(this.formState[e].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Ua(),this.host.requestUpdate()}isValidFieldName(e){return!!e&&["firstName","lastName","emailAddress"].includes(e)}hostConnected(){}hostDisconnected(){}};var pe=class extends v{constructor(){super(...arguments);this.formController=new Br(this,t=>this._paymentMethodManagerTask.value.setAndValidate(t));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new D(this,{task:async([t])=>t!=="STRIPE_ACH"?L:this.paymentManagers.get(t)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(t,r){let o=t.target;this.formController.setFieldValue(r,o.value)}_handleBlur(t){this.formController.setFieldTouched(t)}_handleError(t){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error occurred")}}))}async _handleSubmitButtonClick(t){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await t.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(t);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(t){try{await t.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}renderForm(t){return c`
1320
+ `;function Ua(){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 Kr=class{constructor(e,t){this.formState=Ua();this.host=e,this.validate=t,e.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(e,t){let r=this.formState[e];r.value=t,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(e,t=!1){t&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),e.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:e}})),this.host.requestUpdate()}setFieldTouched(e){this.formState[e].touched||(this.formState[e].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Ua(),this.host.requestUpdate()}isValidFieldName(e){return!!e&&["firstName","lastName","emailAddress"].includes(e)}hostConnected(){}hostDisconnected(){}};var pe=class extends v{constructor(){super(...arguments);this.formController=new Kr(this,t=>this._paymentMethodManagerTask.value.setAndValidate(t));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new D(this,{task:async([t])=>t!=="STRIPE_ACH"?L:this.paymentManagers.get(t)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(t,r){let o=t.target;this.formController.setFieldValue(r,o.value)}_handleBlur(t){this.formController.setFieldTouched(t)}_handleError(t){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error occurred")}}))}async _handleSubmitButtonClick(t){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await t.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(t);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(t){try{await t.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}renderForm(t){return c`
1321
1321
  <h2>
1322
1322
  ${A("payWithAch",{id:"payWithAch"})}
1323
1323
  </h2>
@@ -1597,7 +1597,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1597
1597
  </slot>
1598
1598
  `:c`
1599
1599
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1600
- ${U(this.hasAssignedContent,()=>h,()=>c`
1600
+ ${V(this.hasAssignedContent,()=>h,()=>c`
1601
1601
  <div
1602
1602
  class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
1603
1603
  >
@@ -1628,10 +1628,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1628
1628
  height: 100%;
1629
1629
  flex: 1;
1630
1630
  }
1631
- `;var we=class extends v{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new D(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return L;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new D(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),n=t.createButton(),l=this.createRenderOptions(o);return await n.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),t}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let t=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return t+2*r}createRenderOptions(t){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:t}}:r==="PAYPAL"?{style:{buttonHeight:t}}:{style:{buttonHeight:t}}}updated(t){t.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>h,complete:()=>c`
1631
+ `;var ke=class extends v{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new D(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return L;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new D(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),n=t.createButton(),l=this.createRenderOptions(o);return await n.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),t}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let t=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return t+2*r}createRenderOptions(t){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:t}}:r==="PAYPAL"?{style:{buttonHeight:t}}:{style:{buttonHeight:t}}}updated(t){t.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>h,complete:()=>c`
1632
1632
  <!-- The native button container is rendered first -->
1633
1633
  <div class="native-button-container" id="${this._buttonId}"></div>
1634
- `,pending:()=>h})}};we.styles=[w,Ba],s([p({type:Object})],we.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p()],we.prototype,"paymentManagers",2),s([b({context:$e,subscribe:!0}),p()],we.prototype,"computedStyles",2),we=s([y("primer-native-payment")],we);var Kr="card-form-context";var Ka=f`
1634
+ `,pending:()=>h})}};ke.styles=[w,Ba],s([p({type:Object})],ke.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p()],ke.prototype,"paymentManagers",2),s([b({context:$e,subscribe:!0}),p()],ke.prototype,"computedStyles",2),ke=s([y("primer-native-payment")],ke);var jr="card-form-context";var Ka=f`
1635
1635
  :host {
1636
1636
  display: contents;
1637
1637
  }
@@ -1654,10 +1654,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1654
1654
  display: flex;
1655
1655
  gap: var(--primer-space-small);
1656
1656
  }
1657
- `;var ke=class extends v{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:Kr,initialValue:null});this.eventsController=new gt(this);this.setupCardFormTask=new D(this,{task:async([t])=>{if(!t?.manager)return L;let{manager:r}=t,{cardNumberInput:o,expiryInput:n,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:n,cvvInput:l,setCardholderName:g=>r.setCardholderName(g),setCardNetwork:g=>{this.selectedCardNetwork=g},validate:()=>r.validate(),submit:g=>r.submit(g)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=t=>{let o=t.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(t.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=t=>{t.stopPropagation(),this.submitCardPayment()};this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=t=>{t.preventDefault(),t.stopPropagation(),this.submitCardPayment()}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(t){let r=t.tagName.toLowerCase(),o=r==="button",n=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||n&&(t.getAttribute("buttonType")==="submit"||t.hasAttribute("data-submit"))}async submitCardPayment(){let t=this.cardFormProvider.value;if(!t)return;let r=await t.validate?.();if(r?.valid){let o=await t.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...t,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===De.ERROR||this.setupCardFormTask.status===De.INITIAL?h:c`
1657
+ `;var Ee=class extends v{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:jr,initialValue:null});this.eventsController=new gt(this);this.setupCardFormTask=new D(this,{task:async([t])=>{if(!t?.manager)return L;let{manager:r}=t,{cardNumberInput:o,expiryInput:n,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:n,cvvInput:l,setCardholderName:g=>r.setCardholderName(g),setCardNetwork:g=>{this.selectedCardNetwork=g},validate:()=>r.validate(),submit:g=>r.submit(g),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=t=>{let o=t.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(t.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=t=>{t.stopPropagation(),this.submitCardPayment()};this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=t=>{t.preventDefault(),t.stopPropagation(),this.submitCardPayment()}}updated(t){super.updated(t),t.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(t){let r=t.tagName.toLowerCase(),o=r==="button",n=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||n&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))}async submitCardPayment(){let t=this.cardFormProvider.value;if(!t)return;let r=await t.validate?.();if(r?.valid){let o=await t.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...t,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===De.ERROR||this.setupCardFormTask.status===De.INITIAL?h:c`
1658
1658
  <form @submit=${this.handleFormSubmit}>
1659
1659
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1660
- ${this.setupCardFormTask.render({complete:()=>U(this.hasAssignedContent,()=>h,()=>c`
1660
+ ${this.setupCardFormTask.render({complete:()=>V(this.hasAssignedContent,()=>h,()=>c`
1661
1661
  <div class="card-form">
1662
1662
  <primer-input-card-number></primer-input-card-number>
1663
1663
  <div class="card-form-row">
@@ -1669,7 +1669,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1669
1669
  <primer-card-form-submit></primer-card-form-submit>
1670
1670
  `)})}
1671
1671
  </form>
1672
- `}};ke.styles=[w,Ka],s([I()],ke.prototype,"hasAssignedContent",2),s([I()],ke.prototype,"selectedCardNetwork",2),s([b({context:J,subscribe:!0}),p({type:Object})],ke.prototype,"paymentManagers",2),ke=s([y("primer-card-form"),$()],ke);function ja(i,e){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!e.shadowRoot?.querySelector("style[data-custom-input-style]")){let t=document.createElement("style");t.setAttribute("data-custom-input-style",""),t.textContent=`
1672
+ `}};Ee.styles=[w,Ka],s([p({type:Boolean,attribute:"hide-labels",reflect:!0})],Ee.prototype,"hideLabels",2),s([I()],Ee.prototype,"hasAssignedContent",2),s([I()],Ee.prototype,"selectedCardNetwork",2),s([b({context:J,subscribe:!0}),p({type:Object})],Ee.prototype,"paymentManagers",2),Ee=s([y("primer-card-form"),$()],Ee);function ja(i,e){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!e.shadowRoot?.querySelector("style[data-custom-input-style]")){let t=document.createElement("style");t.setAttribute("data-custom-input-style",""),t.textContent=`
1673
1673
  input[data-custom-input]::placeholder {
1674
1674
  color: var(--primer-color-text-placeholder);
1675
1675
  font-size: var(--primer-typography-body-large-size);
@@ -1678,25 +1678,28 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1678
1678
  input[data-custom-input]:focus {
1679
1679
  outline: none;
1680
1680
  }
1681
- `,e.shadowRoot?e.shadowRoot.appendChild(t):e.appendChild(t)}}function jr(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 Ga(i,e){return i.active===e.active&&i.dirty===e.dirty&&i.error===e.error&&i.errorCode===e.errorCode&&i.submitted===e.submitted&&i.touched===e.touched&&i.valid===e.valid}var Gr=class{constructor(e,t){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=e,this.config=t,this.host.addController(this),this.setupTask=new D(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:e}=this.config,t=this.host.cardFormContext;return t?{cardNumber:t.cardNumberInput,cvv:t.cvvInput,expire:t.expiryInput,cardholderName:"cardholderName"}[e]:void 0}async setupHostedInput([e]){if(!e)return L;await this.host.updateComplete;let t=this.getTargetContainer();return t?e==="cardholderName"?this.setupStandardInput(t):this.setupHostedIframeInput(e,t):L}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(e){let t=document.createElement("input");return t.type="text",t.placeholder=this.host.placeholder,ja(t,this.host),(this.host.ariaLabel||this.host.label)&&t.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(t),e.innerHTML="",e.appendChild(t),this._standardInput=t,!0}setupInputEventListeners(e){e.addEventListener("input",t=>{let r=t.target;this.config.onInput?.(r.value)}),e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(e,t){await new Promise(n=>requestAnimationFrame(()=>n())),this._hostedInput=e;let r=jr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),e.addEventListener("change",n=>{this._meta=n,Ga(this._meta,n)&&this.host.requestUpdate()}),await e.render(t,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var X=class extends v{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(t){return t?typeof t=="string"?t:A(t.id,{id:t.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(t){let r=this.label;t!==""?(this._userAssignedProps.add("label"),this._internalLabel=t):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(t){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=t,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(t){let r=this.ariaLabel;t!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=t):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new Gr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let t=this.hostedInputController.meta;return t.submitted||t.dirty&&t.touched?t.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
1681
+ `,e.shadowRoot?e.shadowRoot.appendChild(t):e.appendChild(t)}}function Gr(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 Ga(i,e){return i.active===e.active&&i.dirty===e.dirty&&i.error===e.error&&i.errorCode===e.errorCode&&i.submitted===e.submitted&&i.touched===e.touched&&i.valid===e.valid}var qr=class{constructor(e,t){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=e,this.config=t,this.host.addController(this),this.setupTask=new D(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:e}=this.config,t=this.host.cardFormContext;return t?{cardNumber:t.cardNumberInput,cvv:t.cvvInput,expire:t.expiryInput,cardholderName:"cardholderName"}[e]:void 0}async setupHostedInput([e]){if(!e)return L;await this.host.updateComplete;let t=this.getTargetContainer();return t?e==="cardholderName"?this.setupStandardInput(t):this.setupHostedIframeInput(e,t):L}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(e){let t=document.createElement("input");return t.type="text",t.placeholder=this.host.placeholder,ja(t,this.host),(this.host.ariaLabel||this.host.label)&&t.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(t),e.innerHTML="",e.appendChild(t),this._standardInput=t,!0}setupInputEventListeners(e){e.addEventListener("input",t=>{let r=t.target;this.config.onInput?.(r.value)}),e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(e,t){await new Promise(n=>requestAnimationFrame(()=>n())),this._hostedInput=e;let r=Gr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),e.addEventListener("change",n=>{this._meta=n,Ga(this._meta,n)&&this.host.requestUpdate()}),await e.render(t,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var X=class extends v{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(t){return t?typeof t=="string"?t:A(t.id,{id:t.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(t){let r=this.label;t!==""?(this._userAssignedProps.add("label"),this._internalLabel=t):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(t){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=t,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(t){let r=this.ariaLabel;t!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=t):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new qr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let t=this.hostedInputController.meta;return t.submitted||t.dirty&&t.touched?t.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
1682
1682
  <primer-input-wrapper
1683
1683
  .focusWithin="${this.hostedInputController.isFocused}"
1684
1684
  .hasError=${!!t}
1685
1685
  @wrapper-click="${this.handleWrapperClick}"
1686
1686
  >
1687
- <primer-input-label slot="label">${this.label}</primer-input-label>
1687
+ ${V(!this.cardFormContext?.hideLabels,()=>c`<primer-input-label slot="label"
1688
+ >${this.label}</primer-input-label
1689
+ >`,()=>h)}
1688
1690
  <div
1689
1691
  slot="input"
1690
1692
  class="card-input-slot"
1691
1693
  id="${this.config.containerSelector.substring(1)}"
1694
+ aria-label="${this.ariaLabel}"
1692
1695
  ></div>
1693
- ${U(t,()=>c`
1696
+ ${V(t,()=>c`
1694
1697
  <primer-input-error slot="error">
1695
1698
  ${A(t,{id:t})}
1696
1699
  </primer-input-error>
1697
1700
  `,()=>h)}
1698
1701
  </primer-input-wrapper>
1699
- `}};s([b({context:Kr,subscribe:!0})],X.prototype,"cardFormContext",2),s([b({context:$e,subscribe:!0}),p()],X.prototype,"computedStyles",2),s([p({type:String})],X.prototype,"label",1),s([p({type:String})],X.prototype,"placeholder",1),s([p({type:String,attribute:"aria-label"})],X.prototype,"ariaLabel",1);var qa=f`
1702
+ `}};s([b({context:jr,subscribe:!0})],X.prototype,"cardFormContext",2),s([b({context:$e,subscribe:!0}),p()],X.prototype,"computedStyles",2),s([p({type:String})],X.prototype,"label",1),s([p({type:String})],X.prototype,"placeholder",1),s([p({type:String,attribute:"aria-label"})],X.prototype,"ariaLabel",1);var qa=f`
1700
1703
  :host {
1701
1704
  display: contents;
1702
1705
  }
@@ -1729,8 +1732,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1729
1732
  .focusWithin="${this.hostedInputController.isFocused}"
1730
1733
  .hasError=${!!t}
1731
1734
  >
1732
- <primer-input-label slot="label">${this.label}</primer-input-label>
1733
- <div slot="input" class="card-number-container">
1735
+ ${V(!this.cardFormContext?.hideLabels,()=>c`<primer-input-label slot="label"
1736
+ >${this.label}</primer-input-label
1737
+ >`,()=>h)}
1738
+ <div
1739
+ slot="input"
1740
+ class="card-number-container"
1741
+ aria-label="${this.ariaLabel}"
1742
+ >
1734
1743
  <div id="${this.config.containerSelector.substring(1)}"></div>
1735
1744
  <div class="network-selector-container">
1736
1745
  <primer-card-network-selector
@@ -1738,7 +1747,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1738
1747
  ></primer-card-network-selector>
1739
1748
  </div>
1740
1749
  </div>
1741
- ${U(t,r=>c`
1750
+ ${V(t,r=>c`
1742
1751
  <primer-input-error slot="error">
1743
1752
  ${A(r,{id:r})}
1744
1753
  </primer-input-error>
@@ -1762,7 +1771,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1762
1771
  }
1763
1772
  `;var ce=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=t=>{if(t.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:A("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
1764
1773
  <primer-button
1765
- buttonType="submit"
1774
+ type="submit"
1766
1775
  variant=${this.variant}
1767
1776
  ?disabled=${this.disabled}
1768
1777
  @click=${this.handleClick}
@@ -1771,7 +1780,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1771
1780
  >
1772
1781
  ${this.buttonText}${r}
1773
1782
  </primer-button>
1774
- `}};ce.styles=[w,Ja],s([p({type:String})],ce.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],ce.prototype,"headlessInstance",2),s([b({context:Le,subscribe:!0}),p({type:Object})],ce.prototype,"clientOptions",2),s([b({context:j,subscribe:!0}),p()],ce.prototype,"sdkState",2),s([p({type:String})],ce.prototype,"variant",2),s([p({type:Boolean})],ce.prototype,"disabled",2),ce=s([y("primer-card-form-submit"),$()],ce);var{I:rE}=ua;var Qa=i=>i.strings===void 0;var er=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),er(r,e);return!0},qr=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},en=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),cl(e)}};function dl(i){this._$AN!==void 0?(qr(this),this._$AM=i,en(this)):this._$AM=i}function pl(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)er(r[n],!1),qr(r[n]);else r!=null&&(er(r,!1),qr(r));else er(this,i)}var cl=i=>{i.type==Fr.CHILD&&(i._$AP??(i._$AP=pl),i._$AQ??(i._$AQ=dl))},Wr=class extends Et{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),en(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(er(this,e),qr(this))}setValue(e){if(Qa(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var qi=()=>new Gi,Gi=class{},ji=new WeakMap,Zr=Jt(class extends Wr{render(i){return h}update(i,[e]){let t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),h}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=ji.get(e);t===void 0&&(t=new WeakMap,ji.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?ji.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 tn=f`
1783
+ `}};ce.styles=[w,Ja],s([p({type:String})],ce.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],ce.prototype,"headlessInstance",2),s([b({context:Le,subscribe:!0}),p({type:Object})],ce.prototype,"clientOptions",2),s([b({context:j,subscribe:!0}),p()],ce.prototype,"sdkState",2),s([p({type:String})],ce.prototype,"variant",2),s([p({type:Boolean})],ce.prototype,"disabled",2),ce=s([y("primer-card-form-submit"),$()],ce);var{I:rE}=ua;var Qa=i=>i.strings===void 0;var er=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),er(r,e);return!0},Wr=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},en=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),cl(e)}};function dl(i){this._$AN!==void 0?(Wr(this),this._$AM=i,en(this)):this._$AM=i}function pl(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)er(r[n],!1),Wr(r[n]);else r!=null&&(er(r,!1),Wr(r));else er(this,i)}var cl=i=>{i.type==Br.CHILD&&(i._$AP??(i._$AP=pl),i._$AQ??(i._$AQ=dl))},Zr=class extends Et{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),en(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(er(this,e),Wr(this))}setValue(e){if(Qa(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var qi=()=>new Gi,Gi=class{},ji=new WeakMap,Xr=Jt(class extends Zr{render(i){return h}update(i,[e]){let t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),h}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=ji.get(e);t===void 0&&(t=new WeakMap,ji.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?ji.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 tn=f`
1775
1784
  :host {
1776
1785
  display: flex;
1777
1786
  align-items: center;
@@ -1893,7 +1902,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1893
1902
  }
1894
1903
  `;var me=class extends v{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=qi();this.dropdownRef=qi();this.networkOptionRefs=[];this.handleClickOutside=t=>{this.isDropdownOpen&&(this.contains(t.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=t=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(t.target)||this===t.target||this.isDropdownOpen&&t.target===document.body)))switch(this.isKeyboardNavigation=!0,t.key){case"ArrowDown":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(t.preventDefault(),this.selectNetwork(t,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(t.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(t.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=t=>{this.isDropdownOpen&&this.handleKeyDown(t)}}toggleDropdown(t){this.isKeyboardNavigation=!1,t.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(t){return this.headlessUtils?.getCardNetworkAsset(t.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let t=this.getDetectedNetwork();if(!t)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===t.network);return r>=0?r:0}selectNetwork(t,r){t.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(t,r){this.networkOptionRefs[r]=t}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return c`<primer-spinner size="small" compact></primer-spinner>`;let t=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&t.length===0)return c`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(t.length>0?t[0]:null);if(!r)return c`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=t.length>1;return c`
1895
1904
  <button
1896
- ${Zr(this.buttonRef)}
1905
+ ${Xr(this.buttonRef)}
1897
1906
  class="network-selector"
1898
1907
  @click=${this.toggleDropdown}
1899
1908
  @keydown=${n=>{(n.key===" "||n.key==="Enter")&&o&&(n.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
@@ -1907,7 +1916,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1907
1916
  src=${this.getNetworkIconUrl(r)}
1908
1917
  alt=${r.displayName}
1909
1918
  />
1910
- ${U(o,()=>c`
1919
+ ${V(o,()=>c`
1911
1920
  <primer-icon
1912
1921
  class="caret ${this.isDropdownOpen?"open":""}"
1913
1922
  name="chevron-down"
@@ -1915,9 +1924,9 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1915
1924
  `,()=>h)}
1916
1925
  </button>
1917
1926
 
1918
- ${U(this.isDropdownOpen,()=>c`
1927
+ ${V(this.isDropdownOpen,()=>c`
1919
1928
  <div
1920
- ${Zr(this.dropdownRef)}
1929
+ ${Xr(this.dropdownRef)}
1921
1930
  id="network-dropdown"
1922
1931
  class="dropdown open"
1923
1932
  role="listbox"
@@ -1925,7 +1934,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1925
1934
  >
1926
1935
  ${t.map((n,l)=>c`
1927
1936
  <div
1928
- ${Zr(g=>this.setNetworkOptionRef(g,l))}
1937
+ ${Xr(g=>this.setNetworkOptionRef(g,l))}
1929
1938
  class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
1930
1939
  @click=${g=>this.selectNetwork(g,n)}
1931
1940
  @keydown=${g=>{(g.key==="Enter"||g.key===" ")&&this.selectNetwork(g,n)}}
@@ -1939,7 +1948,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1939
1948
  alt=${n.displayName}
1940
1949
  />
1941
1950
  <span class="network-name">${n.displayName}</span>
1942
- ${U(n.network===r.network,()=>c`
1951
+ ${V(n.network===r.network,()=>c`
1943
1952
  <primer-icon
1944
1953
  class="checkmark"
1945
1954
  name="checkmark"
@@ -1949,7 +1958,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1949
1958
  `)}
1950
1959
  </div>
1951
1960
  `,()=>h)}
1952
- `}};me.styles=[w,tn],s([b({context:vr,subscribe:!0})],me.prototype,"cardNetworks",2),s([b({context:W,subscribe:!0})],me.prototype,"headlessUtils",2),s([I()],me.prototype,"selectedCardNetwork",2),s([I()],me.prototype,"isDropdownOpen",2),s([I()],me.prototype,"focusedNetworkIndex",2),s([I()],me.prototype,"isKeyboardNavigation",2),me=s([y("primer-card-network-selector")],me);var ml=Ro(Zi(),1),Ke=Ro(Zi(),1);function Xi(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function ul(i){return i?i===i.toUpperCase()?Xi(i):i:""}function rn(i,e){return[i,e].filter(Boolean).join(" ")}function hl(i,e){return!i||!e?"":`Expires ${i}/${e.slice(-2)}`}function on(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function gl(i){let e=i.paymentInstrumentData,t=ul(e.network),r=e.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${t} ${on(r)}`:t)||" Card"}`,n=hl(e.expirationMonth,e.expirationYear);return{description:o,secondaryDescription:n}}function fl(i){let e=i.paymentInstrumentData,t=e.externalPayerInfo?.email||"",r=e.externalPayerInfo?.firstName||"",o=e.externalPayerInfo?.lastName||"",n=i.userDescription||t||"PayPal Account",l=rn(r,o);return{description:n,secondaryDescription:l}}function vl(i){let e=i.paymentInstrumentData,t=e.sessionData?.billingAddress?.email||"",r=e.sessionData?.billingAddress?.firstName||"",o=e.sessionData?.billingAddress?.lastName||"",n=i.userDescription||(t?`Klarna - ${t}`:"Klarna Account"),l=rn(r,o);return{description:n,secondaryDescription:l}}function yl(i){let e=i.paymentInstrumentData,t=e.accountNumberLastFourDigits||"",r=e.bankName||"",o=e.accountType||"",n=i.userDescription;n||(r&&t?n=`${r} ${on(t)}`:r?n=r:n="Bank Account");let l=o?`${Xi(o)} Account`:"";return{description:n,secondaryDescription:l}}function bl(i){let e=i.paymentInstrumentType,t=Xi(e.replace(/_/g," "));return{description:i.userDescription||t}}var El={[Ke.PaymentInstrumentType.CARD]:gl,[Ke.PaymentInstrumentType.PAYPAL_VAULTED]:fl,[Ke.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:vl,[Ke.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:yl};function Xr(i){try{let e=El[i.paymentInstrumentType];return e?e(i):bl(i)}catch(e){return R.error("FormatUtils",`Error formatting payment method ${i.id}:`,e),{description:i.userDescription||i.id||"Payment Method"}}}var an=f`
1961
+ `}};me.styles=[w,tn],s([b({context:yr,subscribe:!0})],me.prototype,"cardNetworks",2),s([b({context:W,subscribe:!0})],me.prototype,"headlessUtils",2),s([I()],me.prototype,"selectedCardNetwork",2),s([I()],me.prototype,"isDropdownOpen",2),s([I()],me.prototype,"focusedNetworkIndex",2),s([I()],me.prototype,"isKeyboardNavigation",2),me=s([y("primer-card-network-selector")],me);var ml=Ro(Zi(),1),Ke=Ro(Zi(),1);function Xi(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function ul(i){return i?i===i.toUpperCase()?Xi(i):i:""}function rn(i,e){return[i,e].filter(Boolean).join(" ")}function hl(i,e){return!i||!e?"":`Expires ${i}/${e.slice(-2)}`}function on(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function gl(i){let e=i.paymentInstrumentData,t=ul(e.network),r=e.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${t} ${on(r)}`:t)||" Card"}`,n=hl(e.expirationMonth,e.expirationYear);return{description:o,secondaryDescription:n}}function fl(i){let e=i.paymentInstrumentData,t=e.externalPayerInfo?.email||"",r=e.externalPayerInfo?.firstName||"",o=e.externalPayerInfo?.lastName||"",n=i.userDescription||t||"PayPal Account",l=rn(r,o);return{description:n,secondaryDescription:l}}function vl(i){let e=i.paymentInstrumentData,t=e.sessionData?.billingAddress?.email||"",r=e.sessionData?.billingAddress?.firstName||"",o=e.sessionData?.billingAddress?.lastName||"",n=i.userDescription||(t?`Klarna - ${t}`:"Klarna Account"),l=rn(r,o);return{description:n,secondaryDescription:l}}function yl(i){let e=i.paymentInstrumentData,t=e.accountNumberLastFourDigits||"",r=e.bankName||"",o=e.accountType||"",n=i.userDescription;n||(r&&t?n=`${r} ${on(t)}`:r?n=r:n="Bank Account");let l=o?`${Xi(o)} Account`:"";return{description:n,secondaryDescription:l}}function bl(i){let e=i.paymentInstrumentType,t=Xi(e.replace(/_/g," "));return{description:i.userDescription||t}}var El={[Ke.PaymentInstrumentType.CARD]:gl,[Ke.PaymentInstrumentType.PAYPAL_VAULTED]:fl,[Ke.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:vl,[Ke.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:yl};function Jr(i){try{let e=El[i.paymentInstrumentType];return e?e(i):bl(i)}catch(e){return R.error("FormatUtils",`Error formatting payment method ${i.id}:`,e),{description:i.userDescription||i.id||"Payment Method"}}}var an=f`
1953
1962
  :host {
1954
1963
  display: block;
1955
1964
  width: 100%;
@@ -2066,9 +2075,9 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2066
2075
  transition: none;
2067
2076
  }
2068
2077
  }
2069
- `;var ir=globalThis,Jr=ir.trustedTypes,nn=Jr?Jr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Qi="$lit$",Ie=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Ie,Cl=`<${eo}>`,st=document,Qr=()=>st.createComment(""),or=i=>i===null||typeof i!="object"&&typeof i!="function",to=Array.isArray,mn=i=>to(i)||typeof i?.[Symbol.iterator]=="function",Ji=`[
2078
+ `;var ir=globalThis,Qr=ir.trustedTypes,nn=Qr?Qr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Qi="$lit$",Ie=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Ie,Cl=`<${eo}>`,st=document,ei=()=>st.createComment(""),or=i=>i===null||typeof i!="object"&&typeof i!="function",to=Array.isArray,mn=i=>to(i)||typeof i?.[Symbol.iterator]=="function",Ji=`[
2070
2079
  \f\r]`,rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,sn=/-->/g,ln=/>/g,at=RegExp(`>|${Ji}(?:([^\\s"'>=/]+)(${Ji}*=${Ji}*(?:[^
2071
- \f\r"'\`<>=]|("|')|))|$)`,"g"),dn=/'/g,pn=/"/g,un=/^(?:script|style|textarea|title)$/i,ro=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),eC=ro(1),tC=ro(2),rC=ro(3),ar=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),cn=new WeakMap,nt=st.createTreeWalker(st,129);function hn(i,e){if(!to(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return nn!==void 0?nn.createHTML(e):e}var gn=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=rr;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,V=0;for(;V<u.length&&(l.lastIndex=V,k=l.exec(u),k!==null);)V=l.lastIndex,l===rr?k[1]==="!--"?l=sn:k[1]!==void 0?l=ln:k[2]!==void 0?(un.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=at):k[3]!==void 0&&(l=at):l===at?k[0]===">"?(l=o??rr,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?at:k[3]==='"'?pn:dn):l===pn||l===dn?l=at:l===sn||l===ln?l=rr:(l=at,o=void 0);let Y=l===at&&i[g+1].startsWith("/>")?" ":"";n+=l===rr?u+Cl:_>=0?(r.push(S),u.slice(0,_)+Qi+u.slice(_)+Ie+Y):u+Ie+(_===-2?g:Y)}return[hn(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},nr=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=gn(e,t);if(this.el=i.createElement(S,r),nt.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=nt.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Qi)){let V=k[l++],Y=o.getAttribute(_).split(Ie),he=/([.?@])?(.*)/.exec(V);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?ti:he[1]==="?"?ri:he[1]==="@"?ii:dt}),o.removeAttribute(_)}else _.startsWith(Ie)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(un.test(o.tagName)){let _=o.textContent.split(Ie),V=_.length-1;if(V>0){o.textContent=Jr?Jr.emptyScript:"";for(let Y=0;Y<V;Y++)o.append(_[Y],Qr()),nt.nextNode(),u.push({type:2,index:++n});o.append(_[V],Qr())}}}else if(o.nodeType===8)if(o.data===eo)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(Ie,_+1))!==-1;)u.push({type:7,index:n}),_+=Ie.length-1}n++}}static createElement(e,t){let r=st.createElement("template");return r.innerHTML=e,r}};function lt(i,e,t=i,r){if(e===ar)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=or(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=lt(i,o._$AS(i,e.values),o,r)),e}var ei=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??st).importNode(t,!0);nt.currentNode=o;let n=nt.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new sr(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new oi(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=nt.nextNode(),l++)}return nt.currentNode=st,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},sr=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lt(this,e,t),or(e)?e===K||e==null||e===""?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==ar&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mn(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==K&&or(this._$AH)?this._$AA.nextSibling.data=e:this.T(st.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=nr.createElement(hn(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new ei(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=cn.get(e.strings);return t===void 0&&cn.set(e.strings,t=new nr(e)),t}k(e){to(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(Qr()),this.O(Qr()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=K,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=K}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=lt(this,e,t,0),l=!or(e)||e!==this._$AH&&e!==ar,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=lt(this,g[r+u],t,u),S===ar&&(S=this._$AH[u]),l||(l=!or(S)||S!==this._$AH[u]),S===K?e=K:e!==K&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ti=class extends dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}},ri=class extends dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}},ii=class extends dt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=lt(this,e,t,0)??K)===ar)return;let r=this._$AH,o=e===K&&r!==K||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==K&&(r===K||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},oi=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){lt(this,e)}},fn={M:Qi,P:Ie,A:eo,C:1,L:gn,R:ei,D:mn,V:lt,I:sr,H:dt,N:ri,U:ii,B:ti,F:oi},xl=ir.litHtmlPolyfillSupport;xl?.(nr,sr),(ir.litHtmlVersions??(ir.litHtmlVersions=[])).push("3.3.0");var Mt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},lr=i=>(...e)=>({_$litDirective$:i,values:e}),ai=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:pC}=fn;var vn=i=>i.strings===void 0;var dr=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),dr(r,e);return!0},ni=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},yn=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),Sl(e)}};function Al(i){this._$AN!==void 0?(ni(this),this._$AM=i,yn(this)):this._$AM=i}function _l(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)dr(r[n],!1),ni(r[n]);else r!=null&&(dr(r,!1),ni(r));else dr(this,i)}var Sl=i=>{i.type==Mt.CHILD&&(i._$AP??(i._$AP=_l),i._$AQ??(i._$AQ=Al))},Tt=class extends ai{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),yn(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(dr(this,e),ni(this))}setValue(e){if(vn(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var si=new WeakMap,Pt=class{constructor(e,t){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=e,this.defaultOptions=t.defaultOptions||{},this.startPaused=!!t.startPaused,this.disabled=!!t.disabled,this.onComplete=t.onComplete,si.set(this.host,this)}async add(e){this.clients.add(e),this.startPaused&&e.webAnimation?.pause(),this.pendingComplete=!0,await e.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(e){this.clients.delete(e)}pause(){this.clients.forEach(e=>e.webAnimation?.pause())}play(){this.clients.forEach(e=>e.webAnimation?.play())}cancel(){this.clients.forEach(e=>e.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(e=>e.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(e=>e.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(e=>e.finished))}};var bn=0,io=new Map,En=new WeakSet,oo=()=>new Promise(i=>requestAnimationFrame(i));var Cn=(i,e)=>{let t=i-e;return t===0?void 0:t},xn=(i,e)=>{let t=i/e;return t===1?void 0:t},li={left:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateX(${t}px)`}},top:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateY(${t}px)`}},width:(i,e)=>{let t;e===0&&(e=1,t={width:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,e)=>{let t;e===0&&(e=1,t={height:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},_n={duration:333,easing:"ease-in-out"},Sn=["left","top","width","height","opacity","color","background"],An=new WeakMap,di=class extends Tt{constructor(e){if(super(e),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,e.type===Mt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){this.l?.(),this.l=void 0}render(e){return K}getController(){return si.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(e,[t]){let r=this.u===void 0;return r&&(this.u=e.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=e.element,An.set(this.element,this)),this.optionsOrCallback=t,(r||typeof t!="function")&&this.p(t),this.render(t)}p(e){e=e??{};let t=this.getController();t!==void 0&&((e={...t.defaultOptions,...e}).keyframeOptions={...t.defaultOptions.keyframeOptions,...e.keyframeOptions}),e.properties??(e.properties=Sn),this.options=e}m(){let e={},t=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let n=t[o]??(li[o]?void 0:r[o]),l=Number(n);e[o]=isNaN(l)?n+"":l}),e}v(){let e,t=!0;return this.options.guard&&(e=this.options.guard(),t=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((n,l)=>n===o[l]))return!1}else if(o===r)return!1;return!0})(e,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&t&&this.element.isConnected,this.h&&(this._=Array.isArray(e)?Array.from(e):e),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let e;this.prepare(),await oo;let t=this.O(),r=this.j(this.options.keyframeOptions,t),o=this.m();if(this.A!==void 0){let{from:n,to:l}=this.N(this.A,o,t);this.log("measured",[this.A,o,n,l]),e=this.calculateKeyframes(n,l)}else{let n=io.get(this.options.inId);if(n){io.delete(this.options.inId);let{from:l,to:g}=this.N(n,o,t);e=this.calculateKeyframes(l,g),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,bn++,e.forEach(u=>u.zIndex=bn)}else this.options.in&&(e=[...this.options.in,{}])}this.animate(e,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&io.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await oo(),this.i?.isConnected){let t=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,t),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,n=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&n===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),n!==0&&(this.element.style.top=n+"px")}}let e=this.j(this.options.keyframeOptions);await this.animate(this.options.out,e),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(e){e&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let e=[];for(let t=this.element.parentNode;t;t=t?.parentNode){let r=An.get(t);r&&!r.isDisabled()&&r&&e.push(r)}return e}get isHostRendered(){let e=En.has(this.u);return e||this.u.updateComplete.then(()=>{En.add(this.u)}),e}j(e,t=this.O()){let r={..._n};return t.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,e),r}N(e,t,r){e={...e},t={...t};let o=r.map(g=>g.animatingProperties).filter(g=>g!==void 0),n=1,l=1;return o.length>0&&(o.forEach(g=>{g.width&&(n/=g.width),g.height&&(l/=g.height)}),e.left!==void 0&&t.left!==void 0&&(e.left=n*e.left,t.left=n*t.left),e.top!==void 0&&t.top!==void 0&&(e.top=l*e.top,t.top=l*t.top)),{from:e,to:t}}calculateKeyframes(e,t,r=!1){let o={},n={},l=!1,g={};for(let u in t){let S=e[u],k=t[u];if(u in li){let _=li[u];if(S===void 0||k===void 0)continue;let V=_(S,k);V.transform!==void 0&&(g[u]=V.value,l=!0,o.transform=`${o.transform??""} ${V.transform}`,V.overrideFrom!==void 0&&Object.assign(o,V.overrideFrom))}else S!==k&&S!==void 0&&k!==void 0&&(l=!0,o[u]=S,n[u]=k)}return o.transformOrigin=n.transformOrigin=r?"center center":"top left",this.animatingProperties=g,l?[o,n]:void 0}async animate(e,t=this.options.keyframeOptions){this.start(),this.frames=e;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=e=this.options.onFrames(this),this.log("modified frames",e)),e!==void 0)){this.log("animate",[e,t]),r=!0,this.webAnimation=this.element.animate(e,t);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(e,t){this.shouldLog&&!this.isDisabled()&&console.log(e,this.options.id,t)}},je=lr(di);var Ml=["top","right","bottom","left"],pi=class extends Tt{constructor(e){if(super(e),e.type!==Mt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(e,t){return K}update(e,[t,r]){return this.u===void 0&&(this.u=e.options?.host,this.u.addController(this)),this.S=e.element,this.C=t,this.F=r??["left","top","width","height"],this.render(t,r)}hostUpdated(){this.$()}$(){let e=typeof this.C=="function"?this.C():this.C?.value,t=e.offsetParent;if(e===void 0||!t)return;let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();this.F?.forEach(n=>{let l=Ml.includes(n)?r[n]-o[n]:r[n];this.S.style[n]=l+"px"})}},Tl=lr(pi);var ue=class extends v{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new Pt(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(t){this.isEditMode=t.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(t){this.deletePaymentMethodId=t.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=A("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(t){this.errorMessage=t instanceof Error?t.message:A("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(t){let r=t.detail?.error;this.errorMessage=r instanceof Error?r.message:A("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(t){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===t);if(!r)return"";try{return Xr(r).description||""}catch{return""}}renderLoadingOverlay(){return c`
2080
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),dn=/'/g,pn=/"/g,un=/^(?:script|style|textarea|title)$/i,ro=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),eC=ro(1),tC=ro(2),rC=ro(3),ar=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),cn=new WeakMap,nt=st.createTreeWalker(st,129);function hn(i,e){if(!to(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return nn!==void 0?nn.createHTML(e):e}var gn=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=rr;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,H=0;for(;H<u.length&&(l.lastIndex=H,k=l.exec(u),k!==null);)H=l.lastIndex,l===rr?k[1]==="!--"?l=sn:k[1]!==void 0?l=ln:k[2]!==void 0?(un.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=at):k[3]!==void 0&&(l=at):l===at?k[0]===">"?(l=o??rr,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?at:k[3]==='"'?pn:dn):l===pn||l===dn?l=at:l===sn||l===ln?l=rr:(l=at,o=void 0);let Y=l===at&&i[g+1].startsWith("/>")?" ":"";n+=l===rr?u+Cl:_>=0?(r.push(S),u.slice(0,_)+Qi+u.slice(_)+Ie+Y):u+Ie+(_===-2?g:Y)}return[hn(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},nr=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=gn(e,t);if(this.el=i.createElement(S,r),nt.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=nt.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Qi)){let H=k[l++],Y=o.getAttribute(_).split(Ie),he=/([.?@])?(.*)/.exec(H);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?ri:he[1]==="?"?ii:he[1]==="@"?oi:dt}),o.removeAttribute(_)}else _.startsWith(Ie)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(un.test(o.tagName)){let _=o.textContent.split(Ie),H=_.length-1;if(H>0){o.textContent=Qr?Qr.emptyScript:"";for(let Y=0;Y<H;Y++)o.append(_[Y],ei()),nt.nextNode(),u.push({type:2,index:++n});o.append(_[H],ei())}}}else if(o.nodeType===8)if(o.data===eo)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(Ie,_+1))!==-1;)u.push({type:7,index:n}),_+=Ie.length-1}n++}}static createElement(e,t){let r=st.createElement("template");return r.innerHTML=e,r}};function lt(i,e,t=i,r){if(e===ar)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=or(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=lt(i,o._$AS(i,e.values),o,r)),e}var ti=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??st).importNode(t,!0);nt.currentNode=o;let n=nt.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new sr(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new ai(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=nt.nextNode(),l++)}return nt.currentNode=st,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},sr=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lt(this,e,t),or(e)?e===K||e==null||e===""?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==ar&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mn(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==K&&or(this._$AH)?this._$AA.nextSibling.data=e:this.T(st.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=nr.createElement(hn(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new ti(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=cn.get(e.strings);return t===void 0&&cn.set(e.strings,t=new nr(e)),t}k(e){to(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(ei()),this.O(ei()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=K,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=K}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=lt(this,e,t,0),l=!or(e)||e!==this._$AH&&e!==ar,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=lt(this,g[r+u],t,u),S===ar&&(S=this._$AH[u]),l||(l=!or(S)||S!==this._$AH[u]),S===K?e=K:e!==K&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ri=class extends dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}},ii=class extends dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}},oi=class extends dt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=lt(this,e,t,0)??K)===ar)return;let r=this._$AH,o=e===K&&r!==K||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==K&&(r===K||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ai=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){lt(this,e)}},fn={M:Qi,P:Ie,A:eo,C:1,L:gn,R:ti,D:mn,V:lt,I:sr,H:dt,N:ii,U:oi,B:ri,F:ai},xl=ir.litHtmlPolyfillSupport;xl?.(nr,sr),(ir.litHtmlVersions??(ir.litHtmlVersions=[])).push("3.3.0");var Mt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},lr=i=>(...e)=>({_$litDirective$:i,values:e}),ni=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:pC}=fn;var vn=i=>i.strings===void 0;var dr=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),dr(r,e);return!0},si=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},yn=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),Sl(e)}};function Al(i){this._$AN!==void 0?(si(this),this._$AM=i,yn(this)):this._$AM=i}function _l(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)dr(r[n],!1),si(r[n]);else r!=null&&(dr(r,!1),si(r));else dr(this,i)}var Sl=i=>{i.type==Mt.CHILD&&(i._$AP??(i._$AP=_l),i._$AQ??(i._$AQ=Al))},Pt=class extends ni{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),yn(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(dr(this,e),si(this))}setValue(e){if(vn(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var li=new WeakMap,Tt=class{constructor(e,t){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=e,this.defaultOptions=t.defaultOptions||{},this.startPaused=!!t.startPaused,this.disabled=!!t.disabled,this.onComplete=t.onComplete,li.set(this.host,this)}async add(e){this.clients.add(e),this.startPaused&&e.webAnimation?.pause(),this.pendingComplete=!0,await e.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(e){this.clients.delete(e)}pause(){this.clients.forEach(e=>e.webAnimation?.pause())}play(){this.clients.forEach(e=>e.webAnimation?.play())}cancel(){this.clients.forEach(e=>e.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(e=>e.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(e=>e.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(e=>e.finished))}};var bn=0,io=new Map,En=new WeakSet,oo=()=>new Promise(i=>requestAnimationFrame(i));var Cn=(i,e)=>{let t=i-e;return t===0?void 0:t},xn=(i,e)=>{let t=i/e;return t===1?void 0:t},di={left:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateX(${t}px)`}},top:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateY(${t}px)`}},width:(i,e)=>{let t;e===0&&(e=1,t={width:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,e)=>{let t;e===0&&(e=1,t={height:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},_n={duration:333,easing:"ease-in-out"},Sn=["left","top","width","height","opacity","color","background"],An=new WeakMap,pi=class extends Pt{constructor(e){if(super(e),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,e.type===Mt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){this.l?.(),this.l=void 0}render(e){return K}getController(){return li.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(e,[t]){let r=this.u===void 0;return r&&(this.u=e.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=e.element,An.set(this.element,this)),this.optionsOrCallback=t,(r||typeof t!="function")&&this.p(t),this.render(t)}p(e){e=e??{};let t=this.getController();t!==void 0&&((e={...t.defaultOptions,...e}).keyframeOptions={...t.defaultOptions.keyframeOptions,...e.keyframeOptions}),e.properties??(e.properties=Sn),this.options=e}m(){let e={},t=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let n=t[o]??(di[o]?void 0:r[o]),l=Number(n);e[o]=isNaN(l)?n+"":l}),e}v(){let e,t=!0;return this.options.guard&&(e=this.options.guard(),t=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((n,l)=>n===o[l]))return!1}else if(o===r)return!1;return!0})(e,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&t&&this.element.isConnected,this.h&&(this._=Array.isArray(e)?Array.from(e):e),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let e;this.prepare(),await oo;let t=this.O(),r=this.j(this.options.keyframeOptions,t),o=this.m();if(this.A!==void 0){let{from:n,to:l}=this.N(this.A,o,t);this.log("measured",[this.A,o,n,l]),e=this.calculateKeyframes(n,l)}else{let n=io.get(this.options.inId);if(n){io.delete(this.options.inId);let{from:l,to:g}=this.N(n,o,t);e=this.calculateKeyframes(l,g),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,bn++,e.forEach(u=>u.zIndex=bn)}else this.options.in&&(e=[...this.options.in,{}])}this.animate(e,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&io.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await oo(),this.i?.isConnected){let t=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,t),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,n=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&n===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),n!==0&&(this.element.style.top=n+"px")}}let e=this.j(this.options.keyframeOptions);await this.animate(this.options.out,e),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(e){e&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let e=[];for(let t=this.element.parentNode;t;t=t?.parentNode){let r=An.get(t);r&&!r.isDisabled()&&r&&e.push(r)}return e}get isHostRendered(){let e=En.has(this.u);return e||this.u.updateComplete.then(()=>{En.add(this.u)}),e}j(e,t=this.O()){let r={..._n};return t.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,e),r}N(e,t,r){e={...e},t={...t};let o=r.map(g=>g.animatingProperties).filter(g=>g!==void 0),n=1,l=1;return o.length>0&&(o.forEach(g=>{g.width&&(n/=g.width),g.height&&(l/=g.height)}),e.left!==void 0&&t.left!==void 0&&(e.left=n*e.left,t.left=n*t.left),e.top!==void 0&&t.top!==void 0&&(e.top=l*e.top,t.top=l*t.top)),{from:e,to:t}}calculateKeyframes(e,t,r=!1){let o={},n={},l=!1,g={};for(let u in t){let S=e[u],k=t[u];if(u in di){let _=di[u];if(S===void 0||k===void 0)continue;let H=_(S,k);H.transform!==void 0&&(g[u]=H.value,l=!0,o.transform=`${o.transform??""} ${H.transform}`,H.overrideFrom!==void 0&&Object.assign(o,H.overrideFrom))}else S!==k&&S!==void 0&&k!==void 0&&(l=!0,o[u]=S,n[u]=k)}return o.transformOrigin=n.transformOrigin=r?"center center":"top left",this.animatingProperties=g,l?[o,n]:void 0}async animate(e,t=this.options.keyframeOptions){this.start(),this.frames=e;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=e=this.options.onFrames(this),this.log("modified frames",e)),e!==void 0)){this.log("animate",[e,t]),r=!0,this.webAnimation=this.element.animate(e,t);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(e,t){this.shouldLog&&!this.isDisabled()&&console.log(e,this.options.id,t)}},je=lr(pi);var Ml=["top","right","bottom","left"],ci=class extends Pt{constructor(e){if(super(e),e.type!==Mt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(e,t){return K}update(e,[t,r]){return this.u===void 0&&(this.u=e.options?.host,this.u.addController(this)),this.S=e.element,this.C=t,this.F=r??["left","top","width","height"],this.render(t,r)}hostUpdated(){this.$()}$(){let e=typeof this.C=="function"?this.C():this.C?.value,t=e.offsetParent;if(e===void 0||!t)return;let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();this.F?.forEach(n=>{let l=Ml.includes(n)?r[n]-o[n]:r[n];this.S.style[n]=l+"px"})}},Pl=lr(ci);var ue=class extends v{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new Tt(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(t){this.isEditMode=t.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(t){this.deletePaymentMethodId=t.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=A("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(t){this.errorMessage=t instanceof Error?t.message:A("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(t){let r=t.detail?.error;this.errorMessage=r instanceof Error?r.message:A("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(t){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===t);if(!r)return"";try{return Jr(r).description||""}catch{return""}}renderLoadingOverlay(){return c`
2072
2081
  <div
2073
2082
  class="loading-overlay"
2074
2083
  ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
@@ -2099,7 +2108,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2099
2108
  `}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return c`
2100
2109
  <div class="payment-methods-list">
2101
2110
  ${t.map(o=>this.renderPaymentMethodItem(o))}
2102
- ${U(r,()=>c`
2111
+ ${V(r,()=>c`
2103
2112
  <div class="submit-button-container">
2104
2113
  <primer-vault-payment-submit
2105
2114
  class="submit-button"
@@ -2117,7 +2126,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2117
2126
  @toggle-edit-mode=${this.handleToggleEditMode}
2118
2127
  ></primer-vault-manager-header>
2119
2128
 
2120
- ${U(this.errorMessage,()=>c`
2129
+ ${V(this.errorMessage,()=>c`
2121
2130
  <primer-vault-error-message
2122
2131
  .errorMessage=${this.errorMessage}
2123
2132
  @close-error=${this.handleCloseError}
@@ -2126,23 +2135,23 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2126
2135
  `,()=>h)}
2127
2136
 
2128
2137
  <div class="vault-manager-content">
2129
- ${U(!r&&!t,()=>c`
2138
+ ${V(!r&&!t,()=>c`
2130
2139
  <div class="content-container">
2131
2140
  <primer-vault-empty-state
2132
2141
  ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2133
2142
  ></primer-vault-empty-state>
2134
2143
  </div>
2135
2144
  `,()=>h)}
2136
- ${U(!r&&t,()=>c`
2145
+ ${V(!r&&t,()=>c`
2137
2146
  <div class="content-container">
2138
- ${U(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2147
+ ${V(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2139
2148
  </div>
2140
2149
  `,()=>h)}
2141
2150
  </div>
2142
2151
 
2143
- ${U(o,()=>this.renderLoadingOverlay(),()=>h)}
2152
+ ${V(o,()=>this.renderLoadingOverlay(),()=>h)}
2144
2153
  </div>
2145
- `}};ue.styles=[w,an],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ue.prototype,"vaultManagerContext",2),s([I()],ue.prototype,"isEditMode",2),s([I()],ue.prototype,"deletePaymentMethodId",2),s([I()],ue.prototype,"isDeleting",2),s([I()],ue.prototype,"errorMessage",2),s([p({type:Number})],ue.prototype,"animationDuration",2),ue=s([y("primer-vault-manager"),$()],ue);function Mn(i){return i.paymentInstrumentType===Ke.PaymentInstrumentType.CARD}var Tn=f`
2154
+ `}};ue.styles=[w,an],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ue.prototype,"vaultManagerContext",2),s([I()],ue.prototype,"isEditMode",2),s([I()],ue.prototype,"deletePaymentMethodId",2),s([I()],ue.prototype,"isDeleting",2),s([I()],ue.prototype,"errorMessage",2),s([p({type:Number})],ue.prototype,"animationDuration",2),ue=s([y("primer-vault-manager"),$()],ue);function Mn(i){return i.paymentInstrumentType===Ke.PaymentInstrumentType.CARD}var Pn=f`
2146
2155
  :host {
2147
2156
  display: flex;
2148
2157
  width: 100%;
@@ -2249,7 +2258,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2249
2258
  .delete-button primer-icon {
2250
2259
  color: var(--primer-color-red-500);
2251
2260
  }
2252
- `;var ve=class extends v{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new D(this,{task:async([t,r,o])=>{if(!t||!r||!o)return L;let n="";if(Mn(t))n=r.getCardNetworkAsset(t.paymentInstrumentData.network).cardUrl;else{let u=await r.getCDNAssets(t.paymentMethodType);u&&(n=u.assets?.icon?`${u.goatCdnUrl}/${u.assets.icon}`:"")}let l=o.cvvRecapture,g=Xr(t);return{icon:n,shouldShowCVV:l,...g}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let t=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!t&&t.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(t){let r=t.icon?c`<img
2261
+ `;var ve=class extends v{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new D(this,{task:async([t,r,o])=>{if(!t||!r||!o)return L;let n="";if(Mn(t))n=r.getCardNetworkAsset(t.paymentInstrumentData.network).cardUrl;else{let u=await r.getCDNAssets(t.paymentMethodType);u&&(n=u.assets?.icon?`${u.goatCdnUrl}/${u.assets.icon}`:"")}let l=o.cvvRecapture,g=Jr(t);return{icon:n,shouldShowCVV:l,...g}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let t=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!t&&t.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(t){let r=t.icon?c`<img
2253
2262
  class="payment-method-icon"
2254
2263
  src=${t.icon}
2255
2264
  alt=${t.description}
@@ -2290,11 +2299,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2290
2299
  `:h}
2291
2300
  </div>
2292
2301
 
2293
- ${U(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>c`<primer-vault-cvv-input
2302
+ ${V(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>c`<primer-vault-cvv-input
2294
2303
  .paymentMethod="${this.paymentMethod}"
2295
2304
  ></primer-vault-cvv-input>`,()=>h)}
2296
2305
  </div>
2297
- `}})}};ve.styles=[w,Tn],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.cvvRecapture!==r?.cvvRecapture}})],ve.prototype,"vaultManagerContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],ve.prototype,"vaultItemContext",2),s([b({context:W,subscribe:!0}),p({type:Object})],ve.prototype,"headlessUtils",2),s([p({type:Object,attribute:!1})],ve.prototype,"paymentMethod",2),s([p({type:Boolean,reflect:!0})],ve.prototype,"isEditMode",2),ve=s([y("primer-vault-payment-method-item"),$()],ve);var Pn=f`
2306
+ `}})}};ve.styles=[w,Pn],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.cvvRecapture!==r?.cvvRecapture}})],ve.prototype,"vaultManagerContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],ve.prototype,"vaultItemContext",2),s([b({context:W,subscribe:!0}),p({type:Object})],ve.prototype,"headlessUtils",2),s([p({type:Object,attribute:!1})],ve.prototype,"paymentMethod",2),s([p({type:Boolean,reflect:!0})],ve.prototype,"isEditMode",2),ve=s([y("primer-vault-payment-method-item"),$()],ve);var Tn=f`
2298
2307
  :host {
2299
2308
  display: block;
2300
2309
  width: 100%;
@@ -2338,7 +2347,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2338
2347
  </primer-button>
2339
2348
  `:h}
2340
2349
  </div>
2341
- `}};Ge.styles=[w,Pn],s([p({type:Boolean})],Ge.prototype,"isEditMode",2),s([p({type:Boolean})],Ge.prototype,"hasPaymentMethods",2),Ge=s([y("primer-vault-manager-header"),$()],Ge);var wn=f`
2350
+ `}};Ge.styles=[w,Tn],s([p({type:Boolean})],Ge.prototype,"isEditMode",2),s([p({type:Boolean})],Ge.prototype,"hasPaymentMethods",2),Ge=s([y("primer-vault-manager-header"),$()],Ge);var wn=f`
2342
2351
  :host {
2343
2352
  display: block;
2344
2353
  width: 100%;
@@ -2409,7 +2418,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2409
2418
  opacity: 0.7;
2410
2419
  cursor: not-allowed;
2411
2420
  }
2412
- `;var Ee=class extends v{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let t=this.paymentMethodName;return c`
2421
+ `;var Ce=class extends v{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let t=this.paymentMethodName;return c`
2413
2422
  <div class="delete-confirmation">
2414
2423
  <div class="delete-message">
2415
2424
  <p class="delete-text">${t}</p>
@@ -2431,7 +2440,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2431
2440
  </button>
2432
2441
  </div>
2433
2442
  </div>
2434
- `}};Ee.styles=[w,wn],s([p({type:Boolean})],Ee.prototype,"isDeleting",2),s([p({type:String})],Ee.prototype,"paymentMethodId",2),s([p({type:String})],Ee.prototype,"paymentMethodName",2),s([b({context:Q,subscribe:!0})],Ee.prototype,"vaultManager",2),Ee=s([y("primer-vault-delete-confirmation"),$()],Ee);var kn=f`
2443
+ `}};Ce.styles=[w,wn],s([p({type:Boolean})],Ce.prototype,"isDeleting",2),s([p({type:String})],Ce.prototype,"paymentMethodId",2),s([p({type:String})],Ce.prototype,"paymentMethodName",2),s([b({context:Q,subscribe:!0})],Ce.prototype,"vaultManager",2),Ce=s([y("primer-vault-delete-confirmation"),$()],Ce);var kn=f`
2435
2444
  :host {
2436
2445
  display: block;
2437
2446
  width: 100%;
@@ -2539,14 +2548,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2539
2548
  .cvv-input-container {
2540
2549
  margin-bottom: var(--primer-space-medium);
2541
2550
  }
2542
- `;var re=class extends v{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new D(this,{task:async([t,r])=>!t||!r||t.paymentMethodType!=="PAYMENT_CARD"||!t.paymentInstrumentData?.network||r.createCvvInput===null?L:{network:t.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new D(this,{task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=jr(this.computedStyles),n=o?{input:{base:o}}:void 0,l={cardNetwork:t.network,container:r,name:"cvv",placeholder:"123",style:n};this.cvvInput=await t.createCvvInput?.(l)??null,this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>h,complete:()=>c`
2551
+ `;var re=class extends v{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new D(this,{task:async([t,r])=>!t||!r||t.paymentMethodType!=="PAYMENT_CARD"||!t.paymentInstrumentData?.network||r.createCvvInput===null?L:{network:t.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new D(this,{task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=Gr(this.computedStyles),n=o?{input:{base:o}}:void 0,l={cardNetwork:t.network,container:r,name:"cvv",placeholder:"123",style:n};this.cvvInput=await t.createCvvInput?.(l)??null,this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>h,complete:()=>c`
2543
2552
  <div class="cvv-input-container">
2544
2553
  <primer-input-wrapper
2545
2554
  .hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
2546
2555
  >
2547
2556
  <primer-input-label slot="label">CVV</primer-input-label>
2548
2557
  <div slot="input" id="${this.cvvContainerId}"></div>
2549
- ${U(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>c`
2558
+ ${V(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>c`
2550
2559
  <primer-input-error slot="error">
2551
2560
  ${this.cvvError}
2552
2561
  </primer-input-error>
@@ -2602,7 +2611,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2602
2611
  message="${A(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2603
2612
  ?visible="${this.shouldShowError}"
2604
2613
  ></primer-error-message>
2605
- `:h}};qe.styles=[Rn],s([b({context:j,subscribe:!0}),I()],qe.prototype,"sdkState",2),s([p({type:Boolean,attribute:"show-processing-errors"})],qe.prototype,"showProcessingErrors",2),qe=s([y("primer-error-message-container")],qe);async function M0(){xa(),Aa()}export{pe as AchPayment,de as Button,ke as CardForm,At as CardFormCVV,me as CardFormCardNetworkSelector,xt as CardFormCardNumber,Ue as CardFormError,_t as CardFormExpiry,St as CardFormName,ce as CardFormSubmit,ae as Collapsable,Ct as Dialog,fe as DynamicPayment,ye as ErrorMessage,qe as ErrorMessageContainer,Vr as InitializedPayments,F as Input,He as InputLabel,Te as InputWrapper,we as NativePayment,ze as PaymentMethod,ot as Portal,pr as PrimerCheckoutComplete,le as PrimerCheckoutComponent,kt as PrimerCheckoutFailure,Ye as PrimerCheckoutState,Pe as PrimerIcon,ee as PrimerKlarna,Fe as PrimerMain,be as RedirectPayment,ct as ShowOtherPayments,Me as Spinner,re as VaultCvvInput,Ee as VaultDeleteConfirmation,wt as VaultEmptyState,pt as VaultErrorMessage,ue as VaultManager,Ge as VaultManagerHeader,ve as VaultPaymentMethodItem,te as VaultPaymentSubmit,nl as injectDarkTheme,al as injectLightTheme,xa as injectLoaderStyles,Aa as injectThemeStyles,M0 as loadPrimer};
2614
+ `:h}};qe.styles=[Rn],s([b({context:j,subscribe:!0}),I()],qe.prototype,"sdkState",2),s([p({type:Boolean,attribute:"show-processing-errors"})],qe.prototype,"showProcessingErrors",2),qe=s([y("primer-error-message-container")],qe);async function M0(){xa(),Aa()}export{pe as AchPayment,de as Button,Ee as CardForm,At as CardFormCVV,me as CardFormCardNetworkSelector,xt as CardFormCardNumber,Ue as CardFormError,_t as CardFormExpiry,St as CardFormName,ce as CardFormSubmit,ae as Collapsable,Ct as Dialog,fe as DynamicPayment,ye as ErrorMessage,qe as ErrorMessageContainer,Hr as InitializedPayments,F as Input,He as InputLabel,Te as InputWrapper,ke as NativePayment,ze as PaymentMethod,ot as Portal,pr as PrimerCheckoutComplete,le as PrimerCheckoutComponent,kt as PrimerCheckoutFailure,Ye as PrimerCheckoutState,we as PrimerIcon,ee as PrimerKlarna,Fe as PrimerMain,be as RedirectPayment,ct as ShowOtherPayments,Pe as Spinner,re as VaultCvvInput,Ce as VaultDeleteConfirmation,wt as VaultEmptyState,pt as VaultErrorMessage,ue as VaultManager,Ge as VaultManagerHeader,ve as VaultPaymentMethodItem,te as VaultPaymentSubmit,nl as injectDarkTheme,al as injectLightTheme,xa as injectLoaderStyles,Aa as injectThemeStyles,M0 as loadPrimer};
2606
2615
  /*! Bundled license information:
2607
2616
 
2608
2617
  @lit/context/lib/context-request-event.js: