(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[48],{958:function(t,s,i){"use strict";i.r(s),i.d(s,"AuWidgetSteps",function(){return l}),i.d(s,"widget",function(){return l});var e,a=i(0),n=i(2),o=i(76),d=i(14),r=i(1),c=i(46),u=i(160);!function(t){t[t.previous=0]="previous",t[t.visited=1]="visited",t[t.all=2]="all"}(e||(e={}));let l=class extends u.a{constructor(){super(...arguments),this._isSubscribedToOnFinish=!1}connectedCallback(){super.connectedCallback(),this.stepSubscription=this.observe(d.a.STEP_CHANGED).subscribe(async t=>{var s;this._currentStep=null===(s=null===t||void 0===t?void 0:t.data)||void 0===s?void 0:s.step,await this.updateParamsAsync(this.params)})}async _stepChangeCallback(t){if(r.a.isNotNullOrUndefined(this.params)&&r.a.isNotNullOrUndefined(this.params.availabilityMode))switch(e[this.params.availabilityMode.toString()]){case e.previous:this.stepsManager.handleModePrevious(t);break;case e.visited:this.stepsManager.handleModeVisited(t);break;case e.all:}}updateParams(t){}async updateParamsAsync(t){var s,i;await super.updateParamsAsync(t),(null===t||void 0===t?void 0:t.steps)&&await this.changeStepState(t.steps),(null===t||void 0===t?void 0:t.finishButton)&&((null===(s=t.finishButton)||void 0===s?void 0:s.onClick)&&this._subscribeToOnFinishClick(null===(i=t.finishButton)||void 0===i?void 0:i.onClick),this.stepsManager.finishButton=t.finishButton,this.stepsManager.update()),(null===t||void 0===t?void 0:t.backToProductButton)&&(this.stepsManager.backToProductButton=t.backToProductButton,this.stepsManager.update()),this._currentStep&&await this._stepChangeCallback(this._currentStep)}async _subscribeToOnFinishClick(t){this.publishData({selector:"#finishButton"},d.a.GET_ELEMENT_FROM_AU_WIZARD).then(s=>{s&&(this._isSubscribedToOnFinish||(s.onFinish.subscribe(async()=>{await r.a.functionWrapperConstructor(t)()}),this._isSubscribedToOnFinish=!0))})}async changeStepState(t){const s=this.stepsManager.steps;for(const[i,e]of Object.entries(t))await this._applyConfig(s,i,e);this.stepsManager.update()}async _applyConfig(t,s,i){const e=r.a.isNum(s)?t[Number(s)]:t.find(t=>t.title===s||t.name===s);if(e){const s=t.indexOf(e);r.a.isNotNullOrUndefined(i.enabled)&&this.stepsManager.toggleDisable(s,!i.enabled,!1),r.a.isNotNullOrUndefined(i.disabled)&&this.stepsManager.toggleDisable(s,i.disabled,!1),r.a.isNotNullOrUndefined(i.hidden)&&this.stepsManager.toggleHidden(s,i.hidden,!1)}}};Object(a.a)([Object(c.b)("StepsManager"),Object(a.b)("design:type",o.a)],l.prototype,"stepsManager",void 0),Object(a.a)([Object(n.c)(),Object(a.b)("design:type",Object)],l.prototype,"params",void 0),l=Object(a.a)([Object(n.a)("au-widget-steps")],l)}}]);