import{useStyleInject as e}from"../StyleContext.mjs";import t from"./useHMR.mjs";import{onBeforeUnmount as n,shallowRef as r,watch as i,watchEffect as a}from"vue";function o(o,s,c,l){let u=e(),d=r(``),f=r();a(()=>{d.value=[o,...s.value].join(`%`)}),t();let p=e=>{u.value.cache.update(e,e=>{let[t=0,n]=e||[];return t-1==0?(l?.(n,!1),null):[t-1,n]})};return i(d,(e,t)=>{t&&p(t),u.value.cache.update(e,e=>{let[t=0,n]=e||[],r=n||c();return[t+1,r]}),f.value=u.value.cache.get(d.value)[1]},{immediate:!0}),n(()=>{p(d.value)}),f}export{o as default};