var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r["throw"](e))}catch(e){a(e)}}function l(e){e.done?n(e.value):i(e.value).then(o,s)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return l([e,t])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(n=0)),n)try{if(r=1,i&&(a=s[0]&2?i["return"]:s[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;if(i=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]0?r:1;r=r/(i.max-i.min);if(!t){r*=-1}if(e==="A"){i.ratioA=d(0,i.ratioA+r,1)}else{i.ratioB=d(0,i.ratioB+r,1)}i.ionKnobMoveStart.emit({value:n(i.value)});i.updateValue();i.emitValueChange();i.ionKnobMoveEnd.emit({value:n(i.value)})};this.onBlur=function(){if(i.hasFocus){i.hasFocus=false;i.ionBlur.emit();i.emitStyle()}};this.onFocus=function(){if(!i.hasFocus){i.hasFocus=true;i.ionFocus.emit();i.emitStyle()}};this.ratioA=0;this.ratioB=0;this.pressedKnob=undefined;this.color=undefined;this.debounce=undefined;this.name=this.rangeId;this.label=undefined;this.dualKnobs=false;this.min=0;this.max=100;this.pin=false;this.pinFormatter=function(e){return Math.round(e)};this.snaps=false;this.step=1;this.ticks=true;this.activeBarStart=undefined;this.disabled=false;this.value=0;this.labelPlacement="start";this.legacy=undefined}e.prototype.debounceChanged=function(){var e=this,t=e.ionInput,n=e.debounce,r=e.originalIonInput;this.ionInput=n===undefined?r!==null&&r!==void 0?r:t:g(t,n)};e.prototype.minChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.maxChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.activeBarStartChanged=function(){var e=this.activeBarStart;if(e!==undefined){if(e>this.max){f("Range: The value of activeBarStart (".concat(e,") is greater than the max (").concat(this.max,"). Valid values are greater than or equal to the min value and less than or equal to the max value."),this.el);this.activeBarStart=this.max}else if(e
Volume
\nExample with aria-label: \n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.',this.el);if(this.legacy){f('ion-range is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\n\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new range syntax.',this.el)}this.hasLoggedDeprecationWarning=true}var t=this,n=t.el,r=t.pressedKnob,o=t.disabled,s=t.pin,l=t.rangeId;var h=v(this);p(true,n,this.name,JSON.stringify(this.getValue()),o);return i(a,{onFocusin:this.onFocus,onFocusout:this.onBlur,id:l,class:k(this.color,(e={},e[h]=true,e["in-item"]=x("ion-item",n),e["range-disabled"]=o,e["range-pressed"]=r!==undefined,e["range-has-pin"]=s,e["legacy-range"]=true,e))},i("slot",{name:"start"}),this.renderRangeSlider(),i("slot",{name:"end"}))};Object.defineProperty(e.prototype,"hasStartSlotContent",{get:function(){return this.el.querySelector('[slot="start"]')!==null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hasEndSlotContent",{get:function(){return this.el.querySelector('[slot="end"]')!==null},enumerable:false,configurable:true});e.prototype.renderRange=function(){var e;var t=this,n=t.disabled,r=t.el,o=t.hasLabel,s=t.rangeId,l=t.pin,h=t.pressedKnob,b=t.labelPlacement,d=t.label;var g=x("ion-item",r);var c=o&&(b==="start"||b==="fixed")||this.hasStartSlotContent;var u=g&&!c;var f=o&&b==="end"||this.hasEndSlotContent;var m=g&&!f;var w=v(this);p(true,r,this.name,JSON.stringify(this.getValue()),n);return i(a,{onFocusin:this.onFocus,onFocusout:this.onBlur,id:s,class:k(this.color,(e={},e[w]=true,e["in-item"]=g,e["range-disabled"]=n,e["range-pressed"]=h!==undefined,e["range-has-pin"]=l,e["range-label-placement-".concat(b)]=true,e["range-item-start-adjustment"]=u,e["range-item-end-adjustment"]=m,e))},i("label",{class:"range-wrapper",id:"range-label"},i("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":!o},part:"label"},d!==undefined?i("div",{class:"label-text"},d):i("slot",{name:"label"})),i("div",{class:"native-wrapper"},i("slot",{name:"start"}),this.renderRangeSlider(),i("slot",{name:"end"}))))};Object.defineProperty(e.prototype,"hasLabel",{get:function(){return this.label!==undefined||this.el.querySelector('[slot="label"]')!==null},enumerable:false,configurable:true});e.prototype.renderRangeSlider=function(){var e;var t=this;var n;var r=this,a=r.min,o=r.max,s=r.step,l=r.el,h=r.handleKeyboard,b=r.pressedKnob,d=r.disabled,g=r.pin,c=r.ratioLower,p=r.ratioUpper,f=r.inheritedAttributes,k=r.rangeId,x=r.pinFormatter;var v=u(l,k).labelText;if(v===undefined||v===null){v=f["aria-label"]}var w="".concat(c*100,"%");var y="".concat(100-p*100,"%");var z=m(this.el);var j=z?"right":"left";var M=z?"left":"right";var S=function(e){var t;return t={},t[j]=e[j],t};if(this.dualKnobs===false){if(this.valA<((n=this.activeBarStart)!==null&&n!==void 0?n:this.min)){w="".concat(p*100,"%");y="".concat(100-c*100,"%")}else{w="".concat(c*100,"%");y="".concat(100-p*100,"%")}}var A=(e={},e[j]=w,e[M]=y,e);var O=[];if(this.snaps&&this.ticks){for(var _=a;_<=o;_+=s){var T=C(_,a,o);var F=Math.min(c,p);var E=Math.max(c,p);var q={ratio:T,active:T>=F&&T<=E};q[j]="".concat(T*100,"%");O.push(q)}}var K;if(!this.legacyFormController.hasLegacyControl()&&this.hasLabel){K="range-label"}return i("div",{class:"range-slider",ref:function(e){return t.rangeSlider=e},onPointerUp:function(e){if(t.pressedKnob===undefined){t.onStart();t.onEnd(e)}}},O.map((function(e){return i("div",{style:S(e),role:"presentation",class:{"range-tick":true,"range-tick-active":e.active},part:e.active?"tick-active":"tick"})})),i("div",{class:"range-bar-container"},i("div",{class:"range-bar",role:"presentation",part:"bar"}),i("div",{class:{"range-bar":true,"range-bar-active":true,"has-ticks":O.length>0},role:"presentation",style:A,part:"bar-active"})),B(z,{knob:"A",pressed:b==="A",value:this.valA,ratio:this.ratioA,pin:g,pinFormatter:x,disabled:d,handleKeyboard:h,min:a,max:o,labelText:v,labelledBy:K}),this.dualKnobs&&B(z,{knob:"B",pressed:b==="B",value:this.valB,ratio:this.ratioB,pin:g,pinFormatter:x,disabled:d,handleKeyboard:h,min:a,max:o,labelText:v,labelledBy:K}))};e.prototype.render=function(){var e=this.legacyFormController;return e.hasLegacyControl()?this.renderLegacyRange():this.renderRange()};Object.defineProperty(e.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{debounce:["debounceChanged"],min:["minChanged"],max:["maxChanged"],activeBarStart:["activeBarStartChanged"],disabled:["disabledChanged"],value:["valueChanged"]}},enumerable:false,configurable:true});return e}());var B=function(e,t){var n=t.knob,r=t.value,a=t.ratio,o=t.min,s=t.max,l=t.disabled,h=t.pressed,b=t.pin,d=t.handleKeyboard,g=t.labelText,c=t.labelledBy,p=t.pinFormatter;var u=e?"right":"left";var f=function(){var e={};e[u]="".concat(a*100,"%");return e};return i("div",{onKeyDown:function(e){var t=e.key;if(t==="ArrowLeft"||t==="ArrowDown"){d(n,false);e.preventDefault();e.stopPropagation()}else if(t==="ArrowRight"||t==="ArrowUp"){d(n,true);e.preventDefault();e.stopPropagation()}},class:{"range-knob-handle":true,"range-knob-a":n==="A","range-knob-b":n==="B","range-knob-pressed":h,"range-knob-min":r===o,"range-knob-max":r===s,"ion-activatable":true,"ion-focusable":true},style:f(),role:"slider",tabindex:l?-1:0,"aria-label":c===undefined?g:null,"aria-labelledby":c!==undefined?c:null,"aria-valuemin":o,"aria-valuemax":s,"aria-disabled":l?"true":null,"aria-valuenow":r},b&&i("div",{class:"range-pin",role:"presentation",part:"pin"},p(r)),i("div",{class:"range-knob",role:"presentation",part:"knob"}))};var O=function(e,t,n,r){var i=(n-t)*e;if(r>0){i=Math.round(i/r)*r+t}var a=d(t,i,n);return y(a,t,n,r)};var C=function(e,t,n){return d(0,(e-t)/(n-t),1)};var _=0;A.style={ios:j,md:S}}}}));