1import{fQ as p,np as m,av as f,u as h,aa as y,N as P,O as b,fN as g,ap as A}from"./addresses-is-address-empty.-MuOhIyI.js";import{a7 as E,a8 as S,h as _,f as x}from"./esnext-vendor.D7ldIee_.js";import{b as w}from"./hooks-useReplaceShopPayInHistory.Cz4PqGkk.js";function F({shop:e,checkout:t,paymentMethods:n}){return p(n)&&e.hasFlagEnabled(m)&&t.configuration.layout.isOnePage.value&&!t.isCheckoutLayoutForcedToOnePage.value}function T({paymentLines:e,paymentMethods:t}){if(!t?.some(r=>r.type==="wallet"&&r.name==="PAYPAL_EXPRESS"))return{status:"not_connected"};const o=f(e,"PAYPAL_EXPRESS");if(o&&h(o)){const{walletContent:r}=o.method;return{status:"connected",email:r?.email??"",token:r?.token??""}}return{status:"not_connected"}}function L(e,t){try{const n=new URL(e),o=new URL(t);return n.origin===e&&n.protocol==="https:"&&n.protocol===o.protocol&&n.port===o.port&&(n.hostname===o.hostname||n.hostname.endsWith(`.${o.hostname}`))}catch{return!1}}const R="data-special-id";function H({id:e,url:t,privileges:n,title:o,name:r,iframeSpecialId:s,onLoad:i}){const c=document.getElementById(`sandbox-${e}`);if(c&&c.tagName==="IFRAME")return c;const a=document.createElement("iframe");if(a.setAttribute("id",`sandbox-${e}`),a.setAttribute("src",t),a.setAttribute("sandbox",n.join(" ")),a.setAttribute("tabIndex","-1"),a.setAttribute("aria-hidden","true"),s&&a.setAttribute(R,s),o&&a.setAttribute("title",o),r&&a.setAttribute("name",r),a.setAttribute("style","display:none; height:0; width:0; visibility: hidden;"),O(a),i){const u=i(a);a.addEventListener("load",u,{once:!0})}return a}const d={};function $(e,t,n,o,r){const s=e.getAttribute("id");if(!s)throw Error("Endpoint cannot be created without an iframe id");o&&I(t,o);const i=`${s}-endpoint-${n}`,c=d[i];c&&(o?.leaveErrorBreadcrumb(`Terminating existing RPC endpoint ${i}`),c.terminate());const a=r?.isSandboxedWithNullOrigin?"*":new URL(t).origin,u=E(S(e,{targetOrigin:a}));return d[i]=u,u}function I(e,t){let n;try{n=new URL(e,window.location.href)}catch{return}const o=n.searchParams.get("shopHost");if(!o)return;const r=`https://${o}`,s=window.location.origin;L(s,r)||t.log("sandbox_parent_origin_mismatch","Sandbox shopHost does not match the parent origin",{sandbox:n.pathname,expectedOrigin:r,actualOrigin:s})}function O(e){let t=document.querySelector("#SandboxContainer");t==null&&(t=document.createElement("div"),t.setAttribute("id","SandboxContainer"),document.body.appendChild(t)),t.appendChild(e)}function C(){const{currentPage:e}=y().value,{router:t,observability:n,shopPay:o}=P(),{search:r,pathname:s}=t.currentUrl.value,i=s.includes("/shoppay"),{replaceShopPayInHistory:c}=w(),a=e&&!i;return _(()=>{i&&(n.error(new l('Attempted to render "/shoppay" route in 3 page layout, which is not supported')),n.counter({name:"shop_pay_route_not_found",value:1}),c(o.config.checkoutAsGuestUrl))},[i,n,c,o.config.checkoutAsGuestUrl]),a&&t.redirect({pathname:e.route,search:r}),null}class l extends Error{constructor(t){super(t),this.name="RouteNotFoundError"}}const D=Object.freeze(Object.defineProperty({__proto__:null,RouteNotFoundError:l,default:C},Symbol.toStringTag,{value:"Module"}));function M(){const e=b().paymentLines;return x(()=>{const[t]=g(e.value,[A.AmazonPay]);return t})}const k="https://www.shopify.com/legal/usdc-rewards-terms";export{R as D,D as N,k as U,O as a,$ as b,H as c,T as d,F as i,I as r,M 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.