import{h as n,m as d,g as r,j as e}from"./Dyk1ealw.js";import{c}from"./CVq-Ik9t.js";async function l(){return c.get("/sidebar/items")}let s=n(d([])),o=n(!1),i=n(d({}));const p={get items(){return r(s)},get loaded(){return r(o)},get badges(){return r(i)},async load(){try{const t=await l();e(s,t.sort((a,g)=>(g.priority??0)-(a.priority??0)),!0),e(o,!0)}catch{}},async fetchBadges(){await Promise.all(r(s).filter(t=>t.badgeEndpoint).map(async t=>{try{const a=await c.get(t.badgeEndpoint);this.setBadge(t.id,a.count)}catch{}}))},setBadge(t,a){e(i,{...r(i),[t]:a},!0)},clear(){e(s,[],!0),e(o,!1),e(i,{},!0)}};export{p as s};
