import{n,s as t}from"./index-ce8c147b.js";const e=[];function s(s,o=n){let c;const i=new Set;function f(n){if(t(s,n)&&(s=n,c)){const n=!e.length;for(const n of i)n[1](),e.push(n,s);if(n){for(let n=0;n<e.length;n+=2)e[n][0](e[n+1]);e.length=0}}}return{set:f,update:function(n){f(n(s))},subscribe:function(t,e=n){const r=[t,e];return i.add(r),1===i.size&&(c=o(f)||n),t(s),()=>{i.delete(r),0===i.size&&(c(),c=null)}}}}export{s as w};
