import{n as h,aA as M}from"./ReferenceContentLoader-D7Cnl9bC.js";import{j as s,o as t,k as R,d as k,r as x,b$ as E,i as D,q as i,n as b,p as n,bU as v,H as w,h as C,b as B,c6 as $,F as N,e as I,c as S,W as z,C as A,B as F,t as V}from"./index-BX34W763.js";import{m as q}from"./Draggable.vue-Csiddntz.js";import{w as L}from"./DeleteSidebarListElement.vue-BV2fba9G.js";const O={},W={class:"gap-1/2 flex flex-col px-3 pb-[75px]"};function j(r,u){return t(),s("ul",W,[R(r.$slots,"default")])}const X=h(O,[["render",j]]),H={class:"absolute right-1 flex opacity-0 group-hover:opacity-100"},K=k({__name:"SidebarListElementActions",props:{variable:{},warningMessage:{},isCopyable:{type:Boolean},isDeletable:{type:Boolean},isRenameable:{type:Boolean}},emits:["delete","rename"],setup(r,{emit:u}){const c=u,o=x({action:"None",name:""}),p=E(),{copyToClipboard:g}=M();function f(a){o.value={action:a,name:r.variable.name},p.show()}function d(){p.hide(),o.value={action:"None",name:""}}function y(a){c("delete",a),d()}return(a,e)=>(t(),s(N,null,[D("div",H,[a.isCopyable?(t(),s("button",{key:0,class:"text-c-3 hover:bg-b-3 hover:text-c-1 rounded p-[5px]",type:"button",onClick:e[0]||(e[0]=l=>n(g)(a.variable.name))},[i(n(v),{class:"h-3 w-3",icon:"Clipboard"})])):b("",!0),a.isRenameable?(t(),s("button",{key:1,class:"text-c-3 hover:bg-b-3 hover:text-c-1 rounded p-[5px]",type:"button",onClick:e[1]||(e[1]=l=>c("rename",a.variable.uid))},[i(n(v),{class:"h-3 w-3",icon:"Edit"})])):b("",!0),!a.variable.isDefault&&a.isDeletable?(t(),s("button",{key:2,class:"text-c-3 hover:bg-b-3 hover:text-c-1 rounded p-1",type:"button",onClick:e[2]||(e[2]=w(l=>f("Delete"),["prevent"]))},[i(n(v),{class:"h-3.5 w-3.5",icon:"Close"})])):b("",!0)]),i(n($),{size:"sm",state:n(p),title:`${o.value.action} ${o.value.name}`},{default:C(()=>[o.value.action==="Delete"?(t(),B(L,{key:0,variableName:o.value.name,warningMessage:a.warningMessage,onClose:d,onDelete:e[3]||(e[3]=l=>y(a.variable.uid))},null,8,["variableName","warningMessage"])):b("",!0)]),_:1},8,["state","title"])],64))}}),T={class:"empty-variable-name line-clamp-1 text-sm break-all group-hover:pr-5"},U=k({__name:"SidebarListElement",props:{variable:{},warningMessage:{},to:{},isDeletable:{type:Boolean},isCopyable:{type:Boolean},isRenameable:{type:Boolean},isDraggable:{type:Boolean,default:!1},isDroppable:{type:[Boolean,Function],default:!1},collectionId:{}},emits:["delete","colorModal","rename","onDragEnd"],setup(r,{emit:u}){const c=u,o=I(),p=e=>{e.metaKey?window.open(o.resolve(r.to).href,"_blank"):o.push(r.to)},g=e=>{c("delete",e)},f=e=>{c("colorModal",e)},d=e=>{c("rename",e)},y=x(null),a=S(()=>({ceiling:.5,floor:.5}));return(e,l)=>{const _=z("router-link");return t(),s("li",null,[i(n(q),{id:e.variable.uid,ref_key:"draggableRef",ref:y,ceiling:a.value.ceiling,floor:a.value.floor,isDraggable:e.isDraggable,isDroppable:e.isDroppable,parentIds:e.collectionId?[e.collectionId]:[],onOnDragEnd:l[2]||(l[2]=(...m)=>e.$emit("onDragEnd",...m))},{default:C(()=>[i(_,{class:A(["text-c-2 hover:bg-b-2 group relative flex h-8 items-center gap-1.5 rounded py-1 pr-1.5 font-medium no-underline",[e.variable.color?"pl-5":"pl-1.5"]]),exactActiveClass:"bg-b-2 !text-c-1",role:"button",to:e.to,onClick:l[1]||(l[1]=w(m=>p(m),["prevent"]))},{default:C(()=>[e.variable.color?(t(),s("button",{key:0,class:"hover:bg-b-3 rounded p-1.5",type:"button",onClick:l[0]||(l[0]=m=>f(e.variable.uid))},[D("div",{class:"h-2.5 w-2.5 rounded-xl",style:F({backgroundColor:e.variable.color})},null,4)])):b("",!0),e.variable.icon?(t(),B(n(v),{key:1,class:"text-sidebar-c-2 size-3.5 stroke-[2.25]",icon:e.variable.icon},null,8,["icon"])):b("",!0),D("span",T,V(e.variable.name),1),i(K,{isCopyable:!!e.isCopyable,isDeletable:!!e.isDeletable,isRenameable:!!e.isRenameable,variable:{...e.variable,isDefault:e.variable.isDefault??!1},warningMessage:e.warningMessage,onDelete:g,onRename:d},null,8,["isCopyable","isDeletable","isRenameable","variable","warningMessage"])]),_:1},8,["class","to"])]),_:1},8,["id","ceiling","floor","isDraggable","isDroppable","parentIds"])])}}}),Y=h(U,[["__scopeId","data-v-0b6c70e4"]]);export{X as _,Y as p};
