text: var Hashtable=function(){function hashObject(obj){var hashCode;if("string"==typeof obj)return obj;if(typeof obj.hashCode==FUNCTION)return hashCode=obj.hashCode(),"string"==typeof hashCode?hashCode:hashObject(hashCode);if(typeof obj.toString==FUNCTION)return obj.toString();try{return String(obj)}catch(ex){return Object.prototype.toString.call(obj)}}function equals_fixedValueHasEquals(fixedValue,variableValue){return fixedValue.equals(variableValue)}function equals_fixedValueNoEquals(fixedValue,variableValue){return typeof variableValue.equals==FUNCTION?variableValue.equals(fixedValue):fixedValue===variableValue}function createKeyValCheck(kvStr){return function(kv){if(null===kv)throw new Error("null is not a valid "+kvStr);if("undefined"==typeof kv)throw new Error(kvStr+" must not be undefined")}}function Bucket(hash,firstKey,firstValue,equalityFunction){this[0]=hash,this.entries=[],this.addEntry(firstKey,firstValue),null!==equalityFunction&&(this.getEqualityFunction=function(){return equalityFunction})}function createBucketSearcher(mode){return function(key){for(var entry,i=this.entries.length,equals=this.getEqualityFunction(key);i--;)if(entry=this.entries[i],equals(key,entry[0]))switch(mode){case EXISTENCE:return!0;case ENTRY:return entry;case ENTRY_INDEX_AND_VALUE:return[i,entry[1]]}return!1}}function createBucketLister(entryProperty){return function(aggregatedArr){for(var startIndex=aggregatedArr.length,i=0,len=this.entries.length;len>i;++i)aggregatedArr[startIndex+i]=this.entries[i][entryProperty]}}function searchBuckets(buckets,hash){for(var bucket,i=buckets.length;i--;)if(bucket=buckets[i],hash===bucket[0])return i;return null}function getBucketForHash(bucketsByHash,hash){var bucket=bucketsByHash[hash];return bucket&&bucket instanceof Bucket?bucket:null}function Hashtable(hashingFunctionParam,equalityFunctionParam){var that=this,buckets=[],bucketsByHash={},hashingFunction=typeof hashingFunctionParam==FUNCTION?hashingFunctionParam:hashObject,equalityFunction=typeof equalityFunctionParam==FUNCTION?equalityFunctionParam:null;this.put=function(key,value){checkKey(key),checkValue(value);var bucket,bucketEntry,hash=hashingFunction(key),oldValue=null;return bucket=getBucketForHash(bucketsByHash,hash),bucket?(bucketEntry=bucket.getEntryForKey(key),bucketEntry?(oldValue=bucketEntry[1],bucketEntry[1]=value):bucket.addEntry(key,value)):(bucket=new Bucket(hash,key,value,equalityFunction),buckets[buckets.length]=bucket,bucketsByHash[hash]=bucket),oldValue},this.get=function(key){checkKey(key);var hash=hashingFunction(key),bucket=getBucketForHash(bucketsByHash,hash);if(bucket){var bucketEntry=bucket.getEntryForKey(key);if(bucketEntry)return bucketEntry[1]}return null},this.containsKey=function(key){checkKey(key);var bucketKey=hashingFunction(key),bucket=getBucketForHash(bucketsByHash,bucketKey);return bucket?bucket.containsKey(key):!1},this.containsValue=function(value){checkValue(value);for(var i=buckets.length;i--;)if(buckets[i].containsValue(value))return!0;return!1},this.clear=function(){buckets.length=0,bucketsByHash={}},this.isEmpty=function(){return!buckets.length};var createBucketAggregator=function(bucketFuncName){return function(){for(var aggregated=[],i=buckets.length;i--;)buckets[i][bucketFuncName](aggregated);return aggregated}};this.keys=createBucketAggregator("keys"),this.values=createBucketAggregator("values"),this.entries=createBucketAggregator("getEntries"),this.remove=function(key){checkKey(key);var bucketIndex,hash=hashingFunction(key),oldValue=null,bucket=getBucketForHash(bucketsByHash,hash);return bucket&&(oldValue=bucket.removeEntryForKey(key),null!==oldValue&&(bucket.entries.length||(bucketIndex=searchBuckets(buckets,hash),arrayRemoveAt(buckets,bucketIndex),delete bucketsByHash[hash]))),oldValue},this.size=function(){for(var total=0,i=buckets.length;i--;)total+=buckets[i].entries.length;return total},this.each=function(callback){for(var entry,entries=that.entries(),i=entries.length;i--;)entry=entries[i],callback(entry[0],entry[1])},this.putAll=function(hashtable,conflictCallback){for(var entry,key,value,thisValue,entries=hashtable.entries(),i=entries.length,hasConflictCallback=typeof conflictCallback==FUNCTION;i--;)entry=entries[i],key=entry[0],value=entry[1],hasConflictCallback&&(thisValue=that.get(key))&&(value=conflictCallback(key,thisValue,value)),that.put(key,value)},this.clone=function(){var clone=new Hashtable(hashingFunctionParam,equalityFunctionParam);return clone.putAll(that),clone}}var FUNCTION="function",arrayRemoveAt=typeof Array.prototype.splice==FUNCTION?function(arr,idx){arr.splice(idx,1)}:function(arr,idx){var itemsAfterDeleted,i,len;if(idx===arr.length-1)arr.length=idx;else for(itemsAfterDeleted=arr.slice(idx+1),arr.length=idx,i=0,len=itemsAfterDeleted.length;len>i;++i)arr[idx+i]=itemsAfterDeleted[i]},checkKey=createKeyValCheck("key"),checkValue=createKeyValCheck("value"),EXISTENCE=0,ENTRY=1,ENTRY_INDEX_AND_VALUE=2;return Bucket.prototype={getEqualityFunction:function(searchValue){return typeof searchValue.equals==FUNCTION?equals_fixedValueHasEquals:equals_fixedValueNoEquals},getEntryForKey:createBucketSearcher(ENTRY),getEntryAndIndexForKey:createBucketSearcher(ENTRY_INDEX_AND_VALUE),removeEntryForKey:function(key){var result=this.getEntryAndIndexForKey(key);return result?(arrayRemoveAt(this.entries,result[0]),result[1]):null},addEntry:function(key,value){this.entries[this.entries.length]=[key,value]},keys:createBucketLister(0),values:createBucketLister(1),getEntries:function(entries){for(var startIndex=entries.length,i=0,len=this.entries.length;len>i;++i)entries[startIndex+i]=this.entries[i].slice(0)},containsKey:createBucketSearcher(EXISTENCE),containsValue:function(value){for(var i=this.entries.length;i--;)if(value===this.entries[i][1])return!0;return!1}},Hashtable}();!function($){$.baseClass=function(obj){return obj=$(obj),obj.get(0).className.match(/([^ ]+)/)[1]},$.fn.addDependClass=function(className,delimiter){var options={delimiter:delimiter?delimiter:"-"};return this.each(function(){var baseClass=$.baseClass(this);baseClass&&$(this).addClass(baseClass+options.delimiter+className)})},$.fn.removeDependClass=function(className,delimiter){var options={delimiter:delimiter?delimiter:"-"};return this.each(function(){var baseClass=$.baseClass(this);baseClass&&$(this).removeClass(baseClass+options.delimiter+className)})},$.fn.toggleDependClass=function(className,delimiter){var options={delimiter:delimiter?delimiter:"-"};return this.each(function(){var baseClass=$.baseClass(this);baseClass&&($(this).is("."+baseClass+options.delimiter+className)?$(this).removeClass(baseClass+options.delimiter+className):$(this).addClass(baseClass+options.delimiter+className))})}}(jQuery),function(jQuery){function FormatData(dec,group,neg){this.dec=dec,this.group=group,this.neg=neg}function init(){for(var localeGroupIdx=0;localeGroupIdx<nfAllLocales.length;localeGroupIdx++){localeGroup=nfAllLocales[localeGroupIdx];for(var i=0;i<localeGroup.length;i++)nfLocales.put(localeGroup[i],localeGroupIdx)}}function formatCodes(locale,isFullLocale){0==nfLocales.size()&&init();var dec=".",group=",",neg="-";0==isFullLocale&&(-1!=locale.indexOf("_")?locale=locale.split("_")[1].toLowerCase():-1!=locale.indexOf("-")&&(locale=locale.split("-")[1].toLowerCase()));var codesIndex=nfLocales.get(locale);if(codesIndex){var codes=nfLocaleFormatting[codesIndex];codes&&(dec=codes[0],group=codes[1])}return new FormatData(dec,group,neg)}var nfLocales=new Hashtable,nfLocalesLikeUS=["ae","au","ca","cn","eg","gb","hk","il","in","jp","sk","th","tw","us"],nfLocalesLikeDE=["at","br","de","dk","es","gr","it","nl","pt","tr","vn"],nfLocalesLikeFR=["cz","fi","fr","ru","se","pl"],nfLocalesLikeCH=["ch"],nfLocaleFormatting=[[".",","],[",","."],[","," "],[".","'"]],nfAllLocales=[nfLocalesLikeUS,nfLocalesLikeDE,nfLocalesLikeFR,nfLocalesLikeCH];jQuery.fn.formatNumber=function(options,writeBack,giveReturnValue){return this.each(function(){null==writeBack&&(writeBack=!0),null==giveReturnValue&&(giveReturnValue=!0);var text;text=String(jQuery(this).is(":input")?jQuery(this).val():jQuery(this).text());var returnString=jQuery.formatNumber(text,options);return writeBack&&(jQuery(this).is(":input")?jQuery(this).val(returnString):jQuery(this).text(returnString)),giveReturnValue?returnString:void 0})},jQuery.formatNumber=function(numberString,options){options=jQuery.extend({},jQuery.fn.formatNumber.defaults,options);for(var formatData=formatCodes(options.locale.toLowerCase(),options.isFullLocale),validFormat=(formatData.dec,formatData.group,formatData.neg,"0#-,."),prefix="",negativeInFront=!1,i=0;i<options.format.length;i++){if(-1!=validFormat.indexOf(options.format.charAt(i))){if(0==i&&"-"==options.format.charAt(i)){negativeInFront=!0;continue}break}prefix+=options.format.charAt(i)}for(var suffix="",i=options.format.length-1;i>=0&&-1==validFormat.indexOf(options.format.charAt(i));i--)suffix=options.format.charAt(i)+suffix;options.format=options.format.substring(prefix.length),options.format=options.format.substring(0,options.format.length-suffix.length);var number=Number(numberString);return jQuery._formatNumber(number,options,suffix,prefix,negativeInFront)},jQuery._formatNumber=function(number,options,suffix,prefix,negativeInFront){var options=jQuery.extend({},jQuery.fn.formatNumber.defaults,options),formatData=formatCodes(options.locale.toLowerCase(),options.isFullLocale),dec=formatData.dec,group=formatData.group,neg=formatData.neg,forcedToZero=!1;if(isNaN(number)){if(1!=options.nanForceZero)return null;number=0,forcedToZero=!0}"%"==suffix&&(number=100*number);var returnString="";if(options.format.indexOf(".")>-1){var decimalPortion=dec,decimalFormat=options.format.substring(options.format.lastIndexOf(".")+1);if(1==options.round)number=Number(number.toFixed(decimalFormat.length));else{var numStr=number.toString();numStr=numStr.substring(0,numStr.lastIndexOf(".")+decimalFormat.length+1),number=Number(numStr)}var decimalValue=number%1,decimalString=String(decimalValue.toFixed(decimalFormat.length));decimalString=decimalString.substring(decimalString.lastIndexOf(".")+1);for(var i=0;i<decimalFormat.length;i++)if("#"!=decimalFormat.charAt(i)||"0"==decimalString.charAt(i)){if("#"==decimalFormat.charAt(i)&&"0"==decimalString.charAt(i)){var notParsed=decimalString.substring(i);if(notParsed.match("[1-9]")){decimalPortion+=decimalString.charAt(i);continue}break}"0"==decimalFormat.charAt(i)&&(decimalPortion+=decimalString.charAt(i))}else decimalPortion+=decimalString.charAt(i);returnString+=decimalPortion}else number=Math.round(number);var ones=Math.floor(number);0>number&&(ones=Math.ceil(number));var onesFormat="";onesFormat=-1==options.format.indexOf(".")?options.format:options.format.substring(0,options.format.indexOf("."));var onePortion="";if(0!=ones||"#"!=onesFormat.substr(onesFormat.length-1)||forcedToZero){var oneText=String(Math.abs(ones)),groupLength=9999;-1!=onesFormat.lastIndexOf(",")&&(groupLength=onesFormat.length-onesFormat.lastIndexOf(",")-1);for(var groupCount=0,i=oneText.length-1;i>-1;i--)onePortion=oneText.charAt(i)+onePortion,groupCount++,groupCount==groupLength&&0!=i&&(onePortion=group+onePortion,groupCount=0);if(onesFormat.length>onePortion.length){var padStart=onesFormat.indexOf("0");if(-1!=padStart)for(var padLen=onesFormat.length-padStart,pos=onesFormat.length-onePortion.length-1;onePortion.length<padLen;){var padChar=onesFormat.charAt(pos);","==padChar&&(padChar=group),onePortion=padChar+onePortion,pos--}}}return onePortion||-1===onesFormat.indexOf("0",onesFormat.length-1)||(onePortion="0"),returnString=onePortion+returnString,0>number&&negativeInFront&&prefix.length>0?prefix=neg+prefix:0>number&&(returnString=neg+returnString),options.decimalSeparatorAlwaysShown||returnString.lastIndexOf(dec)==returnString.length-1&&(returnString=returnString.substring(0,returnString.length-1)),returnString=prefix+returnString+suffix},jQuery.fn.parseNumber=function(options,writeBack,giveReturnValue){null==writeBack&&(writeBack=!0),null==giveReturnValue&&(giveReturnValue=!0);var text;text=String(jQuery(this).is(":input")?jQuery(this).val():jQuery(this).text());var number=jQuery.parseNumber(text,options);return number&&(writeBack&&(jQuery(this).is(":input")?jQuery(this).val(number.toString()):jQuery(this).text(number.toString())),giveReturnValue)?number:void 0},jQuery.parseNumber=function(numberString,options){for(var options=jQuery.extend({},jQuery.fn.parseNumber.defaults,options),formatData=formatCodes(options.locale.toLowerCase(),options.isFullLocale),dec=formatData.dec,group=formatData.group,neg=formatData.neg,valid="1234567890.-";numberString.indexOf(group)>-1;)numberString=numberString.replace(group,"");numberString=numberString.replace(dec,".").replace(neg,"-");var validText="",hasPercent=!1;("%"==numberString.charAt(numberString.length-1)||1==options.isPercentage)&&(hasPercent=!0);for(var i=0;i<numberString.length;i++)valid.indexOf(numberString.charAt(i))>-1&&(validText+=numberString.charAt(i));var number=Number(validText);if(hasPercent){number/=100;var decimalPos=validText.indexOf(".");if(-1!=decimalPos){var decimalPoints=validText.length-decimalPos-1;number=number.toFixed(decimalPoints+2)}else number=number.toFixed(validText.length-1)}return number},jQuery.fn.parseNumber.defaults={locale:"us",decimalSeparatorAlwaysShown:!1,isPercentage:!1,isFullLocale:!1},jQuery.fn.formatNumber.defaults={format:"#,###.00",locale:"us",decimalSeparatorAlwaysShown:!1,nanForceZero:!0,round:!0,isFullLocale:!1},Number.prototype.toFixed=function(precision){return jQuery._roundNumber(this,precision)},jQuery._roundNumber=function(number,decimalPlaces){var power=Math.pow(10,decimalPlaces||0),value=String(Math.round(number*power)/power);if(decimalPlaces>0){var dp=value.indexOf(".");for(-1==dp?(value+=".",dp=0):dp=value.length-(dp+1);decimalPlaces>dp;)value+="0",dp++}return value}}(jQuery);var Slider;!function(Slider){var Template=function(){function Template(template){this.cache=this.createTemplateFn(template)}return Template.prototype.render=function(data){return this.cache(data)},Template.prototype.createTemplateFn=function(template){return new Function("data","var p=[],print=function(){p.push.apply(p,arguments);};with(data){p.push('"+template.replace(/[\r\t\n]/g," ").split("<#").join("	").replace(/((^|#>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)#>/g,"',$1,'").split("	").join("');").split("#>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');")},Template}();Slider.Template=Template}(Slider||(Slider={}));var Slider;!function(Slider){var UXComponent=function(){function UXComponent(){this.initialized=!1}return UXComponent.prototype.create=function(templateParams){if("undefined"==typeof templateParams&&(templateParams={}),!this.template)throw"No template is defined";return this.isInitialized()?this:(this.$el=jQuery(this.template.render(templateParams)),this.initialized=!0,this)},UXComponent.prototype.css=function(cssProps){var _this=this;return this.getAnimationFrame(function(){_this.$el.css(cssProps)}),this.$el},UXComponent.prototype.outerWidth=function(){return this.$el.outerWidth()},UXComponent.prototype.offset=function(){return this.$el.offset()},UXComponent.prototype.destroy=function(){this.$el.detach(),this.$el.off(),this.$el.remove()},UXComponent.prototype.isInitialized=function(){return this.initialized},UXComponent.prototype.getAnimationFrame=function(callback){var animationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)}}();animationFrame(callback)},UXComponent}();Slider.UXComponent=UXComponent}(Slider||(Slider={}));var __extends=this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);__.prototype=b.prototype,d.prototype=new __},Slider;!function(Slider){var LimitLabel=function(_super){function LimitLabel(template,params){_super.call(this),this.template=new Slider.Template('<div class="<#=className#>-value"><span></span><#=dimension#></div>'),this.template=new Slider.Template(template),this.create(params)}return __extends(LimitLabel,_super),LimitLabel.prototype.fadeIn=function(duration){return this.$el.fadeIn(duration)},LimitLabel.prototype.fadeOut=function(duration){return this.$el.fadeOut(duration)},LimitLabel}(Slider.UXComponent);Slider.LimitLabel=LimitLabel}(Slider||(Slider={}));var __extends=this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);__.prototype=b.prototype,d.prototype=new __},Slider;!function(Slider){var ValueLabel=function(_super){function ValueLabel(template,params){_super.call(this),this.template=new Slider.Template(template),this.create(params),this.$value=this.$el.find("span")}return __extends(ValueLabel,_super),ValueLabel.prototype.setValue=function(str){this.$value.html(str)},ValueLabel}(Slider.UXComponent);Slider.ValueLabel=ValueLabel}(Slider||(Slider={}));var __extends=this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);__.prototype=b.prototype,d.prototype=new __},Slider;!function(Slider){var Draggable=function(_super){function Draggable(){_super.call(this),this.defaultIs={drag:!1,clicked:!1,toclick:!1,mouseup:!1}}return __extends(Draggable,_super),Draggable.prototype.initialize=function(){this.is=jQuery.extend(this.is,this.defaultIs),this.events={down:"touch",move:"drag",up:"release",click:"tap"}},Draggable.prototype.create=function(templateParams){"undefined"==typeof templateParams&&(templateParams={}),_super.prototype.create.call(this,templateParams),this.outer=jQuery(".draggable-outer");var offset=this.getPointerOffset();return this.d={left:offset.left,top:offset.top,width:this.$el.width(),height:this.$el.height()},this.setupEvents(),this},Draggable.prototype.getGesture=function(event){return event.gesture?event.gesture:event.originalEvent.gesture},Draggable.prototype.setupEvents=function(){var _this=this;this.bind(jQuery(document),Draggable.EVENT_MOVE,function(event){if(_this.is.drag){var gesture=_this.getGesture(event);gesture.preventDefault(),gesture.stopPropagation(),_this.mouseMove(event)}}),this.bind(jQuery(document),Draggable.EVENT_DOWN,function(event){if(_this.is.drag){var gesture=_this.getGesture(event);gesture.preventDefault(),gesture.stopPropagation()}}),this.bind(this.$el,Draggable.EVENT_MOVE,function(event){if(_this.is.drag){var gesture=_this.getGesture(event);gesture.preventDefault(),gesture.stopPropagation(),_this.mouseMove(event)}}),this.bind(this.$el,Draggable.EVENT_DOWN,function(event){_this.mouseDown(event)}),this.bind(jQuery(document),Draggable.EVENT_UP,function(event){_this.mouseUp(event)}),this.bind(this.$el,Draggable.EVENT_CLICK,function(){_this.is.clicked=!0,_this.is.toclick||(_this.is.toclick=!0)})},Draggable.prototype.getPageCoords=function(event){var touch=this.getGesture(event).touches[0];return{x:touch.pageX,y:touch.pageY}},Draggable.prototype.getPointerOffset=function(){return this.$el.offset()},Draggable.prototype.unbind=function(){for(var eventType in this.events){var namespacedEvent=this.events[eventType];this.$el.off(namespacedEvent)}},Draggable.prototype.destroy=function(){this.unbind(),_super.prototype.destroy.call(this)},Draggable.prototype.bind=function(element,eventType,callback){var namespacedEvent=this.events[eventType];element.on(namespacedEvent,callback)},Draggable.prototype.mouseDown=function(event){this.is.drag=!0,this.is.mouseup=this.is.clicked=!1;var offset=this.getPointerOffset(),coords=this.getPageCoords(event);this.cursorX=coords.x-offset.left,this.cursorY=coords.y-offset.top,this.d=jQuery.extend(this.d,{left:offset.left,top:offset.top,width:this.$el.width(),height:this.$el.height()}),this.outer.length>0&&this.outer.css({height:Math.max(this.outer.height(),jQuery(document.body).height()),overflow:"hidden"}),this.onMouseDown(event)},Draggable.prototype.mouseMove=function(event){this.is.toclick=!1;var coords=this.getPageCoords(event);this.onMouseMove(event,coords.x-this.cursorX,coords.y-this.cursorY)},Draggable.prototype.mouseUp=function(event){this.is.drag&&(this.is.drag=!1,this.outer.css(this.outer.length>0&&navigator.userAgent.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/i.test(navigator.userAgent)?{overflow:"hidden"}:{overflow:"visible"}),this.onMouseUp(event))},Draggable.prototype.onInit=function(){},Draggable.prototype.onMouseDown=function(){this.css({position:"absolute"})},Draggable.prototype.onMouseMove=function(event,x,y){"undefined"==typeof x&&(x=null),"undefined"==typeof y&&(y=null)},Draggable.prototype.onMouseUp=function(){},Draggable.EVENT_NAMESPACE=".sliderDraggable",Draggable.EVENT_CLICK="click",Draggable.EVENT_UP="up",Draggable.EVENT_MOVE="move",Draggable.EVENT_DOWN="down",Draggable}(Slider.UXComponent);Slider.Draggable=Draggable}(Slider||(Slider={}));var __extends=this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);__.prototype=b.prototype,d.prototype=new __},Slider;!function(Slider){var Pointer=function(_super){function Pointer(config){_super.call(this),this.initialize(config),this.create({className:Slider.Impl.CLASSNAME}),this.$scope.$el.append(this.$el),this.createValueLabel(),this.$el.insertAfter(Slider.Impl.SELECTOR+"-bg"),this.set(Slider.MathHelper.valueToPrc(config.value,this),!0)}return __extends(Pointer,_super),Pointer.prototype.initialize=function(config){_super.prototype.initialize.call(this,config),this.template=new Slider.Template('<div class="<#=className#>-pointer"></div>'),this.components={label:null},this.uid=config.id,this.$scope=config.$scope,this.settings=this.$scope.settings,this.value={prc:null,origin:null}},Pointer.prototype.createValueLabel=function(){var template,labelParams;this.uid===Slider.Impl.POINTER_TO?(template='<div class="<#=className#>-label <#=className#>-label-to"><span><#=to#></span><#=dimension#></div>',labelParams={className:Slider.Impl.CLASSNAME,to:this.settings.to,dimension:this.settings.dimension},this.$el.addClass("pointer-to")):(labelParams={className:Slider.Impl.CLASSNAME,from:this.settings.from,dimension:this.settings.dimension},template='<div class="<#=className#>-label <#=className#>-label-from"><span><#=from#></span><#=dimension#></div>');var label=new Slider.ValueLabel(template,labelParams);this.$scope.$el.append(label.$el),this.components.label=label},Pointer.prototype.onMouseDown=function(event){_super.prototype.onMouseDown.call(this,event),this.parentSizes={offset:this.$scope.$el.offset(),width:this.$scope.$el.width()},this.$el.addDependClass("hover"),this.setIndexOver()},Pointer.prototype.onMouseMove=function(event){_super.prototype.onMouseMove.call(this,event);var prc=this.getPrcValueForX(this.getPageCoords(event).x);this.set(prc,!0),this.$scope.setValueElementPosition(),this.redrawLabels()},Pointer.prototype.isDistanceViolation=function(){var distance=this.settings.distance,other=this.getAdjacentPointer();return other instanceof Slider.Pointer&&!this.settings.single?distance&&this.isMinDistanceViolation(other.get().origin,distance.min)?!0:distance&&this.isMaxDistanceViolation(other.get().origin,distance.max):!1},Pointer.prototype.isMaxDistanceViolation=function(otherOrigin,max){return isNaN(max)?!1:this.uid===Slider.Impl.POINTER_FROM&&otherOrigin+max>this.value.origin?!0:this.uid===Slider.Impl.POINTER_TO&&otherOrigin-max<this.value.origin},Pointer.prototype.isMinDistanceViolation=function(otherOrigin,min){return isNaN(min)?!1:this.uid===Slider.Impl.POINTER_FROM&&this.value.origin+min>=otherOrigin?!0:this.uid===Slider.Impl.POINTER_TO&&this.value.origin-min<=otherOrigin},Pointer.prototype.onMouseUp=function(event){_super.prototype.onMouseUp.call(this,event),!this.settings.single&&this.isDistanceViolation()&&this.$scope.setValueElementPosition(),jQuery.isFunction(this.settings.onStateChange)&&this.$scope.onStateChange(this.$scope.getValue()),this.$el.removeDependClass("hover"),this.$scope.setValue()},Pointer.prototype.setIndexOver=function(){this.$scope.setPointerIndex(1),this.index(2)},Pointer.prototype.index=function(i){this.css({zIndex:i})},Pointer.prototype.getPrcValueForX=function(x){return Slider.MathHelper.calcLimits(100*(x-this.parentSizes.offset.left)/this.parentSizes.width,this)},Pointer.prototype.set=function(value,isPrc){"undefined"==typeof isPrc&&(isPrc=!1);var roundedValue;roundedValue=isPrc?Slider.MathHelper.prcToValue(value,this):Slider.MathHelper.round(value,this.settings.step,this.settings.round),this.value.origin=Slider.MathHelper.clamp(roundedValue,this.settings.from,this.settings.to),this.value.prc=Slider.MathHelper.valueToPrc(this.value.origin,this),this.isDistanceViolation()&&(this.value.prc=this.enforceMinMaxDistance()),this.css({left:this.value.prc+"%"}),this.$scope.update()},Pointer.prototype.get=function(){return this.value},Pointer.prototype.enforceMinMaxDistance=function(){var another=this.getAdjacentPointer(),distance=this.settings.distance,originValue=this.get().origin,anotherOriginValue=another.get().origin;switch(this.uid){case Slider.Impl.POINTER_FROM:Boolean(distance.max)&&originValue<=anotherOriginValue-distance.max?this.value.origin=Slider.MathHelper.clamp(anotherOriginValue-distance.max,this.settings.from,this.settings.to):Boolean(distance.min)&&originValue+distance.min>=anotherOriginValue&&(this.value.origin=Slider.MathHelper.clamp(anotherOriginValue-distance.min,this.settings.from,this.settings.to));break;case Slider.Impl.POINTER_TO:Boolean(distance.max)&&originValue>=anotherOriginValue+distance.max?this.value.origin=Slider.MathHelper.clamp(anotherOriginValue+distance.max,this.settings.from,this.settings.to):Boolean(distance.min)&&originValue-distance.min<=anotherOriginValue&&(this.value.origin=Slider.MathHelper.clamp(anotherOriginValue+distance.min,this.settings.from,this.settings.to))}return Slider.MathHelper.valueToPrc(this.value.origin,this)},Pointer.prototype.getAdjacentPointer=function(){return this.$scope.getPointers()[1-this.uid]},Pointer.prototype.getLabel=function(){return this.components.label},Pointer.prototype.hasSameOrigin=function(pointer){return this.value.prc==pointer.get().prc},Pointer.prototype.redrawLabels=function(){var label=this.getLabel();label.setValue(this.$scope.calculate(this.get().origin));var prc=this.get().prc,parentSizes=this.$scope.sizes,sizes={label:label.outerWidth(),right:!1,border:prc*parentSizes.domWidth/100},otherPointer=this.getAdjacentPointer();if(otherPointer){var otherLabel=otherPointer.getLabel();switch(this.uid){case Slider.Impl.POINTER_FROM:sizes.border+sizes.label/2>otherLabel.offset().left-parentSizes.domOffset.left?(otherLabel.css({visibility:"hidden"}),otherLabel.setValue(this.$scope.calculate(otherPointer.get().origin)),label.css({visibility:"visible"}),prc=(otherPointer.get().prc-prc)/2+prc,otherPointer.get().prc!=this.get().prc&&(label.setValue(this.$scope.calculate(this.get().origin)+"&nbsp;&ndash;&nbsp;"+this.$scope.calculate(otherPointer.get().origin)),sizes.label=label.outerWidth(),sizes.border=prc*parentSizes.domWidth/100)):otherLabel.css({visibility:"visible"});break;case Slider.Impl.POINTER_TO:sizes.border-sizes.label/2<otherLabel.offset().left-parentSizes.domOffset.left+otherLabel.outerWidth()?(otherLabel.css({visibility:"hidden"}),otherLabel.setValue(this.$scope.calculate(otherPointer.get().origin)),label.css({visibility:"visible"}),prc=(prc-otherPointer.get().prc)/2+otherPointer.get().prc,otherPointer.get().prc!=this.get().prc&&(label.setValue(this.$scope.calculate(otherPointer.get().origin)+"&nbsp;&ndash;&nbsp;"+this.$scope.calculate(this.get().origin)),sizes.label=label.outerWidth(),sizes.border=prc*parentSizes.domWidth/100)):otherLabel.css({visibility:"visible"})}}this.setPosition(label,sizes,prc),otherLabel&&(sizes={label:otherLabel.outerWidth(),right:!1,border:otherPointer.value.prc*parentSizes.domWidth/100},this.setPosition(otherLabel,sizes,otherPointer.value.prc))},Pointer.prototype.setPosition=function(label,sizes,prc){sizes.margin=-sizes.label/2;var labelLeft=sizes.border+sizes.margin;0>labelLeft&&(sizes.margin-=labelLeft),sizes.border+sizes.label/2>this.$scope.sizes.domWidth?(sizes.margin=0,sizes.right=!0):sizes.right=!1;var cssProps={left:prc+"%",marginLeft:sizes.margin,right:"auto"};return label.css(cssProps),sizes.right&&label.css({left:"auto",right:0}),sizes},Pointer}(Slider.Draggable);Slider.Pointer=Pointer}(Slider||(Slider={}));var __extends=this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);__.prototype=b.prototype,d.prototype=new __},Slider;!function(Slider){var Impl=function(_super){function Impl(inputNode,settings){if("undefined"==typeof settings&&(settings={}),_super.call(this),this.defaultSettings={from:1,to:10,step:1,smooth:!0,limits:!0,round:0,format:{format:"#,##0.##"},value:"5;7",dimension:null,heterogeneity:null,distance:{min:null,max:null}},this.settings=jQuery.extend(this.defaultSettings,settings),this.$input=jQuery(inputNode).hide(),"INPUT"!==this.$input.prop("tagName"))throw"jquery.slider: Slider must only be applied to INPUT elements.";if(this.settings.interval=this.settings.to-this.settings.from,this.settings.value=this.$input.val(),null===this.settings.value||void 0===this.settings.value)throw"jquery.slider: INPUT element does not have a value.";this.settings.calculate&&jQuery.isFunction(this.settings.calculate)&&(this.calculate=this.settings.calculate),this.components={limits:[],pointers:[],labels:[]},this.create({className:Slider.Impl.CLASSNAME,settings:{from:this.calculate(this.settings.from),to:this.calculate(this.settings.to),dimension:this.settings.dimension},scale:this.generateScale()})}return __extends(Impl,_super),Impl.prototype.create=function(params){var _this=this;this.template=new Slider.Template('<span class="<#=className#>"><div class="<#=className#>-bg"><i class="l"></i><i class="f"></i><i class="r"></i><i class="v"></i></div>'+(this.settings.scale?'<div class="<#=className#>-scale"><#=scale#></div>':"")+"</span>"),_super.prototype.create.call(this,params),this.$input.after(this.$el),this.drawScale();var values=this.settings.value.split(";").map(function(value){return""==value?_this.settings.from.toString():value});if(1==values.length)this.settings.single=!0,this.$el.addDependClass("single");else if(values.length>2)throw"jquery.slider: Only two handles are supported";return this.settings.limits||this.$el.addDependClass("limitless"),this.settings.skin&&this.setSkin(this.settings.skin.toString()),this.sizes={domWidth:this.$el.width(),domOffset:this.$el.offset()},this.components={pointers:[],limits:[],labels:[]},this.createLimitLabels(),this.$value=this.$el.find(".v"),values.forEach(function(value,uid){var typedValue=parseInt(value,10),prev=parseInt(values[uid-1],10);if(isNaN(typedValue))throw'jquery.slider: Invalid value: "'+value.toString()+'". Values must be integers.';!isNaN(prev)&&prev>typedValue&&(typedValue=prev),typedValue=Slider.MathHelper.clamp(typedValue,_this.settings.from,_this.settings.to),_this.components.pointers[uid]=new Slider.Pointer({id:uid,value:typedValue,$scope:_this}),_this.components.pointers[uid].redrawLabels()}),jQuery.each(this.getPointers(),function(i,pointer){_this.settings.single||_this.ensurePointerIndex(pointer)}),this.setValue(),this.setValueElementPosition(),this.redrawLimits(),jQuery(window).resize(function(){_this.redraw()}),this.hammerManager=new Hammer(this.$el.get(0),{domEvents:!0,dragLockToAxis:!0,preventDefault:!0,dragBlockHorizontal:!0}),this},Impl.prototype.createLimitLabels=function(){if(this.settings.limits){var template,params,limitLabel;template='<div class="<#=className#>-label"><span><#=from#></span><#=dimension#></div>',params={className:Slider.Impl.CLASSNAME,from:this.settings.from,dimension:this.settings.dimension},limitLabel=new Slider.LimitLabel(template,params),this.$el.append(limitLabel.$el),this.components.limits.push(limitLabel),template='<div class="<#=className#>-label <#=className#>-label-to"><span><#=to#></span><#=dimension#></div>',
  params={className:Slider.Impl.CLASSNAME,to:this.settings.to,dimension:this.settings.dimension},limitLabel=new Slider.LimitLabel(template,params),this.$el.append(limitLabel.$el),this.components.limits.push(limitLabel)}},Impl.prototype.ensurePointerIndex=function(pointer){var otherPointer=pointer.getAdjacentPointer();pointer.hasSameOrigin(otherPointer)&&(pointer.uid==Slider.Impl.POINTER_FROM&&pointer.get().origin==this.settings.from?otherPointer.setIndexOver():pointer.uid==Slider.Impl.POINTER_TO&&pointer.get().origin==this.settings.to&&otherPointer.setIndexOver())},Impl.prototype.onStateChange=function(value){return this.settings.onStateChange&&jQuery.isFunction(this.settings.onStateChange)?this.settings.onStateChange.call(this,value):!0},Impl.prototype.disableSlider=function(){this.$el.addClass("disabled")},Impl.prototype.enableSlider=function(){this.$el.removeClass("disabled")},Impl.prototype.update=function(){this.redraw(),this.drawScale()},Impl.prototype.setSkin=function(skinName){this.settings.skin&&this.$el.removeDependClass(this.settings.skin,"_"),this.$el.addDependClass(this.settings.skin=skinName,"_")},Impl.prototype.setPointerIndex=function(index){jQuery.each(this.getPointers(),function(i,pointer){pointer.index(index)})},Impl.prototype.getPointers=function(){return this.components.pointers},Impl.prototype.getLimits=function(){return this.components.limits},Impl.prototype.generateScale=function(){if(!this.settings.scale)return"";for(var str="",scale=this.settings.scale,prc=Math.min(Math.max(0,Math.round(100/(scale.length-1)*1e4)/1e4),100),i=0;i<scale.length;i++)str+='<span style="left: '+i*prc+'%">'+("|"!=scale[i]?"<ins>"+scale[i]+"</ins>":"")+"</span>";return str},Impl.prototype.drawScale=function(){this.$el.find(Slider.Impl.SELECTOR+"scale span ins").each(function(){jQuery(this).css({marginLeft:-jQuery(this).outerWidth()/2})})},Impl.prototype.redraw=function(){var _this=this;this.sizes={domWidth:this.$el.width(),domOffset:this.$el.offset()},jQuery.each(this.components.pointers,function(i,pointer){_this.setValueElementPosition(),pointer.redrawLabels()}),this.redrawLimits(),this.setValue()},Impl.prototype.setValueElementPosition=function(){var fromPercent,toPercent;2==this.components.pointers.length?(fromPercent=this.components.pointers[Slider.Impl.POINTER_FROM].get().prc,toPercent=this.components.pointers[Slider.Impl.POINTER_TO].get().prc):1==this.components.pointers.length&&(fromPercent=0,toPercent=this.components.pointers[Slider.Impl.POINTER_FROM].get().prc),this.$value.css({left:fromPercent+"%",width:toPercent-fromPercent+"%"})},Impl.prototype.redrawLimits=function(){if(this.settings.limits)for(var i=0;i<this.components.pointers.length;i++){var pointer=this.components.pointers[i],label=pointer.getLabel(),labelLeft=label.offset().left-this.sizes.domOffset.left;if(i==Slider.Impl.POINTER_FROM){var limitFrom=this.components.limits[Slider.Impl.POINTER_FROM];if(labelLeft<limitFrom.outerWidth()?limitFrom.fadeOut("fast"):limitFrom.fadeIn("fast"),this.settings.single){var limitTo=this.components.limits[Slider.Impl.POINTER_TO];labelLeft+label.outerWidth()>this.sizes.domWidth-limitTo.outerWidth()?limitTo.fadeOut("fast"):limitTo.fadeIn("fast")}}else if(i==Slider.Impl.POINTER_TO){var limitTo=this.components.limits[Slider.Impl.POINTER_TO];labelLeft+label.outerWidth()>this.sizes.domWidth-limitTo.outerWidth()?limitTo.fadeOut("fast"):limitTo.fadeIn("fast")}}},Impl.prototype.setValue=function(){var value=this.getValue();this.$input.val(value)},Impl.prototype.getValue=function(){var value="";return jQuery.each(this.getPointers(),function(i,pointer){var prc=pointer.get().prc;prc&&!isNaN(prc)&&(value+=(i>0?";":"")+Slider.MathHelper.prcToValue(prc,pointer).toString())}),value},Impl.prototype.getPrcValue=function(){var value="";return jQuery.each(this.getPointers(),function(i,pointer){var prc=pointer.get().prc;prc&&!isNaN(prc)&&(value+=(i>0?";":"")+prc.toString())}),value},Impl.prototype.calculate=function(value){return value=value.toString().replace(/,/gi,".").replace(/ /gi,""),jQuery.formatNumber?jQuery.formatNumber(Number(value),this.settings.format||{}).replace(/-/gi,"&minus;"):value},Impl.prototype.destroy=function(){jQuery.each(this.components.pointers,function(i,sliderPointer){sliderPointer.destroy()}),jQuery.each(this.components.labels,function(i,sliderValueLabel){sliderValueLabel.destroy()}),jQuery.each(this.components.limits,function(i,sliderLimitLabel){sliderLimitLabel.destroy()}),this.$value.remove(),this.$el.remove()},Impl.POINTER_FROM=0,Impl.POINTER_TO=1,Impl.CLASSNAME="jslider",Impl.SELECTOR=".jslider-",Impl}(Slider.UXComponent);Slider.Impl=Impl}(Slider||(Slider={})),jQuery.slider=function(node,settings,force){"undefined"==typeof force&&(force=!1);var jNode=jQuery(node);return(!jNode.data("jslider")||force)&&jNode.data("jslider",new Slider.Impl(node,settings)),jNode.data("jslider")},jQuery.fn.slider=function(action,optValue){function isDef(val){return void 0!==val}function isDefAndNotNull(val){return isDef(val)&&null!=val}var returnValue,args=arguments;return this.each(function(){var self=jQuery.slider(this,action);if("string"==typeof action)switch(action){case"value":if(isDef(args[1])&&isDef(args[2])){var pointers=self.getPointers();isDefAndNotNull(pointers[0])&&isDefAndNotNull(args[1])&&(pointers[0].set(args[1]),pointers[0].setIndexOver()),isDefAndNotNull(pointers[1])&&isDefAndNotNull(args[2])&&(pointers[1].set(args[2]),pointers[1].setIndexOver())}else if(isDef(args[1])){var pointers=self.getPointers();isDefAndNotNull(pointers[0])&&isDefAndNotNull(args[1])&&(pointers[0].set(args[1]),pointers[0].setIndexOver())}else returnValue=self.getValue();break;case"prc":if(isDef(args[1])&&isDef(args[2])){var pointers=self.getPointers();isDefAndNotNull(pointers[0])&&isDefAndNotNull(args[1])&&(pointers[0].set(args[1]),pointers[0].setIndexOver()),isDefAndNotNull(pointers[1])&&isDefAndNotNull(args[2])&&(pointers[1].set(args[2]),pointers[1].setIndexOver())}else if(isDef(args[1])){var pointers=self.getPointers();isDefAndNotNull(pointers[0])&&isDefAndNotNull(args[1])&&(pointers[0].set(args[1]),pointers[0].setIndexOver())}else returnValue=self.getPrcValue();break;case"calculatedValue":var value=self.getValue().split(";");returnValue="";for(var i=0;i<value.length;i++)returnValue+=(i>0?";":"")+self.calculate(value[i]);break;case"disable":self.disableSlider();break;case"enable":self.enableSlider();break;case"skin":self.setSkin(args[1])}else action||optValue||(jQuery.isArray(returnValue)||(returnValue=[]),returnValue.push(self))}),jQuery.isArray(returnValue)&&1==returnValue.length&&(returnValue=returnValue[0]),returnValue||this};var Slider;!function(Slider){var MathHelper=function(){function MathHelper(){}return MathHelper.clamp=function(delta,min,max){return Math.min(Math.max(delta,min),max)},MathHelper.round=function(value,step,round){return"undefined"==typeof round&&(round=0),value=Math.round(value/step)*step,value=round?Math.round(value*Math.pow(10,round))/Math.pow(10,round):Math.round(value)},MathHelper.prcToValue=function(prc,pointer){var settings=pointer.settings;if(settings.heterogeneity&&settings.heterogeneity.length>0)for(var value,heterogeneity=settings.heterogeneity,start=0,from=settings.from,i=0;i<=heterogeneity.length;i++){var v;v=heterogeneity[i]?heterogeneity[i].split("/"):[100,settings.to],v[0]=Number(v[0]),v[1]=Number(v[1]),prc>=start&&prc<=v[0]&&(value=from+(prc-start)*(v[1]-from)/(v[0]-start)),start=v[0],from=v[1]}else value=settings.from+prc*settings.interval/100;return MathHelper.round(value,settings.step,settings.round)},MathHelper.valueToPrc=function(value,pointer){var prc,settings=pointer.settings;if(settings.heterogeneity&&settings.heterogeneity.length>0)for(var v,heterogeneity=settings.heterogeneity,start=0,from=settings.from,i=0;i<=heterogeneity.length;i++)v=heterogeneity[i]?heterogeneity[i].split("/"):[100,settings.to],v[0]=Number(v[0]),v[1]=Number(v[1]),value>=from&&value<=v[1]&&(prc=MathHelper.calcLimits(start+(value-from)*(v[0]-start)/(v[1]-from),pointer)),start=v[0],from=v[1];else prc=MathHelper.calcLimits(100*(value-settings.from)/settings.interval,pointer);return prc},MathHelper.calcLimits=function(delta,pointer){var settings=pointer.settings;if(!settings.smooth){var step=100*settings.step/settings.interval;delta=Math.round(delta/step)*step}var another=pointer.getAdjacentPointer();return another&&pointer.uid&&delta<another.get().prc&&(delta=another.get().prc),another&&!pointer.uid&&delta>another.get().prc&&(delta=another.get().prc),0>delta&&(delta=0),delta>100&&(delta=100),Math.round(10*delta)/10},MathHelper}();Slider.MathHelper=MathHelper}(Slider||(Slider={}));