@primer-io/primer-js 0.1.2 → 0.1.3
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/custom-elements.json +321 -122
- package/dist/primer-loader.d.ts +30 -27
- package/dist/primer-loader.js +83 -83
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/dist/primer-loader.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
import{a as Uo,b as tn,c as Dr,d as n}from"./chunks/chunk.G45OCYEN.js";var Ar=tn((Vt,co)=>{(function(o,t){typeof Vt=="object"&&typeof co=="object"?co.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Vt=="object"?Vt.Primer=t():o.Primer=t()})(Vt,()=>(()=>{"use strict";let o;var t,e,r={};r.d=(a,l)=>{for(var p in l)r.o(l,p)&&!r.o(a,p)&&Object.defineProperty(a,p,{enumerable:!0,get:l[p]})},r.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};r.r(i),r.d(i,{SuccessScreenType:()=>Wa,PaymentFlow:()=>Ka,ThreeDSecureStatus:()=>ja,TokenType:()=>Ga,isStripeOptionsDropInWithFullMandateText:()=>Za,PaymentInstrumentType:()=>yt,ErrorCode:()=>qa,EventTypes:()=>Xa,CheckoutUXFlow:()=>Fa,HeadlessManagerType:()=>Ja,PaymentMethodType:()=>bt,Primer:()=>Qa});let s={LEGACY:"legacy",V_2_4:"2.4"},c=s.V_2_4,x=c;class h extends Error{static from(l,p=!1){if(l instanceof h)return l;let b=new h(l instanceof Error?l.message:String(l),p);return l instanceof Error&&l.stack&&(b.stack=l.stack,Object.assign(b,l)),b}markAsReported(){this.isReported=!0}constructor(l,p=!1){super(l),function(b,A,E){A in b?Object.defineProperty(b,A,{value:E,enumerable:!0,configurable:!0,writable:!0}):b[A]=E}(this,"isReported",void 0),this.isReported=p,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let R="https://analytics.production.data.primer.io/sdk-logs";var z=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),O=function(a){return a.START="START",a.END="END",a}({});let Q={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var B=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function Xe(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let ua={get(a,l){let p;try{switch(a){case"PRIMER_SDK_VERSION":p="v2.53.2";break;case"PRIMER_ASSETS_URL":p=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":p=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return p||l}}.get("PRIMER_SDK_VERSION");async function uo(a,l,p){return{...p,createdAt:Date.now(),device:await Xe(),eventType:a,properties:l,sdkVersion:ua,sdkType:"WEB"}}let ho=Symbol.for("__primerAnalytics__"),gt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[ho];a?gt=a:window[ho]=gt}let go=()=>gt.providers,_r=()=>gt.timers,ft=()=>gt.eventsQueue,Yt=new Map;function Sr(a,l=!1,p=1){Yt.has(a)&&(clearTimeout(Yt.get(a)),Yt.delete(a));let b=()=>{let E=ft().get(a);if(E?.length){let y=!0,M=[],k=0,_=0;for(;_<E.length;){let L=E[_],H=new Blob([JSON.stringify(L)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",L),_++;continue}if(k+H>64e3&&M.length>0){try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(U){y=!1,console.error("Unable to send events",U)}if(!y)break;M=[],k=0}M.push(L),k+=H,_++}if(M.length>0&&y)try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(L){y=!1,console.error("Unable to send events",L)}y?ft().delete(a):p<5?setTimeout(()=>Sr(a,l,p+1),500*Math.pow(2,p)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void b();let A=setTimeout(b,500);Yt.set(a,A)}let fo=!1;function Pr({url:a=R,...l}){typeof document>"u"||fo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=Je(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),Sr(A.url,!0)}}),fo=!0);let p=A=>async E=>{if(typeof navigator>"u")return;let y=function k(_,L,H=new WeakSet,U=0,oe=10){if(U>oe||H.has(_))return _;H.add(_);let ie=te=>typeof te=="object"&&te!==null?k(te,L,H,U+1,oe):L(te);return Array.isArray(_)?_.map(ie):Object.fromEntries(Object.entries(_).map(([te,et])=>[te,ie(et)]))}(await uo(A,E,l),k=>{var _;return typeof(_=typeof k=="function"?k.name||"function":k)=="string"&&_.length>5120?`${_.slice(0,5120)}...`:_});ft().has(a)||ft().set(a,[]),ft().get(a)?.push(y),Sr(a)},b={crashEvent:p(B.CRASH_EVENT),messageEvent:p(B.MESSAGE_EVENT),networkCallEvent:p(B.NETWORK_CALL_EVENT),sdkFunctionEvent:p(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return _r().set(y,{start:M}),p(B.TIMER_EVENT)({...E,id:A,timerType:O.START})},timerEnd:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,{start:M}=_r().get(y)??{};_r().delete(y);let k=performance?.now?performance.now():Date.now();return p(B.TIMER_EVENT)({...E,id:A,timerType:O.END,duration:M?k-M:void 0})},v1Event:p(B.V1_EVENT),url:a};return go().set(l.checkoutSessionId,b),Je(l.checkoutSessionId)}function Je(a){return new Proxy({},{get:(l,p)=>(go().get(a)??Pr({checkoutSessionId:a}))[p]})}let Tr=(a,l,p,b)=>({callType:p?z.REQUEST_END:z.REQUEST_START,id:a,errorBody:p?.error&&JSON.stringify(p.error,Object.getOwnPropertyNames(p.error)),method:l.method,responseCode:p?.status,url:l.url,duration:b});function ha(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function vo(a,l,p,b=ha){let A=0,E={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!E.enabled)return a();for(;;)try{let y=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof y=="object"&&y&&"status"in y&&(M+=` Status code: ${y.status}`),p?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return y}catch(y){let M=A>=E.maxRetries,k=y.isNetworkError&&!E.retryNetworkErrors,_=y.status&&y.status>=500&&!E.retry500Errors;if(M||k||_){let U=`Failed after ${A} retries. `;throw M?U+=`Reached maximum retries (${E.maxRetries}).`:k?U+="Network error encountered and retryNetworkErrors is disabled.":_&&(U+="HTTP 500 error encountered and retry500Errors is disabled."),U+=` Last error: ${y.message}`,p?.({messageType:"RETRY_FAILED",message:U,severity:"ERROR",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),Error(U,{cause:y})}A++;let L=Math.min(E.initialBackoff*Math.pow(2,A-1)+Math.random()*E.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";y.isNetworkError?H="Network error":y.status&&(H=`HTTP ${y.status} error`),p?.({messageType:"RETRY",message:`Retry attempt ${A}/${E.maxRetries} due to: ${H}. Error details: ${y.message}. Waiting for ${L.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),await b(L)}}let wr={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=wr),wr=window.__primerCache__);let ee=()=>wr.cache;function yo(){if(ee().size<=30)return;let a=Date.now();for(let[l,p]of ee())p.exp<a&&ee().delete(l);if(ee().size>50)for(let[l]of ee()){if(ee().size<=50)break;ee().delete(l)}}let kr=()=>bo.randomUUID?.()||ga(),ga=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^fa()>>a/4).toString(16)),fa=()=>(bo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,bo=typeof crypto<"u"?crypto:{},va=(a,l,p)=>ya(a,"get",l,p),ya=async(a,l,p,b,A)=>{let E=kr(),y=performance?.now(),M=Je(a),k={method:l,url:p,body:A};M.networkCallEvent(Tr(E,k));try{let _=await fetch(p,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":E,...b}});if(!_.ok){let U=Error(`HTTP error! status: ${_.status}`);throw U.status=_.status,U}let L=await _.json();if(p.includes("client-sdk/configuration")){let{primerAccountId:U,clientSession:{clientSessionId:oe,customer:ie}}=L;M=Pr({checkoutSessionId:a,clientSessionId:oe,customerId:ie?.customerId,primerAccountId:U,url:M.url})}let H=performance?.now();return M.networkCallEvent(Tr(E,k,{data:L},H-y)),{data:L,headers:_.headers,status:_.status,source:"NETWORK"}}catch(_){let L=performance?.now();throw Object.assign(_,{isNetworkError:_ instanceof TypeError}),M.networkCallEvent(Tr(E,k,{error:_},L-y)),_}},ba=(a,l)=>new Promise((p,b)=>{let A=setTimeout(()=>{let E=Error("Request timed out");E.isNetworkError=!0,b(E)},l);a.then(p).catch(b).finally(()=>clearTimeout(A))}),Ea=(a,l)=>{let{headers:p,retryConfig:b,cacheConfig:A,timeout:E=15e3,checkoutSessionId:y}=l,M=Je(y);return function(k){if(!k)return oe=>oe();let{key:_,refresh:L=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:U=36e5}=k;return async oe=>{let ie=Date.now(),te=ee().get(_);if(!L&&te&&te.exp>ie)return te.promise;te&&ee().delete(_);let et=oe().then(Et=>{let Vo=U;return H&&(Vo=1e3*(Number(Et.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ho,ttl:Yo=36e5},en){Yo?ee().set(Ho,{promise:Promise.resolve({...en,source:"CACHE"}),exp:Date.now()+Yo}):ee().delete(Ho)}({key:_,ttl:Vo},Et),yo(),Et},Et=>{throw ee().delete(_),Et});return ee().set(_,{promise:et,exp:ie+U}),yo(),et}}(A)(()=>vo(()=>ba(va(y,a,p),E),b,k=>M.messageEvent({...k,url:a})))},Qe=typeof Buffer=="function",Eo=typeof TextDecoder=="function"?new TextDecoder:void 0,xo=typeof TextEncoder=="function"?new TextEncoder:void 0,vt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ut=(a=>{let l={};return a.forEach((p,b)=>l[p]=b),l})(vt),xa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,F=String.fromCharCode.bind(String),Co=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),Ao=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Mo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),_o=typeof btoa=="function"?a=>btoa(a):Qe?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,p,b,A,E="",y=a.length%3;for(let M=0;M<a.length;){if((p=a.charCodeAt(M++))>255||(b=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");E+=vt[(l=p<<16|b<<8|A)>>18&63]+vt[l>>12&63]+vt[l>>6&63]+vt[63&l]}return y?E.slice(0,y-3)+"===".substring(y):E},Ir=Qe?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let p=0,b=a.length;p<b;p+=4096)l.push(F.apply(null,a.subarray(p,p+4096)));return _o(l.join(""))},jn=(a,l=!1)=>l?Ao(Ir(a)):Ir(a),Ca=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?F(192|l>>>6)+F(128|63&l):F(224|l>>>12&15)+F(128|l>>>6&63)+F(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return F(240|l>>>18&7)+F(128|l>>>12&63)+F(128|l>>>6&63)+F(128|63&l)},Aa=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ma=a=>a.replace(Aa,Ca),So=Qe?a=>Buffer.from(a,"utf8").toString("base64"):xo?a=>Ir(xo.encode(a)):a=>_o(Ma(a)),_a=(a,l=!1)=>l?Ao(So(a)):So(a),Sa=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Pa=a=>{switch(a.length){case 4:var l=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return F((l>>>10)+55296)+F((1023&l)+56320);case 3:return F((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return F((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Ta=a=>a.replace(Sa,Pa),Po=typeof atob=="function"?a=>atob(Mo(a)):Qe?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!xa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,p="",b,A;for(let E=0;E<a.length;)l=Ut[a.charAt(E++)]<<18|Ut[a.charAt(E++)]<<12|(b=Ut[a.charAt(E++)])<<6|(A=Ut[a.charAt(E++)]),p+=b===64?F(l>>16&255):A===64?F(l>>16&255,l>>8&255):F(l>>16&255,l>>8&255,255&l);return p},To=Qe?a=>Co(Buffer.from(a,"base64")):a=>Co(Po(a).split("").map(l=>l.charCodeAt(0))),Gn=a=>To(wo(a)),wa=Qe?a=>Buffer.from(a,"base64").toString("utf8"):Eo?a=>Eo.decode(To(a)):a=>Ta(Po(a)),wo=a=>Mo(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),ka=a=>wa(wo(a)),qn=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),ko={encode:_a,decode:ka},Ia={encode:function(a,l={}){let{urlSafe:p=!1}=l;return ko.encode(a,p)},decode:ko.decode},Io="The provided `clientToken`",Na=`${Io} has expired`,La=`${Io} is malformed`,Ra=(a,l,p)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.2","primer-sdk-checkout-session-id":l,...p&&{"x-api-version":p}});async function Oa(a,l,p){let{accessToken:b,configurationUrl:A,analyticsUrlV2:E}=function(_){let L=function(U){try{let[oe,ie]=U.split(".");return JSON.parse(Ia.decode(ie||oe))}catch{throw Error(La)}}(_),H=1e3*L.exp;if(Date.now()>H)throw Error(`${Na}. Expiration date: ${new Date(H).toISOString()}`);return L}(a),y=Pr({checkoutSessionId:l,url:E}),M=x,k=M!==s.LEGACY?M:"2.3";y.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:_,source:L}=await Ea(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:Ra(b,l,k),retryConfig:{enabled:!0},cacheConfig:p});return y.timerEnd({id:"CONFIGURATION_LOADING",context:{source:L}}),_}catch(_){let L=_ instanceof Error?_.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${L}`)}}function No(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function zt({checkoutSessionId:a,analytics:l,error:p,reporter:b}){l?.crashEvent?l.crashEvent({...No(p),reporter:b}):a&&Nr(a,p,b)}async function Nr(a,l,p){let b=await uo(B.CRASH_EVENT,{...No(l),reporter:p},{checkoutSessionId:a});try{await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch(A){console.error("Failed to post crash event",A)}}let Lo=Symbol.for("initGlobalErrorMonitoringLoaded"),Ro=(a,l)=>{typeof window<"u"&&window[Lo]||(window[Lo]=!0,window.addEventListener("error",p=>{!Da(p)&&$a(p)&&zt({checkoutSessionId:a,analytics:l,error:p.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",p=>{let b=p.reason||Error("Unhandled promise rejection");Va(b)&&zt({checkoutSessionId:a,analytics:l,error:b,reporter:"unhandledrejection"})}))},Da=a=>a.message==="Script error."||!a.filename||a.lineno===0,$a=a=>{let l=a.filename;return!!(l&&Lr(l))&&!!new h(a.error).isReported||!1},Va=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=h.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Lr(a.fileName))||Ha(l.stack).some(Lr))}return!1},Lr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ha=a=>{if(!a)return[];let l=a.split(`
|
|
2
|
-
`),p=[],b=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let E=A.match(b);if(E&&E[1])p.push(E[1]);else{let y=/@(.*?):\d+:\d+$/,M=A.match(y);M&&M[1]&&p.push(M[1])}}return p};function Oo(a,l,p){return document.querySelector(`${a}[${l}^="${p}"]`)}async function Do(a,l,p,b,A,E){let{analytics:y,name:M=l,retryConfig:k}=E;await vo(()=>new Promise((_,L)=>{let H=Oo(a,p,l)||function(U,oe){let ie=document.createElement(U);return Object.entries(oe).forEach(([te,et])=>ie.setAttribute(te,et)),ie}(a,{...b,[p]:l});H.onload=()=>{y?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),_()},H.onerror=()=>{H.remove(),L(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),k,_=>y?.messageEvent({..._,url:l}))}async function $o(a){return o||(o=Promise.all([function(l,p={}){return Oo("script","src",l)&&window.__Primer?(p.analytics?.sdkFunctionEvent({name:p.name??l,params:["Script already loaded"]}),Promise.resolve()):Do("script",l,"src",{...p.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",p)}("https://sdk.primer.io/web/v2.53.2/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,p={}){return Array.from(document.styleSheets).some(b=>b.href===l)?(p.analytics?.sdkFunctionEvent({name:p.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):Do("link",l,"href",{...p.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",p)}("https://sdk.primer.io/web/v2.53.2/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw o=void 0,l}))}let Ya=async()=>{let a=kr();try{let l=Je(a);try{Ro(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:Q.preloadPrimer}),await $o(l),l.timerEnd({id:Q.preloadPrimer})}catch(p){let b=h.from(p);throw b.isReported||(zt({checkoutSessionId:a,analytics:l,error:b,reporter:"preloadPrimer level 1"}),b.markAsReported()),b}}catch(l){let p=h.from(l);throw p.isReported||(Nr(a,p,"preloadPrimer level 0"),p.markAsReported()),p}},Ua=Rr("createHeadless"),za=Rr("showUniversalCheckout"),Ba=Rr("showVaultManager");function Rr(a){return async(...[l,p,...b])=>{var A;(A=p?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${c}'.`),x=A??c;let E=kr();try{let y=Je(E);try{Ro(E,y),y.sdkFunctionEvent({name:a,params:[l,p,...b]}),y.timerStart({id:Q[a]});let[M,k]=await Promise.all([Oa(l,E,p?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),$o(y)]);return k[a](M,E,l,p,...b)}catch(M){let k=h.from(M);throw k.isReported||(zt({checkoutSessionId:E,analytics:y,error:k,reporter:"lazyLoad level 1"}),k.markAsReported()),k}}catch(y){let M=h.from(y);throw M.isReported||(Nr(E,M,"lazyLoad level 0"),M.markAsReported()),M}}}var Fa=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),Ka=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),ja=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let yt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},bt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},Ga={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};yt.PAYPAL_VAULTED,bt.PAYPAL,yt.KLARNA_CUSTOMER_TOKEN,bt.KLARNA,yt.AUTOMATED_CLEARING_HOUSE,bt.STRIPE_ACH,yt.CARD,bt.PAYMENT_CARD;var qa=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function Bt(a,l,p){return l in a?Object.defineProperty(a,l,{value:p,enumerable:!0,configurable:!0,writable:!0}):a[l]=p,a}class Or extends h{static fromErrorCode(l,p){return new Or(l,p)}constructor(l,p){super(p.message),Bt(this,"code",void 0),Bt(this,"diagnosticsId",void 0),Bt(this,"data",void 0),Bt(this,"isFromDeveloper",void 0),this.code=l,this.diagnosticsId=p.diagnosticsId??null,this.data=p.data,this.isFromDeveloper=p.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Or)}}var Wa=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let Za=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var Xa=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),Ja=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let Qa={SDK_VERSION:"v2.53.2",createHeadless:Ua,showUniversalCheckout:za,showVaultManager:Ba,preloadPrimer:Ya};return i})())});var Ft=typeof window<"u"&&typeof window.document<"u";function rn(o){return document.querySelector(`#${o}`)}function on(o,t){let e=document.createElement("style");return e.textContent=o,e.id=t,e}function xt(o,t,e=!0){if(!Ft||rn(t))return;let i=on(o,t);e&&document.head.firstChild?document.head.insertBefore(i,document.head.firstChild):document.head.appendChild(i)}var zo=`
|
|
1
|
+
import{a as Uo,b as on,c as Dr,d as n}from"./chunks/chunk.G45OCYEN.js";var Ar=on((Vt,po)=>{(function(o,t){typeof Vt=="object"&&typeof po=="object"?po.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Vt=="object"?Vt.Primer=t():o.Primer=t()})(Vt,()=>(()=>{"use strict";let o;var t,e,r={};r.d=(a,l)=>{for(var c in l)r.o(l,c)&&!r.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},r.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};r.r(i),r.d(i,{SuccessScreenType:()=>Xa,PaymentFlow:()=>Ga,ThreeDSecureStatus:()=>qa,TokenType:()=>Wa,isStripeOptionsDropInWithFullMandateText:()=>Ja,PaymentInstrumentType:()=>yt,ErrorCode:()=>Za,EventTypes:()=>Qa,CheckoutUXFlow:()=>ja,HeadlessManagerType:()=>en,PaymentMethodType:()=>bt,Primer:()=>tn});let s={LEGACY:"legacy",V_2_4:"2.4"},p=s.V_2_4,x=p;class h extends Error{static from(l,c=!1){if(l instanceof h)return l;let b=new h(l instanceof Error?l.message:String(l),c);return l instanceof Error&&l.stack&&(b.stack=l.stack,Object.assign(b,l)),b}markAsReported(){this.isReported=!0}constructor(l,c=!1){super(l),function(b,A,E){A in b?Object.defineProperty(b,A,{value:E,enumerable:!0,configurable:!0,writable:!0}):b[A]=E}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let O="https://analytics.production.data.primer.io/sdk-logs";var z=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),D=function(a){return a.START="START",a.END="END",a}({});let Q={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var B=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function Xe(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let ga={get(a,l){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.3";break;case"PRIMER_ASSETS_URL":c=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":c=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return c||l}}.get("PRIMER_SDK_VERSION");async function uo(a,l,c){return{...c,createdAt:Date.now(),device:await Xe(),eventType:a,properties:l,sdkVersion:ga,sdkType:"WEB"}}let ho=Symbol.for("__primerAnalytics__"),gt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[ho];a?gt=a:window[ho]=gt}let go=()=>gt.providers,Sr=()=>gt.timers,ft=()=>gt.eventsQueue,Yt=new Map;function _r(a,l=!1,c=1){Yt.has(a)&&(clearTimeout(Yt.get(a)),Yt.delete(a));let b=()=>{let E=ft().get(a);if(E?.length){let y=!0,M=[],I=0,S=0;for(;S<E.length;){let R=E[S],H=new Blob([JSON.stringify(R)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",R),S++;continue}if(I+H>64e3&&M.length>0){try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(U){y=!1,console.error("Unable to send events",U)}if(!y)break;M=[],I=0}M.push(R),I+=H,S++}if(M.length>0&&y)try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(R){y=!1,console.error("Unable to send events",R)}y?ft().delete(a):c<5?setTimeout(()=>_r(a,l,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void b();let A=setTimeout(b,500);Yt.set(a,A)}let fo=!1;function Pr({url:a=O,...l}){typeof document>"u"||fo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=Je(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),_r(A.url,!0)}}),fo=!0);let c=A=>async E=>{if(typeof navigator>"u")return;let y=function I(S,R,H=new WeakSet,U=0,oe=10){if(U>oe||H.has(S))return S;H.add(S);let ie=te=>typeof te=="object"&&te!==null?I(te,R,H,U+1,oe):R(te);return Array.isArray(S)?S.map(ie):Object.fromEntries(Object.entries(S).map(([te,et])=>[te,ie(et)]))}(await uo(A,E,l),I=>{var S;return typeof(S=typeof I=="function"?I.name||"function":I)=="string"&&S.length>5120?`${S.slice(0,5120)}...`:S});ft().has(a)||ft().set(a,[]),ft().get(a)?.push(y),_r(a)},b={crashEvent:c(B.CRASH_EVENT),messageEvent:c(B.MESSAGE_EVENT),networkCallEvent:c(B.NETWORK_CALL_EVENT),sdkFunctionEvent:c(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return Sr().set(y,{start:M}),c(B.TIMER_EVENT)({...E,id:A,timerType:D.START})},timerEnd:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,{start:M}=Sr().get(y)??{};Sr().delete(y);let I=performance?.now?performance.now():Date.now();return c(B.TIMER_EVENT)({...E,id:A,timerType:D.END,duration:M?I-M:void 0})},v1Event:c(B.V1_EVENT),url:a};return go().set(l.checkoutSessionId,b),Je(l.checkoutSessionId)}function Je(a){return new Proxy({},{get:(l,c)=>(go().get(a)??Pr({checkoutSessionId:a}))[c]})}let Tr=(a,l,c,b)=>({callType:c?z.REQUEST_END:z.REQUEST_START,id:a,errorBody:c?.error&&JSON.stringify(c.error,Object.getOwnPropertyNames(c.error)),method:l.method,responseCode:c?.status,url:l.url,duration:b});function fa(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function vo(a,l,c,b=fa){let A=0,E={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!E.enabled)return a();for(;;)try{let y=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof y=="object"&&y&&"status"in y&&(M+=` Status code: ${y.status}`),c?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return y}catch(y){let M=A>=E.maxRetries,I=y.isNetworkError&&!E.retryNetworkErrors,S=y.status&&y.status>=500&&!E.retry500Errors;if(M||I||S){let U=`Failed after ${A} retries. `;throw M?U+=`Reached maximum retries (${E.maxRetries}).`:I?U+="Network error encountered and retryNetworkErrors is disabled.":S&&(U+="HTTP 500 error encountered and retry500Errors is disabled."),U+=` Last error: ${y.message}`,c?.({messageType:"RETRY_FAILED",message:U,severity:"ERROR",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),Error(U,{cause:y})}A++;let R=Math.min(E.initialBackoff*Math.pow(2,A-1)+Math.random()*E.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";y.isNetworkError?H="Network error":y.status&&(H=`HTTP ${y.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${A}/${E.maxRetries} due to: ${H}. Error details: ${y.message}. Waiting for ${R.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),await b(R)}}let wr={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=wr),wr=window.__primerCache__);let ee=()=>wr.cache;function yo(){if(ee().size<=30)return;let a=Date.now();for(let[l,c]of ee())c.exp<a&&ee().delete(l);if(ee().size>50)for(let[l]of ee()){if(ee().size<=50)break;ee().delete(l)}}let kr=()=>bo.randomUUID?.()||va(),va=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^ya()>>a/4).toString(16)),ya=()=>(bo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,bo=typeof crypto<"u"?crypto:{},ba=(a,l,c)=>Ea(a,"get",l,c),Ea=async(a,l,c,b,A)=>{let E=kr(),y=performance?.now(),M=Je(a),I={method:l,url:c,body:A};M.networkCallEvent(Tr(E,I));try{let S=await fetch(c,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":E,...b}});if(!S.ok){let U=Error(`HTTP error! status: ${S.status}`);throw U.status=S.status,U}let R=await S.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:U,clientSession:{clientSessionId:oe,customer:ie}}=R;M=Pr({checkoutSessionId:a,clientSessionId:oe,customerId:ie?.customerId,primerAccountId:U,url:M.url})}let H=performance?.now();return M.networkCallEvent(Tr(E,I,{data:R},H-y)),{data:R,headers:S.headers,status:S.status,source:"NETWORK"}}catch(S){let R=performance?.now();throw Object.assign(S,{isNetworkError:S instanceof TypeError}),M.networkCallEvent(Tr(E,I,{error:S},R-y)),S}},xa=(a,l)=>new Promise((c,b)=>{let A=setTimeout(()=>{let E=Error("Request timed out");E.isNetworkError=!0,b(E)},l);a.then(c).catch(b).finally(()=>clearTimeout(A))}),Ca=(a,l)=>{let{headers:c,retryConfig:b,cacheConfig:A,timeout:E=15e3,checkoutSessionId:y}=l,M=Je(y);return function(I){if(!I)return oe=>oe();let{key:S,refresh:R=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:U=36e5}=I;return async oe=>{let ie=Date.now(),te=ee().get(S);if(!R&&te&&te.exp>ie)return te.promise;te&&ee().delete(S);let et=oe().then(Et=>{let Vo=U;return H&&(Vo=1e3*(Number(Et.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ho,ttl:Yo=36e5},rn){Yo?ee().set(Ho,{promise:Promise.resolve({...rn,source:"CACHE"}),exp:Date.now()+Yo}):ee().delete(Ho)}({key:S,ttl:Vo},Et),yo(),Et},Et=>{throw ee().delete(S),Et});return ee().set(S,{promise:et,exp:ie+U}),yo(),et}}(A)(()=>vo(()=>xa(ba(y,a,c),E),b,I=>M.messageEvent({...I,url:a})))},Qe=typeof Buffer=="function",Eo=typeof TextDecoder=="function"?new TextDecoder:void 0,xo=typeof TextEncoder=="function"?new TextEncoder:void 0,vt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ut=(a=>{let l={};return a.forEach((c,b)=>l[c]=b),l})(vt),Aa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,F=String.fromCharCode.bind(String),Co=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),Ao=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Mo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),So=typeof btoa=="function"?a=>btoa(a):Qe?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,c,b,A,E="",y=a.length%3;for(let M=0;M<a.length;){if((c=a.charCodeAt(M++))>255||(b=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");E+=vt[(l=c<<16|b<<8|A)>>18&63]+vt[l>>12&63]+vt[l>>6&63]+vt[63&l]}return y?E.slice(0,y-3)+"===".substring(y):E},Ir=Qe?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let c=0,b=a.length;c<b;c+=4096)l.push(F.apply(null,a.subarray(c,c+4096)));return So(l.join(""))},qn=(a,l=!1)=>l?Ao(Ir(a)):Ir(a),Ma=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?F(192|l>>>6)+F(128|63&l):F(224|l>>>12&15)+F(128|l>>>6&63)+F(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return F(240|l>>>18&7)+F(128|l>>>12&63)+F(128|l>>>6&63)+F(128|63&l)},Sa=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_a=a=>a.replace(Sa,Ma),_o=Qe?a=>Buffer.from(a,"utf8").toString("base64"):xo?a=>Ir(xo.encode(a)):a=>So(_a(a)),Pa=(a,l=!1)=>l?Ao(_o(a)):_o(a),Ta=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,wa=a=>{switch(a.length){case 4:var l=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return F((l>>>10)+55296)+F((1023&l)+56320);case 3:return F((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return F((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},ka=a=>a.replace(Ta,wa),Po=typeof atob=="function"?a=>atob(Mo(a)):Qe?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Aa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,c="",b,A;for(let E=0;E<a.length;)l=Ut[a.charAt(E++)]<<18|Ut[a.charAt(E++)]<<12|(b=Ut[a.charAt(E++)])<<6|(A=Ut[a.charAt(E++)]),c+=b===64?F(l>>16&255):A===64?F(l>>16&255,l>>8&255):F(l>>16&255,l>>8&255,255&l);return c},To=Qe?a=>Co(Buffer.from(a,"base64")):a=>Co(Po(a).split("").map(l=>l.charCodeAt(0))),Wn=a=>To(wo(a)),Ia=Qe?a=>Buffer.from(a,"base64").toString("utf8"):Eo?a=>Eo.decode(To(a)):a=>ka(Po(a)),wo=a=>Mo(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),La=a=>Ia(wo(a)),Zn=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),ko={encode:Pa,decode:La},Na={encode:function(a,l={}){let{urlSafe:c=!1}=l;return ko.encode(a,c)},decode:ko.decode},Io="The provided `clientToken`",Ra=`${Io} has expired`,Oa=`${Io} is malformed`,Da=(a,l,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.3","primer-sdk-checkout-session-id":l,...c&&{"x-api-version":c}});async function $a(a,l,c){let{accessToken:b,configurationUrl:A,analyticsUrlV2:E}=function(S){let R=function(U){try{let[oe,ie]=U.split(".");return JSON.parse(Na.decode(ie||oe))}catch{throw Error(Oa)}}(S),H=1e3*R.exp;if(Date.now()>H)throw Error(`${Ra}. Expiration date: ${new Date(H).toISOString()}`);return R}(a),y=Pr({checkoutSessionId:l,url:E}),M=x,I=M!==s.LEGACY?M:"2.3";y.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:S,source:R}=await Ca(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:Da(b,l,I),retryConfig:{enabled:!0},cacheConfig:c});return y.timerEnd({id:"CONFIGURATION_LOADING",context:{source:R}}),S}catch(S){let R=S instanceof Error?S.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${R}`)}}function Lo(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function zt({checkoutSessionId:a,analytics:l,error:c,reporter:b}){l?.crashEvent?l.crashEvent({...Lo(c),reporter:b}):a&&Lr(a,c,b)}async function Lr(a,l,c){let b=await uo(B.CRASH_EVENT,{...Lo(l),reporter:c},{checkoutSessionId:a});try{await fetch(O,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch(A){console.error("Failed to post crash event",A)}}let No=Symbol.for("initGlobalErrorMonitoringLoaded"),Ro=(a,l)=>{typeof window<"u"&&window[No]||(window[No]=!0,window.addEventListener("error",c=>{!Va(c)&&Ha(c)&&zt({checkoutSessionId:a,analytics:l,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let b=c.reason||Error("Unhandled promise rejection");Ya(b)&&zt({checkoutSessionId:a,analytics:l,error:b,reporter:"unhandledrejection"})}))},Va=a=>a.message==="Script error."||!a.filename||a.lineno===0,Ha=a=>{let l=a.filename;return!!(l&&Nr(l))&&!!new h(a.error).isReported||!1},Ya=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=h.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Nr(a.fileName))||Ua(l.stack).some(Nr))}return!1},Nr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ua=a=>{if(!a)return[];let l=a.split(`
|
|
2
|
+
`),c=[],b=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let E=A.match(b);if(E&&E[1])c.push(E[1]);else{let y=/@(.*?):\d+:\d+$/,M=A.match(y);M&&M[1]&&c.push(M[1])}}return c};function Oo(a,l,c){return document.querySelector(`${a}[${l}^="${c}"]`)}async function Do(a,l,c,b,A,E){let{analytics:y,name:M=l,retryConfig:I}=E;await vo(()=>new Promise((S,R)=>{let H=Oo(a,c,l)||function(U,oe){let ie=document.createElement(U);return Object.entries(oe).forEach(([te,et])=>ie.setAttribute(te,et)),ie}(a,{...b,[c]:l});H.onload=()=>{y?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),S()},H.onerror=()=>{H.remove(),R(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),I,S=>y?.messageEvent({...S,url:l}))}async function $o(a){return o||(o=Promise.all([function(l,c={}){return Oo("script","src",l)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Script already loaded"]}),Promise.resolve()):Do("script",l,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.3/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,c={}){return Array.from(document.styleSheets).some(b=>b.href===l)?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):Do("link",l,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.3/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw o=void 0,l}))}let za=async()=>{let a=kr();try{let l=Je(a);try{Ro(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:Q.preloadPrimer}),await $o(l),l.timerEnd({id:Q.preloadPrimer})}catch(c){let b=h.from(c);throw b.isReported||(zt({checkoutSessionId:a,analytics:l,error:b,reporter:"preloadPrimer level 1"}),b.markAsReported()),b}}catch(l){let c=h.from(l);throw c.isReported||(Lr(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},Ba=Rr("createHeadless"),Fa=Rr("showUniversalCheckout"),Ka=Rr("showVaultManager");function Rr(a){return async(...[l,c,...b])=>{var A;(A=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${p}'.`),x=A??p;let E=kr();try{let y=Je(E);try{Ro(E,y),y.sdkFunctionEvent({name:a,params:[l,c,...b]}),y.timerStart({id:Q[a]});let[M,I]=await Promise.all([$a(l,E,c?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),$o(y)]);return I[a](M,E,l,c,...b)}catch(M){let I=h.from(M);throw I.isReported||(zt({checkoutSessionId:E,analytics:y,error:I,reporter:"lazyLoad level 1"}),I.markAsReported()),I}}catch(y){let M=h.from(y);throw M.isReported||(Lr(E,M,"lazyLoad level 0"),M.markAsReported()),M}}}var ja=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),Ga=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),qa=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let yt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},bt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},Wa={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};yt.PAYPAL_VAULTED,bt.PAYPAL,yt.KLARNA_CUSTOMER_TOKEN,bt.KLARNA,yt.AUTOMATED_CLEARING_HOUSE,bt.STRIPE_ACH,yt.CARD,bt.PAYMENT_CARD;var Za=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function Bt(a,l,c){return l in a?Object.defineProperty(a,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[l]=c,a}class Or extends h{static fromErrorCode(l,c){return new Or(l,c)}constructor(l,c){super(c.message),Bt(this,"code",void 0),Bt(this,"diagnosticsId",void 0),Bt(this,"data",void 0),Bt(this,"isFromDeveloper",void 0),this.code=l,this.diagnosticsId=c.diagnosticsId??null,this.data=c.data,this.isFromDeveloper=c.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Or)}}var Xa=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let Ja=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var Qa=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),en=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let tn={SDK_VERSION:"v2.53.3",createHeadless:Ba,showUniversalCheckout:Fa,showVaultManager:Ka,preloadPrimer:za};return i})())});var Ft=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,i=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:i,selectableCardNetworks:s,isLoading:!1})}};var tt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var _e=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var rt=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,p)=>{this.unsubscribe&&(this.unsubscribe!==p&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,p)),this.unsubscribe=p},this.host=t,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new _e(this.context,this.host,this.t,this.subscribe))}};var Kt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var $r=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},K=class extends Kt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[p,{consumerHost:x}]of this.subscriptions)s.has(p)||(s.add(p),x.dispatchEvent(new _e(this.context,x,p,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $r(this.context,this.host))}};function C({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new rt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new rt(i,{context:o,callback:s=>{i[r]=s},subscribe:t})})}}var jt="cardNetworksContext";var ot="clientOptionsContext";var Pe="computedStylesContext";var q="headlessInstanceContext";var Gt="klarnaCategoriesContext";var ue="managerContext";var it="paymentMethodsContext";var j="sdkStateContext";var W="vaultManagerContext";var Te="vaultManagerCvvContext";var T=class T{static log(t,...e){T.enabled&&console.log(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.log,...e)}static info(t,...e){T.enabled&&console.info(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.info,...e)}static warn(t,...e){T.enabled&&console.warn(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.warn,...e)}static error(t,...e){T.enabled&&console.error(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.error,...e)}static debug(t,...e){T.enabled&&console.debug(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.debug,...e)}static table(t,e){T.enabled&&console.table(t,e)}static time(t){T.enabled&&console.time(`${T.brandTag} ${t}`)}static timeEnd(t){T.enabled&&console.timeEnd(`${T.brandTag} ${t}`)}};T.enabled=!0,T.defaultFont="font-family: Consolas, monospace; font-size: 12px;",T.brandTag="[PRIMER]",T.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+T.defaultFont,T.styles={log:"color: #4CAF50; "+T.defaultFont,info:"color: #2196F3; "+T.defaultFont,warn:"color: #FF9800; "+T.defaultFont,error:"color: #F44336; "+T.defaultFont,debug:"color: #9C27B0; "+T.defaultFont};var w=T;var qt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Wt=class{constructor(t){(this.host=t).addController(this),this._state=qt}hostConnected(){}reducer(t,e){switch(e.type){case"START_LOADING":return{...t,isLoading:!0};case"START_PROCESSING":return{...t,failure:null,isProcessing:!0};case"STOP_PROCESSING":return{...t,isProcessing:!1};case"COMPLETE_PROCESSING":return{...t,isProcessing:!1,isSuccessful:!0};case"SET_ERROR":return w.error(e.payload.message),{...t,isProcessing:!1,error:e.payload};case"SET_FAILURE":return{...t,isProcessing:!1,failure:e.payload};case"COMPLETE_LOADING":return{...t,isLoading:!1};case"RESET":return qt;default:return t}}dispatch(t){let e=this.reducer(this._state,t);this._state=e,this.host.sdkContextController.setSdkState(e),this.host.primerEventsController.dispatchSdkState(e)}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}forceCompleteLoading(){this._state.isLoading&&(w.warn("Force completing loading state"),this.completeLoading())}get state(){return this._state}};var Zt=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new K(t,{context:j,initialValue:qt}),this.paymentMethodsProvider=new K(t,{context:it,initialValue:null}),this.paymentManagerProvider=new K(t,{context:ue,initialValue:new Map}),this.cardNetworksContext=new K(t,{context:jt,initialValue:null}),this.vaultManagerProvider=new K(t,{context:W,initialValue:null}),this.vaultManagerCvvProvider=new K(t,{context:Te,initialValue:null}),this.clientOptionsContext=new K(t,{context:ot,initialValue:null}),this.klarnaCategoriesProvider=new K(t,{context:Gt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new K(t,{context:q,initialValue:null}),this.computedStylesProvider=new K(t,{context:Pe,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var ze=class ze{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){w.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||w.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=ze.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,i)=>"-"+i.toLowerCase()),ze.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let i=t[r];if(!i)continue;if(!this.isValidCssProperty(r)){w.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(i))continue;let s=this.getCssVarName(r);e.push([s,i])}if(e.length>0)for(let[r,i]of e)this.host.style.setProperty(r,i)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of ze.cssVarCache.keys()){let e=ze.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};ze.cssVarCache=new Map;var Xt=ze;var Jt=globalThis,Qt=Jt.ShadowRoot&&(Jt.ShadyCSS===void 0||Jt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vr=Symbol(),zo=new WeakMap,xt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Vr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Qt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=zo.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&zo.set(e,t))}return t}toString(){return this.cssText}},Bo=o=>new xt(typeof o=="string"?o:o+"",void 0,Vr),g=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,s)=>r+(p=>{if(p._$cssResult$===!0)return p.cssText;if(typeof p=="number")return p;throw Error("Value passed to 'css' function must be a 'css' function result: "+p+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new xt(e,o,Vr)},Hr=(o,t)=>{if(Qt)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Jt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},er=Qt?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Bo(e)})(o):o;var{is:an,defineProperty:nn,getOwnPropertyDescriptor:sn,getOwnPropertyNames:ln,getOwnPropertySymbols:dn,getPrototypeOf:cn}=Object,we=globalThis,Fo=we.trustedTypes,pn=Fo?Fo.emptyScript:"",mn=we.reactiveElementPolyfillSupport,Ct=(o,t)=>o,At={toAttribute(o,t){switch(t){case Boolean:o=o?pn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},at=(o,t)=>!an(o,t),Ko={attribute:!0,type:String,converter:At,reflect:!1,hasChanged:at};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),we.litPropertyMetadata??(we.litPropertyMetadata=new WeakMap);var ve=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ko){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&nn(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:s}=sn(this.prototype,t)??{get(){return this[e]},set(p){this[e]=p}};return{get(){return i?.call(this)},set(p){let x=i?.call(this);s.call(this,p),this.requestUpdate(t,x,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ko}static _$Ei(){if(this.hasOwnProperty(Ct("elementProperties")))return;let t=cn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ct("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ct("properties"))){let e=this.properties,r=[...ln(e),...dn(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(er(i))}else t!==void 0&&e.push(er(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:At).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let s=r.getPropertyOptions(i),p=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:At;this._$Em=i,this[i]=p.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??at)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,s]of r)s.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],s)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};ve.elementStyles=[],ve.shadowRootOptions={mode:"open"},ve[Ct("elementProperties")]=new Map,ve[Ct("finalized")]=new Map,mn?.({ReactiveElement:ve}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var ke={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},N=Symbol(),V=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??jo,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(p){s=!0,r=p}if(this.p===i){if(e===N)this.i=0;else{if(s===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},jo=(o,t)=>o===t||o.length===t.length&&o.every((e,r)=>!at(e,t[r]));var Mt={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},tr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function Yr(o,t,e){switch(t.type){case"SET_LOADING":return{...o,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...o,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...o,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return w.error("VaultManagerController",t.payload.message),{...o,isLoading:!1};case"DISABLE":return{...Mt,enabled:!1};case"RESET":return Mt;default:return o}}function Ur(o,t,e){switch(t.type){case"INITIALIZE_CVV":return{...o,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...o,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...o,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...o,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return tr;default:return o}}var St=class{constructor(t){this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0}),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(e){throw this.dispatchVaultManager({type:"SET_ERROR",payload:e instanceof Error?e:new Error("Failed to delete payment method")}),e}};this.setCvvInput=t=>{this.dispatchVaultItem({type:"SET_CVV_INPUT",payload:t})};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this._vaultItemState.selectedVaultedPaymentMethod,e=this._vaultManagerState.cvvRecapture,r=this._vaultItemState.cvvInput;if(!t||e&&(!r||r.metadata.error)){this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!0});return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,e?{cvv:r.valueToken}:void 0)}catch(i){w.error("VaultManagerController: Error starting vaulted payment flow",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Failed to start vaulted payment flow")}),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.dispatchVaultItem({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t}),this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!1})};(this.host=t).addController(this),this._vaultManagerState=Mt,this._vaultItemState=tr,new V(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),N;this.dispatchVaultManager({type:"SET_LOADING",payload:!0});try{this.dispatchVaultManager({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:r.vaultEnabled,cvvRecapture:!!r.captureVaultedCardCvv}),this.dispatchVaultItem({type:"INITIALIZE_CVV",createCvvInput:e.createCvvInput}),await this.fetchVaultedPaymentMethods(),w.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(i){w.error("VaultManagerController: Failed to initialize vault",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Unknown error")})}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,e){this.vaultManager=t,this.options=e??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}hostDisconnected(){this.vaultManager=null,this.dispatchVaultManager({type:"RESET"})}dispatchVaultManager(t){let e={deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod,startVaultedPaymentFlow:this.startVaultedPaymentFlow,createCvvInput:this.vaultManager?.createCvvInput},r=Yr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Ur(this._vaultItemState,t,e);this._vaultItemState=r,this.host.sdkContextController.setVaultManagerCvv(r)}async fetchVaultedPaymentMethods(){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0});let t=await this._vaultManager.fetchVaultedPaymentMethods();return w.log("VaultManagerController: Fetched payment methods",t),this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:t,isLoading:!1}),t}catch(t){throw this.dispatchVaultManager({type:"SET_ERROR",payload:t instanceof Error?t:new Error("Failed to fetch payment methods")}),t}}};var _t="lit-localize-status";var Go=o=>typeof o!="string"&&"strTag"in o,rr=(o,t,e)=>{let r=o[0];for(let i=1;i<o.length;i++)r+=t[e?e[i-1]:i-1],r+=o[i];return r};var Pt=o=>Go(o)?rr(o.strings,o.values):o;var P=Pt,qo=!1;function zr(o){if(qo)throw new Error("lit-localize can only be configured once");P=o,qo=!0}var Br=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(_t,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(_t,this.__litLocalizeEventHandler)}},un=o=>o.addController(new Br(o)),Wo=un;var L=()=>(o,t)=>(o.addInitializer(Wo),o);var Tt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var ye=[];for(let o=0;o<256;o++)ye[o]=(o>>4&15).toString(16)+(o&15).toString(16);function Zo(o){let t=0,e=8997,r=0,i=33826,s=0,p=40164,x=0,h=52210;for(let O=0;O<o.length;O++)e^=o.charCodeAt(O),t=e*435,r=i*435,s=p*435,x=h*435,s+=e<<8,x+=i<<8,r+=t>>>16,e=t&65535,s+=r>>>16,i=r&65535,h=x+(s>>>16)&65535,p=s&65535;return ye[h>>8]+ye[h&255]+ye[p>>8]+ye[p&255]+ye[i>>8]+ye[i&255]+ye[e>>8]+ye[e&255]}var hn="",gn="h",fn="s";function Xo(o,t){return(t?gn:fn)+Zo(typeof o=="string"?o:o.join(hn))}var Jo=new WeakMap,Qo=new Map;function ei(o,t,e){if(o){let r=e?.id??vn(t),i=o[r];if(i){if(typeof i=="string")return i;if("strTag"in i)return rr(i.strings,t.values,i.values);{let s=Jo.get(i);return s===void 0&&(s=i.values,Jo.set(i,s)),{...i,values:s.map(p=>t.values[p])}}}}return Pt(t)}function vn(o){let t=typeof o=="string"?o:o.strings,e=Qo.get(t);return e===void 0&&(e=Xo(t,typeof o!="string"&&!("strTag"in o)),Qo.set(t,e)),e}function Fr(o){window.dispatchEvent(new CustomEvent(_t,{detail:o}))}var ir="",Kr,ti,ar,jr,ri,Be=new Tt;Be.resolve();var or=0,oi=o=>(zr((t,e)=>ei(ri,t,e)),ir=ti=o.sourceLocale,ar=new Set(o.targetLocales),ar.add(o.sourceLocale),jr=o.loadLocale,{getLocale:yn,setLocale:bn}),yn=()=>ir,bn=o=>{if(o===(Kr??ir))return Be.promise;if(!ar||!jr)throw new Error("Internal error");if(!ar.has(o))throw new Error("Invalid locale code");or++;let t=or;return Kr=o,Be.settled&&(Be=new Tt),Fr({status:"loading",loadingLocale:o}),(o===ti?Promise.resolve({templates:void 0}):jr(o)).then(r=>{or===t&&(ir=o,Kr=void 0,ri=r.templates,Fr({status:"ready",readyLocale:o}),Be.resolve())},r=>{or===t&&(Fr({status:"error",errorLocale:o,errorMessage:r.toString()}),Be.reject(r))}),Be.promise};var Gr="en",qr=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],ii="You must call `loadLocale` first to set up the localized template.",ai,nr,ni=o=>{let t=oi({sourceLocale:Gr,targetLocales:qr,loadLocale:o});ai=t.getLocale,nr=t.setLocale};var Wr=o=>{ni(o)},Zr=o=>{if(!nr)throw new Error(ii);return nr(o)};var wt=new Set(qr);wt.add(Gr);var Xr=o=>{if(typeof o!="string")return!1;if(o==="en")return!0;let t=o.replace("_","-");if(wt.has(t))return!0;let e=t.split("-")[0];return!!wt.has(e)},Jr=o=>{if(o==="en")return"en-GB";let t=o.replace("_","-");if(wt.has(t))return t;let e=t.split("-")[0];return wt.has(e)?e:"en-GB"};var It=globalThis,sr=It.trustedTypes,si=sr?sr.createPolicy("lit-html",{createHTML:o=>o}):void 0,eo="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,to="?"+be,En=`<${to}>`,je=document,Lt=()=>je.createComment(""),Nt=o=>o===null||typeof o!="object"&&typeof o!="function",ro=Array.isArray,ui=o=>ro(o)||typeof o?.[Symbol.iterator]=="function",Qr=`[
|
|
3
|
+
\f\r]`,kt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,li=/-->/g,di=/>/g,Fe=RegExp(`>|${Qr}(?:([^\\s"'>=/]+)(${Qr}*=${Qr}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ci=/'/g,pi=/"/g,hi=/^(?:script|style|textarea|title)$/i,oo=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),m=oo(1),Ie=oo(2),Ad=oo(3),Ee=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),mi=new WeakMap,Ke=je.createTreeWalker(je,129);function gi(o,t){if(!ro(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return si!==void 0?si.createHTML(t):t}var fi=(o,t)=>{let e=o.length-1,r=[],i,s=t===2?"<svg>":t===3?"<math>":"",p=kt;for(let x=0;x<e;x++){let h=o[x],O,z,D=-1,Q=0;for(;Q<h.length&&(p.lastIndex=Q,z=p.exec(h),z!==null);)Q=p.lastIndex,p===kt?z[1]==="!--"?p=li:z[1]!==void 0?p=di:z[2]!==void 0?(hi.test(z[2])&&(i=RegExp("</"+z[2],"g")),p=Fe):z[3]!==void 0&&(p=Fe):p===Fe?z[0]===">"?(p=i??kt,D=-1):z[1]===void 0?D=-2:(D=p.lastIndex-z[2].length,O=z[1],p=z[3]===void 0?Fe:z[3]==='"'?pi:ci):p===pi||p===ci?p=Fe:p===li||p===di?p=kt:(p=Fe,i=void 0);let B=p===Fe&&o[x+1].startsWith("/>")?" ":"";s+=p===kt?h+En:D>=0?(r.push(O),h.slice(0,D)+eo+h.slice(D)+be+B):h+be+(D===-2?x:B)}return[gi(o,s+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Rt=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,p=0,x=t.length-1,h=this.parts,[O,z]=fi(t,e);if(this.el=o.createElement(O,r),Ke.currentNode=this.el.content,e===2||e===3){let D=this.el.content.firstChild;D.replaceWith(...D.childNodes)}for(;(i=Ke.nextNode())!==null&&h.length<x;){if(i.nodeType===1){if(i.hasAttributes())for(let D of i.getAttributeNames())if(D.endsWith(eo)){let Q=z[p++],B=i.getAttribute(D).split(be),Xe=/([.?@])?(.*)/.exec(Q);h.push({type:1,index:s,name:Xe[2],strings:B,ctor:Xe[1]==="."?dr:Xe[1]==="?"?cr:Xe[1]==="@"?pr:qe}),i.removeAttribute(D)}else D.startsWith(be)&&(h.push({type:6,index:s}),i.removeAttribute(D));if(hi.test(i.tagName)){let D=i.textContent.split(be),Q=D.length-1;if(Q>0){i.textContent=sr?sr.emptyScript:"";for(let B=0;B<Q;B++)i.append(D[B],Lt()),Ke.nextNode(),h.push({type:2,index:++s});i.append(D[Q],Lt())}}}else if(i.nodeType===8)if(i.data===to)h.push({type:2,index:s});else{let D=-1;for(;(D=i.data.indexOf(be,D+1))!==-1;)h.push({type:7,index:s}),D+=be.length-1}s++}}static createElement(t,e){let r=je.createElement("template");return r.innerHTML=t,r}};function Ge(o,t,e=o,r){if(t===Ee)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,s=Nt(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Ge(o,i._$AS(o,t.values),i,r)),t}var lr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??je).importNode(e,!0);Ke.currentNode=i;let s=Ke.nextNode(),p=0,x=0,h=r[0];for(;h!==void 0;){if(p===h.index){let O;h.type===2?O=new nt(s,s.nextSibling,this,t):h.type===1?O=new h.ctor(s,h.name,h.strings,this,t):h.type===6&&(O=new mr(s,this,t)),this._$AV.push(O),h=r[++x]}p!==h?.index&&(s=Ke.nextNode(),p++)}return Ke.currentNode=je,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},nt=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ge(this,t,e),Nt(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==Ee&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ui(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&Nt(this._$AH)?this._$AA.nextSibling.data=t:this.T(je.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Rt.createElement(gi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new lr(i,this),p=s.u(this.options);s.p(e),this.T(p),this._$AH=s}}_$AC(t){let e=mi.get(t.strings);return e===void 0&&mi.set(t.strings,e=new Rt(t)),e}k(t){ro(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let s of t)i===e.length?e.push(r=new o(this.O(Lt()),this.O(Lt()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},qe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,e=this,r,i){let s=this.strings,p=!1;if(s===void 0)t=Ge(this,t,e,0),p=!Nt(t)||t!==this._$AH&&t!==Ee,p&&(this._$AH=t);else{let x=t,h,O;for(t=s[0],h=0;h<s.length-1;h++)O=Ge(this,x[r+h],e,h),O===Ee&&(O=this._$AH[h]),p||(p=!Nt(O)||O!==this._$AH[h]),O===u?t=u:t!==u&&(t+=(O??"")+s[h+1]),this._$AH[h]=O}p&&!i&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},dr=class extends qe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},cr=class extends qe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},pr=class extends qe{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Ge(this,t,e,0)??u)===Ee)return;let r=this._$AH,i=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==u&&(r===u||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},mr=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ge(this,t)}},vi={M:eo,P:be,A:to,C:1,L:fi,R:lr,D:ui,V:Ge,I:nt,H:qe,N:cr,U:pr,B:dr,F:mr},xn=It.litHtmlPolyfillSupport;xn?.(Rt,nt),(It.litHtmlVersions??(It.litHtmlVersions=[])).push("3.2.1");var yi=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let s=e?.renderBefore??null;r._$litPart$=i=new nt(t.insertBefore(Lt(),s),s,void 0,e??{})}return i._$AI(o),i};var f=class extends ve{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=yi(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ee}};f._$litElement$=!0,f.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:f});var Cn=globalThis.litElementPolyfillSupport;Cn?.({LitElement:f});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var v=o=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,t)}):customElements.define(o,t)};var An={attribute:!0,type:String,converter:At,reflect:!1,hasChanged:at},Mn=(o=An,t,e)=>{let{kind:r,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(e.name,o),r==="accessor"){let{name:p}=e;return{set(x){let h=t.get.call(this);t.set.call(this,x),this.requestUpdate(p,h,o)},init(x){return x!==void 0&&this.P(p,void 0,o),x}}}if(r==="setter"){let{name:p}=e;return function(x){let h=this[p];t.call(this,x),this.requestUpdate(p,h,o)}}throw Error("Unsupported decorator location: "+r)};function d(o){return(t,e)=>typeof e=="object"?Mn(o,t,e):((r,i,s)=>{let p=i.hasOwnProperty(s);return i.constructor.createProperty(s,p?{...r,wrapped:!0}:r),p?Object.getOwnPropertyDescriptor(i,s):void 0})(o,t,e)}function k(o){return d({...o,state:!0,attribute:!1})}var We=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Le(o,t){return(e,r,i)=>{let s=p=>p.renderRoot?.querySelector(o)??null;if(t){let{get:p,set:x}=typeof r=="object"?e:i??(()=>{let h=Symbol();return{get(){return this[h]},set(O){this[h]=O}}})();return We(e,r,{get(){let h=p.call(this);return h===void 0&&(h=s(this),(h!==null||this.hasUpdated)&&x.call(this,h)),h}})}return We(e,r,{get(){return s(this)}})}}function $(o,t,e){return o?t(o):e?.(o)}var _=g`
|
|
5
|
+
* {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
`,bi=g`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
isolation: isolate;
|
|
12
|
+
position: relative;
|
|
13
|
+
width: 100%;
|
|
14
|
+
//Keep the CSS loader in the same position - check css-loader-inline.ts
|
|
15
|
+
min-height: 64px;
|
|
16
|
+
}
|
|
17
|
+
`;var Ei="https://sdk.primer.io/web/v2-latest/Primer.min.js";var ur=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var hr=typeof window<"u"&&typeof window.document<"u";function Sn(o){return document.querySelector(`script[src^="${o}"]`)}function _n(o,t){let e=document.createElement("script");return e.setAttribute("src",o),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function xi(o,t=!1){if(!hr)throw new Error("Cannot load script in server environment");let e=Sn(o)??_n(o,t);return new Promise((r,i)=>{e.onload=()=>{r()},e.onerror=()=>{i()},e.parentNode||document.head.appendChild(e)})}var gr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new V(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new V(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.state.isLoading&&(w.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),w.info("SDK instance cleaned up")}catch(t){w.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=Ei){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){w.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await xi(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return w.warn("Component disconnected, aborting SDK initialization"),N;if(!t||!e)return N;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,i=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:p=>{this.isDisconnected||(w.info("Configuration payment methods:",p),this.paymentsList=p)},onCheckoutComplete:({payment:p})=>{this.isDisconnected||(w.info("Payment completed:",p),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(p,x,h)=>{this.isDisconnected||(w.error("Payment failed:",p),this.host.sdkStateController.setFailure(p.code||"UNKNOWN_ERROR",p.message||"Unknown error occurred"),h&&h.showErrorMessage())},onBeforePaymentCreate:(p,x)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),x?.continuePaymentCreation())},onPaymentMethodAction:(p,x)=>{this.isDisconnected||p==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});if(this.createPaymentMethodManager=i.createPaymentMethodManager.bind(i),this.currentSdkInstance=i,await i.start(),this.isDisconnected)return this.cleanupResources(),N;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(i);let s=i.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(i.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),i}catch(r){throw r instanceof Error&&(w.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return N;if(!t||!e.length)return N;let r=new Map,i=new Map;try{for(let p of e){if(this.isDisconnected)break;let x=await this.initializePaymentMethodManager(p)();p&&x&&(r.set(p.type,p),i.set(p.type,x))}if(this.isDisconnected)return N;let s=new ur(r);return this.host.sdkContextController.setPaymentManagers(i),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),w.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let i=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{this.isDisconnected||s==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});return i?{type:e,manager:i}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async p=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(p)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let i=await this.createPaymentMethodManager(e);return i?{type:e,manager:i}:null}catch(i){return w.error(`Failed to initialize manager for ${e}:`,i),null}}}};var Pn=Uo({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});Wr(o=>Pn(`../../localization/lit-localize/locales/${o}.ts`));var ae=class extends f{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.sdkContextController=new Zt(this),this.sdkStateController=new Wt(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Xt(this),this.vaultManagerController=new St(this),this.cardNetworkController=new Ft(this),new gr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,i){e==="customstyles"?this.styleProcessingController.processCustomStyles(i):super.attributeChangedCallback(e,r,i)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.state.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(Xr(this.options?.locale)?this.locale=Jr(this.options?.locale):w.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Zr(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.state.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.state.isLoading&&(w.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.state,r=e.isLoading,i=e.error,s=!r&&!i;return m`
|
|
18
|
+
${$(r,()=>u)}
|
|
19
|
+
${$(i,()=>m`<primer-checkout-error></primer-checkout-error>`)}
|
|
20
|
+
${$(s,()=>m`
|
|
21
|
+
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
22
|
+
${$(this.hasAssignedContent,()=>u,()=>m`<primer-main></primer-main>`)}
|
|
23
|
+
`,()=>u)}
|
|
24
|
+
`}addEventListener(e,r,i){super.addEventListener(e,r,i)}};ae.styles=[_,bi],n([d({type:String,attribute:"custom-styles"})],ae.prototype,"customStyles",2),n([d({type:String,attribute:"client-token"})],ae.prototype,"clientToken",2),n([d({type:Object})],ae.prototype,"options",2),n([d({type:Boolean,reflect:!0,attribute:"js-initialized"})],ae.prototype,"_jsInitialized",2),n([Le("slot")],ae.prototype,"defaultSlot",2),n([k()],ae.prototype,"previousLoadingState",2),ae=n([L(),v("primer-checkout")],ae);function Tn(o){return document.querySelector(`#${o}`)}function wn(o,t){let e=document.createElement("style");return e.textContent=o,e.id=t,e}function Ot(o,t,e=!0){if(!hr||Tn(t))return;let i=wn(o,t);e&&document.head.firstChild?document.head.insertBefore(i,document.head.firstChild):document.head.appendChild(i)}var Ci=`
|
|
3
25
|
@keyframes primer-css-spinner-rotate {
|
|
4
26
|
0% {
|
|
5
27
|
transform: rotate(0deg);
|
|
@@ -35,7 +57,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
35
57
|
animation: primer-css-spinner-rotate 1.2s linear infinite;
|
|
36
58
|
z-index: 9999;
|
|
37
59
|
}
|
|
38
|
-
`;var
|
|
60
|
+
`;var Ai=`/**
|
|
39
61
|
* Do not edit directly, this file was auto-generated.
|
|
40
62
|
*/
|
|
41
63
|
|
|
@@ -143,7 +165,7 @@ primer-checkout {
|
|
|
143
165
|
--primer-color-border-transparent-focus: var(--primer-color-focus);
|
|
144
166
|
--primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
|
|
145
167
|
}
|
|
146
|
-
`,
|
|
168
|
+
`,Mi=`/**
|
|
147
169
|
* Do not edit directly, this file was auto-generated.
|
|
148
170
|
*/
|
|
149
171
|
|
|
@@ -163,29 +185,7 @@ primer-checkout.primer-dark-theme {
|
|
|
163
185
|
--primer-color-blue-500: #3f93e4;
|
|
164
186
|
--primer-color-blue-900: #4aaeff;
|
|
165
187
|
}
|
|
166
|
-
`;var an="primer-light-theme-css",nn="primer-dark-theme-css";function $r(){xt(Bo,an,!0)}function Vr(){xt(Fo,nn,!0)}function Ko(){$r(),Vr()}var Kt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,i=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:i,selectableCardNetworks:s,isLoading:!1})}};var tt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var Se=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var rt=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,c)=>{this.unsubscribe&&(this.unsubscribe!==c&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,c)),this.unsubscribe=c},this.host=t,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Se(this.context,this.host,this.t,this.subscribe))}};var jt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Hr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},K=class extends jt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[c,{consumerHost:x}]of this.subscriptions)s.has(c)||(s.add(c),x.dispatchEvent(new Se(this.context,x,c,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Hr(this.context,this.host))}};function C({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new rt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new rt(i,{context:o,callback:s=>{i[r]=s},subscribe:t})})}}var Gt="cardNetworksContext";var ot="clientOptionsContext";var Pe="computedStylesContext";var q="headlessInstanceContext";var qt="klarnaCategoriesContext";var ue="managerContext";var it="paymentMethodsContext";var j="sdkStateContext";var W="vaultManagerContext";var Te="vaultManagerCvvContext";var T=class T{static log(t,...e){T.enabled&&console.log(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.log,...e)}static info(t,...e){T.enabled&&console.info(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.info,...e)}static warn(t,...e){T.enabled&&console.warn(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.warn,...e)}static error(t,...e){T.enabled&&console.error(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.error,...e)}static debug(t,...e){T.enabled&&console.debug(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.debug,...e)}static table(t,e){T.enabled&&console.table(t,e)}static time(t){T.enabled&&console.time(`${T.brandTag} ${t}`)}static timeEnd(t){T.enabled&&console.timeEnd(`${T.brandTag} ${t}`)}};T.enabled=!0,T.defaultFont="font-family: Consolas, monospace; font-size: 12px;",T.brandTag="[PRIMER]",T.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+T.defaultFont,T.styles={log:"color: #4CAF50; "+T.defaultFont,info:"color: #2196F3; "+T.defaultFont,warn:"color: #FF9800; "+T.defaultFont,error:"color: #F44336; "+T.defaultFont,debug:"color: #9C27B0; "+T.defaultFont};var N=T;var Wt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Zt=class{constructor(t){(this.host=t).addController(this),this._state=Wt}hostConnected(){}reducer(t,e){switch(e.type){case"START_LOADING":return{...t,isLoading:!0};case"START_PROCESSING":return{...t,failure:null,isProcessing:!0};case"STOP_PROCESSING":return{...t,isProcessing:!1};case"COMPLETE_PROCESSING":return{...t,isProcessing:!1,isSuccessful:!0};case"SET_ERROR":return N.error(e.payload.message),{...t,isProcessing:!1,error:e.payload};case"SET_FAILURE":return{...t,isProcessing:!1,failure:e.payload};case"COMPLETE_LOADING":return{...t,isLoading:!1};case"RESET":return Wt;default:return t}}dispatch(t){let e=this.reducer(this._state,t);this._state=e,this.host.sdkContextController.setSdkState(e),this.host.primerEventsController.dispatchSdkState(e)}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}get state(){return this._state}};var Xt=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new K(t,{context:j,initialValue:Wt}),this.paymentMethodsProvider=new K(t,{context:it,initialValue:null}),this.paymentManagerProvider=new K(t,{context:ue,initialValue:new Map}),this.cardNetworksContext=new K(t,{context:Gt,initialValue:null}),this.vaultManagerProvider=new K(t,{context:W,initialValue:null}),this.vaultManagerCvvProvider=new K(t,{context:Te,initialValue:null}),this.clientOptionsContext=new K(t,{context:ot,initialValue:null}),this.klarnaCategoriesProvider=new K(t,{context:qt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new K(t,{context:q,initialValue:null}),this.computedStylesProvider=new K(t,{context:Pe,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var ze=class ze{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){N.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||N.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=ze.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,i)=>"-"+i.toLowerCase()),ze.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let i=t[r];if(!i)continue;if(!this.isValidCssProperty(r)){N.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(i))continue;let s=this.getCssVarName(r);e.push([s,i])}if(e.length>0)for(let[r,i]of e)this.host.style.setProperty(r,i)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of ze.cssVarCache.keys()){let e=ze.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};ze.cssVarCache=new Map;var Jt=ze;var Qt=globalThis,er=Qt.ShadowRoot&&(Qt.ShadyCSS===void 0||Qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yr=Symbol(),jo=new WeakMap,Ct=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Yr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(er&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=jo.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&jo.set(e,t))}return t}toString(){return this.cssText}},Go=o=>new Ct(typeof o=="string"?o:o+"",void 0,Yr),g=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,s)=>r+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new Ct(e,o,Yr)},Ur=(o,t)=>{if(er)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Qt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},tr=er?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Go(e)})(o):o;var{is:sn,defineProperty:ln,getOwnPropertyDescriptor:dn,getOwnPropertyNames:pn,getOwnPropertySymbols:cn,getPrototypeOf:mn}=Object,we=globalThis,qo=we.trustedTypes,un=qo?qo.emptyScript:"",hn=we.reactiveElementPolyfillSupport,At=(o,t)=>o,Mt={toAttribute(o,t){switch(t){case Boolean:o=o?un:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},at=(o,t)=>!sn(o,t),Wo={attribute:!0,type:String,converter:Mt,reflect:!1,hasChanged:at};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),we.litPropertyMetadata??(we.litPropertyMetadata=new WeakMap);var ve=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Wo){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&ln(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:s}=dn(this.prototype,t)??{get(){return this[e]},set(c){this[e]=c}};return{get(){return i?.call(this)},set(c){let x=i?.call(this);s.call(this,c),this.requestUpdate(t,x,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wo}static _$Ei(){if(this.hasOwnProperty(At("elementProperties")))return;let t=mn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(At("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(At("properties"))){let e=this.properties,r=[...pn(e),...cn(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(tr(i))}else t!==void 0&&e.push(tr(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ur(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:Mt).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let s=r.getPropertyOptions(i),c=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Mt;this._$Em=i,this[i]=c.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??at)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,s]of r)s.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],s)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};ve.elementStyles=[],ve.shadowRootOptions={mode:"open"},ve[At("elementProperties")]=new Map,ve[At("finalized")]=new Map,hn?.({ReactiveElement:ve}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var ke={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},D=Symbol(),V=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??Zo,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(c){s=!0,r=c}if(this.p===i){if(e===D)this.i=0;else{if(s===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Zo=(o,t)=>o===t||o.length===t.length&&o.every((e,r)=>!at(e,t[r]));var _t={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},rr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function zr(o,t,e){switch(t.type){case"SET_LOADING":return{...o,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...o,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...o,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return N.error("VaultManagerController",t.payload.message),{...o,isLoading:!1};case"DISABLE":return{..._t,enabled:!1};case"RESET":return _t;default:return o}}function Br(o,t,e){switch(t.type){case"INITIALIZE_CVV":return{...o,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...o,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...o,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...o,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return rr;default:return o}}var St=class{constructor(t){this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0}),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(e){throw this.dispatchVaultManager({type:"SET_ERROR",payload:e instanceof Error?e:new Error("Failed to delete payment method")}),e}};this.setCvvInput=t=>{this.dispatchVaultItem({type:"SET_CVV_INPUT",payload:t})};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this._vaultItemState.selectedVaultedPaymentMethod,e=this._vaultManagerState.cvvRecapture,r=this._vaultItemState.cvvInput;if(!t||e&&(!r||r.metadata.error)){this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!0});return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,e?{cvv:r.valueToken}:void 0)}catch(i){N.error("VaultManagerController: Error starting vaulted payment flow",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Failed to start vaulted payment flow")}),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.dispatchVaultItem({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t}),this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!1})};(this.host=t).addController(this),this._vaultManagerState=_t,this._vaultItemState=rr,new V(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),D;this.dispatchVaultManager({type:"SET_LOADING",payload:!0});try{this.dispatchVaultManager({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:r.vaultEnabled,cvvRecapture:!!r.captureVaultedCardCvv}),this.dispatchVaultItem({type:"INITIALIZE_CVV",createCvvInput:e.createCvvInput}),await this.fetchVaultedPaymentMethods(),N.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(i){N.error("VaultManagerController: Failed to initialize vault",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Unknown error")})}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,e){this.vaultManager=t,this.options=e??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}hostDisconnected(){this.vaultManager=null,this.dispatchVaultManager({type:"RESET"})}dispatchVaultManager(t){let e={deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod,startVaultedPaymentFlow:this.startVaultedPaymentFlow,createCvvInput:this.vaultManager?.createCvvInput},r=zr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Br(this._vaultItemState,t,e);this._vaultItemState=r,this.host.sdkContextController.setVaultManagerCvv(r)}async fetchVaultedPaymentMethods(){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0});let t=await this._vaultManager.fetchVaultedPaymentMethods();return N.log("VaultManagerController: Fetched payment methods",t),this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:t,isLoading:!1}),t}catch(t){throw this.dispatchVaultManager({type:"SET_ERROR",payload:t instanceof Error?t:new Error("Failed to fetch payment methods")}),t}}};var Pt="lit-localize-status";var Xo=o=>typeof o!="string"&&"strTag"in o,or=(o,t,e)=>{let r=o[0];for(let i=1;i<o.length;i++)r+=t[e?e[i-1]:i-1],r+=o[i];return r};var Tt=o=>Xo(o)?or(o.strings,o.values):o;var P=Tt,Jo=!1;function Fr(o){if(Jo)throw new Error("lit-localize can only be configured once");P=o,Jo=!0}var Kr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Pt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Pt,this.__litLocalizeEventHandler)}},gn=o=>o.addController(new Kr(o)),Qo=gn;var I=()=>(o,t)=>(o.addInitializer(Qo),o);var wt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var ye=[];for(let o=0;o<256;o++)ye[o]=(o>>4&15).toString(16)+(o&15).toString(16);function ei(o){let t=0,e=8997,r=0,i=33826,s=0,c=40164,x=0,h=52210;for(let R=0;R<o.length;R++)e^=o.charCodeAt(R),t=e*435,r=i*435,s=c*435,x=h*435,s+=e<<8,x+=i<<8,r+=t>>>16,e=t&65535,s+=r>>>16,i=r&65535,h=x+(s>>>16)&65535,c=s&65535;return ye[h>>8]+ye[h&255]+ye[c>>8]+ye[c&255]+ye[i>>8]+ye[i&255]+ye[e>>8]+ye[e&255]}var fn="",vn="h",yn="s";function ti(o,t){return(t?vn:yn)+ei(typeof o=="string"?o:o.join(fn))}var ri=new WeakMap,oi=new Map;function ii(o,t,e){if(o){let r=e?.id??bn(t),i=o[r];if(i){if(typeof i=="string")return i;if("strTag"in i)return or(i.strings,t.values,i.values);{let s=ri.get(i);return s===void 0&&(s=i.values,ri.set(i,s)),{...i,values:s.map(c=>t.values[c])}}}}return Tt(t)}function bn(o){let t=typeof o=="string"?o:o.strings,e=oi.get(t);return e===void 0&&(e=ti(t,typeof o!="string"&&!("strTag"in o)),oi.set(t,e)),e}function jr(o){window.dispatchEvent(new CustomEvent(Pt,{detail:o}))}var ar="",Gr,ai,nr,qr,ni,Be=new wt;Be.resolve();var ir=0,si=o=>(Fr((t,e)=>ii(ni,t,e)),ar=ai=o.sourceLocale,nr=new Set(o.targetLocales),nr.add(o.sourceLocale),qr=o.loadLocale,{getLocale:En,setLocale:xn}),En=()=>ar,xn=o=>{if(o===(Gr??ar))return Be.promise;if(!nr||!qr)throw new Error("Internal error");if(!nr.has(o))throw new Error("Invalid locale code");ir++;let t=ir;return Gr=o,Be.settled&&(Be=new wt),jr({status:"loading",loadingLocale:o}),(o===ai?Promise.resolve({templates:void 0}):qr(o)).then(r=>{ir===t&&(ar=o,Gr=void 0,ni=r.templates,jr({status:"ready",readyLocale:o}),Be.resolve())},r=>{ir===t&&(jr({status:"error",errorLocale:o,errorMessage:r.toString()}),Be.reject(r))}),Be.promise};var Wr="en",Zr=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],li="You must call `loadLocale` first to set up the localized template.",di,sr,pi=o=>{let t=si({sourceLocale:Wr,targetLocales:Zr,loadLocale:o});di=t.getLocale,sr=t.setLocale};var Xr=o=>{pi(o)},Jr=o=>{if(!sr)throw new Error(li);return sr(o)};var kt=new Set(Zr);kt.add(Wr);var Qr=o=>{if(typeof o!="string")return!1;if(o==="en")return!0;let t=o.replace("_","-");if(kt.has(t))return!0;let e=t.split("-")[0];return!!kt.has(e)},eo=o=>{if(o==="en")return"en-GB";let t=o.replace("_","-");if(kt.has(t))return t;let e=t.split("-")[0];return kt.has(e)?e:"en-GB"};var Nt=globalThis,lr=Nt.trustedTypes,ci=lr?lr.createPolicy("lit-html",{createHTML:o=>o}):void 0,ro="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,oo="?"+be,Cn=`<${oo}>`,je=document,Lt=()=>je.createComment(""),Rt=o=>o===null||typeof o!="object"&&typeof o!="function",io=Array.isArray,vi=o=>io(o)||typeof o?.[Symbol.iterator]=="function",to=`[
|
|
167
|
-
\f\r]`,It=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mi=/-->/g,ui=/>/g,Fe=RegExp(`>|${to}(?:([^\\s"'>=/]+)(${to}*=${to}*(?:[^
|
|
168
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),hi=/'/g,gi=/"/g,yi=/^(?:script|style|textarea|title)$/i,ao=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),m=ao(1),Ie=ao(2),wd=ao(3),Ee=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),fi=new WeakMap,Ke=je.createTreeWalker(je,129);function bi(o,t){if(!io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ci!==void 0?ci.createHTML(t):t}var Ei=(o,t)=>{let e=o.length-1,r=[],i,s=t===2?"<svg>":t===3?"<math>":"",c=It;for(let x=0;x<e;x++){let h=o[x],R,z,O=-1,Q=0;for(;Q<h.length&&(c.lastIndex=Q,z=c.exec(h),z!==null);)Q=c.lastIndex,c===It?z[1]==="!--"?c=mi:z[1]!==void 0?c=ui:z[2]!==void 0?(yi.test(z[2])&&(i=RegExp("</"+z[2],"g")),c=Fe):z[3]!==void 0&&(c=Fe):c===Fe?z[0]===">"?(c=i??It,O=-1):z[1]===void 0?O=-2:(O=c.lastIndex-z[2].length,R=z[1],c=z[3]===void 0?Fe:z[3]==='"'?gi:hi):c===gi||c===hi?c=Fe:c===mi||c===ui?c=It:(c=Fe,i=void 0);let B=c===Fe&&o[x+1].startsWith("/>")?" ":"";s+=c===It?h+Cn:O>=0?(r.push(R),h.slice(0,O)+ro+h.slice(O)+be+B):h+be+(O===-2?x:B)}return[bi(o,s+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ot=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,c=0,x=t.length-1,h=this.parts,[R,z]=Ei(t,e);if(this.el=o.createElement(R,r),Ke.currentNode=this.el.content,e===2||e===3){let O=this.el.content.firstChild;O.replaceWith(...O.childNodes)}for(;(i=Ke.nextNode())!==null&&h.length<x;){if(i.nodeType===1){if(i.hasAttributes())for(let O of i.getAttributeNames())if(O.endsWith(ro)){let Q=z[c++],B=i.getAttribute(O).split(be),Xe=/([.?@])?(.*)/.exec(Q);h.push({type:1,index:s,name:Xe[2],strings:B,ctor:Xe[1]==="."?pr:Xe[1]==="?"?cr:Xe[1]==="@"?mr:qe}),i.removeAttribute(O)}else O.startsWith(be)&&(h.push({type:6,index:s}),i.removeAttribute(O));if(yi.test(i.tagName)){let O=i.textContent.split(be),Q=O.length-1;if(Q>0){i.textContent=lr?lr.emptyScript:"";for(let B=0;B<Q;B++)i.append(O[B],Lt()),Ke.nextNode(),h.push({type:2,index:++s});i.append(O[Q],Lt())}}}else if(i.nodeType===8)if(i.data===oo)h.push({type:2,index:s});else{let O=-1;for(;(O=i.data.indexOf(be,O+1))!==-1;)h.push({type:7,index:s}),O+=be.length-1}s++}}static createElement(t,e){let r=je.createElement("template");return r.innerHTML=t,r}};function Ge(o,t,e=o,r){if(t===Ee)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,s=Rt(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Ge(o,i._$AS(o,t.values),i,r)),t}var dr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??je).importNode(e,!0);Ke.currentNode=i;let s=Ke.nextNode(),c=0,x=0,h=r[0];for(;h!==void 0;){if(c===h.index){let R;h.type===2?R=new nt(s,s.nextSibling,this,t):h.type===1?R=new h.ctor(s,h.name,h.strings,this,t):h.type===6&&(R=new ur(s,this,t)),this._$AV.push(R),h=r[++x]}c!==h?.index&&(s=Ke.nextNode(),c++)}return Ke.currentNode=je,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},nt=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ge(this,t,e),Rt(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==Ee&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):vi(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&Rt(this._$AH)?this._$AA.nextSibling.data=t:this.T(je.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ot.createElement(bi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new dr(i,this),c=s.u(this.options);s.p(e),this.T(c),this._$AH=s}}_$AC(t){let e=fi.get(t.strings);return e===void 0&&fi.set(t.strings,e=new Ot(t)),e}k(t){io(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let s of t)i===e.length?e.push(r=new o(this.O(Lt()),this.O(Lt()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},qe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,e=this,r,i){let s=this.strings,c=!1;if(s===void 0)t=Ge(this,t,e,0),c=!Rt(t)||t!==this._$AH&&t!==Ee,c&&(this._$AH=t);else{let x=t,h,R;for(t=s[0],h=0;h<s.length-1;h++)R=Ge(this,x[r+h],e,h),R===Ee&&(R=this._$AH[h]),c||(c=!Rt(R)||R!==this._$AH[h]),R===u?t=u:t!==u&&(t+=(R??"")+s[h+1]),this._$AH[h]=R}c&&!i&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},pr=class extends qe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},cr=class extends qe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},mr=class extends qe{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Ge(this,t,e,0)??u)===Ee)return;let r=this._$AH,i=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==u&&(r===u||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ur=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ge(this,t)}},xi={M:ro,P:be,A:oo,C:1,L:Ei,R:dr,D:vi,V:Ge,I:nt,H:qe,N:cr,U:mr,B:pr,F:ur},An=Nt.litHtmlPolyfillSupport;An?.(Ot,nt),(Nt.litHtmlVersions??(Nt.litHtmlVersions=[])).push("3.2.1");var Ci=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let s=e?.renderBefore??null;r._$litPart$=i=new nt(t.insertBefore(Lt(),s),s,void 0,e??{})}return i._$AI(o),i};var f=class extends ve{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ci(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ee}};f._$litElement$=!0,f.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:f});var Mn=globalThis.litElementPolyfillSupport;Mn?.({LitElement:f});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var v=o=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,t)}):customElements.define(o,t)};var _n={attribute:!0,type:String,converter:Mt,reflect:!1,hasChanged:at},Sn=(o=_n,t,e)=>{let{kind:r,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(e.name,o),r==="accessor"){let{name:c}=e;return{set(x){let h=t.get.call(this);t.set.call(this,x),this.requestUpdate(c,h,o)},init(x){return x!==void 0&&this.P(c,void 0,o),x}}}if(r==="setter"){let{name:c}=e;return function(x){let h=this[c];t.call(this,x),this.requestUpdate(c,h,o)}}throw Error("Unsupported decorator location: "+r)};function d(o){return(t,e)=>typeof e=="object"?Sn(o,t,e):((r,i,s)=>{let c=i.hasOwnProperty(s);return i.constructor.createProperty(s,c?{...r,wrapped:!0}:r),c?Object.getOwnPropertyDescriptor(i,s):void 0})(o,t,e)}function w(o){return d({...o,state:!0,attribute:!1})}var We=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ne(o,t){return(e,r,i)=>{let s=c=>c.renderRoot?.querySelector(o)??null;if(t){let{get:c,set:x}=typeof r=="object"?e:i??(()=>{let h=Symbol();return{get(){return this[h]},set(R){this[h]=R}}})();return We(e,r,{get(){let h=c.call(this);return h===void 0&&(h=s(this),(h!==null||this.hasUpdated)&&x.call(this,h)),h}})}return We(e,r,{get(){return s(this)}})}}function $(o,t,e){return o?t(o):e?.(o)}var S=g`
|
|
169
|
-
* {
|
|
170
|
-
box-sizing: border-box;
|
|
171
|
-
}
|
|
172
|
-
`,Ai=g`
|
|
173
|
-
:host {
|
|
174
|
-
display: block;
|
|
175
|
-
isolation: isolate;
|
|
176
|
-
position: relative;
|
|
177
|
-
width: 100%;
|
|
178
|
-
//Keep the CSS loader in the same position - check css-loader-inline.ts
|
|
179
|
-
min-height: 64px;
|
|
180
|
-
}
|
|
181
|
-
`;var Mi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var hr=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};function Pn(o){return document.querySelector(`script[src^="${o}"]`)}function Tn(o,t){let e=document.createElement("script");return e.setAttribute("src",o),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function _i(o,t=!1){if(!Ft)throw new Error("Cannot load script in server environment");let e=Pn(o)??Tn(o,t);return new Promise((r,i)=>{e.onload=()=>{r()},e.onerror=()=>{i()},e.parentNode||document.head.appendChild(e)})}var gr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];(this.host=t).addController(this),this.sdkInstanceTask=new V(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new V(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.host.sdkStateController.startLoading()}async _loadV2Sdk(t=Mi){await _i(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(!t||!e)return D;try{await this._loadV2Sdk();let{Primer:r}=window,i=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:c=>{N.info("Configuration payment methods:",c),this.paymentsList=c},onCheckoutComplete:({payment:c})=>{N.info("Payment completed:",c),this.host.sdkStateController.completeProcessing()},onCheckoutFail:(c,x,h)=>{N.error("Payment failed:",c),this.host.sdkStateController.setFailure(c.code||"UNKNOWN_ERROR",c.message||"Unknown error occurred"),h&&h.showErrorMessage()},onBeforePaymentCreate:(c,x)=>{this.host.sdkStateController.startProcessing(),x?.continuePaymentCreation()},onPaymentMethodAction:(c,x)=>{c==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});this.createPaymentMethodManager=i.createPaymentMethodManager.bind(i),await i.start(),this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(i);let s=i.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(i.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),i}catch(r){throw r instanceof Error&&this.host.sdkStateController.setError(r),r}}}initializeLitContext(){return async([t,e])=>{if(!t||!e.length)return D;let r=new Map,i=new Map;try{for(let c of e){let x=await this.initializePaymentMethodManager(c)();c&&x&&(r.set(c.type,c),i.set(c.type,x))}let s=new hr(r);return this.host.sdkContextController.setPaymentManagers(i),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),N.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let i=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{s==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});return i?{type:e,manager:i}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async c=>{await this.host.cardNetworkController.processCardNetworkChangeEvent(c)},onCardNetworksLoading:()=>{this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let i=await this.createPaymentMethodManager(e);return i?{type:e,manager:i}:null}catch(i){return N.error(`Failed to initialize manager for ${e}:`,i),null}}}};var wn=Uo({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});Xr(o=>wn(`../../localization/lit-localize/locales/${o}.ts`));var ae=class extends f{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this.locale="en-GB";this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.sdkContextController=new Xt(this),this.sdkStateController=new Zt(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Jt(this),this.vaultManagerController=new St(this),this.cardNetworkController=new Kt(this),new gr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,i){e==="customstyles"?this.styleProcessingController.processCustomStyles(i):super.attributeChangedCallback(e,r,i)}willUpdate(e){e.has("options")&&(this.options?.locale&&(Qr(this.options?.locale)?this.locale=eo(this.options?.locale):N.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Jr(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.state.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e}render(){let e=this.sdkStateController.state,r=e.isLoading,i=e.error,s=!r&&!i;return m`
|
|
182
|
-
${$(r,()=>u)}
|
|
183
|
-
${$(i,()=>m`<primer-checkout-error></primer-checkout-error>`)}
|
|
184
|
-
${$(s,()=>m`
|
|
185
|
-
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
186
|
-
${$(this.hasAssignedContent,()=>u,()=>m`<primer-main></primer-main>`)}
|
|
187
|
-
`,()=>u)}
|
|
188
|
-
`}addEventListener(e,r,i){super.addEventListener(e,r,i)}};ae.styles=[S,Ai],n([d({type:String,attribute:"custom-styles"})],ae.prototype,"customStyles",2),n([d({type:String,attribute:"client-token"})],ae.prototype,"clientToken",2),n([d({type:Object})],ae.prototype,"options",2),n([d({type:Boolean,reflect:!0,attribute:"js-initialized"})],ae.prototype,"_jsInitialized",2),n([Ne("slot")],ae.prototype,"defaultSlot",2),n([w()],ae.prototype,"previousLoadingState",2),ae=n([I(),v("primer-checkout")],ae);var Si=g`
|
|
188
|
+
`;var kn="primer-light-theme-css",In="primer-dark-theme-css";function io(){Ot(Ai,kn,!0)}function ao(){Ot(Mi,In,!0)}function Si(){io(),ao()}function _i(){Ot(Ci,"primer-css-loader-styles",!1)}function Pi(){Si()}function Ln(){io()}function Nn(){ao()}var Ti=g`
|
|
189
189
|
:host {
|
|
190
190
|
display: inline-flex;
|
|
191
191
|
align-items: center;
|
|
@@ -249,7 +249,7 @@ primer-checkout.primer-dark-theme {
|
|
|
249
249
|
/>
|
|
250
250
|
</svg>
|
|
251
251
|
</div>
|
|
252
|
-
`}};xe.styles=[
|
|
252
|
+
`}};xe.styles=[Ti],n([d({type:String})],xe.prototype,"color",2),n([d({type:String})],xe.prototype,"size",2),n([d({type:Boolean})],xe.prototype,"compact",2),xe=n([v("primer-spinner")],xe);var fr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),st=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var ce=Dt(class extends st{constructor(o){if(super(o),o.type!==fr.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=o.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let i=!!t[r];i===this.st.has(r)||this.nt?.has(r)||(i?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return Ee}});var wi=g`
|
|
253
253
|
* {
|
|
254
254
|
box-sizing: border-box;
|
|
255
255
|
}
|
|
@@ -317,12 +317,12 @@ primer-checkout.primer-dark-theme {
|
|
|
317
317
|
`;var Ce=class extends f{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(i=>i.tagName.toLowerCase()==="primer-input");if(r)return r;for(let i of e){let s=i.querySelector("primer-input");if(s)return s}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return m`
|
|
318
318
|
<div class="input-wrapper">
|
|
319
319
|
<slot name="label"></slot>
|
|
320
|
-
<div class="${
|
|
320
|
+
<div class="${ce(e)}" @click="${this.handleWrapperClick}">
|
|
321
321
|
<slot name="input"></slot>
|
|
322
322
|
</div>
|
|
323
323
|
<slot name="error"></slot>
|
|
324
324
|
</div>
|
|
325
|
-
`}};Ce.styles=[
|
|
325
|
+
`}};Ce.styles=[wi],n([d({type:Boolean})],Ce.prototype,"focusWithin",2),n([d({type:Boolean,reflect:!0,attribute:"has-error"})],Ce.prototype,"hasError",2),n([Le('slot[name="input"]')],Ce.prototype,"inputSlot",2),Ce=n([v("primer-input-wrapper")],Ce);var ki=g`
|
|
326
326
|
:host {
|
|
327
327
|
display: inline-block;
|
|
328
328
|
font-weight: var(--primer-typography-body-small-weight);
|
|
@@ -336,7 +336,7 @@ primer-checkout.primer-dark-theme {
|
|
|
336
336
|
:host([disabled]) {
|
|
337
337
|
color: var(--primer-color-text-disabled);
|
|
338
338
|
}
|
|
339
|
-
`;var
|
|
339
|
+
`;var Ne=class extends f{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return m`<label for=${this.for}><slot></slot></label>`}};Ne.styles=[ki],n([d({type:String,reflect:!0})],Ne.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Ne.prototype,"disabled",2),Ne=n([v("primer-input-label")],Ne);var Ii=g`
|
|
340
340
|
:host {
|
|
341
341
|
display: contents;
|
|
342
342
|
}
|
|
@@ -530,7 +530,7 @@ primer-checkout.primer-dark-theme {
|
|
|
530
530
|
</span>
|
|
531
531
|
${this.renderCheckmark()}
|
|
532
532
|
</button>
|
|
533
|
-
`}};ne.styles=[
|
|
533
|
+
`}};ne.styles=[_,Ii],n([d({type:String})],ne.prototype,"variant",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"disabled",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"loading",2),n([d({type:String})],ne.prototype,"buttonType",2),n([d({type:String,reflect:!0})],ne.prototype,"selectionState",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"selectable",2),ne=n([v("primer-button")],ne);var Li=g`
|
|
534
534
|
:host {
|
|
535
535
|
display: contents;
|
|
536
536
|
}
|
|
@@ -555,7 +555,7 @@ primer-checkout.primer-dark-theme {
|
|
|
555
555
|
>
|
|
556
556
|
<slot></slot>
|
|
557
557
|
</span>
|
|
558
|
-
`}};Re.styles=[
|
|
558
|
+
`}};Re.styles=[Li],n([d({type:String,reflect:!0})],Re.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Re.prototype,"active",2),Re=n([v("primer-input-error")],Re);var Ni={pencil:Ie`
|
|
559
559
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
560
560
|
<path d="M12.3292 1.82659C12.142 1.63935 11.8779 1.53418 11.6028 1.53418C11.3277 1.53418 11.0636 1.63935 10.8764 1.82659L2.92969 9.77325V13.0666H6.22306L14.1698 5.11992C14.357 4.93268 14.4622 4.66859 14.4622 4.39352C14.4622 4.11844 14.357 3.85435 14.1698 3.66711L12.3292 1.82659ZM5.77375 11.7333H4.26302V10.2225L10.8764 3.60919L12.3871 5.11992L5.77375 11.7333Z" fill="currentColor"/>
|
|
561
561
|
</svg>
|
|
@@ -605,7 +605,7 @@ primer-checkout.primer-dark-theme {
|
|
|
605
605
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
606
606
|
<path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" fill="#212121"/>
|
|
607
607
|
</svg>
|
|
608
|
-
`};var
|
|
608
|
+
`};var Ri=g`
|
|
609
609
|
:host {
|
|
610
610
|
display: inline-block;
|
|
611
611
|
line-height: 0; /* so you don’t get extra space around the icon */
|
|
@@ -647,11 +647,11 @@ primer-checkout.primer-dark-theme {
|
|
|
647
647
|
/* --internal used for abstracting away the icon component */
|
|
648
648
|
fill: var(--internal-icon-color, currentColor);
|
|
649
649
|
}
|
|
650
|
-
`;var Ae=class extends f{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?
|
|
650
|
+
`;var Ae=class extends f{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Ni[this.name]:null;return m`
|
|
651
651
|
<div style="--internal-icon-color: ${this.color}">
|
|
652
652
|
${e||m`<slot></slot>`}
|
|
653
653
|
</div>
|
|
654
|
-
`}};Ae.styles=[
|
|
654
|
+
`}};Ae.styles=[Ri],n([d({type:String})],Ae.prototype,"color",2),n([d({type:String})],Ae.prototype,"size",2),n([d({reflect:!0})],Ae.prototype,"name",2),Ae=n([v("primer-icon")],Ae);var Oi=g`
|
|
655
655
|
:host {
|
|
656
656
|
display: flex;
|
|
657
657
|
flex-direction: column;
|
|
@@ -701,7 +701,7 @@ primer-checkout.primer-dark-theme {
|
|
|
701
701
|
</primer-icon>
|
|
702
702
|
<p>Payment failed</p>
|
|
703
703
|
${this.description?m`<p class="secondary">${this.description}</p>`:m`<p class="secondary">Something went wrong.</p>`}
|
|
704
|
-
`}};Oe.styles=[
|
|
704
|
+
`}};Oe.styles=[Oi],n([d({type:String})],Oe.prototype,"type",2),n([d({type:String})],Oe.prototype,"description",2),Oe=n([v("primer-checkout-state")],Oe);var Di=g`
|
|
705
705
|
:host {
|
|
706
706
|
display: contents;
|
|
707
707
|
}
|
|
@@ -732,7 +732,7 @@ primer-checkout.primer-dark-theme {
|
|
|
732
732
|
:host([disabled]) input::placeholder {
|
|
733
733
|
color: var(--primer-color-text-disabled);
|
|
734
734
|
}
|
|
735
|
-
`;var
|
|
735
|
+
`;var Rn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function On(o){return Rn.includes(o)}var Y=class extends f{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(e){e.stopPropagation();let r=e.target;this.value=r.value;let i=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(i)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let i=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(i)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,i){this.inputElement?.setSelectionRange(e,r,i)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return m`
|
|
736
736
|
<input
|
|
737
737
|
part="input"
|
|
738
738
|
class=${r}
|
|
@@ -757,7 +757,7 @@ primer-checkout.primer-dark-theme {
|
|
|
757
757
|
@blur=${this.handleBlur}
|
|
758
758
|
@invalid=${this.handleInvalid}
|
|
759
759
|
/>
|
|
760
|
-
`}addEventListener(e,r,i){super.addEventListener(e,r,i)}removeEventListener(e,r,i){super.removeEventListener(e,r,i)}};Y.styles=[
|
|
760
|
+
`}addEventListener(e,r,i){super.addEventListener(e,r,i)}removeEventListener(e,r,i){super.removeEventListener(e,r,i)}};Y.styles=[Di],n([Le("input")],Y.prototype,"inputElement",2),n([d({type:String,reflect:!0})],Y.prototype,"value",2),n([d({type:String,reflect:!0})],Y.prototype,"placeholder",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),n([d({type:String,reflect:!0})],Y.prototype,"name",2),n([d({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!On(e)?(e&&e!=="text"&&w.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],Y.prototype,"type",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"required",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"readonly",2),n([d({type:String,reflect:!0})],Y.prototype,"pattern",2),n([d({type:Number,reflect:!0})],Y.prototype,"minlength",2),n([d({type:Number,reflect:!0})],Y.prototype,"maxlength",2),n([d({type:String,reflect:!0})],Y.prototype,"min",2),n([d({type:String,reflect:!0})],Y.prototype,"max",2),n([d({type:String,reflect:!0})],Y.prototype,"step",2),n([d({type:String,reflect:!0})],Y.prototype,"autocomplete",2),n([d({type:String,reflect:!0})],Y.prototype,"id",2),n([k()],Y.prototype,"hasFocus",2),n([k()],Y.prototype,"hasError",2),Y=n([v("primer-input")],Y);var $i=g`
|
|
761
761
|
:host {
|
|
762
762
|
display: block;
|
|
763
763
|
}
|
|
@@ -835,7 +835,7 @@ primer-checkout.primer-dark-theme {
|
|
|
835
835
|
</div>
|
|
836
836
|
</div>
|
|
837
837
|
</div>
|
|
838
|
-
`}};re.styles=[
|
|
838
|
+
`}};re.styles=[$i],n([d({type:String})],re.prototype,"header",2),n([d({type:Boolean})],re.prototype,"expanded",2),n([d({type:String})],re.prototype,"expandText",2),n([d({type:String})],re.prototype,"collapseText",2),n([d({type:String})],re.prototype,"ariaLabel",2),n([d({type:String})],re.prototype,"buttonVariant",2),n([k()],re.prototype,"isExpanded",2),re=n([v("primer-collapsable")],re);var Vi=g`
|
|
839
839
|
:host {
|
|
840
840
|
display: block;
|
|
841
841
|
width: 100%;
|
|
@@ -898,7 +898,7 @@ primer-checkout.primer-dark-theme {
|
|
|
898
898
|
`;var he=class extends f{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(e){e.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return u;let e={"error-message":!0,hidden:!this.visible};return m`
|
|
899
899
|
<div
|
|
900
900
|
part="error-message"
|
|
901
|
-
class=${
|
|
901
|
+
class=${ce(e)}
|
|
902
902
|
aria-live="assertive"
|
|
903
903
|
aria-atomic="true"
|
|
904
904
|
>
|
|
@@ -911,7 +911,7 @@ primer-checkout.primer-dark-theme {
|
|
|
911
911
|
</div>
|
|
912
912
|
<div part="error-content" class="error-content">${this.message}</div>
|
|
913
913
|
</div>
|
|
914
|
-
`}};he.styles=[
|
|
914
|
+
`}};he.styles=[Vi],n([d({type:String})],he.prototype,"message",2),n([d({type:Boolean,reflect:!0})],he.prototype,"visible",2),n([d({type:String,reflect:!0})],he.prototype,"role",2),n([k()],he.prototype,"showMessage",2),he=n([v("primer-error-message")],he);var Hi=g`
|
|
915
915
|
:host {
|
|
916
916
|
display: contents;
|
|
917
917
|
}
|
|
@@ -1103,13 +1103,13 @@ primer-checkout.primer-dark-theme {
|
|
|
1103
1103
|
background-color: var(--primer-color-background-outlined-default);
|
|
1104
1104
|
border-radius: var(--primer-radius-small);
|
|
1105
1105
|
}
|
|
1106
|
-
`;var Z=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=P("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>{if(!e||!r)return
|
|
1106
|
+
`;var Z=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=P("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>{if(!e||!r)return N;let i=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:i?.assets?.icon?`${i.goatCdnUrl}/${i.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){w.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){w.error("Failed to render Klarna category",e)}}selectCategory(e){this.selectedCategory=e,this.renderSelectedCategory()}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?m`<div class="loading">
|
|
1107
1107
|
<primer-spinner size="small"></primer-spinner>
|
|
1108
1108
|
</div>`:e.length<=1?u:m`
|
|
1109
1109
|
<div class="category-selection">
|
|
1110
1110
|
${e.map(i=>m`
|
|
1111
1111
|
<button
|
|
1112
|
-
class=${
|
|
1112
|
+
class=${ce({"category-button":!0,selected:i.id===this.selectedCategory})}
|
|
1113
1113
|
@click=${()=>{this.selectCategory(i.id)}}
|
|
1114
1114
|
>
|
|
1115
1115
|
${i.name}
|
|
@@ -1126,7 +1126,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1126
1126
|
`:u}
|
|
1127
1127
|
|
|
1128
1128
|
<button
|
|
1129
|
-
class=${
|
|
1129
|
+
class=${ce({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1130
1130
|
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1131
1131
|
@click=${()=>this.startKlarnaPayment()}
|
|
1132
1132
|
>
|
|
@@ -1164,7 +1164,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1164
1164
|
</div>
|
|
1165
1165
|
</div>
|
|
1166
1166
|
</div>
|
|
1167
|
-
`:u})}};Z.styles=[
|
|
1167
|
+
`:u})}};Z.styles=[_,Hi],n([C({context:ue,subscribe:!0}),d()],Z.prototype,"paymentManagers",2),n([C({context:j,subscribe:!0}),d()],Z.prototype,"sdkState",2),n([C({context:q,subscribe:!0}),d({type:Object})],Z.prototype,"headlessUtils",2),n([C({context:Gt,subscribe:!0}),d()],Z.prototype,"klarnaCategories",2),n([k()],Z.prototype,"selectedCategory",2),n([k()],Z.prototype,"isExpanded",2),n([k()],Z.prototype,"headerAriaLabel",2),n([Le("#klarna-category-container")],Z.prototype,"klarnaContainer",2),Z=n([v("primer-klarna"),L()],Z);var Yi=g`
|
|
1168
1168
|
:host {
|
|
1169
1169
|
display: contents;
|
|
1170
1170
|
}
|
|
@@ -1172,7 +1172,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1172
1172
|
.paymentMethod=${e}
|
|
1173
1173
|
></primer-native-payment>`;case"REDIRECT":return m`<primer-redirect-payment
|
|
1174
1174
|
.paymentMethod=${e}
|
|
1175
|
-
></primer-redirect-payment>`;case"KLARNA":return m`<primer-klarna></primer-klarna>`;default:return u}}};De.styles=[
|
|
1175
|
+
></primer-redirect-payment>`;case"KLARNA":return m`<primer-klarna></primer-klarna>`;default:return u}}};De.styles=[Yi],n([d({type:String})],De.prototype,"type",2),n([C({context:it,subscribe:!0}),d()],De.prototype,"paymentMethods",2),De=n([v("primer-payment-method")],De);var Ui=g`
|
|
1176
1176
|
:host {
|
|
1177
1177
|
height: calc(
|
|
1178
1178
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1209,15 +1209,15 @@ primer-checkout.primer-dark-theme {
|
|
|
1209
1209
|
img {
|
|
1210
1210
|
height: 100%;
|
|
1211
1211
|
}
|
|
1212
|
-
`;var ge=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?
|
|
1212
|
+
`;var ge=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?N:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return N;let i=r.getPaymentMethodConfiguration(e);return i?{backgroundColor:i.displayMetadata.button.backgroundColor.colored,name:i.name,iconUrl:i.displayMetadata.button.iconUrl.colored}:N},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?N:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor),m` <primer-button
|
|
1213
1213
|
@click="${()=>this.startRedirectPayment()}"
|
|
1214
|
-
class=${
|
|
1214
|
+
class=${ce({loading:!!this.sdkState?.isProcessing})}
|
|
1215
1215
|
title="${P("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1216
1216
|
>
|
|
1217
1217
|
<span class="image-container">
|
|
1218
1218
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1219
1219
|
</span>
|
|
1220
|
-
</primer-button>`)})}};ge.styles=[
|
|
1220
|
+
</primer-button>`)})}};ge.styles=[_,Ui],n([d({type:Object})],ge.prototype,"paymentMethod",2),n([C({context:ue,subscribe:!0})],ge.prototype,"paymentManagers",2),n([C({context:j,subscribe:!0})],ge.prototype,"sdkState",2),n([C({context:q,subscribe:!0})],ge.prototype,"headlessUtils",2),ge=n([v("primer-redirect-payment"),L()],ge);var zi=g`
|
|
1221
1221
|
:host {
|
|
1222
1222
|
display: contents;
|
|
1223
1223
|
}
|
|
@@ -1244,7 +1244,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1244
1244
|
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
1245
1245
|
${$(this.hasAssignedContent,()=>u,()=>m`
|
|
1246
1246
|
<div
|
|
1247
|
-
class=${
|
|
1247
|
+
class=${ce({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
1248
1248
|
>
|
|
1249
1249
|
<primer-vault-manager></primer-vault-manager>
|
|
1250
1250
|
<primer-show-other-payments>
|
|
@@ -1259,7 +1259,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1259
1259
|
<primer-error-message-container></primer-error-message-container>
|
|
1260
1260
|
</div>
|
|
1261
1261
|
`)}
|
|
1262
|
-
`}};$e.styles=[
|
|
1262
|
+
`}};$e.styles=[_,zi],n([C({context:it,subscribe:!0}),d()],$e.prototype,"paymentMethods",2),n([C({context:j,subscribe:!0}),d()],$e.prototype,"sdkState",2),$e=n([v("primer-main")],$e);var Bi=g`
|
|
1263
1263
|
:host {
|
|
1264
1264
|
height: calc(
|
|
1265
1265
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1273,10 +1273,10 @@ primer-checkout.primer-dark-theme {
|
|
|
1273
1273
|
height: 100%;
|
|
1274
1274
|
flex: 1;
|
|
1275
1275
|
}
|
|
1276
|
-
`;var Me=class extends f{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new V(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return
|
|
1276
|
+
`;var Me=class extends f{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new V(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return N;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new V(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return N;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let i=this.calculateButtonHeight(),s=e.createButton(),p=this.createRenderOptions(i);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,p),e}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>u,complete:()=>m`
|
|
1277
1277
|
<!-- The native button container is rendered first -->
|
|
1278
1278
|
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
1279
|
-
`,pending:()=>u})}};Me.styles=[
|
|
1279
|
+
`,pending:()=>u})}};Me.styles=[_,Bi],n([d({type:Object})],Me.prototype,"paymentMethod",2),n([C({context:ue,subscribe:!0}),d()],Me.prototype,"paymentManagers",2),n([C({context:Pe,subscribe:!0}),d()],Me.prototype,"computedStyles",2),Me=n([v("primer-native-payment")],Me);var vr="card-form-context";var Fi=g`
|
|
1280
1280
|
:host {
|
|
1281
1281
|
display: contents;
|
|
1282
1282
|
}
|
|
@@ -1299,7 +1299,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1299
1299
|
display: flex;
|
|
1300
1300
|
gap: var(--primer-space-small);
|
|
1301
1301
|
}
|
|
1302
|
-
`;var
|
|
1302
|
+
`;var Se=class extends f{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new K(this,{context:vr,initialValue:null});this.eventsController=new tt(this);this.setupCardFormTask=new V(this,{task:async([e])=>{if(!e?.manager)return N;let{manager:r}=e,{cardNumberInput:i,expiryInput:s,cvvInput:p}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:i,expiryInput:s,cvvInput:p,setCardholderName:x=>r.setCardholderName(x),setCardNetwork:x=>{this.selectedCardNetwork=x},validate:()=>r.validate(),submit:x=>r.submit(x)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let i=e.target.closest("button, primer-button");if(!i)return;this.isSubmitButton(i)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),i=r==="button",s=r==="primer-button";return i&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||s&&(e.getAttribute("buttonType")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let i=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(i)}else{let i=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:i}),this.eventsController.dispatchFormSubmitErrors(i)}}render(){return this.setupCardFormTask.status===ke.ERROR||this.setupCardFormTask.status===ke.INITIAL?u:m`
|
|
1303
1303
|
<form @submit=${this.handleFormSubmit}>
|
|
1304
1304
|
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
1305
1305
|
${this.setupCardFormTask.render({complete:()=>$(this.hasAssignedContent,()=>u,()=>m`
|
|
@@ -1314,7 +1314,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1314
1314
|
<primer-card-form-submit></primer-card-form-submit>
|
|
1315
1315
|
`)})}
|
|
1316
1316
|
</form>
|
|
1317
|
-
`}};
|
|
1317
|
+
`}};Se.styles=[_,Fi],n([k()],Se.prototype,"hasAssignedContent",2),n([k()],Se.prototype,"selectedCardNetwork",2),n([C({context:ue,subscribe:!0}),d({type:Object})],Se.prototype,"paymentManagers",2),Se=n([v("primer-card-form"),L()],Se);function Ki(o,t){if(o.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",o.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
|
|
1318
1318
|
input[data-custom-input]::placeholder {
|
|
1319
1319
|
color: var(--primer-color-text-placeholder);
|
|
1320
1320
|
font-size: var(--primer-typography-body-large-size);
|
|
@@ -1323,7 +1323,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1323
1323
|
input[data-custom-input]:focus {
|
|
1324
1324
|
outline: none;
|
|
1325
1325
|
}
|
|
1326
|
-
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function yr(o){return o?{paddingHorizontal:0,placeholder:{color:o.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim()},height:o.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim(),color:o.getPropertyValue("--primer-color-text-primary").trim()}:null}function
|
|
1326
|
+
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function yr(o){return o?{paddingHorizontal:0,placeholder:{color:o.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim()},height:o.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim(),color:o.getPropertyValue("--primer-color-text-primary").trim()}:null}function ji(o,t){return o.active===t.active&&o.dirty===t.dirty&&o.error===t.error&&o.errorCode===t.errorCode&&o.submitted===t.submitted&&o.touched===t.touched&&o.valid===t.valid}var br=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new V(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return N;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):N}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,Ki(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(s=>requestAnimationFrame(()=>s())),this._hostedInput=t;let r=yr(this.host.computedStyles),i=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",s=>{this._meta=s,ji(this._meta,s)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...i}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var G=class extends f{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:P(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new br(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===ke.ERROR)return u;let e=this.getError();return m`
|
|
1327
1327
|
<primer-input-wrapper
|
|
1328
1328
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1329
1329
|
.hasError=${!!e}
|
|
@@ -1341,7 +1341,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1341
1341
|
</primer-input-error>
|
|
1342
1342
|
`,()=>u)}
|
|
1343
1343
|
</primer-input-wrapper>
|
|
1344
|
-
`}};n([C({context:vr,subscribe:!0})],G.prototype,"cardFormContext",2),n([C({context:Pe,subscribe:!0}),d()],G.prototype,"computedStyles",2),n([d({type:String})],G.prototype,"label",1),n([d({type:String})],G.prototype,"placeholder",1),n([d({type:String,attribute:"aria-label"})],G.prototype,"ariaLabel",1);var
|
|
1344
|
+
`}};n([C({context:vr,subscribe:!0})],G.prototype,"cardFormContext",2),n([C({context:Pe,subscribe:!0}),d()],G.prototype,"computedStyles",2),n([d({type:String})],G.prototype,"label",1),n([d({type:String})],G.prototype,"placeholder",1),n([d({type:String,attribute:"aria-label"})],G.prototype,"ariaLabel",1);var Gi=g`
|
|
1345
1345
|
:host {
|
|
1346
1346
|
display: contents;
|
|
1347
1347
|
}
|
|
@@ -1389,19 +1389,19 @@ primer-checkout.primer-dark-theme {
|
|
|
1389
1389
|
</primer-input-error>
|
|
1390
1390
|
`,()=>u)}
|
|
1391
1391
|
</primer-input-wrapper>
|
|
1392
|
-
`}render(){return this.renderInput()}};lt.styles=[
|
|
1392
|
+
`}render(){return this.renderInput()}};lt.styles=[_,Ve,Gi],lt=n([v("primer-input-card-number"),L()],lt);var qi=g`
|
|
1393
1393
|
:host {
|
|
1394
1394
|
display: contents;
|
|
1395
1395
|
}
|
|
1396
|
-
`;var dt=class extends G{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};dt.styles=[
|
|
1396
|
+
`;var dt=class extends G{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};dt.styles=[_,Ve,qi],dt=n([v("primer-input-cvv"),L()],dt);var Wi=g`
|
|
1397
1397
|
:host {
|
|
1398
1398
|
display: contents;
|
|
1399
1399
|
}
|
|
1400
|
-
`;var
|
|
1400
|
+
`;var ct=class extends G{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};ct.styles=[_,Ve,Wi],ct=n([v("primer-input-card-expiry"),L()],ct);var Zi=g`
|
|
1401
1401
|
:host {
|
|
1402
1402
|
display: contents;
|
|
1403
1403
|
}
|
|
1404
|
-
`;var
|
|
1404
|
+
`;var pt=class extends G{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};pt.styles=[_,Ve,Zi],pt=n([v("primer-input-card-holder-name"),L()],pt);var Xi=g`
|
|
1405
1405
|
:host {
|
|
1406
1406
|
display: contents;
|
|
1407
1407
|
}
|
|
@@ -1416,7 +1416,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1416
1416
|
>
|
|
1417
1417
|
${this.buttonText}${r}
|
|
1418
1418
|
</primer-button>
|
|
1419
|
-
`}};se.styles=[
|
|
1419
|
+
`}};se.styles=[_,Xi],n([d({type:String})],se.prototype,"buttonText",1),n([C({context:q,subscribe:!0}),d({type:Object})],se.prototype,"headlessInstance",2),n([C({context:ot,subscribe:!0}),d({type:Object})],se.prototype,"clientOptions",2),n([C({context:j,subscribe:!0}),d()],se.prototype,"sdkState",2),n([d({type:String})],se.prototype,"variant",2),n([d({type:Boolean})],se.prototype,"disabled",2),se=n([v("primer-card-form-submit"),L()],se);var{I:rv}=vi;var Ji=o=>o.strings===void 0;var $t=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),$t(r,t);return!0},Er=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Qi=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Vn(t)}};function Dn(o){this._$AN!==void 0?(Er(this),this._$AM=o,Qi(this)):this._$AM=o}function $n(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)$t(r[s],!1),Er(r[s]);else r!=null&&($t(r,!1),Er(r));else $t(this,o)}var Vn=o=>{o.type==fr.CHILD&&(o._$AP??(o._$AP=$n),o._$AQ??(o._$AQ=Dn))},xr=class extends st{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Qi(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&($t(this,t),Er(this))}setValue(t){if(Ji(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var co=()=>new lo,lo=class{},so=new WeakMap,Cr=Dt(class extends xr{render(o){return u}update(o,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),u}rt(o){if(this.isConnected||(o=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=so.get(t);e===void 0&&(e=new WeakMap,so.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,o),o!==void 0&&this.Y.call(this.ht,o)}else this.Y.value=o}get lt(){return typeof this.Y=="function"?so.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var ea=g`
|
|
1420
1420
|
:host {
|
|
1421
1421
|
display: flex;
|
|
1422
1422
|
align-items: center;
|
|
@@ -1536,7 +1536,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1536
1536
|
width: var(--primer-size-small);
|
|
1537
1537
|
height: var(--primer-size-small);
|
|
1538
1538
|
}
|
|
1539
|
-
`;var le=class extends f{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=
|
|
1539
|
+
`;var le=class extends f{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=co();this.dropdownRef=co();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(i=>i.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return m`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return m`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return m`<primer-icon name="payment-card" size="sm"></primer-icon>`;let i=e.length>1;return m`
|
|
1540
1540
|
<button
|
|
1541
1541
|
${Cr(this.buttonRef)}
|
|
1542
1542
|
class="network-selector"
|
|
@@ -1568,15 +1568,15 @@ primer-checkout.primer-dark-theme {
|
|
|
1568
1568
|
role="listbox"
|
|
1569
1569
|
aria-label="Select card network"
|
|
1570
1570
|
>
|
|
1571
|
-
${e.map((s,
|
|
1571
|
+
${e.map((s,p)=>m`
|
|
1572
1572
|
<div
|
|
1573
|
-
${Cr(x=>this.setNetworkOptionRef(x,
|
|
1574
|
-
class="network-option ${this.isKeyboardNavigation&&
|
|
1573
|
+
${Cr(x=>this.setNetworkOptionRef(x,p))}
|
|
1574
|
+
class="network-option ${this.isKeyboardNavigation&&p===this.focusedNetworkIndex?"focused":""}"
|
|
1575
1575
|
@click=${x=>this.selectNetwork(x,s)}
|
|
1576
1576
|
@keydown=${x=>{(x.key==="Enter"||x.key===" ")&&this.selectNetwork(x,s)}}
|
|
1577
1577
|
role="option"
|
|
1578
1578
|
aria-selected=${s.network===r.network}
|
|
1579
|
-
tabindex="${
|
|
1579
|
+
tabindex="${p===this.focusedNetworkIndex?"0":"-1"}"
|
|
1580
1580
|
>
|
|
1581
1581
|
<img
|
|
1582
1582
|
class="network-option-icon"
|
|
@@ -1594,7 +1594,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1594
1594
|
`)}
|
|
1595
1595
|
</div>
|
|
1596
1596
|
`,()=>u)}
|
|
1597
|
-
`}};le.styles=[
|
|
1597
|
+
`}};le.styles=[_,ea],n([C({context:jt,subscribe:!0})],le.prototype,"cardNetworks",2),n([C({context:q,subscribe:!0})],le.prototype,"headlessUtils",2),n([k()],le.prototype,"selectedCardNetwork",2),n([k()],le.prototype,"isDropdownOpen",2),n([k()],le.prototype,"focusedNetworkIndex",2),n([k()],le.prototype,"isKeyboardNavigation",2),le=n([v("primer-card-network-selector")],le);var Hn=Dr(Ar(),1),mt=Dr(Ar(),1);function mo(o){return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()}function Yn(o){return o?o===o.toUpperCase()?mo(o):o:""}function ta(o,t){return[o,t].filter(Boolean).join(" ")}function Un(o,t){return!o||!t?"":`Expires ${o}/${t.slice(-2)}`}function ra(o){return o?`\u2022\u2022\u2022\u2022 ${o}`:""}function zn(o){let t=o.paymentInstrumentData,e=Yn(t.network),r=t.last4Digits,i=`${o.paymentInstrumentData.cardholderName?o.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${ra(r)}`:e)||" Card"}`,s=Un(t.expirationMonth,t.expirationYear);return{description:i,secondaryDescription:s}}function Bn(o){let t=o.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",i=t.externalPayerInfo?.lastName||"",s=o.userDescription||e||"PayPal Account",p=ta(r,i);return{description:s,secondaryDescription:p}}function Fn(o){let t=o.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",i=t.sessionData?.billingAddress?.lastName||"",s=o.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),p=ta(r,i);return{description:s,secondaryDescription:p}}function Kn(o){let t=o.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",i=t.accountType||"",s=o.userDescription;s||(r&&e?s=`${r} ${ra(e)}`:r?s=r:s="Bank Account");let p=i?`${mo(i)} Account`:"";return{description:s,secondaryDescription:p}}function jn(o){let t=o.paymentInstrumentType,e=mo(t.replace(/_/g," "));return{description:o.userDescription||e}}var Gn={[mt.PaymentInstrumentType.CARD]:zn,[mt.PaymentInstrumentType.PAYPAL_VAULTED]:Bn,[mt.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:Fn,[mt.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:Kn};function Mr(o){try{let t=Gn[o.paymentInstrumentType];return t?t(o):jn(o)}catch(t){return w.error("FormatUtils",`Error formatting payment method ${o.id}:`,t),{description:o.userDescription||o.id||"Payment Method"}}}var oa=g`
|
|
1598
1598
|
:host {
|
|
1599
1599
|
display: block;
|
|
1600
1600
|
width: 100%;
|
|
@@ -1624,7 +1624,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1624
1624
|
width: 100%;
|
|
1625
1625
|
z-index: 1;
|
|
1626
1626
|
}
|
|
1627
|
-
`;var
|
|
1627
|
+
`;var pe=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage=""}handleToggleEditMode(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=P("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(e){this.errorMessage=e instanceof Error?e.message:P("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(e){let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:P("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(i=>i.id===e);if(!r)return"";try{return Mr(r).description||""}catch{return""}}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return m`
|
|
1628
1628
|
<div class="delete-confirmation-container">
|
|
1629
1629
|
<primer-vault-delete-confirmation
|
|
1630
1630
|
.isDeleting=${this.isDeleting}
|
|
@@ -1670,7 +1670,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1670
1670
|
`,()=>u)}
|
|
1671
1671
|
</div>
|
|
1672
1672
|
</div>
|
|
1673
|
-
`}};
|
|
1673
|
+
`}};pe.styles=[_,oa],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],pe.prototype,"vaultManagerContext",2),n([k()],pe.prototype,"isEditMode",2),n([k()],pe.prototype,"deletePaymentMethodId",2),n([k()],pe.prototype,"isDeleting",2),n([k()],pe.prototype,"errorMessage",2),pe=n([v("primer-vault-manager"),L()],pe);var ia=Dr(Ar(),1);function aa(o){return o.paymentInstrumentType===ia.PaymentInstrumentType.CARD}var na=g`
|
|
1674
1674
|
:host {
|
|
1675
1675
|
display: flex;
|
|
1676
1676
|
width: 100%;
|
|
@@ -1788,7 +1788,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1788
1788
|
.delete-button primer-icon {
|
|
1789
1789
|
color: var(--primer-color-red-500);
|
|
1790
1790
|
}
|
|
1791
|
-
`;var me=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new V(this,{task:async([e,r,i])=>{if(!e||!r||!i)return
|
|
1791
|
+
`;var me=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new V(this,{task:async([e,r,i])=>{if(!e||!r||!i)return N;let s="";if(aa(e))s=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let h=await r.getCDNAssets(e.paymentMethodType);h&&(s=h.assets?.icon?`${h.goatCdnUrl}/${h.assets.icon}`:"")}let p=i.cvvRecapture,x=Mr(e);return{icon:s,shouldShowCVV:p,...x}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let e=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!e&&e.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(e){let r=e.icon?m`<img
|
|
1792
1792
|
class="payment-method-icon"
|
|
1793
1793
|
src=${e.icon}
|
|
1794
1794
|
alt=${e.description}
|
|
@@ -1832,7 +1832,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1832
1832
|
.paymentMethod="${this.paymentMethod}"
|
|
1833
1833
|
></primer-vault-cvv-input>`)}
|
|
1834
1834
|
</div>
|
|
1835
|
-
`}})}};me.styles=[
|
|
1835
|
+
`}})}};me.styles=[_,na],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],me.prototype,"vaultManagerContext",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],me.prototype,"vaultItemContext",2),n([C({context:q,subscribe:!0}),d({type:Object})],me.prototype,"headlessUtils",2),n([d({type:Object,attribute:!1})],me.prototype,"paymentMethod",2),n([d({type:Boolean,reflect:!0})],me.prototype,"isEditMode",2),me=n([v("primer-vault-payment-method-item"),L()],me);var sa=g`
|
|
1836
1836
|
:host {
|
|
1837
1837
|
display: block;
|
|
1838
1838
|
width: 100%;
|
|
@@ -1876,7 +1876,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1876
1876
|
</primer-button>
|
|
1877
1877
|
`:u}
|
|
1878
1878
|
</div>
|
|
1879
|
-
`}};He.styles=[
|
|
1879
|
+
`}};He.styles=[_,sa],n([d({type:Boolean})],He.prototype,"isEditMode",2),n([d({type:Boolean})],He.prototype,"hasPaymentMethods",2),He=n([v("primer-vault-manager-header"),L()],He);var la=g`
|
|
1880
1880
|
:host {
|
|
1881
1881
|
display: block;
|
|
1882
1882
|
width: 100%;
|
|
@@ -1969,7 +1969,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1969
1969
|
</button>
|
|
1970
1970
|
</div>
|
|
1971
1971
|
</div>
|
|
1972
|
-
`}};fe.styles=[
|
|
1972
|
+
`}};fe.styles=[_,la],n([d({type:Boolean})],fe.prototype,"isDeleting",2),n([d({type:String})],fe.prototype,"paymentMethodId",2),n([d({type:String})],fe.prototype,"paymentMethodName",2),n([C({context:W,subscribe:!0})],fe.prototype,"vaultManager",2),fe=n([v("primer-vault-delete-confirmation"),L()],fe);var da=g`
|
|
1973
1973
|
:host {
|
|
1974
1974
|
display: block;
|
|
1975
1975
|
width: 100%;
|
|
@@ -1990,7 +1990,7 @@ primer-checkout.primer-dark-theme {
|
|
|
1990
1990
|
${P("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
1991
1991
|
</p>
|
|
1992
1992
|
</div>
|
|
1993
|
-
`}};ut.styles=[
|
|
1993
|
+
`}};ut.styles=[_,da],ut=n([v("primer-vault-empty-state"),L()],ut);var ca=g`
|
|
1994
1994
|
:host {
|
|
1995
1995
|
display: block;
|
|
1996
1996
|
width: 100%;
|
|
@@ -2053,7 +2053,7 @@ primer-checkout.primer-dark-theme {
|
|
|
2053
2053
|
<primer-icon name="close" size="sm"></primer-icon>
|
|
2054
2054
|
</button>
|
|
2055
2055
|
</div>
|
|
2056
|
-
`}};Ze.styles=[
|
|
2056
|
+
`}};Ze.styles=[_,ca],n([d({type:String})],Ze.prototype,"errorMessage",2),Ze=n([v("primer-vault-error-message"),L()],Ze);var pa=g`
|
|
2057
2057
|
:host {
|
|
2058
2058
|
display: contents;
|
|
2059
2059
|
}
|
|
@@ -2068,7 +2068,7 @@ primer-checkout.primer-dark-theme {
|
|
|
2068
2068
|
>
|
|
2069
2069
|
${this.buttonText}${r}
|
|
2070
2070
|
</primer-button>
|
|
2071
|
-
`}};X.styles=[
|
|
2071
|
+
`}};X.styles=[_,pa],n([d({type:String})],X.prototype,"buttonText",1),n([C({context:q,subscribe:!0}),d({type:Object})],X.prototype,"headlessInstance",2),n([C({context:j,subscribe:!0}),d()],X.prototype,"sdkState",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],X.prototype,"vaultItemContext",2),n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],X.prototype,"vaultManager",2),n([C({context:ot,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],X.prototype,"clientOptions",2),n([d({type:String})],X.prototype,"variant",2),n([d({type:Boolean})],X.prototype,"disabled",2),X=n([v("primer-vault-payment-submit"),L()],X);var ma=g`
|
|
2072
2072
|
:host {
|
|
2073
2073
|
display: block;
|
|
2074
2074
|
margin-top: var(--primer-space-medium);
|
|
@@ -2077,7 +2077,7 @@ primer-checkout.primer-dark-theme {
|
|
|
2077
2077
|
.cvv-input-container {
|
|
2078
2078
|
margin-bottom: var(--primer-space-medium);
|
|
2079
2079
|
}
|
|
2080
|
-
`;var J=class extends f{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new V(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===void 0?
|
|
2080
|
+
`;var J=class extends f{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new V(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===void 0?N:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new V(this,{task:async([e])=>{if(!e)return N;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let i=yr(this.computedStyles),s=i?{input:{base:i}}:void 0,p={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:s};this.cvvInput=await e.createCvvInput(p),this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>u,complete:()=>m`
|
|
2081
2081
|
<div class="cvv-input-container">
|
|
2082
2082
|
<primer-input-wrapper
|
|
2083
2083
|
.hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
|
|
@@ -2091,7 +2091,7 @@ primer-checkout.primer-dark-theme {
|
|
|
2091
2091
|
`)}
|
|
2092
2092
|
</primer-input-wrapper>
|
|
2093
2093
|
</div>
|
|
2094
|
-
`})}};J.styles=[
|
|
2094
|
+
`})}};J.styles=[_,ma],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],J.prototype,"vaultManagerFormContext",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1})],J.prototype,"vaultManagerCvvContext",2),n([C({context:Pe,subscribe:!0}),d()],J.prototype,"computedStyles",2),n([d({type:Object})],J.prototype,"paymentMethod",2),n([k()],J.prototype,"cvvError",2),n([k()],J.prototype,"cvvInputIsDirty",2),n([k()],J.prototype,"cvvInputIsBlurred",2),n([k()],J.prototype,"cvvInput",2),J=n([v("primer-vault-cvv-input"),L()],J);var ua=g`
|
|
2095
2095
|
:host {
|
|
2096
2096
|
display: block;
|
|
2097
2097
|
margin-top: var(--primer-space-medium);
|
|
@@ -2124,14 +2124,14 @@ primer-checkout.primer-dark-theme {
|
|
|
2124
2124
|
</div>
|
|
2125
2125
|
</primer-collapsable>
|
|
2126
2126
|
</div>
|
|
2127
|
-
`}};Ye.styles=[
|
|
2127
|
+
`}};Ye.styles=[ua],n([k()],Ye.prototype,"isShowingOtherPayments",2),n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],Ye.prototype,"vaultManager",2),Ye=n([v("primer-show-other-payments")],Ye);var Ht=class extends f{render(){return m`
|
|
2128
2128
|
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
2129
2129
|
`}};Ht=n([v("primer-checkout-complete")],Ht);var ht=class extends f{constructor(){super(...arguments);this.sdkState=null}render(){return m`
|
|
2130
2130
|
<primer-checkout-state
|
|
2131
2131
|
type="failure"
|
|
2132
2132
|
description=${this.sdkState?.error?.message||""}
|
|
2133
2133
|
></primer-checkout-state>
|
|
2134
|
-
`}};n([C({context:j,subscribe:!0}),d()],ht.prototype,"sdkState",2),ht=n([v("primer-checkout-error")],ht);var
|
|
2134
|
+
`}};n([C({context:j,subscribe:!0}),d()],ht.prototype,"sdkState",2),ht=n([v("primer-checkout-error")],ht);var ha=g`
|
|
2135
2135
|
:host {
|
|
2136
2136
|
display: block;
|
|
2137
2137
|
width: 100%;
|
|
@@ -2141,7 +2141,7 @@ primer-checkout.primer-dark-theme {
|
|
|
2141
2141
|
message="${P(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
2142
2142
|
?visible="${this.shouldShowError}"
|
|
2143
2143
|
></primer-error-message>
|
|
2144
|
-
`:u}};Ue.styles=[
|
|
2144
|
+
`:u}};Ue.styles=[ha],n([C({context:j,subscribe:!0}),k()],Ue.prototype,"sdkState",2),n([d({type:Boolean,attribute:"show-processing-errors"})],Ue.prototype,"showProcessingErrors",2),Ue=n([v("primer-error-message-container")],Ue);async function Ix(){_i(),Pi()}export{ne as Button,Se as CardForm,dt as CardFormCVV,le as CardFormCardNetworkSelector,lt as CardFormCardNumber,Re as CardFormError,ct as CardFormExpiry,pt as CardFormName,se as CardFormSubmit,re as Collapsable,he as ErrorMessage,Ue as ErrorMessageContainer,ur as InitializedPayments,Y as Input,Ne as InputLabel,Ce as InputWrapper,Me as NativePayment,De as PaymentMethod,Ht as PrimerCheckoutComplete,ae as PrimerCheckoutComponent,ht as PrimerCheckoutFailure,Oe as PrimerCheckoutState,Ae as PrimerIcon,Z as PrimerKlarna,$e as PrimerMain,ge as RedirectPayment,Ye as ShowOtherPayments,xe as Spinner,J as VaultCvvInput,fe as VaultDeleteConfirmation,ut as VaultEmptyState,Ze as VaultErrorMessage,pe as VaultManager,He as VaultManagerHeader,me as VaultPaymentMethodItem,X as VaultPaymentSubmit,Nn as injectDarkTheme,Ln as injectLightTheme,_i as injectLoaderStyles,Pi as injectThemeStyles,Ix as loadPrimer};
|
|
2145
2145
|
/*! Bundled license information:
|
|
2146
2146
|
|
|
2147
2147
|
@lit/context/lib/context-request-event.js:
|