import{_ as e,r as a,o as s,e as t,P as o,b as r,c as l,d as n,i,l as c,F as p,f as d,g as h,h as u,n as w,x as m,T as v,B as f,L as y}from"./index.51eb0e02.1749480002384.js";import{S as g}from"./sortable.esm.218539f1.1749480002384.js";import{d as x}from"./app.4e4ee3e1.1749480002384.js";import"./index.17be3941.1749480002384.js";import"./wangEditor.b189ca34.1749480002384.js";const S={class:"bg-white h-full w-full"},b={class:"top-search-window-nav w-600 flex-shrink-0 max500:w-max"},k=["data-type","onClick"],_=["src"],j={class:"max500:hidden"},T={class:"top-search-window-right"},C={class:"top-search-window-topList top-search-window-f-1x1:hidden"},E=["href"],I={class:"top-search-window-hotNum"};var F=e({__name:"window",setup(e){const F=a([]),N=a([]),A=a("baidu");let J="[]";try{const{topSearchSort:e="[]"}=localStorage;J=JSON.parse(e)||[],"object"!=typeof J&&(J=[])}catch(M){J=[]}x.forEach((e=>{var a;e.sort=(null==(a=J.find((a=>a.type===e.type)))?void 0:a.sort)||0})),F.value=x.sort(((e,a)=>e.sort-a.sort)),A.value=F.value[0].type;const L=a(!1),O=()=>{L.value=!0,f({url:"/apps.topSearch.Index/TopSearch",method:"GET",timeout:8e3,params:{type:A.value}}).then((e=>{1===e.code&&(N.value=e.data),L.value=!1})).catch((()=>{y({message:"请求超时",type:"error"})}))},B=(e=0)=>e>0?e>1e8?(e/1e8).toFixed(1)+"亿":(e/1e4).toFixed(1)+"万":e,G=a("");return s((()=>{const e=new g(G.value,{animation:300,ghostClass:"menu-item",dataIdAttr:"data-type",onUpdate:function(a){let s=e.toArray(),o=[];s.forEach(((e,a)=>{console.log(e,a),o.push({type:e,sort:a})})),localStorage.setItem("topSearchSort",JSON.stringify(o)),t.emit("topSearchRefresh")}})})),O(),(e,a)=>{const s=o("loading");return r(),l("div",S,[a[2]||(a[2]=n("div",{class:"top-search-window-souTop"},[n("img",{src:"/dist/assets/search.d6765de9.1749480002384.svg",class:"pointer-events-none",alt:""})],-1)),i((r(),l("div",{onMousedown:a[1]||(a[1]=c((()=>{}),["stop"])),class:"top-search-window-appWindow"},[n("div",b,[n("div",{class:"top-search-window-flex top-search-window-w-full top-search-window-left-menu",ref_key:"menu",ref:G},[(r(!0),l(p,null,d(F.value,(e=>(r(),h(v,{key:e.name},{default:u((()=>[n("div",{"data-type":e.type,class:w(["top-search-window-menu-item flex-shrink-0",{"top-search-window-sel":A.value===e.type}]),onClick:a=>{return s=e.type,A.value=s,void O();var s}},[n("img",{src:e.ico,class:"flex-shrink-0",alt:"百度"},null,8,_),n("span",j,m(e.name),1)],10,k)])),_:2},1024)))),128))],512)]),n("div",T,[n("ul",C,[(r(!0),l(p,null,d(N.value,((e,s)=>(r(),l("li",{key:s},[n("span",null,m(s+1),1),n("a",{onClick:a[0]||(a[0]=c((()=>{}),["stop"])),class:"top-search-window-aTag",target:"_blank _parent",href:e.url},m(e.title),9,E),n("span",I,m(B(e.hot)),1)])))),128))])])],32)),[[s,L.value]])])}}},[["__scopeId","data-v-33ce1beb"]]);export{F as default};
