import{d as S,ah as B,g as f,A as p,J as o,B as h,j as a,t as e,am as D,H as u,C as Q,aH as V,_ as y,P as m,r as $,c as v}from"./index-DOFLUERq.js";import{i as E}from"./nodes-5SvwML7l.js";import{_ as H}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./common-DEIQtiPI.js";const K={class:"toolbar"},L={class:"filters"},A={class:"view-toggle"},j=["title"],z=["title"],J=["disabled"],O=["disabled","title"],P=["disabled"],R=["disabled"],T=S({__name:"local_ai_node_list_toolbar",props:{entity:{},searchQuery:{},viewMode:{},selectedKeys:{},loading:{type:Boolean}},emits:["update:searchQuery","update:viewMode","reload","create","delete-selected"],setup(s,{emit:k}){const g=s,i=k,d=B(),r=$(!1),b=v({get:()=>g.searchQuery,set:l=>i("update:searchQuery",l)}),c=v({get:()=>g.viewMode,set:l=>i("update:viewMode",l)});function w(){i("reload")}function C(){i("create")}function _(){i("delete-selected")}const I=v(()=>[{label:e("Import local nodes"),key:"import-local-nodes"}]);function x(l){l==="import-local-nodes"&&M()}async function M(){if(!r.value){r.value=!0;try{const l=await E();if(i("reload"),!l?.success){d.error({title:e("Error"),content:e("Import failed")});return}const t=l.matched||0,n=l.imported||0,N=l.skipped_existing||0;t===0?d.info({title:e("Info"),content:e("No local node definitions found")}):n===0&&N>0?d.info({title:e("Info"),content:e("All local nodes already exist")}):n>0?d.success({title:e("Success"),content:`${e("Imported")} ${n} ${e("nodes")}`}):d.info({title:e("Info"),content:e("No new local nodes found")})}catch(l){console.error("Import local nodes error:",l),d.error({title:e("Error"),content:e("Import failed")})}finally{r.value=!1}}}return(l,t)=>(f(),p("div",K,[o("div",L,[h(a(D),{value:b.value,"onUpdate:value":t[0]||(t[0]=n=>b.value=n),placeholder:a(e)("Search"),clearable:"",style:{width:"200px"}},null,8,["value","placeholder"])]),o("div",A,[o("button",{class:u(["toggle-btn",{active:c.value==="list"}]),onClick:t[1]||(t[1]=n=>c.value="list"),title:a(e)("List View")},[...t[3]||(t[3]=[o("i",{class:"fa fa-list"},null,-1)])],10,j),o("button",{class:u(["toggle-btn",{active:c.value==="card"}]),onClick:t[2]||(t[2]=n=>c.value="card"),title:a(e)("Card View")},[...t[4]||(t[4]=[o("i",{class:"fa fa-th-large"},null,-1)])],10,z)]),o("button",{class:"refresh-btn",onClick:w,disabled:s.loading},[o("i",{class:u(s.loading?"fa fa-spinner fa-spin":"fa fa-refresh")},null,2)],8,J),h(a(V),{trigger:"click",options:I.value,onSelect:x},{default:Q(()=>[o("button",{class:"refresh-btn",disabled:s.loading||r.value,title:a(e)("More")},[o("i",{class:u(r.value?"fa fa-ellipsis-h fa-spin":"fa fa-ellipsis-h")},null,2)],8,O)]),_:1},8,["options"]),s.selectedKeys.length===0?(f(),p("button",{key:0,class:"create-btn",onClick:C,disabled:s.loading},[t[5]||(t[5]=o("i",{class:"fa fa-plus"},null,-1)),y(" "+m(a(e)("Create")),1)],8,P)):(f(),p("button",{key:1,class:"delete-btn",onClick:_,disabled:s.loading},[t[6]||(t[6]=o("i",{class:"fa fa-trash"},null,-1)),y(" "+m(a(e)("Delete Selected"))+" ("+m(s.selectedKeys.length)+") ",1)],8,R))]))}}),W=H(T,[["__scopeId","data-v-653d49dd"]]);export{W as default};
