import{w}from"./chunk-JZWAC4HX-5kJHQiQ9.js";import{j as p}from"./jsx-runtime-C4_65a1U.js";import{r as u}from"./index-B9zr-vzA.js";import{E as g,D as h}from"./epic-video-BZ1AWKL2.js";import"./use-event-source-Dip1vrZy.js";import"./index-nErvdZSM.js";import"./index-BzPxupzT.js";import"./index-BYdxj4vr.js";import"./misc-DRDyxdMg.js";import"./tooltip-mkBMB3mq.js";import"./root-loader-Cnwtpb_k.js";import"./pe-P58jSSsB.js";import"./schemas-RF4TJjJw.js";import"./online-CrGTaAx4.js";import"./loading-DDR0n-s7.js";import"./format-CKpZi3Um.js";import"./user-Pnhys2oT.js";import"./workshop-config-BVRT-ayZ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"8a6db0ac5fe78363b0c97fe458a96ce773bf357c"};var o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="271cdef0-b873-4bab-9b81-601f890efa62",e._sentryDebugIdIdentifier="sentry-dbid-271cdef0-b873-4bab-9b81-601f890efa62")}catch{}})();function m(e,o,i={}){const{schema:a}=i,r=crypto.randomUUID();return new Promise((n,t)=>{if(!window.parent||window.parent===window){console.log("[MCP] No parent frame available. Would have sent message:",{type:e,messageId:r,payload:o}),t(new Error("No parent frame available"));return}window.parent.postMessage({type:e,messageId:r,payload:o},"*");function s(d){if(d.data.type!=="ui-message-response"||d.data.messageId!==r)return;window.removeEventListener("message",s);const{response:c,error:l}=d.data.payload;if(l)return t(l);if(!a)return n(c);const f=a.safeParse(c);return f.success?n(f.data):t(f.error)}window.addEventListener("message",s)})}const S=w(function({loaderData:o}){const i=u.useRef(null);u.useEffect(()=>{o.videoInfos?.finally(()=>{if(window.parent.postMessage({type:"ui-lifecycle-iframe-ready"},"*"),!i.current)return;const r=i.current.clientHeight,n=i.current.clientWidth;window.parent.postMessage({type:"ui-size-change",payload:{height:r,width:n}},"*")})},[o.videoInfos]);async function a(r){const n=r.target;if(!(n instanceof HTMLAnchorElement))return;const t=n.href;if(!t)return;r.preventDefault(),r.stopPropagation();const s=t.startsWith("http")?new URL(t):new URL(t,window.location.origin);s.host===window.location.host&&s.pathname==="/login"&&await m("tool",{toolName:"login",params:{workshopDirectory:ENV.EPICSHOP_CONTEXT_CWD}}),await m("link",{url:s.toString()})}return p.jsx("div",{ref:i,onClickCapture:a,children:p.jsx(g,{epicVideoInfosPromise:o.videoInfos,children:p.jsx(h,{url:o.videoUrl})})})});export{S as default};
//# sourceMappingURL=epic-video-CGI2ek-X.js.map
