import{m as i}from"./chunk-MN3WRWXI.js";var p=(r,s,t=!1)=>(Array.isArray(r)||(r=[r]),s?r.map(c=>typeof c=="string"||t?s(c):c):r);var n=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(s){return this._cache.has(s)}get(s){let t=this._cache.get(s);return t||i(`[Assets] Asset id ${s} was not found in the Cache`),t}set(s,t){let c=p(s),a;for(let e=0;e<this.parsers.length;e++){let h=this.parsers[e];if(h.test(t)){a=h.getCacheableAssets(c,t);break}}let o=new Map(Object.entries(a||{}));a||c.forEach(e=>{o.set(e,t)});let f=[...o.keys()],_={cacheKeys:f,keys:c};c.forEach(e=>{this._cacheMap.set(e,_)}),f.forEach(e=>{let h=a?a[e]:t;this._cache.has(e)&&this._cache.get(e)!==h&&i("[Cache] already has key:",e),this._cache.set(e,o.get(e))})}remove(s){if(!this._cacheMap.has(s)){i(`[Assets] Asset id ${s} was not found in the Cache`);return}let t=this._cacheMap.get(s);t.cacheKeys.forEach(a=>{this._cache.delete(a)}),t.keys.forEach(a=>{this._cacheMap.delete(a)})}get parsers(){return this._parsers}},A=new n;export{p as a,A as b};
