1import{u as e,w as n,T as t,S as i,q as r,h as o,o as a,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.Bywc2Brn.js";import{af as f,c as _,I as y,eE as v,eF as b,eG as k,eH as S,eI as w,eA as R,eJ as L,ev as I,d1 as P,eK as U,ew as D,aI as E,eL as A,eM as C,eN as T,c2 as x}from"./9dba8418.nSn06qNc.js";import{u as O,a as j,S as z}from"./8c0eaf27.DPoupkYZ.js";import{u as q,U as B}from"./a25deb9a.MkbUxm8m.js";import{L as M,b as F,f8 as V,fe as N,d as W,bs as H,v as G,ff as $,fg as K,fh as J,eQ as X,am as Q,Y,fi as Z,bF as ee,b8 as ne,S as te,au as ie,eP as re,bK as oe,af as ae,ag as se,a0 as ce,k as le}from"./164ad2e3.Bn4mVc0u.js";import{c as de}from"./dfca5da5.CXiXBEd3.js";import{R as ue,D as me,c as he,d as pe,u as ge,a as fe,p as _e,S as ye,b as ve}from"./91319467.CleldDuD.js";import{u as be}from"./app.B7Ohb9rB.js";import{M as ke}from"./1d34c07e.h4dJAaCz.js";import{R as Se,n as we,i as Re,a as Le,c as Ie}from"./1f5e7811.B-Accwr_.js";import{g as Pe}from"./9ce08e25.XYYnIMRV.js";import{u as Ue}from"./24773686.7xgoMIiO.js";import{MobileOrderSummary as De}from"./d2e6a587.DPWeavQe.js";import{u as Ee,S as Ae}from"./71ae3d5c.BAoM4Tq1.js";import"./e39bc11c.vcoq105t.js";import"./d0bb51ec.up41EQh6.js";import"./f67abd2c.BiDTv4D9.js";import"./60a453ce.BI5dm7PK.js";import"./e12db40c.xtsrYBcz.js";import"./dae24aab.DshQXsWO.js";import"./7b0c98ea.CIpGRPTq.js";import"./1ed8f5e3.CzhdrJHY.js";import"./945a08d6.DdFvumqp.js";function Ce({isShopPayExternal:t}){const i=f();return t?null:e(n,{when:i,children:e(Te,{})})}function Te(){const{i18n:n}=_();return t(()=>{const e=""!==document.referrer,n=window.history&&window.history.length>1;return e||n},[])?e(F,{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}=V(N.Login);return e(i,{children:[e(W,{blockSize:"large-100"}),e(F,{inlineAlignment:"center",children:e(M,{href:n,onClick:r,textDecoration:"none",children:t})})]})}function Oe({iframeOrigin:e,observability:n,onError:t,onLoaded:i,onLoggedIn:a,skip:s=!1}){const c=r(e=>{switch(e.action){case ue.Loaded:return i?.();case ue.Error:return t?.(e.message)}},[i,t]);o(()=>{if(s)return;const i=i=>{if((r=i.origin)!==e&&!pe.includes(r))return;var r;const{data:o}=i;if((e=>e&&"object"==typeof e&&"redirect_url_on_complete"===e.type&&e.postSignInUrl)(o))try{const e=new URL(o.postSignInUrl).searchParams.get("token");e&&a?.(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(me))(o))try{const[e,...n]=o.split(me);if(e!==he)return;const t=JSON.parse(n.join(me));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)},[a,n,e,t,c,s])}var je=(e=>(e.Seamless="seamless",e.OAuth="oauth",e.OAuthWithEmbeddedContext="oauthWithEmbeddedContext",e.Embedded="embedded",e))(je||{});function ze(){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 qe(e,n){return Boolean(e?.isFlagshipPartner)||w(n)}function Be(){const e=function(){const{checkout:e}=_(),n=function(){const e=a(!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=Pe(document.body);if(Se.test(e))return e}return r})}();return c(()=>{const n=we(e.value??"rgba(255, 255, 255, 1)");
1return{isDark:Re(n,"rgb(255, 255, 255)"),parentBackgroundColor:n}})}function Me(){const e=Be();return l(e.peek()).current}function Fe(e){const n=l("");return!n.current&&R(e)&&(n.current=e),n.current}const Ve=(e="")=>{const{client:n,shopPay:i,environment:r,i18n:{locale:o},shop:a,source:{checkoutSessionIdentifier:s},embed:c,checkout:{proposal:{proposed:l},negotiator:d}}=_(),u=qe(c,i),m=Fe(l.email.value),h=L(n.initialRequest.url),p=d.current.fields.buyerIdentity.value?.customerProfile,g=i.signup.skipAutomaticLoginAttempt.value,f=H({include:{shopId:!0}}),{parentBackgroundColor:y,isDark:v}=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:ke.PaymentRequest,flowVersion:"iframe"}:{origin:"c1_login",flowVersion:"iframe"}}(i),d=new URLSearchParams(n.initialRequest.url.search),_=new URLSearchParams;_.set("locale",o),_.set("analytics_trace_id",e),_.set("origin",t),_.set("checkout_token",s),_.set("flow","pay_checkout_login"),_.set("flow_version",l??""),_.set("authentication_level","phone"),_.set("target_origin",window.location.origin),_.set("storefront_domain",a.domain),_.set("layout","full"),v&&_.set("theme","dark"),y&&_.set("parent_background_color",y),h&&(_.set("force_authentication","true"),_.set("prompt","login"));const k=d.get("login_hint");k?_.set("login_hint",k):u&&m&&!h&&!g?_.set("login_hint",m):!g&&p?.email&&_.set("login_hint",p.email);const S=d.get("shop_client_uuid")??c?.shopClientUuid??d.get("client_uuid");S&&_.set("client_uuid",S),f(_,d);const w=new URL("/accounts/login/embedded",r.services.shopServer.url);return w.search=_.toString(),{origin:t,frameUrl:w.href,flow:"pay_checkout_login"}},[e,v,y,s,n.initialRequest.url.search,p?.email,r.services.shopServer.url,h,o,c?.shopClientUuid,f,a.domain,m,i,g,u])};function Ne({analyticsTraceId:e,loginData:n}){const{progress:t}=G(),{shopPay:i,observability:o}=_(),{config:a,updateAccessToken:s}=i,{exchangeSessionTokenForCookie:c}=ge(),{extendBuyerIdentity:l}=fe(),{checkoutAsGuestUrl:d}=a,{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||(o.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,o,i.signup])}const We="oX06g",He=d(function({title:n,src:t,height:i,hidden:r=!1,onLoad:o,className:a,allow:s=Ge()},c){return e("iframe",{ref:c,id:K,title:n,src:t,onLoad:o,height:i,width:$,className:u("_5Z70J",r&&"vUvXb",a),"aria-hidden":!!r||void 0,allow:s})});function Ge(){return J}function $e({hidden:n=!1,iframeLoaded:s=!1,loginData:c,onIframeLoad:d,renderListeners:u,serverDrivenAuth:h,serverRenderedIframe:p=!1}){const g=a(!1),{client:f,environment:y,i18n:v,observability:b,shopPay:k}=_(),S=l(null),R=ze(),{frameUrl:L}=c,I=Boolean(L),P=!(s||g.value);O(P);const U=t(()=>{try{return new URL(L).origin}catch{return""}},[L]),D=w(k);let E="empty";U===y.services.shopServer.url?E="shop_server":U===y.services.payShopifyCom.url?E="pay_shopify":U&&(E="merchant_storefront"),function({frameUrl:e,loginVariant:n,shopPaySdkCheckout:t}){const{checkout:i,client:r,observability:a}=_(),s=Boolean(e),c=function(e){try{return new URL(e).searchParams.has("login_hint")}catch{return!1}}(e),l=Boolean(i.proposal.proposed.email.value),d=new URLSearchParams(r.initialRequest.url.search).has("login_hint");o(()=>{s&&a.counter({name:"shop_pay_login_hint",value:1,attributes:{checkoutUrlHint:d,loginHintSent:c,loginVariant:n,proposedEmailAvailable:l,shopPaySdkCheckout:t}})},[d,s,c,n,a,l,t])}({frameUrl:L,loginVariant:R,shopPaySdkCheckout:D});const A={serverDrivenAuth:h,hidden:n,shopPaySdkCheckout:D,serverRendered:f.initialRequest.isServerRendered,serverRenderedIframe:p,loginVariant:R};X({enabled:I&&P,onTimeout:e=>{const n={timeout:e,...A,frameHostKind:E,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:U},{exportImmediately:!0})}}),X({enabled:!I,onTimeout:e=>{const n={timeout:e,...A,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 C=h?370:250,[T,x]=m(C),j=r(e=>{x(e)},[]),z=r(()=>{g.value=!0,d?.()},[g,d]);return L?e(i,{children:[u?.({iframeOrigin:U,iframeRef:S,onResized:j}),e(He,{ref:S,title:v.translate("verification.title"),src:L,onLoad:z,height:T,hidden:n})]}):null}function Ke({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:t=!1}){const i=Q(),o=Be(),a=t&&n?n:window.location.origin;return{dispatchThemeMessage:r(()=>{if(!e.current?.contentWindow)return;const{isDark:n,parentBackgroundColor:t}=o.value,i={theme:n?"dark":"light",type:"theme"};t&&(i.parentBackgroundColor=t),e.current.contentWindow.postMessage(i,a)},[e,o,a]),dispatchStyleMessage:r(()=>{if(!e.current?.contentWindow)return;const n=function(e){return Xe(Object.fromEntries(Object.entries(e).filter(([e])=>Je(e))),P)}(i.customProperties.value);!function(e,n,t){const i=I(),r=P.borderRadius.base,o=P.borderRadius.large,a=P.control.borderRadius,s=n=>i||!e[n],c=n.configuration.cornerRadius.base?`${n.configuration.cornerRadius.base}px`:Y.borderRadius.base,l=n.configuration.primaryButton.cornerRadius;let d=Y.borderRadius.base;"none"===l?d="0px":l&&(d=Y.borderRadius[l]??Y.borderRadius.base),s(r)&&(e[r]=c),t?e[o]=Y.borderRadius.base:s(o)&&(e[o]=d),e[a]||(e[a]=Y.borderRadius.base)}(n,i,t),e.current.contentWindow.postMessage({type:"style",style:Qe(n)},a)},[e,i,a,t]),resolvedParentBackground:o}}const Je=e=>["borderRadius","control"].includes(e);function Xe(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(Xe(t,n[e])):[]);return Object.fromEntries(t)}const Qe=e=>Object.entries(e).map(([e,n])=>`${e}: ${n};`).join("");function Ye({iframeRef:e,iframeOrigin:n,onLoggedIn:t}){const{checkout:i,observability:a}=_(),{isEmbeddedShopPayTheme:s}=i.configuration.branding,{dispatchThemeMessage:c,dispatchStyleMessage:l,resolvedParentBackground:d}=Ke({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:s}),u=d.value,m=r(()=>{c(),l()},[c,l]);return o(()=>{c()},[c,u]),Oe({iframeOrigin:n,observability:a,onLoaded:m,onLoggedIn:t}),null}function Ze({analyticsTraceId:n,...t}){const i=Ve(n),r=Ne({analyticsTraceId:n,loginData:i});return e($e,{...t,loginData:i,renderListeners:({iframeOrigin:n,iframeRef:t})=>e(Ye,{iframeRef:t,iframeOrigin:n,onLoggedIn:r}),serverDrivenAuth:!0})}const en="c1_login",nn="pay_checkout_login";function tn(){return{origin:en,frameUrl:"",flow:nn}}function rn(e="",{includeEmbeddedContext:n=!1}={}){const{client:i,embed:r,shopPay:o,i18n:{locale:a},shop:s,source:{checkoutSessionIdentifier:c,sourceId:l},checkout:{proposal:{proposed:d},negotiator:u}}=_(),{config:m,signup:h}=o,p=Fe(d.email.value),g=qe(r,o),f=L(i.initialRequest.url),y=u.current.fields.buyerIdentity.value?.customerProfile,v=Z(),b=h.skipAutomaticLoginAttempt.value,{redirectUrl:k}=m,S=H({include:{shopId:!0}}),{parentBackgroundColor:w,isDark:R}=Me(),I=n?S:void 0,P=n?r?.shopClientUuid:void 0,U=n?void 0:v,D=i.unstable_getSerialization("shopPayLoginOAuthState"),E=t(()=>D??function(){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36)).join("")}(),[D]);return t(()=>{if(!c)return tn();const n=new URLSearchParams;!function(e,{analyticsTraceId:n,checkoutSessionIdentifier:t,domain:i,locale:r,oAuthState:o,sourceId:a}){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",o),e.set("storefront_domain",i),e.set("locale",r),e.set("analytics_trace_id",n),e.set("origin",en),e.set("checkout_token",t),e.set("checkout_source_id",a),e.set("flow",nn),e.set("target_origin",`https://${i}`),e.set("ux_mode","iframe"),e.set("layout","full")}(n,{analyticsTraceId:e,checkoutSessionIdentifier:c,domain:s.domain,locale:a,oAuthState:E,sourceId:l}),void 0!==U&&n.set("shop_id",String(U)),R&&n.set("theme","dark"),w&&n.set("parent_background_color",w),k&&n.set("checkout_redirect_url",k),f&&(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):g&&p&&!f&&!b?n.set("login_hint",p):!b&&y?.email&&n.set("login_hint",y.email);const o=function(e,n){return e.get("shop_client_uuid")??n??e.get("client_uuid")}(t,P);o&&n.set("client_uuid",o),I?.(n,t);
1try{const e=new URL("/services/login_with_shop/authorize",`https://${s.domain}`);return e.search=n.toString(),{origin:en,frameUrl:e.href,flow:nn}}catch{return tn()}},[m.transactionParams,e,I,c,i.initialRequest.url.search,g,y?.email,s.domain,P,f,p,R,w,a,U,k,b,E,l])}const on=(e="")=>rn(e,{includeEmbeddedContext:!0});function an({analyticsTraceId:n,...t}){const i=on(n),r=Ne({analyticsTraceId:n,loginData:i});return e($e,{...t,loginData:i,renderListeners:({iframeOrigin:n,iframeRef:t})=>e(Ye,{iframeRef:t,iframeOrigin:n,onLoggedIn:r}),serverDrivenAuth:!0})}const sn=(e="")=>rn(e);function cn({iframeRef:e}){const{checkout:n,environment:t,observability:i,router:r,source:a}=_(),{replaceShopPayInHistory:s}=Ue(),c=new URL(t.services.shopServer.url).origin,d=a.checkoutSessionIdentifier,u=l(!1);return o(()=>{const t=({data:t,origin:o,source:a})=>{if(u.current||o!==c||!e.current?.contentWindow||a!==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 ln({analyticsTraceId:n,hidden:t,iframeLoaded:i,onIframeLoad:r,serverRenderedIframe:o}){const a=sn(n);return e($e,{hidden:t,iframeLoaded:i,loginData:a,onIframeLoad:r,renderListeners:({iframeRef:n})=>e(cn,{iframeRef:n}),serverDrivenAuth:!0,serverRenderedIframe:o})}var dn=(e=>(e.Partner="sdk_partner",e.Merchant="sdk_merchant",e))(dn||{});const un=(e="")=>{const{client:n,shopPay:i,embed:r,environment:o,i18n:{locale:a},observability:s,shop:c,source:{checkoutSessionIdentifier:l},mobileCheckoutSdk:d,checkout:{proposal:{proposed:u},negotiator:m}}=_(),h=Fe(u.email.value),{config:p}=i,g=L(n.initialRequest.url),{transactionParams:f,tokens:y}=p,v=m.current.fields.buyerIdentity.value?.customerProfile,k=ee().value,S=Le(),w=q(),R=o.services.payShopifyCom.url,I=n.unstable_getSerialization("shopClientUuid"),P=H({include:{shopId:!0}}),U=Boolean(r?.isFlagshipPartner),E=qe(r,i),A=r?.shopClientUuid,C=i.signup.skipAutomaticLoginAttempt.value;return t(()=>{if(!l)throw new D({groupingHash:"ShopPayCheckoutIdentifierMissingError::LoginFrame"});const{origin:t,flowVersion:r,flow:o}=function(e){return b(e)?{origin:ke.PaymentRequest,flowVersion:e.flowVersion,flow:"payment_request"}:{origin:"c1_login",flowVersion:void 0,flow:void 0}}(i),u=r??(U?"iframe":void 0),m=new URLSearchParams(n.initialRequest.url.search),p=mn(m,"shop_client_uuid")??A??mn(m,"client_uuid")??I;U&&!p&&s.log("shop_pay_login_seamless_missing_client_uuid","[ShopPayLoginFrame] Embedded checkout missing shop_client_uuid for Login Seamless.");const _=new URLSearchParams({flow:o??"",locale:a,origin:t,isPointOfSale:String(k),transaction_params:f??"",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:w});p&&_.set("client_uuid",p);const L=m.get("login_hint");L?_.set("login_hint",L):E&&h&&!g&&!C&&_.set("login_hint",h),!C&&v?.email&&_.set("storefront_account_email",v.email),S&&_.set(Ie,d.variant.isPartner()?dn.Partner:dn.Merchant),g||_.set("authorization",y.authorization??""),P(_,m);const T=new URL("/pay/authentication/login-seamless",R);return T.search=_.toString(),{origin:t,frameUrl:T.href}},[e,P,n.initialRequest.url.search,y,l,v?.email,g,R,S,U,k,a,c.myshopifyDomain,d,A,h,I,i,w,E,C,s,f])};function mn(e,n){return e.get(n)||void 0}function hn({iframeRef:e,iframeOrigin:n,onLoggedIn:t,onResized:i}){const{checkout:a,shopPay:s}=_(),{isEmbeddedShopPayTheme:c}=a.configuration.branding,{dispatchThemeMessage:l,dispatchStyleMessage:d,resolvedParentBackground:u}=Ke({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:c}),m=u.value,h=r(()=>{_e(e.current,{action:ye.Ready}),e.current?.contentDocument?.body&&ne(e.current.contentDocument.body)?.focu
1s(),c&&(l(),d())},[l,d,e,c]);o(()=>{c&&l()},[l,c,m]);const p=r(e=>{s.signup.unstable_setHcaptchaToken(e)},[s.signup]);return ve({onLoaded:h,onLoggedIn:t,onResized:i,onShareCaptchaToken:p}),null}function pn({analyticsTraceId:n,...t}){const i=un(n),r=Ne({analyticsTraceId:n,loginData:i});return e($e,{...t,loginData:i,renderListeners:({iframeOrigin:n,iframeRef:t,onResized:i})=>e(hn,{iframeRef:t,iframeOrigin:n,onLoggedIn:r,onResized:i}),serverDrivenAuth:!1})}function gn({serverRenderedIframe:n,...i}){const{client:r}=_(),o=ze(),a=r.unstable_getSerialization("shopPayLoginAnalyticsTraceId"),s=t(()=>a??be(),[a]);switch(o){case je.OAuth:return e(ln,{...i,analyticsTraceId:s,serverRenderedIframe:n});case je.OAuthWithEmbeddedContext:return e(an,{...i,analyticsTraceId:s});case je.Embedded:return e(Ze,{...i,analyticsTraceId:s});case je.Seamless:return e(pn,{...i,analyticsTraceId:s});default:return h(o)}}function fn({className:n}){const{i18n:t}=_(),i=t.translate("general.loading");return e(F,{accessibilityRole:"status",accessibilityLabel:i,"aria-live":"polite",className:n,children:e(te,{blockSize:"100%",padding:"large-200",gap:"large-100",children:[e(te,{alignItems:"center",gap:"large-100",children:[e(ie,{delay:!1,contentDisplay:"block",inlineSize:"92px",blockSize:"32px"}),e(ie,{delay:!1,contentDisplay:"block",inlineSize:"50%",blockSize:"16px"})]}),e(te,{gap:"small-400",children:e(ie,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"})}),e(ie,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"}),e(F,{paddingBlockStart:"large-200",children:e(te,{alignItems:"center",gap:"large-400",children:[e(ie,{delay:!1,contentDisplay:"block",inlineSize:"34%",blockSize:"14px"}),e(ie,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"14px"})]})})]})})}function _n({serverRenderedIframe:n=!1}={}){const{client:t,environment:i,observability:o}=_(),s=i.services.shopServer.url,c=t.unstable_legacyNavigationPerformance,l=f(),d=a(!1),m=a(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)=>{o.histogram({name:"shop_pay_login_form_visible_duration",value:Math.round(e-b),unit:"ms",attributes:{serverRendered:k,serverRenderedIframe:m.value,revealSource:n}})},[b,o,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 Oe({iframeOrigin:s,observability:o,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",v&&"WC8Ph"),children:[v&&e(fn,{className:We}),e(gn,{hidden:!y,iframeLoaded:d.value,onIframeLoad:R,serverRenderedIframe:h})]}):e(fn,{className:We})}function yn(){const t=f(),{embed:i}=_();return y(i?.embedder)?e(n,{when:t,children:e(vn,{})}):null}function vn(){const{observability:e,source:n,embed:i,environment:r,url:a,shop:s}=_(),{iframeUrl:c,source:l}=function(e=""){const n={seamless:un(e),embedded:Ve(e),oauth:sn(e),oauthWithEmbeddedContext:on(e)},i=ze(),{serverDrivenAuth:r,variant:o}=(e=>{switch(e){case je.OAuth:return{serverDrivenAuth:!0,variant:"oauth"};case je.OAuthWithEmbeddedContext:return{serverDrivenAuth:!0,variant:"oauthWithEmbeddedContext"};case je.Embedded:return{serverDrivenAuth:!0,variant:"embedded"};case je.Seamless:default:return{serverDrivenAuth:!1,variant:"seamless"}}})(i),{frameUrl:a,origin:s,flow:c}=n[o];return{flow:c,iframeOrigin:t(()=>{try{return new URL(a).origin}catch{return""}},[a]),serverDrivenAuth:r,source:s,iframeUrl:a,variant:o}}(),d=i?.client?.embedderHostname;return o(()=>{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(a.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,a,s.myshopifyDomain,n.checkoutSessionIdentifier,e]),null}function bn(){!function(){const{client:e,userEvents:n,source:t,checkout:i,shop:r,shopPay:a}=_(),{redirectSource:s,tracking:c}=a.config,{checkoutSessionIdentifier:l="checkout_identifier_undefined"}=t,d=re(A.SHOP_PAY_LOGIN),u=ee().value;Ee({stage:Ae.Complete,id:"ShopPayLogin"}),o(()=>{I()&&n.monorailEvent({schemaId:"shop_app_page_load/9.0",payload:{...E(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:{...E(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:a}=_(),s="shopPayExternal"===r.type,c=ze(),l=c===je.Seamless,d=t.currentUrl.value,m=d.href===n.initialRequest.url.href&&n.initialRequest.isServerRendered&&c===je.OAuth,{isAppLayout:h}=oe(),p=i.hasFlagEnabled(C)&&!s&&!h&&!I(d.search)&&!a.config.isReferral&&!d.searchParams.has(T)&&!0===n.unstable_getSerialization("shopPayConfig").has_remember_me_cookie&&a.visibility.showCheckoutAsGuestFeature;return e("div",{children:[e(yn,{}),e(de,{padding:"none",dividerDisplay:"@media (inline-size >= medium) none, auto",children:e(F,{padding:"@media (inline-size >= small) none none large-300 none, none",maxInlineSize:"@media (inline-size >= small) 425px, 432px",className:u("oSdnC"),children:e(de,{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(_n,{serverRenderedIframe:m})})})}),a.visibility.showUnauthedOrderSummary&&e(ae,{section:"summary",children:e(se,{section:"summary",children:e(ce,{above:"small",children:e(de,{hideDivider:!0,padding:"none none large-200 none",children:e(De,{})})})})}),p?e(xe,{}):e(Ce,{isShopPayExternal:s})]})}function kn(){const{client:n,observability:t,shopPay:i}=_(),{shouldUseAccessToken:r,user:a}=i,s=L(n.initialRequest.url),l=q(),d=!!l&&B.includes(l),u=g(l),h=le(),p=c(()=>"shopPayLogin"===h.value.currentDetour?.type),f=j(),y=c(()=>f()),v=i.accessToken.value,{refetch:b}=x(z,{isOnShopPayLoginDetour:p,newSignupLoginVariant:u,simulatedBuyerDetails:y}),[k,S]=m(!1),w=!r||Boolean(v),R=a.email.value,I=d&&!s||Boolean(k&&R&&w),P=null==l||I;O(P);const U=n.unstable_legacyNavigationPerformance,{progress:D}=G();return o(()=>{const e=i.session.initialization.peek();"failed"===e.status&&"fetch"===e.reason&&i.session.unstable_setInitialization({status:"pending"})},[i.session]),o(()=>{v&&(s||(b(),S(!0)))},[v,s,b]),o(()=>{I&&(U?.usable(),D("shop-pay-login-loader-complete"))},[I,U,D]),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(bn,{})}export{kn 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.