1import{q as m,h as E,e as T,T as O}from"./2c1ab0fe.DYQSH7bT.js";import{O as y,G as N}from"./4c290a1e.CvCmFIo_.js";import"./164ad2e3.BcELPLd1.js";function j({isShippingRequired:e,isPickupSelected:s,shippingCountryCode:r,billingCountryCode:t}){return!e||s?t||r:r||t}function q(e,s){const r=s?e.countrySpecific[s]?.phoneMarketingDisclosure:void 0;return r===void 0?e.phoneMarketingDisclosure:r}const g=new Map;function P(e){g.set(e,performance.now())}function v(e){return g.has(e)}function w(e){const s=g.get(e);if(s===void 0)return 0;const r=performance.now()-s;return I(e),r}function D(e,s){return v(e)?s(w(e)):null}function I(e){return g.delete(e)}const H={start:P,exists:v,end:w,endAndRun:D,remove:I},x="shopify_pay",f=":",J=["https://shop-server.shop.dev","https://shop.app"];var o=(e=>(e.Closed="closed",e.EmailChanged="emailChanged",e.Error="error",e.Hidden="hidden",e.Loaded="loaded",e.LoggedIn="loggedIn",e.Ready="ready",e.Resized="resized",e.ShareCaptchaToken="shareCaptchaToken",e))(o||{}),F=(e=>(e.AllowNoInitialEmail="allowNoInitialEmail",e.Create="create",e.Hidden="hidden",e.OriginChanged="originChanged",e.Ready="ready",e.CheckoutQueueToken="checkoutQueueToken",e))(F||{}),G=(e=>(e.ShopifyPayUserNotFound="shopify_pay_user_not_found",e))(G||{}),B=(e=>(e.FraudGuard="fraud_guard",e.InvalidEmail="invalid_email",e.InvalidPhone="invalid_phone",e.LimitExceeded="limit_exceeded",e.PhoneBlocked="phone_blocked",e.RecordNotFound="record_not_found",e))(B||{});const Q=()=>{const{environment:{services:{shopServer:e}},shop:s}=y(),r=parseInt(N(s.id),10);return{extendBuyerIdentity:m(async()=>{await fetch(new URL(`/checkout/${r}/shopify_pay/extend_buyer_identity`,e.url),{method:"GET",keepalive:!0})},[r,e.url])}},Y=()=>{const{environment:{services:{shopServer:e}},shop:{myshopifyDomain:s},source:{checkoutSessionIdentifier:r},url:t}=y();return{exchangeSessionTokenForCookie:m(async({token:l,origin:h,analytics_trace_id:u,flow:c})=>{const a=new URLSearchParams({token:l,origin:h,shopify_domain:s});r&&a.set("checkout_token",r),u&&a.set("analytics_trace_id",u),c&&a.set("flow",c);const d=new URL(t.shopPaySession(),e.url);return d.search=a.toString(),fetch(d.href,{method:"POST",keepalive:!0})},[r,s,t,e.url])}};function $({targetId:e,onLoaded:s,onClosed:r,onHidden:t,onError:i,onLoggedIn:l,onReady:h,onResized:u,onShareCaptchaToken:c,onEmailChange:a,skip:d=!1}){const k=m(n=>{switch(n.action){case o.Closed:return r?.();case o.Hidden:return t?.();case o.Error:return i?.(n.message,n.apiError,n.email);case o.Loaded:return s?.();case o.LoggedIn:return l?.(n.token,n.shop_pay_access_token);case o.Ready:return h?.(n.phoneNumber);case o.Resized:return u?.(parseInt(n.height,10));case o.ShareCaptchaToken:return c?.(n.token);case o.EmailChanged:return a?.(n.email,n.isUserFound)}},[r,t,i,s,l,h,u,c,a]),{environment:C}=y(),S=C.services.payShopifyCom.url;E(()=>{if(d)return;const n=({data:p,origin:b})=>{if(b!==S||!p||typeof p!="string"||!p.includes(f))return;const[L,...M]=p.split(f);if(L===x)try{const _=JSON.parse(M.join(f));(e&&_.targetId===e||!e)&&k(_)}catch{}};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[k,S,e,d])}function R(e,s={delimiter:f,messageKey:x}){return[s.messageKey,s.delimiter,JSON.stringify(e)].join("")}function U(e){return R(e)}function V(e,s){e&&e.contentWindow?.postMessage(U(s),"*")}function X({endpoint:e,invokingWallet:s}){const r=T(!1),{checkout:{wallets:t}}=y(),i=m(()=>{r.value&&(r.value=!1,t.clearActiveSession({invokingWallet:s}),e?.value?.call.closePopupWindows())},[r,e,s,t]);return O(()=>({isScrimOpen:r,closePopupWindowsAndScrim:i}),[r,i])}const Z=e=>{if(!e)return null;const s=e.querySelector("iframe");if(!s)return null;const r=getComputedStyle(s).borderRadius;return r?.includes("px")?parseInt(r,10):null};export{B as A,f as D,G as M,o as R,F as S,Q as a,$ as b,x as c,J as d,X as e,H as f,Z as g,j as h,q as i,V as p,Y as u};
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.