@primer-io/primer-js 0.1.7 → 0.1.9

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.
Files changed (58) hide show
  1. package/dist/chunks/{ar.5AY75F5J.js → ar.6MRFCKX4.js} +1 -1
  2. package/dist/chunks/{bg.2EL2HTYI.js → bg.HRSMU7Y5.js} +1 -1
  3. package/dist/chunks/{ca.WZI7CBFW.js → ca.3FSHJL7U.js} +1 -1
  4. package/dist/chunks/chunk.I6YWTZRK.js +1 -0
  5. package/dist/chunks/{cs.GBLLNC3E.js → cs.WAO4WFS3.js} +1 -1
  6. package/dist/chunks/{da.CDEFQG44.js → da.4OFYGDVA.js} +1 -1
  7. package/dist/chunks/{de.UHURA2HV.js → de.3FZS52IN.js} +1 -1
  8. package/dist/chunks/{el.BY5NGYDF.js → el.A4R7VG5T.js} +1 -1
  9. package/dist/chunks/en-GB.ILZ7SXSW.js +1 -0
  10. package/dist/chunks/en.7GZJA7MN.js +1 -0
  11. package/dist/chunks/{es-AR.EYNC6EAZ.js → es-AR.QKHDL4JV.js} +1 -1
  12. package/dist/chunks/{es-MX.OIO2YURF.js → es-MX.GG7MJMG2.js} +1 -1
  13. package/dist/chunks/{es.CNNIJYLX.js → es.FEZ6BF3S.js} +1 -1
  14. package/dist/chunks/{et-EE.4ZF6CLB6.js → et-EE.FJLPTMF3.js} +1 -1
  15. package/dist/chunks/{fi-FI.4ZXWRRYI.js → fi-FI.DM5R27A5.js} +1 -1
  16. package/dist/chunks/{fr.TZM5I4K2.js → fr.YZV52NTA.js} +1 -1
  17. package/dist/chunks/{he.DWEZBG4A.js → he.6SCF3XZZ.js} +1 -1
  18. package/dist/chunks/{hr.BV4PC324.js → hr.PPDZ7AAS.js} +1 -1
  19. package/dist/chunks/{hu.MTEKSS3J.js → hu.6WOPSGLW.js} +1 -1
  20. package/dist/chunks/{id.SJSTOPSC.js → id.NS22WGWL.js} +1 -1
  21. package/dist/chunks/{it.IISTMHN5.js → it.42TO3R4G.js} +1 -1
  22. package/dist/chunks/{ja.IBQ3ID5C.js → ja.UEGHEUAP.js} +1 -1
  23. package/dist/chunks/{ko.KZVQLI4V.js → ko.HTMDY6RY.js} +1 -1
  24. package/dist/chunks/{lt-LT.RKBB7CZ6.js → lt-LT.4U3GBQTQ.js} +1 -1
  25. package/dist/chunks/{lt.TLM7OCXP.js → lt.73ME4TDM.js} +1 -1
  26. package/dist/chunks/{lv-LV.H5TJC2T4.js → lv-LV.JRWO2BF6.js} +1 -1
  27. package/dist/chunks/{lv.G4SRVBAC.js → lv.KROS45TV.js} +1 -1
  28. package/dist/chunks/{ms.ATTITA66.js → ms.HE3SWJFQ.js} +1 -1
  29. package/dist/chunks/{nb.5EE7XOA7.js → nb.TR6TEKBY.js} +1 -1
  30. package/dist/chunks/{nl.TY2SYTKZ.js → nl.V5QP6OXL.js} +1 -1
  31. package/dist/chunks/{nl_NL.GB5BQ5PG.js → nl_NL.FCVWIF3Y.js} +1 -1
  32. package/dist/chunks/{pl.5PRBSG4K.js → pl.DQZDG7LR.js} +1 -1
  33. package/dist/chunks/{pt-BR.5XRZB5WW.js → pt-BR.CR4ROBVE.js} +1 -1
  34. package/dist/chunks/{pt.TA5H5JUJ.js → pt.JRWVFJPX.js} +1 -1
  35. package/dist/chunks/{ro.PSZKGHRP.js → ro.NRMWYY3F.js} +1 -1
  36. package/dist/chunks/{ru.3QZY7ZIT.js → ru.OWSKHXVO.js} +1 -1
  37. package/dist/chunks/{sk.FAQFYLGM.js → sk.YGBRNNWT.js} +1 -1
  38. package/dist/chunks/{sl.QRSCQXJP.js → sl.IRTDTNTP.js} +1 -1
  39. package/dist/chunks/{sr-RS.TKMMG7FK.js → sr-RS.AWGLHKVE.js} +1 -1
  40. package/dist/chunks/{sv.HZ3E6V5F.js → sv.O4BXFGNF.js} +1 -1
  41. package/dist/chunks/{th.AY6M42B4.js → th.GZCEBRT2.js} +1 -1
  42. package/dist/chunks/{tr.TFKBPYMO.js → tr.ZDILMEEO.js} +1 -1
  43. package/dist/chunks/{uk-UA.3TU67RSI.js → uk-UA.JUUBOEW3.js} +1 -1
  44. package/dist/chunks/{vi.NLXELMXV.js → vi.IN7CFTLL.js} +1 -1
  45. package/dist/chunks/zf.YT47ULXR.js +1 -0
  46. package/dist/chunks/{zh-CN.VEOQJ3EU.js → zh-CN.RBRAS4RP.js} +1 -1
  47. package/dist/chunks/{zh-HK.ZEXSW7FF.js → zh-HK.4CK7LBWM.js} +1 -1
  48. package/dist/chunks/{zh-TW.MMVWEQMZ.js → zh-TW.374TMWNJ.js} +1 -1
  49. package/dist/custom-elements.json +1477 -1342
  50. package/dist/primer-loader.d.ts +815 -741
  51. package/dist/primer-loader.js +923 -922
  52. package/dist/primer-react-wrappers.js +387 -386
  53. package/dist/web-types.json +1 -1
  54. package/package.json +9 -1
  55. package/dist/chunks/chunk.G45OCYEN.js +0 -1
  56. package/dist/chunks/en-GB.UBLLAUVW.js +0 -1
  57. package/dist/chunks/en.BKAVPUID.js +0 -1
  58. package/dist/chunks/zf.U5XPENNR.js +0 -1
