import{w}from"./chunk-UIGDSWPH-1hkfewjj.js";import{j as c}from"./jsx-runtime-agliiQSw.js";import{r as u}from"./index-BtyHvDgk.js";import{E as g,D as h}from"./epic-video-DTKLtvzE.js";import"./index-sWE7Vh13.js";import"./misc-CJRwnByf.js";import"./tooltip-Dei6jwuV.js";import"./index-D93mqesT.js";import"./root-loader-CIAkTEfn.js";import"./pe-jEPZ3eFB.js";import"./types-BzMnrBW1.js";import"./online-BJUQDd5b.js";import"./loading-DiAugSWv.js";import"./user-DPQPC1Ql.js";import"./workshop-config-BKSyfc8n.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"8bd8bc3153d70a1c10ccde8d38796bd67282553d"}}catch{}})();function m(s,o,i={}){const{schema:a}=i,e=crypto.randomUUID();return new Promise((r,t)=>{if(!window.parent||window.parent===window){console.log("[MCP] No parent frame available. Would have sent message:",{type:s,messageId:e,payload:o}),t(new Error("No parent frame available"));return}window.parent.postMessage({type:s,messageId:e,payload:o},"*");function n(d){if(d.data.type!=="ui-message-response"||d.data.messageId!==e)return;window.removeEventListener("message",n);const{response:f,error:l}=d.data.payload;if(l)return t(l);if(!a)return r(f);const p=a.safeParse(f);return p.success?r(p.data):t(p.error)}window.addEventListener("message",n)})}const U=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 e=i.current.clientHeight,r=i.current.clientWidth;window.parent.postMessage({type:"ui-size-change",payload:{height:e,width:r}},"*")})},[o.videoInfos]);async function a(e){const r=e.target;if(!(r instanceof HTMLAnchorElement))return;const t=r.href;if(!t)return;e.preventDefault(),e.stopPropagation();const n=t.startsWith("http")?new URL(t):new URL(t,window.location.origin);n.host===window.location.host&&n.pathname==="/login"&&await m("tool",{toolName:"login",params:{workshopDirectory:ENV.EPICSHOP_CONTEXT_CWD}}),await m("link",{url:n.toString()})}return c.jsx("div",{ref:i,onClickCapture:a,children:c.jsx(g,{epicVideoInfosPromise:o.videoInfos,children:c.jsx(h,{url:o.videoUrl})})})});export{U as default};
//# sourceMappingURL=epic-video-Di-g-wXC.js.map
