import{h as o,m as i,g as l,j as e}from"./Dyk1ealw.js";import{c as d}from"./CVq-Ik9t.js";async function p(){return d.get("/context-panels")}let s=o(i([])),c=o(!1),n=o(null),a=o(null),u=o(i({}));const m={get items(){return l(s)},get loaded(){return l(c)},get activePanel(){return l(n)},get context(){return l(a)},get badges(){return l(u)},async load(){try{const t=await p();e(s,t.sort((r,g)=>(g.priority??0)-(r.priority??0)),!0),e(c,!0)}catch{}},clear(){e(s,[],!0),e(c,!1),e(n,null),e(a,null),e(u,{},!0)},open(t,r){e(n,t,!0),e(a,r,!0)},close(){e(n,null),e(a,null)},toggle(t,r){l(n)===t?(e(n,null),e(a,null)):(e(n,t,!0),e(a,r,!0))},setBadge(t,r){e(u,{...l(u),[t]:r},!0)},clearBadges(){e(u,{},!0)},forContext(t){return l(s).filter(r=>r.contexts.includes(t))},getPanel(t){return l(s).find(r=>r.id===t)}};export{m as c};