@@ -1,11 +1,10 @@
1
- import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs((je,$i)=>{(function(i,t){typeof je=="object"&&typeof $i=="object"?$i.exports=t():typeof define=="function"&&define.amd?define([],t):typeof je=="object"?je.Primer=t():i.Primer=t()})(je,()=>(()=>{"use strict";let i;var t,e,r={};r.d=(a,d)=>{for(var c in d)r.o(d,c)&&!r.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:d[c]})},r.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>js,PaymentFlow:()=>zs,PrimerClientError:()=>sr,ThreeDSecureStatus:()=>Bs,TokenType:()=>Ks,isStripeOptionsDropInWithFullMandateText:()=>qs,PaymentInstrumentType:()=>Pe,ErrorCode:()=>Gs,EventTypes:()=>Ws,CheckoutUXFlow:()=>Fs,HeadlessManagerType:()=>Zs,PaymentMethodType:()=>we,Primer:()=>Xs});let s={LEGACY:"legacy",V_2_4:"2.4"},l=s.V_2_4,f=l;class m extends Error{static from(d,c=!1){if(d instanceof m)return d;let E=new m(d instanceof Error?d.message:String(d),c);return d instanceof Error&&d.stack&&(E.stack=d.stack,Object.assign(E,d)),E}markAsReported(){this.isReported=!0}constructor(d,c=!1){super(d),function(E,x,C){x in E?Object.defineProperty(E,x,{value:C,enumerable:!0,configurable:!0,writable:!0}):E[x]=C}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let _="https://analytics.production.data.primer.io/sdk-logs";var w=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),A=function(a){return a.START="START",a.END="END",a}({});let O={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var H=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 ht(){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 ps={get(a,d){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.6";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||d}}.get("PRIMER_SDK_VERSION");async function Ki(a,d,c){return{...c,createdAt:Date.now(),device:await ht(),eventType:a,properties:d,sdkVersion:ps,sdkType:"WEB"}}let Gi=Symbol.for("__primerAnalytics__"),xe={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[Gi];a?xe=a:window[Gi]=xe}let ji=()=>xe.providers,ti=()=>xe.timers,Se=()=>xe.eventsQueue,rr=new Map;function ei(a,d=!1,c=1){rr.has(a)&&(clearTimeout(rr.get(a)),rr.delete(a));let E=()=>{let C=Se().get(a);if(C?.length){let b=!0,S=[],L=0,M=0;for(;M<C.length;){let D=C[M],F=new Blob([JSON.stringify(D)]).size;if(F>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",D),M++;continue}if(L+F>64e3&&S.length>0){try{b=navigator.sendBeacon(a,JSON.stringify(S))}catch(B){b=!1,console.error("Unable to send events",B)}if(!b)break;S=[],L=0}S.push(D),L+=F,M++}if(S.length>0&&b)try{b=navigator.sendBeacon(a,JSON.stringify(S))}catch(D){b=!1,console.error("Unable to send events",D)}b?Se().delete(a):c<5?setTimeout(()=>ei(a,d,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(d)return void E();let x=setTimeout(E,500);rr.set(a,x)}let qi=!1;function ri({url:a=_,...d}){typeof document>"u"||qi||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let x=ne(d.checkoutSessionId);x.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),ei(x.url,!0)}}),qi=!0);let c=x=>async C=>{if(typeof navigator>"u")return;let b=function L(M,D,F=new WeakSet,B=0,lt=10){if(B>lt||F.has(M))return M;F.add(M);let dt=rt=>typeof rt=="object"&&rt!==null?L(rt,D,F,B+1,lt):D(rt);return Array.isArray(M)?M.map(dt):Object.fromEntries(Object.entries(M).map(([rt,de])=>[rt,dt(de)]))}(await Ki(x,C,d),L=>{var M;return typeof(M=typeof L=="function"?L.name||"function":L)=="string"&&M.length>5120?`${M.slice(0,5120)}...`:M});Se().has(a)||Se().set(a,[]),Se().get(a)?.push(b),ei(a)},E={crashEvent:c(H.CRASH_EVENT),messageEvent:c(H.MESSAGE_EVENT),networkCallEvent:c(H.NETWORK_CALL_EVENT),sdkFunctionEvent:c(H.SDK_FUNCTION_EVENT),timerStart:({id:x,...C})=>{let b=`${d.checkoutSessionId}|${x}`,S=performance?.now?performance.now():Date.now();return ti().set(b,{start:S}),c(H.TIMER_EVENT)({...C,id:x,timerType:A.START})},timerEnd:({id:x,...C})=>{let b=`${d.checkoutSessionId}|${x}`,{start:S}=ti().get(b)??{};ti().delete(b);let L=performance?.now?performance.now():Date.now();return c(H.TIMER_EVENT)({...C,id:x,timerType:A.END,duration:S?L-S:void 0})},v1Event:c(H.V1_EVENT),url:a};return ji().set(d.checkoutSessionId,E),ne(d.checkoutSessionId)}function ne(a){return new Proxy({},{get:(d,c)=>(ji().get(a)??ri({checkoutSessionId:a}))[c]})}let ii=(a,d,c,E)=>({callType:c?w.REQUEST_END:w.REQUEST_START,id:a,errorBody:c?.error&&JSON.stringify(c.error,Object.getOwnPropertyNames(c.error)),method:d.method,responseCode:c?.status,url:d.url,duration:E});function ms(a){return a?new Promise(d=>{setTimeout(d,a)}):Promise.resolve()}async function Wi(a,d,c,E=ms){let x=0,C={enabled:d?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!C.enabled)return a();for(;;)try{let b=await a();if(x){let S=`Request succeeded after ${x} retries.`;typeof b=="object"&&b&&"status"in b&&(S+=` Status code: ${b.status}`),c?.({messageType:"RETRY_SUCCESS",message:S,severity:"INFO"})}return b}catch(b){let S=x>=C.maxRetries,L=b.isNetworkError&&!C.retryNetworkErrors,M=b.status&&b.status>=500&&!C.retry500Errors;if(S||L||M){let B=`Failed after ${x} retries. `;throw S?B+=`Reached maximum retries (${C.maxRetries}).`:L?B+="Network error encountered and retryNetworkErrors is disabled.":M&&(B+="HTTP 500 error encountered and retry500Errors is disabled."),B+=` Last error: ${b.message}`,c?.({messageType:"RETRY_FAILED",message:B,severity:"ERROR",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),Error(B,{cause:b})}x++;let D=Math.min(C.initialBackoff*Math.pow(2,x-1)+Math.random()*C.maxJitter,Number.MAX_SAFE_INTEGER),F="Unknown error";b.isNetworkError?F="Network error":b.status&&(F=`HTTP ${b.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${x}/${C.maxRetries} due to: ${F}. Error details: ${b.message}. Waiting for ${D.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),await E(D)}}let oi={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=oi),oi=window.__primerCache__);let et=()=>oi.cache;function Zi(){if(et().size<=30)return;let a=Date.now();for(let[d,c]of et())c.exp<a&&et().delete(d);if(et().size>50)for(let[d]of et()){if(et().size<=50)break;et().delete(d)}}let ai=()=>Xi.randomUUID?.()||hs(),hs=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^us()>>a/4).toString(16)),us=()=>(Xi.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,Xi=typeof crypto<"u"?crypto:{},fs=(a,d,c)=>gs(a,"get",d,c),gs=async(a,d,c,E,x)=>{let C=ai(),b=performance?.now(),S=ne(a),L={method:d,url:c,body:x};S.networkCallEvent(ii(C,L));try{let M=await fetch(c,{body:x,method:d,headers:{"content-type":"application/json","x-request-id":C,...E}});if(!M.ok){let B=Error(`HTTP error! status: ${M.status}`);throw B.status=M.status,B}let D=await M.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:B,clientSession:{clientSessionId:lt,customer:dt}}=D;S=ri({checkoutSessionId:a,clientSessionId:lt,customerId:dt?.customerId,primerAccountId:B,url:S.url})}let F=performance?.now();return S.networkCallEvent(ii(C,L,{data:D},F-b)),{data:D,headers:M.headers,status:M.status,source:"NETWORK"}}catch(M){let D=performance?.now();throw Object.assign(M,{isNetworkError:M instanceof TypeError}),S.networkCallEvent(ii(C,L,{error:M},D-b)),M}},ys=(a,d)=>new Promise((c,E)=>{let x=setTimeout(()=>{let C=Error("Request timed out");C.isNetworkError=!0,E(C)},d);a.then(c).catch(E).finally(()=>clearTimeout(x))}),vs=(a,d)=>{let{headers:c,retryConfig:E,cacheConfig:x,timeout:C=15e3,checkoutSessionId:b}=d,S=ne(b);return function(L){if(!L)return lt=>lt();let{key:M,refresh:D=!1,usePrimerSessionCacheTtlHeader:F=!1,ttl:B=36e5}=L;return async lt=>{let dt=Date.now(),rt=et().get(M);if(!D&&rt&&rt.exp>dt)return rt.promise;rt&&et().delete(M);let de=lt().then(Te=>{let yo=B;return F&&(yo=1e3*(Number(Te.headers.get("x-primer-session-cache-ttl"))||0)),function({key:vo,ttl:bo=36e5},Js){bo?et().set(vo,{promise:Promise.resolve({...Js,source:"CACHE"}),exp:Date.now()+bo}):et().delete(vo)}({key:M,ttl:yo},Te),Zi(),Te},Te=>{throw et().delete(M),Te});return et().set(M,{promise:de,exp:dt+B}),Zi(),de}}(x)(()=>Wi(()=>ys(fs(b,a,c),C),E,L=>S.messageEvent({...L,url:a})))},le=typeof Buffer=="function",Ji=typeof TextDecoder=="function"?new TextDecoder:void 0,Qi=typeof TextEncoder=="function"?new TextEncoder:void 0,Me=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),ir=(a=>{let d={};return a.forEach((c,E)=>d[c]=E),d})(Me),bs=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,j=String.fromCharCode.bind(String),to=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),eo=a=>a.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),ro=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),io=typeof btoa=="function"?a=>btoa(a):le?a=>Buffer.from(a,"binary").toString("base64"):a=>{let d,c,E,x,C="",b=a.length%3;for(let S=0;S<a.length;){if((c=a.charCodeAt(S++))>255||(E=a.charCodeAt(S++))>255||(x=a.charCodeAt(S++))>255)throw TypeError("invalid character found");C+=Me[(d=c<<16|E<<8|x)>>18&63]+Me[d>>12&63]+Me[d>>6&63]+Me[63&d]}return b?C.slice(0,b-3)+"===".substring(b):C},si=le?a=>Buffer.from(a).toString("base64"):a=>{let d=[];for(let c=0,E=a.length;c<E;c+=4096)d.push(j.apply(null,a.subarray(c,c+4096)));return io(d.join(""))},ld=(a,d=!1)=>d?eo(si(a)):si(a),Es=a=>{if(a.length<2){var d=a.charCodeAt(0);return d<128?a:d<2048?j(192|d>>>6)+j(128|63&d):j(224|d>>>12&15)+j(128|d>>>6&63)+j(128|63&d)}var d=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return j(240|d>>>18&7)+j(128|d>>>12&63)+j(128|d>>>6&63)+j(128|63&d)},Cs=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,As=a=>a.replace(Cs,Es),oo=le?a=>Buffer.from(a,"utf8").toString("base64"):Qi?a=>si(Qi.encode(a)):a=>io(As(a)),_s=(a,d=!1)=>d?eo(oo(a)):oo(a),xs=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ss=a=>{switch(a.length){case 4:var d=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return j((d>>>10)+55296)+j((1023&d)+56320);case 3:return j((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return j((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Ms=a=>a.replace(xs,Ss),ao=typeof atob=="function"?a=>atob(ro(a)):le?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!bs.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let d,c="",E,x;for(let C=0;C<a.length;)d=ir[a.charAt(C++)]<<18|ir[a.charAt(C++)]<<12|(E=ir[a.charAt(C++)])<<6|(x=ir[a.charAt(C++)]),c+=E===64?j(d>>16&255):x===64?j(d>>16&255,d>>8&255):j(d>>16&255,d>>8&255,255&d);return c},so=le?a=>to(Buffer.from(a,"base64")):a=>to(ao(a).split("").map(d=>d.charCodeAt(0))),dd=a=>so(no(a)),Ps=le?a=>Buffer.from(a,"base64").toString("utf8"):Ji?a=>Ji.decode(so(a)):a=>Ms(ao(a)),no=a=>ro(a.replace(/[-_]/g,d=>d=="-"?"+":"/")),ws=a=>Ps(no(a)),cd=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),lo={encode:_s,decode:ws},Ts={encode:function(a,d={}){let{urlSafe:c=!1}=d;return lo.encode(a,c)},decode:lo.decode},co="The provided `clientToken`",ks=`${co} has expired`,Ns=`${co} is malformed`,Is=(a,d,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.6","primer-sdk-checkout-session-id":d,...c&&{"x-api-version":c}});async function Ls(a,d,c){let{accessToken:E,configurationUrl:x,analyticsUrlV2:C}=function(M){let D=function(B){try{let[lt,dt]=B.split(".");return JSON.parse(Ts.decode(dt||lt))}catch{throw Error(Ns)}}(M),F=1e3*D.exp;if(Date.now()>F)throw Error(`${ks}. Expiration date: ${new Date(F).toISOString()}`);return D}(a),b=ri({checkoutSessionId:d,url:C}),S=f,L=S!==s.LEGACY?S:"2.3";b.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:M,source:D}=await vs(`${x}/?withDisplayMetadata=true`,{checkoutSessionId:d,headers:Is(E,d,L),retryConfig:{enabled:!0},cacheConfig:c});return b.timerEnd({id:"CONFIGURATION_LOADING",context:{source:D}}),M}catch(M){let D=M instanceof Error?M.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${D}`)}}function po(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 or({checkoutSessionId:a,analytics:d,error:c,reporter:E}){d?.crashEvent?d.crashEvent({...po(c),reporter:E}):a&&ni(a,c,E)}async function ni(a,d,c){let E=await Ki(H.CRASH_EVENT,{...po(d),reporter:c},{checkoutSessionId:a});try{await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})}catch(x){console.error("Failed to post crash event",x)}}let mo=Symbol.for("initGlobalErrorMonitoringLoaded"),ho=(a,d)=>{typeof window<"u"&&window[mo]||(window[mo]=!0,window.addEventListener("error",c=>{!Rs(c)&&$s(c)&&or({checkoutSessionId:a,analytics:d,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let E=c.reason||Error("Unhandled promise rejection");Os(E)&&or({checkoutSessionId:a,analytics:d,error:E,reporter:"unhandledrejection"})}))},Rs=a=>a.message==="Script error."||!a.filename||a.lineno===0,$s=a=>{let d=a.filename;return!!(d&&li(d))&&!!new m(a.error).isReported||!1},Os=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let d=m.from(a);return!d.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&li(a.fileName))||Ds(d.stack).some(li))}return!1},li=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ds=a=>{if(!a)return[];let d=a.split(`
2
- `),c=[],E=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let x of d){let C=x.match(E);if(C&&C[1])c.push(C[1]);else{let b=/@(.*?):\d+:\d+$/,S=x.match(b);S&&S[1]&&c.push(S[1])}}return c};function uo(a,d,c){return document.querySelector(`${a}[${d}^="${c}"]`)}async function fo(a,d,c,E,x,C){let{analytics:b,name:S=d,retryConfig:L}=C;await Wi(()=>new Promise((M,D)=>{let F=uo(a,c,d)||function(B,lt){let dt=document.createElement(B);return Object.entries(lt).forEach(([rt,de])=>dt.setAttribute(rt,de)),dt}(a,{...E,[c]:d});F.onload=()=>{b?.sdkFunctionEvent({name:S,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${d}`]}),M()},F.onerror=()=>{F.remove(),D(Error(`${x}: ${d}`))},F.parentNode||document.head.appendChild(F)}),L,M=>b?.messageEvent({...M,url:d}))}async function go(a){return i||(i=Promise.all([function(d,c={}){return uo("script","src",d)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??d,params:["Script already loaded"]}),Promise.resolve()):fo("script",d,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.6/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(d,c={}){return Array.from(document.styleSheets).some(E=>E.href===d)?(c.analytics?.sdkFunctionEvent({name:c.name??d,params:["Stylesheet already loaded"]}),Promise.resolve()):fo("link",d,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.6/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let d=window.__Primer;return delete window.__Primer,d}).catch(d=>{throw i=void 0,d}))}let Vs=async()=>{let a=ai();try{let d=ne(a);try{ho(a,d),d.sdkFunctionEvent({name:"preloadPrimer"}),d.timerStart({id:O.preloadPrimer}),await go(d),d.timerEnd({id:O.preloadPrimer})}catch(c){let E=m.from(c);throw E.isReported||(or({checkoutSessionId:a,analytics:d,error:E,reporter:"preloadPrimer level 1"}),E.markAsReported()),E}}catch(d){let c=m.from(d);throw c.isReported||(ni(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},Hs=di("createHeadless"),Us=di("showUniversalCheckout"),Ys=di("showVaultManager");function di(a){return async(...[d,c,...E])=>{var x;(x=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${l}'.`),f=x??l;let C=ai();try{let b=ne(C);try{ho(C,b),b.sdkFunctionEvent({name:a,params:[d,c,...E]}),b.timerStart({id:O[a]});let[S,L]=await Promise.all([Ls(d,C,c?.clientSessionCachingEnabled?{key:d,usePrimerSessionCacheTtlHeader:!0}:void 0),go(b)]);return L[a](S,C,d,c,...E)}catch(S){let L=m.from(S);throw L.isReported||(or({checkoutSessionId:C,analytics:b,error:L,reporter:"lazyLoad level 1"}),L.markAsReported()),L}}catch(b){let S=m.from(b);throw S.isReported||(ni(C,S,"lazyLoad level 0"),S.markAsReported()),S}}}var Fs=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),zs=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),Bs=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let Pe={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"},we={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"},Ks={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};Pe.PAYPAL_VAULTED,we.PAYPAL,Pe.KLARNA_CUSTOMER_TOKEN,we.KLARNA,Pe.AUTOMATED_CLEARING_HOUSE,we.STRIPE_ACH,Pe.CARD,we.PAYMENT_CARD;var Gs=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 ar(a,d,c){return d in a?Object.defineProperty(a,d,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[d]=c,a}class sr extends m{static fromErrorCode(d,c){return new sr(d,c)}constructor(d,c){super(c.message),ar(this,"code",void 0),ar(this,"diagnosticsId",void 0),ar(this,"data",void 0),ar(this,"isFromDeveloper",void 0),this.code=d,this.diagnosticsId=c.diagnosticsId??null,this.data=c.data,this.isFromDeveloper=c.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,sr)}}var js=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let qs=a=>{let d=a?.mandateData;return!!d&&"fullMandateText"in d};var Ws=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}({}),Zs=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let Xs={SDK_VERSION:"v2.53.6",createHeadless:Hs,showUniversalCheckout:Us,showVaultManager:Ys,preloadPrimer:Vs};return o})())});import{createComponent as Nn}from"@lit/react";import In from"react";var nr=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 ce=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchOnCheckoutComplete(t){this.dispatchEvent("primer-oncheckout-complete",{payment:t})}dispatchOnCheckoutFailure(t,e){this.dispatchEvent("primer-oncheckout-failure",{error:t,payment:e})}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var Lt=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 pe=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(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,l)),this.unsubscribe=l},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 Lt(this.context,this.host,this.t,this.subscribe))}};var lr=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 ci=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},q=class extends lr{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[l,{consumerHost:f}]of this.subscriptions)s.has(l)||(s.add(l),f.dispatchEvent(new Lt(this.context,f,l,!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 ci(this.context,this.host))}};function P({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new pe(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new pe(o,{context:i,callback:s=>{o[r]=s},subscribe:t})})}}var dr="cardNetworksContext";var me="clientOptionsContext";var he="computedStylesContext";var ct="headlessInstanceContext";var cr="klarnaCategoriesContext";var Q="managerContext";var ue="paymentMethodsContext";var G="sdkStateContext";var fe="vaultManagerContext";var Ao="vaultManagerCvvContext";var k=class k{static log(t,...e){k.enabled&&console.log(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.log,...e)}static info(t,...e){k.enabled&&console.info(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.info,...e)}static warn(t,...e){k.enabled&&console.warn(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.warn,...e)}static error(t,...e){k.enabled&&console.error(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.error,...e)}static debug(t,...e){k.enabled&&console.debug(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.debug,...e)}static table(t,e){k.enabled&&console.table(t,e)}static time(t){k.enabled&&console.time(`${k.brandTag} ${t}`)}static timeEnd(t){k.enabled&&console.timeEnd(`${k.brandTag} ${t}`)}};k.enabled=!0,k.defaultFont="font-family: Consolas, monospace; font-size: 12px;",k.brandTag="[PRIMER]",k.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+k.defaultFont,k.styles={log:"color: #4CAF50; "+k.defaultFont,info:"color: #2196F3; "+k.defaultFont,warn:"color: #FF9800; "+k.defaultFont,error:"color: #F44336; "+k.defaultFont,debug:"color: #9C27B0; "+k.defaultFont};var N=k;function tn(i,t,e,r){let o=i,s=e;return{dispatch:l=>{let f=t(o,l,s);o=f,r(f)},getState:()=>Object.freeze({...o}),setCallbacks:l=>{s={...s,...l}}}}function ke(i){return(t,e,r)=>{let o=i[e.type];if(!o)throw new Error(`No handler for action type: ${e.type}`);return o(t,e,r)}}var Yt=class{constructor(t,e,r,o,s=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=s;this.host.addController(this),this._dispatcher=tn(e,r,o,l=>{this.stateHandler(l)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},pr=class{constructor(t){this.host=t;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(t){this._controllers.push(t)}hostConnected(){this._controllers.forEach(t=>{t.hostConnected&&t.hostConnected()})}hostDisconnected(){this._controllers.forEach(t=>{t.hostDisconnected&&t.hostDisconnected()})}};var hr={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},en={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,t)=>(N.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>hr,RESET_ERROR:i=>({...i,error:null,failure:null})},rn=ke(en),mr=class extends Yt{constructor(t){super(t,hr,rn,null,e=>{t.sdkContextController.setSdkState(e),t.primerEventsController.dispatchSdkState(e)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(N.warn("Force completing loading state"),this.completeLoading())}};var ur=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 q(t,{context:G,initialValue:hr}),this.paymentMethodsProvider=new q(t,{context:ue,initialValue:null}),this.paymentManagerProvider=new q(t,{context:Q,initialValue:new Map}),this.cardNetworksContext=new q(t,{context:dr,initialValue:null}),this.vaultManagerProvider=new q(t,{context:fe,initialValue:null}),this.vaultManagerCvvProvider=new q(t,{context:Ao,initialValue:null}),this.clientOptionsContext=new q(t,{context:me,initialValue:null}),this.klarnaCategoriesProvider=new q(t,{context:cr,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new q(t,{context:ct,initialValue:null}),this.computedStylesProvider=new q(t,{context:he,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 Ft=class Ft{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=Ft.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ft.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)){N.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 Ft.cssVarCache.keys()){let e=Ft.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Ft.cssVarCache=new Map;var fr=Ft;var gr=globalThis,yr=gr.ShadowRoot&&(gr.ShadyCSS===void 0||gr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pi=Symbol(),_o=new WeakMap,Ne=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==pi)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(yr&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=_o.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&_o.set(e,t))}return t}toString(){return this.cssText}},xo=i=>new Ne(typeof i=="string"?i:i+"",void 0,pi),g=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,s)=>r+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[s+1],i[0]);return new Ne(e,i,pi)},mi=(i,t)=>{if(yr)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=gr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},vr=yr?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return xo(e)})(i):i;var{is:on,defineProperty:an,getOwnPropertyDescriptor:sn,getOwnPropertyNames:nn,getOwnPropertySymbols:ln,getPrototypeOf:dn}=Object,Rt=globalThis,So=Rt.trustedTypes,cn=So?So.emptyScript:"",pn=Rt.reactiveElementPolyfillSupport,Ie=(i,t)=>i,Le={toAttribute(i,t){switch(t){case Boolean:i=i?cn: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}},ge=(i,t)=>!on(i,t),Mo={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:ge};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Rt.litPropertyMetadata??(Rt.litPropertyMetadata=new WeakMap);var Ct=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=Mo){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&&an(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:s}=sn(this.prototype,t)??{get(){return this[e]},set(l){this[e]=l}};return{get(){return o?.call(this)},set(l){let f=o?.call(this);s.call(this,l),this.requestUpdate(t,f,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Mo}static _$Ei(){if(this.hasOwnProperty(Ie("elementProperties")))return;let t=dn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ie("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ie("properties"))){let e=this.properties,r=[...nn(e),...ln(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(vr(o))}else t!==void 0&&e.push(vr(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 mi(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:Le).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),l=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Le;this._$Em=o,this[o]=l.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??ge)(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){}};Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},Ct[Ie("elementProperties")]=new Map,Ct[Ie("finalized")]=new Map,pn?.({ReactiveElement:Ct}),(Rt.reactiveElementVersions??(Rt.reactiveElementVersions=[])).push("2.0.4");var $t={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},R=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 o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Po,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(l){s=!0,r=l}if(this.p===o){if(e===R)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)}}},Po=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!ge(e,t[r]));var mn={SET_LOADING:(i,t)=>({...i,isLoading:t.payload}),SET_UPDATING:(i,t)=>({...i,isUpdating:t.payload}),INITIALIZE_VAULT_MANAGER:(i,t,e)=>({...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,t)=>({...i,vaultedPaymentMethods:t.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>wo},hn={INITIALIZE_CVV:(i,t,e)=>({...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,t)=>({...i,formIsDirty:t.payload}),SET_CVV_INPUT:(i,t)=>({...i,cvvInput:t.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,t)=>({...i,selectedVaultedPaymentMethod:t.payload}),RESET_CVV:()=>To},un=ke(mn),fn=ke(hn),wo={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},To={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},hi=class extends Yt{constructor(t,e){super(t,wo,un,e,r=>{t.sdkContextController.setVaultManager(r)})}setLoading(t){this.dispatch({type:"SET_LOADING",payload:t})}setUpdating(t){this.dispatch({type:"SET_UPDATING",payload:t})}initializeVaultManager(t,e,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:t,vaultEnabled:e,cvvRecapture:r})}updatePaymentMethods(t){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:t})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},ui=class extends Yt{constructor(t,e){super(t,To,fn,e,r=>{t.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(t){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:t})}setFormDirty(t){this.dispatch({type:"SET_FORM_DIRTY",payload:t})}setCvvInputState(t){this.dispatch({type:"SET_CVV_INPUT",payload:t})}setSelectedPaymentMethod(t){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},Re=class extends pr{constructor(e){super(e);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(e),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=e=>{this.itemController.setCvvInputState(e)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let e=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!e||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(e.id,r?{cvv:o.valueToken}:void 0)}catch(s){N.error("VaultManagerController: Error starting vaulted payment flow",s),this.coreController.setError(s instanceof Error?s:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new hi(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new ui(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new V(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),R;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),N.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(s){N.error("VaultManagerController: Failed to initialize vault",s),this.coreController.setError(s instanceof Error?s:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return N.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)}};var $e="lit-localize-status";var ko=i=>typeof i!="string"&&"strTag"in i,br=(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 Oe=i=>ko(i)?br(i.strings,i.values):i;var T=Oe,No=!1;function fi(i){if(No)throw new Error("lit-localize can only be configured once");T=i,No=!0}var gi=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener($e,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener($e,this.__litLocalizeEventHandler)}},gn=i=>i.addController(new gi(i)),Io=gn;var z=()=>(i,t)=>(i.addInitializer(Io),i);var De=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var At=[];for(let i=0;i<256;i++)At[i]=(i>>4&15).toString(16)+(i&15).toString(16);function Lo(i){let t=0,e=8997,r=0,o=33826,s=0,l=40164,f=0,m=52210;for(let _=0;_<i.length;_++)e^=i.charCodeAt(_),t=e*435,r=o*435,s=l*435,f=m*435,s+=e<<8,f+=o<<8,r+=t>>>16,e=t&65535,s+=r>>>16,o=r&65535,m=f+(s>>>16)&65535,l=s&65535;return At[m>>8]+At[m&255]+At[l>>8]+At[l&255]+At[o>>8]+At[o&255]+At[e>>8]+At[e&255]}var yn="",vn="h",bn="s";function Ro(i,t){return(t?vn:bn)+Lo(typeof i=="string"?i:i.join(yn))}var $o=new WeakMap,Oo=new Map;function Do(i,t,e){if(i){let r=e?.id??En(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return br(o.strings,t.values,o.values);{let s=$o.get(o);return s===void 0&&(s=o.values,$o.set(o,s)),{...o,values:s.map(l=>t.values[l])}}}}return Oe(t)}function En(i){let t=typeof i=="string"?i:i.strings,e=Oo.get(t);return e===void 0&&(e=Ro(t,typeof i!="string"&&!("strTag"in i)),Oo.set(t,e)),e}function yi(i){window.dispatchEvent(new CustomEvent($e,{detail:i}))}var Cr="",vi,Vo,Ar,bi,Ho,zt=new De;zt.resolve();var Er=0,Uo=i=>(fi((t,e)=>Do(Ho,t,e)),Cr=Vo=i.sourceLocale,Ar=new Set(i.targetLocales),Ar.add(i.sourceLocale),bi=i.loadLocale,{getLocale:Cn,setLocale:An}),Cn=()=>Cr,An=i=>{if(i===(vi??Cr))return zt.promise;if(!Ar||!bi)throw new Error("Internal error");if(!Ar.has(i))throw new Error("Invalid locale code");Er++;let t=Er;return vi=i,zt.settled&&(zt=new De),yi({status:"loading",loadingLocale:i}),(i===Vo?Promise.resolve({templates:void 0}):bi(i)).then(r=>{Er===t&&(Cr=i,vi=void 0,Ho=r.templates,yi({status:"ready",readyLocale:i}),zt.resolve())},r=>{Er===t&&(yi({status:"error",errorLocale:i,errorMessage:r.toString()}),zt.reject(r))}),zt.promise};var Ei="en",Ci=["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"],Yo="You must call `loadLocale` first to set up the localized template.",Fo,_r,zo=i=>{let t=Uo({sourceLocale:Ei,targetLocales:Ci,loadLocale:i});Fo=t.getLocale,_r=t.setLocale};var Ai=i=>{zo(i)},_i=i=>{if(!_r)throw new Error(Yo);return _r(i)};var Ve=new Set(Ci);Ve.add(Ei);var xi=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(Ve.has(t))return!0;let e=t.split("-")[0];return!!Ve.has(e)},Si=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(Ve.has(t))return t;let e=t.split("-")[0];return Ve.has(e)?e:"en-GB"};var Ue=globalThis,xr=Ue.trustedTypes,Bo=xr?xr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Pi="$lit$",_t=`lit$${Math.random().toFixed(9).slice(2)}$`,wi="?"+_t,_n=`<${wi}>`,Gt=document,Ye=()=>Gt.createComment(""),Fe=i=>i===null||typeof i!="object"&&typeof i!="function",Ti=Array.isArray,Zo=i=>Ti(i)||typeof i?.[Symbol.iterator]=="function",Mi=`[
3
- \f\r]`,He=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ko=/-->/g,Go=/>/g,Bt=RegExp(`>|${Mi}(?:([^\\s"'>=/]+)(${Mi}*=${Mi}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),jo=/'/g,qo=/"/g,Xo=/^(?:script|style|textarea|title)$/i,ki=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),h=ki(1),St=ki(2),Bp=ki(3),xt=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),Wo=new WeakMap,Kt=Gt.createTreeWalker(Gt,129);function Jo(i,t){if(!Ti(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bo!==void 0?Bo.createHTML(t):t}var Qo=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",l=He;for(let f=0;f<e;f++){let m=i[f],_,w,A=-1,O=0;for(;O<m.length&&(l.lastIndex=O,w=l.exec(m),w!==null);)O=l.lastIndex,l===He?w[1]==="!--"?l=Ko:w[1]!==void 0?l=Go:w[2]!==void 0?(Xo.test(w[2])&&(o=RegExp("</"+w[2],"g")),l=Bt):w[3]!==void 0&&(l=Bt):l===Bt?w[0]===">"?(l=o??He,A=-1):w[1]===void 0?A=-2:(A=l.lastIndex-w[2].length,_=w[1],l=w[3]===void 0?Bt:w[3]==='"'?qo:jo):l===qo||l===jo?l=Bt:l===Ko||l===Go?l=He:(l=Bt,o=void 0);let H=l===Bt&&i[f+1].startsWith("/>")?" ":"";s+=l===He?m+_n:A>=0?(r.push(_),m.slice(0,A)+Pi+m.slice(A)+_t+H):m+_t+(A===-2?f:H)}return[Jo(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ze=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,l=0,f=t.length-1,m=this.parts,[_,w]=Qo(t,e);if(this.el=i.createElement(_,r),Kt.currentNode=this.el.content,e===2||e===3){let A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;(o=Kt.nextNode())!==null&&m.length<f;){if(o.nodeType===1){if(o.hasAttributes())for(let A of o.getAttributeNames())if(A.endsWith(Pi)){let O=w[l++],H=o.getAttribute(A).split(_t),ht=/([.?@])?(.*)/.exec(O);m.push({type:1,index:s,name:ht[2],strings:H,ctor:ht[1]==="."?Mr:ht[1]==="?"?Pr:ht[1]==="@"?wr:qt}),o.removeAttribute(A)}else A.startsWith(_t)&&(m.push({type:6,index:s}),o.removeAttribute(A));if(Xo.test(o.tagName)){let A=o.textContent.split(_t),O=A.length-1;if(O>0){o.textContent=xr?xr.emptyScript:"";for(let H=0;H<O;H++)o.append(A[H],Ye()),Kt.nextNode(),m.push({type:2,index:++s});o.append(A[O],Ye())}}}else if(o.nodeType===8)if(o.data===wi)m.push({type:2,index:s});else{let A=-1;for(;(A=o.data.indexOf(_t,A+1))!==-1;)m.push({type:7,index:s}),A+=_t.length-1}s++}}static createElement(t,e){let r=Gt.createElement("template");return r.innerHTML=t,r}};function jt(i,t,e=i,r){if(t===xt)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=Fe(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=jt(i,o._$AS(i,t.values),o,r)),t}var Sr=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??Gt).importNode(e,!0);Kt.currentNode=o;let s=Kt.nextNode(),l=0,f=0,m=r[0];for(;m!==void 0;){if(l===m.index){let _;m.type===2?_=new ye(s,s.nextSibling,this,t):m.type===1?_=new m.ctor(s,m.name,m.strings,this,t):m.type===6&&(_=new Tr(s,this,t)),this._$AV.push(_),m=r[++f]}l!==m?.index&&(s=Kt.nextNode(),l++)}return Kt.currentNode=Gt,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++}},ye=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=jt(this,t,e),Fe(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==xt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Zo(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&&Fe(this._$AH)?this._$AA.nextSibling.data=t:this.T(Gt.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=ze.createElement(Jo(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new Sr(o,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(t){let e=Wo.get(t.strings);return e===void 0&&Wo.set(t.strings,e=new ze(t)),e}k(t){Ti(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(Ye()),this.O(Ye()),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))}},qt=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,l=!1;if(s===void 0)t=jt(this,t,e,0),l=!Fe(t)||t!==this._$AH&&t!==xt,l&&(this._$AH=t);else{let f=t,m,_;for(t=s[0],m=0;m<s.length-1;m++)_=jt(this,f[r+m],e,m),_===xt&&(_=this._$AH[m]),l||(l=!Fe(_)||_!==this._$AH[m]),_===u?t=u:t!==u&&(t+=(_??"")+s[m+1]),this._$AH[m]=_}l&&!o&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Mr=class extends qt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},Pr=class extends qt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},wr=class extends qt{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=jt(this,t,e,0)??u)===xt)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)}},Tr=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){jt(this,t)}},ta={M:Pi,P:_t,A:wi,C:1,L:Qo,R:Sr,D:Zo,V:jt,I:ye,H:qt,N:Pr,U:wr,B:Mr,F:Tr},xn=Ue.litHtmlPolyfillSupport;xn?.(ze,ye),(Ue.litHtmlVersions??(Ue.litHtmlVersions=[])).push("3.2.1");var ea=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let s=e?.renderBefore??null;r._$litPart$=o=new ye(t.insertBefore(Ye(),s),s,void 0,e??{})}return o._$AI(i),o};var y=class extends Ct{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=ea(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return xt}};y._$litElement$=!0,y.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:y});var Sn=globalThis.litElementPolyfillSupport;Sn?.({LitElement:y});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var v=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Mn={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:ge},Pn=(i=Mn,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:l}=e;return{set(f){let m=t.get.call(this);t.set.call(this,f),this.requestUpdate(l,m,i)},init(f){return f!==void 0&&this.P(l,void 0,i),f}}}if(r==="setter"){let{name:l}=e;return function(f){let m=this[l];t.call(this,f),this.requestUpdate(l,m,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(t,e)=>typeof e=="object"?Pn(i,t,e):((r,o,s)=>{let l=o.hasOwnProperty(s);return o.constructor.createProperty(s,l?{...r,wrapped:!0}:r),l?Object.getOwnPropertyDescriptor(o,s):void 0})(i,t,e)}function I(i){return p({...i,state:!0,attribute:!1})}var Wt=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Ot(i,t){return(e,r,o)=>{let s=l=>l.renderRoot?.querySelector(i)??null;if(t){let{get:l,set:f}=typeof r=="object"?e:o??(()=>{let m=Symbol();return{get(){return this[m]},set(_){this[m]=_}}})();return Wt(e,r,{get(){let m=l.call(this);return m===void 0&&(m=s(this),(m!==null||this.hasUpdated)&&f.call(this,m)),m}})}return Wt(e,r,{get(){return s(this)}})}}function U(i,t,e){return i?t(i):e?.(i)}var $=g`
1
+ import{a as ti,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as xa}from"@lit/react";import Aa from"react";var Me=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var Bt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchOnCheckoutComplete(t){this.dispatchEvent("primer-oncheckout-complete",{payment:t})}dispatchOnCheckoutFailure(t,e){this.dispatchEvent("primer-oncheckout-failure",{error:t,payment:e})}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var ft=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var Ft=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(a,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=a,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(a,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){let a=e;this.context=a.context,this.callback=a.callback,this.subscribe=a.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ft(this.context,this.host,this.t,this.subscribe))}};var ke=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var xr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},I=class extends ke{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let a=o.contextTarget??o.composedPath()[0];a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let a=new Set;for(let[n,{consumerHost:m}]of this.subscriptions)a.has(n)||(a.add(n),m.dispatchEvent(new ft(this.context,m,n,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new xr(this.context,this.host))}};function v({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ft(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new Ft(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var Te="cardNetworksContext";var Kt="clientOptionsContext";var jt="computedStylesContext";var j="headlessInstanceContext";var $e="klarnaCategoriesContext";var V="managerContext";var Gt="paymentMethodsContext";var L="sdkStateContext";var qt="vaultManagerContext";var ei="vaultManagerCvvContext";var x=class x{static log(t,...e){x.enabled&&console.log(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.log,...e)}static info(t,...e){x.enabled&&console.info(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.info,...e)}static warn(t,...e){x.enabled&&console.warn(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.warn,...e)}static error(t,...e){x.enabled&&console.error(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.error,...e)}static debug(t,...e){x.enabled&&console.debug(`%c${x.brandTag}%c ${t}`,x.brandStyle,x.styles.debug,...e)}static table(t,e){x.enabled&&console.table(t,e)}static time(t){x.enabled&&console.time(`${x.brandTag} ${t}`)}static timeEnd(t){x.enabled&&console.timeEnd(`${x.brandTag} ${t}`)}};x.enabled=!0,x.defaultFont="font-family: Consolas, monospace; font-size: 12px;",x.brandTag="[PRIMER]",x.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+x.defaultFont,x.styles={log:"color: #4CAF50; "+x.defaultFont,info:"color: #2196F3; "+x.defaultFont,warn:"color: #FF9800; "+x.defaultFont,error:"color: #F44336; "+x.defaultFont,debug:"color: #9C27B0; "+x.defaultFont};var A=x;function Ko(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let m=t(o,n,a);o=m,r(m)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function re(i){return(t,e,r)=>{let o=i[e.type];if(!o)throw new Error(`No handler for action type: ${e.type}`);return o(t,e,r)}}var _t=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=Ko(e,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},Le=class{constructor(t){this.host=t;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(t){this._controllers.push(t)}hostConnected(){this._controllers.forEach(t=>{t.hostConnected&&t.hostConnected()})}hostDisconnected(){this._controllers.forEach(t=>{t.hostDisconnected&&t.hostDisconnected()})}};var Ie={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},jo={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,t)=>(A.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Ie,RESET_ERROR:i=>({...i,error:null,failure:null})},Go=re(jo),Ne=class extends _t{constructor(t){super(t,Ie,Go,null,e=>{t.sdkContextController.setSdkState(e),t.primerEventsController.dispatchSdkState(e)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(A.warn("Force completing loading state"),this.completeLoading())}};var Re=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new I(t,{context:L,initialValue:Ie}),this.paymentMethodsProvider=new I(t,{context:Gt,initialValue:null}),this.paymentManagerProvider=new I(t,{context:V,initialValue:new Map}),this.cardNetworksContext=new I(t,{context:Te,initialValue:null}),this.vaultManagerProvider=new I(t,{context:qt,initialValue:null}),this.vaultManagerCvvProvider=new I(t,{context:ei,initialValue:null}),this.clientOptionsContext=new I(t,{context:Kt,initialValue:null}),this.klarnaCategoriesProvider=new I(t,{context:$e,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new I(t,{context:j,initialValue:null}),this.computedStylesProvider=new I(t,{context:jt,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var Et=class Et{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){A.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||A.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Et.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Et.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){A.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);e.push([a,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of Et.cssVarCache.keys()){let e=Et.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Et.cssVarCache=new Map;var Oe=Et;var De=globalThis,Ve=De.ShadowRoot&&(De.ShadyCSS===void 0||De.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ar=Symbol(),ri=new WeakMap,ie=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ar)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Ve&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=ri.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ri.set(e,t))}return t}toString(){return this.cssText}},ii=i=>new ie(typeof i=="string"?i:i+"",void 0,Ar),h=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,a)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[a+1],i[0]);return new ie(e,i,Ar)},_r=(i,t)=>{if(Ve)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=De.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Ye=Ve?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ii(e)})(i):i;var{is:qo,defineProperty:Wo,getOwnPropertyDescriptor:Zo,getOwnPropertyNames:Xo,getOwnPropertySymbols:Qo,getPrototypeOf:Jo}=Object,gt=globalThis,oi=gt.trustedTypes,ta=oi?oi.emptyScript:"",ea=gt.reactiveElementPolyfillSupport,oe=(i,t)=>i,ae={toAttribute(i,t){switch(t){case Boolean:i=i?ta:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},Wt=(i,t)=>!qo(i,t),ai={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:Wt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),gt.litPropertyMetadata??(gt.litPropertyMetadata=new WeakMap);var it=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ai){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&Wo(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=Zo(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let m=o?.call(this);a.call(this,n),this.requestUpdate(t,m,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ai}static _$Ei(){if(this.hasOwnProperty(oe("elementProperties")))return;let t=Jo(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(oe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oe("properties"))){let e=this.properties,r=[...Xo(e),...Qo(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(Ye(o))}else t!==void 0&&e.push(Ye(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _r(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:ae).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:ae;this._$Em=o,this[o]=n.fromAttribute(e,a.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??Wt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};it.elementStyles=[],it.shadowRootOptions={mode:"open"},it[oe("elementProperties")]=new Map,it[oe("finalized")]=new Map,ea?.({ReactiveElement:it}),(gt.reactiveElementVersions??(gt.reactiveElementVersions=[])).push("2.0.4");var yt={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},E=Symbol(),P=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??si,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let a=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(e===E)this.i=0;else{if(a===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},si=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!Wt(e,t[r]));var ra={SET_LOADING:(i,t)=>({...i,isLoading:t.payload}),SET_UPDATING:(i,t)=>({...i,isUpdating:t.payload}),INITIALIZE_VAULT_MANAGER:(i,t,e)=>({...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,t)=>({...i,vaultedPaymentMethods:t.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>ni},ia={INITIALIZE_CVV:(i,t,e)=>({...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,t)=>({...i,formIsDirty:t.payload}),SET_CVV_INPUT:(i,t)=>({...i,cvvInput:t.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,t)=>({...i,selectedVaultedPaymentMethod:t.payload}),RESET_CVV:()=>li},oa=re(ra),aa=re(ia),ni={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},li={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Er=class extends _t{constructor(t,e){super(t,ni,oa,e,r=>{t.sdkContextController.setVaultManager(r)})}setLoading(t){this.dispatch({type:"SET_LOADING",payload:t})}setUpdating(t){this.dispatch({type:"SET_UPDATING",payload:t})}initializeVaultManager(t,e,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:t,vaultEnabled:e,cvvRecapture:r})}updatePaymentMethods(t){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:t})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Sr=class extends _t{constructor(t,e){super(t,li,aa,e,r=>{t.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(t){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:t})}setFormDirty(t){this.dispatch({type:"SET_FORM_DIRTY",payload:t})}setCvvInputState(t){this.dispatch({type:"SET_CVV_INPUT",payload:t})}setSelectedPaymentMethod(t){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},se=class extends Le{constructor(e){super(e);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(e),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=e=>{this.itemController.setCvvInputState(e)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let e=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!e||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(e.id,r?{cvv:o.valueToken}:void 0)}catch(a){A.error("VaultManagerController: Error starting vaulted payment flow",a),this.coreController.setError(a instanceof Error?a:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new Er(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Sr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new P(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),E;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),A.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){A.error("VaultManagerController: Failed to initialize vault",a),this.coreController.setError(a instanceof Error?a:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return A.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)}};var ne="lit-localize-status";var di=i=>typeof i!="string"&&"strTag"in i,He=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var le=i=>di(i)?He(i.strings,i.values):i;var C=le,pi=!1;function Pr(i){if(pi)throw new Error("lit-localize can only be configured once");C=i,pi=!0}var wr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(ne,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(ne,this.__litLocalizeEventHandler)}},sa=i=>i.addController(new wr(i)),ci=sa;var T=()=>(i,t)=>(i.addInitializer(ci),i);var de=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var ot=[];for(let i=0;i<256;i++)ot[i]=(i>>4&15).toString(16)+(i&15).toString(16);function mi(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,m=0,p=52210;for(let y=0;y<i.length;y++)e^=i.charCodeAt(y),t=e*435,r=o*435,a=n*435,m=p*435,a+=e<<8,m+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,p=m+(a>>>16)&65535,n=a&65535;return ot[p>>8]+ot[p&255]+ot[n>>8]+ot[n&255]+ot[o>>8]+ot[o&255]+ot[e>>8]+ot[e&255]}var na="",la="h",da="s";function hi(i,t){return(t?la:da)+mi(typeof i=="string"?i:i.join(na))}var ui=new WeakMap,fi=new Map;function gi(i,t,e){if(i){let r=e?.id??pa(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return He(o.strings,t.values,o.values);{let a=ui.get(o);return a===void 0&&(a=o.values,ui.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return le(t)}function pa(i){let t=typeof i=="string"?i:i.strings,e=fi.get(t);return e===void 0&&(e=hi(t,typeof i!="string"&&!("strTag"in i)),fi.set(t,e)),e}function Mr(i){window.dispatchEvent(new CustomEvent(ne,{detail:i}))}var ze="",kr,yi,Be,Tr,vi,St=new de;St.resolve();var Ue=0,bi=i=>(Pr((t,e)=>gi(vi,t,e)),ze=yi=i.sourceLocale,Be=new Set(i.targetLocales),Be.add(i.sourceLocale),Tr=i.loadLocale,{getLocale:ca,setLocale:ma}),ca=()=>ze,ma=i=>{if(i===(kr??ze))return St.promise;if(!Be||!Tr)throw new Error("Internal error");if(!Be.has(i))throw new Error("Invalid locale code");Ue++;let t=Ue;return kr=i,St.settled&&(St=new de),Mr({status:"loading",loadingLocale:i}),(i===yi?Promise.resolve({templates:void 0}):Tr(i)).then(r=>{Ue===t&&(ze=i,kr=void 0,vi=r.templates,Mr({status:"ready",readyLocale:i}),St.resolve())},r=>{Ue===t&&(Mr({status:"error",errorLocale:i,errorMessage:r.toString()}),St.reject(r))}),St.promise};var $r="en",Lr=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],Ci="You must call `loadLocale` first to set up the localized template.",xi,Fe,Ai=i=>{let t=bi({sourceLocale:$r,targetLocales:Lr,loadLocale:i});xi=t.getLocale,Fe=t.setLocale};var Nr=i=>{Ai(i)},Ir=i=>{if(!Fe)throw new Error(Ci);return Fe(i)};var pe=new Set(Lr);pe.add($r);var Rr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(pe.has(t))return!0;let e=t.split("-")[0];return!!pe.has(e)},Or=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(pe.has(t))return t;let e=t.split("-")[0];return pe.has(e)?e:"en-GB"};var me=globalThis,Ke=me.trustedTypes,_i=Ke?Ke.createPolicy("lit-html",{createHTML:i=>i}):void 0,Vr="$lit$",at=`lit$${Math.random().toFixed(9).slice(2)}$`,Yr="?"+at,ha=`<${Yr}>`,Mt=document,he=()=>Mt.createComment(""),ue=i=>i===null||typeof i!="object"&&typeof i!="function",Hr=Array.isArray,ki=i=>Hr(i)||typeof i?.[Symbol.iterator]=="function",Dr=`[
2
+ \f\r]`,ce=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ei=/-->/g,Si=/>/g,Pt=RegExp(`>|${Dr}(?:([^\\s"'>=/]+)(${Dr}*=${Dr}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Pi=/'/g,wi=/"/g,Ti=/^(?:script|style|textarea|title)$/i,Ur=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=Ur(1),nt=Ur(2),ip=Ur(3),st=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Mi=new WeakMap,wt=Mt.createTreeWalker(Mt,129);function $i(i,t){if(!Hr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return _i!==void 0?_i.createHTML(t):t}var Li=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=ce;for(let m=0;m<e;m++){let p=i[m],y,b,g=-1,M=0;for(;M<p.length&&(n.lastIndex=M,b=n.exec(p),b!==null);)M=n.lastIndex,n===ce?b[1]==="!--"?n=Ei:b[1]!==void 0?n=Si:b[2]!==void 0?(Ti.test(b[2])&&(o=RegExp("</"+b[2],"g")),n=Pt):b[3]!==void 0&&(n=Pt):n===Pt?b[0]===">"?(n=o??ce,g=-1):b[1]===void 0?g=-2:(g=n.lastIndex-b[2].length,y=b[1],n=b[3]===void 0?Pt:b[3]==='"'?wi:Pi):n===wi||n===Pi?n=Pt:n===Ei||n===Si?n=ce:(n=Pt,o=void 0);let N=n===Pt&&i[m+1].startsWith("/>")?" ":"";a+=n===ce?p+ha:g>=0?(r.push(y),p.slice(0,g)+Vr+p.slice(g)+at+N):p+at+(g===-2?m:N)}return[$i(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},fe=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,m=t.length-1,p=this.parts,[y,b]=Li(t,e);if(this.el=i.createElement(y,r),wt.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(o=wt.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let g of o.getAttributeNames())if(g.endsWith(Vr)){let M=b[n++],N=o.getAttribute(g).split(at),rt=/([.?@])?(.*)/.exec(M);p.push({type:1,index:a,name:rt[2],strings:N,ctor:rt[1]==="."?Ge:rt[1]==="?"?qe:rt[1]==="@"?We:Tt}),o.removeAttribute(g)}else g.startsWith(at)&&(p.push({type:6,index:a}),o.removeAttribute(g));if(Ti.test(o.tagName)){let g=o.textContent.split(at),M=g.length-1;if(M>0){o.textContent=Ke?Ke.emptyScript:"";for(let N=0;N<M;N++)o.append(g[N],he()),wt.nextNode(),p.push({type:2,index:++a});o.append(g[M],he())}}}else if(o.nodeType===8)if(o.data===Yr)p.push({type:2,index:a});else{let g=-1;for(;(g=o.data.indexOf(at,g+1))!==-1;)p.push({type:7,index:a}),g+=at.length-1}a++}}static createElement(t,e){let r=Mt.createElement("template");return r.innerHTML=t,r}};function kt(i,t,e=i,r){if(t===st)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=ue(t)?void 0:t._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=kt(i,o._$AS(i,t.values),o,r)),t}var je=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??Mt).importNode(e,!0);wt.currentNode=o;let a=wt.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let y;p.type===2?y=new Zt(a,a.nextSibling,this,t):p.type===1?y=new p.ctor(a,p.name,p.strings,this,t):p.type===6&&(y=new Ze(a,this,t)),this._$AV.push(y),p=r[++m]}n!==p?.index&&(a=wt.nextNode(),n++)}return wt.currentNode=Mt,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Zt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=kt(this,t,e),ue(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==st&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ki(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==c&&ue(this._$AH)?this._$AA.nextSibling.data=t:this.T(Mt.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=fe.createElement($i(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new je(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=Mi.get(t.strings);return e===void 0&&Mi.set(t.strings,e=new fe(t)),e}k(t){Hr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let a of t)o===e.length?e.push(r=new i(this.O(he()),this.O(he()),this,this.options)):r=e[o],r._$AI(a),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Tt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=c}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=kt(this,t,e,0),n=!ue(t)||t!==this._$AH&&t!==st,n&&(this._$AH=t);else{let m=t,p,y;for(t=a[0],p=0;p<a.length-1;p++)y=kt(this,m[r+p],e,p),y===st&&(y=this._$AH[p]),n||(n=!ue(y)||y!==this._$AH[p]),y===c?t=c:t!==c&&(t+=(y??"")+a[p+1]),this._$AH[p]=y}n&&!o&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ge=class extends Tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}},qe=class extends Tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==c)}},We=class extends Tt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=kt(this,t,e,0)??c)===st)return;let r=this._$AH,o=t===c&&r!==c||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==c&&(r===c||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ze=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){kt(this,t)}},Ni={M:Vr,P:at,A:Yr,C:1,L:Li,R:je,D:ki,V:kt,I:Zt,H:Tt,N:qe,U:We,B:Ge,F:Ze},ua=me.litHtmlPolyfillSupport;ua?.(fe,Zt),(me.litHtmlVersions??(me.litHtmlVersions=[])).push("3.2.1");var Ii=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new Zt(t.insertBefore(he(),a),a,void 0,e??{})}return o._$AI(i),o};var u=class extends it{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ii(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return st}};u._$litElement$=!0,u.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:u});var fa=globalThis.litElementPolyfillSupport;fa?.({LitElement:u});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var f=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var ga={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:Wt},ya=(i=ga,t,e)=>{let{kind:r,metadata:o}=e,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),a.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(m){let p=t.get.call(this);t.set.call(this,m),this.requestUpdate(n,p,i)},init(m){return m!==void 0&&this.P(n,void 0,i),m}}}if(r==="setter"){let{name:n}=e;return function(m){let p=this[n];t.call(this,m),this.requestUpdate(n,p,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?ya(i,t,e):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,t,e)}function _(i){return l({...i,state:!0,attribute:!1})}var $t=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function vt(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:m}=typeof r=="object"?e:o??(()=>{let p=Symbol();return{get(){return this[p]},set(y){this[p]=y}}})();return $t(e,r,{get(){let p=n.call(this);return p===void 0&&(p=a(this),(p!==null||this.hasUpdated)&&m.call(this,p)),p}})}return $t(e,r,{get(){return a(this)}})}}function w(i,t,e){return i?t(i):e?.(i)}var S=h`
5
4
  * {
6
5
  box-sizing: border-box;
7
6
  }
8
- `,ra=g`
7
+ `,Ri=h`
9
8
  :host {
10
9
  display: block;
11
10
  isolation: isolate;
@@ -14,14 +13,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
14
13
  //Keep the CSS loader in the same position - check css-loader-inline.ts
15
14
  min-height: 64px;
16
15
  }
17
- `;var ia="https://sdk.primer.io/web/v2-latest/Primer.min.js";var kr=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 oa=typeof window<"u"&&typeof window.document<"u";function wn(i){return document.querySelector(`script[src^="${i}"]`)}function Tn(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 aa(i,t=!1){if(!oa)throw new Error("Cannot load script in server environment");let e=wn(i)??Tn(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var Nr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new V(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new V(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(N.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(),N.info("SDK instance cleaned up")}catch(t){N.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=ia){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){N.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await aa(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return N.warn("Component disconnected, aborting SDK initialization"),R;if(!t||!e)return R;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:l=>{this.isDisconnected||(N.info("Configuration payment methods:",l),this.paymentsList=l)},onCheckoutComplete:({payment:l})=>{this.isDisconnected||(N.info("Payment completed:",l),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(l))},onCheckoutFail:(l,f)=>{this.isDisconnected||(N.error("Payment failed:",l),this.host.sdkStateController.setFailure(l.code||"UNKNOWN_ERROR",l.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(l,f.payment))},onBeforePaymentCreate:(l,f)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),f?.continuePaymentCreation())},onPaymentMethodAction:(l,f)=>{this.isDisconnected||l==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||this.host.sdkStateController.resetError()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),R;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&&(N.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return R;if(!t||!e.length)return R;let r=new Map,o=new Map;try{for(let l of e){if(this.isDisconnected)break;let f=await this.initializePaymentMethodManager(l)();l&&f&&(r.set(l.type,l),o.set(l.type,f))}if(this.isDisconnected)return R;let s=new kr(r);return this.host.sdkContextController.setPaymentManagers(o),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.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:s=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async l=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(l)},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 N.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Ir=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var kn=Eo({"../../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")});Ai(i=>kn(`../../localization/lit-localize/locales/${i}.ts`));var Lr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},it=class extends y{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 ur(this),this.sdkStateController=new mr(this),this.primerEventsController=new ce(this),this.styleProcessingController=new fr(this),this.vaultManagerController=new Re(this),this.cardNetworkController=new nr(this),this.achPaymentEventsController=new Ir(this),new Nr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===Lr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(xi(this.options?.locale)?this.locale=Si(this.options?.locale):N.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),_i(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(N.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.currentState,r=e.isLoading,o=e.error,s=!r&&!o;return h`
18
- ${U(r,()=>u)}
19
- ${U(o,()=>h`<primer-checkout-error></primer-checkout-error>`)}
20
- ${U(s,()=>h`
16
+ `;var Oi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Xe=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var Di=typeof window<"u"&&typeof window.document<"u";function va(i){return document.querySelector(`script[src^="${i}"]`)}function ba(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function Vi(i,t=!1){if(!Di)throw new Error("Cannot load script in server environment");let e=va(i)??ba(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var Qe=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new P(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new P(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(A.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),A.info("SDK instance cleaned up")}catch(t){A.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=Oi){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){A.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await Vi(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return A.warn("Component disconnected, aborting SDK initialization"),E;if(!t||!e)return E;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(A.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(A.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(n))},onCheckoutFail:(n,m)=>{this.isDisconnected||(A.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(n,m.payment))},onBeforePaymentCreate:(n,m)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),m?.continuePaymentCreation())},onPaymentMethodAction:(n,m)=>{this.isDisconnected||n==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||this.host.sdkStateController.resetError()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),E;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(o);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(A.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return E;if(!t||!e.length)return E;let r=new Map,o=new Map;try{for(let n of e){if(this.isDisconnected)break;let m=await this.initializePaymentMethodManager(n)();n&&m&&(r.set(n.type,n),o.set(n.type,m))}if(this.isDisconnected)return E;let a=new Xe(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),A.info("Initialized payment methods:",a.toArray()),r}catch(a){if(a instanceof Error)throw this.host.sdkStateController.setError(a),a;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:a=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:a,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(e,{onCardNetworksChange:async n=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:e,manager:a}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return A.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Je=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Ca=ti({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.6MRFCKX4.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.HRSMU7Y5.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.3FSHJL7U.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.WAO4WFS3.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.4OFYGDVA.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.3FZS52IN.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.A4R7VG5T.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.ILZ7SXSW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.7GZJA7MN.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.QKHDL4JV.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.GG7MJMG2.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.FEZ6BF3S.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.FJLPTMF3.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.DM5R27A5.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.YZV52NTA.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.6SCF3XZZ.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.PPDZ7AAS.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.6WOPSGLW.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.NS22WGWL.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.42TO3R4G.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.UEGHEUAP.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.HTMDY6RY.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.4U3GBQTQ.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.73ME4TDM.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.JRWO2BF6.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.KROS45TV.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.HE3SWJFQ.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.TR6TEKBY.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.V5QP6OXL.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.FCVWIF3Y.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.DQZDG7LR.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.CR4ROBVE.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.JRWVFJPX.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.NRMWYY3F.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.OWSKHXVO.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.YGBRNNWT.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.IRTDTNTP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.AWGLHKVE.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.O4BXFGNF.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.GZCEBRT2.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.ZDILMEEO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.JUUBOEW3.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.IN7CFTLL.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.YT47ULXR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.RBRAS4RP.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.4CK7LBWM.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.374TMWNJ.js")});Nr(i=>Ca(`../../localization/lit-localize/locales/${i}.ts`));var tr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},H=class extends u{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new Re(this),this.sdkStateController=new Ne(this),this.primerEventsController=new Bt(this),this.styleProcessingController=new Oe(this),this.vaultManagerController=new se(this),this.cardNetworkController=new Me(this),this.achPaymentEventsController=new Je(this),new Qe(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===tr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(Rr(this.options?.locale)?this.locale=Or(this.options?.locale):A.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Ir(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(A.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.currentState,r=e.isLoading,o=e.error,a=!r&&!o;return d`
17
+ ${w(r,()=>c)}
18
+ ${w(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
19
+ ${w(a,()=>d`
21
20
  <slot name="main" @slotchange=${this.onSlotChange}></slot>
22
- ${U(this.hasAssignedContent,()=>u,()=>h`<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)}};it.styles=[$,ra],n([p({type:String,attribute:Lr.CUSTOM_STYLES})],it.prototype,"customStyles",2),n([p({type:String,attribute:Lr.CLIENT_TOKEN})],it.prototype,"clientToken",2),n([p({type:Object})],it.prototype,"options",2),n([p({type:Boolean,reflect:!0,attribute:Lr.JS_INIT})],it.prototype,"_jsInitialized",2),n([Ot("slot")],it.prototype,"defaultSlot",2),n([I()],it.prototype,"previousLoadingState",2),it=n([z(),v("primer-checkout")],it);var Eh=Nn({tagName:"primer-checkout",elementClass:it,react:In});import{createComponent as Ln}from"@lit/react";import Rn from"react";var sa=g`
21
+ ${w(this.hasAssignedContent,()=>c,()=>d`<primer-main></primer-main>`)}
22
+ `,()=>c)}
23
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};H.styles=[S,Ri],s([l({type:String,attribute:tr.CUSTOM_STYLES})],H.prototype,"customStyles",2),s([l({type:String,attribute:tr.CLIENT_TOKEN})],H.prototype,"clientToken",2),s([l({type:Object})],H.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:tr.JS_INIT})],H.prototype,"_jsInitialized",2),s([vt("slot")],H.prototype,"defaultSlot",2),s([_()],H.prototype,"previousLoadingState",2),H=s([T(),f("primer-checkout")],H);var _a=xa({tagName:"primer-checkout",elementClass:H,react:Aa});import{createComponent as Ea}from"@lit/react";import Sa from"react";var Yi=h`
25
24
  :host {
26
25
  display: flex;
27
26
  flex-direction: column;
@@ -50,7 +49,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
50
49
  line-height: var(--primer-typography-body-medium-line-height);
51
50
  letter-spacing: var(--primer-typography-body-medium-letter-spacing);
52
51
  }
53
- `;var Mt=class extends y{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?h`
52
+ `;var lt=class extends u{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
54
53
  <!-- Successful view -->
55
54
  <primer-icon
56
55
  size="lg"
@@ -62,7 +61,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
62
61
  <p class="secondary">
63
62
  You'll be redirected to the order confirmation page soon.
64
63
  </p>
65
- `:h`
64
+ `:d`
66
65
  <primer-icon
67
66
  size="lg"
68
67
  name="failure-icon"
@@ -70,8 +69,8 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
70
69
  >
71
70
  </primer-icon>
72
71
  <p>Payment failed</p>
73
- ${this.description?h`<p class="secondary">${this.description}</p>`:h`<p class="secondary">Something went wrong.</p>`}
74
- `}};Mt.styles=[sa],n([p({type:String,reflect:!0})],Mt.prototype,"type",2),n([p({type:String,reflect:!0})],Mt.prototype,"description",2),Mt=n([v("primer-checkout-state")],Mt);var Ih=Ln({tagName:"primer-checkout-state",elementClass:Mt,react:Rn});import{createComponent as $n}from"@lit/react";import On from"react";var na=g`
72
+ ${this.description?d`<p class="secondary">${this.description}</p>`:d`<p class="secondary">Something went wrong.</p>`}
73
+ `}};lt.styles=[Yi],s([l({type:String,reflect:!0})],lt.prototype,"type",2),s([l({type:String,reflect:!0})],lt.prototype,"description",2),lt=s([f("primer-checkout-state")],lt);var Pa=Ea({tagName:"primer-checkout-state",elementClass:lt,react:Sa});import{createComponent as wa}from"@lit/react";import Ma from"react";var Hi=h`
75
74
  :host {
76
75
  display: block;
77
76
  }
@@ -125,201 +124,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
125
124
  transition: none;
126
125
  }
127
126
  }
128
- `;var la=g`
129
- :host {
130
- display: contents;
131
- }
132
-
133
- button {
134
- align-items: center;
135
- border-radius: var(--primer-radius-medium);
136
- border: none;
137
- cursor: pointer;
138
- display: flex;
139
- font-family: var(--primer-typography-title-large-font);
140
- font-size: var(--primer-typography-title-large-size);
141
- font-weight: var(--primer-typography-title-large-weight);
142
- gap: var(--primer-space-small);
143
- justify-content: center;
144
- letter-spacing: var(--primer-typography-title-large-letter-spacing);
145
- line-height: var(--primer-typography-title-large-line-height);
146
- outline: none;
147
- padding: var(--primer-space-medium) var(--primer-space-medium);
148
- position: relative;
149
- transition: all 0.2s ease-in-out;
150
- }
151
-
152
- .button-content {
153
- display: flex;
154
- height: 100%;
155
- align-items: center;
156
- gap: var(--primer-space-small);
157
- justify-content: center;
158
- transition: opacity var(--primer-animation-duration)
159
- var(--primer-animation-easing);
160
- }
161
-
162
- /* Reduce opacity of text during loading for better focus on the spinner */
163
- .button-content.loading {
164
- opacity: 0.65;
165
- }
166
-
167
- :host([selectable]) button {
168
- justify-content: space-between;
169
- }
170
-
171
- /* Primary variant */
172
- :host([variant='primary']) button {
173
- background-color: var(--primer-color-brand);
174
- /* This is correct (color-background for color) because Button is kind of a special component */
175
- color: var(--primer-color-background-outlined-default);
176
- }
177
- :host([variant='primary']:not([disabled]):not([loading])) button:hover {
178
- filter: brightness(105%);
179
- }
180
- :host([variant='primary']:not([disabled]):not([loading])) button:active {
181
- filter: brightness(98%);
182
- }
183
- :host([variant='primary']) button:focus-visible {
184
- outline: 2px solid var(--primer-color-brand);
185
- outline-offset: 2px;
186
- }
187
-
188
- /* Disabled state for primary button */
189
- :host([variant='primary'][disabled]:not([loading])) button,
190
- :host([variant='primary']:not([loading])) button:disabled {
191
- color: var(--primer-color-text-disabled);
192
- background-color: var(--primer-color-background-outlined-disabled);
193
- cursor: not-allowed;
194
- }
195
-
196
- /* Loading state for primary button - OVERRIDES disabled styles with higher specificity */
197
- :host([variant='primary'][loading]) button {
198
- background-color: var(--primer-color-brand);
199
- opacity: 0.8;
200
- color: var(--primer-color-background-outlined-default);
201
- cursor: wait;
202
- }
203
-
204
- /* Secondary variant */
205
- :host([variant='secondary']) button {
206
- background-color: var(--primer-color-background-outlined-default);
207
- color: var(--primer-color-text-primary);
208
- border: 1px solid var(--primer-color-border-outlined-default);
209
- }
210
- :host([variant='secondary']:not([disabled]):not([loading])) button:hover {
211
- background-color: var(--primer-color-background-outlined-hover);
212
- }
213
- :host([variant='secondary']:not([disabled]):not([loading])) button:active {
214
- background-color: var(--primer-color-background-outlined-active);
215
- }
216
- :host([variant='secondary']) button:focus-visible {
217
- outline: 2px solid var(--primer-color-border-outlined-focus);
218
- outline-offset: 2px;
219
- }
220
-
221
- /* Disabled state for secondary button */
222
- :host([variant='secondary'][disabled]:not([loading])) button,
223
- :host([variant='secondary']:not([loading])) button:disabled {
224
- background-color: var(--primer-color-background-outlined-disabled);
225
- border-color: var(--primer-color-border-outlined-disabled);
226
- color: var(--primer-color-text-disabled);
227
- cursor: not-allowed;
228
- }
229
-
230
- /* Loading state for secondary button - OVERRIDES disabled styles */
231
- :host([variant='secondary'][loading]) button {
232
- background-color: var(--primer-color-gray-100);
233
- border-color: var(--primer-color-gray-300);
234
- color: var(--primer-color-gray-600);
235
- cursor: wait;
236
- }
237
-
238
- /* Tertiary variant */
239
- :host([variant='tertiary']) button {
240
- background-color: var(--primer-color-background-transparent-default);
241
- border: 1px solid var(--primer-color-border-transparent-default);
242
- color: var(--primer-color-text-primary);
243
- border-radius: var(--primer-radius-small);
244
- padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall);
245
- }
246
- :host([variant='tertiary']:not([disabled]):not([loading])) button:hover {
247
- border-radius: var(--primer-radius-small);
248
- background-color: var(--primer-color-background-transparent-hover);
249
- border: 1px solid var(--primer-color-border-transparent-hover);
250
- color: var(--primer-color-text-primary);
251
- }
252
- :host([variant='tertiary']:not([disabled]):not([loading])) button:active {
253
- background-color: var(--primer-color-background-transparent-active);
254
- border-color: var(--primer-color-border-transparent-active);
255
- border-radius: var(--primer-radius-small);
256
- color: var(--primer-color-text-primary);
257
- }
258
- :host([variant='tertiary']) button:focus-visible {
259
- border-radius: var(--primer-radius-small);
260
- background-color: var(--primer-color-background-transparent-focus);
261
- outline: 2px solid var(--primer-color-border-transparent-focus);
262
- outline-offset: 2px;
263
- }
264
-
265
- /* Disabled state for tertiary button */
266
- :host([variant='tertiary'][disabled]:not([loading])) button,
267
- :host([variant='tertiary']:not([loading])) button:disabled {
268
- background-color: var(--primer-color-border-transparent-disabled);
269
- color: var(--primer-color-text-disabled);
270
- cursor: not-allowed;
271
- }
272
-
273
- /* Loading state for tertiary button - OVERRIDES disabled styles */
274
- :host([variant='tertiary'][loading]) button {
275
- background-color: var(--primer-color-gray-100);
276
- color: var(--primer-color-gray-600);
277
- cursor: wait;
278
- }
279
-
280
- /* Checked state styling */
281
- :host([selectionState='checked']) button {
282
- border: 1px solid var(--primer-color-brand);
283
- background-color: var(--primer-color-gray-100);
284
- }
285
-
286
- /* Loading state - center spinner with content */
287
- :host([loading]) primer-spinner {
288
- margin-right: var(--primer-space-xsmall);
289
- }
290
-
291
- /* Special case for tertiary variant loading state spinner size */
292
- :host([variant='tertiary'][loading]) primer-spinner {
293
- transform: scale(0.85);
294
- }
295
- `;var tt=class extends y{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:h`
296
- <primer-icon
297
- name="checkmark"
298
- size="sm"
299
- color="var(--primer-color-icon-primary)"
300
- ></primer-icon>
301
- `}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)"),h`
302
- <primer-spinner
303
- size="small"
304
- color="${e}"
305
- compact
306
- ></primer-spinner>
307
- `}render(){return h`
308
- <button
309
- type=${this.buttonType}
310
- ?disabled=${this.disabled||this.loading}
311
- @click=${this.handleClick}
312
- part="button"
313
- aria-checked=${this.selectionState==="checked"}
314
- aria-busy=${this.loading}
315
- >
316
- ${this.renderSpinner()}
317
- <span class="button-content ${this.loading?"loading":""}">
318
- <slot></slot>
319
- </span>
320
- ${this.renderCheckmark()}
321
- </button>
322
- `}};tt.styles=[$,la],n([p({type:String,reflect:!0})],tt.prototype,"variant",2),n([p({type:Boolean,reflect:!0})],tt.prototype,"disabled",2),n([p({type:Boolean,reflect:!0})],tt.prototype,"loading",2),n([p({type:String,attribute:"type"})],tt.prototype,"buttonType",2),n([p({type:String,reflect:!0})],tt.prototype,"selectionState",2),n([p({type:Boolean,reflect:!0})],tt.prototype,"selectable",2),tt=n([v("primer-button")],tt);var W=class extends y{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 h`
127
+ `;var Y=class extends u{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,o=this.header||e;return d`
323
128
  <div class="collapsable">
324
129
  <primer-button
325
130
  variant=${this.buttonVariant}
@@ -343,7 +148,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
343
148
  </div>
344
149
  </div>
345
150
  </div>
346
- `}};W.styles=[na],n([p({type:String})],W.prototype,"header",2),n([p({type:Boolean})],W.prototype,"expanded",2),n([p({type:String})],W.prototype,"expandText",2),n([p({type:String})],W.prototype,"collapseText",2),n([p({type:String})],W.prototype,"ariaLabel",2),n([p({type:String})],W.prototype,"buttonVariant",2),n([I()],W.prototype,"isExpanded",2),W=n([v("primer-collapsable")],W);var eu=$n({tagName:"primer-collapsable",elementClass:W,react:On});import{createComponent as Dn}from"@lit/react";import Vn from"react";var da=g`
151
+ `}};Y.styles=[Hi],s([l({type:String})],Y.prototype,"header",2),s([l({type:Boolean})],Y.prototype,"expanded",2),s([l({type:String})],Y.prototype,"expandText",2),s([l({type:String})],Y.prototype,"collapseText",2),s([l({type:String})],Y.prototype,"ariaLabel",2),s([l({type:String})],Y.prototype,"buttonVariant",2),s([_()],Y.prototype,"isExpanded",2),Y=s([f("primer-collapsable")],Y);var ka=wa({tagName:"primer-collapsable",elementClass:Y,react:Ma});import{createComponent as Ta}from"@lit/react";import $a from"react";var Ui=h`
347
152
  :host {
348
153
  display: contents;
349
154
  }
@@ -372,9 +177,9 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
372
177
  display: flex;
373
178
  justify-content: flex-end;
374
179
  }
375
- `;var Rr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Be=i=>(...t)=>({_$litDirective$:i,values:t}),ve=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 Z=Be(class extends ve{constructor(i){if(super(i),i.type!==Rr.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 xt}});var Zt=class extends y{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return h`
180
+ `;var er={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=i=>(...t)=>({_$litDirective$:i,values:t}),Xt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var R=ge(class extends Xt{constructor(i){if(super(i),i.type!==er.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=i.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let o=!!t[r];o===this.st.has(r)||this.nt?.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return st}});var Lt=class extends u{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
376
181
  <div
377
- class=${Z({backdrop:!0})}
182
+ class=${R({backdrop:!0})}
378
183
  @click=${t=>{t.preventDefault()}}
379
184
  >
380
185
  <div class="dialog">
@@ -388,7 +193,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
388
193
  </div>
389
194
  </div>
390
195
  </div>
391
- `}};Zt.styles=[da],Zt=n([v("primer-dialog")],Zt);var Cu=Dn({tagName:"primer-dialog",elementClass:Zt,react:Vn});import{createComponent as Hn}from"@lit/react";import Un from"react";var ca=g`
196
+ `}};Lt.styles=[Ui],Lt=s([f("primer-dialog")],Lt);var La=Ta({tagName:"primer-dialog",elementClass:Lt,react:$a});import{createComponent as Na}from"@lit/react";import Ia from"react";var zi=h`
392
197
  :host {
393
198
  display: block;
394
199
  width: 100%;
@@ -448,17 +253,33 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
448
253
  transform: none;
449
254
  }
450
255
  }
451
- `;var pa={pencil:St`
256
+ `;var W=class extends u{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(e){e.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return c;let e={"error-message":!0,hidden:!this.visible};return d`
257
+ <div
258
+ part="error-message"
259
+ class=${R(e)}
260
+ aria-live="assertive"
261
+ aria-atomic="true"
262
+ >
263
+ <div part="error-icon" class="error-icon">
264
+ <primer-icon
265
+ name="failure-icon"
266
+ size="sm"
267
+ color="var(--primer-color-icon-negative)"
268
+ ></primer-icon>
269
+ </div>
270
+ <div part="error-content" class="error-content">${this.message}</div>
271
+ </div>
272
+ `}};W.styles=[zi],s([l({type:String})],W.prototype,"message",2),s([l({type:Boolean,reflect:!0})],W.prototype,"visible",2),s([l({type:String,reflect:!0})],W.prototype,"role",2),s([_()],W.prototype,"showMessage",2),W=s([f("primer-error-message")],W);var Ra=Na({tagName:"primer-error-message",elementClass:W,react:Ia});import{createComponent as Oa}from"@lit/react";import Da from"react";var Bi={pencil:nt`
452
273
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
453
274
  <path d="M12.3292 1.82659C12.142 1.63935 11.8779 1.53418 11.6028 1.53418C11.3277 1.53418 11.0636 1.63935 10.8764 1.82659L2.92969 9.77325V13.0666H6.22306L14.1698 5.11992C14.357 4.93268 14.4622 4.66859 14.4622 4.39352C14.4622 4.11844 14.357 3.85435 14.1698 3.66711L12.3292 1.82659ZM5.77375 11.7333H4.26302V10.2225L10.8764 3.60919L12.3871 5.11992L5.77375 11.7333Z" fill="currentColor"/>
454
275
  </svg>
455
- `,trash:St`
276
+ `,trash:nt`
456
277
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
457
278
  <path d="M13.8333 2.99992H11.5V2.49992C11.5 2.05789 11.3244 1.63397 11.0118 1.32141C10.6993 1.00885 10.2754 0.833252 9.83333 0.833252H6.16667C5.72464 0.833252 5.30072 1.00885 4.98816 1.32141C4.67559 1.63397 4.5 2.05789 4.5 2.49992V2.99992H2.16667C1.98986 2.99992 1.82029 3.07015 1.69526 3.19518C1.57024 3.32021 1.5 3.48978 1.5 3.66659C1.5 3.8434 1.57024 4.01297 1.69526 4.138C1.82029 4.26302 1.98986 4.33326 2.16667 4.33326H2.83333V12.4999C2.83333 12.942 3.00893 13.3659 3.32149 13.6784C3.63405 13.991 4.05797 14.1666 4.5 14.1666H11.5C11.942 14.1666 12.3659 13.991 12.6785 13.6784C12.9911 13.3659 13.1667 12.942 13.1667 12.4999V4.33326H13.8333C14.0101 4.33326 14.1797 4.26302 14.3047 4.138C14.4298 4.01297 14.5 3.8434 14.5 3.66659C14.5 3.48978 14.4298 3.32021 14.3047 3.19518C14.1797 3.07015 14.0101 2.99992 13.8333 2.99992ZM5.83333 2.49992C5.83333 2.32311 5.90357 2.15354 6.0286 2.02851C6.15362 1.90349 6.32319 1.83325 6.5 1.83325H9.5C9.67681 1.83325 9.84638 1.90349 9.9714 2.02851C10.0964 2.15354 10.1667 2.32311 10.1667 2.49992V2.99992H5.83333V2.49992ZM11.8333 12.4999C11.8333 12.6767 11.7631 12.8463 11.6381 12.9713C11.513 13.0964 11.3435 13.1666 11.1667 13.1666H4.83333C4.65652 13.1666 4.48695 13.0964 4.36193 12.9713C4.2369 12.8463 4.16667 12.6767 4.16667 12.4999V4.33326H11.8333V12.4999Z" fill="currentColor"/>
458
279
  <path d="M6.5 10.9999C6.67681 10.9999 6.84638 10.9297 6.9714 10.8047C7.09643 10.6796 7.16667 10.5101 7.16667 10.3333V7.33325C7.16667 7.15644 7.09643 6.98687 6.9714 6.86184C6.84638 6.73682 6.67681 6.66658 6.5 6.66658C6.32319 6.66658 6.15362 6.73682 6.0286 6.86184C5.90357 6.98687 5.83333 7.15644 5.83333 7.33325V10.3333C5.83333 10.5101 5.90357 10.6796 6.0286 10.8047C6.15362 10.9297 6.32319 10.9999 6.5 10.9999Z" fill="currentColor"/>
459
280
  <path d="M9.5 10.9999C9.67681 10.9999 9.84638 10.9297 9.9714 10.8047C10.0964 10.6796 10.1667 10.5101 10.1667 10.3333V7.33325C10.1667 7.15644 10.0964 6.98687 9.9714 6.86184C9.84638 6.73682 9.67681 6.66658 9.5 6.66658C9.32319 6.66658 9.15362 6.73682 9.0286 6.86184C8.90357 6.98687 8.83333 7.15644 8.83333 7.33325V10.3333C8.83333 10.5101 8.90357 10.6796 9.0286 10.8047C9.15362 10.9297 9.32319 10.9999 9.5 10.9999Z" fill="currentColor"/>
460
281
  </svg>
461
- `,"successful-check":St`
282
+ `,"successful-check":nt`
462
283
  <svg
463
284
  viewBox="0 0 56 56"
464
285
  fill="none"
@@ -473,7 +294,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
473
294
  />
474
295
  </g>
475
296
  </svg>
476
- `,"failure-icon":St`
297
+ `,"failure-icon":nt`
477
298
  <svg
478
299
  viewBox="0 0 40 40"
479
300
  fill="none"
@@ -485,27 +306,27 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
485
306
  d="M20.0008 23.3333C20.4614 23.3333 20.7873 22.9606 20.7873 22.5V15C20.7873 14.5394 20.4146 14.1666 20.0008 14.1666C19.587 14.1666 19.1675 14.5416 19.1675 15V22.5C19.1675 22.9583 19.5425 23.3333 20.0008 23.3333ZM32.9331 27.3594L22.5269 9.75935C22.0008 8.86821 21.0529 8.33488 20.0008 8.33331C18.9487 8.33331 18.006 8.8656 17.4748 9.75831L7.06331 27.3625C6.53987 28.2463 6.53206 29.3073 7.04134 30.201C7.568 31.1198 8.51904 31.6666 9.58935 31.6666H30.4175C31.4857 31.6666 32.4357 31.1182 32.9597 30.1995C33.4696 29.3073 33.4591 28.2448 32.9331 27.3594ZM18.7977 26.6666C18.7977 25.976 19.3107 25.4166 20.0008 25.4166C20.6935 25.4166 21.2508 25.9739 21.2039 26.6666C21.2039 27.3568 20.6909 27.9166 20.0008 27.9166C19.3576 27.9166 18.7977 27.3568 18.7977 26.6666Z"
486
307
  />
487
308
  </svg>
488
- `,"payment-card":St`
309
+ `,"payment-card":nt`
489
310
  <svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
490
311
  <rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
491
312
  <rect y="6.74805" width="28" height="4" fill="#212121"/>
492
313
  <rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
493
314
  </svg>
494
- `,"chevron-down":St`
315
+ `,"chevron-down":nt`
495
316
  <svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
496
317
  <path d="M4.41978 4.90118C4.32079 5.02361 4.16188 5.08353 4.00037 5.08353C3.83887 5.08353 3.67996 5.02361 3.55753 4.90118L0.63995 1.9836C0.395733 1.73939 0.395733 1.34382 0.63995 1.09947C0.884167 0.855124 1.27973 0.855254 1.52408 1.09947L4.00037 3.57524L6.47589 1.09973C6.72011 0.855515 7.11567 0.855515 7.36002 1.09973C7.60437 1.34395 7.60424 1.73952 7.36002 1.98386L4.41978 4.90118Z" fill="#212121"/>
497
- </svg>`,checkmark:St`
318
+ </svg>`,checkmark:nt`
498
319
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
499
320
  <path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" fill="#212121"/>
500
321
  </svg>
501
- `,close:St`
322
+ `,close:nt`
502
323
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
503
324
  <path
504
325
  d="M14.7551 13.734C15.0479 14.0269 15.0479 14.502 14.7551 14.7949C14.4622 15.0879 13.987 15.0878 13.6941 14.7949L10.0005 11.0738L6.28054 14.7937C5.98767 15.0866 5.51249 15.0866 5.21959 14.7937C4.92668 14.5008 4.92671 14.0256 5.21959 13.7327L8.94075 10.0141L5.21856 6.26604C4.92568 5.97316 4.92568 5.49798 5.21856 5.20508C5.51143 4.91217 5.98661 4.91221 6.27951 5.20508L10.0005 8.95438L13.7204 5.23446C14.0132 4.94159 14.4884 4.94159 14.7813 5.23446C15.0742 5.52734 15.0742 6.00252 14.7813 6.29542L11.0602 10.0141L14.7551 13.734Z"
505
326
  fill="#212121"
506
327
  />
507
328
  </svg>
508
- `};var ma=g`
329
+ `};var Fi=h`
509
330
  :host {
510
331
  display: inline-block;
511
332
  line-height: 0; /* so you don’t get extra space around the icon */
@@ -547,27 +368,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
547
368
  /* --internal used for abstracting away the icon component */
548
369
  fill: var(--internal-icon-color, currentColor);
549
370
  }
550
- `;var ft=class extends y{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?pa[this.name]:null;return h`
371
+ `;var Q=class extends u{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Bi[this.name]:null;return d`
551
372
  <div style="--internal-icon-color: ${this.color}">
552
- ${e||h`<slot></slot>`}
373
+ ${e||d`<slot></slot>`}
553
374
  </div>
554
- `}};ft.styles=[ma],n([p({type:String,reflect:!0})],ft.prototype,"color",2),n([p({type:String,reflect:!0})],ft.prototype,"size",2),n([p({reflect:!0})],ft.prototype,"name",2),ft=n([v("primer-icon")],ft);var pt=class extends y{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 h`
555
- <div
556
- part="error-message"
557
- class=${Z(e)}
558
- aria-live="assertive"
559
- aria-atomic="true"
560
- >
561
- <div part="error-icon" class="error-icon">
562
- <primer-icon
563
- name="failure-icon"
564
- size="sm"
565
- color="var(--primer-color-icon-negative)"
566
- ></primer-icon>
567
- </div>
568
- <div part="error-content" class="error-content">${this.message}</div>
569
- </div>
570
- `}};pt.styles=[ca],n([p({type:String})],pt.prototype,"message",2),n([p({type:Boolean,reflect:!0})],pt.prototype,"visible",2),n([p({type:String,reflect:!0})],pt.prototype,"role",2),n([I()],pt.prototype,"showMessage",2),pt=n([v("primer-error-message")],pt);var Wu=Hn({tagName:"primer-error-message",elementClass:pt,react:Un});import{createComponent as Yn}from"@lit/react";import Fn from"react";var tf=Yn({tagName:"primer-icon",elementClass:ft,react:Fn});import{createComponent as Kn}from"@lit/react";import Gn from"react";var ha=g`
375
+ `}};Q.styles=[Fi],s([l({type:String,reflect:!0})],Q.prototype,"color",2),s([l({type:String,reflect:!0})],Q.prototype,"size",2),s([l({reflect:!0})],Q.prototype,"name",2),Q=s([f("primer-icon")],Q);var Va=Oa({tagName:"primer-icon",elementClass:Q,react:Da});import{createComponent as Ua}from"@lit/react";import za from"react";var Ki=h`
571
376
  :host {
572
377
  display: contents;
573
378
  }
@@ -598,7 +403,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
598
403
  :host([disabled]) input::placeholder {
599
404
  color: var(--primer-color-text-disabled);
600
405
  }
601
- `;var zn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Bn(i){return zn.includes(i)}var Y=class extends y{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 h`
406
+ `;var Ya=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Ha(i){return Ya.includes(i)}var k=class extends u{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,o){this.inputElement?.setSelectionRange(e,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return d`
602
407
  <input
603
408
  part="input"
604
409
  class=${r}
@@ -623,7 +428,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
623
428
  @blur=${this.handleBlur}
624
429
  @invalid=${this.handleInvalid}
625
430
  />
626
- `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};Y.styles=[ha],n([Ot("input")],Y.prototype,"inputElement",2),n([p({type:String,reflect:!0})],Y.prototype,"value",2),n([p({type:String,reflect:!0})],Y.prototype,"placeholder",2),n([p({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),n([p({type:String,reflect:!0})],Y.prototype,"name",2),n([p({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Bn(e)?(e&&e!=="text"&&N.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],Y.prototype,"type",2),n([p({type:Boolean,reflect:!0})],Y.prototype,"required",2),n([p({type:Boolean,reflect:!0})],Y.prototype,"readonly",2),n([p({type:String,reflect:!0})],Y.prototype,"pattern",2),n([p({type:Number,reflect:!0})],Y.prototype,"minlength",2),n([p({type:Number,reflect:!0})],Y.prototype,"maxlength",2),n([p({type:String,reflect:!0})],Y.prototype,"min",2),n([p({type:String,reflect:!0})],Y.prototype,"max",2),n([p({type:String,reflect:!0})],Y.prototype,"step",2),n([p({type:String,reflect:!0})],Y.prototype,"autocomplete",2),n([p({type:String,reflect:!0})],Y.prototype,"id",2),n([I()],Y.prototype,"hasFocus",2),n([I()],Y.prototype,"hasError",2),Y=n([v("primer-input")],Y);var uf=Kn({tagName:"primer-input",elementClass:Y,react:Gn});import{createComponent as jn}from"@lit/react";import qn from"react";var ua=g`
431
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};k.styles=[Ki],s([vt("input")],k.prototype,"inputElement",2),s([l({type:String,reflect:!0})],k.prototype,"value",2),s([l({type:String,reflect:!0})],k.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],k.prototype,"disabled",2),s([l({type:String,reflect:!0})],k.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Ha(e)?(e&&e!=="text"&&A.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],k.prototype,"type",2),s([l({type:Boolean,reflect:!0})],k.prototype,"required",2),s([l({type:Boolean,reflect:!0})],k.prototype,"readonly",2),s([l({type:String,reflect:!0})],k.prototype,"pattern",2),s([l({type:Number,reflect:!0})],k.prototype,"minlength",2),s([l({type:Number,reflect:!0})],k.prototype,"maxlength",2),s([l({type:String,reflect:!0})],k.prototype,"min",2),s([l({type:String,reflect:!0})],k.prototype,"max",2),s([l({type:String,reflect:!0})],k.prototype,"step",2),s([l({type:String,reflect:!0})],k.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],k.prototype,"id",2),s([_()],k.prototype,"hasFocus",2),s([_()],k.prototype,"hasError",2),k=s([f("primer-input")],k);var Ba=Ua({tagName:"primer-input",elementClass:k,react:za});import{createComponent as Fa}from"@lit/react";import Ka from"react";var ji=h`
627
432
  :host {
628
433
  display: contents;
629
434
  }
@@ -639,7 +444,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
639
444
  display: block;
640
445
  font-family: var(--primer-typography-body-small-font);
641
446
  }
642
- `;var Pt=class extends y{constructor(){super(...arguments);this.for="";this.active=!0}render(){return h`
447
+ `;var dt=class extends u{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
643
448
  <span
644
449
  class="error"
645
450
  role="alert"
@@ -648,7 +453,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
648
453
  >
649
454
  <slot></slot>
650
455
  </span>
651
- `}};Pt.styles=[ua],n([p({type:String,reflect:!0})],Pt.prototype,"for",2),n([p({type:Boolean,reflect:!0})],Pt.prototype,"active",2),Pt=n([v("primer-input-error")],Pt);var Mf=jn({tagName:"primer-input-error",elementClass:Pt,react:qn});import{createComponent as Wn}from"@lit/react";import Zn from"react";var fa=g`
456
+ `}};dt.styles=[ji],s([l({type:String,reflect:!0})],dt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],dt.prototype,"active",2),dt=s([f("primer-input-error")],dt);var ja=Fa({tagName:"primer-input-error",elementClass:dt,react:Ka});import{createComponent as Ga}from"@lit/react";import qa from"react";var Gi=h`
652
457
  :host {
653
458
  display: inline-block;
654
459
  font-weight: var(--primer-typography-body-small-weight);
@@ -662,7 +467,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
662
467
  :host([disabled]) {
663
468
  color: var(--primer-color-text-disabled);
664
469
  }
665
- `;var wt=class extends y{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return h`<label for=${this.for}><slot></slot></label>`}};wt.styles=[fa],n([p({type:String,reflect:!0})],wt.prototype,"for",2),n([p({type:Boolean,reflect:!0})],wt.prototype,"disabled",2),wt=n([v("primer-input-label")],wt);var Vf=Wn({tagName:"primer-input-label",elementClass:wt,react:Zn});import{createComponent as Xn}from"@lit/react";import Jn from"react";var ga=g`
470
+ `;var pt=class extends u{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};pt.styles=[Gi],s([l({type:String,reflect:!0})],pt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],pt.prototype,"disabled",2),pt=s([f("primer-input-label")],pt);var Wa=Ga({tagName:"primer-input-label",elementClass:pt,react:qa});import{createComponent as Za}from"@lit/react";import Xa from"react";var qi=h`
666
471
  * {
667
472
  box-sizing: border-box;
668
473
  }
@@ -727,19 +532,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
727
532
  border-color: var(--primer-color-border-outlined-disabled);
728
533
  cursor: not-allowed;
729
534
  }
730
- `;var vt=class extends y{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 h`
535
+ `;var J=class extends u{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of e){let a=o.querySelector("primer-input");if(a)return a}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return d`
731
536
  <div class="input-wrapper">
732
537
  <slot name="label"></slot>
733
- <div class="${Z(e)}" @click="${this.handleWrapperClick}">
538
+ <div class="${R(e)}" @click="${this.handleWrapperClick}">
734
539
  <slot name="input"></slot>
735
540
  </div>
736
541
  <slot name="error"></slot>
737
542
  </div>
738
- `}};vt.styles=[ga],n([p({type:Boolean})],vt.prototype,"focusWithin",2),n([p({type:Boolean,reflect:!0,attribute:"has-error"})],vt.prototype,"hasError",2),n([Ot('slot[name="input"]')],vt.prototype,"inputSlot",2),vt=n([v("primer-input-wrapper")],vt);var Xf=Xn({tagName:"primer-input-wrapper",elementClass:vt,react:Jn});import{createComponent as Qn}from"@lit/react";import tl from"react";var ya=g`
543
+ `}};J.styles=[qi],s([l({type:Boolean})],J.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],J.prototype,"hasError",2),s([vt('slot[name="input"]')],J.prototype,"inputSlot",2),J=s([f("primer-input-wrapper")],J);var Qa=Za({tagName:"primer-input-wrapper",elementClass:J,react:Xa});import{createComponent as Ja}from"@lit/react";import ts from"react";var Wi=h`
739
544
  :host {
740
545
  display: none;
741
546
  }
742
- `;var Dt=class extends y{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(l=>s.appendChild(l))}render(){return h`<slot @slotchange=${this._handleSlotChange}></slot>`}};Dt.styles=[ya],n([I()],Dt.prototype,"id",2),Dt=n([v("primer-portal")],Dt);var dg=Qn({tagName:"primer-portal",elementClass:Dt,react:tl});import{createComponent as el}from"@lit/react";import rl from"react";var va=g`
547
+ `;var bt=class extends u{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let e=document.querySelector(`#${this.id}`);return e||(e=document.createElement("div"),e.id=this.id,document.body.appendChild(e),this._setupEventListeners(e)),e}_setupEventListeners(e){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{e.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(e){let o=e.target.assignedNodes();if(!o.length)return;let a=this.getContainer();o.forEach(n=>a.appendChild(n))}render(){return d`<slot @slotchange=${this._handleSlotChange}></slot>`}};bt.styles=[Wi],s([_()],bt.prototype,"id",2),bt=s([f("primer-portal")],bt);var es=Ja({tagName:"primer-portal",elementClass:bt,react:ts});import{createComponent as rs}from"@lit/react";import is from"react";var Zi=h`
743
548
  :host {
744
549
  display: inline-flex;
745
550
  align-items: center;
@@ -784,7 +589,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
784
589
  transform: rotate(360deg);
785
590
  }
786
591
  }
787
- `;var Ni={small:16,medium:24,large:32},bt=class extends y{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ni)return Ni[this.size];let e=parseInt(this.size,10);return isNaN(e)?Ni.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`),h`
592
+ `;var zr={small:16,medium:24,large:32},tt=class extends u{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in zr)return zr[this.size];let e=parseInt(this.size,10);return isNaN(e)?zr.medium:e}render(){let e=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),d`
788
593
  <div class="spinner-container ${this.compact?"compact":""}">
789
594
  <svg
790
595
  class="spinner"
@@ -803,7 +608,201 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
803
608
  />
804
609
  </svg>
805
610
  </div>
806
- `}};bt.styles=[va],n([p({type:String})],bt.prototype,"color",2),n([p({type:String})],bt.prototype,"size",2),n([p({type:Boolean})],bt.prototype,"compact",2),bt=n([v("primer-spinner")],bt);var Cg=el({tagName:"primer-spinner",elementClass:bt,react:rl});import{createComponent as il}from"@lit/react";import ol from"react";var ba=g`
611
+ `}};tt.styles=[Zi],s([l({type:String})],tt.prototype,"color",2),s([l({type:String})],tt.prototype,"size",2),s([l({type:Boolean})],tt.prototype,"compact",2),tt=s([f("primer-spinner")],tt);var os=rs({tagName:"primer-spinner",elementClass:tt,react:is});import{createComponent as as}from"@lit/react";import ss from"react";var Xi=h`
612
+ :host {
613
+ display: contents;
614
+ }
615
+
616
+ button {
617
+ align-items: center;
618
+ border-radius: var(--primer-radius-medium);
619
+ border: none;
620
+ cursor: pointer;
621
+ display: flex;
622
+ font-family: var(--primer-typography-title-large-font);
623
+ font-size: var(--primer-typography-title-large-size);
624
+ font-weight: var(--primer-typography-title-large-weight);
625
+ gap: var(--primer-space-small);
626
+ justify-content: center;
627
+ letter-spacing: var(--primer-typography-title-large-letter-spacing);
628
+ line-height: var(--primer-typography-title-large-line-height);
629
+ outline: none;
630
+ padding: var(--primer-space-medium) var(--primer-space-medium);
631
+ position: relative;
632
+ transition: all 0.2s ease-in-out;
633
+ }
634
+
635
+ .button-content {
636
+ display: flex;
637
+ height: 100%;
638
+ align-items: center;
639
+ gap: var(--primer-space-small);
640
+ justify-content: center;
641
+ transition: opacity var(--primer-animation-duration)
642
+ var(--primer-animation-easing);
643
+ }
644
+
645
+ /* Reduce opacity of text during loading for better focus on the spinner */
646
+ .button-content.loading {
647
+ opacity: 0.65;
648
+ }
649
+
650
+ :host([selectable]) button {
651
+ justify-content: space-between;
652
+ }
653
+
654
+ /* Primary variant */
655
+ :host([variant='primary']) button {
656
+ background-color: var(--primer-color-brand);
657
+ /* This is correct (color-background for color) because Button is kind of a special component */
658
+ color: var(--primer-color-background-outlined-default);
659
+ }
660
+ :host([variant='primary']:not([disabled]):not([loading])) button:hover {
661
+ filter: brightness(105%);
662
+ }
663
+ :host([variant='primary']:not([disabled]):not([loading])) button:active {
664
+ filter: brightness(98%);
665
+ }
666
+ :host([variant='primary']) button:focus-visible {
667
+ outline: 2px solid var(--primer-color-brand);
668
+ outline-offset: 2px;
669
+ }
670
+
671
+ /* Disabled state for primary button */
672
+ :host([variant='primary'][disabled]:not([loading])) button,
673
+ :host([variant='primary']:not([loading])) button:disabled {
674
+ color: var(--primer-color-text-disabled);
675
+ background-color: var(--primer-color-background-outlined-disabled);
676
+ cursor: not-allowed;
677
+ }
678
+
679
+ /* Loading state for primary button - OVERRIDES disabled styles with higher specificity */
680
+ :host([variant='primary'][loading]) button {
681
+ background-color: var(--primer-color-brand);
682
+ opacity: 0.8;
683
+ color: var(--primer-color-background-outlined-default);
684
+ cursor: wait;
685
+ }
686
+
687
+ /* Secondary variant */
688
+ :host([variant='secondary']) button {
689
+ background-color: var(--primer-color-background-outlined-default);
690
+ color: var(--primer-color-text-primary);
691
+ border: 1px solid var(--primer-color-border-outlined-default);
692
+ }
693
+ :host([variant='secondary']:not([disabled]):not([loading])) button:hover {
694
+ background-color: var(--primer-color-background-outlined-hover);
695
+ }
696
+ :host([variant='secondary']:not([disabled]):not([loading])) button:active {
697
+ background-color: var(--primer-color-background-outlined-active);
698
+ }
699
+ :host([variant='secondary']) button:focus-visible {
700
+ outline: 2px solid var(--primer-color-border-outlined-focus);
701
+ outline-offset: 2px;
702
+ }
703
+
704
+ /* Disabled state for secondary button */
705
+ :host([variant='secondary'][disabled]:not([loading])) button,
706
+ :host([variant='secondary']:not([loading])) button:disabled {
707
+ background-color: var(--primer-color-background-outlined-disabled);
708
+ border-color: var(--primer-color-border-outlined-disabled);
709
+ color: var(--primer-color-text-disabled);
710
+ cursor: not-allowed;
711
+ }
712
+
713
+ /* Loading state for secondary button - OVERRIDES disabled styles */
714
+ :host([variant='secondary'][loading]) button {
715
+ background-color: var(--primer-color-gray-100);
716
+ border-color: var(--primer-color-gray-300);
717
+ color: var(--primer-color-gray-600);
718
+ cursor: wait;
719
+ }
720
+
721
+ /* Tertiary variant */
722
+ :host([variant='tertiary']) button {
723
+ background-color: var(--primer-color-background-transparent-default);
724
+ border: 1px solid var(--primer-color-border-transparent-default);
725
+ color: var(--primer-color-text-primary);
726
+ border-radius: var(--primer-radius-small);
727
+ padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall);
728
+ }
729
+ :host([variant='tertiary']:not([disabled]):not([loading])) button:hover {
730
+ border-radius: var(--primer-radius-small);
731
+ background-color: var(--primer-color-background-transparent-hover);
732
+ border: 1px solid var(--primer-color-border-transparent-hover);
733
+ color: var(--primer-color-text-primary);
734
+ }
735
+ :host([variant='tertiary']:not([disabled]):not([loading])) button:active {
736
+ background-color: var(--primer-color-background-transparent-active);
737
+ border-color: var(--primer-color-border-transparent-active);
738
+ border-radius: var(--primer-radius-small);
739
+ color: var(--primer-color-text-primary);
740
+ }
741
+ :host([variant='tertiary']) button:focus-visible {
742
+ border-radius: var(--primer-radius-small);
743
+ background-color: var(--primer-color-background-transparent-focus);
744
+ outline: 2px solid var(--primer-color-border-transparent-focus);
745
+ outline-offset: 2px;
746
+ }
747
+
748
+ /* Disabled state for tertiary button */
749
+ :host([variant='tertiary'][disabled]:not([loading])) button,
750
+ :host([variant='tertiary']:not([loading])) button:disabled {
751
+ background-color: var(--primer-color-border-transparent-disabled);
752
+ color: var(--primer-color-text-disabled);
753
+ cursor: not-allowed;
754
+ }
755
+
756
+ /* Loading state for tertiary button - OVERRIDES disabled styles */
757
+ :host([variant='tertiary'][loading]) button {
758
+ background-color: var(--primer-color-gray-100);
759
+ color: var(--primer-color-gray-600);
760
+ cursor: wait;
761
+ }
762
+
763
+ /* Checked state styling */
764
+ :host([selectionState='checked']) button {
765
+ border: 1px solid var(--primer-color-brand);
766
+ background-color: var(--primer-color-gray-100);
767
+ }
768
+
769
+ /* Loading state - center spinner with content */
770
+ :host([loading]) primer-spinner {
771
+ margin-right: var(--primer-space-xsmall);
772
+ }
773
+
774
+ /* Special case for tertiary variant loading state spinner size */
775
+ :host([variant='tertiary'][loading]) primer-spinner {
776
+ transform: scale(0.85);
777
+ }
778
+ `;var U=class extends u{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?c:d`
779
+ <primer-icon
780
+ name="checkmark"
781
+ size="sm"
782
+ color="var(--primer-color-icon-primary)"
783
+ ></primer-icon>
784
+ `}renderSpinner(){if(!this.loading)return c;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),d`
785
+ <primer-spinner
786
+ size="small"
787
+ color="${e}"
788
+ compact
789
+ ></primer-spinner>
790
+ `}render(){return d`
791
+ <button
792
+ type=${this.buttonType}
793
+ ?disabled=${this.disabled||this.loading}
794
+ @click=${this.handleClick}
795
+ part="button"
796
+ aria-checked=${this.selectionState==="checked"}
797
+ aria-busy=${this.loading}
798
+ >
799
+ ${this.renderSpinner()}
800
+ <span class="button-content ${this.loading?"loading":""}">
801
+ <slot></slot>
802
+ </span>
803
+ ${this.renderCheckmark()}
804
+ </button>
805
+ `}};U.styles=[S,Xi],s([l({type:String,reflect:!0})],U.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],U.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],U.prototype,"loading",2),s([l({type:String,attribute:"type"})],U.prototype,"buttonType",2),s([l({type:String,reflect:!0})],U.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],U.prototype,"selectable",2),U=s([f("primer-button")],U);var ns=as({tagName:"primer-button",elementClass:U,react:ss});import{createComponent as ls}from"@lit/react";import ds from"react";var Qi=h`
807
806
  :host {
808
807
  display: flex;
809
808
  flex-direction: column;
@@ -888,12 +887,12 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
888
887
  flex-direction: column;
889
888
  }
890
889
  }
891
- `;function Ea(){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 $r=class{constructor(t,e){this.formState=Ea();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=Ea(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var ot=class extends y{constructor(){super(...arguments);this.formController=new $r(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 V(this,{task:async([e])=>e!=="STRIPE_ACH"?R: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 h`
890
+ `;function Ji(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var rr=class{constructor(t,e){this.formState=Ji();this.host=t,this.validate=e,t.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(t,e){let r=this.formState[t];r.value=e,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(t,e=!1){e&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),t.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:t}})),this.host.requestUpdate()}setFieldTouched(t){this.formState[t].touched||(this.formState[t].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Ji(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var z=class extends u{constructor(){super(...arguments);this.formController=new rr(this,e=>this._paymentMethodManagerTask.value.setAndValidate(e));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new P(this,{task:async([e])=>e!=="STRIPE_ACH"?E:this.paymentManagers.get(e)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(e,r){let o=e.target;this.formController.setFieldValue(r,o.value)}_handleBlur(e){this.formController.setFieldTouched(e)}_handleError(e){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error occurred")}}))}async _handleSubmitButtonClick(e){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await e.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(e);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(e){try{await e.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}renderForm(e){return d`
892
891
  <h2>
893
- ${T("payWithAch",{id:"payWithAch"})}
892
+ ${C("payWithAch",{id:"payWithAch"})}
894
893
  </h2>
895
894
  <p>
896
- ${T("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
895
+ ${C("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
897
896
  </p>
898
897
 
899
898
  <form @submit=${r=>r.preventDefault()}>
@@ -902,7 +901,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
902
901
  .hasError=${this.formController.hasError.firstName}
903
902
  >
904
903
  <primer-input-label slot="label">
905
- ${T("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
904
+ ${C("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
906
905
  </primer-input-label>
907
906
  <primer-input
908
907
  slot="input"
@@ -912,14 +911,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
912
911
  ?disabled=${this.isSubmitting}
913
912
  ></primer-input>
914
913
  <primer-input-error slot="error">
915
- ${this.formController.hasError.firstName?this.formController.formState.firstName.error:u}
914
+ ${this.formController.hasError.firstName?this.formController.formState.firstName.error:c}
916
915
  </primer-input-error>
917
916
  </primer-input-wrapper>
918
917
  <primer-input-wrapper
919
918
  .hasError=${this.formController.hasError.lastName}
920
919
  >
921
920
  <primer-input-label slot="label">
922
- ${T("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
921
+ ${C("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
923
922
  </primer-input-label>
924
923
  <primer-input
925
924
  slot="input"
@@ -930,7 +929,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
930
929
  >
931
930
  </primer-input>
932
931
  <primer-input-error slot="error">
933
- ${this.formController.hasError.lastName?this.formController.formState.lastName.error:u}
932
+ ${this.formController.hasError.lastName?this.formController.formState.lastName.error:c}
934
933
  </primer-input-error>
935
934
  </primer-input-wrapper>
936
935
  </div>
@@ -938,7 +937,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
938
937
  .hasError=${this.formController.hasError.emailAddress}
939
938
  >
940
939
  <primer-input-label slot="label">
941
- ${T("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
940
+ ${C("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
942
941
  </primer-input-label>
943
942
  <primer-input
944
943
  slot="input"
@@ -949,11 +948,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
949
948
  ?disabled=${this.isSubmitting}
950
949
  ></primer-input>
951
950
  <primer-input-error slot="error">
952
- ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:u}
951
+ ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:c}
953
952
  </primer-input-error>
954
953
  </primer-input-wrapper>
955
954
  <p>
956
- ${T("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
955
+ ${C("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
957
956
  </p>
958
957
  <primer-button
959
958
  buttonType="submit"
@@ -962,16 +961,16 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
962
961
  ?disabled=${this.isSubmitting}
963
962
  ?loading=${this.isSubmitting}
964
963
  >
965
- ${T("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
964
+ ${C("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
966
965
  </primer-button>
967
966
  </form>
968
- `}renderMandate(){return h`
967
+ `}renderMandate(){return d`
969
968
  <h2>
970
- ${T("payWithAch",{id:"payWithAch"})}
969
+ ${C("payWithAch",{id:"payWithAch"})}
971
970
  </h2>
972
971
 
973
972
  <p>
974
- ${this.clientOptions?.stripe?.mandateData.fullMandateText??T("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
973
+ ${this.clientOptions?.stripe?.mandateData.fullMandateText??C("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
975
974
  </p>
976
975
 
977
976
  <div class="button-group">
@@ -981,7 +980,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
981
980
  ?disabled=${this.isSubmitting}
982
981
  ?loading=${this.isSubmitting}
983
982
  >
984
- ${T("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
983
+ ${C("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
985
984
  </primer-button>
986
985
 
987
986
  <primer-button
@@ -989,10 +988,10 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
989
988
  @click=${this._handleDeclineMandate.bind(this)}
990
989
  ?disabled=${this.isSubmitting}
991
990
  >
992
- ${T("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
991
+ ${C("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
993
992
  </primer-button>
994
993
  </div>
995
- `}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():u})}};ot.styles=[$,ba],n([p({type:Object})],ot.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0}),p({attribute:!1})],ot.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0}),p({attribute:!1})],ot.prototype,"sdkState",2),n([P({context:me,subscribe:!0}),p({attribute:!1})],ot.prototype,"clientOptions",2),n([I()],ot.prototype,"screen",2),n([I()],ot.prototype,"isSubmitting",2),ot=n([v("primer-ach-payment"),z()],ot);var Gg=il({tagName:"primer-ach-payment",elementClass:ot,react:ol});import{createComponent as al}from"@lit/react";import sl from"react";var Or="card-form-context";var Ca=g`
994
+ `}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():c})}};z.styles=[S,Qi],s([l({type:Object})],z.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0}),l({attribute:!1})],z.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0}),l({attribute:!1})],z.prototype,"sdkState",2),s([v({context:Kt,subscribe:!0}),l({attribute:!1})],z.prototype,"clientOptions",2),s([_()],z.prototype,"screen",2),s([_()],z.prototype,"isSubmitting",2),z=s([f("primer-ach-payment"),T()],z);var ps=ls({tagName:"primer-ach-payment",elementClass:z,react:ds});import{createComponent as cs}from"@lit/react";import ms from"react";var ir="card-form-context";var to=h`
996
995
  :host {
997
996
  display: contents;
998
997
  }
@@ -1015,10 +1014,10 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1015
1014
  display: flex;
1016
1015
  gap: var(--primer-space-small);
1017
1016
  }
1018
- `;var gt=class extends y{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:Or,initialValue:null});this.eventsController=new ce(this);this.setupCardFormTask=new V(this,{task:async([e])=>{if(!e?.manager)return R;let{manager:r}=e,{cardNumberInput:o,expiryInput:s,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:s,cvvInput:l,setCardholderName:f=>r.setCardholderName(f),setCardNetwork:f=>{this.selectedCardNetwork=f},validate:()=>r.validate(),submit:f=>r.submit(f),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}updated(e){super.updated(e),e.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),o=r==="button",s=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||s&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===$t.ERROR||this.setupCardFormTask.status===$t.INITIAL?u:h`
1017
+ `;var Z=class extends u{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new I(this,{context:ir,initialValue:null});this.eventsController=new Bt(this);this.setupCardFormTask=new P(this,{task:async([e])=>{if(!e?.manager)return E;let{manager:r}=e,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:m=>r.setCardholderName(m),setCardNetwork:m=>{this.selectedCardNetwork=m},validate:()=>r.validate(),submit:m=>r.submit(m),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}updated(e){super.updated(e),e.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),o=r==="button",a=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||a&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===yt.ERROR||this.setupCardFormTask.status===yt.INITIAL?c:d`
1019
1018
  <form @submit=${this.handleFormSubmit}>
1020
1019
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1021
- ${this.setupCardFormTask.render({complete:()=>U(this.hasAssignedContent,()=>u,()=>h`
1020
+ ${this.setupCardFormTask.render({complete:()=>w(this.hasAssignedContent,()=>c,()=>d`
1022
1021
  <div class="card-form">
1023
1022
  <primer-input-card-number></primer-input-card-number>
1024
1023
  <div class="card-form-row">
@@ -1030,11 +1029,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1030
1029
  <primer-card-form-submit></primer-card-form-submit>
1031
1030
  `)})}
1032
1031
  </form>
1033
- `}};gt.styles=[$,Ca],n([p({type:Boolean,attribute:"hide-labels",reflect:!0})],gt.prototype,"hideLabels",2),n([I()],gt.prototype,"hasAssignedContent",2),n([I()],gt.prototype,"selectedCardNetwork",2),n([P({context:Q,subscribe:!0}),p({type:Object})],gt.prototype,"paymentManagers",2),gt=n([v("primer-card-form"),z()],gt);var uy=al({tagName:"primer-card-form",elementClass:gt,react:sl});import{createComponent as nl}from"@lit/react";import ll from"react";var Aa=g`
1032
+ `}};Z.styles=[S,to],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],Z.prototype,"hideLabels",2),s([_()],Z.prototype,"hasAssignedContent",2),s([_()],Z.prototype,"selectedCardNetwork",2),s([v({context:V,subscribe:!0}),l({type:Object})],Z.prototype,"paymentManagers",2),Z=s([f("primer-card-form"),T()],Z);var hs=cs({tagName:"primer-card-form",elementClass:Z,react:ms});import{createComponent as us}from"@lit/react";import fs from"react";var eo=h`
1034
1033
  :host {
1035
1034
  display: contents;
1036
1035
  }
1037
- `;var at=class extends y{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:T("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 h`
1036
+ `;var B=class extends u{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=e=>{if(e.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:C("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:c;return d`
1038
1037
  <primer-button
1039
1038
  type="submit"
1040
1039
  variant=${this.variant}
@@ -1045,7 +1044,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1045
1044
  >
1046
1045
  ${this.buttonText}${r}
1047
1046
  </primer-button>
1048
- `}};at.styles=[$,Aa],n([p({type:String})],at.prototype,"buttonText",1),n([P({context:ct,subscribe:!0}),p({type:Object})],at.prototype,"headlessInstance",2),n([P({context:me,subscribe:!0}),p({type:Object})],at.prototype,"clientOptions",2),n([P({context:G,subscribe:!0}),p()],at.prototype,"sdkState",2),n([p({type:String})],at.prototype,"variant",2),n([p({type:Boolean})],at.prototype,"disabled",2),at=n([v("primer-card-form-submit"),z()],at);var $y=nl({tagName:"primer-card-form-submit",elementClass:at,react:ll});import{createComponent as ml}from"@lit/react";import hl from"react";var{I:Vy}=ta;var _a=i=>i.strings===void 0;var Ke=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Ke(r,t);return!0},Dr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},xa=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),pl(t)}};function dl(i){this._$AN!==void 0?(Dr(this),this._$AM=i,xa(this)):this._$AM=i}function cl(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++)Ke(r[s],!1),Dr(r[s]);else r!=null&&(Ke(r,!1),Dr(r));else Ke(this,i)}var pl=i=>{i.type==Rr.CHILD&&(i._$AP??(i._$AP=cl),i._$AQ??(i._$AQ=dl))},Vr=class extends ve{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),xa(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Ke(this,t),Dr(this))}setValue(t){if(_a(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 Ri=()=>new Li,Li=class{},Ii=new WeakMap,Hr=Be(class extends Vr{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=Ii.get(t);e===void 0&&(e=new WeakMap,Ii.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"?Ii.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 Sa=g`
1047
+ `}};B.styles=[S,eo],s([l({type:String})],B.prototype,"buttonText",1),s([v({context:j,subscribe:!0}),l({type:Object})],B.prototype,"headlessInstance",2),s([v({context:Kt,subscribe:!0}),l({type:Object})],B.prototype,"clientOptions",2),s([v({context:L,subscribe:!0}),l()],B.prototype,"sdkState",2),s([l({type:String})],B.prototype,"variant",2),s([l({type:Boolean})],B.prototype,"disabled",2),B=s([f("primer-card-form-submit"),T()],B);var gs=us({tagName:"primer-card-form-submit",elementClass:B,react:fs});import{createComponent as Cs}from"@lit/react";import xs from"react";var{I:If}=Ni;var ro=i=>i.strings===void 0;var ye=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),ye(r,t);return!0},or=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},io=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),bs(t)}};function ys(i){this._$AN!==void 0?(or(this),this._$AM=i,io(this)):this._$AM=i}function vs(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let a=e;a<r.length;a++)ye(r[a],!1),or(r[a]);else r!=null&&(ye(r,!1),or(r));else ye(this,i)}var bs=i=>{i.type==er.CHILD&&(i._$AP??(i._$AP=vs),i._$AQ??(i._$AQ=ys))},ar=class extends Xt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),io(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ye(this,t),or(this))}setValue(t){if(ro(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Kr=()=>new Fr,Fr=class{},Br=new WeakMap,sr=ge(class extends ar{render(i){return c}update(i,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),c}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=Br.get(t);e===void 0&&(e=new WeakMap,Br.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?Br.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var oo=h`
1049
1048
  :host {
1050
1049
  display: flex;
1051
1050
  align-items: center;
@@ -1168,65 +1167,67 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1168
1167
  width: var(--primer-size-small);
1169
1168
  height: var(--primer-size-small);
1170
1169
  }
1171
- `;var st=class extends y{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Ri();this.dropdownRef=Ri();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 h`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return h`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return h`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return h`
1170
+ `;var F=class extends u{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Kr();this.dropdownRef=Kr();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return d`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return d`
1172
1171
  <button
1173
- ${Hr(this.buttonRef)}
1172
+ ${sr(this.buttonRef)}
1174
1173
  class="network-selector"
1175
1174
  @click=${this.toggleDropdown}
1176
- @keydown=${s=>{(s.key===" "||s.key==="Enter")&&o&&(s.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1175
+ @keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1177
1176
  aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1178
- aria-expanded=${o?this.isDropdownOpen:u}
1179
- aria-haspopup=${o?"true":u}
1180
- aria-controls=${o?"network-dropdown":u}
1177
+ aria-expanded=${o?this.isDropdownOpen:c}
1178
+ aria-haspopup=${o?"true":c}
1179
+ aria-controls=${o?"network-dropdown":c}
1181
1180
  >
1182
1181
  <img
1183
1182
  class="network-icon"
1184
1183
  src=${this.getNetworkIconUrl(r)}
1185
1184
  alt=${r.displayName}
1186
1185
  />
1187
- ${U(o,()=>h`
1186
+ ${w(o,()=>d`
1188
1187
  <primer-icon
1189
1188
  class="caret ${this.isDropdownOpen?"open":""}"
1189
+ size="sm"
1190
1190
  name="chevron-down"
1191
1191
  ></primer-icon>
1192
- `,()=>u)}
1192
+ `,()=>c)}
1193
1193
  </button>
1194
1194
 
1195
- ${U(this.isDropdownOpen,()=>h`
1195
+ ${w(this.isDropdownOpen,()=>d`
1196
1196
  <div
1197
- ${Hr(this.dropdownRef)}
1197
+ ${sr(this.dropdownRef)}
1198
1198
  id="network-dropdown"
1199
1199
  class="dropdown open"
1200
1200
  role="listbox"
1201
1201
  aria-label="Select card network"
1202
1202
  >
1203
- ${e.map((s,l)=>h`
1203
+ ${e.map((a,n)=>d`
1204
1204
  <div
1205
- ${Hr(f=>this.setNetworkOptionRef(f,l))}
1206
- class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
1207
- @click=${f=>this.selectNetwork(f,s)}
1208
- @keydown=${f=>{(f.key==="Enter"||f.key===" ")&&this.selectNetwork(f,s)}}
1205
+ ${sr(m=>this.setNetworkOptionRef(m,n))}
1206
+ class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
1207
+ @click=${m=>this.selectNetwork(m,a)}
1208
+ @keydown=${m=>{(m.key==="Enter"||m.key===" ")&&this.selectNetwork(m,a)}}
1209
1209
  role="option"
1210
- aria-selected=${s.network===r.network}
1211
- tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
1210
+ aria-selected=${a.network===r.network}
1211
+ tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
1212
1212
  >
1213
1213
  <img
1214
1214
  class="network-option-icon"
1215
- src=${this.getNetworkIconUrl(s)}
1216
- alt=${s.displayName}
1215
+ src=${this.getNetworkIconUrl(a)}
1216
+ alt=${a.displayName}
1217
1217
  />
1218
- <span class="network-name">${s.displayName}</span>
1219
- ${U(s.network===r.network,()=>h`
1218
+ <span class="network-name">${a.displayName}</span>
1219
+ ${w(a.network===r.network,()=>d`
1220
1220
  <primer-icon
1221
1221
  class="checkmark"
1222
1222
  name="checkmark"
1223
+ size="sm"
1223
1224
  ></primer-icon>
1224
- `,()=>u)}
1225
+ `,()=>c)}
1225
1226
  </div>
1226
1227
  `)}
1227
1228
  </div>
1228
- `,()=>u)}
1229
- `}};st.styles=[$,Sa],n([P({context:dr,subscribe:!0})],st.prototype,"cardNetworks",2),n([P({context:ct,subscribe:!0})],st.prototype,"headlessUtils",2),n([I()],st.prototype,"selectedCardNetwork",2),n([I()],st.prototype,"isDropdownOpen",2),n([I()],st.prototype,"focusedNetworkIndex",2),n([I()],st.prototype,"isKeyboardNavigation",2),st=n([v("primer-card-network-selector")],st);var gv=ml({tagName:"primer-card-network-selector",elementClass:st,react:hl});import{createComponent as ul}from"@lit/react";import fl from"react";function Ma(i,t){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
1229
+ `,()=>c)}
1230
+ `}};F.styles=[S,oo],s([v({context:Te,subscribe:!0})],F.prototype,"cardNetworks",2),s([v({context:j,subscribe:!0})],F.prototype,"headlessUtils",2),s([_()],F.prototype,"selectedCardNetwork",2),s([_()],F.prototype,"isDropdownOpen",2),s([_()],F.prototype,"focusedNetworkIndex",2),s([_()],F.prototype,"isKeyboardNavigation",2),F=s([f("primer-card-network-selector")],F);var As=Cs({tagName:"primer-card-network-selector",elementClass:F,react:xs});import{createComponent as _s}from"@lit/react";import Es from"react";function ao(i,t){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
1230
1231
  input[data-custom-input]::placeholder {
1231
1232
  color: var(--primer-color-text-placeholder);
1232
1233
  font-size: var(--primer-typography-body-large-size);
@@ -1235,44 +1236,44 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1235
1236
  input[data-custom-input]:focus {
1236
1237
  outline: none;
1237
1238
  }
1238
- `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Pa(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 wa(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var Ur=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new 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 R;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):R}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,Ma(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=Pa(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,wa(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 X=class extends y{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:T(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new Ur(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===$t.ERROR)return u;let e=this.getError();return h`
1239
+ `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function so(i){return i?{paddingHorizontal:0,placeholder:{color:i.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim()},height:i.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim(),color:i.getPropertyValue("--primer-color-text-primary").trim()}:null}function no(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var nr=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new P(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return E;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):E}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,ao(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(a=>requestAnimationFrame(()=>a())),this._hostedInput=t;let r=so(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",a=>{this._meta=a,no(this._meta,a)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var O=class extends u{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:C(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new nr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===yt.ERROR)return c;let e=this.getError();return d`
1239
1240
  <primer-input-wrapper
1240
1241
  .focusWithin="${this.hostedInputController.isFocused}"
1241
1242
  .hasError=${!!e}
1242
1243
  @wrapper-click="${this.handleWrapperClick}"
1243
1244
  >
1244
- ${U(!this.cardFormContext?.hideLabels,()=>h`<primer-input-label slot="label"
1245
+ ${w(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
1245
1246
  >${this.label}</primer-input-label
1246
- >`,()=>u)}
1247
+ >`,()=>c)}
1247
1248
  <div
1248
1249
  slot="input"
1249
1250
  class="card-input-slot"
1250
1251
  id="${this.config.containerSelector.substring(1)}"
1251
1252
  aria-label="${this.ariaLabel}"
1252
1253
  ></div>
1253
- ${U(e,()=>h`
1254
+ ${w(e,()=>d`
1254
1255
  <primer-input-error slot="error">
1255
- ${T(e,{id:e})}
1256
+ ${C(e,{id:e})}
1256
1257
  </primer-input-error>
1257
- `,()=>u)}
1258
+ `,()=>c)}
1258
1259
  </primer-input-wrapper>
1259
- `}};n([P({context:Or,subscribe:!0})],X.prototype,"cardFormContext",2),n([P({context:he,subscribe:!0}),p()],X.prototype,"computedStyles",2),n([p({type:String})],X.prototype,"label",1),n([p({type:String})],X.prototype,"placeholder",1),n([p({type:String,attribute:"aria-label"})],X.prototype,"ariaLabel",1);var Ta=g`
1260
+ `}};s([v({context:ir,subscribe:!0})],O.prototype,"cardFormContext",2),s([v({context:jt,subscribe:!0}),l()],O.prototype,"computedStyles",2),s([l({type:String})],O.prototype,"label",1),s([l({type:String})],O.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],O.prototype,"ariaLabel",1);var lo=h`
1260
1261
  :host {
1261
1262
  display: contents;
1262
1263
  }
1263
- `;var Vt=g`
1264
+ `;var Ct=h`
1264
1265
  .card-input-slot {
1265
1266
  display: flex;
1266
1267
  }
1267
- `;var Xt=class extends X{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};Xt.styles=[$,Vt,Ta],Xt=n([v("primer-input-card-holder-name"),z()],Xt);var eb=ul({tagName:"primer-input-card-holder-name",elementClass:Xt,react:fl});import{createComponent as gl}from"@lit/react";import yl from"react";var ka=g`
1268
+ `;var Nt=class extends O{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};Nt.styles=[S,Ct,lo],Nt=s([f("primer-input-card-holder-name"),T()],Nt);var Ss=_s({tagName:"primer-input-card-holder-name",elementClass:Nt,react:Es});import{createComponent as Ps}from"@lit/react";import ws from"react";var po=h`
1268
1269
  :host {
1269
1270
  display: contents;
1270
1271
  }
1271
- `;var Jt=class extends X{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};Jt.styles=[$,Vt,ka],Jt=n([v("primer-input-card-expiry"),z()],Jt);var yb=gl({tagName:"primer-input-card-expiry",elementClass:Jt,react:yl});import{createComponent as vl}from"@lit/react";import bl from"react";var Na=g`
1272
+ `;var It=class extends O{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};It.styles=[S,Ct,po],It=s([f("primer-input-card-expiry"),T()],It);var Ms=Ps({tagName:"primer-input-card-expiry",elementClass:It,react:ws});import{createComponent as ks}from"@lit/react";import Ts from"react";var co=h`
1272
1273
  :host {
1273
1274
  display: contents;
1274
1275
  }
1275
- `;var Qt=class extends X{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Qt.styles=[$,Vt,Na],Qt=n([v("primer-input-cvv"),z()],Qt);var Lb=vl({tagName:"primer-input-cvv",elementClass:Qt,react:bl});import{createComponent as El}from"@lit/react";import Cl from"react";var Ia=g`
1276
+ `;var Rt=class extends O{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Rt.styles=[S,Ct,co],Rt=s([f("primer-input-cvv"),T()],Rt);var $s=ks({tagName:"primer-input-cvv",elementClass:Rt,react:Ts});import{createComponent as Ls}from"@lit/react";import Ns from"react";var mo=h`
1276
1277
  :host {
1277
1278
  display: contents;
1278
1279
  }
@@ -1296,14 +1297,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1296
1297
  align-items: center;
1297
1298
  z-index: 2;
1298
1299
  }
1299
- `;var te=class extends X{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===$t.ERROR)return u;let e=this.getError();return h`
1300
+ `;var Ot=class extends O{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===yt.ERROR)return c;let e=this.getError();return d`
1300
1301
  <primer-input-wrapper
1301
1302
  .focusWithin="${this.hostedInputController.isFocused}"
1302
1303
  .hasError=${!!e}
1303
1304
  >
1304
- ${U(!this.cardFormContext?.hideLabels,()=>h`<primer-input-label slot="label"
1305
+ ${w(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
1305
1306
  >${this.label}</primer-input-label
1306
- >`,()=>u)}
1307
+ >`,()=>c)}
1307
1308
  <div
1308
1309
  slot="input"
1309
1310
  class="card-number-container"
@@ -1316,13 +1317,13 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1316
1317
  ></primer-card-network-selector>
1317
1318
  </div>
1318
1319
  </div>
1319
- ${U(e,r=>h`
1320
+ ${w(e,r=>d`
1320
1321
  <primer-input-error slot="error">
1321
- ${T(r,{id:r})}
1322
+ ${C(r,{id:r})}
1322
1323
  </primer-input-error>
1323
- `,()=>u)}
1324
+ `,()=>c)}
1324
1325
  </primer-input-wrapper>
1325
- `}render(){return this.renderInput()}};te.styles=[$,Vt,Ia],te=n([v("primer-input-card-number"),z()],te);var Jb=El({tagName:"primer-input-number",elementClass:te,react:Cl});import{createComponent as Al}from"@lit/react";import _l from"react";var La=g`
1326
+ `}render(){return this.renderInput()}};Ot.styles=[S,Ct,mo],Ot=s([f("primer-input-card-number"),T()],Ot);var Is=Ls({tagName:"primer-input-number",elementClass:Ot,react:Ns});import{createComponent as Rs}from"@lit/react";import Os from"react";var ho=h`
1326
1327
  :host {
1327
1328
  height: calc(
1328
1329
  var(--primer-typography-title-large-line-height) +
@@ -1358,7 +1359,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1358
1359
  img {
1359
1360
  height: 100%;
1360
1361
  }
1361
- `;function Ge(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var mt=class extends y{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?R:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return R;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}:R},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?R:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Ge(e):"";return r==="payWith"&&(r="pay_with"),T(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?h`
1362
+ `;function ve(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var G=class extends u{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new P(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new P(this,{task:async([e,r])=>{if(!e||!r)return E;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:E},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new P(this,{task:async([e,r])=>!e||!r?E:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?ve(e):"";return r==="payWith"&&(r="pay_with"),C(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
1362
1363
  <primer-portal>
1363
1364
  <primer-dialog @primer-dialog-close="${()=>this.open=!1}">
1364
1365
  <primer-ach-payment
@@ -1369,11 +1370,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1369
1370
  ></primer-ach-payment>
1370
1371
  </primer-dialog>
1371
1372
  </primer-portal>
1372
- `:u}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),h`
1373
+ `:c}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
1373
1374
  <primer-button
1374
1375
  @click="${()=>this.start()}"
1375
- class=${Z({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1376
- title="${T("pay_with",{id:"pay_with"})} ${e.name}"
1376
+ class=${R({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1377
+ title="${C("pay_with",{id:"pay_with"})} ${e.name}"
1377
1378
  >
1378
1379
  <span class="image-container">
1379
1380
  <img src="${e.iconUrl}" alt="${e.name}" />
@@ -1381,17 +1382,17 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1381
1382
  ${e.displayName}
1382
1383
  </primer-button>
1383
1384
  ${this.renderDialog()}
1384
- `)})}};mt.styles=[$,La],n([p({type:Object})],mt.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0})],mt.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0})],mt.prototype,"sdkState",2),n([P({context:ct,subscribe:!0})],mt.prototype,"headlessUtils",2),n([I()],mt.prototype,"open",2),mt=n([v("primer-dynamic-payment"),z()],mt);var AE=Al({tagName:"primer-dynamic-payment",elementClass:mt,react:_l});import{createComponent as xl}from"@lit/react";import Sl from"react";var Ra=g`
1385
+ `)})}};G.styles=[S,ho],s([l({type:Object})],G.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0})],G.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0})],G.prototype,"sdkState",2),s([v({context:j,subscribe:!0})],G.prototype,"headlessUtils",2),s([_()],G.prototype,"open",2),G=s([f("primer-dynamic-payment"),T()],G);var Ds=Rs({tagName:"primer-dynamic-payment",elementClass:G,react:Os});import{createComponent as Vs}from"@lit/react";import Ys from"react";var uo=h`
1385
1386
  :host {
1386
1387
  display: block;
1387
1388
  width: 100%;
1388
1389
  }
1389
- `;var Tt=class extends y{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?h`
1390
+ `;var ct=class extends u{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?d`
1390
1391
  <primer-error-message
1391
- message="${T(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
1392
+ message="${C(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
1392
1393
  ?visible="${this.shouldShowError}"
1393
1394
  ></primer-error-message>
1394
- `:u}};Tt.styles=[Ra],n([P({context:G,subscribe:!0}),I()],Tt.prototype,"sdkState",2),n([p({type:Boolean,attribute:"show-processing-errors"})],Tt.prototype,"showProcessingErrors",2),Tt=n([v("primer-error-message-container")],Tt);var YE=xl({tagName:"primer-error-message-container",elementClass:Tt,react:Sl});import{createComponent as Ml}from"@lit/react";import Pl from"react";var $a=g`
1395
+ `:c}};ct.styles=[uo],s([v({context:L,subscribe:!0}),_()],ct.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],ct.prototype,"showProcessingErrors",2),ct=s([f("primer-error-message-container")],ct);var Hs=Vs({tagName:"primer-error-message-container",elementClass:ct,react:Ys});import{createComponent as Us}from"@lit/react";import zs from"react";var fo=h`
1395
1396
  :host {
1396
1397
  display: contents;
1397
1398
  }
@@ -1583,38 +1584,38 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1583
1584
  background-color: var(--primer-color-background-outlined-default);
1584
1585
  border-radius: var(--primer-radius-small);
1585
1586
  }
1586
- `;var J=class extends y{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=T("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>{if(!e||!r)return R;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){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?h`<div class="loading">
1587
+ `;var D=class extends u{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=C("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new P(this,{task:async([e,r])=>{if(!e||!r)return E;let o=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){A.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){A.error("Failed to render Klarna category",e)}}selectCategory(e){this.selectedCategory=e,this.renderSelectedCategory()}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?d`<div class="loading">
1587
1588
  <primer-spinner size="small"></primer-spinner>
1588
- </div>`:h`
1589
+ </div>`:d`
1589
1590
  <div class="category-selection">
1590
- ${e.map(o=>h`
1591
+ ${e.map(o=>d`
1591
1592
  <button
1592
- class=${Z({"category-button":!0,selected:o.id===this.selectedCategory})}
1593
+ class=${R({"category-button":!0,selected:o.id===this.selectedCategory})}
1593
1594
  @click=${()=>{this.selectCategory(o.id)}}
1594
1595
  >
1595
1596
  ${o.name}
1596
1597
  </button>
1597
1598
  `)}
1598
1599
  </div>
1599
- `}renderExpandedContent(){return h`
1600
+ `}renderExpandedContent(){return d`
1600
1601
  ${this.renderCategorySelection()}
1601
- ${this.selectedCategory?h`
1602
+ ${this.selectedCategory?d`
1602
1603
  <div
1603
1604
  id="klarna-category-container"
1604
1605
  class="klarna-category-container"
1605
1606
  ></div>
1606
- `:u}
1607
+ `:c}
1607
1608
 
1608
1609
  <button
1609
- class=${Z({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1610
+ class=${R({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1610
1611
  ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
1611
1612
  @click=${()=>this.startKlarnaPayment()}
1612
1613
  >
1613
- ${T("confirm",{id:"confirm"})}
1614
+ ${C("confirm",{id:"confirm"})}
1614
1615
  </button>
1615
- `}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return h`<div class="error">
1616
+ `}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return d`<div class="error">
1616
1617
  Error loading Klarna: ${r}
1617
- </div>`},complete:({manager:e,klarnaIcon:r})=>e?h`
1618
+ </div>`},complete:({manager:e,klarnaIcon:r})=>e?d`
1618
1619
  <div class="klarna-container ${this.isExpanded?"expanded":""}">
1619
1620
  <div class="klarna-button-header">
1620
1621
  <primer-button
@@ -1627,7 +1628,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1627
1628
  aria-label=${this.headerAriaLabel}
1628
1629
  >
1629
1630
  <img src=${r} alt="Klarna logo" />
1630
- <span>${T("pay_with",{id:"pay_with"})} Klarna</span>
1631
+ <span>${C("pay_with",{id:"pay_with"})} Klarna</span>
1631
1632
  <span
1632
1633
  class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1633
1634
  >
@@ -1644,7 +1645,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1644
1645
  </div>
1645
1646
  </div>
1646
1647
  </div>
1647
- `:u})}};J.styles=[$,$a],n([P({context:Q,subscribe:!0}),p()],J.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0}),p()],J.prototype,"sdkState",2),n([P({context:ct,subscribe:!0}),p({type:Object})],J.prototype,"headlessUtils",2),n([P({context:cr,subscribe:!0}),p()],J.prototype,"klarnaCategories",2),n([I()],J.prototype,"selectedCategory",2),n([I()],J.prototype,"isExpanded",2),n([I()],J.prototype,"headerAriaLabel",2),n([Ot("#klarna-category-container")],J.prototype,"klarnaContainer",2),J=n([v("primer-klarna"),z()],J);var mC=Ml({tagName:"primer-klarna",elementClass:J,react:Pl});import{createComponent as wl}from"@lit/react";import Tl from"react";var Oa=g`
1648
+ `:c})}};D.styles=[S,fo],s([v({context:V,subscribe:!0}),l()],D.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0}),l()],D.prototype,"sdkState",2),s([v({context:j,subscribe:!0}),l({type:Object})],D.prototype,"headlessUtils",2),s([v({context:$e,subscribe:!0}),l()],D.prototype,"klarnaCategories",2),s([_()],D.prototype,"selectedCategory",2),s([_()],D.prototype,"isExpanded",2),s([_()],D.prototype,"headerAriaLabel",2),s([vt("#klarna-category-container")],D.prototype,"klarnaContainer",2),D=s([f("primer-klarna"),T()],D);var Bs=Us({tagName:"primer-klarna",elementClass:D,react:zs});import{createComponent as Fs}from"@lit/react";import Ks from"react";var go=h`
1648
1649
  :host {
1649
1650
  height: calc(
1650
1651
  var(--primer-typography-title-large-line-height) +
@@ -1658,29 +1659,29 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1658
1659
  height: 100%;
1659
1660
  flex: 1;
1660
1661
  }
1661
- `;var Et=class extends y{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 R;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 R;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),s=e.createButton(),l=this.createRenderOptions(o);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),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:()=>h`
1662
+ `;var et=class extends u{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new P(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return E;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new P(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return E;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=e.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),e}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>c,complete:()=>d`
1662
1663
  <!-- The native button container is rendered first -->
1663
1664
  <div class="native-button-container" id="${this._buttonId}"></div>
1664
- `,pending:()=>u})}};Et.styles=[$,Oa],n([p({type:Object})],Et.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0}),p()],Et.prototype,"paymentManagers",2),n([P({context:he,subscribe:!0}),p()],Et.prototype,"computedStyles",2),Et=n([v("primer-native-payment")],Et);var kC=wl({tagName:"primer-native-payment",elementClass:Et,react:Tl});import{createComponent as kl}from"@lit/react";import Nl from"react";var Da=g`
1665
+ `,pending:()=>c})}};et.styles=[S,go],s([l({type:Object})],et.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0}),l()],et.prototype,"paymentManagers",2),s([v({context:jt,subscribe:!0}),l()],et.prototype,"computedStyles",2),et=s([f("primer-native-payment")],et);var js=Fs({tagName:"primer-native-payment",elementClass:et,react:Ks});import{createComponent as Gs}from"@lit/react";import qs from"react";var yo=h`
1665
1666
  :host {
1666
1667
  display: contents;
1667
1668
  }
1668
- `;var kt=class extends y{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 h`<primer-card-form></primer-card-form>`;case"NATIVE":return h`<primer-native-payment
1669
+ `;var mt=class extends u{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return c;let e=this.paymentMethods?.get(this.type);if(!e)return c;switch(e?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
1669
1670
  .paymentMethod=${e}
1670
- ></primer-native-payment>`;case"REDIRECT":return h`<primer-redirect-payment
1671
+ ></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
1671
1672
  .paymentMethod=${e}
1672
- ></primer-redirect-payment>`;case"KLARNA":return h`<primer-klarna></primer-klarna>`;case"ACH":return h`
1673
+ ></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
1673
1674
  <primer-dynamic-payment
1674
1675
  .paymentMethod=${e}
1675
1676
  ></primer-dynamic-payment>
1676
- `;default:return u}}};kt.styles=[Da],n([p({type:String})],kt.prototype,"type",2),n([P({context:ue,subscribe:!0}),p()],kt.prototype,"paymentMethods",2),kt=n([v("primer-payment-method")],kt);var KC=kl({tagName:"primer-payment-method",elementClass:kt,react:Nl});import{createComponent as Il}from"@lit/react";import Ll from"react";var be=class extends y{render(){return h`
1677
+ `;default:return c}}};mt.styles=[yo],s([l({type:String})],mt.prototype,"type",2),s([v({context:Gt,subscribe:!0}),l()],mt.prototype,"paymentMethods",2),mt=s([f("primer-payment-method")],mt);var Ws=Gs({tagName:"primer-payment-method",elementClass:mt,react:qs});import{createComponent as Zs}from"@lit/react";import Xs from"react";var Qt=class extends u{render(){return d`
1677
1678
  <primer-checkout-state type="complete"></primer-checkout-state>
1678
- `}};be=n([v("primer-checkout-complete")],be);var tA=Il({tagName:"primer-checkout-complete",elementClass:be,react:Ll});import{createComponent as Rl}from"@lit/react";import $l from"react";var ee=class extends y{constructor(){super(...arguments);this.sdkState=null}render(){return h`
1679
+ `}};Qt=s([f("primer-checkout-complete")],Qt);var Qs=Zs({tagName:"primer-checkout-complete",elementClass:Qt,react:Xs});import{createComponent as Js}from"@lit/react";import tn from"react";var Dt=class extends u{constructor(){super(...arguments);this.sdkState=null}render(){return d`
1679
1680
  <primer-checkout-state
1680
1681
  type="failure"
1681
1682
  description=${this.sdkState?.error?.message||""}
1682
1683
  ></primer-checkout-state>
1683
- `}};n([P({context:G,subscribe:!0}),p()],ee.prototype,"sdkState",2),ee=n([v("primer-checkout-error")],ee);var mA=Rl({tagName:"primer-checkout-error",elementClass:ee,react:$l});import{createComponent as Ol}from"@lit/react";import Dl from"react";var Va=g`
1684
+ `}};s([v({context:L,subscribe:!0}),l()],Dt.prototype,"sdkState",2),Dt=s([f("primer-checkout-error")],Dt);var en=Js({tagName:"primer-checkout-error",elementClass:Dt,react:tn});import{createComponent as rn}from"@lit/react";import on from"react";var vo=h`
1684
1685
  :host {
1685
1686
  display: contents;
1686
1687
  }
@@ -1699,20 +1700,20 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1699
1700
  primer-vault-manager {
1700
1701
  margin-bottom: var(--primer-space-xlarge);
1701
1702
  }
1702
- `;var Nt=class extends y{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?h`
1703
+ `;var ht=class extends u{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?d`
1703
1704
  <slot name="checkout-complete">
1704
1705
  <primer-checkout-complete></primer-checkout-complete>
1705
1706
  </slot>
1706
- `:h`
1707
+ `:d`
1707
1708
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1708
- ${U(this.hasAssignedContent,()=>u,()=>h`
1709
+ ${w(this.hasAssignedContent,()=>c,()=>d`
1709
1710
  <div
1710
- class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
1711
+ class=${R({"primer-is-processing":!!this.sdkState?.isProcessing})}
1711
1712
  >
1712
1713
  <primer-vault-manager></primer-vault-manager>
1713
1714
  <primer-show-other-payments>
1714
1715
  <div slot="other-payments" class="primer-main-list">
1715
- ${this.paymentMethods?.toArray().map(e=>h`
1716
+ ${this.paymentMethods?.toArray().map(e=>d`
1716
1717
  <primer-payment-method
1717
1718
  type=${e.type}
1718
1719
  ></primer-payment-method>
@@ -1722,7 +1723,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1722
1723
  <primer-error-message-container></primer-error-message-container>
1723
1724
  </div>
1724
1725
  `)}
1725
- `}};Nt.styles=[$,Va],n([P({context:ue,subscribe:!0}),p()],Nt.prototype,"paymentMethods",2),n([P({context:G,subscribe:!0}),p()],Nt.prototype,"sdkState",2),Nt=n([v("primer-main")],Nt);var IA=Ol({tagName:"primer-main",elementClass:Nt,react:Dl});import{createComponent as Vl}from"@lit/react";import Hl from"react";var Ha=g`
1726
+ `}};ht.styles=[S,vo],s([v({context:Gt,subscribe:!0}),l()],ht.prototype,"paymentMethods",2),s([v({context:L,subscribe:!0}),l()],ht.prototype,"sdkState",2),ht=s([f("primer-main")],ht);var an=rn({tagName:"primer-main",elementClass:ht,react:on});import{createComponent as sn}from"@lit/react";import nn from"react";var bo=h`
1726
1727
  :host {
1727
1728
  height: calc(
1728
1729
  var(--primer-typography-title-large-line-height) +
@@ -1797,24 +1798,24 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1797
1798
  flex-shrink: 0;
1798
1799
  flex-grow: 1;
1799
1800
  }
1800
- `;var yt=class extends y{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?R:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return R;let o=r.getPaymentMethodConfiguration(e);if(!o)return R;let s=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,l=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:s,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:l}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?R:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Ge(e):"";return r==="payWith"&&(r="pay_with"),T(r,{id:r})}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);let r={loading:!!this.sdkState?.isProcessing,"icon-end":e.iconPosition==="END","image-only":!e.displayName},o=e.displayName?h`
1801
+ `;var X=class extends u{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new P(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new P(this,{task:async([e,r])=>{if(!e||!r)return E;let o=r.getPaymentMethodConfiguration(e);if(!o)return E;let a=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,n=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:a,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:n}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new P(this,{task:async([e,r])=>!e||!r?E:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?ve(e):"";return r==="payWith"&&(r="pay_with"),C(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:e})=>{this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":e.iconPosition==="END","image-only":!e.displayName},o=e.displayName?d`
1801
1802
  <span class="image-container">
1802
1803
  <img src="${e.iconUrl}" alt="${e.name}" />
1803
1804
  </span>
1804
1805
  <span class="button-text">${e.displayName}</span>
1805
- `:h`
1806
+ `:d`
1806
1807
  <span class="image-container">
1807
1808
  <img src="${e.iconUrl}" alt="${e.name}" />
1808
1809
  </span>
1809
- `;return h`
1810
+ `;return d`
1810
1811
  <primer-button
1811
1812
  @click="${()=>this.startRedirectPayment()}"
1812
- class=${Z(r)}
1813
- title="${T("pay_with",{id:"pay_with"})} ${e.name}"
1813
+ class=${R(r)}
1814
+ title="${C("pay_with",{id:"pay_with"})} ${e.name}"
1814
1815
  >
1815
1816
  ${o}
1816
1817
  </primer-button>
1817
- `}})}};yt.styles=[$,Ha],n([p({type:Object})],yt.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0})],yt.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0})],yt.prototype,"sdkState",2),n([P({context:ct,subscribe:!0})],yt.prototype,"headlessUtils",2),yt=n([v("primer-redirect-payment"),z()],yt);var e_=Vl({tagName:"primer-redirect-payment",elementClass:yt,react:Hl});import{createComponent as Ul}from"@lit/react";import Yl from"react";var Ua=g`
1818
+ `}})}};X.styles=[S,bo],s([l({type:Object})],X.prototype,"paymentMethod",2),s([v({context:V,subscribe:!0})],X.prototype,"paymentManagers",2),s([v({context:L,subscribe:!0})],X.prototype,"sdkState",2),s([v({context:j,subscribe:!0})],X.prototype,"headlessUtils",2),X=s([f("primer-redirect-payment"),T()],X);var ln=sn({tagName:"primer-redirect-payment",elementClass:X,react:nn});import{createComponent as dn}from"@lit/react";import pn from"react";var Co=h`
1818
1819
  :host {
1819
1820
  display: block;
1820
1821
  margin-top: var(--primer-space-medium);
@@ -1834,19 +1835,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1834
1835
  justify-content: center;
1835
1836
  align-items: center;
1836
1837
  }
1837
- `;var Ht=class extends y{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?u:!this.vaultManager||!this.vaultManager.enabled?h`<slot name="other-payments"></slot>`:h`
1838
+ `;var xt=class extends u{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?c:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
1838
1839
  <div class="other-payment-methods-container">
1839
1840
  <primer-collapsable
1840
1841
  buttonVariant="secondary"
1841
1842
  .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
1842
- .header="${T("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
1843
+ .header="${C("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
1843
1844
  >
1844
1845
  <div class="other-payment-methods-content">
1845
1846
  <slot name="other-payments"></slot>
1846
1847
  </div>
1847
1848
  </primer-collapsable>
1848
1849
  </div>
1849
- `}};Ht.styles=[Ua],n([P({context:fe,subscribe:!0}),p({type:Object,attribute:!1})],Ht.prototype,"vaultManager",2),Ht=n([v("primer-show-other-payments")],Ht);var A_=Ul({tagName:"primer-show-other-payments",elementClass:Ht,react:Yl});import{createComponent as Fl}from"@lit/react";import zl from"react";var P_=Fl({tagName:"primer-button",elementClass:tt,react:zl});import{createComponent as sd}from"@lit/react";import nd from"react";var Bl=Co(Oi(),1),Ee=Co(Oi(),1);function Di(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Kl(i){return i?i===i.toUpperCase()?Di(i):i:""}function Ya(i,t){return[i,t].filter(Boolean).join(" ")}function Gl(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function Fa(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function jl(i){let t=i.paymentInstrumentData,e=Kl(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${Fa(r)}`:e)||" Card"}`,s=Gl(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:s}}function ql(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",s=i.userDescription||e||"PayPal Account",l=Ya(r,o);return{description:s,secondaryDescription:l}}function Wl(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"),l=Ya(r,o);return{description:s,secondaryDescription:l}}function Zl(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",s=i.userDescription;s||(r&&e?s=`${r} ${Fa(e)}`:r?s=r:s="Bank Account");let l=o?`${Di(o)} Account`:"";return{description:s,secondaryDescription:l}}function Xl(i){let t=i.paymentInstrumentType,e=Di(t.replace(/_/g," "));return{description:i.userDescription||e}}var Jl={[Ee.PaymentInstrumentType.CARD]:jl,[Ee.PaymentInstrumentType.PAYPAL_VAULTED]:ql,[Ee.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:Wl,[Ee.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:Zl};function za(i){try{let t=Jl[i.paymentInstrumentType];return t?t(i):Xl(i)}catch(t){return N.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var Ba=g`
1850
+ `}};xt.styles=[Co],s([v({context:qt,subscribe:!0}),l({type:Object,attribute:!1})],xt.prototype,"vaultManager",2),xt=s([f("primer-show-other-payments")],xt);var cn=dn({tagName:"primer-show-other-payments",elementClass:xt,react:pn});import{createComponent as wn}from"@lit/react";import Mn from"react";var be={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"};function jr(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function mn(i){return i?i===i.toUpperCase()?jr(i):i:""}function xo(i,t){return[i,t].filter(Boolean).join(" ")}function hn(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function Ao(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function un(i){let t=i.paymentInstrumentData,e=mn(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${Ao(r)}`:e)||" Card"}`,a=hn(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:a}}function fn(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account",n=xo(r,o);return{description:a,secondaryDescription:n}}function gn(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),n=xo(r,o);return{description:a,secondaryDescription:n}}function yn(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;a||(r&&e?a=`${r} ${Ao(e)}`:r?a=r:a="Bank Account");let n=o?`${jr(o)} Account`:"";return{description:a,secondaryDescription:n}}function vn(i){let t=i.paymentInstrumentType,e=jr(t.replace(/_/g," "));return{description:i.userDescription||e}}var bn={[be.CARD]:un,[be.PAYPAL_VAULTED]:fn,[be.KLARNA_CUSTOMER_TOKEN]:gn,[be.AUTOMATED_CLEARING_HOUSE]:yn};function _o(i){try{let t=bn[i.paymentInstrumentType];return t?t(i):vn(i)}catch(t){return A.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var Eo=h`
1850
1851
  :host {
1851
1852
  display: block;
1852
1853
  width: 100%;
@@ -1963,19 +1964,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1963
1964
  transition: none;
1964
1965
  }
1965
1966
  }
1966
- `;var We=globalThis,Yr=We.trustedTypes,Ka=Yr?Yr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Hi="$lit$",It=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+It,Ql=`<${Ui}>`,oe=document,Fr=()=>oe.createComment(""),Ze=i=>i===null||typeof i!="object"&&typeof i!="function",Yi=Array.isArray,Xa=i=>Yi(i)||typeof i?.[Symbol.iterator]=="function",Vi=`[
1967
- \f\r]`,qe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ga=/-->/g,ja=/>/g,re=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
1968
- \f\r"'\`<>=]|("|')|))|$)`,"g"),qa=/'/g,Wa=/"/g,Ja=/^(?:script|style|textarea|title)$/i,Fi=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),U_=Fi(1),Y_=Fi(2),F_=Fi(3),Xe=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),Za=new WeakMap,ie=oe.createTreeWalker(oe,129);function Qa(i,t){if(!Yi(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ka!==void 0?Ka.createHTML(t):t}var ts=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",l=qe;for(let f=0;f<e;f++){let m=i[f],_,w,A=-1,O=0;for(;O<m.length&&(l.lastIndex=O,w=l.exec(m),w!==null);)O=l.lastIndex,l===qe?w[1]==="!--"?l=Ga:w[1]!==void 0?l=ja:w[2]!==void 0?(Ja.test(w[2])&&(o=RegExp("</"+w[2],"g")),l=re):w[3]!==void 0&&(l=re):l===re?w[0]===">"?(l=o??qe,A=-1):w[1]===void 0?A=-2:(A=l.lastIndex-w[2].length,_=w[1],l=w[3]===void 0?re:w[3]==='"'?Wa:qa):l===Wa||l===qa?l=re:l===Ga||l===ja?l=qe:(l=re,o=void 0);let H=l===re&&i[f+1].startsWith("/>")?" ":"";s+=l===qe?m+Ql:A>=0?(r.push(_),m.slice(0,A)+Hi+m.slice(A)+It+H):m+It+(A===-2?f:H)}return[Qa(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Je=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,l=0,f=t.length-1,m=this.parts,[_,w]=ts(t,e);if(this.el=i.createElement(_,r),ie.currentNode=this.el.content,e===2||e===3){let A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;(o=ie.nextNode())!==null&&m.length<f;){if(o.nodeType===1){if(o.hasAttributes())for(let A of o.getAttributeNames())if(A.endsWith(Hi)){let O=w[l++],H=o.getAttribute(A).split(It),ht=/([.?@])?(.*)/.exec(O);m.push({type:1,index:s,name:ht[2],strings:H,ctor:ht[1]==="."?Br:ht[1]==="?"?Kr:ht[1]==="@"?Gr:se}),o.removeAttribute(A)}else A.startsWith(It)&&(m.push({type:6,index:s}),o.removeAttribute(A));if(Ja.test(o.tagName)){let A=o.textContent.split(It),O=A.length-1;if(O>0){o.textContent=Yr?Yr.emptyScript:"";for(let H=0;H<O;H++)o.append(A[H],Fr()),ie.nextNode(),m.push({type:2,index:++s});o.append(A[O],Fr())}}}else if(o.nodeType===8)if(o.data===Ui)m.push({type:2,index:s});else{let A=-1;for(;(A=o.data.indexOf(It,A+1))!==-1;)m.push({type:7,index:s}),A+=It.length-1}s++}}static createElement(t,e){let r=oe.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){if(t===Xe)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=Ze(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=ae(i,o._$AS(i,t.values),o,r)),t}var zr=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??oe).importNode(e,!0);ie.currentNode=o;let s=ie.nextNode(),l=0,f=0,m=r[0];for(;m!==void 0;){if(l===m.index){let _;m.type===2?_=new Qe(s,s.nextSibling,this,t):m.type===1?_=new m.ctor(s,m.name,m.strings,this,t):m.type===6&&(_=new jr(s,this,t)),this._$AV.push(_),m=r[++f]}l!==m?.index&&(s=ie.nextNode(),l++)}return ie.currentNode=oe,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++}},Qe=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=K,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=ae(this,t,e),Ze(t)?t===K||t==null||t===""?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==Xe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Xa(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!==K&&Ze(this._$AH)?this._$AA.nextSibling.data=t:this.T(oe.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=Je.createElement(Qa(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new zr(o,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(t){let e=Za.get(t.strings);return e===void 0&&Za.set(t.strings,e=new Je(t)),e}k(t){Yi(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(Fr()),this.O(Fr()),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))}},se=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,s){this.type=1,this._$AH=K,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=K}_$AI(t,e=this,r,o){let s=this.strings,l=!1;if(s===void 0)t=ae(this,t,e,0),l=!Ze(t)||t!==this._$AH&&t!==Xe,l&&(this._$AH=t);else{let f=t,m,_;for(t=s[0],m=0;m<s.length-1;m++)_=ae(this,f[r+m],e,m),_===Xe&&(_=this._$AH[m]),l||(l=!Ze(_)||_!==this._$AH[m]),_===K?t=K:t!==K&&(t+=(_??"")+s[m+1]),this._$AH[m]=_}l&&!o&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Br=class extends se{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}},Kr=class extends se{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}},Gr=class extends se{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=ae(this,t,e,0)??K)===Xe)return;let r=this._$AH,o=t===K&&r!==K||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==K&&(r===K||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)}},jr=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){ae(this,t)}},es={M:Hi,P:It,A:Ui,C:1,L:ts,R:zr,D:Xa,V:ae,I:Qe,H:se,N:Kr,U:Gr,B:Br,F:jr},td=We.litHtmlPolyfillSupport;td?.(Je,Qe),(We.litHtmlVersions??(We.litHtmlVersions=[])).push("3.3.0");var Ce={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},tr=i=>(...t)=>({_$litDirective$:i,values:t}),qr=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Z_}=es;var rs=i=>i.strings===void 0;var er=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),er(r,t);return!0},Wr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},is=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),id(t)}};function ed(i){this._$AN!==void 0?(Wr(this),this._$AM=i,is(this)):this._$AM=i}function rd(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++)er(r[s],!1),Wr(r[s]);else r!=null&&(er(r,!1),Wr(r));else er(this,i)}var id=i=>{i.type==Ce.CHILD&&(i._$AP??(i._$AP=rd),i._$AQ??(i._$AQ=ed))},Ae=class extends qr{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),is(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(er(this,t),Wr(this))}setValue(t){if(rs(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 Zr=new WeakMap,_e=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,Zr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var os=0,zi=new Map,as=new WeakSet,Bi=()=>new Promise(i=>requestAnimationFrame(i));var ss=(i,t)=>{let e=i-t;return e===0?void 0:e},ns=(i,t)=>{let e=i/t;return e===1?void 0:e},Xr={left:(i,t)=>{let e=ss(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=ss(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=ns(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=ns(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},ds={duration:333,easing:"ease-in-out"},cs=["left","top","width","height","opacity","color","background"],ls=new WeakMap,Jr=class extends Ae{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Ce.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(t=>{this.l=t})}async resolveFinished(){this.l?.(),this.l=void 0}render(t){return K}getController(){return Zr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,ls.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};let e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=cs),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let s=e[o]??(Xr[o]?void 0:r[o]),l=Number(s);t[o]=isNaN(l)?s+"":l}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((s,l)=>s===o[l]))return!1}else if(o===r)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Bi;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:s,to:l}=this.N(this.A,o,e);this.log("measured",[this.A,o,s,l]),t=this.calculateKeyframes(s,l)}else{let s=zi.get(this.options.inId);if(s){zi.delete(this.options.inId);let{from:l,to:f}=this.N(s,o,e);t=this.calculateKeyframes(l,f),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,os++,t.forEach(m=>m.zIndex=os)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&zi.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Bi(),this.i?.isConnected){let e=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,e),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,s=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&s===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),s!==0&&(this.element.style.top=s+"px")}}let t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(t){t&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e?.parentNode){let r=ls.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=as.has(this.u);return t||this.u.updateComplete.then(()=>{as.add(this.u)}),t}j(t,e=this.O()){let r={...ds};return e.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t={...t},e={...e};let o=r.map(f=>f.animatingProperties).filter(f=>f!==void 0),s=1,l=1;return o.length>0&&(o.forEach(f=>{f.width&&(s/=f.width),f.height&&(l/=f.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=s*t.left,e.left=s*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=l*t.top,e.top=l*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},s={},l=!1,f={};for(let m in e){let _=t[m],w=e[m];if(m in Xr){let A=Xr[m];if(_===void 0||w===void 0)continue;let O=A(_,w);O.transform!==void 0&&(f[m]=O.value,l=!0,o.transform=`${o.transform??""} ${O.transform}`,O.overrideFrom!==void 0&&Object.assign(o,O.overrideFrom))}else _!==w&&_!==void 0&&w!==void 0&&(l=!0,o[m]=_,s[m]=w)}return o.transformOrigin=s.transformOrigin=r?"center center":"top left",this.animatingProperties=f,l?[o,s]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}},Ut=tr(Jr);var od=["top","right","bottom","left"],Qr=class extends Ae{constructor(t){if(super(t),t.type!==Ce.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return K}update(t,[e,r]){return this.u===void 0&&(this.u=t.options?.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r??["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){let t=typeof this.C=="function"?this.C():this.C?.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();this.F?.forEach(s=>{let l=od.includes(s)?r[s]-o[s]:r[s];this.S.style[s]=l+"px"})}},ad=tr(Qr);var nt=class extends y{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new _e(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=T("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:T("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:T("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 za(r).description||""}catch{return""}}renderLoadingOverlay(){return h`
1967
+ `;var xe=globalThis,lr=xe.trustedTypes,So=lr?lr.createPolicy("lit-html",{createHTML:i=>i}):void 0,qr="$lit$",ut=`lit$${Math.random().toFixed(9).slice(2)}$`,Wr="?"+ut,Cn=`<${Wr}>`,Ht=document,dr=()=>Ht.createComment(""),Ae=i=>i===null||typeof i!="object"&&typeof i!="function",Zr=Array.isArray,$o=i=>Zr(i)||typeof i?.[Symbol.iterator]=="function",Gr=`[
1968
+ \f\r]`,Ce=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Po=/-->/g,wo=/>/g,Vt=RegExp(`>|${Gr}(?:([^\\s"'>=/]+)(${Gr}*=${Gr}*(?:[^
1969
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Mo=/'/g,ko=/"/g,Lo=/^(?:script|style|textarea|title)$/i,Xr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),ix=Xr(1),ox=Xr(2),ax=Xr(3),_e=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),To=new WeakMap,Yt=Ht.createTreeWalker(Ht,129);function No(i,t){if(!Zr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return So!==void 0?So.createHTML(t):t}var Io=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=Ce;for(let m=0;m<e;m++){let p=i[m],y,b,g=-1,M=0;for(;M<p.length&&(n.lastIndex=M,b=n.exec(p),b!==null);)M=n.lastIndex,n===Ce?b[1]==="!--"?n=Po:b[1]!==void 0?n=wo:b[2]!==void 0?(Lo.test(b[2])&&(o=RegExp("</"+b[2],"g")),n=Vt):b[3]!==void 0&&(n=Vt):n===Vt?b[0]===">"?(n=o??Ce,g=-1):b[1]===void 0?g=-2:(g=n.lastIndex-b[2].length,y=b[1],n=b[3]===void 0?Vt:b[3]==='"'?ko:Mo):n===ko||n===Mo?n=Vt:n===Po||n===wo?n=Ce:(n=Vt,o=void 0);let N=n===Vt&&i[m+1].startsWith("/>")?" ":"";a+=n===Ce?p+Cn:g>=0?(r.push(y),p.slice(0,g)+qr+p.slice(g)+ut+N):p+ut+(g===-2?m:N)}return[No(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ee=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,m=t.length-1,p=this.parts,[y,b]=Io(t,e);if(this.el=i.createElement(y,r),Yt.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(o=Yt.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let g of o.getAttributeNames())if(g.endsWith(qr)){let M=b[n++],N=o.getAttribute(g).split(ut),rt=/([.?@])?(.*)/.exec(M);p.push({type:1,index:a,name:rt[2],strings:N,ctor:rt[1]==="."?cr:rt[1]==="?"?mr:rt[1]==="@"?hr:zt}),o.removeAttribute(g)}else g.startsWith(ut)&&(p.push({type:6,index:a}),o.removeAttribute(g));if(Lo.test(o.tagName)){let g=o.textContent.split(ut),M=g.length-1;if(M>0){o.textContent=lr?lr.emptyScript:"";for(let N=0;N<M;N++)o.append(g[N],dr()),Yt.nextNode(),p.push({type:2,index:++a});o.append(g[M],dr())}}}else if(o.nodeType===8)if(o.data===Wr)p.push({type:2,index:a});else{let g=-1;for(;(g=o.data.indexOf(ut,g+1))!==-1;)p.push({type:7,index:a}),g+=ut.length-1}a++}}static createElement(t,e){let r=Ht.createElement("template");return r.innerHTML=t,r}};function Ut(i,t,e=i,r){if(t===_e)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=Ae(t)?void 0:t._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=Ut(i,o._$AS(i,t.values),o,r)),t}var pr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??Ht).importNode(e,!0);Yt.currentNode=o;let a=Yt.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let y;p.type===2?y=new Se(a,a.nextSibling,this,t):p.type===1?y=new p.ctor(a,p.name,p.strings,this,t):p.type===6&&(y=new ur(a,this,t)),this._$AV.push(y),p=r[++m]}n!==p?.index&&(a=Yt.nextNode(),n++)}return Yt.currentNode=Ht,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Se=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=$,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ut(this,t,e),Ae(t)?t===$||t==null||t===""?(this._$AH!==$&&this._$AR(),this._$AH=$):t!==this._$AH&&t!==_e&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):$o(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==$&&Ae(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ht.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ee.createElement(No(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new pr(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=To.get(t.strings);return e===void 0&&To.set(t.strings,e=new Ee(t)),e}k(t){Zr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let a of t)o===e.length?e.push(r=new i(this.O(dr()),this.O(dr()),this,this.options)):r=e[o],r._$AI(a),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},zt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=$,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=$}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=Ut(this,t,e,0),n=!Ae(t)||t!==this._$AH&&t!==_e,n&&(this._$AH=t);else{let m=t,p,y;for(t=a[0],p=0;p<a.length-1;p++)y=Ut(this,m[r+p],e,p),y===_e&&(y=this._$AH[p]),n||(n=!Ae(y)||y!==this._$AH[p]),y===$?t=$:t!==$&&(t+=(y??"")+a[p+1]),this._$AH[p]=y}n&&!o&&this.j(t)}j(t){t===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},cr=class extends zt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}},mr=class extends zt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==$)}},hr=class extends zt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=Ut(this,t,e,0)??$)===_e)return;let r=this._$AH,o=t===$&&r!==$||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==$&&(r===$||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ur=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ut(this,t)}},Ro={M:qr,P:ut,A:Wr,C:1,L:Io,R:pr,D:$o,V:Ut,I:Se,H:zt,N:mr,U:hr,B:cr,F:ur},xn=xe.litHtmlPolyfillSupport;xn?.(Ee,Se),(xe.litHtmlVersions??(xe.litHtmlVersions=[])).push("3.3.0");var Jt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Pe=i=>(...t)=>({_$litDirective$:i,values:t}),fr=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:hx}=Ro;var Oo=i=>i.strings===void 0;var we=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),we(r,t);return!0},gr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},Do=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),En(t)}};function An(i){this._$AN!==void 0?(gr(this),this._$AM=i,Do(this)):this._$AM=i}function _n(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let a=e;a<r.length;a++)we(r[a],!1),gr(r[a]);else r!=null&&(we(r,!1),gr(r));else we(this,i)}var En=i=>{i.type==Jt.CHILD&&(i._$AP??(i._$AP=_n),i._$AQ??(i._$AQ=An))},te=class extends fr{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Do(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(we(this,t),gr(this))}setValue(t){if(Oo(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var yr=new WeakMap,ee=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,yr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var Vo=0,Qr=new Map,Yo=new WeakSet,Jr=()=>new Promise(i=>requestAnimationFrame(i));var Ho=(i,t)=>{let e=i-t;return e===0?void 0:e},Uo=(i,t)=>{let e=i/t;return e===1?void 0:e},vr={left:(i,t)=>{let e=Ho(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=Ho(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=Uo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=Uo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},Bo={duration:333,easing:"ease-in-out"},Fo=["left","top","width","height","opacity","color","background"],zo=new WeakMap,br=class extends te{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Jt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(t=>{this.l=t})}async resolveFinished(){this.l?.(),this.l=void 0}render(t){return $}getController(){return yr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,zo.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};let e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=Fo),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(vr[o]?void 0:r[o]),n=Number(a);t[o]=isNaN(n)?a+"":n}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((a,n)=>a===o[n]))return!1}else if(o===r)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Jr;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,e);this.log("measured",[this.A,o,a,n]),t=this.calculateKeyframes(a,n)}else{let a=Qr.get(this.options.inId);if(a){Qr.delete(this.options.inId);let{from:n,to:m}=this.N(a,o,e);t=this.calculateKeyframes(n,m),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,Vo++,t.forEach(p=>p.zIndex=Vo)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&Qr.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Jr(),this.i?.isConnected){let e=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,e),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,a=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&a===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),a!==0&&(this.element.style.top=a+"px")}}let t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(t){t&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e?.parentNode){let r=zo.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=Yo.has(this.u);return t||this.u.updateComplete.then(()=>{Yo.add(this.u)}),t}j(t,e=this.O()){let r={...Bo};return e.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t={...t},e={...e};let o=r.map(m=>m.animatingProperties).filter(m=>m!==void 0),a=1,n=1;return o.length>0&&(o.forEach(m=>{m.width&&(a/=m.width),m.height&&(n/=m.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=a*t.left,e.left=a*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=n*t.top,e.top=n*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},a={},n=!1,m={};for(let p in e){let y=t[p],b=e[p];if(p in vr){let g=vr[p];if(y===void 0||b===void 0)continue;let M=g(y,b);M.transform!==void 0&&(m[p]=M.value,n=!0,o.transform=`${o.transform??""} ${M.transform}`,M.overrideFrom!==void 0&&Object.assign(o,M.overrideFrom))}else y!==b&&y!==void 0&&b!==void 0&&(n=!0,o[p]=y,a[p]=b)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=m,n?[o,a]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}},At=Pe(br);var Sn=["top","right","bottom","left"],Cr=class extends te{constructor(t){if(super(t),t.type!==Jt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return $}update(t,[e,r]){return this.u===void 0&&(this.u=t.options?.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r??["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){let t=typeof this.C=="function"?this.C():this.C?.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();this.F?.forEach(a=>{let n=Sn.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},Pn=Pe(Cr);var K=class extends u{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new ee(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=C("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(e){this.errorMessage=e instanceof Error?e.message:C("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(e){let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:C("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===e);if(!r)return"";try{return _o(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
1969
1970
  <div
1970
1971
  class="loading-overlay"
1971
- ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1972
+ ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1972
1973
  >
1973
1974
  <primer-spinner
1974
1975
  size="medium"
1975
1976
  color="var(--primer-color-loader)"
1976
1977
  ></primer-spinner>
1977
1978
  </div>
1978
- `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return h`
1979
+ `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return c;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
1979
1980
  <div class="delete-confirmation-container">
1980
1981
  <primer-vault-delete-confirmation
1981
1982
  .isDeleting=${this.isDeleting}
@@ -1983,30 +1984,30 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
1983
1984
  .paymentMethodName=${e}
1984
1985
  @confirm-delete=${this.handleConfirmDelete}
1985
1986
  @cancel-delete=${this.handleCancelDelete}
1986
- ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1987
+ ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1987
1988
  ></primer-vault-delete-confirmation>
1988
1989
  </div>
1989
- `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:h`
1990
+ `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?c:d`
1990
1991
  <primer-vault-payment-method-item
1991
1992
  .paymentMethod=${e}
1992
1993
  .isEditMode=${this.isEditMode}
1993
1994
  @delete-payment-method=${this.handleDeletePaymentMethod}
1994
- ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1995
+ ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1995
1996
  ></primer-vault-payment-method-item>
1996
- `}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return h`
1997
+ `}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
1997
1998
  <div class="payment-methods-list">
1998
1999
  ${e.map(o=>this.renderPaymentMethodItem(o))}
1999
- ${U(r,()=>h`
2000
+ ${w(r,()=>d`
2000
2001
  <div class="submit-button-container">
2001
2002
  <primer-vault-payment-submit
2002
2003
  class="submit-button"
2003
2004
  @primer-vault-payment-error=${this.handlePaymentError}
2004
- ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2005
+ ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2005
2006
  ></primer-vault-payment-submit>
2006
2007
  </div>
2007
- `,()=>u)}
2008
+ `,()=>c)}
2008
2009
  </div>
2009
- `}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return h`
2010
+ `}render(){if(!this.vaultManagerContext?.enabled)return c;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
2010
2011
  <div class="vault-manager ${o?"is-updating":""}">
2011
2012
  <primer-vault-manager-header
2012
2013
  .isEditMode=${this.isEditMode}
@@ -2014,32 +2015,32 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
2014
2015
  @toggle-edit-mode=${this.handleToggleEditMode}
2015
2016
  ></primer-vault-manager-header>
2016
2017
 
2017
- ${U(this.errorMessage,()=>h`
2018
+ ${w(this.errorMessage,()=>d`
2018
2019
  <primer-vault-error-message
2019
2020
  .errorMessage=${this.errorMessage}
2020
2021
  @close-error=${this.handleCloseError}
2021
- ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2022
+ ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2022
2023
  ></primer-vault-error-message>
2023
- `,()=>u)}
2024
+ `,()=>c)}
2024
2025
 
2025
2026
  <div class="vault-manager-content">
2026
- ${U(!r&&!e,()=>h`
2027
+ ${w(!r&&!e,()=>d`
2027
2028
  <div class="content-container">
2028
2029
  <primer-vault-empty-state
2029
- ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2030
+ ${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2030
2031
  ></primer-vault-empty-state>
2031
2032
  </div>
2032
- `,()=>u)}
2033
- ${U(!r&&e,()=>h`
2033
+ `,()=>c)}
2034
+ ${w(!r&&e,()=>d`
2034
2035
  <div class="content-container">
2035
- ${U(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2036
+ ${w(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2036
2037
  </div>
2037
- `,()=>u)}
2038
+ `,()=>c)}
2038
2039
  </div>
2039
2040
 
2040
- ${U(o,()=>this.renderLoadingOverlay(),()=>u)}
2041
+ ${w(o,()=>this.renderLoadingOverlay(),()=>c)}
2041
2042
  </div>
2042
- `}};nt.styles=[$,Ba],n([P({context:fe,subscribe:!0}),p({type:Object,attribute:!1})],nt.prototype,"vaultManagerContext",2),n([I()],nt.prototype,"isEditMode",2),n([I()],nt.prototype,"deletePaymentMethodId",2),n([I()],nt.prototype,"isDeleting",2),n([I()],nt.prototype,"errorMessage",2),n([p({type:Number})],nt.prototype,"animationDuration",2),nt=n([v("primer-vault-manager"),z()],nt);var Kx=sd({tagName:"primer-vault-manager",elementClass:nt,react:nd});export{Gg as AchPayment,P_ as Button,uy as CardForm,$y as CardFormSubmit,gv as CardNetworkSelector,Ih as CheckoutState,eu as Collapsable,Cu as Dialog,AE as DynamicPayment,Wu as ErrorMessage,YE as ErrorMessageContainer,tf as Icon,uf as Input,yb as InputCardExpiry,eb as InputCardHolderName,Jb as InputCardNumber,Lb as InputCvv,Mf as InputError,Vf as InputLabel,Xf as InputWrapper,mC as Klarna,kC as NativePayment,KC as PaymentMethod,dg as Portal,Eh as PrimerCheckout,tA as PrimerCheckoutComplete,mA as PrimerCheckoutError,IA as PrimerMain,e_ as RedirectPayment,A_ as ShowOtherPayments,Cg as Spinner,Kx as VaultManager};
2043
+ `}};K.styles=[S,Eo],s([v({context:qt,subscribe:!0}),l({type:Object,attribute:!1})],K.prototype,"vaultManagerContext",2),s([_()],K.prototype,"isEditMode",2),s([_()],K.prototype,"deletePaymentMethodId",2),s([_()],K.prototype,"isDeleting",2),s([_()],K.prototype,"errorMessage",2),s([l({type:Number})],K.prototype,"animationDuration",2),K=s([f("primer-vault-manager"),T()],K);var kn=wn({tagName:"primer-vault-manager",elementClass:K,react:Mn});export{ps as AchPayment,ns as Button,hs as CardForm,gs as CardFormSubmit,As as CardNetworkSelector,Pa as CheckoutState,ka as Collapsable,La as Dialog,Ds as DynamicPayment,Ra as ErrorMessage,Hs as ErrorMessageContainer,Va as Icon,Ba as Input,Ms as InputCardExpiry,Ss as InputCardHolderName,Is as InputCardNumber,$s as InputCvv,ja as InputError,Wa as InputLabel,Qa as InputWrapper,Bs as Klarna,js as NativePayment,Ws as PaymentMethod,es as Portal,_a as PrimerCheckout,Qs as PrimerCheckoutComplete,en as PrimerCheckoutError,an as PrimerMain,ln as RedirectPayment,cn as ShowOtherPayments,os as Spinner,kn as VaultManager};
2043
2044
  /*! Bundled license information:
2044
2045
 
2045
2046
  @lit/context/lib/context-request-event.js: