import{d as M,B as b,r as p,C as N,F as z,G as A,e as F,w as G,k as f,o as n,c as _,a as w,n as c,p as C,i as V,H as U,u as r,b as g,I as J,f as d,J as D,K as B,L as I,M as K,E as Q,N as W,O as $,_ as j}from"./index-CUMBhq1p.js";const P={class:"local-search-header"},X={class:"local-search-section"},Y={key:0,class:"local-search-list-box"},Z={class:"local-search-grid"},ee={key:1,class:"el-empty-box"},se={class:"local-search-section"},le={key:0,class:"local-search-list-box"},te={class:"local-search-grid"},oe={key:1,class:"el-empty-box"},ae=M({name:"LocalSearch",__name:"index",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(O,{emit:S}){const L=O,R=S,m=b({get:()=>L.modelValue,set:e=>R("update:modelValue",e)}),o=p(""),y=p(null),h=N(),v=b(()=>{const e=o.value.trim();return e?z({id:0,children:h.homeGroupList}).filter(s=>{var i,a,t;return((i=s.name)==null?void 0:i.includes(e))||((t=(a=A(s.url??"").split("."))==null?void 0:a[1])==null?void 0:t.includes(e))}):[]}),T=()=>{o.value=""};F(()=>{setTimeout(()=>{var e;return(e=y.value)==null?void 0:e.focus()},0)});const x=p(!1),u=p([]),q=K(async()=>{const e=o.value.trim();if(!e){u.value=[];return}x.value=!0;const l=await $({page:1,limit:24,type:0,name:e,order:1});x.value=!1,(l==null?void 0:l.code)===0?u.value=(l.data.data??[]).map(s=>({id:s.id,name:s.name,url:s.url,src:s.src,background:s.background??"rgba(0,0,0,0)",type:"icon",info:(s==null?void 0:s.info)??""})):u.value=[]},500,!1);G(o,()=>{o.value.trim()?q():u.value=[]});const k=(e,l)=>{const s=[];return e.url&&(e.url.indexOf("https://")!=-1||e.url.indexOf("http://")!=-1)&&s.push({icon:"fa fa-share-square-o",text:e.openType==0?"在浏览器中打开":"在弹窗中打开",handler:(i,a)=>{h.handleShowComponent({...a,openType:a.openType==0?1:0})}}),l==1&&s.push({icon:"fa fa-plus",text:"添加到分组",handler:(i,a)=>{const{info:t,id:E,...H}=a;console.log(t,E),h.addElement(H),Q.success(W("group.tips4"))}}),s};return(e,l)=>{const s=f("SvgIcon"),i=f("el-empty"),a=f("el-dialog");return n(),_(a,{modelValue:r(m),"onUpdate:modelValue":l[1]||(l[1]=t=>V(m)?m.value=t:null),width:"750px","destroy-on-close":"",modal:!0,"close-on-click-modal":!0,"show-close":!1,style:{maxWidth:"100vw",color:"#fff","background-color":"#161616c2"}},{header:w(()=>[c("div",P,[C(c("input",{ref_key:"inputRef",ref:y,"onUpdate:modelValue":l[0]||(l[0]=t=>V(o)?o.value=t:null),class:"local-search-input",type:"text",placeholder:"搜索分组图标..."},null,512),[[U,r(o)]]),C(c("button",{class:"local-search-close",onClick:T},[g(s,{name:"el el-Close",size:"20"})],512),[[J,r(o)]])])]),default:w(()=>[c("div",X,[l[2]||(l[2]=c("div",{class:"local-search-section-title"},"本地图标/组件",-1)),r(v).length?(n(),d("div",Y,[c("div",Z,[(n(!0),d(D,null,B(r(v),t=>(n(),_(I,{key:t.id,class:"local-search-item",appData:t,type:"grid",contextmenus:k(t,0)},null,8,["appData","contextmenus"]))),128))])])):(n(),d("div",ee,[g(i,{"image-size":61})]))]),c("div",se,[l[3]||(l[3]=c("div",{class:"local-search-section-title"},"在线图标(可以右键添加到分组)",-1)),r(u).length?(n(),d("div",le,[c("div",te,[(n(!0),d(D,null,B(r(u),t=>(n(),_(I,{key:t.id,class:"local-search-item",appData:t,type:"grid",contextmenus:k(t,1)},null,8,["appData","contextmenus"]))),128))])])):(n(),d("div",oe,[g(i,{"image-size":61})]))])]),_:1},8,["modelValue"])}}}),ie=j(ae,[["__scopeId","data-v-60264334"]]);export{ie as default};
