import{s as k,W as M,E as R,b as v,h as E,k as I}from"./ReferenceContentLoader-34zh6S1n.js";import{c as s,o as t,r as N,d as C,y as x,a as D,e as i,j as b,u as n,G as w,w as h,b as B,F as $,s as S,a8 as z,k as F,I as V,t as A}from"./index-CDPBytck.js";import{m as L}from"./Draggable.vue-ar48KVQp.js";import{w as O}from"./DeleteSidebarListElement.vue-BOkQGL8v.js";const j={},q={class:"gap-1/2 flex flex-col px-3 pb-[75px]"};function G(r,u){return t(),s("ul",q,[N(r.$slots,"default")])}const X=k(j,[["render",G]]),K={class:"absolute right-1 flex opacity-0 group-hover:opacity-100"},T=C({__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=M(),{copyToClipboard:g}=R();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($,null,[D("div",K,[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(E),{size:"sm",state:n(p),title:`${o.value.action} ${o.value.name}`},{default:h(()=>[o.value.action==="Delete"?(t(),B(O,{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))}}),W={class:"empty-variable-name line-clamp-1 text-sm break-all group-hover:pr-5"},H=C({__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(L),{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:h(()=>[i(_,{class:F(["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:h(()=>[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:V({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",W,A(e.variable.name),1),i(T,{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=k(H,[["__scopeId","data-v-0b6c70e4"]]);export{X as _,Y as p};
