import{LitElement as e}from"../../../lit/index.js";String.prototype.replaceAll||(String.prototype.replaceAll=function(e,t){return this.split(e).join(t)});class SimpleIconset extends e{static get tag(){return"simple-iconset"}constructor(){super(),this.iconsets={},this.iconlist=[],this.manifest={},this.needsHydrated=[]}registerManifest(e){(e||[]).forEach((e=>{this.manifest[e.name]||(this.manifest[e.name]=e.icons||[],this.manifest[e.name].forEach((t=>{this.iconlist.push(`${e.name}:${t}`)})))}))}registerIconset(e,t={}){if("object"==typeof t?this.iconsets[e]={...t}:"string"==typeof t&&(this.iconsets[e]=t),this.needsHydrated.length>0){let e=[];this.needsHydrated.forEach(((t,s)=>{"function"==typeof t.setSrcByIcon&&t.setSrcByIcon(this)&&e.push(s)})),e.reverse().forEach((e=>{this.needsHydrated.splice(e,1)}))}}getIcon(e,t){let s=e.replaceAll("/","-").split(":");if(1===s.length&&(s=["icons",e]),2==s.length&&this.iconsets[s[0]]){if("string"!=typeof this.iconsets[s[0]]&&this.iconsets[s[0]][s[1]]&&"function"!=typeof this.iconsets[s[0]][s[1]])return this.iconsets[s[0]][s[1]];if(s[1])return`${this.iconsets[s[0]]}${s[1]}.svg`}return t!==this&&t&&this.needsHydrated.push(t),null}}globalThis.customElements.define(SimpleIconset.tag,SimpleIconset),globalThis.SimpleIconset=globalThis.SimpleIconset||{},globalThis.SimpleIconset.requestAvailability=()=>(null==globalThis.SimpleIconset.instance&&globalThis.document&&globalThis.document.body&&(globalThis.SimpleIconset.instance=globalThis.document.createElement("simple-iconset"),globalThis.document.body.appendChild(globalThis.SimpleIconset.instance)),globalThis.SimpleIconset.instance);const t="undefined"!=typeof global?new SimpleIconset:globalThis.SimpleIconset.requestAvailability();export{SimpleIconset,t as SimpleIconsetStore};