import{k as o,$ as a,aD as i,af as p,az as l,i as d}from"./chunk-index.Cwye847qc1.1727777727200.js";import{E as _}from"./chunk-m_editor.DktKpbliKd.1727777727200.js";const h=_.inherit({_getDefaultOptions(){return o(this.callBase(),{min:0,max:100,value:0})},_initMarkup(){this.$element().addClass("dx-trackbar"),this._renderWrapper(),this._renderContainer(),this._renderRange(),this._renderValue(),this._setRangeStyles(),this.callBase()},_render(){this.callBase(),this._setRangeStyles(this._rangeStylesConfig())},_renderWrapper(){this._$wrapper=a("<div>").addClass("dx-trackbar-wrapper").appendTo(this.$element())},_renderContainer(){this._$bar=a("<div>").addClass("dx-trackbar-container").appendTo(this._$wrapper)},_renderRange(){this._$range=a("<div>").addClass("dx-trackbar-range").appendTo(this._$bar)},_renderValue(){const t=this.option("value"),e=this.option("min"),s=this.option("max");if(e>s)return;if(t<e){this.option("value",e),this._currentRatio=0;return}if(t>s){this.option("value",s),this._currentRatio=1;return}const n=e===s?0:(t-e)/(s-e);!this._needPreventAnimation&&this._setRangeStyles({width:100*n+"%"}),this.setAria({valuemin:this.option("min"),valuemax:s,valuenow:t}),this._currentRatio=n},_rangeStylesConfig(){return{width:100*this._currentRatio+"%"}},_setRangeStyles(t){if(i.stop(this._$range),!t){this._$range.css({width:0});return}this._needPreventAnimation||!p()||i.animate(this._$range,{type:"custom",duration:100,to:t})},_optionChanged(t){switch(t.name){case"value":this._renderValue(),this.callBase(t);break;case"max":case"min":this._renderValue();break;default:this.callBase(t)}},_dispose(){i.stop(this._$range),this.callBase()}});l("dxTrackBar",h);const r="dx-progressbar-animating-segment",u=h.inherit({_getDefaultOptions(){return o(this.callBase(),{value:0,statusFormat:t=>`Progress: ${Math.round(100*t)}%`,showStatus:!0,onComplete:null,activeStateEnabled:!1,statusPosition:"bottom left",_animatingSegmentCount:0})},_defaultOptionsRules(){return this.callBase().concat([{device:t=>t.platform==="android",options:{_animatingSegmentCount:2}}])},_initMarkup(){this._renderStatus(),this._createCompleteAction(),this.callBase(),this.$element().addClass("dx-progressbar"),this._$wrapper.addClass("dx-progressbar-wrapper"),this._$bar.addClass("dx-progressbar-container"),this.setAria("role","progressbar"),a("<div>").addClass("dx-progressbar-range-container").appendTo(this._$wrapper).append(this._$bar),this._$range.addClass("dx-progressbar-range"),this._toggleStatus(this.option("showStatus"))},_useTemplates:()=>!1,_createCompleteAction(){this._completeAction=this._createActionByOption("onComplete")},_renderStatus(){this._$status=a("<div>").addClass("dx-progressbar-status")},_renderIndeterminateState(){this._$segmentContainer=a("<div>").addClass("dx-progressbar-animating-container");const t=this.option("_animatingSegmentCount");for(let e=0;e<t;e++)a("<div>").addClass(r).addClass(`${r}-${e+1}`).appendTo(this._$segmentContainer);this._$segmentContainer.appendTo(this._$wrapper)},_toggleStatus(t){const e=this.option("statusPosition").split(" ");t?e[0]==="top"||e[0]==="left"?this._$status.prependTo(this._$wrapper):this._$status.appendTo(this._$wrapper):this._$status.detach(),this._togglePositionClass()},_togglePositionClass(){const e=this.option("statusPosition").split(" ");this._$wrapper.removeClass("dx-position-top-left dx-position-top-right dx-position-bottom-left dx-position-bottom-right dx-position-left dx-position-right");let s=`dx-position-${e[0]}`;e[1]&&(s+=`-${e[1]}`),this._$wrapper.addClass(s)},_toggleIndeterminateState(t){t?(this._renderIndeterminateState(),this._$bar.toggle(!1)):(this._$bar.toggle(!0),this._$segmentContainer.remove(),delete this._$segmentContainer)},_renderValue(){const t=this.option("value"),e=this.option("max");if(!t&&t!==0){this._toggleIndeterminateState(!0);return}this._$segmentContainer&&this._toggleIndeterminateState(!1),t===e&&this._completeAction(),this.callBase(),this._setStatus()},_setStatus(){let t=this.option("statusFormat");d(t)?t=t.bind(this):t=function(s){return s};const e=t(this._currentRatio,this.option("value"));this._$status.text(e)},_dispose(){this._$status.remove(),this.callBase()},_optionChanged(t){switch(t.name){case"statusFormat":this._setStatus();break;case"showStatus":this._toggleStatus(t.value);break;case"statusPosition":this._toggleStatus(this.option("showStatus"));break;case"onComplete":this._createCompleteAction();break;case"_animatingSegmentCount":break;default:this.callBase(t)}}});l("dxProgressBar",u);export{u as P};
