import{C as e,Dt as t,I as n,It as r,Q as i,S as a,T as o,Wt as s,Y as c,an as l,bt as u,cn as d,j as f,k as p,lt as m,w as h,x as g}from"./_plugin-vue_export-helper-BVhEvvHC.js";import{Dn as _,Ln as v,P as y,an as b,pn as x}from"./src-CD6Jsigc.js";import{M as S,j as C,u as w,y as T}from"./src-C_qKxWab.js";import{r as E,t as D}from"./axios-DSyjHw-i.js";import{n as O}from"./runtimeModeStore-Db3SY58j.js";n(),u(),s();var k={class:`h-screen w-screen bg-background text-foreground flex flex-col overflow-hidden`},A={class:`text-xs font-medium text-muted-foreground`},j={key:0,class:`ml-2 rounded-sm border border-red-400/40 bg-red-400/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-red-300`},M={key:1,class:`ml-2 rounded-sm border border-amber-400/40 bg-amber-400/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-amber-300`},N={key:0,class:`flex-1 flex items-center justify-center text-muted-foreground`},P={key:1,class:`flex-1 flex items-center justify-center text-muted-foreground`},F=6,I=f({__name:`SceneConsoleWindow`,setup(n){let{t:s}=E({useScope:`global`}),{dragRegionStyle:u,noDragStyle:f}=y(),I=S(),L=O(),R=g(()=>({actions:s(`sceneEditor.consolePanel.actions`),all:s(`sceneEditor.consolePanel.all`),autoScroll:s(`sceneEditor.consolePanel.autoScroll`),clear:s(`sceneEditor.consolePanel.clear`),copyAll:s(`sceneEditor.consolePanel.copyAll`),copyEntry:s(`sceneEditor.consolePanel.copyEntry`),copyMessage:s(`sceneEditor.consolePanel.copyMessage`),debug:s(`sceneEditor.consolePanel.debug`),empty:s(`sceneEditor.consolePanel.empty`),error:s(`sceneEditor.consolePanel.error`),info:s(`sceneEditor.consolePanel.info`),warning:s(`sceneEditor.consolePanel.warning`)})),z=g(()=>!!I.rpc),B=t(!0),V=t(!1),H=null;m([()=>I.activeSceneName,()=>I.rpc],([e,t])=>{H&&=(H.disconnect(),null),e&&t&&(H=C({rpc:t,sceneName:e}),T(H))},{immediate:!0}),c(async()=>{if(document.title=s(`sceneEditor.console`),L.refresh().catch(e=>console.warn(`Could not load runtime mode`,e)),I.rpc||await new Promise(e=>{let t=m(()=>I.rpc,n=>{n&&(t(),e())},{immediate:!0})}),!I.activeSceneName)try{await I.fetchScenes();let e=new URLSearchParams(window.location.search).get(`scene`)??I.scenes[0]?.name;e&&await I.openScene(e)}catch(e){console.error(`Failed to load scenes in console window:`,e)}B.value=!1});function U(){D.post(`/status/minimize`,{windowType:F})}function W(){D.post(`/status/maximize`,{windowType:F}).then(e=>{V.value=e.data})}function G(){D.post(`/status/close`,{windowType:F})}return(t,n)=>(i(),o(`div`,k,[a(`div`,{class:`h-8 shrink-0 flex items-center px-3 bg-card border-b border-border select-none`,style:l(r(u))},[a(`span`,A,d(r(s)(`sceneEditor.console`)),1),r(L).loadFailed?(i(),o(`span`,j,d(r(s)(`runtimeMode.unavailable`)),1)):r(L).isNonProduction?(i(),o(`span`,M,d(r(s)(`runtimeMode.${r(L).mode.toLowerCase()}`)),1)):h(``,!0),a(`div`,{class:`ml-auto flex items-center`,style:l(r(f))},[a(`button`,{class:`h-8 w-10 inline-flex items-center justify-center hover:bg-muted transition-colors`,onClick:U},[p(r(_),{class:`h-3.5 w-3.5`})]),a(`button`,{class:`h-8 w-10 inline-flex items-center justify-center hover:bg-muted transition-colors`,onClick:W},[V.value?(i(),e(r(v),{key:0,class:`h-3.5 w-3.5 scale-x-[-1]`})):(i(),e(r(x),{key:1,class:`h-3.5 w-3.5`}))]),a(`button`,{class:`h-8 w-10 inline-flex items-center justify-center hover:bg-destructive hover:text-destructive-foreground transition-colors`,onClick:G},[p(r(b),{class:`h-3.5 w-3.5`})])],4)],4),z.value?B.value?(i(),o(`div`,P,d(r(s)(`sceneEditor.loading`)),1)):(i(),e(r(w),{key:2,class:`flex-1`,labels:R.value},null,8,[`labels`])):(i(),o(`div`,N,d(r(s)(`sceneEditor.connecting`)),1))]))}});export{I as default};