import{j as p}from"./Button.BVfR1y85.js";import{s as u}from"./page.BTC3Kf3x.js";import{P as m,B as b}from"./bars-icon.wdJgEs3A.js";import{r as d}from"./index.eCxJ45ll.js";/* empty css                        */import"./PageContext.BUbWpNW2.js";let r=[],a=0;const f=4;let x=i=>{let l=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=l.push(e),()=>{for(let s=a+f;s<r.length;)r[s]===e?r.splice(s,f):s+=f;let n=l.indexOf(e);~n&&(l.splice(n,1),--t.lc||t.off())}},notify(e,n){let s=!r.length;for(let o of l)r.push(o,t.value,e,n);if(s){for(a=0;a<r.length;a+=f)r[a](r[a+1],r[a+2],r[a+3]);r.length=0}},off(){},set(e){let n=t.value;n!==e&&(t.value=e,t.notify(n))},subscribe(e){let n=t.listen(e);return e(t.value),n},value:i};return t};function E(i,l,t){let e=new Set(l).add(void 0);return i.listen((n,s,o)=>{e.has(o)&&t(n,s,o)})}let c=(i,l)=>t=>{i.current!==t&&(i.current=t,l())};function S(i,{keys:l,deps:t=[i,l]}={}){let e=d.useRef();e.current=i.get();let n=d.useCallback(o=>(c(e,o)(i.value),l?.length>0?E(i,l,c(e,o)):i.listen(c(e,o))),t),s=()=>e.current;return d.useSyncExternalStore(n,s,s)}const g=x(!0),B=()=>{const i=S(g);function l(){g.set(!i)}return d.useEffect(()=>{const t=typeof window<"u",e=document.getElementById("page-sidebar-body")?.parentElement;!t||!e||(e.classList.contains(u.pageSidebar)?(e.classList.toggle(u.modifiers.expanded),e.classList.toggle(u.modifiers.collapsed)):e.classList.add(u.pageSidebar,i?u.modifiers.expanded:u.modifiers.collapsed),e.setAttribute("aria-hidden",`${!i}`))},[i]),p.jsx(m,{"aria-label":"Global navigation",onSidebarToggle:l,isSidebarOpen:i,children:p.jsx(b,{})})};export{B as PageToggle};
