import{r as t,h as e,g as s}from"./p-fb8320e0.js";class i{constructor(e){t(this,e),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,e)=>this.inactiveSteps.indexOf(e)<0);t.forEach((e,s)=>{e.style.display="flex",e.index=s,e.active=0===s,e.index===t.length-1&&(e.isLast=!0)}),Array.from(this.host.querySelectorAll("materials-step")).filter((t,e)=>this.inactiveSteps.indexOf(e)>-1).forEach(t=>t.style.display="none"),this.adjustHeight()}async handleActiveStepUpdate(){Array.from(this.host.querySelectorAll("materials-step")).filter((t,e)=>this.inactiveSteps.indexOf(e)<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,e)=>this.inactiveSteps.indexOf(e)<0).find(e=>!("valid"===e.status||e.optional)&&e.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,e)=>this.inactiveSteps.indexOf(e)<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 e("slot",null)}get host(){return s(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{i as materials_stepper};