import{ng as u}from"./getNormalizedPaymentMethodName.2fnRWc01.js";import{a4 as b,ae as m}from"./esnext-vendor.25PjUpIY.js";const h=({source:{type:t}})=>t==="shopPayExternal"?u.ShopPayExternal:u.CheckoutOne;var f=(t=>(t.InterestEligibility="interest_bearing_checkout_eligibility",t.SplitPayEligibility="split_pay_checkout_eligibility",t.UserEligibility="user_eligibility",t.CheckoutEligibility="checkout_eligibility",t.InstallmentsRetryError="installments_retryable_error",t.InstallmentsPermanentRejection="installments_permanent_rejection",t.InstallmentsPlanSelected="plan_selected",t.CreateAgreement="create_agreement",t))(f||{}),g=(t=>(t.PointOfSale="point_of_sale",t.SpiBanner="spi_banner",t.ReturningSpiBuyer="returning_spi_buyer",t.SelectedSpi="selected_spi",t))(g||{});function C(t){return t?t.contact.locationCount>1:!1}const _="data-special-id";function E({id:t,url:i,privileges:c,title:a,name:d,iframeSpecialId:o,onLoad:n}){const r=document.getElementById(`sandbox-${t}`);if(r&&r.tagName==="IFRAME")return r;const e=document.createElement("iframe");if(e.setAttribute("id",`sandbox-${t}`),e.setAttribute("src",i),e.setAttribute("sandbox",c.join(" ")),e.setAttribute("tabIndex","-1"),e.setAttribute("aria-hidden","true"),o&&e.setAttribute(_,o),a&&e.setAttribute("title",a),d&&e.setAttribute("name",d),e.setAttribute("style","display:none; height:0; width:0; visibility: hidden;"),p(e),n){const s=n(e);e.addEventListener("load",s,{once:!0})}return e}const l={};function y(t,i,c,a,d){const o=t.getAttribute("id");if(!o)throw Error("Endpoint cannot be created without an iframe id");const n=`${o}-endpoint-${c}`,r=l[n];r&&(a?.leaveErrorBreadcrumb(`Terminating existing RPC endpoint ${n}`),r.terminate());const e=d?.isSandboxedWithNullOrigin?"*":new URL(i).origin,s=b(m(t,{targetOrigin:e}));return l[n]=s,s}function p(t){let i=document.querySelector("#SandboxContainer");i==null&&(i=document.createElement("div"),i.setAttribute("id","SandboxContainer"),document.body.appendChild(i)),i.appendChild(t)}export{_ as D,g as P,f as S,y as a,p as b,E as c,C as h,h as s};
