import{w}from"./chunk-UIGDSWPH-fNK8sKgt.js";import{j as f}from"./jsx-runtime-C_974cfT.js";import{r as u}from"./index-BDZD4X5K.js";import{E as g,D as h}from"./epic-video-dHfyeG47.js";import"./index-bXLUfgPf.js";import"./misc-BOyXKFuR.js";import"./tooltip-Dl4Bqfpf.js";import"./index-L8976fcQ.js";import"./root-loader-BZ1M-egm.js";import"./pe-D3b-z7vI.js";import"./types-D4aTVJpv.js";import"./online-DhPMIuLO.js";import"./loading-B_A7E1hQ.js";import"./user-1MpuZX0i.js";import"./workshop-config-C5QE7ew3.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:"3ea6c863933c57219be78eb06addfb47859d8df2"}}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:c,error:l}=d.data.payload;if(l)return t(l);if(!a)return r(c);const p=a.safeParse(c);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 f.jsx("div",{ref:i,onClickCapture:a,children:f.jsx(g,{epicVideoInfosPromise:o.videoInfos,children:f.jsx(h,{url:o.videoUrl})})})});export{U as default};
//# sourceMappingURL=epic-video-CZAhjkY6.js.map
