import{d as N,B as T,e as z,w as A,j as g,o,c as y,a as V,l as n,b as p,i as C,u as r,p as D,f as d,F as w,C as S,D as B,A as F,m as G,Z as M,G as I,r as m,t as h,E as U,H as Z,I as j,J,K,_ as P}from"./index-ongssuUn.js";const Q={class:"local-search-content"},W={class:"local-search-header"},X={class:"local-search-section"},Y={class:"local-search-section-title"},ee={key:0,class:"local-search-list-box"},se={class:"local-search-scroll"},te={class:"local-search-grid"},ae={key:1,class:"el-empty-box"},le={key:0,class:"local-search-section"},oe={class:"local-search-section-title"},ne={key:0,class:"local-search-list-box"},ce={class:"local-search-scroll"},ie={class:"local-search-grid"},re={key:1,class:"el-empty-box"},de=N({name:"LocalSearch",__name:"index",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(O,{emit:R}){const $=O,q=R,_=I({get:()=>$.modelValue,set:e=>q("update:modelValue",e)}),c=m(""),v=m(null),f=T(),x=I(()=>{const e=c.value.trim();return e?Z({children:f.homeGroupList}).filter(s=>{var u,l,t;return((u=s.name)==null?void 0:u.includes(e))||((t=(l=j(s.url??"").split("."))==null?void 0:l[1])==null?void 0:t.includes(e))}):[]});z(()=>{setTimeout(()=>{var e;return(e=v.value)==null?void 0:e.focus()},0)});const k=m(!1),i=m([]),E=J(async()=>{const e=c.value.trim();if(!e){i.value=[];return}k.value=!0;const a=await K({page:1,limit:24,type:0,name:e,order:1});k.value=!1,(a==null?void 0:a.code)===0?i.value=(a.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)??""})):i.value=[]},500,!1);A(c,()=>{c.value.trim()?E():i.value=[]});const b=(e,a)=>{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?h("在浏览器中打开"):h("在弹窗中打开"),handler:(u,l)=>{f.handleShowComponent({...l,openType:l.openType==0?1:0})}}),a==1&&s.push({icon:"fa fa-plus",text:h("添加到分组"),handler:(u,l)=>{const{info:t,id:H,...L}=l;console.log(t,H),f.addElement(L),U.success(h("添加成功"))}}),s};return(e,a)=>{const s=g("SvgIcon"),u=g("el-input"),l=g("el-empty");return o(),y(M,G({modelValue:r(_),"onUpdate:modelValue":a[1]||(a[1]=t=>C(_)?_.value=t:null)},{"append-to-body":!0},{title:e.$t("搜索分组图标"),width:"800px"}),{default:V(()=>[n("div",Q,[n("div",W,[p(u,{ref_key:"inputRef",ref:v,modelValue:r(c),"onUpdate:modelValue":a[0]||(a[0]=t=>C(c)?c.value=t:null),class:"local-search-input",placeholder:e.$t("搜索分组图标"),clearable:""},{prefix:V(()=>[p(s,{name:"el el-Search",size:"18"})]),_:1},8,["modelValue","placeholder"])]),n("div",X,[n("div",Y,D(e.$t("本地图标/组件")),1),r(x).length?(o(),d("div",ee,[n("div",se,[n("div",te,[(o(!0),d(w,null,S(r(x),t=>(o(),y(B,{key:t.id,class:"local-search-item",appData:t,type:"grid",contextmenus:b(t,0)},null,8,["appData","contextmenus"]))),128))])])])):(o(),d("div",ae,[p(l,{"image-size":80})]))]),r(i).length?(o(),d("div",le,[n("div",oe,D(e.$t("在线图标(可以右键添加到分组)")),1),r(i).length?(o(),d("div",ne,[n("div",ce,[n("div",ie,[(o(!0),d(w,null,S(r(i),t=>(o(),y(B,{key:t.id,class:"local-search-item",appData:t,type:"grid",contextmenus:b(t,1)},null,8,["appData","contextmenus"]))),128))])])])):(o(),d("div",re,[p(l,{"image-size":80})]))])):F("",!0)])]),_:1},16,["modelValue","title"])}}}),me=P(de,[["__scopeId","data-v-efae9467"]]);export{me as default};
