import{j,U as k,V as w,W as y,c as m,v as r,F as A,r as C,e as g,w as l,y as u,t as N,X as v,T as b,d as s,o as d}from"./vendor-nextcloud-vue-BwabAicX.js";import{e as h}from"./aiquila-main.js";import{_ as B}from"./vendor-icons-D2YTIWGr.js";const I={name:"ProjectSidebar",components:{NcAppNavigationNew:y,NcAppNavigationItem:w,NcActionButton:k},props:{projects:{type:Array,default:()=>[]},activeProjectId:{type:Number,default:null}},emits:["new-project","select-project","delete-project","duplicate-project","project-renamed"],methods:{t:j,async onSaveRename(t,i){const n=i.trim();if(n)try{const{data:o}=await h(t,{title:n});this.$emit("project-renamed",o)}catch(o){console.error("Rename failed:",o)}}}},P={style:{display:"contents"}};function q(t,i,n,o,S,a){const _=s("NcAppNavigationNew"),p=s("NcActionButton"),f=s("NcAppNavigationItem");return d(),m("div",P,[r(_,{text:a.t("aiquila","New project"),onClick:i[0]||(i[0]=e=>t.$emit("new-project"))},null,8,["text"]),(d(!0),m(A,null,C(n.projects,e=>(d(),g(f,{key:e.id,name:e.title,class:b({active:e.id===n.activeProjectId}),editable:!0,"edit-label":a.t("aiquila","Rename"),"edit-placeholder":a.t("aiquila","Project name"),"onUpdate:name":c=>a.onSaveRename(e.id,c),onClick:c=>t.$emit("select-project",e.id)},{actions:l(()=>[r(p,{onClick:v(c=>t.$emit("duplicate-project",e.id),["stop"])},{default:l(()=>[u(N(a.t("aiquila","Duplicate")),1)]),_:1},8,["onClick"]),r(p,{onClick:v(c=>t.$emit("delete-project",e.id),["stop"])},{default:l(()=>[u(N(a.t("aiquila","Delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["name","class","edit-label","edit-placeholder","onUpdate:name","onClick"]))),128))])}const D=B(I,[["render",q],["__scopeId","data-v-67cc6d3b"]]);export{D as default};
