(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[712],{14712:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var l=s(95155),n=s(12115),r=s(35497),a=s(90620);let c={LOG:"text-green-400",INFO:"text-blue-400",WARN:"text-yellow-400",ERROR:"text-red-400",DEBUG:"text-purple-400"};function i({active:e=!0,heightClassName:t="h-[calc(100vh-220px)]",compact:s=!1,showToolbar:o=!0}){let[u,d]=(0,n.useState)([]),[x,h]=(0,n.useState)(!1),p=(0,n.useRef)(null),m=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){console.error("Failed to clear console logs:",e)}};(0,n.useEffect)(()=>{if(!e)return void h(!1);let t=new EventSource("/api/translator/console-logs/stream");return t.onopen=()=>h(!0),t.onmessage=e=>{let t=JSON.parse(e.data);"init"===t.type?d(t.logs.slice(-a.UY.maxLines)):"line"===t.type?d(e=>{let s=[...e,t.line];return s.length>a.UY.maxLines?s.slice(-a.UY.maxLines):s}):"clear"===t.type&&d([])},t.onerror=()=>h(!1),()=>t.close()},[e]),(0,n.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[u]);let f=(0,l.jsxs)(l.Fragment,{children:[o&&(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 pt-3 pb-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[(0,l.jsx)("span",{className:`size-2 rounded-full ${x?"bg-green-500":"bg-text-muted/40"}`}),(0,l.jsx)("span",{children:x?"Live":"Disconnected"})]}),(0,l.jsx)(r.$n,{size:"sm",variant:"outline",icon:"delete",onClick:m,children:"Clear"})]}),(0,l.jsx)("div",{ref:p,className:`overflow-y-auto bg-black p-4 font-mono text-xs ${t} ${s?"rounded-lg":"rounded-b-lg"}`,children:0===u.length?(0,l.jsx)("span",{className:"text-text-muted",children:"No console logs yet."}):(0,l.jsx)("div",{className:"space-y-0.5","data-i18n-skip":"true",children:u.map((e,t)=>{let s,n;return(0,l.jsx)("div",{children:(n=c[(s=e.match(/\[(\w+)\]/g))?s[1]?.replace(/\[|\]/g,""):null]||"text-green-400",(0,l.jsx)("span",{className:n,children:e}))},`${t}-${e.slice(0,32)}`)})})})]});return s?f:(0,l.jsx)(r.Zp,{children:f})}},44493:(e,t,s)=>{"use strict";s.d(t,{default:()=>a});var l=s(95155),n=s(12115),r=s(14712);function a(){return(0,n.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{})},[]),(0,l.jsx)("div",{className:"",children:(0,l.jsx)(r.A,{})})}},51094:(e,t,s)=>{Promise.resolve().then(s.bind(s,44493))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=51094)),_N_E=e.O()}]);