(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,487976,e=>{"use strict";var r=e.i(289721),t=e.i(965652),n=e.i(946822),l=e.i(40448),a=e.i(821957),o=e.i(807265),c=e.i(461526);e.s(["PreviewLogTerminal",0,function({previewKey:e,taskId:i}){let{resolvedTheme:u}=(0,a.useTheme)(),s=(0,t.useRef)(null),d=(0,t.useRef)(null),f=(0,t.useRef)(null),m=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!s.current)return;let r="light"!==u,t=new n.Terminal({fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontSize:12,scrollback:5e3,cursorBlink:!1,disableStdin:!0,allowTransparency:!1,convertEol:!0,theme:r?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}}),a=new l.FitAddon;t.loadAddon(a),t.open(s.current);let w=s.current.querySelector(".xterm-helper-textarea");w&&(w.style.opacity="0"),d.current=t,m.current=a;try{a.fit()}catch{}let y=!1,g=null;(async()=>{let r=await (0,o.getActualWsPort)();if(y)return;let n=new URLSearchParams({taskId:c.PREVIEW_TASK_ID,role:"terminal",previewKey:e,connectionId:crypto.randomUUID(),clientTaskId:i});(g=new WebSocket(`ws://localhost:${r}/?${n.toString()}`)).binaryType="arraybuffer",f.current=g,g.onmessage=e=>{let r="string"==typeof e.data?e.data:new TextDecoder().decode(e.data);t.write(r)}})();let b=()=>{try{m.current?.fit()}catch{}};return window.addEventListener("resize",b),()=>{y=!0,window.removeEventListener("resize",b),f.current?.close(),f.current=null,d.current&&(d.current.dispose(),d.current=null),m.current=null}},[e,i,u]),(0,r.jsx)("div",{ref:s,className:"size-full bg-black"})}])},461834,e=>{e.n(e.i(487976))}]);