1import{u as e,w as n,T as t,S as i,q as r,h as a,o,p as s,k as c,g as l,D as d,m as u,z as m,G as h,_ as p,s as g}from"./2c1ab0fe.XVnTovwp.js";import{a8 as f,a as _,z as y,eG as v,eH as b,eI as k,eJ as S,eK as w,eC as R,eL as L,eM as I,ex as P,cU as E,eN as U,ey as D,al as A,eO as C,eP as T,eQ as O,bY as x}from"./f67abd2c.DYpmk7mw.js";import{u as j,a as z,S as q}from"./8c0eaf27.Cu8UiXXz.js";import{u as F,U as B}from"./a25deb9a.DX96HOu0.js";import{L as M,b as W,f8 as N,fe as V,d as H,br as K,r as $,ff as G,fg as J,fh as Q,eP as X,al as Y,X as Z,fi as ee,bF as ne,b7 as te,S as ie,at as re,eO as ae,bJ as oe,ae as se,af as ce,$ as le,j as de}from"./164ad2e3.hrg71Gqs.js";import{c as ue}from"./dfca5da5.DaUPQuNF.js";import{R as me,D as he,c as pe,d as ge,u as fe,a as _e,p as ye,S as ve,b as be}from"./91319467.Dwd85Qom.js";import{u as ke}from"./app.Bke-0Cv3.js";import{M as Se}from"./1d34c07e.h4dJAaCz.js";import{R as we,n as Re,i as Le,a as Ie,c as Pe}from"./1f5e7811.C2FDfyfw.js";import{g as Ee}from"./9ce08e25.yvYyG5Hw.js";import{u as Ue}from"./24773686.DHVsBc9s.js";import{MobileOrderSummary as De}from"./d2e6a587.BexYxUnC.js";import{u as Ae,S as Ce}from"./71ae3d5c.DAFuGUTz.js";import"./e39bc11c.8KP_WUjj.js";import"./d0bb51ec.Bel_y502.js";import"./60a453ce.Al5ISuVm.js";import"./e12db40c.D-IRYT_x.js";import"./9dba8418.C8BcPjk_.js";import"./dae24aab.C7mdClmp.js";import"./7b0c98ea.DNl6VXr2.js";import"./1ed8f5e3.DNUS73wi.js";import"./945a08d6.CKST5h-A.js";function Te({isShopPayExternal:t}){const i=f();return t?null:e(n,{when:i,children:e(Oe,{})})}function Oe(){const{i18n:n}=_();return t(()=>{const e=""!==document.referrer,n=window.history&&window.history.length>1;return e||n},[])?e(W,{inlineAlignment:"center",children:e(M,{onClick:()=>{window.history.back()},accessibilityLabel:n.translate("account_management.back"),textDecoration:"none",children:n.translate("account_management.back")})}):null}function xe(){const{href:n,label:t,onClick:r}=N(V.Login);return e(i,{children:[e(H,{blockSize:"large-100"}),e(W,{inlineAlignment:"center",children:e(M,{href:n,onClick:r,textDecoration:"none",children:t})})]})}function je({iframeOrigin:e,observability:n,onError:t,onLoaded:i,onLoggedIn:o,skip:s=!1}){const c=r(e=>{switch(e.action){case me.Loaded:return i?.();case me.Error:return t?.(e.message)}},[i,t]);a(()=>{if(s)return;const i=i=>{if((r=i.origin)!==e&&!ge.includes(r))return;var r;const{data:a}=i;if((e=>e&&"object"==typeof e&&"redirect_url_on_complete"===e.type&&e.postSignInUrl)(a))try{const e=new URL(a.postSignInUrl).searchParams.get("token");e&&o?.(e)}catch{t?.("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(he))(a))try{const[e,...n]=a.split(he);if(e!==pe)return;const t=JSON.parse(n.join(he));c(t)}catch{t?.("shop_pay_embedded_login_event_error"),n?.log("shop_pay_embedded_login_event_error","Failed to parse event")}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[o,n,e,t,c,s])}var ze=(e=>(e.Seamless="seamless",e.OAuth="oauth",e.OAuthWithEmbeddedContext="oauthWithEmbeddedContext",e.Embedded="embedded",e))(ze||{});function qe(){const{shop:e,shopPay:n,embed:t,mobileCheckoutSdk:i}=_(),r=i.enabled||t?.isCheckoutKit();return y(t?.embedder)?"embedded":t?.isFlagshipPartner||v(n)?"seamless":b(n)||r&&e.hasFlagEnabled(k)?"embedded":r&&e.hasFlagEnabled(S)?"oauthWithEmbeddedContext":r?"seamless":"oauth"}function Fe(e,n,t){return Boolean(e?.isFlagshipPartner)||t&&w(n)}function Be(){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 t=n=>{e.value=n.matches};return"function"==typeof n.addEventListener?(n.addEventListener("change",t),()=>n.removeEventListener("change",t)):void 0}),e}();return c(()=>{const{customProperties:t,darkModeCustomProperties:i}=e.configuration.branding.theme,r=function({customProperties:e}){return e?.color?.schemes?.scheme1?.base?.background}({customProperties:n.value&&i.value||t.value});if("undefined"!=typeof document&&"undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=Ee(document.body);if(we.test(e))return e}return r})}();return c(()=>{const n=Re(e.value??"rgba(255, 255, 255, 1)");
1return{isDark:Le(n,"rgb(255, 255, 255)"),parentBackgroundColor:n}})}function Me(){const e=Be();return l(e.peek()).current}function We(e){const n=l("");return!n.current&&R(e)&&(n.current=e),n.current}const Ne=(e="")=>{const{client:n,shopPay:i,environment:r,i18n:{locale:a},shop:o,source:{checkoutSessionIdentifier:s},embed:c,checkout:{proposal:{proposed:l},negotiator:d}}=_(),u=o.hasFlagEnabled(L),m=Fe(c,i,u),h=We(l.email.value),p=u?h:l.email.value,g=I(n.initialRequest.url),f=d.current.fields.buyerIdentity.value?.customerProfile,y=i.signup.skipAutomaticLoginAttempt.value,v=K({include:{shopId:!0}}),{parentBackgroundColor:k,isDark:S}=Me();return t(()=>{if(!s)return{origin:"c1_login",frameUrl:"",flow:"pay_checkout_login"};const{origin:t,flowVersion:l}=function(e){return b(e)?{origin:Se.PaymentRequest,flowVersion:"iframe"}:{origin:"c1_login",flowVersion:"iframe"}}(i),d=new URLSearchParams(n.initialRequest.url.search),u=new URLSearchParams;u.set("locale",a),u.set("analytics_trace_id",e),u.set("origin",t),u.set("checkout_token",s),u.set("flow","pay_checkout_login"),u.set("flow_version",l??""),u.set("authentication_level","phone"),u.set("target_origin",window.location.origin),u.set("storefront_domain",o.domain),u.set("layout","full"),S&&u.set("theme","dark"),k&&u.set("parent_background_color",k),g&&(u.set("force_authentication","true"),u.set("prompt","login"));const h=d.get("login_hint");h?u.set("login_hint",h):m&&p&&!g&&!y?u.set("login_hint",p):!y&&f?.email&&u.set("login_hint",f.email);const _=d.get("shop_client_uuid")??c?.shopClientUuid??d.get("client_uuid");_&&u.set("client_uuid",_),v(u,d);const w=new URL("/accounts/login/embedded",r.services.shopServer.url);return w.search=u.toString(),{origin:t,frameUrl:w.href,flow:"pay_checkout_login"}},[e,S,k,s,n.initialRequest.url.search,f?.email,r.services.shopServer.url,g,a,c?.shopClientUuid,v,o.domain,p,i,y,m])};function Ve({analyticsTraceId:e,loginData:n}){const{progress:t}=$(),{shopPay:i,observability:a}=_(),{config:o,updateAccessToken:s}=i,{exchangeSessionTokenForCookie:c}=fe(),{extendBuyerIdentity:l}=_e(),{checkoutAsGuestUrl:d}=o,{replaceShopPayInHistory:u}=Ue(),{flow:m,origin:h}=n;return r(async(n,r)=>{if(r)s(r);else if(n){const t=await c({token:n,origin:h,analytics_trace_id:e,flow:m});t.ok||(a.log("shop_pay_login_frame_session_token_exchange_failed","exchangeSessionTokenForCookie request failed",{status:t.status}),t.status>=500&&u(d))}await l(),i.signup.unstable_setSkipAutomaticLoginAttempt(!1),t("shop-pay-login-success")},[t,s,c,h,m,e,l,d,u,a,i.signup])}const He="vUvXb",Ke="WC8Ph",$e="oX06g",Ge=d(function({title:n,src:t,height:i,hidden:r=!1,onLoad:a,className:o,allow:s=Je()},c){return e("iframe",{ref:c,id:J,title:n,src:t,onLoad:a,height:i,width:G,className:u("_5Z70J",{[He]:r},o),"aria-hidden":!!r||void 0,allow:s})});function Je(){return Q}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}=_(),R=l(null),I=qe(),{frameUrl:P}=c,E=Boolean(P),U=!(s||g.value);j(U);const D=t(()=>{try{return new URL(P).origin}catch{return""}},[P]),A=w(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:t,shopPaySdkCheckout:i}){const{checkout:r,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(r.proposal.proposed.email.value),u=new URLSearchParams(o.initialRequest.url.search).has("login_hint");a(()=>{c&&s.counter({name:"shop_pay_login_hint",value:1,attributes:{checkoutUrlHint:u,loginHintSent:l,loginVariant:n,proposedEmailAvailable:d,sdkLoginHintFlagEnabled:t,shopPaySdkCheckout:i}})},[u,c,l,n,s,d,t,i])}({frameUrl:P,loginVariant:I,sdkLoginHintFlagEnabled:k.hasFlagEnabled(L),shopPaySdkCheckout:A});const T={serverDrivenAuth:h,hidden:n,shopPaySdkCheckout:A,serverRendered:f.initialRequest.isServerRendered,serverRenderedIframe:p,loginVariant:I};X({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})}}),X({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),q=r(e=>{z(e)},[]),F=r(()=>{g.value=!0,d?.()},[g,d]);return P?e(i,{children:[u?.({iframeOrigin:D,iframeRef:R,onResized:q}),e(Ge,{ref:R,title:v.translate("verification.title"),src:P,onLoad:F,height:x,hidden:n})]}):null}function Xe({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:t=!1}){const i=Y(),a=Be(),o=t&&n?n:window.location.origin;return{dispatchThemeMessage:r(()=>{if(!e.current?.contentWindow)return;const{isDark:n,parentBackgroundColor:t}=a.value,i={theme:n?"dark":"light",type:"theme"};t&&(i.parentBackgroundColor=t),e.current.contentWindow.postMessage(i,o)},[e,a,o]),dispatchStyleMessage:r(()=>{if(!e.current?.contentWindow)return;const n=function(e){return Ze(Object.fromEntries(Object.entries(e).filter(([e])=>Ye(e))),E)}(i.customProperties.value);!function(e,n,t){const i=P(),r=E.borderRadius.base,a=E.borderRadius.large,o=E.control.borderRadius,s=n=>i||!e[n],c=n.configuration.cornerRadius.base?`${n.configuration.cornerRadius.base}px`:Z.borderRadius.base,l=n.configuration.primaryButton.cornerRadius;let d=Z.borderRadius.base;"none"===l?d="0px":l&&(d=Z.borderRadius[l]??Z.borderRadius.base),s(r)&&(e[r]=c),t?e[a]=Z.borderRadius.base:s(a)&&(e[a]=d),e[o]||(e[o]=Z.borderRadius.base)}(n,i,t),e.current.contentWindow.postMessage({type:"style",style:en(n)},o)},[e,i,o,t]),resolvedParentBackground:a}}const Ye=e=>["borderRadius","control"].includes(e);function Ze(e,n){const t=Object.entries(e).flatMap(([e,t])=>"object"!=typeof t||Array.isArray(t)||null==t?null!=n[e]&&null!=t?[[n[e],t]]:[]:n[e]?Object.entries(Ze(t,n[e])):[]);return Object.fromEntries(t)}const en=e=>Object.entries(e).map(([e,n])=>`${e}: ${n};`).join("");function nn({iframeRef:e,iframeOrigin:n,onLoggedIn:t}){const{checkout:i,observability:o}=_(),{isEmbeddedShopPayTheme:s}=i.configuration.branding,{dispatchThemeMessage:c,dispatchStyleMessage:l,resolvedParentBackground:d}=Xe({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:s}),u=d.value,m=r(()=>{c(),l()},[c,l]);return a(()=>{c()},[c,u]),je({iframeOrigin:n,observability:o,onLoaded:m,onLoggedIn:t}),null}function tn({analyticsTraceId:n,...t}){const i=Ne(n),r=Ve({analyticsTraceId:n,loginData:i});return e(Qe,{...t,loginData:i,renderListeners:({iframeOrigin:n,iframeRef:t})=>e(nn,{iframeRef:t,iframeOrigin:n,onLoggedIn:r}),serverDrivenAuth:!0})}const rn="c1_login",an="pay_checkout_login";function on(){return{origin:rn,frameUrl:"",flow:an}}function sn(e="",{includeEmbeddedContext:n=!1}={}){const{client:i,embed:r,shopPay:a,i18n:{locale:o},shop:s,source:{checkoutSessionIdentifier:c,sourceId:l},checkout:{proposal:{proposed:d},negotiator:u}}=_(),{config:m,signup:h}=a,p=s.hasFlagEnabled(L),g=We(d.email.value),f=p?g:d.email.value,y=Fe(r,a,p),v=I(i.initialRequest.url),b=u.current.fields.buyerIdentity.value?.customerProfile,k=ee(),S=h.skipAutomaticLoginAttempt.value,{redirectUrl:w}=m,R=K({include:{shopId:!0}}),{parentBackgroundColor:P,isDark:E}=Me(),U=n?R:void 0,D=n?r?.shopClientUuid:void 0,A=n?void 0:k,C=i.unstable_getSerialization("shopPayLoginOAuthState"),T=t(()=>C??function(){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36)).join("")}(),[C]);return t(()=>{if(!c)return on();const n=new URLSearchParams;!function(e,{analyticsTraceId:n,checkoutSessionIdentifier:t,domain:i,locale:r,oAuthState:a,sourceId:o}){e.set("client_id",""),e.set("redirect_uri",`https://${i}/services/login_with_shop/callback`),e.set("scope","openid email profile"),e.set("response_type","code"),e.set("state",a),e.set("storefront_domain",i),e.set("locale",r),e.set("analytics_trace_id",n),e.set("origin",rn),e.set("checkout_token",t),e.set("checkout_source_id",o),e.set("flow",an),e.set("target_origin",`https://${i}`),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)),E&&n.set("theme","dark"),P&&n.set("parent_background_color",P),w&&n.set("checkout_redirect_url",w),v&&(n.set("force_authentication","true"),n.set("prompt","login")),m.transactionParams&&n.set("transaction_params",m.transactionParams);const t=new URLSearchParams(i.initialRequest.url.search),r=t.get("login_hint");r?n.set("login_hint",r):y&&f&&!v&&!S?n.set("login_hint",f):!S&&b?.email&&n.set("login_hint",b.email);const a=function(e,n){return e.get("shop_client_uuid")??n??e.get("client_uuid")}(t,D);a&&n.set("client_uuid",a),U?.(n,t);
1try{const e=new URL("/services/login_with_shop/authorize",`https://${s.domain}`);return e.search=n.toString(),{origin:rn,frameUrl:e.href,flow:an}}catch{return on()}},[m.transactionParams,e,U,c,i.initialRequest.url.search,y,b?.email,s.domain,D,v,f,E,P,o,A,w,S,T,l])}const cn=(e="")=>sn(e,{includeEmbeddedContext:!0});function ln({analyticsTraceId:n,...t}){const i=cn(n),r=Ve({analyticsTraceId:n,loginData:i});return e(Qe,{...t,loginData:i,renderListeners:({iframeOrigin:n,iframeRef:t})=>e(nn,{iframeRef:t,iframeOrigin:n,onLoggedIn:r}),serverDrivenAuth:!0})}const dn=(e="")=>sn(e);function un({iframeRef:e}){const{checkout:n,environment:t,observability:i,router:r,source:o}=_(),{replaceShopPayInHistory:s}=Ue(),c=new URL(t.services.shopServer.url).origin,d=o.checkoutSessionIdentifier,u=l(!1);return a(()=>{const t=({data:t,origin:a,source:o})=>{if(u.current||a!==c||!e.current?.contentWindow||o!==e.current.contentWindow||!t||"object"!=typeof t||!("type"in t)||"pay_guest_session_ready"!==t.type)return;const l=new URL(window.location.href);U(l.pathname)&&(u.current=!0,i.counter({name:"guest_handoff_received",value:1,exportImmediately:!0,requiresKeepalive:!0}),i.log("guest_handoff_received","Shop Pay guest handoff received",{checkoutToken:d},{exportImmediately:!0,requiresKeepalive:!0}),l.pathname=r.resolve("/shoppay").pathname,n.unstable_setRedirectingExternally(!0),setTimeout(()=>s(l.toString()),0))};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[n,d,e,i,s,r,c]),null}function mn({analyticsTraceId:n,hidden:t,iframeLoaded:i,onIframeLoad:r,serverRenderedIframe:a}){const o=dn(n);return e(Qe,{hidden:t,iframeLoaded:i,loginData:o,onIframeLoad:r,renderListeners:({iframeRef:n})=>e(un,{iframeRef:n}),serverDrivenAuth:!0,serverRenderedIframe:a})}var hn=(e=>(e.Partner="sdk_partner",e.Merchant="sdk_merchant",e))(hn||{});const pn=(e="")=>{const{client:n,shopPay:i,embed:r,environment:a,i18n:{locale:o},observability:s,shop:c,source:{checkoutSessionIdentifier:l},mobileCheckoutSdk:d,checkout:{proposal:{proposed:u},negotiator:m}}=_(),h=c.hasFlagEnabled(L),p=We(u.email.value),g=h?p:u.email.value,{config:f}=i,y=I(n.initialRequest.url),{transactionParams:v,tokens:k}=f,S=m.current.fields.buyerIdentity.value?.customerProfile,w=ne().value,R=Ie(),P=F(),E=a.services.payShopifyCom.url,U=n.unstable_getSerialization("shopClientUuid"),A=K({include:{shopId:!0}}),C=Boolean(r?.isFlagshipPartner),T=Fe(r,i,h),O=r?.shopClientUuid,x=i.signup.skipAutomaticLoginAttempt.value;return t(()=>{if(!l)throw new D({groupingHash:"ShopPayCheckoutIdentifierMissingError::LoginFrame"});const{origin:t,flowVersion:r,flow:a}=function(e){return b(e)?{origin:Se.PaymentRequest,flowVersion:e.flowVersion,flow:"payment_request"}:{origin:"c1_login",flowVersion:void 0,flow:void 0}}(i),u=r??(C?"iframe":void 0),m=new URLSearchParams(n.initialRequest.url.search),h=gn(m,"shop_client_uuid")??O??gn(m,"client_uuid")??U;C&&!h&&s.log("shop_pay_login_seamless_missing_client_uuid","[ShopPayLoginFrame] Embedded checkout missing shop_client_uuid for Login Seamless.");const p=new URLSearchParams({flow:a??"",locale:o,origin:t,isPointOfSale:String(w),transaction_params:v??"",flow_version:u??"",shopify_domain:c.myshopifyDomain,checkout_token:l,analytics_trace_id:e,shop_pay_button_variant:i.logoBrand,shop_pay_new_signup_login_variant:P});h&&p.set("client_uuid",h);const f=m.get("login_hint");f?p.set("login_hint",f):T&&g&&!y&&!x&&p.set("login_hint",g),!x&&S?.email&&p.set("storefront_account_email",S.email),R&&p.set(Pe,d.variant.isPartner()?hn.Partner:hn.Merchant),y||p.set("authorization",k.authorization??""),A(p,m);const _=new URL("/pay/authentication/login-seamless",E);return _.search=p.toString(),{origin:t,frameUrl:_.href}},[e,A,n.initialRequest.url.search,k,l,S?.email,y,E,R,C,w,o,c.myshopifyDomain,d,O,g,U,i,P,T,x,s,v])};function gn(e,n){return e.get(n)||void 0}function fn({iframeRef:e,iframeOrigin:n,onLoggedIn:t,onResized:i}){const{checkout:o,shopPay:s}=_(),{isEmbeddedShopPayTheme:c}=o.configuration.branding,{dispatchThemeMessage:l,dispatchStyleMessage:d,resolvedParentBackgroun
1d:u}=Xe({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:c}),m=u.value,h=r(()=>{ye(e.current,{action:ve.Ready}),e.current?.contentDocument?.body&&te(e.current.contentDocument.body)?.focus(),c&&(l(),d())},[l,d,e,c]);a(()=>{c&&l()},[l,c,m]);const p=r(e=>{s.signup.unstable_setHcaptchaToken(e)},[s.signup]);return be({onLoaded:h,onLoggedIn:t,onResized:i,onShareCaptchaToken:p}),null}function _n({analyticsTraceId:n,...t}){const i=pn(n),r=Ve({analyticsTraceId:n,loginData:i});return e(Qe,{...t,loginData:i,renderListeners:({iframeOrigin:n,iframeRef:t,onResized:i})=>e(fn,{iframeRef:t,iframeOrigin:n,onLoggedIn:r,onResized:i}),serverDrivenAuth:!1})}function yn({serverRenderedIframe:n,...i}){const{client:r}=_(),a=qe(),o=r.unstable_getSerialization("shopPayLoginAnalyticsTraceId"),s=t(()=>o??ke(),[o]);switch(a){case ze.OAuth:return e(mn,{...i,analyticsTraceId:s,serverRenderedIframe:n});case ze.OAuthWithEmbeddedContext:return e(ln,{...i,analyticsTraceId:s});case ze.Embedded:return e(tn,{...i,analyticsTraceId:s});case ze.Seamless:return e(_n,{...i,analyticsTraceId:s});default:return h(a)}}function vn({className:n}){const{i18n:t}=_(),i=t.translate("general.loading");return e(W,{accessibilityRole:"status",accessibilityLabel:i,"aria-live":"polite",className:n,children:e(ie,{blockSize:"100%",padding:"large-200",gap:"large-100",children:[e(ie,{alignItems:"center",gap:"large-100",children:[e(re,{delay:!1,contentDisplay:"block",inlineSize:"92px",blockSize:"32px"}),e(re,{delay:!1,contentDisplay:"block",inlineSize:"50%",blockSize:"16px"})]}),e(ie,{gap:"small-400",children:e(re,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"})}),e(re,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"}),e(W,{paddingBlockStart:"large-200",children:e(ie,{alignItems:"center",gap:"large-400",children:[e(re,{delay:!1,contentDisplay:"block",inlineSize:"34%",blockSize:"14px"}),e(re,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"14px"})]})})]})})}function bn({serverRenderedIframe:n=!1}={}){const{client:t,environment:i,observability:a}=_(),s=i.services.shopServer.url,c=t.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=t.initialRequest.isServerRendered,S=r((e,n)=>{a.histogram({name:"shop_pay_login_form_visible_duration",value:Math.round(e-b),unit:"ms",attributes:{serverRendered:k,serverRenderedIframe:m.value,revealSource:n}})},[b,a,k,m]),w=r((e,n=performance.now())=>{d.value||(d.value=!0,S(n,e))},[d,S]),R=r(()=>{w("iframe_load")},[w]),L=r(()=>{w("login_message")},[w]);return je({iframeOrigin:s,observability:a,onLoaded:L,skip:!g}),p(()=>
1{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(vn,{className:$e}),e(yn,{hidden:!y,iframeLoaded:d.value,onIframeLoad:R,serverRenderedIframe:h})]}):e(vn,{className:$e})}function kn(){const t=f(),{embed:i}=_();return y(i?.embedder)?e(n,{when:t,children:e(Sn,{})}):null}function Sn(){const{observability:e,source:n,embed:i,environment:r,url:o,shop:s}=_(),{iframeUrl:c,source:l}=function(e=""){const n={seamless:pn(e),embedded:Ne(e),oauth:dn(e),oauthWithEmbeddedContext:cn(e)},i=qe(),{serverDrivenAuth:r,variant:a}=(e=>{switch(e){case ze.OAuth:return{serverDrivenAuth:!0,variant:"oauth"};case ze.OAuthWithEmbeddedContext:return{serverDrivenAuth:!0,variant:"oauthWithEmbeddedContext"};case ze.Embedded:return{serverDrivenAuth:!0,variant:"embedded"};case ze.Seamless:default:return{serverDrivenAuth:!1,variant:"seamless"}}})(i),{frameUrl:o,origin:s,flow:c}=n[a];return{flow:c,iframeOrigin:t(()=>{try{return new URL(o).origin}catch{return""}},[o]),serverDrivenAuth:r,source:s,iframeUrl:o,variant:a}}(),d=i?.client?.embedderHostname;return a(()=>{if(!y(i?.embedder)||!c||!d)return;const t=new URL(c);t.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()})}(i,{loginUrl:t.href,exchangeUrl:new URL(o.shopPaySession(),r.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})},[i,d,c,l,r.services.shopServer.url,o,s.myshopifyDomain,n.checkoutSessionIdentifier,e]),null}function wn(){!function(){const{client:e,userEvents:n,source:t,checkout:i,shop:r,shopPay:o}=_(),{redirectSource:s,tracking:c}=o.config,{checkoutSessionIdentifier:l="checkout_identifier_undefined"}=t,d=ae(C.SHOP_PAY_LOGIN),u=ne().value;Ae({stage:Ce.Complete,id:"ShopPayLogin"}),a(()=>{P()&&n.monorailEvent({schemaId:"shop_app_page_load/9.0",payload:{...A(t,i,r),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:{...A(t,i,r),pageType:"checkout_login",clientTimestampMs:Date.now(),redirectSource:s}}),u&&n.monorailEvent({schemaId:"retail_shop_pay/2.0",payload:d})},[e.cookies,n,t,i,r,s,d,u,l,c.unique,c.visit])}();const{client:n,router:t,shop:i,source:r,shopPay:o}=_(),s="shopPayExternal"===r.type,c=qe(),l=c===ze.Seamless,d=t.currentUrl.value,m=d.href===n.initialRequest.url.href&&n.initialRequest.isServerRendered&&c===ze.OAuth,{isAppLayout:h}=oe(),p=i.hasFlagEnabled(T)&&!s&&!h&&!P(d.search)&&!o.config.isReferral&&!d.searchParams.has(O)&&!0===n.unstable_getSerialization("shopPayConfig").has_remember_me_cookie&&o.visibility.showCheckoutAsGuestFeature;return e("div",{children:[e(kn,{}),e(ue,{padding:"none",dividerDisplay:"@media (inline-size >= medium) none, auto",children:e(W,{padding:"@media (inline-size >= small) none none large-300 none, none",maxInlineSize:"@media (inline-size >= small) 425px, 432px",className:u("oSdnC"),children:e(ue,{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(bn,{serverRenderedIframe:m})})})}),o.visibility.showUnauthedOrderSummary&&e(se,{section:"summary",children:e(ce,{section:"summary",children:e(le,{above:"small",children:e(ue,{hideDivider:!0,padding:"none none large-200 none",children:e(De,{})})})})}),p?e(xe,{}):e(Te,{isShopPayExternal:s})]})}function Rn(){const{client:n,observability:t,shopPay:i}=_(),{shouldUseAccessToken:r,user:o}=i,s=I(n.initialRequest.url),l=F(),d=!!l&&B.includes(l),u=g(l),h=de(),p=c(()=>"shopPayLogin"===h.value.currentDetour?.type),f=z(),y=c(()=>f()),v=i.accessToken.value,{refetch:b}=x(q,{isOnShopPayLoginDetour:p,newSignupLoginVariant:u,simulatedBuyerDetails:y}),[k,S]=m(!1),w=!r||Boolean(v),R=o.email.value,L=d&&!s||Boolean(k&&R&&w),P=null==l||L;j(P);const E=n.unstable_legacyNavigationPerformance,{progress:U}=$();return a(()=>{const e=i.session.initialization.peek();"failed"===e.status&&"fetch"===e.reason&&i.session.unstable_setInitialization({status:"pending"})},[i.session]),a(()=>{v&&(s||(b(),S(!0)))},[v,s,b]),a(()=>{L&&(E?.usable(),U("shop-pay-login-loader-complete"))},[L,E,U]),X({enabled:P,onTimeout:e=>{t.counter({name:"shop_pay_login_loader_loading_timeout",value:1}),t.log("shop_pay_login_loader_loading_timeout","ShopPayLoginLoader loading timeout",{timeout:e,variant:l,isUnauthenticatedVariant:d})}}),P?null:e(wn,{})}export{Rn 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.