@primer-io/primer-js 0.1.3 → 0.1.5

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,11 +1,11 @@
1
- import{a as Uo,b as on,c as Dr,d as n}from"./chunks/chunk.G45OCYEN.js";var Ar=on((Vt,po)=>{(function(o,t){typeof Vt=="object"&&typeof po=="object"?po.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Vt=="object"?Vt.Primer=t():o.Primer=t()})(Vt,()=>(()=>{"use strict";let o;var t,e,r={};r.d=(a,l)=>{for(var c in l)r.o(l,c)&&!r.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},r.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};r.r(i),r.d(i,{SuccessScreenType:()=>Xa,PaymentFlow:()=>Ga,ThreeDSecureStatus:()=>qa,TokenType:()=>Wa,isStripeOptionsDropInWithFullMandateText:()=>Ja,PaymentInstrumentType:()=>yt,ErrorCode:()=>Za,EventTypes:()=>Qa,CheckoutUXFlow:()=>ja,HeadlessManagerType:()=>en,PaymentMethodType:()=>bt,Primer:()=>tn});let s={LEGACY:"legacy",V_2_4:"2.4"},p=s.V_2_4,x=p;class h extends Error{static from(l,c=!1){if(l instanceof h)return l;let b=new h(l instanceof Error?l.message:String(l),c);return l instanceof Error&&l.stack&&(b.stack=l.stack,Object.assign(b,l)),b}markAsReported(){this.isReported=!0}constructor(l,c=!1){super(l),function(b,A,E){A in b?Object.defineProperty(b,A,{value:E,enumerable:!0,configurable:!0,writable:!0}):b[A]=E}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let O="https://analytics.production.data.primer.io/sdk-logs";var z=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),D=function(a){return a.START="START",a.END="END",a}({});let Q={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var B=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 Xe(){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 ga={get(a,l){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.3";break;case"PRIMER_ASSETS_URL":c=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":c=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return c||l}}.get("PRIMER_SDK_VERSION");async function uo(a,l,c){return{...c,createdAt:Date.now(),device:await Xe(),eventType:a,properties:l,sdkVersion:ga,sdkType:"WEB"}}let ho=Symbol.for("__primerAnalytics__"),gt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[ho];a?gt=a:window[ho]=gt}let go=()=>gt.providers,Sr=()=>gt.timers,ft=()=>gt.eventsQueue,Yt=new Map;function _r(a,l=!1,c=1){Yt.has(a)&&(clearTimeout(Yt.get(a)),Yt.delete(a));let b=()=>{let E=ft().get(a);if(E?.length){let y=!0,M=[],I=0,S=0;for(;S<E.length;){let R=E[S],H=new Blob([JSON.stringify(R)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",R),S++;continue}if(I+H>64e3&&M.length>0){try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(U){y=!1,console.error("Unable to send events",U)}if(!y)break;M=[],I=0}M.push(R),I+=H,S++}if(M.length>0&&y)try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(R){y=!1,console.error("Unable to send events",R)}y?ft().delete(a):c<5?setTimeout(()=>_r(a,l,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void b();let A=setTimeout(b,500);Yt.set(a,A)}let fo=!1;function Pr({url:a=O,...l}){typeof document>"u"||fo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=Je(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),_r(A.url,!0)}}),fo=!0);let c=A=>async E=>{if(typeof navigator>"u")return;let y=function I(S,R,H=new WeakSet,U=0,oe=10){if(U>oe||H.has(S))return S;H.add(S);let ie=te=>typeof te=="object"&&te!==null?I(te,R,H,U+1,oe):R(te);return Array.isArray(S)?S.map(ie):Object.fromEntries(Object.entries(S).map(([te,et])=>[te,ie(et)]))}(await uo(A,E,l),I=>{var S;return typeof(S=typeof I=="function"?I.name||"function":I)=="string"&&S.length>5120?`${S.slice(0,5120)}...`:S});ft().has(a)||ft().set(a,[]),ft().get(a)?.push(y),_r(a)},b={crashEvent:c(B.CRASH_EVENT),messageEvent:c(B.MESSAGE_EVENT),networkCallEvent:c(B.NETWORK_CALL_EVENT),sdkFunctionEvent:c(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return Sr().set(y,{start:M}),c(B.TIMER_EVENT)({...E,id:A,timerType:D.START})},timerEnd:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,{start:M}=Sr().get(y)??{};Sr().delete(y);let I=performance?.now?performance.now():Date.now();return c(B.TIMER_EVENT)({...E,id:A,timerType:D.END,duration:M?I-M:void 0})},v1Event:c(B.V1_EVENT),url:a};return go().set(l.checkoutSessionId,b),Je(l.checkoutSessionId)}function Je(a){return new Proxy({},{get:(l,c)=>(go().get(a)??Pr({checkoutSessionId:a}))[c]})}let Tr=(a,l,c,b)=>({callType:c?z.REQUEST_END:z.REQUEST_START,id:a,errorBody:c?.error&&JSON.stringify(c.error,Object.getOwnPropertyNames(c.error)),method:l.method,responseCode:c?.status,url:l.url,duration:b});function fa(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function vo(a,l,c,b=fa){let A=0,E={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!E.enabled)return a();for(;;)try{let y=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof y=="object"&&y&&"status"in y&&(M+=` Status code: ${y.status}`),c?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return y}catch(y){let M=A>=E.maxRetries,I=y.isNetworkError&&!E.retryNetworkErrors,S=y.status&&y.status>=500&&!E.retry500Errors;if(M||I||S){let U=`Failed after ${A} retries. `;throw M?U+=`Reached maximum retries (${E.maxRetries}).`:I?U+="Network error encountered and retryNetworkErrors is disabled.":S&&(U+="HTTP 500 error encountered and retry500Errors is disabled."),U+=` Last error: ${y.message}`,c?.({messageType:"RETRY_FAILED",message:U,severity:"ERROR",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),Error(U,{cause:y})}A++;let R=Math.min(E.initialBackoff*Math.pow(2,A-1)+Math.random()*E.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";y.isNetworkError?H="Network error":y.status&&(H=`HTTP ${y.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${A}/${E.maxRetries} due to: ${H}. Error details: ${y.message}. Waiting for ${R.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),await b(R)}}let wr={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=wr),wr=window.__primerCache__);let ee=()=>wr.cache;function yo(){if(ee().size<=30)return;let a=Date.now();for(let[l,c]of ee())c.exp<a&&ee().delete(l);if(ee().size>50)for(let[l]of ee()){if(ee().size<=50)break;ee().delete(l)}}let kr=()=>bo.randomUUID?.()||va(),va=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^ya()>>a/4).toString(16)),ya=()=>(bo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,bo=typeof crypto<"u"?crypto:{},ba=(a,l,c)=>Ea(a,"get",l,c),Ea=async(a,l,c,b,A)=>{let E=kr(),y=performance?.now(),M=Je(a),I={method:l,url:c,body:A};M.networkCallEvent(Tr(E,I));try{let S=await fetch(c,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":E,...b}});if(!S.ok){let U=Error(`HTTP error! status: ${S.status}`);throw U.status=S.status,U}let R=await S.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:U,clientSession:{clientSessionId:oe,customer:ie}}=R;M=Pr({checkoutSessionId:a,clientSessionId:oe,customerId:ie?.customerId,primerAccountId:U,url:M.url})}let H=performance?.now();return M.networkCallEvent(Tr(E,I,{data:R},H-y)),{data:R,headers:S.headers,status:S.status,source:"NETWORK"}}catch(S){let R=performance?.now();throw Object.assign(S,{isNetworkError:S instanceof TypeError}),M.networkCallEvent(Tr(E,I,{error:S},R-y)),S}},xa=(a,l)=>new Promise((c,b)=>{let A=setTimeout(()=>{let E=Error("Request timed out");E.isNetworkError=!0,b(E)},l);a.then(c).catch(b).finally(()=>clearTimeout(A))}),Ca=(a,l)=>{let{headers:c,retryConfig:b,cacheConfig:A,timeout:E=15e3,checkoutSessionId:y}=l,M=Je(y);return function(I){if(!I)return oe=>oe();let{key:S,refresh:R=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:U=36e5}=I;return async oe=>{let ie=Date.now(),te=ee().get(S);if(!R&&te&&te.exp>ie)return te.promise;te&&ee().delete(S);let et=oe().then(Et=>{let Vo=U;return H&&(Vo=1e3*(Number(Et.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ho,ttl:Yo=36e5},rn){Yo?ee().set(Ho,{promise:Promise.resolve({...rn,source:"CACHE"}),exp:Date.now()+Yo}):ee().delete(Ho)}({key:S,ttl:Vo},Et),yo(),Et},Et=>{throw ee().delete(S),Et});return ee().set(S,{promise:et,exp:ie+U}),yo(),et}}(A)(()=>vo(()=>xa(ba(y,a,c),E),b,I=>M.messageEvent({...I,url:a})))},Qe=typeof Buffer=="function",Eo=typeof TextDecoder=="function"?new TextDecoder:void 0,xo=typeof TextEncoder=="function"?new TextEncoder:void 0,vt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ut=(a=>{let l={};return a.forEach((c,b)=>l[c]=b),l})(vt),Aa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,F=String.fromCharCode.bind(String),Co=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),Ao=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Mo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),So=typeof btoa=="function"?a=>btoa(a):Qe?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,c,b,A,E="",y=a.length%3;for(let M=0;M<a.length;){if((c=a.charCodeAt(M++))>255||(b=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");E+=vt[(l=c<<16|b<<8|A)>>18&63]+vt[l>>12&63]+vt[l>>6&63]+vt[63&l]}return y?E.slice(0,y-3)+"===".substring(y):E},Ir=Qe?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let c=0,b=a.length;c<b;c+=4096)l.push(F.apply(null,a.subarray(c,c+4096)));return So(l.join(""))},qn=(a,l=!1)=>l?Ao(Ir(a)):Ir(a),Ma=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?F(192|l>>>6)+F(128|63&l):F(224|l>>>12&15)+F(128|l>>>6&63)+F(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return F(240|l>>>18&7)+F(128|l>>>12&63)+F(128|l>>>6&63)+F(128|63&l)},Sa=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_a=a=>a.replace(Sa,Ma),_o=Qe?a=>Buffer.from(a,"utf8").toString("base64"):xo?a=>Ir(xo.encode(a)):a=>So(_a(a)),Pa=(a,l=!1)=>l?Ao(_o(a)):_o(a),Ta=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,wa=a=>{switch(a.length){case 4:var l=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return F((l>>>10)+55296)+F((1023&l)+56320);case 3:return F((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return F((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},ka=a=>a.replace(Ta,wa),Po=typeof atob=="function"?a=>atob(Mo(a)):Qe?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Aa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,c="",b,A;for(let E=0;E<a.length;)l=Ut[a.charAt(E++)]<<18|Ut[a.charAt(E++)]<<12|(b=Ut[a.charAt(E++)])<<6|(A=Ut[a.charAt(E++)]),c+=b===64?F(l>>16&255):A===64?F(l>>16&255,l>>8&255):F(l>>16&255,l>>8&255,255&l);return c},To=Qe?a=>Co(Buffer.from(a,"base64")):a=>Co(Po(a).split("").map(l=>l.charCodeAt(0))),Wn=a=>To(wo(a)),Ia=Qe?a=>Buffer.from(a,"base64").toString("utf8"):Eo?a=>Eo.decode(To(a)):a=>ka(Po(a)),wo=a=>Mo(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),La=a=>Ia(wo(a)),Zn=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),ko={encode:Pa,decode:La},Na={encode:function(a,l={}){let{urlSafe:c=!1}=l;return ko.encode(a,c)},decode:ko.decode},Io="The provided `clientToken`",Ra=`${Io} has expired`,Oa=`${Io} is malformed`,Da=(a,l,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.3","primer-sdk-checkout-session-id":l,...c&&{"x-api-version":c}});async function $a(a,l,c){let{accessToken:b,configurationUrl:A,analyticsUrlV2:E}=function(S){let R=function(U){try{let[oe,ie]=U.split(".");return JSON.parse(Na.decode(ie||oe))}catch{throw Error(Oa)}}(S),H=1e3*R.exp;if(Date.now()>H)throw Error(`${Ra}. Expiration date: ${new Date(H).toISOString()}`);return R}(a),y=Pr({checkoutSessionId:l,url:E}),M=x,I=M!==s.LEGACY?M:"2.3";y.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:S,source:R}=await Ca(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:Da(b,l,I),retryConfig:{enabled:!0},cacheConfig:c});return y.timerEnd({id:"CONFIGURATION_LOADING",context:{source:R}}),S}catch(S){let R=S instanceof Error?S.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${R}`)}}function Lo(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 zt({checkoutSessionId:a,analytics:l,error:c,reporter:b}){l?.crashEvent?l.crashEvent({...Lo(c),reporter:b}):a&&Lr(a,c,b)}async function Lr(a,l,c){let b=await uo(B.CRASH_EVENT,{...Lo(l),reporter:c},{checkoutSessionId:a});try{await fetch(O,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch(A){console.error("Failed to post crash event",A)}}let No=Symbol.for("initGlobalErrorMonitoringLoaded"),Ro=(a,l)=>{typeof window<"u"&&window[No]||(window[No]=!0,window.addEventListener("error",c=>{!Va(c)&&Ha(c)&&zt({checkoutSessionId:a,analytics:l,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let b=c.reason||Error("Unhandled promise rejection");Ya(b)&&zt({checkoutSessionId:a,analytics:l,error:b,reporter:"unhandledrejection"})}))},Va=a=>a.message==="Script error."||!a.filename||a.lineno===0,Ha=a=>{let l=a.filename;return!!(l&&Nr(l))&&!!new h(a.error).isReported||!1},Ya=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=h.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Nr(a.fileName))||Ua(l.stack).some(Nr))}return!1},Nr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ua=a=>{if(!a)return[];let l=a.split(`
2
- `),c=[],b=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let E=A.match(b);if(E&&E[1])c.push(E[1]);else{let y=/@(.*?):\d+:\d+$/,M=A.match(y);M&&M[1]&&c.push(M[1])}}return c};function Oo(a,l,c){return document.querySelector(`${a}[${l}^="${c}"]`)}async function Do(a,l,c,b,A,E){let{analytics:y,name:M=l,retryConfig:I}=E;await vo(()=>new Promise((S,R)=>{let H=Oo(a,c,l)||function(U,oe){let ie=document.createElement(U);return Object.entries(oe).forEach(([te,et])=>ie.setAttribute(te,et)),ie}(a,{...b,[c]:l});H.onload=()=>{y?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),S()},H.onerror=()=>{H.remove(),R(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),I,S=>y?.messageEvent({...S,url:l}))}async function $o(a){return o||(o=Promise.all([function(l,c={}){return Oo("script","src",l)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Script already loaded"]}),Promise.resolve()):Do("script",l,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.3/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,c={}){return Array.from(document.styleSheets).some(b=>b.href===l)?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):Do("link",l,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.3/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw o=void 0,l}))}let za=async()=>{let a=kr();try{let l=Je(a);try{Ro(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:Q.preloadPrimer}),await $o(l),l.timerEnd({id:Q.preloadPrimer})}catch(c){let b=h.from(c);throw b.isReported||(zt({checkoutSessionId:a,analytics:l,error:b,reporter:"preloadPrimer level 1"}),b.markAsReported()),b}}catch(l){let c=h.from(l);throw c.isReported||(Lr(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},Ba=Rr("createHeadless"),Fa=Rr("showUniversalCheckout"),Ka=Rr("showVaultManager");function Rr(a){return async(...[l,c,...b])=>{var A;(A=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${p}'.`),x=A??p;let E=kr();try{let y=Je(E);try{Ro(E,y),y.sdkFunctionEvent({name:a,params:[l,c,...b]}),y.timerStart({id:Q[a]});let[M,I]=await Promise.all([$a(l,E,c?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),$o(y)]);return I[a](M,E,l,c,...b)}catch(M){let I=h.from(M);throw I.isReported||(zt({checkoutSessionId:E,analytics:y,error:I,reporter:"lazyLoad level 1"}),I.markAsReported()),I}}catch(y){let M=h.from(y);throw M.isReported||(Lr(E,M,"lazyLoad level 0"),M.markAsReported()),M}}}var ja=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),Ga=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),qa=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let yt={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"},bt={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"},Wa={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};yt.PAYPAL_VAULTED,bt.PAYPAL,yt.KLARNA_CUSTOMER_TOKEN,bt.KLARNA,yt.AUTOMATED_CLEARING_HOUSE,bt.STRIPE_ACH,yt.CARD,bt.PAYMENT_CARD;var Za=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 Bt(a,l,c){return l in a?Object.defineProperty(a,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[l]=c,a}class Or extends h{static fromErrorCode(l,c){return new Or(l,c)}constructor(l,c){super(c.message),Bt(this,"code",void 0),Bt(this,"diagnosticsId",void 0),Bt(this,"data",void 0),Bt(this,"isFromDeveloper",void 0),this.code=l,this.diagnosticsId=c.diagnosticsId??null,this.data=c.data,this.isFromDeveloper=c.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Or)}}var Xa=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let Ja=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var Qa=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}({}),en=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let tn={SDK_VERSION:"v2.53.3",createHeadless:Ba,showUniversalCheckout:Fa,showVaultManager:Ka,preloadPrimer:za};return i})())});var Ft=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,i=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:i,selectableCardNetworks:s,isLoading:!1})}};var tt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var _e=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var rt=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,p)=>{this.unsubscribe&&(this.unsubscribe!==p&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,p)),this.unsubscribe=p},this.host=t,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new _e(this.context,this.host,this.t,this.subscribe))}};var Kt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var $r=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},K=class extends Kt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[p,{consumerHost:x}]of this.subscriptions)s.has(p)||(s.add(p),x.dispatchEvent(new _e(this.context,x,p,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $r(this.context,this.host))}};function C({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new rt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new rt(i,{context:o,callback:s=>{i[r]=s},subscribe:t})})}}var jt="cardNetworksContext";var ot="clientOptionsContext";var Pe="computedStylesContext";var q="headlessInstanceContext";var Gt="klarnaCategoriesContext";var ue="managerContext";var it="paymentMethodsContext";var j="sdkStateContext";var W="vaultManagerContext";var Te="vaultManagerCvvContext";var T=class T{static log(t,...e){T.enabled&&console.log(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.log,...e)}static info(t,...e){T.enabled&&console.info(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.info,...e)}static warn(t,...e){T.enabled&&console.warn(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.warn,...e)}static error(t,...e){T.enabled&&console.error(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.error,...e)}static debug(t,...e){T.enabled&&console.debug(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.debug,...e)}static table(t,e){T.enabled&&console.table(t,e)}static time(t){T.enabled&&console.time(`${T.brandTag} ${t}`)}static timeEnd(t){T.enabled&&console.timeEnd(`${T.brandTag} ${t}`)}};T.enabled=!0,T.defaultFont="font-family: Consolas, monospace; font-size: 12px;",T.brandTag="[PRIMER]",T.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+T.defaultFont,T.styles={log:"color: #4CAF50; "+T.defaultFont,info:"color: #2196F3; "+T.defaultFont,warn:"color: #FF9800; "+T.defaultFont,error:"color: #F44336; "+T.defaultFont,debug:"color: #9C27B0; "+T.defaultFont};var w=T;var qt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Wt=class{constructor(t){(this.host=t).addController(this),this._state=qt}hostConnected(){}reducer(t,e){switch(e.type){case"START_LOADING":return{...t,isLoading:!0};case"START_PROCESSING":return{...t,failure:null,isProcessing:!0};case"STOP_PROCESSING":return{...t,isProcessing:!1};case"COMPLETE_PROCESSING":return{...t,isProcessing:!1,isSuccessful:!0};case"SET_ERROR":return w.error(e.payload.message),{...t,isProcessing:!1,error:e.payload};case"SET_FAILURE":return{...t,isProcessing:!1,failure:e.payload};case"COMPLETE_LOADING":return{...t,isLoading:!1};case"RESET":return qt;default:return t}}dispatch(t){let e=this.reducer(this._state,t);this._state=e,this.host.sdkContextController.setSdkState(e),this.host.primerEventsController.dispatchSdkState(e)}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}forceCompleteLoading(){this._state.isLoading&&(w.warn("Force completing loading state"),this.completeLoading())}get state(){return this._state}};var Zt=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new K(t,{context:j,initialValue:qt}),this.paymentMethodsProvider=new K(t,{context:it,initialValue:null}),this.paymentManagerProvider=new K(t,{context:ue,initialValue:new Map}),this.cardNetworksContext=new K(t,{context:jt,initialValue:null}),this.vaultManagerProvider=new K(t,{context:W,initialValue:null}),this.vaultManagerCvvProvider=new K(t,{context:Te,initialValue:null}),this.clientOptionsContext=new K(t,{context:ot,initialValue:null}),this.klarnaCategoriesProvider=new K(t,{context:Gt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new K(t,{context:q,initialValue:null}),this.computedStylesProvider=new K(t,{context:Pe,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var ze=class ze{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){w.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||w.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=ze.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,i)=>"-"+i.toLowerCase()),ze.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let i=t[r];if(!i)continue;if(!this.isValidCssProperty(r)){w.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(i))continue;let s=this.getCssVarName(r);e.push([s,i])}if(e.length>0)for(let[r,i]of e)this.host.style.setProperty(r,i)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of ze.cssVarCache.keys()){let e=ze.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};ze.cssVarCache=new Map;var Xt=ze;var Jt=globalThis,Qt=Jt.ShadowRoot&&(Jt.ShadyCSS===void 0||Jt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vr=Symbol(),zo=new WeakMap,xt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Vr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Qt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=zo.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&zo.set(e,t))}return t}toString(){return this.cssText}},Bo=o=>new xt(typeof o=="string"?o:o+"",void 0,Vr),g=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,s)=>r+(p=>{if(p._$cssResult$===!0)return p.cssText;if(typeof p=="number")return p;throw Error("Value passed to 'css' function must be a 'css' function result: "+p+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new xt(e,o,Vr)},Hr=(o,t)=>{if(Qt)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Jt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},er=Qt?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Bo(e)})(o):o;var{is:an,defineProperty:nn,getOwnPropertyDescriptor:sn,getOwnPropertyNames:ln,getOwnPropertySymbols:dn,getPrototypeOf:cn}=Object,we=globalThis,Fo=we.trustedTypes,pn=Fo?Fo.emptyScript:"",mn=we.reactiveElementPolyfillSupport,Ct=(o,t)=>o,At={toAttribute(o,t){switch(t){case Boolean:o=o?pn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},at=(o,t)=>!an(o,t),Ko={attribute:!0,type:String,converter:At,reflect:!1,hasChanged:at};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),we.litPropertyMetadata??(we.litPropertyMetadata=new WeakMap);var ve=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ko){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&nn(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:s}=sn(this.prototype,t)??{get(){return this[e]},set(p){this[e]=p}};return{get(){return i?.call(this)},set(p){let x=i?.call(this);s.call(this,p),this.requestUpdate(t,x,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ko}static _$Ei(){if(this.hasOwnProperty(Ct("elementProperties")))return;let t=cn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ct("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ct("properties"))){let e=this.properties,r=[...ln(e),...dn(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(er(i))}else t!==void 0&&e.push(er(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:At).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let s=r.getPropertyOptions(i),p=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:At;this._$Em=i,this[i]=p.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??at)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,s]of r)s.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],s)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};ve.elementStyles=[],ve.shadowRootOptions={mode:"open"},ve[Ct("elementProperties")]=new Map,ve[Ct("finalized")]=new Map,mn?.({ReactiveElement:ve}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var ke={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},N=Symbol(),V=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??jo,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(p){s=!0,r=p}if(this.p===i){if(e===N)this.i=0;else{if(s===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},jo=(o,t)=>o===t||o.length===t.length&&o.every((e,r)=>!at(e,t[r]));var Mt={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},tr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function Yr(o,t,e){switch(t.type){case"SET_LOADING":return{...o,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...o,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...o,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return w.error("VaultManagerController",t.payload.message),{...o,isLoading:!1};case"DISABLE":return{...Mt,enabled:!1};case"RESET":return Mt;default:return o}}function Ur(o,t,e){switch(t.type){case"INITIALIZE_CVV":return{...o,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...o,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...o,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...o,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return tr;default:return o}}var St=class{constructor(t){this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0}),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(e){throw this.dispatchVaultManager({type:"SET_ERROR",payload:e instanceof Error?e:new Error("Failed to delete payment method")}),e}};this.setCvvInput=t=>{this.dispatchVaultItem({type:"SET_CVV_INPUT",payload:t})};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this._vaultItemState.selectedVaultedPaymentMethod,e=this._vaultManagerState.cvvRecapture,r=this._vaultItemState.cvvInput;if(!t||e&&(!r||r.metadata.error)){this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!0});return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,e?{cvv:r.valueToken}:void 0)}catch(i){w.error("VaultManagerController: Error starting vaulted payment flow",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Failed to start vaulted payment flow")}),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.dispatchVaultItem({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t}),this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!1})};(this.host=t).addController(this),this._vaultManagerState=Mt,this._vaultItemState=tr,new V(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),N;this.dispatchVaultManager({type:"SET_LOADING",payload:!0});try{this.dispatchVaultManager({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:r.vaultEnabled,cvvRecapture:!!r.captureVaultedCardCvv}),this.dispatchVaultItem({type:"INITIALIZE_CVV",createCvvInput:e.createCvvInput}),await this.fetchVaultedPaymentMethods(),w.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(i){w.error("VaultManagerController: Failed to initialize vault",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Unknown error")})}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,e){this.vaultManager=t,this.options=e??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()}hostDisconnected(){this.vaultManager=null,this.dispatchVaultManager({type:"RESET"})}dispatchVaultManager(t){let e={deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod,startVaultedPaymentFlow:this.startVaultedPaymentFlow,createCvvInput:this.vaultManager?.createCvvInput},r=Yr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Ur(this._vaultItemState,t,e);this._vaultItemState=r,this.host.sdkContextController.setVaultManagerCvv(r)}async fetchVaultedPaymentMethods(){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0});let t=await this._vaultManager.fetchVaultedPaymentMethods();return w.log("VaultManagerController: Fetched payment methods",t),this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:t,isLoading:!1}),t}catch(t){throw this.dispatchVaultManager({type:"SET_ERROR",payload:t instanceof Error?t:new Error("Failed to fetch payment methods")}),t}}};var _t="lit-localize-status";var Go=o=>typeof o!="string"&&"strTag"in o,rr=(o,t,e)=>{let r=o[0];for(let i=1;i<o.length;i++)r+=t[e?e[i-1]:i-1],r+=o[i];return r};var Pt=o=>Go(o)?rr(o.strings,o.values):o;var P=Pt,qo=!1;function zr(o){if(qo)throw new Error("lit-localize can only be configured once");P=o,qo=!0}var Br=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(_t,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(_t,this.__litLocalizeEventHandler)}},un=o=>o.addController(new Br(o)),Wo=un;var L=()=>(o,t)=>(o.addInitializer(Wo),o);var Tt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var ye=[];for(let o=0;o<256;o++)ye[o]=(o>>4&15).toString(16)+(o&15).toString(16);function Zo(o){let t=0,e=8997,r=0,i=33826,s=0,p=40164,x=0,h=52210;for(let O=0;O<o.length;O++)e^=o.charCodeAt(O),t=e*435,r=i*435,s=p*435,x=h*435,s+=e<<8,x+=i<<8,r+=t>>>16,e=t&65535,s+=r>>>16,i=r&65535,h=x+(s>>>16)&65535,p=s&65535;return ye[h>>8]+ye[h&255]+ye[p>>8]+ye[p&255]+ye[i>>8]+ye[i&255]+ye[e>>8]+ye[e&255]}var hn="",gn="h",fn="s";function Xo(o,t){return(t?gn:fn)+Zo(typeof o=="string"?o:o.join(hn))}var Jo=new WeakMap,Qo=new Map;function ei(o,t,e){if(o){let r=e?.id??vn(t),i=o[r];if(i){if(typeof i=="string")return i;if("strTag"in i)return rr(i.strings,t.values,i.values);{let s=Jo.get(i);return s===void 0&&(s=i.values,Jo.set(i,s)),{...i,values:s.map(p=>t.values[p])}}}}return Pt(t)}function vn(o){let t=typeof o=="string"?o:o.strings,e=Qo.get(t);return e===void 0&&(e=Xo(t,typeof o!="string"&&!("strTag"in o)),Qo.set(t,e)),e}function Fr(o){window.dispatchEvent(new CustomEvent(_t,{detail:o}))}var ir="",Kr,ti,ar,jr,ri,Be=new Tt;Be.resolve();var or=0,oi=o=>(zr((t,e)=>ei(ri,t,e)),ir=ti=o.sourceLocale,ar=new Set(o.targetLocales),ar.add(o.sourceLocale),jr=o.loadLocale,{getLocale:yn,setLocale:bn}),yn=()=>ir,bn=o=>{if(o===(Kr??ir))return Be.promise;if(!ar||!jr)throw new Error("Internal error");if(!ar.has(o))throw new Error("Invalid locale code");or++;let t=or;return Kr=o,Be.settled&&(Be=new Tt),Fr({status:"loading",loadingLocale:o}),(o===ti?Promise.resolve({templates:void 0}):jr(o)).then(r=>{or===t&&(ir=o,Kr=void 0,ri=r.templates,Fr({status:"ready",readyLocale:o}),Be.resolve())},r=>{or===t&&(Fr({status:"error",errorLocale:o,errorMessage:r.toString()}),Be.reject(r))}),Be.promise};var Gr="en",qr=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],ii="You must call `loadLocale` first to set up the localized template.",ai,nr,ni=o=>{let t=oi({sourceLocale:Gr,targetLocales:qr,loadLocale:o});ai=t.getLocale,nr=t.setLocale};var Wr=o=>{ni(o)},Zr=o=>{if(!nr)throw new Error(ii);return nr(o)};var wt=new Set(qr);wt.add(Gr);var Xr=o=>{if(typeof o!="string")return!1;if(o==="en")return!0;let t=o.replace("_","-");if(wt.has(t))return!0;let e=t.split("-")[0];return!!wt.has(e)},Jr=o=>{if(o==="en")return"en-GB";let t=o.replace("_","-");if(wt.has(t))return t;let e=t.split("-")[0];return wt.has(e)?e:"en-GB"};var It=globalThis,sr=It.trustedTypes,si=sr?sr.createPolicy("lit-html",{createHTML:o=>o}):void 0,eo="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,to="?"+be,En=`<${to}>`,je=document,Lt=()=>je.createComment(""),Nt=o=>o===null||typeof o!="object"&&typeof o!="function",ro=Array.isArray,ui=o=>ro(o)||typeof o?.[Symbol.iterator]=="function",Qr=`[
3
- \f\r]`,kt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,li=/-->/g,di=/>/g,Fe=RegExp(`>|${Qr}(?:([^\\s"'>=/]+)(${Qr}*=${Qr}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ci=/'/g,pi=/"/g,hi=/^(?:script|style|textarea|title)$/i,oo=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),m=oo(1),Ie=oo(2),Ad=oo(3),Ee=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),mi=new WeakMap,Ke=je.createTreeWalker(je,129);function gi(o,t){if(!ro(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return si!==void 0?si.createHTML(t):t}var fi=(o,t)=>{let e=o.length-1,r=[],i,s=t===2?"<svg>":t===3?"<math>":"",p=kt;for(let x=0;x<e;x++){let h=o[x],O,z,D=-1,Q=0;for(;Q<h.length&&(p.lastIndex=Q,z=p.exec(h),z!==null);)Q=p.lastIndex,p===kt?z[1]==="!--"?p=li:z[1]!==void 0?p=di:z[2]!==void 0?(hi.test(z[2])&&(i=RegExp("</"+z[2],"g")),p=Fe):z[3]!==void 0&&(p=Fe):p===Fe?z[0]===">"?(p=i??kt,D=-1):z[1]===void 0?D=-2:(D=p.lastIndex-z[2].length,O=z[1],p=z[3]===void 0?Fe:z[3]==='"'?pi:ci):p===pi||p===ci?p=Fe:p===li||p===di?p=kt:(p=Fe,i=void 0);let B=p===Fe&&o[x+1].startsWith("/>")?" ":"";s+=p===kt?h+En:D>=0?(r.push(O),h.slice(0,D)+eo+h.slice(D)+be+B):h+be+(D===-2?x:B)}return[gi(o,s+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Rt=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,p=0,x=t.length-1,h=this.parts,[O,z]=fi(t,e);if(this.el=o.createElement(O,r),Ke.currentNode=this.el.content,e===2||e===3){let D=this.el.content.firstChild;D.replaceWith(...D.childNodes)}for(;(i=Ke.nextNode())!==null&&h.length<x;){if(i.nodeType===1){if(i.hasAttributes())for(let D of i.getAttributeNames())if(D.endsWith(eo)){let Q=z[p++],B=i.getAttribute(D).split(be),Xe=/([.?@])?(.*)/.exec(Q);h.push({type:1,index:s,name:Xe[2],strings:B,ctor:Xe[1]==="."?dr:Xe[1]==="?"?cr:Xe[1]==="@"?pr:qe}),i.removeAttribute(D)}else D.startsWith(be)&&(h.push({type:6,index:s}),i.removeAttribute(D));if(hi.test(i.tagName)){let D=i.textContent.split(be),Q=D.length-1;if(Q>0){i.textContent=sr?sr.emptyScript:"";for(let B=0;B<Q;B++)i.append(D[B],Lt()),Ke.nextNode(),h.push({type:2,index:++s});i.append(D[Q],Lt())}}}else if(i.nodeType===8)if(i.data===to)h.push({type:2,index:s});else{let D=-1;for(;(D=i.data.indexOf(be,D+1))!==-1;)h.push({type:7,index:s}),D+=be.length-1}s++}}static createElement(t,e){let r=je.createElement("template");return r.innerHTML=t,r}};function Ge(o,t,e=o,r){if(t===Ee)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,s=Nt(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Ge(o,i._$AS(o,t.values),i,r)),t}var lr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??je).importNode(e,!0);Ke.currentNode=i;let s=Ke.nextNode(),p=0,x=0,h=r[0];for(;h!==void 0;){if(p===h.index){let O;h.type===2?O=new nt(s,s.nextSibling,this,t):h.type===1?O=new h.ctor(s,h.name,h.strings,this,t):h.type===6&&(O=new mr(s,this,t)),this._$AV.push(O),h=r[++x]}p!==h?.index&&(s=Ke.nextNode(),p++)}return Ke.currentNode=je,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},nt=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ge(this,t,e),Nt(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==Ee&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ui(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&Nt(this._$AH)?this._$AA.nextSibling.data=t:this.T(je.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Rt.createElement(gi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new lr(i,this),p=s.u(this.options);s.p(e),this.T(p),this._$AH=s}}_$AC(t){let e=mi.get(t.strings);return e===void 0&&mi.set(t.strings,e=new Rt(t)),e}k(t){ro(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let s of t)i===e.length?e.push(r=new o(this.O(Lt()),this.O(Lt()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},qe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,e=this,r,i){let s=this.strings,p=!1;if(s===void 0)t=Ge(this,t,e,0),p=!Nt(t)||t!==this._$AH&&t!==Ee,p&&(this._$AH=t);else{let x=t,h,O;for(t=s[0],h=0;h<s.length-1;h++)O=Ge(this,x[r+h],e,h),O===Ee&&(O=this._$AH[h]),p||(p=!Nt(O)||O!==this._$AH[h]),O===u?t=u:t!==u&&(t+=(O??"")+s[h+1]),this._$AH[h]=O}p&&!i&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},dr=class extends qe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},cr=class extends qe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},pr=class extends qe{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Ge(this,t,e,0)??u)===Ee)return;let r=this._$AH,i=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==u&&(r===u||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},mr=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ge(this,t)}},vi={M:eo,P:be,A:to,C:1,L:fi,R:lr,D:ui,V:Ge,I:nt,H:qe,N:cr,U:pr,B:dr,F:mr},xn=It.litHtmlPolyfillSupport;xn?.(Rt,nt),(It.litHtmlVersions??(It.litHtmlVersions=[])).push("3.2.1");var yi=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let s=e?.renderBefore??null;r._$litPart$=i=new nt(t.insertBefore(Lt(),s),s,void 0,e??{})}return i._$AI(o),i};var f=class extends ve{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=yi(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ee}};f._$litElement$=!0,f.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:f});var Cn=globalThis.litElementPolyfillSupport;Cn?.({LitElement:f});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var v=o=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,t)}):customElements.define(o,t)};var An={attribute:!0,type:String,converter:At,reflect:!1,hasChanged:at},Mn=(o=An,t,e)=>{let{kind:r,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(e.name,o),r==="accessor"){let{name:p}=e;return{set(x){let h=t.get.call(this);t.set.call(this,x),this.requestUpdate(p,h,o)},init(x){return x!==void 0&&this.P(p,void 0,o),x}}}if(r==="setter"){let{name:p}=e;return function(x){let h=this[p];t.call(this,x),this.requestUpdate(p,h,o)}}throw Error("Unsupported decorator location: "+r)};function d(o){return(t,e)=>typeof e=="object"?Mn(o,t,e):((r,i,s)=>{let p=i.hasOwnProperty(s);return i.constructor.createProperty(s,p?{...r,wrapped:!0}:r),p?Object.getOwnPropertyDescriptor(i,s):void 0})(o,t,e)}function k(o){return d({...o,state:!0,attribute:!1})}var We=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Le(o,t){return(e,r,i)=>{let s=p=>p.renderRoot?.querySelector(o)??null;if(t){let{get:p,set:x}=typeof r=="object"?e:i??(()=>{let h=Symbol();return{get(){return this[h]},set(O){this[h]=O}}})();return We(e,r,{get(){let h=p.call(this);return h===void 0&&(h=s(this),(h!==null||this.hasUpdated)&&x.call(this,h)),h}})}return We(e,r,{get(){return s(this)}})}}function $(o,t,e){return o?t(o):e?.(o)}var _=g`
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=`[
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`
5
5
  * {
6
6
  box-sizing: border-box;
7
7
  }
8
- `,bi=g`
8
+ `,ga=f`
9
9
  :host {
10
10
  display: block;
11
11
  isolation: isolate;
@@ -14,14 +14,14 @@ import{a as Uo,b as on,c as Dr,d as n}from"./chunks/chunk.G45OCYEN.js";var Ar=on
14
14
  //Keep the CSS loader in the same position - check css-loader-inline.ts
15
15
  min-height: 64px;
16
16
  }
17
- `;var Ei="https://sdk.primer.io/web/v2-latest/Primer.min.js";var ur=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var hr=typeof window<"u"&&typeof window.document<"u";function Sn(o){return document.querySelector(`script[src^="${o}"]`)}function _n(o,t){let e=document.createElement("script");return e.setAttribute("src",o),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function xi(o,t=!1){if(!hr)throw new Error("Cannot load script in server environment");let e=Sn(o)??_n(o,t);return new Promise((r,i)=>{e.onload=()=>{r()},e.onerror=()=>{i()},e.parentNode||document.head.appendChild(e)})}var gr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new V(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new V(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.state.isLoading&&(w.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(),w.info("SDK instance cleaned up")}catch(t){w.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=Ei){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){w.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await xi(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return w.warn("Component disconnected, aborting SDK initialization"),N;if(!t||!e)return N;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,i=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:p=>{this.isDisconnected||(w.info("Configuration payment methods:",p),this.paymentsList=p)},onCheckoutComplete:({payment:p})=>{this.isDisconnected||(w.info("Payment completed:",p),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(p,x,h)=>{this.isDisconnected||(w.error("Payment failed:",p),this.host.sdkStateController.setFailure(p.code||"UNKNOWN_ERROR",p.message||"Unknown error occurred"),h&&h.showErrorMessage())},onBeforePaymentCreate:(p,x)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),x?.continuePaymentCreation())},onPaymentMethodAction:(p,x)=>{this.isDisconnected||p==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});if(this.createPaymentMethodManager=i.createPaymentMethodManager.bind(i),this.currentSdkInstance=i,await i.start(),this.isDisconnected)return this.cleanupResources(),N;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(i);let s=i.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(i.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),i}catch(r){throw r instanceof Error&&(w.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return N;if(!t||!e.length)return N;let r=new Map,i=new Map;try{for(let p of e){if(this.isDisconnected)break;let x=await this.initializePaymentMethodManager(p)();p&&x&&(r.set(p.type,p),i.set(p.type,x))}if(this.isDisconnected)return N;let s=new ur(r);return this.host.sdkContextController.setPaymentManagers(i),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),w.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let i=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{this.isDisconnected||s==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});return i?{type:e,manager:i}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async p=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(p)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let i=await this.createPaymentMethodManager(e);return i?{type:e,manager:i}:null}catch(i){return w.error(`Failed to initialize manager for ${e}:`,i),null}}}};var Pn=Uo({"../../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")});Wr(o=>Pn(`../../localization/lit-localize/locales/${o}.ts`));var ae=class extends f{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.sdkContextController=new Zt(this),this.sdkStateController=new Wt(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Xt(this),this.vaultManagerController=new St(this),this.cardNetworkController=new Ft(this),new gr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,i){e==="customstyles"?this.styleProcessingController.processCustomStyles(i):super.attributeChangedCallback(e,r,i)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.state.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(Xr(this.options?.locale)?this.locale=Jr(this.options?.locale):w.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Zr(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.state.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.state.isLoading&&(w.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.state,r=e.isLoading,i=e.error,s=!r&&!i;return m`
18
- ${$(r,()=>u)}
19
- ${$(i,()=>m`<primer-checkout-error></primer-checkout-error>`)}
20
- ${$(s,()=>m`
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`
21
21
  <slot name="main" @slotchange=${this.onSlotChange}></slot>
22
- ${$(this.hasAssignedContent,()=>u,()=>m`<primer-main></primer-main>`)}
23
- `,()=>u)}
24
- `}addEventListener(e,r,i){super.addEventListener(e,r,i)}};ae.styles=[_,bi],n([d({type:String,attribute:"custom-styles"})],ae.prototype,"customStyles",2),n([d({type:String,attribute:"client-token"})],ae.prototype,"clientToken",2),n([d({type:Object})],ae.prototype,"options",2),n([d({type:Boolean,reflect:!0,attribute:"js-initialized"})],ae.prototype,"_jsInitialized",2),n([Le("slot")],ae.prototype,"defaultSlot",2),n([k()],ae.prototype,"previousLoadingState",2),ae=n([L(),v("primer-checkout")],ae);function Tn(o){return document.querySelector(`#${o}`)}function wn(o,t){let e=document.createElement("style");return e.textContent=o,e.id=t,e}function Ot(o,t,e=!0){if(!hr||Tn(t))return;let i=wn(o,t);e&&document.head.firstChild?document.head.insertBefore(i,document.head.firstChild):document.head.appendChild(i)}var Ci=`
22
+ ${U(this.hasAssignedContent,()=>h,()=>c`<primer-main></primer-main>`)}
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=`
25
25
  @keyframes primer-css-spinner-rotate {
26
26
  0% {
27
27
  transform: rotate(0deg);
@@ -57,11 +57,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
57
57
  animation: primer-css-spinner-rotate 1.2s linear infinite;
58
58
  z-index: 9999;
59
59
  }
60
- `;var Ai=`/**
60
+ `;var ba=`/**
61
61
  * Do not edit directly, this file was auto-generated.
62
62
  */
63
63
 
64
- primer-checkout {
64
+ :root, primer-checkout {
65
65
  --primer-color-background-transparent-default: rgba(255, 255, 255, 0);
66
66
  --primer-color-border-transparent-default: rgba(255, 255, 255, 0);
67
67
  --primer-color-gray-100: #f5f5f5;
@@ -165,11 +165,11 @@ primer-checkout {
165
165
  --primer-color-border-transparent-focus: var(--primer-color-focus);
166
166
  --primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
167
167
  }
168
- `,Mi=`/**
168
+ `,Ea=`/**
169
169
  * Do not edit directly, this file was auto-generated.
170
170
  */
171
171
 
172
- primer-checkout.primer-dark-theme {
172
+ :root, primer-checkout.primer-dark-theme {
173
173
  --primer-color-gray-100: #292929;
174
174
  --primer-color-gray-200: #424242;
175
175
  --primer-color-gray-300: #575757;
@@ -185,7 +185,7 @@ primer-checkout.primer-dark-theme {
185
185
  --primer-color-blue-500: #3f93e4;
186
186
  --primer-color-blue-900: #4aaeff;
187
187
  }
188
- `;var kn="primer-light-theme-css",In="primer-dark-theme-css";function io(){Ot(Ai,kn,!0)}function ao(){Ot(Mi,In,!0)}function Si(){io(),ao()}function _i(){Ot(Ci,"primer-css-loader-styles",!1)}function Pi(){Si()}function Ln(){io()}function Nn(){ao()}var Ti=g`
188
+ `;var il="primer-light-theme-css",ol="primer-dark-theme-css";function Fi(){Xt(ba,il,!0)}function Bi(){Xt(Ea,ol,!0)}function Ca(){Fi(),Bi()}function xa(){Xt(ya,"primer-css-loader-styles",!1)}function Aa(){Ca()}function al(){Fi()}function nl(){Bi()}var _a=f`
189
189
  :host {
190
190
  display: inline-flex;
191
191
  align-items: center;
@@ -230,13 +230,13 @@ primer-checkout.primer-dark-theme {
230
230
  transform: rotate(360deg);
231
231
  }
232
232
  }
233
- `;var no={small:16,medium:24,large:32},xe=class extends f{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in no)return no[this.size];let e=parseInt(this.size,10);return isNaN(e)?no.medium:e}render(){let e=this.getSize(),r=20,i=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),m`
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`
234
234
  <div class="spinner-container ${this.compact?"compact":""}">
235
235
  <svg
236
236
  class="spinner"
237
- width="${e}"
238
- height="${e}"
239
- viewBox="${i}"
237
+ width="${t}"
238
+ height="${t}"
239
+ viewBox="${o}"
240
240
  fill="none"
241
241
  xmlns="http://www.w3.org/2000/svg"
242
242
  role="status"
@@ -249,7 +249,7 @@ primer-checkout.primer-dark-theme {
249
249
  />
250
250
  </svg>
251
251
  </div>
252
- `}};xe.styles=[Ti],n([d({type:String})],xe.prototype,"color",2),n([d({type:String})],xe.prototype,"size",2),n([d({type:Boolean})],xe.prototype,"compact",2),xe=n([v("primer-spinner")],xe);var fr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),st=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var ce=Dt(class extends st{constructor(o){if(super(o),o.type!==fr.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=o.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let i=!!t[r];i===this.st.has(r)||this.nt?.has(r)||(i?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return Ee}});var wi=g`
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`
253
253
  * {
254
254
  box-sizing: border-box;
255
255
  }
@@ -314,15 +314,15 @@ primer-checkout.primer-dark-theme {
314
314
  border-color: var(--primer-color-border-outlined-disabled);
315
315
  cursor: not-allowed;
316
316
  }
317
- `;var Ce=class extends f{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(i=>i.tagName.toLowerCase()==="primer-input");if(r)return r;for(let i of e){let s=i.querySelector("primer-input");if(s)return s}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return m`
317
+ `;var Te=class extends v{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(t){if(t.target!==t.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let t=this.inputSlot.assignedElements({flatten:!0}),r=t.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of t){let n=o.querySelector("primer-input");if(n)return n}return null}render(){let t={"input-slot":!0,"focus-within":this.focusWithin};return c`
318
318
  <div class="input-wrapper">
319
319
  <slot name="label"></slot>
320
- <div class="${ce(e)}" @click="${this.handleWrapperClick}">
320
+ <div class="${Z(t)}" @click="${this.handleWrapperClick}">
321
321
  <slot name="input"></slot>
322
322
  </div>
323
323
  <slot name="error"></slot>
324
324
  </div>
325
- `}};Ce.styles=[wi],n([d({type:Boolean})],Ce.prototype,"focusWithin",2),n([d({type:Boolean,reflect:!0,attribute:"has-error"})],Ce.prototype,"hasError",2),n([Le('slot[name="input"]')],Ce.prototype,"inputSlot",2),Ce=n([v("primer-input-wrapper")],Ce);var ki=g`
325
+ `}};Te.styles=[Sa],s([p({type:Boolean})],Te.prototype,"focusWithin",2),s([p({type:Boolean,reflect:!0,attribute:"has-error"})],Te.prototype,"hasError",2),s([Ve('slot[name="input"]')],Te.prototype,"inputSlot",2),Te=s([y("primer-input-wrapper")],Te);var Ma=f`
326
326
  :host {
327
327
  display: inline-block;
328
328
  font-weight: var(--primer-typography-body-small-weight);
@@ -336,7 +336,7 @@ primer-checkout.primer-dark-theme {
336
336
  :host([disabled]) {
337
337
  color: var(--primer-color-text-disabled);
338
338
  }
339
- `;var Ne=class extends f{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return m`<label for=${this.for}><slot></slot></label>`}};Ne.styles=[ki],n([d({type:String,reflect:!0})],Ne.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Ne.prototype,"disabled",2),Ne=n([v("primer-input-label")],Ne);var Ii=g`
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`
340
340
  :host {
341
341
  display: contents;
342
342
  }
@@ -503,19 +503,19 @@ primer-checkout.primer-dark-theme {
503
503
  :host([variant='tertiary'][loading]) primer-spinner {
504
504
  transform: scale(0.85);
505
505
  }
506
- `;var ne=class extends f{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?u:m`
506
+ `;var de=class extends v{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?h:c`
507
507
  <primer-icon
508
508
  name="checkmark"
509
509
  size="sm"
510
510
  color="var(--primer-color-icon-primary)"
511
511
  ></primer-icon>
512
- `}renderSpinner(){if(!this.loading)return u;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),m`
512
+ `}renderSpinner(){if(!this.loading)return h;let t;return this.variant==="primary"?t="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(t="var(--primer-color-gray-900)"),c`
513
513
  <primer-spinner
514
514
  size="small"
515
- color="${e}"
515
+ color="${t}"
516
516
  compact
517
517
  ></primer-spinner>
518
- `}render(){return m`
518
+ `}render(){return c`
519
519
  <button
520
520
  type=${this.buttonType}
521
521
  ?disabled=${this.disabled||this.loading}
@@ -530,7 +530,7 @@ primer-checkout.primer-dark-theme {
530
530
  </span>
531
531
  ${this.renderCheckmark()}
532
532
  </button>
533
- `}};ne.styles=[_,Ii],n([d({type:String})],ne.prototype,"variant",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"disabled",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"loading",2),n([d({type:String})],ne.prototype,"buttonType",2),n([d({type:String,reflect:!0})],ne.prototype,"selectionState",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"selectable",2),ne=n([v("primer-button")],ne);var Li=g`
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`
534
534
  :host {
535
535
  display: contents;
536
536
  }
@@ -546,7 +546,7 @@ primer-checkout.primer-dark-theme {
546
546
  display: block;
547
547
  font-family: var(--primer-typography-body-small-font);
548
548
  }
549
- `;var Re=class extends f{constructor(){super(...arguments);this.for="";this.active=!0}render(){return m`
549
+ `;var Ue=class extends v{constructor(){super(...arguments);this.for="";this.active=!0}render(){return c`
550
550
  <span
551
551
  class="error"
552
552
  role="alert"
@@ -555,17 +555,17 @@ primer-checkout.primer-dark-theme {
555
555
  >
556
556
  <slot></slot>
557
557
  </span>
558
- `}};Re.styles=[Li],n([d({type:String,reflect:!0})],Re.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Re.prototype,"active",2),Re=n([v("primer-input-error")],Re);var Ni={pencil:Ie`
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`
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:Ie`
562
+ `,trash:Se`
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":Ie`
568
+ `,"successful-check":Se`
569
569
  <svg
570
570
  viewBox="0 0 56 56"
571
571
  fill="none"
@@ -580,7 +580,7 @@ primer-checkout.primer-dark-theme {
580
580
  />
581
581
  </g>
582
582
  </svg>
583
- `,"failure-icon":Ie`
583
+ `,"failure-icon":Se`
584
584
  <svg
585
585
  viewBox="0 0 40 40"
586
586
  fill="none"
@@ -592,20 +592,27 @@ primer-checkout.primer-dark-theme {
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":Ie`
595
+ `,"payment-card":Se`
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":Ie`
601
+ `,"chevron-down":Se`
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:Ie`
604
+ </svg>`,checkmark:Se`
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
- `};var Ri=g`
608
+ `,close:Se`
609
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
610
+ <path
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"
612
+ fill="#212121"
613
+ />
614
+ </svg>
615
+ `};var ka=f`
609
616
  :host {
610
617
  display: inline-block;
611
618
  line-height: 0; /* so you don’t get extra space around the icon */
@@ -647,11 +654,11 @@ primer-checkout.primer-dark-theme {
647
654
  /* --internal used for abstracting away the icon component */
648
655
  fill: var(--internal-icon-color, currentColor);
649
656
  }
650
- `;var Ae=class extends f{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Ni[this.name]:null;return m`
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`
651
658
  <div style="--internal-icon-color: ${this.color}">
652
- ${e||m`<slot></slot>`}
659
+ ${t||c`<slot></slot>`}
653
660
  </div>
654
- `}};Ae.styles=[Ri],n([d({type:String})],Ae.prototype,"color",2),n([d({type:String})],Ae.prototype,"size",2),n([d({reflect:!0})],Ae.prototype,"name",2),Ae=n([v("primer-icon")],Ae);var Oi=g`
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`
655
662
  :host {
656
663
  display: flex;
657
664
  flex-direction: column;
@@ -680,7 +687,7 @@ primer-checkout.primer-dark-theme {
680
687
  line-height: var(--primer-typography-body-medium-line-height);
681
688
  letter-spacing: var(--primer-typography-body-medium-letter-spacing);
682
689
  }
683
- `;var Oe=class extends f{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?m`
690
+ `;var Ye=class extends v{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?c`
684
691
  <!-- Successful view -->
685
692
  <primer-icon
686
693
  size="lg"
@@ -692,7 +699,7 @@ primer-checkout.primer-dark-theme {
692
699
  <p class="secondary">
693
700
  You'll be redirected to the order confirmation page soon.
694
701
  </p>
695
- `:m`
702
+ `:c`
696
703
  <primer-icon
697
704
  size="lg"
698
705
  name="failure-icon"
@@ -700,8 +707,8 @@ primer-checkout.primer-dark-theme {
700
707
  >
701
708
  </primer-icon>
702
709
  <p>Payment failed</p>
703
- ${this.description?m`<p class="secondary">${this.description}</p>`:m`<p class="secondary">Something went wrong.</p>`}
704
- `}};Oe.styles=[Oi],n([d({type:String})],Oe.prototype,"type",2),n([d({type:String})],Oe.prototype,"description",2),Oe=n([v("primer-checkout-state")],Oe);var Di=g`
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`
705
712
  :host {
706
713
  display: contents;
707
714
  }
@@ -732,7 +739,7 @@ primer-checkout.primer-dark-theme {
732
739
  :host([disabled]) input::placeholder {
733
740
  color: var(--primer-color-text-disabled);
734
741
  }
735
- `;var Rn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function On(o){return Rn.includes(o)}var Y=class extends f{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(e){e.stopPropagation();let r=e.target;this.value=r.value;let i=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(i)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let i=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(i)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,i){this.inputElement?.setSelectionRange(e,r,i)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return m`
742
+ `;var sl=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function ll(i){return sl.includes(i)}var F=class extends v{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(t){t.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(t){this.inputElement?.focus(t)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(t,r,o){this.inputElement?.setSelectionRange(t,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let t={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(t).filter(([,o])=>o).map(([o])=>o).join(" ");return c`
736
743
  <input
737
744
  part="input"
738
745
  class=${r}
@@ -757,7 +764,7 @@ primer-checkout.primer-dark-theme {
757
764
  @blur=${this.handleBlur}
758
765
  @invalid=${this.handleInvalid}
759
766
  />
760
- `}addEventListener(e,r,i){super.addEventListener(e,r,i)}removeEventListener(e,r,i){super.removeEventListener(e,r,i)}};Y.styles=[Di],n([Le("input")],Y.prototype,"inputElement",2),n([d({type:String,reflect:!0})],Y.prototype,"value",2),n([d({type:String,reflect:!0})],Y.prototype,"placeholder",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),n([d({type:String,reflect:!0})],Y.prototype,"name",2),n([d({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!On(e)?(e&&e!=="text"&&w.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],Y.prototype,"type",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"required",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"readonly",2),n([d({type:String,reflect:!0})],Y.prototype,"pattern",2),n([d({type:Number,reflect:!0})],Y.prototype,"minlength",2),n([d({type:Number,reflect:!0})],Y.prototype,"maxlength",2),n([d({type:String,reflect:!0})],Y.prototype,"min",2),n([d({type:String,reflect:!0})],Y.prototype,"max",2),n([d({type:String,reflect:!0})],Y.prototype,"step",2),n([d({type:String,reflect:!0})],Y.prototype,"autocomplete",2),n([d({type:String,reflect:!0})],Y.prototype,"id",2),n([k()],Y.prototype,"hasFocus",2),n([k()],Y.prototype,"hasError",2),Y=n([v("primer-input")],Y);var $i=g`
767
+ `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};F.styles=[Na],s([Ve("input")],F.prototype,"inputElement",2),s([p({type:String,reflect:!0})],F.prototype,"value",2),s([p({type:String,reflect:!0})],F.prototype,"placeholder",2),s([p({type:Boolean,reflect:!0})],F.prototype,"disabled",2),s([p({type:String,reflect:!0})],F.prototype,"name",2),s([p({type:String,reflect:!0,converter:{fromAttribute:t=>!t||!ll(t)?(t&&t!=="text"&&R.warn(`Invalid input type: ${t}. Defaulting to 'text'.`),"text"):t}})],F.prototype,"type",2),s([p({type:Boolean,reflect:!0})],F.prototype,"required",2),s([p({type:Boolean,reflect:!0})],F.prototype,"readonly",2),s([p({type:String,reflect:!0})],F.prototype,"pattern",2),s([p({type:Number,reflect:!0})],F.prototype,"minlength",2),s([p({type:Number,reflect:!0})],F.prototype,"maxlength",2),s([p({type:String,reflect:!0})],F.prototype,"min",2),s([p({type:String,reflect:!0})],F.prototype,"max",2),s([p({type:String,reflect:!0})],F.prototype,"step",2),s([p({type:String,reflect:!0})],F.prototype,"autocomplete",2),s([p({type:String,reflect:!0})],F.prototype,"id",2),s([I()],F.prototype,"hasFocus",2),s([I()],F.prototype,"hasError",2),F=s([y("primer-input")],F);var La=f`
761
768
  :host {
762
769
  display: block;
763
770
  }
@@ -811,7 +818,7 @@ primer-checkout.primer-dark-theme {
811
818
  transition: none;
812
819
  }
813
820
  }
814
- `;var re=class extends f{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,i=this.header||e;return m`
821
+ `;var ae=class extends v{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(t){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:t}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let t=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||t,o=this.header||t;return c`
815
822
  <div class="collapsable">
816
823
  <primer-button
817
824
  variant=${this.buttonVariant}
@@ -821,7 +828,7 @@ primer-checkout.primer-dark-theme {
821
828
  aria-controls="collapsable-content"
822
829
  aria-label=${r}
823
830
  >
824
- <span>${i}</span>
831
+ <span>${o}</span>
825
832
  </primer-button>
826
833
 
827
834
  <div
@@ -835,7 +842,7 @@ primer-checkout.primer-dark-theme {
835
842
  </div>
836
843
  </div>
837
844
  </div>
838
- `}};re.styles=[$i],n([d({type:String})],re.prototype,"header",2),n([d({type:Boolean})],re.prototype,"expanded",2),n([d({type:String})],re.prototype,"expandText",2),n([d({type:String})],re.prototype,"collapseText",2),n([d({type:String})],re.prototype,"ariaLabel",2),n([d({type:String})],re.prototype,"buttonVariant",2),n([k()],re.prototype,"isExpanded",2),re=n([v("primer-collapsable")],re);var Vi=g`
845
+ `}};ae.styles=[La],s([p({type:String})],ae.prototype,"header",2),s([p({type:Boolean})],ae.prototype,"expanded",2),s([p({type:String})],ae.prototype,"expandText",2),s([p({type:String})],ae.prototype,"collapseText",2),s([p({type:String})],ae.prototype,"ariaLabel",2),s([p({type:String})],ae.prototype,"buttonVariant",2),s([I()],ae.prototype,"isExpanded",2),ae=s([y("primer-collapsable")],ae);var $a=f`
839
846
  :host {
840
847
  display: block;
841
848
  width: 100%;
@@ -895,10 +902,10 @@ primer-checkout.primer-dark-theme {
895
902
  transform: none;
896
903
  }
897
904
  }
898
- `;var he=class extends f{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(e){e.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return u;let e={"error-message":!0,hidden:!this.visible};return m`
905
+ `;var ye=class extends v{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(t){t.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return h;let t={"error-message":!0,hidden:!this.visible};return c`
899
906
  <div
900
907
  part="error-message"
901
- class=${ce(e)}
908
+ class=${Z(t)}
902
909
  aria-live="assertive"
903
910
  aria-atomic="true"
904
911
  >
@@ -911,7 +918,56 @@ primer-checkout.primer-dark-theme {
911
918
  </div>
912
919
  <div part="error-content" class="error-content">${this.message}</div>
913
920
  </div>
914
- `}};he.styles=[Vi],n([d({type:String})],he.prototype,"message",2),n([d({type:Boolean,reflect:!0})],he.prototype,"visible",2),n([d({type:String,reflect:!0})],he.prototype,"role",2),n([k()],he.prototype,"showMessage",2),he=n([v("primer-error-message")],he);var Hi=g`
921
+ `}};ye.styles=[$a],s([p({type:String})],ye.prototype,"message",2),s([p({type:Boolean,reflect:!0})],ye.prototype,"visible",2),s([p({type:String,reflect:!0})],ye.prototype,"role",2),s([I()],ye.prototype,"showMessage",2),ye=s([y("primer-error-message")],ye);var Ra=f`
922
+ :host {
923
+ display: none;
924
+ }
925
+ `;var ot=class extends v{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let t=document.querySelector(`#${this.id}`);return t||(t=document.createElement("div"),t.id=this.id,document.body.appendChild(t),this._setupEventListeners(t)),t}_setupEventListeners(t){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{t.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(t){let o=t.target.assignedNodes();if(!o.length)return;let n=this.getContainer();o.forEach(l=>n.appendChild(l))}render(){return c`<slot @slotchange=${this._handleSlotChange}></slot>`}};ot.styles=[Ra],s([I()],ot.prototype,"id",2),ot=s([y("primer-portal")],ot);var Oa=f`
926
+ :host {
927
+ display: contents;
928
+ }
929
+
930
+ .backdrop {
931
+ position: absolute;
932
+ top: 0;
933
+ left: 0;
934
+ background-color: rgba(0, 0, 0, 0.5);
935
+ z-index: 1000;
936
+ display: flex;
937
+ justify-content: center;
938
+ align-items: center;
939
+ width: 100vw;
940
+ height: 100vh;
941
+ }
942
+
943
+ .dialog {
944
+ background-color: white;
945
+ padding: var(--primer-space-medium);
946
+ border-radius: var(--primer-radius-medium);
947
+ max-width: 600px;
948
+ }
949
+
950
+ .header {
951
+ display: flex;
952
+ justify-content: flex-end;
953
+ }
954
+ `;var Ct=class extends v{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return c`
955
+ <div
956
+ class=${Z({backdrop:!0})}
957
+ @click=${e=>{e.preventDefault()}}
958
+ >
959
+ <div class="dialog">
960
+ <div class="header">
961
+ <primer-button variant="tertiary" @click=${this._handleCloseClick}>
962
+ <primer-icon name="close"></primer-icon>
963
+ </primer-button>
964
+ </div>
965
+ <div class="content">
966
+ <slot></slot>
967
+ </div>
968
+ </div>
969
+ </div>
970
+ `}};Ct.styles=[Oa],Ct=s([y("primer-dialog")],Ct);var Da=f`
915
971
  :host {
916
972
  display: contents;
917
973
  }
@@ -1103,38 +1159,38 @@ primer-checkout.primer-dark-theme {
1103
1159
  background-color: var(--primer-color-background-outlined-default);
1104
1160
  border-radius: var(--primer-radius-small);
1105
1161
  }
1106
- `;var Z=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=P("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>{if(!e||!r)return N;let i=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:i?.assets?.icon?`${i.goatCdnUrl}/${i.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){w.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){w.error("Failed to render Klarna category",e)}}selectCategory(e){this.selectedCategory=e,this.renderSelectedCategory()}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?m`<div class="loading">
1162
+ `;var ee=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=A("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=await r.getCDNAssets("KLARNA");return{manager:t.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(t){R.error("Failed to start Klarna payment",t)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:t=>{t>0&&(this.klarnaContainer.style.height=`${t}px`)}})}catch(t){R.error("Failed to render Klarna category",t)}}selectCategory(t){this.selectedCategory=t,this.renderSelectedCategory()}updated(t){t.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let t=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?c`<div class="loading">
1107
1163
  <primer-spinner size="small"></primer-spinner>
1108
- </div>`:e.length<=1?u:m`
1164
+ </div>`:c`
1109
1165
  <div class="category-selection">
1110
- ${e.map(i=>m`
1166
+ ${t.map(o=>c`
1111
1167
  <button
1112
- class=${ce({"category-button":!0,selected:i.id===this.selectedCategory})}
1113
- @click=${()=>{this.selectCategory(i.id)}}
1168
+ class=${Z({"category-button":!0,selected:o.id===this.selectedCategory})}
1169
+ @click=${()=>{this.selectCategory(o.id)}}
1114
1170
  >
1115
- ${i.name}
1171
+ ${o.name}
1116
1172
  </button>
1117
1173
  `)}
1118
1174
  </div>
1119
- `}renderExpandedContent(){return m`
1175
+ `}renderExpandedContent(){return c`
1120
1176
  ${this.renderCategorySelection()}
1121
- ${this.selectedCategory?m`
1177
+ ${this.selectedCategory?c`
1122
1178
  <div
1123
1179
  id="klarna-category-container"
1124
1180
  class="klarna-category-container"
1125
1181
  ></div>
1126
- `:u}
1182
+ `:h}
1127
1183
 
1128
1184
  <button
1129
- class=${ce({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1185
+ class=${Z({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1130
1186
  ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
1131
1187
  @click=${()=>this.startKlarnaPayment()}
1132
1188
  >
1133
- ${P("confirm",{id:"confirm"})}
1189
+ ${A("confirm",{id:"confirm"})}
1134
1190
  </button>
1135
- `}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return m`<div class="error">
1191
+ `}render(){return this._paymentMethodManagerTask.render({error:t=>{let r=t instanceof Error?t.message:"Unknown error in Klarna";return c`<div class="error">
1136
1192
  Error loading Klarna: ${r}
1137
- </div>`},complete:({manager:e,klarnaIcon:r})=>e?m`
1193
+ </div>`},complete:({manager:t,klarnaIcon:r})=>t?c`
1138
1194
  <div class="klarna-container ${this.isExpanded?"expanded":""}">
1139
1195
  <div class="klarna-button-header">
1140
1196
  <primer-button
@@ -1147,7 +1203,7 @@ primer-checkout.primer-dark-theme {
1147
1203
  aria-label=${this.headerAriaLabel}
1148
1204
  >
1149
1205
  <img src=${r} alt="Klarna logo" />
1150
- <span>${P("pay_with",{id:"pay_with"})} Klarna</span>
1206
+ <span>${A("pay_with",{id:"pay_with"})} Klarna</span>
1151
1207
  <span
1152
1208
  class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1153
1209
  >
@@ -1164,15 +1220,208 @@ primer-checkout.primer-dark-theme {
1164
1220
  </div>
1165
1221
  </div>
1166
1222
  </div>
1167
- `:u})}};Z.styles=[_,Hi],n([C({context:ue,subscribe:!0}),d()],Z.prototype,"paymentManagers",2),n([C({context:j,subscribe:!0}),d()],Z.prototype,"sdkState",2),n([C({context:q,subscribe:!0}),d({type:Object})],Z.prototype,"headlessUtils",2),n([C({context:Gt,subscribe:!0}),d()],Z.prototype,"klarnaCategories",2),n([k()],Z.prototype,"selectedCategory",2),n([k()],Z.prototype,"isExpanded",2),n([k()],Z.prototype,"headerAriaLabel",2),n([Le("#klarna-category-container")],Z.prototype,"klarnaContainer",2),Z=n([v("primer-klarna"),L()],Z);var Yi=g`
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`
1168
1224
  :host {
1169
1225
  display: contents;
1170
1226
  }
1171
- `;var De=class extends f{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return u;let e=this.paymentMethods?.get(this.type);if(!e)return u;switch(e?.managerType){case"CARD":return m`<primer-card-form></primer-card-form>`;case"NATIVE":return m`<primer-native-payment
1172
- .paymentMethod=${e}
1173
- ></primer-native-payment>`;case"REDIRECT":return m`<primer-redirect-payment
1174
- .paymentMethod=${e}
1175
- ></primer-redirect-payment>`;case"KLARNA":return m`<primer-klarna></primer-klarna>`;default:return u}}};De.styles=[Yi],n([d({type:String})],De.prototype,"type",2),n([C({context:it,subscribe:!0}),d()],De.prototype,"paymentMethods",2),De=n([v("primer-payment-method")],De);var Ui=g`
1227
+ `;var ze=class extends v{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return h;let t=this.paymentMethods?.get(this.type);if(!t)return h;switch(t?.managerType){case"CARD":return c`<primer-card-form></primer-card-form>`;case"NATIVE":return c`<primer-native-payment
1228
+ .paymentMethod=${t}
1229
+ ></primer-native-payment>`;case"REDIRECT":return c`<primer-redirect-payment
1230
+ .paymentMethod=${t}
1231
+ ></primer-redirect-payment>`;case"KLARNA":return c`<primer-klarna></primer-klarna>`;case"ACH":return c`
1232
+ <primer-dynamic-payment
1233
+ .paymentMethod=${t}
1234
+ ></primer-dynamic-payment>
1235
+ `;default:return h}}};ze.styles=[Va],s([p({type:String})],ze.prototype,"type",2),s([b({context:vt,subscribe:!0}),p()],ze.prototype,"paymentMethods",2),ze=s([y("primer-payment-method")],ze);var Ha=f`
1236
+ :host {
1237
+ display: flex;
1238
+ flex-direction: column;
1239
+ gap: var(--primer-space-medium);
1240
+ width: 100%;
1241
+ }
1242
+
1243
+ h2 {
1244
+ margin: 0;
1245
+ padding: 0;
1246
+ border-radius: var(--primer-radius-medium);
1247
+ font-weight: var(--primer-typography-title-xlarge-weight);
1248
+ font-size: var(--primer-typography-title-xlarge-size);
1249
+ letter-spacing: var(--primer-typography-title-xlarge-letter-spacing);
1250
+ line-height: var(--primer-typography-title-xlarge-line-height);
1251
+ font-family: var(--primer-typography-title-xlarge-font);
1252
+ }
1253
+
1254
+ p {
1255
+ margin: 0;
1256
+ padding: 0;
1257
+ border-radius: var(--primer-radius-medium);
1258
+ font-weight: var(--primer-typography-body-medium-weight);
1259
+ font-size: var(--primer-typography-body-medium-size);
1260
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
1261
+ line-height: var(--primer-typography-body-medium-line-height);
1262
+ font-family: var(--primer-typography-body-medium-font);
1263
+ }
1264
+
1265
+ form {
1266
+ display: flex;
1267
+ flex-direction: column;
1268
+ gap: var(--primer-space-medium);
1269
+ width: 100%;
1270
+ }
1271
+
1272
+ .form-row {
1273
+ display: flex;
1274
+ gap: var(--primer-space-small);
1275
+ width: 100%;
1276
+ }
1277
+
1278
+ .form-row primer-input-wrapper {
1279
+ flex: 1;
1280
+ }
1281
+
1282
+ .error-message {
1283
+ color: var(--primer-color-text-negative);
1284
+ background-color: var(--primer-color-red-100);
1285
+ padding: var(--primer-space-small);
1286
+ border-radius: var(--primer-radius-small);
1287
+ font-weight: var(--primer-typography-body-medium-weight);
1288
+ font-size: var(--primer-typography-body-medium-size);
1289
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
1290
+ line-height: var(--primer-typography-body-medium-line-height);
1291
+ font-family: var(--primer-typography-body-medium-font);
1292
+ }
1293
+
1294
+ .loading-container {
1295
+ display: flex;
1296
+ flex-direction: column;
1297
+ align-items: center;
1298
+ justify-content: center;
1299
+ gap: var(--primer-space-medium);
1300
+ padding: var(--primer-space-large);
1301
+ }
1302
+
1303
+ .button-group {
1304
+ display: flex;
1305
+ gap: var(--primer-space-small);
1306
+ margin-top: var(--primer-space-medium);
1307
+ }
1308
+
1309
+ /* Apply responsive styles for small screens */
1310
+ @media (max-width: 600px) {
1311
+ .form-row {
1312
+ flex-direction: column;
1313
+ gap: var(--primer-space-medium);
1314
+ }
1315
+
1316
+ .button-group {
1317
+ flex-direction: column;
1318
+ }
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`
1321
+ <h2>
1322
+ ${A("payWithAch",{id:"payWithAch"})}
1323
+ </h2>
1324
+ <p>
1325
+ ${A("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
1326
+ </p>
1327
+
1328
+ <form @submit=${r=>r.preventDefault()}>
1329
+ <div class="form-row">
1330
+ <primer-input-wrapper
1331
+ .hasError=${this.formController.hasError.firstName}
1332
+ >
1333
+ <primer-input-label slot="label">
1334
+ ${A("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
1335
+ </primer-input-label>
1336
+ <primer-input
1337
+ slot="input"
1338
+ .value=${this.formController.formState.firstName.value}
1339
+ @input=${r=>this._handleInput(r,"firstName")}
1340
+ @blur=${()=>this._handleBlur("firstName")}
1341
+ ?disabled=${this.isSubmitting}
1342
+ ></primer-input>
1343
+ <primer-input-error slot="error">
1344
+ ${this.formController.hasError.firstName?this.formController.formState.firstName.error:h}
1345
+ </primer-input-error>
1346
+ </primer-input-wrapper>
1347
+ <primer-input-wrapper
1348
+ .hasError=${this.formController.hasError.lastName}
1349
+ >
1350
+ <primer-input-label slot="label">
1351
+ ${A("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
1352
+ </primer-input-label>
1353
+ <primer-input
1354
+ slot="input"
1355
+ .value=${this.formController.formState.lastName.value}
1356
+ @input=${r=>this._handleInput(r,"lastName")}
1357
+ @blur=${()=>this._handleBlur("lastName")}
1358
+ ?disabled=${this.isSubmitting}
1359
+ >
1360
+ </primer-input>
1361
+ <primer-input-error slot="error">
1362
+ ${this.formController.hasError.lastName?this.formController.formState.lastName.error:h}
1363
+ </primer-input-error>
1364
+ </primer-input-wrapper>
1365
+ </div>
1366
+ <primer-input-wrapper
1367
+ .hasError=${this.formController.hasError.emailAddress}
1368
+ >
1369
+ <primer-input-label slot="label">
1370
+ ${A("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
1371
+ </primer-input-label>
1372
+ <primer-input
1373
+ slot="input"
1374
+ type="email"
1375
+ .value=${this.formController.formState.emailAddress.value}
1376
+ @input=${r=>this._handleInput(r,"emailAddress")}
1377
+ @blur=${()=>this._handleBlur("emailAddress")}
1378
+ ?disabled=${this.isSubmitting}
1379
+ ></primer-input>
1380
+ <primer-input-error slot="error">
1381
+ ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:h}
1382
+ </primer-input-error>
1383
+ </primer-input-wrapper>
1384
+ <p>
1385
+ ${A("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
1386
+ </p>
1387
+ <primer-button
1388
+ buttonType="submit"
1389
+ variant="primary"
1390
+ @click=${()=>this._handleSubmitButtonClick(t)}
1391
+ ?disabled=${this.isSubmitting}
1392
+ ?loading=${this.isSubmitting}
1393
+ >
1394
+ ${A("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
1395
+ </primer-button>
1396
+ </form>
1397
+ `}renderMandate(){return c`
1398
+ <h2>
1399
+ ${A("payWithAch",{id:"payWithAch"})}
1400
+ </h2>
1401
+
1402
+ <p>
1403
+ ${this.clientOptions?.stripe?.mandateData.fullMandateText??A("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
1404
+ </p>
1405
+
1406
+ <div class="button-group">
1407
+ <primer-button
1408
+ variant="primary"
1409
+ @click=${this._handleConfirmMandate.bind(this)}
1410
+ ?disabled=${this.isSubmitting}
1411
+ ?loading=${this.isSubmitting}
1412
+ >
1413
+ ${A("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
1414
+ </primer-button>
1415
+
1416
+ <primer-button
1417
+ variant="tertiary"
1418
+ @click=${this._handleDeclineMandate.bind(this)}
1419
+ ?disabled=${this.isSubmitting}
1420
+ >
1421
+ ${A("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
1422
+ </primer-button>
1423
+ </div>
1424
+ `}render(){return this._paymentMethodManagerTask.render({complete:t=>t?this.screen==="form"?this.renderForm(t):this.renderMandate():h})}};pe.styles=[w,Ha],s([p({type:Object})],pe.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p({attribute:!1})],pe.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p({attribute:!1})],pe.prototype,"sdkState",2),s([b({context:Le,subscribe:!0}),p({attribute:!1})],pe.prototype,"clientOptions",2),s([I()],pe.prototype,"screen",2),s([I()],pe.prototype,"isSubmitting",2),pe=s([y("primer-ach-payment"),$()],pe);var Ya=f`
1176
1425
  :host {
1177
1426
  height: calc(
1178
1427
  var(--primer-typography-title-large-line-height) +
@@ -1181,7 +1430,7 @@ primer-checkout.primer-dark-theme {
1181
1430
  display: flex;
1182
1431
 
1183
1432
  /* Default value for the background color CSS variable */
1184
- --redirect-payment-button-bg-color: var(
1433
+ --dynamic-payment-button-bg-color: var(
1185
1434
  --primer-color-background-outlined-default
1186
1435
  );
1187
1436
  }
@@ -1192,7 +1441,7 @@ primer-checkout.primer-dark-theme {
1192
1441
  }
1193
1442
 
1194
1443
  primer-button::part(button) {
1195
- background-color: var(--redirect-payment-button-bg-color);
1444
+ background-color: var(--dynamic-payment-button-bg-color);
1196
1445
  border: 1px solid var(--primer-color-border-outlined-default);
1197
1446
  color: var(--primer-color-text-primary);
1198
1447
  flex: 1;
@@ -1202,22 +1451,128 @@ primer-checkout.primer-dark-theme {
1202
1451
  .image-container {
1203
1452
  display: flex;
1204
1453
  justify-content: center;
1205
- width: 100%;
1206
1454
  height: 100%;
1207
1455
  }
1208
1456
  /* Target the img specifically inside our component */
1209
1457
  img {
1210
1458
  height: 100%;
1211
1459
  }
1212
- `;var ge=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?N:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return N;let i=r.getPaymentMethodConfiguration(e);return i?{backgroundColor:i.displayMetadata.button.backgroundColor.colored,name:i.name,iconUrl:i.displayMetadata.button.iconUrl.colored}:N},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?N:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor),m` <primer-button
1213
- @click="${()=>this.startRedirectPayment()}"
1214
- class=${ce({loading:!!this.sdkState?.isProcessing})}
1215
- title="${P("pay_with",{id:"pay_with"})} ${e.name}"
1216
- >
1217
- <span class="image-container">
1218
- <img src="${e.iconUrl}" alt="${e.name}" />
1219
- </span>
1220
- </primer-button>`)})}};ge.styles=[_,Ui],n([d({type:Object})],ge.prototype,"paymentMethod",2),n([C({context:ue,subscribe:!0})],ge.prototype,"paymentManagers",2),n([C({context:j,subscribe:!0})],ge.prototype,"sdkState",2),n([C({context:q,subscribe:!0})],ge.prototype,"headlessUtils",2),ge=n([v("primer-redirect-payment"),L()],ge);var zi=g`
1460
+ `;function Qt(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())}var fe=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>!t||!r?L:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=r.getPaymentMethodConfiguration(t);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:L},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new D(this,{task:async([t,r])=>!t||!r?L:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?Qt(t):"";return r==="payWith"&&(r="pay_with"),A(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?c`
1461
+ <primer-portal>
1462
+ <primer-dialog @primer-dialog-close="${()=>this.open=!1}">
1463
+ <primer-ach-payment
1464
+ .paymentMethod=${this.paymentMethod}
1465
+ @primer-ach-error=${()=>this.open=!1}
1466
+ @primer-ach-mandate-confirmed=${()=>this.open=!1}
1467
+ @primer-ach-mandate-declined=${()=>this.open=!1}
1468
+ ></primer-ach-payment>
1469
+ </primer-dialog>
1470
+ </primer-portal>
1471
+ `:h}render(){return this._setupTasks.render({error:()=>h,complete:({assetsConfig:t})=>(this.style.setProperty("--dynamic-payment-button-bg-color",t.backgroundColor),c`
1472
+ <primer-button
1473
+ @click="${()=>this.start()}"
1474
+ class=${Z({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1475
+ title="${A("pay_with",{id:"pay_with"})} ${t.name}"
1476
+ >
1477
+ <span class="image-container">
1478
+ <img src="${t.iconUrl}" alt="${t.name}" />
1479
+ </span>
1480
+ ${t.displayName}
1481
+ </primer-button>
1482
+ ${this.renderDialog()}
1483
+ `)})}};fe.styles=[w,Ya],s([p({type:Object})],fe.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0})],fe.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0})],fe.prototype,"sdkState",2),s([b({context:W,subscribe:!0})],fe.prototype,"headlessUtils",2),s([I()],fe.prototype,"open",2),fe=s([y("primer-dynamic-payment"),$()],fe);var za=f`
1484
+ :host {
1485
+ height: calc(
1486
+ var(--primer-typography-title-large-line-height) +
1487
+ calc(2 * var(--primer-space-medium))
1488
+ );
1489
+ display: flex;
1490
+
1491
+ /* Default value for the background color CSS variable */
1492
+ --redirect-payment-button-bg-color: var(
1493
+ --primer-color-background-outlined-default
1494
+ );
1495
+ }
1496
+
1497
+ primer-button {
1498
+ width: 100%;
1499
+ height: 100%;
1500
+ }
1501
+
1502
+ primer-button::part(button) {
1503
+ background-color: var(--redirect-payment-button-bg-color);
1504
+ border: 1px solid var(--primer-color-border-outlined-default);
1505
+ color: var(--primer-color-text-primary);
1506
+ flex: 1;
1507
+ padding: var(--primer-space-small);
1508
+ display: flex;
1509
+ align-items: center;
1510
+ justify-content: center;
1511
+ gap: var(--primer-space-small);
1512
+ }
1513
+
1514
+ /* Default layout: icon on the left (START) */
1515
+ primer-button {
1516
+ display: flex;
1517
+ flex-direction: row;
1518
+ }
1519
+
1520
+ /* When icon position is END */
1521
+ primer-button.icon-end {
1522
+ flex-direction: row-reverse;
1523
+ }
1524
+
1525
+ .image-container {
1526
+ display: flex;
1527
+ justify-content: center;
1528
+ align-items: center;
1529
+ min-width: 100px;
1530
+ height: 100%;
1531
+ }
1532
+
1533
+ .button-text {
1534
+ font-family: var(--primer-typography-font-family);
1535
+ font-size: var(--primer-typography-title-small-font-size);
1536
+ font-weight: var(--primer-typography-title-small-font-weight);
1537
+ line-height: var(--primer-typography-title-small-line-height);
1538
+ letter-spacing: var(--primer-typography-title-small-letter-spacing);
1539
+ white-space: nowrap;
1540
+ overflow: hidden;
1541
+ text-overflow: ellipsis;
1542
+ }
1543
+
1544
+ /* Target the img specifically inside our component */
1545
+ img {
1546
+ max-width: 100px;
1547
+ width: 100%;
1548
+ height: auto;
1549
+ object-fit: cover;
1550
+ max-height: 100%;
1551
+ }
1552
+
1553
+ /* For image container sizing */
1554
+ .image-container {
1555
+ flex-shrink: 0;
1556
+ flex-grow: 1;
1557
+ }
1558
+ `;var be=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>!t||!r?L:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=r.getPaymentMethodConfiguration(t);if(!o)return L;let n=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,l=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:n,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:l}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new D(this,{task:async([t,r])=>!t||!r?L:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?Qt(t):"";return r==="payWith"&&(r="pay_with"),A(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>h,complete:({assetsConfig:t})=>{this.style.setProperty("--redirect-payment-button-bg-color",t.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":t.iconPosition==="END","image-only":!t.displayName},o=t.displayName?c`
1559
+ <span class="image-container">
1560
+ <img src="${t.iconUrl}" alt="${t.name}" />
1561
+ </span>
1562
+ <span class="button-text">${t.displayName}</span>
1563
+ `:c`
1564
+ <span class="image-container">
1565
+ <img src="${t.iconUrl}" alt="${t.name}" />
1566
+ </span>
1567
+ `;return c`
1568
+ <primer-button
1569
+ @click="${()=>this.startRedirectPayment()}"
1570
+ class=${Z(r)}
1571
+ title="${A("pay_with",{id:"pay_with"})} ${t.name}"
1572
+ >
1573
+ ${o}
1574
+ </primer-button>
1575
+ `}})}};be.styles=[w,za],s([p({type:Object})],be.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0})],be.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0})],be.prototype,"sdkState",2),s([b({context:W,subscribe:!0})],be.prototype,"headlessUtils",2),be=s([y("primer-redirect-payment"),$()],be);var Fa=f`
1221
1576
  :host {
1222
1577
  display: contents;
1223
1578
  }
@@ -1236,22 +1591,22 @@ primer-checkout.primer-dark-theme {
1236
1591
  primer-vault-manager {
1237
1592
  margin-bottom: var(--primer-space-xlarge);
1238
1593
  }
1239
- `;var $e=class extends f{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?m`
1594
+ `;var Fe=class extends v{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?c`
1240
1595
  <slot name="checkout-complete">
1241
1596
  <primer-checkout-complete></primer-checkout-complete>
1242
1597
  </slot>
1243
- `:m`
1598
+ `:c`
1244
1599
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1245
- ${$(this.hasAssignedContent,()=>u,()=>m`
1600
+ ${U(this.hasAssignedContent,()=>h,()=>c`
1246
1601
  <div
1247
- class=${ce({"primer-is-processing":!!this.sdkState?.isProcessing})}
1602
+ class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
1248
1603
  >
1249
1604
  <primer-vault-manager></primer-vault-manager>
1250
1605
  <primer-show-other-payments>
1251
1606
  <div slot="other-payments" class="primer-main-list">
1252
- ${this.paymentMethods?.toArray().map(e=>m`
1607
+ ${this.paymentMethods?.toArray().map(t=>c`
1253
1608
  <primer-payment-method
1254
- type=${e.type}
1609
+ type=${t.type}
1255
1610
  ></primer-payment-method>
1256
1611
  `)}
1257
1612
  </div>
@@ -1259,7 +1614,7 @@ primer-checkout.primer-dark-theme {
1259
1614
  <primer-error-message-container></primer-error-message-container>
1260
1615
  </div>
1261
1616
  `)}
1262
- `}};$e.styles=[_,zi],n([C({context:it,subscribe:!0}),d()],$e.prototype,"paymentMethods",2),n([C({context:j,subscribe:!0}),d()],$e.prototype,"sdkState",2),$e=n([v("primer-main")],$e);var Bi=g`
1617
+ `}};Fe.styles=[w,Fa],s([b({context:vt,subscribe:!0}),p()],Fe.prototype,"paymentMethods",2),s([b({context:j,subscribe:!0}),p()],Fe.prototype,"sdkState",2),Fe=s([y("primer-main")],Fe);var Ba=f`
1263
1618
  :host {
1264
1619
  height: calc(
1265
1620
  var(--primer-typography-title-large-line-height) +
@@ -1273,10 +1628,10 @@ primer-checkout.primer-dark-theme {
1273
1628
  height: 100%;
1274
1629
  flex: 1;
1275
1630
  }
1276
- `;var Me=class extends f{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new V(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return N;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new V(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return N;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let i=this.calculateButtonHeight(),s=e.createButton(),p=this.createRenderOptions(i);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,p),e}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>u,complete:()=>m`
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`
1277
1632
  <!-- The native button container is rendered first -->
1278
1633
  <div class="native-button-container" id="${this._buttonId}"></div>
1279
- `,pending:()=>u})}};Me.styles=[_,Bi],n([d({type:Object})],Me.prototype,"paymentMethod",2),n([C({context:ue,subscribe:!0}),d()],Me.prototype,"paymentManagers",2),n([C({context:Pe,subscribe:!0}),d()],Me.prototype,"computedStyles",2),Me=n([v("primer-native-payment")],Me);var vr="card-form-context";var Fi=g`
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`
1280
1635
  :host {
1281
1636
  display: contents;
1282
1637
  }
@@ -1299,10 +1654,10 @@ primer-checkout.primer-dark-theme {
1299
1654
  display: flex;
1300
1655
  gap: var(--primer-space-small);
1301
1656
  }
1302
- `;var Se=class extends f{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new K(this,{context:vr,initialValue:null});this.eventsController=new tt(this);this.setupCardFormTask=new V(this,{task:async([e])=>{if(!e?.manager)return N;let{manager:r}=e,{cardNumberInput:i,expiryInput:s,cvvInput:p}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:i,expiryInput:s,cvvInput:p,setCardholderName:x=>r.setCardholderName(x),setCardNetwork:x=>{this.selectedCardNetwork=x},validate:()=>r.validate(),submit:x=>r.submit(x)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let i=e.target.closest("button, primer-button");if(!i)return;this.isSubmitButton(i)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.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(e){let r=e.tagName.toLowerCase(),i=r==="button",s=r==="primer-button";return i&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||s&&(e.getAttribute("buttonType")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let i=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(i)}else{let i=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:i}),this.eventsController.dispatchFormSubmitErrors(i)}}render(){return this.setupCardFormTask.status===ke.ERROR||this.setupCardFormTask.status===ke.INITIAL?u:m`
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`
1303
1658
  <form @submit=${this.handleFormSubmit}>
1304
1659
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1305
- ${this.setupCardFormTask.render({complete:()=>$(this.hasAssignedContent,()=>u,()=>m`
1660
+ ${this.setupCardFormTask.render({complete:()=>U(this.hasAssignedContent,()=>h,()=>c`
1306
1661
  <div class="card-form">
1307
1662
  <primer-input-card-number></primer-input-card-number>
1308
1663
  <div class="card-form-row">
@@ -1314,7 +1669,7 @@ primer-checkout.primer-dark-theme {
1314
1669
  <primer-card-form-submit></primer-card-form-submit>
1315
1670
  `)})}
1316
1671
  </form>
1317
- `}};Se.styles=[_,Fi],n([k()],Se.prototype,"hasAssignedContent",2),n([k()],Se.prototype,"selectedCardNetwork",2),n([C({context:ue,subscribe:!0}),d({type:Object})],Se.prototype,"paymentManagers",2),Se=n([v("primer-card-form"),L()],Se);function Ki(o,t){if(o.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;",o.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
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=`
1318
1673
  input[data-custom-input]::placeholder {
1319
1674
  color: var(--primer-color-text-placeholder);
1320
1675
  font-size: var(--primer-typography-body-large-size);
@@ -1323,10 +1678,10 @@ primer-checkout.primer-dark-theme {
1323
1678
  input[data-custom-input]:focus {
1324
1679
  outline: none;
1325
1680
  }
1326
- `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function yr(o){return o?{paddingHorizontal:0,placeholder:{color:o.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim()},height:o.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim(),color:o.getPropertyValue("--primer-color-text-primary").trim()}:null}function ji(o,t){return o.active===t.active&&o.dirty===t.dirty&&o.error===t.error&&o.errorCode===t.errorCode&&o.submitted===t.submitted&&o.touched===t.touched&&o.valid===t.valid}var br=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new V(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return N;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):N}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,Ki(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(s=>requestAnimationFrame(()=>s())),this._hostedInput=t;let r=yr(this.host.computedStyles),i=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",s=>{this._meta=s,ji(this._meta,s)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...i}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var G=class extends f{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:P(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new br(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===ke.ERROR)return u;let e=this.getError();return m`
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`
1327
1682
  <primer-input-wrapper
1328
1683
  .focusWithin="${this.hostedInputController.isFocused}"
1329
- .hasError=${!!e}
1684
+ .hasError=${!!t}
1330
1685
  @wrapper-click="${this.handleWrapperClick}"
1331
1686
  >
1332
1687
  <primer-input-label slot="label">${this.label}</primer-input-label>
@@ -1335,13 +1690,13 @@ primer-checkout.primer-dark-theme {
1335
1690
  class="card-input-slot"
1336
1691
  id="${this.config.containerSelector.substring(1)}"
1337
1692
  ></div>
1338
- ${$(e,()=>m`
1693
+ ${U(t,()=>c`
1339
1694
  <primer-input-error slot="error">
1340
- ${P(e,{id:e})}
1695
+ ${A(t,{id:t})}
1341
1696
  </primer-input-error>
1342
- `,()=>u)}
1697
+ `,()=>h)}
1343
1698
  </primer-input-wrapper>
1344
- `}};n([C({context:vr,subscribe:!0})],G.prototype,"cardFormContext",2),n([C({context:Pe,subscribe:!0}),d()],G.prototype,"computedStyles",2),n([d({type:String})],G.prototype,"label",1),n([d({type:String})],G.prototype,"placeholder",1),n([d({type:String,attribute:"aria-label"})],G.prototype,"ariaLabel",1);var Gi=g`
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`
1345
1700
  :host {
1346
1701
  display: contents;
1347
1702
  }
@@ -1365,14 +1720,14 @@ primer-checkout.primer-dark-theme {
1365
1720
  align-items: center;
1366
1721
  z-index: 2;
1367
1722
  }
1368
- `;var Ve=g`
1723
+ `;var Be=f`
1369
1724
  .card-input-slot {
1370
1725
  display: flex;
1371
1726
  }
1372
- `;var lt=class extends G{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===ke.ERROR)return u;let e=this.getError();return m`
1727
+ `;var xt=class extends X{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(t){let{network:r}=t.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
1373
1728
  <primer-input-wrapper
1374
1729
  .focusWithin="${this.hostedInputController.isFocused}"
1375
- .hasError=${!!e}
1730
+ .hasError=${!!t}
1376
1731
  >
1377
1732
  <primer-input-label slot="label">${this.label}</primer-input-label>
1378
1733
  <div slot="input" class="card-number-container">
@@ -1383,29 +1738,29 @@ primer-checkout.primer-dark-theme {
1383
1738
  ></primer-card-network-selector>
1384
1739
  </div>
1385
1740
  </div>
1386
- ${$(e,r=>m`
1741
+ ${U(t,r=>c`
1387
1742
  <primer-input-error slot="error">
1388
- ${P(r,{id:r})}
1743
+ ${A(r,{id:r})}
1389
1744
  </primer-input-error>
1390
- `,()=>u)}
1745
+ `,()=>h)}
1391
1746
  </primer-input-wrapper>
1392
- `}render(){return this.renderInput()}};lt.styles=[_,Ve,Gi],lt=n([v("primer-input-card-number"),L()],lt);var qi=g`
1747
+ `}render(){return this.renderInput()}};xt.styles=[w,Be,qa],xt=s([y("primer-input-card-number"),$()],xt);var Wa=f`
1393
1748
  :host {
1394
1749
  display: contents;
1395
1750
  }
1396
- `;var dt=class extends G{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};dt.styles=[_,Ve,qi],dt=n([v("primer-input-cvv"),L()],dt);var Wi=g`
1751
+ `;var At=class extends X{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};At.styles=[w,Be,Wa],At=s([y("primer-input-cvv"),$()],At);var Za=f`
1397
1752
  :host {
1398
1753
  display: contents;
1399
1754
  }
1400
- `;var ct=class extends G{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};ct.styles=[_,Ve,Wi],ct=n([v("primer-input-card-expiry"),L()],ct);var Zi=g`
1755
+ `;var _t=class extends X{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};_t.styles=[w,Be,Za],_t=s([y("primer-input-card-expiry"),$()],_t);var Xa=f`
1401
1756
  :host {
1402
1757
  display: contents;
1403
1758
  }
1404
- `;var pt=class extends G{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};pt.styles=[_,Ve,Zi],pt=n([v("primer-input-card-holder-name"),L()],pt);var Xi=g`
1759
+ `;var St=class extends X{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:t=>this.handleInput(t)};this.childUpdated()}handleInput(t){this.cardFormContext?.setCardholderName?.(t)}render(){return this.renderInput()}};St.styles=[w,Be,Xa],St=s([y("primer-input-card-holder-name"),$()],St);var Ja=f`
1405
1760
  :host {
1406
1761
  display: contents;
1407
1762
  }
1408
- `;var se=class extends f{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=e=>{if(e.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:P("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u;return m`
1763
+ `;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`
1409
1764
  <primer-button
1410
1765
  buttonType="submit"
1411
1766
  variant=${this.variant}
@@ -1416,7 +1771,7 @@ primer-checkout.primer-dark-theme {
1416
1771
  >
1417
1772
  ${this.buttonText}${r}
1418
1773
  </primer-button>
1419
- `}};se.styles=[_,Xi],n([d({type:String})],se.prototype,"buttonText",1),n([C({context:q,subscribe:!0}),d({type:Object})],se.prototype,"headlessInstance",2),n([C({context:ot,subscribe:!0}),d({type:Object})],se.prototype,"clientOptions",2),n([C({context:j,subscribe:!0}),d()],se.prototype,"sdkState",2),n([d({type:String})],se.prototype,"variant",2),n([d({type:Boolean})],se.prototype,"disabled",2),se=n([v("primer-card-form-submit"),L()],se);var{I:rv}=vi;var Ji=o=>o.strings===void 0;var $t=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),$t(r,t);return!0},Er=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Qi=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Vn(t)}};function Dn(o){this._$AN!==void 0?(Er(this),this._$AM=o,Qi(this)):this._$AM=o}function $n(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)$t(r[s],!1),Er(r[s]);else r!=null&&($t(r,!1),Er(r));else $t(this,o)}var Vn=o=>{o.type==fr.CHILD&&(o._$AP??(o._$AP=$n),o._$AQ??(o._$AQ=Dn))},xr=class extends st{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Qi(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&($t(this,t),Er(this))}setValue(t){if(Ji(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var co=()=>new lo,lo=class{},so=new WeakMap,Cr=Dt(class extends xr{render(o){return u}update(o,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),u}rt(o){if(this.isConnected||(o=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=so.get(t);e===void 0&&(e=new WeakMap,so.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,o),o!==void 0&&this.Y.call(this.ht,o)}else this.Y.value=o}get lt(){return typeof this.Y=="function"?so.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 ea=g`
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`
1420
1775
  :host {
1421
1776
  display: flex;
1422
1777
  align-items: center;
@@ -1536,79 +1891,120 @@ primer-checkout.primer-dark-theme {
1536
1891
  width: var(--primer-size-small);
1537
1892
  height: var(--primer-size-small);
1538
1893
  }
1539
- `;var le=class extends f{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=co();this.dropdownRef=co();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(i=>i.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return m`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return m`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return m`<primer-icon name="payment-card" size="sm"></primer-icon>`;let i=e.length>1;return m`
1894
+ `;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`
1540
1895
  <button
1541
- ${Cr(this.buttonRef)}
1896
+ ${Zr(this.buttonRef)}
1542
1897
  class="network-selector"
1543
1898
  @click=${this.toggleDropdown}
1544
- @keydown=${s=>{(s.key===" "||s.key==="Enter")&&i&&(s.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1545
- aria-label=${i?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1546
- aria-expanded=${i?this.isDropdownOpen:u}
1547
- aria-haspopup=${i?"true":u}
1548
- aria-controls=${i?"network-dropdown":u}
1899
+ @keydown=${n=>{(n.key===" "||n.key==="Enter")&&o&&(n.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1900
+ aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1901
+ aria-expanded=${o?this.isDropdownOpen:h}
1902
+ aria-haspopup=${o?"true":h}
1903
+ aria-controls=${o?"network-dropdown":h}
1549
1904
  >
1550
1905
  <img
1551
1906
  class="network-icon"
1552
1907
  src=${this.getNetworkIconUrl(r)}
1553
1908
  alt=${r.displayName}
1554
1909
  />
1555
- ${$(i,()=>m`
1910
+ ${U(o,()=>c`
1556
1911
  <primer-icon
1557
1912
  class="caret ${this.isDropdownOpen?"open":""}"
1558
1913
  name="chevron-down"
1559
1914
  ></primer-icon>
1560
- `,()=>u)}
1915
+ `,()=>h)}
1561
1916
  </button>
1562
1917
 
1563
- ${$(this.isDropdownOpen,()=>m`
1918
+ ${U(this.isDropdownOpen,()=>c`
1564
1919
  <div
1565
- ${Cr(this.dropdownRef)}
1920
+ ${Zr(this.dropdownRef)}
1566
1921
  id="network-dropdown"
1567
1922
  class="dropdown open"
1568
1923
  role="listbox"
1569
1924
  aria-label="Select card network"
1570
1925
  >
1571
- ${e.map((s,p)=>m`
1926
+ ${t.map((n,l)=>c`
1572
1927
  <div
1573
- ${Cr(x=>this.setNetworkOptionRef(x,p))}
1574
- class="network-option ${this.isKeyboardNavigation&&p===this.focusedNetworkIndex?"focused":""}"
1575
- @click=${x=>this.selectNetwork(x,s)}
1576
- @keydown=${x=>{(x.key==="Enter"||x.key===" ")&&this.selectNetwork(x,s)}}
1928
+ ${Zr(g=>this.setNetworkOptionRef(g,l))}
1929
+ class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
1930
+ @click=${g=>this.selectNetwork(g,n)}
1931
+ @keydown=${g=>{(g.key==="Enter"||g.key===" ")&&this.selectNetwork(g,n)}}
1577
1932
  role="option"
1578
- aria-selected=${s.network===r.network}
1579
- tabindex="${p===this.focusedNetworkIndex?"0":"-1"}"
1933
+ aria-selected=${n.network===r.network}
1934
+ tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
1580
1935
  >
1581
1936
  <img
1582
1937
  class="network-option-icon"
1583
- src=${this.getNetworkIconUrl(s)}
1584
- alt=${s.displayName}
1938
+ src=${this.getNetworkIconUrl(n)}
1939
+ alt=${n.displayName}
1585
1940
  />
1586
- <span class="network-name">${s.displayName}</span>
1587
- ${$(s.network===r.network,()=>m`
1941
+ <span class="network-name">${n.displayName}</span>
1942
+ ${U(n.network===r.network,()=>c`
1588
1943
  <primer-icon
1589
1944
  class="checkmark"
1590
1945
  name="checkmark"
1591
1946
  ></primer-icon>
1592
- `,()=>u)}
1947
+ `,()=>h)}
1593
1948
  </div>
1594
1949
  `)}
1595
1950
  </div>
1596
- `,()=>u)}
1597
- `}};le.styles=[_,ea],n([C({context:jt,subscribe:!0})],le.prototype,"cardNetworks",2),n([C({context:q,subscribe:!0})],le.prototype,"headlessUtils",2),n([k()],le.prototype,"selectedCardNetwork",2),n([k()],le.prototype,"isDropdownOpen",2),n([k()],le.prototype,"focusedNetworkIndex",2),n([k()],le.prototype,"isKeyboardNavigation",2),le=n([v("primer-card-network-selector")],le);var Hn=Dr(Ar(),1),mt=Dr(Ar(),1);function mo(o){return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()}function Yn(o){return o?o===o.toUpperCase()?mo(o):o:""}function ta(o,t){return[o,t].filter(Boolean).join(" ")}function Un(o,t){return!o||!t?"":`Expires ${o}/${t.slice(-2)}`}function ra(o){return o?`\u2022\u2022\u2022\u2022 ${o}`:""}function zn(o){let t=o.paymentInstrumentData,e=Yn(t.network),r=t.last4Digits,i=`${o.paymentInstrumentData.cardholderName?o.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${ra(r)}`:e)||" Card"}`,s=Un(t.expirationMonth,t.expirationYear);return{description:i,secondaryDescription:s}}function Bn(o){let t=o.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",i=t.externalPayerInfo?.lastName||"",s=o.userDescription||e||"PayPal Account",p=ta(r,i);return{description:s,secondaryDescription:p}}function Fn(o){let t=o.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",i=t.sessionData?.billingAddress?.lastName||"",s=o.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),p=ta(r,i);return{description:s,secondaryDescription:p}}function Kn(o){let t=o.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",i=t.accountType||"",s=o.userDescription;s||(r&&e?s=`${r} ${ra(e)}`:r?s=r:s="Bank Account");let p=i?`${mo(i)} Account`:"";return{description:s,secondaryDescription:p}}function jn(o){let t=o.paymentInstrumentType,e=mo(t.replace(/_/g," "));return{description:o.userDescription||e}}var Gn={[mt.PaymentInstrumentType.CARD]:zn,[mt.PaymentInstrumentType.PAYPAL_VAULTED]:Bn,[mt.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:Fn,[mt.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:Kn};function Mr(o){try{let t=Gn[o.paymentInstrumentType];return t?t(o):jn(o)}catch(t){return w.error("FormatUtils",`Error formatting payment method ${o.id}:`,t),{description:o.userDescription||o.id||"Payment Method"}}}var oa=g`
1951
+ `,()=>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`
1598
1953
  :host {
1599
1954
  display: block;
1600
1955
  width: 100%;
1956
+ position: relative;
1601
1957
  }
1602
1958
 
1603
1959
  .vault-manager {
1604
1960
  display: flex;
1605
1961
  flex-direction: column;
1962
+ position: relative;
1606
1963
  }
1607
1964
 
1608
1965
  .vault-manager-content {
1609
1966
  display: flex;
1610
1967
  flex-direction: column;
1611
1968
  width: 100%;
1969
+ position: relative;
1970
+ }
1971
+
1972
+ /* Content container using CSS Grid for height animation */
1973
+ .content-container {
1974
+ display: grid;
1975
+ grid-template-rows: 1fr;
1976
+ transition: grid-template-rows var(--primer-animation-duration)
1977
+ var(--primer-animation-easing);
1978
+ width: 100%;
1979
+ position: relative;
1980
+ }
1981
+
1982
+ /* Required to make grid animation work - ensures content can expand/collapse properly */
1983
+ .content-container > * {
1984
+ min-height: 0;
1985
+ overflow: hidden;
1986
+ }
1987
+
1988
+ /* Submit button container */
1989
+ .submit-button-container {
1990
+ display: grid;
1991
+ grid-template-rows: 1fr;
1992
+ transition: grid-template-rows var(--primer-animation-duration)
1993
+ var(--primer-animation-easing);
1994
+ overflow: hidden;
1995
+ margin-top: var(--primer-space-small);
1996
+ width: 100%;
1997
+ }
1998
+
1999
+ /* Ensure the submit button has full width */
2000
+ .submit-button {
2001
+ width: 100%;
2002
+ }
2003
+
2004
+ /* Make sure pay button inside the submit component is full width */
2005
+ primer-vault-payment-submit::part(button),
2006
+ ::slotted(primer-button) {
2007
+ width: 100%;
1612
2008
  }
1613
2009
 
1614
2010
  /* Payment methods list */
@@ -1617,60 +2013,136 @@ primer-checkout.primer-dark-theme {
1617
2013
  flex-direction: column;
1618
2014
  gap: var(--primer-space-small);
1619
2015
  width: 100%;
2016
+ position: relative;
1620
2017
  }
1621
2018
 
1622
2019
  /* Delete confirmation container */
1623
2020
  .delete-confirmation-container {
1624
2021
  width: 100%;
1625
- z-index: 1;
2022
+ position: relative;
2023
+ }
2024
+
2025
+ /* Loading overlay styles */
2026
+ .loading-overlay {
2027
+ position: absolute;
2028
+ top: 0;
2029
+ left: 0;
2030
+ width: 100%;
2031
+ height: 100%;
2032
+ display: flex;
2033
+ align-items: center;
2034
+ justify-content: center;
2035
+ background-color: rgba(255, 255, 255, 0.7);
2036
+ z-index: 10;
2037
+ border-radius: var(--primer-radius-medium);
2038
+ backdrop-filter: blur(2px);
2039
+ opacity: 0; /* Start invisible */
2040
+ }
2041
+
2042
+ /* Add styles for when updating is active */
2043
+ .is-updating {
2044
+ pointer-events: none; /* Prevent interaction when updating */
2045
+ }
2046
+
2047
+ /*
2048
+ * Component-specific styles to ensure smooth animations
2049
+ * These components need display:block to work with the grid layout
2050
+ */
2051
+ primer-vault-payment-method-item,
2052
+ primer-vault-empty-state,
2053
+ primer-vault-delete-confirmation {
2054
+ display: block;
2055
+ width: 100%;
2056
+ }
2057
+
2058
+ /* Disable animations for reduced motion preference */
2059
+ @media (prefers-reduced-motion: reduce) {
2060
+ .content-container,
2061
+ .submit-button-container,
2062
+ primer-vault-payment-method-item,
2063
+ primer-vault-payment-submit,
2064
+ primer-vault-empty-state,
2065
+ primer-vault-delete-confirmation {
2066
+ transition: none;
2067
+ }
1626
2068
  }
1627
- `;var pe=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage=""}handleToggleEditMode(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=P("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(e){this.errorMessage=e instanceof Error?e.message:P("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(e){let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:P("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(i=>i.id===e);if(!r)return"";try{return Mr(r).description||""}catch{return""}}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return m`
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=`[
2070
+ \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`
2072
+ <div
2073
+ class="loading-overlay"
2074
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2075
+ >
2076
+ <primer-spinner
2077
+ size="medium"
2078
+ color="var(--primer-color-loader)"
2079
+ ></primer-spinner>
2080
+ </div>
2081
+ `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return h;let t=this.getPaymentMethodName(this.deletePaymentMethodId);return c`
1628
2082
  <div class="delete-confirmation-container">
1629
2083
  <primer-vault-delete-confirmation
1630
2084
  .isDeleting=${this.isDeleting}
1631
2085
  .paymentMethodId=${this.deletePaymentMethodId}
1632
- .paymentMethodName=${e}
2086
+ .paymentMethodName=${t}
1633
2087
  @confirm-delete=${this.handleConfirmDelete}
1634
2088
  @cancel-delete=${this.handleCancelDelete}
2089
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1635
2090
  ></primer-vault-delete-confirmation>
1636
2091
  </div>
1637
- `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:m`
2092
+ `}renderPaymentMethodItem(t){return this.deletePaymentMethodId===t.id?h:c`
1638
2093
  <primer-vault-payment-method-item
1639
- .paymentMethod=${e}
2094
+ .paymentMethod=${t}
1640
2095
  .isEditMode=${this.isEditMode}
1641
2096
  @delete-payment-method=${this.handleDeletePaymentMethod}
2097
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1642
2098
  ></primer-vault-payment-method-item>
1643
- `}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,i=!this.isEditMode&&e&&!r&&!this.deletePaymentMethodId;return m`
1644
- <div class="vault-manager">
2099
+ `}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return c`
2100
+ <div class="payment-methods-list">
2101
+ ${t.map(o=>this.renderPaymentMethodItem(o))}
2102
+ ${U(r,()=>c`
2103
+ <div class="submit-button-container">
2104
+ <primer-vault-payment-submit
2105
+ class="submit-button"
2106
+ @primer-vault-payment-error=${this.handlePaymentError}
2107
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2108
+ ></primer-vault-payment-submit>
2109
+ </div>
2110
+ `,()=>h)}
2111
+ </div>
2112
+ `}render(){if(!this.vaultManagerContext?.enabled)return h;let t=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return c`
2113
+ <div class="vault-manager ${o?"is-updating":""}">
1645
2114
  <primer-vault-manager-header
1646
2115
  .isEditMode=${this.isEditMode}
1647
- .hasPaymentMethods=${e}
2116
+ .hasPaymentMethods=${t}
1648
2117
  @toggle-edit-mode=${this.handleToggleEditMode}
1649
2118
  ></primer-vault-manager-header>
1650
2119
 
1651
- ${$(this.errorMessage,()=>m`
2120
+ ${U(this.errorMessage,()=>c`
1652
2121
  <primer-vault-error-message
1653
2122
  .errorMessage=${this.errorMessage}
1654
2123
  @close-error=${this.handleCloseError}
2124
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1655
2125
  ></primer-vault-error-message>
1656
- `,()=>u)}
2126
+ `,()=>h)}
1657
2127
 
1658
2128
  <div class="vault-manager-content">
1659
- ${$(!r&&!e,()=>m`<primer-vault-empty-state></primer-vault-empty-state>`,()=>u)}
1660
- ${$(!r&&e&&this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>u)}
1661
- ${$(!r&&e&&!this.deletePaymentMethodId,()=>m`
1662
- <div class="payment-methods-list">
1663
- ${this.vaultManagerContext?.vaultedPaymentMethods.map(s=>this.renderPaymentMethodItem(s))}
1664
- ${$(i,()=>m`
1665
- <primer-vault-payment-submit
1666
- @primer-vault-payment-error=${this.handlePaymentError}
1667
- ></primer-vault-payment-submit>
1668
- `,()=>u)}
2129
+ ${U(!r&&!t,()=>c`
2130
+ <div class="content-container">
2131
+ <primer-vault-empty-state
2132
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2133
+ ></primer-vault-empty-state>
2134
+ </div>
2135
+ `,()=>h)}
2136
+ ${U(!r&&t,()=>c`
2137
+ <div class="content-container">
2138
+ ${U(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
1669
2139
  </div>
1670
- `,()=>u)}
2140
+ `,()=>h)}
1671
2141
  </div>
2142
+
2143
+ ${U(o,()=>this.renderLoadingOverlay(),()=>h)}
1672
2144
  </div>
1673
- `}};pe.styles=[_,oa],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],pe.prototype,"vaultManagerContext",2),n([k()],pe.prototype,"isEditMode",2),n([k()],pe.prototype,"deletePaymentMethodId",2),n([k()],pe.prototype,"isDeleting",2),n([k()],pe.prototype,"errorMessage",2),pe=n([v("primer-vault-manager"),L()],pe);var ia=Dr(Ar(),1);function aa(o){return o.paymentInstrumentType===ia.PaymentInstrumentType.CARD}var na=g`
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`
1674
2146
  :host {
1675
2147
  display: flex;
1676
2148
  width: 100%;
@@ -1683,30 +2155,19 @@ primer-checkout.primer-dark-theme {
1683
2155
  width: 100%;
1684
2156
  }
1685
2157
 
1686
- /* Styles for edit mode */
1687
- .payment-method-item {
1688
- border: 1px solid var(--primer-color-border-outlined-default);
1689
- background-color: var(--primer-color-background-outlined-default);
1690
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
1691
- padding: var(--primer-space-medium);
1692
- border-radius: var(--primer-radius-medium);
1693
- box-sizing: border-box;
2158
+ .payment-method-container {
1694
2159
  display: flex;
1695
2160
  width: 100%;
1696
- }
1697
-
1698
- /* Hover states */
1699
- .payment-method-item:hover {
1700
- border-color: var(--primer-color-border-outlined-hover);
1701
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
1702
- }
1703
-
1704
- .payment-method-content {
1705
- display: flex;
1706
2161
  align-items: center;
1707
2162
  gap: var(--primer-space-small);
2163
+ }
2164
+
2165
+ /* Target the button part from primer-button using ::part selector */
2166
+ primer-button::part(button) {
1708
2167
  width: 100%;
1709
- position: relative;
2168
+ justify-content: flex-start;
2169
+ display: flex;
2170
+ text-align: left;
1710
2171
  }
1711
2172
 
1712
2173
  /* Card icons */
@@ -1730,10 +2191,11 @@ primer-checkout.primer-dark-theme {
1730
2191
  .payment-method-details {
1731
2192
  flex: 1;
1732
2193
  display: flex;
1733
- gap: var(--primer-space-small);
1734
- align-items: baseline;
2194
+ gap: var(--primer-space-xsmall);
2195
+ align-items: flex-start;
1735
2196
  transition: transform var(--primer-animation-duration)
1736
2197
  var(--primer-animation-easing);
2198
+ margin-left: var(--primer-space-small);
1737
2199
  }
1738
2200
 
1739
2201
  .payment-method-description {
@@ -1746,12 +2208,15 @@ primer-checkout.primer-dark-theme {
1746
2208
  .payment-method-secondary-description {
1747
2209
  font-size: var(--primer-typography-body-small-size);
1748
2210
  color: var(--primer-color-text-secondary);
1749
- margin-top: var(--primer-space-xxsmall);
1750
2211
  transition: color var(--primer-animation-duration)
1751
2212
  var(--primer-animation-easing);
1752
2213
  }
1753
2214
 
1754
- /* Delete button - visible only in edit mode */
2215
+ .payment-method-button {
2216
+ flex: 1;
2217
+ }
2218
+
2219
+ /* Delete button - for edit mode */
1755
2220
  .delete-button {
1756
2221
  background-color: transparent;
1757
2222
  border: none;
@@ -1765,15 +2230,11 @@ primer-checkout.primer-dark-theme {
1765
2230
  justify-content: center;
1766
2231
  height: var(--primer-size-medium);
1767
2232
  width: var(--primer-size-medium);
1768
- /* The delete button starts invisible */
1769
- opacity: 0;
1770
- transform: translateX(var(--primer-space-small));
1771
- }
1772
-
1773
- /* Delete button is fully visible in stable edit mode (not transitioning) */
1774
- .payment-method-item .delete-button {
1775
- opacity: 1;
1776
- transform: translateX(0);
2233
+ margin-left: var(--primer-space-small);
2234
+ transition:
2235
+ background-color var(--primer-animation-duration)
2236
+ var(--primer-animation-easing),
2237
+ transform var(--primer-animation-duration) var(--primer-animation-easing);
1777
2238
  }
1778
2239
 
1779
2240
  .delete-button:hover {
@@ -1788,51 +2249,52 @@ primer-checkout.primer-dark-theme {
1788
2249
  .delete-button primer-icon {
1789
2250
  color: var(--primer-color-red-500);
1790
2251
  }
1791
- `;var me=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new V(this,{task:async([e,r,i])=>{if(!e||!r||!i)return N;let s="";if(aa(e))s=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let h=await r.getCDNAssets(e.paymentMethodType);h&&(s=h.assets?.icon?`${h.goatCdnUrl}/${h.assets.icon}`:"")}let p=i.cvvRecapture,x=Mr(e);return{icon:s,shouldShowCVV:p,...x}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let e=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!e&&e.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(e){let r=e.icon?m`<img
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
1792
2253
  class="payment-method-icon"
1793
- src=${e.icon}
1794
- alt=${e.description}
1795
- />`:m`
2254
+ src=${t.icon}
2255
+ alt=${t.description}
2256
+ />`:c`
1796
2257
  <div class="payment-method-icon payment-method-icon-generic">
1797
2258
  <primer-icon name="payment-card" size="sm"></primer-icon>
1798
2259
  </div>
1799
- `;return m`
2260
+ `;return c`
1800
2261
  ${r}
1801
2262
  <div class="payment-method-details">
1802
- <div class="payment-method-description">${e.description}</div>
1803
- ${e.secondaryDescription?m`<div class="payment-method-secondary-description">
1804
- ${e.secondaryDescription}
1805
- </div>`:u}
2263
+ <div class="payment-method-description">${t.description}</div>
2264
+ ${t.secondaryDescription?c`<div class="payment-method-secondary-description">
2265
+ ${t.secondaryDescription}
2266
+ </div>`:h}
1806
2267
  </div>
1807
- `}render(){return this._getAssetsTask.render({error:()=>u,complete:e=>{let r=this.isSelected()?"checked":"default";return this.isEditMode?m`
1808
- <div class="payment-method-item" @click=${this.handleClick}>
1809
- <div class="payment-method-content">
1810
- ${this.renderPaymentMethodContent(e)}
1811
- <button
1812
- class="delete-button"
1813
- @click=${this.handleDeleteClick}
1814
- aria-label=${`${P("delete",{id:"delete"})} ${e.description}`}
1815
- >
1816
- <primer-icon name="trash" size="sm"></primer-icon>
1817
- </button>
1818
- </div>
1819
- </div>
1820
- `:m`
2268
+ `}render(){return this._getAssetsTask.render({error:()=>h,complete:t=>{let r=this.isSelected()?"checked":"default";return c`
1821
2269
  <div class="payment-method-wrapper">
1822
- <primer-button
1823
- variant="secondary"
1824
- class="payment-method-button"
1825
- selectable
1826
- selectionState=${r}
1827
- @click=${this.handleClick}
1828
- >
1829
- ${this.renderPaymentMethodContent(e)}
1830
- </primer-button>
1831
- ${$(e.shouldShowCVV&&this.isSelected(),()=>m`<primer-vault-cvv-input
1832
- .paymentMethod="${this.paymentMethod}"
1833
- ></primer-vault-cvv-input>`)}
2270
+ <div class="payment-method-container">
2271
+ <primer-button
2272
+ variant="secondary"
2273
+ class="payment-method-button"
2274
+ selectable
2275
+ ?disabled=${this.isEditMode}
2276
+ selectionState=${r}
2277
+ @click=${this.handleClick}
2278
+ >
2279
+ ${this.renderPaymentMethodContent(t)}
2280
+ </primer-button>
2281
+
2282
+ ${this.isEditMode?c`
2283
+ <button
2284
+ class="delete-button"
2285
+ @click=${this.handleDeleteClick}
2286
+ aria-label=${`${A("delete",{id:"delete"})} ${t.description}`}
2287
+ >
2288
+ <primer-icon name="trash" size="sm"></primer-icon>
2289
+ </button>
2290
+ `:h}
2291
+ </div>
2292
+
2293
+ ${U(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>c`<primer-vault-cvv-input
2294
+ .paymentMethod="${this.paymentMethod}"
2295
+ ></primer-vault-cvv-input>`,()=>h)}
1834
2296
  </div>
1835
- `}})}};me.styles=[_,na],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],me.prototype,"vaultManagerContext",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],me.prototype,"vaultItemContext",2),n([C({context:q,subscribe:!0}),d({type:Object})],me.prototype,"headlessUtils",2),n([d({type:Object,attribute:!1})],me.prototype,"paymentMethod",2),n([d({type:Boolean,reflect:!0})],me.prototype,"isEditMode",2),me=n([v("primer-vault-payment-method-item"),L()],me);var sa=g`
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`
1836
2298
  :host {
1837
2299
  display: block;
1838
2300
  width: 100%;
@@ -1862,21 +2324,21 @@ primer-checkout.primer-dark-theme {
1862
2324
  .edit-button.active {
1863
2325
  color: var(--primer-color-brand);
1864
2326
  }
1865
- `;var He=class extends f{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return m`
2327
+ `;var Ge=class extends v{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return c`
1866
2328
  <div class="vault-manager-header">
1867
- <h3>${P("previouslyUsed",{id:"previouslyUsed"})}</h3>
2329
+ <h3>${A("previouslyUsed",{id:"previouslyUsed"})}</h3>
1868
2330
 
1869
- ${this.hasPaymentMethods?m`
2331
+ ${this.hasPaymentMethods?c`
1870
2332
  <primer-button
1871
2333
  class="edit-button ${this.isEditMode?"active":""}"
1872
2334
  @click=${this.toggleEditMode}
1873
- aria-label=${this.isEditMode?P("confirm",{id:"confirm"}):P("editPaymentMethods",{id:"editPaymentMethods"})}
2335
+ aria-label=${this.isEditMode?A("confirm",{id:"confirm"}):A("editPaymentMethods",{id:"editPaymentMethods"})}
1874
2336
  >
1875
- ${this.isEditMode?m`<primer-icon name="checkmark" size="sm"></primer-icon>`:m`<primer-icon name="pencil" size="sm"></primer-icon>`}
2337
+ ${this.isEditMode?c`<primer-icon name="checkmark" size="sm"></primer-icon>`:c`<primer-icon name="pencil" size="sm"></primer-icon>`}
1876
2338
  </primer-button>
1877
- `:u}
2339
+ `:h}
1878
2340
  </div>
1879
- `}};He.styles=[_,sa],n([d({type:Boolean})],He.prototype,"isEditMode",2),n([d({type:Boolean})],He.prototype,"hasPaymentMethods",2),He=n([v("primer-vault-manager-header"),L()],He);var la=g`
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`
1880
2342
  :host {
1881
2343
  display: block;
1882
2344
  width: 100%;
@@ -1947,10 +2409,10 @@ primer-checkout.primer-dark-theme {
1947
2409
  opacity: 0.7;
1948
2410
  cursor: not-allowed;
1949
2411
  }
1950
- `;var fe=class extends f{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let e=this.paymentMethodName;return m`
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`
1951
2413
  <div class="delete-confirmation">
1952
2414
  <div class="delete-message">
1953
- <p class="delete-text">${e}</p>
2415
+ <p class="delete-text">${t}</p>
1954
2416
  </div>
1955
2417
  <div class="delete-actions">
1956
2418
  <button
@@ -1958,18 +2420,18 @@ primer-checkout.primer-dark-theme {
1958
2420
  @click=${this.handleConfirmClick}
1959
2421
  ?disabled=${this.isDeleting}
1960
2422
  >
1961
- ${this.isDeleting?P("deleting",{id:"deleting"}):P("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
2423
+ ${this.isDeleting?A("deleting",{id:"deleting"}):A("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
1962
2424
  </button>
1963
2425
  <button
1964
2426
  class="delete-cancel"
1965
2427
  @click=${this.handleCancelClick}
1966
2428
  ?disabled=${this.isDeleting}
1967
2429
  >
1968
- ${P("cancel",{id:"cancel"})}
2430
+ ${A("cancel",{id:"cancel"})}
1969
2431
  </button>
1970
2432
  </div>
1971
2433
  </div>
1972
- `}};fe.styles=[_,la],n([d({type:Boolean})],fe.prototype,"isDeleting",2),n([d({type:String})],fe.prototype,"paymentMethodId",2),n([d({type:String})],fe.prototype,"paymentMethodName",2),n([C({context:W,subscribe:!0})],fe.prototype,"vaultManager",2),fe=n([v("primer-vault-delete-confirmation"),L()],fe);var da=g`
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`
1973
2435
  :host {
1974
2436
  display: block;
1975
2437
  width: 100%;
@@ -1984,13 +2446,13 @@ primer-checkout.primer-dark-theme {
1984
2446
  .empty-state p {
1985
2447
  margin: 0;
1986
2448
  }
1987
- `;var ut=class extends f{render(){return m`
2449
+ `;var wt=class extends v{render(){return c`
1988
2450
  <div class="empty-state">
1989
2451
  <p>
1990
- ${P("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
2452
+ ${A("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
1991
2453
  </p>
1992
2454
  </div>
1993
- `}};ut.styles=[_,da],ut=n([v("primer-vault-empty-state"),L()],ut);var ca=g`
2455
+ `}};wt.styles=[w,kn],wt=s([y("primer-vault-empty-state"),$()],wt);var In=f`
1994
2456
  :host {
1995
2457
  display: block;
1996
2458
  width: 100%;
@@ -2036,7 +2498,7 @@ primer-checkout.primer-dark-theme {
2036
2498
  .error-message button:hover {
2037
2499
  background-color: rgba(0, 0, 0, 0.05);
2038
2500
  }
2039
- `;var Ze=class extends f{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return m`
2501
+ `;var pt=class extends v{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return c`
2040
2502
  <div class="error-message">
2041
2503
  <div class="error-content">
2042
2504
  <primer-icon
@@ -2048,16 +2510,16 @@ primer-checkout.primer-dark-theme {
2048
2510
  </div>
2049
2511
  <button
2050
2512
  @click=${this.handleDismiss}
2051
- aria-label=${P("closeErrorMessage",{id:"closeErrorMessage"})}
2513
+ aria-label=${A("closeErrorMessage",{id:"closeErrorMessage"})}
2052
2514
  >
2053
2515
  <primer-icon name="close" size="sm"></primer-icon>
2054
2516
  </button>
2055
2517
  </div>
2056
- `}};Ze.styles=[_,ca],n([d({type:String})],Ze.prototype,"errorMessage",2),Ze=n([v("primer-vault-error-message"),L()],Ze);var pa=g`
2518
+ `}};pt.styles=[w,In],s([p({type:String})],pt.prototype,"errorMessage",2),pt=s([y("primer-vault-error-message"),$()],pt);var Nn=f`
2057
2519
  :host {
2058
2520
  display: contents;
2059
2521
  }
2060
- `;var X=class extends f{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async e=>{if(e.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let i=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(i)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:P("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u;return m`
2522
+ `;var te=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async t=>{if(t.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText: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)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
2061
2523
  <primer-button
2062
2524
  buttonType="submit"
2063
2525
  variant=${this.variant}
@@ -2068,7 +2530,7 @@ primer-checkout.primer-dark-theme {
2068
2530
  >
2069
2531
  ${this.buttonText}${r}
2070
2532
  </primer-button>
2071
- `}};X.styles=[_,pa],n([d({type:String})],X.prototype,"buttonText",1),n([C({context:q,subscribe:!0}),d({type:Object})],X.prototype,"headlessInstance",2),n([C({context:j,subscribe:!0}),d()],X.prototype,"sdkState",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],X.prototype,"vaultItemContext",2),n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],X.prototype,"vaultManager",2),n([C({context:ot,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],X.prototype,"clientOptions",2),n([d({type:String})],X.prototype,"variant",2),n([d({type:Boolean})],X.prototype,"disabled",2),X=n([v("primer-vault-payment-submit"),L()],X);var ma=g`
2533
+ `}};te.styles=[w,Nn],s([p({type:String})],te.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],te.prototype,"headlessInstance",2),s([b({context:j,subscribe:!0}),p()],te.prototype,"sdkState",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],te.prototype,"vaultItemContext",2),s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],te.prototype,"vaultManager",2),s([b({context:Le,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],te.prototype,"clientOptions",2),s([p({type:String})],te.prototype,"variant",2),s([p({type:Boolean})],te.prototype,"disabled",2),te=s([y("primer-vault-payment-submit"),$()],te);var Ln=f`
2072
2534
  :host {
2073
2535
  display: block;
2074
2536
  margin-top: var(--primer-space-medium);
@@ -2077,21 +2539,21 @@ primer-checkout.primer-dark-theme {
2077
2539
  .cvv-input-container {
2078
2540
  margin-bottom: var(--primer-space-medium);
2079
2541
  }
2080
- `;var J=class extends f{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 V(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===void 0?N:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new V(this,{task:async([e])=>{if(!e)return N;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let i=yr(this.computedStyles),s=i?{input:{base:i}}:void 0,p={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:s};this.cvvInput=await e.createCvvInput(p),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:()=>u,complete:()=>m`
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`
2081
2543
  <div class="cvv-input-container">
2082
2544
  <primer-input-wrapper
2083
2545
  .hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
2084
2546
  >
2085
2547
  <primer-input-label slot="label">CVV</primer-input-label>
2086
2548
  <div slot="input" id="${this.cvvContainerId}"></div>
2087
- ${$(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>m`
2549
+ ${U(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>c`
2088
2550
  <primer-input-error slot="error">
2089
2551
  ${this.cvvError}
2090
2552
  </primer-input-error>
2091
2553
  `)}
2092
2554
  </primer-input-wrapper>
2093
2555
  </div>
2094
- `})}};J.styles=[_,ma],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],J.prototype,"vaultManagerFormContext",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1})],J.prototype,"vaultManagerCvvContext",2),n([C({context:Pe,subscribe:!0}),d()],J.prototype,"computedStyles",2),n([d({type:Object})],J.prototype,"paymentMethod",2),n([k()],J.prototype,"cvvError",2),n([k()],J.prototype,"cvvInputIsDirty",2),n([k()],J.prototype,"cvvInputIsBlurred",2),n([k()],J.prototype,"cvvInput",2),J=n([v("primer-vault-cvv-input"),L()],J);var ua=g`
2556
+ `})}};re.styles=[w,Ln],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.createCvvInput!==r?.createCvvInput}})],re.prototype,"vaultManagerFormContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1})],re.prototype,"vaultManagerCvvContext",2),s([b({context:$e,subscribe:!0}),p()],re.prototype,"computedStyles",2),s([p({type:Object})],re.prototype,"paymentMethod",2),s([I()],re.prototype,"cvvError",2),s([I()],re.prototype,"cvvInputIsDirty",2),s([I()],re.prototype,"cvvInputIsBlurred",2),s([I()],re.prototype,"cvvInput",2),re=s([y("primer-vault-cvv-input"),$()],re);var $n=f`
2095
2557
  :host {
2096
2558
  display: block;
2097
2559
  margin-top: var(--primer-space-medium);
@@ -2111,37 +2573,36 @@ primer-checkout.primer-dark-theme {
2111
2573
  justify-content: center;
2112
2574
  align-items: center;
2113
2575
  }
2114
- `;var Ye=class extends f{constructor(){super(...arguments);this.isShowingOtherPayments=!1;this.vaultManager=null}handleExpandedChanged(e){this.isShowingOtherPayments=e.detail.expanded}render(){return this.vaultManager?.isLoading?u:!this.vaultManager||!this.vaultManager.enabled||this.vaultManager.vaultedPaymentMethods.length===0?m`<slot name="other-payments"></slot>`:m`
2576
+ `;var ct=class extends v{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?h:!this.vaultManager||!this.vaultManager.enabled?c`<slot name="other-payments"></slot>`:c`
2115
2577
  <div class="other-payment-methods-container">
2116
2578
  <primer-collapsable
2117
2579
  buttonVariant="secondary"
2118
- .expanded="${this.isShowingOtherPayments}"
2119
- .header="${P("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2120
- @expanded-changed="${this.handleExpandedChanged}"
2580
+ .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
2581
+ .header="${A("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2121
2582
  >
2122
2583
  <div class="other-payment-methods-content">
2123
2584
  <slot name="other-payments"></slot>
2124
2585
  </div>
2125
2586
  </primer-collapsable>
2126
2587
  </div>
2127
- `}};Ye.styles=[ua],n([k()],Ye.prototype,"isShowingOtherPayments",2),n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],Ye.prototype,"vaultManager",2),Ye=n([v("primer-show-other-payments")],Ye);var Ht=class extends f{render(){return m`
2588
+ `}};ct.styles=[$n],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ct.prototype,"vaultManager",2),ct=s([y("primer-show-other-payments")],ct);var pr=class extends v{render(){return c`
2128
2589
  <primer-checkout-state type="complete"></primer-checkout-state>
2129
- `}};Ht=n([v("primer-checkout-complete")],Ht);var ht=class extends f{constructor(){super(...arguments);this.sdkState=null}render(){return m`
2590
+ `}};pr=s([y("primer-checkout-complete")],pr);var kt=class extends v{constructor(){super(...arguments);this.sdkState=null}render(){return c`
2130
2591
  <primer-checkout-state
2131
2592
  type="failure"
2132
2593
  description=${this.sdkState?.error?.message||""}
2133
2594
  ></primer-checkout-state>
2134
- `}};n([C({context:j,subscribe:!0}),d()],ht.prototype,"sdkState",2),ht=n([v("primer-checkout-error")],ht);var ha=g`
2595
+ `}};s([b({context:j,subscribe:!0}),p()],kt.prototype,"sdkState",2),kt=s([y("primer-checkout-error")],kt);var Rn=f`
2135
2596
  :host {
2136
2597
  display: block;
2137
2598
  width: 100%;
2138
2599
  }
2139
- `;var Ue=class extends f{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?m`
2600
+ `;var qe=class extends v{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?c`
2140
2601
  <primer-error-message
2141
- message="${P(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2602
+ message="${A(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2142
2603
  ?visible="${this.shouldShowError}"
2143
2604
  ></primer-error-message>
2144
- `:u}};Ue.styles=[ha],n([C({context:j,subscribe:!0}),k()],Ue.prototype,"sdkState",2),n([d({type:Boolean,attribute:"show-processing-errors"})],Ue.prototype,"showProcessingErrors",2),Ue=n([v("primer-error-message-container")],Ue);async function Ix(){_i(),Pi()}export{ne as Button,Se as CardForm,dt as CardFormCVV,le as CardFormCardNetworkSelector,lt as CardFormCardNumber,Re as CardFormError,ct as CardFormExpiry,pt as CardFormName,se as CardFormSubmit,re as Collapsable,he as ErrorMessage,Ue as ErrorMessageContainer,ur as InitializedPayments,Y as Input,Ne as InputLabel,Ce as InputWrapper,Me as NativePayment,De as PaymentMethod,Ht as PrimerCheckoutComplete,ae as PrimerCheckoutComponent,ht as PrimerCheckoutFailure,Oe as PrimerCheckoutState,Ae as PrimerIcon,Z as PrimerKlarna,$e as PrimerMain,ge as RedirectPayment,Ye as ShowOtherPayments,xe as Spinner,J as VaultCvvInput,fe as VaultDeleteConfirmation,ut as VaultEmptyState,Ze as VaultErrorMessage,pe as VaultManager,He as VaultManagerHeader,me as VaultPaymentMethodItem,X as VaultPaymentSubmit,Nn as injectDarkTheme,Ln as injectLightTheme,_i as injectLoaderStyles,Pi as injectThemeStyles,Ix as loadPrimer};
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};
2145
2606
  /*! Bundled license information:
2146
2607
 
2147
2608
  @lit/context/lib/context-request-event.js:
@@ -2444,4 +2905,32 @@ lit-html/directives/ref.js:
2444
2905
  * Copyright 2020 Google LLC
2445
2906
  * SPDX-License-Identifier: BSD-3-Clause
2446
2907
  *)
2908
+
2909
+ lit-html/lit-html.js:
2910
+ (**
2911
+ * @license
2912
+ * Copyright 2017 Google LLC
2913
+ * SPDX-License-Identifier: BSD-3-Clause
2914
+ *)
2915
+
2916
+ lit-html/directive.js:
2917
+ (**
2918
+ * @license
2919
+ * Copyright 2017 Google LLC
2920
+ * SPDX-License-Identifier: BSD-3-Clause
2921
+ *)
2922
+
2923
+ lit-html/directive-helpers.js:
2924
+ (**
2925
+ * @license
2926
+ * Copyright 2020 Google LLC
2927
+ * SPDX-License-Identifier: BSD-3-Clause
2928
+ *)
2929
+
2930
+ lit-html/async-directive.js:
2931
+ (**
2932
+ * @license
2933
+ * Copyright 2017 Google LLC
2934
+ * SPDX-License-Identifier: BSD-3-Clause
2935
+ *)
2447
2936
  */