import{j as c}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=[],o=0;const f=4;let x=i=>{let s=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=s.push(e),()=>{for(let n=o+f;n<r.length;)r[n]===e?r.splice(n,f):n+=f;let l=s.indexOf(e);~l&&(s.splice(l,1),--t.lc||t.off())}},notify(e,l){let n=!r.length;for(let a of s)r.push(a,t.value,e,l);if(n){for(o=0;o<r.length;o+=f)r[o](r[o+1],r[o+2],r[o+3]);r.length=0}},off(){},set(e){let l=t.value;l!==e&&(t.value=e,t.notify(l))},subscribe(e){let l=t.listen(e);return e(t.value),l},value:i};return t};function E(i,s,t){let e=new Set([...s,void 0]);return i.listen((l,n,a)=>{e.has(a)&&t(l,n,a)})}let p=(i,s)=>t=>{i.current=t,s()};function S(i,{keys:s,deps:t=[i,s]}={}){let e=d.useRef();e.current=i.get();let l=d.useCallback(a=>s?.length>0?E(i,s,p(e,a)):i.listen(p(e,a)),t),n=()=>e.current;return d.useSyncExternalStore(l,n,n)}const g=x(!0),B=()=>{const i=S(g);function s(){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]),c.jsx(m,{"aria-label":"Global navigation",onSidebarToggle:s,isSidebarOpen:i,children:c.jsx(b,{})})};export{B as PageToggle};
