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