import{r as t,h as s,g as e}from"./p-a0e89da3.js";const a=class{constructor(s){t(this,s),this.activeStep=0,this.inactiveSteps=[]}componentDidLoad(){Array.from(this.host.querySelectorAll("materials-step")).forEach(t=>{t.showButtons||(t.showButtons=this.showButtons)}),this.calcIndexes()}async calcIndexes(){const t=Array.from(this.host.querySelectorAll("materials-step")).filter((t,s)=>this.inactiveSteps.indexOf(s)<0);t.forEach((s,e)=>{s.style.display="flex",s.index=e,s.active=0===e,s.index===t.length-1&&(s.isLast=!0)}),Array.from(this.host.querySelectorAll("materials-step")).filter((t,s)=>this.inactiveSteps.indexOf(s)>-1).forEach(t=>t.style.display="none"),this.adjustHeight()}async handleActiveStepUpdate(){Array.from(this.host.querySelectorAll("materials-step")).filter((t,s)=>this.inactiveSteps.indexOf(s)<0).forEach(t=>{t.index===this.activeStep&&(this.currentStep=t),t.active=t.index===this.activeStep})}switchStep(t){Array.from(this.host.querySelectorAll("materials-step")).filter((t,s)=>this.inactiveSteps.indexOf(s)<0).find(s=>!("valid"===s.status||s.optional)&&s.index<t.detail)||(this.activeStep=t.detail)}async openStep(t){this.activeStep=t}async nextStep(){const t=Array.from(this.host.querySelectorAll("materials-step")).filter((t,s)=>this.inactiveSteps.indexOf(s)<0);this.activeStep<t.length-1&&this.activeStep++}async previousStep(){this.activeStep>0&&this.activeStep--}async adjustHeight(){const t=Array.from(this.host.querySelectorAll("materials-step"));t&&t.forEach(t=>{t.adjustHeight()})}render(){return s("slot",null)}get host(){return e(this)}static get watchers(){return{inactiveSteps:["calcIndexes"],activeStep:["handleActiveStepUpdate"]}}static get style(){return":host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start;overflow:hidden}"}};export{a as materials_stepper};