import{u as D,a as S,b as C,c as L,d as P,e as z,f as M,g as f,i as r,h as a,L as A,B as u,j as B,k as E,m as w,D as F,S as I,M as y,F as R,l as G,I as H,n as N,o as T,p as q,t as n}from"./index-D5mkkdQy.js";var J=n("<div>"),K=n('<div class="mt-20 w-full flex flex-col gap-4"><div class="flex gap-2 items-center justify-between pl-3"><div class="text-14-medium text-text-strong"></div></div><ul class="flex flex-col gap-2">'),O=n('<div class="mt-30 mx-auto flex flex-col items-center gap-3"><div class="flex flex-col gap-1 items-center justify-center"><div class="text-14-medium text-text-strong"></div><div class="text-12-regular text-text-weak">'),Q=n('<div class="mx-auto mt-55 w-full md:w-auto px-4">'),U=n('<div class="text-14-regular text-text-weak">');function W(){const m=D(),$=S(),p=C(),h=L(),_=P(),o=z(),s=M(),b=f(()=>m.data.path.home),k=f(()=>m.data.project.slice().sort((t,e)=>(e.time.updated??e.time.created)-(t.time.updated??t.time.created)).slice(0,5)),j=f(()=>{const t=o.healthy();return t===!0?"bg-icon-success-base":t===!1?"bg-icon-critical-base":"bg-border-weak-base"});function d(t){$.projects.open(t),o.projects.touch(t),_(`/${T(t)}`)}async function x(){function t(e){if(Array.isArray(e))for(const l of e)d(l);else e&&d(e)}if(p.openDirectoryPickerDialog&&o.isLocal()){const e=await p.openDirectoryPickerDialog?.({title:s.t("command.project.open"),multiple:!0});t(e)}else h.show(()=>a(q,{multiple:!0,onSelect:t}),()=>t(null))}return(()=>{var t=Q();return r(t,a(A,{class:"md:w-1/2 opacity-12 mx-auto"}),null),r(t,a(I,{get when(){return!o.isLocal},get children(){return a(u,{size:"large",variant:"ghost",class:"mt-4 mx-auto text-14-regular text-text-weak",onClick:()=>h.show(()=>a(F,{})),get children(){return[(()=>{var e=J();return B(l=>E(e,{"size-2 rounded-full":!0,[j()]:!0},l)),e})(),w(()=>o.name)]}})}}),null),r(t,a(N,{get children(){return[a(y,{get when(){return m.data.project.length>0},get children(){var e=K(),l=e.firstChild,i=l.firstChild,g=l.nextSibling;return r(i,()=>s.t("home.recentProjects")),r(l,a(u,{icon:"folder-add-left",size:"normal",class:"pl-2 pr-3",onClick:x,get children(){return s.t("command.project.open")}}),null),r(g,a(R,{get each(){return k()},children:c=>a(u,{size:"large",variant:"ghost",class:"text-14-mono text-left justify-between px-3",onClick:()=>d(c.worktree),get children(){return[w(()=>c.worktree.replace(b(),"~")),(()=>{var v=U();return r(v,()=>G.fromMillis(c.time.updated??c.time.created).toRelative()),v})()]}})})),e}}),a(y,{when:!0,get children(){var e=O(),l=e.firstChild,i=l.firstChild,g=i.nextSibling;return r(e,a(H,{name:"folder-add-left",size:"large"}),l),r(i,()=>s.t("home.empty.title")),r(g,()=>s.t("home.empty.description")),r(e,a(u,{class:"px-3 mt-1",onClick:x,get children(){return s.t("command.project.open")}}),null),e}})]}}),null),t})()}export{W as default};
