@primer-io/primer-js 0.1.2 → 0.1.4

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,5 +1,27 @@
1
- import{a as Uo,b as tn,c as Dr,d as n}from"./chunks/chunk.G45OCYEN.js";var Ar=tn((Vt,co)=>{(function(o,t){typeof Vt=="object"&&typeof co=="object"?co.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 p in l)r.o(l,p)&&!r.o(a,p)&&Object.defineProperty(a,p,{enumerable:!0,get:l[p]})},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:()=>Wa,PaymentFlow:()=>Ka,ThreeDSecureStatus:()=>ja,TokenType:()=>Ga,isStripeOptionsDropInWithFullMandateText:()=>Za,PaymentInstrumentType:()=>yt,ErrorCode:()=>qa,EventTypes:()=>Xa,CheckoutUXFlow:()=>Fa,HeadlessManagerType:()=>Ja,PaymentMethodType:()=>bt,Primer:()=>Qa});let s={LEGACY:"legacy",V_2_4:"2.4"},c=s.V_2_4,x=c;class h extends Error{static from(l,p=!1){if(l instanceof h)return l;let b=new h(l instanceof Error?l.message:String(l),p);return l instanceof Error&&l.stack&&(b.stack=l.stack,Object.assign(b,l)),b}markAsReported(){this.isReported=!0}constructor(l,p=!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=p,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let R="https://analytics.production.data.primer.io/sdk-logs";var z=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),O=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 ua={get(a,l){let p;try{switch(a){case"PRIMER_SDK_VERSION":p="v2.53.2";break;case"PRIMER_ASSETS_URL":p=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":p=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return p||l}}.get("PRIMER_SDK_VERSION");async function uo(a,l,p){return{...p,createdAt:Date.now(),device:await Xe(),eventType:a,properties:l,sdkVersion:ua,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,_r=()=>gt.timers,ft=()=>gt.eventsQueue,Yt=new Map;function Sr(a,l=!1,p=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=[],k=0,_=0;for(;_<E.length;){let L=E[_],H=new Blob([JSON.stringify(L)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",L),_++;continue}if(k+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=[],k=0}M.push(L),k+=H,_++}if(M.length>0&&y)try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(L){y=!1,console.error("Unable to send events",L)}y?ft().delete(a):p<5?setTimeout(()=>Sr(a,l,p+1),500*Math.pow(2,p)):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=R,...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)."}),Sr(A.url,!0)}}),fo=!0);let p=A=>async E=>{if(typeof navigator>"u")return;let y=function k(_,L,H=new WeakSet,U=0,oe=10){if(U>oe||H.has(_))return _;H.add(_);let ie=te=>typeof te=="object"&&te!==null?k(te,L,H,U+1,oe):L(te);return Array.isArray(_)?_.map(ie):Object.fromEntries(Object.entries(_).map(([te,et])=>[te,ie(et)]))}(await uo(A,E,l),k=>{var _;return typeof(_=typeof k=="function"?k.name||"function":k)=="string"&&_.length>5120?`${_.slice(0,5120)}...`:_});ft().has(a)||ft().set(a,[]),ft().get(a)?.push(y),Sr(a)},b={crashEvent:p(B.CRASH_EVENT),messageEvent:p(B.MESSAGE_EVENT),networkCallEvent:p(B.NETWORK_CALL_EVENT),sdkFunctionEvent:p(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return _r().set(y,{start:M}),p(B.TIMER_EVENT)({...E,id:A,timerType:O.START})},timerEnd:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,{start:M}=_r().get(y)??{};_r().delete(y);let k=performance?.now?performance.now():Date.now();return p(B.TIMER_EVENT)({...E,id:A,timerType:O.END,duration:M?k-M:void 0})},v1Event:p(B.V1_EVENT),url:a};return go().set(l.checkoutSessionId,b),Je(l.checkoutSessionId)}function Je(a){return new Proxy({},{get:(l,p)=>(go().get(a)??Pr({checkoutSessionId:a}))[p]})}let Tr=(a,l,p,b)=>({callType:p?z.REQUEST_END:z.REQUEST_START,id:a,errorBody:p?.error&&JSON.stringify(p.error,Object.getOwnPropertyNames(p.error)),method:l.method,responseCode:p?.status,url:l.url,duration:b});function ha(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function vo(a,l,p,b=ha){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}`),p?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return y}catch(y){let M=A>=E.maxRetries,k=y.isNetworkError&&!E.retryNetworkErrors,_=y.status&&y.status>=500&&!E.retry500Errors;if(M||k||_){let U=`Failed after ${A} retries. `;throw M?U+=`Reached maximum retries (${E.maxRetries}).`:k?U+="Network error encountered and retryNetworkErrors is disabled.":_&&(U+="HTTP 500 error encountered and retry500Errors is disabled."),U+=` Last error: ${y.message}`,p?.({messageType:"RETRY_FAILED",message:U,severity:"ERROR",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),Error(U,{cause:y})}A++;let L=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`),p?.({messageType:"RETRY",message:`Retry attempt ${A}/${E.maxRetries} due to: ${H}. Error details: ${y.message}. Waiting for ${L.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),await b(L)}}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,p]of ee())p.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?.()||ga(),ga=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^fa()>>a/4).toString(16)),fa=()=>(bo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,bo=typeof crypto<"u"?crypto:{},va=(a,l,p)=>ya(a,"get",l,p),ya=async(a,l,p,b,A)=>{let E=kr(),y=performance?.now(),M=Je(a),k={method:l,url:p,body:A};M.networkCallEvent(Tr(E,k));try{let _=await fetch(p,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":E,...b}});if(!_.ok){let U=Error(`HTTP error! status: ${_.status}`);throw U.status=_.status,U}let L=await _.json();if(p.includes("client-sdk/configuration")){let{primerAccountId:U,clientSession:{clientSessionId:oe,customer:ie}}=L;M=Pr({checkoutSessionId:a,clientSessionId:oe,customerId:ie?.customerId,primerAccountId:U,url:M.url})}let H=performance?.now();return M.networkCallEvent(Tr(E,k,{data:L},H-y)),{data:L,headers:_.headers,status:_.status,source:"NETWORK"}}catch(_){let L=performance?.now();throw Object.assign(_,{isNetworkError:_ instanceof TypeError}),M.networkCallEvent(Tr(E,k,{error:_},L-y)),_}},ba=(a,l)=>new Promise((p,b)=>{let A=setTimeout(()=>{let E=Error("Request timed out");E.isNetworkError=!0,b(E)},l);a.then(p).catch(b).finally(()=>clearTimeout(A))}),Ea=(a,l)=>{let{headers:p,retryConfig:b,cacheConfig:A,timeout:E=15e3,checkoutSessionId:y}=l,M=Je(y);return function(k){if(!k)return oe=>oe();let{key:_,refresh:L=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:U=36e5}=k;return async oe=>{let ie=Date.now(),te=ee().get(_);if(!L&&te&&te.exp>ie)return te.promise;te&&ee().delete(_);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},en){Yo?ee().set(Ho,{promise:Promise.resolve({...en,source:"CACHE"}),exp:Date.now()+Yo}):ee().delete(Ho)}({key:_,ttl:Vo},Et),yo(),Et},Et=>{throw ee().delete(_),Et});return ee().set(_,{promise:et,exp:ie+U}),yo(),et}}(A)(()=>vo(()=>ba(va(y,a,p),E),b,k=>M.messageEvent({...k,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((p,b)=>l[p]=b),l})(vt),xa=/^(?:[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,""),_o=typeof btoa=="function"?a=>btoa(a):Qe?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,p,b,A,E="",y=a.length%3;for(let M=0;M<a.length;){if((p=a.charCodeAt(M++))>255||(b=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");E+=vt[(l=p<<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 p=0,b=a.length;p<b;p+=4096)l.push(F.apply(null,a.subarray(p,p+4096)));return _o(l.join(""))},jn=(a,l=!1)=>l?Ao(Ir(a)):Ir(a),Ca=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)},Aa=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ma=a=>a.replace(Aa,Ca),So=Qe?a=>Buffer.from(a,"utf8").toString("base64"):xo?a=>Ir(xo.encode(a)):a=>_o(Ma(a)),_a=(a,l=!1)=>l?Ao(So(a)):So(a),Sa=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Pa=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))}},Ta=a=>a.replace(Sa,Pa),Po=typeof atob=="function"?a=>atob(Mo(a)):Qe?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!xa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,p="",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++)]),p+=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 p},To=Qe?a=>Co(Buffer.from(a,"base64")):a=>Co(Po(a).split("").map(l=>l.charCodeAt(0))),Gn=a=>To(wo(a)),wa=Qe?a=>Buffer.from(a,"base64").toString("utf8"):Eo?a=>Eo.decode(To(a)):a=>Ta(Po(a)),wo=a=>Mo(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),ka=a=>wa(wo(a)),qn=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),ko={encode:_a,decode:ka},Ia={encode:function(a,l={}){let{urlSafe:p=!1}=l;return ko.encode(a,p)},decode:ko.decode},Io="The provided `clientToken`",Na=`${Io} has expired`,La=`${Io} is malformed`,Ra=(a,l,p)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.2","primer-sdk-checkout-session-id":l,...p&&{"x-api-version":p}});async function Oa(a,l,p){let{accessToken:b,configurationUrl:A,analyticsUrlV2:E}=function(_){let L=function(U){try{let[oe,ie]=U.split(".");return JSON.parse(Ia.decode(ie||oe))}catch{throw Error(La)}}(_),H=1e3*L.exp;if(Date.now()>H)throw Error(`${Na}. Expiration date: ${new Date(H).toISOString()}`);return L}(a),y=Pr({checkoutSessionId:l,url:E}),M=x,k=M!==s.LEGACY?M:"2.3";y.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:_,source:L}=await Ea(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:Ra(b,l,k),retryConfig:{enabled:!0},cacheConfig:p});return y.timerEnd({id:"CONFIGURATION_LOADING",context:{source:L}}),_}catch(_){let L=_ instanceof Error?_.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${L}`)}}function No(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:p,reporter:b}){l?.crashEvent?l.crashEvent({...No(p),reporter:b}):a&&Nr(a,p,b)}async function Nr(a,l,p){let b=await uo(B.CRASH_EVENT,{...No(l),reporter:p},{checkoutSessionId:a});try{await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch(A){console.error("Failed to post crash event",A)}}let Lo=Symbol.for("initGlobalErrorMonitoringLoaded"),Ro=(a,l)=>{typeof window<"u"&&window[Lo]||(window[Lo]=!0,window.addEventListener("error",p=>{!Da(p)&&$a(p)&&zt({checkoutSessionId:a,analytics:l,error:p.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",p=>{let b=p.reason||Error("Unhandled promise rejection");Va(b)&&zt({checkoutSessionId:a,analytics:l,error:b,reporter:"unhandledrejection"})}))},Da=a=>a.message==="Script error."||!a.filename||a.lineno===0,$a=a=>{let l=a.filename;return!!(l&&Lr(l))&&!!new h(a.error).isReported||!1},Va=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"&&Lr(a.fileName))||Ha(l.stack).some(Lr))}return!1},Lr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ha=a=>{if(!a)return[];let l=a.split(`
2
- `),p=[],b=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let E=A.match(b);if(E&&E[1])p.push(E[1]);else{let y=/@(.*?):\d+:\d+$/,M=A.match(y);M&&M[1]&&p.push(M[1])}}return p};function Oo(a,l,p){return document.querySelector(`${a}[${l}^="${p}"]`)}async function Do(a,l,p,b,A,E){let{analytics:y,name:M=l,retryConfig:k}=E;await vo(()=>new Promise((_,L)=>{let H=Oo(a,p,l)||function(U,oe){let ie=document.createElement(U);return Object.entries(oe).forEach(([te,et])=>ie.setAttribute(te,et)),ie}(a,{...b,[p]:l});H.onload=()=>{y?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),_()},H.onerror=()=>{H.remove(),L(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),k,_=>y?.messageEvent({..._,url:l}))}async function $o(a){return o||(o=Promise.all([function(l,p={}){return Oo("script","src",l)&&window.__Primer?(p.analytics?.sdkFunctionEvent({name:p.name??l,params:["Script already loaded"]}),Promise.resolve()):Do("script",l,"src",{...p.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",p)}("https://sdk.primer.io/web/v2.53.2/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,p={}){return Array.from(document.styleSheets).some(b=>b.href===l)?(p.analytics?.sdkFunctionEvent({name:p.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):Do("link",l,"href",{...p.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",p)}("https://sdk.primer.io/web/v2.53.2/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw o=void 0,l}))}let Ya=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(p){let b=h.from(p);throw b.isReported||(zt({checkoutSessionId:a,analytics:l,error:b,reporter:"preloadPrimer level 1"}),b.markAsReported()),b}}catch(l){let p=h.from(l);throw p.isReported||(Nr(a,p,"preloadPrimer level 0"),p.markAsReported()),p}},Ua=Rr("createHeadless"),za=Rr("showUniversalCheckout"),Ba=Rr("showVaultManager");function Rr(a){return async(...[l,p,...b])=>{var A;(A=p?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${c}'.`),x=A??c;let E=kr();try{let y=Je(E);try{Ro(E,y),y.sdkFunctionEvent({name:a,params:[l,p,...b]}),y.timerStart({id:Q[a]});let[M,k]=await Promise.all([Oa(l,E,p?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),$o(y)]);return k[a](M,E,l,p,...b)}catch(M){let k=h.from(M);throw k.isReported||(zt({checkoutSessionId:E,analytics:y,error:k,reporter:"lazyLoad level 1"}),k.markAsReported()),k}}catch(y){let M=h.from(y);throw M.isReported||(Nr(E,M,"lazyLoad level 0"),M.markAsReported()),M}}}var Fa=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),Ka=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),ja=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"},Ga={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 qa=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,p){return l in a?Object.defineProperty(a,l,{value:p,enumerable:!0,configurable:!0,writable:!0}):a[l]=p,a}class Or extends h{static fromErrorCode(l,p){return new Or(l,p)}constructor(l,p){super(p.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=p.diagnosticsId??null,this.data=p.data,this.isFromDeveloper=p.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Or)}}var Wa=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let Za=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var Xa=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}({}),Ja=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let Qa={SDK_VERSION:"v2.53.2",createHeadless:Ua,showUniversalCheckout:za,showVaultManager:Ba,preloadPrimer:Ya};return i})())});var Ft=typeof window<"u"&&typeof window.document<"u";function rn(o){return document.querySelector(`#${o}`)}function on(o,t){let e=document.createElement("style");return e.textContent=o,e.id=t,e}function xt(o,t,e=!0){if(!Ft||rn(t))return;let i=on(o,t);e&&document.head.firstChild?document.head.insertBefore(i,document.head.firstChild):document.head.appendChild(i)}var zo=`
1
+ import{a as Gi,b as fn,c as zr,d as n}from"./chunks/chunk.G45OCYEN.js";var wr=fn((zt,vi)=>{(function(i,t){typeof zt=="object"&&typeof vi=="object"?vi.exports=t():typeof define=="function"&&define.amd?define([],t):typeof zt=="object"?zt.Primer=t():i.Primer=t()})(zt,()=>(()=>{"use strict";let i;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 o={};r.r(o),r.d(o,{SuccessScreenType:()=>pn,PaymentFlow:()=>nn,ThreeDSecureStatus:()=>sn,TokenType:()=>ln,isStripeOptionsDropInWithFullMandateText:()=>cn,PaymentInstrumentType:()=>Ct,ErrorCode:()=>dn,EventTypes:()=>mn,CheckoutUXFlow:()=>an,HeadlessManagerType:()=>un,PaymentMethodType:()=>_t,Primer:()=>hn});let s={LEGACY:"legacy",V_2_4:"2.4"},m=s.V_2_4,C=m;class v extends Error{static from(l,c=!1){if(l instanceof v)return l;let E=new v(l instanceof Error?l.message:String(l),c);return l instanceof Error&&l.stack&&(E.stack=l.stack,Object.assign(E,l)),E}markAsReported(){this.isReported=!0}constructor(l,c=!1){super(l),function(E,A,x){A in E?Object.defineProperty(E,A,{value:x,enumerable:!0,configurable:!0,writable:!0}):E[A]=x}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let D="https://analytics.production.data.primer.io/sdk-logs";var F=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 te={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 tt(){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 ka={get(a,l){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.4";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 bi(a,l,c){return{...c,createdAt:Date.now(),device:await tt(),eventType:a,properties:l,sdkVersion:ka,sdkType:"WEB"}}let Ei=Symbol.for("__primerAnalytics__"),bt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[Ei];a?bt=a:window[Ei]=bt}let xi=()=>bt.providers,Ir=()=>bt.timers,Et=()=>bt.eventsQueue,Bt=new Map;function Lr(a,l=!1,c=1){Bt.has(a)&&(clearTimeout(Bt.get(a)),Bt.delete(a));let E=()=>{let x=Et().get(a);if(x?.length){let b=!0,M=[],N=0,S=0;for(;S<x.length;){let O=x[S],H=new Blob([JSON.stringify(O)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",O),S++;continue}if(N+H>64e3&&M.length>0){try{b=navigator.sendBeacon(a,JSON.stringify(M))}catch(Y){b=!1,console.error("Unable to send events",Y)}if(!b)break;M=[],N=0}M.push(O),N+=H,S++}if(M.length>0&&b)try{b=navigator.sendBeacon(a,JSON.stringify(M))}catch(O){b=!1,console.error("Unable to send events",O)}b?Et().delete(a):c<5?setTimeout(()=>Lr(a,l,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void E();let A=setTimeout(E,500);Bt.set(a,A)}let Ci=!1;function Nr({url:a=D,...l}){typeof document>"u"||Ci||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=rt(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),Lr(A.url,!0)}}),Ci=!0);let c=A=>async x=>{if(typeof navigator>"u")return;let b=function N(S,O,H=new WeakSet,Y=0,ae=10){if(Y>ae||H.has(S))return S;H.add(S);let ne=ie=>typeof ie=="object"&&ie!==null?N(ie,O,H,Y+1,ae):O(ie);return Array.isArray(S)?S.map(ne):Object.fromEntries(Object.entries(S).map(([ie,ot])=>[ie,ne(ot)]))}(await bi(A,x,l),N=>{var S;return typeof(S=typeof N=="function"?N.name||"function":N)=="string"&&S.length>5120?`${S.slice(0,5120)}...`:S});Et().has(a)||Et().set(a,[]),Et().get(a)?.push(b),Lr(a)},E={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,...x})=>{let b=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return Ir().set(b,{start:M}),c(B.TIMER_EVENT)({...x,id:A,timerType:$.START})},timerEnd:({id:A,...x})=>{let b=`${l.checkoutSessionId}|${A}`,{start:M}=Ir().get(b)??{};Ir().delete(b);let N=performance?.now?performance.now():Date.now();return c(B.TIMER_EVENT)({...x,id:A,timerType:$.END,duration:M?N-M:void 0})},v1Event:c(B.V1_EVENT),url:a};return xi().set(l.checkoutSessionId,E),rt(l.checkoutSessionId)}function rt(a){return new Proxy({},{get:(l,c)=>(xi().get(a)??Nr({checkoutSessionId:a}))[c]})}let Rr=(a,l,c,E)=>({callType:c?F.REQUEST_END:F.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:E});function Ta(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function _i(a,l,c,E=Ta){let A=0,x={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let b=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof b=="object"&&b&&"status"in b&&(M+=` Status code: ${b.status}`),c?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return b}catch(b){let M=A>=x.maxRetries,N=b.isNetworkError&&!x.retryNetworkErrors,S=b.status&&b.status>=500&&!x.retry500Errors;if(M||N||S){let Y=`Failed after ${A} retries. `;throw M?Y+=`Reached maximum retries (${x.maxRetries}).`:N?Y+="Network error encountered and retryNetworkErrors is disabled.":S&&(Y+="HTTP 500 error encountered and retry500Errors is disabled."),Y+=` Last error: ${b.message}`,c?.({messageType:"RETRY_FAILED",message:Y,severity:"ERROR",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),Error(Y,{cause:b})}A++;let O=Math.min(x.initialBackoff*Math.pow(2,A-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";b.isNetworkError?H="Network error":b.status&&(H=`HTTP ${b.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${A}/${x.maxRetries} due to: ${H}. Error details: ${b.message}. Waiting for ${O.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),await E(O)}}let Or={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=Or),Or=window.__primerCache__);let re=()=>Or.cache;function Ai(){if(re().size<=30)return;let a=Date.now();for(let[l,c]of re())c.exp<a&&re().delete(l);if(re().size>50)for(let[l]of re()){if(re().size<=50)break;re().delete(l)}}let Dr=()=>Mi.randomUUID?.()||wa(),wa=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Pa()>>a/4).toString(16)),Pa=()=>(Mi.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,Mi=typeof crypto<"u"?crypto:{},Ia=(a,l,c)=>La(a,"get",l,c),La=async(a,l,c,E,A)=>{let x=Dr(),b=performance?.now(),M=rt(a),N={method:l,url:c,body:A};M.networkCallEvent(Rr(x,N));try{let S=await fetch(c,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":x,...E}});if(!S.ok){let Y=Error(`HTTP error! status: ${S.status}`);throw Y.status=S.status,Y}let O=await S.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:Y,clientSession:{clientSessionId:ae,customer:ne}}=O;M=Nr({checkoutSessionId:a,clientSessionId:ae,customerId:ne?.customerId,primerAccountId:Y,url:M.url})}let H=performance?.now();return M.networkCallEvent(Rr(x,N,{data:O},H-b)),{data:O,headers:S.headers,status:S.status,source:"NETWORK"}}catch(S){let O=performance?.now();throw Object.assign(S,{isNetworkError:S instanceof TypeError}),M.networkCallEvent(Rr(x,N,{error:S},O-b)),S}},Na=(a,l)=>new Promise((c,E)=>{let A=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,E(x)},l);a.then(c).catch(E).finally(()=>clearTimeout(A))}),Ra=(a,l)=>{let{headers:c,retryConfig:E,cacheConfig:A,timeout:x=15e3,checkoutSessionId:b}=l,M=rt(b);return function(N){if(!N)return ae=>ae();let{key:S,refresh:O=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:Y=36e5}=N;return async ae=>{let ne=Date.now(),ie=re().get(S);if(!O&&ie&&ie.exp>ne)return ie.promise;ie&&re().delete(S);let ot=ae().then(At=>{let Bi=Y;return H&&(Bi=1e3*(Number(At.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ki,ttl:ji=36e5},gn){ji?re().set(Ki,{promise:Promise.resolve({...gn,source:"CACHE"}),exp:Date.now()+ji}):re().delete(Ki)}({key:S,ttl:Bi},At),Ai(),At},At=>{throw re().delete(S),At});return re().set(S,{promise:ot,exp:ne+Y}),Ai(),ot}}(A)(()=>_i(()=>Na(Ia(b,a,c),x),E,N=>M.messageEvent({...N,url:a})))},it=typeof Buffer=="function",Si=typeof TextDecoder=="function"?new TextDecoder:void 0,ki=typeof TextEncoder=="function"?new TextEncoder:void 0,xt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Kt=(a=>{let l={};return a.forEach((c,E)=>l[c]=E),l})(xt),Oa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,K=String.fromCharCode.bind(String),Ti=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),wi=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Pi=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),Ii=typeof btoa=="function"?a=>btoa(a):it?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,c,E,A,x="",b=a.length%3;for(let M=0;M<a.length;){if((c=a.charCodeAt(M++))>255||(E=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");x+=xt[(l=c<<16|E<<8|A)>>18&63]+xt[l>>12&63]+xt[l>>6&63]+xt[63&l]}return b?x.slice(0,b-3)+"===".substring(b):x},$r=it?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let c=0,E=a.length;c<E;c+=4096)l.push(K.apply(null,a.subarray(c,c+4096)));return Ii(l.join(""))},ns=(a,l=!1)=>l?wi($r(a)):$r(a),Da=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?K(192|l>>>6)+K(128|63&l):K(224|l>>>12&15)+K(128|l>>>6&63)+K(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return K(240|l>>>18&7)+K(128|l>>>12&63)+K(128|l>>>6&63)+K(128|63&l)},$a=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Va=a=>a.replace($a,Da),Li=it?a=>Buffer.from(a,"utf8").toString("base64"):ki?a=>$r(ki.encode(a)):a=>Ii(Va(a)),Ha=(a,l=!1)=>l?wi(Li(a)):Li(a),Ua=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ya=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 K((l>>>10)+55296)+K((1023&l)+56320);case 3:return K((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return K((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},za=a=>a.replace(Ua,Ya),Ni=typeof atob=="function"?a=>atob(Pi(a)):it?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Oa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,c="",E,A;for(let x=0;x<a.length;)l=Kt[a.charAt(x++)]<<18|Kt[a.charAt(x++)]<<12|(E=Kt[a.charAt(x++)])<<6|(A=Kt[a.charAt(x++)]),c+=E===64?K(l>>16&255):A===64?K(l>>16&255,l>>8&255):K(l>>16&255,l>>8&255,255&l);return c},Ri=it?a=>Ti(Buffer.from(a,"base64")):a=>Ti(Ni(a).split("").map(l=>l.charCodeAt(0))),ss=a=>Ri(Oi(a)),Fa=it?a=>Buffer.from(a,"base64").toString("utf8"):Si?a=>Si.decode(Ri(a)):a=>za(Ni(a)),Oi=a=>Pi(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),Ba=a=>Fa(Oi(a)),ls=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Di={encode:Ha,decode:Ba},Ka={encode:function(a,l={}){let{urlSafe:c=!1}=l;return Di.encode(a,c)},decode:Di.decode},$i="The provided `clientToken`",ja=`${$i} has expired`,Ga=`${$i} is malformed`,qa=(a,l,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.4","primer-sdk-checkout-session-id":l,...c&&{"x-api-version":c}});async function Wa(a,l,c){let{accessToken:E,configurationUrl:A,analyticsUrlV2:x}=function(S){let O=function(Y){try{let[ae,ne]=Y.split(".");return JSON.parse(Ka.decode(ne||ae))}catch{throw Error(Ga)}}(S),H=1e3*O.exp;if(Date.now()>H)throw Error(`${ja}. Expiration date: ${new Date(H).toISOString()}`);return O}(a),b=Nr({checkoutSessionId:l,url:x}),M=C,N=M!==s.LEGACY?M:"2.3";b.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:S,source:O}=await Ra(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:qa(E,l,N),retryConfig:{enabled:!0},cacheConfig:c});return b.timerEnd({id:"CONFIGURATION_LOADING",context:{source:O}}),S}catch(S){let O=S instanceof Error?S.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${O}`)}}function Vi(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 jt({checkoutSessionId:a,analytics:l,error:c,reporter:E}){l?.crashEvent?l.crashEvent({...Vi(c),reporter:E}):a&&Vr(a,c,E)}async function Vr(a,l,c){let E=await bi(B.CRASH_EVENT,{...Vi(l),reporter:c},{checkoutSessionId:a});try{await fetch(D,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})}catch(A){console.error("Failed to post crash event",A)}}let Hi=Symbol.for("initGlobalErrorMonitoringLoaded"),Ui=(a,l)=>{typeof window<"u"&&window[Hi]||(window[Hi]=!0,window.addEventListener("error",c=>{!Za(c)&&Xa(c)&&jt({checkoutSessionId:a,analytics:l,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let E=c.reason||Error("Unhandled promise rejection");Ja(E)&&jt({checkoutSessionId:a,analytics:l,error:E,reporter:"unhandledrejection"})}))},Za=a=>a.message==="Script error."||!a.filename||a.lineno===0,Xa=a=>{let l=a.filename;return!!(l&&Hr(l))&&!!new v(a.error).isReported||!1},Ja=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=v.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Hr(a.fileName))||Qa(l.stack).some(Hr))}return!1},Hr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Qa=a=>{if(!a)return[];let l=a.split(`
2
+ `),c=[],E=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let x=A.match(E);if(x&&x[1])c.push(x[1]);else{let b=/@(.*?):\d+:\d+$/,M=A.match(b);M&&M[1]&&c.push(M[1])}}return c};function Yi(a,l,c){return document.querySelector(`${a}[${l}^="${c}"]`)}async function zi(a,l,c,E,A,x){let{analytics:b,name:M=l,retryConfig:N}=x;await _i(()=>new Promise((S,O)=>{let H=Yi(a,c,l)||function(Y,ae){let ne=document.createElement(Y);return Object.entries(ae).forEach(([ie,ot])=>ne.setAttribute(ie,ot)),ne}(a,{...E,[c]:l});H.onload=()=>{b?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),S()},H.onerror=()=>{H.remove(),O(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),N,S=>b?.messageEvent({...S,url:l}))}async function Fi(a){return i||(i=Promise.all([function(l,c={}){return Yi("script","src",l)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Script already loaded"]}),Promise.resolve()):zi("script",l,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.4/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,c={}){return Array.from(document.styleSheets).some(E=>E.href===l)?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):zi("link",l,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.4/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw i=void 0,l}))}let en=async()=>{let a=Dr();try{let l=rt(a);try{Ui(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:te.preloadPrimer}),await Fi(l),l.timerEnd({id:te.preloadPrimer})}catch(c){let E=v.from(c);throw E.isReported||(jt({checkoutSessionId:a,analytics:l,error:E,reporter:"preloadPrimer level 1"}),E.markAsReported()),E}}catch(l){let c=v.from(l);throw c.isReported||(Vr(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},tn=Ur("createHeadless"),rn=Ur("showUniversalCheckout"),on=Ur("showVaultManager");function Ur(a){return async(...[l,c,...E])=>{var A;(A=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${m}'.`),C=A??m;let x=Dr();try{let b=rt(x);try{Ui(x,b),b.sdkFunctionEvent({name:a,params:[l,c,...E]}),b.timerStart({id:te[a]});let[M,N]=await Promise.all([Wa(l,x,c?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),Fi(b)]);return N[a](M,x,l,c,...E)}catch(M){let N=v.from(M);throw N.isReported||(jt({checkoutSessionId:x,analytics:b,error:N,reporter:"lazyLoad level 1"}),N.markAsReported()),N}}catch(b){let M=v.from(b);throw M.isReported||(Vr(x,M,"lazyLoad level 0"),M.markAsReported()),M}}}var an=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),nn=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),sn=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let Ct={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",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"},_t={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"},ln={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};Ct.PAYPAL_VAULTED,_t.PAYPAL,Ct.KLARNA_CUSTOMER_TOKEN,_t.KLARNA,Ct.AUTOMATED_CLEARING_HOUSE,_t.STRIPE_ACH,Ct.CARD,_t.PAYMENT_CARD;var dn=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 Gt(a,l,c){return l in a?Object.defineProperty(a,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[l]=c,a}class Yr extends v{static fromErrorCode(l,c){return new Yr(l,c)}constructor(l,c){super(c.message),Gt(this,"code",void 0),Gt(this,"diagnosticsId",void 0),Gt(this,"data",void 0),Gt(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,Yr)}}var pn=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let cn=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var mn=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}({}),un=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let hn={SDK_VERSION:"v2.53.4",createHeadless:tn,showUniversalCheckout:rn,showVaultManager:on,preloadPrimer:en};return o})())});var qt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:s,isLoading:!1})}};var at=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 we=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var nt=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,m)=>{this.unsubscribe&&(this.unsubscribe!==m&&(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,m)),this.unsubscribe=m},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=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new we(this.context,this.host,this.t,this.subscribe))}};var Wt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var Fr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},j=class extends Wt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[m,{consumerHost:C}]of this.subscriptions)s.has(m)||(s.add(m),C.dispatchEvent(new we(this.context,C,m,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Fr(this.context,this.host))}};function y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new nt(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new nt(o,{context:i,callback:s=>{o[r]=s},subscribe:t})})}}var Zt="cardNetworksContext";var Pe="clientOptionsContext";var Ie="computedStylesContext";var G="headlessInstanceContext";var Xt="klarnaCategoriesContext";var Z="managerContext";var st="paymentMethodsContext";var z="sdkStateContext";var X="vaultManagerContext";var Le="vaultManagerCvvContext";var w=class w{static log(t,...e){w.enabled&&console.log(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.log,...e)}static info(t,...e){w.enabled&&console.info(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.info,...e)}static warn(t,...e){w.enabled&&console.warn(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.warn,...e)}static error(t,...e){w.enabled&&console.error(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.error,...e)}static debug(t,...e){w.enabled&&console.debug(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.debug,...e)}static table(t,e){w.enabled&&console.table(t,e)}static time(t){w.enabled&&console.time(`${w.brandTag} ${t}`)}static timeEnd(t){w.enabled&&console.timeEnd(`${w.brandTag} ${t}`)}};w.enabled=!0,w.defaultFont="font-family: Consolas, monospace; font-size: 12px;",w.brandTag="[PRIMER]",w.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+w.defaultFont,w.styles={log:"color: #4CAF50; "+w.defaultFont,info:"color: #2196F3; "+w.defaultFont,warn:"color: #FF9800; "+w.defaultFont,error:"color: #F44336; "+w.defaultFont,debug:"color: #9C27B0; "+w.defaultFont};var P=w;var Jt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Qt=class{constructor(t){(this.host=t).addController(this),this._state=Jt}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 P.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 Jt;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&&(P.warn("Force completing loading state"),this.completeLoading())}get state(){return this._state}};var er=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new j(t,{context:z,initialValue:Jt}),this.paymentMethodsProvider=new j(t,{context:st,initialValue:null}),this.paymentManagerProvider=new j(t,{context:Z,initialValue:new Map}),this.cardNetworksContext=new j(t,{context:Zt,initialValue:null}),this.vaultManagerProvider=new j(t,{context:X,initialValue:null}),this.vaultManagerCvvProvider=new j(t,{context:Le,initialValue:null}),this.clientOptionsContext=new j(t,{context:Pe,initialValue:null}),this.klarnaCategoriesProvider=new j(t,{context:Xt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new j(t,{context:G,initialValue:null}),this.computedStylesProvider=new j(t,{context:Ie,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 Ke=class Ke{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){P.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||P.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Ke.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ke.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){P.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let s=this.getCssVarName(r);e.push([s,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of Ke.cssVarCache.keys()){let e=Ke.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Ke.cssVarCache=new Map;var tr=Ke;var rr=globalThis,ir=rr.ShadowRoot&&(rr.ShadyCSS===void 0||rr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Br=Symbol(),qi=new WeakMap,Mt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Br)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(ir&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=qi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&qi.set(e,t))}return t}toString(){return this.cssText}},Wi=i=>new Mt(typeof i=="string"?i:i+"",void 0,Br),h=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,s)=>r+(m=>{if(m._$cssResult$===!0)return m.cssText;if(typeof m=="number")return m;throw Error("Value passed to 'css' function must be a 'css' function result: "+m+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[s+1],i[0]);return new Mt(e,i,Br)},Kr=(i,t)=>{if(ir)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=rr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},or=ir?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Wi(e)})(i):i;var{is:vn,defineProperty:yn,getOwnPropertyDescriptor:bn,getOwnPropertyNames:En,getOwnPropertySymbols:xn,getPrototypeOf:Cn}=Object,Ne=globalThis,Zi=Ne.trustedTypes,_n=Zi?Zi.emptyScript:"",An=Ne.reactiveElementPolyfillSupport,St=(i,t)=>i,kt={toAttribute(i,t){switch(t){case Boolean:i=i?_n:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},lt=(i,t)=>!vn(i,t),Xi={attribute:!0,type:String,converter:kt,reflect:!1,hasChanged:lt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ne.litPropertyMetadata??(Ne.litPropertyMetadata=new WeakMap);var be=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=Xi){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&yn(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:s}=bn(this.prototype,t)??{get(){return this[e]},set(m){this[e]=m}};return{get(){return o?.call(this)},set(m){let C=o?.call(this);s.call(this,m),this.requestUpdate(t,C,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Xi}static _$Ei(){if(this.hasOwnProperty(St("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(St("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(St("properties"))){let e=this.properties,r=[...En(e),...xn(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(or(o))}else t!==void 0&&e.push(or(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 Kr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:kt).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=r.getPropertyOptions(o),m=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:kt;this._$Em=o,this[o]=m.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??lt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,s]of r)s.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],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){}};be.elementStyles=[],be.shadowRootOptions={mode:"open"},be[St("elementProperties")]=new Map,be[St("finalized")]=new Map,An?.({ReactiveElement:be}),(Ne.reactiveElementVersions??(Ne.reactiveElementVersions=[])).push("2.0.4");var Re={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},I=Symbol(),R=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Ji,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(m){s=!0,r=m}if(this.p===o){if(e===I)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)}}},Ji=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!lt(e,t[r]));var Tt={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},ar={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function jr(i,t,e){switch(t.type){case"SET_LOADING":return{...i,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...i,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return P.error("VaultManagerController",t.payload.message),{...i,isLoading:!1};case"DISABLE":return{...Tt,enabled:!1};case"RESET":return Tt;default:return i}}function Gr(i,t,e){switch(t.type){case"INITIALIZE_CVV":return{...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...i,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...i,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...i,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return ar;default:return i}}var wt=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(o){P.error("VaultManagerController: Error starting vaulted payment flow",o),this.dispatchVaultManager({type:"SET_ERROR",payload:o instanceof Error?o: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=Tt,this._vaultItemState=ar,new R(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),I;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(),P.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(o){P.error("VaultManagerController: Failed to initialize vault",o),this.dispatchVaultManager({type:"SET_ERROR",payload:o instanceof Error?o: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=jr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Gr(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 P.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 Pt="lit-localize-status";var Qi=i=>typeof i!="string"&&"strTag"in i,nr=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var It=i=>Qi(i)?nr(i.strings,i.values):i;var _=It,eo=!1;function qr(i){if(eo)throw new Error("lit-localize can only be configured once");_=i,eo=!0}var Wr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Pt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Pt,this.__litLocalizeEventHandler)}},Mn=i=>i.addController(new Wr(i)),to=Mn;var L=()=>(i,t)=>(i.addInitializer(to),i);var Lt=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 Ee=[];for(let i=0;i<256;i++)Ee[i]=(i>>4&15).toString(16)+(i&15).toString(16);function ro(i){let t=0,e=8997,r=0,o=33826,s=0,m=40164,C=0,v=52210;for(let D=0;D<i.length;D++)e^=i.charCodeAt(D),t=e*435,r=o*435,s=m*435,C=v*435,s+=e<<8,C+=o<<8,r+=t>>>16,e=t&65535,s+=r>>>16,o=r&65535,v=C+(s>>>16)&65535,m=s&65535;return Ee[v>>8]+Ee[v&255]+Ee[m>>8]+Ee[m&255]+Ee[o>>8]+Ee[o&255]+Ee[e>>8]+Ee[e&255]}var Sn="",kn="h",Tn="s";function io(i,t){return(t?kn:Tn)+ro(typeof i=="string"?i:i.join(Sn))}var oo=new WeakMap,ao=new Map;function no(i,t,e){if(i){let r=e?.id??wn(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return nr(o.strings,t.values,o.values);{let s=oo.get(o);return s===void 0&&(s=o.values,oo.set(o,s)),{...o,values:s.map(m=>t.values[m])}}}}return It(t)}function wn(i){let t=typeof i=="string"?i:i.strings,e=ao.get(t);return e===void 0&&(e=io(t,typeof i!="string"&&!("strTag"in i)),ao.set(t,e)),e}function Zr(i){window.dispatchEvent(new CustomEvent(Pt,{detail:i}))}var lr="",Xr,so,dr,Jr,lo,je=new Lt;je.resolve();var sr=0,po=i=>(qr((t,e)=>no(lo,t,e)),lr=so=i.sourceLocale,dr=new Set(i.targetLocales),dr.add(i.sourceLocale),Jr=i.loadLocale,{getLocale:Pn,setLocale:In}),Pn=()=>lr,In=i=>{if(i===(Xr??lr))return je.promise;if(!dr||!Jr)throw new Error("Internal error");if(!dr.has(i))throw new Error("Invalid locale code");sr++;let t=sr;return Xr=i,je.settled&&(je=new Lt),Zr({status:"loading",loadingLocale:i}),(i===so?Promise.resolve({templates:void 0}):Jr(i)).then(r=>{sr===t&&(lr=i,Xr=void 0,lo=r.templates,Zr({status:"ready",readyLocale:i}),je.resolve())},r=>{sr===t&&(Zr({status:"error",errorLocale:i,errorMessage:r.toString()}),je.reject(r))}),je.promise};var Qr="en",ei=["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"],co="You must call `loadLocale` first to set up the localized template.",mo,pr,uo=i=>{let t=po({sourceLocale:Qr,targetLocales:ei,loadLocale:i});mo=t.getLocale,pr=t.setLocale};var ti=i=>{uo(i)},ri=i=>{if(!pr)throw new Error(co);return pr(i)};var Nt=new Set(ei);Nt.add(Qr);var ii=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(Nt.has(t))return!0;let e=t.split("-")[0];return!!Nt.has(e)},oi=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(Nt.has(t))return t;let e=t.split("-")[0];return Nt.has(e)?e:"en-GB"};var Ot=globalThis,cr=Ot.trustedTypes,ho=cr?cr.createPolicy("lit-html",{createHTML:i=>i}):void 0,ni="$lit$",xe=`lit$${Math.random().toFixed(9).slice(2)}$`,si="?"+xe,Ln=`<${si}>`,We=document,Dt=()=>We.createComment(""),$t=i=>i===null||typeof i!="object"&&typeof i!="function",li=Array.isArray,Eo=i=>li(i)||typeof i?.[Symbol.iterator]=="function",ai=`[
3
+ \f\r]`,Rt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,go=/-->/g,fo=/>/g,Ge=RegExp(`>|${ai}(?:([^\\s"'>=/]+)(${ai}*=${ai}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),vo=/'/g,yo=/"/g,xo=/^(?:script|style|textarea|title)$/i,di=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=di(1),_e=di(2),Od=di(3),Ce=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),bo=new WeakMap,qe=We.createTreeWalker(We,129);function Co(i,t){if(!li(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ho!==void 0?ho.createHTML(t):t}var _o=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",m=Rt;for(let C=0;C<e;C++){let v=i[C],D,F,$=-1,te=0;for(;te<v.length&&(m.lastIndex=te,F=m.exec(v),F!==null);)te=m.lastIndex,m===Rt?F[1]==="!--"?m=go:F[1]!==void 0?m=fo:F[2]!==void 0?(xo.test(F[2])&&(o=RegExp("</"+F[2],"g")),m=Ge):F[3]!==void 0&&(m=Ge):m===Ge?F[0]===">"?(m=o??Rt,$=-1):F[1]===void 0?$=-2:($=m.lastIndex-F[2].length,D=F[1],m=F[3]===void 0?Ge:F[3]==='"'?yo:vo):m===yo||m===vo?m=Ge:m===go||m===fo?m=Rt:(m=Ge,o=void 0);let B=m===Ge&&i[C+1].startsWith("/>")?" ":"";s+=m===Rt?v+Ln:$>=0?(r.push(D),v.slice(0,$)+ni+v.slice($)+xe+B):v+xe+($===-2?C:B)}return[Co(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Vt=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,m=0,C=t.length-1,v=this.parts,[D,F]=_o(t,e);if(this.el=i.createElement(D,r),qe.currentNode=this.el.content,e===2||e===3){let $=this.el.content.firstChild;$.replaceWith(...$.childNodes)}for(;(o=qe.nextNode())!==null&&v.length<C;){if(o.nodeType===1){if(o.hasAttributes())for(let $ of o.getAttributeNames())if($.endsWith(ni)){let te=F[m++],B=o.getAttribute($).split(xe),tt=/([.?@])?(.*)/.exec(te);v.push({type:1,index:s,name:tt[2],strings:B,ctor:tt[1]==="."?ur:tt[1]==="?"?hr:tt[1]==="@"?gr:Xe}),o.removeAttribute($)}else $.startsWith(xe)&&(v.push({type:6,index:s}),o.removeAttribute($));if(xo.test(o.tagName)){let $=o.textContent.split(xe),te=$.length-1;if(te>0){o.textContent=cr?cr.emptyScript:"";for(let B=0;B<te;B++)o.append($[B],Dt()),qe.nextNode(),v.push({type:2,index:++s});o.append($[te],Dt())}}}else if(o.nodeType===8)if(o.data===si)v.push({type:2,index:s});else{let $=-1;for(;($=o.data.indexOf(xe,$+1))!==-1;)v.push({type:7,index:s}),$+=xe.length-1}s++}}static createElement(t,e){let r=We.createElement("template");return r.innerHTML=t,r}};function Ze(i,t,e=i,r){if(t===Ce)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=$t(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=Ze(i,o._$AS(i,t.values),o,r)),t}var mr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??We).importNode(e,!0);qe.currentNode=o;let s=qe.nextNode(),m=0,C=0,v=r[0];for(;v!==void 0;){if(m===v.index){let D;v.type===2?D=new dt(s,s.nextSibling,this,t):v.type===1?D=new v.ctor(s,v.name,v.strings,this,t):v.type===6&&(D=new fr(s,this,t)),this._$AV.push(D),v=r[++C]}m!==v?.index&&(s=qe.nextNode(),m++)}return qe.currentNode=We,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},dt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ze(this,t,e),$t(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==Ce&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Eo(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&&$t(this._$AH)?this._$AA.nextSibling.data=t:this.T(We.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Vt.createElement(Co(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new mr(o,this),m=s.u(this.options);s.p(e),this.T(m),this._$AH=s}}_$AC(t){let e=bo.get(t.strings);return e===void 0&&bo.set(t.strings,e=new Vt(t)),e}k(t){li(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let s of t)o===e.length?e.push(r=new i(this.O(Dt()),this.O(Dt()),this,this.options)):r=e[o],r._$AI(s),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Xe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,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,o){let s=this.strings,m=!1;if(s===void 0)t=Ze(this,t,e,0),m=!$t(t)||t!==this._$AH&&t!==Ce,m&&(this._$AH=t);else{let C=t,v,D;for(t=s[0],v=0;v<s.length-1;v++)D=Ze(this,C[r+v],e,v),D===Ce&&(D=this._$AH[v]),m||(m=!$t(D)||D!==this._$AH[v]),D===u?t=u:t!==u&&(t+=(D??"")+s[v+1]),this._$AH[v]=D}m&&!o&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ur=class extends Xe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},hr=class extends Xe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},gr=class extends Xe{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=Ze(this,t,e,0)??u)===Ce)return;let r=this._$AH,o=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==u&&(r===u||o);o&&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)}},fr=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){Ze(this,t)}},Ao={M:ni,P:xe,A:si,C:1,L:_o,R:mr,D:Eo,V:Ze,I:dt,H:Xe,N:hr,U:gr,B:ur,F:fr},Nn=Ot.litHtmlPolyfillSupport;Nn?.(Vt,dt),(Ot.litHtmlVersions??(Ot.litHtmlVersions=[])).push("3.2.1");var Mo=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let s=e?.renderBefore??null;r._$litPart$=o=new dt(t.insertBefore(Dt(),s),s,void 0,e??{})}return o._$AI(i),o};var g=class extends be{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=Mo(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ce}};g._$litElement$=!0,g.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:g});var Rn=globalThis.litElementPolyfillSupport;Rn?.({LitElement:g});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var f=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var On={attribute:!0,type:String,converter:kt,reflect:!1,hasChanged:lt},Dn=(i=On,t,e)=>{let{kind:r,metadata:o}=e,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(e.name,i),r==="accessor"){let{name:m}=e;return{set(C){let v=t.get.call(this);t.set.call(this,C),this.requestUpdate(m,v,i)},init(C){return C!==void 0&&this.P(m,void 0,i),C}}}if(r==="setter"){let{name:m}=e;return function(C){let v=this[m];t.call(this,C),this.requestUpdate(m,v,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Dn(i,t,e):((r,o,s)=>{let m=o.hasOwnProperty(s);return o.constructor.createProperty(s,m?{...r,wrapped:!0}:r),m?Object.getOwnPropertyDescriptor(o,s):void 0})(i,t,e)}function T(i){return d({...i,state:!0,attribute:!1})}var Je=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Oe(i,t){return(e,r,o)=>{let s=m=>m.renderRoot?.querySelector(i)??null;if(t){let{get:m,set:C}=typeof r=="object"?e:o??(()=>{let v=Symbol();return{get(){return this[v]},set(D){this[v]=D}}})();return Je(e,r,{get(){let v=m.call(this);return v===void 0&&(v=s(this),(v!==null||this.hasUpdated)&&C.call(this,v)),v}})}return Je(e,r,{get(){return s(this)}})}}function V(i,t,e){return i?t(i):e?.(i)}var k=h`
5
+ * {
6
+ box-sizing: border-box;
7
+ }
8
+ `,So=h`
9
+ :host {
10
+ display: block;
11
+ isolation: isolate;
12
+ position: relative;
13
+ width: 100%;
14
+ //Keep the CSS loader in the same position - check css-loader-inline.ts
15
+ min-height: 64px;
16
+ }
17
+ `;var ko="https://sdk.primer.io/web/v2-latest/Primer.min.js";var vr=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 yr=typeof window<"u"&&typeof window.document<"u";function $n(i){return document.querySelector(`script[src^="${i}"]`)}function Vn(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function To(i,t=!1){if(!yr)throw new Error("Cannot load script in server environment");let e=$n(i)??Vn(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var br=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 R(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new R(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&&(P.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(),P.info("SDK instance cleaned up")}catch(t){P.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=ko){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){P.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await To(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return P.warn("Component disconnected, aborting SDK initialization"),I;if(!t||!e)return I;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:m=>{this.isDisconnected||(P.info("Configuration payment methods:",m),this.paymentsList=m)},onCheckoutComplete:({payment:m})=>{this.isDisconnected||(P.info("Payment completed:",m),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(m,C,v)=>{this.isDisconnected||(P.error("Payment failed:",m),this.host.sdkStateController.setFailure(m.code||"UNKNOWN_ERROR",m.message||"Unknown error occurred"),v&&v.showErrorMessage())},onBeforePaymentCreate:(m,C)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),C?.continuePaymentCreation())},onPaymentMethodAction:(m,C)=>{this.isDisconnected||m==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),I;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(o);let s=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(P.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return I;if(!t||!e.length)return I;let r=new Map,o=new Map;try{for(let m of e){if(this.isDisconnected)break;let C=await this.initializePaymentMethodManager(m)();m&&C&&(r.set(m.type,m),o.set(m.type,C))}if(this.isDisconnected)return I;let s=new vr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),P.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 o=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 o?{type:e,manager:o}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async m=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(m)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return P.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Er=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Hn=Gi({"../../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")});ti(i=>Hn(`../../localization/lit-localize/locales/${i}.ts`));var se=class extends g{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new er(this),this.sdkStateController=new Qt(this),this.primerEventsController=new at(this),this.styleProcessingController=new tr(this),this.vaultManagerController=new wt(this),this.cardNetworkController=new qt(this),this.achPaymentEventsController=new Er(this),new br(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e==="customstyles"?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}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&&(ii(this.options?.locale)?this.locale=oi(this.options?.locale):P.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),ri(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&&(P.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,o=e.error,s=!r&&!o;return p`
18
+ ${V(r,()=>u)}
19
+ ${V(o,()=>p`<primer-checkout-error></primer-checkout-error>`)}
20
+ ${V(s,()=>p`
21
+ <slot name="main" @slotchange=${this.onSlotChange}></slot>
22
+ ${V(this.hasAssignedContent,()=>u,()=>p`<primer-main></primer-main>`)}
23
+ `,()=>u)}
24
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};se.styles=[k,So],n([d({type:String,attribute:"custom-styles"})],se.prototype,"customStyles",2),n([d({type:String,attribute:"client-token"})],se.prototype,"clientToken",2),n([d({type:Object})],se.prototype,"options",2),n([d({type:Boolean,reflect:!0,attribute:"js-initialized"})],se.prototype,"_jsInitialized",2),n([Oe("slot")],se.prototype,"defaultSlot",2),n([T()],se.prototype,"previousLoadingState",2),se=n([L(),f("primer-checkout")],se);function Un(i){return document.querySelector(`#${i}`)}function Yn(i,t){let e=document.createElement("style");return e.textContent=i,e.id=t,e}function Ht(i,t,e=!0){if(!yr||Un(t))return;let o=Yn(i,t);e&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var wo=`
3
25
  @keyframes primer-css-spinner-rotate {
4
26
  0% {
5
27
  transform: rotate(0deg);
@@ -35,11 +57,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
35
57
  animation: primer-css-spinner-rotate 1.2s linear infinite;
36
58
  z-index: 9999;
37
59
  }
38
- `;var Bo=`/**
60
+ `;var Po=`/**
39
61
  * Do not edit directly, this file was auto-generated.
40
62
  */
41
63
 
42
- primer-checkout {
64
+ :root, primer-checkout {
43
65
  --primer-color-background-transparent-default: rgba(255, 255, 255, 0);
44
66
  --primer-color-border-transparent-default: rgba(255, 255, 255, 0);
45
67
  --primer-color-gray-100: #f5f5f5;
@@ -143,11 +165,11 @@ primer-checkout {
143
165
  --primer-color-border-transparent-focus: var(--primer-color-focus);
144
166
  --primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
145
167
  }
146
- `,Fo=`/**
168
+ `,Io=`/**
147
169
  * Do not edit directly, this file was auto-generated.
148
170
  */
149
171
 
150
- primer-checkout.primer-dark-theme {
172
+ :root, primer-checkout.primer-dark-theme {
151
173
  --primer-color-gray-100: #292929;
152
174
  --primer-color-gray-200: #424242;
153
175
  --primer-color-gray-300: #575757;
@@ -163,29 +185,7 @@ primer-checkout.primer-dark-theme {
163
185
  --primer-color-blue-500: #3f93e4;
164
186
  --primer-color-blue-900: #4aaeff;
165
187
  }
166
- `;var an="primer-light-theme-css",nn="primer-dark-theme-css";function $r(){xt(Bo,an,!0)}function Vr(){xt(Fo,nn,!0)}function Ko(){$r(),Vr()}var Kt=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 Se=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,c)=>{this.unsubscribe&&(this.unsubscribe!==c&&(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,c)),this.unsubscribe=c},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 Se(this.context,this.host,this.t,this.subscribe))}};var jt=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 Hr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},K=class extends jt{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[c,{consumerHost:x}]of this.subscriptions)s.has(c)||(s.add(c),x.dispatchEvent(new Se(this.context,x,c,!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 Hr(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 Gt="cardNetworksContext";var ot="clientOptionsContext";var Pe="computedStylesContext";var q="headlessInstanceContext";var qt="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 N=T;var Wt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Zt=class{constructor(t){(this.host=t).addController(this),this._state=Wt}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 N.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 Wt;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"})}get state(){return this._state}};var Xt=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:Wt}),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:Gt,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:qt,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){N.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||N.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)){N.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 Jt=ze;var Qt=globalThis,er=Qt.ShadowRoot&&(Qt.ShadyCSS===void 0||Qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yr=Symbol(),jo=new WeakMap,Ct=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Yr)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(er&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=jo.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&jo.set(e,t))}return t}toString(){return this.cssText}},Go=o=>new Ct(typeof o=="string"?o:o+"",void 0,Yr),g=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,s)=>r+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new Ct(e,o,Yr)},Ur=(o,t)=>{if(er)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Qt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},tr=er?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Go(e)})(o):o;var{is:sn,defineProperty:ln,getOwnPropertyDescriptor:dn,getOwnPropertyNames:pn,getOwnPropertySymbols:cn,getPrototypeOf:mn}=Object,we=globalThis,qo=we.trustedTypes,un=qo?qo.emptyScript:"",hn=we.reactiveElementPolyfillSupport,At=(o,t)=>o,Mt={toAttribute(o,t){switch(t){case Boolean:o=o?un: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)=>!sn(o,t),Wo={attribute:!0,type:String,converter:Mt,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=Wo){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&&ln(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:s}=dn(this.prototype,t)??{get(){return this[e]},set(c){this[e]=c}};return{get(){return i?.call(this)},set(c){let x=i?.call(this);s.call(this,c),this.requestUpdate(t,x,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wo}static _$Ei(){if(this.hasOwnProperty(At("elementProperties")))return;let t=mn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(At("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(At("properties"))){let e=this.properties,r=[...pn(e),...cn(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(tr(i))}else t!==void 0&&e.push(tr(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 Ur(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:Mt).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),c=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Mt;this._$Em=i,this[i]=c.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[At("elementProperties")]=new Map,ve[At("finalized")]=new Map,hn?.({ReactiveElement:ve}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var ke={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},D=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??Zo,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(c){s=!0,r=c}if(this.p===i){if(e===D)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)}}},Zo=(o,t)=>o===t||o.length===t.length&&o.every((e,r)=>!at(e,t[r]));var _t={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},rr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function zr(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 N.error("VaultManagerController",t.payload.message),{...o,isLoading:!1};case"DISABLE":return{..._t,enabled:!1};case"RESET":return _t;default:return o}}function Br(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 rr;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){N.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=_t,this._vaultItemState=rr,new V(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),D;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(),N.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(i){N.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=zr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Br(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 N.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 Pt="lit-localize-status";var Xo=o=>typeof o!="string"&&"strTag"in o,or=(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 Tt=o=>Xo(o)?or(o.strings,o.values):o;var P=Tt,Jo=!1;function Fr(o){if(Jo)throw new Error("lit-localize can only be configured once");P=o,Jo=!0}var Kr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Pt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Pt,this.__litLocalizeEventHandler)}},gn=o=>o.addController(new Kr(o)),Qo=gn;var I=()=>(o,t)=>(o.addInitializer(Qo),o);var wt=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 ei(o){let t=0,e=8997,r=0,i=33826,s=0,c=40164,x=0,h=52210;for(let R=0;R<o.length;R++)e^=o.charCodeAt(R),t=e*435,r=i*435,s=c*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,c=s&65535;return ye[h>>8]+ye[h&255]+ye[c>>8]+ye[c&255]+ye[i>>8]+ye[i&255]+ye[e>>8]+ye[e&255]}var fn="",vn="h",yn="s";function ti(o,t){return(t?vn:yn)+ei(typeof o=="string"?o:o.join(fn))}var ri=new WeakMap,oi=new Map;function ii(o,t,e){if(o){let r=e?.id??bn(t),i=o[r];if(i){if(typeof i=="string")return i;if("strTag"in i)return or(i.strings,t.values,i.values);{let s=ri.get(i);return s===void 0&&(s=i.values,ri.set(i,s)),{...i,values:s.map(c=>t.values[c])}}}}return Tt(t)}function bn(o){let t=typeof o=="string"?o:o.strings,e=oi.get(t);return e===void 0&&(e=ti(t,typeof o!="string"&&!("strTag"in o)),oi.set(t,e)),e}function jr(o){window.dispatchEvent(new CustomEvent(Pt,{detail:o}))}var ar="",Gr,ai,nr,qr,ni,Be=new wt;Be.resolve();var ir=0,si=o=>(Fr((t,e)=>ii(ni,t,e)),ar=ai=o.sourceLocale,nr=new Set(o.targetLocales),nr.add(o.sourceLocale),qr=o.loadLocale,{getLocale:En,setLocale:xn}),En=()=>ar,xn=o=>{if(o===(Gr??ar))return Be.promise;if(!nr||!qr)throw new Error("Internal error");if(!nr.has(o))throw new Error("Invalid locale code");ir++;let t=ir;return Gr=o,Be.settled&&(Be=new wt),jr({status:"loading",loadingLocale:o}),(o===ai?Promise.resolve({templates:void 0}):qr(o)).then(r=>{ir===t&&(ar=o,Gr=void 0,ni=r.templates,jr({status:"ready",readyLocale:o}),Be.resolve())},r=>{ir===t&&(jr({status:"error",errorLocale:o,errorMessage:r.toString()}),Be.reject(r))}),Be.promise};var Wr="en",Zr=["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"],li="You must call `loadLocale` first to set up the localized template.",di,sr,pi=o=>{let t=si({sourceLocale:Wr,targetLocales:Zr,loadLocale:o});di=t.getLocale,sr=t.setLocale};var Xr=o=>{pi(o)},Jr=o=>{if(!sr)throw new Error(li);return sr(o)};var kt=new Set(Zr);kt.add(Wr);var Qr=o=>{if(typeof o!="string")return!1;if(o==="en")return!0;let t=o.replace("_","-");if(kt.has(t))return!0;let e=t.split("-")[0];return!!kt.has(e)},eo=o=>{if(o==="en")return"en-GB";let t=o.replace("_","-");if(kt.has(t))return t;let e=t.split("-")[0];return kt.has(e)?e:"en-GB"};var Nt=globalThis,lr=Nt.trustedTypes,ci=lr?lr.createPolicy("lit-html",{createHTML:o=>o}):void 0,ro="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,oo="?"+be,Cn=`<${oo}>`,je=document,Lt=()=>je.createComment(""),Rt=o=>o===null||typeof o!="object"&&typeof o!="function",io=Array.isArray,vi=o=>io(o)||typeof o?.[Symbol.iterator]=="function",to=`[
167
- \f\r]`,It=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mi=/-->/g,ui=/>/g,Fe=RegExp(`>|${to}(?:([^\\s"'>=/]+)(${to}*=${to}*(?:[^
168
- \f\r"'\`<>=]|("|')|))|$)`,"g"),hi=/'/g,gi=/"/g,yi=/^(?:script|style|textarea|title)$/i,ao=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),m=ao(1),Ie=ao(2),wd=ao(3),Ee=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),fi=new WeakMap,Ke=je.createTreeWalker(je,129);function bi(o,t){if(!io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ci!==void 0?ci.createHTML(t):t}var Ei=(o,t)=>{let e=o.length-1,r=[],i,s=t===2?"<svg>":t===3?"<math>":"",c=It;for(let x=0;x<e;x++){let h=o[x],R,z,O=-1,Q=0;for(;Q<h.length&&(c.lastIndex=Q,z=c.exec(h),z!==null);)Q=c.lastIndex,c===It?z[1]==="!--"?c=mi:z[1]!==void 0?c=ui:z[2]!==void 0?(yi.test(z[2])&&(i=RegExp("</"+z[2],"g")),c=Fe):z[3]!==void 0&&(c=Fe):c===Fe?z[0]===">"?(c=i??It,O=-1):z[1]===void 0?O=-2:(O=c.lastIndex-z[2].length,R=z[1],c=z[3]===void 0?Fe:z[3]==='"'?gi:hi):c===gi||c===hi?c=Fe:c===mi||c===ui?c=It:(c=Fe,i=void 0);let B=c===Fe&&o[x+1].startsWith("/>")?" ":"";s+=c===It?h+Cn:O>=0?(r.push(R),h.slice(0,O)+ro+h.slice(O)+be+B):h+be+(O===-2?x:B)}return[bi(o,s+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ot=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,c=0,x=t.length-1,h=this.parts,[R,z]=Ei(t,e);if(this.el=o.createElement(R,r),Ke.currentNode=this.el.content,e===2||e===3){let O=this.el.content.firstChild;O.replaceWith(...O.childNodes)}for(;(i=Ke.nextNode())!==null&&h.length<x;){if(i.nodeType===1){if(i.hasAttributes())for(let O of i.getAttributeNames())if(O.endsWith(ro)){let Q=z[c++],B=i.getAttribute(O).split(be),Xe=/([.?@])?(.*)/.exec(Q);h.push({type:1,index:s,name:Xe[2],strings:B,ctor:Xe[1]==="."?pr:Xe[1]==="?"?cr:Xe[1]==="@"?mr:qe}),i.removeAttribute(O)}else O.startsWith(be)&&(h.push({type:6,index:s}),i.removeAttribute(O));if(yi.test(i.tagName)){let O=i.textContent.split(be),Q=O.length-1;if(Q>0){i.textContent=lr?lr.emptyScript:"";for(let B=0;B<Q;B++)i.append(O[B],Lt()),Ke.nextNode(),h.push({type:2,index:++s});i.append(O[Q],Lt())}}}else if(i.nodeType===8)if(i.data===oo)h.push({type:2,index:s});else{let O=-1;for(;(O=i.data.indexOf(be,O+1))!==-1;)h.push({type:7,index:s}),O+=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=Rt(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 dr=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(),c=0,x=0,h=r[0];for(;h!==void 0;){if(c===h.index){let R;h.type===2?R=new nt(s,s.nextSibling,this,t):h.type===1?R=new h.ctor(s,h.name,h.strings,this,t):h.type===6&&(R=new ur(s,this,t)),this._$AV.push(R),h=r[++x]}c!==h?.index&&(s=Ke.nextNode(),c++)}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),Rt(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):vi(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&&Rt(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=Ot.createElement(bi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new dr(i,this),c=s.u(this.options);s.p(e),this.T(c),this._$AH=s}}_$AC(t){let e=fi.get(t.strings);return e===void 0&&fi.set(t.strings,e=new Ot(t)),e}k(t){io(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,c=!1;if(s===void 0)t=Ge(this,t,e,0),c=!Rt(t)||t!==this._$AH&&t!==Ee,c&&(this._$AH=t);else{let x=t,h,R;for(t=s[0],h=0;h<s.length-1;h++)R=Ge(this,x[r+h],e,h),R===Ee&&(R=this._$AH[h]),c||(c=!Rt(R)||R!==this._$AH[h]),R===u?t=u:t!==u&&(t+=(R??"")+s[h+1]),this._$AH[h]=R}c&&!i&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},pr=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)}},mr=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)}},ur=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ge(this,t)}},xi={M:ro,P:be,A:oo,C:1,L:Ei,R:dr,D:vi,V:Ge,I:nt,H:qe,N:cr,U:mr,B:pr,F:ur},An=Nt.litHtmlPolyfillSupport;An?.(Ot,nt),(Nt.litHtmlVersions??(Nt.litHtmlVersions=[])).push("3.2.1");var Ci=(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=Ci(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 Mn=globalThis.litElementPolyfillSupport;Mn?.({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 _n={attribute:!0,type:String,converter:Mt,reflect:!1,hasChanged:at},Sn=(o=_n,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:c}=e;return{set(x){let h=t.get.call(this);t.set.call(this,x),this.requestUpdate(c,h,o)},init(x){return x!==void 0&&this.P(c,void 0,o),x}}}if(r==="setter"){let{name:c}=e;return function(x){let h=this[c];t.call(this,x),this.requestUpdate(c,h,o)}}throw Error("Unsupported decorator location: "+r)};function d(o){return(t,e)=>typeof e=="object"?Sn(o,t,e):((r,i,s)=>{let c=i.hasOwnProperty(s);return i.constructor.createProperty(s,c?{...r,wrapped:!0}:r),c?Object.getOwnPropertyDescriptor(i,s):void 0})(o,t,e)}function w(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 Ne(o,t){return(e,r,i)=>{let s=c=>c.renderRoot?.querySelector(o)??null;if(t){let{get:c,set:x}=typeof r=="object"?e:i??(()=>{let h=Symbol();return{get(){return this[h]},set(R){this[h]=R}}})();return We(e,r,{get(){let h=c.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 S=g`
169
- * {
170
- box-sizing: border-box;
171
- }
172
- `,Ai=g`
173
- :host {
174
- display: block;
175
- isolation: isolate;
176
- position: relative;
177
- width: 100%;
178
- //Keep the CSS loader in the same position - check css-loader-inline.ts
179
- min-height: 64px;
180
- }
181
- `;var Mi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var hr=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}};function Pn(o){return document.querySelector(`script[src^="${o}"]`)}function Tn(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 _i(o,t=!1){if(!Ft)throw new Error("Cannot load script in server environment");let e=Pn(o)??Tn(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.host=t).addController(this),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.host.sdkStateController.startLoading()}async _loadV2Sdk(t=Mi){await _i(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(!t||!e)return D;try{await this._loadV2Sdk();let{Primer:r}=window,i=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:c=>{N.info("Configuration payment methods:",c),this.paymentsList=c},onCheckoutComplete:({payment:c})=>{N.info("Payment completed:",c),this.host.sdkStateController.completeProcessing()},onCheckoutFail:(c,x,h)=>{N.error("Payment failed:",c),this.host.sdkStateController.setFailure(c.code||"UNKNOWN_ERROR",c.message||"Unknown error occurred"),h&&h.showErrorMessage()},onBeforePaymentCreate:(c,x)=>{this.host.sdkStateController.startProcessing(),x?.continuePaymentCreation()},onPaymentMethodAction:(c,x)=>{c==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});this.createPaymentMethodManager=i.createPaymentMethodManager.bind(i),await i.start(),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&&this.host.sdkStateController.setError(r),r}}}initializeLitContext(){return async([t,e])=>{if(!t||!e.length)return D;let r=new Map,i=new Map;try{for(let c of e){let x=await this.initializePaymentMethodManager(c)();c&&x&&(r.set(c.type,c),i.set(c.type,x))}let s=new hr(r);return this.host.sdkContextController.setPaymentManagers(i),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),N.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let i=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{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 c=>{await this.host.cardNetworkController.processCardNetworkChangeEvent(c)},onCardNetworksLoading:()=>{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 N.error(`Failed to initialize manager for ${e}:`,i),null}}}};var wn=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")});Xr(o=>wn(`../../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.locale="en-GB";this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.sdkContextController=new Xt(this),this.sdkStateController=new Zt(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Jt(this),this.vaultManagerController=new St(this),this.cardNetworkController=new Kt(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)}willUpdate(e){e.has("options")&&(this.options?.locale&&(Qr(this.options?.locale)?this.locale=eo(this.options?.locale):N.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Jr(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}render(){let e=this.sdkStateController.state,r=e.isLoading,i=e.error,s=!r&&!i;return m`
182
- ${$(r,()=>u)}
183
- ${$(i,()=>m`<primer-checkout-error></primer-checkout-error>`)}
184
- ${$(s,()=>m`
185
- <slot name="main" @slotchange=${this.onSlotChange}></slot>
186
- ${$(this.hasAssignedContent,()=>u,()=>m`<primer-main></primer-main>`)}
187
- `,()=>u)}
188
- `}addEventListener(e,r,i){super.addEventListener(e,r,i)}};ae.styles=[S,Ai],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([Ne("slot")],ae.prototype,"defaultSlot",2),n([w()],ae.prototype,"previousLoadingState",2),ae=n([I(),v("primer-checkout")],ae);var Si=g`
188
+ `;var zn="primer-light-theme-css",Fn="primer-dark-theme-css";function pi(){Ht(Po,zn,!0)}function ci(){Ht(Io,Fn,!0)}function Lo(){pi(),ci()}function No(){Ht(wo,"primer-css-loader-styles",!1)}function Ro(){Lo()}function Bn(){pi()}function Kn(){ci()}var Oo=h`
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 mi={small:16,medium:24,large:32},Ae=class extends g{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in mi)return mi[this.size];let e=parseInt(this.size,10);return isNaN(e)?mi.medium:e}render(){let e=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),p`
234
234
  <div class="spinner-container ${this.compact?"compact":""}">
235
235
  <svg
236
236
  class="spinner"
237
237
  width="${e}"
238
238
  height="${e}"
239
- viewBox="${i}"
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=[Si],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 pe=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 Pi=g`
252
+ `}};Ae.styles=[Oo],n([d({type:String})],Ae.prototype,"color",2),n([d({type:String})],Ae.prototype,"size",2),n([d({type:Boolean})],Ae.prototype,"compact",2),Ae=n([f("primer-spinner")],Ae);var xr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ut=i=>(...t)=>({_$litDirective$:i,values:t}),pt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var q=Ut(class extends pt{constructor(i){if(super(i),i.type!==xr.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=i.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let o=!!t[r];o===this.st.has(r)||this.nt?.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return Ce}});var Do=h`
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 Me=class extends g{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of e){let s=o.querySelector("primer-input");if(s)return s}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return p`
318
318
  <div class="input-wrapper">
319
319
  <slot name="label"></slot>
320
- <div class="${pe(e)}" @click="${this.handleWrapperClick}">
320
+ <div class="${q(e)}" @click="${this.handleWrapperClick}">
321
321
  <slot name="input"></slot>
322
322
  </div>
323
323
  <slot name="error"></slot>
324
324
  </div>
325
- `}};Ce.styles=[Pi],n([d({type:Boolean})],Ce.prototype,"focusWithin",2),n([d({type:Boolean,reflect:!0,attribute:"has-error"})],Ce.prototype,"hasError",2),n([Ne('slot[name="input"]')],Ce.prototype,"inputSlot",2),Ce=n([v("primer-input-wrapper")],Ce);var Ti=g`
325
+ `}};Me.styles=[Do],n([d({type:Boolean})],Me.prototype,"focusWithin",2),n([d({type:Boolean,reflect:!0,attribute:"has-error"})],Me.prototype,"hasError",2),n([Oe('slot[name="input"]')],Me.prototype,"inputSlot",2),Me=n([f("primer-input-wrapper")],Me);var $o=h`
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 Le=class extends f{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return m`<label for=${this.for}><slot></slot></label>`}};Le.styles=[Ti],n([d({type:String,reflect:!0})],Le.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Le.prototype,"disabled",2),Le=n([v("primer-input-label")],Le);var wi=g`
339
+ `;var De=class extends g{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return p`<label for=${this.for}><slot></slot></label>`}};De.styles=[$o],n([d({type:String,reflect:!0})],De.prototype,"for",2),n([d({type:Boolean,reflect:!0})],De.prototype,"disabled",2),De=n([f("primer-input-label")],De);var Vo=h`
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 le=class extends g{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:p`
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 u;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),p`
513
513
  <primer-spinner
514
514
  size="small"
515
515
  color="${e}"
516
516
  compact
517
517
  ></primer-spinner>
518
- `}render(){return m`
518
+ `}render(){return p`
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=[S,wi],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 ki=g`
533
+ `}};le.styles=[k,Vo],n([d({type:String})],le.prototype,"variant",2),n([d({type:Boolean,reflect:!0})],le.prototype,"disabled",2),n([d({type:Boolean,reflect:!0})],le.prototype,"loading",2),n([d({type:String})],le.prototype,"buttonType",2),n([d({type:String,reflect:!0})],le.prototype,"selectionState",2),n([d({type:Boolean,reflect:!0})],le.prototype,"selectable",2),le=n([f("primer-button")],le);var Ho=h`
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 $e=class extends g{constructor(){super(...arguments);this.for="";this.active=!0}render(){return p`
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=[ki],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 Ii={pencil:Ie`
558
+ `}};$e.styles=[Ho],n([d({type:String,reflect:!0})],$e.prototype,"for",2),n([d({type:Boolean,reflect:!0})],$e.prototype,"active",2),$e=n([f("primer-input-error")],$e);var Uo={pencil:_e`
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:_e`
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":_e`
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":_e`
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":_e`
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":_e`
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:_e`
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 Ni=g`
608
+ `,close:_e`
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 Yo=h`
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?Ii[this.name]:null;return m`
657
+ `;var Se=class extends g{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Uo[this.name]:null;return p`
651
658
  <div style="--internal-icon-color: ${this.color}">
652
- ${e||m`<slot></slot>`}
659
+ ${e||p`<slot></slot>`}
653
660
  </div>
654
- `}};Ae.styles=[Ni],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 Li=g`
661
+ `}};Se.styles=[Yo],n([d({type:String})],Se.prototype,"color",2),n([d({type:String})],Se.prototype,"size",2),n([d({reflect:!0})],Se.prototype,"name",2),Se=n([f("primer-icon")],Se);var zo=h`
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 Ve=class extends g{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?p`
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
+ `:p`
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=[Li],n([d({type:String})],Oe.prototype,"type",2),n([d({type:String})],Oe.prototype,"description",2),Oe=n([v("primer-checkout-state")],Oe);var Ri=g`
710
+ ${this.description?p`<p class="secondary">${this.description}</p>`:p`<p class="secondary">Something went wrong.</p>`}
711
+ `}};Ve.styles=[zo],n([d({type:String})],Ve.prototype,"type",2),n([d({type:String})],Ve.prototype,"description",2),Ve=n([f("primer-checkout-state")],Ve);var Fo=h`
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 kn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function In(o){return kn.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 jn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Gn(i){return jn.includes(i)}var U=class extends g{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,o){this.inputElement?.setSelectionRange(e,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return p`
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=[Ri],n([Ne("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||!In(e)?(e&&e!=="text"&&N.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([w()],Y.prototype,"hasFocus",2),n([w()],Y.prototype,"hasError",2),Y=n([v("primer-input")],Y);var Oi=g`
767
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};U.styles=[Fo],n([Oe("input")],U.prototype,"inputElement",2),n([d({type:String,reflect:!0})],U.prototype,"value",2),n([d({type:String,reflect:!0})],U.prototype,"placeholder",2),n([d({type:Boolean,reflect:!0})],U.prototype,"disabled",2),n([d({type:String,reflect:!0})],U.prototype,"name",2),n([d({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Gn(e)?(e&&e!=="text"&&P.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],U.prototype,"type",2),n([d({type:Boolean,reflect:!0})],U.prototype,"required",2),n([d({type:Boolean,reflect:!0})],U.prototype,"readonly",2),n([d({type:String,reflect:!0})],U.prototype,"pattern",2),n([d({type:Number,reflect:!0})],U.prototype,"minlength",2),n([d({type:Number,reflect:!0})],U.prototype,"maxlength",2),n([d({type:String,reflect:!0})],U.prototype,"min",2),n([d({type:String,reflect:!0})],U.prototype,"max",2),n([d({type:String,reflect:!0})],U.prototype,"step",2),n([d({type:String,reflect:!0})],U.prototype,"autocomplete",2),n([d({type:String,reflect:!0})],U.prototype,"id",2),n([T()],U.prototype,"hasFocus",2),n([T()],U.prototype,"hasError",2),U=n([f("primer-input")],U);var Bo=h`
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 oe=class extends g{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,o=this.header||e;return p`
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=[Oi],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([w()],re.prototype,"isExpanded",2),re=n([v("primer-collapsable")],re);var Di=g`
845
+ `}};oe.styles=[Bo],n([d({type:String})],oe.prototype,"header",2),n([d({type:Boolean})],oe.prototype,"expanded",2),n([d({type:String})],oe.prototype,"expandText",2),n([d({type:String})],oe.prototype,"collapseText",2),n([d({type:String})],oe.prototype,"ariaLabel",2),n([d({type:String})],oe.prototype,"buttonVariant",2),n([T()],oe.prototype,"isExpanded",2),oe=n([f("primer-collapsable")],oe);var Ko=h`
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 fe=class extends g{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 p`
899
906
  <div
900
907
  part="error-message"
901
- class=${pe(e)}
908
+ class=${q(e)}
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=[Di],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([w()],he.prototype,"showMessage",2),he=n([v("primer-error-message")],he);var $i=g`
921
+ `}};fe.styles=[Ko],n([d({type:String})],fe.prototype,"message",2),n([d({type:Boolean,reflect:!0})],fe.prototype,"visible",2),n([d({type:String,reflect:!0})],fe.prototype,"role",2),n([T()],fe.prototype,"showMessage",2),fe=n([f("primer-error-message")],fe);var jo=h`
922
+ :host {
923
+ display: none;
924
+ }
925
+ `;var Qe=class extends g{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let e=document.querySelector(`#${this.id}`);return e||(e=document.createElement("div"),e.id=this.id,document.body.appendChild(e),this._setupEventListeners(e)),e}_setupEventListeners(e){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{e.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(e){let o=e.target.assignedNodes();if(!o.length)return;let s=this.getContainer();o.forEach(m=>s.appendChild(m))}render(){return p`<slot @slotchange=${this._handleSlotChange}></slot>`}};Qe.styles=[jo],n([T()],Qe.prototype,"id",2),Qe=n([f("primer-portal")],Qe);var Go=h`
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 g{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return p`
955
+ <div
956
+ class=${q({backdrop:!0})}
957
+ @click=${t=>{t.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=[Go],ct=n([f("primer-dialog")],ct);var qo=h`
915
971
  :host {
916
972
  display: contents;
917
973
  }
@@ -1103,22 +1159,22 @@ 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 D;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){N.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){N.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 J=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=_("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new R(this,{task:async([e,r])=>{if(!e||!r)return I;let o=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){P.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){P.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?p`<div class="loading">
1107
1163
  <primer-spinner size="small"></primer-spinner>
1108
- </div>`:e.length<=1?u:m`
1164
+ </div>`:e.length<=1?u:p`
1109
1165
  <div class="category-selection">
1110
- ${e.map(i=>m`
1166
+ ${e.map(o=>p`
1111
1167
  <button
1112
- class=${pe({"category-button":!0,selected:i.id===this.selectedCategory})}
1113
- @click=${()=>{this.selectCategory(i.id)}}
1168
+ class=${q({"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 p`
1120
1176
  ${this.renderCategorySelection()}
1121
- ${this.selectedCategory?m`
1177
+ ${this.selectedCategory?p`
1122
1178
  <div
1123
1179
  id="klarna-category-container"
1124
1180
  class="klarna-category-container"
@@ -1126,15 +1182,15 @@ primer-checkout.primer-dark-theme {
1126
1182
  `:u}
1127
1183
 
1128
1184
  <button
1129
- class=${pe({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1185
+ class=${q({"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
+ ${_("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:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return p`<div class="error">
1136
1192
  Error loading Klarna: ${r}
1137
- </div>`},complete:({manager:e,klarnaIcon:r})=>e?m`
1193
+ </div>`},complete:({manager:e,klarnaIcon:r})=>e?p`
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>${_("pay_with",{id:"pay_with"})} Klarna</span>
1151
1207
  <span
1152
1208
  class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1153
1209
  >
@@ -1164,15 +1220,267 @@ primer-checkout.primer-dark-theme {
1164
1220
  </div>
1165
1221
  </div>
1166
1222
  </div>
1167
- `:u})}};Z.styles=[S,$i],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:qt,subscribe:!0}),d()],Z.prototype,"klarnaCategories",2),n([w()],Z.prototype,"selectedCategory",2),n([w()],Z.prototype,"isExpanded",2),n([w()],Z.prototype,"headerAriaLabel",2),n([Ne("#klarna-category-container")],Z.prototype,"klarnaContainer",2),Z=n([v("primer-klarna"),I()],Z);var Vi=g`
1223
+ `:u})}};J.styles=[k,qo],n([y({context:Z,subscribe:!0}),d()],J.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0}),d()],J.prototype,"sdkState",2),n([y({context:G,subscribe:!0}),d({type:Object})],J.prototype,"headlessUtils",2),n([y({context:Xt,subscribe:!0}),d()],J.prototype,"klarnaCategories",2),n([T()],J.prototype,"selectedCategory",2),n([T()],J.prototype,"isExpanded",2),n([T()],J.prototype,"headerAriaLabel",2),n([Oe("#klarna-category-container")],J.prototype,"klarnaContainer",2),J=n([f("primer-klarna"),L()],J);var Wo=h`
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
1227
+ `;var He=class extends g{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 p`<primer-card-form></primer-card-form>`;case"NATIVE":return p`<primer-native-payment
1172
1228
  .paymentMethod=${e}
1173
- ></primer-native-payment>`;case"REDIRECT":return m`<primer-redirect-payment
1229
+ ></primer-native-payment>`;case"REDIRECT":return p`<primer-redirect-payment
1174
1230
  .paymentMethod=${e}
1175
- ></primer-redirect-payment>`;case"KLARNA":return m`<primer-klarna></primer-klarna>`;default:return u}}};De.styles=[Vi],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 Hi=g`
1231
+ ></primer-redirect-payment>`;case"KLARNA":return p`<primer-klarna></primer-klarna>`;case"ACH":return p`
1232
+ <primer-dynamic-payment
1233
+ .paymentMethod=${e}
1234
+ ></primer-dynamic-payment>
1235
+ `;default:return u}}};He.styles=[Wo],n([d({type:String})],He.prototype,"type",2),n([y({context:st,subscribe:!0}),d()],He.prototype,"paymentMethods",2),He=n([f("primer-payment-method")],He);var Zo=h`
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 Xo(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var Cr=class{constructor(t,e){this.formState=Xo();this.host=t,this.validate=e,t.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(t,e){let r=this.formState[t];r.value=e,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(t,e=!1){e&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),t.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:t}})),this.host.requestUpdate()}setFieldTouched(t){this.formState[t].touched||(this.formState[t].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Xo(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var de=class extends g{constructor(){super(...arguments);this.formController=new Cr(this,e=>this._paymentMethodManagerTask.value.setAndValidate(e));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new R(this,{task:async([e])=>e!=="STRIPE_ACH"?I:this.paymentManagers.get(e)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(e,r){let o=e.target;this.formController.setFieldValue(r,o.value)}_handleBlur(e){this.formController.setFieldTouched(e)}_handleError(e){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error occurred")}}))}async _handleSubmitButtonClick(e){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await e.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(e);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(e){try{await e.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}renderForm(e){return p`
1321
+ <h2>
1322
+ ${_("payWithAch",{id:"payWithAch"})}
1323
+ </h2>
1324
+ <p>
1325
+ ${_("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
+ ${_("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:u}
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
+ ${_("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:u}
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
+ ${_("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:u}
1382
+ </primer-input-error>
1383
+ </primer-input-wrapper>
1384
+ <p>
1385
+ ${_("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(e)}
1391
+ ?disabled=${this.isSubmitting}
1392
+ ?loading=${this.isSubmitting}
1393
+ >
1394
+ ${_("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
1395
+ </primer-button>
1396
+ </form>
1397
+ `}renderMandate(){return p`
1398
+ <h2>
1399
+ ${_("payWithAch",{id:"payWithAch"})}
1400
+ </h2>
1401
+
1402
+ <p>
1403
+ ${this.clientOptions?.stripe?.mandateData.fullMandateText??_("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
+ ${_("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
+ ${_("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:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():u})}};de.styles=[k,Zo],n([d({type:Object})],de.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0}),d({attribute:!1})],de.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0}),d({attribute:!1})],de.prototype,"sdkState",2),n([y({context:Pe,subscribe:!0}),d({attribute:!1})],de.prototype,"clientOptions",2),n([T()],de.prototype,"screen",2),n([T()],de.prototype,"isSubmitting",2),de=n([f("primer-ach-payment"),L()],de);var Jo=h`
1425
+ :host {
1426
+ height: calc(
1427
+ var(--primer-typography-title-large-line-height) +
1428
+ calc(2 * var(--primer-space-medium))
1429
+ );
1430
+ display: flex;
1431
+
1432
+ /* Default value for the background color CSS variable */
1433
+ --dynamic-payment-button-bg-color: var(
1434
+ --primer-color-background-outlined-default
1435
+ );
1436
+ }
1437
+
1438
+ primer-button {
1439
+ width: 100%;
1440
+ height: 100%;
1441
+ }
1442
+
1443
+ primer-button::part(button) {
1444
+ background-color: var(--dynamic-payment-button-bg-color);
1445
+ border: 1px solid var(--primer-color-border-outlined-default);
1446
+ color: var(--primer-color-text-primary);
1447
+ flex: 1;
1448
+ padding: 1px;
1449
+ }
1450
+
1451
+ .image-container {
1452
+ display: flex;
1453
+ justify-content: center;
1454
+ height: 100%;
1455
+ }
1456
+ /* Target the img specifically inside our component */
1457
+ img {
1458
+ height: 100%;
1459
+ }
1460
+ `;function ui(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var ue=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new R(this,{task:async([e,r])=>!e||!r?I:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new R(this,{task:async([e,r])=>{if(!e||!r)return I;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:I},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new R(this,{task:async([e,r])=>!e||!r?I:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?ui(e):"";return r==="payWith"&&(r="pay_with"),_(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?p`
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
+ `:u}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),p`
1472
+ <primer-button
1473
+ @click="${()=>this.start()}"
1474
+ class=${q({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1475
+ title="${_("pay_with",{id:"pay_with"})} ${e.name}"
1476
+ >
1477
+ <span class="image-container">
1478
+ <img src="${e.iconUrl}" alt="${e.name}" />
1479
+ </span>
1480
+ ${e.displayName}
1481
+ </primer-button>
1482
+ ${this.renderDialog()}
1483
+ `)})}};ue.styles=[k,Jo],n([d({type:Object})],ue.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0})],ue.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0})],ue.prototype,"sdkState",2),n([y({context:G,subscribe:!0})],ue.prototype,"headlessUtils",2),n([T()],ue.prototype,"open",2),ue=n([f("primer-dynamic-payment"),L()],ue);var Qo=h`
1176
1484
  :host {
1177
1485
  height: calc(
1178
1486
  var(--primer-typography-title-large-line-height) +
@@ -1209,15 +1517,15 @@ primer-checkout.primer-dark-theme {
1209
1517
  img {
1210
1518
  height: 100%;
1211
1519
  }
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?D:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return D;let i=r.getPaymentMethodConfiguration(e);return i?{backgroundColor:i.displayMetadata.button.backgroundColor.colored,name:i.name,iconUrl:i.displayMetadata.button.iconUrl.colored}:D},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?D:{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
1520
+ `;var ve=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new R(this,{task:async([e,r])=>!e||!r?I:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new R(this,{task:async([e,r])=>{if(!e||!r)return I;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,iconUrl:o.displayMetadata.button.iconUrl.colored}:I},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new R(this,{task:async([e,r])=>!e||!r?I:{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),p` <primer-button
1213
1521
  @click="${()=>this.startRedirectPayment()}"
1214
- class=${pe({loading:!!this.sdkState?.isProcessing})}
1215
- title="${P("pay_with",{id:"pay_with"})} ${e.name}"
1522
+ class=${q({loading:!!this.sdkState?.isProcessing})}
1523
+ title="${_("pay_with",{id:"pay_with"})} ${e.name}"
1216
1524
  >
1217
1525
  <span class="image-container">
1218
1526
  <img src="${e.iconUrl}" alt="${e.name}" />
1219
1527
  </span>
1220
- </primer-button>`)})}};ge.styles=[S,Hi],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"),I()],ge);var Yi=g`
1528
+ </primer-button>`)})}};ve.styles=[k,Qo],n([d({type:Object})],ve.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0})],ve.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0})],ve.prototype,"sdkState",2),n([y({context:G,subscribe:!0})],ve.prototype,"headlessUtils",2),ve=n([f("primer-redirect-payment"),L()],ve);var ea=h`
1221
1529
  :host {
1222
1530
  display: contents;
1223
1531
  }
@@ -1236,20 +1544,20 @@ primer-checkout.primer-dark-theme {
1236
1544
  primer-vault-manager {
1237
1545
  margin-bottom: var(--primer-space-xlarge);
1238
1546
  }
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`
1547
+ `;var Ue=class extends g{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?p`
1240
1548
  <slot name="checkout-complete">
1241
1549
  <primer-checkout-complete></primer-checkout-complete>
1242
1550
  </slot>
1243
- `:m`
1551
+ `:p`
1244
1552
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1245
- ${$(this.hasAssignedContent,()=>u,()=>m`
1553
+ ${V(this.hasAssignedContent,()=>u,()=>p`
1246
1554
  <div
1247
- class=${pe({"primer-is-processing":!!this.sdkState?.isProcessing})}
1555
+ class=${q({"primer-is-processing":!!this.sdkState?.isProcessing})}
1248
1556
  >
1249
1557
  <primer-vault-manager></primer-vault-manager>
1250
1558
  <primer-show-other-payments>
1251
1559
  <div slot="other-payments" class="primer-main-list">
1252
- ${this.paymentMethods?.toArray().map(e=>m`
1560
+ ${this.paymentMethods?.toArray().map(e=>p`
1253
1561
  <primer-payment-method
1254
1562
  type=${e.type}
1255
1563
  ></primer-payment-method>
@@ -1259,7 +1567,7 @@ primer-checkout.primer-dark-theme {
1259
1567
  <primer-error-message-container></primer-error-message-container>
1260
1568
  </div>
1261
1569
  `)}
1262
- `}};$e.styles=[S,Yi],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 Ui=g`
1570
+ `}};Ue.styles=[k,ea],n([y({context:st,subscribe:!0}),d()],Ue.prototype,"paymentMethods",2),n([y({context:z,subscribe:!0}),d()],Ue.prototype,"sdkState",2),Ue=n([f("primer-main")],Ue);var ta=h`
1263
1571
  :host {
1264
1572
  height: calc(
1265
1573
  var(--primer-typography-title-large-line-height) +
@@ -1273,10 +1581,10 @@ primer-checkout.primer-dark-theme {
1273
1581
  height: 100%;
1274
1582
  flex: 1;
1275
1583
  }
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 D;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 D;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let i=this.calculateButtonHeight(),s=e.createButton(),c=this.createRenderOptions(i);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,c),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`
1584
+ `;var ke=class extends g{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new R(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return I;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new R(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return I;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),s=e.createButton(),m=this.createRenderOptions(o);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,m),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:()=>p`
1277
1585
  <!-- The native button container is rendered first -->
1278
1586
  <div class="native-button-container" id="${this._buttonId}"></div>
1279
- `,pending:()=>u})}};Me.styles=[S,Ui],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 zi=g`
1587
+ `,pending:()=>u})}};ke.styles=[k,ta],n([d({type:Object})],ke.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0}),d()],ke.prototype,"paymentManagers",2),n([y({context:Ie,subscribe:!0}),d()],ke.prototype,"computedStyles",2),ke=n([f("primer-native-payment")],ke);var _r="card-form-context";var ra=h`
1280
1588
  :host {
1281
1589
  display: contents;
1282
1590
  }
@@ -1299,10 +1607,10 @@ primer-checkout.primer-dark-theme {
1299
1607
  display: flex;
1300
1608
  gap: var(--primer-space-small);
1301
1609
  }
1302
- `;var _e=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 D;let{manager:r}=e,{cardNumberInput:i,expiryInput:s,cvvInput:c}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:i,expiryInput:s,cvvInput:c,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`
1610
+ `;var Te=class extends g{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new j(this,{context:_r,initialValue:null});this.eventsController=new at(this);this.setupCardFormTask=new R(this,{task:async([e])=>{if(!e?.manager)return I;let{manager:r}=e,{cardNumberInput:o,expiryInput:s,cvvInput:m}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:s,cvvInput:m,setCardholderName:C=>r.setCardholderName(C),setCardNetwork:C=>{this.selectedCardNetwork=C},validate:()=>r.validate(),submit:C=>r.submit(C)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),o=r==="button",s=r==="primer-button";return o&&(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 o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===Re.ERROR||this.setupCardFormTask.status===Re.INITIAL?u:p`
1303
1611
  <form @submit=${this.handleFormSubmit}>
1304
1612
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1305
- ${this.setupCardFormTask.render({complete:()=>$(this.hasAssignedContent,()=>u,()=>m`
1613
+ ${this.setupCardFormTask.render({complete:()=>V(this.hasAssignedContent,()=>u,()=>p`
1306
1614
  <div class="card-form">
1307
1615
  <primer-input-card-number></primer-input-card-number>
1308
1616
  <div class="card-form-row">
@@ -1314,7 +1622,7 @@ primer-checkout.primer-dark-theme {
1314
1622
  <primer-card-form-submit></primer-card-form-submit>
1315
1623
  `)})}
1316
1624
  </form>
1317
- `}};_e.styles=[S,zi],n([w()],_e.prototype,"hasAssignedContent",2),n([w()],_e.prototype,"selectedCardNetwork",2),n([C({context:ue,subscribe:!0}),d({type:Object})],_e.prototype,"paymentManagers",2),_e=n([v("primer-card-form"),I()],_e);function Bi(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=`
1625
+ `}};Te.styles=[k,ra],n([T()],Te.prototype,"hasAssignedContent",2),n([T()],Te.prototype,"selectedCardNetwork",2),n([y({context:Z,subscribe:!0}),d({type:Object})],Te.prototype,"paymentManagers",2),Te=n([f("primer-card-form"),L()],Te);function ia(i,t){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
1318
1626
  input[data-custom-input]::placeholder {
1319
1627
  color: var(--primer-color-text-placeholder);
1320
1628
  font-size: var(--primer-typography-body-large-size);
@@ -1323,7 +1631,7 @@ primer-checkout.primer-dark-theme {
1323
1631
  input[data-custom-input]:focus {
1324
1632
  outline: none;
1325
1633
  }
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 Fi(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 D;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):D}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,Bi(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,Fi(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.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===ke.ERROR)return u;let e=this.getError();return m`
1634
+ `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Ar(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 oa(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var Mr=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 R(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 I;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):I}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,ia(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=Ar(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",s=>{this._meta=s,oa(this._meta,s)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var W=class extends g{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:_(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 Mr(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===Re.ERROR)return u;let e=this.getError();return p`
1327
1635
  <primer-input-wrapper
1328
1636
  .focusWithin="${this.hostedInputController.isFocused}"
1329
1637
  .hasError=${!!e}
@@ -1335,13 +1643,13 @@ primer-checkout.primer-dark-theme {
1335
1643
  class="card-input-slot"
1336
1644
  id="${this.config.containerSelector.substring(1)}"
1337
1645
  ></div>
1338
- ${$(e,()=>m`
1646
+ ${V(e,()=>p`
1339
1647
  <primer-input-error slot="error">
1340
- ${P(e,{id:e})}
1648
+ ${_(e,{id:e})}
1341
1649
  </primer-input-error>
1342
1650
  `,()=>u)}
1343
1651
  </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 Ki=g`
1652
+ `}};n([y({context:_r,subscribe:!0})],W.prototype,"cardFormContext",2),n([y({context:Ie,subscribe:!0}),d()],W.prototype,"computedStyles",2),n([d({type:String})],W.prototype,"label",1),n([d({type:String})],W.prototype,"placeholder",1),n([d({type:String,attribute:"aria-label"})],W.prototype,"ariaLabel",1);var aa=h`
1345
1653
  :host {
1346
1654
  display: contents;
1347
1655
  }
@@ -1365,11 +1673,11 @@ primer-checkout.primer-dark-theme {
1365
1673
  align-items: center;
1366
1674
  z-index: 2;
1367
1675
  }
1368
- `;var Ve=g`
1676
+ `;var Ye=h`
1369
1677
  .card-input-slot {
1370
1678
  display: flex;
1371
1679
  }
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`
1680
+ `;var mt=class extends W{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===Re.ERROR)return u;let e=this.getError();return p`
1373
1681
  <primer-input-wrapper
1374
1682
  .focusWithin="${this.hostedInputController.isFocused}"
1375
1683
  .hasError=${!!e}
@@ -1383,29 +1691,29 @@ primer-checkout.primer-dark-theme {
1383
1691
  ></primer-card-network-selector>
1384
1692
  </div>
1385
1693
  </div>
1386
- ${$(e,r=>m`
1694
+ ${V(e,r=>p`
1387
1695
  <primer-input-error slot="error">
1388
- ${P(r,{id:r})}
1696
+ ${_(r,{id:r})}
1389
1697
  </primer-input-error>
1390
1698
  `,()=>u)}
1391
1699
  </primer-input-wrapper>
1392
- `}render(){return this.renderInput()}};lt.styles=[S,Ve,Ki],lt=n([v("primer-input-card-number"),I()],lt);var ji=g`
1700
+ `}render(){return this.renderInput()}};mt.styles=[k,Ye,aa],mt=n([f("primer-input-card-number"),L()],mt);var na=h`
1393
1701
  :host {
1394
1702
  display: contents;
1395
1703
  }
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=[S,Ve,ji],dt=n([v("primer-input-cvv"),I()],dt);var Gi=g`
1704
+ `;var ut=class extends W{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};ut.styles=[k,Ye,na],ut=n([f("primer-input-cvv"),L()],ut);var sa=h`
1397
1705
  :host {
1398
1706
  display: contents;
1399
1707
  }
1400
- `;var pt=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()}};pt.styles=[S,Ve,Gi],pt=n([v("primer-input-card-expiry"),I()],pt);var qi=g`
1708
+ `;var ht=class extends W{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};ht.styles=[k,Ye,sa],ht=n([f("primer-input-card-expiry"),L()],ht);var la=h`
1401
1709
  :host {
1402
1710
  display: contents;
1403
1711
  }
1404
- `;var ct=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()}};ct.styles=[S,Ve,qi],ct=n([v("primer-input-card-holder-name"),I()],ct);var Wi=g`
1712
+ `;var gt=class extends W{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};gt.styles=[k,Ye,la],gt=n([f("primer-input-card-holder-name"),L()],gt);var da=h`
1405
1713
  :host {
1406
1714
  display: contents;
1407
1715
  }
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`
1716
+ `;var pe=class extends g{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:_("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 p`
1409
1717
  <primer-button
1410
1718
  buttonType="submit"
1411
1719
  variant=${this.variant}
@@ -1416,7 +1724,7 @@ primer-checkout.primer-dark-theme {
1416
1724
  >
1417
1725
  ${this.buttonText}${r}
1418
1726
  </primer-button>
1419
- `}};se.styles=[S,Wi],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"),I()],se);var{I:Zf}=xi;var Zi=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)},Xi=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),Rn(t)}};function Nn(o){this._$AN!==void 0?(Er(this),this._$AM=o,Xi(this)):this._$AM=o}function Ln(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 Rn=o=>{o.type==fr.CHILD&&(o._$AP??(o._$AP=Ln),o._$AQ??(o._$AQ=Nn))},xr=class extends st{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Xi(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(Zi(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var po=()=>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 Ji=g`
1727
+ `}};pe.styles=[k,da],n([d({type:String})],pe.prototype,"buttonText",1),n([y({context:G,subscribe:!0}),d({type:Object})],pe.prototype,"headlessInstance",2),n([y({context:Pe,subscribe:!0}),d({type:Object})],pe.prototype,"clientOptions",2),n([y({context:z,subscribe:!0}),d()],pe.prototype,"sdkState",2),n([d({type:String})],pe.prototype,"variant",2),n([d({type:Boolean})],pe.prototype,"disabled",2),pe=n([f("primer-card-form-submit"),L()],pe);var{I:Sy}=Ao;var pa=i=>i.strings===void 0;var Yt=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Yt(r,t);return!0},Sr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},ca=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),Zn(t)}};function qn(i){this._$AN!==void 0?(Sr(this),this._$AM=i,ca(this)):this._$AM=i}function Wn(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)Yt(r[s],!1),Sr(r[s]);else r!=null&&(Yt(r,!1),Sr(r));else Yt(this,i)}var Zn=i=>{i.type==xr.CHILD&&(i._$AP??(i._$AP=Wn),i._$AQ??(i._$AQ=qn))},kr=class extends pt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ca(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Yt(this,t),Sr(this))}setValue(t){if(pa(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 fi=()=>new gi,gi=class{},hi=new WeakMap,Tr=Ut(class extends kr{render(i){return u}update(i,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),u}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=hi.get(t);e===void 0&&(e=new WeakMap,hi.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?hi.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 ma=h`
1420
1728
  :host {
1421
1729
  display: flex;
1422
1730
  align-items: center;
@@ -1536,23 +1844,23 @@ primer-checkout.primer-dark-theme {
1536
1844
  width: var(--primer-size-small);
1537
1845
  height: var(--primer-size-small);
1538
1846
  }
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=po();this.dropdownRef=po();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`
1847
+ `;var ce=class extends g{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=fi();this.dropdownRef=fi();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return p`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return p`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return p`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return p`
1540
1848
  <button
1541
- ${Cr(this.buttonRef)}
1849
+ ${Tr(this.buttonRef)}
1542
1850
  class="network-selector"
1543
1851
  @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}
1852
+ @keydown=${s=>{(s.key===" "||s.key==="Enter")&&o&&(s.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1853
+ aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1854
+ aria-expanded=${o?this.isDropdownOpen:u}
1855
+ aria-haspopup=${o?"true":u}
1856
+ aria-controls=${o?"network-dropdown":u}
1549
1857
  >
1550
1858
  <img
1551
1859
  class="network-icon"
1552
1860
  src=${this.getNetworkIconUrl(r)}
1553
1861
  alt=${r.displayName}
1554
1862
  />
1555
- ${$(i,()=>m`
1863
+ ${V(o,()=>p`
1556
1864
  <primer-icon
1557
1865
  class="caret ${this.isDropdownOpen?"open":""}"
1558
1866
  name="chevron-down"
@@ -1560,23 +1868,23 @@ primer-checkout.primer-dark-theme {
1560
1868
  `,()=>u)}
1561
1869
  </button>
1562
1870
 
1563
- ${$(this.isDropdownOpen,()=>m`
1871
+ ${V(this.isDropdownOpen,()=>p`
1564
1872
  <div
1565
- ${Cr(this.dropdownRef)}
1873
+ ${Tr(this.dropdownRef)}
1566
1874
  id="network-dropdown"
1567
1875
  class="dropdown open"
1568
1876
  role="listbox"
1569
1877
  aria-label="Select card network"
1570
1878
  >
1571
- ${e.map((s,c)=>m`
1879
+ ${e.map((s,m)=>p`
1572
1880
  <div
1573
- ${Cr(x=>this.setNetworkOptionRef(x,c))}
1574
- class="network-option ${this.isKeyboardNavigation&&c===this.focusedNetworkIndex?"focused":""}"
1575
- @click=${x=>this.selectNetwork(x,s)}
1576
- @keydown=${x=>{(x.key==="Enter"||x.key===" ")&&this.selectNetwork(x,s)}}
1881
+ ${Tr(C=>this.setNetworkOptionRef(C,m))}
1882
+ class="network-option ${this.isKeyboardNavigation&&m===this.focusedNetworkIndex?"focused":""}"
1883
+ @click=${C=>this.selectNetwork(C,s)}
1884
+ @keydown=${C=>{(C.key==="Enter"||C.key===" ")&&this.selectNetwork(C,s)}}
1577
1885
  role="option"
1578
1886
  aria-selected=${s.network===r.network}
1579
- tabindex="${c===this.focusedNetworkIndex?"0":"-1"}"
1887
+ tabindex="${m===this.focusedNetworkIndex?"0":"-1"}"
1580
1888
  >
1581
1889
  <img
1582
1890
  class="network-option-icon"
@@ -1584,7 +1892,7 @@ primer-checkout.primer-dark-theme {
1584
1892
  alt=${s.displayName}
1585
1893
  />
1586
1894
  <span class="network-name">${s.displayName}</span>
1587
- ${$(s.network===r.network,()=>m`
1895
+ ${V(s.network===r.network,()=>p`
1588
1896
  <primer-icon
1589
1897
  class="checkmark"
1590
1898
  name="checkmark"
@@ -1594,7 +1902,7 @@ primer-checkout.primer-dark-theme {
1594
1902
  `)}
1595
1903
  </div>
1596
1904
  `,()=>u)}
1597
- `}};le.styles=[S,Ji],n([C({context:Gt,subscribe:!0})],le.prototype,"cardNetworks",2),n([C({context:q,subscribe:!0})],le.prototype,"headlessUtils",2),n([w()],le.prototype,"selectedCardNetwork",2),n([w()],le.prototype,"isDropdownOpen",2),n([w()],le.prototype,"focusedNetworkIndex",2),n([w()],le.prototype,"isKeyboardNavigation",2),le=n([v("primer-card-network-selector")],le);var On=Dr(Ar(),1),mt=Dr(Ar(),1);function mo(o){return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()}function Dn(o){return o?o===o.toUpperCase()?mo(o):o:""}function Qi(o,t){return[o,t].filter(Boolean).join(" ")}function $n(o,t){return!o||!t?"":`Expires ${o}/${t.slice(-2)}`}function ea(o){return o?`\u2022\u2022\u2022\u2022 ${o}`:""}function Vn(o){let t=o.paymentInstrumentData,e=Dn(t.network),r=t.last4Digits,i=`${o.paymentInstrumentData.cardholderName?o.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${ea(r)}`:e)||" Card"}`,s=$n(t.expirationMonth,t.expirationYear);return{description:i,secondaryDescription:s}}function Hn(o){let t=o.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",i=t.externalPayerInfo?.lastName||"",s=o.userDescription||e||"PayPal Account",c=Qi(r,i);return{description:s,secondaryDescription:c}}function Yn(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"),c=Qi(r,i);return{description:s,secondaryDescription:c}}function Un(o){let t=o.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",i=t.accountType||"",s=o.userDescription;s||(r&&e?s=`${r} ${ea(e)}`:r?s=r:s="Bank Account");let c=i?`${mo(i)} Account`:"";return{description:s,secondaryDescription:c}}function zn(o){let t=o.paymentInstrumentType,e=mo(t.replace(/_/g," "));return{description:o.userDescription||e}}var Bn={[mt.PaymentInstrumentType.CARD]:Vn,[mt.PaymentInstrumentType.PAYPAL_VAULTED]:Hn,[mt.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:Yn,[mt.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:Un};function Mr(o){try{let t=Bn[o.paymentInstrumentType];return t?t(o):zn(o)}catch(t){return N.error("FormatUtils",`Error formatting payment method ${o.id}:`,t),{description:o.userDescription||o.id||"Payment Method"}}}var ta=g`
1905
+ `}};ce.styles=[k,ma],n([y({context:Zt,subscribe:!0})],ce.prototype,"cardNetworks",2),n([y({context:G,subscribe:!0})],ce.prototype,"headlessUtils",2),n([T()],ce.prototype,"selectedCardNetwork",2),n([T()],ce.prototype,"isDropdownOpen",2),n([T()],ce.prototype,"focusedNetworkIndex",2),n([T()],ce.prototype,"isKeyboardNavigation",2),ce=n([f("primer-card-network-selector")],ce);var Xn=zr(wr(),1),ft=zr(wr(),1);function yi(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Jn(i){return i?i===i.toUpperCase()?yi(i):i:""}function ua(i,t){return[i,t].filter(Boolean).join(" ")}function Qn(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function ha(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function es(i){let t=i.paymentInstrumentData,e=Jn(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${ha(r)}`:e)||" Card"}`,s=Qn(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:s}}function ts(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",s=i.userDescription||e||"PayPal Account",m=ua(r,o);return{description:s,secondaryDescription:m}}function rs(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",s=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),m=ua(r,o);return{description:s,secondaryDescription:m}}function is(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",s=i.userDescription;s||(r&&e?s=`${r} ${ha(e)}`:r?s=r:s="Bank Account");let m=o?`${yi(o)} Account`:"";return{description:s,secondaryDescription:m}}function os(i){let t=i.paymentInstrumentType,e=yi(t.replace(/_/g," "));return{description:i.userDescription||e}}var as={[ft.PaymentInstrumentType.CARD]:es,[ft.PaymentInstrumentType.PAYPAL_VAULTED]:ts,[ft.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:rs,[ft.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:is};function Pr(i){try{let t=as[i.paymentInstrumentType];return t?t(i):os(i)}catch(t){return P.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var ga=h`
1598
1906
  :host {
1599
1907
  display: block;
1600
1908
  width: 100%;
@@ -1624,7 +1932,7 @@ primer-checkout.primer-dark-theme {
1624
1932
  width: 100%;
1625
1933
  z-index: 1;
1626
1934
  }
1627
- `;var ce=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`
1935
+ `;var he=class extends g{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=_("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:_("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:_("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===e);if(!r)return"";try{return Pr(r).description||""}catch{return""}}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return p`
1628
1936
  <div class="delete-confirmation-container">
1629
1937
  <primer-vault-delete-confirmation
1630
1938
  .isDeleting=${this.isDeleting}
@@ -1634,13 +1942,13 @@ primer-checkout.primer-dark-theme {
1634
1942
  @cancel-delete=${this.handleCancelDelete}
1635
1943
  ></primer-vault-delete-confirmation>
1636
1944
  </div>
1637
- `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:m`
1945
+ `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:p`
1638
1946
  <primer-vault-payment-method-item
1639
1947
  .paymentMethod=${e}
1640
1948
  .isEditMode=${this.isEditMode}
1641
1949
  @delete-payment-method=${this.handleDeletePaymentMethod}
1642
1950
  ></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`
1951
+ `}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=!this.isEditMode&&e&&!r&&!this.deletePaymentMethodId;return p`
1644
1952
  <div class="vault-manager">
1645
1953
  <primer-vault-manager-header
1646
1954
  .isEditMode=${this.isEditMode}
@@ -1648,7 +1956,7 @@ primer-checkout.primer-dark-theme {
1648
1956
  @toggle-edit-mode=${this.handleToggleEditMode}
1649
1957
  ></primer-vault-manager-header>
1650
1958
 
1651
- ${$(this.errorMessage,()=>m`
1959
+ ${V(this.errorMessage,()=>p`
1652
1960
  <primer-vault-error-message
1653
1961
  .errorMessage=${this.errorMessage}
1654
1962
  @close-error=${this.handleCloseError}
@@ -1656,12 +1964,12 @@ primer-checkout.primer-dark-theme {
1656
1964
  `,()=>u)}
1657
1965
 
1658
1966
  <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`
1967
+ ${V(!r&&!e,()=>p`<primer-vault-empty-state></primer-vault-empty-state>`,()=>u)}
1968
+ ${V(!r&&e&&this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>u)}
1969
+ ${V(!r&&e&&!this.deletePaymentMethodId,()=>p`
1662
1970
  <div class="payment-methods-list">
1663
1971
  ${this.vaultManagerContext?.vaultedPaymentMethods.map(s=>this.renderPaymentMethodItem(s))}
1664
- ${$(i,()=>m`
1972
+ ${V(o,()=>p`
1665
1973
  <primer-vault-payment-submit
1666
1974
  @primer-vault-payment-error=${this.handlePaymentError}
1667
1975
  ></primer-vault-payment-submit>
@@ -1670,7 +1978,7 @@ primer-checkout.primer-dark-theme {
1670
1978
  `,()=>u)}
1671
1979
  </div>
1672
1980
  </div>
1673
- `}};ce.styles=[S,ta],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],ce.prototype,"vaultManagerContext",2),n([w()],ce.prototype,"isEditMode",2),n([w()],ce.prototype,"deletePaymentMethodId",2),n([w()],ce.prototype,"isDeleting",2),n([w()],ce.prototype,"errorMessage",2),ce=n([v("primer-vault-manager"),I()],ce);var ra=Dr(Ar(),1);function oa(o){return o.paymentInstrumentType===ra.PaymentInstrumentType.CARD}var ia=g`
1981
+ `}};he.styles=[k,ga],n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1})],he.prototype,"vaultManagerContext",2),n([T()],he.prototype,"isEditMode",2),n([T()],he.prototype,"deletePaymentMethodId",2),n([T()],he.prototype,"isDeleting",2),n([T()],he.prototype,"errorMessage",2),he=n([f("primer-vault-manager"),L()],he);var fa=zr(wr(),1);function va(i){return i.paymentInstrumentType===fa.PaymentInstrumentType.CARD}var ya=h`
1674
1982
  :host {
1675
1983
  display: flex;
1676
1984
  width: 100%;
@@ -1788,36 +2096,36 @@ primer-checkout.primer-dark-theme {
1788
2096
  .delete-button primer-icon {
1789
2097
  color: var(--primer-color-red-500);
1790
2098
  }
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 D;let s="";if(oa(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 c=i.cvvRecapture,x=Mr(e);return{icon:s,shouldShowCVV:c,...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
2099
+ `;var ge=class extends g{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new R(this,{task:async([e,r,o])=>{if(!e||!r||!o)return I;let s="";if(va(e))s=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let v=await r.getCDNAssets(e.paymentMethodType);v&&(s=v.assets?.icon?`${v.goatCdnUrl}/${v.assets.icon}`:"")}let m=o.cvvRecapture,C=Pr(e);return{icon:s,shouldShowCVV:m,...C}},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?p`<img
1792
2100
  class="payment-method-icon"
1793
2101
  src=${e.icon}
1794
2102
  alt=${e.description}
1795
- />`:m`
2103
+ />`:p`
1796
2104
  <div class="payment-method-icon payment-method-icon-generic">
1797
2105
  <primer-icon name="payment-card" size="sm"></primer-icon>
1798
2106
  </div>
1799
- `;return m`
2107
+ `;return p`
1800
2108
  ${r}
1801
2109
  <div class="payment-method-details">
1802
2110
  <div class="payment-method-description">${e.description}</div>
1803
- ${e.secondaryDescription?m`<div class="payment-method-secondary-description">
2111
+ ${e.secondaryDescription?p`<div class="payment-method-secondary-description">
1804
2112
  ${e.secondaryDescription}
1805
2113
  </div>`:u}
1806
2114
  </div>
1807
- `}render(){return this._getAssetsTask.render({error:()=>u,complete:e=>{let r=this.isSelected()?"checked":"default";return this.isEditMode?m`
2115
+ `}render(){return this._getAssetsTask.render({error:()=>u,complete:e=>{let r=this.isSelected()?"checked":"default";return this.isEditMode?p`
1808
2116
  <div class="payment-method-item" @click=${this.handleClick}>
1809
2117
  <div class="payment-method-content">
1810
2118
  ${this.renderPaymentMethodContent(e)}
1811
2119
  <button
1812
2120
  class="delete-button"
1813
2121
  @click=${this.handleDeleteClick}
1814
- aria-label=${`${P("delete",{id:"delete"})} ${e.description}`}
2122
+ aria-label=${`${_("delete",{id:"delete"})} ${e.description}`}
1815
2123
  >
1816
2124
  <primer-icon name="trash" size="sm"></primer-icon>
1817
2125
  </button>
1818
2126
  </div>
1819
2127
  </div>
1820
- `:m`
2128
+ `:p`
1821
2129
  <div class="payment-method-wrapper">
1822
2130
  <primer-button
1823
2131
  variant="secondary"
@@ -1828,11 +2136,11 @@ primer-checkout.primer-dark-theme {
1828
2136
  >
1829
2137
  ${this.renderPaymentMethodContent(e)}
1830
2138
  </primer-button>
1831
- ${$(e.shouldShowCVV&&this.isSelected(),()=>m`<primer-vault-cvv-input
2139
+ ${V(e.shouldShowCVV&&this.isSelected(),()=>p`<primer-vault-cvv-input
1832
2140
  .paymentMethod="${this.paymentMethod}"
1833
2141
  ></primer-vault-cvv-input>`)}
1834
2142
  </div>
1835
- `}})}};me.styles=[S,ia],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"),I()],me);var aa=g`
2143
+ `}})}};ge.styles=[k,ya],n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],ge.prototype,"vaultManagerContext",2),n([y({context:Le,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],ge.prototype,"vaultItemContext",2),n([y({context:G,subscribe:!0}),d({type:Object})],ge.prototype,"headlessUtils",2),n([d({type:Object,attribute:!1})],ge.prototype,"paymentMethod",2),n([d({type:Boolean,reflect:!0})],ge.prototype,"isEditMode",2),ge=n([f("primer-vault-payment-method-item"),L()],ge);var ba=h`
1836
2144
  :host {
1837
2145
  display: block;
1838
2146
  width: 100%;
@@ -1862,21 +2170,21 @@ primer-checkout.primer-dark-theme {
1862
2170
  .edit-button.active {
1863
2171
  color: var(--primer-color-brand);
1864
2172
  }
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`
2173
+ `;var ze=class extends g{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 p`
1866
2174
  <div class="vault-manager-header">
1867
- <h3>${P("previouslyUsed",{id:"previouslyUsed"})}</h3>
2175
+ <h3>${_("previouslyUsed",{id:"previouslyUsed"})}</h3>
1868
2176
 
1869
- ${this.hasPaymentMethods?m`
2177
+ ${this.hasPaymentMethods?p`
1870
2178
  <primer-button
1871
2179
  class="edit-button ${this.isEditMode?"active":""}"
1872
2180
  @click=${this.toggleEditMode}
1873
- aria-label=${this.isEditMode?P("confirm",{id:"confirm"}):P("editPaymentMethods",{id:"editPaymentMethods"})}
2181
+ aria-label=${this.isEditMode?_("confirm",{id:"confirm"}):_("editPaymentMethods",{id:"editPaymentMethods"})}
1874
2182
  >
1875
- ${this.isEditMode?m`<primer-icon name="checkmark" size="sm"></primer-icon>`:m`<primer-icon name="pencil" size="sm"></primer-icon>`}
2183
+ ${this.isEditMode?p`<primer-icon name="checkmark" size="sm"></primer-icon>`:p`<primer-icon name="pencil" size="sm"></primer-icon>`}
1876
2184
  </primer-button>
1877
2185
  `:u}
1878
2186
  </div>
1879
- `}};He.styles=[S,aa],n([d({type:Boolean})],He.prototype,"isEditMode",2),n([d({type:Boolean})],He.prototype,"hasPaymentMethods",2),He=n([v("primer-vault-manager-header"),I()],He);var na=g`
2187
+ `}};ze.styles=[k,ba],n([d({type:Boolean})],ze.prototype,"isEditMode",2),n([d({type:Boolean})],ze.prototype,"hasPaymentMethods",2),ze=n([f("primer-vault-manager-header"),L()],ze);var Ea=h`
1880
2188
  :host {
1881
2189
  display: block;
1882
2190
  width: 100%;
@@ -1947,7 +2255,7 @@ primer-checkout.primer-dark-theme {
1947
2255
  opacity: 0.7;
1948
2256
  cursor: not-allowed;
1949
2257
  }
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`
2258
+ `;var ye=class extends g{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 p`
1951
2259
  <div class="delete-confirmation">
1952
2260
  <div class="delete-message">
1953
2261
  <p class="delete-text">${e}</p>
@@ -1958,18 +2266,18 @@ primer-checkout.primer-dark-theme {
1958
2266
  @click=${this.handleConfirmClick}
1959
2267
  ?disabled=${this.isDeleting}
1960
2268
  >
1961
- ${this.isDeleting?P("deleting",{id:"deleting"}):P("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
2269
+ ${this.isDeleting?_("deleting",{id:"deleting"}):_("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
1962
2270
  </button>
1963
2271
  <button
1964
2272
  class="delete-cancel"
1965
2273
  @click=${this.handleCancelClick}
1966
2274
  ?disabled=${this.isDeleting}
1967
2275
  >
1968
- ${P("cancel",{id:"cancel"})}
2276
+ ${_("cancel",{id:"cancel"})}
1969
2277
  </button>
1970
2278
  </div>
1971
2279
  </div>
1972
- `}};fe.styles=[S,na],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"),I()],fe);var sa=g`
2280
+ `}};ye.styles=[k,Ea],n([d({type:Boolean})],ye.prototype,"isDeleting",2),n([d({type:String})],ye.prototype,"paymentMethodId",2),n([d({type:String})],ye.prototype,"paymentMethodName",2),n([y({context:X,subscribe:!0})],ye.prototype,"vaultManager",2),ye=n([f("primer-vault-delete-confirmation"),L()],ye);var xa=h`
1973
2281
  :host {
1974
2282
  display: block;
1975
2283
  width: 100%;
@@ -1984,13 +2292,13 @@ primer-checkout.primer-dark-theme {
1984
2292
  .empty-state p {
1985
2293
  margin: 0;
1986
2294
  }
1987
- `;var ut=class extends f{render(){return m`
2295
+ `;var vt=class extends g{render(){return p`
1988
2296
  <div class="empty-state">
1989
2297
  <p>
1990
- ${P("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
2298
+ ${_("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
1991
2299
  </p>
1992
2300
  </div>
1993
- `}};ut.styles=[S,sa],ut=n([v("primer-vault-empty-state"),I()],ut);var la=g`
2301
+ `}};vt.styles=[k,xa],vt=n([f("primer-vault-empty-state"),L()],vt);var Ca=h`
1994
2302
  :host {
1995
2303
  display: block;
1996
2304
  width: 100%;
@@ -2036,7 +2344,7 @@ primer-checkout.primer-dark-theme {
2036
2344
  .error-message button:hover {
2037
2345
  background-color: rgba(0, 0, 0, 0.05);
2038
2346
  }
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`
2347
+ `;var et=class extends g{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return p`
2040
2348
  <div class="error-message">
2041
2349
  <div class="error-content">
2042
2350
  <primer-icon
@@ -2048,16 +2356,16 @@ primer-checkout.primer-dark-theme {
2048
2356
  </div>
2049
2357
  <button
2050
2358
  @click=${this.handleDismiss}
2051
- aria-label=${P("closeErrorMessage",{id:"closeErrorMessage"})}
2359
+ aria-label=${_("closeErrorMessage",{id:"closeErrorMessage"})}
2052
2360
  >
2053
2361
  <primer-icon name="close" size="sm"></primer-icon>
2054
2362
  </button>
2055
2363
  </div>
2056
- `}};Ze.styles=[S,la],n([d({type:String})],Ze.prototype,"errorMessage",2),Ze=n([v("primer-vault-error-message"),I()],Ze);var da=g`
2364
+ `}};et.styles=[k,Ca],n([d({type:String})],et.prototype,"errorMessage",2),et=n([f("primer-vault-error-message"),L()],et);var _a=h`
2057
2365
  :host {
2058
2366
  display: contents;
2059
2367
  }
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`
2368
+ `;var Q=class extends g{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async e=>{if(e.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:_("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u;return p`
2061
2369
  <primer-button
2062
2370
  buttonType="submit"
2063
2371
  variant=${this.variant}
@@ -2068,7 +2376,7 @@ primer-checkout.primer-dark-theme {
2068
2376
  >
2069
2377
  ${this.buttonText}${r}
2070
2378
  </primer-button>
2071
- `}};X.styles=[S,da],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"),I()],X);var pa=g`
2379
+ `}};Q.styles=[k,_a],n([d({type:String})],Q.prototype,"buttonText",1),n([y({context:G,subscribe:!0}),d({type:Object})],Q.prototype,"headlessInstance",2),n([y({context:z,subscribe:!0}),d()],Q.prototype,"sdkState",2),n([y({context:Le,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],Q.prototype,"vaultItemContext",2),n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1})],Q.prototype,"vaultManager",2),n([y({context:Pe,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],Q.prototype,"clientOptions",2),n([d({type:String})],Q.prototype,"variant",2),n([d({type:Boolean})],Q.prototype,"disabled",2),Q=n([f("primer-vault-payment-submit"),L()],Q);var Aa=h`
2072
2380
  :host {
2073
2381
  display: block;
2074
2382
  margin-top: var(--primer-space-medium);
@@ -2077,21 +2385,21 @@ primer-checkout.primer-dark-theme {
2077
2385
  .cvv-input-container {
2078
2386
  margin-bottom: var(--primer-space-medium);
2079
2387
  }
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?D:{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 D;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,c={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:s};this.cvvInput=await e.createCvvInput(c),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`
2388
+ `;var ee=class extends g{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new R(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===void 0?I:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new R(this,{task:async([e])=>{if(!e)return I;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=Ar(this.computedStyles),s=o?{input:{base:o}}:void 0,m={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:s};this.cvvInput=await e.createCvvInput(m),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:()=>p`
2081
2389
  <div class="cvv-input-container">
2082
2390
  <primer-input-wrapper
2083
2391
  .hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
2084
2392
  >
2085
2393
  <primer-input-label slot="label">CVV</primer-input-label>
2086
2394
  <div slot="input" id="${this.cvvContainerId}"></div>
2087
- ${$(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>m`
2395
+ ${V(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>p`
2088
2396
  <primer-input-error slot="error">
2089
2397
  ${this.cvvError}
2090
2398
  </primer-input-error>
2091
2399
  `)}
2092
2400
  </primer-input-wrapper>
2093
2401
  </div>
2094
- `})}};J.styles=[S,pa],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([w()],J.prototype,"cvvError",2),n([w()],J.prototype,"cvvInputIsDirty",2),n([w()],J.prototype,"cvvInputIsBlurred",2),n([w()],J.prototype,"cvvInput",2),J=n([v("primer-vault-cvv-input"),I()],J);var ca=g`
2402
+ `})}};ee.styles=[k,Aa],n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],ee.prototype,"vaultManagerFormContext",2),n([y({context:Le,subscribe:!0}),d({type:Object,attribute:!1})],ee.prototype,"vaultManagerCvvContext",2),n([y({context:Ie,subscribe:!0}),d()],ee.prototype,"computedStyles",2),n([d({type:Object})],ee.prototype,"paymentMethod",2),n([T()],ee.prototype,"cvvError",2),n([T()],ee.prototype,"cvvInputIsDirty",2),n([T()],ee.prototype,"cvvInputIsBlurred",2),n([T()],ee.prototype,"cvvInput",2),ee=n([f("primer-vault-cvv-input"),L()],ee);var Ma=h`
2095
2403
  :host {
2096
2404
  display: block;
2097
2405
  margin-top: var(--primer-space-medium);
@@ -2111,12 +2419,12 @@ primer-checkout.primer-dark-theme {
2111
2419
  justify-content: center;
2112
2420
  align-items: center;
2113
2421
  }
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`
2422
+ `;var Fe=class extends g{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?p`<slot name="other-payments"></slot>`:p`
2115
2423
  <div class="other-payment-methods-container">
2116
2424
  <primer-collapsable
2117
2425
  buttonVariant="secondary"
2118
2426
  .expanded="${this.isShowingOtherPayments}"
2119
- .header="${P("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2427
+ .header="${_("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2120
2428
  @expanded-changed="${this.handleExpandedChanged}"
2121
2429
  >
2122
2430
  <div class="other-payment-methods-content">
@@ -2124,24 +2432,24 @@ primer-checkout.primer-dark-theme {
2124
2432
  </div>
2125
2433
  </primer-collapsable>
2126
2434
  </div>
2127
- `}};Ye.styles=[ca],n([w()],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`
2435
+ `}};Fe.styles=[Ma],n([T()],Fe.prototype,"isShowingOtherPayments",2),n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1})],Fe.prototype,"vaultManager",2),Fe=n([f("primer-show-other-payments")],Fe);var Ft=class extends g{render(){return p`
2128
2436
  <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`
2437
+ `}};Ft=n([f("primer-checkout-complete")],Ft);var yt=class extends g{constructor(){super(...arguments);this.sdkState=null}render(){return p`
2130
2438
  <primer-checkout-state
2131
2439
  type="failure"
2132
2440
  description=${this.sdkState?.error?.message||""}
2133
2441
  ></primer-checkout-state>
2134
- `}};n([C({context:j,subscribe:!0}),d()],ht.prototype,"sdkState",2),ht=n([v("primer-checkout-error")],ht);var ma=g`
2442
+ `}};n([y({context:z,subscribe:!0}),d()],yt.prototype,"sdkState",2),yt=n([f("primer-checkout-error")],yt);var Sa=h`
2135
2443
  :host {
2136
2444
  display: block;
2137
2445
  width: 100%;
2138
2446
  }
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`
2447
+ `;var Be=class extends g{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?p`
2140
2448
  <primer-error-message
2141
- message="${P(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2449
+ message="${_(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2142
2450
  ?visible="${this.shouldShowError}"
2143
2451
  ></primer-error-message>
2144
- `:u}};Ue.styles=[ma],n([C({context:j,subscribe:!0}),w()],Ue.prototype,"sdkState",2),n([d({type:Boolean,attribute:"show-processing-errors"})],Ue.prototype,"showProcessingErrors",2),Ue=n([v("primer-error-message-container")],Ue);function Fn(){xt(zo,"primer-css-loader-styles",!1)}function Kn(){Ko()}function Px(){$r()}function Tx(){Vr()}async function wx(){Fn(),Kn()}export{ne as Button,_e as CardForm,dt as CardFormCVV,le as CardFormCardNetworkSelector,lt as CardFormCardNumber,Re as CardFormError,pt as CardFormExpiry,ct as CardFormName,se as CardFormSubmit,re as Collapsable,he as ErrorMessage,Ue as ErrorMessageContainer,hr as InitializedPayments,Y as Input,Le 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,ce as VaultManager,He as VaultManagerHeader,me as VaultPaymentMethodItem,X as VaultPaymentSubmit,Tx as injectDarkTheme,Px as injectLightTheme,Fn as injectLoaderStyles,Kn as injectThemeStyles,wx as loadPrimer};
2452
+ `:u}};Be.styles=[Sa],n([y({context:z,subscribe:!0}),T()],Be.prototype,"sdkState",2),n([d({type:Boolean,attribute:"show-processing-errors"})],Be.prototype,"showProcessingErrors",2),Be=n([f("primer-error-message-container")],Be);async function i_(){No(),Ro()}export{de as AchPayment,le as Button,Te as CardForm,ut as CardFormCVV,ce as CardFormCardNetworkSelector,mt as CardFormCardNumber,$e as CardFormError,ht as CardFormExpiry,gt as CardFormName,pe as CardFormSubmit,oe as Collapsable,ct as Dialog,ue as DynamicPayment,fe as ErrorMessage,Be as ErrorMessageContainer,vr as InitializedPayments,U as Input,De as InputLabel,Me as InputWrapper,ke as NativePayment,He as PaymentMethod,Qe as Portal,Ft as PrimerCheckoutComplete,se as PrimerCheckoutComponent,yt as PrimerCheckoutFailure,Ve as PrimerCheckoutState,Se as PrimerIcon,J as PrimerKlarna,Ue as PrimerMain,ve as RedirectPayment,Fe as ShowOtherPayments,Ae as Spinner,ee as VaultCvvInput,ye as VaultDeleteConfirmation,vt as VaultEmptyState,et as VaultErrorMessage,he as VaultManager,ze as VaultManagerHeader,ge as VaultPaymentMethodItem,Q as VaultPaymentSubmit,Kn as injectDarkTheme,Bn as injectLightTheme,No as injectLoaderStyles,Ro as injectThemeStyles,i_ as loadPrimer};
2145
2453
  /*! Bundled license information:
2146
2454
 
2147
2455
  @lit/context/lib/context-request-event.js: