import{u as A,a as N,S as k}from"./CjwkogD-.js";import{d as j,r as $,c as B,b as H,e as r,w as l,s as i,f as t,E as n,l as g,F as C,y as z,t as V,k as D,G as L,D as S,N as M,H as U,j as a,K as E,A as b,J as F,Q as I}from"./DGA3dmy8.js";import{u as O,B as v}from"./BGI1QYR-.js";import{S as h}from"./Ctc_nflK.js";import{A as G}from"./B1gjD2QT.js";import{l as w}from"./Cay67bh1.js";import{I as f}from"./CCeWr_SP.js";const J={key:0,class:"flex"},K={class:"flex flex-col w-full text-sm divide-y divide-border"},Q={key:0,class:"select-none text-xs text-muted-foreground"},q=["innerHTML"],P={key:1,class:"text-sm text-muted-foreground text-center py-8"},R=j({__name:"terminal",props:{logs:{},date:{type:Boolean}},setup(y){const x=y,_=O();$({});const p=B(()=>{const m=new G({fg:w.zinc[50],bg:w.zinc[950],newline:!1});return x.logs.map(s=>({text:m.toHtml(s.text.trim()),date:s.date,type:s.type}))});return(m,e)=>{const s=h;return r(),H(s,{class:"flex flex-col h-full justify-center justify-content-flex-start"},{default:l(()=>[t(p)&&t(p).length>0?(r(),i("pre",J,[e[5]||(e[5]=n("      ")),g("code",K,[e[3]||(e[3]=n(`
        `)),(r(!0),i(C,null,z(t(p),d=>(r(),i("span",{class:V(["flex items-center gap-2 py-px pl-3 pr-2",t(D)({"bg-cyan-950/25":d.type==="meta","bg-red-950/25":d.type==="error"})])},[e[0]||(e[0]=n(`
          `)),m.date?(r(),i("span",Q,S(t(_)(d.date).format("LTS")),1)):L("",!0),e[1]||(e[1]=n(`
          `)),g("div",{class:"text-wrap brightness-75 dark:brightness-150",innerHTML:d.text.trim()},null,8,q),e[2]||(e[2]=n(`
        `))],2))),256)),e[4]||(e[4]=n(`
      `))]),e[6]||(e[6]=n(`
    `))])):(r(),i("p",P,"No logs yet."))]),_:1})}}}),W=Object.assign(R,{__name:"UtilityTerminal"}),X={class:"flex w-fit flex-col gap-1.5"},Y={key:0,class:"flex gap-2"},Z={class:"flex gap-2"},tt=j({__name:"terminal",props:{id:{}},setup(y){const x=y,{getScript:_,killScript:p}=A(),m=O(),e=M("terminal-date",!1,{initOnMounted:!0}),s=B(()=>x.id?_(x.id):void 0);return(d,c)=>(r(),H(t(U),{class:"flex min-h-0 flex-grow flex-col"},{default:l(()=>[a(t(F),{class:"flex flex-row justify-between gap-2"},{default:l(()=>{var u,T;return[g("div",X,[a(t(E),null,{default:l(()=>c[2]||(c[2]=[n("Command Logs")])),_:1,__:[2]}),t(s)?(r(),i("div",Y,[a(t(v),{class:"flex gap-2"},{default:l(()=>{var o;return[a(t(f),{icon:"lucide:clock"}),n(" "+S(t(m)((o=t(s))==null?void 0:o.createdAt).format("LT")),1)]}),_:1}),a(t(v),{class:"flex gap-2 font-mono"},{default:l(()=>{var o;return[a(t(f),{icon:"lucide:terminal"}),n(" "+S(t(N)({dynamic:t(s).command},((o=t(s).package)==null?void 0:o.path)??"")),1)]}),_:1}),a(t(v),{variant:((u=t(s))==null?void 0:u.status)===t(k).Opened?"success":"destructive",class:"flex gap-2"},{default:l(()=>{var o;return[a(t(f),{icon:"lucide:stethoscope"}),((o=t(s))==null?void 0:o.status)===t(k).Opened?(r(),i(C,{key:0},[n("Opened")],64)):(r(),i(C,{key:1},[n("Closed")],64))]}),_:1},8,["variant"])])):L("",!0)]),g("div",Z,[a(t(b),{variant:t(e)?"default":"secondary",size:"icon",onClick:c[0]||(c[0]=o=>e.value=!t(e))},{default:l(()=>[a(t(f),{icon:"lucide:clock"})]),_:1},8,["variant"]),a(t(b),{disabled:((T=t(s))==null?void 0:T.status)!==t(k).Opened,variant:"destructive",size:"icon",onClick:c[1]||(c[1]=o=>t(p)(d.id))},{default:l(()=>[a(t(f),{icon:"lucide:trash-2"})]),_:1},8,["disabled"])])]}),_:1}),a(t(I),{class:"min-h-0 px-0"},{default:l(()=>{var u;return[a(W,{logs:((u=t(s))==null?void 0:u.logs)??[],date:t(e)},null,8,["logs","date"])]}),_:1})]),_:1}))}}),it=Object.assign(tt,{__name:"CardsTerminal"});export{it as T};
//# sourceMappingURL=C22IAIRP.js.map
