1import{u as e,i as n,T as i,S as t,q as a,h as r,e as o,o as s,f as c,A as l,D as d,g as u,k as m,a as h,_ as p,l as g}from"./2c1ab0fe.D_oO1jU7.js";import{ae as f,O as _,bx as y,f2 as v,f3 as b,f4 as k,f5 as S,A as w,f6 as R,eR as L,f7 as P,f8 as I,P as E,e9 as U,f9 as D,eM as A,da as C,fa as T,eN as O,ar as x,fb as z,fc as j,fd as q,ce as F}from"./4c290a1e.D9lE9kmU.js";import{u as B,a as M,S as N}from"./8c0eaf27.CL21dRLp.js";import{u as V,U as W}from"./a25deb9a.XIOr6b3K.js";import{L as H,B as $,fa as K,fm as G,b as J,bg as X,h as Q,fn as Y,fo as Z,fp as ee,eP as ne,a2 as ie,t as te,fq as ae,bm as re,aR as oe,c as se,ac as ce,eO as le,bq as de,N as ue,O as me,m as he,e as pe}from"./164ad2e3.DgUUtBtV.js";import{c as ge}from"./dfca5da5.H1thSL3M.js";import{R as fe,D as _e,c as ye,d as ve,u as be,a as ke,p as Se,S as we,b as Re}from"./cb8fcd45.gqoNFKgG.js";import{R as Le,n as Pe,i as Ie,a as Ee,s as Ue}from"./945a08d6.DUn1GrN-.js";import{g as De}from"./d5d34b3b.HJgnljYP.js";import{MobileOrderSummary as Ae}from"./d2e6a587.DdUzoAUU.js";import{u as Ce,S as Te}from"./ca5e9c49.BL-l7mUG.js";import"./app.bDJ3v-8C.js";import"./e39bc11c.BNw-kv3c.js";import"./65f3d4da.8ZfwXSRH.js";import"./60a453ce.BIyixFcg.js";import"./0a7dffce.BMM606kb.js";import"./bb728e1c.BObJOhlA.js";import"./7b0c98ea.0CGJF8wQ.js";import"./1ed8f5e3.Oin1LrS4.js";function Oe({isShopPayExternal:i}){const t=f();return i?null:e(n,{when:t,children:e(xe,{})})}function xe(){const{i18n:n}=_();return i((()=>{const e=""!==document.referrer,n=window.history&&window.history.length>1;return e||n}),[])?e($,{inlineAlignment:"center",children:e(H,{onClick:()=>{window.history.back()},accessibilityLabel:n.translate("account_management.back"),textDecoration:"none",children:n.translate("account_management.back")})}):null}function ze(){const{href:n,label:i,onClick:a}=K(G.Login);return e(t,{children:[e(J,{blockSize:"large-100"}),e($,{inlineAlignment:"center",children:e(H,{href:n,onClick:a,textDecoration:"none",children:i})})]})}function je({iframeOrigin:e,observability:n,onError:i,onLoaded:t,onLoggedIn:o,skip:s=!1}){const c=a((e=>{switch(e.action){case fe.Loaded:return t?.();case fe.Error:return i?.(e.message)}}),[t,i]);r((()=>{if(s)return;const t=t=>{if((a=t.origin)!==e&&!ve.includes(a))return;var a;const{data:r}=t;if((e=>e&&"object"==typeof e&&"redirect_url_on_complete"===e.type&&e.postSignInUrl)(r))try{const e=new URL(r.postSignInUrl).searchParams.get("token");e&&o?.(e)}catch{i?.("shop_pay_embedded_login_url_parse_error"),n?.log("shop_pay_embedded_login_url_parse_error","Failed to parse redirect URL")}else if((e=>e&&"string"==typeof e&&e.includes(_e))(r))try{const[e,...n]=r.split(_e);if(e!==ye)return;const i=JSON.parse(n.join(_e));c(i)}catch{i?.("shop_pay_embedded_login_event_error"),n?.log("shop_pay_embedded_login_event_error","Failed to parse event")}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}),[o,n,e,i,c,s])}var qe=(e=>(e.Seamless="seamless",e.OAuth="oauth",e.OAuthWithEmbeddedContext="oauthWithEmbeddedContext",e.Embedded="embedded",e))(qe||{});function Fe(){const{shop:e,shopPay:n,embed:i,mobileCheckoutSdk:t}=_(),a=t.enabled||i?.isCheckoutKit();return y(i?.embedder)?"embedded":i?.isFlagshipPartner||v(n)?"seamless":b(n)||a&&e.hasFlagEnabled(k)?"embedded":a&&e.hasFlagEnabled(S)?"oauthWithEmbeddedContext":a?"seamless":"oauth"}function Be(e,n,i){return Boolean(e?.isFlagshipPartner)||i&&R(n)}function Me(){const e=function(){const{checkout:e}=_(),n=function(){const e=o(!1);return s((()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia("(prefers-color-scheme: dark)");e.value=n.matches;const i=n=>{e.value=n.matches};return"function"==typeof n.addEventListener?(n.addEventListener("change",i),()=>n.removeEventListener("change",i)):void 0})),e}();return c((()=>{const{customProperties:i,darkModeCustomProperties:t}=e.configuration.branding.theme,a=function({customProperties:e}){return e?.color?.schemes?.scheme1?.base?.background}({customProperties:n.value&&t.value||i.value});if("undefined"!=typeof document&&"undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=De(document.body);if(Le.test(e))return e}return a}))}();return c((()=>{const n=Pe(e.value??"rgba(255, 255, 255, 1)");
1return{isDark:Ie(n,"rgb(255, 255, 255)"),parentBackgroundColor:n}}))}function Ne(){const e=Me();return l(e.peek()).current}function Ve(e){const n=l("");return!n.current&&L(e)&&(n.current=e),n.current}const We=(e="")=>{const{client:n,shopPay:t,environment:a,i18n:{locale:r},shop:o,source:{checkoutSessionIdentifier:s},embed:c,checkout:{proposal:{proposed:l}}}=_(),d=o.hasFlagEnabled(P),u=Be(c,t,d),m=Ve(l.email.value),h=d?m:l.email.value,p=I(n.initialRequest.url),g=E().buyerIdentity.value?.customerProfile,f=t.signup.skipAutomaticLoginAttempt.value,y=X({include:{shopId:!0}}),{parentBackgroundColor:v,isDark:k}=Ne();return i((()=>{if(!s)return{origin:"c1_login",frameUrl:"",flow:"pay_checkout_login"};const{origin:i,flowVersion:l}=function(e){return b(e)?{origin:U.PaymentRequest,flowVersion:"iframe"}:{origin:"c1_login",flowVersion:"iframe"}}(t),d=new URLSearchParams(n.initialRequest.url.search),m=new URLSearchParams;m.set("locale",r),m.set("analytics_trace_id",e),m.set("origin",i),m.set("checkout_token",s),m.set("flow","pay_checkout_login"),m.set("flow_version",l??""),m.set("authentication_level","phone"),m.set("target_origin",window.location.origin),m.set("storefront_domain",o.domain),m.set("layout","full"),k&&m.set("theme","dark"),v&&m.set("parent_background_color",v),p&&(m.set("force_authentication","true"),m.set("prompt","login"));const _=d.get("login_hint");_?m.set("login_hint",_):u&&h&&!p&&!f?m.set("login_hint",h):!f&&g?.email&&m.set("login_hint",g.email);const S=d.get("shop_client_uuid")??c?.shopClientUuid??d.get("client_uuid");S&&m.set("client_uuid",S),y(m,d);const w=new URL("/accounts/login/embedded",a.services.shopServer.url);return w.search=m.toString(),{origin:i,frameUrl:w.href,flow:"pay_checkout_login"}}),[e,k,v,s,n.initialRequest.url.search,g?.email,a.services.shopServer.url,p,r,c?.shopClientUuid,y,o.domain,h,t,f,u])};function He({analyticsTraceId:e,loginData:n}){const{progress:i}=Q(),{shopPay:t,observability:r}=_(),{config:o,updateAccessToken:s}=t,{exchangeSessionTokenForCookie:c}=be(),{extendBuyerIdentity:l}=ke(),{checkoutAsGuestUrl:d}=o,{replaceShopPayInHistory:u}=D(),{flow:m,origin:h}=n;return a((async(n,a)=>{if(a)s(a);else if(n){const i=await c({token:n,origin:h,analytics_trace_id:e,flow:m});i.ok||(r.log("shop_pay_login_frame_session_token_exchange_failed","exchangeSessionTokenForCookie request failed",{status:i.status}),i.status>=500&&u(d))}await l(),t.signup.unstable_setSkipAutomaticLoginAttempt(!1),i("shop-pay-login-success")}),[i,s,c,h,m,e,l,d,u,r,t.signup])}const $e="vUvXb",Ke="WC8Ph",Ge="oX06g",Je=d((function({title:n,src:i,height:t,hidden:a=!1,onLoad:r,className:o,allow:s=Xe()},c){return e("iframe",{ref:c,id:Z,title:n,src:i,onLoad:r,height:t,width:Y,className:u("_5Z70J",{[$e]:a},o),"aria-hidden":!!a||void 0,allow:s})}));function Xe(){return ee}function Qe({hidden:n=!1,iframeLoaded:s=!1,loginData:c,onIframeLoad:d,renderListeners:u,serverDrivenAuth:h,serverRenderedIframe:p=!1}){const g=o(!1),{client:f,environment:y,i18n:v,observability:b,shop:k,shopPay:S}=_(),w=l(null),L=Fe(),{frameUrl:I}=c,E=Boolean(I),U=!(s||g.value);B(U);const D=i((()=>{try{return new URL(I).origin}catch{return""}}),[I]),A=R(S);let C="empty";D===y.services.shopServer.url?C="shop_server":D===y.services.payShopifyCom.url?C="pay_shopify":D&&(C="merchant_storefront"),function({frameUrl:e,loginVariant:n,sdkLoginHintFlagEnabled:i,shopPaySdkCheckout:t}){const{checkout:a,client:o,observability:s}=_(),c=Boolean(e),l=function(e){try{return new URL(e).searchParams.has("login_hint")}catch{return!1}}(e),d=Boolean(a.proposal.proposed.email.value),u=new URLSearchParams(o.initialRequest.url.search).has("login_hint");r((()=>{c&&s.counter({name:"shop_pay_login_hint",value:1,attributes:{checkoutUrlHint:u,loginHintSent:l,loginVariant:n,proposedEmailAvailable:d,sdkLoginHintFlagEnabled:i,shopPaySdkCheckout:t}})}),[u,c,l,n,s,d,i,t])}({frameUrl:I,loginVariant:L,sdkLoginHintFlagEnabled:k.hasFlagEnabled(P),shopPaySdkCheckout:A});const T={serverDrivenAuth:h,hidden:n,shopPaySdkCheckout:A,serverRendered:f.initialRequest.isServerRendered,serverRenderedIframe:p,loginVariant:L};ne({enabled:E&&U,onTimeout:e=>{const n={timeout:e,...T,frameHostKind:C,documentReadyState:document.readyState};b.counter({name:"shop_pay_login_frame_load_timeout",value:1,exportImmediately:!0,attributes:n}
1),b.log("shop_pay_login_frame_load_timeout","Shop Pay login iframe never fired its load event",{...n,iframeOrigin:D},{exportImmediately:!0})}}),ne({enabled:!E,onTimeout:e=>{const n={timeout:e,...T,documentReadyState:document.readyState};b.counter({name:"shop_pay_login_frame_url_missing",value:1,exportImmediately:!0,attributes:n}),b.log("shop_pay_login_frame_url_missing","Shop Pay login frame never received a URL",n,{exportImmediately:!0})}});const O=h?370:250,[x,z]=m(O),j=a((e=>{z(e)}),[]),q=a((()=>{g.value=!0,d?.()}),[g,d]);return I?e(t,{children:[u?.({iframeOrigin:D,iframeRef:w,onResized:j}),e(Je,{ref:w,title:v.translate("verification.title"),src:I,onLoad:q,height:x,hidden:n})]}):null}function Ye({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:i=!1}){const t=ie(),r=Me(),o=i&&n?n:window.location.origin;return{dispatchThemeMessage:a((()=>{if(!e.current?.contentWindow)return;const{isDark:n,parentBackgroundColor:i}=r.value,t={theme:n?"dark":"light",type:"theme"};i&&(t.parentBackgroundColor=i),e.current.contentWindow.postMessage(t,o)}),[e,r,o]),dispatchStyleMessage:a((()=>{if(!e.current?.contentWindow)return;const n=function(e){return en(Object.fromEntries(Object.entries(e).filter((([e])=>Ze(e)))),C)}(t.customProperties.value);!function(e,n,i){const t=A(),a=C.borderRadius.base,r=C.borderRadius.large,o=C.control.borderRadius,s=n=>t||!e[n],c=n.configuration.cornerRadius.base?`${n.configuration.cornerRadius.base}px`:te.borderRadius.base,l=n.configuration.primaryButton.cornerRadius;let d=te.borderRadius.base;"none"===l?d="0px":l&&(d=te.borderRadius[l]??te.borderRadius.base),s(a)&&(e[a]=c),i?e[r]=te.borderRadius.base:s(r)&&(e[r]=d),e[o]||(e[o]=te.borderRadius.base)}(n,t,i),e.current.contentWindow.postMessage({type:"style",style:nn(n)},o)}),[e,t,o,i]),resolvedParentBackground:r}}const Ze=e=>["borderRadius","control"].includes(e);function en(e,n){const i=Object.entries(e).flatMap((([e,i])=>"object"!=typeof i||Array.isArray(i)||null==i?null!=n[e]&&null!=i?[[n[e],i]]:[]:n[e]?Object.entries(en(i,n[e])):[]));return Object.fromEntries(i)}const nn=e=>Object.entries(e).map((([e,n])=>`${e}: ${n};`)).join("");function tn({iframeRef:e,iframeOrigin:n,onLoggedIn:i}){const{checkout:t,observability:o}=_(),{isEmbeddedShopPayTheme:s}=t.configuration.branding,{dispatchThemeMessage:c,dispatchStyleMessage:l,resolvedParentBackground:d}=Ye({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:s}),u=d.value,m=a((()=>{c(),l()}),[c,l]);return r((()=>{c()}),[c,u]),je({iframeOrigin:n,observability:o,onLoaded:m,onLoggedIn:i}),null}function an({analyticsTraceId:n,...i}){const t=We(n),a=He({analyticsTraceId:n,loginData:t});return e(Qe,{...i,loginData:t,renderListeners:({iframeOrigin:n,iframeRef:i})=>e(tn,{iframeRef:i,iframeOrigin:n,onLoggedIn:a}),serverDrivenAuth:!0})}const rn="c1_login",on="pay_checkout_login";function sn(){return{origin:rn,frameUrl:"",flow:on}}function cn(e="",{includeEmbeddedContext:n=!1}={}){const{client:t,embed:a,shopPay:r,i18n:{locale:o},shop:s,source:{checkoutSessionIdentifier:c,sourceId:l},checkout:{proposal:{proposed:d}}}=_(),{config:u,signup:m}=r,h=s.hasFlagEnabled(P),p=Ve(d.email.value),g=h?p:d.email.value,f=Be(a,r,h),y=I(t.initialRequest.url),v=E().buyerIdentity.value?.customerProfile,b=ae(),k=m.skipAutomaticLoginAttempt.value,{redirectUrl:S}=u,w=X({include:{shopId:!0}}),{parentBackgroundColor:R,isDark:L}=Ne(),U=n?w:void 0,D=n?a?.shopClientUuid:void 0,A=n?void 0:b,C=t.unstable_getSerialization("shopPayLoginOAuthState"),T=i((()=>C??function(){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,(e=>e.toString(36))).join("")}()),[C]);return i((()=>{if(!c)return sn();const n=new URLSearchParams;!function(e,{analyticsTraceId:n,checkoutSessionIdentifier:i,domain:t,locale:a,oAuthState:r,sourceId:o}){e.set("client_id",""),e.set("redirect_uri",`https://${t}/services/login_with_shop/callback`),e.set("scope","openid email profile"),e.set("response_type","code"),e.set("state",r),e.set("storefront_domain",t),e.set("locale",a),e.set("analytics_trace_id",n),e.set("origin",rn),e.set("checkout_token",i),e.set("checkout_source_id",o),e.set("flow",on),e.set("target_origin",`https://${t}`),e.set("ux_mode","iframe"),e.set("layout","full")}(n,{analyticsTraceId:e,checkoutSessionIdentifier:c,domain:s.domain,locale:o,oAuthState:T,sourceId:l}),void 0!==A&&n.set("shop_id",String(A)),L&&n.set("theme","dark"),R&&n.set("parent_background_color",R),S&&n.set("checkout_redirect_url",S),y&&(n.set("force_authentication","true"),n.set("prompt","login")),u.transactionParams&&n.set("transaction_params",u.transactionParams);const i=new URLSearchParams(t.initialRequest.url.search),a=i.get("login_hint");a?n.set("login_hint",a):f&&g&&!y&&!k?n.set("login_hint",g):!k&&v?.email&&n.set("login_hint",v.email);const r=function(e,n){return e.get("shop_client_uuid")??n??e.get("client_uuid")}(i,D);r&&n.set("client_uuid",r),U?.(n,i);
1try{const e=new URL("/services/login_with_shop/authorize",`https://${s.domain}`);return e.search=n.toString(),{origin:rn,frameUrl:e.href,flow:on}}catch{return sn()}}),[u.transactionParams,e,U,c,t.initialRequest.url.search,f,v?.email,s.domain,D,y,g,L,R,o,A,S,k,T,l])}const ln=(e="")=>cn(e,{includeEmbeddedContext:!0});function dn({analyticsTraceId:n,...i}){const t=ln(n),a=He({analyticsTraceId:n,loginData:t});return e(Qe,{...i,loginData:t,renderListeners:({iframeOrigin:n,iframeRef:i})=>e(tn,{iframeRef:i,iframeOrigin:n,onLoggedIn:a}),serverDrivenAuth:!0})}const un=(e="")=>cn(e);function mn({iframeRef:e}){const{checkout:n,environment:i,observability:t,router:a,source:o}=_(),{replaceShopPayInHistory:s}=D(),c=new URL(i.services.shopServer.url).origin,d=o.checkoutSessionIdentifier,u=l(!1);return r((()=>{const i=({data:i,origin:r,source:o})=>{if(u.current||r!==c||!e.current?.contentWindow||o!==e.current.contentWindow||!i||"object"!=typeof i||!("type"in i)||"pay_guest_session_ready"!==i.type)return;const l=new URL(window.location.href);T(l.pathname)&&(u.current=!0,t.counter({name:"guest_handoff_received",value:1,exportImmediately:!0,requiresKeepalive:!0}),t.log("guest_handoff_received","Shop Pay guest handoff received",{checkoutToken:d},{exportImmediately:!0,requiresKeepalive:!0}),l.pathname=a.resolve("/shoppay").pathname,n.unstable_setRedirectingExternally(!0),setTimeout((()=>s(l.toString())),0))};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)}),[n,d,e,t,s,a,c]),null}function hn({analyticsTraceId:n,hidden:i,iframeLoaded:t,onIframeLoad:a,serverRenderedIframe:r}){const o=un(n);return e(Qe,{hidden:i,iframeLoaded:t,loginData:o,onIframeLoad:a,renderListeners:({iframeRef:n})=>e(mn,{iframeRef:n}),serverDrivenAuth:!0,serverRenderedIframe:r})}var pn=(e=>(e.Partner="sdk_partner",e.Merchant="sdk_merchant",e))(pn||{});const gn=(e="")=>{const{client:n,shopPay:t,embed:a,environment:r,i18n:{locale:o},observability:s,shop:c,source:{checkoutSessionIdentifier:l},mobileCheckoutSdk:d,checkout:{proposal:{proposed:u}}}=_(),m=c.hasFlagEnabled(P),h=Ve(u.email.value),p=m?h:u.email.value,{config:g}=t,f=I(n.initialRequest.url),{transactionParams:y,tokens:v}=g,k=E().buyerIdentity.value?.customerProfile,S=re().value,w=Ee(),R=V(),L=r.services.payShopifyCom.url,D=n.unstable_getSerialization("shopClientUuid"),A=X({include:{shopId:!0}}),C=Boolean(a?.isFlagshipPartner),T=Be(a,t,m),x=a?.shopClientUuid,z=t.signup.skipAutomaticLoginAttempt.value;return i((()=>{if(!l)throw new O({groupingHash:"ShopPayCheckoutIdentifierMissingError::LoginFrame"});const{origin:i,flowVersion:a,flow:r}=function(e){return b(e)?{origin:U.PaymentRequest,flowVersion:e.flowVersion,flow:"payment_request"}:{origin:"c1_login",flowVersion:void 0,flow:void 0}}(t),u=a??(C?"iframe":void 0),m=new URLSearchParams(n.initialRequest.url.search),h=fn(m,"shop_client_uuid")??x??fn(m,"client_uuid")??D;C&&!h&&s.log("shop_pay_login_seamless_missing_client_uuid","[ShopPayLoginFrame] Embedded checkout missing shop_client_uuid for Login Seamless.");const g=new URLSearchParams({flow:r??"",locale:o,origin:i,isPointOfSale:String(S),transaction_params:y??"",flow_version:u??"",shopify_domain:c.myshopifyDomain,checkout_token:l,analytics_trace_id:e,shop_pay_button_variant:t.logoBrand,shop_pay_new_signup_login_variant:R});h&&g.set("client_uuid",h);const _=m.get("login_hint");_?g.set("login_hint",_):T&&p&&!f&&!z&&g.set("login_hint",p),!z&&k?.email&&g.set("storefront_account_email",k.email),w&&g.set(Ue,d.variant.isPartner()?pn.Partner:pn.Merchant),f||g.set("authorization",v.authorization??""),A(g,m);const P=new URL("/pay/authentication/login-seamless",L);return P.search=g.toString(),{origin:i,frameUrl:P.href}}),[e,A,n.initialRequest.url.search,v,l,k?.email,f,L,w,C,S,o,c.myshopifyDomain,d,x,p,D,t,R,T,z,s,y])};function fn(e,n){return e.get(n)||void 0}function _n({iframeRef:e,iframeOrigin:n,onLoggedIn:i,onResized:t}){const{checkout:o,shopPay:s}=_(),{isEmbeddedShopPayTheme:c}=o.configuration.branding,{dispatchThemeMessage:l,dispatchStyleMessage:d,resolvedParentBackground:u}=Ye({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:c}),m=u.value,h=a((()=>{Se(e.current,{action:we.Ready}),e.current?.contentDocument?.body&&oe(e.current.contentDocument.body)?.focu
1s(),c&&(l(),d())}),[l,d,e,c]);r((()=>{c&&l()}),[l,c,m]);const p=a((e=>{s.signup.unstable_setHcaptchaToken(e)}),[s.signup]);return Re({onLoaded:h,onLoggedIn:i,onResized:t,onShareCaptchaToken:p}),null}function yn({analyticsTraceId:n,...i}){const t=gn(n),a=He({analyticsTraceId:n,loginData:t});return e(Qe,{...i,loginData:t,renderListeners:({iframeOrigin:n,iframeRef:i,onResized:t})=>e(_n,{iframeRef:i,iframeOrigin:n,onLoggedIn:a,onResized:t}),serverDrivenAuth:!1})}function vn({serverRenderedIframe:n,...t}){const{client:a}=_(),r=Fe(),o=a.unstable_getSerialization("shopPayLoginAnalyticsTraceId"),s=i((()=>o??w()),[o]);switch(r){case qe.OAuth:return e(hn,{...t,analyticsTraceId:s,serverRenderedIframe:n});case qe.OAuthWithEmbeddedContext:return e(dn,{...t,analyticsTraceId:s});case qe.Embedded:return e(an,{...t,analyticsTraceId:s});case qe.Seamless:return e(yn,{...t,analyticsTraceId:s});default:return h(r)}}function bn({className:n}){const{i18n:i}=_(),t=i.translate("general.loading");return e($,{accessibilityRole:"status",accessibilityLabel:t,"aria-live":"polite",className:n,children:e(se,{blockSize:"100%",padding:"large-200",gap:"large-100",children:[e(se,{alignItems:"center",gap:"large-100",children:[e(ce,{delay:!1,contentDisplay:"block",inlineSize:"92px",blockSize:"32px"}),e(ce,{delay:!1,contentDisplay:"block",inlineSize:"50%",blockSize:"16px"})]}),e(se,{gap:"small-400",children:e(ce,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"})}),e(ce,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"}),e($,{paddingBlockStart:"large-200",children:e(se,{alignItems:"center",gap:"large-400",children:[e(ce,{delay:!1,contentDisplay:"block",inlineSize:"34%",blockSize:"14px"}),e(ce,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"14px"})]})})]})})}function kn({serverRenderedIframe:n=!1}={}){const{client:i,environment:t,observability:r}=_(),s=t.services.shopServer.url,c=i.unstable_legacyNavigationPerformance,l=f(),d=o(!1),m=o(n&&!l.peek()),h=m.value,g=l.value||h,y=d.value,v=!y,b=c?.navigationStartTime??0,k=i.initialRequest.isServerRendered,S=a(((e,n)=>{r.histogram({name:"shop_pay_login_form_visible_duration",value:Math.round(e-b),unit:"ms",attributes:{serverRendered:k,serverRenderedIframe:m.value,revealSource:n}})}),[b,r,k,m]),w=a(((e,n=performance.now())=>{d.value||(d.value=!0,S(n,e))}),[d,S]),R=a((()=>{w("iframe_load")}),[w]),L=a((()=>{w("login_message")}),[w]);return je({iframeOrigin:s,observability:r,onLoaded:L,skip:!g}),p((()=>{if(!h||!l.value)return;const e=()=>{w("page_load_fallback")};if("complete"!==document.readyState)return window.addEventListener("load",e,{once:!0}),()=>{window.removeEventListener("load",e)};e()}),[l.value,h,w]),g?e("div",{className:u("K7GTB",{[Ke]:v}),children:[v&&e(bn,{className:Ge}),e(vn,{hidden:!y,iframeLoaded:d.value,onIframeLoad:R,serverRenderedIframe:h})]}):e(bn,{className:Ge})}function Sn(){const i=f(),{embed:t}=_();return y(t?.embedder)?e(n,{when:i,children:e(wn,{})}):null}function wn(){const{observability:e,source:n,embed:t,environment:a,url:o,shop:s}=_(),{iframeUrl:c,source:l}=function(e=""){const n={seamless:gn(e),embedded:We(e),oauth:un(e),oauthWithEmbeddedContext:ln(e)},t=Fe(),{serverDrivenAuth:a,variant:r}=(e=>{switch(e){case qe.OAuth:return{serverDrivenAuth:!0,variant:"oauth"};case qe.OAuthWithEmbeddedContext:return{serverDrivenAuth:!0,variant:"oauthWithEmbeddedContext"};case qe.Embedded:return{serverDrivenAuth:!0,variant:"embedded"};case qe.Seamless:default:return{serverDrivenAuth:!1,variant:"seamless"}}})(t),{frameUrl:o,origin:s,flow:c}=n[r];return{flow:c,iframeOrigin:i((()=>{try{return new URL(o).origin}catch{return""}}),[o]),serverDrivenAuth:a,source:s,iframeUrl:o,variant:r}}(),d=t?.client?.embedderHostname;return r((()=>{if(!y(t?.embedder)||!c||!d)return;const i=new URL(c);i.searchParams.set("target_origin",`https://${d}`),function(e,n){e&&y(e.embedder)&&e.client?.error({code:"UC_LOGIN_REQUIRED",message:JSON.stringify(n),severity:"recoverable",timestamp:Date.now()})}(t,{loginUrl:i.href,exchangeUrl:new URL(o.shopPaySession(),a.services.shopServer.url).href,origin:l,shopifyDomain:s.myshopifyDomain,checkoutToken:n.
1checkoutSessionIdentifier??void 0}),e.counter({name:"universal_checkout_shop_pay_login_required_emitted",value:1})}),[t,d,c,l,a.services.shopServer.url,o,s.myshopifyDomain,n.checkoutSessionIdentifier,e]),null}function Rn(){!function(){const{client:e,userEvents:n,source:i,checkout:t,shop:a,shopPay:o}=_(),{redirectSource:s,tracking:c}=o.config,{checkoutSessionIdentifier:l="checkout_identifier_undefined"}=i,d=le(z.SHOP_PAY_LOGIN),u=re().value;Ce({stage:Te.Complete,id:"ShopPayLogin"}),r((()=>{A()&&n.monorailEvent({schemaId:"shop_app_page_load/9.0",payload:{...x(i,t,a),platform:"web",locale:navigator.language,userToken:c.unique??e.cookies.get("_shopify_y")??"",webSessionToken:c.visit??e.cookies.get("_shopify_s")??"",pageType:"pay_checkout_login",pageValue:l}}),n.monorailEvent({schemaId:"shopify_pay_page_load/2.6",payload:{...x(i,t,a),pageType:"checkout_login",clientTimestampMs:Date.now(),redirectSource:s}}),u&&n.monorailEvent({schemaId:"retail_shop_pay/2.0",payload:d})}),[e.cookies,n,i,t,a,s,d,u,l,c.unique,c.visit])}();const{client:n,router:i,shop:t,source:a,shopPay:o}=_(),s="shopPayExternal"===a.type,c=Fe(),l=c===qe.Seamless,d=i.currentUrl.value,m=d.href===n.initialRequest.url.href&&n.initialRequest.isServerRendered&&c===qe.OAuth,{isAppLayout:h}=de(),p=t.hasFlagEnabled(j)&&!s&&!h&&!A(d.search)&&!o.config.isReferral&&!d.searchParams.has(q)&&!0===n.unstable_getSerialization("shopPayConfig").has_remember_me_cookie&&o.visibility.showCheckoutAsGuestFeature;return e("div",{children:[e(Sn,{}),e(ge,{padding:"none",dividerDisplay:"@media (inline-size >= medium) none, auto",children:e($,{padding:"@media (inline-size >= small) none none large-300 none, none",maxInlineSize:"@media (inline-size >= small) 425px, 432px",className:u("oSdnC"),children:e(ge,{padding:"none",borderWidth:l?"@media (inline-size >= small) base, none":void 0,borderRadius:l?"@media (inline-size >= small) base, none":void 0,hideDivider:!0,children:e(kn,{serverRenderedIframe:m})})})}),o.visibility.showUnauthedOrderSummary&&e(ue,{section:"summary",children:e(me,{section:"summary",children:e(he,{above:"small",children:e(ge,{hideDivider:!0,padding:"none none large-200 none",children:e(Ae,{})})})})}),p?e(ze,{}):e(Oe,{isShopPayExternal:s})]})}function Ln(){const{client:n,observability:i,shopPay:t}=_(),{shouldUseAccessToken:a,user:o}=t,s=I(n.initialRequest.url),l=V(),d=!!l&&W.includes(l),u=g(l),h=pe(),p=c((()=>"shopPayLogin"===h.value.currentDetour?.type)),f=M(),y=c((()=>f())),v=t.accessToken.value,{refetch:b}=F(N,{isOnShopPayLoginDetour:p,newSignupLoginVariant:u,simulatedBuyerDetails:y}),[k,S]=m(!1),w=!a||Boolean(v),R=o.email.value,L=d&&!s||Boolean(k&&R&&w),P=null==l||L;B(P);const E=n.unstable_legacyNavigationPerformance,{progress:U}=Q();return r((()=>{const e=t.session.initialization.peek();"failed"===e.status&&"fetch"===e.reason&&t.session.unstable_setInitialization({status:"pending"})}),[t.session]),r((()=>{v&&(s||(b(),S(!0)))}),[v,s,b]),r((()=>{L&&(E?.usable(),U("shop-pay-login-loader-complete"))}),[L,E,U]),ne({enabled:P,onTimeout:e=>{i.counter({name:"shop_pay_login_loader_loading_timeout",value:1}),i.log("shop_pay_login_loader_loading_timeout","ShopPayLoginLoader loading timeout",{timeout:e,variant:l,isUnauthenticatedVariant:d})}}),P?null:e(Rn,{})}export{Ln as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.