@primer-io/primer-js 0.1.8 → 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.
- package/dist/chunks/{ar.5AY75F5J.js → ar.6MRFCKX4.js} +1 -1
- package/dist/chunks/{bg.2EL2HTYI.js → bg.HRSMU7Y5.js} +1 -1
- package/dist/chunks/{ca.WZI7CBFW.js → ca.3FSHJL7U.js} +1 -1
- package/dist/chunks/chunk.I6YWTZRK.js +1 -0
- package/dist/chunks/{cs.GBLLNC3E.js → cs.WAO4WFS3.js} +1 -1
- package/dist/chunks/{da.CDEFQG44.js → da.4OFYGDVA.js} +1 -1
- package/dist/chunks/{de.UHURA2HV.js → de.3FZS52IN.js} +1 -1
- package/dist/chunks/{el.BY5NGYDF.js → el.A4R7VG5T.js} +1 -1
- package/dist/chunks/en-GB.ILZ7SXSW.js +1 -0
- package/dist/chunks/en.7GZJA7MN.js +1 -0
- package/dist/chunks/{es-AR.EYNC6EAZ.js → es-AR.QKHDL4JV.js} +1 -1
- package/dist/chunks/{es-MX.OIO2YURF.js → es-MX.GG7MJMG2.js} +1 -1
- package/dist/chunks/{es.CNNIJYLX.js → es.FEZ6BF3S.js} +1 -1
- package/dist/chunks/{et-EE.4ZF6CLB6.js → et-EE.FJLPTMF3.js} +1 -1
- package/dist/chunks/{fi-FI.4ZXWRRYI.js → fi-FI.DM5R27A5.js} +1 -1
- package/dist/chunks/{fr.TZM5I4K2.js → fr.YZV52NTA.js} +1 -1
- package/dist/chunks/{he.DWEZBG4A.js → he.6SCF3XZZ.js} +1 -1
- package/dist/chunks/{hr.BV4PC324.js → hr.PPDZ7AAS.js} +1 -1
- package/dist/chunks/{hu.MTEKSS3J.js → hu.6WOPSGLW.js} +1 -1
- package/dist/chunks/{id.SJSTOPSC.js → id.NS22WGWL.js} +1 -1
- package/dist/chunks/{it.IISTMHN5.js → it.42TO3R4G.js} +1 -1
- package/dist/chunks/{ja.IBQ3ID5C.js → ja.UEGHEUAP.js} +1 -1
- package/dist/chunks/{ko.KZVQLI4V.js → ko.HTMDY6RY.js} +1 -1
- package/dist/chunks/{lt-LT.RKBB7CZ6.js → lt-LT.4U3GBQTQ.js} +1 -1
- package/dist/chunks/{lt.TLM7OCXP.js → lt.73ME4TDM.js} +1 -1
- package/dist/chunks/{lv-LV.H5TJC2T4.js → lv-LV.JRWO2BF6.js} +1 -1
- package/dist/chunks/{lv.G4SRVBAC.js → lv.KROS45TV.js} +1 -1
- package/dist/chunks/{ms.ATTITA66.js → ms.HE3SWJFQ.js} +1 -1
- package/dist/chunks/{nb.5EE7XOA7.js → nb.TR6TEKBY.js} +1 -1
- package/dist/chunks/{nl.TY2SYTKZ.js → nl.V5QP6OXL.js} +1 -1
- package/dist/chunks/{nl_NL.GB5BQ5PG.js → nl_NL.FCVWIF3Y.js} +1 -1
- package/dist/chunks/{pl.5PRBSG4K.js → pl.DQZDG7LR.js} +1 -1
- package/dist/chunks/{pt-BR.5XRZB5WW.js → pt-BR.CR4ROBVE.js} +1 -1
- package/dist/chunks/{pt.TA5H5JUJ.js → pt.JRWVFJPX.js} +1 -1
- package/dist/chunks/{ro.PSZKGHRP.js → ro.NRMWYY3F.js} +1 -1
- package/dist/chunks/{ru.3QZY7ZIT.js → ru.OWSKHXVO.js} +1 -1
- package/dist/chunks/{sk.FAQFYLGM.js → sk.YGBRNNWT.js} +1 -1
- package/dist/chunks/{sl.QRSCQXJP.js → sl.IRTDTNTP.js} +1 -1
- package/dist/chunks/{sr-RS.TKMMG7FK.js → sr-RS.AWGLHKVE.js} +1 -1
- package/dist/chunks/{sv.HZ3E6V5F.js → sv.O4BXFGNF.js} +1 -1
- package/dist/chunks/{th.AY6M42B4.js → th.GZCEBRT2.js} +1 -1
- package/dist/chunks/{tr.TFKBPYMO.js → tr.ZDILMEEO.js} +1 -1
- package/dist/chunks/{uk-UA.3TU67RSI.js → uk-UA.JUUBOEW3.js} +1 -1
- package/dist/chunks/{vi.NLXELMXV.js → vi.IN7CFTLL.js} +1 -1
- package/dist/chunks/zf.YT47ULXR.js +1 -0
- package/dist/chunks/{zh-CN.VEOQJ3EU.js → zh-CN.RBRAS4RP.js} +1 -1
- package/dist/chunks/{zh-HK.ZEXSW7FF.js → zh-HK.4CK7LBWM.js} +1 -1
- package/dist/chunks/{zh-TW.MMVWEQMZ.js → zh-TW.374TMWNJ.js} +1 -1
- package/dist/custom-elements.json +1154 -1019
- package/dist/primer-loader.d.ts +815 -741
- package/dist/primer-loader.js +923 -924
- package/dist/primer-react-wrappers.js +385 -386
- package/dist/web-types.json +1 -1
- package/package.json +9 -1
- package/dist/chunks/chunk.G45OCYEN.js +0 -1
- package/dist/chunks/en-GB.UBLLAUVW.js +0 -1
- package/dist/chunks/en.BKAVPUID.js +0 -1
- 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]`,
|
|
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
|
-
`,
|
|
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
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
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
|
-
${
|
|
23
|
-
`,()=>
|
|
24
|
-
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};
|
|
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
|
|
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
|
-
`:
|
|
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?
|
|
74
|
-
`}};
|
|
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
|
|
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
|
-
`}};
|
|
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
|
|
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=${
|
|
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
|
-
`}};
|
|
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
|
|
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:
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
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||
|
|
373
|
+
${e||d`<slot></slot>`}
|
|
553
374
|
</div>
|
|
554
|
-
`}};
|
|
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
|
|
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)}};
|
|
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
|
|
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
|
-
`}};
|
|
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
|
|
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
|
|
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="${
|
|
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
|
-
`}};
|
|
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
|
|
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
|
|
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
|
-
`}};
|
|
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
|
|
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
|
-
${
|
|
892
|
+
${C("payWithAch",{id:"payWithAch"})}
|
|
894
893
|
</h2>
|
|
895
894
|
<p>
|
|
896
|
-
${
|
|
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
|
-
${
|
|
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:
|
|
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
|
-
${
|
|
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:
|
|
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
|
-
${
|
|
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:
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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
|
|
967
|
+
`}renderMandate(){return d`
|
|
969
968
|
<h2>
|
|
970
|
-
${
|
|
969
|
+
${C("payWithAch",{id:"payWithAch"})}
|
|
971
970
|
</h2>
|
|
972
971
|
|
|
973
972
|
<p>
|
|
974
|
-
${this.clientOptions?.stripe?.mandateData.fullMandateText??
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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():
|
|
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
|
|
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:()=>
|
|
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
|
-
`}};
|
|
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
|
|
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
|
-
`}};
|
|
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,67 +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
|
|
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
|
-
${
|
|
1172
|
+
${sr(this.buttonRef)}
|
|
1174
1173
|
class="network-selector"
|
|
1175
1174
|
@click=${this.toggleDropdown}
|
|
1176
|
-
@keydown=${
|
|
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:
|
|
1179
|
-
aria-haspopup=${o?"true":
|
|
1180
|
-
aria-controls=${o?"network-dropdown":
|
|
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
|
-
${
|
|
1186
|
+
${w(o,()=>d`
|
|
1188
1187
|
<primer-icon
|
|
1189
1188
|
class="caret ${this.isDropdownOpen?"open":""}"
|
|
1190
1189
|
size="sm"
|
|
1191
1190
|
name="chevron-down"
|
|
1192
1191
|
></primer-icon>
|
|
1193
|
-
`,()=>
|
|
1192
|
+
`,()=>c)}
|
|
1194
1193
|
</button>
|
|
1195
1194
|
|
|
1196
|
-
${
|
|
1195
|
+
${w(this.isDropdownOpen,()=>d`
|
|
1197
1196
|
<div
|
|
1198
|
-
${
|
|
1197
|
+
${sr(this.dropdownRef)}
|
|
1199
1198
|
id="network-dropdown"
|
|
1200
1199
|
class="dropdown open"
|
|
1201
1200
|
role="listbox"
|
|
1202
1201
|
aria-label="Select card network"
|
|
1203
1202
|
>
|
|
1204
|
-
${e.map((
|
|
1203
|
+
${e.map((a,n)=>d`
|
|
1205
1204
|
<div
|
|
1206
|
-
${
|
|
1207
|
-
class="network-option ${this.isKeyboardNavigation&&
|
|
1208
|
-
@click=${
|
|
1209
|
-
@keydown=${
|
|
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)}}
|
|
1210
1209
|
role="option"
|
|
1211
|
-
aria-selected=${
|
|
1212
|
-
tabindex="${
|
|
1210
|
+
aria-selected=${a.network===r.network}
|
|
1211
|
+
tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
|
|
1213
1212
|
>
|
|
1214
1213
|
<img
|
|
1215
1214
|
class="network-option-icon"
|
|
1216
|
-
src=${this.getNetworkIconUrl(
|
|
1217
|
-
alt=${
|
|
1215
|
+
src=${this.getNetworkIconUrl(a)}
|
|
1216
|
+
alt=${a.displayName}
|
|
1218
1217
|
/>
|
|
1219
|
-
<span class="network-name">${
|
|
1220
|
-
${
|
|
1218
|
+
<span class="network-name">${a.displayName}</span>
|
|
1219
|
+
${w(a.network===r.network,()=>d`
|
|
1221
1220
|
<primer-icon
|
|
1222
1221
|
class="checkmark"
|
|
1223
1222
|
name="checkmark"
|
|
1224
1223
|
size="sm"
|
|
1225
1224
|
></primer-icon>
|
|
1226
|
-
`,()=>
|
|
1225
|
+
`,()=>c)}
|
|
1227
1226
|
</div>
|
|
1228
1227
|
`)}
|
|
1229
1228
|
</div>
|
|
1230
|
-
`,()=>
|
|
1231
|
-
`}};
|
|
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=`
|
|
1232
1231
|
input[data-custom-input]::placeholder {
|
|
1233
1232
|
color: var(--primer-color-text-placeholder);
|
|
1234
1233
|
font-size: var(--primer-typography-body-large-size);
|
|
@@ -1237,44 +1236,44 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1237
1236
|
input[data-custom-input]:focus {
|
|
1238
1237
|
outline: none;
|
|
1239
1238
|
}
|
|
1240
|
-
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function
|
|
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`
|
|
1241
1240
|
<primer-input-wrapper
|
|
1242
1241
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1243
1242
|
.hasError=${!!e}
|
|
1244
1243
|
@wrapper-click="${this.handleWrapperClick}"
|
|
1245
1244
|
>
|
|
1246
|
-
${
|
|
1245
|
+
${w(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
1247
1246
|
>${this.label}</primer-input-label
|
|
1248
|
-
>`,()=>
|
|
1247
|
+
>`,()=>c)}
|
|
1249
1248
|
<div
|
|
1250
1249
|
slot="input"
|
|
1251
1250
|
class="card-input-slot"
|
|
1252
1251
|
id="${this.config.containerSelector.substring(1)}"
|
|
1253
1252
|
aria-label="${this.ariaLabel}"
|
|
1254
1253
|
></div>
|
|
1255
|
-
${
|
|
1254
|
+
${w(e,()=>d`
|
|
1256
1255
|
<primer-input-error slot="error">
|
|
1257
|
-
${
|
|
1256
|
+
${C(e,{id:e})}
|
|
1258
1257
|
</primer-input-error>
|
|
1259
|
-
`,()=>
|
|
1258
|
+
`,()=>c)}
|
|
1260
1259
|
</primer-input-wrapper>
|
|
1261
|
-
`}};
|
|
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`
|
|
1262
1261
|
:host {
|
|
1263
1262
|
display: contents;
|
|
1264
1263
|
}
|
|
1265
|
-
`;var
|
|
1264
|
+
`;var Ct=h`
|
|
1266
1265
|
.card-input-slot {
|
|
1267
1266
|
display: flex;
|
|
1268
1267
|
}
|
|
1269
|
-
`;var
|
|
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`
|
|
1270
1269
|
:host {
|
|
1271
1270
|
display: contents;
|
|
1272
1271
|
}
|
|
1273
|
-
`;var
|
|
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`
|
|
1274
1273
|
:host {
|
|
1275
1274
|
display: contents;
|
|
1276
1275
|
}
|
|
1277
|
-
`;var
|
|
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`
|
|
1278
1277
|
:host {
|
|
1279
1278
|
display: contents;
|
|
1280
1279
|
}
|
|
@@ -1298,14 +1297,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1298
1297
|
align-items: center;
|
|
1299
1298
|
z-index: 2;
|
|
1300
1299
|
}
|
|
1301
|
-
`;var
|
|
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`
|
|
1302
1301
|
<primer-input-wrapper
|
|
1303
1302
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1304
1303
|
.hasError=${!!e}
|
|
1305
1304
|
>
|
|
1306
|
-
${
|
|
1305
|
+
${w(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
1307
1306
|
>${this.label}</primer-input-label
|
|
1308
|
-
>`,()=>
|
|
1307
|
+
>`,()=>c)}
|
|
1309
1308
|
<div
|
|
1310
1309
|
slot="input"
|
|
1311
1310
|
class="card-number-container"
|
|
@@ -1318,13 +1317,13 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1318
1317
|
></primer-card-network-selector>
|
|
1319
1318
|
</div>
|
|
1320
1319
|
</div>
|
|
1321
|
-
${
|
|
1320
|
+
${w(e,r=>d`
|
|
1322
1321
|
<primer-input-error slot="error">
|
|
1323
|
-
${
|
|
1322
|
+
${C(r,{id:r})}
|
|
1324
1323
|
</primer-input-error>
|
|
1325
|
-
`,()=>
|
|
1324
|
+
`,()=>c)}
|
|
1326
1325
|
</primer-input-wrapper>
|
|
1327
|
-
`}render(){return this.renderInput()}};
|
|
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`
|
|
1328
1327
|
:host {
|
|
1329
1328
|
height: calc(
|
|
1330
1329
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1360,7 +1359,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1360
1359
|
img {
|
|
1361
1360
|
height: 100%;
|
|
1362
1361
|
}
|
|
1363
|
-
`;function
|
|
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`
|
|
1364
1363
|
<primer-portal>
|
|
1365
1364
|
<primer-dialog @primer-dialog-close="${()=>this.open=!1}">
|
|
1366
1365
|
<primer-ach-payment
|
|
@@ -1371,11 +1370,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1371
1370
|
></primer-ach-payment>
|
|
1372
1371
|
</primer-dialog>
|
|
1373
1372
|
</primer-portal>
|
|
1374
|
-
`:
|
|
1373
|
+
`:c}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
|
|
1375
1374
|
<primer-button
|
|
1376
1375
|
@click="${()=>this.start()}"
|
|
1377
|
-
class=${
|
|
1378
|
-
title="${
|
|
1376
|
+
class=${R({loading:!!this.sdkState?.isProcessing,reverse:!0})}
|
|
1377
|
+
title="${C("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1379
1378
|
>
|
|
1380
1379
|
<span class="image-container">
|
|
1381
1380
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
@@ -1383,17 +1382,17 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1383
1382
|
${e.displayName}
|
|
1384
1383
|
</primer-button>
|
|
1385
1384
|
${this.renderDialog()}
|
|
1386
|
-
`)})}};
|
|
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`
|
|
1387
1386
|
:host {
|
|
1388
1387
|
display: block;
|
|
1389
1388
|
width: 100%;
|
|
1390
1389
|
}
|
|
1391
|
-
`;var
|
|
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`
|
|
1392
1391
|
<primer-error-message
|
|
1393
|
-
message="${
|
|
1392
|
+
message="${C(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
1394
1393
|
?visible="${this.shouldShowError}"
|
|
1395
1394
|
></primer-error-message>
|
|
1396
|
-
`:
|
|
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`
|
|
1397
1396
|
:host {
|
|
1398
1397
|
display: contents;
|
|
1399
1398
|
}
|
|
@@ -1585,38 +1584,38 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1585
1584
|
background-color: var(--primer-color-background-outlined-default);
|
|
1586
1585
|
border-radius: var(--primer-radius-small);
|
|
1587
1586
|
}
|
|
1588
|
-
`;var
|
|
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">
|
|
1589
1588
|
<primer-spinner size="small"></primer-spinner>
|
|
1590
|
-
</div>`:
|
|
1589
|
+
</div>`:d`
|
|
1591
1590
|
<div class="category-selection">
|
|
1592
|
-
${e.map(o=>
|
|
1591
|
+
${e.map(o=>d`
|
|
1593
1592
|
<button
|
|
1594
|
-
class=${
|
|
1593
|
+
class=${R({"category-button":!0,selected:o.id===this.selectedCategory})}
|
|
1595
1594
|
@click=${()=>{this.selectCategory(o.id)}}
|
|
1596
1595
|
>
|
|
1597
1596
|
${o.name}
|
|
1598
1597
|
</button>
|
|
1599
1598
|
`)}
|
|
1600
1599
|
</div>
|
|
1601
|
-
`}renderExpandedContent(){return
|
|
1600
|
+
`}renderExpandedContent(){return d`
|
|
1602
1601
|
${this.renderCategorySelection()}
|
|
1603
|
-
${this.selectedCategory?
|
|
1602
|
+
${this.selectedCategory?d`
|
|
1604
1603
|
<div
|
|
1605
1604
|
id="klarna-category-container"
|
|
1606
1605
|
class="klarna-category-container"
|
|
1607
1606
|
></div>
|
|
1608
|
-
`:
|
|
1607
|
+
`:c}
|
|
1609
1608
|
|
|
1610
1609
|
<button
|
|
1611
|
-
class=${
|
|
1610
|
+
class=${R({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1612
1611
|
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1613
1612
|
@click=${()=>this.startKlarnaPayment()}
|
|
1614
1613
|
>
|
|
1615
|
-
${
|
|
1614
|
+
${C("confirm",{id:"confirm"})}
|
|
1616
1615
|
</button>
|
|
1617
|
-
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return
|
|
1616
|
+
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return d`<div class="error">
|
|
1618
1617
|
Error loading Klarna: ${r}
|
|
1619
|
-
</div>`},complete:({manager:e,klarnaIcon:r})=>e?
|
|
1618
|
+
</div>`},complete:({manager:e,klarnaIcon:r})=>e?d`
|
|
1620
1619
|
<div class="klarna-container ${this.isExpanded?"expanded":""}">
|
|
1621
1620
|
<div class="klarna-button-header">
|
|
1622
1621
|
<primer-button
|
|
@@ -1629,7 +1628,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1629
1628
|
aria-label=${this.headerAriaLabel}
|
|
1630
1629
|
>
|
|
1631
1630
|
<img src=${r} alt="Klarna logo" />
|
|
1632
|
-
<span>${
|
|
1631
|
+
<span>${C("pay_with",{id:"pay_with"})} Klarna</span>
|
|
1633
1632
|
<span
|
|
1634
1633
|
class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
|
|
1635
1634
|
>
|
|
@@ -1646,7 +1645,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1646
1645
|
</div>
|
|
1647
1646
|
</div>
|
|
1648
1647
|
</div>
|
|
1649
|
-
`:
|
|
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`
|
|
1650
1649
|
:host {
|
|
1651
1650
|
height: calc(
|
|
1652
1651
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1660,29 +1659,29 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1660
1659
|
height: 100%;
|
|
1661
1660
|
flex: 1;
|
|
1662
1661
|
}
|
|
1663
|
-
`;var
|
|
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`
|
|
1664
1663
|
<!-- The native button container is rendered first -->
|
|
1665
1664
|
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
1666
|
-
`,pending:()=>
|
|
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`
|
|
1667
1666
|
:host {
|
|
1668
1667
|
display: contents;
|
|
1669
1668
|
}
|
|
1670
|
-
`;var
|
|
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
|
|
1671
1670
|
.paymentMethod=${e}
|
|
1672
|
-
></primer-native-payment>`;case"REDIRECT":return
|
|
1671
|
+
></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
|
|
1673
1672
|
.paymentMethod=${e}
|
|
1674
|
-
></primer-redirect-payment>`;case"KLARNA":return
|
|
1673
|
+
></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
|
|
1675
1674
|
<primer-dynamic-payment
|
|
1676
1675
|
.paymentMethod=${e}
|
|
1677
1676
|
></primer-dynamic-payment>
|
|
1678
|
-
`;default:return
|
|
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`
|
|
1679
1678
|
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
1680
|
-
`}};
|
|
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`
|
|
1681
1680
|
<primer-checkout-state
|
|
1682
1681
|
type="failure"
|
|
1683
1682
|
description=${this.sdkState?.error?.message||""}
|
|
1684
1683
|
></primer-checkout-state>
|
|
1685
|
-
`}};
|
|
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`
|
|
1686
1685
|
:host {
|
|
1687
1686
|
display: contents;
|
|
1688
1687
|
}
|
|
@@ -1701,20 +1700,20 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1701
1700
|
primer-vault-manager {
|
|
1702
1701
|
margin-bottom: var(--primer-space-xlarge);
|
|
1703
1702
|
}
|
|
1704
|
-
`;var
|
|
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`
|
|
1705
1704
|
<slot name="checkout-complete">
|
|
1706
1705
|
<primer-checkout-complete></primer-checkout-complete>
|
|
1707
1706
|
</slot>
|
|
1708
|
-
`:
|
|
1707
|
+
`:d`
|
|
1709
1708
|
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
1710
|
-
${
|
|
1709
|
+
${w(this.hasAssignedContent,()=>c,()=>d`
|
|
1711
1710
|
<div
|
|
1712
|
-
class=${
|
|
1711
|
+
class=${R({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
1713
1712
|
>
|
|
1714
1713
|
<primer-vault-manager></primer-vault-manager>
|
|
1715
1714
|
<primer-show-other-payments>
|
|
1716
1715
|
<div slot="other-payments" class="primer-main-list">
|
|
1717
|
-
${this.paymentMethods?.toArray().map(e=>
|
|
1716
|
+
${this.paymentMethods?.toArray().map(e=>d`
|
|
1718
1717
|
<primer-payment-method
|
|
1719
1718
|
type=${e.type}
|
|
1720
1719
|
></primer-payment-method>
|
|
@@ -1724,7 +1723,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1724
1723
|
<primer-error-message-container></primer-error-message-container>
|
|
1725
1724
|
</div>
|
|
1726
1725
|
`)}
|
|
1727
|
-
`}};
|
|
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`
|
|
1728
1727
|
:host {
|
|
1729
1728
|
height: calc(
|
|
1730
1729
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1799,24 +1798,24 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1799
1798
|
flex-shrink: 0;
|
|
1800
1799
|
flex-grow: 1;
|
|
1801
1800
|
}
|
|
1802
|
-
`;var
|
|
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`
|
|
1803
1802
|
<span class="image-container">
|
|
1804
1803
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1805
1804
|
</span>
|
|
1806
1805
|
<span class="button-text">${e.displayName}</span>
|
|
1807
|
-
`:
|
|
1806
|
+
`:d`
|
|
1808
1807
|
<span class="image-container">
|
|
1809
1808
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1810
1809
|
</span>
|
|
1811
|
-
`;return
|
|
1810
|
+
`;return d`
|
|
1812
1811
|
<primer-button
|
|
1813
1812
|
@click="${()=>this.startRedirectPayment()}"
|
|
1814
|
-
class=${
|
|
1815
|
-
title="${
|
|
1813
|
+
class=${R(r)}
|
|
1814
|
+
title="${C("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1816
1815
|
>
|
|
1817
1816
|
${o}
|
|
1818
1817
|
</primer-button>
|
|
1819
|
-
`}})}};
|
|
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`
|
|
1820
1819
|
:host {
|
|
1821
1820
|
display: block;
|
|
1822
1821
|
margin-top: var(--primer-space-medium);
|
|
@@ -1836,19 +1835,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1836
1835
|
justify-content: center;
|
|
1837
1836
|
align-items: center;
|
|
1838
1837
|
}
|
|
1839
|
-
`;var
|
|
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`
|
|
1840
1839
|
<div class="other-payment-methods-container">
|
|
1841
1840
|
<primer-collapsable
|
|
1842
1841
|
buttonVariant="secondary"
|
|
1843
1842
|
.expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
|
|
1844
|
-
.header="${
|
|
1843
|
+
.header="${C("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
1845
1844
|
>
|
|
1846
1845
|
<div class="other-payment-methods-content">
|
|
1847
1846
|
<slot name="other-payments"></slot>
|
|
1848
1847
|
</div>
|
|
1849
1848
|
</primer-collapsable>
|
|
1850
1849
|
</div>
|
|
1851
|
-
`}};
|
|
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`
|
|
1852
1851
|
:host {
|
|
1853
1852
|
display: block;
|
|
1854
1853
|
width: 100%;
|
|
@@ -1965,19 +1964,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1965
1964
|
transition: none;
|
|
1966
1965
|
}
|
|
1967
1966
|
}
|
|
1968
|
-
`;var
|
|
1969
|
-
\f\r]`,
|
|
1970
|
-
\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`
|
|
1971
1970
|
<div
|
|
1972
1971
|
class="loading-overlay"
|
|
1973
|
-
${
|
|
1972
|
+
${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1974
1973
|
>
|
|
1975
1974
|
<primer-spinner
|
|
1976
1975
|
size="medium"
|
|
1977
1976
|
color="var(--primer-color-loader)"
|
|
1978
1977
|
></primer-spinner>
|
|
1979
1978
|
</div>
|
|
1980
|
-
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return
|
|
1979
|
+
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return c;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
|
|
1981
1980
|
<div class="delete-confirmation-container">
|
|
1982
1981
|
<primer-vault-delete-confirmation
|
|
1983
1982
|
.isDeleting=${this.isDeleting}
|
|
@@ -1985,30 +1984,30 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1985
1984
|
.paymentMethodName=${e}
|
|
1986
1985
|
@confirm-delete=${this.handleConfirmDelete}
|
|
1987
1986
|
@cancel-delete=${this.handleCancelDelete}
|
|
1988
|
-
${
|
|
1987
|
+
${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1989
1988
|
></primer-vault-delete-confirmation>
|
|
1990
1989
|
</div>
|
|
1991
|
-
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?
|
|
1990
|
+
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?c:d`
|
|
1992
1991
|
<primer-vault-payment-method-item
|
|
1993
1992
|
.paymentMethod=${e}
|
|
1994
1993
|
.isEditMode=${this.isEditMode}
|
|
1995
1994
|
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
1996
|
-
${
|
|
1995
|
+
${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1997
1996
|
></primer-vault-payment-method-item>
|
|
1998
|
-
`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return
|
|
1997
|
+
`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
|
|
1999
1998
|
<div class="payment-methods-list">
|
|
2000
1999
|
${e.map(o=>this.renderPaymentMethodItem(o))}
|
|
2001
|
-
${
|
|
2000
|
+
${w(r,()=>d`
|
|
2002
2001
|
<div class="submit-button-container">
|
|
2003
2002
|
<primer-vault-payment-submit
|
|
2004
2003
|
class="submit-button"
|
|
2005
2004
|
@primer-vault-payment-error=${this.handlePaymentError}
|
|
2006
|
-
${
|
|
2005
|
+
${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2007
2006
|
></primer-vault-payment-submit>
|
|
2008
2007
|
</div>
|
|
2009
|
-
`,()=>
|
|
2008
|
+
`,()=>c)}
|
|
2010
2009
|
</div>
|
|
2011
|
-
`}render(){if(!this.vaultManagerContext?.enabled)return
|
|
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`
|
|
2012
2011
|
<div class="vault-manager ${o?"is-updating":""}">
|
|
2013
2012
|
<primer-vault-manager-header
|
|
2014
2013
|
.isEditMode=${this.isEditMode}
|
|
@@ -2016,32 +2015,32 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
2016
2015
|
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
2017
2016
|
></primer-vault-manager-header>
|
|
2018
2017
|
|
|
2019
|
-
${
|
|
2018
|
+
${w(this.errorMessage,()=>d`
|
|
2020
2019
|
<primer-vault-error-message
|
|
2021
2020
|
.errorMessage=${this.errorMessage}
|
|
2022
2021
|
@close-error=${this.handleCloseError}
|
|
2023
|
-
${
|
|
2022
|
+
${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2024
2023
|
></primer-vault-error-message>
|
|
2025
|
-
`,()=>
|
|
2024
|
+
`,()=>c)}
|
|
2026
2025
|
|
|
2027
2026
|
<div class="vault-manager-content">
|
|
2028
|
-
${
|
|
2027
|
+
${w(!r&&!e,()=>d`
|
|
2029
2028
|
<div class="content-container">
|
|
2030
2029
|
<primer-vault-empty-state
|
|
2031
|
-
${
|
|
2030
|
+
${At({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2032
2031
|
></primer-vault-empty-state>
|
|
2033
2032
|
</div>
|
|
2034
|
-
`,()=>
|
|
2035
|
-
${
|
|
2033
|
+
`,()=>c)}
|
|
2034
|
+
${w(!r&&e,()=>d`
|
|
2036
2035
|
<div class="content-container">
|
|
2037
|
-
${
|
|
2036
|
+
${w(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
2038
2037
|
</div>
|
|
2039
|
-
`,()=>
|
|
2038
|
+
`,()=>c)}
|
|
2040
2039
|
</div>
|
|
2041
2040
|
|
|
2042
|
-
${
|
|
2041
|
+
${w(o,()=>this.renderLoadingOverlay(),()=>c)}
|
|
2043
2042
|
</div>
|
|
2044
|
-
`}};
|
|
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};
|
|
2045
2044
|
/*! Bundled license information:
|
|
2046
2045
|
|
|
2047
2046
|
@lit/context/lib/context-request-event.js:
|