"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7317],{4901:(e,t,r)=>{r.d(t,{cn:()=>o});function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}},7317:(e,t,r)=>{r.r(t),r.d(t,{Terminal:()=>c});var o=r(3817),l=r(6749),n=r(4901),a=r(1806);function c(e){let{sessionId:t}=e,[r,c]=(0,l.useState)(!1),[s,i]=(0,l.useState)(null),[d,u]=(0,l.useState)(null);return(0,l.useEffect)(()=>{var e;let r=null!=(e=a.env.NEXT_PUBLIC_TERMINAL_PORT)?e:"14800",o=window.location.protocol,l=window.location.hostname;fetch("".concat(o,"//").concat(l,":").concat(r,"/terminal?session=").concat(encodeURIComponent(t))).then(e=>{if(!e.ok)throw Error("HTTP ".concat(e.status));return e.json()}).then(e=>{i(e.url)}).catch(e=>{console.error("[Terminal] Failed to get terminal URL:",e),u("Failed to connect to terminal server")})},[t]),(0,o.jsxs)("div",{className:(0,n.cn)("overflow-hidden rounded-[2px] border border-[var(--color-border-default)] bg-black",r&&"fixed inset-0 z-50 rounded-none border-0"),children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--color-border-default)] bg-[var(--color-bg-tertiary)] px-3 py-2",children:[(0,o.jsx)("div",{className:(0,n.cn)("h-2 w-2 rounded-full",s?"bg-[#3fb950]":d?"bg-[#f85149]":"bg-[#d29922] animate-pulse")}),(0,o.jsx)("span",{className:"font-[var(--font-mono)] text-xs text-[var(--color-text-muted)]",children:t}),(0,o.jsx)("span",{className:(0,n.cn)("text-[10px] font-medium uppercase tracking-wide",s?"text-[var(--color-accent-green)]":d?"text-[var(--color-accent-red)]":"text-[var(--color-text-muted)]"),children:s?"Connected":null!=d?d:"Connecting..."}),(0,o.jsx)("button",{onClick:()=>c(!r),className:"ml-auto rounded-[2px] px-2 py-0.5 text-[11px] text-[var(--color-text-muted)] transition-colors hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]",children:r?"exit fullscreen":"fullscreen"})]}),(0,o.jsx)("div",{className:"w-full",style:{height:r?"calc(100dvh - 40px)":"max(440px, calc(100dvh - 440px))"},children:s?(0,o.jsx)("iframe",{src:s,className:"h-full w-full border-0",title:"Terminal: ".concat(t),allow:"clipboard-read; clipboard-write",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"}):(0,o.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-[var(--color-text-muted)]",children:null!=d?d:"Connecting to terminal..."})})]})}}}]);