const e=require("../StyleContext.js"),t=require("../../../node_modules/.pnpm/@emotion_hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js"),n=require("../util.js"),r=require("./useGlobalCache.js");let i=require("vue");var a={},o=`css`,s=new Map;function c(e){s.set(e,(s.get(e)||0)+1)}function l(t,n){typeof document<`u`&&document.querySelectorAll(`style[${e.ATTR_TOKEN}="${t}"]`).forEach(e=>{e.__cssinjs_instance__===n&&e.parentNode?.removeChild(e)})}var u=0;function d(e,t){s.set(e,(s.get(e)||0)-1);let n=Array.from(s.keys()),r=n.filter(e=>(s.get(e)||0)<=0);n.length-r.length>u&&r.forEach(e=>{l(e,t),s.delete(e)})}var f=(e,t,n,r)=>{let i={...n.getDerivativeToken(e),...t};return r&&(i=r(i)),i};function p(s,l,u=(0,i.ref)({})){let p=e.useStyleInject(),m=(0,i.computed)(()=>Object.assign({},...l.value)),h=(0,i.computed)(()=>n.flattenToken(m.value)),g=(0,i.computed)(()=>n.flattenToken(u.value.override||a));return r.default(`token`,(0,i.computed)(()=>[u.value.salt||``,s.value.id,h.value,g.value]),()=>{let{salt:e=``,override:r=a,formatToken:i,getComputedToken:l}=u.value,d=l?l(m.value,r,s.value):f(m.value,r,s.value,i),p=n.token2key(d,e);d._tokenKey=p,c(p);let h=`${o}-${t.default(p)}`;return d._hashId=h,[d,h]},e=>{d(e[0]._tokenKey,p.value?.cache.instanceId)})}exports.default=p,exports.getComputedToken=f;