import{L as e}from"./p-dcc98162.js";import{c as s}from"./p-262ec334.js";const t=new class{constructor(){this.baseBasicZIndex=1e4,this.topBasicZIndex=11e3,this.levelEntry={base:{zIndex:this.baseBasicZIndex,elements:[]},top:{zIndex:this.topBasicZIndex,elements:[]}}}setZIndex(s,t="base"){if(null===s)return;this.removeZIndex(s,t);const i=this.levelEntry[t];s&&i&&("base"===t&&this.isBaseLevelOver()&&(e.warn("The max 'z-index' of base level is '11000', but the current 'z-index' is over, Please optimize the use of 'z-index', otherwise there will be some performance overhead."),this.increaseTopEntry()),i.elements.push(s),i.zIndex+=1,s.style.zIndex=i.zIndex.toString())}removeZIndex(e,t="base"){if(null===e)return;const i=this.levelEntry[t];if(e&&i){let t=-1;i.elements.forEach(((i,n)=>{i===e&&(t=n),t>=0&&n>t&&(i.style.zIndex=""+(s(i.style.zIndex)-1))})),t>=0&&(e.style.removeProperty("z-index"),i.elements.splice(t,1),i.zIndex-=1)}}overrideZIndexBasicValues(e){const s=this.formatZIndexBasicValues(e);this.validBasicValues(s)&&this.updateBasicValues(s)}formatZIndexBasicValues(e){return Object.assign({base:this.baseBasicZIndex,top:this.topBasicZIndex},e)}validBasicValues(s){return"number"!=typeof s.base||"number"!=typeof s.top?(e.error("Change z-index basic value failed, both base level and top level should be of type number!"),!1):!(s.base>=s.top&&(e.error("Change z-index basic value failed, the base level should be smaller than the top level!"),1))}updateBasicValues(e){this.baseBasicZIndex=e.base,this.topBasicZIndex=e.top;const s=this.levelEntry.base;s.elements.forEach(((e,s)=>{e.style.zIndex=`${this.baseBasicZIndex+s+1}`})),s.zIndex=this.baseBasicZIndex+s.elements.length;const t=this.levelEntry.top;t.elements.forEach(((e,s)=>{e.style.zIndex=`${this.topBasicZIndex+s+1}`})),t.zIndex=this.topBasicZIndex+t.elements.length}increaseTopEntry(){const e=this.levelEntry.top;e.elements.forEach((e=>{e.style.zIndex=`${s(e.style.zIndex)+1}`})),e.zIndex+=1}isBaseLevelOver(){return this.levelEntry.base.zIndex>=this.topBasicZIndex}};export{t as I}