1import{s as e,T as t,x as o,_ as n,u as r,l as a,m as i,v as s,W as c,S as u,a7 as l,C as d}from"./2c1ab0fe.GMbxnz74.js";import{S as p,T as m,eW as f,eX as h,eY as v,a9 as g,aZ as y,eZ as k,bk as w,e_ as S,e$ as E,f0 as P,f1 as b,bf as _,eq as M,b0 as C,f2 as L,bv as I}from"./4c290a1e.C6TDJ9Fn.js";import{eR as T,b8 as A,M as x,fe as N,Q as V,aW as O,aX as D,fg as R,fh as U,fi as j,e4 as H,e5 as B,a6 as F,fj as W}from"./164ad2e3.BbIvMjRY.js";import{L as $}from"./74835653.CRP9zX7D.js";import{a as z}from"./a25deb9a.DBfpGDzj.js";import{u as G}from"./2fdb3dd3.YdlRJDkL.js";import{a as q}from"./29034f35.BtTRppF-.js";import{p as Q,S as J,a as X,b as Y,M as Z,A as K,c as ee}from"./91319467.CaV5Q69j.js";import{i as te,a as oe,u as ne,b as re,c as ae,d as ie,A as se,e as ce,r as ue,S as le,M as de,I as pe,f as me,R as fe,P as he,g as ve,h as ge,j as ye,k as ke}from"./c57e39e6.BkBRz_xN.js";import"./app.CepNJbvh.js";import"./9f047e05.CCJUgz_L.js";import"./0a7dffce.DfUtZWCu.js";import"./5fda1420.KYpufQ--.js";import"./60a453ce.Ck
1hHeRBc.js";import"./21cc90a2.DAzJmttM.js";import"./bb728e1c.iawBHR84.js";import"./31cc568e.eY_zQ4dB.js";import"./47b970b2.hK1atmf1.js";import"./0727407f.CsUvC--9.js";import"./064f6ac1.B1U3VPaO.js";import"./53bbdad9.CGJC_1cv.js";import"./efa0389a.Cyj781OI.js";import"./ac5a19ff.CRrh5Bdw.js";import"./2210eadb.DF0gIp_2.js";function we({element:t}){return e(()=>{t?.current&&t.current?.focus&&t.current.focus()},[t])}function Se({children:a,offset:i,arrowOffset:s,contentWidth:c,contentHeight:u,placement:l="inlineEnd",activator:d,open:p}){const m=function(t){const[r,a]=o(null),i=e(()=>{null!==t&&a(t.getBoundingClientRect())},[t]);return n(()=>(i(),window.addEventListener("resize",i),window.addEventListener("scroll",i),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i)}),[i]),r}(d??null),[f,h]=function(){const[t,n]=o(null);return[t,e(e=>{null!==e&&n(e.getBoundingClientRect())},[])]}(),{offsets:v,spacing:g}=t(()=>p?function(e,t,o,n,{offset:r=0,arrowOffset:a=0}={}){let i={x:0,y:0},s={left:0,right:0},c=0;if(!t&&!o)return{offsets:i,spacing:c};if(!n){const{clientWidth:e,clientHeight:n}=document.documentElement;return i={x:e/2-t/2,y:n/2-o/2},{offsets:i,spacing:c}}switch(e){case"blockEnd":i={x:"rtl"===(document?.dir??"ltr")?n.left:n.right-t,y:n.bottom+r};break;case"inlineEnd":i={x:"rtl"===(document?.dir??"ltr")?n.left-t-r:n.right+r,y:n.top+n.height/2-a}}return s=function(e,t){const o=document.documentElement.clientWidth,n=e.x+t;let r={left:0,right:0};return n>o&&(r={...r,right:o-n}),e.x<0&&(r={...r,left:-e.x}),r}(i,t),s.right&&!s.left?(i.x+=s.right,c=-10):!s.right&&s.left&&(i.x=0,c=10),{offsets:i,spacing:c}}(l,(c||f?.width)??0,(u||f?.height)??0,m,{offset:i,arrowOffset:s}):{offsets:{x:0,y:0},spacing:0},[i,s,l,f,m,p,c,u]),{x:y,y:k}=t(()=>p?function({x:e,y:t}){const o=window.devicePixelRatio||1;return{x:Math.round(e*o)/o||0,y:Math.round(t*o)/o||0}}({x:v.x+g+(window.scrollX||window.pageXOffset),y:v.y+(window.scrollY||window.pageYOffset)}):{x:0,y:0},[v,g,p]),w=t(()=>p?(window.devicePixelRatio||1)<2?`translate(${y}px, ${k}px)`:`translate3d(${y}px, ${k}px, 0)`:"none",[p,y,k]);return r(A,{children:r("div",{className:"qdHCv",style:{...f&&{transform:w,MozTransform:w,WebkitTransform:w}},ref:h,"aria-hidden":!p,children:a})})}const Ee={Backdrop:"hgqpU","Backdrop-visible":"LTbS5",BackdropLinearGradient:"axmya",Popover:"JHj7j",Content:"hQvGd",PopoverArrow:"PMbsk",PopoverOpen:"wA8HY","Popover-placementInlineEnd":"trTaz","Popover-placementBlockEnd":"KMvI7",Bumper:"xnzQ4"},Pe=V("Popover");function be({children:t,activator:o,open:l,placement:d="inlineEnd",contentWidth:p,contentHeight:m,onClose:f}){const h=a(null),v=a(null),g=a(null),y=x(void 0,Pe),k=N(),w=e(()=>{"BUTTON"===o?.tagName&&(o?.setAttribute("aria-controls",y),o?.setAttribute("aria-expanded",String(l)))},[o,l,y]),S=e(e=>{f?.(e)},[f]),E=e(e=>{e.target instanceof Node&&!o?.contains(e.target)&&document.contains(e.target)&&!g.current?.contains(e.target)&&l&&S(e)},[S,o,l,g]),P=e(e=>{if(l)switch(e.key){case"Escape":case"Esc":S(),o?.focus()}},[S,o,l]);i(()=>(document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}),[E]),i(()=>(l&&document.addEventListener("keydown",P,!1),()=>{document.removeEventListener("keydown",P,!1)}),[l,P]),i(()=>{w()}),n(()=>{l&&g.current?.focus({preventScroll:!0})},[l]);const b=e=>{const t=g.current;if(t){const o=e?O(t):D(t);o?o.focus():t.focus()}},_=s(Ee.Popover,Ee[c("Popover-placement",d)],l&&Ee.PopoverOpen,o&&Ee.PopoverArrow);return r(u,{children:[r(Se,{activator:o,placement:d,offset:15,arrowOffset:30,open:l,contentWidth:p,contentHeight:m,children:[l&&r("button",{className:Ee.Bumper,ref:h,"aria-hidden":"true",onFocus:()=>b(!1),type:"button"}),r("div",{className:_,id:y,ref:g,children:r("div",{className:Ee.Content,children:t})}),l&&r("button",{className:Ee.Bumper,ref:v,"aria-hidden":"true",onFocus:()=>b(!0),type:"button"})]}),r("div",{className:s(Ee.Backdrop,l&&Ee["Backdrop-visible"],l&&k&&Ee.BackdropLinearGradient)})]})}var _e=(e=>(e.Normal="normal",e.CustomerAccount="customer_account",e.AccountsSameStore="accounts_same_store",e.AccountsCrossStore="accounts_cross_store",e))(_e||{});function Me({email:e,skipVerifyOnLoad:t,iframeReady:o,iframeRef:n,dismissedModalKey:r,readyToDismiss:s,onReadyToDismiss:c,showPopover:u,showToggle:l,popoverActivator:d,open:h,automaticVerificationEnabled:v}){const _=m().buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:M}}=g(),{isDismissedGuestModal:C}=R(),{checkout:L,client:I,shopPay:T,source:A}=p(),{checkoutProtocolModalEventSignal:x}=y(),N=U(w.ShopPayVerification,{scope:k(A)}),V=L.negotiator.throttleState.peek().token,O=a();return i(()=>
1{if(!o)return void(O.current=void 0);if(t.current)return void(t.current=!1);const a=_&&I.cookies.get(r),i=e&&S(e),s="connected"===M.value.status,c=_&&function(){const e=sessionStorage.getItem(b);if(!e)return!1;const t=Number.parseInt(e,10);return!isNaN(t)&&Date.now()<t}();i?a||s||c||(N.value!==j.Verified?(v||h)&&O.current!==e&&(O.current=e,Q(n?.current,{action:J.Create,email:e,flow:_e.Normal,disableAutoFocus:C()})):N.value=void 0):O.current=void 0},[e,o,v,h]),{onShow:function(){if(!A.checkoutSessionIdentifier)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::GuestCheckout"});if((!_||!I.cookies.get(r))&&e&&S(e)){s||c(),V&&Q(n?.current,{action:J.CheckoutQueueToken,queueToken:V}),T.setUserIdentified(escape(A.checkoutSessionIdentifier));const t=new URL(window.location.href);t.searchParams.delete(E),history.replaceState(null,"",t.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),N.value=j.Pending,C()?l?.(!0):(u(!0,e),l?.(!1))}},onHidden:function(){s&&(N.value=j.Dismissed,_&&I.cookies.set(r,"true"),d?.current?.focus(),u(!1),l?.(!0))},onLoggedIn:function(){P(),N.value=j.Verified,x.value="none"}}}const Ce=[K.FraudGuard,K.InvalidPhone,K.LimitExceeded,K.PhoneBlocked];function Le({email:t,onSetEmail:o,skipVerifyOnLoad:n,iframeReady:r,iframeRef:s,readyToDismiss:c,onReadyToDismiss:u,showPopover:l,popoverActivator:d,origin:m,open:h,automaticVerificationEnabled:v}){const{shopPay:g,source:{checkoutSessionIdentifier:k}}=p(),{openModal:w}=H(),{exchangeSessionTokenForCookie:E}=X(),{extendBuyerIdentity:b}=Y(),_=a(null),M=a(!1),C=a(),{checkoutProtocolModalEventSignal:L}=y(),I=e(()=>{s.current&&Q(s.current,{action:J.Create,email:"",flow:_e.Normal})},[s]);return i(()=>{s.current&&r&&m===T.C1ModalShopPaySignIn&&(Q(s.current,{action:J.AllowNoInitialEmail}),I(),Q(s.current,{action:J.Ready}))},[r,s,m,I]),i(()=>{h&&(_.current=null)},[h]),i(()=>{M.current&&s.current&&r&&(M.current=!1,I())}),i(()=>{function e(){o&&(g.updateUserVerification({status:"none"}),o(""),d?.current?.focus()),M.current=!0}return window.addEventListener("shop_pay_verification_reset",e),()=>{window.removeEventListener("shop_pay_verification_reset",e)}},[d,l,o,s,g]),i(()=>{if(!r)return void(C.current=void 0);if(n.current)return void(n.current=!1);const e=t&&S(t),o=v||h;if(!e||m===T.C1ModalShopPaySignIn||o)if(e&&m!==T.C1ModalShopPaySignIn){if(C.current===t)return;C.current=t,g.updateUserVerification({email:t,status:"loading"}),Q(s?.current,{action:J.Create,email:t,flow:_e.Normal})}else m!==T.C1ModalShopPaySignIn&&(C.current=void 0,I(),g.updateUserVerification({status:"none"}))},[t,r,n,s,m,v,h,g,I,l]),{onShow:function(){if(!k)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopPayCheckout"});m===T.C1ModalShopPay&&t&&S(t)&&(c||u(),g.updateUserVerification({email:t,status:"found"}),l(!0,t))},onHidden:function(){if(m===T.C1ModalShopPay&&!c)return;const e=_.current;null!=o&&null!=e&&("found"!==e.status||m===T.C1ModalShopPay||!t)&&(o(e.email??""),g.updateUserVerification(e),d?.current?.focus()),"found"===g.userVerification.value.status?w({type:B.ContinueWithShopPay,email:g.userVerification.value.email}):d?.current?.focus(),l(!1),_.current=null},onEmailChange:function(e,t){e?(_.current||g.userVerification.value.email!==e)&&(_.current={email:e,status:t?"found":"new"}):_.current={status:"none"}},onError:function(e,t,o){if((!o||o===g.userVerification.value.email)&&(e===Z.ShopifyPayUserNotFound&&Ce.includes(t)&&(l(!1),w({type:B.Generic})),o)){const e=t===K.InvalidEmail;g.updateUserVerification({email:o,status:e?"invalid":"new"})}},onLoggedIn:async function(e){P(),L.value="none",e&&(await E({token:e,origin:m}),b(),window.location.reload())}}}function Ie({email:e,onSetEmail:n,open:s,popoverActivator:c,showPopover:u,showToggle:l,urlOrigin:d=T.C1Modal,updatedOrigin:g=d,onIframeLoaded:k,automaticVerificationEnabled:w=!0}){const S=F({base:"blockEnd",medium:"inlineEnd"}),[P,b]=o(!1),[I,A]=o(300),[x,N]=o(!1),{i18n:V,shopPay:O,shop:D,source:{checkoutSessionIdentifier:R}}=p(),U=a(null),[j,H]=o(!1),{checkoutProtocolModalEventSignal:B}=y(),W=M(e,L),X=`${R}-${e.replace(/[^a-zA-Z0-9]/g,"")}`,Y=q().value,te=a(Y),{onShow:oe,onHidden:ne,onError:re,onEmailChange:ae,onLoggedIn:ie}=function(e){const{observability:t}=p(),o=a(e),n=o.current,r=e===o.current?void 0:`Callback hook changed from ${o.current.name} to ${e.name} between renders.`;return i(()=>{r&&t.error(new _(`${r} Only the original hook is called.`,{groupingHash:"ShopPayError::OnlyOriginalHookCalled"}),{severity:"warning",errorClass:"ShopPay::ShopPayVerification::useStableHook"})},[r,t]),n}(O.user.isUnauthenticatedUser.value?Le:Me)({email:W,onSetEmail:n,skipVerifyOnLoad:te,iframeReady:P,iframeRef:U,dismissedModalKey:X,readyToDismiss:x,onReadyToDismiss:()=>{setTimeout(()=>N(!0),1e3)},showPopover:u,showToggle:l,popoverActivator:c,origin:g,open:s,automaticVerificationEnabled:w});ee({targetId:d,onReady:oe,onClosed:function(){H(!0)},onLoggedIn:ie,onHidden:ne,onError:function(e,t,o){re?.(e,t,o),e===Z.ShopifyPayUserNotFound&&O.setUserIdentified(null);const n=new URL(window.location.href);t===K.LimitExceeded?n.searchParams.set(E,"true"):n.searchParams.delete(E),history.replaceState(null,"",n.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))},onResized:function(e){!isNaN(e)&&e&&A(e)},onLoaded:()=>{b(!0),k()},onEmailChange:ae}),i(()=>{Q(U?.current,{action:J.OriginChanged,origin:g})},[g]),i(()=>{const e=s?J.Ready:J.Hidden;if(Q(U?.current,{action:e}),B.value=s?"shopPayVerification":"none",U.current&&s&&U.current.focus(),s&&D.hasFlagEnabled(C))return()=>{B.value="none"}},[B,s,D]);const se=(e=>{const{environment:o,i18n:{locale:n},shop:{myshopifyDomain:r},source:{checkoutSessionIdentifier:a},shopPay:i}=p(),s=G(),c=m().buyerIdentity.value?.customerProfile,{redirectUrl:u,transactionParams:l,tokens:d}=i.config,g=d.iframe,y=z();return t(()=>{if(!a)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::ULCFrame"});if(!y)return;if(!g||!u)return;const t=new URLSearchParams({shopify_domain:r,checkout_token:a,origin:e,locale:n,iframe_token:g,redirect_url:u,transaction_params:l??"",shop_pay_new_signup_login_variant:y});for(const[e,o]of s.entries())t.set(e,o);e===T.C1InlineModal&&t.set(h,v.ShopPayAsPaymentMethod),c?.email&&t.set("fast_login","true");const i=t.toString(),d=new URL("/pay/transactions/new/email",o.services.payShopifyCom.url);return d.search=i,d.href},[e,r,a,n,g,u,l,y,s,c,o])})(d);return i(()=>()=>{b(!1)},[se]),se?r(be,{activator:s?c?.current:void 0,open:s,onClose:ne,placement:S,contentWidth:320,contentHeight:I,children:r($,{active:j||!P,size:"large",children:r("iframe",{id:"shop-pay-verification-iframe",title:V.translate("verification.title"),ref:U,src:se,height:I,width:320,className:"B1y2m",allow:"publickey-credentials-get *",referrerPolicy:"origin"},se)})}):null}function Te(e){const{checkoutToken:t,checkoutVersion:o,shopPermanentDomain:n}=e;return{checkoutVersion:o,checkoutToken:t,flow:"checkout_modal",shopPermanentDomain:n}}const Ae=({anchorTo:n,email:s,experiments:c,preventOverlayDismissOnClick:u,queueToken:l,totalDue:d,...p})=>{const{modalVisible:m}=ne(),f=a(null);!function({email:n,emailInputSelector:r,onGetEmailInput:s,hideChange:c,iframeRef:u,shouldListen:l=!0,shouldOpenOnMatch:d=!0}){const{loaded:p,modalVisible:m}=ne(),{leaveBreadcrumb:f,notify:h}=re(),{trackUserAction:v}=ae(),{isFilledWithPasswordManager:g}=function({emailInputSelector:e}){const[n,r]=o(),[a,s]=o();return i(()=>{function t(e){"password"===this.type?s(e.timeStamp):r(e.timeStamp)}if(e){const o=oe.querySelector(e);
1if(o){o.addEventListener("input",t);const e=o.form?.querySelector('input[type="password"]');return e&&e instanceof HTMLInputElement&&e.addEventListener("input",t),()=>{o.removeEventListener("input",t),e&&e.removeEventListener("input",t)}}}},[e]),{isFilledWithPasswordManager:t(()=>void 0!==n&&void 0!==a&&Math.abs(n-a)<100,[n,a])}}({emailInputSelector:r}),y=a(null),[k,w]=o(),[S,E]=o(),[P,b]=o(),_=a(null),M=a(""),C=t(()=>new Set,[]),L=e(async(e,t="",o="")=>{const n=ie(e);if(g&&!C.has("PASSWORD_MANAGER_AUTOFILL_DETECTED")&&(C.add("PASSWORD_MANAGER_AUTOFILL_DETECTED"),v({userAction:"PASSWORD_MANAGER_AUTOFILL_DETECTED"})),n&&!C.has("EMAIL_ENTERED")&&(C.add("EMAIL_ENTERED"),v({userAction:"EMAIL_ENTERED"})),f("email entered",{},"state"),!u.current||m)return;if(!p)return;const r=n?e:"";y.current&&!y.current?.signal.aborted&&y.current.abort(),y.current=new AbortController;try{const{open:e,postMessage:n,waitForMessage:a}=u.current;M.current=r,n({firstName:t,lastName:o,type:"namesubmitted"}),n({email:r,hideChange:void 0===c?r.length>0:c,type:"emailsubmitted"}),f("email submitted",{email:r?"redacted":""},"state");const i=a("shop_user_matched",y.current.signal),s=new Promise((e,t)=>{const o=async()=>{try{const t=await a("error",y.current.signal);"error"===t.type&&"captcha_challenge"===t.code?e(void 0):await o()}catch(n){t(n)}};o()});await Promise.race([i,s]),d&&(e("event_shop_user_matched"),_?.current?.blur(),function(){if(!te())return;const e="shop-pay-safari-unzoom",t=oe.getElementById(e);if(t)return t.focus();const o=oe.createElement("input");o.id=e,o.style.fontSize="16px",o.style.width="1px",o.style.height="1px",o.style.position="fixed",o.style.bottom="-1000px",o.style.right="-1000px",o.style.transform="translate(1000px, 1000px)",o.setAttribute("aria-hidden","true"),oe.body.appendChild(o),o.focus({preventScroll:!0})}()),y.current.abort(),w(void 0)}catch(a){if(a instanceof se&&"AbortSignalReceivedError"===a.name)return;a instanceof Error&&h(new Error(`Error updating user info: ${a.name} - ${a.message}`))}},[c,u,g,f,p,m,h,d,v,C]),I=ce((e,t,o)=>{L(e,t,o)},200);i(()=>{void 0!==k&&p&&I(k,S,P)},[I,k,p,S,P]),i(()=>{if(!r&&!s)return;const e=r?oe.querySelector(r):s?.();if(!e)return;_.current=e;const t=()=>{e&&w(e.value)};if(e?.value&&t(),l)return e?.addEventListener("input",t),()=>{e?.removeEventListener("input",t)};e?.removeEventListener("input",t)},[r,s,l]),i(()=>{void 0!==n&&w(n)},[n])}({email:s,iframeRef:f});const{postMessageAfterLoad:h}=function({iframeRef:e}){const{loaded:t}=ne();return{postMessageAfterLoad:async function(o){if(!e.current)return;const{postMessage:n,waitForMessage:r}=e.current;t||await r("loaded"),n(o)}}}({iframeRef:f}),{trackUserAction:v}=ae(),{leaveBreadcrumb:g}=re();i(()=>{const e=new URL(he).origin,t=t=>{if(t.origin===e&&"completed"===t.data?.type&&(g("oauth completed from popup",{},"state"),void 0!==ve&&"parent"in ve&&ve.parent&&ve.parent!==ve)){g("forwarding completion to parent window",{},"state");const e="ancestorOrigins"in ve.location?ve.location.ancestorOrigins:void 0,t=e?.[0];t&&ve.parent.postMessage({type:"completed",origin:he},t)}};return ve.addEventListener("message",t),()=>{ve.removeEventListener("message",t)}},[g]);const y=t(()=>({open:async()=>{m||(f.current?.open("user_button_clicked"),v({userAction:"OPEN_CALLED"}),g("open called",{},"state"))}}),[m,v,g]);ge(y);const{trackShopPayModalStateChange:k}=function(){const{analyticsData:t,produceMonorailEvent:o}=ae();return{trackShopPayModalStateChange:e(({currentState:e,zoom:n})=>{const{analyticsTraceId:r,checkoutToken:a,checkoutVersion:i,shopPermanentDomain:s}=t,c={previousState:"",currentState:e,clientTimestampMs:(new Date).getTime(),analyticsTraceId:r,checkoutToken:a||"",checkoutVersion:i||"",shopifyDomain:s||"",zoom:n};o({event:{payload:c,schemaId:"shopify_pay_modal_state_change/1.3"}})},[t,o])}}(),w=e(()=>{k({currentState:"loaded",zoom:`${ve.visualViewport?.scale}`})},[k]),S=e(e=>{k({currentState:e?"shown":"hidden",zoom:`${ve.visualViewport?.scale}`})},[k]);i(()=>{if(l||d){const e={totalDue:Number(d)||0,checkoutQueueToken:l||""};h({type:"checkoutcontextsubmitted",checkoutContext:e}),l&&h({type:"checkoutqueuetokensubmitted",checkoutQueueToken:l})}},[h,l,d]);const{authorizeUrl:E}=ye({analyticsContext:"loginWithShopCheckoutModal",avoidSdkSession:!0,clientId:"",disableSignUp:!0,flow:"checkout_modal",proxy:!0,redirectType:"iframe",responseType:"code",uxMode:"iframe",...p}),P=t(()=>{if(u)return!1;try{if(!c)return!0;return"treatment"!==JSON.parse(c).e_7585671bd434a1fca2d05deff50a41ee}catch{return!0}},[c,u]);return r(ke,{anchorTo:n,dismissable:P,keepModalOpen:!0,onLoaded:w,onModalVisibleChange:S,proxy:!0,ref:f,src:E,sandbox:!0,variant:"checkoutModal",scrolling:"no"})},xe=({shopCheckoutModal:e,eventName:t,eventListener:o})=>{i(()=>(e?.addEventListener(t,o),()=>e?.removeEventListener(t,o)),[o,t,e])};function Ne({email:n,open:s,popoverActivator:c,popoverAnchorSelector:u,showPopover:d,showToggle:h,onIframeLoaded:v,automaticVerificationEnabled:S=!0}
1){const E=c?.current,b=l(null),[_,M]=o(!1),C=a(!1),{client:L,shop:{myshopifyDomain:T,storefrontUrl:A},shopPay:x,source:N,checkout:{wallets:V,negotiator:{throttleState:O}}}=p(),{redirectUrl:D,transactionParams:H}=x.config,B=m().buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:F}}=g(),{isDismissedGuestModal:W}=R(),$=we({element:c}),z=t(()=>O.peek().token,[O]),{value:G}=I(),{checkoutProtocolModalEventSignal:Q}=y(),J=U(w.ShopPayVerification,{scope:k(N)}),X=`${N.checkoutSessionIdentifier}-${n.replace(/[^a-zA-Z0-9]/g,"")}`,Y=q().value,Z=a(Y);i(()=>{if(Z.current)return Z.current=!1,void M(!1);const e=W(),t=B&&L.cookies.get(X),o="connected"===F.value.status;if(!(e||t||o))return J.value===j.Verified?(J.value=void 0,void M(!1)):void M(!0);M(!1)},[n]);const K=e(()=>{P(),J.value=j.Verified,Q.value="none"},[Q,J]);xe({shopCheckoutModal:b.value,eventName:"completed",eventListener:K});const ee=e(()=>{if(!N.checkoutSessionIdentifier)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopJSVerification"});x.setUserIdentified(escape(N.checkoutSessionIdentifier)),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),J.value=j.Pending,d?.(!0,n),h?.(!1)},[N.checkoutSessionIdentifier,n,x,J,d,h]);xe({shopCheckoutModal:b.value,eventName:"modalopened",eventListener:ee});const te=e(()=>{J.value=j.Dismissed,B&&L.cookies.set(X,"true"),d?.(!1),h?.(C.current),M(!1),$()},[B,X,J,d,h,$,L.cookies]);xe({shopCheckoutModal:b.value,eventName:"modalclosed",eventListener:te});const oe=e(()=>{C.current=!0},[]);xe({shopCheckoutModal:b.value,eventName:"shopusermatched",eventListener:oe});const ne=e(e=>{C.current=!1,x.setUserIdentified(null),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))},[x]);xe({shopCheckoutModal:b.value,eventName:"shopusernotmatched",eventListener:ne}),xe({shopCheckoutModal:b.value,eventName:"loaded",eventListener:v}),i(()=>{E&&s&&(b.peek()?.open(),E.blur())},[E,n,s,b]),i(()=>{if(s)return Q.value="shopPayVerification",()=>{Q.value="none"}},[Q,s]);const re=s||S&&_?n:"";if(!D||V.activeSession.value)return null;const ae=E?.id?`input#${ie=E.id,"undefined"!=typeof CSS&&CSS.escape?CSS.escape(ie):ie}`:"";var ie;return r("shop-checkout-modal",{"anchor-to":u??ae,"checkout-redirect-url":D,"checkout-token":N.checkoutSessionIdentifier,"checkout-version":"checkout_one",email:re,"prevent-overlay-dismiss-on-click":!0,"queue-token":z||"","total-due":G?.amount?.toString()||"0",ref:b,"shop-permanent-domain":T,"transaction-params":H,"storefront-domain":A})}"undefined"==typeof window||"undefined"==typeof customElements||customElements.get("shop-checkout-modal")||ue(({element:e,...t})=>r(fe,{element:e,featureName:"ShopCheckoutModal",children:r(le,{children:r(de,{monorailProps:Te(t),children:r(pe,{children:r(me,{children:r(Ae,{...t})})})})})}),{methods:["open"],name:"shop-checkout-modal",props:{anchorTo:"string",checkoutRedirectUrl:"string",checkoutToken:"string",checkoutVersion:"string",email:"string",embed:"string",experiments:"string",preventOverlayDismissOnClick:"boolean",queueToken:"string",shopId:"number",shopPermanentDomain:"string",shopifyEssential:"string",totalDue:"string",transactionParams:"string",storefrontDomain:"string"},shadow:"open"});const Ve=e=>r(u,{children:r(Ne,{...e})}),Oe=({email:o,onSetEmail:n,open:s,popoverActivator:c,popoverAnchorSelector:u,showPopover:l,showToggle:m,urlOrigin:f=T.C1Modal,updatedOrigin:h=T.C1Modal})=>{const{shopPay:{user:{hasFlow:v}},embed:g,webMcp:y,checkout:{identity:k},observability:w}=p(),E="shopPay"===k.current.value,P=y?.hasToolCallStarted.value??!1,b=!g&&(E||!P),_=we({element:c});d(()=>{const e=y?.hasToolCallStarted.value;e&&s&&!E&&(l(!1),_())});const M=t(()=>W(),[]),C=t(()=>W(),[]),L=a(!0),I=t(()=>({isC1:!0,shopJsVerification:!E}),[E]);i(()=>{S(o)&&(M.mark("start"),L.current=!0)},[M,o]),i(()=>{if(s&&L.current&&M.marks.start&&I){M.mark("open"),L.current=!1;const e=Math.round(M.marks.open-M.marks.start);w.histogram({name:"shop_pay_verification_time_to_interactive",value:e,attributes:I});const t=Math.round(M.marks.open-Math.max(M.marks.start,M.marks.loaded||0));w.histogram({name:"shop_pay_verification_time_to_interactive_after_load",value:t,attributes:I})}},[s,w,M,I]),i(()=>{C.mark("start")},[C]);const A=e(()=>{if(C.marks.start){C.mark("loaded"),M.mark("loaded");const e=Math.round(C.marks.loaded-C.marks.start);w.histogram({name:"shop_pay_verification_iframe_ready_duration",value:e,attributes:I})}},[C,M,w,I]);return E&&!v.value?null:E?r(Ie,{popoverActivator:c,email:o,onSetEmail:n,open:s,showPopover:l,showToggle:m,urlOrigin:f,updatedOrigin:h,onIframeLoaded:A,automaticVerificationEnabled:b}):P&&!s?null:r(Ve,{popoverActivator:c,popoverAnchorSelector:u,email:o,open:s,showPopover:l,showToggle:m,onIframeLoaded:A,automaticVerificationEnabled:b})};export{Oe 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.