import{aU as Ue,kp as Oe,bE as le,dW as ve,ao as Ee,aR as Le,aS as re,ek as $e,bO as B,en as ce,er as H,kq as Be,h1 as Fe,ab as N,q as A,cV as Pe,a,kr as je,aj as M,cj as He,ck as ze,ks as We,ak as E,as as me,ea as Ge,n as de,ey as qe,kt as Ke,br as we,ku as Ae,ef as oe,kv as Ie,gr as Ce,gq as ie,kw as be,eF as ue,kx as ne,ky as q,kz as Me,kA as De,kB as he,c4 as X,kC as Je,kD as Ye,kE as _e,i as Qe,kF as Ze,aF as Xe,e as et,dU as tt,gg as nt,kG as rt,kH as Te,kI as ot,kJ as st,_ as y,il as it,aW as at,kK as ke}from"./app.owqgWGYv.js";import{p as K,S as W,u as ct,a as ut,M as xe,A as Z,b as lt}from"./useSubscribeMessenger.Bkh-o6J2.js";import{i as dt,a as te,u as pe,b as Ve,c as fe,d as ht,e as pt,A as ft,f as Ne,r as mt,R as _t,P as se,g as C,h as kt,j as yt,M as gt,k as St,l as vt,m as Et}from"./index.CZo637rF.js";const Lt=t=>{const e=Ue(),n=Oe(),r=le(),{iframe_token:s,redirect_url:p,transaction_params:c}=ve(),{locale:o}=Ee().i18n,{myshopifyDomain:i}=Le(),{checkoutSessionIdentifier:u}=re(),h=$e();return B(()=>{if(!u)throw new ce({groupingHash:"ShopPayCheckoutIdentifierMissingError::ULCFrame"});if(!h||!(s&&p))return;const g=new URLSearchParams({shopify_domain:i,checkout_token:u,origin:t,locale:o,iframe_token:s,redirect_url:p,transaction_params:c??"",shop_pay_new_signup_login_variant:h});for(const[d,P]of n.entries())g.set(d,P);t===H.C1InlineModal&&g.set(Be,Fe.ShopPayAsPaymentMethod),r?.email&&g.set("fast_login","true");const _=g.toString(),v=new URL("/pay/transactions/new/email",e.services.payShopifyCom.url);return v.search=_,v.href},[t,i,u,o,s,p,c,h,n,r,e])},ye=10;function Pt({x:t,y:e}){const n=window.devicePixelRatio||1;return{x:Math.round(t*n)/n||0,y:Math.round(e*n)/n||0}}function wt(t,e,n,r,{offset:s=0,arrowOffset:p=0}={}){let c={x:0,y:0},o={left:0,right:0},i=0;if(!e&&!n)return{offsets:c,spacing:i};if(!r){const{clientWidth:u,clientHeight:h}=document.documentElement;return c={x:u/2-e/2,y:h/2-n/2},{offsets:c,spacing:i}}switch(t){case"blockEnd":c={x:(document?.dir??"ltr")==="rtl"?r.left:r.right-e,y:r.bottom+s};break;case"inlineEnd":c={x:(document?.dir??"ltr")==="rtl"?r.left-e-s:r.right+s,y:r.top+r.height/2-p};break}return o=At(c,e),o.right&&!o.left?(c.x+=o.right,i=-ye):!o.right&&o.left&&(c.x=0,i=ye),{offsets:c,spacing:i}}function At(t,e){const n=document.documentElement.clientWidth,r=t.x+e;let s={left:0,right:0};return r>n&&(s={...s,right:n-r}),t.x<0&&(s={...s,left:-t.x}),s}function It(){const[t,e]=N(null),n=A(r=>{r!==null&&e(r.getBoundingClientRect())},[]);return[t,n]}function Ct(t){const[e,n]=N(null),r=A(()=>{t!==null&&n(t.getBoundingClientRect())},[t]);return Pe(()=>(r(),window.addEventListener("resize",r),window.addEventListener("scroll",r),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r)}),[r]),e}const bt="qdHCv",Mt={Popper:bt};function Dt({children:t,offset:e,arrowOffset:n,contentWidth:r,contentHeight:s,placement:p="inlineEnd",activator:c,open:o}){const i=Ct(c??null),[u,h]=It(),{offsets:l,spacing:g}=B(()=>o?wt(p,(r||u?.width)??0,(s||u?.height)??0,i,{offset:e,arrowOffset:n}):{offsets:{x:0,y:0},spacing:0},[e,n,p,u,i,o,r,s]),{x:_,y:v}=B(()=>o?Pt({x:l.x+g+(window.scrollX||window.pageXOffset),y:l.y+(window.scrollY||window.pageYOffset)}):{x:0,y:0},[l,g,o]),d=B(()=>o?(window.devicePixelRatio||1)<2?`translate(${_}px, ${v}px)`:`translate3d(${_}px, ${v}px, 0)`:"none",[o,_,v]);return a(je,{children:a("div",{className:Mt.Popper,style:{...u&&{transform:d,MozTransform:d,WebkitTransform:d}},ref:h,"aria-hidden":!o,children:t})})}const Tt="hgqpU",xt="axmya",Vt="JHj7j",Nt="hQvGd",Rt="PMbsk",Ut="wA8HY",Ot="xnzQ4",j={Backdrop:Tt,"Backdrop-visible":"LTbS5",BackdropLinearGradient:xt,Popover:Vt,Content:Nt,PopoverArrow:Rt,PopoverOpen:Ut,"Popover-placementInlineEnd":"trTaz","Popover-placementBlockEnd":"KMvI7",Bumper:Ot},$t=ze("Popover");function Bt({children:t,activator:e,open:n,placement:r="inlineEnd",contentWidth:s,contentHeight:p,onClose:c}){const o=M(null),i=M(null),u=M(null),h=He(void 0,$t),l=We(),g=A(()=>{e?.tagName==="BUTTON"&&(e?.setAttribute("aria-controls",h),e?.setAttribute("aria-expanded",String(n)))},[e,n,h]),_=A(m=>{c?.(m)},[c]),v=A(m=>{m.target instanceof Node&&!e?.contains(m.target)&&document.contains(m.target)&&!u.current?.contains(m.target)&&n&&_(m)},[_,e,n,u]),d=A(m=>{if(n)switch(m.key){case"Escape":case"Esc":_(),e?.focus();break}},[_,e,n]);E(()=>(document.addEventListener("click",v),()=>{document.removeEventListener("click",v)}),[v]),E(()=>(n&&document.addEventListener("keydown",d,!1),()=>{document.removeEventListener("keydown",d,!1)}),[n,d]),E(()=>{g()}),Pe(()=>{n&&u.current?.focus({preventScroll:!0})},[n]);const P=m=>{const w=u.current;if(w){const I=m?qe(w):Ke(w);I?I.focus():w.focus()}},L=me(j.Popover,j[Ge("Popover-placement",r)],n&&j.PopoverOpen,e&&j.PopoverArrow);return a(de,{children:[a(Dt,{activator:e,placement:r,offset:15,arrowOffset:30,open:n,contentWidth:s,contentHeight:p,children:[n&&a("button",{className:j.Bumper,ref:o,"aria-hidden":"true",onFocus:()=>P(!1),type:"button"}),a("div",{className:L,id:h,ref:u,children:a("div",{className:j.Content,children:t})}),n&&a("button",{className:j.Bumper,ref:i,"aria-hidden":"true",onFocus:()=>P(!0),type:"button"})]}),a("div",{className:me(j.Backdrop,n&&j["Backdrop-visible"],n&&l&&j.BackdropLinearGradient)})]})}const Ft="B1y2m",jt={VerificationIframe:Ft};var ae=(t=>(t.Normal="normal",t.CustomerAccount="customer_account",t.AccountsSameStore="accounts_same_store",t.AccountsCrossStore="accounts_cross_store",t))(ae||{});function Ht({email:t,skipVerifyOnLoad:e,iframeReady:n,iframeRef:r,dismissedModalKey:s,readyToDismiss:p,onReadyToDismiss:c,showPopover:o,showToggle:i,popoverActivator:u}){const h=le(),{inMemoryPayPalParts:{accountStatus:l}}=we(),{guestDismissedModalKey:g}=Ae(),{checkoutSessionIdentifier:_}=re(),v=oe(),d=Ie(ie.ShopPayVerification,{scope:Ce}),P=be().current.token;E(()=>{if(e.current&&n){e.current=!1;return}const I=h&&ue(s),O=t&&ne(t),x=l.value.status==="connected",U=h&&zt();if(!(!n||!O||I||x||U)){if(d.peek()===q.Verified){d.value=void 0;return}K(r?.current,{action:W.Create,email:t,flow:ae.Normal,disableAutoFocus:!!sessionStorage.getItem(g)})}},[t,n]);function L(){if(!_)throw new ce({groupingHash:"ShopPayCheckoutIdentifierMissingError::GuestCheckout"});h&&ue(s)||t&&ne(t)&&(p||c(),P&&K(r?.current,{action:W.CheckoutQueueToken,queueToken:P}),v.setUserIdentified(escape(_)),Me(ie.SkipShopPay,"false"),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),d.value=q.Pending,sessionStorage.getItem(g)?i?.(!0):(o(!0,t),i?.(!1)))}function m(){p&&(d.value=q.Dismissed,h&&De(s,"true"),u?.current?.focus(),o(!1),i?.(!0))}function w(){he(),d.value=q.Verified,X.value="none"}return{onShow:L,onHidden:m,onLoggedIn:w}}function zt(){const t=sessionStorage.getItem(Je);if(!t)return!1;const e=Number.parseInt(t,10);return isNaN(e)?!1:Date.now(){s.current&&K(s.current,{action:W.Create,email:"",flow:ae.Normal})},[s]);E(()=>{s.current&&r&&u===H.C1ModalShopPaySignIn&&(K(s.current,{action:W.AllowNoInitialEmail}),m(),K(s.current,{action:W.Ready}))},[r,s,u,m]),E(()=>{h&&(d.current=null)},[h]),E(()=>{P.current&&s.current&&r&&(P.current=!1,m())}),E(()=>{function k(){e&&(L.updateUserVerification({status:"none"}),e(""),i?.current?.focus()),P.current=!0}return window.addEventListener("shop_pay_verification_reset",k),()=>{window.removeEventListener("shop_pay_verification_reset",k)}},[i,o,e,s,L]),E(()=>{if(!r)return;if(n.current){n.current=!1;return}t&&ne(t)&&u!==H.C1ModalShopPaySignIn?(L.updateUserVerification({email:t,status:"loading"}),K(s?.current,{action:W.Create,email:t,flow:ae.Normal})):u!==H.C1ModalShopPaySignIn&&(m(),L.updateUserVerification({status:"none"}))},[t,r,n,s,u,L,m,o]);function w(){if(!l)throw new ce({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopPayCheckout"});u===H.C1ModalShopPay&&t&&ne(t)&&(p||c(),L.updateUserVerification({email:t,status:"found"}),o(!0,t))}function I(){if(u===H.C1ModalShopPay&&!p)return;const k=d.current;e!=null&&k!=null&&(k.status!=="found"||u===H.C1ModalShopPay||!t)&&(e(k.email??""),L.updateUserVerification(k),i?.current?.focus()),L.userVerification.status==="found"?g({type:_e.ContinueWithShopPay,email:L.userVerification.email}):i?.current?.focus(),o(!1),d.current=null}function O(k,f,S){if(!(S&&S!==L.userVerification.email)&&(k===xe.ShopifyPayUserNotFound&&Wt.includes(f)&&(o(!1),g({type:_e.Generic})),S)){const D=f===Z.InvalidEmail;L.updateUserVerification({email:S,status:D?"invalid":"new"})}}function x(k,f){k?(d.current||L.userVerification.email!==k)&&(d.current={email:k,status:f?"found":"new"}):d.current={status:"none"}}async function U(k){he(),X.value="none",k&&(await _({token:k,origin:u}),v(),window.location.reload())}return{onShow:w,onHidden:I,onEmailChange:x,onError:O,onLoggedIn:U}}function qt(t){const e=Qe(),n=M(t),r=n.current,s=t===n.current?void 0:`Callback hook changed from ${n.current.name} to ${t.name} between renders.`;return E(()=>{s&&e.notify(new Ze(`${s} Only the original hook is called.`,{groupingHash:"ShopPayError::OnlyOriginalHookCalled"}),{severity:"warning",errorClass:"ShopPay::ShopPayVerification::useStableHook"})},[s,e]),r}const Kt="shop-pay-verification-iframe",ge=320,Jt=300,Yt=1e3;function Qt({email:t,onSetEmail:e,open:n,popoverActivator:r,showPopover:s,showToggle:p,urlOrigin:c=H.C1Modal,updatedOrigin:o=c,onIframeLoaded:i}){const u=Xe({base:"blockEnd",medium:"inlineEnd"}),[h,l]=N(!1),[g,_]=N(Jt),[v,d]=N(!1),P=et(),{checkoutSessionIdentifier:L}=re(),m=M(null),[w,I]=N(!1),O=oe(),x=tt.flow.value===nt.UnauthenticatedUser,U=rt(t,st),k=`${L}-${t.replace(/[^a-zA-Z0-9]/g,"")}`,f=Te(),S=M(f),{onShow:D,onHidden:T,onError:F,onEmailChange:V,onLoggedIn:z}=qt(x?Gt:Ht)({email:U,onSetEmail:e,skipVerifyOnLoad:S,iframeReady:h,iframeRef:m,dismissedModalKey:k,readyToDismiss:v,onReadyToDismiss:()=>{setTimeout(()=>d(!0),Yt)},showPopover:s,showToggle:p,popoverActivator:r,origin:o,open:n});lt({targetId:c,onReady:D,onClosed:b,onLoggedIn:z,onHidden:T,onError:ee,onResized:G,onLoaded:()=>{l(!0),i()},onEmailChange:V}),E(()=>{K(m?.current,{action:W.OriginChanged,origin:o})},[o]),E(()=>{const R=n?W.Ready:W.Hidden;K(m?.current,{action:R}),X.value=n?"shopPayVerification":"none",m.current&&n&&m.current.focus()},[n]);const $=Lt(c);if(E(()=>()=>{l(!1)},[$]),!$)return null;const J=n?r?.current:void 0;return a(Bt,{activator:J,open:n,onClose:T,placement:u,contentWidth:ge,contentHeight:g,children:a(ot,{active:w||!h,size:"large",children:a("iframe",{id:Kt,title:P("shop_pay.verification.title"),ref:m,src:$,height:g,width:ge,className:jt.VerificationIframe,allow:"publickey-credentials-get *",referrerPolicy:"origin"},$)})});function G(R){!isNaN(R)&&R&&_(R)}function b(){I(!0)}function ee(R,Y,Re){F?.(R,Y,Re),R===xe.ShopifyPayUserNotFound&&O.setUserIdentified(null),Me(ie.SkipShopPay,Y===Z.LimitExceeded?L||"":"false"),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))}}function Zt(){if(!dt())return;const t="shop-pay-safari-unzoom",e=te.getElementById(t);if(e)return e.focus();const n=te.createElement("input");n.id=t,n.style.fontSize="16px",n.style.width="1px",n.style.height="1px",n.style.position="fixed",n.style.bottom="-1000px",n.style.right="-1000px",n.style.transform="translate(1000px, 1000px)",n.setAttribute("aria-hidden","true"),te.body.appendChild(n),n.focus({preventScroll:!0})}const Xt=100;function en({emailInputSelector:t}){const[e,n]=N(),[r,s]=N();return E(()=>{function c(o){this.type==="password"?s(o.timeStamp):n(o.timeStamp)}if(t){const o=te.querySelector(t);if(o){o.addEventListener("input",c);const i=o.form?.querySelector('input[type="password"]');return i&&i instanceof HTMLInputElement&&i.addEventListener("input",c),()=>{o.removeEventListener("input",c),i&&i.removeEventListener("input",c)}}}},[t]),{isFilledWithPasswordManager:B(()=>e===void 0||r===void 0?!1:Math.abs(e-r)new Set,[]),O=()=>w.current,x=A(async(f,S="",D="")=>{const T=pt(f);if(h&&!I.has("PASSWORD_MANAGER_AUTOFILL_DETECTED")&&(I.add("PASSWORD_MANAGER_AUTOFILL_DETECTED"),u({userAction:"PASSWORD_MANAGER_AUTOFILL_DETECTED"})),T&&!I.has("EMAIL_ENTERED")&&(I.add("EMAIL_ENTERED"),u({userAction:"EMAIL_ENTERED"})),o("email entered",{},"state"),!r.current||c||!p)return;const F=T?f:"";l.current&&!l.current?.signal.aborted&&l.current.abort(),l.current=new AbortController;try{const{open:V,postMessage:z,waitForMessage:$}=r.current;w.current=F,z({firstName:S,lastName:D,type:"namesubmitted"}),z({email:F,hideChange:n===void 0?F.length>0:n,type:"emailsubmitted"}),o("email submitted",{email:F?"redacted":""},"state");const J=$("shop_user_matched",l.current.signal),G=new Promise((b,ee)=>{const R=async()=>{try{const Y=await $("error",l.current.signal);Y.type==="error"&&Y.code==="captcha_challenge"?b(void 0):await R()}catch(Y){ee(Y)}};R()});await Promise.race([J,G]),V("event_shop_user_matched"),m?.current?.blur(),Zt(),l.current.abort(),_(void 0)}catch(V){if(V instanceof ft&&V.name==="AbortSignalReceivedError")return;V instanceof Error&&i(new Error(`Error updating user info: ${V.name} - ${V.message}`))}},[n,r,h,o,p,c,i,u,I]),U=ht((f,S,D)=>{x(f,S,D)},200);E(()=>{g!==void 0&&p&&U(g,v,P)},[U,g,p,v,P]),E(()=>{if(!e)return;const f=te.querySelector(e);if(!f)return;m.current=f;const S=()=>{f&&_(f.value)};if(f?.value&&S(),!s){f?.removeEventListener("input",S);return}return f?.addEventListener("input",S),()=>{f?.removeEventListener("input",S)}},[e,s]),E(()=>{t!==void 0&&_(t)},[t]);const k=(f="",S="")=>{d(f),L(S)};return{getSubmittedEmail:O,updateEmailToPost:f=>_(f||""),updateNamesToPost:(f,S)=>k(f,S)}}function nn({iframeRef:t}){const{loaded:e}=pe();async function n(r){if(!t.current)return;const{postMessage:s,waitForMessage:p}=t.current;e||await p("loaded"),s(r)}return{postMessageAfterLoad:n}}function rn({size:t=16,gap:e=16,className:n}){const r=t/4,s=e/4,p=6,c=s*2,o=p*r+(p-1)*s,i=r*2+c,u=` @keyframes wave-${t}-${e} { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } } `;return a(de,{children:[a("style",{dangerouslySetInnerHTML:{__html:u}}),a("svg",{className:n,width:o,height:i,viewBox:`0 0 ${o} ${i}`,"data-testid":"connectiondots",children:[Array.from({length:p},(h,l)=>a("circle",{cx:l*(r+s)+r/2,cy:r/2,r:r/2,fill:"#e5e7eb",style:{animation:`wave-${t}-${e} 1.5s ease-in-out infinite`,animationDelay:`${l*.1}s`}},`dot-top-${l}`)),Array.from({length:p},(h,l)=>a("circle",{cx:l*(r+s)+r/2,cy:r+c+r/2,r:r/2,fill:"#00D66F",style:{animation:`wave-${t}-${e} 1.5s ease-in-out infinite`,animationDelay:`${(p-1-l)*.1}s`}},`dot-bottom-${l}`))]})]})}function on({className:t}){const{translate:e}=Ne(),n=String(e("stripeLinkAuth.shopLogoAriaLabel",{defaultValue:"Shop"}));return a("svg",{className:t,viewBox:"0 0 50 50",width:"100%",height:"100%",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":n,role:"img",children:[a("path",{d:"M50 12.5C50 5.597 44.403 0 37.5 0h-25C5.597 0 0 5.597 0 12.5v25C0 44.403 5.597 50 12.5 50h25C44.403 50 50 44.403 50 37.5v-25z",fill:"#5A31F4"}),a("path",{d:"M14.551 17.49v12.2a.09.09 0 00.092.092h2.249a.091.091 0 00.091-.091v-5.203c0-1.007.676-1.726 1.761-1.726 1.189 0 1.484.969 1.484 1.96v4.969a.09.09 0 00.027.065.09.09 0 00.066.026h2.24a.092.092 0 00.09-.091v-5.266c0-.18-.007-.357-.022-.53a4.681 4.681 0 00-.416-1.628c-.52-1.084-1.505-1.785-2.989-1.785a2.989 2.989 0 00-2.336 1.195l-.056.066V17.49a.092.092 0 00-.091-.092h-2.098a.092.092 0 00-.092.092zm-3.441 6.862s-1.088-.256-1.489-.357c-.4-.102-1.101-.328-1.101-.848 0-.544.562-.696 1.138-.696.576 0 1.21.137 1.261.771a.09.09 0 00.09.08l2.108-.008a.091.091 0 00.086-.06.092.092 0 00.005-.036c-.13-2.027-1.915-2.752-3.563-2.752-1.953 0-3.377 1.28-3.377 2.698 0 1.03.294 2 2.597 2.673.402.118.954.27 1.433.4.577.16.884.4.884.784 0 .443-.652.75-1.277.75-.916 0-1.567-.338-1.62-.946a.09.09 0 00-.09-.08l-2.104.01a.09.09 0 00-.066.028.092.092 0 00-.025.066c.096 1.914 1.951 2.945 3.68 2.945 2.57 0 3.74-1.45 3.74-2.796.003-.628-.143-2.075-2.31-2.627zm25.703-2.588V20.54a.088.088 0 00-.026-.064.09.09 0 00-.065-.027h-2.1a.09.09 0 00-.09.09v11.994a.088.088 0 00.026.064.089.089 0 00.065.026h2.249a.09.09 0 00.09-.09v-3.937h.034c.356.542 1.334 1.192 2.608 1.192 2.401 0 4.397-1.98 4.397-4.66 0-2.569-1.984-4.651-4.51-4.651-1.125 0-2.069.62-2.677 1.369v-.082zm2.468 5.747c-1.292 0-2.32-1.072-2.32-2.38 0-1.308 1.027-2.368 2.32-2.368 1.294 0 2.33 1.06 2.33 2.368 0 1.308-1.036 2.38-2.33 2.38zm-11.406-7.554c-2.096 0-3.142.708-3.983 1.28l-.024.016a.205.205 0 00-.063.275l.867 1.487a.213.213 0 00.322.056l.065-.054c.432-.36 1.086-.905 2.761-1.04.933-.074 1.74.176 2.33.72.653.601 1.044 1.57 1.044 2.594 0 1.88-1.114 3.064-2.902 3.088-1.474-.008-2.466-.774-2.466-1.906 0-.599.237-1.04.77-1.43a.207.207 0 00.061-.263l-.744-1.402a.215.215 0 00-.297-.083c-.836.493-1.822 1.446-1.767 3.182.067 2.21 1.912 3.896 4.31 3.965h.273c2.85-.092 4.907-2.198 4.907-5.048 0-2.637-1.914-5.437-5.463-5.437z",fill:"#fff"})]})}function Se({size:t=50,className:e}){const n={width:`${t}px`,height:`${t}px`};return a("div",{className:e,style:n,"data-testid":"stripelinkicon",children:a("svg",{viewBox:"0 0 50 50",width:"100%",height:"100%",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a("rect",{width:"50",height:"50",rx:"12.5",fill:"#00D66F"}),a("path",{d:"M24.475 10H16.765C18.265 16.27 22.645 21.63 28.125 25C22.635 28.37 18.265 33.73 16.765 40H24.475C26.385 34.2 31.675 29.16 38.175 28.13V21.86C31.665 20.84 26.375 15.8 24.475 10Z",fill:"#011E0F"})]})})}function sn({email:t,phoneNumber:e,onContinue:n}){const{translate:r}=Ne(),s=r("stripeLinkAuth.title"),p=r("stripeLinkAuth.description"),c=r("stripeLinkAuth.continueButton"),o=String(r("stripeLinkAuth.shopTermsUrl")),i=String(r("stripeLinkAuth.privacyPolicyUrl")),u=r("stripeLinkAuth.legalText",{shopTermsLink:a("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-grayscale-d0 underline transition-colors hover_text-grayscale-d1",children:r("stripeLinkAuth.shopTerms")}),privacyPolicyLink:a("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-grayscale-d0 underline transition-colors hover_text-grayscale-d1",children:r("stripeLinkAuth.privacyPolicy")})});return a("div",{className:"w-full space-y-4",children:[a("div",{className:"space-y-4",children:[a("div",{className:"flex items-center justify-center gap-0",children:[a("div",{className:"size-10 overflow-hidden rounded-md",children:a(on,{})}),a(rn,{size:12,gap:12}),a("div",{className:"overflow-hidden rounded-md",children:a(Se,{size:40})})]}),a("div",{className:"flex flex-col items-center gap-2",children:[a("h2",{className:"text-center font-sans text-header-normal font-medium text-grayscale-d2",children:s}),a("p",{className:"mx-auto text-center font-sans text-body-small font-normal leading-[20px] text-grayscale-primary-light",children:p})]})]}),a("div",{className:"rounded-xl border border-grayscale-l2l bg-white p-3",children:a("div",{className:"flex items-center gap-2",children:[a(Se,{size:36}),a("div",{className:"flex flex-col",children:[a("p",{className:"font-sans text-caption font-medium leading-[16px]",children:t}),a("p",{className:"font-sans text-caption font-normal leading-[16px] text-grayscale-d0",children:e})]})]})}),a("div",{className:"space-y-3",children:[a("button",{type:"button",onClick:n,className:"relative flex w-full items-center justify-center whitespace-nowrap rounded-md bg-purple-primary p-3 font-sans font-medium text-white outline-none transition-all hover_bg-purple-d0",children:a("span",{className:"truncate",children:c})}),a("p",{className:"text-center font-sans text-caption font-normal leading-[16px] text-grayscale-l1",children:u})]})]})}function an(){const{analyticsData:t,produceMonorailEvent:e}=fe();return{trackShopPayModalStateChange:A(({currentState:r,zoom:s})=>{const{analyticsTraceId:p,checkoutToken:c,checkoutVersion:o,shopPermanentDomain:i}=t,u={previousState:"",currentState:r,clientTimestampMs:new Date().getTime(),analyticsTraceId:p,checkoutToken:c||"",checkoutVersion:o||"",shopifyDomain:i||"",zoom:s};e({event:{payload:u,schemaId:"shopify_pay_modal_state_change/1.3"}})},[t,e])}}function cn(t){const{checkoutToken:e,checkoutVersion:n,shopPermanentDomain:r}=t;return{checkoutVersion:n,checkoutToken:e,flow:"checkout_modal",shopPermanentDomain:r}}function un(t){switch(t){case"../StripeLinkAuth/translations/bg-BG.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.H),[]);case"../StripeLinkAuth/translations/cs.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.I),[]);case"../StripeLinkAuth/translations/da.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.J),[]);case"../StripeLinkAuth/translations/de.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.K),[]);case"../StripeLinkAuth/translations/el.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.L),[]);case"../StripeLinkAuth/translations/en.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.M),[]);case"../StripeLinkAuth/translations/es.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.N),[]);case"../StripeLinkAuth/translations/fi.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.O),[]);case"../StripeLinkAuth/translations/fr.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.P),[]);case"../StripeLinkAuth/translations/hi.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.Q),[]);case"../StripeLinkAuth/translations/hr-HR.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.R),[]);case"../StripeLinkAuth/translations/hu.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.S),[]);case"../StripeLinkAuth/translations/id.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.T),[]);case"../StripeLinkAuth/translations/it.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.U),[]);case"../StripeLinkAuth/translations/ja.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.V),[]);case"../StripeLinkAuth/translations/ko.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.W),[]);case"../StripeLinkAuth/translations/lt-LT.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.X),[]);case"../StripeLinkAuth/translations/ms.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.Y),[]);case"../StripeLinkAuth/translations/nb.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.Z),[]);case"../StripeLinkAuth/translations/nl.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e._),[]);case"../StripeLinkAuth/translations/pl.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.$),[]);case"../StripeLinkAuth/translations/pt-BR.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a0),[]);case"../StripeLinkAuth/translations/pt-PT.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a1),[]);case"../StripeLinkAuth/translations/ro-RO.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a2),[]);case"../StripeLinkAuth/translations/ru.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a3),[]);case"../StripeLinkAuth/translations/sk-SK.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a4),[]);case"../StripeLinkAuth/translations/sl-SI.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a5),[]);case"../StripeLinkAuth/translations/sv.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a6),[]);case"../StripeLinkAuth/translations/th.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a7),[]);case"../StripeLinkAuth/translations/tr.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a8),[]);case"../StripeLinkAuth/translations/vi.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.a9),[]);case"../StripeLinkAuth/translations/zh-CN.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.aa),[]);case"../StripeLinkAuth/translations/zh-TW.json":return y(()=>import("./shopjs-locales.CsXI8-GQ.js").then(e=>e.ab),[]);default:return new Promise(function(e,n){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+t)))})}}const ln=({anchorTo:t,email:e,queueToken:n,totalDue:r,...s})=>{const{modalVisible:p,dispatch:c}=pe(),o=M(null),i=M(null),[u,h]=N(!1),[l,g]=N(null);tn({email:e,iframeRef:o});const{postMessageAfterLoad:_}=nn({iframeRef:o}),{trackUserAction:v}=fe(),{leaveBreadcrumb:d}=Ve(),P=A(k=>{if(d("stripe link user found event caught",{},"state"),!k.email){d("stripe link event missing email",{event:k},"error");return}g({email:k.email,phone:k.phone}),h(!0)},[d]);E(()=>{const k=new URL(se).origin,f=S=>{if(S.origin===k&&S.data?.type==="completed"&&(d("stripe link oauth completed from popup",{},"state"),i.current&&!i.current.closed&&(d("closing oauth popup window",{},"state"),i.current.close(),i.current=null),typeof C<"u"&&"parent"in C&&C.parent&&C.parent!==C)){d("forwarding completion to parent window",{},"state");const T=("ancestorOrigins"in C.location?C.location.ancestorOrigins:void 0)?.[0];T&&C.parent.postMessage({type:"completed",origin:se},T)}};return C.addEventListener("message",f),()=>{C.removeEventListener("message",f),i.current&&!i.current.closed&&i.current.close()}},[d]);const L=B(()=>({open:async()=>{p||(o.current?.open("user_button_clicked"),v({userAction:"OPEN_CALLED"}),d("open called",{},"state"))}}),[p,v,d]);kt(L);const{trackShopPayModalStateChange:m}=an(),w=A(()=>{m({currentState:"loaded",zoom:`${C.visualViewport?.scale}`})},[m]),I=A(k=>{m({currentState:k?"shown":"hidden",zoom:`${C.visualViewport?.scale}`})},[m]);E(()=>{if(n||r){const k={totalDue:Number(r)||0,checkoutQueueToken:n||""};_({type:"checkoutcontextsubmitted",checkoutContext:k}),n&&_({type:"checkoutqueuetokensubmitted",checkoutQueueToken:n})}},[_,n,r]);const{authorizeUrl:O}=yt({analyticsContext:"loginWithShopCheckoutModal",avoidSdkSession:!0,clientId:"",disableSignUp:!0,flow:"checkout_modal",proxy:!0,redirectType:"iframe",responseType:"code",uxMode:"iframe",...s}),x=A(()=>{if(d("stripe link auth completed",{},"state"),!l?.email)return;const f=!!vt(C.location.hostname)?"mock_stripe_link":"stripe_link",S=Et(),D=new URLSearchParams({login_hint:l.email,handle:f}),T=new URL(C.location.href);if(S){T.searchParams.has("skip_shop_pay")&&T.searchParams.delete("skip_shop_pay"),D.append("return_url",T.toString()),D.append("redirect_type","top_frame");const b=`${se}/oauth/idp_auth?${D.toString()}`;d("in-app browser detected, using full-page redirect",{},"state"),C.location.href=b;return}D.append("return_url",T.toString()),D.append("redirect_type","post_message");const F=`${se}/oauth/idp_auth?${D.toString()}`,V=600,z=700,$=C.screen.width/2-V/2,J=C.screen.height/2-z/2,G=C.open(F,"stripeLinkOAuth",`width=${V},height=${z},left=${$},top=${J},toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=yes`);G?(d("popup opened successfully, storing reference",{},"state"),i.current=G):d("popup blocked by browser",{},"error")},[d,l]),U=A(()=>{d("stripe link auth cancelled",{},"state"),i.current&&!i.current.closed&&(d("closing oauth popup on cancel",{},"state"),i.current.close(),i.current=null),h(!1),g(null),c({type:"hideModal",reason:"user_dismissed",dismissMethod:"close_button"})},[d,c]);return u&&l?(d("rendering native Stripe Link UI",{email:l.email,phone:l.phone},"state"),a(gt,{anchorTo:t,hideHeader:!1,headerTitle:"",onDismiss:()=>U(),variant:"checkoutModal",visible:p,type:"default",onModalInViewport:()=>{m({currentState:"shown",zoom:`${C.visualViewport?.scale}`})},children:a("div",{className:"px-4 pb-4",children:a(sn,{email:l.email,phoneNumber:l.phone||"",onContinue:x})})})):a(St,{anchorTo:t,keepModalOpen:!0,onLoaded:w,onModalVisibleChange:I,onStripeLinkUserFound:P,proxy:!0,ref:o,src:O,variant:"checkoutModal",scrolling:"no"})},dn=async t=>await un(`../StripeLinkAuth/translations/${t}.json`),hn=()=>mt(({element:t,...e})=>a(_t,{element:t,monorailProps:cn(e),featureName:"ShopCheckoutModal",getFeatureDictionary:dn,children:a(ln,{...e})}),{methods:["open"],name:"shop-checkout-modal",props:{anchorTo:"string",checkoutRedirectUrl:"string",checkoutToken:"string",checkoutVersion:"string",email:"string",queueToken:"string",shopPermanentDomain:"string",totalDue:"string",transactionParams:"string",storefrontDomain:"string"},shadow:"open"}),Q=({shopCheckoutModal:t,eventName:e,eventListener:n})=>{E(()=>(t?.addEventListener(e,n),()=>t?.removeEventListener(e,n)),[n,e,t])};function pn({email:t,open:e,popoverActivator:n,showPopover:r,showToggle:s,onIframeLoaded:p}){const c=n?.current,o=M(null),[i,u]=N(!1),h=M(!1),l=M(!1),{redirect_url:g,transaction_params:_}=ve(),{myshopifyDomain:v,storefrontUrl:d}=Le(),P=le(),{inMemoryPayPalParts:{accountStatus:L}}=we(),{guestDismissedModalKey:m}=Ae(),{checkoutSessionIdentifier:w}=re(),I=be(),O=B(()=>I.current.token,[I]),x=oe(),{wallets:U}=Ee(),{value:k}=it();E(()=>{customElements.get("shop-checkout-modal")||hn()},[]);const f=Ie(ie.ShopPayVerification,{scope:Ce}),S=`${w}-${t.replace(/[^a-zA-Z0-9]/g,"")}`,D=Te(),T=M(D);E(()=>{if(T.current){T.current=!1,u(!1);return}const b=sessionStorage.getItem(m),ee=P&&ue(S),R=L.peek().status==="connected";if(b||ee||R){u(!1);return}if(f.peek()===q.Verified){f.value=void 0,u(!1);return}u(!0)},[t]);const F=A(()=>{if(he(),f.value=q.Verified,X.value="none",l.current){r?.(!1),s?.(h.current);const b=new URL(window.location.href);b.searchParams.has("skip_shop_pay")&&