import{computed as h}from"vue";import{useToken as x}from"../theme/internal.mjs";const u=["xxxl","xxl","xl","lg","md","sm","xs"],l=s=>({xs:`(max-width: ${s.screenXSMax}px)`,sm:`(min-width: ${s.screenSM}px)`,md:`(min-width: ${s.screenMD}px)`,lg:`(min-width: ${s.screenLG}px)`,xl:`(min-width: ${s.screenXL}px)`,xxl:`(min-width: ${s.screenXXL}px)`,xxxl:`{min-width: ${s.screenXXXL}px}`});function b(){const[,s]=x();return h(()=>{const n=l(s.value),r=new Map;let a=-1,c={};return{matchHandlers:{},dispatch(e){return c=e,r.forEach(t=>t(c)),r.size>=1},subscribe(e){return r.size||this.register(),a+=1,r.set(a,e),e(c),a},unsubscribe(e){r.delete(e),r.size||this.unregister()},unregister(){Object.keys(n).forEach(e=>{const t=n[e],i=this.matchHandlers[t];i?.mql.removeListener(i?.listener)}),r.clear()},register(){Object.keys(n).forEach(e=>{const t=n[e],i=({matches:m})=>{this.dispatch({...c,[e]:m})},d=window.matchMedia(t);d.addListener(i),this.matchHandlers[t]={mql:d,listener:i},i(d)})},responsiveMap:n}})}export{b as default,u as responsiveArray};
