var t=Object.defineProperty,e=(e,h,l)=>(((e,h,l)=>{h in e?t(e,h,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[h]=l})(e,"symbol"!=typeof h?h+"":h,l),l);import{g as h}from"./common-41a4cac1.js";class l{constructor(t,h){e(this,"styleSheet"),e(this,"hightlightStyle",[]),e(this,"intialStyle",""),this.styleSheet=null,this.intialStyle=t,this.hightlightStyle=h}async injectStyle(t,e){let l=document.createElement("style");t.appendChild(l);const s=await h();if("string"==typeof this.hightlightStyle[s.highLightStyle]?l.innerHTML=this.intialStyle+`.yd-highlight ${this.hightlightStyle[s.highLightStyle]}`:l.innerHTML=this.intialStyle+`.yd-highlight ${this.hightlightStyle[s.highLightStyle].original}.yd-highlight:hover ${this.hightlightStyle[s.highLightStyle].hover}.yd-highlight:active ${this.hightlightStyle[s.highLightStyle].active}`,this.styleSheet=l.sheet,e)for(let h in e){const t=h,l=e[h];this.addRule(`${t} {${l}}`)}}removeAllStyles(){if(this.styleSheet)for(;this.styleSheet.cssRules.length>0;)this.styleSheet.deleteRule(0)}modifyStyle(t){if(this.styleSheet){for(;this.styleSheet.cssRules.length>0;)this.styleSheet.deleteRule(0);this.addRule(t)}}addRule(t){this.styleSheet&&this.styleSheet.insertRule(t,this.styleSheet.cssRules.length)}addClass(t,e){this.addRule(`.${t}  ${e} `)}modifyClass(t,e){if(this.styleSheet)for(let h=0;h<this.styleSheet.cssRules.length;h++){let l=this.styleSheet.cssRules[h];if(l instanceof CSSStyleRule&&l.selectorText==="."+t){this.styleSheet.deleteRule(h),this.addClass(t,e);break}}}removeClass(t){if(this.styleSheet)for(let e=this.styleSheet.cssRules.length-1;e>=0;e--){let h=this.styleSheet.cssRules[e];h instanceof CSSStyleRule&&h.selectorText==="."+t&&this.styleSheet.deleteRule(e)}}}export{l as S};
