import{L as $}from"./CircularLoading-CjXNFRbA.js";import{e as W,r as d,n as C,l as P,P as q,f as l,j as M,v as m,aV as R,N as V,W as j,g as p,ar as B}from"./jwt-decode.esm-CX61wVx3.js";import{W as T}from"./Watermark-D2zHvRKy.js";import{u as y}from"./userStore-C3Z0vN5p.js";import{b as J,l as N}from"./workspaceStore-QlTT1mu8.js";import{b as U,a as A,c as X}from"./linkInterceptor-DeEo1UFM.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="05d36740-22b2-4681-a25e-84a729da5d36",t._sentryDebugIdIdentifier="sentry-dbid-05d36740-22b2-4681-a25e-84a729da5d36")}catch{}})();const F={class:"page-container"},H={key:0,class:"loading"},O={key:1,class:"error-container"},z=["srcdoc"],G=W({__name:"PageStageView",props:{uiData:{}},setup(t){const a=t,i=V(),h=j(),f=d(!0),c=d(""),s=d(!1),v=d(null);async function g(){const e=y();e.loadJWT(),f.value=!0,s.value=!1,c.value="";try{const o=a.uiData.path?`/_page/${a.uiData.path}`:"/_page-home",r=await J(o+window.location.search,{headers:e.authHeaders});if(r.status===401){e.removeJWT(),i.push({name:"playerLogin",query:{redirect:`/${a.uiData.path}`}});return}if(r.ok){const u=await r.text(),n=r.headers.get("X-Execution-Id"),_=r.headers.get("X-Abstra-Debug")==="true";if(u){const w=`<base href="${o}" target="_top">`,D=window.location.search.replace(/&/g,"&amp;").replace(/"/g,"&quot;"),k=`<meta name="abstra-page-endpoint" content="${o}${D}">`,I=U(),x=A(),E=e.jwt?`<meta name="abstra-auth-token" content="${e.jwt}">`:"",S=n?`<meta name="abstra-execution-id" content="${n}">`:"",L=n&&_?X(n,a.uiData.id):"";c.value=w+k+E+S+I+x+L+u}else s.value=!0}else s.value=!0}catch{s.value=!0}f.value=!1}function b(e){if(e.origin!==window.location.origin||!e.data)return;if(e.data.type==="abstra-login"){i.push({name:"playerLogin",query:{redirect:`/${a.uiData.path}`}});return}if(e.data.type==="abstra-logout"){y().removeJWT(),N(),g();return}if(e.data.type!=="abstra-page-navigate")return;const o=typeof e.data.search=="string"?e.data.search:"",r=typeof e.data.hash=="string"?e.data.hash:"",u=Object.fromEntries(new URLSearchParams(o));i.replace({path:h.path,query:u,hash:r||void 0})}return C(()=>{window.addEventListener("message",b),g()}),P(()=>{window.removeEventListener("message",b)}),q(()=>h.query,()=>{g()}),(e,o)=>(p(),l("div",F,[f.value?(p(),l("div",H,[m($)])):s.value?(p(),l("div",O,[m(R,{"error-message":null,"execution-id":null,locale:"en"})])):c.value?(p(),l("iframe",{key:2,ref_key:"iframeRef",ref:v,class:"page-iframe",srcdoc:c.value},null,8,z)):M("",!0),m(T,{"page-id":t.uiData.id,locale:"en"},null,8,["page-id"])]))}}),te=B(G,[["__scopeId","data-v-0a019559"]]);export{te as P};
//# sourceMappingURL=PageStageView-CnyrhD6f.js.map
