function ht(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a<t;a++)i[a]=e[a];return i}function $t(e,t,a){return(t=(function(i){var d=(function(f,m){if(typeof f!="object"||!f)return f;var P=f[Symbol.toPrimitive];if(P!==void 0){var D=P.call(f,m);if(typeof D!="object")return D;throw new TypeError("@@toPrimitive must return a primitive value.")}return(m==="string"?String:Number)(f)})(i,"string");return typeof d=="symbol"?d:d+""})(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function mt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(d){return Object.getOwnPropertyDescriptor(e,d).enumerable})),a.push.apply(a,i)}return a}function Ge(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?mt(Object(a),!0).forEach(function(i){$t(e,i,a[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):mt(Object(a)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(a,i))})}return e}function Et(e,t){return(function(a){if(Array.isArray(a))return a})(e)||(function(a,i){var d=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(d!=null){var f,m,P,D,y=[],E=!0,z=!1;try{if(P=(d=d.call(a)).next,i!==0)for(;!(E=(f=P.call(d)).done)&&(y.push(f.value),y.length!==i);E=!0);}catch(G){z=!0,m=G}finally{try{if(!E&&d.return!=null&&(D=d.return(),Object(D)!==D))return}finally{if(z)throw m}}return y}})(e,t)||(function(a,i){if(a){if(typeof a=="string")return ht(a,i);var d={}.toString.call(a).slice(8,-1);return d==="Object"&&a.constructor&&(d=a.constructor.name),d==="Map"||d==="Set"?Array.from(a):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?ht(a,i):void 0}})(e,t)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}var We={test:"https://test.checkout.dodopayments.com",live:"https://checkout.dodopayments.com"},et={test:"https://sdk.custom.hs.dodopayments.com",live:"https://sdk.hs.dodopayments.com"},It={test:"https://api.custom.hs.dodopayments.com",live:"https://api.hs.dodopayments.com"},Ct=`
  width: 100dvw;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: none;
  background: transparent;
  z-index: 1000;
`,At=`
  width: 100%;
  height: 0px; 
  border: none;
  background: transparent;
  overflow: hidden;
  transition: height 0.2s ease-out;
`,Dt=`
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
`,Tt=new Set(["checkout.opened","checkout.payment_page_opened","checkout.customer_details_submitted","checkout.closed","checkout.error","checkout.redirect","checkout.resize","checkout.breakdown","checkout.link_expired","checkout.status","checkout.redirect_requested","checkout.pay_button_clicked","checkout.keys_provided","checkout.form_ready"]);function tt(e,t){return!!document.querySelector('link[rel="'.concat(e,'"][href="').concat(t,'"]'))}function Ye(e){if(!tt("preconnect",e)&&document.head){var t=document.createElement("link");t.rel="preconnect",t.href=e,t.crossOrigin="anonymous",document.head.appendChild(t)}}function Qe(e){if(!tt("dns-prefetch",e)&&document.head){var t=document.createElement("link");t.rel="dns-prefetch",t.href=e,document.head.appendChild(t)}}function yt(e){if(!e.mode)throw new Error("Checkout mode is required");if(!Object.keys(We).includes(e.mode))throw new Error("Invalid checkout mode");if(e.displayType&&!["overlay","inline"].includes(e.displayType))throw new Error("Invalid display type. Must be 'overlay' or 'inline'")}function Rt(e){try{var t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")throw new Error("Invalid redirect URL protocol");if(e.length>2048)throw new Error("Redirect URL exceeds maximum length")}catch{throw new Error("Invalid redirect URL format")}}var v=null;function Ut(e){if(v&&e.origin===v.allowedOrigin)try{var t=e.data;if(!t||!t.event_type)return;if(!Tt.has(t.event_type))return void console.warn("Received message with invalid event_type: ".concat(t.event_type));if(Ee(t.event_type,t.data||{}),t.event_type==="checkout.closed"&&setTimeout(function(){return xt(!1)},100),t.event_type==="checkout.redirect"){var a,i=(a=t.data)===null||a===void 0||(a=a.message)===null||a===void 0?void 0:a.redirect_to;if(i)try{Rt(i),window.location.href=i}catch(m){console.error("Invalid redirect URL:",m),Ee("checkout.error",{message:"Invalid redirect URL"})}}if(t.event_type,t.event_type==="checkout.keys_provided"&&v.config.displayType==="inline"){var d;if(!v.isSafari)return;var f=(d=t.data)===null||d===void 0?void 0:d.message;if(!f||typeof f.publishable_key!="string"||typeof f.client_secret_key!="string")return console.error("Invalid keys_provided payload:",f),void Ee("checkout.error",{message:"Apple Pay initialization failed - invalid key data"});try{(function(m,P,D){if(!v)throw new Error("Checkout not initialized");if(v.isSafari){if(window.Hyper===void 0)throw new Error("HS SDK not loaded");var y=It[v.config.mode];try{var E=window.Hyper(m,{customBackendUrl:y});v.hsInstance=E;var z=E.elements({appearance:{theme:"default"},clientSecret:P}),G={layout:"tabs",displaySavedPaymentMethodsCheckbox:!1,hideCardNicknameField:!0,showCardFormByDefault:!1,displaySavedPaymentMethods:!1,wallets:{walletReturnUrl:D||window.location.href,style:{type:"default",height:38,buttonRadius:12}},branding:"never"},V=z.create("applePay",G);v.applePayElementContainer&&(V.mount("#".concat(v.applePayElementContainer.id)),v.applePayElementContainer.style.display="block")}catch(X){throw console.error("Failed to initialize HS:",X),v.applePayElementContainer&&(v.applePayElementContainer.style.display="none"),X}}})(f.publishable_key,f.client_secret_key,f.return_url)}catch(m){console.error("Error initializing HS:",m),Ee("checkout.error",{message:"Failed to initialize HS"})}}}catch(m){console.error("Error processing checkout message:",m),Ee("checkout.error",{message:"Failed to process message"})}}function Ee(e){var t,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(v)if(Tt.has(e)){var i=Ge(Ge({},a),{},{products:v.currentProducts,timestamp:Date.now()});if(v.config.onEvent)try{v.config.onEvent({event_type:e,data:i})}catch(d){console.error("Error in onEvent handler for ".concat(e,":"),d)}(t=v.eventListeners[e])!==null&&t!==void 0&&t.length&&v.eventListeners[e].forEach(function(d){try{d(i)}catch(f){console.error("Error in ".concat(e," event handler:"),f)}})}else console.warn("Attempted to emit invalid event type: ".concat(e))}function xt(){var e,t,a,i=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];if((e=v)!==null&&e!==void 0&&e.container||(t=v)!==null&&t!==void 0&&t.iframe||(a=v)!==null&&a!==void 0&&a.wrapperDiv)try{v.container?(v.container.remove(),v.container=null):v.wrapperDiv?(v.wrapperDiv.remove(),v.wrapperDiv=null):v.iframe&&v.iframe.remove(),v.iframe=null,v.currentProducts=[],v.iframeResizerInstance&&v.iframeResizerInstance.length>0&&(v.iframeResizerInstance.forEach(function(d){d.iFrameResizer.close()}),v.iframeResizerInstance=null),v.applePayElementContainer&&(v.applePayElementContainer.remove(),v.applePayElementContainer=null),v.hsInstance=null,document.body.style.overflow="",document.body.style.contain="",i&&Ee("checkout.closed",{message:"Checkout closed manually"})}catch(d){throw console.error("Error closing checkout:",d),Ee("checkout.error",{message:"Failed to close checkout"}),d}}function Ht(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wt,gt,vt,bt={exports:{}};/*!
 *  @module      auto-console-group v1.2.11
 *
 *  @description Automagically group console logs in the browser console.
 *
 *  @author      David J. Bradshaw <info@iframe-resizer.com>
 *  @see         {@link https://github.com/davidjbradshaw/auto-console-group#readme}
 *  @license     MIT
 *
 *  @copyright  (c) 2025, David J. Bradshaw. All rights reserved.
 */function Nt(){return wt||(wt=1,(function(e){const t="font-weight: normal;",a="font-weight: bold;",i="font-style: italic;",d=t+i,f="color: #135CD2;",m="color: #A9C7FB;",P="color: #1F1F1F;",D="color: #E3E3E3;",y="default",E="error",z="log",G=Object.freeze({assert:!0,error:!0,warn:!0}),V={expand:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},X={profile:0,profileEnd:0,timeStamp:0,trace:0},ye=U=>{const C=U.event||U.defaultEvent;return C?`${C}`:""},F=Object.assign(console);function we(){const U=new Date,C=(I,T)=>U[I]().toString().padStart(T,"0");return`@ ${C("getHours",2)}:${C("getMinutes",2)}:${C("getSeconds",2)}.${C("getMilliseconds",3)}`}const{fromEntries:Oe,keys:Y}=Object,ge=U=>[U,F[U]],ve=U=>C=>[C,function(I){U[C]=I}],fe=(U,C)=>Oe(Y(U).map(C));function pe(U={}){const C={},I={},T=[],A={...V,expand:!U.collapsed||V.expanded,...U};let ee="";function W(){T.length=0,ee=""}function ce(){delete A.event,W()}const de=()=>T.some(([g])=>g in G),Ne=()=>!!de()||!!A.expand,$e=()=>A.showTime?ee:"";function Te(){if(T.length!==0){F[Ne()?"group":"groupCollapsed"](`%c${A.label}%c ${ye(A)} %c${$e()}`,t,a,d);for(const[g,...te]of T)F.assert(g in F,`Unknown console method: ${g}`),g in F&&F[g](...te);F.groupEnd(),ce()}else ce()}function Ce(){ee===""&&(ee=we())}function Se(g){Ce(),A.event=g}function Ke(){Ce(),queueMicrotask(()=>queueMicrotask(Te))}function be(g,...te){T.length===0&&Ke(),T.push([g,...te])}const o=g=>(...te)=>{let ae;try{ae=g(...te)}catch(_e){if(!Error.prototype.isPrototypeOf(_e))throw _e;be(E,_e),Te()}return ae};function Fe(g,...te){g!==!0&&be("assert",g,...te)}function Re(g=y){I[g]?I[g]+=1:I[g]=1,be(z,`${g}: ${I[g]}`)}function Me(g=y){delete I[g]}function Je(g=y){Ce(),C[g]=performance.now()}function Be(g=y,...te){if(!C[g])return void be("timeLog",g,...te);const ae=performance.now()-C[g];be(z,`${g}: ${ae} ms`,...te)}function xe(g=y){Be(g),delete C[g]}const ie=g=>[g,(...te)=>be(g,...te)];return{...fe(A,ve(A)),...fe(console,ie),...fe(X,ge),assert:Fe,count:Re,countReset:Me,endAutoGroup:Te,errorBoundary:o,event:Se,purge:W,time:Je,timeEnd:xe,timeLog:Be,touch:Ce}}const Ie=!(typeof window>"u"||typeof window.matchMedia!="function")&&window.matchMedia("(prefers-color-scheme: dark)").matches,He=Ie?m:f,Le=Ie?D:P;e.BOLD=a,e.FOREGROUND=Le,e.HIGHLIGHT=He,e.ITALIC=i,e.NORMAL=t,e.default=pe,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(bt.exports)),bt.exports}/*!
 *  @preserve
 *  
 *  @module      iframe-resizer/core 5.5.7 (cjs) - 2025-09-23
 *
 *  @license     GPL-3.0 for non-commercial use only.
 *               For commercial use, you must purchase a license from
 *               https://iframe-resizer.com/pricing
 * 
 *  @description Keep same and cross domain iFrames sized to their content 
 *
 *  @author      David J. Bradshaw <info@iframe-resizer.com>
 * 
 *  @see         {@link https://iframe-resizer.com}
 * 
 *  @copyright  (c) 2013 - 2025, David J. Bradshaw. All rights reserved.
 */var Mt=Ht((function(){if(vt)return gt;vt=1;const e=Nt(),t="5.5.7",a="iframeResizer",i=":",d="autoResize",f="init",m="iframeReady",P="load",D="message",y="onload",E="pageInfo",z="parentInfo",G="reset",V="resize",X="scroll",ye="child",F="parent",we="string",Oe="object",Y="function",ge="auto",ve="none",fe="vertical",pe="horizontal",Ie="[iFrameSizer]",He=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),Le=Object.freeze({[y]:1,[f]:1,[m]:1}),U="expanded",C="collapsed",I=Object.freeze({[U]:1,[C]:1}),T=(n,r,s,b)=>n.addEventListener(r,s,b||!1),A=(n,r,s)=>n.removeEventListener(r,s,!1),ee=n=>{if(!n)return"";let r=-559038744,s=1103547984;for(let b,S=0;S<n.length;S++)b=n.codePointAt(S),r=Math.imul(r^b,2246822519),s=Math.imul(s^b,3266489917);return r^=Math.imul(r^s>>>15,1935289751),s^=Math.imul(s^r>>>15,3405138345),r^=s>>>16,s^=r>>>16,(2097152*(s>>>0)+(r>>>11)).toString(36)},W=n=>n.replace(/[A-Za-z]/g,r=>String.fromCodePoint((r<="Z"?90:122)>=(r=r.codePointAt(0)+19)?r:r-26)),ce=["spjluzl","rlf","clyzpvu"],de=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],Ne=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],$e=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((n,r)=>[n,Math.max(0,r-1)])),Te=n=>W(de[n]),Ce=n=>{const r=n[W(ce[0])]||n[W(ce[1])]||n[W(ce[2])];if(!r)return-1;const s=r.split("-");let b=(function(S=""){let H=-2;const J=ee(W(S));return J in $e&&(H=$e[J]),H})(s[0]);return b===0||(S=>S[2]===ee(S[0]+S[1]))(s)||(b=-2),b},Se=Object.hasOwn||((n,r)=>Object.prototype.hasOwnProperty.call(n,r)),Ke=n=>n,be=n=>r=>window.chrome?n(r.replaceAll("<br>",`
`).replaceAll("<rb>","\x1B[31;1m").replaceAll("</>","\x1B[m").replaceAll("<b>","\x1B[1m").replaceAll("<i>","\x1B[3m").replaceAll("<u>","\x1B[4m")):n((s=>s.replaceAll("<br>",`
`).replaceAll(/<[/a-z]+>/gi,""))(r)),o={},Fe=(Re=e,Re!=null&&Re.__esModule?Re.default:Re);var Re;let Me=!0;const Je=Fe({expand:!1,label:F}),Be=n=>window.top===window.self?`parent(${n})`:`nested parent(${n})`,xe=n=>(r,...s)=>o[r]?o[r].console[n](...s):Je[n](...s),ie=(n,...r)=>(s=>o[s]?o[s].log:Me)(n)===!0?xe("log")(n,...r):null,g=xe("warn"),te=xe("error"),ae=xe("event"),_e=xe("purge"),nt=xe("errorBoundary"),he=(n,...r)=>o[n]?o[n].console.warn(be(Ke)(...r)):queueMicrotask(()=>console==null?void 0:console.warn(be((s=>(...b)=>[`${a}(${s})`,...b].join(" "))(n))(...r))),St=(n=>(r,s="renamed to")=>(b,S,H="",J="")=>n(J,`<rb>Deprecated ${r}(${b.replace("()","")})</>

The <b>${b}</> ${r.toLowerCase()} has been ${s} <b>${S}</>. ${H}Use of the old ${r.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(he)("Option"),qe=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:fe,firstRun:!0,inPageLinks:!1,heightCalculationMethod:ge,id:"iFrameResizer",log:!1,logExpand:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:ge,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:n=>{typeof o[n.id].onInit===Y&&(St("init()","onReady()","",n.id),o[n.id].onInit(n))},onResized(){},onScroll:()=>!0}),ne={position:null,version:t};function ot(n){function r(){dt(j),lt(k),Z("onResized",j)}function s(h){return h.boxSizing!=="border-box"?0:(h.paddingTop?parseInt(h.paddingTop,10):0)+(h.paddingBottom?parseInt(h.paddingBottom,10):0)}function b(h){return h.boxSizing!=="border-box"?0:(h.borderTopWidth?parseInt(h.borderTopWidth,10):0)+(h.borderBottomWidth?parseInt(h.borderBottomWidth,10):0)}const S=h=>re.slice(re.indexOf(i)+7+h),H=(h,l)=>(R,O)=>{const x={};var L,M;L=function(){je(`${R} (${h})`,`${h}:${l()}`,O)},x[M=O]||(L(),x[M]=requestAnimationFrame(()=>{x[M]=null}))},J=(h,l)=>()=>{let R=!1;const O=me=>()=>{o[_]?R&&R!==me||(h(me,_),R=me,requestAnimationFrame(()=>{R=!1})):ue()},x=O(X),L=O("resize window");function M(me,ze){ze(window,X,x),ze(window,V,L)}function ue(){ae(_,`stop${l}`),M(0,A),K.disconnect(),le.disconnect(),A(o[_].iframe,P,ue)}const _=k,K=new ResizeObserver(O("pageObserver")),le=new ResizeObserver(O("iframeObserver"));o[_]&&(o[_][`stop${l}`]=ue,T(o[_].iframe,P,ue),M(0,T),K.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),le.observe(o[_].iframe,{attributes:!0,childList:!1,subtree:!1}))},Ae=h=>()=>{h in o[k]&&(o[k][h](),delete o[k][h])},u=H(E,function(){const h=document.body.getBoundingClientRect(),l=j.iframe.getBoundingClientRect(),{scrollY:R,scrollX:O,innerHeight:x,innerWidth:L}=window,{clientHeight:M,clientWidth:ue}=document.documentElement;return JSON.stringify({iframeHeight:l.height,iframeWidth:l.width,clientHeight:Math.max(M,x||0),clientWidth:Math.max(ue,L||0),offsetTop:parseInt(l.top-h.top,10),offsetLeft:parseInt(l.left-h.left,10),scrollTop:R,scrollLeft:O,documentHeight:M,documentWidth:ue,windowHeight:x,windowWidth:L})}),p=H(z,function(){const{iframe:h}=j,{scrollWidth:l,scrollHeight:R}=document.documentElement,{width:O,height:x,offsetLeft:L,offsetTop:M,pageLeft:ue,pageTop:_,scale:K}=window.visualViewport;return JSON.stringify({iframe:h.getBoundingClientRect(),document:{scrollWidth:l,scrollHeight:R},viewport:{width:O,height:x,offsetLeft:L,offsetTop:M,pageLeft:ue,pageTop:_,scale:K}})}),w=J(u,"PageInfo"),N=J(p,"ParentInfo"),$=Ae("stopPageInfo"),Q=Ae("stopParentInfo");function B(h){const l=h.getBoundingClientRect();return at(),{x:Number(l.left)+Number(ne.position.x),y:Number(l.top)+Number(ne.position.y)}}function oe(h){const l=h?B(j.iframe):{x:0,y:0};ie(k,`Reposition requested (offset x:%c${l.x}%c y:%c${l.y})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT);const R=((x,L)=>({x:x.width+L.x,y:x.height+L.y}))(j,l),O=window.parentIframe||window.parentIFrame;O?(function(x,L){setTimeout(()=>x["scrollTo"+(h?"Offset":"")](L.x,L.y))})(O,R):(function(x){ne.position=x,se(k)})(R)}function se(h){var x;const{x:l,y:R}=ne.position,O=(x=o[h])==null?void 0:x.iframe;Z("onScroll",{iframe:O,top:R,left:l,x:l,y:R})!==!1?lt(h):st()}function q(h){let l={};if(j.width===0&&j.height===0){const R=S(9).split(i);l={x:R[1],y:R[0]}}else l={x:j.width,y:j.height};Z(h,{iframe:j.iframe,screenX:Number(l.x),screenY:Number(l.y),type:j.type})}const Z=(h,l)=>Ve(k,h,l);function Pe(){var ue;const{height:h,iframe:l,msg:R,type:O,width:x}=j;switch((ue=o[k])!=null&&ue.firstRun&&o[k]&&(pt(k,j.mode),o[k].firstRun=!1),O){case"close":it(l);break;case D:M=S(6),Z("onMessage",{iframe:j.iframe,message:JSON.parse(M)});break;case"mouseenter":q("onMouseEnter");break;case"mouseleave":q("onMouseLeave");break;case"beforeUnload":ie(k,"Ready state reset"),o[k].initialised=!1;break;case d:o[k].autoResize=JSON.parse(S(9));break;case"scrollBy":(function(){const _=j.width,K=j.height,le=window.parentIframe||window.parentIFrame||window;ie(k,`scrollBy: x: %c${_}%c y: %c${K}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),le.scrollBy(_,K)})();break;case"scrollTo":oe(!1);break;case"scrollToOffset":oe(!0);break;case E:w();break;case z:N();break;case"pageInfoStop":$();break;case"parentInfoStop":Q();break;case"inPageLink":(function(_){const K=_.split("#")[1]||"",le=decodeURIComponent(K);let me=document.getElementById(le)||document.getElementsByName(le)[0];me?(function(){const ze=B(me);ie(k,`Moving to in page link: %c#${K}`,e.HIGHLIGHT),ne.position={x:ze.x,y:ze.y},se(k),window.location.hash=K})():window.top!==window.self&&(function(){const ze=window.parentIframe||window.parentIFrame;ze&&ze.moveToAnchor(K)})()})(S(9));break;case"title":(function(_,K){var le;(le=o[K])!=null&&le.syncTitle&&(o[K].iframe.title=_,ie(K,`Set iframe title attribute: %c${_}`,e.HIGHLIGHT))})(R,k);break;case G:ct(j);break;case f:r(),(function(_){var K,le,me;try{o[_].sameOrigin=!!((me=(le=(K=o[_])==null?void 0:K.iframe)==null?void 0:le.contentWindow)!=null&&me.iframeChildListener)}catch{o[_].sameOrigin=!1}})(k),(L=R)!==t&&(L!==void 0||he(k,`<rb>Legacy version detected in iframe</>

Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.

See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
`)),o[k].initialised=!0,Z("onReady",l);break;default:if(x===0&&h===0)return void g(k,`Unsupported message received (${O}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(x===0||h===0||document.hidden)return;r()}var L,M}let re=n.data;if(re==="[iFrameResizerChild]Ready")return De=n.source,void Object.values(o).forEach((h=>({initChild:l,postMessageTarget:R})=>{h===R&&l()})(De));var De;if(!(h=>Ie===`${h}`.slice(0,13)&&h.slice(13).split(i)[0]in o)(re))return typeof re!==we?void 0:void ae(F,"ignoredMessage");const j=(function(h){var M;const l=h.slice(13).split(i),R=l[1]?Number(l[1]):0,O=(M=o[l[0]])==null?void 0:M.iframe,x=getComputedStyle(O),L={iframe:O,id:l[0],height:R+s(x)+b(x),width:Number(l[2]),type:l[3],msg:l[4]};return l[5]&&(L.mode=l[5]),L})(re),{id:ke,type:Ue}=j,k=ke;k?(ae(k,Ue),nt(k,function(h){(function(l){if(!o[l])throw new Error(`${j.type} No settings for ${l}. Message was: ${re}`)})(k),j.type in{true:1,false:1,undefined:1}||(j.iframe!==null||(g(k,`The iframe (${j.id}) was not found.`),0))&&(function(){var x;const{origin:l,sameOrigin:R}=n;if(R)return!0;let O=(x=o[k])==null?void 0:x.checkOrigin;if(O&&`${l}`!="null"&&!(O.constructor===Array?(function(){let L=0,M=!1;for(;L<O.length;L++)if(O[L]===l){M=!0;break}return M})():(function(){var M;const L=(M=o[k])==null?void 0:M.remoteHost;return l===L})()))throw new Error(`Unexpected message received from: ${l} for ${j.iframe.id}. Message was: ${n.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0})()&&Pe()})(re)):g("","iframeResizer received messageData without id, message was: ",re)}function Ve(n,r,s){let b=null,S=null;if(o[n]){if(b=o[n][r],typeof b!==Y)throw new TypeError(`${r} on iFrame[${n}] is not a function`);if(r==="onBeforeClose"||r==="onScroll")try{S=b(s)}catch(H){console.error(H),g(n,`Error in ${r} callback`)}else((H,...J)=>{setTimeout(()=>H(...J),0)})(b,s)}return S}function rt(n){const{id:r}=n;delete o[r],delete n.iframeResizer}function it(n){const{id:r}=n;if(Ve(r,"onBeforeClose",r)!==!1){try{n.parentNode&&n.remove()}catch(s){g(r,s)}Ve(r,"onAfterClose",r),rt(n)}}function at(n){ne.position===null&&(ne.position={x:window.scrollX,y:window.scrollY})}function st(){ne.position=null}function lt(n){ne.position!==null&&(window.scrollTo(ne.position.x,ne.position.y),ie(n,`Set page position: %c${ne.position.x}%c, %c${ne.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),st())}function ct(n){at(n.id),dt(n),je(G,G,n.id)}function dt(n){function r(H){const J=`${n[H]}px`;n.iframe.style[H]=J,ie(s,`Set ${H}: %c${J}`,e.HIGHLIGHT)}const{id:s}=n,{sizeHeight:b,sizeWidth:S}=o[s];b&&r("height"),S&&r("width")}const jt=n=>n.split(i).filter((r,s)=>s!==19).join(i);function je(n,r,s){var S;function b(H){const J=n in Le?jt(r):r;ie(s,H,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),ie(s,`Message data: %c${J}`,e.HIGHLIGHT)}ae(s,n),o[s]&&((S=o[s])!=null&&S.postMessageTarget?(function(){const{iframe:H,postMessageTarget:J,sameOrigin:Ae,targetOrigin:u}=o[s];if(Ae)try{return H.contentWindow.iframeChildListener(Ie+r),void b(`Sending message to iframe %c${s}%c via same origin%c`)}catch{n in Le?o[s].sameOrigin=!1:g(s,"Same origin messaging failed, falling back to postMessage")}b(`Sending message to iframe: %c${s}%c targetOrigin: %c${u}`),J.postMessage(Ie+r,u)})():g(s,`Iframe(${s}) not found`))}let ut=0,Xe=!1,ft=!1;function pt(n,r=-3){if(Xe)return;const s=Math.max(o[n].mode,r);if(s>o[n].mode&&(o[n].mode=s),s<0)throw _e(n),o[n].vAdvised||he(n||"Parent",`${Te(s+2)}${Te(2)}`),o[n].vAdvised=!0,Te(s+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");s>0&&ft||(function(b,S){queueMicrotask(()=>console.info(`%ciframe-resizer ${b}`,Me||S<1?"font-weight: bold;":e.NORMAL))})(`v${t} (${(b=>W(Ne[b]))(s)})`,s),s<1&&he("Parent",Te(3)),Xe=!0}function Ot(){document.hidden!==!0&&((n,r)=>{Object.values(o).filter(({autoResize:s,firstRun:b})=>s&&!b).forEach(({iframe:s})=>je("tabVisible",r,s.id))})(0,V)}const Lt=(n=>{let r=!1;return function(){return r?void 0:(r=!0,Reflect.apply(n,this,arguments))}})(()=>{T(window,D,ot),T(document,"visibilitychange",Ot),window.iframeParentListener=n=>setTimeout(()=>ot({data:n,sameOrigin:!0}))});return gt=n=>r=>{function s(p,w){const N=Q=>()=>{var se;if(!o[p])return;const{firstRun:B,iframe:oe}=o[p];je(Q,w,p),(q=>q===f)(Q)&&(q=>q.loading==="lazy")(oe)||(function(q,Z){const{msgTimeout:Pe,warningTimeout:re}=Z[q];re&&(Pe&&clearTimeout(Pe),Z[q].msgTimeout=setTimeout(function(){if(Z[q]===void 0)return;const{initialised:De,loadErrorShown:j}=Z[q];Z[q].msgTimeout=void 0,De||j||(Z[q].loadErrorShown=!0,(function(ke,Ue){const{iframe:k,waitForLoad:h}=Ue[ke],{sandbox:l}=k,R=typeof l===Oe&&l.length>0&&!(l.contains("allow-scripts")&&l.contains("allow-same-origin"));ae(ke,"noResponse"),he(ke,`<rb>No response from iframe</>
          
The iframe (<i>${ke}</>) has not responded within ${Ue[ke].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
${h?`
The <b>waitForLoad</> option is currently set to <b>'true'</>. If the iframe loads before <i>iframe-resizer</> runs, this option will prevent <i>iframe-resizer</> initialising. To disable this option, set <b>waitForLoad</> to <b>'false'</>.  
`:""}${R?`
The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.
`:""}
This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.
`)})(q,Z))},re))})(p,o),B||((se=o[u])==null?void 0:se.heightCalculationMethod)in He&&ct({iframe:r,height:1,width:1,type:f})},{iframe:$}=o[p];o[p].initChild=N(m),(function(Q,B){T(Q,P,()=>setTimeout(B,1))})($,N(y)),(function(Q,B){const{iframe:oe,waitForLoad:se}=o[Q];se!==!0&&((q=>{const{src:Z,srcdoc:Pe}=q;return!Pe&&(Z==null||Z===""||Z==="about:blank")})(oe)?setTimeout(()=>{ae(Q,"noContent"),ie(Q,"No content detected in the iframe, delaying initialisation")}):setTimeout(B))})(p,N(f))}function b(p){return p?(("sizeWidth"in p||"sizeHeight"in p||d in p)&&he(u,`<rb>Deprecated Option</>

The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"${fe}"</>, <i>"${pe}"</> or <i>"${ve}"</>.
`),p):{}}function S(p){var N,$;const w=($=(N=o[p])==null?void 0:N.iframe)==null?void 0:$.title;return w===""||w===void 0}function H(p,w){Se(o[u],p)&&(he(u,`<rb>Deprecated option</>

The <b>${p}</> option has been renamed to <b>${w}</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.`),o[u][w]=o[u][p],delete o[u][p])}const J=p=>Se(p,"onMouseEnter")||Se(p,"onMouseLeave");function Ae(p){var w,N;o[u]={...o[u],iframe:r,remoteHost:r==null?void 0:r.src.split("/").slice(0,3).join("/"),...qe,...b(p),mouseEvents:J(p),mode:Ce(p),syncTitle:S(u)},H("offset","offsetSize"),H("onClose","onBeforeClose"),H("onClosed","onAfterClose"),ae(u,"setup"),(function(){const{direction:$}=o[u];switch($){case fe:break;case pe:o[u].sizeHeight=!1;case"both":o[u].sizeWidth=!0;break;case ve:o[u].sizeWidth=!1,o[u].sizeHeight=!1,o[u].autoResize=!1;break;default:throw new TypeError(u,`Direction value of "${$}" is not valid`)}})(),(w=(p==null?void 0:p.offsetSize)||(p==null?void 0:p.offset))&&(o[u].direction===fe?o[u].offsetHeight=w:o[u].offsetWidth=w),(function($){$!=null&&$.offset&&he(u,`<rb>Deprecated option</>

 The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.`)})(p),o[u].warningTimeout||ie(u,"warningTimeout:%c disabled",e.HIGHLIGHT),o[u].postMessageTarget===null&&(o[u].postMessageTarget=r.contentWindow),o[u].targetOrigin=o[u].checkOrigin===!0?(N=o[u].remoteHost)===""||N.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":N:"*"}const u=(function(p){if(p&&typeof p!==we)throw new TypeError("Invalid id for iFrame. Expected String");return p!==""&&p||(p=(function(){let w=(n==null?void 0:n.id)||qe.id+ut++;return document.getElementById(w)!==null&&(w+=ut++),w})(),r.id=p,ae(p,"assignId")),p})(r.id);if(typeof n!==Oe)throw new TypeError("Options is not an object");return(function(p){const{search:w}=window.location;w.includes("ifrlog")&&(p.log=C,p.logExpand=w.includes("ifrlog=expanded"))})(n),(function(p,w){const N=Se(w,"log"),$=typeof w.log===we,Q=N?!!$||w.log:qe.log;Se(w,"logExpand")||(w.logExpand=N&&$?w.log===U:qe.logExpand),(function(B){(B==null?void 0:B.log)===-1&&(B.log=!1,ft=!0)})(w),(function({enabled:B,expand:oe,iframeId:se}){const q=Fe({expand:oe,label:Be(se)});Me=B,o[se]||(o[se]={console:q})})({enabled:Q,expand:w.logExpand,iframeId:p}),$&&!(w.log in I)&&te(p,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),w.log=Q})(u,n),nt(u,function(p){a in r?g(u,`Ignored iframe (${u}), already setup.`):(Ae(p),(function(){if(Xe)return;const{mode:w}=o[u];w!==-1&&pt(u,w)})(),Lt(),(function(){var w,N;switch(r.style.overflow=((w=o[u])==null?void 0:w.scrolling)===!1?"hidden":ge,(N=o[u])==null?void 0:N.scrolling){case"omit":break;case!0:r.scrolling="yes";break;case!1:r.scrolling="no";break;default:r.scrolling=o[u]?o[u].scrolling:"no"}})(),(function(){const{bodyMargin:w}=o[u];typeof w!="number"&&w!=="0"||(o[u].bodyMargin=`${w}px`)})(),s(u,(function(w){const{autoResize:N,bodyBackground:$,bodyMargin:Q,bodyPadding:B,heightCalculationMethod:oe,inPageLinks:se,license:q,log:Z,logExpand:Pe,mouseEvents:re,offsetHeight:De,offsetWidth:j,mode:ke,sizeHeight:Ue,sizeWidth:k,tolerance:h,widthCalculationMethod:l}=o[w];return[w,"8",k,Z,"32",!0,N,Q,oe,$,B,h,se,ye,l,re,De,j,Ue,q,ne.version,ke,"",Pe].join(i)})(u)),(function(){if(o[u]){const{iframe:w}=o[u],N={close:it.bind(null,w),disconnect:rt.bind(null,w),removeListeners(){he(u,`<rb>Deprecated Method Name</>

The \x1B[removeListeners()</> method has been renamed to \x1B[disconnect()</>.
`),this.disconnect()},resize(){he(u,`<rb>Deprecated Method</>
        
Use of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As their are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code.`),je.bind(null,"Window resize",V,u)},moveToAnchor($){((Q,B)=>{if(typeof Q!==B)throw new TypeError(`moveToAnchor(anchor) anchor is not a ${oe=B,oe.charAt(0).toUpperCase()+oe.slice(1)}`);var oe})($,we),je("Move to anchor",`moveToAnchor:${$}`,u)},sendMessage($){$=JSON.stringify($),je(D,`${D}:${$}`,u)}};w.iframeResizer=N,w.iFrameResizer=N}})())})(n),r==null?void 0:r.iframeResizer}})());/*!
 *  @preserve
 *  
 *  @module      iframe-resizer/parent 5.5.7 (esm) - 2025-09-23
 *
 *  @license     GPL-3.0 for non-commercial use only.
 *               For commercial use, you must purchase a license from
 *               https://iframe-resizer.com/pricing
 * 
 *  @description Keep same and cross domain iFrames sized to their content 
 *
 *  @author      David J. Bradshaw <info@iframe-resizer.com>
 * 
 *  @see         {@link https://iframe-resizer.com}
 * 
 *  @copyright  (c) 2013 - 2025, David J. Bradshaw. All rights reserved.
 */const kt="undefined",Ze="[iframeResizer] ",_t=(function(){function e(i){switch(!0){case!i:throw new TypeError(`${Ze}iframe is not defined`);case!i.tagName:throw new TypeError(`${Ze}Not a valid DOM element`);case i.tagName.toUpperCase()!=="IFRAME":throw new TypeError(`${Ze}Expected <IFRAME> tag, found <${i.tagName}>`);default:t(i),a.push(i)}}let t,a;return function(i,d){if(typeof window===kt)return[];switch(t=Mt(i),a=[],typeof d){case kt:case"string":document.querySelectorAll(d||"iframe").forEach(e);break;case"object":e(d);break;default:throw new TypeError(`${Ze}Unexpected data type (${typeof d})`)}return Object.freeze(a)}})();var c=null;function Wt(e){var t,a=e.products,i=e.paymentLink,d=e.queryParams,f=e.redirectUrl,m=e.checkoutUrl,P=e.elementId,D=e.options;if(a&&a.length>0&&console.warn("⚠️ DEPRECATION WARNING: 'products' option is deprecated and will be removed in v2.0.0. Please use 'checkoutUrl' with session linkType instead."),i&&console.warn("⚠️ DEPRECATION WARNING: 'paymentLink' option is deprecated and will be removed in v2.0.0. Please use 'checkoutUrl' with session linkType instead."),d&&console.warn("⚠️ DEPRECATION WARNING: 'queryParams' option is deprecated and will be removed in v2.0.0. Please include query parameters in your 'checkoutUrl' instead."),f&&console.warn("⚠️ DEPRECATION WARNING: 'redirectUrl' option is deprecated and will be removed in v2.0.0. Please include redirect URL in your checkout session configuration instead."),i&&((function(y){try{var E=new URL(y);if(E.protocol!=="https:"&&E.protocol!=="http:")throw new Error("Invalid payment URL protocol");if(y.length>2048)throw new Error("Payment URL exceeds maximum length")}catch{throw new Error("Invalid payment URL format")}})(i),t=i.slice(-8)),!c)throw new Error("Checkout not initialized");if((function(y,E){if(E==="inline"&&!y.elementId)throw new Error("elementId is required for inline checkout display type");if(y.elementId&&typeof y.elementId!="string")throw new Error("elementId must be a string")})(e,c.config.displayType),c.iframe||c.container)console.warn("Checkout is already open");else{if(f&&Rt(f),m&&(function(y){try{var E=new URL(y);if(E.protocol!=="https:"&&E.protocol!=="http:")throw new Error("Invalid checkout URL protocol");if(y.length>2048)throw new Error("Checkout URL exceeds maximum length");if(E.hostname==="test.checkout.dodopayments.com"||E.hostname==="checkout.dodopayments.com"){var z=E.pathname.split("/").filter(function(F){return F.length>0});if(z.length===0)throw new Error("Checkout URL must contain a session ID or payment link ID");if(z[0]==="session"){if(z.length!==2)throw new Error("Session URL must have format: /session/cks_sessionId");var G=z[1];if(!G.startsWith("cks_"))throw new Error("Session ID must start with 'cks_' prefix");if(G.length!==25)throw new Error("Session ID must be exactly 25 characters including 'cks_' prefix");if(!/^cks_[a-zA-Z0-9_-]+$/.test(G))throw new Error("Session ID contains invalid characters")}else if(z.length===1){var V=z[0];if(V.length!==8)throw new Error("Payment link ID must be exactly 8 characters");if(!/^[a-zA-Z0-9_-]+$/.test(V))throw new Error("Payment link ID contains invalid characters")}else{if(z[0]!=="overlay")throw new Error("Invalid checkout URL format. Expected /session/cks_id or /paymentLinkId");if(z.length===2){var X=z[1];if(X.length!==8||!/^[a-zA-Z0-9_-]{8}$/.test(X))throw new Error("Invalid payment link ID in overlay URL")}else{if(z.length!==3||z[1]!=="session")throw new Error("Invalid overlay URL format. Expected /overlay/paymentLinkId or /overlay/session/sessionId");var ye=z[2];if(!ye.startsWith("cks_")||ye.length!==25||!/^cks_[a-zA-Z0-9_-]{21}$/.test(ye))throw new Error("Invalid session ID in overlay URL")}}}}catch(F){throw F instanceof Error?F:new Error("Invalid checkout URL format")}})(m),c.config.linkType==="session"){if(!m)throw new Error("checkoutUrl is required for session checkout")}else if(c.config.linkType==="static"){if(console.warn("⚠️ DEPRECATION WARNING: 'static' linkType is deprecated and will be removed in v2.0.0. Please migrate to 'session' linkType with checkoutUrl."),a==null||!a.length)throw new Error("Products are required for static checkout");if(a.length>1)throw new Error("Only one product is supported for checkout at the moment");(function(y){if(!y||typeof y!="string")throw new Error("Invalid product ID");if(y.length>50)throw new Error("Product ID exceeds maximum length");if(!/^[a-zA-Z0-9_-]+$/.test(y))throw new Error("Product ID contains invalid characters")})(a[0].productId)}else if(c.config.linkType==="dynamic"&&(console.warn("⚠️ DEPRECATION WARNING: 'dynamic' linkType is deprecated and will be removed in v2.0.0. Please migrate to 'session' linkType with checkoutUrl."),!t))throw new Error("Payment link ID is required for dynamic checkout");t&&(function(y){if(!y||typeof y!="string")throw new Error("Invalid payment link ID");if(y.length>10)throw new Error("Payment link ID exceeds maximum length");if(!/^[a-zA-Z0-9_-]+$/.test(y))throw new Error("Payment link ID contains invalid characters")})(t),c.currentProducts=a||[];try{(function(y,E,z,G,V,X,ye){if(c){var F,we=c.config.displayType||"overlay";if(c.config.linkType==="session"&&V){var Oe=Pt(V,we,ye);F=new URL(Oe)}else if(c.config.linkType==="static"&&y!=null&&y[0])F=(function(I,T,A){if(!c)throw new Error("Checkout not initialized");if(!c.config.displayType)throw new Error("Display type not specified");var ee=c.config.displayType==="inline"?"inline":"overlay",W=new URL("".concat(c.baseUrl,"/").concat(ee,"/buy/").concat(I.productId),window.location.origin);return T&&Object.entries(T).forEach(function(ce){var de=Et(ce,2),Ne=de[0],$e=de[1];W.searchParams.append(Ne,$e)}),A&&W.searchParams.append("redirect_url",A),W.searchParams.append("quantity",I.quantity.toString()),c.config.theme&&console.warn("⚠️ DEPRECATION WARNING: Using 'theme' in static checkout is deprecated and will be removed in v2.0.0. Please configure theme in your checkout session instead."),W.searchParams.append("theme",c.config.theme||"light"),W})(y[0],z,G);else{if(c.config.linkType!=="dynamic"||!E)throw new Error("Invalid checkout configuration");F=(function(I){if(!c)throw new Error("Checkout not initialized");if(!c.config.displayType)throw new Error("Display type not specified");var T=c.config.displayType==="inline"?"inline":"overlay",A=new URL("".concat(c.baseUrl,"/").concat(T,"/").concat(I),window.location.origin);return c.config.theme&&console.warn("⚠️ DEPRECATION WARNING: Using 'theme' in dynamic checkout is deprecated and will be removed in v2.0.0. Please configure theme in your checkout session instead."),A.searchParams.append("theme",c.config.theme||"light"),A})(E)}var Y=document.createElement("iframe");if(Y.id=c.iframeId,Y.src=F.toString(),(function(I){I.setAttribute("allowtransparency","true"),I.setAttribute("frameBorder","0"),I.allow="payment keyboard-map *",I.setAttribute("sandbox","allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox"),I.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),I.setAttribute("fetchpriority","high")})(Y),we==="inline"){var ge=X?document.getElementById(X):null;if(!ge)throw new Error('Target element with ID "'.concat(X,'" not found for inline checkout.'));if(c.isSafari){(function(){if(!c)return Promise.reject(new Error("Checkout not initialized"));var I=et[c.config.mode],T=document.querySelector('script[src="'.concat(I,'"]'));if(T)return new Promise(function(ee,W){if(window.Hyper===void 0){var ce=setTimeout(function(){W(new Error("Timeout waiting for HS SDK to initialize"))},1e4),de=function(){return clearTimeout(ce)};T.addEventListener("load",function(){window.Hyper!==void 0&&(de(),ee())}),T.addEventListener("error",function(){de(),W(new Error("Failed to load HS SDK script"))})}else ee()});if(!document.head)return Promise.reject(new Error("Document head not found, cannot inject HS SDK script"));var A=document.createElement("script");return A.async=!0,A.src=I,new Promise(function(ee,W){A.onload=function(){var ce=Date.now(),de=function(){window.Hyper!==void 0?ee():Date.now()-ce>1e4?W(new Error("HS SDK script loaded but window.Hyper not available")):setTimeout(de,50)};de()},A.onerror=function(){W(new Error("Failed to load HS SDK script"))},document.head.appendChild(A)})})().catch(function(I){var T;console.error("Failed to inject HS SDK:",I),(T=c)!==null&&T!==void 0&&T.applePayElementContainer&&(c.applePayElementContainer.style.display="none"),Ee("checkout.error",{message:"Apple Pay initialization failed"})});var ve=document.createElement("div"),fe="dodo-hs-apple-pay-".concat(Date.now());ve.id=fe,ve.style.cssText=Dt+" display: none;",c.applePayElementContainer=ve;var pe=document.createElement("div");pe.style.cssText=`
        display: flex;
        flex-direction: column;
        height: 0px;
        overflow-y: auto;
        transition: height 0.2s ease-out;
      `,c.wrapperDiv=pe,Y.style.cssText=`
        width: 100%;
        height: 100%;
        border: none;
        background: transparent;
        overflow: hidden;
        transition: height 0.2s ease-out;
      `,pe.appendChild(ve),pe.appendChild(Y),ge.appendChild(pe)}else Y.style.cssText=At,ge.appendChild(Y);c.iframe=Y,c.container=null;var Ie={license:"GPLv3",checkOrigin:[c.allowedOrigin],direction:"vertical",log:!1,warningTimeout:15e3,onResized:function(I){var T;if((T=c)!==null&&T!==void 0&&T.wrapperDiv){var A=c.applePayElementContainer&&c.applePayElementContainer.style.display!=="none"?I.height+55:I.height;c.wrapperDiv.style.height="".concat(A,"px")}}};c.iframeResizerInstance=_t(Ie,Y)}else{var He="z-index: 6859456; position: fixed; top: 0px; display: block; left: 0px; height: 100%; width: 100%; max-height: 100dvh; backface-visibility: hidden; overflow-y: visible;",Le="min-height: 100%; transition: 0.3s ease-out; position: fixed; top: 0px; left: 0px; width: 100%; height: 100%; background: transparent;",U=document.createElement("div");U.style.cssText=He,U.id="dodo-checkout-outer-div";var C=document.createElement("div");C.style.cssText=Le,C.id="dodo-checkout-inner-div",Y.style.cssText=Ct,C.appendChild(Y),U.appendChild(C),document.body.style.overflow="hidden",document.body.style.contain="initial",document.body.appendChild(U),c.iframe=Y,c.container=U}}})(a,t,d,f,m,P,D)}catch(y){throw console.error("Error creating checkout:",y),Ee("checkout.error",{message:"Failed to create checkout"}),y}}}function zt(e,t,a){t&&Object.entries(t).forEach(function(i){var d=Et(i,2),f=d[0],m=d[1];m&&e.searchParams.append("".concat(a,"_").concat(f),String(m))})}function Pt(e){var t,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"overlay",i=arguments.length>2?arguments[2]:void 0;if(!e||typeof e!="string")throw new Error("URL must be a non-empty string");if(e.trim()!==e)throw new Error("URL cannot have leading or trailing whitespace");try{t=new URL(e.trim())}catch{throw new Error("Invalid URL format")}if(t.protocol!=="https:"&&t.protocol!=="http:")throw new Error("URL must use HTTP or HTTPS protocol");var d=["test.checkout.dodopayments.com","checkout.dodopayments.com"];if(!d.includes(t.hostname))throw new Error("URL must be a Dodo Payments checkout domain. Expected: ".concat(d.join(" or ")));var f=a==="inline"?"inline":"overlay",m=t.pathname.split("/").filter(function(X){return X.length>0});if(m.length===0)throw new Error("URL must contain a session ID or payment link ID");if(m[0]==="session"){if(m.length!==2)throw new Error("Session URL must have exactly 2 path segments: /session/sessionId");var P=m[1];if(!P.startsWith("cks_"))throw new Error("Session ID must start with 'cks_' prefix");if(P.length!==25)throw new Error("Session ID must be exactly 25 characters including 'cks_' prefix");if(!/^cks_[a-zA-Z0-9_-]{21}$/.test(P))throw new Error("Session ID contains invalid characters. Only alphanumeric, underscore, and dash allowed after 'cks_' prefix");t.pathname="/".concat(f,"/session/").concat(P)}else if(m.length===1){var D=m[0];if(D.length!==8)throw new Error("Payment link ID must be exactly 8 characters");if(!/^[a-zA-Z0-9_-]{8}$/.test(D))throw new Error("Payment link ID contains invalid characters. Only alphanumeric, underscore, and dash allowed");t.pathname="/".concat(f,"/").concat(D)}else{if(m[0]!=="overlay"&&m[0]!=="inline")throw new Error(`Invalid URL format. Expected formats:
    - /session/cks_sessionId (25 chars total)
    - /paymentLinkId (8 chars)
    - /overlay/id or /inline/id (already processed)
    
    Got: /`.concat(m.join("/")));var y=m[0];if(m.length===2){var E=m[1];if(E.length!==8||!/^[a-zA-Z0-9_-]{8}$/.test(E))throw new Error("Invalid payment link ID in ".concat(y," URL"))}else{if(m.length!==3||m[1]!=="session")throw new Error("".concat(y," URL must have format: /").concat(y,"/paymentLinkId or /").concat(y,"/session/sessionId"));var z=m[2];if(!z.startsWith("cks_")||z.length!==25||!/^cks_[a-zA-Z0-9_-]{21}$/.test(z))throw new Error("Invalid session ID in ".concat(y," URL"))}}if(i){if(i.showTimer!==void 0&&t.searchParams.append("showTimer",String(i.showTimer)),i.showSecurityBadge!==void 0&&t.searchParams.append("showSecurityBadge",String(i.showSecurityBadge)),i.manualRedirect!==void 0&&t.searchParams.append("manualRedirect",String(i.manualRedirect)),i.themeConfig!==void 0){var G=i.themeConfig;zt(t,G.light,"theme"),zt(t,G.dark,"theme_dark"),G.radius&&t.searchParams.append("theme_radius",G.radius)}i.payButtonText!==void 0&&t.searchParams.append("payButtonText",i.payButtonText),i.fontSize!==void 0&&t.searchParams.append("fontSize",i.fontSize),i.fontWeight!==void 0&&t.searchParams.append("fontWeight",i.fontWeight)}var V=t.toString();if(!V.includes("/".concat(f,"/")))throw new Error("Internal error: Failed to build overlay URL");return V}var Gt={Initialize:function(e){if(yt(e),e.theme&&console.warn("⚠️ DEPRECATION WARNING: 'theme' option is deprecated and will be removed in v2.0.0. Please configure theme in your checkout session instead."),e.linkType&&e.linkType!=="session"&&console.warn("⚠️ DEPRECATION WARNING: 'linkType' option with value '"+e.linkType+"' is deprecated and will be removed in v2.0.0. Please use 'session' linkType with checkoutUrl instead."),c)(function(f){if(!c)throw new Error("Checkout not initialized");yt(f),f.theme&&console.warn("⚠️ DEPRECATION WARNING: 'theme' option is deprecated and will be removed in v2.0.0. Please configure theme in your checkout session instead."),f.linkType&&f.linkType!=="session"&&console.warn("⚠️ DEPRECATION WARNING: 'linkType' option with value '"+f.linkType+"' is deprecated and will be removed in v2.0.0. Please use 'session' linkType with checkoutUrl instead.");var m=f.onEvent||c.config.onEvent;c.config=Ge(Ge({linkType:"session"},f),{},{onEvent:m}),c.baseUrl!==We[f.mode]&&(c.baseUrl=We[f.mode],c.allowedOrigin=new URL(c.baseUrl).origin)})(e);else{var t=We[e.mode],a=new URL(t).origin,i=!1;try{var d=navigator.userAgent;i=/Safari/.test(d)&&!/Chrome/.test(d)&&!/CriOS/.test(d)&&!/Edg/.test(d)}catch{i=!0}c={iframe:null,container:null,config:Ge({linkType:"session"},e),currentProducts:[],baseUrl:t,allowedOrigin:a,iframeId:"dodo-checkout-iframe",eventListeners:{},hsInstance:null,applePayElementContainer:null,isSafari:i,wrapperDiv:null,iframeResizerInstance:null},v=c,window.addEventListener("message",Ut),(function(f){var m=f.mode,P=f.isSafari;try{var D=new URL(We[m]);if(Ye(D.origin),Qe(D.origin),P){var y=new URL(et[m]),E=new URL(It[m]);Ye(y.origin),Qe(y.origin),Ye(E.origin),Qe(E.origin)}}catch(z){console.warn("Failed to inject resource hints:",z)}})({mode:e.mode,isSafari:c.isSafari}),c.isSafari&&(function(f){var m=et[f];if(!tt("preload",m)&&!document.querySelector('script[src="'.concat(m,'"]'))&&document.head){var P=document.createElement("link");P.rel="preload",P.as="script",P.href=m,P.crossOrigin="anonymous",document.head.appendChild(P)}})(e.mode)}},Checkout:{open:function(e){Wt(e)},close:xt,isOpen:function(){var e,t;return!!((e=c)!==null&&e!==void 0&&e.iframe||(t=c)!==null&&t!==void 0&&t.container)},buildUrl:Pt}};export{Gt as DodoPayments};
