import{u as p}from"./useQuery-DB4moXtm.js";import{s as b,i as r,aA as u,x as y,y as g}from"./index-CXwCk-SR.js";import{u as m}from"./useLayers-CmM8Q7L7.js";function C(){b();const{loaded:l}=g(),a=p({queryKey:["overview-dashboards"],queryFn:()=>y.overview.list(),enabled:r(()=>{var e;return l.value&&(((e=u())==null?void 0:e.length)??0)===0}),staleTime:6e4,refetchOnWindowFocus:!0}),{availableLayers:v}=m(),d=r(()=>{const e=new Set;for(const s of v.value)e.add(s.key.toUpperCase());return e}),o=r(()=>{var s;const e=u();return e&&e.length>0?e.map(t=>{var n;return{...t,widgetCount:((n=t.widgets)==null?void 0:n.length)??0}}):((s=a.data.value)==null?void 0:s.dashboards)??[]}),i=r(()=>o.value.filter(e=>{const s=e.layers??[];return s.length===0?!0:s.some(t=>d.value.has(t.toUpperCase()))})),c=r(()=>i.value.filter(e=>(e.visibility??"public")==="public")),f=r(()=>i.value.filter(e=>e.visibility==="operate"));return{isLoading:a.isLoading,isError:a.isError,all:o,visible:i,publicOverviews:c,operateOverviews:f}}export{C as u};
