var stjs={};stjs.NOT_IMPLEMENTED=function(){throw"This method is not implemented in Javascript.";};stjs.JavalikeEquals=function(value){if(value==null)
return false;if(value.valueOf)
return this.valueOf()===value.valueOf();return this===value;};stjs.JavalikeGetClass=function(){return this.constructor;};if(!String.prototype.equals){String.prototype.equals=stjs.JavalikeEquals;}
if(!String.prototype.getBytes){String.prototype.getBytes=stjs.NOT_IMPLEMENTED;}
if(!String.prototype.getChars){String.prototype.getChars=stjs.NOT_IMPLEMENTED;}
if(!String.prototype.contentEquals){String.prototype.contentEquals=stjs.NOT_IMPLEMENTED;}
if(!String.prototype.startsWith){String.prototype.startsWith=function(start,from){var f=from!=null?from:0;return this.substring(f,f+start.length)==start;}}
if(!String.prototype.endsWith){String.prototype.endsWith=function(end){if(end==null)
return false;if(this.length<end.length)
return false;return this.substring(this.length-end.length,this.length)==end;}}
if(!String.prototype.trim){stjs.trimLeftRegExp=/^\s+/;stjs.trimRightRegExp=/\s+$/;String.prototype.trim=function(){return this.replace(stjs.trimLeftRegExp,"").replace(stjs.trimRightRegExp,"");}}
if(!String.prototype.matches){String.prototype.matches=function(regexp){return this.match("^"+regexp+"$")!=null;}}
if(!String.prototype.compareTo){String.prototype.compareTo=function(other){if(other==null)
return 1;if(this<other)
return-1;if(this==other)
return 0;return 1;}}
if(!String.prototype.compareToIgnoreCase){String.prototype.compareToIgnoreCase=function(other){if(other==null)
return 1;return this.toLowerCase().compareTo(other.toLowerCase());}}
if(!String.prototype.equalsIgnoreCase){String.prototype.equalsIgnoreCase=function(other){if(other==null)
return false;return this.toLowerCase()===other.toLowerCase();}}
if(!String.prototype.codePointAt){String.prototype.codePointAt=String.prototype.charCodeAt;}
if(!String.prototype.codePointBefore){String.prototype.codePointBefore=stjs.NOT_IMPLEMENTED;}
if(!String.prototype.codePointCount){String.prototype.codePointCount=stjs.NOT_IMPLEMENTED;}
if(!String.prototype.replaceAll){String.prototype.replaceAll=function(regexp,replace){return this.replace(new RegExp(regexp,"g"),replace);}}
if(!String.prototype.replaceFirst){String.prototype.replaceFirst=function(regexp,replace){return this.replace(new RegExp(regexp),replace);}}
if(!String.prototype.regionMatches){String.prototype.regionMatches=function(ignoreCase,toffset,other,ooffset,len){if(arguments.length==4){len=arguments[3];ooffset=arguments[2];other=arguments[1];toffset=arguments[0];ignoreCase=false;}
if(toffset<0||ooffset<0||other==null||toffset+len>this.length||ooffset+len>other.length)
return false;var s1=this.substring(toffset,toffset+len);var s2=other.substring(ooffset,ooffset+len);return ignoreCase?s1.equalsIgnoreCase(s2):s1===s2;}}
if(!String.prototype.contains){String.prototype.contains=function(it){return this.indexOf(it)>=0;};}
if(!String.prototype.getClass){String.prototype.getClass=stjs.JavalikeGetClass;}
String.valueOf=function(value){return new String(value);};var Byte=Number;var Double=Number;var Float=Number;var Integer=Number;var Long=Number;var Short=Number;if(!Number.prototype.intValue){Number.prototype.intValue=function(){return parseInt(this);}}
if(!Number.prototype.shortValue){Number.prototype.shortValue=function(){return parseInt(this);}}
if(!Number.prototype.longValue){Number.prototype.longValue=function(){return parseInt(this);}}
if(!Number.prototype.byteValue){Number.prototype.byteValue=function(){return parseInt(this);}}
if(!Number.prototype.floatValue){Number.prototype.floatValue=function(){return parseFloat(this);}}
if(!Number.prototype.doubleValue){Number.prototype.doubleValue=function(){return parseFloat(this);}}
if(!Number.parseInt){Number.parseInt=parseInt;}
if(!Number.parseShort){Number.parseShort=parseInt;}
if(!Number.parseLong){Number.parseLong=parseInt;}
if(!Number.parseByte){Number.parseByte=parseInt;}
if(!Number.parseDouble){Number.parseDouble=parseFloat;}
if(!Number.parseFloat){Number.parseFloat=parseFloat;}
if(!Number.isNaN){Number.isNaN=isNaN;}
if(!Number.prototype.isNaN){Number.prototype.isNaN=function(){return isNaN(this);}}
if(!Number.prototype.equals){Number.prototype.equals=stjs.JavalikeEquals;}
if(!Number.prototype.getClass){Number.prototype.getClass=stjs.JavalikeGetClass;}
Number.valueOf=function(value){return new Number(value).valueOf();}
if(!Boolean.prototype.equals){Boolean.prototype.equals=stjs.JavalikeEquals;}
if(!Boolean.prototype.getClass){Boolean.prototype.getClass=stjs.JavalikeGetClass;}
Boolean.valueOf=function(value){return new Boolean(value).valueOf();}
stjs.global=this;stjs.skipCopy={"prototype":true,"constructor":true,"$typeDescription":true,"$inherit":true};stjs.ns=function(path){var p=path.split(".");var obj=stjs.global;for(var i=0;i<p.length;++i){var part=p[i];obj=obj[part]=obj[part]||{};}
return obj;};stjs.copyProps=function(from,to){for(var key in from){if(!stjs.skipCopy[key])
to[key]=from[key];}
return to;};stjs.copyInexistentProps=function(from,to){for(var key in from){if(!stjs.skipCopy[key]&&!to[key])
to[key]=from[key];}
return to;};stjs.extend=function(_constructor,_super,_implements,_initializer,_typeDescription,_annotations){if(typeof(_typeDescription)!=="object"){return stjs.extend12.apply(this,arguments);}
_constructor.$inherit=[];if(_super!=null){var I=function(){};I.prototype=_super.prototype;_constructor.prototype=new I();stjs.copyProps(_super,_constructor);stjs.copyProps(_super.$typeDescription,_typeDescription);stjs.copyProps(_super.$annotations,_annotations);_constructor.$inherit.push(_super);}
for(var a=0;a<_implements.length;++a){if(!_implements[a])continue;stjs.copyProps(_implements[a],_constructor);stjs.copyInexistentProps(_implements[a].prototype,_constructor.prototype);_constructor.$inherit.push(_implements[a]);}
_constructor.prototype.constructor=_constructor;if(_initializer!=null){_initializer(_constructor,_constructor.prototype);}
_constructor.$typeDescription=_typeDescription;_constructor.$annotations=_annotations;if(_super==null){if(!_constructor.prototype.equals){_constructor.prototype.equals=stjs.JavalikeEquals;}
if(!_constructor.prototype.getClass){_constructor.prototype.getClass=stjs.JavalikeGetClass;}}
return _constructor;};stjs.extend12=function(_constructor,_super,_implements){var I=function(){};I.prototype=_super.prototype;_constructor.prototype=new I();for(var a=1;a<arguments.length;++a){stjs.copyProps(arguments[a],_constructor);}
_constructor.prototype.constructor=_constructor;if(_super==null){_constructor.prototype.equals=stjs.JavalikeEquals;_constructor.prototype.getClass=stjs.JavalikeGetClass;}
return _constructor;};stjs.getAnnotations=function(clz){return clz.$annotations;};stjs.getTypeAnnotation=function(clz,annType){var ann=clz.$annotations._;return ann?ann[annType]:null;};stjs.getMemberAnnotation=function(clz,memberName,annType){var ann=clz.$annotations.memberName;return ann?ann[annType]:null;};stjs.getParameterAnnotation=function(clz,methodName,idx,annType){var ann=clz.$annotations[methodName+"$"+idx];return ann?ann[annType]:null;};stjs.isInstanceOf=function(child,parent){if(child==null)
return false;if(child===parent)
return true;if(!child.$inherit)
return false;for(var i=0;i<child.$inherit.length;++i){if(stjs.isInstanceOf(child.$inherit[i],parent)){return true;}}
return false;}
stjs.enumEntry=function(idx,name){this._name=name;this._ordinal=idx;};stjs.enumEntry.prototype.name=function(){return this._name;};stjs.enumEntry.prototype.ordinal=function(){return this._ordinal;};stjs.enumEntry.prototype.toString=function(){return this._name;};stjs.enumEntry.prototype.equals=stjs.JavalikeEquals;stjs.enumeration=function(){var i;var e={};e._values=[];for(i=0;i<arguments.length;++i){e[arguments[i]]=new stjs.enumEntry(i,arguments[i]);e._values[i]=e[arguments[i]];}
e.values=function(){return this._values;};e.valueOf=function(label){return this[label];}
return e;};stjs.mainCallDisabled=false;stjs.exception=function(err){return err;};stjs.isEnum=function(obj){return obj!=null&&obj.constructor==stjs.enumEntry;};if(typeof Math.trunc==="function"){stjs.trunc=Math.trunc;}else{stjs.trunc=function(n){if(n==null)
return null;return n>=0?Math.floor(n):Math.ceil(n);}}
stjs.converters={Date:function(s,type){var a=/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)$/.exec(s);if(a){return new Date(+a[1],+a[2]-1,+a[3],+a[4],+a[5],+a[6]);}
return null;},Enum:function(s,type){return eval(type.arguments[0])[s];}};stjs.serializers={Date:function(d,type){function pad(n){return n<10?"0"+n:""+n;}
if(d){return""+d.getFullYear()+"-"+pad(d.getMonth()+1)+"-"+pad(d.getDate())+" "+pad(d.getHours())+":"+pad(d.getMinutes())+":"+pad(d.getSeconds());}
return null;},Enum:function(e,type){return e!=null?e.toString():null;}};stjs.bind=function(obj,method,thisParamPos){var useFirstParamAsContext=false;if(method==null){method=obj;obj=null;useFirstParamAsContext=true;}
var addThisToParameters=thisParamPos!=null;var f=function(){var args=arguments;if(addThisToParameters){Array.prototype.splice.call(args,thisParamPos,0,this);}
if(useFirstParamAsContext){obj=Array.prototype.shift.call(args);}
if(typeof method==="string"){return obj[method].apply(obj,args);}else{return method.apply(obj,args);}};return f;};function exception(err){return err;}
function isEnum(obj){return obj!=null&&obj.constructor==stjs.enumEntry;}
stjs.parseJSON=(function(){var number='(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';var oneChar='(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
+'|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var string='(?:\"'+oneChar+'*\")';var jsonToken=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]'
+'|'+number
+'|'+string
+')','g');var escapeSequence=new RegExp('\\\\(?:([^u])|u(.{4}))','g');var escapes={'"':'"','/':'/','\\':'\\','b':'\b','f':'\f','n':'\n','r':'\r','t':'\t'};function unescapeOne(_,ch,hex){return ch?escapes[ch]:String.fromCharCode(parseInt(hex,16));}
var constructors={};function constr(name,param){var c=constructors[name];if(!c)
constructors[name]=c=eval(name);return new c(param);}
function convert(type,json){if(!type)
return json;var cv=stjs.converters[type.name||type];if(cv)
return cv(json,type);return constr(type,json);}
function builder(type){if(!type)
return{};if(typeof type=="function")
return new type();if(type.name){if(type.name=="Map")
return{};if(type.name=="Array")
return[];return constr(type.name);}
return constr(type);}
var EMPTY_STRING=new String('');var SLASH='\\';var firstTokenCtors={'{':Object,'[':Array};var hop=Object.hasOwnProperty;function nextMatch(str){var m=jsonToken.exec(str);return m!=null?m[0]:null;}
return function(json,type){var result;var tok=nextMatch(json);var topLevelPrimitive=false;if('{'===tok){result=builder(type,null);}else if('['===tok){result=[];}else{result=[];topLevelPrimitive=true;}
var key;var stack=[result];var stack2=[type];for(tok=nextMatch(json);tok!=null;tok=nextMatch(json)){var cont;switch(tok.charCodeAt(0)){default:cont=stack[0];cont[key||cont.length]=+(tok);key=void 0;break;case 0x22:tok=tok.substring(1,tok.length-1);if(tok.indexOf(SLASH)!==-1){tok=tok.replace(escapeSequence,unescapeOne);}
cont=stack[0];if(!key){if(cont instanceof Array){key=cont.length;}else{key=tok||EMPTY_STRING;stack2[0]=cont.constructor.$typeDescription?cont.constructor.$typeDescription[key]:stack2[1].arguments[1];break;}}
cont[key]=convert(stack2[0],tok);key=void 0;break;case 0x5b:cont=stack[0];stack.unshift(cont[key||cont.length]=[]);stack2.unshift(stack2[0].arguments[0]);key=void 0;break;case 0x5d:stack.shift();stack2.shift();break;case 0x66:cont=stack[0];cont[key||cont.length]=false;key=void 0;break;case 0x6e:cont=stack[0];cont[key||cont.length]=null;key=void 0;break;case 0x74:cont=stack[0];cont[key||cont.length]=true;key=void 0;break;case 0x7b:cont=stack[0];stack.unshift(cont[key||cont.length]=builder(stack2[0]));stack2.unshift(null);key=void 0;break;case 0x7d:stack.shift();stack2.shift();break;}}
if(topLevelPrimitive){if(stack.length!==1){throw new Error();}
result=result[0];}else{if(stack.length){throw new Error();}}
return result;};})();stjs.isArray=function(obj){return stjs.toString.call(obj)==="[object Array]";};stjs.typefy=function(obj,cls){if(stjs.isArray(obj)){var result=[];for(var idx=0;idx<obj.length;idx++){result.push(stjs.typefy(obj[idx],elementType(cls)));}
return result;}
var constructors={};function constr(name,param){var c=constructors[name];if(!c)
constructors[name]=c=eval(name);return new c(param);}
function elementType(type){if(typeof type=="function")
return type;if(type.arguments){return eval(type.arguments[0]);}
if(typeof type=="string")
return eval(type);return Object;}
function convert(type,json){if(!type)
return json;var cv=stjs.converters[type.name||type];if(cv)
return cv(json,type);return constr(type,json);}
function builder(type){if(!type)
return{};if(typeof type=="function")
return new type();if(type.name){if(type.name=="Map")
return{};if(type.name=="Array")
return[];return constr(type.name);}
return constr(type);}
if(obj==null)
return null;var ret=new cls();for(var key in obj){var prop=obj[key];if(prop==null)
continue;var td=cls.$typeDescription[key];if(!td){ret[key]=prop;continue;}
if(typeof prop=="string")
ret[key]=convert(td,prop);else if(typeof prop=="object"){if(typeof td=="string"){td=eval(td);}
ret[key]=stjs.typefy(prop,td);}}
return ret;};stjs.hydrate=stjs.typefy
stjs.stringify=function(obj,cls){if(obj==null)
return null;var ret={};for(var key in obj){var td=cls.$typeDescription[key];var prop=obj[key];var ser=td!=null?stjs.serializers[td.name||td]:null;if(typeof prop=="function")
continue;if(!td||!ser){ret[key]=prop;continue;}
if(typeof prop!="string")
if(ser)
ret[key]=ser(prop,td);else
ret[key]=stjs.typefy(prop,td);}
return ret;};stjs.assertHandler=function(position,code,msg){throw msg+" at "+position;};stjs.STJSAssert={};stjs.STJSAssert.setAssertHandler=function(a){stjs.assertHandler=a;}
stjs.STJSAssert.assertArgEquals=function(position,code,expectedValue,testValue){if(expectedValue!=testValue&&stjs.assertHandler)
stjs.assertHandler(position,code,"Wrong argument. Expected: "+expectedValue+", got:"+testValue);}
stjs.STJSAssert.assertArgNotNull=function(position,code,testValue){if(testValue==null&&stjs.assertHandler)
stjs.assertHandler(position,code,"Wrong argument. Null value");}
stjs.STJSAssert.assertArgTrue=function(position,code,condition){if(!condition&&stjs.assertHandler)
stjs.assertHandler(position,code,"Wrong argument. Condition is false");}
stjs.STJSAssert.assertStateEquals=function(position,code,expectedValue,testValue){if(expectedValue!=testValue&&stjs.assertHandler)
stjs.assertHandler(position,code,"Wrong state. Expected: "+expectedValue+", got:"+testValue);}
stjs.STJSAssert.assertStateNotNull=function(position,code,testValue){if(testValue==null&&stjs.assertHandler)
stjs.assertHandler(position,code,"Wrong state. Null value");}
stjs.STJSAssert.assertStateTrue=function(position,code,condition){if(!condition&&stjs.assertHandler)
stjs.assertHandler(position,code,"Wrong state. Condition is false");}
var Throwable=function(message,cause){Error.call(this);if(typeof Error.captureStackTrace==='function'){Error.captureStackTrace(this,arguments.callee);}else{try{throw new Error();}catch(e){this.stack=e.stack;}}
if(typeof message==="string"){this.detailMessage=message;this.message=message;this.cause=cause;}else{this.cause=message;}};stjs.extend(Throwable,Error,[],function(constructor,prototype){prototype.detailMessage=null;prototype.cause=null;prototype.getMessage=function(){return this.detailMessage;};prototype.getLocalizedMessage=function(){return this.getMessage();};prototype.getCause=function(){return(this.cause==this?null:this.cause);};prototype.toString=function(){var s="Exception";var message=this.getLocalizedMessage();return(message!=null)?(s+": "+message):s;};prototype.getStackTrace=function(){return this.stack;};prototype.printStackTrace=function(){console.error(this.getStackTrace());};},{});var Exception=function(message,cause){Throwable.call(this,message,cause);};stjs.extend(Exception,Throwable,[],function(constructor,prototype){},{});var RuntimeException=function(message,cause){Exception.call(this,message,cause);};stjs.extend(RuntimeException,Exception,[],function(constructor,prototype){},{});var Iterator=function(){};Iterator=stjs.extend(Iterator,null,[],function(constructor,prototype){prototype.hasNext=function(){};prototype.next=function(){};prototype.remove=function(){};},{},{});var Iterable=function(){};Iterable=stjs.extend(Iterable,null,[],function(constructor,prototype){prototype.iterator=function(){};},{},{});stjs.setField=function(obj,field,value,returnOldValue){if(stjs.setFieldHandler)
return stjs.setFieldHandler(obj,field,value,returnOldValue);var toReturn=returnOldValue?obj[field]:value;obj[field]=value;return toReturn;};stjs.getField=function(obj,field){if(stjs.getFieldHandler)
return stjs.getFieldHandler(obj,field);return obj[field];};
/*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)
}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
//# sourceMappingURL=jquery.min.map
/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window);
/*! jQuery UI - v1.11.4 - 2015-03-11
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))})),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.css("box-sizing"),l=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},d=l&&u.down||u,c=function(){o._toggleComplete(i)};return"number"==typeof d&&(a=d),"string"==typeof d&&(n=d),n=n||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:c,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,c):e.animate(this.showProps,a,n,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget);
i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.4"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),v===n&&(v=null))},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target);
return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,H,z,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),H=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=H,z=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;H>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(z)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[z]):[!0,""],j=z.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>z||$&&z>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(j&&!v?"&#xa0;":W?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===R.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":"&#xa0;")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.4",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)
},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent(),a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=e(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0};e(n.alsoResize).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;
if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};
f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})},e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.val(),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step,s=Math.floor(+(e-t).toFixed(this._precision())/i)*i;e=s+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));
return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("<tr>",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children().each(function(){e("<td>&#160;</td>",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels;
this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o},h=function(e,t){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,n){setTimeout(function(){o.html(e),s._trigger("load",i,r),h(n,t)},1)}).fail(function(e,t){setTimeout(function(){h(e,t)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(t,s),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){n._delay(function(){e.data("ui-tooltip-open")&&(t&&(t.type=a),this._open(t,e,i))})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){l.of=e,o.is(":hidden")||o.position(l)}var a,o,r,h,l=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("<div>").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(l.of),clearInterval(r))},e.fx.interval)),this._trigger("open",t,{tooltip:o})}},_registerCloseHandlers:function(t,i){var s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);return a?(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})});
var SQW=function(){};SQW=stjs.extend(SQW,null,[],function(constructor,prototype){constructor.$=null;constructor.main=function(args){SQW.$=(window)["jQuery"];};},{$:"Object"},{});if(!stjs.mainCallDisabled)
SQW.main();
var SQWUtils=function(){SQW.$.fn.sqw_reverse=[].reverse;;};SQWUtils=stjs.extend(SQWUtils,null,[],function(constructor,prototype){prototype.applet=null;prototype.array=null;prototype.css=null;prototype.is_right_to_left=null;constructor.main=function(args){SQW.utils=new SQWUtils();};prototype.hasApplet=function(){SQW.utils.applet.has();};prototype.moveAppletFix=function(id,top,left){SQW.utils.applet.moveFix(id,top,left);};prototype.applyAppletFix=function($){SQW.utils.applet.applyFix($);};prototype.removeAppletFix=function($){SQW.utils.applet.removeFix($);};prototype.hideAppletFix=function($){SQW.utils.applet.hideFix($);};prototype.FunctionProxy=function(sourceCode){return(Function('with (this){'+'return('+'(function(){'+sourceCode+'})()'+');'+'};'));;};prototype.xssPrevent=function(string){string=(string).replace(new RegExp("[\"\\'][\\s]*javascript:(.*)[\"\\']","g"),"\"\"");string=(string).replace(new RegExp("script(.*)","g"),"");string=(string).replace(new RegExp("eval\\((.*)\\)","g"),"");string=(string).replace(new RegExp("([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])"),"");return string;};prototype.highlight=function(text,highlight,filter_case){try{var regexp=new RegExp("(.*?)("+(filter_case?highlight:highlight.toLowerCase())+")(.*)","gi");text=(text).replace(regexp,"$1<em>$2</em>$3");}catch(ex){}
return text;};prototype.scrollTo=function(parent,target,settings){return new SQWVerticalScroll(parent,target,settings);};prototype.getConstructorName=function(obj){var funcNameRegex=new RegExp("function (.{1,})\\(");var results=funcNameRegex.exec((obj).constructor.toString());return results!=null&&results.length>1?results[1]:"";};prototype.stopDefaultEvent=function(event){if(event!=null&&(typeof(event)["preventDefault"])=="function"){event.preventDefault();}else{window.event.returnValue=false;}
return false;};prototype.disabledEventPropagation=function(event){if((typeof(event)["stopPropagation"])=="function"){event.stopPropagation();}else if((typeof(window)["event"])!="undefined"){window.event.cancelBubble=true;}};prototype.attributes=function(node,with_values){node=SQW.$(node).get(0);var to_ignore=["style","contenteditable","hasfocus","tabindex"];var attributes=this.to_array(node.attributes);if(with_values){return SQW.utils.array.removeByName(attributes,to_ignore);}
for(var attr in attributes){if(!(attributes).hasOwnProperty(attr))
continue;attributes.push((attr).nodeName);}
return attributes;};prototype.to_array=function(iterable){if(iterable==null){return[];}
if((typeof(iterable)["toArray"])=="function"){return(iterable).toArray();}
var length=((iterable).length||0);var results=[];while(--length>0){results[length]=(iterable)[length];}
return results;};prototype.right_to_left=function(){if(this.is_right_to_left==null){this.is_right_to_left=SQW.$("body").css("direction")=="rtl";}
return this.is_right_to_left;};},{applet:"SQWApplet",array:"SQWArray",css:"SQWCSS"},{});if(!stjs.mainCallDisabled)
SQWUtils.main();
var SQWApplet=function(){};SQWApplet=stjs.extend(SQWApplet,null,[],function(constructor,prototype){constructor.main=function(args){SQW.utils.applet=new SQWApplet();};prototype.has=function(){if(SQW.$("applet").constructor.length>0){return true;}
return false;};prototype.moveFix=function(id,top,left){if(SQW.utils.applet.has()){SQW.$("#"+id).css("top",top).css("left",left);}};prototype.applyFix=function(parentElement){if(SQW.utils.applet.has()){if(parentElement.prop("id")!=null){parentElement.prop("id","appletFix_"+parseInt(Math.random()*1000));}
var id="iframe_"+parentElement.prop("id");if(SQW.$("#"+id).constructor.length==0){var iframe_template="<iframe id=\""+id+"\" src=\"javascript:false;\" frameborder=\"0\" style=\"opacity:0; position: absolute;z-index: 1;\"></iframe>";SQW.$(iframe_template).prependTo("body");}else{SQW.$("#"+id).show();}
SQW.$("#"+id).css("width",parentElement.outerWidth()).css("height",parentElement.outerHeight());SQW.utils.applet.moveFix(id,parentElement.offset().top,parentElement.offset().left);return SQW.$("#"+id);}
return null;};prototype.hideFix=function(parentElement){if(SQW.utils.applet.has()){var id="iframe_"+parentElement.prop("id");SQW.$("#"+id).hide();}};prototype.removeFix=function(parentElement){if(SQW.utils.applet.has()){var id="iframe_"+parentElement.prop("id");SQW.$("#"+id).remove();}};},{},{});if(!stjs.mainCallDisabled)
SQWApplet.main();
var SQWArray=function(){};SQWArray=stjs.extend(SQWArray,null,[],function(constructor,prototype){constructor.main=function(args){SQW.utils.array=new SQWArray();};prototype.inArray=function(array,p_val){if(SQW.utils.array.search(array,p_val)!=-1){return true;}
return false;};prototype.search=function(array,p_val){var l=array.length;for(var i=0;i<l;i++){if(array[i]==p_val){return i;}}
return-1;};prototype.removeByName=function(array,to_remove){var args=[];if((typeof to_remove)=="string"){args.push(to_remove);}
var L=args.length;var ax;var what;while(L>0&&array.length>0){what=args[--L];while((ax=this.search(array,what))!=-1){array.splice(ax,1);}}
return array;};prototype.remove=function(array,from,to){var rest=array.slice(((to||from)+1||array.length));(array)["length"]=from<0?array.length+from:from;for(var item in rest){if(!(rest).hasOwnProperty(item))
continue;array.push(item);}
return rest;};prototype.unique=function(array){var a=[];var i;var j;var l;for(i=0,l=array.length;i<l;i++){for(j=0;j<=i;j++){if(array[i]==array[j]){break;}}
if(j==i){a.push(array[i]);}}
return a;};prototype.diff=function(A,B){var strA=":"+A.join("::")+":";var strB=":"+B.join(":|:")+":";var reg=new RegExp("("+strB+")","gi");var strDiff=(strA).replace(reg,"");strDiff=(strDiff).replace(new RegExp("^:"),"");strDiff=(strDiff).replace(new RegExp(":$"),"");var arrDiff=[];if(strDiff!=""){arrDiff=(strDiff).split("::");}
return arrDiff;};},{},{});if(!stjs.mainCallDisabled)
SQWArray.main();
var SQWCSS=function(){};SQWCSS=stjs.extend(SQWCSS,null,[],function(constructor,prototype){constructor.main=function(args){SQW.utils.css=new SQWCSS();};prototype.get_css=function(rule_name,delete_flag,sheet){rule_name=rule_name.toLowerCase();var css_rules=(sheet.cssRules||sheet.rules);var j=0;do{if(css_rules.length>0&&j>css_rules.length+5){return false;}
if(css_rules[j].selectorText!=""&&css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag==true){if((typeof(sheet)["removeRule"])=="function"){sheet.removeRule(j);}
if((typeof(sheet)["deleteRule"])=="function"){sheet.deleteRule(j);}
return true;}
return css_rules[j];}}while((typeof css_rules[++j])!="undefined");return false;};prototype.add_css=function(rule_name,sheet){if(SQW.utils.css.get_css(rule_name,false,sheet)){return false;}
if((typeof(typeof(sheet)["insertRule"]))=="function"){sheet.insertRule(rule_name+" { }",0);}else{sheet.addRule(rule_name,null,0);}
return SQW.utils.css.get_css(rule_name,null,null);};prototype.remove_css=function(rule_name,sheet){return SQW.utils.css.get_css(rule_name,true,sheet);};prototype.add_sheet=function(opts){var is_new=true;var tmp=null;if(opts.str!=null){if(opts.title!=null){tmp=SQW.$("style[id='"+opts.title+"-stylesheet']").get(0);}
if(tmp!=null){is_new=false;}else{tmp=document.createElement("style");tmp.setAttribute("type","text/css");if(opts.title!=null){tmp.setAttribute("id",opts.title+"-stylesheet");}}
if(tmp.styleSheet!=null){if(is_new){document.getElementsByTagName("head")[0].appendChild(tmp);tmp.styleSheet.cssText=opts.str;}else{tmp.styleSheet.cssText=tmp.styleSheet.cssText+" "+opts.str;}}else{tmp.appendChild(document.createTextNode(opts.str));document.getElementsByTagName("head")[0].appendChild(tmp);}
return(tmp.sheet||tmp.styleSheet);}
if(opts.url!=null){tmp=document.createElement("link");tmp.rel="stylesheet";tmp.type="text/css";tmp.media="all";tmp.href=opts.url;document.getElementsByTagName("head")[0].appendChild(tmp);return tmp.styleSheet;}
return null;};constructor.SheetOptions=function(){};constructor.SheetOptions=stjs.extend(constructor.SheetOptions,null,[],function(constructor,prototype){prototype.str=null;prototype.title=null;prototype.url=null;},{},{});},{},{});if(!stjs.mainCallDisabled)
SQWCSS.main();
var SQWVerticalScroll=function(parent,target,settings){var default_settings={"duration":0};settings=SQW.$.extend(default_settings,settings);if(target=="max"){target=9.0E9;}
var elements=(this._scrollable(parent).get());for(var key in elements){if(!(elements).hasOwnProperty(key))
continue;var elem=elements[key];var $elem=SQW.$(elem);var element=false;var top=0;var win=$elem.is("html,body");var type=(typeof target);var typeNumeric=(type=="number"||type=="string")?1:(type=="object")?2:3;switch(typeNumeric){case 1:if(new RegExp("^([+-]=)?\\d+(\\.\\d+)?(px|%)?$").test(target)){top=target;break;}
target=SQW.$(this).find(target);case 2:if((target)["is"]!=null||(target)["style"]!=null){element=true;top=((target=SQW.$(target))).offset().top;}else{}}
var scrollTop=0;if(element){scrollTop=(top+(win?0:elem.scrollTop-$elem.offset().top));if((typeof settings["margin"])!="undefined"){var margin=parseInt(settings["margin"]);if(margin!=NaN){scrollTop-=margin;}}}else{scrollTop=stjs.trunc((((typeof top)=="string"&&(top).substring(-1)=="%")?parseFloat(top)/100*this.maximum(elem):top));}
if(new RegExp("^\\d+$").test(scrollTop)){scrollTop=stjs.trunc((scrollTop<=0?0:Math.min(scrollTop,this.maximum(elem))));}
if(settings["duration"]>0){var scrollAnimation={};scrollAnimation["scrollTop"]=scrollTop;$elem.stop(false,true).animate(scrollAnimation,settings["duration"]);}else{$elem.scrollTop(scrollTop);}}};SQWVerticalScroll=stjs.extend(SQWVerticalScroll,null,[],function(constructor,prototype){prototype._scrollable=function(elements){return elements.map(stjs.bind(this,function(i,THIS){var elem=THIS;var isWin=(!elem.nodeName||SQW.$.inArray(elem.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1);if(!isWin){return elem;}
var doc=((elem.contentWindow||elem).document||elem.ownerDocument||elem);if(SQW.$.browser.safari||doc.compatMode=="BackCompat"){return doc.body;}
return doc.documentElement;},1));};prototype.maximum=function(elem){if(!SQW.$(elem).is("html,body")){return(elem.scrollHeight-SQW.$(elem).height());}
var html=elem.ownerDocument.documentElement;var body=elem.ownerDocument.body;return Math.max(html.scrollHeight,body.scrollHeight)-Math.min(html.clientHeight,body.clientHeight);};},{},{});
if(!Array.prototype.indexOf)
{Array.prototype.indexOf=function(elt)
{var len=this.length>>>0;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0)
from+=len;for(;from<len;from++)
{if(from in this&&this[from]===elt)
return from;}
return-1;};}
if(!document.createElement('canvas').getContext){(function(){var m=Math;var mr=m.round;var ms=m.sin;var mc=m.cos;var abs=m.abs;var sqrt=m.sqrt;var Z=10;var Z2=Z/2;var IE_VERSION=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function getContext(){return this.context_||(this.context_=new CanvasRenderingContext2D_(this));}
var slice=Array.prototype.slice;function bind(f,obj,var_args){var a=slice.call(arguments,2);return function(){return f.apply(obj,a.concat(slice.call(arguments)));};}
function encodeHtmlAttribute(s){return String(s).replace(/&/g,'&amp;').replace(/"/g,'&quot;');}
function addNamespace(doc,prefix,urn){if(!doc.namespaces[prefix]){doc.namespaces.add(prefix,urn,'#default#VML');}}
function addNamespacesAndStylesheet(doc){addNamespace(doc,'g_vml_','urn:schemas-microsoft-com:vml');addNamespace(doc,'g_o_','urn:schemas-microsoft-com:office:office');if(!doc.styleSheets['ex_canvas_']){var ss=doc.createStyleSheet();ss.owningElement.id='ex_canvas_';ss.cssText='canvas{display:inline-block;overflow:hidden;'+'text-align:left;width:300px;height:150px}';}}
addNamespacesAndStylesheet(document);var G_vmlCanvasManager_={init:function(opt_doc){var doc=opt_doc||document;doc.createElement('canvas');doc.attachEvent('onreadystatechange',bind(this.init_,this,doc));},init_:function(doc){var els=doc.getElementsByTagName('canvas');for(var i=0;i<els.length;i++){this.initElement(els[i]);}},initElement:function(el){if(!el.getContext){el.getContext=getContext;addNamespacesAndStylesheet(el.ownerDocument);el.innerHTML='';el.attachEvent('onpropertychange',onPropertyChange);el.attachEvent('onresize',onResize);var attrs=el.attributes;if(attrs.width&&attrs.width.specified){el.style.width=attrs.width.nodeValue+'px';}else{el.width=el.clientWidth;}
if(attrs.height&&attrs.height.specified){el.style.height=attrs.height.nodeValue+'px';}else{el.height=el.clientHeight;}}
return el;}};function onPropertyChange(e){var el=e.srcElement;switch(e.propertyName){case'width':el.getContext().clearRect();el.style.width=el.attributes.width.nodeValue+'px';el.firstChild.style.width=el.clientWidth+'px';break;case'height':el.getContext().clearRect();el.style.height=el.attributes.height.nodeValue+'px';el.firstChild.style.height=el.clientHeight+'px';break;}}
function onResize(e){var el=e.srcElement;if(el.firstChild){el.firstChild.style.width=el.clientWidth+'px';el.firstChild.style.height=el.clientHeight+'px';}}
G_vmlCanvasManager_.init();var decToHex=[];for(var i=0;i<16;i++){for(var j=0;j<16;j++){decToHex[i*16+j]=i.toString(16)+j.toString(16);}}
function createMatrixIdentity(){return[[1,0,0],[0,1,0],[0,0,1]];}
function matrixMultiply(m1,m2){var result=createMatrixIdentity();for(var x=0;x<3;x++){for(var y=0;y<3;y++){var sum=0;for(var z=0;z<3;z++){sum+=m1[x][z]*m2[z][y];}
result[x][y]=sum;}}
return result;}
function copyState(o1,o2){o2.fillStyle=o1.fillStyle;o2.lineCap=o1.lineCap;o2.lineJoin=o1.lineJoin;o2.lineWidth=o1.lineWidth;o2.miterLimit=o1.miterLimit;o2.shadowBlur=o1.shadowBlur;o2.shadowColor=o1.shadowColor;o2.shadowOffsetX=o1.shadowOffsetX;o2.shadowOffsetY=o1.shadowOffsetY;o2.strokeStyle=o1.strokeStyle;o2.globalAlpha=o1.globalAlpha;o2.font=o1.font;o2.textAlign=o1.textAlign;o2.textBaseline=o1.textBaseline;o2.arcScaleX_=o1.arcScaleX_;o2.arcScaleY_=o1.arcScaleY_;o2.lineScale_=o1.lineScale_;}
var colorData={aliceblue:'#F0F8FF',antiquewhite:'#FAEBD7',aquamarine:'#7FFFD4',azure:'#F0FFFF',beige:'#F5F5DC',bisque:'#FFE4C4',black:'#000000',blanchedalmond:'#FFEBCD',blueviolet:'#8A2BE2',brown:'#A52A2A',burlywood:'#DEB887',cadetblue:'#5F9EA0',chartreuse:'#7FFF00',chocolate:'#D2691E',coral:'#FF7F50',cornflowerblue:'#6495ED',cornsilk:'#FFF8DC',crimson:'#DC143C',cyan:'#00FFFF',darkblue:'#00008B',darkcyan:'#008B8B',darkgoldenrod:'#B8860B',darkgray:'#A9A9A9',darkgreen:'#006400',darkgrey:'#A9A9A9',darkkhaki:'#BDB76B',darkmagenta:'#8B008B',darkolivegreen:'#556B2F',darkorange:'#FF8C00',darkorchid:'#9932CC',darkred:'#8B0000',darksalmon:'#E9967A',darkseagreen:'#8FBC8F',darkslateblue:'#483D8B',darkslategray:'#2F4F4F',darkslategrey:'#2F4F4F',darkturquoise:'#00CED1',darkviolet:'#9400D3',deeppink:'#FF1493',deepskyblue:'#00BFFF',dimgray:'#696969',dimgrey:'#696969',dodgerblue:'#1E90FF',firebrick:'#B22222',floralwhite:'#FFFAF0',forestgreen:'#228B22',gainsboro:'#DCDCDC',ghostwhite:'#F8F8FF',gold:'#FFD700',goldenrod:'#DAA520',grey:'#808080',greenyellow:'#ADFF2F',honeydew:'#F0FFF0',hotpink:'#FF69B4',indianred:'#CD5C5C',indigo:'#4B0082',ivory:'#FFFFF0',khaki:'#F0E68C',lavender:'#E6E6FA',lavenderblush:'#FFF0F5',lawngreen:'#7CFC00',lemonchiffon:'#FFFACD',lightblue:'#ADD8E6',lightcoral:'#F08080',lightcyan:'#E0FFFF',lightgoldenrodyellow:'#FAFAD2',lightgreen:'#90EE90',lightgrey:'#D3D3D3',lightpink:'#FFB6C1',lightsalmon:'#FFA07A',lightseagreen:'#20B2AA',lightskyblue:'#87CEFA',lightslategray:'#778899',lightslategrey:'#778899',lightsteelblue:'#B0C4DE',lightyellow:'#FFFFE0',limegreen:'#32CD32',linen:'#FAF0E6',magenta:'#FF00FF',mediumaquamarine:'#66CDAA',mediumblue:'#0000CD',mediumorchid:'#BA55D3',mediumpurple:'#9370DB',mediumseagreen:'#3CB371',mediumslateblue:'#7B68EE',mediumspringgreen:'#00FA9A',mediumturquoise:'#48D1CC',mediumvioletred:'#C71585',midnightblue:'#191970',mintcream:'#F5FFFA',mistyrose:'#FFE4E1',moccasin:'#FFE4B5',navajowhite:'#FFDEAD',oldlace:'#FDF5E6',olivedrab:'#6B8E23',orange:'#FFA500',orangered:'#FF4500',orchid:'#DA70D6',palegoldenrod:'#EEE8AA',palegreen:'#98FB98',paleturquoise:'#AFEEEE',palevioletred:'#DB7093',papayawhip:'#FFEFD5',peachpuff:'#FFDAB9',peru:'#CD853F',pink:'#FFC0CB',plum:'#DDA0DD',powderblue:'#B0E0E6',rosybrown:'#BC8F8F',royalblue:'#4169E1',saddlebrown:'#8B4513',salmon:'#FA8072',sandybrown:'#F4A460',seagreen:'#2E8B57',seashell:'#FFF5EE',sienna:'#A0522D',skyblue:'#87CEEB',slateblue:'#6A5ACD',slategray:'#708090',slategrey:'#708090',snow:'#FFFAFA',springgreen:'#00FF7F',steelblue:'#4682B4',tan:'#D2B48C',thistle:'#D8BFD8',tomato:'#FF6347',turquoise:'#40E0D0',violet:'#EE82EE',wheat:'#F5DEB3',whitesmoke:'#F5F5F5',yellowgreen:'#9ACD32'};function getRgbHslContent(styleString){var start=styleString.indexOf('(',3);var end=styleString.indexOf(')',start+1);var parts=styleString.substring(start+1,end).split(',');if(parts.length!=4||styleString.charAt(3)!='a'){parts[3]=1;}
return parts;}
function percent(s){return parseFloat(s)/100;}
function clamp(v,min,max){return Math.min(max,Math.max(min,v));}
function hslToRgb(parts){var r,g,b,h,s,l;h=parseFloat(parts[0])/360%360;if(h<0)
h++;s=clamp(percent(parts[1]),0,1);l=clamp(percent(parts[2]),0,1);if(s==0){r=g=b=l;}else{var q=l<0.5?l*(1+s):l+s-l*s;var p=2*l-q;r=hueToRgb(p,q,h+1/3);g=hueToRgb(p,q,h);b=hueToRgb(p,q,h-1/3);}
return'#'+decToHex[Math.floor(r*255)]+
decToHex[Math.floor(g*255)]+
decToHex[Math.floor(b*255)];}
function hueToRgb(m1,m2,h){if(h<0)
h++;if(h>1)
h--;if(6*h<1)
return m1+(m2-m1)*6*h;else if(2*h<1)
return m2;else if(3*h<2)
return m1+(m2-m1)*(2/3-h)*6;else
return m1;}
var processStyleCache={};function processStyle(styleString){if(styleString in processStyleCache){return processStyleCache[styleString];}
var str,alpha=1;styleString=String(styleString);if(styleString.charAt(0)=='#'){str=styleString;}else if(/^rgb/.test(styleString)){var parts=getRgbHslContent(styleString);var str='#',n;for(var i=0;i<3;i++){if(parts[i].indexOf('%')!=-1){n=Math.floor(percent(parts[i])*255);}else{n=+parts[i];}
str+=decToHex[clamp(n,0,255)];}
alpha=+parts[3];}else if(/^hsl/.test(styleString)){var parts=getRgbHslContent(styleString);str=hslToRgb(parts);alpha=parts[3];}else{str=colorData[styleString]||styleString;}
return processStyleCache[styleString]={color:str,alpha:alpha};}
var DEFAULT_STYLE={style:'normal',variant:'normal',weight:'normal',size:10,family:'sans-serif'};var fontStyleCache={};function processFontStyle(styleString){if(fontStyleCache[styleString]){return fontStyleCache[styleString];}
var el=document.createElement('div');var style=el.style;try{style.font=styleString;}catch(ex){}
return fontStyleCache[styleString]={style:style.fontStyle||DEFAULT_STYLE.style,variant:style.fontVariant||DEFAULT_STYLE.variant,weight:style.fontWeight||DEFAULT_STYLE.weight,size:style.fontSize||DEFAULT_STYLE.size,family:style.fontFamily||DEFAULT_STYLE.family};}
function getComputedStyle(style,element){var computedStyle={};for(var p in style){computedStyle[p]=style[p];}
var canvasFontSize=parseFloat(element.currentStyle.fontSize),fontSize=parseFloat(style.size);if(typeof style.size=='number'){computedStyle.size=style.size;}else if(style.size.indexOf('px')!=-1){computedStyle.size=fontSize;}else if(style.size.indexOf('em')!=-1){computedStyle.size=canvasFontSize*fontSize;}else if(style.size.indexOf('%')!=-1){computedStyle.size=(canvasFontSize/100)*fontSize;}else if(style.size.indexOf('pt')!=-1){computedStyle.size=fontSize/.75;}else{computedStyle.size=canvasFontSize;}
computedStyle.size*=0.981;return computedStyle;}
function buildStyle(style){return style.style+' '+style.variant+' '+style.weight+' '+
style.size+'px '+style.family;}
var lineCapMap={'butt':'flat','round':'round'};function processLineCap(lineCap){return lineCapMap[lineCap]||'square';}
function CanvasRenderingContext2D_(canvasElement){this.m_=createMatrixIdentity();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle='#000';this.fillStyle='#000';this.lineWidth=1;this.lineJoin='miter';this.lineCap='butt';this.miterLimit=Z*1;this.globalAlpha=1;this.font='10px sans-serif';this.textAlign='left';this.textBaseline='alphabetic';this.canvas=canvasElement;var cssText='width:'+canvasElement.clientWidth+'px;height:'+
canvasElement.clientHeight+'px;overflow:hidden;position:absolute';var el=canvasElement.ownerDocument.createElement('div');el.style.cssText=cssText;canvasElement.appendChild(el);var overlayEl=el.cloneNode(false);overlayEl.style.backgroundColor='red';overlayEl.style.filter='alpha(opacity=0)';canvasElement.appendChild(overlayEl);this.element_=el;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1;}
var contextPrototype=CanvasRenderingContext2D_.prototype;contextPrototype.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null;}
this.element_.innerHTML='';};contextPrototype.beginPath=function(){this.currentPath_=[];};contextPrototype.moveTo=function(aX,aY){var p=getCoords(this,aX,aY);this.currentPath_.push({type:'moveTo',x:p.x,y:p.y});this.currentX_=p.x;this.currentY_=p.y;};contextPrototype.lineTo=function(aX,aY){var p=getCoords(this,aX,aY);this.currentPath_.push({type:'lineTo',x:p.x,y:p.y});this.currentX_=p.x;this.currentY_=p.y;};contextPrototype.bezierCurveTo=function(aCP1x,aCP1y,aCP2x,aCP2y,aX,aY){var p=getCoords(this,aX,aY);var cp1=getCoords(this,aCP1x,aCP1y);var cp2=getCoords(this,aCP2x,aCP2y);bezierCurveTo(this,cp1,cp2,p);};function bezierCurveTo(self,cp1,cp2,p){self.currentPath_.push({type:'bezierCurveTo',cp1x:cp1.x,cp1y:cp1.y,cp2x:cp2.x,cp2y:cp2.y,x:p.x,y:p.y});self.currentX_=p.x;self.currentY_=p.y;}
contextPrototype.quadraticCurveTo=function(aCPx,aCPy,aX,aY){var cp=getCoords(this,aCPx,aCPy);var p=getCoords(this,aX,aY);var cp1={x:this.currentX_+2.0/3.0*(cp.x-this.currentX_),y:this.currentY_+2.0/3.0*(cp.y-this.currentY_)};var cp2={x:cp1.x+(p.x-this.currentX_)/3.0,y:cp1.y+(p.y-this.currentY_)/3.0};bezierCurveTo(this,cp1,cp2,p);};contextPrototype.arc=function(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){aRadius*=Z;var arcType=aClockwise?'at':'wa';var xStart=aX+mc(aStartAngle)*aRadius-Z2;var yStart=aY+ms(aStartAngle)*aRadius-Z2;var xEnd=aX+mc(aEndAngle)*aRadius-Z2;var yEnd=aY+ms(aEndAngle)*aRadius-Z2;if(xStart==xEnd&&!aClockwise){xStart+=0.125;}
var p=getCoords(this,aX,aY);var pStart=getCoords(this,xStart,yStart);var pEnd=getCoords(this,xEnd,yEnd);this.currentPath_.push({type:arcType,x:p.x,y:p.y,radius:aRadius,xStart:pStart.x,yStart:pStart.y,xEnd:pEnd.x,yEnd:pEnd.y});};contextPrototype.rect=function(aX,aY,aWidth,aHeight){this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();};contextPrototype.strokeRect=function(aX,aY,aWidth,aHeight){var oldPath=this.currentPath_;this.beginPath();this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();this.stroke();this.currentPath_=oldPath;};contextPrototype.fillRect=function(aX,aY,aWidth,aHeight){var oldPath=this.currentPath_;this.beginPath();this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();this.fill();this.currentPath_=oldPath;};contextPrototype.createLinearGradient=function(aX0,aY0,aX1,aY1){var gradient=new CanvasGradient_('gradient');gradient.x0_=aX0;gradient.y0_=aY0;gradient.x1_=aX1;gradient.y1_=aY1;return gradient;};contextPrototype.createRadialGradient=function(aX0,aY0,aR0,aX1,aY1,aR1){var gradient=new CanvasGradient_('gradientradial');gradient.x0_=aX0;gradient.y0_=aY0;gradient.r0_=aR0;gradient.x1_=aX1;gradient.y1_=aY1;gradient.r1_=aR1;return gradient;};contextPrototype.drawImage=function(image,var_args){var dx,dy,dw,dh,sx,sy,sw,sh;var oldRuntimeWidth=image.runtimeStyle.width;var oldRuntimeHeight=image.runtimeStyle.height;image.runtimeStyle.width='auto';image.runtimeStyle.height='auto';var w=image.width;var h=image.height;image.runtimeStyle.width=oldRuntimeWidth;image.runtimeStyle.height=oldRuntimeHeight;if(arguments.length==3){dx=arguments[1];dy=arguments[2];sx=sy=0;sw=dw=w;sh=dh=h;}else if(arguments.length==5){dx=arguments[1];dy=arguments[2];dw=arguments[3];dh=arguments[4];sx=sy=0;sw=w;sh=h;}else if(arguments.length==9){sx=arguments[1];sy=arguments[2];sw=arguments[3];sh=arguments[4];dx=arguments[5];dy=arguments[6];dw=arguments[7];dh=arguments[8];}else{throw Error('Invalid number of arguments');}
var d=getCoords(this,dx,dy);var w2=sw/2;var h2=sh/2;var vmlStr=[];var W=10;var H=10;vmlStr.push(' <g_vml_:group',' coordsize="',Z*W,',',Z*H,'"',' coordorigin="0,0"',' style="width:',W,'px;height:',H,'px;position:absolute;');if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var filter=[];filter.push('M11=',this.m_[0][0],',','M12=',this.m_[1][0],',','M21=',this.m_[0][1],',','M22=',this.m_[1][1],',','Dx=',mr(d.x/Z),',','Dy=',mr(d.y/Z),'');var max=d;var c2=getCoords(this,dx+dw,dy);var c3=getCoords(this,dx,dy+dh);var c4=getCoords(this,dx+dw,dy+dh);max.x=m.max(max.x,c2.x,c3.x,c4.x);max.y=m.max(max.y,c2.y,c3.y,c4.y);vmlStr.push('padding:0 ',mr(max.x/Z),'px ',mr(max.y/Z),'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',filter.join(''),", sizingmethod='clip');");}else{vmlStr.push('top:',mr(d.y/Z),'px;left:',mr(d.x/Z),'px;');}
vmlStr.push(' ">','<g_vml_:image src="',image.src,'"',' style="width:',Z*dw,'px;',' height:',Z*dh,'px"',' cropleft="',sx/w,'"',' croptop="',sy/h,'"',' cropright="',(w-sx-sw)/w,'"',' cropbottom="',(h-sy-sh)/h,'"',' />','</g_vml_:group>');this.element_.insertAdjacentHTML('BeforeEnd',vmlStr.join(''));};contextPrototype.stroke=function(aFill){var lineStr=[];var lineOpen=false;var W=10;var H=10;lineStr.push('<g_vml_:shape',' filled="',!!aFill,'"',' style="position:absolute;width:',W,'px;height:',H,'px;"',' coordorigin="0,0"',' coordsize="',Z*W,',',Z*H,'"',' stroked="',!aFill,'"',' path="');var newSeq=false;var min={x:null,y:null};var max={x:null,y:null};for(var i=0;i<this.currentPath_.length;i++){var p=this.currentPath_[i];var c;switch(p.type){case'moveTo':c=p;lineStr.push(' m ',mr(p.x),',',mr(p.y));break;case'lineTo':lineStr.push(' l ',mr(p.x),',',mr(p.y));break;case'close':lineStr.push(' x ');p=null;break;case'bezierCurveTo':lineStr.push(' c ',mr(p.cp1x),',',mr(p.cp1y),',',mr(p.cp2x),',',mr(p.cp2y),',',mr(p.x),',',mr(p.y));break;case'at':case'wa':lineStr.push(' ',p.type,' ',mr(p.x-this.arcScaleX_*p.radius),',',mr(p.y-this.arcScaleY_*p.radius),' ',mr(p.x+this.arcScaleX_*p.radius),',',mr(p.y+this.arcScaleY_*p.radius),' ',mr(p.xStart),',',mr(p.yStart),' ',mr(p.xEnd),',',mr(p.yEnd));break;}
if(p){if(min.x==null||p.x<min.x){min.x=p.x;}
if(max.x==null||p.x>max.x){max.x=p.x;}
if(min.y==null||p.y<min.y){min.y=p.y;}
if(max.y==null||p.y>max.y){max.y=p.y;}}}
lineStr.push(' ">');if(!aFill){appendStroke(this,lineStr);}else{appendFill(this,lineStr,min,max);}
lineStr.push('</g_vml_:shape>');this.element_.insertAdjacentHTML('beforeEnd',lineStr.join(''));};function appendStroke(ctx,lineStr){var a=processStyle(ctx.strokeStyle);var color=a.color;var opacity=a.alpha*ctx.globalAlpha;var lineWidth=ctx.lineScale_*ctx.lineWidth;if(lineWidth<1){opacity*=lineWidth;}
lineStr.push('<g_vml_:stroke',' opacity="',opacity,'"',' joinstyle="',ctx.lineJoin,'"',' miterlimit="',ctx.miterLimit,'"',' endcap="',processLineCap(ctx.lineCap),'"',' weight="',lineWidth,'px"',' color="',color,'" />');}
function appendFill(ctx,lineStr,min,max){var fillStyle=ctx.fillStyle;var arcScaleX=ctx.arcScaleX_;var arcScaleY=ctx.arcScaleY_;var width=max.x-min.x;var height=max.y-min.y;if(fillStyle instanceof CanvasGradient_){var angle=0;var focus={x:0,y:0};var shift=0;var expansion=1;if(fillStyle.type_=='gradient'){var x0=fillStyle.x0_/arcScaleX;var y0=fillStyle.y0_/arcScaleY;var x1=fillStyle.x1_/arcScaleX;var y1=fillStyle.y1_/arcScaleY;var p0=getCoords(ctx,x0,y0);var p1=getCoords(ctx,x1,y1);var dx=p1.x-p0.x;var dy=p1.y-p0.y;angle=Math.atan2(dx,dy)*180/Math.PI;if(angle<0){angle+=360;}
if(angle<1e-6){angle=0;}}else{var p0=getCoords(ctx,fillStyle.x0_,fillStyle.y0_);focus={x:(p0.x-min.x)/width,y:(p0.y-min.y)/height};width/=arcScaleX*Z;height/=arcScaleY*Z;var dimension=m.max(width,height);shift=2*fillStyle.r0_/dimension;expansion=2*fillStyle.r1_/dimension-shift;}
var stops=fillStyle.colors_;stops.sort(function(cs1,cs2){return cs1.offset-cs2.offset;});var length=stops.length;var color1=stops[0].color;var color2=stops[length-1].color;var opacity1=stops[0].alpha*ctx.globalAlpha;var opacity2=stops[length-1].alpha*ctx.globalAlpha;var colors=[];for(var i=0;i<length;i++){var stop=stops[i];colors.push(stop.offset*expansion+shift+' '+stop.color);}
lineStr.push('<g_vml_:fill type="',fillStyle.type_,'"',' method="none" focus="100%"',' color="',color1,'"',' color2="',color2,'"',' colors="',colors.join(','),'"',' opacity="',opacity2,'"',' g_o_:opacity2="',opacity1,'"',' angle="',angle,'"',' focusposition="',focus.x,',',focus.y,'" />');}else if(fillStyle instanceof CanvasPattern_){if(width&&height){var deltaLeft=-min.x;var deltaTop=-min.y;lineStr.push('<g_vml_:fill',' position="',deltaLeft/width*arcScaleX*arcScaleX,',',deltaTop/height*arcScaleY*arcScaleY,'"',' type="tile"',' src="',fillStyle.src_,'" />');}}else{var a=processStyle(ctx.fillStyle);var color=a.color;var opacity=a.alpha*ctx.globalAlpha;lineStr.push('<g_vml_:fill color="',color,'" opacity="',opacity,'" />');}}
contextPrototype.fill=function(){this.stroke(true);};contextPrototype.closePath=function(){this.currentPath_.push({type:'close'});};function getCoords(ctx,aX,aY){var m=ctx.m_;return{x:Z*(aX*m[0][0]+aY*m[1][0]+m[2][0])-Z2,y:Z*(aX*m[0][1]+aY*m[1][1]+m[2][1])-Z2};};contextPrototype.save=function(){var o={};copyState(this,o);this.aStack_.push(o);this.mStack_.push(this.m_);this.m_=matrixMultiply(createMatrixIdentity(),this.m_);};contextPrototype.restore=function(){if(this.aStack_.length){copyState(this.aStack_.pop(),this);this.m_=this.mStack_.pop();}};function matrixIsFinite(m){return isFinite(m[0][0])&&isFinite(m[0][1])&&isFinite(m[1][0])&&isFinite(m[1][1])&&isFinite(m[2][0])&&isFinite(m[2][1]);}
function setM(ctx,m,updateLineScale){if(!matrixIsFinite(m)){return;}
ctx.m_=m;if(updateLineScale){var det=m[0][0]*m[1][1]-m[0][1]*m[1][0];ctx.lineScale_=sqrt(abs(det));}}
contextPrototype.translate=function(aX,aY){var m1=[[1,0,0],[0,1,0],[aX,aY,1]];setM(this,matrixMultiply(m1,this.m_),false);};contextPrototype.rotate=function(aRot){var c=mc(aRot);var s=ms(aRot);var m1=[[c,s,0],[-s,c,0],[0,0,1]];setM(this,matrixMultiply(m1,this.m_),false);};contextPrototype.scale=function(aX,aY){this.arcScaleX_*=aX;this.arcScaleY_*=aY;var m1=[[aX,0,0],[0,aY,0],[0,0,1]];setM(this,matrixMultiply(m1,this.m_),true);};contextPrototype.transform=function(m11,m12,m21,m22,dx,dy){var m1=[[m11,m12,0],[m21,m22,0],[dx,dy,1]];setM(this,matrixMultiply(m1,this.m_),true);};contextPrototype.setTransform=function(m11,m12,m21,m22,dx,dy){var m=[[m11,m12,0],[m21,m22,0],[dx,dy,1]];setM(this,m,true);};contextPrototype.drawText_=function(text,x,y,maxWidth,stroke){var m=this.m_,delta=1000,left=0,right=delta,offset={x:0,y:0},lineStr=[];var fontStyle=getComputedStyle(processFontStyle(this.font),this.element_);var fontStyleString=buildStyle(fontStyle);var elementStyle=this.element_.currentStyle;var textAlign=this.textAlign.toLowerCase();switch(textAlign){case'left':case'center':case'right':break;case'end':textAlign=elementStyle.direction=='ltr'?'right':'left';break;case'start':textAlign=elementStyle.direction=='rtl'?'right':'left';break;default:textAlign='left';}
switch(this.textBaseline){case'hanging':case'top':offset.y=fontStyle.size/1.75;break;case'middle':break;default:case null:case'alphabetic':case'ideographic':case'bottom':offset.y=-fontStyle.size/2.25;break;}
switch(textAlign){case'right':left=delta;right=0.05;break;case'center':left=right=delta/2;break;}
var d=getCoords(this,x+offset.x,y+offset.y);lineStr.push('<g_vml_:line from="',-left,' 0" to="',right,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!stroke,'" stroked="',!!stroke,'" style="position:absolute;width:1px;height:1px;">');if(stroke){appendStroke(this,lineStr);}else{appendFill(this,lineStr,{x:-left,y:0},{x:right,y:fontStyle.size});}
var skewM=m[0][0].toFixed(3)+','+m[1][0].toFixed(3)+','+
m[0][1].toFixed(3)+','+m[1][1].toFixed(3)+',0,0';var skewOffset=mr(d.x/Z)+','+mr(d.y/Z);lineStr.push('<g_vml_:skew on="t" matrix="',skewM,'" ',' offset="',skewOffset,'" origin="',left,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',encodeHtmlAttribute(text),'" style="v-text-align:',textAlign,';font:',encodeHtmlAttribute(fontStyleString),'" /></g_vml_:line>');this.element_.insertAdjacentHTML('beforeEnd',lineStr.join(''));};contextPrototype.fillText=function(text,x,y,maxWidth){this.drawText_(text,x,y,maxWidth,false);};contextPrototype.strokeText=function(text,x,y,maxWidth){this.drawText_(text,x,y,maxWidth,true);};contextPrototype.measureText=function(text){if(!this.textMeasureEl_){var s='<span style="position:absolute;'+'top:-20000px;left:0;padding:0;margin:0;border:none;'+'white-space:pre;"></span>';this.element_.insertAdjacentHTML('beforeEnd',s);this.textMeasureEl_=this.element_.lastChild;}
var doc=this.element_.ownerDocument;this.textMeasureEl_.innerHTML='';this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(doc.createTextNode(text));return{width:this.textMeasureEl_.offsetWidth};};contextPrototype.clip=function(){};contextPrototype.arcTo=function(){};contextPrototype.createPattern=function(image,repetition){return new CanvasPattern_(image,repetition);};function CanvasGradient_(aType){this.type_=aType;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[];}
CanvasGradient_.prototype.addColorStop=function(aOffset,aColor){aColor=processStyle(aColor);this.colors_.push({offset:aOffset,color:aColor.color,alpha:aColor.alpha});};function CanvasPattern_(image,repetition){assertImageIsValid(image);switch(repetition){case'repeat':case null:case'':this.repetition_='repeat';break
case'repeat-x':case'repeat-y':case'no-repeat':this.repetition_=repetition;break;default:throwException('SYNTAX_ERR');}
this.src_=image.src;this.width_=image.width;this.height_=image.height;}
function throwException(s){throw new DOMException_(s);}
function assertImageIsValid(img){if(!img||img.nodeType!=1||img.tagName!='IMG'){throwException('TYPE_MISMATCH_ERR');}
if(img.readyState!='complete'){throwException('INVALID_STATE_ERR');}}
function DOMException_(s){this.code=this[s];this.message=s+': DOM Exception '+this.code;}
var p=DOMException_.prototype=new Error;p.INDEX_SIZE_ERR=1;p.DOMSTRING_SIZE_ERR=2;p.HIERARCHY_REQUEST_ERR=3;p.WRONG_DOCUMENT_ERR=4;p.INVALID_CHARACTER_ERR=5;p.NO_DATA_ALLOWED_ERR=6;p.NO_MODIFICATION_ALLOWED_ERR=7;p.NOT_FOUND_ERR=8;p.NOT_SUPPORTED_ERR=9;p.INUSE_ATTRIBUTE_ERR=10;p.INVALID_STATE_ERR=11;p.SYNTAX_ERR=12;p.INVALID_MODIFICATION_ERR=13;p.NAMESPACE_ERR=14;p.INVALID_ACCESS_ERR=15;p.VALIDATION_ERR=16;p.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=G_vmlCanvasManager_;CanvasRenderingContext2D=CanvasRenderingContext2D_;CanvasGradient=CanvasGradient_;CanvasPattern=CanvasPattern_;DOMException=DOMException_;})();};
$(document).ready(function(){ie_version=(function(){var undef,v=3,div=document.createElement('div'),all=div.getElementsByTagName('i');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',all[0]);if(v==8){var vbScriptTag=document.createElement("script");vbScriptTag.text="Function BinaryToString(Binary)\nDim I,S\nFor I = 1 to LenB(Binary)\nS = S & ChrW(AscB(MidB(Binary,I,1)))\nNext\nBinaryToString = S\nEnd Function";vbScriptTag.setAttribute("language","VBScript");document.body.appendChild(vbScriptTag);}
return v>4?v:undef;}());});
(function(global){'use strict';var undefined=(void 0);var MAX_ARRAY_LENGTH=1e5;function Type(v){switch(typeof v){case'undefined':return'undefined';case'boolean':return'boolean';case'number':return'number';case'string':return'string';default:return v===null?'null':'object';}}
function Class(v){return Object.prototype.toString.call(v).replace(/^\[object *|\]$/g,'');}
function IsCallable(o){return typeof o==='function';}
function ToObject(v){if(v===null||v===undefined)throw TypeError();return Object(v);}
function ToInt32(v){return v>>0;}
function ToUint32(v){return v>>>0;}
var LN2=Math.LN2,abs=Math.abs,floor=Math.floor,log=Math.log,max=Math.max,min=Math.min,pow=Math.pow,round=Math.round;(function(){var orig=Object.defineProperty;var dom_only=!(function(){try{return Object.defineProperty({},'x',{});}catch(_){return false;}}());if(!orig||dom_only){Object.defineProperty=function(o,prop,desc){if(orig)
try{return orig(o,prop,desc);}catch(_){}
if(o!==Object(o))
throw TypeError('Object.defineProperty called on non-object');if(Object.prototype.__defineGetter__&&('get'in desc))
Object.prototype.__defineGetter__.call(o,prop,desc.get);if(Object.prototype.__defineSetter__&&('set'in desc))
Object.prototype.__defineSetter__.call(o,prop,desc.set);if('value'in desc)
o[prop]=desc.value;return o;};}}());function makeArrayAccessors(obj){if(obj.length>MAX_ARRAY_LENGTH)throw RangeError('Array too large for polyfill');function makeArrayAccessor(index){Object.defineProperty(obj,index,{'get':function(){return obj._getter(index);},'set':function(v){obj._setter(index,v);},enumerable:true,configurable:false});}
var i;for(i=0;i<obj.length;i+=1){makeArrayAccessor(i);}}
function as_signed(value,bits){var s=32-bits;return(value<<s)>>s;}
function as_unsigned(value,bits){var s=32-bits;return(value<<s)>>>s;}
function packI8(n){return[n&0xff];}
function unpackI8(bytes){return as_signed(bytes[0],8);}
function packU8(n){return[n&0xff];}
function unpackU8(bytes){return as_unsigned(bytes[0],8);}
function packU8Clamped(n){n=round(Number(n));return[n<0?0:n>0xff?0xff:n&0xff];}
function packI16(n){return[(n>>8)&0xff,n&0xff];}
function unpackI16(bytes){return as_signed(bytes[0]<<8|bytes[1],16);}
function packU16(n){return[(n>>8)&0xff,n&0xff];}
function unpackU16(bytes){return as_unsigned(bytes[0]<<8|bytes[1],16);}
function packI32(n){return[(n>>24)&0xff,(n>>16)&0xff,(n>>8)&0xff,n&0xff];}
function unpackI32(bytes){return as_signed(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32);}
function packU32(n){return[(n>>24)&0xff,(n>>16)&0xff,(n>>8)&0xff,n&0xff];}
function unpackU32(bytes){return as_unsigned(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32);}
function packIEEE754(v,ebits,fbits){var bias=(1<<(ebits-1))-1,s,e,f,ln,i,bits,str,bytes;function roundToEven(n){var w=floor(n),f=n-w;if(f<0.5)
return w;if(f>0.5)
return w+1;return w%2?w+1:w;}
if(v!==v){e=(1<<ebits)-1;f=pow(2,fbits-1);s=0;}else if(v===Infinity||v===-Infinity){e=(1<<ebits)-1;f=0;s=(v<0)?1:0;}else if(v===0){e=0;f=0;s=(1/v===-Infinity)?1:0;}else{s=v<0;v=abs(v);if(v>=pow(2,1-bias)){e=min(floor(log(v)/LN2),1023);f=roundToEven(v/pow(2,e)*pow(2,fbits));if(f/pow(2,fbits)>=2){e=e+1;f=1;}
if(e>bias){e=(1<<ebits)-1;f=0;}else{e=e+bias;f=f-pow(2,fbits);}}else{e=0;f=roundToEven(v/pow(2,1-bias-fbits));}}
bits=[];for(i=fbits;i;i-=1){bits.push(f%2?1:0);f=floor(f/2);}
for(i=ebits;i;i-=1){bits.push(e%2?1:0);e=floor(e/2);}
bits.push(s?1:0);bits.reverse();str=bits.join('');bytes=[];while(str.length){bytes.push(parseInt(str.substring(0,8),2));str=str.substring(8);}
return bytes;}
function unpackIEEE754(bytes,ebits,fbits){var bits=[],i,j,b,str,bias,s,e,f;for(i=bytes.length;i;i-=1){b=bytes[i-1];for(j=8;j;j-=1){bits.push(b%2?1:0);b=b>>1;}}
bits.reverse();str=bits.join('');bias=(1<<(ebits-1))-1;s=parseInt(str.substring(0,1),2)?-1:1;e=parseInt(str.substring(1,1+ebits),2);f=parseInt(str.substring(1+ebits),2);if(e===(1<<ebits)-1){return f!==0?NaN:s*Infinity;}else if(e>0){return s*pow(2,e-bias)*(1+f/pow(2,fbits));}else if(f!==0){return s*pow(2,-(bias-1))*(f/pow(2,fbits));}else{return s<0?-0:0;}}
function unpackF64(b){return unpackIEEE754(b,11,52);}
function packF64(v){return packIEEE754(v,11,52);}
function unpackF32(b){return unpackIEEE754(b,8,23);}
function packF32(v){return packIEEE754(v,8,23);}
(function(){function ArrayBuffer(length){length=ToInt32(length);if(length<0)throw RangeError('ArrayBuffer size is not a small enough positive integer.');Object.defineProperty(this,'byteLength',{value:length});Object.defineProperty(this,'_bytes',{value:Array(length)});for(var i=0;i<length;i+=1)
this._bytes[i]=0;}
global.ArrayBuffer=global.ArrayBuffer||ArrayBuffer;function $TypedArray$(){if(!arguments.length||typeof arguments[0]!=='object'){return(function(length){length=ToInt32(length);if(length<0)throw RangeError('length is not a small enough positive integer.');Object.defineProperty(this,'length',{value:length});Object.defineProperty(this,'byteLength',{value:length*this.BYTES_PER_ELEMENT});Object.defineProperty(this,'buffer',{value:new ArrayBuffer(this.byteLength)});Object.defineProperty(this,'byteOffset',{value:0});}).apply(this,arguments);}
if(arguments.length>=1&&Type(arguments[0])==='object'&&arguments[0]instanceof $TypedArray$){return(function(typedArray){if(this.constructor!==typedArray.constructor)throw TypeError();var byteLength=typedArray.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,'buffer',{value:new ArrayBuffer(byteLength)});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:0});Object.defineProperty(this,'length',{value:typedArray.length});for(var i=0;i<this.length;i+=1)
this._setter(i,typedArray._getter(i));}).apply(this,arguments);}
if(arguments.length>=1&&Type(arguments[0])==='object'&&!(arguments[0]instanceof $TypedArray$)&&!(arguments[0]instanceof ArrayBuffer||Class(arguments[0])==='ArrayBuffer')){return(function(array){var byteLength=array.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,'buffer',{value:new ArrayBuffer(byteLength)});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:0});Object.defineProperty(this,'length',{value:array.length});for(var i=0;i<this.length;i+=1){var s=array[i];this._setter(i,Number(s));}}).apply(this,arguments);}
if(arguments.length>=1&&Type(arguments[0])==='object'&&(arguments[0]instanceof ArrayBuffer||Class(arguments[0])==='ArrayBuffer')){return(function(buffer,byteOffset,length){byteOffset=ToUint32(byteOffset);if(byteOffset>buffer.byteLength)
throw RangeError('byteOffset out of range');if(byteOffset%this.BYTES_PER_ELEMENT)
throw RangeError('buffer length minus the byteOffset is not a multiple of the element size.');if(length===undefined){var byteLength=buffer.byteLength-byteOffset;if(byteLength%this.BYTES_PER_ELEMENT)
throw RangeError('length of buffer minus byteOffset not a multiple of the element size');length=byteLength/this.BYTES_PER_ELEMENT;}else{length=ToUint32(length);byteLength=length*this.BYTES_PER_ELEMENT;}
if((byteOffset+byteLength)>buffer.byteLength)
throw RangeError('byteOffset and length reference an area beyond the end of the buffer');Object.defineProperty(this,'buffer',{value:buffer});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:byteOffset});Object.defineProperty(this,'length',{value:length});}).apply(this,arguments);}
throw TypeError();}
Object.defineProperty($TypedArray$,'from',{value:function(iterable){return new this(iterable);}});Object.defineProperty($TypedArray$,'of',{value:function(){return new this(arguments);}});var $TypedArrayPrototype$={};$TypedArray$.prototype=$TypedArrayPrototype$;Object.defineProperty($TypedArray$.prototype,'_getter',{value:function(index){if(arguments.length<1)throw SyntaxError('Not enough arguments');index=ToUint32(index);if(index>=this.length)
return undefined;var bytes=[],i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1){bytes.push(this.buffer._bytes[o]);}
return this._unpack(bytes);}});Object.defineProperty($TypedArray$.prototype,'get',{value:$TypedArray$.prototype._getter});Object.defineProperty($TypedArray$.prototype,'_setter',{value:function(index,value){if(arguments.length<2)throw SyntaxError('Not enough arguments');index=ToUint32(index);if(index>=this.length)
return;var bytes=this._pack(value),i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1){this.buffer._bytes[o]=bytes[i];}}});Object.defineProperty($TypedArray$.prototype,'constructor',{value:$TypedArray$});Object.defineProperty($TypedArray$.prototype,'copyWithin',{value:function(target,start){var end=arguments[2];var o=ToObject(this);var lenVal=o.length;var len=ToUint32(lenVal);len=max(len,0);var relativeTarget=ToInt32(target);var to;if(relativeTarget<0)
to=max(len+relativeTarget,0);else
to=min(relativeTarget,len);var relativeStart=ToInt32(start);var from;if(relativeStart<0)
from=max(len+relativeStart,0);else
from=min(relativeStart,len);var relativeEnd;if(end===undefined)
relativeEnd=len;else
relativeEnd=ToInt32(end);var finalVal;if(relativeEnd<0)
finalVal=max(len+relativeEnd,0);else
finalVal=min(relativeEnd,len);var count=min(finalVal-from,len-to);var direction;if(from<to&&to<from+count){direction=-1;from=from+count-1;to=to+count-1;}else{direction=1;}
while(count>0){o._setter(to,o._getter(from));from=from+direction;to=to+direction;count=count-1;}
return o;}});Object.defineProperty($TypedArray$.prototype,'every',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisArg=arguments[1];for(var i=0;i<len;i++){if(!callbackfn.call(thisArg,t._getter(i),i,t))
return false;}
return true;}});Object.defineProperty($TypedArray$.prototype,'fill',{value:function(value){var start=arguments[1],end=arguments[2];var o=ToObject(this);var lenVal=o.length;var len=ToUint32(lenVal);len=max(len,0);var relativeStart=ToInt32(start);var k;if(relativeStart<0)
k=max((len+relativeStart),0);else
k=min(relativeStart,len);var relativeEnd;if(end===undefined)
relativeEnd=len;else
relativeEnd=ToInt32(end);var finalVal;if(relativeEnd<0)
finalVal=max((len+relativeEnd),0);else
finalVal=min(relativeEnd,len);while(k<finalVal){o._setter(k,value);k+=1;}
return o;}});Object.defineProperty($TypedArray$.prototype,'filter',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var res=[];var thisp=arguments[1];for(var i=0;i<len;i++){var val=t._getter(i);if(callbackfn.call(thisp,val,i,t))
res.push(val);}
return new this.constructor(res);}});Object.defineProperty($TypedArray$.prototype,'find',{value:function(predicate){var o=ToObject(this);var lenValue=o.length;var len=ToUint32(lenValue);if(!IsCallable(predicate))throw TypeError();var t=arguments.length>1?arguments[1]:undefined;var k=0;while(k<len){var kValue=o._getter(k);var testResult=predicate.call(t,kValue,k,o);if(Boolean(testResult))
return kValue;++k;}
return undefined;}});Object.defineProperty($TypedArray$.prototype,'findIndex',{value:function(predicate){var o=ToObject(this);var lenValue=o.length;var len=ToUint32(lenValue);if(!IsCallable(predicate))throw TypeError();var t=arguments.length>1?arguments[1]:undefined;var k=0;while(k<len){var kValue=o._getter(k);var testResult=predicate.call(t,kValue,k,o);if(Boolean(testResult))
return k;++k;}
return-1;}});Object.defineProperty($TypedArray$.prototype,'forEach',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisp=arguments[1];for(var i=0;i<len;i++)
callbackfn.call(thisp,t._getter(i),i,t);}});Object.defineProperty($TypedArray$.prototype,'indexOf',{value:function(searchElement){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(len===0)return-1;var n=0;if(arguments.length>0){n=Number(arguments[1]);if(n!==n){n=0;}else if(n!==0&&n!==(1/0)&&n!==-(1/0)){n=(n>0||-1)*floor(abs(n));}}
if(n>=len)return-1;var k=n>=0?n:max(len-abs(n),0);for(;k<len;k++){if(t._getter(k)===searchElement){return k;}}
return-1;}});Object.defineProperty($TypedArray$.prototype,'join',{value:function(separator){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var tmp=Array(len);for(var i=0;i<len;++i)
tmp[i]=t._getter(i);return tmp.join(separator===undefined?',':separator);}});Object.defineProperty($TypedArray$.prototype,'lastIndexOf',{value:function(searchElement){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(len===0)return-1;var n=len;if(arguments.length>1){n=Number(arguments[1]);if(n!==n){n=0;}else if(n!==0&&n!==(1/0)&&n!==-(1/0)){n=(n>0||-1)*floor(abs(n));}}
var k=n>=0?min(n,len-1):len-abs(n);for(;k>=0;k--){if(t._getter(k)===searchElement)
return k;}
return-1;}});Object.defineProperty($TypedArray$.prototype,'map',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var res=[];res.length=len;var thisp=arguments[1];for(var i=0;i<len;i++)
res[i]=callbackfn.call(thisp,t._getter(i),i,t);return new this.constructor(res);}});Object.defineProperty($TypedArray$.prototype,'reduce',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();if(len===0&&arguments.length===1)throw TypeError();var k=0;var accumulator;if(arguments.length>=2){accumulator=arguments[1];}else{accumulator=t._getter(k++);}
while(k<len){accumulator=callbackfn.call(undefined,accumulator,t._getter(k),k,t);k++;}
return accumulator;}});Object.defineProperty($TypedArray$.prototype,'reduceRight',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();if(len===0&&arguments.length===1)throw TypeError();var k=len-1;var accumulator;if(arguments.length>=2){accumulator=arguments[1];}else{accumulator=t._getter(k--);}
while(k>=0){accumulator=callbackfn.call(undefined,accumulator,t._getter(k),k,t);k--;}
return accumulator;}});Object.defineProperty($TypedArray$.prototype,'reverse',{value:function(){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var half=floor(len/2);for(var i=0,j=len-1;i<half;++i,--j){var tmp=t._getter(i);t._setter(i,t._getter(j));t._setter(j,tmp);}
return t;}});Object.defineProperty($TypedArray$.prototype,'set',{value:function(index,value){if(arguments.length<1)throw SyntaxError('Not enough arguments');var array,sequence,offset,len,i,s,d,byteOffset,byteLength,tmp;if(typeof arguments[0]==='object'&&arguments[0].constructor===this.constructor){array=arguments[0];offset=ToUint32(arguments[1]);if(offset+array.length>this.length){throw RangeError('Offset plus length of array is out of range');}
byteOffset=this.byteOffset+offset*this.BYTES_PER_ELEMENT;byteLength=array.length*this.BYTES_PER_ELEMENT;if(array.buffer===this.buffer){tmp=[];for(i=0,s=array.byteOffset;i<byteLength;i+=1,s+=1){tmp[i]=array.buffer._bytes[s];}
for(i=0,d=byteOffset;i<byteLength;i+=1,d+=1){this.buffer._bytes[d]=tmp[i];}}else{for(i=0,s=array.byteOffset,d=byteOffset;i<byteLength;i+=1,s+=1,d+=1){this.buffer._bytes[d]=array.buffer._bytes[s];}}}else if(typeof arguments[0]==='object'&&typeof arguments[0].length!=='undefined'){sequence=arguments[0];len=ToUint32(sequence.length);offset=ToUint32(arguments[1]);if(offset+len>this.length){throw RangeError('Offset plus length of array is out of range');}
for(i=0;i<len;i+=1){s=sequence[i];this._setter(offset+i,Number(s));}}else{throw TypeError('Unexpected argument type(s)');}}});Object.defineProperty($TypedArray$.prototype,'slice',{value:function(start,end){var o=ToObject(this);var lenVal=o.length;var len=ToUint32(lenVal);var relativeStart=ToInt32(start);var k=(relativeStart<0)?max(len+relativeStart,0):min(relativeStart,len);var relativeEnd=(end===undefined)?len:ToInt32(end);var finalVal=(relativeEnd<0)?max(len+relativeEnd,0):min(relativeEnd,len);var count=finalVal-k;var c=o.constructor;var a=new c(count);var n=0;while(k<finalVal){var kValue=o._getter(k);a._setter(n,kValue);++k;++n;}
return a;}});Object.defineProperty($TypedArray$.prototype,'some',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisp=arguments[1];for(var i=0;i<len;i++){if(callbackfn.call(thisp,t._getter(i),i,t)){return true;}}
return false;}});Object.defineProperty($TypedArray$.prototype,'sort',{value:function(comparefn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var tmp=Array(len);for(var i=0;i<len;++i)
tmp[i]=t._getter(i);if(comparefn)tmp.sort(comparefn);else tmp.sort();for(i=0;i<len;++i)
t._setter(i,tmp[i]);return t;}});Object.defineProperty($TypedArray$.prototype,'subarray',{value:function(start,end){function clamp(v,min,max){return v<min?min:v>max?max:v;}
start=ToInt32(start);end=ToInt32(end);if(arguments.length<1){start=0;}
if(arguments.length<2){end=this.length;}
if(start<0){start=this.length+start;}
if(end<0){end=this.length+end;}
start=clamp(start,0,this.length);end=clamp(end,0,this.length);var len=end-start;if(len<0){len=0;}
return new this.constructor(this.buffer,this.byteOffset+start*this.BYTES_PER_ELEMENT,len);}});function makeTypedArray(elementSize,pack,unpack){var TypedArray=function(){Object.defineProperty(this,'constructor',{value:TypedArray});$TypedArray$.apply(this,arguments);makeArrayAccessors(this);};if('__proto__'in TypedArray){TypedArray.__proto__=$TypedArray$;}else{TypedArray.from=$TypedArray$.from;TypedArray.of=$TypedArray$.of;}
TypedArray.BYTES_PER_ELEMENT=elementSize;var TypedArrayPrototype=function(){};TypedArrayPrototype.prototype=$TypedArrayPrototype$;TypedArray.prototype=new TypedArrayPrototype();Object.defineProperty(TypedArray.prototype,'BYTES_PER_ELEMENT',{value:elementSize});Object.defineProperty(TypedArray.prototype,'_pack',{value:pack});Object.defineProperty(TypedArray.prototype,'_unpack',{value:unpack});return TypedArray;}
var Int8Array=makeTypedArray(1,packI8,unpackI8);var Uint8Array=makeTypedArray(1,packU8,unpackU8);var Uint8ClampedArray=makeTypedArray(1,packU8Clamped,unpackU8);var Int16Array=makeTypedArray(2,packI16,unpackI16);var Uint16Array=makeTypedArray(2,packU16,unpackU16);var Int32Array=makeTypedArray(4,packI32,unpackI32);var Uint32Array=makeTypedArray(4,packU32,unpackU32);var Float32Array=makeTypedArray(4,packF32,unpackF32);var Float64Array=makeTypedArray(8,packF64,unpackF64);global.Int8Array=global.Int8Array||Int8Array;global.Uint8Array=global.Uint8Array||Uint8Array;global.Uint8ClampedArray=global.Uint8ClampedArray||Uint8ClampedArray;global.Int16Array=global.Int16Array||Int16Array;global.Uint16Array=global.Uint16Array||Uint16Array;global.Int32Array=global.Int32Array||Int32Array;global.Uint32Array=global.Uint32Array||Uint32Array;global.Float32Array=global.Float32Array||Float32Array;global.Float64Array=global.Float64Array||Float64Array;}());(function(){function r(array,index){return IsCallable(array.get)?array.get(index):array[index];}
var IS_BIG_ENDIAN=(function(){var u16array=new Uint16Array([0x1234]),u8array=new Uint8Array(u16array.buffer);return r(u8array,0)===0x12;}());function DataView(buffer,byteOffset,byteLength){if(!(buffer instanceof ArrayBuffer||Class(buffer)==='ArrayBuffer'))throw TypeError();byteOffset=ToUint32(byteOffset);if(byteOffset>buffer.byteLength)
throw RangeError('byteOffset out of range');if(byteLength===undefined)
byteLength=buffer.byteLength-byteOffset;else
byteLength=ToUint32(byteLength);if((byteOffset+byteLength)>buffer.byteLength)
throw RangeError('byteOffset and length reference an area beyond the end of the buffer');Object.defineProperty(this,'buffer',{value:buffer});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:byteOffset});};function makeGetter(arrayType){return function GetViewValue(byteOffset,littleEndian){byteOffset=ToUint32(byteOffset);if(byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)
throw RangeError('Array index out of range');byteOffset+=this.byteOffset;var uint8Array=new Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),bytes=[];for(var i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)
bytes.push(r(uint8Array,i));if(Boolean(littleEndian)===Boolean(IS_BIG_ENDIAN))
bytes.reverse();return r(new arrayType(new Uint8Array(bytes).buffer),0);};}
Object.defineProperty(DataView.prototype,'getUint8',{value:makeGetter(Uint8Array)});Object.defineProperty(DataView.prototype,'getInt8',{value:makeGetter(Int8Array)});Object.defineProperty(DataView.prototype,'getUint16',{value:makeGetter(Uint16Array)});Object.defineProperty(DataView.prototype,'getInt16',{value:makeGetter(Int16Array)});Object.defineProperty(DataView.prototype,'getUint32',{value:makeGetter(Uint32Array)});Object.defineProperty(DataView.prototype,'getInt32',{value:makeGetter(Int32Array)});Object.defineProperty(DataView.prototype,'getFloat32',{value:makeGetter(Float32Array)});Object.defineProperty(DataView.prototype,'getFloat64',{value:makeGetter(Float64Array)});function makeSetter(arrayType){return function SetViewValue(byteOffset,value,littleEndian){byteOffset=ToUint32(byteOffset);if(byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)
throw RangeError('Array index out of range');var typeArray=new arrayType([value]),byteArray=new Uint8Array(typeArray.buffer),bytes=[],i,byteView;for(i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)
bytes.push(r(byteArray,i));if(Boolean(littleEndian)===Boolean(IS_BIG_ENDIAN))
bytes.reverse();byteView=new Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT);byteView.set(bytes);};}
Object.defineProperty(DataView.prototype,'setUint8',{value:makeSetter(Uint8Array)});Object.defineProperty(DataView.prototype,'setInt8',{value:makeSetter(Int8Array)});Object.defineProperty(DataView.prototype,'setUint16',{value:makeSetter(Uint16Array)});Object.defineProperty(DataView.prototype,'setInt16',{value:makeSetter(Int16Array)});Object.defineProperty(DataView.prototype,'setUint32',{value:makeSetter(Uint32Array)});Object.defineProperty(DataView.prototype,'setInt32',{value:makeSetter(Int32Array)});Object.defineProperty(DataView.prototype,'setFloat32',{value:makeSetter(Float32Array)});Object.defineProperty(DataView.prototype,'setFloat64',{value:makeSetter(Float64Array)});global.DataView=global.DataView||DataView;}());}(this));
(function(){var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame'];}
if(!window.requestAnimationFrame)
window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall);},timeToCall);lastTime=currTime+timeToCall;return id;};if(!window.cancelAnimationFrame)
window.cancelAnimationFrame=function(id){clearTimeout(id);};}());
(function($){$.fn.autoGrowInput=function(o){o=$.extend({maxWidth:1000,minWidth:0,comfortZone:70,onChangeCallback:null},o);this.filter('input:text').each(function(){var minWidth=o.minWidth||$(this).width(),val='',input=$(this),testSubject=$('<tester/>').css({position:'absolute',top:-9999,left:-9999,width:'auto',fontSize:input.css('fontSize'),fontFamily:input.css('fontFamily'),fontWeight:input.css('fontWeight'),letterSpacing:input.css('letterSpacing'),whiteSpace:'nowrap'}),check=function(){if(val===(val=input.val())){return;}
var escaped=val.replace(/&/g,'&amp;').replace(/\s/g,'&nbsp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');testSubject.html(escaped);var testerWidth=testSubject.width(),newWidth=(testerWidth+o.comfortZone)>=minWidth?testerWidth+o.comfortZone:minWidth,currentWidth=input.width(),isValidWidthChange=(newWidth<currentWidth&&newWidth>=minWidth)||(newWidth>minWidth&&newWidth<o.maxWidth);if(isValidWidthChange){input.width(newWidth);if(o.onChangeCallback){o.onChangeCallback(newWidth);}}};testSubject.insertAfter(input);$(this).bind('keyup keydown blur update',check);});return this;};})(jQuery);
var Observable=function(){this.observers={};};Observable=stjs.extend(Observable,null,[],function(constructor,prototype){prototype.observers=null;prototype.attach=function(observer){if(observer!=null){this.observers[observer.getId()]=observer;}};prototype.detach=function(observer){if(observer!=null){delete this.observers[observer.getId()];}};prototype.notifyObservers=function(newData){for(var observerId in this.observers){var observer=this.observers[observerId];if(observer!=null){observer.update(newData);}}};prototype.detachAll=function(){this.observers={};};},{observers:{name:"Map",arguments:[null,"Observer"]}},{});
var Observer=function(){};Observer=stjs.extend(Observer,null,[],function(constructor,prototype){prototype.getId=function(){};prototype.update=function(newData){};},{},{});
var ChartOption=function(){};ChartOption=stjs.extend(ChartOption,null,[],function(constructor,prototype){constructor.Implementation=stjs.enumeration("CANVAS");constructor.DEFAULT=ChartOption.Implementation.CANVAS;constructor.NORMAL_BAR="normal";constructor.INVERSE_NEGATIVE_BAR="inverse_negative";prototype.implementation=null;prototype.type=null;prototype.colorStrategy=null;prototype.volumeColorStrategy=null;prototype.aggregationStrategy=null;prototype.xAxisPosition=null;prototype.y1AxisPosition=null;prototype.y2AxisPosition=null;prototype.mainAxisMinMax=null;prototype.labelFont=null;prototype.bigLabelFontSize=0;prototype.normalLabelFontSize=0;prototype.smallLabelFontSize=0;prototype.adaptedLabelFontSize=0;prototype.interactionModel=null;prototype.styleModel=null;prototype.engineModel=null;prototype.layout=null;prototype.volumeAxisPosition=null;prototype.addYesterday=false;prototype.volumeHeightRatio=0.0;prototype.graphsHalfSpacing=0;prototype.showYesterday=false;prototype.showValueInTitle=false;prototype.titleType=null;prototype.displayAtStartup=false;prototype.showIndicatorsDescriptions=false;prototype.popOverAllowed=false;prototype.zoomIconSize=0;prototype.dynamicXAxisData=false;prototype.widthParam=null;prototype.autorefreshIntervalSeconds=null;prototype.focusable=false;prototype.period=null;prototype.frequency=null;prototype.mainSerieField=null;prototype.xAxisField=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParams=null;prototype.oddLinesColor=null;prototype.oddLinesColorGradientParams=null;prototype.evenLinesColor=null;prototype.evenLinesColorGradientParams=null;prototype.gridColor=null;prototype.gridColorGradientParams=null;prototype.yesterdayLineColor=null;prototype.yesterdayLineColorGradientParams=null;prototype.tickTextColor=null;prototype.tickTextColorGradientParams=null;prototype.tickColor=null;prototype.tickColorGradientParams=null;prototype.borderColor=null;prototype.borderColorGradientParams=null;prototype.areaContourColor=null;prototype.zoomAreaColor=null;prototype.zoomAreaColorGradientParam=null;prototype.textColor=null;prototype.volumeLabelColor=null;prototype.chartPaddingLeftPercent=0.0;prototype.chartPaddingTopPercent=0.0;prototype.chartPaddingRightPercent=0.0;prototype.chartPaddingBottomPercent=0.0;prototype.chartMarginLeftPercent=0.0;prototype.chartMarginTopPercent=0.0;prototype.chartMarginRightPercent=0.0;prototype.chartMarginBottomPercent=0.0;prototype.chartBorderLeft=0;prototype.chartBorderTop=0;prototype.chartBorderRight=0;prototype.chartBorderBottom=0;prototype.gridStyle=null;prototype.showToolTip=false;prototype.showTitle=false;prototype.titleColor=null;prototype.showYAxisTicks=false;prototype.showXAxisTicks=false;prototype.yAxisTicksColor=null;prototype.xAxisTicksColor=null;prototype.labelHighlightColor=null;prototype.xAxisFormatter=null;prototype.y1AxisFormatter=null;prototype.y2AxisFormatter=null;prototype.xLabelsValuesScale=0.0;prototype.yLabelsValuesScale=0.0;prototype.xHighlightLabelFormat=null;prototype.yHighlightLabelFormat=null;prototype.allowOverlayDrawing=false;prototype.highlightLineColor=null;prototype.copyrightColor=null;prototype.dataFormat=null;prototype.showVolume=false;prototype.stocks=null;prototype.url=null;prototype.urls=null;prototype.data=null;prototype.dataType=null;prototype.stretchLeftSide=false;prototype.stretchRightSide=false;prototype.minimumZoomFactor=0.0;prototype.animateChart=false;prototype.animationTime=0.0;prototype.highlightType=null;prototype.barType=null;prototype.yesterdayLineDashed=false;prototype.showCopyright=false;prototype.title=null;prototype.alternateTitle=null;prototype.copyrightPosition=null;prototype.showLegend=false;prototype.legendPosition=null;prototype.legendAreaPostion=null;prototype.roundNumbers=false;prototype.font=null;prototype.showBorder=false;prototype.zoomType=null;prototype.rangeSelector=null;prototype.panEnabled=false;prototype.mode=null;prototype.startScale=null;prototype.providerClass=null;prototype.reloadFunctionId=null;prototype.columnsRelativeWidth=null;prototype._styleModel=null;prototype._engineModel=null;prototype.defaultHistoColor=null;prototype.labelHighlightTextColor=null;prototype.intradayMultipartResponseAllowed=false;prototype.intradayResponseLineOffset=0;constructor.getDefault=function(){var chartConfig=new ChartOption();chartConfig.colorStrategy=ColorStrategy.GREEN_RED;chartConfig.volumeColorStrategy=ColorStrategy.GREEN_RED;chartConfig.aggregationStrategy=AggregationStrategy.MIN_MAX;chartConfig.volumeAxisPosition=Layout.Position.LEFT;chartConfig.xAxisPosition=Layout.Position.BOTTOM;chartConfig.y1AxisPosition=Layout.Position.RIGHT;chartConfig.y2AxisPosition=Layout.Position.LEFT;chartConfig.labelHighlightColor=ChartColor.lightYellow;chartConfig.mainAxisMinMax=null;chartConfig.legendAreaPostion=Layout.Position.BOTTOM;chartConfig.bigLabelFontSize=14;chartConfig.normalLabelFontSize=12;chartConfig.smallLabelFontSize=11;chartConfig.labelFont="Arial";chartConfig.interactionModel=AbstractInteractionModel.getDefaultFromDevice();chartConfig.gridColor=ChartColor.grey;chartConfig.gridColorGradientParams=null;chartConfig.chartPaddingLeftPercent=1.5;chartConfig.chartPaddingTopPercent=3;chartConfig.chartPaddingRightPercent=1.5;chartConfig.chartPaddingBottomPercent=3;chartConfig.chartMarginLeftPercent=0;chartConfig.chartMarginTopPercent=0;chartConfig.chartMarginRightPercent=0;chartConfig.chartMarginBottomPercent=0;chartConfig.chartBorderLeft=1;chartConfig.chartBorderTop=1;chartConfig.chartBorderRight=1;chartConfig.chartBorderBottom=1;chartConfig.gridStyle=GraphStyle.CLASSIC_GRID_STYLE;chartConfig.mainSerieField=Serie.Y;chartConfig.xAxisField=Serie.X;chartConfig.dynamicXAxisData=true;chartConfig.minimumZoomFactor=4;chartConfig.stretchLeftSide=false;chartConfig.stretchRightSide=true;chartConfig.xLabelsValuesScale=DateUtil.MS_MINUTE;chartConfig.yLabelsValuesScale=0.01;chartConfig.showTitle=true;chartConfig.showCopyright=true;chartConfig.animateChart=false;chartConfig.showValueInTitle=true;chartConfig.titleType=null;chartConfig.showYAxisTicks=true;chartConfig.showXAxisTicks=false;chartConfig.showIndicatorsDescriptions=true;chartConfig.dataType="indexed";chartConfig.yAxisTicksColor=ChartColor.red;chartConfig.xAxisTicksColor=ChartColor.red;chartConfig.animationTime=1000;chartConfig.providerClass="";chartConfig.highlightType=GraphStyle.LINES_HIGHLIGHT+GraphStyle.CIRCLE_HIGHLIGHT;chartConfig.barType=ChartOption.NORMAL_BAR;chartConfig.displayAtStartup=true;chartConfig.popOverAllowed=true;chartConfig.type="LINE";chartConfig.zoomIconSize=10;chartConfig.widthParam="1000";chartConfig.autorefreshIntervalSeconds=null;chartConfig.allowOverlayDrawing=false;chartConfig.zoomAreaColor=ChartColor.lightOrangeTransparent;chartConfig.textColor=ChartColor.black;chartConfig.titleColor=ChartColor.orange;chartConfig.showYesterday=true;chartConfig.graphsHalfSpacing=2;chartConfig.volumeHeightRatio=0.35;chartConfig.showVolume=true;chartConfig.columnsRelativeWidth=[0.37,0.19,0.19,0.25];chartConfig.showToolTip=false;chartConfig.showLegend=false;chartConfig.yesterdayLineDashed=true;chartConfig.yesterdayLineColor=ChartColor.orange;chartConfig.addYesterday=false;chartConfig.roundNumbers=false;chartConfig.font="Georgia";chartConfig.tickTextColor=ChartColor.black;chartConfig.tickColor=ChartColor.grey;chartConfig.defaultHistoColor=ChartColor.orange;chartConfig.showBorder=false;chartConfig.implementation=ChartOption.DEFAULT;chartConfig.areaContourColor=null;chartConfig.labelHighlightTextColor=ChartColor.black;chartConfig.volumeLabelColor=ChartColor.black;chartConfig.xAxisFormatter=new DateTimeFormatter();chartConfig.y1AxisFormatter=new AbbreviateNumberFormatter();chartConfig.y2AxisFormatter=new PercentNumberFormatter();chartConfig.styleModel=new DefaultStyleModel();chartConfig.layout=new DefaultLayout();chartConfig.engineModel=new DefaultEngineModel();chartConfig.highlightLineColor=null;chartConfig.copyrightColor=null;chartConfig.intradayMultipartResponseAllowed=true;chartConfig.intradayResponseLineOffset=1;return chartConfig;};prototype.getLabelHighlightTextColor=function(){return this.labelHighlightTextColor;};prototype.setLabelHighlightTextColor=function(labelHighlightTextColor){this.labelHighlightTextColor=labelHighlightTextColor;};constructor.extend=function(userDefined){var customStyleModel=null;var customEngineModel=null;if(userDefined!=null){if(userDefined.styleModel!=null){customStyleModel=userDefined.styleModel;delete userDefined.styleModel;}
if(userDefined.engineModel!=null){customEngineModel=userDefined.engineModel;delete userDefined.engineModel;}}
var fullConfig=new ChartOption();fullConfig=SQW.$.extend(fullConfig,ChartOption.getDefault(),userDefined);if(customStyleModel!=null){fullConfig._styleModel=customStyleModel;userDefined.styleModel=customStyleModel;}
if(customEngineModel!=null){fullConfig._engineModel=customEngineModel;userDefined.engineModel=customEngineModel;}
return fullConfig;};constructor.getConfigFromCSS=function(){return null;};prototype.getHighlightLineColor=function(){return this.highlightLineColor;};prototype.getCopyrightColor=function(){return this.copyrightColor;};prototype.setHighlightLineColor=function(highlightLineColor){this.highlightLineColor=highlightLineColor;};prototype.setCopyrightColor=function(copyrightColor){this.copyrightColor=copyrightColor;};prototype.getColorStrategy=function(){return this.colorStrategy;};prototype.setColorStrategy=function(colorStrategy){this.colorStrategy=colorStrategy;};prototype.getZoomType=function(){return this.zoomType;};prototype.setZoomType=function(zoomType){this.zoomType=zoomType;};prototype.getRangeSelector=function(){return this.rangeSelector;};prototype.setRangeSelector=function(rangeSelector){this.rangeSelector=rangeSelector;};prototype.getAggregationStrategy=function(){return this.aggregationStrategy;};prototype.setAggregationStrategy=function(aggregationStrategy){this.aggregationStrategy=aggregationStrategy;};prototype.isPanEnabled=function(){return this.panEnabled;};prototype.setPanEnabled=function(panEnabled){this.panEnabled=panEnabled;};prototype.getXAxisPosition=function(){return this.xAxisPosition;};prototype.setXAxisPosition=function(xAxisPosition){this.xAxisPosition=xAxisPosition;};prototype.getY1AxisPosition=function(){return this.y1AxisPosition;};prototype.setY1AxisPosition=function(y1AxisPosition){this.y1AxisPosition=y1AxisPosition;};prototype.getY2AxisPosition=function(){return this.y2AxisPosition;};prototype.setY2AxisPosition=function(y2AxisPosition){this.y2AxisPosition=y2AxisPosition;};prototype.getLabelFont=function(){return this.labelFont;};prototype.setLabelFont=function(labelFont){this.labelFont=labelFont;};prototype.getNormalLabelFontSize=function(){return this.normalLabelFontSize;};prototype.setNormalLabelFontSize=function(normalLabelFontSize){this.normalLabelFontSize=normalLabelFontSize;};prototype.getSmallLabelFontSize=function(){return this.smallLabelFontSize;};prototype.setSmallLabelFontSize=function(smallLabelFontSize){this.smallLabelFontSize=smallLabelFontSize;};prototype.getBigLabelFontSize=function(){return this.bigLabelFontSize;};prototype.setBigLabelFontSize=function(bigLabelFontSize){this.bigLabelFontSize=bigLabelFontSize;};prototype.getInteractionModel=function(){return this.interactionModel;};prototype.setInteractionModel=function(interactionModel){this.interactionModel=interactionModel;};prototype.getPeriod=function(){return this.period;};prototype.setPeriod=function(period){this.period=period;};prototype.getFrequency=function(){return this.frequency;};prototype.setFrequency=function(frequency){this.frequency=frequency;};prototype.getMode=function(){if(this.mode!=null&&!this.mode.isEmpty()){return this.mode;}
var periodInstance=Period.getInstance(this.period,this.frequency);if(periodInstance.isIntraday()){return Period.INTRADAY;}
return Period.HISTO;};prototype.setMode=function(mode){this.mode=mode;};prototype.getStartScale=function(){return this.startScale;};prototype.setStartScale=function(startScale){this.startScale=startScale;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParams=function(){return this.backgroundColorGradientParams;};prototype.setBackgroundColorGradientParams=function(backgroundColorGradientParams){this.backgroundColorGradientParams=backgroundColorGradientParams;};prototype.getOddLinesColorGradientParams=function(){return this.oddLinesColorGradientParams;};prototype.setOddLinesColorGradientParams=function(oddLinesColorGradientParams){this.oddLinesColorGradientParams=oddLinesColorGradientParams;};prototype.getEvenLinesColorGradientParams=function(){return this.evenLinesColorGradientParams;};prototype.setEvenLinesColorGradientParams=function(evenLinesColorGradientParams){this.evenLinesColorGradientParams=evenLinesColorGradientParams;};prototype.getGridColorGradientParams=function(){return this.gridColorGradientParams;};prototype.setGridColorGradientParams=function(gridColorGradientParams){this.gridColorGradientParams=gridColorGradientParams;};prototype.getYesterdayLineColorGradientParams=function(){return this.yesterdayLineColorGradientParams;};prototype.setYesterdayLineColorGradientParams=function(yesterdayLineColorGradientParams){this.yesterdayLineColorGradientParams=yesterdayLineColorGradientParams;};prototype.isAddYesterday=function(){return this.addYesterday;};prototype.setAddYesterday=function(addYesterday){this.addYesterday=addYesterday;};prototype.getTickTextColorGradientParams=function(){return this.tickTextColorGradientParams;};prototype.setTickTextColorGradientParams=function(tickTextColorGradientParams){this.tickTextColorGradientParams=tickTextColorGradientParams;};prototype.getTickColorGradientParams=function(){return this.tickColorGradientParams;};prototype.setTickColorGradientParams=function(tickColorGradientParams){this.tickColorGradientParams=tickColorGradientParams;};prototype.getBorderColorGradientParams=function(){return this.borderColorGradientParams;};prototype.setBorderColorGradientParams=function(borderColorGradientParams){this.borderColorGradientParams=borderColorGradientParams;};prototype.getGridStyle=function(){return this.gridStyle;};prototype.setGridStyle=function(gridStyle){this.gridStyle=gridStyle;};prototype.getOddLinesColor=function(){return this.oddLinesColor;};prototype.setOddLinesColor=function(oddLinesColor){this.oddLinesColor=oddLinesColor;};prototype.getEvenLinesColor=function(){return this.evenLinesColor;};prototype.setEvenLinesColor=function(evenLinesColor){this.evenLinesColor=evenLinesColor;};prototype.getGridColor=function(){return this.gridColor;};prototype.setGridColor=function(gridColor){this.gridColor=gridColor;};prototype.isShowTitle=function(){return this.showTitle;};prototype.setShowTitle=function(showTitle){this.showTitle=showTitle;};prototype.isShowCopyright=function(){return this.showCopyright;};prototype.setShowCopyright=function(showCopyright){this.showCopyright=showCopyright;};prototype.getCopyrightPosition=function(){return this.copyrightPosition;};prototype.setCopyrightPosition=function(copyrightPosition){this.copyrightPosition=copyrightPosition;};prototype.isShowLegend=function(){return this.showLegend;};prototype.setShowLegend=function(showLegend){this.showLegend=showLegend;};prototype.getLegendPosition=function(){return this.legendPosition;};prototype.setLegendPosition=function(legendPosition){this.legendPosition=legendPosition;};prototype.getYesterdayLineColor=function(){return this.yesterdayLineColor;};prototype.setYesterdayLineColor=function(yesterdayLineColor){this.yesterdayLineColor=yesterdayLineColor;};prototype.isYesterdayLineDashed=function(){return this.yesterdayLineDashed;};prototype.setYesterdayLineDashed=function(yesterdayLineDashed){this.yesterdayLineDashed=yesterdayLineDashed;};prototype.isRoundNumbers=function(){return this.roundNumbers;};prototype.setRoundNumbers=function(roundNumbers){this.roundNumbers=roundNumbers;};prototype.getFont=function(){return this.font;};prototype.setFont=function(font){this.font=font;};prototype.getTickTextColor=function(){return this.tickTextColor;};prototype.setTickTextColor=function(tickTextColor){this.tickTextColor=tickTextColor;};prototype.getTickColor=function(){return this.tickColor;};prototype.setTickColor=function(tickColor){this.tickColor=tickColor;};prototype.isShowBorder=function(){return this.showBorder;};prototype.setShowBorder=function(showBorder){this.showBorder=showBorder;};prototype.getBorderColor=function(){return this.borderColor;};prototype.setBorderColor=function(borderColor){this.borderColor=borderColor;};prototype.getImplementation=function(){return this.implementation;};prototype.setImplementation=function(implementation){this.implementation=implementation;};prototype.getChartPaddingLeftPercent=function(){return this.chartPaddingLeftPercent;};prototype.setChartPaddingLeftPercent=function(chartPaddingLeftPercent){this.chartPaddingLeftPercent=chartPaddingLeftPercent;};prototype.getChartPaddingTopPercent=function(){return this.chartPaddingTopPercent;};prototype.setChartPaddingTopPercent=function(chartPaddingTopPercent){this.chartPaddingTopPercent=chartPaddingTopPercent;};prototype.getChartPaddingRightPercent=function(){return this.chartPaddingRightPercent;};prototype.setChartPaddingRightPercent=function(chartPaddingRightPercent){this.chartPaddingRightPercent=chartPaddingRightPercent;};prototype.getChartPaddingBottomPercent=function(){return this.chartPaddingBottomPercent;};prototype.setChartPaddingBottomPercent=function(chartPaddingBottomPercent){this.chartPaddingBottomPercent=chartPaddingBottomPercent;};prototype.getMainSerieField=function(){return this.mainSerieField;};prototype.setMainSerieField=function(mainSerieField){this.mainSerieField=mainSerieField;};prototype.getChartMarginLeftPercent=function(){return this.chartMarginLeftPercent;};prototype.setChartMarginLeftPercent=function(chartMarginLeftPercent){this.chartMarginLeftPercent=chartMarginLeftPercent;};prototype.getChartMarginTopPercent=function(){return this.chartMarginTopPercent;};prototype.setChartMarginTopPercent=function(chartMarginTopPercent){this.chartMarginTopPercent=chartMarginTopPercent;};prototype.getChartMarginRightPercent=function(){return this.chartMarginRightPercent;};prototype.setChartMarginRightPercent=function(chartMarginRightPercent){this.chartMarginRightPercent=chartMarginRightPercent;};prototype.getChartMarginBottomPercent=function(){return this.chartMarginBottomPercent;};prototype.setChartMarginBottomPercent=function(chartMarginBottomPercent){this.chartMarginBottomPercent=chartMarginBottomPercent;};prototype.getChartBorderLeft=function(){return this.chartBorderLeft;};prototype.setChartBorderLeft=function(chartBorderLeft){this.chartBorderLeft=chartBorderLeft;};prototype.getChartBorderTop=function(){return this.chartBorderTop;};prototype.setChartBorderTop=function(chartBorderTop){this.chartBorderTop=chartBorderTop;};prototype.getChartBorderRight=function(){return this.chartBorderRight;};prototype.setChartBorderRight=function(chartBorderRight){this.chartBorderRight=chartBorderRight;};prototype.getChartBorderBottom=function(){return this.chartBorderBottom;};prototype.setChartBorderBottom=function(chartBorderBottom){this.chartBorderBottom=chartBorderBottom;};prototype.getHighlightType=function(){return this.highlightType;};prototype.setHighlightType=function(highlightType){this.highlightType=highlightType;};prototype.getUrl=function(){return this.url;};prototype.setUrl=function(url){this.url=url;};prototype.getUrls=function(){return this.urls;};prototype.setUrls=function(urls){this.urls=urls;};prototype.getData=function(){return this.data;};prototype.setData=function(data){this.data=data;};prototype.getXAxisField=function(){return this.xAxisField;};prototype.setXAxisField=function(xAxisField){this.xAxisField=xAxisField;};prototype.getXAxisFormatter=function(){return this.xAxisFormatter;};prototype.setxAxisFormatter=function(xAxisFormatter){this.xAxisFormatter=xAxisFormatter;};prototype.getY1AxisFormatter=function(){return this.y1AxisFormatter;};prototype.setY1AxisFormatter=function(y1AxisFormatter){this.y1AxisFormatter=y1AxisFormatter;};prototype.getY2AxisFormatter=function(){return this.y2AxisFormatter;};prototype.setY2AxisFormatter=function(y2AxisFormatter){this.y2AxisFormatter=y2AxisFormatter;};prototype.getMinimumZoomFactor=function(){return this.minimumZoomFactor;};prototype.setMinimumZoomFactor=function(minimumZoomFactor){this.minimumZoomFactor=minimumZoomFactor;};prototype.isStretchLeftSide=function(){return this.stretchLeftSide;};prototype.setStretchLeftSide=function(stretchLeftSide){this.stretchLeftSide=stretchLeftSide;};prototype.isStretchRightSide=function(){return this.stretchRightSide;};prototype.setStretchRightSide=function(stretchRightSide){this.stretchRightSide=stretchRightSide;};prototype.getXHighlightLabelFormat=function(){return this.xHighlightLabelFormat;};prototype.setXHighlightLabelFormat=function(xHighlightLabelFormat){this.xHighlightLabelFormat=xHighlightLabelFormat;};prototype.setAnimateChart=function(animateChart){this.animateChart=animateChart;};prototype.isAnimateChart=function(){return this.animateChart;};prototype.setAnimationTime=function(animationTime){this.animationTime=animationTime;};prototype.getAnimationTime=function(){return this.animationTime;};prototype.getProviderName=function(){return this.providerClass;};prototype.setProviderClass=function(providerClass){this.providerClass=providerClass;};prototype.getVolumeHeightRatio=function(){return this.volumeHeightRatio;};prototype.setVolumeHeightRatio=function(volumeHeightRatio){this.volumeHeightRatio=volumeHeightRatio;};prototype.getGraphsHalfSpacing=function(){return this.graphsHalfSpacing;};prototype.setGraphsHalfSpacing=function(graphsHalfSpacing){this.graphsHalfSpacing=graphsHalfSpacing;};prototype.getVolumeAxisPosition=function(){return this.volumeAxisPosition;};prototype.setVolumeAxisPosition=function(volumeAxisPosition){this.volumeAxisPosition=volumeAxisPosition;};prototype.isShowYesterday=function(){return this.showYesterday;};prototype.setShowYesterday=function(showYesterday){this.showYesterday=showYesterday;};prototype.isShowVolume=function(){return this.showVolume;};prototype.setShowVolume=function(showVolume){this.showVolume=showVolume;};prototype.getBarType=function(){return this.barType;};prototype.setBarType=function(barType){this.barType=barType;};prototype.getTitleColor=function(){return this.titleColor;};prototype.setTitleColor=function(titleColor){this.titleColor=titleColor;};prototype.isShowValueInTitle=function(){return this.showValueInTitle;};prototype.setShowValueInTitle=function(showValueInTitle){this.showValueInTitle=showValueInTitle;};prototype.isShowYAxisTicks=function(){return this.showYAxisTicks;};prototype.isShowXAxisTicks=function(){return this.showXAxisTicks;};prototype.setShowXAxisTicks=function(showXAxisTicks){this.showXAxisTicks=showXAxisTicks;};prototype.getYAxisTicksColor=function(){return this.yAxisTicksColor;};prototype.setYAxisTicksColor=function(yAxisTicksColor){this.yAxisTicksColor=yAxisTicksColor;};prototype.getXAxisTicksColor=function(){return this.xAxisTicksColor;};prototype.setXAxisTicksColor=function(xAxisTicksColor){this.xAxisTicksColor=xAxisTicksColor;};prototype.getRawDataType=function(){return this.dataType;};prototype.setRawDataType=function(dataType){this.dataType=dataType;};prototype.getStyleModel=function(){return this.styleModel;};prototype.setStyleModel=function(styleModel){this.styleModel=styleModel;};prototype.getEngineModel=function(){return this.engineModel;};prototype.setEngineModel=function(engineModel){this.engineModel=engineModel;};prototype.getDataProvider=function(){return DataProviderFactory.getInstance().getProvider(this);};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.getLayout=function(){return this.layout;};prototype.setLayout=function(layout){this.layout=layout;};prototype.isDisplayAtStartup=function(){return this.displayAtStartup;};prototype.setDisplayAtStartup=function(displayAtStartup){this.displayAtStartup=displayAtStartup;};prototype.getTitle=function(){return this.title;};prototype.setTitle=function(title){this.title=title;};prototype.getAlternateTitle=function(){return this.alternateTitle;};prototype.setAlternateTitle=function(alternateTitle){this.alternateTitle=alternateTitle;};prototype.isPopOverAllowed=function(){return this.popOverAllowed;};prototype.setPopOverAllowed=function(popOverAllowed){this.popOverAllowed=popOverAllowed;};prototype.getZoomIconSize=function(){return this.zoomIconSize;};prototype.setZoomIconSize=function(zoomIconSize){this.zoomIconSize=zoomIconSize;};prototype.getWidthParam=function(){return this.widthParam;};prototype.setWidthParam=function(widthParam){this.widthParam=widthParam;};prototype.isShowToolTip=function(){return this.showToolTip;};prototype.setShowToolTip=function(showToolTip){this.showToolTip=showToolTip;};prototype.setShowYAxisTicks=function(showYAxisTicks){this.showYAxisTicks=showYAxisTicks;};prototype.getStocks=function(){return this.stocks;};prototype.setStocks=function(stocks){this.stocks=stocks;};prototype.getLegendAreaPostion=function(){return this.legendAreaPostion;};prototype.setLegendAreaPostion=function(legendAreaPostion){this.legendAreaPostion=legendAreaPostion;};prototype.isDynamicXAxisData=function(){return this.dynamicXAxisData;};prototype.setDynamicXAxisData=function(dynamicXAxisData){this.dynamicXAxisData=dynamicXAxisData;};prototype.getReloadFunctionId=function(){return this.reloadFunctionId;};prototype.getAutorefreshIntervalSeconds=function(){return this.autorefreshIntervalSeconds;};prototype.setAutorefreshIntervalSeconds=function(autorefreshInterval){this.autorefreshIntervalSeconds=autorefreshInterval;};prototype.getTitleType=function(){return this.titleType;};prototype.setTitleType=function(titleType){this.titleType=titleType;};prototype.setColumnsRelativeWidth=function(columnsRelativeWidth){this.columnsRelativeWidth=columnsRelativeWidth;};prototype.getColumnsRelativeWidth=function(){return this.columnsRelativeWidth;};prototype.isAllowOverlayDrawing=function(){return this.allowOverlayDrawing;};prototype.setAllowOverlayDrawing=function(allowOverlayDrawing){this.allowOverlayDrawing=allowOverlayDrawing;};prototype.getZoomAreaColor=function(){return this.zoomAreaColor;};prototype.setZoomAreaColor=function(zoomAreaColor){this.zoomAreaColor=zoomAreaColor;};prototype.getZoomAreaColorGradientParam=function(){return this.zoomAreaColorGradientParam;};prototype.setZoomAreaColorGradientParam=function(zoomAreaColorGradientParam){this.zoomAreaColorGradientParam=zoomAreaColorGradientParam;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getCustomStyleModel=function(){return this._styleModel;};prototype.getCustomEngineModel=function(){return this._engineModel;};prototype.setCustomeStyleModel=function(customStyleModel){this._styleModel=customStyleModel;};prototype.setCustomeEngineModel=function(customEngineModel){this._engineModel=customEngineModel;};prototype.getMainAxisMinMax=function(){return this.mainAxisMinMax;};prototype.setMainAxisMinMax=function(mainAxisMinMax){this.mainAxisMinMax=mainAxisMinMax;};prototype.getDefaultHistoColor=function(){return this.defaultHistoColor;};prototype.setDefaultHistoColor=function(defaultHistoColor){this.defaultHistoColor=defaultHistoColor;};prototype.getLabelHighlightColor=function(){return this.labelHighlightColor;};prototype.setLabelHighlightColor=function(labelHighlightColor){this.labelHighlightColor=labelHighlightColor;};prototype.getVolumeColorStrategy=function(){return this.volumeColorStrategy;};prototype.getVolumeLabelColor=function(){return this.volumeLabelColor;};prototype.setVolumeLabelColor=function(volumeLabelColor){this.volumeLabelColor=volumeLabelColor;};prototype.setVolumeColorStrategy=function(volumeColorStrategy){this.volumeColorStrategy=volumeColorStrategy;};prototype.isShowIndicatorsDescriptions=function(){return this.showIndicatorsDescriptions;};prototype.setShowIndicatorsDescriptions=function(showIndicatorsDescriptions){this.showIndicatorsDescriptions=showIndicatorsDescriptions;};prototype.getAreaContourColor=function(){return this.areaContourColor;};prototype.setAreaContourColor=function(areaContourColor){this.areaContourColor=areaContourColor;};prototype.isIntradayMultipartResponseAllowed=function(){return this.intradayMultipartResponseAllowed;};prototype.getIntradayResponseLineOffset=function(){return this.intradayResponseLineOffset;};prototype.setIntradayMultipartResponseAllowed=function(intradayMultipartResponseAllowed){this.intradayMultipartResponseAllowed=intradayMultipartResponseAllowed;};prototype.setIntradayResponseLineOffset=function(intradayResponseLineOffset){this.intradayResponseLineOffset=intradayResponseLineOffset;};},{DEFAULT:{name:"Enum",arguments:["ChartOption.Implementation"]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},colorStrategy:"ColorStrategy",volumeColorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},xAxisPosition:{name:"Enum",arguments:["Layout.Position"]},y1AxisPosition:{name:"Enum",arguments:["Layout.Position"]},y2AxisPosition:{name:"Enum",arguments:["Layout.Position"]},mainAxisMinMax:{name:"Array",arguments:[null]},interactionModel:"AbstractInteractionModel",styleModel:"StyleModel",engineModel:"EngineModel",layout:"Layout",volumeAxisPosition:{name:"Enum",arguments:["Layout.Position"]},backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]},oddLinesColor:"ChartColor",oddLinesColorGradientParams:{name:"Array",arguments:[null]},evenLinesColor:"ChartColor",evenLinesColorGradientParams:{name:"Array",arguments:[null]},gridColor:"ChartColor",gridColorGradientParams:{name:"Array",arguments:[null]},yesterdayLineColor:"ChartColor",yesterdayLineColorGradientParams:{name:"Array",arguments:[null]},tickTextColor:"ChartColor",tickTextColorGradientParams:{name:"Array",arguments:[null]},tickColor:"ChartColor",tickColorGradientParams:{name:"Array",arguments:[null]},borderColor:"ChartColor",borderColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",zoomAreaColor:"ChartColor",zoomAreaColorGradientParam:{name:"Array",arguments:[null]},textColor:"ChartColor",volumeLabelColor:"ChartColor",titleColor:"ChartColor",yAxisTicksColor:"ChartColor",xAxisTicksColor:"ChartColor",labelHighlightColor:"ChartColor",xAxisFormatter:"Formatter",y1AxisFormatter:"Formatter",y2AxisFormatter:"Formatter",highlightLineColor:"ChartColor",copyrightColor:"ChartColor",stocks:{name:"Array",arguments:["Stock"]},urls:{name:"Array",arguments:[null]},data:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},copyrightPosition:{name:"Array",arguments:[null]},legendPosition:{name:"Array",arguments:[null]},legendAreaPostion:{name:"Enum",arguments:["Layout.Position"]},zoomType:{name:"Map",arguments:[null,null]},rangeSelector:{name:"Map",arguments:[null,"Object"]},startScale:{name:"Array",arguments:[null]},columnsRelativeWidth:{name:"Array",arguments:[null]},_styleModel:"StyleModel",_engineModel:"EngineModel",defaultHistoColor:"ChartColor",labelHighlightTextColor:"ChartColor"},{});
var Chart=function(parentElement,optionParams){this.id=new Date().getTime()+"_chart_"+Math.round((Math.random()*100000));this.renderCallbacks={};this.init(parentElement,optionParams);if(Chart.charts==null){Chart.charts={};}
Chart.charts[this.id]=this;};Chart=stjs.extend(Chart,null,[Observer],function(constructor,prototype){constructor.ChartType=stjs.enumeration("POINT","LINE","AREA","BAR","HLOC","HL_AREA","CANDLESTICK","BID_ASK","NONE","PIE");constructor.charts=null;prototype.relatedCharts=null;prototype.renderCallbacks=null;prototype.parentElement=null;prototype.id=null;prototype.title=null;prototype.chartType=null;prototype.engineModel=null;prototype.data=null;prototype.chartView=null;prototype.interactionModel=null;prototype.options=null;prototype.init=function(parentElement,optionParams){this.options=this.getExtendedOption(optionParams);this.parentElement=parentElement;this.title=this.options.getTitle();this.chartType=Chart.ChartType.valueOf(this.options.getType());if(this.chartType==null){this.chartType=Chart.ChartType.LINE;}
this.relatedCharts={};};prototype.getExtendedOption=function(optionParams){return ChartOption.extend(optionParams);};prototype.render=function(xRange){};prototype.reRender=function(){};prototype.onResize=function(triggerRender){};prototype.resize=function(width,height){};prototype.refresh=function(){};prototype.reset=function(){};prototype.pause=function(){};prototype.unpause=function(){};prototype.openPopOver=function(){};prototype.setChartType=function(chartTypeString){};prototype.reattachTo=function(newParenDiv){};prototype.addRelatedChart=function(chart,reflexive){if(chart==null){return;}
var key=chart.getId();if(this.relatedCharts[key]==null){this.relatedCharts[key]=chart;}
if(reflexive){chart.addRelatedChart(this,false);}};prototype.removeChart=function(){if(Chart.charts[this.id]!=null){AbstractInteractionModel.unregisterModelOn(this.interactionModel,this.parentElement);delete Chart.charts[this.id];}};prototype.removeRelatedChart=function(chart,reflexive){if(chart==null){return;}
var key=chart.getId();delete this.relatedCharts[key];if(reflexive){chart.removeRelatedChart(this,false);}};prototype.isChartRendered=function(){};prototype.isPanning=function(){};prototype.startPan=function(offsetX,offsetY){};prototype.movePan=function(offsetX,offsetY){};prototype.endPan=function(offsetX,offsetY){};prototype.setZoomLevel=function(zoomLevel){};prototype.setZoomHistory=function(zoomHistory){};prototype.isZooming=function(){};prototype.isZoomStarted=function(){};prototype.startZoom=function(offsetX,offsetY){};prototype.moveZoom=function(offsetX,offsetY){};prototype.endZoom=function(offsetX,offsetY){};prototype.zoomIn=function(offsetX,offsetY,newPercentSize){};prototype.zoomOut=function(offsetX,offsetY,newPercentSize){};prototype.zoomInWheel=function(offsetX,offsetY,newPercentSize){};prototype.zoomOutWheel=function(offsetX,offsetY,newPercentSize){};prototype.zoomBack=function(){};prototype.mouseAt=function(offsetX,offsetY){};prototype.click=function(offsetX,offsetY){};prototype.getZoomLevel=function(){};prototype.getPanLevel=function(){};prototype.getZoomHistory=function(){};prototype.getId=function(){return this.id;};prototype.getTitle=function(){return this.title;};prototype.setTitle=function(title){this.title=title;};prototype.getChartType=function(){return this.chartType;};prototype.getChartData=function(){return this.data;};prototype.getView=function(){return this.chartView;};prototype.getEngineModel=function(){return this.engineModel;};prototype.setEngineModel=function(engineModel){this.engineModel=engineModel;};prototype.getParentElement=function(){return this.parentElement;};prototype.getChartOption=function(){return this.options;};prototype.getChartView=function(){return this.chartView;};constructor.pauseAll=function(){if(Chart.charts!=null){for(var chartId in Chart.charts){var chart=Chart.charts[chartId];if(chart!=null){chart.pause();}}}};constructor.unpauseAll=function(){if(Chart.charts!=null){for(var chartId in Chart.charts){var chart=Chart.charts[chartId];if(chart!=null){chart.unpause();}}}};prototype.isPanStarted=function(){};prototype.getInteractionModel=function(){return this.interactionModel;};prototype.updateInteractionModel=function(interactionModel,newParentDiv){if(this.interactionModel!=null){AbstractInteractionModel.unregisterModelOn(this.interactionModel,this.parentElement);}
if(interactionModel!=null){this.interactionModel=interactionModel;}else{this.interactionModel=AbstractInteractionModel.getDefaultFromDevice();}
AbstractInteractionModel.registerModelOn(this.interactionModel,newParentDiv,this);};prototype.fireRenderCallbacks=function(){for(var id in this.renderCallbacks){var currentCallback=this.renderCallbacks[id];if(currentCallback!=null){currentCallback(this);}}};prototype.registerRenderCallback=function(callbackId,renderCallback){if(callbackId!=null&&renderCallback!=null){this.renderCallbacks[callbackId]=renderCallback;}};prototype.unregisterRenderCallback=function(callbackId){if(callbackId!=null){delete this.renderCallbacks[callbackId];}};},{charts:{name:"Map",arguments:[null,"Chart"]},relatedCharts:{name:"Map",arguments:[null,"Chart"]},renderCallbacks:{name:"Map",arguments:[null,"Callback1"]},parentElement:"SqwJQuery",chartType:{name:"Enum",arguments:["Chart.ChartType"]},engineModel:"EngineModel",chartView:"CanvasChartView",interactionModel:"AbstractInteractionModel"},{});
var DefaultChart=function(parentDiv,optionsParam){Chart.call(this,parentDiv,optionsParam);};DefaultChart=stjs.extend(DefaultChart,Chart,[],function(constructor,prototype){prototype.paused=false;prototype.zooming=false;prototype.zoomStarted=false;prototype.minimumZoomFactor=null;prototype.zoomHistory=null;prototype.zoomLevel=null;prototype.notifications=null;prototype.panLevel=null;prototype.popOverAllowed=false;prototype.updated=false;prototype.startUp=false;prototype.interactionStartElement=null;prototype.panning=false;prototype.panStarted=false;prototype.panningStartValue=null;prototype.visibleXSpaceSize=null;prototype.missedUpdate=false;prototype.forceStopUpdate=false;prototype.chartRendered=false;prototype.waitUpdate=false;prototype.renderEndCallback=null;prototype.getVisibleXSpaceSize=function(){return this.visibleXSpaceSize;};prototype.init=function(parentDiv,optionsParam){Chart.prototype.init.call(this,parentDiv,optionsParam);this.popOverAllowed=this.options.isPopOverAllowed();this.zoomHistory=[];this.zoomLevel=null;this.minimumZoomFactor=this.options.getMinimumZoomFactor();if(this.minimumZoomFactor==null){this.minimumZoomFactor=4.0;}
this.missedUpdate=false;this.updated=false;this.startUp=true;this.zooming=false;this.zoomStarted=false;this.panStarted=false;this.panning=false;this.paused=false;this.chartRendered=false;this.waitUpdate=true;this.forceStopUpdate=false;this.chartView=CanvasChartView.createView(this.options.getImplementation(),this.options,this.parentElement);this.notifications=new ChartNotifications(this.chartView);this.initSpecifics();this.updateInteractionModel(this.options.getInteractionModel(),this.parentElement);var self=this;this.renderEndCallback=function(){self.chartRendered=true;self.mouseAt(self.interactionModel.getLastMouseXPosition(),self.interactionModel.getLastMouseYPosition());};if(this.options.isDisplayAtStartup()&&this.chartView.isValid()){this.refresh();}};prototype.reattachTo=function(newParenDiv){this.chartView.moveTo(newParenDiv);this.updateInteractionModel(this.options.getInteractionModel(),newParenDiv);this.parentElement=newParenDiv;};prototype.initSpecifics=function(){this.engineModel=this.options.getEngineModel();if(this.engineModel==null){this.engineModel=new DefaultEngineModel();}
this.engineModel.init(this.options);this.data=new ChartData(this,this.options.getDataProvider());this.data.attach(this);};prototype.render=function(xRange){if(!this.updated){return;}
this.chartView.clear();this.engineModel.updateRange(xRange,this.chartView,this.data);this.engineModel.createMainGraphics(this.chartView,this.data);this.chartView.render();this.fireRenderCallbacks();};prototype.reRender=function(){if(this.paused||this.waitUpdate){return;}
this.chartView.clear();this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);this.engineModel.createMainGraphics(this.chartView,this.data);this.chartView.render();this.fireRenderCallbacks();};prototype.resize=function(width,height){this.chartView.clear();this.chartView.resize(width,height);this.render(this.zoomLevel);};prototype.setChartType=function(chartTypeString){this.chartType=Chart.ChartType.valueOf(chartTypeString);this.options.setType(chartTypeString);this.engineModel.updateGraphEngine(this.options);this.refresh();};prototype.refresh=function(){this.chartRendered=false;this.chartView.clear();this.notifications.showLoadingIndicator();this.data.fetchDataSeries();};prototype.reset=function(){this.zoomHistory=[];this.zoomLevel=null;this.missedUpdate=false;this.startUp=true;this.zooming=false;this.zoomStarted=false;this.panStarted=false;this.panning=false;this.paused=false;this.chartRendered=false;this.engineModel.reset();this.waitUpdate=true;this.refresh();};prototype.update=function(newData){if(newData.getSeries().length==0){return;}
this.waitUpdate=false;if(this.paused){this.missedUpdate=true;return;}
this.data=newData;this.updated=true;this.missedUpdate=false;this.engineModel.updateXType(this.data.getXType());this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);this.chartView.getLayout().updateYAxis();this.chartView.clear();this.notifications.hideLoadingIndicator();this.engineModel.createMainGraphics(this.chartView,this.data);if(this.options.isAnimateChart()&&this.startUp){this.startUp=false;this.chartView.renderAnimation(this.renderEndCallback);}else{this.chartView.render();this.renderEndCallback();this.fireRenderCallbacks();}};prototype.zoomBack=function(){if(this.paused){return;}
this.zoomStarted=false;this.zooming=false;var previousZoom=this.zoomHistory.pop();if(previousZoom!=null){var startXValue=previousZoom[0];var endXValue=previousZoom[1];if(this.zoomLevel==null||startXValue!=this.zoomLevel[0]||endXValue!=this.zoomLevel[1]){this.setZoomLevel(previousZoom);this.render(previousZoom);}}};prototype.startZoom=function(offsetX,offsetY){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(!this.paused&&this.isValidPositionForInteraction(offsetX,offsetY)){var areaBounds=graph.getAreaBound();var x=offsetX-areaBounds.getContentLeft();this.zoomStarted=true;this.interactionStartElement=this.engineModel.getXSpaceValueAt(this.chartView,x);this.chartView.setZoomAreaStartPos(offsetX,offsetY);}};prototype.endZoom=function(offsetX,offsetY){if(!this.paused&&this.zooming){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.isValidPositionForInteraction(offsetX,offsetY)&&this.interactionStartElement!=null){var areaBounds=graph.getAreaBound();var x=offsetX-areaBounds.getContentLeft();var leftXSpace=this.interactionStartElement;var rightXSpace=this.engineModel.getXSpaceValueAt(this.chartView,x);if(leftXSpace>rightXSpace){var tmp=leftXSpace;leftXSpace=rightXSpace;rightXSpace=tmp;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=(this.data.xSpace2NormalizedXValue(leftXSpace)/valueScale)*valueScale;var rightXValue=(this.data.xSpace2NormalizedXValue(rightXSpace)/valueScale)*valueScale;var validRange=this.getValidXValueRange(leftXValue,rightXValue);if(validRange!=null&&!this.isRangeSameAs(this.zoomLevel,validRange)&&(validRange[1]-validRange[0])>=this.minimumZoomFactor){this.saveZoomValue();this.setZoomLevel(validRange);this.render(validRange);}}}
this.zooming=false;this.zoomStarted=false;this.interactionStartElement=null;this.chartView.setZoomAreaStartPos(null,null);this.chartView.setCurrentZoomAreaPos(null,null);};prototype.isZooming=function(){return this.zooming;};prototype.isZoomStarted=function(){return this.zoomStarted;};prototype.moveZoom=function(offsetX,offsetY){if(this.paused){return;}
this.zooming=true;this.chartView.setCurrentZoomAreaPos(offsetX,offsetY);};prototype.isRangeSameAs=function(referenceRange,range){if(range==null&&referenceRange==null){return true;}else if(range==null||referenceRange==null){return false;}else{return range[0]==referenceRange[0]&&range[1]==referenceRange[1];}};prototype.zoomIn=function(offsetX,offsetY,newPercentSize){if(this.paused){return false;}
if(this.isValidPositionForInteraction(offsetX,offsetY)){return this.applyZoom(offsetX,newPercentSize,true);}
return false;};prototype.zoomOut=function(offsetX,offsetY,newPercentSize){if(this.paused){return false;}
var zoomedOut=false;if(this.isValidPositionForInteraction(offsetX,offsetY)&&this.zoomLevel!=null){zoomedOut=this.applyZoom(offsetX,newPercentSize,false);if(zoomedOut){this.zoomHistory.pop();if(this.zoomLevel!=null&&this.zoomHistory.length>0){var previousZoom=this.zoomHistory[this.zoomHistory.length-1];if(previousZoom==null){this.zoomHistory.pop();}else{var previousStartValue=previousZoom[0];var previousEndValue=previousZoom[1];var currentStartValue=this.zoomLevel[0];var currentEndValue=this.zoomLevel[1];if(currentStartValue<previousStartValue||currentEndValue>previousEndValue){this.zoomHistory.pop();}}}else{this.zoomHistory=[];}}else{this.zoomBack();}}
return zoomedOut;};prototype.applyZoom=function(x,percentZoom,zoomIn){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.paused||graph==null){return false;}
var areaBound=graph.getAreaBound();var extremums=this.data.getExtremums();if(extremums==null||extremums[0]==null||extremums[1]==null){return false;}
var center=x-areaBound.getContentLeft();var width=areaBound.getContentWidth();var newWidth=width*percentZoom;var stepSize=this.data.getXStepSize();if(stepSize<=0){stepSize=1;}
var minWidth=this.data.getTotalXSpace()>1?width*(this.minimumZoomFactor/(this.data.getTotalXSpace()-1)):0;if(newWidth<minWidth){newWidth=minWidth;}
var halfWidth=(newWidth/2.0);var newLeft=center-halfWidth;var newRight=center+halfWidth;if(zoomIn&&newLeft<0){newRight-=newLeft;newLeft=0;}
if(zoomIn&&newRight>width){var correction=newRight-width;newLeft-=correction;newLeft=newLeft<0?0:newLeft;newRight=width;}
var leftXSpace=this.engineModel.getXSpaceValueAt(this.chartView,newLeft);var rightXSpace=this.engineModel.getXSpaceValueAt(this.chartView,newRight);var totalXSpaceSize=this.data.getTotalXSpace();if(leftXSpace<0){rightXSpace-=leftXSpace;leftXSpace=0;}
if(rightXSpace>=totalXSpaceSize){var correction=rightXSpace-totalXSpaceSize+1;leftXSpace-=correction;leftXSpace=leftXSpace<0?0:leftXSpace;rightXSpace=totalXSpaceSize-1;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=Math.floor((this.data.xSpace2NormalizedXValue(leftXSpace)/valueScale)*valueScale);var rightXValue=Math.ceil((this.data.xSpace2NormalizedXValue(rightXSpace)/valueScale)*valueScale);var validRange=this.getValidXValueRange(leftXValue,rightXValue);var currentZoomFactor=-1;var newZoomFactor=validRange[1]-validRange[0];if(this.zoomLevel!=null){currentZoomFactor=this.zoomLevel[1]-this.zoomLevel[0];if(!zoomIn&&this.isRangeSameAs(this.zoomLevel,extremums)){this.zoomHistory=[];return false;}}
if(currentZoomFactor!=newZoomFactor&&!this.isRangeSameAs(this.zoomLevel,validRange)&&(!zoomIn||newZoomFactor>=this.minimumZoomFactor)){this.saveZoomValue();this.setZoomLevel(validRange);this.render(validRange);return true;}
return false;};prototype.zoomInWheel=function(offsetX,offsetY,newPercentSize){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(!this.paused&&this.isValidPositionForInteraction(offsetX,offsetY)){var chartAreaBound=graph.getAreaBound();var minValidX=stjs.trunc(chartAreaBound.getContentLeft());var maxValidX=stjs.trunc((chartAreaBound.getContentLeft()+chartAreaBound.getContentWidth()-1));var x=minValidX<offsetX?offsetX:minValidX;x=offsetX>maxValidX?maxValidX:offsetX;this.zoomIn(x,stjs.trunc(chartAreaBound.getContentTop()),newPercentSize);}};prototype.zoomOutWheel=function(offsetX,offsetY,newPercentSize){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(!this.paused&&this.isValidPositionForInteraction(offsetX,offsetY)){var chartAreaBound=graph.getAreaBound();var centerX=Math.round(chartAreaBound.getContentLeft()+chartAreaBound.getContentWidth()/2.0);this.zoomOut(stjs.trunc(centerX),stjs.trunc(chartAreaBound.getContentTop()),newPercentSize);}};prototype.startPan=function(offsetX,offsetY){if(this.paused){return false;}
this.engineModel.updatePosition(offsetX,offsetY);var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.isValidPositionForInteraction(offsetX,offsetY)){this.chartView.clearHighlight();var areaBound=graph.getAreaBound();var localXPosition=offsetX-areaBound.getContentLeft();this.panningStartValue=this.engineModel.getXSpaceValueAt(this.chartView,localXPosition);this.panStarted=true;this.panLevel=this.zoomLevel!=null?this.zoomLevel.slice(0):null;return true;}else{return false;}};prototype.startPanXValue=function(xSpaceValue){if(this.paused){return false;}
this.chartView.clearHighlight();this.panningStartValue=xSpaceValue;this.panStarted=true;this.panLevel=this.zoomLevel!=null?this.zoomLevel.slice(0):null;return true;};prototype.movePan=function(offsetX,offsetY){if(!this.paused){this.engineModel.updatePosition(offsetX,offsetY);}
var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);var areaBound=graph.getAreaBound();var localXPosition=offsetX-areaBound.getContentLeft();var currentXSpaceValue=this.engineModel.getXSpaceValueAt(this.chartView,localXPosition);this.movePanXValue(currentXSpaceValue);};prototype.movePanXValue=function(currentXSpaceValue){if(this.paused){return;}
this.panning=true;if(this.panningStartValue!=null&&this.panLevel!=null&&this.visibleXSpaceSize!=null){var xSpaceFrom=this.data.normalizedXValue2XSpace(this.panLevel[0]);var xSpaceTo=this.data.normalizedXValue2XSpace(this.panLevel[1]);if(currentXSpaceValue!=null&&xSpaceFrom!=null&&xSpaceTo!=null){var panOffset=currentXSpaceValue-this.panningStartValue;var rangeAfterPan=this.calculateRangeAfterPan(xSpaceFrom,xSpaceTo,panOffset);if(rangeAfterPan!=null&&!this.isRangeSameAs(this.panLevel,rangeAfterPan)){if((panOffset>0&&rangeAfterPan[1]==this.panLevel[1])||(panOffset<0&&rangeAfterPan[0]==this.panLevel[0])){return;}
this.panningStartValue=currentXSpaceValue;this.panLevel=rangeAfterPan;this.render(this.panLevel);this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}}}};prototype.calculateRangeAfterPan=function(xSpaceFrom,xSpaceTo,panOffset){if(panOffset>0){xSpaceTo-=panOffset;xSpaceFrom=xSpaceTo-this.visibleXSpaceSize;}else if(panOffset<0){xSpaceFrom-=panOffset;xSpaceTo=xSpaceFrom+this.visibleXSpaceSize;}else{return null;}
var minValue=0.0;var maxValue=this.data.getTotalXSpace()-1.0;if(xSpaceFrom<minValue){panOffset=xSpaceFrom-minValue;xSpaceTo-=panOffset;xSpaceFrom=minValue;}
if(xSpaceTo>maxValue){panOffset=xSpaceTo-maxValue;xSpaceTo=maxValue;xSpaceFrom-=panOffset;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=(this.data.xSpace2NormalizedXValue(xSpaceFrom)/valueScale)*valueScale;var rightXValue=(this.data.xSpace2NormalizedXValue(xSpaceTo)/valueScale)*valueScale;return this.getValidXValueRange(leftXValue,rightXValue);};prototype.endPan=function(offsetX,offsetY){if(!this.paused&&this.panning){this.zoomLevel=this.panLevel;this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;this.engineModel.updatePosition(offsetX,offsetY);this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}else{this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;}};prototype.endPanXValue=function(xSpaceValue){if(!this.paused&&this.panning){this.zoomLevel=this.panLevel;this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}else{this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;}};prototype.isPanning=function(){return this.panning;};prototype.saveZoomValue=function(){if(this.paused){return;}
var currentZoom=null;if(this.zoomLevel!=null){currentZoom=this.zoomLevel.slice(0);}
this.zoomHistory.push(currentZoom);};prototype.getValidXValueRange=function(startElement,endElement){if(startElement==null||endElement==null){return null;}
return[Math.round(startElement),Math.round(endElement)];};prototype.mouseAt=function(offsetX,offsetY){this.engineModel.updatePosition(offsetX,offsetY);if(!this.paused&&this.chartRendered){this.chartView.clearHighlight();this.engineModel.createInteractiveGraphics(this.chartView,this.data);this.chartView.showHighlight();}};prototype.click=function(offsetX,offsetY){if(!this.paused&&this.popOverAllowed){var currentIcont=this.chartView.findElementById(DefaultTitleEngine.ICON_ID);if(currentIcont!=null&&currentIcont.isInside(offsetX,offsetY)){this.mouseAt(null,null);this.openPopOver();}}};prototype.isChartRendered=function(){return this.chartRendered;};prototype.pause=function(){this.paused=true;};prototype.unpause=function(){this.paused=false;if(this.missedUpdate){this.refresh();}
this.chartView.clearHighlight();this.engineModel.createInteractiveGraphics(this.chartView,this.data);this.chartView.showHighlight();};prototype.openPopOver=function(){if(this.options.isPopOverAllowed()){ChartPopOver.getInstance().open(this);}};prototype.setZoomLevel=function(zoomLevel){this.zoomLevel=zoomLevel;if(zoomLevel!=null){this.visibleXSpaceSize=this.data.getCurrentXSpaceSize(zoomLevel);}else{this.visibleXSpaceSize=null;}};prototype.setZoomHistory=function(zoomHistory){this.zoomHistory=zoomHistory;};prototype.getZoomLevel=function(){return this.zoomLevel;};prototype.getPanLevel=function(){return this.panLevel;};prototype.getZoomHistory=function(){return this.zoomHistory;};prototype.isValidPositionForInteraction=function(offsetX,offsetY){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);return graph!=null&&graph.isInside(offsetX,offsetY);};prototype.onResize=function(triggerRender){if(this.forceStopUpdate){return;}
this.chartView.onResize();if(!this.waitUpdate&&triggerRender){this.render(this.zoomLevel);}};prototype.showNoPriceMessage=function(){this.forceStopUpdate=true;this.notifications.hideLoadingIndicator();this.notifications.showNoPriceMessage();};prototype.isPanStarted=function(){return this.panStarted;};prototype.isWaitUpdate=function(){return this.waitUpdate;};prototype.setWaitUpdate=function(waitUpdate){this.waitUpdate=waitUpdate;};prototype.getMinimumZoomFactor=function(){return this.minimumZoomFactor;};},{zoomHistory:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},zoomLevel:{name:"Array",arguments:[null]},notifications:"ChartNotifications",panLevel:{name:"Array",arguments:[null]},renderEndCallback:"Callback0",charts:{name:"Map",arguments:[null,"Chart"]},relatedCharts:{name:"Map",arguments:[null,"Chart"]},renderCallbacks:{name:"Map",arguments:[null,"Callback1"]},parentElement:"SqwJQuery",chartType:{name:"Enum",arguments:["Chart.ChartType"]},engineModel:"EngineModel",chartView:"CanvasChartView",interactionModel:"AbstractInteractionModel"},{});
var ChartConstant=function(){};ChartConstant=stjs.extend(ChartConstant,null,[],function(constructor,prototype){constructor.ID="id";constructor.COLOR="color";constructor.WIDTH="width";constructor.HEIGHT="height";constructor.HIGHLIGHTED="highlighted";constructor.HIGHLIGHT_COLOR="highlightColor";constructor.HIGHLIGHT_WIDTH="highlightWidth";constructor.GROUPED="grouped";constructor.GROUP_COLOR="groupColor";constructor.GROUP_WIDTH="groupWidth";},{},{});
var PopOver=function(){};PopOver=stjs.extend(PopOver,null,[],function(constructor,prototype){prototype.open=function(trigger){};prototype.close=function(){};},{},{});
var ChartPopOver=function(){this.chartsParent=[];this.charts=[];this.overlay=$(window.document.createElement("div"));this.overlay.addClass(ChartPopOver.POPOVER_OVERLAY_CSS_CLASS);this.overlay.on("click",this.getOnCloseEventHandler());this.closeBox=$(window.document.createElement("div"));this.closeBox.addClass(ChartPopOver.POPOVER_CLOSE_BOX_CSS_CLASS);this.closeBox.on("click",this.getOnCloseEventHandler());this.chartwindow=$(window.document.createElement("div"));this.chartwindow.addClass(ChartPopOver.POPOVER_WINDOW_CSS_CLASS);this.wrapperElement=$(window.document.createElement("div"));this.wrapperElement.addClass(ChartPopOver.POPOVER_WRAPPER_CSS_CLASS);this.wrapperElement.append(this.overlay);this.wrapperElement.append(this.chartwindow);this.wrapperElement.append(this.closeBox);this.wrapperElement.css("visibility","hidden");$(window.document.body).append(this.wrapperElement);var width=this.chartwindow.width();var height=this.chartwindow.height();var marginLeftCorrection=Math.round(width/-2.0);var marginTopCorrection=Math.round(height/-2.0);this.chartwindow.css("margin-left",marginLeftCorrection);this.chartwindow.css("margin-top",marginTopCorrection);this.addChart(ChartPopOver.POPOVER_CHART_PARENT_CSS_CLASS);};ChartPopOver=stjs.extend(ChartPopOver,null,[PopOver],function(constructor,prototype){constructor.POPOVER_OVERLAY_CSS_CLASS="chart-popover-overlay";constructor.POPOVER_WINDOW_CSS_CLASS="chart-popover-window";constructor.POPOVER_CHART_PARENT_CSS_CLASS="chart-popover-parent";constructor.POPOVER_WRAPPER_CSS_CLASS="chart-popover-wrapper";constructor.POPOVER_CLOSE_BOX_CSS_CLASS="chart-popover-close-box";prototype.wrapperElement=null;prototype.overlay=null;prototype.chartwindow=null;prototype.closeBox=null;prototype.chartsParent=null;prototype.charts=null;constructor.instance=null;prototype.addChart=function(chartParentClass){var chartParent=$(window.document.createElement("div"));chartParent.addClass(chartParentClass);this.chartsParent.push(chartParent);this.chartwindow.append(chartParent);var optionsParam=SQW.$.extend(true,{},ChartOption.getDefault());optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);this.charts.push(new DefaultChart(chartParent,optionsParam));};prototype.removeChart=function(chartId){var chartParent=this.chartsParent.pop();chartParent.remove();};prototype.init=function(trigger){var initialSetting=trigger.getChartOption();var optionsParam=SQW.$.extend(true,{},initialSetting);optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);optionsParam.setAnimateChart(false);optionsParam.setStyleModel(new DefaultStyleModel());optionsParam.setEngineModel(new DefaultEngineModel());optionsParam.setLayout(new DefaultLayout());var provider=DataProviderFactory.getInstance().getProvider(initialSetting);var newProvider=provider.clone();var providerClass="popOverProvider";DataProviderFactory.getInstance().registerProvider(providerClass,newProvider);optionsParam.setProviderClass(providerClass);var currentChart=this.charts[0];var chartParent=this.chartsParent[0];chartParent.empty();currentChart.init(chartParent,optionsParam);currentChart.setZoomLevel(trigger.getZoomLevel());};constructor.getInstance=function(){if(ChartPopOver.instance==null){ChartPopOver.instance=new ChartPopOver();}
return ChartPopOver.instance;};prototype.open=function(trigger){Chart.pauseAll();this.init(trigger);this.show();this.unpauseCharts();this.refreshCharts();};prototype.close=function(){this.hide();Chart.unpauseAll();this.pauseCharts();};prototype.show=function(){this.wrapperElement.css("visibility","visible");};prototype.hide=function(){this.wrapperElement.css("visibility","hidden");};prototype.getOnCloseEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){self.close();return false;},1);return eh;};prototype.pauseCharts=function(){var chartsCount=this.charts==null?0:this.charts.length;for(var i=0;i<chartsCount;i++){var chart=this.charts[i];if(chart!=null){chart.pause();}}};prototype.unpauseCharts=function(){var chartsCount=this.charts==null?0:this.charts.length;for(var i=0;i<chartsCount;i++){var chart=this.charts[i];if(chart!=null){chart.unpause();}}};prototype.refreshCharts=function(){var chartsCount=this.charts==null?0:this.charts.length;for(var i=0;i<chartsCount;i++){var chart=this.charts[i];if(chart!=null){chart.refresh();}}};},{wrapperElement:"SqwJQuery",overlay:"SqwJQuery",chartwindow:"SqwJQuery",closeBox:"SqwJQuery",chartsParent:{name:"Array",arguments:["SqwJQuery"]},charts:{name:"Array",arguments:["Chart"]},instance:"ChartPopOver"},{});
var ServerRequest=function(serieData){this.serieData=serieData;this.url=this.createURL(serieData);this.requestType="GET";this.params=null;};ServerRequest=stjs.extend(ServerRequest,null,[],function(constructor,prototype){constructor.WEB_SERVICE_PREFIX_URL_DEFAULT="/sqi_ws/";constructor.WEB_SERVICE_PREFIX_URL=ServerRequest.WEB_SERVICE_PREFIX_URL_DEFAULT;constructor.REQUEST_SUFFIX_CHAR_URL="?";constructor.REQUEST_AND_CHAR_URL="&";constructor.REQUEST_EQUALS_CHAR_URL="=";prototype.requestType=null;prototype.url=null;prototype.params=null;prototype.serieData=null;prototype.makeRequest=function(callback){var self=this;var xhr=new XMLHttpRequest();xhr.open(this.requestType,self.url,true);if('responseType'in xhr){xhr.responseType='arraybuffer';};var c1=(xhr)["overrideMimeType"];if((typeof c1)!="undefined"){xhr.overrideMimeType('text/plain; charset=x-user-defined');}else{xhr.setRequestHeader("Accept-Charset","x-user-defined");}
if(this.requestType=="POST"){xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");}
xhr.setRequestHeader("SQ_REQUEST_SOURCE","application");var callbackSuccess=self.getSuccessCallback(callback);var callbackError=function(p1,p2,p3){callback(null,null);};xhr.onreadystatechange=function(){if(xhr.readyState!=4){return;}
if(xhr.status!=200){callbackError(null,null,null);}else{var responseType=(xhr)["responseType"];if((typeof responseType)!="undefined"&&responseType=="arraybuffer"){var content=(xhr)["response"];if((typeof content)=="undefined"){content=new VBArray(this.responseBody).toArray();}
callbackSuccess(self.arrayBuffer2BinaryString(content),xhr.statusText,xhr);}else if(typeof(ie_version)!=='undefined'&&ie_version==8){callbackSuccess(BinaryToString(xhr.responseBody),xhr.statusText,xhr);}else{callbackSuccess(xhr.responseText,xhr.statusText,xhr);}}};xhr.send(this.params);};prototype.arrayBuffer2BinaryString=function(arrayBuffer){if(arrayBuffer!=null){var binaryString="";var typedBytesArray=new Uint8Array(arrayBuffer);var length=typedBytesArray.length;for(var i=0;i<length;i++){binaryString+=String.fromCharCode(typedBytesArray[i]);}
return binaryString;}else{return null;}};constructor.getBaseURL=function(){return window.location.protocol+"//"+window.location.host;};prototype.getSuccessCallback=function(callback){};prototype.createURL=function(serieData){};prototype.addUrlParam=function(paramName,paramValue){if(this.url!=null&&paramName!=null&&paramValue!=null){this.url+="&"+paramName+"="+paramValue;}};prototype.addPostParam=function(paramName,paramValue){if(paramName!=null&&paramValue!=null){if(this.params==null){this.params=paramName+"="+paramValue;}else{this.params+="&"+paramName+"="+paramValue;}}};constructor.setServicePrefix=function(prefix){ServerRequest.WEB_SERVICE_PREFIX_URL=prefix;};},{},{});
var PriceServletRequest=function(serie){ServerRequest.call(this,serie);};PriceServletRequest=stjs.extend(PriceServletRequest,ServerRequest,[],function(constructor,prototype){constructor.HEADER_FIELD_KEY_PREFIX="key_";constructor.SERVLET_URL="PriceServlet?";prototype.createURL=function(serie){var urlPrefix=ServerRequest.WEB_SERVICE_PREFIX_URL;if(!urlPrefix.toLowerCase().startsWith("http")){urlPrefix=ServerRequest.getBaseURL()+urlPrefix;}
var currentURL=urlPrefix+PriceServletRequest.SERVLET_URL;var serieStock=serie.getStock();if(serieStock!=null){currentURL+="format=full&isin="+serieStock.getIsin()+"&currency="+serieStock.getCurrency()+"&exchangeId="+serieStock.getStockExchangeId()+"&start="+serie.getValidLength();}
currentURL+="&_="+new Date().getTime();return currentURL;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var dataString=data;if(data!=null){var index=data.indexOf("\n");dataString=data.substring(index+1);}
callback(dataString,null);};};},{},{});
var MultiIntradayServletRequest=function(series){ServerRequest.call(this,series);};MultiIntradayServletRequest=stjs.extend(MultiIntradayServletRequest,ServerRequest,[],function(constructor,prototype){constructor.MAX_INTRADAY=6;constructor.HEADER_FIELD_KEY_PREFIX="key_";constructor.SERVLET_URL="MultipleIntradayServlet?";prototype.createURL=function(series){var urlPrefix=this.getWebServicePrefixUrl();if(!urlPrefix.toLowerCase().startsWith("http")){urlPrefix=ServerRequest.getBaseURL()+urlPrefix;}
var currentURL=urlPrefix+MultiIntradayServletRequest.SERVLET_URL;var keyCount=series.length;var keysString=series[0].getKey();for(var i=1;i<keyCount;i++){keysString=keysString+","+series[i].getKey();}
var mainSerie=series!=null?series[0]:null;if(mainSerie!=null&&mainSerie.getPeriod()!=null){var dayVal=mainSerie.getPeriod().getValue();if(dayVal<=0||isNaN(dayVal)){dayVal=1;}else if(dayVal>MultiIntradayServletRequest.MAX_INTRADAY){dayVal=MultiIntradayServletRequest.MAX_INTRADAY;}
currentURL+="days="+dayVal;currentURL+="&freq="+this.getFrequencyValue(mainSerie.getPeriod().getFrequency());}
currentURL+="&format=pipe&keys="+keysString+"&version=10.0";currentURL+="&_="+new Date().getTime();return currentURL;};prototype.getWebServicePrefixUrl=function(){return ServerRequest.WEB_SERVICE_PREFIX_URL;};prototype.getFrequencyValue=function(frequency){if(frequency==null||frequency.isLive()){return"";}else if(frequency.getType()==Frequency.Type.SECOND){return String.valueOf(Math.ceil(frequency.getValue()/60.0));}else if(frequency.getType()==Frequency.Type.MINUTE){return String.valueOf(frequency.getValue());}else if(frequency.getType()==Frequency.Type.HOUR){return String.valueOf(frequency.getValue()*60);}else{return"";}};prototype.getSuccessCallback=function(callback){var self=this;return function(data,textStatus,jqXHR){var responseText=data;var metadata=[];var serieCount=self.serieData.length;for(var i=0;i<serieCount;i++){var currentKeyId=MultiIntradayServletRequest.HEADER_FIELD_KEY_PREFIX+self.serieData[i].getKey();var t=jqXHR.getResponseHeader(currentKeyId);metadata[currentKeyId]=t;}
callback(responseText,metadata);};};},{},{});
var HistoServletRequest=function(serie){ServerRequest.call(this,serie);};HistoServletRequest=stjs.extend(HistoServletRequest,ServerRequest,[],function(constructor,prototype){constructor.HEADER_FIELD_VOLUME_MULTIPLIER="volumeMultiplier";constructor.HEADER_FIELD_OPEN_PERIOD="open_period";constructor.SERVLET_URL="HistoFromServlet?";constructor.HISTO_MINUTES_OFFSET_REFERENCE=720;prototype.createURL=function(serie){var period=serie.getPeriod();var lastPoint=serie.getLastPoint();var key=serie.getKey();var urlPrefix=ServerRequest.WEB_SERVICE_PREFIX_URL;if(!urlPrefix.toLowerCase().startsWith("http")){urlPrefix=ServerRequest.getBaseURL()+urlPrefix;}
var currentURL=urlPrefix+HistoServletRequest.SERVLET_URL;var freq=period.getFrequency();currentURL+="format=pipe&key="+key;currentURL+="&ftype="+Frequency.typeToString(freq.getType());currentURL+="&fvalue="+freq.getValue();currentURL+="&ptype="+Period.typeToRequestParameterString(period.getType());currentURL+="&pvalue="+period.getValue();var lastValue=null;var lastTime=null;if(lastPoint!=null){lastValue=lastPoint[Serie.Y];lastTime=lastPoint[Serie.X];}
if(lastValue!=null&&!isNaN(lastValue)&&lastTime!=null&&!isNaN(lastTime)){currentURL+="&lastDate="+HistoServletRequest.localTime2ServerTimeSeconds(lastTime);currentURL+="&lastClose="+(lastValue).toFixed(2);}
currentURL+="&_="+new Date().getTime();return currentURL;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var responseText=data;var openPeriodsString=jqXHR.getResponseHeader(HistoServletRequest.HEADER_FIELD_OPEN_PERIOD);var volumeMultiplierString=jqXHR.getResponseHeader(HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER);var metadata=[];metadata[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD]=openPeriodsString;metadata[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER]=volumeMultiplierString;callback(responseText,metadata);};};constructor.getLocaleCorrectionTimeOffset=function(){return stjs.trunc(((HistoServletRequest.HISTO_MINUTES_OFFSET_REFERENCE+new Date().getTimezoneOffset())*DateUtil.MS_MINUTE));};constructor.localTime2ServerTimeSeconds=function(localeTime){localeTime=localeTime-HistoServletRequest.getLocaleCorrectionTimeOffset();return Math.round(localeTime/DateUtil.MS_SECOND);};},{},{});
var LocalFileAjaxRequest=function(relativePath,serieData){ServerRequest.call(this,serieData);this.url=this.url+relativePath;};LocalFileAjaxRequest=stjs.extend(LocalFileAjaxRequest,ServerRequest,[],function(constructor,prototype){prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var responseText=data;callback(responseText,null);};};prototype.createURL=function(serie){return ServerRequest.getBaseURL();};},{},{});
var PipeDelimitedDataProcessor=function(){};PipeDelimitedDataProcessor=stjs.extend(PipeDelimitedDataProcessor,null,[],function(constructor,prototype){constructor.NEW_LINE="\n";constructor.DELIMITER="|";prototype.process=function(pipeDelimitedString,lineOffset,elementNumber,stockTimeZone,totaTimeOffsetMs){var points=[];if(PipeDelimitedDataProcessor.isNumberInvalid(totaTimeOffsetMs)){totaTimeOffsetMs=0;}
var pointLines=(pipeDelimitedString).split(PipeDelimitedDataProcessor.NEW_LINE);if(elementNumber==null){elementNumber=pointLines.length-lineOffset;}
for(var i=0;i<elementNumber;i++){var pointIndex=i+lineOffset;var pointLine=pointLines[pointIndex];var point={};var pointLineSplitted=(pointLine).split(PipeDelimitedDataProcessor.DELIMITER);if(pointLineSplitted.length!=6){break;}
var fieldIndex=0;var timeFromServlet=pointLineSplitted[fieldIndex++];var timeFromServletMs=this.convertDateFromServletToMilliseconds(timeFromServlet,stockTimeZone);var timeFromServletWithOffsetMs=timeFromServletMs+totaTimeOffsetMs;point[Serie.X]=timeFromServletWithOffsetMs;var high=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.HIGH]=high>0?high:null;var low=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.LOW]=low>0?low:null;var open=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.OPEN]=open>0?open:null;var close=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.CLOSE]=close>0?close:null;var volume=Integer.parseInt(pointLineSplitted[fieldIndex++]);point[FinancialSerie.VOLUME]=PipeDelimitedDataProcessor.isNumberInvalid(volume)?0:volume;points[i]=point;}
return points;};prototype.convertDateFromServletToMilliseconds=function(dateFromServlet,timeZone){var year=dateFromServlet.substring(0,4);var month=dateFromServlet.substring(4,6);var day=dateFromServlet.substring(6,8);var isoDate=year+"-"+month+"-"+day;if(dateFromServlet.length==14){var hour=dateFromServlet.substring(8,10);var minute=dateFromServlet.substring(10,12);var second=dateFromServlet.substring(12,14);var timeZoneString=this.getTimeZoneString(timeZone);isoDate+="T"+hour+":"+minute+":"+second+timeZoneString;}
return stjs.trunc(new Date(isoDate).getTime());};prototype.getTimeZoneString=function(timeZone){var timeZoneAbs=stjs.trunc(Math.abs(timeZone));var timeZoneString=timeZone<0?"-":"+";timeZoneString+=timeZoneAbs<10?"0"+timeZoneAbs:timeZoneAbs;timeZoneString+=":";timeZoneString+=timeZone==Math.floor(timeZone)?"00":"30";return timeZoneString;};constructor.isNumberInvalid=function(number){if(number==null||isNaN(number)){return true;}
return false;};},{},{});
var DataProvider=function(){this.id=new Date().getTime()+"_provider_"+Math.round((Math.random()*100000));this.cache=Cache.getInstance();};DataProvider=stjs.extend(DataProvider,null,[],function(constructor,prototype){prototype.id=null;prototype.cache=null;prototype.config=null;prototype.chartData=null;prototype.getData=function(chartData){};prototype.updateConfig=function(config){};prototype.getChartData=function(){return this.chartData;};prototype.setChartData=function(chartData){this.chartData=chartData;};prototype.getConfig=function(){return this.config;};prototype.setConfig=function(config){this.config=config;};prototype.getCache=function(){return this.cache;};prototype.setCache=function(cache){this.cache=cache;};prototype.clone=function(){};prototype.getId=function(){return this.id;};},{cache:"Cache",config:"ChartOption"},{});
var MobileServiceDataProvider=function(config){DataProvider.call(this);this.requestId=0;this.retryCount=0;this.currentReturnedRequestNumber=0;this.currentValiditySecond=MobileServiceDataProvider.DEFAULT_INTRADAY_DATA_VALIDITY_SECONDS;this.retrySetDataCallback=null;this.paused=false;this.newDataFlag=false;this.localTimeZoneOffsetMs=stjs.trunc((new Date().getTimezoneOffset()*DateUtil.MS_MINUTE));this.dataProcessor=new PipeDelimitedDataProcessor();var self=this;this.autorefreshFunction=function(){if(self.lastData!=null&&self.lastData.getProvider()!=null&&self.lastData.getProvider().getId()==self.id){self.getData(self.lastData);}};this.onRequestCompleteCallback=function(requestType,requestId,data,series){if(data!=null){if(requestType!=MobileServiceDataProvider.LIVE_REQUEST_ID){data.setSeries(series);}else{var mainSerie=series!=null?series[0]:null;if(mainSerie!=null){data.setSeries([mainSerie.getAggregatedSerie()]);}else{data.setSeries(series);}}}};this.updateConfig(config);this.startAutorefreshTimer();};MobileServiceDataProvider=stjs.extend(MobileServiceDataProvider,DataProvider,[],function(constructor,prototype){constructor.INTRADAY_REQUEST_ID="intraday";constructor.LIVE_REQUEST_ID="live";constructor.HISTO_REQUEST_ID="histo";constructor.HEADER_FIELDS_SEPARATOR="|";constructor.MAX_RETRY_COUNT=5;constructor.RETRY_INTERVAL_MS=2000;constructor.DEFAULT_INTRADAY_DATA_VALIDITY_SECONDS=60;constructor.HISTO_DATA_VALIDITY_HOURS=2;constructor.BID_ASK_VALIDITY_MINUTES=5;prototype.refreshTimer=null;prototype.autorefreshInterval=null;prototype.paused=false;prototype.requestId=0;prototype.retryCount=0;prototype.currentReturnedRequestNumber=0;prototype.retrySetDataCallback=null;prototype.autorefreshFunction=null;prototype.lastData=null;prototype.currentValiditySecond=0;prototype.onRequestCompleteCallback=null;prototype.newDataFlag=false;prototype.stocks=null;prototype.localTimeZoneOffsetMs=0;prototype.dataProcessor=null;prototype.getData=function(data){if(data==null){return;}
clearTimeout(this.refreshTimer);this.lastData=data;this.requestId++;this.retryCount=0;this.currentReturnedRequestNumber=0;var series=this.getNewSeries(data);var invalidSeries=[];var lineOffset=this.config.getIntradayResponseLineOffset();var serieCount=series!=null?series.length:0;var nowTime=new Date().getTime();var mainSerie=series!=null?series[0]:null;for(var i=0;i<serieCount;i++){var currentSerie=series[i];var validity=currentSerie.getValidity();if(validity==null||validity.getTime()<nowTime){var mainData=this.cache.get(currentSerie.getDataId(this.config.getWidthParam()));var metadataString=this.cache.get(currentSerie.getMetadataId(this.config.getWidthParam()));if(mainData!=null&&metadataString!=null){if(this.isBidAskSerie(currentSerie)){var validityFromCacheTime=parseInt(metadataString);if(!isNaN(validityFromCacheTime)&&validityFromCacheTime>=nowTime){var points=this.getBidAskPoints(mainData);currentSerie.setData(points,new Date(validityFromCacheTime),null);}else{this.cache.remove(currentSerie.getDataId(this.config.getWidthParam()));this.cache.remove(currentSerie.getMetadataId(this.config.getWidthParam()));invalidSeries.push(currentSerie);}}else{var validityEndIndex=mainData.indexOf(MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR);var validityFromCache=mainData.substring(0,validityEndIndex);var validityFromCacheTime=parseInt(validityFromCache);var metadata=(metadataString).split(MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR);if(validityFromCacheTime>=nowTime){var elementNumber=null;var totaTimeOffsetMs=0;var stockTimeZone=parseFloat(metadata[3]);if(currentSerie.getPeriod().isIntraday()){var stockTimeZoneOffsetMs=stjs.trunc(Math.round(stockTimeZone*DateUtil.MS_HOUR));if(isNaN(stockTimeZoneOffsetMs)){stockTimeZoneOffsetMs=0;}
if(i==0&&currentSerie.getId()==mainSerie.getId()){totaTimeOffsetMs=stockTimeZoneOffsetMs+this.localTimeZoneOffsetMs;data.setMainSerieTimeOffsetMs(totaTimeOffsetMs);}else{totaTimeOffsetMs=data.getMainSerieTimeOffsetMs();}
metadata.push(String.valueOf(totaTimeOffsetMs));elementNumber=this.config.isIntradayMultipartResponseAllowed()?parseInt(metadata[1]):null;}else{var openPeriodString=metadata[0];var volumeMultiplierString=metadata[1];totaTimeOffsetMs=HistoServletRequest.getLocaleCorrectionTimeOffset();metadata[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD]=openPeriodString;metadata[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER]=volumeMultiplierString;}
var pipeDelimitedString=mainData.substring(validityEndIndex+1);var points=this.dataProcessor.process(pipeDelimitedString,lineOffset,elementNumber,stockTimeZone,totaTimeOffsetMs);if(this.config.isIntradayMultipartResponseAllowed()){lineOffset+=elementNumber;}
currentSerie.setData(points,new Date(validityFromCacheTime),metadata);}else{this.cache.remove(currentSerie.getDataId(this.config.getWidthParam()));this.cache.remove(currentSerie.getMetadataId(this.config.getWidthParam()));invalidSeries.push(currentSerie);}}}else{this.cache.remove(currentSerie.getDataId(this.config.getWidthParam()));this.cache.remove(currentSerie.getMetadataId(this.config.getWidthParam()));invalidSeries.push(currentSerie);}}}
this.doCurrentRequest(data,invalidSeries,series);this.startAutorefreshTimer();};prototype.doCurrentRequest=function(data,invalidSeries,series){var mainSerie=series!=null?series[0]:null;if(mainSerie!=null&&this.isBidAskSerie(mainSerie)){this.doAllBidAskRequest(data,invalidSeries,series);}else if(mainSerie!=null&&mainSerie.getPeriod().isIntraday()){this.doAllMultiIntradayServletRequest(data,invalidSeries,series);}else{this.doAllHistoServletRequests(data,series);}};prototype.isBidAskSerie=function(serie){return serie!=null&&serie.getType()==Chart.ChartType.BID_ASK;};prototype.startAutorefreshTimer=function(){if(this.autorefreshInterval!=null&&!this.paused){clearTimeout(this.refreshTimer);this.refreshTimer=setTimeout(this.autorefreshFunction,this.autorefreshInterval);}};prototype.pauseAutorefreshTimer=function(){clearTimeout(this.refreshTimer);this.paused=true;};prototype.unpauseAutorefreshTimer=function(){this.paused=false;this.startAutorefreshTimer();};prototype.updateConfig=function(config){this.config=config;if(config==null){return;}
this.stocks=config.getStocks();this.autorefreshInterval=config.getAutorefreshIntervalSeconds();if(this.autorefreshInterval!=null){this.autorefreshInterval=this.autorefreshInterval*1000;}};prototype.getNewSeries=function(data){if(data==null){return null;}
var keysCount=this.stocks!=null?this.stocks.length:0;var colorStrategy=this.config.getColorStrategy();var addYesterday=this.config.isAddYesterday();var series=data.getSeries();var newSeries=[];for(var i=0;i<keysCount;i++){var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());var currentStock=this.stocks[i];var currentDataSerie=(series!=null)?series[i]:null;if(currentStock!=null&&currentDataSerie==null||currentDataSerie.getDataId(this.config.getWidthParam())!=currentDataSerie.createDataId(currentStock.getKey(),period,this.config.getWidthParam())){if(period.isIntraday()){if((period.isLive()&&Chart.ChartType.valueOf(this.config.getType())==Chart.ChartType.POINT)||(currentStock.isSwissDotsMarket())){var newBidAskSerie=new BidAskSerie(period,colorStrategy,currentStock);newBidAskSerie.setStretchLeftSide(this.config.isStretchLeftSide());newBidAskSerie.setStretchRightSide(this.config.isStretchRightSide());currentDataSerie=newBidAskSerie;}else{var newIntradaySerie=new IntradaySerie(period,colorStrategy,currentStock,addYesterday);newIntradaySerie.setStretchLeftSide(this.config.isStretchLeftSide());newIntradaySerie.setStretchRightSide(this.config.isStretchRightSide());currentDataSerie=newIntradaySerie;}}else{var newHistoSerie=new HistoSerie(period,null,currentStock);newHistoSerie.setColor(this.config.getDefaultHistoColor());currentDataSerie=newHistoSerie;}}else if(currentDataSerie!=null){if(currentDataSerie.isIntraday()){currentDataSerie.setColorStrategy(colorStrategy);}else{currentDataSerie.setColorStrategy(null);}
currentDataSerie.setStock(currentStock);}
newSeries[i]=currentDataSerie;}
return newSeries;};prototype.doAllMultiIntradayServletRequest=function(data,invalidSeries,series){this.requestId++;var currentRequestId=this.requestId;this.newDataFlag=true;if(invalidSeries.length>0){this.doMultiIntradayServletRequest(data,invalidSeries,series,currentRequestId);}else{this.onRequestCompleteCallback(MobileServiceDataProvider.INTRADAY_REQUEST_ID,currentRequestId,data,series);}};prototype.doMultiIntradayServletRequest=function(data,invalidSeries,series,currentRequestId){this.retryCount=0;var self=this;var request=this.createServletRequest(invalidSeries);var retryCallback=function(){if(self.requestId==currentRequestId){request.makeRequest(self.retrySetDataCallback);}};var setDataCallback=function(binaryString,metadataArray){if(self.requestId==currentRequestId){if(binaryString==null&&metadataArray==null&&self.retryCount<MobileServiceDataProvider.MAX_RETRY_COUNT){self.retryCount++;setTimeout(retryCallback,MobileServiceDataProvider.RETRY_INTERVAL_MS);}else{self.setIntradaySeriesData(binaryString,series,invalidSeries,metadataArray,data,self.currentValiditySecond);self.onRequestCompleteCallback(MobileServiceDataProvider.INTRADAY_REQUEST_ID,currentRequestId,data,series);}}};this.retrySetDataCallback=setDataCallback;request.addUrlParam("px",this.config.getWidthParam());request.makeRequest(setDataCallback);};prototype.createServletRequest=function(series){return new MultiIntradayServletRequest(series);};prototype.doAllHistoServletRequests=function(data,series){this.requestId++;this.retryCount=0;this.currentReturnedRequestNumber=0;this.newDataFlag=false;var currentRequestId=this.requestId;var serieCount=series.length;for(var i=0;i<serieCount;i++){var currentSerie=series[i];this.doHistoServletRequest(data,currentSerie,currentRequestId,serieCount,series);}};prototype.doHistoServletRequest=function(data,serie,currentRequestId,totalRequestNumber,series){var self=this;var request=new HistoServletRequest(serie);var retryCallback=function(){if(self.requestId==currentRequestId){request.makeRequest(self.retrySetDataCallback);}};var setDataCallback=function(binaryString,metadata){if(self.requestId==currentRequestId){if(binaryString==null&&metadata==null&&self.retryCount<MobileServiceDataProvider.MAX_RETRY_COUNT){self.retryCount++;setTimeout(retryCallback,MobileServiceDataProvider.RETRY_INTERVAL_MS);}else{self.currentReturnedRequestNumber++;self.updateHistoSerieData(binaryString,serie,metadata,MobileServiceDataProvider.HISTO_DATA_VALIDITY_HOURS);if(self.currentReturnedRequestNumber>=totalRequestNumber){self.onRequestCompleteCallback(MobileServiceDataProvider.HISTO_REQUEST_ID,currentRequestId,data,series);}}}};this.retrySetDataCallback=setDataCallback;request.makeRequest(setDataCallback);};prototype.doAllBidAskRequest=function(data,invalidSeries,series){this.requestId++;this.newDataFlag=false;var currentRequestId=this.requestId;var mainSerie=series!=null?series[0]:null;var bidAskSerie=mainSerie!=null?(mainSerie).getMainSerie():null;this.doBidAskRequest(data,bidAskSerie,currentRequestId);};prototype.doBidAskRequest=function(data,bidAskSerie,currentRequestId){var self=this;var request=new PriceServletRequest(bidAskSerie);this.retryCount=0;var retryCallback=function(){if(self.requestId==currentRequestId){request.makeRequest(self.retrySetDataCallback);}};var setDataCallback=function(linesString,metadataNull){if(self.requestId==currentRequestId){if(linesString==null&&self.retryCount<MobileServiceDataProvider.MAX_RETRY_COUNT){self.retryCount++;setTimeout(retryCallback,MobileServiceDataProvider.RETRY_INTERVAL_MS);}else{self.updateBidAskSerieData(linesString,bidAskSerie,MobileServiceDataProvider.BID_ASK_VALIDITY_MINUTES);self.onRequestCompleteCallback(MobileServiceDataProvider.LIVE_REQUEST_ID,currentRequestId,data,[bidAskSerie]);}}};this.retrySetDataCallback=setDataCallback;request.makeRequest(setDataCallback);};prototype.setIntradaySeriesData=function(pipeDelimitedString,allSeries,fetchedSeries,metadataArray,data,validitySeconds){if(pipeDelimitedString!=null&&fetchedSeries!=null&&metadataArray!=null){var serieCount=fetchedSeries.length;var validity=DateUtil.getDateAfter(new Date(),validitySeconds,DateUtil.MS_SECOND);var validityTime=validity.getTime();var mainSerie=allSeries!=null?allSeries[0]:null;var lineOffset=this.config.getIntradayResponseLineOffset();for(var i=0;i<serieCount;i++){var currentSerie=fetchedSeries[i];if(currentSerie!=null&&currentSerie.getKey()!=null){var id=MultiIntradayServletRequest.HEADER_FIELD_KEY_PREFIX+currentSerie.getKey();var currentSerieMetadata=metadataArray[id];if(currentSerieMetadata!=null){var metadata=(currentSerieMetadata).split(MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR);var elementNumber=this.config.isIntradayMultipartResponseAllowed()?parseInt(metadata[1]):null;var stockTimeZone=parseFloat(metadata[3]);var stockTimeZoneOffsetMs=stjs.trunc(Math.round(stockTimeZone*DateUtil.MS_HOUR));var totaTimeOffsetMs=0;if(i==0&&currentSerie.getId()==mainSerie.getId()){totaTimeOffsetMs=stockTimeZoneOffsetMs+this.localTimeZoneOffsetMs;data.setMainSerieTimeOffsetMs(totaTimeOffsetMs);}else{totaTimeOffsetMs=data.getMainSerieTimeOffsetMs();}
metadata.push(String.valueOf(totaTimeOffsetMs));if(!isNaN(elementNumber)){var points=this.dataProcessor.process(pipeDelimitedString,lineOffset,elementNumber,stockTimeZone,totaTimeOffsetMs);currentSerie.setData(points,validity,metadata);var validityPrefix=validityTime+MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR;var dataString=validityPrefix+pipeDelimitedString;this.cache.set(currentSerie.getDataId(this.config.getWidthParam()),dataString);this.cache.set(currentSerie.getMetadataId(this.config.getWidthParam()),currentSerieMetadata);if(this.config.isIntradayMultipartResponseAllowed()){lineOffset+=elementNumber;}}}}}}};prototype.updateHistoSerieData=function(pipeDelimitedString,serie,metadata,validityHours){if(pipeDelimitedString!=null&&pipeDelimitedString!=""&&serie!=null&&serie.getKey()!=null&&metadata!=null){var validity=DateUtil.getDateAfter(new Date(),validityHours,DateUtil.MS_HOUR);var stockTimeOffsetMs=HistoServletRequest.getLocaleCorrectionTimeOffset();var points=this.dataProcessor.process(pipeDelimitedString,1,null,0.0,stockTimeOffsetMs);var openPeriodString=metadata[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD];var volumeMultiplierString=metadata[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER];var metadataString=openPeriodString+MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR+volumeMultiplierString;var isAppended=false;if(serie.isEmpty()){serie.setData(points,validity,metadata);}else{if(serie.getValidity()!=null){validity=serie.getValidity();}
isAppended=serie.appendData(points,serie.getValidity(),metadata);}
var validityTime=validity.getTime();if(isAppended){this.cache.append(serie.getDataId(this.config.getWidthParam()),pipeDelimitedString);}else{var validityPrefix=validityTime+MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR;var dataString=validityPrefix+pipeDelimitedString;this.cache.set(serie.getDataId(this.config.getWidthParam()),dataString);}
this.cache.set(serie.getMetadataId(this.config.getWidthParam()),metadataString);this.newDataFlag=true;}};prototype.updateBidAskSerieData=function(linesString,serie,validityTimeMinutes){if(linesString!=null&&linesString!=""&&serie!=null&&serie.getKey()!=null){var points=this.getBidAskPoints(linesString);if(points.length>0){var validity=DateUtil.getDateAfter(new Date(),validityTimeMinutes,DateUtil.MS_MINUTE);var validityTime=validity.getTime();var validityMetadata=String.valueOf(validityTime);if(serie.isEmpty()){serie.setData(points,validity,null);}else{serie.appendData(points,validity,null);}}
this.newDataFlag=true;}};prototype.getBidAskPoints=function(linesString){var lines=(linesString).split("\n");var points=[];for(var index in lines){if(!(lines).hasOwnProperty(index))
continue;var line=lines[index];if(line!=null){var elements=(line).split("|");if(elements!=null&&elements.length>=5){var point={};point[BidAskSerie.ASK]=parseFloat(elements[0]);point[BidAskSerie.BID]=parseFloat(elements[1]);point[BidAskSerie.LAST_VOLUME]=parseFloat(elements[2]);point[BidAskSerie.LAST]=parseFloat(elements[3]);point[BidAskSerie.LAST_TIME]=elements[4];points.push(point);}}}
return points;};prototype.getDataProcessor=function(){return this.dataProcessor;};prototype.getLocalTimeZoneOffsetMs=function(){return this.localTimeZoneOffsetMs;};prototype.clone=function(){return new MobileServiceDataProvider(this.config);};},{refreshTimer:"TimeoutHandler",retrySetDataCallback:{name:"Callback2",arguments:[null,{name:"Array",arguments:[null]}]},autorefreshFunction:"Callback0",onRequestCompleteCallback:{name:"Callback4",arguments:[null,null,"D",{name:"Array",arguments:["S"]}]},stocks:{name:"Array",arguments:["Stock"]},dataProcessor:"PipeDelimitedDataProcessor",cache:"Cache",config:"ChartOption"},{});
var LocalFileDataProvider=function(config){DataProvider.call(this);this.updateConfig(config);};LocalFileDataProvider=stjs.extend(LocalFileDataProvider,DataProvider,[],function(constructor,prototype){prototype.requestId=0;prototype.currentReturnedRequestNumber=0;prototype.urls=null;prototype.getData=function(data){if(data==null){return;}
var series=this.getNewSeries(data);this.doAllRequests(data,series);};prototype.updateConfig=function(config){this.config=config;if(config==null){return;}
this.urls=config.getUrls();if(this.urls==null&&config.getUrl()!=null){this.urls=[config.getUrl()];}};prototype.getNewSeries=function(data){this.updateConfig(this.config);var urlsCount=this.urls!=null?this.urls.length:0;var colorStrategy=null;var newSeries=[];for(var i=0;i<urlsCount;i++){var currentDataSerie=new IndexedSerie(colorStrategy,1);newSeries[i]=currentDataSerie;}
return newSeries;};prototype.doAllRequests=function(data,series){this.requestId++;this.currentReturnedRequestNumber=0;var currentRequestId=this.requestId;var serieCount=series.length;for(var i=0;i<serieCount;i++){var currentSerie=series[i];this.doRequest(data,currentSerie,currentRequestId,serieCount,i,series);}};prototype.doRequest=function(data,serie,requestId,totalRequestNumber,urlIndex,series){var self=this;var setDataCallback=function(binaryString,metadata){if(self.requestId==requestId){self.currentReturnedRequestNumber++;self.setSerieData(binaryString,serie,metadata);if(self.currentReturnedRequestNumber>=totalRequestNumber){data.setSeries(series);}}};var request=new LocalFileAjaxRequest(this.urls[urlIndex],serie);request.makeRequest(setDataCallback);};prototype.setSerieData=function(returnedString,serie,metadata){if(returnedString!=null&&serie!=null){var points=null;points=$.parseJSON(returnedString);serie.setData(points,null,metadata);}};prototype.clone=function(){return new LocalFileDataProvider(this.config);};},{urls:{name:"Array",arguments:[null]},cache:"Cache",config:"ChartOption"},{});
var RawDataProvider=function(config){DataProvider.call(this);this.updateConfig(config);};RawDataProvider=stjs.extend(RawDataProvider,DataProvider,[],function(constructor,prototype){prototype.seriesPoints=null;prototype.serieType=null;prototype.getData=function(chartData){var seriesCount=this.seriesPoints!=null?this.seriesPoints.length:0;var colorStrategy=this.config.getColorStrategy();var series=[];var currentDataSerie=null;var stocks=[];if(this.config.getStocks()!=null){stocks=this.config.getStocks();}
for(var i=0;i<seriesCount;i++){if(this.serieType=="time"){currentDataSerie=new TimeSerie(colorStrategy,1);}else if(this.serieType=="histo"){var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());var histoSerie=new HistoSerie(period,null,stocks[i]);histoSerie.setStepSize(1);currentDataSerie=histoSerie;}else if(this.serieType=="intraday"){var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());var intradaySerie=new IntradaySerie(period,colorStrategy,stocks[i],this.config.isAddYesterday());intradaySerie.setXSpaceScale(1);currentDataSerie=intradaySerie;}else{currentDataSerie=new IndexedSerie(colorStrategy,1);}
currentDataSerie.setData(this.seriesPoints[i],null,null);series[i]=currentDataSerie;}
chartData.setSeries(series);};prototype.updateConfig=function(config){this.config=config;if(config==null){return;}
this.seriesPoints=config.getData();this.serieType=config.getRawDataType();};prototype.clone=function(){return new RawDataProvider(this.config);};},{seriesPoints:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},cache:"Cache",config:"ChartOption"},{});
var DataProviderFactory=function(){this.providers={};};DataProviderFactory=stjs.extend(DataProviderFactory,null,[],function(constructor,prototype){constructor.instance=null;prototype.providers=null;constructor.getInstance=function(){if(DataProviderFactory.instance==null){DataProviderFactory.instance=new DataProviderFactory();}
return DataProviderFactory.instance;};prototype.registerProvider=function(key,dp){if(key!=null&&dp!=null){var trimmedKey=key.trim();this.providers[trimmedKey]=dp;}};prototype.getProvider=function(config){var key=config.getProviderName().trim();var dp=this.providers[key];if(dp!=null){dp.setConfig(config);dp.updateConfig(config);}
return dp;};prototype.removeProvider=function(config){var key=config.getProviderName().trim();if(key!=null){delete this.providers[key];}};prototype.retriveProvider=function(key){var dp=this.providers[key];return dp;};},{instance:"DataProviderFactory",providers:{name:"Map",arguments:[null,"DataProvider"]}},{});
var Serie=function(colorStrategy,xSpaceScale,stepSize,indexed){this.colorStrategy=colorStrategy;this.id=Serie.SERIE_ID_PREFIX+new Date().getTime()+String.valueOf(Math.round((Math.random()*100000)));this.enabled=true;this.xSpaceScale=xSpaceScale;this.stepSize=stepSize;this.indexed=indexed;this.dashed=false;this.interactionAllowed=true;this.mainField=Serie.Y;this.aggregationStrategy=AggregationStrategy.MIN_MAX;this.type=null;this.logScale=false;this.mainFields=[this.mainField];};Serie=stjs.extend(Serie,null,[],function(constructor,prototype){constructor.SERIE_ID_PREFIX="serie_";constructor.X="x";constructor.Y="y";constructor.CHANGE="change";constructor.CHANGE_PERCENT="changePercent";prototype.id=null;prototype.name=null;prototype.points=null;prototype.enabled=false;prototype.logScale=false;prototype.interactionAllowed=false;prototype.validity=null;prototype.colorStrategy=null;prototype.xSpaceScale=0;prototype.stepSize=0;prototype.indexed=false;prototype.mainField=null;prototype.aggregationStrategy=null;prototype.color=null;prototype.dashed=false;prototype.type=null;prototype.mainFields=null;prototype.setData=function(points,validity,metadataArray){this.points=points;this.validity=validity;};prototype.appendData=function(newPoints,newValidity,metadataArray){if(this.points==null){this.setData(newPoints,newValidity,metadataArray);return false;}else{this.points=this.points.concat(newPoints);this.validity=newValidity;return true;}};prototype.computeChangeValues=function(which){if(which==null){if(this.mainField!=null){which=this.mainField;}else{which=Serie.Y;}}
var referenceValue=this.getReferenceValue();if(referenceValue==null){return;}else if(referenceValue==0){referenceValue=1.0;}
var serieCount=this.getLength();for(var i=0;i<serieCount;i++){var currentPoint=this.points[i];var change=currentPoint!=null?currentPoint[which]:null;if(change!=null&&!isNaN(change)){change-=referenceValue;var changePercent=(100*change/Math.abs(referenceValue));currentPoint[Serie.CHANGE]=change;currentPoint[Serie.CHANGE_PERCENT]=changePercent;}else if(currentPoint!=null){currentPoint[Serie.CHANGE]=null;currentPoint[Serie.CHANGE_PERCENT]=null;}}};prototype.getValue=function(i,which){if(this.points!=null&&this.points.length>0&&i!=null&&i>=0&&i<this.points.length){var point=this.points[i];if(point!=null){return point[which];}}
return null;};prototype.getValueAsDouble=function(i,which){return this.getValue(i,which);};prototype.getValueAsInteger=function(i,which){return this.getValue(i,which);};prototype.getLastPoint=function(){if(this.points!=null&&this.points.length>0){return this.points[this.points.length-1];}
return null;};prototype.getLastPointValue=function(which){if(this.points!=null&&this.points.length>0){return this.points[this.points.length-1][which];}
return null;};prototype.getPoint=function(i){if(this.points!=null&&this.points.length>0&&i>=0&&i<this.points.length){return this.points[i];}
return null;};prototype.removeAllPoints=function(){this.points=[];};prototype.addPoint=function(i,point){if(i==null){return;}
if(this.points==null){this.points=[];}
this.points.splice(i,0,point);};prototype.addValue=function(i,value){if(i==null){return;}
if(this.points==null){this.points=[];}
var point={};point[Serie.Y]=value;this.points.splice(i,0,point);};prototype.setValue=function(i,value){if(i==null){return;}
if(this.points==null){this.points=[];}
var point={};point[Serie.Y]=value;this.points[i]=point;};prototype.pushPoint=function(point){if(this.points==null){this.points=[];}
this.points.push(point);};prototype.pushValue=function(value){if(this.points==null){this.points=[];}
var point={};point[Serie.Y]=value;this.points.push(point);};prototype.getStepSize=function(){return this.stepSize;};prototype.getXSpaceScale=function(){return this.xSpaceScale;};prototype.isIndexed=function(){return this.indexed;};prototype.getAggregateValuesFromRange=function(strat,first,last,whichSerieValue){switch(strat){case AggregationStrategy.FIRST:return[this.getValueAsDouble(first,whichSerieValue)];case AggregationStrategy.LAST:return[this.getValueAsDouble(last,whichSerieValue)];case AggregationStrategy.FIRST_LAST:var firstValue=this.getValueAsDouble(first,whichSerieValue);var lastValue=this.getValueAsDouble(last,whichSerieValue);return[firstValue,lastValue];case AggregationStrategy.MEDIAN:var middle=Math.round((first+last)/2.0);return[this.getValueAsDouble(middle,whichSerieValue)];case AggregationStrategy.AVERAGE:var aggregatedValue=0.0;var aggregateCount=0;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null){aggregatedValue+=currentValue;aggregateCount++;}}
if(aggregateCount>0){return[(aggregatedValue/aggregateCount)];}else{return null;}
case AggregationStrategy.MIN:var currentMin=Double.POSITIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;}}
if(currentMin!=Double.POSITIVE_INFINITY){return[currentMin];}else{return null;}
case AggregationStrategy.MAX:var currentMax=Double.NEGATIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;}}
if(currentMax!=Double.NEGATIVE_INFINITY){return[currentMax];}else{return null;}
case AggregationStrategy.SUM:var sum=0;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null){sum+=currentValue;}}
return[sum];case AggregationStrategy.MIN_MAX:currentMin=Double.POSITIVE_INFINITY;currentMax=Double.NEGATIVE_INFINITY;var iMin=0;var iMax=0;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;iMin=i;}
if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;iMax=i;}}
if(currentMin!=Double.POSITIVE_INFINITY&&currentMax!=Double.NEGATIVE_INFINITY){if(iMin<iMax){return[currentMin,currentMax];}else{return[currentMax,currentMin];}}else{return null;}
case AggregationStrategy.NONE:default:var values=[];for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null){values.push(currentValue);}}
return values.length>0?values:null;}};constructor.points2Value=function(points,index,mainField){if(points==null){return null;}else if(points[index]!=null){return points[index][mainField];}else{return null;}};constructor.getAggregateValuesFromPoints=function(strat,points,whichSerieValue){if(points==null||points.length<=0){return null;}else if(points.length==1){return[Serie.points2Value(points,0,whichSerieValue)];}else{}
var first=0;var last=points.length-1;switch(strat){case AggregationStrategy.FIRST:return[Serie.points2Value(points,first,whichSerieValue)];case AggregationStrategy.LAST:return[Serie.points2Value(points,last,whichSerieValue)];case AggregationStrategy.FIRST_LAST:var firstValue=Serie.points2Value(points,first,whichSerieValue);var lastValue=Serie.points2Value(points,last,whichSerieValue);return[firstValue,lastValue];case AggregationStrategy.MEDIAN:var middle=Math.round((first+last)/2.0);return[Serie.points2Value(points,middle,whichSerieValue)];case AggregationStrategy.AVERAGE:var aggregatedValue=0.0;var aggregateCount=0;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null){aggregatedValue+=currentValue;aggregateCount++;}}
if(aggregateCount>0){return[(aggregatedValue/aggregateCount)];}else{return null;}
case AggregationStrategy.MIN:var currentMin=Double.POSITIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;}}
if(currentMin!=Double.POSITIVE_INFINITY){return[currentMin];}else{return null;}
case AggregationStrategy.MAX:var currentMax=Double.NEGATIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;}}
if(currentMax!=Double.NEGATIVE_INFINITY){return[currentMax];}else{return null;}
case AggregationStrategy.SUM:var sum=0;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null){sum+=currentValue;}}
return[sum];case AggregationStrategy.MIN_MAX:currentMin=Double.POSITIVE_INFINITY;currentMax=Double.NEGATIVE_INFINITY;var iMin=0;var iMax=0;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;iMin=i;}
if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;iMax=i;}}
if(currentMin!=Double.POSITIVE_INFINITY&&currentMax!=Double.NEGATIVE_INFINITY){if(iMin<iMax){return[currentMin,currentMax];}else{return[currentMax,currentMin];}}else{return null;}
case AggregationStrategy.NONE:default:var values=[];for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null){values.push(currentValue);}}
return values.length>0?values:null;}};prototype.getXValue=function(i){};prototype.getAggregatedValues=function(aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition){var indices=this.getCorrespondingIndices(context,currentPos,width,exactPosition);if(indices==null||indices.length<=0){return null;}else if(indices.length==1){return[this.getValueAsDouble(indices[0],whichSerieValue)];}else{var first=indices[0];var last=indices[1];return this.getAggregateValuesFromRange(aggregationStrategy,first,last,whichSerieValue);}};prototype.getCorrespondingIndices=function(context,currentPos,width,exactPosition){};prototype.getIndexAtOrAfterXValue=function(xValue,xScale,startIndex,endIndex){};prototype.findIndexAtOrAfterXValue=function(xValue){var maxIndex=this.getLength()-1;if(maxIndex>=0){return this.getIndexAtOrAfterXValue(xValue,this.xSpaceScale,0,maxIndex);}else{return null;}};prototype.getIndexAtOrBeforeXValue=function(xValue,xScale,startIndex,endIndex){};prototype.findIndexAtOrBeforeXValue=function(xValue){var maxIndex=this.getLength()-1;if(maxIndex>=0){return this.getIndexAtOrBeforeXValue(xValue,this.xSpaceScale,0,maxIndex);}else{return null;}};prototype.getIndexClosestToXValue=function(xValue,xScale,startIndex,endIndex){};prototype.findIndexClosestToXValue=function(xValue){var maxIndex=this.getLength()-1;if(maxIndex>=0){return this.getIndexClosestToXValue(xValue,this.xSpaceScale,0,maxIndex);}else{return null;}};prototype.getIndexAroundXValue=function(xValue,xScale,startIndex,endIndex){};prototype.getIndexAtXValue=function(xValue,xScale,startIndex,endIndex){};prototype.getFirstValidIndexWithSameXValue=function(index,xScale){};prototype.isEmpty=function(){return(this.points==null||this.points.length==0);};prototype.getColor=function(){if(this.color!=null){return this.color;}else{return(this.colorStrategy!=null)?this.colorStrategy.getColor():null;}};prototype.setColor=function(color){this.color=color;};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getReferenceValue=function(){return this.getFirstValidValue(0,Serie.Y);};prototype.getColorStrategy=function(){return this.colorStrategy;};prototype.setColorStrategy=function(colorStrategy){this.colorStrategy=colorStrategy;};prototype.getLength=function(){return(this.points==null)?0:this.points.length;};prototype.getId=function(){return this.id;};prototype.isEnabled=function(){return this.enabled;};prototype.setEnabled=function(enabled){this.enabled=enabled;};prototype.isInteractionAllowed=function(){return this.interactionAllowed;};prototype.setInteractionAllowed=function(interactionAllowed){this.interactionAllowed=interactionAllowed;};prototype.getValidity=function(){return this.validity;};prototype.getStartXValue=function(){return this.getXValue(0);};prototype.getAbsoluteStartXValue=function(){return this.getStartXValue();};prototype.getFirstXValue=function(){return this.getXValue(0);};prototype.getEndXValue=function(){return this.getLastXValue();};prototype.getAbsoluteEndXValue=function(){return this.getEndXValue();};prototype.getLastXValue=function(){var index=(this.points!=null)?this.points.length-1:-1;if(index>=0){return this.getXValue(index);}
return null;};prototype.setXAxisFormatsAndSteps=function(formats,steps){};prototype.getPointColors=function(){var res=[];for(var i=0;i<this.points.length;i++){var p=this.points[i];var color=p["color"];if(color!=null){var c=new Color(color).getColor();if(res.indexOf(c)==-1){res.push(c);}}}
return res;};prototype.getPoints=function(){return this.points;};prototype.setPoints=function(points){this.points=points;};prototype.setStepSize=function(stepSize){this.stepSize=stepSize;};prototype.setXSpaceScale=function(xSpaceScale){this.xSpaceScale=xSpaceScale;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getXType=function(){var pointsCount=this.getLength();for(var i=0;i<pointsCount;i++){var value=this.getValue(i,Serie.X);if(value!=null){return Formatter.getObjectXType(value);}}
return null;};prototype.getMainField=function(){return this.mainField;};prototype.getMainFields=function(){return this.mainFields;};prototype.setMainField=function(mainField){this.mainField=mainField;};prototype.setMainFields=function(mainFields){this.mainFields=mainFields;};prototype.getAggregationStrategy=function(){return this.aggregationStrategy;};prototype.setAggregationStrategy=function(aggregationStrategy){this.aggregationStrategy=aggregationStrategy;};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.isLogScale=function(){return this.logScale;};prototype.setLogScale=function(logScale){this.logScale=logScale;};prototype.getFirstValidValue=function(startIndex,which){if(startIndex==null||isNaN(startIndex)){startIndex=0;}
var possibleValue=this.getValueAsDouble(startIndex,which);var firstValidIndex=startIndex+1;var length=this.getLength();while(firstValidIndex<length&&(possibleValue==null||isNaN(possibleValue))){possibleValue=this.getValueAsDouble(firstValidIndex,which);firstValidIndex++;}
return possibleValue;};prototype.getLastValidValue=function(startIndex,which){if(startIndex==null||isNaN(startIndex)){startIndex=0;}
var possibleValue=this.getValueAsDouble(startIndex,which);var firstValidIndex=startIndex-1;while(firstValidIndex>=0&&(possibleValue==null||isNaN(possibleValue))){possibleValue=this.getValueAsDouble(firstValidIndex,which);firstValidIndex--;}
return possibleValue;};prototype.getXValueFloor=function(value){return Math.floor(value);};prototype.getXValueCeil=function(value){return Math.ceil(value);};prototype.getXValueRound=function(value){return Math.round(value);};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});;
var FinancialSerie=function(){};FinancialSerie=stjs.extend(FinancialSerie,null,[],function(constructor,prototype){constructor.CLOSE="y";constructor.HIGH="high";constructor.LOW="low";constructor.OPEN="open";constructor.VOLUME="volume";constructor.DATA_ID_PREFIX="serie_";constructor.METADATA_ID_PREFIX="meta_";prototype.setMetadata=function(metadataArray){};prototype.getPeriod=function(){};prototype.setStock=function(stock){};prototype.getStock=function(){};prototype.getKey=function(){};prototype.getDataId=function(pixelCount){};prototype.getMetadataId=function(pixelCount){};prototype.createDataId=function(key,period,pixelCount){};prototype.createMetadataId=function(key,period,pixelCount){};prototype.isIntraday=function(){};prototype.setForcedInterval=function(first,last){};},{},{});
var IndexedSerie=function(colorStrategy,stepSize){Serie.call(this,colorStrategy,1,stepSize==null?1:stepSize,true);};IndexedSerie=stjs.extend(IndexedSerie,Serie,[],function(constructor,prototype){prototype.getXValue=function(i){return i;};prototype.getCorrespondingIndices=function(context,currentPos,width,exactPosition){var serieStartIndex=context.getMinIndex(this.id,Serie.X);serieStartIndex=(serieStartIndex==null)?0:serieStartIndex;var serieEndIndex=context.getMaxIndex(this.id,Serie.X);serieEndIndex=(serieEndIndex==null)?(this.getLength()-1):serieEndIndex;var pointsPerPixel=((serieEndIndex-serieStartIndex+1.0)/width);if(!exactPosition&&currentPos<0){currentPos=0;}
if(!exactPosition&&currentPos>=width){currentPos=width-1;}
if(pointsPerPixel>1){var first=stjs.trunc(Math.round(serieStartIndex+(pointsPerPixel*currentPos)));var last=stjs.trunc(Math.round(serieStartIndex-1+(pointsPerPixel*(currentPos+1))));if(last>serieEndIndex){last=serieEndIndex;}
if(!exactPosition&&first>serieEndIndex){return[serieEndIndex];}
if(first<serieStartIndex){first=serieStartIndex;}
if(!exactPosition&&last<serieStartIndex){return[serieStartIndex];}
if(last<first){return null;}
return[first,last];}else if(pointsPerPixel<1){if(currentPos<=0){return[serieStartIndex];}
pointsPerPixel=((serieEndIndex-serieStartIndex)/(width-1.0));var previousIndex=serieStartIndex+(pointsPerPixel*(currentPos-1));var currentIndex=serieStartIndex+(pointsPerPixel*currentPos);var nextIndex=serieStartIndex+(pointsPerPixel*(currentPos+1));var previousIndexRounded=Math.round(previousIndex);var currentIndexRounded=Math.round(currentIndex);var indexRounded=currentIndexRounded;if(currentIndexRounded==previousIndexRounded&&Math.abs(indexRounded-previousIndex)<Math.abs(indexRounded-currentIndex)){indexRounded++;}
if(indexRounded>serieEndIndex){indexRounded=serieEndIndex;}
if(Math.abs(indexRounded-currentIndex)<Math.abs(indexRounded-nextIndex)){return[indexRounded];}else if(!exactPosition){return[currentIndexRounded];}else{return null;}}else{var currentIndex=serieStartIndex+currentPos;return[currentIndex];}};prototype.getIndexAtOrAfterXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getIndexAtOrBeforeXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getIndexClosestToXValue=function(xValue,xScale,startIndex,endIndex){return this.getIndexAroundXValue(xValue,xScale,startIndex,endIndex);};prototype.getIndexAroundXValue=function(xValue,xScale,startIndex,endIndex){return stjs.trunc(Math.round(xValue));};prototype.getIndexAtXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getFirstValidIndexWithSameXValue=function(index,xScale){return index;};prototype.setXAxisFormatsAndSteps=function(formats,steps){formats.push(["2"]);steps.push([this.xSpaceScale]);};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var TimeSerie=function(colorStrategy,xSpaceStep){Serie.call(this,colorStrategy,xSpaceStep,1,false);};TimeSerie=stjs.extend(TimeSerie,Serie,[],function(constructor,prototype){constructor.DATE_VALUE="x";prototype.getXValue=function(i){return this.getValueAsDouble(i,Serie.X);};prototype.getCorrespondingIndices=function(context,currentPos,width,exactPosition){var serieStartIndex=context.getMinIndex(this.id,Serie.X);var serieEndIndex=context.getMaxIndex(this.id,Serie.X);serieStartIndex=(serieStartIndex==null)?0:serieStartIndex;if(serieEndIndex==null||serieEndIndex>=this.getLength()){serieEndIndex=this.getLength()-1;}
if(!exactPosition&&currentPos<0){currentPos=0;}
if(!exactPosition&&currentPos>=width){currentPos=width-1;}
var xSpaceValue=context.getXSpaceValueAtPosition(currentPos,width);var nextXSpaceValue=context.getXSpaceValueAtPosition(currentPos+1,width);var currentXValue=this.getXValueCeil(context.getData().xSpace2NormalizedXValue(xSpaceValue)/this.xSpaceScale)*this.xSpaceScale;var nextXValue=this.getXValueCeil(context.getData().xSpace2NormalizedXValue(nextXSpaceValue)/this.xSpaceScale)*this.xSpaceScale;var startIndex=this.getIndexAtOrAfterXValue(currentXValue,this.xSpaceScale,serieStartIndex,serieEndIndex);var endIndex=this.getIndexAtOrBeforeXValue(nextXValue,this.xSpaceScale,serieStartIndex,serieEndIndex);if(startIndex==null||endIndex==null||endIndex<startIndex){if(exactPosition){return null;}else{startIndex=this.getIndexClosestToXValue(currentXValue,this.xSpaceScale,serieStartIndex,serieEndIndex);if(startIndex!=null){return[startIndex];}else{return null;}}}else if(startIndex==endIndex){return[startIndex];}else{return[startIndex,endIndex];}};prototype.getIndexAtOrAfterXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtPreviousStartIndex=Double.NEGATIVE_INFINITY;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex!=null&&previousStartIndex>=startIndex){timeAtPreviousStartIndex=this.getXValueRound(this.getValueAsDouble(previousStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(timeAtPreviousStartIndex>=searchedIndexTime){return previousStartIndex;}else if(timeAtIndex>=searchedIndexTime){return startSearchIndex;}else{return(nextStartIndex!=null&&nextStartIndex<=endIndex)?nextStartIndex:null;}};prototype.getIndexAtOrBeforeXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtNextStartIndex=Double.POSITIVE_INFINITY;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(nextStartIndex!=null&&nextStartIndex<=endIndex){timeAtNextStartIndex=this.getXValueRound(this.getValueAsDouble(nextStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(timeAtNextStartIndex<=searchedIndexTime){return nextStartIndex;}else if(timeAtIndex<=searchedIndexTime){return startSearchIndex;}else{return(previousStartIndex!=null&&previousStartIndex>=startIndex)?previousStartIndex:null;}};prototype.getIndexClosestToXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtStartIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtPreviousStartIndex=0;var timeAtNextStartIndex=0;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex<startIndex){previousStartIndex=startIndex;}
if(nextStartIndex>endIndex){nextStartIndex=endIndex;}
timeAtPreviousStartIndex=this.getXValueRound(this.getValueAsDouble(previousStartIndex,TimeSerie.DATE_VALUE)/timeScale);timeAtNextStartIndex=this.getXValueRound(this.getValueAsDouble(nextStartIndex,TimeSerie.DATE_VALUE)/timeScale);var currentDiff=Math.abs(searchedIndexTime-timeAtStartIndex);var previousDiff=Math.abs(searchedIndexTime-timeAtPreviousStartIndex);var nextDiff=Math.abs(searchedIndexTime-timeAtNextStartIndex);if(previousDiff<=currentDiff&&previousDiff<=nextDiff){return this.getFirstValidIndexWithSameXValue(previousStartIndex,timeScale);}else if(currentDiff<=nextDiff){return startSearchIndex;}else{return nextStartIndex;}};prototype.getIndexAroundXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var index=-1;var startSearchIndex=startIndex;var endSearchIndex=endIndex;if(timeMilliseconds==null||startSearchIndex==null||endSearchIndex==null||startSearchIndex>endSearchIndex||timeScale==0){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);while(startSearchIndex<endSearchIndex){index=Math.floor((startSearchIndex+endSearchIndex)/2.0);var timeAtIndex=this.getXValueRound(this.getValueAsDouble(index,TimeSerie.DATE_VALUE)/timeScale);if(timeAtIndex==searchedIndexTime){return index;}else if(searchedIndexTime-timeAtIndex>0){startSearchIndex=index+1;}else{endSearchIndex=index-1;}}
return startSearchIndex;};prototype.getFirstValidIndexWithSameXValue=function(index,timeScale){if(index==0){return index;}
var timeAtPreviousIndex=-1;var searchedTime=-2;var dateValue=this.getValueAsDouble(index,TimeSerie.DATE_VALUE);var previousElementIndex=index-1;var previousDateValue=this.getValueAsDouble(previousElementIndex,TimeSerie.DATE_VALUE);if(dateValue!=null&&previousDateValue!=null&&timeScale!=0){searchedTime=this.getXValueRound(dateValue/timeScale);timeAtPreviousIndex=this.getXValueRound(previousDateValue/timeScale);}else{return dateValue!=null?index:null;}
while(timeAtPreviousIndex==searchedTime&&index>0){index--;previousElementIndex=index-1;if(previousElementIndex>=0){previousDateValue=this.getValueAsDouble(previousElementIndex,TimeSerie.DATE_VALUE);timeAtPreviousIndex=this.getXValueRound(previousDateValue/timeScale);}}
return index;};prototype.getIndexAtXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtStartIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtPreviousStartIndex=-1;var timeAtNextStartIndex=-1;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex!=null&&previousStartIndex>=startIndex){timeAtPreviousStartIndex=this.getXValueRound(this.getValueAsDouble(previousStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(nextStartIndex!=null&&nextStartIndex<=endIndex){timeAtNextStartIndex=this.getXValueRound(this.getValueAsDouble(nextStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(timeAtPreviousStartIndex==searchedIndexTime){return this.getFirstValidIndexWithSameXValue(previousStartIndex,timeScale);}else if(timeAtStartIndex==searchedIndexTime){return startSearchIndex;}else if(timeAtNextStartIndex==searchedIndexTime){return nextStartIndex;}else{return null;}};prototype.setXAxisFormatsAndSteps=function(formats,steps){DateUtil.setXAxisFormatsAndStepsFromStepValue(this.xSpaceScale,formats,steps);};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var HistoSerie=function(period,colorStrategy,stock){IndexedSerie.call(this,colorStrategy,DateUtil.MS_DAY_24H);this.key=stock!=null?stock.getKey():"";this.name=stock!=null?stock.getSymbol():"";this.stock=stock;this.period=period;if(period!=null&&period.getFrequency()!=null){this.stepSize=period.getFrequency().getTimeValue();}
this.volumeMultiplier=null;this.forcedFirstIndex=null;this.forcedLastIndex=null;};HistoSerie=stjs.extend(HistoSerie,IndexedSerie,[FinancialSerie],function(constructor,prototype){prototype.key=null;prototype.stock=null;prototype.period=null;prototype.volumeMultiplier=null;prototype.referenceValue=null;prototype.forcedFirstIndex=null;prototype.forcedLastIndex=null;prototype.setData=function(points,validity,metadataArray){Serie.prototype.setData.call(this,points,validity,metadataArray);this.setMetadata(metadataArray);this.updateVolumeByMultiplier(points,this.volumeMultiplier);this.dropPointsOutsidePeriod();if(this.forcedFirstIndex==null||this.forcedLastIndex==null){this.referenceValue=this.getFirstValidValue(0,Serie.Y);this.forcedFirstIndex=null;this.forcedLastIndex=null;}};prototype.appendData=function(newPoints,newValidity,metadataArray){if(this.points==null||!this.isDateFlowCorrect(this.points,newPoints)){this.setData(newPoints,newValidity,metadataArray);return false;}else{var superResult=Serie.prototype.appendData.call(this,newPoints,newValidity,metadataArray);this.setMetadata(metadataArray);this.dropPointsOutsidePeriod();this.updateVolumeByMultiplier(newPoints,this.volumeMultiplier);return superResult;}};prototype.dropPointsOutsidePeriod=function(){if(this.points==null||this.period==null||this.period.getFrom()==null||this.period.getTo()==null){return;}
var minXValFromPeriod=this.period.getFrom().getTime();var maxXValFromPeriod=this.period.getTo().getTime();var startValidIndex=0;var endValidIndex=this.getLength()>0?this.getLength()-1:0;var length=this.getLength();for(var i=0;i<length;i++){var xVal=this.getValue(i,Serie.X);if(xVal!=null&&xVal<minXValFromPeriod){startValidIndex=i+1;}
if(xVal!=null&&xVal<=maxXValFromPeriod){endValidIndex=i;}}
this.points=this.points.slice(startValidIndex,endValidIndex+1);};prototype.isDateFlowCorrect=function(oldPoints,newPoints){if(oldPoints==null||newPoints==null){return false;}else if(oldPoints.length==0||newPoints.length==0){return true;}else{var oldPointsLastPoint=oldPoints[oldPoints.length-1];var newPointsFirstPoint=newPoints[0];if(oldPointsLastPoint==null||newPointsFirstPoint==null){return false;}else{var oldPointsLastDateValue=oldPointsLastPoint[Serie.X];var newPointsFirstDateValue=newPointsFirstPoint[Serie.X];return oldPointsLastDateValue!=null&&newPointsFirstDateValue!=null&&newPointsFirstDateValue>oldPointsLastDateValue;}}};prototype.updateVolumeByMultiplier=function(points,multiplier){if(multiplier!=null&&!isNaN(multiplier)){var pointCount=points.length;for(var i=0;i<pointCount;i++){var point=points[i];if(point!=null&&point[FinancialSerie.VOLUME]!=null){var initialVolume=point[FinancialSerie.VOLUME];initialVolume=initialVolume*multiplier;point[FinancialSerie.VOLUME]=initialVolume;}}}};prototype.setMetadata=function(metadataArray){if(metadataArray!=null){this.volumeMultiplier=parseInt(metadataArray[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER]);if(isNaN(this.volumeMultiplier)){this.volumeMultiplier=1;}
var openPeriod=metadataArray[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD];this.period.setOpenPeriods(openPeriod);}};prototype.getColor=function(){if(this.color!=null){return this.color;}
if(this.points==null||this.points.length==0){return this.colorStrategy.getColor();}
var isPositive=this.points[this.points.length-1][Serie.Y]>=this.getReferenceValue();if(isPositive){return this.colorStrategy.getPositiveColor();}else{return this.colorStrategy.getNegativeColor();}};prototype.getReferenceValue=function(){return this.referenceValue;};prototype.getPeriod=function(){return this.period;};prototype.getKey=function(){return this.key;};prototype.getDataId=function(pixelCount){return this.createDataId(this.key,this.period,"");};prototype.getMetadataId=function(pixelCount){return this.createMetadataId(this.key,this.period,"");};prototype.createDataId=function(key,period,pixelCount){return FinancialSerie.DATA_ID_PREFIX+key+"_"+period.getId();};prototype.createMetadataId=function(key,period,pixelCount){return FinancialSerie.METADATA_ID_PREFIX+key+"_"+period.getId();};prototype.setXAxisFormatsAndSteps=function(formats,steps){DateUtil.setXAxisFormatsAndSteps(this.period,formats,steps);};prototype.isIntraday=function(){return false;};prototype.getVolumeMultiplier=function(){return this.volumeMultiplier;};prototype.getStock=function(){return this.stock;};prototype.setStock=function(stock){this.stock=stock;};prototype.getStartXValue=function(){if(this.forcedFirstIndex!=null){return this.getXValue(this.forcedFirstIndex);}else{return this.getXValue(0);}};prototype.getAbsoluteStartXValue=function(){return this.getXValue(0);};prototype.getEndXValue=function(){var index=(this.points!=null)?this.points.length-1:-1;if(this.forcedLastIndex!=null){return this.getXValue(this.forcedLastIndex);}else if(index>=0){return this.getXValue(index);}else{return null;}};prototype.getAbsoluteEndXValue=function(){var index=(this.points!=null)?this.points.length-1:-1;if(index>=0){return this.getXValue(index);}else{return null;}};prototype.setForcedInterval=function(first,last){this.forcedFirstIndex=stjs.trunc(Math.round(first));if(this.forcedFirstIndex!=null){this.referenceValue=this.getFirstValidValue(this.forcedFirstIndex,Serie.Y);}
this.forcedLastIndex=stjs.trunc(Math.round(last));};},{stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var IntradaySerie=function(period,colorStrategy,stock,addYesterday){TimeSerie.call(this,colorStrategy,DateUtil.MS_SECOND);this.key=stock!=null?stock.getKey():"";this.name=stock!=null?stock.getSymbol():this.key;this.stock=stock;this.period=period;this.addYesterday=addYesterday;this.stretchLeftSide=false;this.stretchRightSide=false;this.yesterdayPointAdded=false;};IntradaySerie=stjs.extend(IntradaySerie,TimeSerie,[FinancialSerie],function(constructor,prototype){prototype.key=null;prototype.stock=null;prototype.period=null;prototype.timeOffset=null;prototype.referencePrice=null;prototype.addYesterday=false;prototype.yesterdayPointAdded=false;prototype.stretchLeftSide=false;prototype.stretchRightSide=false;prototype.forcedStart=null;prototype.forcedEnd=null;prototype.setData=function(points,validity,metadataArray){Serie.prototype.setData.call(this,points,validity,metadataArray);this.setMetadata(metadataArray);if(this.addYesterday&&points!=null&&points.length>0&&this.period!=null&&!this.period.spanSeveralDays()&&this.referencePrice!=null&&!isNaN(this.referencePrice)&&this.period.getFrom()!=null&&this.period.getTo()!=null){this.addPoint(0,IntradaySerie.createReferencePricePoint(this.period.getFrom().getTime(),this.referencePrice));this.yesterdayPointAdded=true;}};prototype.appendData=function(newPoints,newValidity,metadataArray){if(this.points==null){this.setData(newPoints,newValidity,metadataArray);return false;}else{var superResult=Serie.prototype.appendData.call(this,newPoints,newValidity,metadataArray);this.setMetadata(metadataArray);return superResult;}};prototype.getReferenceValue=function(){return(this.referencePrice==null||isNaN(this.referencePrice))?Serie.prototype.getReferenceValue.call(this):this.referencePrice;};prototype.setMetadata=function(metadataArray){if(metadataArray==null){return;}
this.referencePrice=parseFloat(metadataArray[2]);var openPeriodsString=metadataArray[5];this.timeOffset=stjs.trunc(parseInt(metadataArray[metadataArray.length-1]));if(this.period!=null){this.period.setTimeOffset(this.timeOffset);this.period.setOpenPeriods(openPeriodsString);}};constructor.createReferencePricePoint=function(xValue,price){var referencePoint={};referencePoint[TimeSerie.DATE_VALUE]=xValue;referencePoint[Serie.Y]=price;referencePoint[FinancialSerie.HIGH]=price;referencePoint[FinancialSerie.LOW]=price;referencePoint[FinancialSerie.OPEN]=price;referencePoint[FinancialSerie.VOLUME]=0;return referencePoint;};prototype.getPeriod=function(){return this.period;};prototype.getStartXValue=function(){if(this.forcedStart!=null){return this.forcedStart;}else if((!this.stretchLeftSide||isNaN(this.getFirstXValue()))&&this.period!=null&&this.period.getFrom()!=null){return this.period.getFrom().getTime();}else{return this.getFirstXValue();}};prototype.getAbsoluteStartXValue=function(){if((!this.stretchLeftSide||isNaN(this.getFirstXValue()))&&this.period!=null&&this.period.getFrom()!=null){return this.period.getFrom().getTime();}
return this.getFirstXValue();};prototype.getEndXValue=function(){if(this.forcedEnd!=null){return this.forcedEnd;}else if((!this.stretchRightSide||this.getLastXValue()==null||isNaN(this.getLastXValue()))&&this.period!=null&&this.period.getTo()!=null){return this.period.getTo().getTime();}else{return this.getLastXValue();}};prototype.getAbsoluteEndXValue=function(){if((!this.stretchRightSide||this.getLastXValue()==null||isNaN(this.getLastXValue()))&&this.period!=null&&this.period.getTo()!=null){return this.period.getTo().getTime();}
return this.getLastXValue();};prototype.getKey=function(){return this.key;};prototype.getDataId=function(pixelCount){return this.createDataId(this.key,this.period,pixelCount);};prototype.getMetadataId=function(pixelCount){return this.createMetadataId(this.key,this.period,pixelCount);};prototype.createDataId=function(key,period,pixelCount){return FinancialSerie.DATA_ID_PREFIX+key+"_"+period.getId()+"_"+pixelCount;};prototype.createMetadataId=function(key,period,pixelCount){return FinancialSerie.METADATA_ID_PREFIX+key+"_"+period.getId()+"_"+pixelCount;};prototype.setXAxisFormatsAndSteps=function(formats,steps){DateUtil.setXAxisFormatsAndSteps(this.period,formats,steps);};prototype.isIntraday=function(){return true;};prototype.isStretchLeftSide=function(){return this.stretchLeftSide;};prototype.setStretchLeftSide=function(stretchLeftSide){this.stretchLeftSide=stretchLeftSide;};prototype.isStretchRightSide=function(){return this.stretchRightSide;};prototype.setStretchRightSide=function(stretchRightSide){this.stretchRightSide=stretchRightSide;};prototype.getTimeOffset=function(){return this.timeOffset;};prototype.getStock=function(){return this.stock;};prototype.setStock=function(stock){this.stock=stock;};prototype.setForcedInterval=function(first,last){this.forcedStart=first;this.forcedEnd=last;};constructor.toRegularFrequency=function(mainSerie){var mainPeriod=mainSerie!=null?mainSerie.getPeriod():null;if(mainPeriod==null||!(mainPeriod.isLive()||(mainPeriod.isIntraday()&&mainPeriod.getValue()>MultiIntradayServletRequest.MAX_INTRADAY))||mainPeriod.getFrom()==null||mainPeriod.getTo()==null){return mainSerie;}
var mainSerieI=mainSerie;var regularSerie=new IntradaySerie(mainSerieI.period,mainSerieI.colorStrategy,mainSerieI.stock,false);regularSerie.referencePrice=mainSerieI.referencePrice;regularSerie.timeOffset=mainSerieI.timeOffset;regularSerie.stretchLeftSide=mainSerieI.stretchLeftSide;regularSerie.stretchRightSide=mainSerieI.stretchRightSide;regularSerie.forcedStart=mainSerieI.forcedStart;regularSerie.forcedEnd=mainSerieI.forcedEnd;regularSerie.color=mainSerieI.color;regularSerie.mainField=mainSerieI.mainField;regularSerie.mainFields=mainSerieI.mainFields!=null?mainSerieI.mainFields.slice(0):null;var regularPoints=null;if(mainSerieI.getMainField()==BidAskSerie.LAST){regularPoints=IntradaySerie.getAggregatedPointsBidAsk(mainSerieI,mainPeriod);}else{regularPoints=IntradaySerie.getAggregatedPointsIntraday(mainSerieI,mainPeriod);}
regularSerie.setData(regularPoints,DateUtil.cloneDate(mainSerieI.validity),null);return regularSerie;};constructor.getAggregatedPointsBidAsk=function(mainSerieI,mainPeriod){var currentHigh=mainSerieI.referencePrice;if(mainPeriod.spanSeveralDays()&&mainSerieI.getStock()!=null&&!mainSerieI.getStock().isSwissDotsMarket()){currentHigh=mainSerieI.getFirstValidValue(0,BidAskSerie.LAST);}
var currentLow=currentHigh;var currentOpen=currentHigh;var currentClose=currentHigh;var currentVolume=0;var accuHigh=currentHigh;var accuLow=currentHigh;var accuOpen=currentHigh;var accuClose=currentHigh;var accuVolume=0;var accuCount=0;var startIndex=0;if(mainSerieI.yesterdayPointAdded){startIndex=1;}
var length=mainSerieI.getLength();var regularPoints=[];var accuX=mainPeriod.getFrom().getTime();var maxTime=mainPeriod.getTo().getTime();if(maxTime<accuX){var tmp=accuX;accuX=maxTime;maxTime=tmp;}
var point=null;var currentXValue=null;var lastArray=null;var index=startIndex;var xStep=DateUtil.MS_MINUTE;if(mainPeriod.getFrequency()!=null&&mainPeriod.getFrequency().getTimeValue()>0){xStep=mainPeriod.getFrequency().getTimeValue();}
var middlePointCorrection=Math.round(xStep/2.0);while(accuX<=maxTime&&index<length){var nextAccuX=mainPeriod.getNextValueInPeriod(accuX,xStep);accuHigh=Double.NEGATIVE_INFINITY;accuLow=Double.POSITIVE_INFINITY;accuVolume=0;accuCount=0;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;lastArray=point!=null?point[BidAskSerie.LAST_ARRAY]:null;accuOpen=lastArray!=null?lastArray[0]:null;while((currentXValue==null||currentXValue<nextAccuX)&&index<length){if(currentXValue!=null&&lastArray!=null&&lastArray.length>0){for(var i in lastArray){if(!(lastArray).hasOwnProperty(i))
continue;accuClose=lastArray[i];if(accuClose!=null&&!isNaN(accuClose)){if(accuClose>accuHigh){accuHigh=accuClose;}
if(accuClose<accuLow){accuLow=accuClose;}
accuCount++;}}
accuVolume+=point[FinancialSerie.VOLUME];}
index++;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;lastArray=point!=null?point[BidAskSerie.LAST_ARRAY]:null;}
if(accuCount>0){currentHigh=accuHigh;currentLow=accuLow;currentOpen=accuOpen;currentClose=accuClose;currentVolume=accuVolume;}
var accuPoint={};accuPoint[Serie.X]=accuX+middlePointCorrection;accuPoint[FinancialSerie.HIGH]=currentHigh;accuPoint[FinancialSerie.LOW]=currentLow;accuPoint[FinancialSerie.OPEN]=currentOpen;accuPoint[FinancialSerie.CLOSE]=currentClose;accuPoint[FinancialSerie.VOLUME]=currentVolume;regularPoints.push(accuPoint);accuX=nextAccuX;}
return regularPoints;};constructor.getAggregatedPointsIntraday=function(mainSerieI,mainPeriod){var currentHigh=mainSerieI.referencePrice;if(mainPeriod.spanSeveralDays()){currentHigh=mainSerieI.getFirstValidValue(0,FinancialSerie.CLOSE);}
var currentLow=currentHigh;var currentOpen=currentHigh;var currentClose=currentHigh;var currentVolume=0;var accuHigh=currentHigh;var accuLow=currentHigh;var accuOpen=currentHigh;var accuClose=currentHigh;var accuVolume=0;var accuCount=0;var startIndex=0;if(mainSerieI.yesterdayPointAdded){startIndex=1;}
var length=mainSerieI.getLength();var regularPoints=[];var accuX=mainPeriod.getFrom().getTime();var maxTime=mainPeriod.getTo().getTime();if(maxTime<accuX){var tmp=accuX;accuX=maxTime;maxTime=tmp;}
var point=null;var currentXValue=null;var index=startIndex;var xStep=DateUtil.MS_MINUTE;if(mainPeriod.getFrequency()!=null&&mainPeriod.getFrequency().getTimeValue()>0){xStep=mainPeriod.getFrequency().getTimeValue();}
var middlePointCorrection=Math.round(xStep/2.0);while(accuX<=maxTime&&index<length){var nextAccuX=mainPeriod.getNextValueInPeriod(accuX,xStep);accuHigh=Double.NEGATIVE_INFINITY;accuLow=Double.POSITIVE_INFINITY;accuVolume=0;accuCount=0;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;accuOpen=point[FinancialSerie.OPEN];while((currentXValue==null||currentXValue<nextAccuX)&&index<length){if(currentXValue!=null){accuClose=point[FinancialSerie.CLOSE];var high=point[FinancialSerie.HIGH];if(high!=null&&!isNaN(high)&&high>accuHigh){accuHigh=high;}
var low=point[FinancialSerie.LOW];if(low!=null&&!isNaN(low)&&low<accuLow){accuLow=low;}
accuVolume+=point[FinancialSerie.VOLUME];accuCount++;}
index++;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;}
if(accuCount>0){currentHigh=accuHigh;currentLow=accuLow;currentOpen=accuOpen;currentClose=accuClose;currentVolume=accuVolume;}
var accuPoint={};accuPoint[Serie.X]=accuX+middlePointCorrection;accuPoint[FinancialSerie.HIGH]=currentHigh;accuPoint[FinancialSerie.LOW]=currentLow;accuPoint[FinancialSerie.OPEN]=currentOpen;accuPoint[FinancialSerie.CLOSE]=currentClose;accuPoint[FinancialSerie.VOLUME]=currentVolume;regularPoints.push(accuPoint);accuX=nextAccuX;}
return regularPoints;};},{stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var BidAskSerie=function(period,colorStrategy,stock){IntradaySerie.call(this,period,colorStrategy,stock,false);this.type=Chart.ChartType.BID_ASK;this.updateReferenceDate();};BidAskSerie=stjs.extend(BidAskSerie,IntradaySerie,[],function(constructor,prototype){constructor.ASK="ask";constructor.BID="bid";constructor.LAST_ARRAY="lastArray";constructor.VOLUME_POSITIVE="volumePositive";constructor.LAST_VOLUME="lastVolume";constructor.LAST="last";constructor.LAST_TIME="lastTime";prototype.aggregatedPoints=null;prototype.referenceDate=null;constructor.sortFunction=function(a,b){if(a!=null&&b!=null){if(a[Serie.X]<b[Serie.X]){return-1;}
if(a[Serie.X]>b[Serie.X]){return 1;}
return 0;}else{return 0;}};prototype.getReferenceDate=function(){return this.referenceDate;};prototype.setReferenceDate=function(referenceDate){this.referenceDate=referenceDate;};prototype.updateReferenceDate=function(){this.referenceDate=DateUtil.createDate(DateUtil.getDateValueInScale(new Date().getTime(),DateUtil.MS_DAY_24H));};prototype.getMainSerie=function(){return this;};prototype.appendData=function(newPoints,newValidity,metadataArray){var length=this.getLength();if(length>0&&!this.isValidLivePoint(this.getLastPoint())){this.points.splice(length-1,1);}
return IntradaySerie.prototype.appendData.call(this,newPoints,newValidity,metadataArray);};prototype.getValidLength=function(){var length=this.getLength();if(length>0&&!this.isValidLivePoint(this.getLastPoint())){return length-1;}else{return length;}};prototype.isValidLivePoint=function(point){if(point!=null){if(this.stock!=null&&this.stock.isSwissDotsMarket()){return BidAskSerie.isValidFinancialValue(point[BidAskSerie.ASK])&&BidAskSerie.isValidFinancialValue(point[BidAskSerie.BID]);}else{return BidAskSerie.isValidFinancialValue(point[BidAskSerie.LAST]);}}
return false;};constructor.isValidFinancialValue=function(value){return value!=null&&!isNaN(value)&&value>0;};prototype.getAggregatedSerie=function(){var aggregatedSerie=new BidAskAggregatedSerie(this,BidAskSerie.LAST,AggregationStrategy.MIN);this.aggregatedPoints=this.getAggregatedPoints();if(this.aggregatedPoints!=null){this.aggregatedPoints.sort(BidAskSerie.sortFunction);}
aggregatedSerie.setData(this.aggregatedPoints,DateUtil.cloneDate(this.validity),null);aggregatedSerie.referencePrice=this.referencePrice;aggregatedSerie.timeOffset=this.timeOffset;aggregatedSerie.stretchLeftSide=this.stretchLeftSide;aggregatedSerie.stretchRightSide=this.stretchRightSide;aggregatedSerie.forcedStart=this.forcedStart;aggregatedSerie.forcedEnd=this.forcedEnd;aggregatedSerie.color=this.color;aggregatedSerie.mainFields=[BidAskSerie.BID,BidAskSerie.ASK,BidAskSerie.LAST];aggregatedSerie.dropPointsAfterPeriodEnd();return aggregatedSerie;};prototype.setPointsXValues=function(){var points=this.points;for(var index in points){if(!(points).hasOwnProperty(index))
continue;var point=points[index];if(point!=null){point[Serie.X]=this.liveTimeToDateValue(this.referenceDate,point[BidAskSerie.LAST_TIME]);}}};prototype.getAggregatedPoints=function(){var aggregatedPoints=[];if(this.points==null||this.points.length==0){return aggregatedPoints;}
this.setPointsXValues();var currentPoint={};var currentLastTime=parseInt(this.getValue(0,BidAskSerie.LAST_TIME));currentPoint[Serie.X]=this.getValue(0,Serie.X);var last=this.getValue(0,BidAskSerie.LAST);var currentVolume=null;var volumePositive=null;var currentLastArray=[];var pointCount=this.points!=null?this.points.length:0;for(var i=1;i<pointCount;i++){var currentTime=parseInt(this.getValue(i,BidAskSerie.LAST_TIME));if(currentTime>currentLastTime){if(currentPoint!=null){currentPoint[FinancialSerie.VOLUME]=currentVolume;currentPoint[BidAskSerie.VOLUME_POSITIVE]=volumePositive;currentPoint[BidAskSerie.LAST_ARRAY]=currentLastArray;currentPoint[BidAskSerie.LAST]=last;aggregatedPoints.push(currentPoint);currentPoint=null;}
currentLastTime=currentTime;}
if(currentTime==currentLastTime){last=this.getValue(i,BidAskSerie.LAST);var vol=this.getValue(i,BidAskSerie.LAST_VOLUME);var bidValue=this.getValue(i,BidAskSerie.BID);if(currentPoint==null){currentPoint={};var askValue=this.getValue(i,BidAskSerie.ASK);currentPoint[BidAskSerie.ASK]=askValue;currentPoint[FinancialSerie.HIGH]=askValue;currentPoint[BidAskSerie.BID]=bidValue;currentPoint[FinancialSerie.LOW]=bidValue;currentPoint[Serie.X]=this.getValue(i,Serie.X);volumePositive=last>bidValue;currentVolume=vol;currentLastArray=[last];}else{if(currentLastArray==null){currentLastArray=[last];}else if(currentLastArray.indexOf(last)==-1){currentLastArray.push(last);}
if(currentVolume==null){currentVolume=vol;volumePositive=last>bidValue;}else if(vol!=null){currentVolume+=vol;volumePositive=last>bidValue;}}}}
if(currentPoint!=null){currentPoint[FinancialSerie.VOLUME]=currentVolume;currentPoint[BidAskSerie.VOLUME_POSITIVE]=volumePositive;currentPoint[BidAskSerie.LAST_ARRAY]=currentLastArray;currentPoint[BidAskSerie.LAST]=last;aggregatedPoints.push(currentPoint);currentPoint=null;}
return aggregatedPoints;};prototype.liveTimeToDateValue=function(today,liveTimeHMMSS){if(liveTimeHMMSS==null){return null;}else{var paddedTime=this.leftPad(liveTimeHMMSS,6);var hours=parseInt(paddedTime.substring(0,2));var minutes=parseInt(paddedTime.substring(2,4));var seconds=parseInt(paddedTime.substring(4,6));today.setHours(hours);today.setMinutes(minutes);today.setSeconds(seconds);return today.getTime();}};prototype.leftPad=function(str,desiredLength){if(str==null){return null;}
while(str.length<desiredLength){str="0"+str;}
return str;};prototype.setMetadata=function(metadataArray){this.referencePrice=this.getValue(0,BidAskSerie.LAST);};prototype.createDataId=function(key,period,pixelCount){return IntradaySerie.prototype.createDataId.call(this,key,period,pixelCount)+"bidask";};prototype.createMetadataId=function(key,period,pixelCount){return IntradaySerie.prototype.createMetadataId.call(this,key,period,pixelCount)+"bidask";};prototype.getBeforeLastPoint=function(){if(this.points!=null&&this.points.length>1){return this.points[this.points.length-2];}
return null;};prototype.setPeriod=function(period){this.period=period;};prototype.setReferenceValue=function(referenceValue){this.referencePrice=referenceValue;};prototype.setTimeOffset=function(timeOffset){this.timeOffset=timeOffset;};},{aggregatedPoints:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},referenceDate:"Date",sortFunction:{name:"SortFunction",arguments:[{name:"Map",arguments:[null,"Object"]}]},stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var BidAskAggregatedSerie=function(mainSerie,mainField,aggregationStrategy){BidAskSerie.call(this,mainSerie.period,mainSerie.colorStrategy,mainSerie.stock);this.mainSerie=mainSerie;this.mainField=mainField;this.aggregationStrategy=aggregationStrategy;this.type=Chart.ChartType.BID_ASK;};BidAskAggregatedSerie=stjs.extend(BidAskAggregatedSerie,BidAskSerie,[],function(constructor,prototype){prototype.mainSerie=null;prototype.getMainSerie=function(){return this.mainSerie;};prototype.getValue=function(i,which){if(this.points!=null&&this.points.length>0&&i!=null&&i>=0&&i<this.points.length){var point=this.points[i];if(point!=null){if(which==Serie.Y){return point[this.mainField];}else{return point[which];}}}
return null;};prototype.prepend=function(pointsToPrepend,length){if(pointsToPrepend!=null&&length>0){var beforeLiveData=[];for(var i=0;i<length;i++){beforeLiveData.push(this.intraday2BidAskPoint(pointsToPrepend[i]));}
var lenght=this.getLength();for(var i=0;i<lenght;i++){beforeLiveData.push(this.points[i]);}
this.points=beforeLiveData;}};prototype.dropPointsAfterPeriodEnd=function(){if(this.period!=null&&this.period.getTo()!=null){var invalidIndex=this.findIndexAtOrAfterXValue(this.period.getTo().getTime()+this.xSpaceScale);if(invalidIndex!=null&&!isNaN(invalidIndex)&&invalidIndex>0){if(this.points!=null){this.points.splice(invalidIndex,this.points.length-invalidIndex);}}}};prototype.intraday2BidAskPoint=function(intradayPoint){if(intradayPoint==null){return null;}
var point={};var last=intradayPoint[Serie.Y];var high=intradayPoint[FinancialSerie.HIGH];var bid=intradayPoint[FinancialSerie.LOW];var volume=intradayPoint[FinancialSerie.VOLUME];point[BidAskSerie.ASK]=high;point[FinancialSerie.HIGH]=high;point[BidAskSerie.BID]=bid;point[BidAskSerie.LOW]=bid;point[BidAskSerie.LAST_VOLUME]=volume;point[FinancialSerie.VOLUME]=volume;point[BidAskSerie.LAST]=last;point[Serie.X]=intradayPoint[Serie.X];point[BidAskSerie.VOLUME_POSITIVE]=last>bid;point[BidAskSerie.LAST_ARRAY]=[last];return point;};},{mainSerie:"BidAskSerie",aggregatedPoints:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},referenceDate:"Date",sortFunction:{name:"SortFunction",arguments:[{name:"Map",arguments:[null,"Object"]}]},stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var Stock=function(key){this.key=key;};Stock=stjs.extend(Stock,null,[],function(constructor,prototype){constructor.marketExtensions={"xx":",ANY","ch":"","chi":"","chid":"","so":",SO","vx":",V","us":",U","ff":",FF","be":",BE","du":",DU","ha":",HA","hv":",HV","mu":",MU","st":",ST","de":",X","fr":",E","fu":",F","no":",O","dk":",K","fi":",H","se":",S","ew":",W","eu":",R","cu":",C","ca":",CA","gb":",GB","it":",IT","at":",AT","co":",CO","is":",IS","cm":",CM","una":",UNA"};constructor.CURRENCY_SEPARATOR_CHAR="_";constructor.INDEX_STOCK_TYPE_ID="4";constructor.COMMODITY_STOCK_TYPE_ID="7";constructor.CURRENCY_STOCK_TYPE_ID="5";constructor.CRYPTO_STOCK_TYPE_ID="8";constructor.SWISS_DOTS_MARKET_ID="672";constructor.publicIsin1="USDJIA000004";constructor.premiumIsin1="USDJIAR00005";constructor.publicIsin2="DEDAX0000007";constructor.premiumIsin2="DEDAXR000000";prototype.key=null;prototype.name=null;prototype.symbol=null;prototype.currency=null;prototype.isin=null;prototype.stockExchangeId=null;prototype.marketId=null;prototype.marketName=null;prototype.stockTypeId=null;constructor.map2Stock=function(stockMap){var stock=null;if(stockMap!=null){stock=new Stock(stockMap["key"]);stock.setName(stockMap["name"]);stock.setSymbol(stockMap["symbol"]);stock.setCurrency(stockMap["currency"]);stock.setIsin(stockMap["isin"]);stock.setStockExchangeId(stockMap["stockExchangeId"]);stock.setMarketId(stockMap["marketId"]);stock.setMarketName(stockMap["marketName"]);stock.setStockTypeId(stockMap["stockTypeId"]);}
return stock;};constructor.stock2Map=function(stock){if(stock!=null){var stockMap={};stockMap["key"]=stock.key;stockMap["name"]=stock.name;stockMap["symbol"]=stock.symbol;stockMap["currency"]=stock.currency;stockMap["isin"]=stock.isin;stockMap["stockExchangeId"]=stock.stockExchangeId;stockMap["marketId"]=stock.marketId;stockMap["marketName"]=stock.marketName;stockMap["stockTypeId"]=stock.stockTypeId;return stockMap;}else{return null;}};constructor.stockSearchResult2Stock=function(key,result){var stock=null;if(key!=null){stock=new Stock(key);if(result!=null){stock.setName(result.getName());stock.setSymbol(result.getSymbol());stock.setCurrency(result.getCurrency());stock.setIsin(result.getIsin());stock.setStockExchangeId(result.getStockExchangeId());stock.setMarketId(result.getMarketId());stock.setMarketName(result.getMarketName());stock.setStockTypeId(result.getStockTypeId());}}
return stock;};prototype.getKey=function(){return this.key;};prototype.setKey=function(key){this.key=key;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getSymbol=function(){return this.symbol;};prototype.setSymbol=function(symbol){this.symbol=symbol;};prototype.getCurrency=function(){return this.currency;};prototype.setCurrency=function(currency){this.currency=currency;};prototype.getIsin=function(){return this.isin;};prototype.setIsin=function(isin){this.isin=isin;};prototype.getStockExchangeId=function(){return this.stockExchangeId;};prototype.setStockExchangeId=function(stockExchangeId){this.stockExchangeId=stockExchangeId;};prototype.getMarketId=function(){return this.marketId;};prototype.setMarketId=function(marketId){this.marketId=marketId;};prototype.getMarketName=function(){return this.marketName;};prototype.setMarketName=function(marketName){this.marketName=marketName;};prototype.getStockTypeId=function(){return this.stockTypeId;};prototype.setStockTypeId=function(stockTypeId){this.stockTypeId=stockTypeId;};prototype.isSwissDotsMarket=function(){return this.stockExchangeId==Stock.SWISS_DOTS_MARKET_ID;};prototype.isCurrency=function(){return this.stockTypeId==Stock.CURRENCY_STOCK_TYPE_ID;};prototype.isCryptoCurrency=function(){return this.stockTypeId==Stock.CRYPTO_STOCK_TYPE_ID;};prototype.isIndex=function(){return this.stockTypeId==Stock.INDEX_STOCK_TYPE_ID;};prototype.isCommodity=function(){return this.stockTypeId==Stock.COMMODITY_STOCK_TYPE_ID;};prototype.getInverseCurrency=function(){if(this.isCurrency()&&Stock.getValidCurrencyPair(this.name)!=null){var inverse=new Stock(this.key);var currPair=Stock.getValidCurrencyPair(this.name);inverse.name=currPair[1]+Stock.CURRENCY_SEPARATOR_CHAR+currPair[0];inverse.symbol=currPair[1]+Stock.CURRENCY_SEPARATOR_CHAR+currPair[0];inverse.currency=currPair[0];inverse.isin="CCX"+currPair[1]+"X"+currPair[0]+"XX";inverse.stockExchangeId=this.stockExchangeId;inverse.marketId=this.marketId;inverse.marketName=this.marketName;inverse.stockTypeId=this.stockTypeId;inverse.key=Stock.createKey(inverse.isin,inverse.stockExchangeId,inverse.currency);return inverse;}else{return null;}};constructor.getValidCurrencyPair=function(name){if(name!=null){var currSplit=(name).split(Stock.CURRENCY_SEPARATOR_CHAR);if(currSplit!=null&&currSplit.length==2&&currSplit[0]!=currSplit[1]){return currSplit;}else{return null;}}else{return null;}};constructor.createKey=function(isin,exchangeId,currency){var exchangeValue=parseInt(exchangeId);if(isin==null||exchangeId==null||currency==null||exchangeValue==null||isNaN(exchangeValue)){return null;}
var exchangeIdString=exchangeId;if(exchangeValue<0){exchangeIdString="M"+String.valueOf(-exchangeValue);}
return isin+"_"+exchangeIdString+"_"+currency;};prototype.getMarketExtension=function(){if(this.marketId!=null&&Stock.marketExtensions[this.marketId]!=null){return Stock.marketExtensions[this.marketId];}else{return"";}};prototype.filterPublicPremiumIsin=function(isPublic){if(isPublic){if(this.isin==Stock.premiumIsin1){this.isin=Stock.publicIsin1;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}else if(this.isin==Stock.premiumIsin2){this.isin=Stock.publicIsin2;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}}else{if(this.isin==Stock.publicIsin1){this.isin=Stock.premiumIsin1;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}else if(this.isin==Stock.publicIsin2){this.isin=Stock.premiumIsin2;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}}};},{marketExtensions:{name:"Map",arguments:[null,null]}},{});
var Cache=function(){this.storage=(window)["sessionStorage"];this.sessionStorageAvailable=((typeof this.storage)!="undefined");};Cache=stjs.extend(Cache,null,[],function(constructor,prototype){constructor.LAST_CLEAR_ID="cacheLastClearTime";constructor.CACHE_VALIDITY_TIME=3600000;constructor.instance=null;prototype.storage=null;prototype.sessionStorageAvailable=false;constructor.getInstance=function(){if(Cache.instance==null){Cache.instance=new Cache();}
Cache.instance.validate();return Cache.instance;};prototype.get=function(key){var currentValue=null;if(key!=null&&this.sessionStorageAvailable){currentValue=this.storage.getItem(key);}
return currentValue;};prototype.set=function(key,value){if(key!=null&&this.sessionStorageAvailable){try{this.storage.setItem(key,value);}catch(e){this.clear();}}};prototype.remove=function(key){if(key!=null&&this.sessionStorageAvailable){this.storage.removeItem(key);}};prototype.append=function(key,value){if(key!=null&&this.sessionStorageAvailable){var currentValue=this.storage[key];if(currentValue==null){currentValue="";}
if(value==null){value="";}
currentValue=currentValue+value;try{this.storage[key]=currentValue;}catch(e){}}};prototype.clear=function(){if(this.sessionStorageAvailable){this.storage.clear();}};prototype.validate=function(){var lastClearTimeString=this.get(Cache.LAST_CLEAR_ID);var now=new Date();var nowTime=now.getTime();if(lastClearTimeString==null||isNaN(lastClearTimeString)){this.clear();this.set(Cache.LAST_CLEAR_ID,nowTime+"");}else{var lastClearTime=parseInt(lastClearTimeString);if(isNaN(lastClearTime)||((lastClearTime+Cache.CACHE_VALIDITY_TIME)<nowTime)){this.clear();this.set(Cache.LAST_CLEAR_ID,nowTime+"");}}};},{instance:"Cache",storage:"Storage"},{});
var ChartData=function(chart,provider){Observable.call(this);this.provider=provider;this.chart=chart;this.cache=Cache.getInstance();this.series=[];this.totalXSpace=0;this.stepSize=1;this.availableFormats=[];this.possibleXSteps=[];this.xValuesPeriods=null;this.logScale=false;this.mainSerieTimeOffsetMs=0;};ChartData=stjs.extend(ChartData,Observable,[],function(constructor,prototype){prototype.chart=null;prototype.provider=null;prototype.cache=null;prototype.series=null;prototype.extremums=null;prototype.totalXSpace=0.0;prototype.xSpaceValuesScale=0.0;prototype.logScale=false;prototype.indexedXSpace=false;prototype.indexedXValues=null;prototype.availableFormats=null;prototype.possibleXSteps=null;prototype.xValuesPeriods=null;prototype.stepSize=0.0;prototype.mainSerieTimeOffsetMs=0;prototype.fetchDataSeries=function(){this.provider.getData(this);};prototype.setSeries=function(series){this.series=series;this.updateSeriesLogScale();this.validateData();this.notifyObservers(this);};prototype.validateData=function(){var serieCount=(this.series!=null)?this.series.length:0;var mainSerie=this.getMainSerie();if(serieCount<=0||mainSerie==null){this.xValuesPeriods=null;this.extremums=null;this.totalXSpace=0;return;}
this.xSpaceValuesScale=mainSerie.getXSpaceScale();this.indexedXSpace=mainSerie.isIndexed();this.stepSize=mainSerie.getStepSize();if(this.indexedXSpace){this.indexedXValues=this.createGlobalIndexedXValues();}
var minNormalizedXValue=Double.POSITIVE_INFINITY;var maxNormalizedXValue=Double.NEGATIVE_INFINITY;var seriesPeriods=[];var flattenedPeriodSpace=0.0;for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.isEnabled()){var serieStartValue=serie.getAbsoluteStartXValue();var serieEndValue=serie.getAbsoluteEndXValue();flattenedPeriodSpace=this.updatePeriods(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue);if(!isNaN(serieStartValue)&&serieStartValue<minNormalizedXValue){minNormalizedXValue=serieStartValue;}
if(!isNaN(serieEndValue)&&serieEndValue>maxNormalizedXValue){maxNormalizedXValue=serieEndValue;}}}
this.xValuesPeriods=seriesPeriods;this.totalXSpace=flattenedPeriodSpace;if(minNormalizedXValue==Double.POSITIVE_INFINITY||maxNormalizedXValue==Double.NEGATIVE_INFINITY){this.extremums=null;}else{this.extremums=[];this.extremums[0]=minNormalizedXValue;this.extremums[1]=maxNormalizedXValue;}
this.availableFormats=[];this.possibleXSteps=[];mainSerie.setXAxisFormatsAndSteps(this.availableFormats,this.possibleXSteps);};prototype.createGlobalIndexedXValues=function(){var seriesCount=this.getSerieCount();var currentMaxLength=-1;var maxSerie=null;for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()&&currentSerie.getLength()>currentMaxLength){currentMaxLength=currentSerie.getLength();maxSerie=currentSerie;}}
if(maxSerie!=null){var indexedXValues=[];for(var i=0;i<currentMaxLength;i++){indexedXValues.push(maxSerie.getValueAsDouble(i,Serie.X));}
return indexedXValues;}
return null;};prototype.updatePeriods=function(orderedXValuesPeriods,initialSize,serieStartValueToAdd,serieEndValueToAdd){if(orderedXValuesPeriods==null||serieStartValueToAdd==null||serieEndValueToAdd==null||isNaN(serieStartValueToAdd)||isNaN(serieEndValueToAdd)||serieEndValueToAdd<=serieStartValueToAdd){return initialSize;}
var serieStartValueToAddNormalized=serieStartValueToAdd;var serieEndValueToAddNormalized=serieEndValueToAdd;var currentSize=initialSize!=null?initialSize:0;var currentPeriodsCount=orderedXValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=orderedXValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];if(serieEndValueToAddNormalized<currentPeriodStart){orderedXValuesPeriods.splice(i,0,[serieStartValueToAddNormalized,serieEndValueToAddNormalized]);return currentSize+(serieEndValueToAddNormalized-serieStartValueToAddNormalized+1);}else if(serieStartValueToAddNormalized<currentPeriodStart&&serieEndValueToAddNormalized<=currentPeriodEnd){currentPeriod[0]=serieStartValueToAddNormalized;orderedXValuesPeriods[i]=currentPeriod;return currentSize+(currentPeriodStart-serieStartValueToAddNormalized);}else if(serieStartValueToAddNormalized>=currentPeriodStart&&serieEndValueToAddNormalized<=currentPeriodEnd){return currentSize;}else if(serieStartValueToAddNormalized>currentPeriodEnd){}else{if(serieStartValueToAddNormalized<currentPeriodStart){orderedXValuesPeriods.splice(i,1);currentSize-=(currentPeriodEnd-currentPeriodStart+1);i--;currentPeriodsCount--;}else{orderedXValuesPeriods.splice(i,1);currentSize-=(currentPeriodEnd-currentPeriodStart+1);serieStartValueToAddNormalized=currentPeriodStart;i--;currentPeriodsCount--;}}}
orderedXValuesPeriods.push([serieStartValueToAddNormalized,serieEndValueToAddNormalized]);return currentSize+(serieEndValueToAddNormalized-serieStartValueToAddNormalized+1);};prototype.getSeries=function(){return this.series;};prototype.getSerie=function(index){if(this.series!=null&&index>=0&&index<this.series.length){return this.series[index];}
return null;};prototype.getSerieCount=function(){return(this.series==null)?0:this.series.length;};prototype.getMainSerie=function(){return(this.series==null)?null:this.series[0];};prototype.getMainSerieLength=function(){var main=this.getMainSerie();return(main==null)?0:main.getLength();};prototype.getTotalXSpace=function(){return this.totalXSpace;};prototype.getCurrentXSpaceSize=function(range){if(range!=null&&range[0]!=null&&range[1]!=null){return this.computeXSpaceSizeFromPeriods(this.xValuesPeriods,range[0],range[1]);}
return this.totalXSpace;};prototype.computeXSpaceSizeFromPeriods=function(periods,start,end){if(start==null||end==null||isNaN(start)||isNaN(end)||end<=start){return 0.0;}
if(periods==null||periods.length<=0){return end-start+1.0;}
var currentSize=0.0;var currentPeriodsCount=periods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=periods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var startValue=currentPeriodStart;var endValue=currentPeriodEnd;if(end<=currentPeriodEnd){endValue=end;}
if(start>=currentPeriodStart){startValue=start;}
if(end<currentPeriodStart){return currentSize;}else if(start<=currentPeriodEnd){currentSize=currentSize+(endValue-startValue+1.0);}else{}}
if(currentSize<this.chart.getMinimumZoomFactor()){currentSize=this.chart.getMinimumZoomFactor();}
return currentSize;};prototype.getXSpaceValuesScale=function(){return this.xSpaceValuesScale;};prototype.getExtremums=function(){return this.extremums!=null?this.extremums.slice(0):null;};prototype.isIndexed=function(){return this.indexedXSpace;};prototype.isEmpty=function(){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&!serie.isEmpty()){return false;}}
return true;};prototype.getAvailableFormats=function(){return this.availableFormats;};prototype.setAvailableFormats=function(availableFormats){this.availableFormats=availableFormats;};prototype.getPossibleXSteps=function(){return this.possibleXSteps;};prototype.setPossibleXSteps=function(possibleXSteps){this.possibleXSteps=possibleXSteps;};prototype.getXStepSize=function(){return this.stepSize;};prototype.clear=function(){this.extremums=null;var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var currentSerie=this.series[i];if(currentSerie!=null){currentSerie.removeAllPoints();}}};prototype.xSpace2ClosestXValue=function(xSpacePosition){return this.normalizedXValue2XValue(this.xSpace2NormalizedXValue(xSpacePosition));};prototype.xSpace2CurrentOrPreviousXValue=function(xSpacePosition){return this.normalizedXValue2XValue(this.applySerieCeil(this.xSpace2NormalizedXValue(xSpacePosition)));};prototype.normalizedXValue2XValue=function(normalizedXValue){if(this.isIndexed()){if(this.indexedXValues!=null){return this.indexedXValues[stjs.trunc(Math.round(normalizedXValue))];}
return null;}
return normalizedXValue;};prototype.xValue2normalizedXValue=function(xValue){if(this.isIndexed()){return Math.round(this.findIndexAroundValue(xValue,this.indexedXValues,this.stepSize));}
return xValue;};prototype.xValue2XSpace=function(xValue){return this.normalizedXValue2XSpace(this.xValue2normalizedXValue(xValue));};prototype.xSpace2NormalizedXValue=function(xSpacePosition){if(xSpacePosition==null){return null;}
if(xSpacePosition<=0){return this.extremums!=null?this.extremums[0]:null;}
if(xSpacePosition>=this.getTotalXSpace()-1){return this.extremums!=null?this.extremums[1]:null;}
var currentPeriodsCount=this.xValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var periodSize=currentPeriodEnd-currentPeriodStart+1;if(xSpacePosition<periodSize){return(currentPeriodStart+xSpacePosition);}
xSpacePosition-=periodSize;}
return null;};prototype.xSpace2NormalizedXValueNegative=function(xSpacePosition){if(xSpacePosition==null){return null;}
var currentPeriodsCount=this.xValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var periodSize=currentPeriodEnd-currentPeriodStart+1;if(xSpacePosition<=periodSize){return(currentPeriodStart+xSpacePosition);}
xSpacePosition-=periodSize;}
return null;};prototype.normalizedXValue2XSpace=function(normalizedXValue){if(normalizedXValue==null){return null;}
if(this.extremums!=null){if(normalizedXValue<this.extremums[0]){return this.extremums[0];}else if(normalizedXValue>this.extremums[1]){return this.extremums[1];}}
var currentXSpaceValue=0.0;var currentPeriodsCount=this.xValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var periodSize=currentPeriodEnd-currentPeriodStart+1;if(normalizedXValue<currentPeriodEnd){return currentXSpaceValue+normalizedXValue-currentPeriodStart;}
currentXSpaceValue+=periodSize;}
return currentXSpaceValue;};prototype.getSerieById=function(id){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.getId()==id){return serie;}}
return null;};prototype.getDataSerieCount=function(){var serieCount=this.getSerieCount();var validSerieCount=0;for(var i=0;i<serieCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&currentSerie.isInteractionAllowed()){validSerieCount++;}}
return validSerieCount;};prototype.setMainSerieTimeOffsetMs=function(mainSerieTimeOffsetMs){this.mainSerieTimeOffsetMs=mainSerieTimeOffsetMs;};prototype.getMainSerieTimeOffsetMs=function(){return this.mainSerieTimeOffsetMs;};prototype.getNextNormalizedXValue=function(normalizedXValue,xValueStep){if(this.stepSize>0){return normalizedXValue+(xValueStep/this.stepSize);}
return normalizedXValue+xValueStep;};prototype.getXType=function(){var seriesCount=this.getSerieCount();for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var xType=currentSerie.getXType();if(xType!=null){return xType;}}}
return null;};prototype.findIndexAroundValue=function(searchedValue,orderedSearchArray,searchScale){if(searchedValue==null||orderedSearchArray==null||orderedSearchArray.length<=0||searchScale==null||searchScale==0){return null;}
var index=-1;var startSearchIndex=0;var endSearchIndex=orderedSearchArray.length;var scaledSearchValue=this.applySerieRound(searchedValue/searchScale);while(startSearchIndex<endSearchIndex){index=stjs.trunc(Math.floor((startSearchIndex+endSearchIndex)/2.0));var valueAtIndex=this.applySerieRound(orderedSearchArray[index]/searchScale);if(valueAtIndex==scaledSearchValue){return index;}else if(scaledSearchValue-valueAtIndex>0){startSearchIndex=index+1;}else{endSearchIndex=index-1;}}
return startSearchIndex;};prototype.findIndexAtOrAfterValue=function(searchedValue,orderedSearchArray,searchScale){var startSearchIndex=this.findIndexAroundValue(searchedValue,orderedSearchArray,searchScale);if(startSearchIndex==null){return null;}
var scaledSearchValue=this.applySerieRound(searchedValue/searchScale);var valueAtIndex=this.applySerieRound(orderedSearchArray[startSearchIndex]/searchScale);var timeAtPreviousStartIndex=Double.NEGATIVE_INFINITY;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex!=null&&previousStartIndex>=0){timeAtPreviousStartIndex=this.applySerieRound(orderedSearchArray[previousStartIndex]/searchScale);}
if(timeAtPreviousStartIndex>=scaledSearchValue){return previousStartIndex;}else if(valueAtIndex>=scaledSearchValue){return startSearchIndex;}else{return(nextStartIndex!=null&&nextStartIndex<orderedSearchArray.length)?nextStartIndex:null;}};prototype.getMinXValue=function(){if(this.isIndexed()){if(this.indexedXValues!=null&&this.extremums!=null){return this.indexedXValues[stjs.trunc(Math.round(this.extremums[0]))];}
return null;}
return this.getMinNormalizedXValue();};prototype.getMinNormalizedXValue=function(){if(this.extremums!=null){return this.extremums[0];}
return null;};prototype.getMaxXValue=function(){if(this.isIndexed()){if(this.indexedXValues!=null&&this.extremums!=null){return this.indexedXValues[stjs.trunc(Math.round(this.extremums[1]))];}
return null;}
return this.getMaxNormalizedXValue();};prototype.getMaxNormalizedXValue=function(){if(this.extremums!=null){return this.extremums[1];}
return null;};prototype.getProvider=function(){return this.provider;};prototype.isLogScale=function(){return this.logScale;};prototype.setLogScale=function(logScale){this.logScale=logScale;this.updateSeriesLogScale();};prototype.updateSeriesLogScale=function(){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null){currentSerie.setLogScale(this.logScale);}}};prototype.applySerieFloor=function(value){var serie=this.getMainSerie();return serie!=null?serie.getXValueFloor(value):value;};prototype.applySerieCeil=function(value){var serie=this.getMainSerie();return serie!=null?serie.getXValueCeil(value):value;};prototype.applySerieRound=function(value){var serie=this.getMainSerie();return serie!=null?serie.getXValueRound(value):value;};prototype.normalizeXSpaceNight=function(xSpace){if(xSpace==null){return null;}
if(this.xValuesPeriods==null||this.xValuesPeriods.length==0){return 0.0;}
var start=this.xValuesPeriods[0][0];var end=this.xValuesPeriods[0][1];if(start==0||end==0||xSpace<end&&xSpace>start||xSpace<start){return 0.0;}
var inPeriod=false;var diff=0.0;var currentPeriodsCount=this.xValuesPeriods.length;for(var i=1;i<currentPeriodsCount;i++){var previousPeriod=this.xValuesPeriods[i-1];var previousPeriodEnd=previousPeriod[1];var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];if(xSpace<currentPeriodEnd&&xSpace>=currentPeriodStart){inPeriod=true;diff+=(currentPeriodStart-previousPeriodEnd+this.normalizeXSpaceNight(xSpace-Frequency.DAY.getTimeValue()));}}
if(!inPeriod){diff+=this.normalizeXSpaceNight(xSpace-Frequency.DAY.getTimeValue());}
return diff;};},{chart:"DefaultChart",provider:{name:"DataProvider",arguments:[{name:"ChartData",arguments:["S"]}]},cache:"Cache",series:{name:"Array",arguments:["S"]},extremums:{name:"Array",arguments:[null]},indexedXValues:{name:"Array",arguments:[null]},availableFormats:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},possibleXSteps:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},xValuesPeriods:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},observers:{name:"Map",arguments:[null,"Observer"]}},{});
var ChartContext=function(){this.seriesMinValues={};this.seriesMaxValues={};this.seriesMinIndices={};this.seriesMaxIndices={};this.labelsPosition={};this.ranges={};this.formats={};this.precision=ChartContext.GENERAL_Y_PRECISION;this.logScale=false;};ChartContext=stjs.extend(ChartContext,null,[],function(constructor,prototype){constructor.SERIE_GLOBAL="global";constructor.PRECISION_THRESHOLD=0.04;constructor.GENERAL_Y_PRECISION=3;constructor.PRECISE_Y_PRECISION=6;prototype.data=null;prototype.aggregationStrategy=null;prototype.currentPosition=null;prototype.zoomIconId=null;prototype.precision=0;prototype.ranges=null;prototype.labelsPosition=null;prototype.formats=null;prototype.seriesMinValues=null;prototype.seriesMaxValues=null;prototype.seriesMinIndices=null;prototype.seriesMaxIndices=null;prototype.globalMinRefValue=0;prototype.globalMaxRefValue=0;prototype.adjustRefValue=0;prototype.logScale=false;prototype.getValue=function(values,serieId,which){if(values==null||serieId==null||which==null){return null;}
var serieValues=values[serieId];if(serieValues!=null){return serieValues[which];}
return null;};prototype.setValue=function(values,serieId,which,min){if(values==null||serieId==null||which==null){return;}
var serieValues=values[serieId];if(serieValues==null){serieValues={};values[serieId]=serieValues;}
serieValues[which]=min;};prototype.getMin=function(serieId,which){return this.getValue(this.seriesMinValues,serieId,which);};prototype.setMin=function(serieId,which,min){this.setValue(this.seriesMinValues,serieId,which,min);};prototype.getMax=function(serieId,which){return this.getValue(this.seriesMaxValues,serieId,which);};prototype.setMax=function(serieId,which,max){this.setValue(this.seriesMaxValues,serieId,which,max);};prototype.getMinIndex=function(serieId,which){return this.getValue(this.seriesMinIndices,serieId,which);};prototype.getMaxIndex=function(serieId,which){return this.getValue(this.seriesMaxIndices,serieId,which);};prototype.setMinIndex=function(serieId,minIndex,which){this.setValue(this.seriesMinIndices,serieId,which,minIndex);};prototype.setMaxIndex=function(serieId,maxIndex,which){this.setValue(this.seriesMaxIndices,serieId,which,maxIndex);};prototype.getMainMin=function(which){var serieId=this.getMainSerieId();return this.getMin(serieId,which);};prototype.getMainMax=function(which){var serieId=this.getMainSerieId();return this.getMax(serieId,which);};prototype.getMainMinIndex=function(which){var serieId=this.getMainSerieId();return this.getMinIndex(serieId,which);};prototype.getMainMaxIndex=function(which){var serieId=this.getMainSerieId();return this.getMaxIndex(serieId,which);};prototype.update=function(data,aggregationStrategy){this.data=data;this.aggregationStrategy=aggregationStrategy;if(data==null||data.getSerieCount()==0){return;}
this.updateSeriesContext(data.getSeries());};prototype.updateSeriesContext=function(series){if(series==null||series.length==0){return;}
var absolutePercentChanges=this.setSeriesMinMaxInRange(this.getRange(DefaultLayout.X_AXIS_AREA),series);var globalMinPercentChange=0.0;var globalMaxPercentChange=0.0;if(absolutePercentChanges!=null&&absolutePercentChanges[0]!=null&&absolutePercentChanges[1]!=null){globalMinPercentChange=absolutePercentChanges[0];globalMaxPercentChange=absolutePercentChanges[1];}
if(globalMinPercentChange==globalMaxPercentChange){globalMinPercentChange--;globalMaxPercentChange++;}
var mainSerie=this.data.getMainSerie();this.logScale=mainSerie.isLogScale();var mainSerieId=mainSerie.getId();var currentRefValue=mainSerie.getReferenceValue();var currentMinPercentChange=this.getMin(mainSerieId,Serie.CHANGE_PERCENT);var currentMaxPercentChange=this.getMax(mainSerieId,Serie.CHANGE_PERCENT);var minRatio=this.computeRatio(globalMinPercentChange,this.globalMinRefValue,currentMinPercentChange,currentRefValue);var maxRatio=this.computeRatio(globalMaxPercentChange,this.globalMaxRefValue,currentMaxPercentChange,currentRefValue);var mainSerieMin=this.getMin(mainSerieId,ChartContext.SERIE_GLOBAL);var mainSerieMax=this.getMax(mainSerieId,ChartContext.SERIE_GLOBAL);var serieNewMin=null;var serieNewMax=null;if(mainSerieMin!=null&&mainSerieMin!=Double.POSITIVE_INFINITY){serieNewMin=mainSerieMin*minRatio;}
if(mainSerieMax!=null&&mainSerieMax!=Double.NEGATIVE_INFINITY){serieNewMax=mainSerieMax*maxRatio;}
this.setMin(mainSerieId,ChartContext.SERIE_GLOBAL,serieNewMin);this.setMax(mainSerieId,ChartContext.SERIE_GLOBAL,serieNewMax);this.setRange(DefaultLayout.Y1_AXIS_AREA,[serieNewMin,serieNewMax]);this.setRange(DefaultLayout.Y2_AXIS_AREA,[globalMinPercentChange,globalMaxPercentChange]);if(serieNewMin==null||serieNewMax==null||(serieNewMax-serieNewMin)<ChartContext.PRECISION_THRESHOLD){this.precision=ChartContext.PRECISE_Y_PRECISION;}else{this.precision=ChartContext.GENERAL_Y_PRECISION;}};prototype.setSeriesMinMaxInRange=function(range,series){var serieCount=series.length;var extremums=this.data.getExtremums();if(extremums==null){return null;}
var startXValue=extremums[0];var endXValue=extremums[1];if(range!=null){var rangeStartXValue=range[0];var rangeEndXValue=range[1];if(!isNaN(rangeStartXValue)&&rangeStartXValue>=startXValue&&rangeStartXValue<=endXValue){startXValue=rangeStartXValue;}
if(!isNaN(rangeEndXValue)&&rangeEndXValue>=startXValue&&rangeEndXValue<=endXValue){endXValue=rangeEndXValue;}
if(rangeStartXValue>rangeEndXValue){startXValue=endXValue;}}
var globalMinPercentChange=Double.POSITIVE_INFINITY;var globalMaxPercentChange=Double.NEGATIVE_INFINITY;var globalMinXValue=startXValue;var globalMaxXValue=endXValue;for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var currentSerieMinIndex=currentSerie.findIndexClosestToXValue(startXValue);var currentSerieMaxIndex=currentSerie.findIndexClosestToXValue(endXValue);this.setMinIndex(serieId,currentSerieMinIndex,Serie.X);this.setMaxIndex(serieId,currentSerieMaxIndex,Serie.X);var currentSerieMinXValue=currentSerie.getValue(currentSerieMinIndex,Serie.X);var currentSerieMaxXValue=currentSerie.getValue(currentSerieMaxIndex,Serie.X);this.setMin(serieId,Serie.X,currentSerieMinXValue);this.setMax(serieId,Serie.X,currentSerieMaxXValue);this.setMin(serieId,Serie.CHANGE,Double.POSITIVE_INFINITY);this.setMax(serieId,Serie.CHANGE,Double.NEGATIVE_INFINITY);this.setMin(serieId,Serie.CHANGE_PERCENT,Double.POSITIVE_INFINITY);this.setMax(serieId,Serie.CHANGE_PERCENT,Double.NEGATIVE_INFINITY);this.setMin(serieId,ChartContext.SERIE_GLOBAL,Double.POSITIVE_INFINITY);this.setMax(serieId,ChartContext.SERIE_GLOBAL,Double.NEGATIVE_INFINITY);var mainFields=currentSerie.getMainFields();for(var index in mainFields){if(!(mainFields).hasOwnProperty(index))
continue;var currentField=mainFields[index];currentSerie.computeChangeValues(currentField);var currentMinPercentChange=Double.POSITIVE_INFINITY;var currentMaxPercentChange=Double.NEGATIVE_INFINITY;var currentFieldMinIndex=-1;var currentFieldMaxIndex=-1;for(var j=currentSerieMinIndex;j<=currentSerieMaxIndex;j++){var currentChangePercentValue=currentSerie.getValueAsDouble(j,Serie.CHANGE_PERCENT);if(currentChangePercentValue!=null&&!isNaN(currentChangePercentValue)){if(currentChangePercentValue<currentMinPercentChange){currentMinPercentChange=currentChangePercentValue;currentFieldMinIndex=j;}
if(currentChangePercentValue>currentMaxPercentChange){currentMaxPercentChange=currentChangePercentValue;currentFieldMaxIndex=j;}}}
var currentFieldMinValue=currentSerie.getValueAsDouble(currentFieldMinIndex,currentField);var currentFieldMaxValue=currentSerie.getValueAsDouble(currentFieldMaxIndex,currentField);var currentFieldMinChange=currentSerie.getValueAsDouble(currentFieldMinIndex,Serie.CHANGE);var currentFieldMaxChange=currentSerie.getValueAsDouble(currentFieldMaxIndex,Serie.CHANGE);var currentFieldMinPercent=currentSerie.getValueAsDouble(currentFieldMinIndex,Serie.CHANGE_PERCENT);var currentFieldMaxPercent=currentSerie.getValueAsDouble(currentFieldMaxIndex,Serie.CHANGE_PERCENT);var serieMinChange=this.getMin(serieId,Serie.CHANGE);var serieMaxChange=this.getMax(serieId,Serie.CHANGE);var serieMin=this.getMin(serieId,ChartContext.SERIE_GLOBAL);var serieMax=this.getMax(serieId,ChartContext.SERIE_GLOBAL);this.setMin(serieId,currentField,currentFieldMinValue);this.setMinIndex(serieId,currentFieldMinIndex,currentField);this.setMax(serieId,currentField,currentFieldMaxValue);this.setMaxIndex(serieId,currentFieldMaxIndex,currentField);this.setMin(serieId,Serie.CHANGE+currentField,currentFieldMinChange);this.setMin(serieId,Serie.CHANGE_PERCENT+currentField,currentFieldMinPercent);this.setMax(serieId,Serie.CHANGE+currentField,currentFieldMaxChange);this.setMax(serieId,Serie.CHANGE_PERCENT+currentField,currentFieldMaxPercent);if(currentFieldMinChange!=null&&currentFieldMinChange<serieMinChange){this.setMin(serieId,Serie.CHANGE,currentFieldMinChange);this.setMin(serieId,Serie.CHANGE_PERCENT,currentFieldMinPercent);}
if(currentFieldMaxChange!=null&&currentFieldMaxChange>serieMaxChange){this.setMax(serieId,Serie.CHANGE,currentFieldMaxChange);this.setMax(serieId,Serie.CHANGE_PERCENT,currentFieldMaxPercent);}
if(currentFieldMinValue!=null&&currentFieldMinValue<serieMin){this.setMin(serieId,ChartContext.SERIE_GLOBAL,currentFieldMinValue);}
if(currentFieldMaxValue!=null&&currentFieldMaxValue>serieMax){this.setMax(serieId,ChartContext.SERIE_GLOBAL,currentFieldMaxValue);}
if(currentMinPercentChange<globalMinPercentChange){globalMinPercentChange=currentMinPercentChange;this.globalMinRefValue=currentSerie.getReferenceValue();}
if(currentMaxPercentChange>globalMaxPercentChange){globalMaxPercentChange=currentMaxPercentChange;this.globalMaxRefValue=currentSerie.getReferenceValue();}
if(currentSerieMinXValue!=null&&currentSerieMinXValue<globalMinXValue){globalMinXValue=currentSerieMinXValue;}
if(currentSerieMaxXValue!=null&&currentSerieMaxXValue>globalMaxXValue){globalMaxXValue=currentSerieMaxXValue;}}}}
if(globalMinPercentChange==Double.POSITIVE_INFINITY||globalMaxPercentChange==Double.NEGATIVE_INFINITY){return null;}
this.setRange(Serie.X,[startXValue,endXValue]);return[globalMinPercentChange,globalMaxPercentChange];};prototype.adjustSeriesMinMax=function(series){var adjustedPercentRange=this.getRange(DefaultLayout.Y2_AXIS_AREA);if(adjustedPercentRange==null||adjustedPercentRange[0]==null||adjustedPercentRange[1]==null){return;}
var adjustedMinPercentChange=adjustedPercentRange[0];var adjustedMaxPercentChange=adjustedPercentRange[1];var serieCount=series.length;for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var currentRefValue=currentSerie.getReferenceValue();this.setMin(serieId,Serie.CHANGE_PERCENT,adjustedMinPercentChange);this.setMax(serieId,Serie.CHANGE_PERCENT,adjustedMaxPercentChange);var contextFields=currentSerie.getMainFields();for(var index in contextFields){if(!(contextFields).hasOwnProperty(index))
continue;var currentField=contextFields[index];var currentMinPercentChange=this.getMin(serieId,Serie.CHANGE_PERCENT+currentField);var currentMaxPercentChange=this.getMax(serieId,Serie.CHANGE_PERCENT+currentField);var minRatio=this.computeRatio(adjustedMinPercentChange,this.adjustRefValue,currentMinPercentChange,currentRefValue);var maxRatio=this.computeRatio(adjustedMaxPercentChange,this.adjustRefValue,currentMaxPercentChange,currentRefValue);var serieNewMin=this.getMin(serieId,currentField);var serieNewMax=this.getMax(serieId,currentField);serieNewMin*=minRatio;serieNewMax*=maxRatio;this.setMin(serieId,currentField,serieNewMin);this.setMax(serieId,currentField,serieNewMax);}}}};prototype.adjustY1Range=function(newY1Range){var newY1Min=newY1Range!=null?newY1Range[0]:null;var newY1Max=newY1Range!=null?newY1Range[1]:null;if(newY1Min!=null&&newY1Max!=null){var referenceValue=this.data.getMainSerie().getReferenceValue();this.adjustRefValue=referenceValue!=0.0?referenceValue:1.0;var adjustedMinPercent=100.0*(newY1Min-this.adjustRefValue)/Math.abs(this.adjustRefValue);var adjustedMaxPercent=100.0*(newY1Max-this.adjustRefValue)/Math.abs(this.adjustRefValue);this.setRange(DefaultLayout.Y1_AXIS_AREA,[newY1Min,newY1Max]);this.setRange(DefaultLayout.Y2_AXIS_AREA,[adjustedMinPercent,adjustedMaxPercent]);}
this.adjustSeriesMinMax(this.data.getSeries());};prototype.adjustY2Range=function(newY2Range){if(newY2Range!=null){this.setRange(DefaultLayout.Y2_AXIS_AREA,[newY2Range[0],newY2Range[1]]);}
this.adjustSeriesMinMax(this.data.getSeries());};prototype.computeRatio=function(numeratorPercent,numeratorRef,denominatorPercent,denominatorRef){var numeratorRefValue=numeratorRef!=0?numeratorRef:1.0;var denominatorRefValue=denominatorRef!=0?denominatorRef:1.0;var numerator=numeratorRefValue>0?numeratorPercent+100:numeratorPercent-100;var denominator=denominatorRefValue>0?denominatorPercent+100:denominatorPercent-100;if(denominator==0){return 1.0;}
return Math.abs(numerator/denominator);};prototype.getXSpaceValueAtPosition=function(xPixel,chartWidthPixels){if(this.data!=null){var rangeStartXSpace=0;var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);if(xRange!=null){rangeStartXSpace=this.data.normalizedXValue2XSpace(xRange[0]);}
var currentXSpaceSize=this.data.getCurrentXSpaceSize(xRange);var interpolatedXSpaceValue=rangeStartXSpace;if(chartWidthPixels!=0){interpolatedXSpaceValue+=(xPixel/(chartWidthPixels-1.0))*(currentXSpaceSize-1);}
return interpolatedXSpaceValue;}
return null;};prototype.getNormalisedXValueAtPosition=function(x,width){return this.data.xSpace2NormalizedXValue(this.getXSpaceValueAtPosition(x,width));};prototype.getPositionFromXSpaceValue=function(xSpaceValue,width){var rangeStartXSpace=0.0;var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);if(xRange!=null){rangeStartXSpace=this.data.normalizedXValue2XSpace(xRange[0]);}
var currentXSpaceSize=this.data.getCurrentXSpaceSize(xRange);var position=xSpaceValue-rangeStartXSpace;if(currentXSpaceSize>1){position*=width/currentXSpaceSize;}
return position;};prototype.getPositionFromYValue=function(yValue,height,yRangeId,logScaleAllowed){var yRange=this.getRange(yRangeId);if(yRange==null||yRange[0]==null||yRange[1]==null){return null;}
var lowestValue=yRange[0];var highestValue=yRange[1];var ratio=1.0;if(this.logScale&&logScaleAllowed){var minLog=Math.log(lowestValue);ratio=(Math.log(yValue)-minLog)/(Math.log(highestValue)-minLog);}else{ratio=(yValue-lowestValue)/(highestValue-lowestValue);}
return(1-ratio)*height;};prototype.getYValueFromYPosition=function(pos,height,yRangeId,logScaleAllowed){var yRange=this.getRange(yRangeId);if(yRange==null||yRange[0]==null||yRange[1]==null||height<=0){return null;}
var lowestValue=yRange[0];var highestValue=yRange[1];var ratio=1.0-(pos/height);var yValue=0.0;if(this.logScale&&logScaleAllowed){var minLog=Math.log(lowestValue);yValue=Math.exp(ratio*(Math.log(highestValue)-minLog)+minLog);}else{yValue=ratio*(highestValue-lowestValue)+lowestValue;}
return yValue;};prototype.getClosestValues=function(left,chartWidth){if(this.currentPosition==null){return null;}
if(left==null){left=0.0;}
var currentPositionOnGraph=stjs.trunc(Math.round(this.currentPosition.getX()-left));return this.getValuesAtPosition(currentPositionOnGraph,chartWidth,false);};prototype.getClosestPointsFromCurrentPosition=function(left,chartWidth){if(this.currentPosition==null){return null;}
if(left==null){left=0.0;}
var currentPositionOnGraph=stjs.trunc(Math.round(this.currentPosition.getX()-left));return this.getDataPointsAtPosition(currentPositionOnGraph,chartWidth,false);};prototype.getPointsAtCurrentPosition=function(left,chartWidth){if(this.currentPosition==null){return null;}
if(left==null){left=0.0;}
var currentPositionOnGraph=stjs.trunc(Math.round(this.currentPosition.getX()-left));return this.getDataPointsAtPosition(currentPositionOnGraph,chartWidth,true);};prototype.getValuesAtPosition=function(xPosition,chartWidth,exactPosition){if(this.data==null){return null;}
var chartData=this.data;var serieCount=chartData.getSerieCount();var seriesValuesAtPosition={};for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var values=this.getSerieValuesAtPosition(currentSerie,xPosition,chartWidth,this.aggregationStrategy,currentSerie.getMainField(),exactPosition);seriesValuesAtPosition[serieId]=values;}}
return seriesValuesAtPosition;};prototype.getDataPointsAtPosition=function(xPosition,chartWidth,exactPosition){if(this.data==null){return null;}
var chartData=this.data;var empty=true;var serieCount=chartData.getSerieCount();var seriesDataPointsAtPosition={};for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var points=this.getSeriePointsAtPosition(currentSerie,xPosition,chartWidth,exactPosition);if(points!=null){seriesDataPointsAtPosition[serieId]=points;empty=false;}}}
if(empty){return null;}
return seriesDataPointsAtPosition;};prototype.getSerieValuesAtPosition=function(serie,xPosition,chartWidth,aggregationStrategy,mainField,exactPosition){if(serie==null){return null;}
return serie.getAggregatedValues(aggregationStrategy,this,xPosition,chartWidth,mainField,exactPosition);};prototype.getSeriePointsAtPosition=function(serie,xPosition,chartWidth,exactPosition){if(serie==null){return null;}
var indices=serie.getCorrespondingIndices(this,xPosition,chartWidth,exactPosition);if(indices!=null&&indices.length>0){var points=[];var pointsCount=indices.length;for(var i=0;i<pointsCount;i++){points.push(serie.getPoint(indices[i]));}
return points;}
return null;};prototype.getClosestDataPointPosition=function(serie,xPosition,areaBound,aggregationStrategy,mainField,which,maxStepDistance){if(serie==null){return null;}
if(which==null){which=mainField;}
var serieId=serie.getId();var chartWidth=stjs.trunc(areaBound.getContentWidth());var indices=serie.getCorrespondingIndices(this,xPosition,chartWidth,false);var valuesAtPosition=serie.getAggregatedValues(aggregationStrategy,this,xPosition,chartWidth,which,false);var valuesCountAtPosition=valuesAtPosition!=null?valuesAtPosition.length:0;var currentValue=Double.NEGATIVE_INFINITY;for(var i=0;i<valuesCountAtPosition;i++){var currentValueAtPosition=valuesAtPosition[i];if(currentValueAtPosition!=null&&currentValueAtPosition>currentValue){currentValue=valuesAtPosition[i];}}
if(indices==null||currentValue==Double.NEGATIVE_INFINITY){return null;}
var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);var closestXValue=serie.getXValue(indices[0]);var currentXSpaceSize=this.data.getCurrentXSpaceSize(xRange);if(xRange==null){xRange=this.data.getExtremums();}
if(currentXSpaceSize<=1){return null;}
var chartLeftPos=stjs.trunc(areaBound.getContentLeft());var chartTopPos=stjs.trunc(areaBound.getContentTop());var chartHeight=stjs.trunc(areaBound.getContentHeight());var chartBottomPos=chartTopPos+chartHeight;var yMin=this.getMin(serieId,mainField);var yMax=this.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin>0&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);if(currentValue>0){currentValue=Math.log(currentValue);}else{currentValue=yMin;}}
var heightRatio=chartHeight/(yMax-yMin);var xSpacePosition=this.data.normalizedXValue2XSpace(closestXValue);var startXSpacePosition=this.data.normalizedXValue2XSpace(xRange[0]);var currentXSpaceValue=this.getXSpaceValueAtPosition(xPosition,chartWidth);if(maxStepDistance!=null&&Math.abs(xSpacePosition-currentXSpaceValue)>maxStepDistance){return null;}
var ratio=(xSpacePosition-startXSpacePosition)/(currentXSpaceSize-1);ratio=ratio>1?1:ratio;var xCoordinate=stjs.trunc(Math.round(ratio*chartWidth+chartLeftPos));var yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));return new Point2D(xCoordinate,yCoordinate);};prototype.getData=function(){return this.data;};prototype.getCurrentPosition=function(){return this.currentPosition;};prototype.setCurrentPosition=function(currentPosition){this.currentPosition=currentPosition;};prototype.getPrecision=function(){return this.precision;};prototype.getMainSerieId=function(){if(this.data==null||this.data.getMainSerie()==null){return null;}
return this.data.getMainSerie().getId();};prototype.getZoomIconId=function(){return this.zoomIconId;};prototype.setZoomIconId=function(zoomIconId){this.zoomIconId=zoomIconId;};prototype.getRange=function(rangeId){return this.ranges[rangeId];};prototype.setRange=function(rangeId,values){this.ranges[rangeId]=values;};prototype.getLabelsPosition=function(rangeId){return this.labelsPosition[rangeId];};prototype.setLabelsPosition=function(labelsId,values){this.labelsPosition[labelsId]=values;};prototype.getFormat=function(formatId){return this.formats[formatId];};prototype.setFormat=function(formatId,format){this.formats[formatId]=format;};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},currentPosition:"Point2D",ranges:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},labelsPosition:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},formats:{name:"Map",arguments:[null,null]},seriesMinValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMaxValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMinIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]},seriesMaxIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]}},{});
var EngineModel=function(){this.context=new ChartContext();this.engines={};};EngineModel=stjs.extend(EngineModel,null,[],function(constructor,prototype){prototype.context=null;prototype.engines=null;prototype.drawEngine=null;prototype.tooltipEngine=null;prototype.titleEngine=null;prototype.xAxisEngine=null;prototype.y1AxisEngine=null;prototype.y2AxisEngine=null;prototype.legendEngine=null;prototype.graphEngine=null;prototype.init=function(options){};prototype.reset=function(){};prototype.updateRange=function(xRange,chartView,chartData){};prototype.updateGraphEngine=function(options){};prototype.updatePosition=function(x,y){};prototype.createMainGraphics=function(chartView,chartData){};prototype.createInteractiveGraphics=function(chartView,chartData){};prototype.setCustomMainAxisMinMax=function(customMainAxisMinMax){};prototype.setSettings=function(string,newPeriod){};prototype.getContext=function(){return this.context;};prototype.setContext=function(context){this.context=context;};prototype.getEngine=function(engineId){if(engineId!=null){return this.engines[engineId];}else{return null;}};prototype.getXSpaceValueAt=function(chartView,xPos){};prototype.updateXType=function(xType){};prototype.getEngines=function(){return this.engines;};},{context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
var DefaultEngineModel=function(){EngineModel.call(this);};DefaultEngineModel=stjs.extend(DefaultEngineModel,EngineModel,[],function(constructor,prototype){prototype.aggregationStrategy=null;prototype.mainField=null;prototype.dynamicXAxisData=false;prototype.customMainAxisMinMax=null;prototype.reset=function(){};prototype.init=function(options){this.mainField=Serie.Y;if(options!=null&&options.getMainSerieField()!=null){this.mainField=options.getMainSerieField();}
this.aggregationStrategy=options.getAggregationStrategy();if(this.aggregationStrategy==null){this.aggregationStrategy=AggregationStrategy.AVERAGE;}
this.dynamicXAxisData=options.isDynamicXAxisData();this.customMainAxisMinMax=options.getMainAxisMinMax();this.tooltipEngine=new DefaultToolTipEngine(options);this.titleEngine=new DefaultTitleEngine(options);this.xAxisEngine=new DefaultXAxisEngine(options);this.y1AxisEngine=new DefaultY1AxisEngine(options);this.y2AxisEngine=new DefaultY2AxisEngine(options);this.legendEngine=new DefaultLegendEngine(options);this.graphEngine=new GraphEngine(options);if(options.isAllowOverlayDrawing()){this.drawEngine=new DefaultDrawEngine(options);this.drawEngine.addAllowedArea(DefaultLayout.GRAPH_AREA,DefaultLayout.Y1_AXIS_AREA);}
this.extend(options);this.engines[DefaultLayout.TITLE_AREA]=this.titleEngine;this.engines[DefaultLayout.X_AXIS_AREA]=this.xAxisEngine;this.engines[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisEngine;this.engines[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisEngine;this.engines[DefaultLayout.GRAPH_AREA]=this.graphEngine;this.engines[DefaultLayout.LEGEND_AREA]=this.legendEngine;this.engines[DefaultLayout.TOOLTIP_AREA]=this.tooltipEngine;this.engines[DrawEngine.ID]=this.drawEngine;};prototype.extend=function(options){if(options!=null){var customEngineModel=options.getCustomEngineModel();if(customEngineModel!=null){if((customEngineModel)["init"]!=null){options.setCustomeEngineModel(null);customEngineModel.init(options);options.setCustomeEngineModel(customEngineModel);}
var validEngines={};var tmp={};this.extendEngine(customEngineModel,validEngines,"titleEngine");this.extendEngine(customEngineModel,validEngines,"xAxisEngine");this.extendEngine(customEngineModel,validEngines,"y1AxisEngine");this.extendEngine(customEngineModel,validEngines,"y2AxisEngine");this.extendEngine(customEngineModel,validEngines,"graphEngine");this.extendEngine(customEngineModel,validEngines,"legendEngine");this.extendEngine(customEngineModel,validEngines,"tooltipEngine");if(options.isAllowOverlayDrawing()){this.extendEngine(customEngineModel,validEngines,"drawEngine");}
SQW.$.extend(true,tmp,customEngineModel,validEngines);SQW.$.extend(true,this,tmp);}}};prototype.extendEngine=function(customEngineModel,validEngines,engineName){if((customEngineModel)[engineName]!=null){(validEngines)[engineName]=SQW.$.extend((this)[engineName],(customEngineModel)[engineName]);}};prototype.updateRange=function(xRange,chartView,chartData){this.context.setRange(DefaultLayout.X_AXIS_AREA,xRange);this.context.update(chartData,this.aggregationStrategy);this.setCustomMinMaxAxis(chartData.getMainSerie());var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var mainYAxis=this.engines[DefaultLayout.Y1_AXIS_AREA];var step=mainYAxis.computePrettyLabels(graphArea,this.context.getRange(DefaultLayout.Y1_AXIS_AREA),this.context.getPrecision(),chartView.getStyleModel().getY1AxisStyle(),chartData.isLogScale());if(step==1||step>=5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"0");}else if(step==0.1||step>=0.5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"1");}else if(step>=0.01||ArrayUtil.getRangeSpan(mainYAxis.getRange())>=0.01){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"2");}else{this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"4");}
if(step!=null){this.context.adjustY1Range(mainYAxis.getRange());this.context.setLabelsPosition(DefaultLayout.Y1_AXIS_AREA,mainYAxis.getLabelsPosition());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,mainYAxis.getLabelsPosition());}else{var y2Axis=this.engines[DefaultLayout.Y2_AXIS_AREA];this.context.adjustY2Range(y2Axis.getRange());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,y2Axis.getLabelsPosition());}
for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.update(chartView,chartData,this.context);}}};prototype.setCustomMinMaxAxis=function(mainSerie){if(this.customMainAxisMinMax!=null){var mainSerieId=mainSerie!=null?mainSerie.getId():null;var customMin=this.customMainAxisMinMax[0];var customMax=this.customMainAxisMinMax[1];if((customMin==null||isNaN(customMin))&&mainSerieId!=null){customMin=this.context.getMin(mainSerieId,Serie.Y);}
if((customMax==null||isNaN(customMax))&&mainSerieId!=null){customMax=this.context.getMax(mainSerieId,Serie.Y);}
this.context.setRange(DefaultLayout.Y1_AXIS_AREA,[customMin,customMax]);}};prototype.updatePosition=function(x,y){if(x!=null&&y!=null){this.context.setCurrentPosition(new Point2D(stjs.trunc(Math.round(x)),stjs.trunc(Math.round(y))));}};prototype.createMainGraphics=function(chartView,data){for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.createMainGraphics(chartView,data,this.context);}}};prototype.createInteractiveGraphics=function(chartView,data){for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.createInteractiveGraphics(chartView,data,this.context);}}};prototype.getXSpaceValueAt=function(chartView,xPos){var graph=chartView.getArea(DefaultLayout.GRAPH_AREA);if(graph!=null&&graph.getAreaBound()!=null){var graphBound=graph.getAreaBound();return this.context.getXSpaceValueAtPosition(xPos,graphBound.getContentWidth());}
return null;};prototype.updateXType=function(xType){if(this.dynamicXAxisData){var xAxisEngine=this.engines[DefaultLayout.X_AXIS_AREA];var formatter=xAxisEngine.getLabelsFormatter();if(formatter.getFormatterType()!=null&&formatter.getFormatterType()==xType){return;}else if(xType==Formatter.DataType.DATE){xAxisEngine.setLabelsFormatter(new DateTimeFormatter());}else if(xType==Formatter.DataType.NUMBER){xAxisEngine.setLabelsFormatter(new AbbreviateNumberFormatter());}else if(xType==Formatter.DataType.STRING){xAxisEngine.setLabelsFormatter(new StringFormatter());}}};prototype.updateGraphEngine=function(options){var graphEngine=this.engines[DefaultLayout.GRAPH_AREA];graphEngine.updateDefaultEngine(options);};prototype.getCustomMainAxisMinMax=function(){return this.customMainAxisMinMax;};prototype.setCustomMainAxisMinMax=function(customMainAxisMinMax){this.customMainAxisMinMax=customMainAxisMinMax;};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},customMainAxisMinMax:{name:"Array",arguments:[null]},context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
var Engine=function(){};Engine=stjs.extend(Engine,null,[],function(constructor,prototype){prototype.correspondingAreaId=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){};prototype.getCorrespondingAreaId=function(){return this.correspondingAreaId;};prototype.setCorrespondingAreaId=function(correspondingAreaId){this.correspondingAreaId=correspondingAreaId;};},{},{});
var AxisEngine=function(options){Engine.call(this);this.options=options;};AxisEngine=stjs.extend(AxisEngine,Engine,[],function(constructor,prototype){prototype.position=null;prototype.labelsFormatter=null;prototype.range=null;prototype.labelsPosition=null;prototype.associatedGraphId=null;prototype.options=null;prototype.computePrettyLabels=function(graphArea,currentRange,precision,style,logScale){};prototype.createTicks=function(layer,area,context,style){};prototype.createLabels=function(layer,chartView,chartData,area,context,style){};prototype.getRange=function(){return this.range;};prototype.setRange=function(range){this.range=range;};prototype.getLabelsFormatter=function(){return this.labelsFormatter;};prototype.setLabelsFormatter=function(labelsFormatter){this.labelsFormatter=labelsFormatter;};prototype.getLabelsPosition=function(){return this.labelsPosition;};prototype.setLabelsPosition=function(labelsPosition){this.labelsPosition=labelsPosition;};prototype.setFormat=function(format){if(this.labelsFormatter!=null){this.labelsFormatter.setFormat(format);}};prototype.getPosition=function(){return this.position;};prototype.setPosition=function(position){this.position=position;};},{position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var GraphEngine=function(options){Engine.call(this);this.copyright=StringUtil.getCopyright();this.aggregationStrategy=options.getAggregationStrategy();if(this.aggregationStrategy==null){this.aggregationStrategy=AggregationStrategy.AVERAGE;}
this.showCopyright=options.isShowCopyright()&&options.isPopOverAllowed();this.correspondingAreaId=DefaultLayout.GRAPH_AREA;this.showTooltip=options.isShowToolTip();this.barType=options.getBarType();this.updateDefaultEngine(options);};GraphEngine=stjs.extend(GraphEngine,Engine,[],function(constructor,prototype){constructor.COPYRIGHT_PADDING=5;prototype.aggregationStrategy=null;prototype.chartData=null;prototype.showCopyright=false;prototype.showTooltip=false;prototype.copyright=null;prototype.defaultType=null;prototype.barType=null;prototype.update=function(chartView,chartData,context){this.chartData=chartData;var series=chartData.getSeries();};prototype.createMainGraphics=function(chartView,chartData,context){var groundLayer=chartView.getGroundLayer();var graphArea=chartView.getArea(this.correspondingAreaId);var graphStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(graphArea==null||graphArea.getAreaBound()==null||!graphArea.getAreaBound().isVisible()){return;}
CanvasBackgroundHelper.createBackground(groundLayer,graphArea,graphStyle);CanvasBackgroundHelper.createBorders(groundLayer,graphArea,graphStyle);var boldDateLabelsPositions=GraphEngine.getBoldDateLabelsPositions(context);this.createBackgroundGrid(groundLayer,graphArea,graphStyle,context.getLabelsPosition(DefaultLayout.X_AXIS_AREA),context.getLabelsPosition(DefaultLayout.Y1_AXIS_AREA),boldDateLabelsPositions);if(this.showCopyright){this.createCopyrightLabel(groundLayer,chartView,graphArea,graphStyle);}
var mainLayer=chartView.getMainLayer();var serieCount=chartData.getSerieCount();for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null){var graphEngine=this.getGraphEngine(currentSerie.getType());if(graphEngine!=null){graphEngine.createGraphElement(mainLayer,graphArea,currentSerie,context,graphStyle);}}}
for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null){var graphEngine=this.getGraphEngine(currentSerie.getType());if(graphEngine!=null){graphEngine.createForegroundElements(groundLayer,graphArea,context,graphStyle);}}}};constructor.getBoldDateLabelsPositions=function(context){var data=null;if(context!=null){data=context.getData();}
var defaultXAxisEngine=null;if(data!=null&&data.getProvider()!=null&&data.getProvider().getConfig()!=null&&data.getProvider().getConfig().getEngineModel()!=null&&stjs.isInstanceOf(data.getProvider().getConfig().getEngineModel().getEngine(DefaultLayout.X_AXIS_AREA).constructor,DefaultXAxisEngine)){defaultXAxisEngine=data.getProvider().getConfig().getEngineModel().getEngine(DefaultLayout.X_AXIS_AREA);}
var boldDateLabelsPositions=null;var emptyArray=[];if(defaultXAxisEngine!=null){boldDateLabelsPositions=defaultXAxisEngine.getBoldDateLabelsPositions();}
return boldDateLabelsPositions!=null?boldDateLabelsPositions:emptyArray;};prototype.getGraphEngine=function(serieType){var type=serieType==null?this.defaultType:serieType;if(type==Chart.ChartType.LINE){return DefaultLineGraphEngine.getInstance();}else if(type==Chart.ChartType.POINT){return DefaultPointGraphEngine.getInstance();}else if(type==Chart.ChartType.AREA){return DefaultAreaGraphEngine.getInstance();}else if(type==Chart.ChartType.BAR){var barGraphEngine=DefaultBarGraphEngine.getInstance();barGraphEngine.setBarType(this.barType);return barGraphEngine;}else if(type==Chart.ChartType.BID_ASK){return BidAskAreaEngine.getInstance();}else if(type==Chart.ChartType.NONE){return null;}else{return DefaultLineGraphEngine.getInstance();}};prototype.createCopyrightLabel=function(layer,chartView,area,style){if(!this.showCopyright||this.copyright==null){return;}
var fontSize=style.getCopyrightFontSize();var isBold=style.isCopyrightBold();var copyrightWidth=chartView.getTextWidth(this.copyright,style.getFont(),fontSize,isBold);var areaBound=area.getAreaBound();var xPos=stjs.trunc(Math.round(areaBound.getInnerLeft()+areaBound.getInnerWidth()-GraphEngine.COPYRIGHT_PADDING));var yPos=stjs.trunc((areaBound.getInnerTop()+GraphEngine.COPYRIGHT_PADDING));var copyrightLabel=ChartElementFactory.createLabel(layer,0.0,this.copyright,xPos,yPos,copyrightWidth,stjs.trunc(areaBound.getContentHeight()));copyrightLabel.setAlign(Label.ALIGN_RIGHT);copyrightLabel.setBaseline(Label.BASELINE_TOP);copyrightLabel.setColor(style.getCopyrightColor());copyrightLabel.setFontSize(fontSize);copyrightLabel.setBold(isBold);area.addElement(copyrightLabel);};prototype.getAggregatedValuesAtPosition=function(serie,context,position,chartWidth,exactPosition){if(serie==null){return null;}
return serie.getAggregatedValues(this.aggregationStrategy,context,position,chartWidth,serie.getMainField(),exactPosition);};prototype.createBackgroundGrid=function(layer,area,style,xLabelsPosition,yLabelsPosition,boldDateLabelsPositions){var gridLinesWidth=style.getBackgroundGridLineWidth();var gridStyle=style.getBackgroundGridStyle();var gridColor=style.getBackgroundGridColor();var gridColorGradientParam=style.getBackgroundGridColorGradientParams();this.createGrid(layer,area,gridLinesWidth,gridStyle,gridColor,gridColorGradientParam,xLabelsPosition,yLabelsPosition,boldDateLabelsPositions);};prototype.createGrid=function(layer,area,gridLinesWidth,gridStyle,gridColor,gridColorGradientParam,xLabelsPosition,yLabelsPosition,boldDateLabelsPositions){var areaBound=area.getAreaBound();var xInnerStart=stjs.trunc(areaBound.getInnerLeft());var yInnerStart=stjs.trunc(areaBound.getInnerTop());var xInnerEnd=stjs.trunc((areaBound.getInnerWidth()+xInnerStart));var yInnerEnd=stjs.trunc((areaBound.getInnerHeight()+yInnerStart));var showHorizontalLines=true;var showVerticalLines=true;var ignoreFirstLine=false;var dashedLines=false;if(gridStyle==null||gridStyle==GraphStyle.NONE_GRID_STYLE){return;}else if(gridStyle==GraphStyle.DASHED_GRID_STYLE){dashedLines=true;}else if(gridStyle==GraphStyle.CLASSIC_GRID_STYLE){ignoreFirstLine=true;}else if(gridStyle==GraphStyle.HORIZONTAL_GRID_STYLE){showVerticalLines=false;}else if(gridStyle==GraphStyle.VERTICAL_GRID_STYLE){showHorizontalLines=false;}
if(gridColor==null){gridColor=ChartColor.grey;}
if(showHorizontalLines){var lineCount=0;if(yLabelsPosition!=null){lineCount=yLabelsPosition.length;}
for(var i=0;i<lineCount;i++){var currentRelativePosition=1.0-yLabelsPosition[i];if(currentRelativePosition!=null&&currentRelativePosition>=-MathUtil.EPSILON&&currentRelativePosition<=(1+MathUtil.EPSILON)){var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+currentRelativePosition*areaBound.getContentHeight()));var horizontalLine=ChartElementFactory.createLine(layer,xInnerStart,yCenter,xInnerEnd,yCenter,gridLinesWidth);horizontalLine.setStrokeColor(gridColor);horizontalLine.setStrokeColorGradientParam(gridColorGradientParam);horizontalLine.setDashed(dashedLines);area.addElement(horizontalLine);}}}
if(showVerticalLines){var lineCount=0;if(xLabelsPosition!=null){lineCount=xLabelsPosition.length;}
var i=0;if(ignoreFirstLine){i++;}
for(;i<lineCount;i++){var currentRelativePosition=xLabelsPosition[i];if(currentRelativePosition!=null&&currentRelativePosition>=-MathUtil.EPSILON&&currentRelativePosition<=(1+MathUtil.EPSILON)){var xCenter=stjs.trunc(Math.round(areaBound.getContentLeft()+currentRelativePosition*areaBound.getContentWidth()));var verticalLine;if(boldDateLabelsPositions.indexOf(currentRelativePosition)>=0){verticalLine=ChartElementFactory.createLine(layer,xCenter,yInnerStart,xCenter,yInnerEnd,2*gridLinesWidth);}else{verticalLine=ChartElementFactory.createLine(layer,xCenter,yInnerStart,xCenter,yInnerEnd,gridLinesWidth);}
verticalLine.setStrokeColor(gridColor);verticalLine.setStrokeColorGradientParam(gridColorGradientParam);verticalLine.setDashed(dashedLines);area.addElement(verticalLine);}}}};prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var graphArea=chartView.getArea(this.correspondingAreaId);var graphStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(graphArea.isPointInside(context.getCurrentPosition())&&!chartData.isEmpty()){var type=graphStyle.getHighlightType();if(type==null){return;}
this.createPositionLines(layer,graphArea,context,graphStyle);if(type.indexOf(GraphStyle.CIRCLE_HIGHLIGHT)!=-1){this.createCircleHighlights(layer,chartView,graphArea,context,graphStyle,chartData);}
if(type.indexOf(GraphStyle.COLOR_HIGHLIGHT)!=-1){this.createColorHighlight(layer,chartView,graphArea,context,graphStyle);}}};prototype.createPositionLines=function(layer,area,context,style){var type=style.getHighlightType();var position=context.getCurrentPosition();var x=position.getX();var y=position.getY();var bound=area.getAreaBound();var xInnerStart=stjs.trunc(bound.getInnerLeft());var yInnerStart=stjs.trunc(bound.getInnerTop());var xInnerEnd=stjs.trunc((bound.getInnerWidth()+xInnerStart));var yInnerEnd=stjs.trunc((bound.getInnerHeight()+yInnerStart));if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.VERTICAL_LINE_HIGHLIGHT)!=-1&&(x>=xInnerStart&&x<=xInnerEnd)){var verticalLine=ChartElementFactory.createLine(layer,x,yInnerStart,x,yInnerEnd,style.getHighlightLineWidth());verticalLine.setStrokeColor(style.getHighlightLineColor());verticalLine.setStrokeColorGradientParam(style.getHighlightLineColorGradientParams());area.addElement(verticalLine);}
if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.HORIZONTAL_LINE_HIGHLIGHT)!=-1&&(y>=yInnerStart&&y<=yInnerEnd)){var horizontalLine=ChartElementFactory.createLine(layer,xInnerStart,y,xInnerEnd,y,style.getHighlightLineWidth());horizontalLine.setStrokeColor(style.getHighlightLineColor());horizontalLine.setStrokeColorGradientParam(style.getHighlightLineColorGradientParams());area.addElement(horizontalLine);}};prototype.createCircleHighlights=function(layer,chartView,graphArea,context,style,chartData){var graphBound=graphArea.getAreaBound();var currentPosition=context.getCurrentPosition();if(currentPosition==null){return;}
var currentPositionOnGraph=stjs.trunc(Math.round(currentPosition.getX()-graphBound.getContentLeft()));var seriesCount=chartData.getSerieCount();var styleField=style!=null?style.getHighlightField():null;for(var i=0;i<seriesCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var mainField=currentSerie.getMainField();var which=styleField==null?mainField:styleField;var closestDataPointPosition=context.getClosestDataPointPosition(currentSerie,currentPositionOnGraph,graphBound,this.aggregationStrategy,mainField,which,300*currentSerie.getXSpaceScale());if(closestDataPointPosition!=null&&graphArea.isPointInside(closestDataPointPosition)){this.createCircleHighlight(layer,closestDataPointPosition,graphArea,currentSerie,style);}}}};prototype.createCircleHighlight=function(layer,position,area,serie,style){var circleHighlight=ChartElementFactory.createCircle(layer,position.getX(),position.getY(),style.getCircleHighlightRadius());circleHighlight.setStrokeColor(serie.getColor());circleHighlight.setLineWidth(style.getCircleHighlightLineWidth());area.addElement(circleHighlight);};prototype.createColorHighlight=function(layer,chartView,area,context,style){var position=context.getCurrentPosition();var x=position.getX();var y=position.getY();var closestShape=chartView.getClosestShapesAtPosition(x,y);if(closestShape==null||closestShape.getData()==null){return;}
var hoverShape=closestShape.copyTo(layer);hoverShape.hover();};prototype.updateDefaultEngine=function(options){this.defaultType=Chart.ChartType.valueOf(options.getType());};prototype.getDefaultType=function(){return this.defaultType;};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},defaultType:{name:"Enum",arguments:["Chart.ChartType"]}},{});
var LegendEngine=function(options){Engine.call(this);this.isVisible=options.isShowLegend();};LegendEngine=stjs.extend(LegendEngine,Engine,[],function(constructor,prototype){prototype.isVisible=false;},{},{});
var TitleEngine=function(options){Engine.call(this);};TitleEngine=stjs.extend(TitleEngine,Engine,[],function(constructor,prototype){prototype.associatedGraphId=null;prototype.associatedAxisId=null;prototype.getAssociatedGraphId=function(){return this.associatedGraphId;};prototype.setAssociatedGraphId=function(associatedGraphId){this.associatedGraphId=associatedGraphId;};prototype.getAssociatedAxisId=function(){return this.associatedAxisId;};prototype.setAssociatedAxisId=function(associatedAxisId){this.associatedAxisId=associatedAxisId;};},{},{});
var ToolTipEngine=function(options){Engine.call(this);this.options=options;};ToolTipEngine=stjs.extend(ToolTipEngine,Engine,[],function(constructor,prototype){prototype.options=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){};prototype.customPlacement=function(tooltipArea,chartView){};prototype.customEvent=function(chartView,chartData,context){};},{options:"ChartOption"},{});
var DrawEngine=function(options){Engine.call(this);this.allowedDrawAreaIds=[];this.selectCallbacks={};this.drawnCallbacks={};this.associatedAxes={};this.drawElements=[];this.currentDrawType=InteractiveShapeFactory.SEGMENT_TYPE;this.currentMode=DrawEngine.DRAW_MODE;this.showElements=true;};DrawEngine=stjs.extend(DrawEngine,Engine,[],function(constructor,prototype){constructor.ID="drawEngineId";constructor.DRAWING_LAYER_ID="drawingLayer";constructor.DRAWING_LAYER_Z_INDEX=3;prototype.currentGroupId=null;constructor.DRAW_MODE="drawMode";constructor.MOVE_MODE="moveMode";prototype.selectCallbacks=null;prototype.drawnCallbacks=null;prototype.allowedDrawAreaIds=null;prototype.associatedAxes=null;prototype.drawElements=null;prototype.currentMode=null;prototype.currentDrawType=null;prototype.selectedElement=null;prototype.showElements=false;prototype.clearInteractiveShapes=function(){this.drawElements=[];};prototype.addAllowedArea=function(areaId,associatedAxis){this.allowedDrawAreaIds.push(areaId);this.associatedAxes[areaId]=associatedAxis;};prototype.removeAllowedArea=function(areaId){var index=this.allowedDrawAreaIds.indexOf(areaId);if(index!=-1){this.allowedDrawAreaIds.splice(index,1);delete this.associatedAxes[areaId];}};prototype.getAllowedDrawAreaIds=function(){return this.allowedDrawAreaIds;};prototype.setAllowedDrawAreaIds=function(allowedDrawAreaIds){this.allowedDrawAreaIds=allowedDrawAreaIds;};prototype.getAssociatedAxes=function(){return this.associatedAxes;};prototype.setAssociatedAxes=function(associatedAxes){this.associatedAxes=associatedAxes;};prototype.getDrawElements=function(){return this.drawElements;};prototype.setSelectedElements=function(selectedElements){this.selectedElement=null;if(selectedElements!=null){this.drawElements=selectedElements;}else{this.drawElements=[];}};prototype.getSelectedElement=function(){return this.selectedElement;};prototype.setSelectedElement=function(selectedElement){this.elementSelected();this.selectedElement=selectedElement;};prototype.deleteSelectedElement=function(){this.selectedElement=null;};prototype.serializeFigures=function(associatedAreaId,groupId){var serializedFigures=[];for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var figure=this.drawElements[index];if(figure!=null&&(associatedAreaId==null||associatedAreaId==figure.getAssociatedAreaId())&&(groupId==null||groupId==figure.getGroupId())){serializedFigures.push(figure.serialize());}}
return serializedFigures;};prototype.getInteractiveShapeAtPosition=function(view,offsetX,offsetY){if(this.selectedElement!=null&&this.selectedElement.isComplete()&&this.selectedElement.isInsideCurrentShape(view,offsetX,offsetY)){return this.selectedElement;}
for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var currentShape=this.drawElements[index];if(currentShape!=null&&currentShape.isInsideCurrentShape(view,offsetX,offsetY)){return currentShape;}}
return null;};prototype.elementSelected=function(){if(this.selectedElement!=null&&this.selectedElement.isComplete()){if(this.drawElements.indexOf(this.selectedElement)==-1){this.drawElements.push(this.selectedElement);}
this.selectedElement=null;}};prototype.isAllowed=function(areaId){return areaId!=null&&this.allowedDrawAreaIds.indexOf(areaId)!=-1;};prototype.getAxisAssociatedWith=function(areaId){return this.associatedAxes[areaId];};prototype.startDrawAt=function(chart,offsetX,offsetY){};prototype.createShape=function(chart,offsetX,offsetY){};prototype.getCurrentMode=function(){return this.currentMode;};prototype.updateMode=function(newMode){this.elementSelected();this.selectedElement=null;this.currentMode=newMode;};prototype.getCurrentDrawType=function(){return this.currentDrawType;};prototype.updateDrawType=function(newDrawType){this.elementSelected();this.selectedElement=null;this.currentDrawType=newDrawType;};prototype.endDrawAt=function(chart,offsetX,offsetY){};prototype.getDrawingLayer=function(view){var layer=view.getLayer(DrawEngine.DRAWING_LAYER_ID);if(layer==null){layer=view.addAdditionalLayer(DrawEngine.DRAWING_LAYER_ID,DrawEngine.DRAWING_LAYER_Z_INDEX);}
return layer;};prototype.isShowElements=function(){return this.showElements;};prototype.setShowElements=function(showElements){this.elementSelected();this.showElements=showElements;};prototype.isPointInsideShape=function(view,offsetX,offsetY){for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var shape=this.drawElements[index];if(shape!=null&&shape.isInsideCurrentShape(view,offsetX,offsetY)){return true;}}
return false;};prototype.applyStyleToCurrentElement=function(chart){if(this.selectedElement==null){return;}
var currentDrawStyle=chart.getChartView().getStyleModel().getStyle(DrawStyle.ID);var strokeColor=ChartColor.black;var strokeStyle="solid";var fillColor=ChartColor.transparent;var textColor=ChartColor.black;var textSize=12;if(currentDrawStyle!=null){strokeColor=currentDrawStyle.getLineColor();strokeStyle=currentDrawStyle.getLineStyle();fillColor=currentDrawStyle.getBackgroundColor();textColor=currentDrawStyle.getTextColor();textSize=currentDrawStyle.getFontSize();}
if(strokeColor!=null&&strokeColor.getFlatColor()!=null){this.selectedElement.setStrokeColor(strokeColor);}
if(strokeStyle!=""){this.selectedElement.setLineStyle(strokeStyle);}
if(fillColor!=null&&fillColor.getFlatColor()!=null){this.selectedElement.setFillColor(fillColor);}
if(textColor!=null&&textColor.getFlatColor()!=null){this.selectedElement.setTextColor(textColor);}
if(this.selectedElement.getFontSize()!=textSize){this.selectedElement.setFontSize(textSize);chart.reRender();}};prototype.fireOnSelectElementCallbacks=function(selectedShape){for(var index in this.selectCallbacks){var currentCallback=this.selectCallbacks[index];if(currentCallback!=null){currentCallback(selectedShape);}}};prototype.fireOnElementChangedCallbacks=function(drawnShape){for(var index in this.drawnCallbacks){var currentCallback=this.drawnCallbacks[index];if(currentCallback!=null){currentCallback(drawnShape);}}};prototype.endSelectedElementChange=function(){this.fireOnElementChangedCallbacks(this.selectedElement);};prototype.registerOnSelectElementCallback=function(id,onSelectCallback){if(id!=null&&onSelectCallback!=null){this.selectCallbacks[id]=onSelectCallback;}};prototype.unregisterOnSelectElementCallback=function(id){if(id!=null){delete this.selectCallbacks[id];}};prototype.registerOnElementChangedCallback=function(id,onElementDrawnCallback){if(id!=null&&onElementDrawnCallback!=null){this.drawnCallbacks[id]=onElementDrawnCallback;}};prototype.unregisterOnElementChangedCallback=function(id){if(id!=null){delete this.drawnCallbacks[id];}};prototype.getCurrentGroupId=function(){return this.currentGroupId;};prototype.setCurrentGroupId=function(currentGroupId){this.currentGroupId=currentGroupId;};},{selectCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},drawnCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},allowedDrawAreaIds:{name:"Array",arguments:[null]},associatedAxes:{name:"Map",arguments:[null,null]},drawElements:{name:"Array",arguments:["InteractiveShape"]},selectedElement:"InteractiveShape"},{});
var DefaultLegendEngine=function(options){LegendEngine.call(this,options);this.correspondingAreaId=DefaultLayout.LEGEND_AREA;};DefaultLegendEngine=stjs.extend(DefaultLegendEngine,LegendEngine,[],function(constructor,prototype){prototype.update=function(chartView,chartData,context){var legendStyle=chartView.getStyleModel().getLegendStyle();if(legendStyle!=null){this.isVisible=legendStyle.isVisible();}else{this.isVisible=false;}};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){};},{},{});
var DefaultTitleEngine=function(options){TitleEngine.call(this,options);this.copyright=StringUtil.getCopyright();this.title=options.getTitle();this.alternateTitle=options.getAlternateTitle();this.showCopyright=options.isShowCopyright();this.showTitle=options.isShowTitle();this.showValue=options.isShowValueInTitle();this.showEnlargeIcon=options.isPopOverAllowed();this.displayedTitle=this.title;this.valueFormatter=new AbbreviateNumberFormatter();this.correspondingAreaId=DefaultLayout.TITLE_AREA;this.associatedGraphId=DefaultLayout.GRAPH_AREA;this.associatedAxisId=DefaultLayout.Y1_AXIS_AREA;this.usedWidth=0;};DefaultTitleEngine=stjs.extend(DefaultTitleEngine,TitleEngine,[],function(constructor,prototype){constructor.MIN_SEPARATION_WIDTH=15;constructor.ICON_ID="enlargeIconId";prototype.displayedTitle=null;prototype.title=null;prototype.alternateTitle=null;prototype.copyright=null;prototype.value=null;prototype.currentIcon=null;prototype.showCopyright=false;prototype.showEnlargeIcon=false;prototype.showTitle=false;prototype.showValue=false;prototype.usedWidth=0;prototype.rightWidth=0;prototype.valueFormatter=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var layer=chartView.getGroundLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();this.usedWidth=0;if(this.showEnlargeIcon){this.rightWidth=this.createTitleIcon(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}else{this.rightWidth=this.createCopyrightLabel(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}
var areaBound=titleArea.getAreaBound();var maxValueWidth=0;if(context.getRange(this.associatedAxisId)!=null&&context.getRange(this.associatedAxisId)[1]!=null){this.valueFormatter.setFormat(context.getFormat(this.associatedAxisId));var valueString=this.valueFormatter.formatValue(context.getRange(this.associatedAxisId)[1]);maxValueWidth=chartView.getTextWidth(valueString,titleStyle.getFont(),titleStyle.getValueFontSize(),titleStyle.isValueBold());}
var availableWidth=stjs.trunc((areaBound.getInnerWidth()-this.usedWidth))-2*DefaultTitleEngine.MIN_SEPARATION_WIDTH-maxValueWidth;this.displayedTitle=this.getTitle(chartView,availableWidth);this.createTitleLabel(layer,this.displayedTitle,chartView,titleStyle.getTitleColor(),titleArea,titleStyle,0);};prototype.createTitleIcon=function(layer,chartView,area,style){if(!this.showTitle||style.getZoomIconSize()<=0){return 0;}
var areaBound=area.getAreaBound();var xPosEnd=stjs.trunc(Math.round(areaBound.getLeft()+areaBound.getOuterWidth(true)));var yPos=stjs.trunc(Math.round(areaBound.getBottom()-style.getZoomIconSize()-DefaultLayout.TITLE_PADDING_BOTTOM));var size=style.getZoomIconSize();var iconType=style.getIconType();if(iconType==null){iconType=ChartIcon.ENLARGE_ICON;}
var icon=ChartElementFactory.createIcon(layer,xPosEnd-size,yPos,size,size,iconType);icon.setId(DefaultTitleEngine.ICON_ID);area.addElement(icon);this.currentIcon=icon;return size;};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var overlayLayer=chartView.getOverlayLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();var position=context.getCurrentPosition();if(this.currentIcon!=null&&position!=null&&this.currentIcon.isInside(position.getX(),position.getY())){var copyIcon=this.currentIcon.copyTo(overlayLayer);copyIcon.setBackgroundColor(ChartColor.orange);titleArea.addElement(copyIcon);}};prototype.createTitleLabel=function(layer,title,chartView,color,area,style,previousTitlesWidth){if(!this.showTitle){return null;}
var fontSize=style.getTitleFontSize();var isBold=style.isTitleBold();var areaBound=area.getAreaBound();var titleWidth=chartView.getLabelWidth(title,style.getFont(),fontSize,isBold);var height=stjs.trunc(areaBound.getContentHeight());var yCenter=stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var xPos=stjs.trunc(areaBound.getInnerLeft())+previousTitlesWidth;var titleLabel=ChartElementFactory.createLabel(layer,0.0,title,xPos,yCenter,titleWidth,height);titleLabel.setAlign(Label.ALIGN_LEFT);titleLabel.setColor(color);titleLabel.setFontSize(fontSize);titleLabel.setBold(isBold);area.addElement(titleLabel);return titleLabel;};prototype.createCopyrightLabel=function(layer,chartView,area,style){if(!this.showCopyright||this.copyright==null){return 0;}
var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var areaBound=area.getAreaBound();var fontSize=style.getCopyrightFontSize();var isBold=style.isCopyrightBold();var copyrightWidth=chartView.getTextWidth(this.copyright,style.getFont(),fontSize,isBold);var xRight=stjs.trunc(Math.round(graphAreaBound.getLeft()+graphAreaBound.getOuterWidth(true)));var height=stjs.trunc(areaBound.getContentHeight());var yCenter=stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var copyrightLabel=ChartElementFactory.createLabel(layer,0.0,this.copyright,xRight,yCenter,copyrightWidth,height);copyrightLabel.setAlign(Label.ALIGN_RIGHT);copyrightLabel.setColor(style.getCopyrightColor());copyrightLabel.setFontSize(fontSize);copyrightLabel.setBold(isBold);area.addElement(copyrightLabel);return copyrightWidth;};prototype.getTitle=function(chartView,availableWidth){if(this.title==null){return this.alternateTitle;}
var titleStyle=chartView.getStyleModel().getTitleStyle();var fontSize=titleStyle.getTitleFontSize();var isBold=titleStyle.isTitleBold();var titleWidth=chartView.getLabelWidth(this.title,titleStyle.getFont(),fontSize,isBold);if(titleWidth>availableWidth&&this.alternateTitle!=null){var symbolWidth=chartView.getLabelWidth(this.alternateTitle,titleStyle.getFont(),fontSize,isBold);if(symbolWidth<titleWidth){return this.alternateTitle;}}
return this.title;};},{currentIcon:"ChartIcon",valueFormatter:"Formatter"},{});
var DefaultToolTipEngine=function(options){ToolTipEngine.call(this,options);this.showToolTip=options.isShowToolTip();this.fontFamily=options.getLabelFont();this.fontSize=options.getNormalLabelFontSize();this.tooltip=new CanvasToolTip();};DefaultToolTipEngine=stjs.extend(DefaultToolTipEngine,ToolTipEngine,[],function(constructor,prototype){prototype.showToolTip=false;prototype.tooltip=null;prototype.fontFamily=null;prototype.fontSize=0;prototype.headerFontStyles=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showToolTip||chartData.isEmpty()){return;}
var overlayLayer=chartView.getOverlayLayer();var style=chartView.getStyleModel().getTooltipStyle();var tooltipArea=chartView.getArea(DefaultLayout.TOOLTIP_AREA);var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);if(graphArea.isPointInside(context.getCurrentPosition())){this.createToolTip(overlayLayer,chartView,chartData,context,tooltipArea,style);}
this.customEvent(chartView,chartData,context);};prototype.createToolTip=function(layer,chartView,chartData,context,tooltipArea,style){var position=context.getCurrentPosition();var offsetX=position.getX();var offsetY=position.getY();var parent=chartView.getClosestShapesAtPosition(offsetX,offsetY);if(parent==null||parent.getData()==null){return;}
this.tooltip.setParent(parent);this.tooltip.parseData();var data=this.tooltip.getData();if(data==null||data.length==0){return;}
this.tooltip.configStyle(style);var numRow=data.length;var padding=DefaultLayout.DEFAULT_PADDING_PIXELS;var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var bounds=graphArea.getAreaBound();var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var chartBottomPos=chartTopPos+chartHeight;var chartRightPos=chartLeftPos+chartWidth;var xPadding=padding*5;var x=parent.getX()+xPadding;var y=parent.getY();if(stjs.isInstanceOf(parent.constructor,Line)){}else if(stjs.isInstanceOf(parent.constructor,Circle)){}else if(stjs.isInstanceOf(parent.constructor,Rect)){y=parent.getY()+parent.getHeight();}else{}
var longestName="";var longestValue="";var longestNameLength=Double.NEGATIVE_INFINITY;var longestValueLength=Double.NEGATIVE_INFINITY;for(var i=0;i<data.length;i++){var e=data[i];if(longestNameLength<e.name.length){longestNameLength=e.name.length;longestName=e.name;}
if(longestValueLength<e.value.length){longestValueLength=e.value.length;longestValue=e.value;}}
this.tooltip.setLongestName(longestName);this.tooltip.setLongestValue(longestValue);var fontFamily=this.fontFamily;var fontSize=this.fontSize;var fontStyle="";var fontColor=ChartColor.black;var fontStyles=[fontFamily,fontSize,fontStyle,fontColor];this.tooltip.calFontStyle(style.getStyle(),fontStyles);var defaultFontFamily=fontStyles[0];var defaultFontSize=fontStyles[1];var defaultFontStyle=fontStyles[2];var defaultFontColor=fontStyles[3];this.tooltip.calFontStyle(style.getNameStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];var nameWidth=chartView.getTextWidthFull(longestName,fontFamily,fontSize,fontStyle);fontStyles=[defaultFontFamily,defaultFontSize,defaultFontStyle,fontColor];this.tooltip.calFontStyle(style.getValueStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];var valueWidth=chartView.getTextWidthFull(longestValue,fontFamily,fontSize,fontStyle);var tooltipWidth=nameWidth+padding*5+valueWidth;if(this.tooltip.getHeader()!=null){numRow++;var headerValue=this.tooltip.getHeader().value;var headerStyle=this.tooltip.getHeader().getValueStyle();if(headerStyle!=null){this.headerFontStyles=[defaultFontFamily,defaultFontSize,defaultFontStyle,fontColor];this.tooltip.calFontStyle(headerStyle,this.headerFontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];fontColor=fontStyles[3];}
var headerWidth=chartView.getTextWidthFull(headerValue,fontFamily,fontSize,fontStyle);if(headerWidth>tooltipWidth){tooltipWidth=headerWidth;}}
var space=tooltipWidth-nameWidth-valueWidth;var xSpace=tooltipWidth-valueWidth-stjs.trunc(space/2);var tooltipHeight=(fontSize+padding)*numRow+padding;var ySpace=fontSize+padding;if(x+tooltipWidth>chartRightPos){x-=tooltipWidth+2*xPadding;}
if(y+tooltipHeight>chartBottomPos){y-=tooltipHeight;}
var tooltipBound=tooltipArea.getAreaBound();tooltipBound.reset();tooltipBound.setLeft(x);tooltipBound.setTop(y);tooltipBound.setWidth(tooltipWidth);tooltipBound.setHeight(tooltipHeight);tooltipBound.setBorder(1.0);tooltipBound.setPadding(padding);this.customPlacement(tooltipBound,chartView);var backgroundColor=style.getBackgroundColor();this.tooltip.init(layer,parent,x,y,tooltipWidth,tooltipHeight);this.tooltip.setNameWidth(nameWidth);this.tooltip.setValueWidth(valueWidth);this.tooltip.setxSpace(xSpace);this.tooltip.setySpace(ySpace);this.tooltip.setFontColor(defaultFontColor);this.tooltip.setFontFamily(defaultFontFamily);this.tooltip.setFontSize(defaultFontSize);this.tooltip.setFontStyle(defaultFontStyle);this.tooltip.setBackgroundColor(backgroundColor);tooltipArea.addElement(this.tooltip);};prototype.createHeader=function(layer,chartView,chartData,context,tooltipArea){var padding=DefaultLayout.DEFAULT_PADDING_PIXELS;var tooltipBound=tooltipArea.getAreaBound();if(this.tooltip.getHeader()==null||tooltipBound==null||this.headerFontStyles==null){return;}
var style=this.tooltip.getHeader().getValueStyle();var backgroundColor=ChartColor.lightYellow;if(style!=null){backgroundColor=(style["backgroundColor"]!=null?style["backgroundColor"]:ChartColor.lightYellow);}
var fontFamily=this.headerFontStyles[0];var fontSize=this.headerFontStyles[1];var fontStyle=this.headerFontStyles[2];var fontColor=this.headerFontStyles[3];var headerValue=this.tooltip.getHeader().value;var left=stjs.trunc(tooltipBound.getLeft());var top=stjs.trunc(tooltipBound.getTop());var width=stjs.trunc(tooltipBound.getWidth());var height=fontSize;var headerLabel=ChartElementFactory.createLabel(layer,0.0,headerValue,left,top,width,height);headerLabel.setFontSize(fontSize);headerLabel.setColor(fontColor);headerLabel.setBackgroundColor(backgroundColor);tooltipArea.addElement(headerLabel);};prototype.customPlacement=function(tooltipArea,chartView){};prototype.customEvent=function(chartView,chartData,context){};},{tooltip:"ToolTipComponent",headerFontStyles:"Array",options:"ChartOption"},{});
var DefaultDrawEngine=function(options){DrawEngine.call(this,options);};DefaultDrawEngine=stjs.extend(DefaultDrawEngine,DrawEngine,[],function(constructor,prototype){prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){if(!this.showElements){return;}
var layer=this.getDrawingLayer(chartView);var willElementChange=false;for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var iShape=this.drawElements[index];if(iShape!=null){willElementChange=willElementChange||iShape.willElementChange(chartData);var shapesInCurrentContext=iShape.getShapes(layer,chartView,chartData,context);if(shapesInCurrentContext!=null&&iShape.getAssociatedAreaId()!=null){if(this.allowedDrawAreaIds.indexOf(iShape.getAssociatedAreaId())!=-1){var associatedArea=chartView.getArea(iShape.getAssociatedAreaId());if(associatedArea!=null){associatedArea.addElements(shapesInCurrentContext);}}}}}
if(willElementChange){this.fireOnElementChangedCallbacks(null);}
if(this.selectedElement!=null&&this.selectedElement.isComplete()){var shapesInCurrentContext=this.selectedElement.getShapes(layer,chartView,chartData,context);if(shapesInCurrentContext!=null&&this.selectedElement.getAssociatedAreaId()!=null){if(this.allowedDrawAreaIds.indexOf(this.selectedElement.getAssociatedAreaId())!=-1){var associatedArea=chartView.getArea(this.selectedElement.getAssociatedAreaId());if(associatedArea!=null){associatedArea.addElements(shapesInCurrentContext);}}}}};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showElements){return;}
var layer=chartView.getOverlayLayer();if(this.selectedElement!=null){this.selectedElement.updatePosition(context.getCurrentPosition());var shapesBeingDrawn=this.selectedElement.getShapes(layer,chartView,chartData,context);var anchorPoints=this.selectedElement.getAnchorPoints(layer,chartView,chartData,context);if(this.selectedElement.getAssociatedAreaId()!=null){if(this.allowedDrawAreaIds.indexOf(this.selectedElement.getAssociatedAreaId())!=-1){var associatedArea=chartView.getArea(this.selectedElement.getAssociatedAreaId());if(associatedArea!=null){if(shapesBeingDrawn!=null){associatedArea.addElements(shapesBeingDrawn);}
if(anchorPoints!=null){associatedArea.addElements(anchorPoints);}}}}}};prototype.createShape=function(chart,offsetX,offsetY){if(!this.showElements){return false;}
if(InteractiveShapeFactory.TEXT_TYPE.equals(this.currentDrawType)){var engine=chart.getEngineModel().getEngine(DrawEngine.ID);var shapeAtPosition=engine.getInteractiveShapeAtPosition(chart.getChartView(),offsetX,offsetY);if(shapeAtPosition!=null&&stjs.isInstanceOf(shapeAtPosition.constructor,InteractiveText)){return false;}}
var associatedArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var areaId=associatedArea.getId();if(this.isAllowed(areaId)){var yAxisId=this.getAxisAssociatedWith(areaId);this.selectedElement=InteractiveShapeFactory.createInteractiveShape(this.currentDrawType,areaId,yAxisId);var chartData=chart.getChartData();var minXValue=chartData.getMinXValue();var completed=false;if(this.selectedElement!=null){InteractiveText.blurAll(chart);this.selectedElement.setReferenceDate(DateUtil.createDateOnly(minXValue));var mainSerie=chartData.getMainSerie();this.updateReferenceFrequency(mainSerie);this.selectedElement.setGroupId(this.currentGroupId);this.applyStyleToCurrentElement(chart);completed=this.selectedElement.addCurrentPositionToShape(offsetX,offsetY,chart);}
return completed;}
return false;};prototype.startDrawAt=function(chart,offsetX,offsetY){if(!this.showElements){return;}
if(this.currentMode==DrawEngine.DRAW_MODE){this.elementSelected();var completed=false;if(this.selectedElement==null){if(chart!=null&&chart.getChartView()!=null&&chart.getChartView().getAreaFromPosition(offsetX,offsetY)!=null){completed=this.createShape(chart,offsetX,offsetY);}}else{var associatedArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var areaId=associatedArea.getId();if(areaId==this.selectedElement.getAssociatedAreaId()){completed=this.selectedElement.addCurrentPositionToShape(offsetX,offsetY,chart);}}
if(completed){this.fireOnElementChangedCallbacks(this.selectedElement);}}else if(this.currentMode==DrawEngine.MOVE_MODE){var view=chart.getChartView();if(this.selectedElement!=null&&this.selectedElement.isComplete()){var layer=view.getOverlayLayer();var data=chart.getChartData();var anchors=this.selectedElement.getAnchorPoints(layer,view,data,chart.getEngineModel().getContext());var anchorsCount=anchors!=null?anchors.length:0;for(var index=0;index<anchorsCount;index++){var anchor=anchors[index];if(anchor!=null&&anchor.isInside(offsetX,offsetY)){this.selectedElement.setOriginTransform(index,offsetX,offsetY);return;}}}
this.elementSelected();var shape=this.getInteractiveShapeAtPosition(view,offsetX,offsetY);if(shape!=null){shape.setOriginTransform(-1,offsetX,offsetY);this.removeFromDrawElements(shape);this.selectedElement=shape;this.fireOnSelectElementCallbacks(shape);}}};prototype.removeFromDrawElements=function(shape){var index=this.drawElements.indexOf(shape);if(index>=0){this.drawElements.splice(index,1);}};prototype.endDrawAt=function(chart,offsetX,offsetY){if(!this.showElements){return false;}
if(this.selectedElement!=null&&this.currentMode==DrawEngine.MOVE_MODE&&chart!=null&&chart.getEngineModel()!=null){this.selectedElement.setEndTransform(offsetX,offsetY);var chartData=chart.getChartData();if(chartData!=null){var minXValue=chartData.getMinXValue();this.selectedElement.setReferenceDate(DateUtil.createDateOnly(minXValue));var mainSerie=chartData.getMainSerie();this.updateReferenceFrequency(mainSerie);}
this.fireOnElementChangedCallbacks(this.selectedElement);return true;}
return false;};prototype.updateReferenceFrequency=function(serie){if(serie!=null&&this.selectedElement!=null&&stjs.isInstanceOf(serie.constructor,FinancialSerie)){var financialSerie=serie;var defaultFreq=financialSerie.isIntraday()?Frequency.MINUTE:Frequency.DAY;var frequency=Frequency.extractFrequency(serie,defaultFreq);this.selectedElement.setReferenceFreq(frequency.getTimeValue());}};},{selectCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},drawnCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},allowedDrawAreaIds:{name:"Array",arguments:[null]},associatedAxes:{name:"Map",arguments:[null,null]},drawElements:{name:"Array",arguments:["InteractiveShape"]},selectedElement:"InteractiveShape"},{});
var DefaultYAxisEngine=function(options){AxisEngine.call(this,options);this.associatedGraphId=DefaultLayout.GRAPH_AREA;this.logScale=false;};DefaultYAxisEngine=stjs.extend(DefaultYAxisEngine,AxisEngine,[],function(constructor,prototype){constructor.LABELS_OVERLAP_PIXELS_ALLOWED=3;constructor.SCALE_MULTIPLIER=10;constructor.MINIMUM_AXIS_VALUE=1.0E-5;constructor.STEPS=[0.01,0.025,0.05];constructor.MAX_LOOP_COUNT=20;prototype.logScale=false;prototype.update=function(chartView,chartData,context){this.range=context.getRange(this.correspondingAreaId);this.labelsPosition=context.getLabelsPosition(this.correspondingAreaId);this.logScale=chartData.isLogScale();var currentFormat=context.getFormat(this.correspondingAreaId);if(this.labelsFormatter!=null&&currentFormat!=null){var formatValue=parseInt(currentFormat)-1;if(formatValue!=null&&!isNaN(formatValue)&&formatValue>1){this.labelsFormatter.setFormat(String.valueOf(formatValue));}else{this.labelsFormatter.setFormat("1");}}
var maxLabelWidth=this.getMaxLabelsWidth(chartView,this.range);var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(axisStyle!=null){axisStyle.setAbsoluteWidth(maxLabelWidth);}
if(this.labelsFormatter!=null&&currentFormat!=null){this.labelsFormatter.setFormat(currentFormat);}};prototype.createMainGraphics=function(chartView,chartData,context){var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);var axisArea=chartView.getArea(this.correspondingAreaId);if(axisArea==null||axisArea.getAreaBound()==null||!axisArea.getAreaBound().isVisible()||axisStyle==null||!axisStyle.isVisible()){return;}
var layer=chartView.getGroundLayer();CanvasBackgroundHelper.createBackground(layer,axisArea,axisStyle);this.createTicks(layer,axisArea,context,axisStyle);this.createLabels(layer,chartView,chartData,axisArea,context,axisStyle);};prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var axisArea=chartView.getArea(this.correspondingAreaId);var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(axisArea!=null&&axisArea.getAreaBound()!=null&&axisArea.getAreaBound().isVisible()&&axisStyle!=null&&axisStyle.isVisible()&&!chartData.isEmpty()){this.createHighlightLabel(layer,axisArea,chartView,context,axisStyle);}};prototype.createTicks=function(layer,area,context,style){var areaBound=area.getAreaBound();var showTicks=style.isShowAxisTicks();var ticksColor=style.getAxisTicksColor();var ticksColorGradientParam=style.getAxisTicksColorGradientParam();if(ticksColor==null){ticksColor=ChartColor.red;}
if(showTicks){var xStart=0;var xEnd=0;if(this.position==Layout.Position.LEFT){xEnd=stjs.trunc(Math.round(areaBound.getLeft()+areaBound.getOuterWidth(true)));xStart=xEnd-style.getAxisTickLength();}else{xStart=stjs.trunc(Math.round(areaBound.getLeft()));xEnd=xStart+style.getAxisTickLength();}
var lineCount=0;if(this.labelsPosition!=null){lineCount=this.labelsPosition.length;}
for(var i=0;i<lineCount;i++){var currentRelativePosition=1.0-this.labelsPosition[i];if(currentRelativePosition!=null){var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+currentRelativePosition*areaBound.getContentHeight()));var currentTick=ChartElementFactory.createLine(layer,xStart,yCenter,xEnd,yCenter,style.getTickWidth());currentTick.setStrokeColor(ticksColor);currentTick.setStrokeColorGradientParam(ticksColorGradientParam);area.addElement(currentTick);}}}};prototype.createLabels=function(layer,chartView,chartData,area,context,style){if(this.range==null){return;}
var lowestValue=this.range[0];var highestValue=this.range[1];if(lowestValue==null||highestValue==null){return;}
var highestValueFormatted=this.labelsFormatter.format(highestValue);var areaBound=area.getAreaBound();var valueDelta=highestValue-lowestValue;var labelCount=this.labelsPosition.length;var axisHeight=stjs.trunc(areaBound.getContentHeight());var labelWidth=stjs.trunc(areaBound.getContentWidth());var layerId=layer.getId();var align=null;var font=style.getFont();var textColor=style.getTickTextColor()!=null?style.getTickTextColor():style.getTextColor();var colorGradientParam=style.getTextColorGradientParams();var isBold=style.isBoldFont();var fontSize=style.getFontSize();var xPos=0;var previousYTop=Double.POSITIVE_INFINITY;if(this.position==Layout.Position.LEFT){align=Label.ALIGN_RIGHT;xPos=stjs.trunc(areaBound.getContentLeft())+labelWidth;}else{align=Label.ALIGN_LEFT;xPos=stjs.trunc((areaBound.getContentLeft()));}
for(var i=0;i<labelCount;i++){var ratio=this.labelsPosition[i];var value=this.getValue(lowestValue,highestValue,ratio,this.logScale);var currentRelativePosition=1.0-ratio;var labelHeight=style.getLabelsHeight();var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+currentRelativePosition*axisHeight));var yBottom=Math.floor(areaBound.getContentTop()+currentRelativePosition*axisHeight+labelHeight/2.0);if(yBottom<previousYTop){previousYTop=yBottom-labelHeight+DefaultYAxisEngine.LABELS_OVERLAP_PIXELS_ALLOWED;var currentValueFormatted=this.labelsFormatter.format(value);var nextValue=this.getValue(lowestValue,highestValue,this.labelsPosition[i+1],this.logScale);var nextValueFormatted=this.labelsFormatter.format(nextValue);var format=Integer.parseInt(this.labelsFormatter.getFormat());if(format<20&&currentValueFormatted.equals(nextValueFormatted)){this.labelsFormatter.setFormat(String.valueOf(format+1));currentValueFormatted=this.labelsFormatter.format(value);}
if(i>0&&highestValueFormatted.endsWith(AbbreviateNumberFormatter.THOUSAND_SUFFIX)&&currentValueFormatted.endsWith("0")){currentValueFormatted=AbbreviateNumberFormatter.separatedToSuffixedThousands(currentValueFormatted);}
var label=ChartElementFactory.createLabel(layer,value,currentValueFormatted,xPos,yCenter,labelWidth,labelHeight);label.setAlign(align);label.setBaseline(Label.BASELINE_MIDDLE);label.setColor(textColor);label.setColorGradientParam(colorGradientParam);label.setBold(isBold);label.setFont(font);label.setFontSize(fontSize);area.addElement(label);}}};prototype.getValue=function(min,max,ratio,logScale){if(logScale){var minLog=Math.log(min);return Math.exp((ratio*(Math.log(max)-minLog))+minLog);}else{return(ratio*(max-min))+min;}};prototype.createHighlightLabel=function(layer,area,chartView,context,yAxisStyle){var areaBounds=area.getAreaBound();var graphArea=chartView.getArea(this.associatedGraphId);var currentPosition=context.getCurrentPosition();if(this.range!=null&&graphArea.isPointInside(currentPosition)){var lowestValue=this.range[0];var highestValue=this.range[1];if(lowestValue==null||highestValue==null){return;}
var font=yAxisStyle.getFont();var textColor=yAxisStyle.getLabelHighlightTextColor()!=null?yAxisStyle.getLabelHighlightTextColor():yAxisStyle.getTextColor();var colorGradientParam=yAxisStyle.getTextColorGradientParams();var fontSize=yAxisStyle.getFontSize();var isBold=yAxisStyle.isLabelHighlightBold();var valueDelta=highestValue-lowestValue;var labelHeight=yAxisStyle.getLabelsHeight();var yPos=currentPosition.getY()-areaBounds.getContentTop();var ratio=1.0-(yPos/areaBounds.getContentHeight());var yPosCentered=stjs.trunc(Math.round(currentPosition.getY()));var axisContentWidth=stjs.trunc(areaBounds.getContentWidth());var axisWidth=stjs.trunc(areaBounds.getOuterWidth(true));var align=null;var xPos=0;var rectLeft=stjs.trunc(areaBounds.getLeft());var currentMaxLabelWidth=this.getMaxLabelsWidth(chartView,this.range);var labelWidth=currentMaxLabelWidth;var rectWidth=labelWidth;var top=stjs.trunc(Math.round(yPosCentered-(labelHeight/2.0)-DefaultLayout.DEFAULT_PADDING_PIXELS));var heightWithPadding=labelHeight+2*DefaultLayout.DEFAULT_PADDING_PIXELS;if(this.position==Layout.Position.LEFT){align=Label.ALIGN_RIGHT;xPos=stjs.trunc(areaBounds.getContentLeft())+axisContentWidth;if(currentMaxLabelWidth<=axisContentWidth){rectWidth=currentMaxLabelWidth+stjs.trunc(areaBounds.getPaddingRight())+stjs.trunc(areaBounds.getPaddingLeft());rectLeft+=axisWidth-rectWidth;}else{labelWidth=axisContentWidth;rectWidth=axisWidth;}}else{align=Label.ALIGN_LEFT;xPos=stjs.trunc(areaBounds.getContentLeft());if(currentMaxLabelWidth<=axisContentWidth){rectWidth=currentMaxLabelWidth+stjs.trunc(areaBounds.getPaddingRight())+stjs.trunc(areaBounds.getPaddingLeft());}else{labelWidth=axisContentWidth;rectWidth=axisWidth;}}
var yValue=this.getValue(lowestValue,highestValue,ratio,this.logScale);var formatter=this.labelsFormatter;var text=formatter.formatValue(yValue);var labelsBackground=ChartElementFactory.createRect(layer,rectLeft,top,rectWidth,heightWithPadding);labelsBackground.setFillColor(yAxisStyle.getLabelHighlightColor());labelsBackground.setFillColorGradientParam(yAxisStyle.getLabelHighlightColorGradientParam());var highlightLabel=ChartElementFactory.createLabel(layer,yValue,text,xPos,yPosCentered,labelWidth,labelHeight);highlightLabel.setAlign(align);highlightLabel.setBaseline(Label.BASELINE_MIDDLE);highlightLabel.setColor(textColor);highlightLabel.setColorGradientParam(colorGradientParam);highlightLabel.setBold(isBold);highlightLabel.setFont(font);highlightLabel.setFontSize(fontSize);area.addElement(labelsBackground);area.addElement(highlightLabel);}};prototype.computePrettyLabels=function(graphArea,currentRange,precision,style,logScale){this.labelsPosition=[];if(graphArea==null||currentRange==null||currentRange[0]==null||currentRange[1]==null){this.range=null;return null;}
var yMin=parseFloat((currentRange[0]).toFixed(precision));var yMax=parseFloat((currentRange[1]).toFixed(precision));var graphBounds=graphArea.getAreaBound();var availableHeight=graphBounds.getInnerHeight();var labelHeight=style.getLabelsHeight();var maxLabels=Math.floor(availableHeight/labelHeight);maxLabels=Math.max(maxLabels,1.0);var startScale=100.0/Math.pow(10,precision);var scale=startScale;var step=DefaultYAxisEngine.STEPS[0]*scale;var yMinWithStep=Math.floor(yMin/step)*step;var yMaxWithStep=Math.ceil(yMax/step)*step;var diff=yMaxWithStep-yMinWithStep;var labelNumber=diff/step;var i=2;while(labelNumber>maxLabels){step=DefaultYAxisEngine.STEPS[i]*scale;yMinWithStep=Math.floor(yMin/step)*step;yMaxWithStep=Math.ceil(yMax/step)*step;diff=Math.abs(yMaxWithStep-yMinWithStep);labelNumber=diff/step;if(labelNumber>maxLabels){i++;if(i>=DefaultYAxisEngine.STEPS.length){i=0;scale=scale*DefaultYAxisEngine.SCALE_MULTIPLIER;}}}
if(labelNumber>0){if(logScale&&this.validateYMinLog(yMinWithStep,yMin,step,scale,i)!=null&&yMaxWithStep>=0){var yMinWithStepValid=this.validateYMinLog(yMinWithStep,yMin,step,scale,i);if(yMaxWithStep<=yMinWithStepValid){yMaxWithStep=yMinWithStepValid+1;}
var yMinWithStepLog=Math.log(yMinWithStepValid);var yMaxWithStepLog=Math.log(yMaxWithStep);var diffLog=yMaxWithStepLog-yMinWithStepLog;var lastLabelIndex=stjs.trunc(Math.round(labelNumber));var positionStep=1.0/lastLabelIndex;this.labelsPosition[0]=0.0;for(i=1;i<=lastLabelIndex;i++){var currentLabelValue=yMinWithStep+i*positionStep*diff;if(currentLabelValue>yMinWithStepValid){var currentLogValue=Math.log(currentLabelValue/yMinWithStepValid);this.labelsPosition[i]=currentLogValue/diffLog;}}
yMinWithStep=yMinWithStepValid;}else{var lastLabelIndex=stjs.trunc(Math.round(labelNumber));var positionStep=1.0/lastLabelIndex;for(i=0;i<=lastLabelIndex;i++){this.labelsPosition[i]=i*positionStep;}}}
this.range=[yMinWithStep,yMaxWithStep];return step;};prototype.validateYMinLog=function(yMinWithStep,yMin,step,startScale,startIndex){if(yMinWithStep<0){return null;}else if(yMinWithStep>0){return yMinWithStep;}else{if(yMin<=0){return DefaultYAxisEngine.MINIMUM_AXIS_VALUE;}
var newYMinWithStep=step;var i=startIndex;var loopCount=0;var scale=startScale;while((newYMinWithStep==0||newYMinWithStep>yMin)&&loopCount<DefaultYAxisEngine.MAX_LOOP_COUNT){step=DefaultYAxisEngine.STEPS[i]*scale;newYMinWithStep=Math.floor(yMin/step)*step;loopCount++;i--;if(i<0){i=DefaultYAxisEngine.STEPS.length-1;scale=scale/DefaultYAxisEngine.SCALE_MULTIPLIER;}}
if(newYMinWithStep==0||newYMinWithStep>yMin){return DefaultYAxisEngine.MINIMUM_AXIS_VALUE;}
return newYMinWithStep;}};prototype.getMaxLabelsWidth=function(chartView,range){if(range==null||range[0]==null||range[1]==null){return 0;}else{var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);var font=axisStyle.getFont();var fontSize=axisStyle.getFontSize();var isBold=axisStyle.isLabelHighlightBold();var lowestValue=range[0];var highestValue=range[1];var valueDelta=highestValue-lowestValue;var labelCount=this.labelsPosition!=null?this.labelsPosition.length:0;var maxValueWidth=0;for(var i=0;i<labelCount;i++){var ratio=this.labelsPosition[i];var value=(ratio*valueDelta)+lowestValue;var valueString="";if(this.labelsFormatter!=null){valueString=this.labelsFormatter.formatValue(value);}else{valueString=String.valueOf(value);}
var currentValueWidth=chartView.getLabelWidth(valueString,font,fontSize,isBold);if(currentValueWidth>maxValueWidth){maxValueWidth=currentValueWidth;}}
return maxValueWidth;}};},{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultY1AxisEngine=function(options){DefaultYAxisEngine.call(this,options);this.labelsFormatter=options.getY1AxisFormatter();this.correspondingAreaId=DefaultLayout.Y1_AXIS_AREA;this.position=options.getY1AxisPosition();};DefaultY1AxisEngine=stjs.extend(DefaultY1AxisEngine,DefaultYAxisEngine,[],null,{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultY2AxisEngine=function(options){DefaultYAxisEngine.call(this,options);this.labelsFormatter=options.getY2AxisFormatter();this.correspondingAreaId=DefaultLayout.Y2_AXIS_AREA;this.position=options.getY2AxisPosition();};DefaultY2AxisEngine=stjs.extend(DefaultY2AxisEngine,DefaultYAxisEngine,[],function(constructor,prototype){constructor.TRIM_THRESHOLD=100;constructor.TRIM_FORMAT="0";constructor.NORMAL_FORMAT="2";prototype.update=function(chartView,chartData,context){this.range=context.getRange(this.correspondingAreaId);this.labelsPosition=context.getLabelsPosition(this.correspondingAreaId);var axisArea=chartView.getArea(this.correspondingAreaId);var areaBound=axisArea.getAreaBound();var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var currentFormat=DefaultY2AxisEngine.NORMAL_FORMAT;if(this.range!=null&&this.range[0]!=null&&this.range[1]!=null&&(this.range[1]-this.range[0])>=DefaultY2AxisEngine.TRIM_THRESHOLD){currentFormat=DefaultY2AxisEngine.TRIM_FORMAT;}
if(this.labelsFormatter!=null){this.labelsFormatter.setFormat("1");}
var maxLabelWidth=this.getMaxLabelsWidth(chartView,this.range);var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);axisStyle.setAbsoluteWidth(maxLabelWidth);if(this.labelsFormatter!=null){this.labelsFormatter.setFormat(currentFormat);}};},{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultXAxisEngine=function(options){AxisEngine.call(this,options);this.labelsFormatter=options.getXAxisFormatter();this.correspondingAreaId=DefaultLayout.X_AXIS_AREA;this.associatedGraphId=DefaultLayout.GRAPH_AREA;this.position=options.getXAxisPosition();this.messages=ChartMessagesRepository.getInstance();};DefaultXAxisEngine=stjs.extend(DefaultXAxisEngine,AxisEngine,[],function(constructor,prototype){prototype.labelsParameters=null;prototype.messages=null;prototype.boldDateLabelsPositions=null;prototype.update=function(chartView,chartData,context){this.range=context.getRange(this.correspondingAreaId);var xAxisStyle=chartView.getStyleModel().getXAxisStyle();this.computeLabelsContext(chartView,chartData,context,xAxisStyle);context.setLabelsPosition(this.correspondingAreaId,this.labelsPosition);if(this.labelsFormatter!=null&&context.getFormat(this.correspondingAreaId)!=null){this.labelsFormatter.setFormat(context.getFormat(this.correspondingAreaId));}};prototype.getBoldDateLabelsPositions=function(){return this.boldDateLabelsPositions;};prototype.computeLabelsContext=function(chartView,chartData,context,style){this.labelsPosition=[];this.labelsParameters=[];this.boldDateLabelsPositions=[];var xRange=this.range;if(xRange==null){xRange=chartData.getExtremums();if(xRange==null){return;}}
var axisStyle=chartView.getStyleModel().getXAxisStyle();var graphArea=chartView.getArea(this.associatedGraphId);var graphBounds=graphArea.getAreaBound();var chartWidth=graphBounds.getContentWidth();var availableFormats=chartData.getAvailableFormats();var possibleSteps=chartData.getPossibleXSteps();var currentStepIndex=0;var availableXSpace=chartData.getCurrentXSpaceSize(xRange);var exampleXValue=context.getMainMax(Serie.X);var currentFormats=availableFormats[currentStepIndex];var currentSteps=possibleSteps[currentStepIndex];var availableXValues=availableXSpace*chartData.getXStepSize();var labelNumberWithSmallestStep=availableXValues/currentSteps[0];this.labelsFormatter.setFormat(currentFormats[0]);var textWithFormat=this.labelsFormatter.formatValue(exampleXValue);var labelWidth=chartView.getLabelWidth(textWithFormat,axisStyle.getFont(),axisStyle.getFontSize(),false);if(currentFormats.length>1){labelWidth=labelWidth+2;}
var widthNeeded=labelNumberWithSmallestStep*labelWidth;while(widthNeeded>chartWidth&&currentStepIndex<(availableFormats.length-1)){currentStepIndex++;currentFormats=availableFormats[currentStepIndex];currentSteps=possibleSteps[currentStepIndex];labelNumberWithSmallestStep=availableXValues/currentSteps[0];this.labelsFormatter.setFormat(currentFormats[0]);textWithFormat=this.labelsFormatter.formatValue(exampleXValue);labelWidth=chartView.getLabelWidth(textWithFormat,axisStyle.getFont(),axisStyle.getFontSize(),false);if(currentFormats.length>1){labelWidth=labelWidth+2;}
widthNeeded=labelNumberWithSmallestStep*labelWidth;}
if(!style.isVisible()&&currentFormats==null||currentSteps==null||currentFormats.length==0||currentSteps.length==0){return;}
this.labelsFormatter.setFormat(currentFormats[0]);var maxNormalizedXValue=xRange[1];var minNormalizedXValue=xRange[0];var possibleStepCount=currentSteps.length;var labelsFormatsCount=currentFormats.length;var minXValue=chartData.normalizedXValue2XValue(minNormalizedXValue);var maxXValue=chartData.normalizedXValue2XValue(maxNormalizedXValue);if(minXValue==null||maxXValue==null){return;}
var currentLabelParameters={};currentLabelParameters["position"]=0;if(chartData.isIndexed()){currentLabelParameters["value"]=minXValue;}else{currentLabelParameters["value"]=this.labelsFormatter.toValueInScale(minXValue,currentSteps[possibleStepCount-1]);}
currentLabelParameters["format"]=currentFormats[labelsFormatsCount-1];currentLabelParameters["step"]=currentSteps[possibleStepCount-1];currentLabelParameters["bold"]=currentFormats.length>1;var currentTypeLabelsParameters=[currentLabelParameters];this.labelsParameters[possibleStepCount-1]=currentTypeLabelsParameters;this.labelsPosition.push(0.0);var nextXValues=[];for(var stepIndex=0;stepIndex<possibleStepCount;stepIndex++){nextXValues[stepIndex]=this.labelsFormatter.nextValueInScale(this.labelsFormatter.toValueInScale(minXValue,currentSteps[stepIndex]),currentSteps[stepIndex]);}
for(var xPixel=1;xPixel<chartWidth;xPixel++){var xSpacePosition=context.getXSpaceValueAtPosition(xPixel,chartWidth);var timeValueMs=chartData.xSpace2CurrentOrPreviousXValue(xSpacePosition);currentLabelParameters=null;var stepIndex=currentFormats.length-1;while(stepIndex>=0){if(timeValueMs>=nextXValues[stepIndex]){var currentStep=currentSteps[stepIndex];if(currentLabelParameters==null){currentLabelParameters={};var position=xPixel/chartWidth;currentLabelParameters["position"]=position;var valueToSet=timeValueMs;if(!chartData.isIndexed()){valueToSet=this.labelsFormatter.toValueInScale(timeValueMs,currentStep);}
currentLabelParameters["value"]=valueToSet;currentLabelParameters["format"]=currentFormats[stepIndex];currentLabelParameters["step"]=currentStep;currentLabelParameters["bold"]=stepIndex>0;currentTypeLabelsParameters=this.labelsParameters[stepIndex];if(currentTypeLabelsParameters==null){currentTypeLabelsParameters=[];this.labelsParameters[stepIndex]=currentTypeLabelsParameters;}
currentTypeLabelsParameters.push(currentLabelParameters);this.labelsPosition.push(position);if(stepIndex>0){this.boldDateLabelsPositions.push(position);}}
nextXValues[stepIndex]=this.labelsFormatter.nextValueInScale(this.labelsFormatter.toValueInScale(timeValueMs,currentStep),currentStep);}
stepIndex--;}}
if(this.labelsPosition.length==1){currentLabelParameters={};currentLabelParameters["position"]=1.0;if(chartData.isIndexed()){currentLabelParameters["value"]=maxXValue;}else{currentLabelParameters["value"]=this.labelsFormatter.toValueInScale(maxXValue,currentSteps[possibleStepCount-1]);}
currentLabelParameters["format"]=currentFormats[labelsFormatsCount-1];currentLabelParameters["step"]=currentSteps[possibleStepCount-1];currentLabelParameters["bold"]=currentFormats.length>1;currentTypeLabelsParameters.push(currentLabelParameters);this.labelsPosition.push(1.0);}};prototype.computePrettyLabels=function(graphArea,currentRange,precision,style,logScale){return null;};prototype.createMainGraphics=function(chartView,chartData,context){var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);var axisArea=chartView.getArea(this.correspondingAreaId);if(axisArea==null||axisArea.getAreaBound()==null||!axisArea.getAreaBound().isVisible()||axisStyle==null||!axisStyle.isVisible()){return;}
var layer=chartView.getGroundLayer();CanvasBackgroundHelper.createBackground(layer,axisArea,axisStyle);this.createTicks(layer,axisArea,context,axisStyle);this.createLabels(layer,chartView,chartData,axisArea,context,axisStyle);};prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var xAxisStyle=chartView.getStyleModel().getXAxisStyle();var graphArea=chartView.getArea(this.associatedGraphId);if(xAxisStyle.isVisible()&&xAxisStyle.isShowLabelHighlight()&&graphArea.isPointInside(context.getCurrentPosition())&&!chartData.isEmpty()){this.createHighlightLabel(layer,chartView,chartData,context);}};prototype.createHighlightLabel=function(layer,chartView,chartData,context){if(chartData==null||context.getData()==null){return;}
var area=chartView.getArea(this.correspondingAreaId);var areaBounds=area.getAreaBound();var xAxisStyle=chartView.getStyleModel().getXAxisStyle();var format=xAxisStyle.getLabelHighlightFormat();if(format!=null){this.labelsFormatter.setFormat(format);}else if(context.getFormat(this.correspondingAreaId)!=null){this.labelsFormatter.setFormat(context.getFormat(this.correspondingAreaId));}
var value=this.getXValueInMilliseconds(context,chartView);var text=this.millisecondsToDateLabelText(value,chartData,this.labelsFormatter.getFormat());if(text==null){return;}
var font=xAxisStyle.getFont();var textColor=xAxisStyle.getLabelHighlightTextColor()!=null?xAxisStyle.getLabelHighlightTextColor():xAxisStyle.getTextColor();var colorGradientParam=xAxisStyle.getTextColorGradientParams();var fontSize=xAxisStyle.getFontSize();var isBold=xAxisStyle.isLabelHighlightBold();var labelWidth=chartView.getLabelWidth(text,font,fontSize,isBold);var xPosCentered=context.getCurrentPosition().getX();var minLeft=areaBounds.getLeft()+labelWidth/2.0;var maxLeft=areaBounds.getLeft()+areaBounds.getOuterWidth(true)-labelWidth/2.0;if(xPosCentered<minLeft){xPosCentered=minLeft;}else if(xPosCentered>maxLeft){xPosCentered=maxLeft;}
var xCenter=stjs.trunc(Math.round(xPosCentered));var height=stjs.trunc(areaBounds.getOuterHeight(true));var yMiddle=stjs.trunc(Math.round(areaBounds.getTop()+height/2.0));var highlightLabel=ChartElementFactory.createLabel(layer,value,text,xCenter,yMiddle,labelWidth,height);highlightLabel.setAlign(Label.ALIGN_CENTER);highlightLabel.setBaseline(Label.BASELINE_MIDDLE);highlightLabel.setColor(textColor);highlightLabel.setColorGradientParam(colorGradientParam);highlightLabel.setBackgroundColor(xAxisStyle.getLabelHighlightColor());highlightLabel.setBackgroundColorGradientParam(xAxisStyle.getLabelHighlightColorGradientParam());highlightLabel.setBold(isBold);highlightLabel.setFont(font);highlightLabel.setFontSize(fontSize);area.addElement(highlightLabel);};prototype.getXValueInMilliseconds=function(context,chartView){var chartData=context.getData();if(chartData==null){return null;}
var graphArea=chartView.getArea(this.associatedGraphId);var graphBounds=graphArea.getAreaBound();var currentPositionOnGraph=stjs.trunc(Math.round(context.getCurrentPosition().getX()-graphBounds.getContentLeft()));var xSpacePosition=context.getXSpaceValueAtPosition(currentPositionOnGraph,graphBounds.getContentWidth());var xValueInMilliseconds=chartData.xSpace2ClosestXValue(xSpacePosition);var mainSerie=chartData.getMainSerie();if(mainSerie!=null&&!mainSerie.isEmpty()&&mainSerie.getLastPoint()!=null){var lastPointMaxPossibleValue=mainSerie.getLastPoint()["x"]+stjs.trunc(this.getStepInMilliseconds(chartData)/2);if(stjs.isInstanceOf(chartData.constructor,FinancialChartData)){var financialSerie=chartData.getMainSerie();if(financialSerie.isIntraday()&&!financialSerie.getPeriod().isLive()&&xValueInMilliseconds<=lastPointMaxPossibleValue){return mainSerie.getPoint(mainSerie.findIndexClosestToXValue(xValueInMilliseconds))["x"];}}}
return xValueInMilliseconds;};prototype.millisecondsToDateLabelText=function(dateInMilliseconds,chartData,format){if(chartData!=null&chartData.getMainSerie()!=null){var stepInMilliseconds=this.getStepInMilliseconds(chartData);var dateLabelText=DateTimeFormatter.formatDateAs(dateInMilliseconds,stepInMilliseconds,format);var outOfBounds=this.isIntervalOutOfBounds(chartData,dateInMilliseconds,stepInMilliseconds);return outOfBounds?DateTimeFormatter.closeDateOfIntervalToLiteral(dateLabelText,this.messages.get("last")):dateLabelText;}
return null;};prototype.getStepInMilliseconds=function(chartData){if(stjs.isInstanceOf(chartData.constructor,FinancialChartData)){var financialSerie=chartData.getMainSerie();return financialSerie.getPeriod().getFrequency().getTimeValue();}
return chartData.getMainSerie().getStepSize();};prototype.isIntervalOutOfBounds=function(chartData,dateInMillis,frequencyInMillis){var mainSerie=chartData!=null?chartData.getMainSerie():null;if(mainSerie!=null&&(stjs.isInstanceOf(mainSerie.constructor,HistoSerie)||stjs.isInstanceOf(mainSerie.constructor,IntradaySerie))){var lastPoint=mainSerie.getLastPoint();if(lastPoint==null||frequencyInMillis==Frequency.MINUTE.getTimeValue()||frequencyInMillis==Frequency.DAY.getTimeValue()||frequencyInMillis==Frequency.ALL.getTimeValue()){return false;}
var lastPointMiddle=lastPoint["x"];var currentTimeWithOffset=new Date().getTime()+chartData.getMainSerieTimeOffsetMs();var halfOfTheStep=stjs.trunc(frequencyInMillis/2);var minPossibleValue=lastPointMiddle-halfOfTheStep;var maxPossibleValue=lastPointMiddle+halfOfTheStep;return dateInMillis<=maxPossibleValue&&dateInMillis>=minPossibleValue&&maxPossibleValue>currentTimeWithOffset;}
return false;};prototype.createTicks=function(layer,area,context,style){var areaBound=area.getAreaBound();var showTicks=style.isShowAxisTicks();var ticksColor=style.getAxisTicksColor();var ticksColorGradientParam=style.getAxisTicksColorGradientParam();if(ticksColor==null){ticksColor=ChartColor.red;}
if(showTicks){var yStart=0;var yEnd=0;if(this.position==Layout.Position.TOP){yEnd=stjs.trunc(Math.round(areaBound.getTop()+areaBound.getOuterHeight(true)));yStart=yEnd-style.getAxisTickLength();}else{yStart=stjs.trunc(Math.round(areaBound.getTop()));yEnd=yStart+style.getAxisTickLength();}
var relativeLabelPositions=context.getLabelsPosition(this.correspondingAreaId);var lineCount=0;if(relativeLabelPositions!=null){lineCount=relativeLabelPositions.length;}
for(var i=0;i<lineCount;i++){var currentRelativePosition=relativeLabelPositions[i];if(currentRelativePosition!=null){var xCenter=stjs.trunc(Math.round(areaBound.getContentLeft()+currentRelativePosition*areaBound.getContentWidth()));var currentTick=ChartElementFactory.createLine(layer,xCenter,yStart,xCenter,yEnd,style.getTickWidth());currentTick.setStrokeColor(ticksColor);currentTick.setStrokeColorGradientParam(ticksColorGradientParam);area.addElement(currentTick);}}}};prototype.createLabels=function(layer,chartView,chartData,area,context,style){var areaBound=area.getAreaBound();var labelsTypeCount=this.labelsParameters!=null?this.labelsParameters.length:0;var axisWidth=stjs.trunc(areaBound.getContentWidth());var align=Label.ALIGN_CENTER;var font=style.getFont();var textColor=style.getTickTextColor()!=null?style.getTickTextColor():style.getTextColor();var colorGradientParam=style.getTextColorGradientParams();var fontSize=style.getFontSize();var xRange=this.range;if(xRange==null){xRange=chartData.getExtremums();}
if(xRange==null||labelsTypeCount<=0){return;}
var formatter=this.labelsFormatter;var top=stjs.trunc(areaBound.getContentTop());var labelHeight=stjs.trunc(areaBound.getContentHeight());var labelBounds=[];var leftPos=stjs.trunc(areaBound.getContentLeft());var leftPosLimit=stjs.trunc(areaBound.getInnerLeft());var rightPosLimit=leftPosLimit+stjs.trunc(areaBound.getInnerWidth());for(var i=labelsTypeCount-1;i>=0;i--){var isBold=i>0;var currentLabelsTypeParameters=this.labelsParameters[i];var currentLabelsTypeCount=currentLabelsTypeParameters!=null?currentLabelsTypeParameters.length:0;for(var j=currentLabelsTypeCount-1;j>=0;j--){var currentLabelParameters=currentLabelsTypeParameters[j];if(currentLabelParameters!=null&&currentLabelParameters["position"]!=null&&currentLabelParameters["value"]!=null){var relativePosition=currentLabelParameters["position"];var xValue=currentLabelParameters["value"];formatter.setFormat(currentLabelParameters["format"]);var text=formatter.formatValue(xValue);var labelWidth=stjs.trunc(Math.ceil(chartView.getLabelWidth(text,font,fontSize,isBold)));var halfWidth=stjs.trunc(Math.round(labelWidth/2.0));var xCenter=stjs.trunc(Math.round(leftPos+(relativePosition*axisWidth)));var xStart=xCenter-halfWidth;var xEnd=xCenter+halfWidth;if(xStart<leftPosLimit){var correction=leftPosLimit-xStart;xCenter+=correction;xStart=leftPosLimit;}else if(xEnd>rightPosLimit){var correction=xEnd-rightPosLimit;xCenter-=correction;xStart-=correction;}
var currentLabelBound=new AreaBound(xStart,top,labelWidth,labelHeight);if(this.hasSpaceForLabel(labelBounds,currentLabelBound)){labelBounds.push(currentLabelBound);var label=ChartElementFactory.createLabel(layer,xValue,text,xCenter,top,labelWidth,labelHeight);label.setAlign(align);label.setBaseline(Label.BASELINE_TOP);label.setColor(textColor);label.setColorGradientParam(colorGradientParam);label.setBold(isBold);label.setFont(font);label.setFontSize(fontSize);area.addElement(label);}}}}};prototype.hasSpaceForLabel=function(currentBounds,newBound){if(currentBounds==null||newBound==null){return false;}
var currentBoundsCount=currentBounds.length;for(var i=0;i<currentBoundsCount;i++){var currentBound=currentBounds[i];if(currentBound!=null&&currentBound.isVisible()&&currentBound.intersects(newBound)){return false;}}
return true;};},{labelsParameters:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},messages:"ChartMessagesRepository",boldDateLabelsPositions:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultGraphEngine=function(){};DefaultGraphEngine=stjs.extend(DefaultGraphEngine,null,[],function(constructor,prototype){prototype.createGraphElement=function(layer,area,serie,context,style){};prototype.createForegroundElements=function(layer,area,context,style){};prototype.traceGraphWith=function(path,area,serie,context,renderingRatio,direction,mainField,aggregationStrategy){if(serie==null){return;}
var bounds=area.getAreaBound();var serieId=serie.getId();var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin!=null&&yMin>0&&yMax!=null&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
if(path==null||renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);var yCoordinate=0;var lastValidXCoordinate=chartLeftPos;var currentValues=null;var i=0;var increment=1;if(direction<0){i=renderingWidth-1;increment=-1;}
for(;i<renderingWidth&&i>=0;i=i+increment){var currentXPosition=i+chartLeftPos;currentValues=serie.getAggregatedValues(aggregationStrategy,context,i,chartWidth,mainField,true);if(currentValues!=null&&currentValues.length>0){lastValidXCoordinate=currentXPosition;for(var j=0;j<currentValues.length;j++){var currentValue=this.filterValue(currentValues[j],yMin,useLogScale);if(currentValue!=null){yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));if(yCoordinate<chartTopPos){yCoordinate=chartTopPos;}else if(yCoordinate>chartBottomPos){yCoordinate=chartBottomPos;}
path.pushPoint(lastValidXCoordinate,yCoordinate);}}}}};prototype.traceGraph=function(path,area,serie,context,renderingRatio,direction){if(serie==null){return;}
this.traceGraphWith(path,area,serie,context,renderingRatio,direction,serie.getMainField(),serie.getAggregationStrategy());};prototype.filterValue=function(value,yMin,useLogScale){if(value!=null&&!isNaN(value)){if(useLogScale){if(value>0){return Math.log(value);}else{return yMin;}}else{return value;}}else{return null;}};},{},{});
var DefaultAreaGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultAreaGraphEngine=stjs.extend(DefaultAreaGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(DefaultAreaGraphEngine.instance==null){DefaultAreaGraphEngine.instance=new DefaultAreaGraphEngine();}
return DefaultAreaGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var mainStrat=serie.getAggregationStrategy();var mainField=serie.getMainField();var renderingRatio=style.getRenderingRatio();var bounds=area.getAreaBound();var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=stjs.trunc((bounds.getBottom()-bounds.getBorderBottom()-bounds.getBorderTop()));var areaZone=ChartElementFactory.createPath(layer,style.getGraphLineWidth());areaZone.setFillShape(true);areaZone.setStrokeShape(false);var highlightedTop=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraph(highlightedTop,area,serie,context,renderingRatio,1);var startPoint=highlightedTop.getStartPoint();var endPoint=highlightedTop.getEndPoint();if(startPoint!=null){areaZone.pushPoint(startPoint.getX(),chartBottomPos);}else{areaZone.pushPoint(chartLeftPos,chartBottomPos);}
this.traceGraph(areaZone,area,serie,context,renderingRatio,1);if(endPoint!=null){areaZone.pushPoint(endPoint.getX(),chartBottomPos);}else{areaZone.pushPoint(chartLeftPos+renderingWidth-1,chartBottomPos);}
var colorStrategy=serie.getColorStrategy();var contourColor=style.getAreaContourColor();if(colorStrategy!=null){if(serie.getLastValidValue(serie.getLength()-1,serie.getMainField())>=serie.getReferenceValue()){areaZone.setFillColor(colorStrategy.getPositiveColor());if(contourColor!=null){highlightedTop.setStrokeColor(contourColor);}else{highlightedTop.setStrokeColor(colorStrategy.getPositiveColor());}}else{areaZone.setFillColor(colorStrategy.getNegativeColor());if(contourColor!=null){highlightedTop.setStrokeColor(contourColor);}else{highlightedTop.setStrokeColor(colorStrategy.getNegativeColor());}}}else if(serie.getColor()!=null){areaZone.setFillColor(serie.getColor());if(contourColor!=null){highlightedTop.setStrokeColor(contourColor);}else{highlightedTop.setStrokeColor(serie.getColor());}}else{areaZone.setFillColor(ChartColor.black);highlightedTop.setStrokeColor(ChartColor.black);}
areaZone.setFillColorGradientParam([0,chartTopPos,0,chartBottomPos]);area.addElement(areaZone);area.addElement(highlightedTop);};},{instance:"DefaultAreaGraphEngine"},{});
var DefaultBarGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultBarGraphEngine=stjs.extend(DefaultBarGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){prototype.barType=null;prototype.chartZeroPos=0;constructor.instance=null;constructor.getInstance=function(){if(DefaultBarGraphEngine.instance==null){DefaultBarGraphEngine.instance=new DefaultBarGraphEngine();}
return DefaultBarGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin>0&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);this.chartZeroPos=stjs.trunc((chartTopPos+heightRatio*yMax));if(yMax==0&&yMin==0){heightRatio=0;this.chartZeroPos=chartTopPos+stjs.trunc(chartHeight/2);}
this.chartZeroPos=DefaultBarGraphEngine.filterYCoordinate(this.chartZeroPos,chartTopPos,chartBottomPos,0,this.barType);var colorStrategy=serie.getColorStrategy();var backupColor=serie.getColor()!=null?serie.getColor():ChartColor.black;var yCoordinate=0;for(var i=0;i<renderingWidth;i++){var currentValues=serie.getAggregatedValues(serie.getAggregationStrategy(),context,i,chartWidth,serie.getMainField(),true);var currentValue=null;if(currentValues!=null&&currentValues.length>0){currentValue=currentValues[0];if(currentValue!=null&&useLogScale){if(currentValue>0){currentValue=Math.log(currentValue);}else{currentValue=yMin;}}}
if(currentValue!=null){var indexes=serie.getCorrespondingIndices(context,i,chartWidth,true);var currentPoint=serie.getPoint(indexes[0]);var pointColor=currentPoint[ChartConstant.COLOR];var yRect=0;if(ChartOption.NORMAL_BAR.equals(this.barType)){yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));yCoordinate=DefaultBarGraphEngine.filterYCoordinate(yCoordinate,chartTopPos,chartBottomPos,currentValue,this.barType);yRect=chartBottomPos;}else if(ChartOption.INVERSE_NEGATIVE_BAR.equals(this.barType)){var bothNegPos=false;if(yMin>0){yCoordinate=stjs.trunc(Math.round(this.chartZeroPos-heightRatio*(currentValue-yMin)));}else if(yMax<0){yCoordinate=stjs.trunc(Math.round(this.chartZeroPos-heightRatio*(currentValue-yMax)));}else{yCoordinate=stjs.trunc(Math.round(this.chartZeroPos-heightRatio*currentValue));bothNegPos=true;}
yCoordinate=DefaultBarGraphEngine.filterYCoordinate(yCoordinate,chartTopPos,chartBottomPos,currentValue,this.barType);if(bothNegPos){if(currentValue>0){yRect=this.chartZeroPos;}else{yRect=this.chartZeroPos+1;}}else{yRect=this.chartZeroPos;}}else{throw new RuntimeException();}
var width=currentPoint[ChartConstant.WIDTH]==null?style.getBarWidth():currentPoint[ChartConstant.WIDTH];width=width!=null?width:1;var height=yCoordinate-yRect+1;if(currentValue==0){height=2;width=1;}
var xRectCorrection=stjs.trunc(Math.floor(width/2.0));var xRect=i+chartLeftPos-xRectCorrection;var bar=ChartElementFactory.createRect(layer,xRect,yRect,width,height);var id=currentPoint[ChartConstant.ID];if(id!=null){bar.setId(id);}
bar.setHighlightRectWidth(style.getHighlightBarWidth());bar.setHighlightColor(style.getHighlightBarColor());bar.setHighlightColorGradientParam(style.getHighlightLineColorGradientParams());bar.setHighlightMode(style.getHighlightBarMode());bar.setHoverRectWidth(style.getHoverBarWidth());bar.setHoverColor(style.getHoverBarColor());bar.setHoverColorGradientParam(style.getHoverBarColorGradientParams());bar.setHoverMode(style.getHoverBarMode());bar.setGroupRectWidth(style.getGroupBarWidth());bar.setGroupColor(style.getGroupBarColor());bar.setGroupColorGradientParam(style.getGroupBarColorGradientParams());if(currentValue==0){bar.setHoverMode(sq.ChartElement.HOVER.CIRCLE);}
bar.setData(currentPoint);if(pointColor!=null){bar.setFillColor(ChartColor.getColor(pointColor));}else if(colorStrategy!=null){if(yCoordinate<this.chartZeroPos){bar.setFillColor(colorStrategy.getPositiveColor());}else if(yCoordinate>this.chartZeroPos){bar.setFillColor(colorStrategy.getNegativeColor());}}else{bar.setFillColor(backupColor);}
if(currentPoint[ChartConstant.HIGHLIGHTED]!=null&&currentPoint[ChartConstant.HIGHLIGHTED]){var highlightColor=ChartColor.getColor(currentPoint[ChartConstant.HIGHLIGHT_COLOR]);var highlightWidth=currentPoint[ChartConstant.HIGHLIGHT_WIDTH];if(highlightColor!=null){bar.setHighlightColor(highlightColor);}
if(highlightWidth!=null){bar.setHighlightRectWidth(highlightWidth);}
bar.setHighlighted(true);}
if(currentPoint[ChartConstant.GROUPED]!=null&&currentPoint[ChartConstant.GROUPED]){this.createGroupElement(currentPoint,bar);}
area.addElement(bar);}}};prototype.createGroupElement=function(currentPoint,bar){var groupColor=ChartColor.getColor(currentPoint[ChartConstant.GROUP_COLOR]);var grouptWidth=currentPoint[ChartConstant.GROUP_WIDTH];if(groupColor!=null){bar.setGroupColor(groupColor);}
if(grouptWidth!=null){bar.setGroupRectWidth(grouptWidth);}
bar.setGrouped(true);};prototype.createForegroundElements=function(layer,area,context,style){var bounds=area.getAreaBound();var chartRightPos=stjs.trunc((bounds.getOuterWidth(true)+bounds.getLeft()));var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var chartBottomPos=chartTopPos+chartHeight;if(ChartOption.INVERSE_NEGATIVE_BAR.equals(this.barType)){this.chartZeroPos=DefaultBarGraphEngine.filterYCoordinate(this.chartZeroPos,chartTopPos,chartBottomPos,0,this.barType);var zeroLine=ChartElementFactory.createLine(layer,stjs.trunc(bounds.getLeft()),this.chartZeroPos,chartRightPos,this.chartZeroPos,1);area.addElement(zeroLine);}};constructor.filterYCoordinate=function(yValue,chartTopPos,chartBottomPos,currentValue,barType){var res=yValue;if(res<chartTopPos){res=chartTopPos;}
if(res>chartBottomPos){res=chartBottomPos;}
if(res==chartBottomPos&&currentValue>0){res=chartBottomPos-1;}
if(res==chartTopPos&&currentValue<=0&&ChartOption.INVERSE_NEGATIVE_BAR.equals(barType)){res=chartTopPos+1;}
return res;};prototype.getBarType=function(){return this.barType;};prototype.setBarType=function(barType){this.barType=barType;};},{instance:"DefaultBarGraphEngine"},{});
var DefaultLineGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultLineGraphEngine=stjs.extend(DefaultLineGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(DefaultLineGraphEngine.instance==null){DefaultLineGraphEngine.instance=new DefaultLineGraphEngine();}
return DefaultLineGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var renderingRatio=style.getRenderingRatio();var graph=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraph(graph,area,serie,context,renderingRatio,1);if(serie.isDashed()){graph.setDashed(true);var dashValues=[5,4];graph.setDashValues(dashValues);}
var colorStrategy=serie.getColorStrategy();if(colorStrategy!=null){if(serie.getLastValidValue(serie.getLength()-1,serie.getMainField())>=serie.getReferenceValue()){graph.setStrokeColor(colorStrategy.getPositiveColor());}else{graph.setStrokeColor(colorStrategy.getNegativeColor());}}else{graph.setStrokeColor(serie.getColor());}
area.addElement(graph);};},{instance:"DefaultLineGraphEngine"},{});
var DefaultPointGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultPointGraphEngine=stjs.extend(DefaultPointGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(DefaultPointGraphEngine.instance==null){DefaultPointGraphEngine.instance=new DefaultPointGraphEngine();}
return DefaultPointGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin>0&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);var yCoordinate=0;var lastValidXCoordinate=chartLeftPos;var color=serie.getColor();if(color==null){color=ChartColor.black;}
var pointRadius=2;var currentValues=null;var i=0;for(;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;currentValues=serie.getAggregatedValues(serie.getAggregationStrategy(),context,i,chartWidth,serie.getMainField(),true);if(currentValues!=null&&currentValues.length>0){lastValidXCoordinate=currentXPosition;for(var j=0;j<currentValues.length;j++){var currentValue=currentValues[j];if(currentValue!=null){if(useLogScale){if(currentValue>0){currentValue=Math.log(currentValue);}else{currentValue=yMin;}}
yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));if(yCoordinate<chartTopPos){yCoordinate=chartTopPos;}else if(yCoordinate>chartBottomPos){yCoordinate=chartBottomPos;}
var point=ChartElementFactory.createCircle(layer,lastValidXCoordinate,yCoordinate,pointRadius);point.setStrokeColor(color);area.addElement(point);}}}}};},{instance:"DefaultPointGraphEngine"},{});
var BidAskAreaEngine=function(){DefaultGraphEngine.call(this);};BidAskAreaEngine=stjs.extend(BidAskAreaEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(BidAskAreaEngine.instance==null){BidAskAreaEngine.instance=new BidAskAreaEngine();}
return BidAskAreaEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var renderingRatio=style.getRenderingRatio();var areaZone=ChartElementFactory.createPath(layer,style.getGraphLineWidth());areaZone.setFillShape(true);areaZone.setStrokeShape(false);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,1,BidAskSerie.BID,AggregationStrategy.MIN);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,-1,BidAskSerie.ASK,AggregationStrategy.MAX);var bidLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(bidLine,area,serie,context,renderingRatio,1,BidAskSerie.BID,AggregationStrategy.MIN);var askLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(askLine,area,serie,context,renderingRatio,1,BidAskSerie.ASK,AggregationStrategy.MAX);var colorStrategy=serie.getColorStrategy();if(colorStrategy!=null){askLine.setStrokeColor(colorStrategy.getPositiveColor());bidLine.setStrokeColor(colorStrategy.getNegativeColor());areaZone.setFillColor(ChartColor.grey);}else{bidLine.setStrokeColor(ChartColor.redOld);askLine.setStrokeColor(ChartColor.greenOld);areaZone.setFillColor(ChartColor.grey);}
area.addElement(areaZone);area.addElement(bidLine);area.addElement(askLine);};},{instance:"BidAskAreaEngine"},{});
var HighLowAreaGraphEngine=function(){DefaultGraphEngine.call(this);};HighLowAreaGraphEngine=stjs.extend(HighLowAreaGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(HighLowAreaGraphEngine.instance==null){HighLowAreaGraphEngine.instance=new HighLowAreaGraphEngine();}
return HighLowAreaGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var renderingRatio=style.getRenderingRatio();var areaZone=ChartElementFactory.createPath(layer,style.getGraphLineWidth());areaZone.setFillShape(true);areaZone.setStrokeShape(false);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,1,FinancialSerie.LOW,AggregationStrategy.MIN);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,-1,FinancialSerie.HIGH,AggregationStrategy.MAX);var lowLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(lowLine,area,serie,context,renderingRatio,1,FinancialSerie.LOW,AggregationStrategy.MIN);var highLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(highLine,area,serie,context,renderingRatio,1,FinancialSerie.HIGH,AggregationStrategy.MAX);var colorStrategy=serie.getColorStrategy();if(colorStrategy!=null){highLine.setStrokeColor(colorStrategy.getPositiveColor());lowLine.setStrokeColor(colorStrategy.getNegativeColor());areaZone.setFillColor(ChartColor.grey);}else{lowLine.setStrokeColor(ChartColor.redOld);highLine.setStrokeColor(ChartColor.greenOld);areaZone.setFillColor(ChartColor.grey);}
area.addElement(areaZone);area.addElement(lowLine);area.addElement(highLine);};},{instance:"HighLowAreaGraphEngine"},{});
var FinancialLegendEngine=function(options){DefaultLegendEngine.call(this,options);};FinancialLegendEngine=stjs.extend(FinancialLegendEngine,DefaultLegendEngine,[],function(constructor,prototype){prototype.createMainGraphics=function(chartView,chartData,context){if(!this.isVisible||chartData.isEmpty()){return;}
var legendStyle=chartView.getStyleModel().getLegendStyle();if(!legendStyle.isVisible()){return;}
var groundLayer=chartView.getGroundLayer();var legendArea=chartView.getArea(this.correspondingAreaId);this.createHeader(chartView,chartData,legendStyle,context);this.createTable(groundLayer,chartView,chartData,legendArea,legendStyle,context);};prototype.createHeader=function(chartView,chartData,style,context){var backgroundColor=style.getHeaderBackgroundColor();var backgroundColorGradientParam=style.getHeaderBackgroundColorGradientParam();var columnsRelativeWidth=style.getColumnsRelativeWidth();var messageRepo=ChartMessagesRepository.getInstance();var format=DateTimeFormatter.FORMAT_DATE;if(chartData.isIntraday()){format=DateTimeFormatter.FORMAT_DAY_MONTH_TIME;}
if(columnsRelativeWidth!=null&&columnsRelativeWidth.length>=4&&chartData.getExtremums()!=null){var xRange=context.getRange(Serie.X);var minNormalizedXValue=xRange!=null?xRange[0]:null;var maxNormalizedXValue=xRange!=null?xRange[1]:null;var firstXValue=Math.round(chartData.normalizedXValue2XValue(minNormalizedXValue));var lastXValue=Math.round(chartData.normalizedXValue2XValue(maxNormalizedXValue));var periodText="";if(firstXValue!=null&&lastXValue!=null&&!isNaN(lastXValue)&&!isNaN(firstXValue)){periodText=DateTimeFormatter.formatValueAs(firstXValue,format);periodText+=" "+messageRepo.get("to")+" ";periodText+=DateTimeFormatter.formatValueAs(lastXValue,format);}
var headerTexts=[periodText,messageRepo.get("periodHigh"),messageRepo.get("periodLow"),messageRepo.get("periodChange")];this.createRow(0,chartView,columnsRelativeWidth,headerTexts,[backgroundColor],[backgroundColorGradientParam],[style.getTextColor()],[style.getTextColorGradientParams()],[style.isBoldFont()]);}};prototype.createTable=function(layer,chartView,chartData,area,style,context){var pricesFormat=context.getFormat(DefaultLayout.Y1_AXIS_AREA);var absolutePriceFormatValue=parseInt(pricesFormat);if(absolutePriceFormatValue==null||isNaN(absolutePriceFormatValue)||absolutePriceFormatValue<AbbreviateNumberFormatter.EXACTLY_2_DECIMALS){pricesFormat=String.valueOf(AbbreviateNumberFormatter.EXACTLY_2_DECIMALS);}
var percentsFormat=context.getFormat(DefaultLayout.Y2_AXIS_AREA);var columnsRelativeWidth=style.getColumnsRelativeWidth();var series=chartData.getSeries();var evenColumnsColor=style.getEvenColumnsColor();var oddColumnsColor=style.getOddColumnsColor();var evenColumnsColorGradientParam=style.getEvenColumnsColorGradientParam();var oddColumnsColorGradientParam=style.getOddColumnsColorGradientParam();var columnsColors=[evenColumnsColor,oddColumnsColor];var columnsColorGradientParams=[evenColumnsColorGradientParam,oddColumnsColorGradientParam];var isBoldFonts=[true,false,false,false];var textColor=style.getTextColor();var count=1;for(var index in series){if(!(series).hasOwnProperty(index))
continue;var currentSerie=series[index];if(currentSerie!=null&&currentSerie.isEnabled()&&currentSerie.isInteractionAllowed()){var serieName="";var currentStock=currentSerie.getStock();if(currentStock!=null&&currentStock.getSymbol()!=null){serieName=currentStock.getSymbol()+currentStock.getMarketExtension();}
var startIndex=context.getMinIndex(currentSerie.getId(),Serie.X);var endIndex=context.getMaxIndex(currentSerie.getId(),Serie.X);var periodLowStr="-";var periodHighStr="-";if(startIndex!=null&&endIndex!=null){var minValues=currentSerie.getAggregateValuesFromRange(AggregationStrategy.MIN,startIndex,endIndex,FinancialSerie.LOW);var maxValues=currentSerie.getAggregateValuesFromRange(AggregationStrategy.MAX,startIndex,endIndex,FinancialSerie.HIGH);if(minValues!=null&&minValues[0]!=null&&minValues[0]>0){periodLowStr=AbbreviateNumberFormatter.formatAs(minValues[0],pricesFormat);}
if(maxValues!=null&&maxValues[0]!=null&&maxValues[0]>0){periodHighStr=AbbreviateNumberFormatter.formatAs(maxValues[0],pricesFormat);}}
var firstValue=currentSerie.getFirstValidValue(startIndex,Serie.Y);var endValue=currentSerie.getLastValidValue(endIndex,Serie.Y);var periodChangeStr="-";if(firstValue!=null&&endValue!=null&&!isNaN(firstValue)&&!isNaN(endValue)&&firstValue>0&&endValue>0){var change=endValue-firstValue;periodChangeStr=AbbreviateNumberFormatter.formatAs(change,pricesFormat);periodChangeStr+=" ("+PercentNumberFormatter.formatAs(100*(change/firstValue),percentsFormat)+")";}
var cellTexts=[serieName,periodHighStr,periodLowStr,periodChangeStr];var columnsTextColor=[FinancialEngineModel.COLORS_ARRAY[(count-1)%FinancialEngineModel.COLORS_ARRAY.length],textColor,textColor,textColor];this.createRow(count,chartView,columnsRelativeWidth,cellTexts,columnsColors,columnsColorGradientParams,columnsTextColor,null,isBoldFonts);count++;}}};prototype.createRow=function(count,chartView,columnsRelativeWidth,cellTexts,columnsBackgroundColor,columnsColorGradientParams,columnsTextColor,columnsTextColorGradientParams,isBoldFonts){var groundLayer=chartView.getGroundLayer();var legendArea=chartView.getArea(this.correspondingAreaId);var legendStyle=chartView.getStyleModel().getLegendStyle();var areaBound=legendArea.getAreaBound();var fontSize=legendStyle.getFontSize();var left=stjs.trunc(Math.round(areaBound.getInnerLeft()));var height=legendStyle.getLabelsHeight();var top=areaBound.getContentTop()+count*height;var yCenter=stjs.trunc(Math.round(top+height/2.0));var labelWidth=0;var columnsCount=columnsRelativeWidth.length;var columnsBackgroundColorCount=columnsBackgroundColor!=null?columnsBackgroundColor.length:0;var columnsColorGradientParamsCount=columnsColorGradientParams!=null?columnsColorGradientParams.length:0;var columnsTextColorCount=columnsTextColor!=null?columnsTextColor.length:0;var columnsTextColorGradientParamsCount=columnsTextColorGradientParams!=null?columnsTextColorGradientParams.length:0;var isBoldFontsCount=isBoldFonts!=null?isBoldFonts.length:0;for(var i=0;i<columnsCount;i++){left=left+labelWidth;labelWidth=stjs.trunc(Math.round(columnsRelativeWidth[i]*areaBound.getInnerWidth()));var centerX=stjs.trunc(Math.round(left+(labelWidth/2.0)));var backgroundColor=null;if(columnsBackgroundColorCount>0){backgroundColor=columnsBackgroundColor[i%columnsBackgroundColorCount];}
var backgroundColorGradientParam=[];if(columnsColorGradientParamsCount>0){backgroundColorGradientParam=columnsColorGradientParams[i%columnsColorGradientParamsCount];}
var textColor=null;if(columnsTextColorCount>0){textColor=columnsTextColor[i%columnsTextColorCount];}
var textColorGradientParams=[];if(columnsTextColorGradientParamsCount>0){textColorGradientParams=columnsTextColorGradientParams[i%columnsTextColorGradientParamsCount];}
var isBold=false;if(isBoldFontsCount>0){isBold=isBoldFonts[i%isBoldFontsCount];}
var currentLabel=ChartElementFactory.createLabel(groundLayer,0.0,cellTexts[i],centerX,yCenter,labelWidth,height);currentLabel.setAlign(Label.ALIGN_CENTER);currentLabel.setBaseline(Label.BASELINE_MIDDLE);currentLabel.setColor(textColor);currentLabel.setColorGradientParam(textColorGradientParams);currentLabel.setBackgroundColor(backgroundColor);currentLabel.setBackgroundColorGradientParam(backgroundColorGradientParam);currentLabel.setFontSize(fontSize);currentLabel.setBold(isBold);legendArea.addElement(currentLabel);}};},{},{});
var InteractionModelEventHandlers=function(interactionModel,chart){this.interactionModel=interactionModel;this.chart=chart;};InteractionModelEventHandlers=stjs.extend(InteractionModelEventHandlers,null,[],function(constructor,prototype){prototype.chart=null;constructor.MIN_TIME_BETWEEN_MOUSEMOVE=10;constructor.MIN_TIME_BETWEEN_MOUSEWHEEL=10;prototype.lastMouseMoveTime=0.0;prototype.lastMouseWheelTime=0.0;prototype.leftButton=false;prototype.rightButton=false;prototype.resizeTimer=null;prototype.interactionModel=null;prototype.isLeftButton=function(){return this.leftButton;};prototype.getOnResizeEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){clearTimeout(self.resizeTimer);var resizeChart=function(){self.chart.onResize(true);return false;};self.resizeTimer=setTimeout(resizeChart,100);return true;},1);return eh;};prototype.getOnMouseDownEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.leftButton=false;self.rightButton=false;if((typeof ev.which)!="undefined"){self.leftButton=(ev.which==1);self.rightButton=(ev.which==3);}else if((typeof ev.button)!="undefined"){self.leftButton=(ev.button==1);self.rightButton=(ev.button==2);}
if(self.leftButton){self.interactionModel.onLeftMouseDown(ev,THIS,self.chart);}else if(self.rightButton){self.interactionModel.onRightMouseDown(ev,THIS,self.chart);}else{self.interactionModel.onOtherMouseDown(ev,THIS,self.chart);}
return false;}
return true;},1);return eh;};prototype.getOnMouseUpEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseUp(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnMouseMoveEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){var now=(new Date()).getTime();if(now-self.lastMouseMoveTime<=InteractionModelEventHandlers.MIN_TIME_BETWEEN_MOUSEMOVE){return true;}
self.lastMouseMoveTime=(new Date()).getTime();ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseMove(ev,THIS,self.chart);self.lastMouseMoveTime=(new Date()).getTime();return false;}
return true;},1);return eh;};prototype.getOnMouseLeaveEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);self.interactionModel.lastMouseXPosition=null;self.interactionModel.lastMouseYPosition=null;self.interactionModel.onMouseLeave(ev,THIS,self.chart);return false;},1);return eh;};prototype.getOnMouseOverEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseOver(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnMouseOutEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseOut(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnMouseEnterEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseEnter(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnClickEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onClick(ev,THIS,self.chart);return true;}
return true;},1);return eh;};prototype.getOnUpdateSelectedElementEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onUpdateSelectedElement(ev,THIS,self.chart);return true;}
return true;},1);return eh;};prototype.getOnDoubleClickEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onDoubleClick(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnContextMenuEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){return false;}
return true;},1);return eh;};prototype.getOnMouseWheelEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){var now=(new Date()).getTime();if(now-self.lastMouseWheelTime<=InteractionModelEventHandlers.MIN_TIME_BETWEEN_MOUSEWHEEL||(typeof ev.originalEvent)=="undefined"){return false;}
self.lastMouseWheelTime=(new Date()).getTime();if(self.chart.isChartRendered()){ev.offsetX=self.interactionModel.lastMouseXPosition;ev.offsetY=self.interactionModel.lastMouseYPosition;ev=self.validateEvent(ev);self.interactionModel.onMouseWheel(ev,THIS,self.chart);self.lastMouseWheelTime=(new Date()).getTime();return false;}
return false;},1);return eh;};prototype.getOnTouchStartEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev.preventDefault();if(self.chart.isChartRendered()){self.interactionModel.onTouchStart(ev,THIS,self.chart);}
return true;},1);return eh;};prototype.getOnTouchMoveEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev.preventDefault();if(self.chart.isChartRendered()){self.interactionModel.onTouchMove(ev,THIS,self.chart);}
return true;},1);return eh;};prototype.getOnTouchEndOrCancelEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){if(self.chart.isChartRendered()){self.interactionModel.onTouchEndOrCancel(ev,THIS,self.chart);}
return true;},1);return eh;};prototype.getOnKeyUpEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){return self.interactionModel.onKeyUp(ev,THIS,self.chart);},1);return eh;};prototype.getOnKeyDownEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){return self.interactionModel.onKeyDown(ev,THIS,self.chart);},1);return eh;};prototype.validateEvent=function(event){if(event==null){event=(window)["event"];}
if((typeof event.offsetX)!="undefined"&&(typeof event.offsetY)!="undefined"){this.interactionModel.lastMouseXPosition=event.offsetX;this.interactionModel.lastMouseYPosition=event.offsetY;}else if((typeof event.pageX)!="undefined"&&(typeof event.pageY)!="undefined"){var targetOffset=SQW.$(event.target).offset();event.offsetX=event.pageX-targetOffset.left;event.offsetY=event.pageY-targetOffset.top;this.interactionModel.lastMouseXPosition=event.offsetX;this.interactionModel.lastMouseYPosition=event.offsetY;}
return event;};},{chart:"Chart",resizeTimer:"TimeoutHandler",interactionModel:"AbstractInteractionModel"},{});
var AbstractInteractionModel=function(){};AbstractInteractionModel=stjs.extend(AbstractInteractionModel,null,[],function(constructor,prototype){constructor.ZOOM_IN_TOUCH_PERCENT=0.9;constructor.ZOOM_OUT_TOUCH_PERCENT=1.1;constructor.ZOOM_IN_WHEEL_PERCENT=0.8;constructor.ZOOM_OUT_WHEEL_PERCENT=1.2;constructor.ZOOM_DOUBLE_CLICK_PERCENT=0.6;prototype.lastMouseXPosition=null;prototype.lastMouseYPosition=null;prototype.currentCursorType="default";constructor.eventHandlers=null;prototype.onMouseMoveEventHandler=null;prototype.onMouseOverEventHandler=null;prototype.onMouseOutEventHandler=null;prototype.onMouseEnterEventHandler=null;prototype.onMouseLeaveEventHandler=null;prototype.onMouseUpEventHandler=null;prototype.onMouseDownEventHandler=null;prototype.onClickEventHandler=null;prototype.onDoubleClickEventHandler=null;prototype.onMouseWheelEventHandler=null;prototype.onTouchStartEventHandler=null;prototype.onTouchMoveEventHandler=null;prototype.onTouchEndOrCancelEventHandler=null;prototype.onKeyDownEventHandler=null;prototype.onKeyUpEventHandler=null;prototype.onResizeEventHandler=null;prototype.onUpdateSelectedElementEventHandler=null;prototype.onContextMenuEventHandler=null;prototype.getInteractionModelType=function(){};constructor.getDefaultFromDevice=function(){return new DefaultInteractionModel();};constructor.registerModelOn=function(interactionModel,element,chart){if(chart==null||interactionModel==null||element==null||element.data(interactionModel.getInteractionModelType())!=null){return;}
AbstractInteractionModel.initEvents(interactionModel,element,chart);AbstractInteractionModel.attachEvents(interactionModel,element);interactionModel.onUserEvent(element,chart);element.data(interactionModel.getInteractionModelType(),true);};constructor.unregisterModelOn=function(interactionModel,element){if(interactionModel==null||element==null||element.data(interactionModel.getInteractionModelType())==null){return;}
AbstractInteractionModel.detachEvents(interactionModel,element);interactionModel.offUserEvent(element);element.data(interactionModel.getInteractionModelType(),null);};prototype.getLastMouseXPosition=function(){return this.lastMouseXPosition;};prototype.getLastMouseYPosition=function(){return this.lastMouseYPosition;};prototype.onMouseMove=function(event,element,chart){};prototype.onMouseOver=function(event,element,chart){};prototype.onMouseEnter=function(event,element,chart){};prototype.onMouseOut=function(event,element,chart){this.lastMouseXPosition=-1;this.lastMouseYPosition=-1;chart.mouseAt(-1,-1);};prototype.onMouseLeave=function(event,element,chart){this.onMouseOut(event,element,chart);};prototype.onLeftMouseDown=function(event,element,chart){};prototype.onRightMouseDown=function(event,element,chart){};prototype.onOtherMouseDown=function(event,element,chart){};prototype.onMouseUp=function(event,element,chart){};prototype.onClick=function(event,element,chart){};prototype.onDoubleClick=function(event,element,chart){};prototype.onMouseWheel=function(event,element,chart){};prototype.onTouchStart=function(event,element,chart){};prototype.onTouchMove=function(event,element,chart){};prototype.onTouchEndOrCancel=function(event,element,chart){};prototype.onKeyDown=function(event,element,chart){return true;};prototype.onKeyUp=function(event,element,chart){return true;};prototype.onUserEvent=function(element,chart){};prototype.offUserEvent=function(element){};prototype.onUpdateSelectedElement=function(event,element,chart){};prototype.getTargetTouches=function(event){if(event==null){event=(window)["event"];}
if(event==null||(typeof event)=="undefined"||(typeof event.originalEvent)=="undefined"){return null;}
return(event.originalEvent)["targetTouches"];};constructor.initEvents=function(interactionModel,element,chart){AbstractInteractionModel.eventHandlers=new InteractionModelEventHandlers(interactionModel,chart);interactionModel.onResizeEventHandler=AbstractInteractionModel.eventHandlers.getOnResizeEventHandler();interactionModel.onMouseUpEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseUpEventHandler();interactionModel.onMouseMoveEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseMoveEventHandler();interactionModel.onMouseDownEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseDownEventHandler();interactionModel.onMouseOverEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseOverEventHandler();interactionModel.onMouseOutEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseOutEventHandler();interactionModel.onMouseEnterEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseEnterEventHandler();interactionModel.onMouseLeaveEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseLeaveEventHandler();interactionModel.onClickEventHandler=AbstractInteractionModel.eventHandlers.getOnClickEventHandler();interactionModel.onUpdateSelectedElementEventHandler=AbstractInteractionModel.eventHandlers.getOnUpdateSelectedElementEventHandler();interactionModel.onDoubleClickEventHandler=AbstractInteractionModel.eventHandlers.getOnDoubleClickEventHandler();interactionModel.onContextMenuEventHandler=AbstractInteractionModel.eventHandlers.getOnContextMenuEventHandler();interactionModel.onMouseWheelEventHandler=AbstractInteractionModel.eventHandlers.getOnMouseWheelEventHandler();interactionModel.onTouchStartEventHandler=AbstractInteractionModel.eventHandlers.getOnTouchStartEventHandler();interactionModel.onTouchMoveEventHandler=AbstractInteractionModel.eventHandlers.getOnTouchMoveEventHandler();interactionModel.onTouchEndOrCancelEventHandler=AbstractInteractionModel.eventHandlers.getOnTouchEndOrCancelEventHandler();interactionModel.onKeyDownEventHandler=AbstractInteractionModel.eventHandlers.getOnKeyDownEventHandler();interactionModel.onKeyUpEventHandler=AbstractInteractionModel.eventHandlers.getOnKeyUpEventHandler();};constructor.attachEvents=function(interactionModel,element){SQW.$(window).resize(interactionModel.onResizeEventHandler);SQW.$(window).on("mouseup",interactionModel.onMouseUpEventHandler);SQW.$(window).on("keydown",interactionModel.onKeyDownEventHandler);SQW.$(window).on("keyup",interactionModel.onKeyUpEventHandler);SQW.$(window).on("touchend touchcancel",interactionModel.onTouchEndOrCancelEventHandler);element.on("mousemove",interactionModel.onMouseMoveEventHandler);element.on("mousedown",interactionModel.onMouseDownEventHandler);element.on("mouseover",interactionModel.onMouseOverEventHandler);element.on("mouseout",interactionModel.onMouseOutEventHandler);element.on("mouseenter",interactionModel.onMouseEnterEventHandler);element.on("mouseleave",interactionModel.onMouseLeaveEventHandler);element.on("click",interactionModel.onClickEventHandler);element.on("updateSelectedElement",interactionModel.onUpdateSelectedElementEventHandler);element.on("dblclick",interactionModel.onDoubleClickEventHandler);element.on("contextmenu",interactionModel.onContextMenuEventHandler);element.on("DOMMouseScroll",interactionModel.onMouseWheelEventHandler);element.on("mousewheel",interactionModel.onMouseWheelEventHandler);element.on("touchstart",interactionModel.onTouchStartEventHandler);element.on("touchmove",interactionModel.onTouchMoveEventHandler);};constructor.detachEvents=function(interactionModel,element){SQW.$(window).off("resize",interactionModel.onResizeEventHandler);SQW.$(window).off("mouseup",interactionModel.onMouseUpEventHandler);SQW.$(window).off("keydown",interactionModel.onKeyDownEventHandler);SQW.$(window).off("keyup",interactionModel.onKeyUpEventHandler);SQW.$(window).off("touchend touchcancel",interactionModel.onTouchEndOrCancelEventHandler);element.off("mousemove",interactionModel.onMouseMoveEventHandler);element.off("mousedown",interactionModel.onMouseDownEventHandler);element.off("mouseover",interactionModel.onMouseOverEventHandler);element.off("mouseout",interactionModel.onMouseOutEventHandler);element.off("mouseenter",interactionModel.onMouseEnterEventHandler);element.off("mouseleave",interactionModel.onMouseLeaveEventHandler);element.off("click",interactionModel.onClickEventHandler);element.off("updateSelectedElement",interactionModel.onUpdateSelectedElementEventHandler);element.off("dblclick",interactionModel.onDoubleClickEventHandler);element.off("contextmenu",interactionModel.onContextMenuEventHandler);element.off("DOMMouseScroll",interactionModel.onMouseWheelEventHandler);element.off("mousewheel",interactionModel.onMouseWheelEventHandler);element.off("touchstart",interactionModel.onTouchStartEventHandler);element.off("touchmove",interactionModel.onTouchMoveEventHandler);};},{eventHandlers:"InteractionModelEventHandlers",onMouseMoveEventHandler:"EventHandler",onMouseOverEventHandler:"EventHandler",onMouseOutEventHandler:"EventHandler",onMouseEnterEventHandler:"EventHandler",onMouseLeaveEventHandler:"EventHandler",onMouseUpEventHandler:"EventHandler",onMouseDownEventHandler:"EventHandler",onClickEventHandler:"EventHandler",onDoubleClickEventHandler:"EventHandler",onMouseWheelEventHandler:"EventHandler",onTouchStartEventHandler:"EventHandler",onTouchMoveEventHandler:"EventHandler",onTouchEndOrCancelEventHandler:"EventHandler",onKeyDownEventHandler:"EventHandler",onKeyUpEventHandler:"EventHandler",onResizeEventHandler:"EventHandler",onUpdateSelectedElementEventHandler:"EventHandler",onContextMenuEventHandler:"EventHandler"},{});
var DefaultInteractionModel=function(){AbstractInteractionModel.call(this);};DefaultInteractionModel=stjs.extend(DefaultInteractionModel,AbstractInteractionModel,[],function(constructor,prototype){prototype.lastOffsetX=null;prototype.lastOffsetY=null;prototype.centerPoint=null;prototype.previousP0=null;prototype.previousP1=null;prototype.previousP0Identifier=0;prototype.previousP1Identifier=0;constructor.INTERACTION_MODEL_TYPE="defaultInteractionModel";prototype.getInteractionModelType=function(){return DefaultInteractionModel.INTERACTION_MODEL_TYPE;};prototype.onMouseMove=function(event,element,chart){var offsetX=event.offsetX;var offsetY=event.offsetY;if(chart.isPanStarted()){chart.movePan(offsetX,offsetY);}else if(chart.isZoomStarted()){chart.moveZoom(offsetX,offsetY);}else{chart.mouseAt(offsetX,offsetY);var chartView=chart.getChartView();if(chartView.isInside(offsetX,offsetY)){var zoomIcon=chartView.findElementById(DefaultTitleEngine.ICON_ID);var elementStyle=(element)["style"];if(zoomIcon!=null&&zoomIcon.isInside(offsetX,offsetY)){if(this.currentCursorType!="pointer"){this.currentCursorType="pointer";elementStyle["cursor"]=this.currentCursorType;}}else if(this.currentCursorType!="default"){this.currentCursorType="default";elementStyle["cursor"]=this.currentCursorType;}}}};prototype.onLeftMouseDown=function(event,element,chart){var startedPanning=chart.startPan(event.offsetX,event.offsetY);if(startedPanning&&element!=null&&this.currentCursorType!="move"){var elementStyle=(element)["style"];this.currentCursorType="move";elementStyle["cursor"]=this.currentCursorType;}};prototype.onRightMouseDown=function(event,element,chart){chart.zoomBack();chart.mouseAt(event.offsetX,event.offsetY);};prototype.onMouseUp=function(event,element,chart){var target=$(event.target);chart.endPan(event.offsetX,event.offsetY);chart.endZoom(event.offsetX,event.offsetY);this.lastMouseXPosition=-1;this.lastMouseYPosition=-1;if(chart.getParentElement()!=null){var jElement=chart.getParentElement();if(jElement.has(target.get(0)).size()>0){chart.mouseAt(event.offsetX,event.offsetY);this.lastMouseXPosition=event.offsetX;this.lastMouseYPosition=event.offsetY;}
if(jElement.get(0)!=null&&this.currentCursorType!="default"){var elementStyle=(jElement.get(0))["style"];this.currentCursorType="default";elementStyle["cursor"]=this.currentCursorType;}}};prototype.onClick=function(event,element,chart){chart.click(event.offsetX,event.offsetY);if(chart.getParentElement()!=null&&chart.getParentElement().get(0)!=null&&this.currentCursorType!="default"){var elementStyle=(chart.getParentElement().get(0))["style"];this.currentCursorType="default";elementStyle["cursor"]=this.currentCursorType;}};prototype.onDoubleClick=function(event,element,chart){chart.zoomIn(event.offsetX,event.offsetY,AbstractInteractionModel.ZOOM_DOUBLE_CLICK_PERCENT);chart.mouseAt(event.offsetX,event.offsetY);};prototype.onMouseWheel=function(event,element,chart){var zoomIn=true;if((typeof event.originalEvent.wheelDelta)!="undefined"){zoomIn=event.originalEvent.wheelDelta>0;}else if(typeof event.originalEvent.detail!='undefined'){zoomIn=event.originalEvent.detail<0;}else if(typeof event.originalEvent.deltaY!='undefined'){zoomIn=event.originalEvent.deltaY<0;}else{return;}
if(zoomIn){chart.zoomInWheel(this.lastMouseXPosition,this.lastMouseYPosition,AbstractInteractionModel.ZOOM_IN_WHEEL_PERCENT);}else{chart.zoomOutWheel(this.lastMouseXPosition,this.lastMouseYPosition,AbstractInteractionModel.ZOOM_OUT_WHEEL_PERCENT);}
chart.mouseAt(this.lastMouseXPosition,this.lastMouseYPosition);};prototype.onTouchStart=function(event,element,chart){var targetTouches=this.getTargetTouches(event);if(chart==null||(typeof targetTouches)=="undefined"||targetTouches==null||targetTouches.length==0||targetTouches.length>2){return;}
var elementOffset=$(event.target).offset();if(targetTouches.length==1){var touch=targetTouches[0];var offsetX=touch.pageX-elementOffset.left;var offsetY=touch.pageY-elementOffset.top;this.lastOffsetX=offsetX;this.lastOffsetY=offsetY;chart.startPan(offsetX,offsetY);chart.mouseAt(null,null);}else if(targetTouches.length==2){if(chart.isPanStarted()){chart.endPan(this.lastOffsetX,this.lastOffsetY);chart.mouseAt(null,null);this.lastOffsetX=null;this.lastOffsetY=null;}
var touch0=targetTouches[0];var offsetX0=touch0.pageX-elementOffset.left;var offsetY0=touch0.pageY-elementOffset.top;var touch1=targetTouches[1];var offsetX1=touch1.pageX-elementOffset.left;var offsetY1=touch1.pageY-elementOffset.top;this.previousP0=new Point2D(offsetX0,offsetY0);this.previousP0Identifier=touch0.identifier;this.previousP1=new Point2D(offsetX1,offsetY1);this.previousP1Identifier=touch1.identifier;this.centerPoint=this.previousP0.midpointWith(this.previousP1);}};prototype.onTouchMove=function(event,element,chart){var targetTouches=this.getTargetTouches(event);if(chart==null||(typeof targetTouches)=="undefined"||targetTouches==null||targetTouches.length==0||targetTouches.length>2){return;}
var elementOffset=$(event.target).offset();if(chart.isPanStarted()){var touch=targetTouches[0];this.lastOffsetX=touch.pageX-elementOffset.left;this.lastOffsetY=touch.pageY-elementOffset.top;chart.movePan(this.lastOffsetX,this.lastOffsetY);chart.mouseAt(null,null);}else if(this.previousP0!=null&&this.previousP1!=null){var p0=this.previousP0;var p1=this.previousP1;var touchesCount=targetTouches.length;for(var i=0;i<touchesCount;i++){var currentTouch=targetTouches[i];var offsetX=currentTouch.pageX-elementOffset.left;var offsetY=currentTouch.pageY-elementOffset.top;if(currentTouch.identifier==this.previousP0Identifier){p0=new Point2D(offsetX,offsetY);}else if(currentTouch.identifier==this.previousP1Identifier){p1=new Point2D(offsetX,offsetY);}}
var previousDistance=this.previousP0.distanceTo(this.previousP1);var currentDistance=p0.distanceTo(p1);if(currentDistance>previousDistance){chart.zoomIn(this.centerPoint.getX(),this.centerPoint.getY(),AbstractInteractionModel.ZOOM_IN_TOUCH_PERCENT);}else if(currentDistance<previousDistance){chart.zoomOut(this.centerPoint.getX(),this.centerPoint.getY(),AbstractInteractionModel.ZOOM_OUT_TOUCH_PERCENT);}
chart.mouseAt(null,null);this.previousP0=p0;this.previousP1=p1;}};prototype.onTouchEndOrCancel=function(event,element,chart){this.previousP0=null;this.previousP1=null;this.centerPoint=null;this.previousP0Identifier=-1;this.previousP1Identifier=-1;if(event==null){event=(window)["event"];}
if(chart==null||(typeof event)=="undefined"||(typeof event.originalEvent)=="undefined"){return;}
if(chart.isPanning()){chart.endPan(this.lastOffsetX,this.lastOffsetY);chart.mouseAt(null,null);this.lastOffsetX=null;this.lastOffsetY=null;}};},{centerPoint:"Point2D",previousP0:"Point2D",previousP1:"Point2D",eventHandlers:"InteractionModelEventHandlers",onMouseMoveEventHandler:"EventHandler",onMouseOverEventHandler:"EventHandler",onMouseOutEventHandler:"EventHandler",onMouseEnterEventHandler:"EventHandler",onMouseLeaveEventHandler:"EventHandler",onMouseUpEventHandler:"EventHandler",onMouseDownEventHandler:"EventHandler",onClickEventHandler:"EventHandler",onDoubleClickEventHandler:"EventHandler",onMouseWheelEventHandler:"EventHandler",onTouchStartEventHandler:"EventHandler",onTouchMoveEventHandler:"EventHandler",onTouchEndOrCancelEventHandler:"EventHandler",onKeyDownEventHandler:"EventHandler",onKeyUpEventHandler:"EventHandler",onResizeEventHandler:"EventHandler",onUpdateSelectedElementEventHandler:"EventHandler",onContextMenuEventHandler:"EventHandler"},{});
var LoadingIndicator=function(chartView){this.chartView=chartView;this.loaded=false;this.pending=[];this.loadingImage=window.document.createElement("img");this.loadingImage.width=LoadingIndicator.WIDTH;this.loadingImage.height=LoadingIndicator.HEIGHT;this.loadingImage.onload=this.getOnLoadCallback();this.loadingImage.src=LoadingIndicator.IMAGE_SRC;this.lastLoadingId=0;};LoadingIndicator=stjs.extend(LoadingIndicator,null,[],function(constructor,prototype){prototype.lastLoadingId=0;prototype.currentLoadingId=0;constructor.WIDTH=26;constructor.HEIGHT=26;constructor.IMAGE_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94FDA86ESKTXoEAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAE4ElEQVRIx52WTYhfVxnGf79z73xn0qRJP0wRm4A2NCIVBLXgUkRQcCMIFtpKcW4KXRgVFXfiQhCKLuxMrG5EFyJid4J2a0FQUIgftVGINMFpJNpMJjOZ+d/zuLj3P5kMcZMDF+7HOed53+d9nvNe+06SCKIEIImllJTVymQF1SahVQ4BS8AEuJ5kV+2BSZKoAA5bRBU1SbDvbJKgkgQAtSaZUQ8Dp5KcVE8BRwKLwvIIeBX4O/C7JH9pz/PW7uehlAERKEAF4mSFMqIGoD0Pfef9hFPIu4D7kiyo88BiYIlkCTikLgNHkhxW/5Tkl03T/NyX+r6eLSWJSQagvrMkSSklzs1Rt7cfAd5JcgydAw4lmW56OMmyugTMT68ki8ARdUZ9Dfh6Wa1X+84GqEmyR91I2YNJTgBLygK4lOS+kYZ1YF3dTTKvvhv4AHAmyTwwX0pZzpDtH5N07Xku991Al31nAQIsJ3mHujjcs6QU9eJkUv82+/IglBtPw8KCqpTVmnq2vBc4l+RMkuUhSO9XX0nyfK3ZUCijCNpxQsbog/wXeLWs1tebxjJZgb7ThQX3VNV3NmW1Xiir9XPqL9SJg/RqrfU08OjM90GlDNJmflQISRrgGsnvy/Hjt8YaMko3I8jefd9Z+s5SVuu3IC8DW0DUP6v/GgPHvrMFDgMLwCFgLskb6q1RmtNgsrdoVO+oVgGT9KOHnlSX1b/u7tZLbTsE2O7zzVT3l9XtMTvU7KP0jlFrnZp0cCdJs8ZvxmTpO23WkskKOFmhVQ8BS6N6Lrfn2e5XJOy5myR7hj6Y2YERh1Snx0MLpPX2bKd09d34zJ0ABze+G/D4zrEUS8Buko32QDT96OT9deD/jbt8myLPAg8DO0l2VNoD0Tlmxj2OqWgC9PtrWw5wu6X2Bym5R8D9e9OOvtgGNoB+38R7R9EmyQywM2WrqJNSyrbaqzRrg6RzZ9GT2zYiZFidWZifhdkEhkstSQ5DyqgkaAul1moSm7WQZLnvPAUstmvTRjZ2RRhXjRUQ3TmZ8v7PxOPPKF9QPmySWeABaKrOCsv42LHevhuy6DtPAF9N8gRwUfhSc55rffcQ8pzkJOHbhNcDDGU+Q8p/rpm3trCegPyM6lOPw2RBZjdkbgtOXWPylc0yrUeSJ5O8oL5P/Xjgh3m+OdqsrSMfQj+iPsrgX0MBLs2Sq9+hvPRINo5/LPGpJ8BjQKVAbW9Oqhdv0Tw+ND2AUspV9cpYkh31dK31p/Vs+aBrnwy8p4ZdEihNA5jmxR3K976RScfRpX//+qPJ5EFSAzXUXaTecPGbE9jBSSft2kD9ZIUvA+fUXXWj1roFbImvycwrsb6RTLbVOsr3WJLHlIdJcxNzI+SGsImuM//Cetl+Nsl3q303uLNZGzLrO88leVadS/K2ujl1OLCpro/vS5JN8LpyHdhMsqluMNteZufTb5brP+nztaepP/jRbVPtA3xR/SLwW3UBmBl/r24CN9VmDGJH3FF7aYs0MzKzhc0/yo1n/lmy1qf9MVz4LOYod5x10/7erOVX9Wz5Q5IzwKeA02MH3h3r1wBtkjlhB3JFFi7o8rqrV27UlQfUCS5+Al49Qtqh8Xm3E7kMpnU8IBeAk8DJ8dfrFrARckl8E7glD+1WtjDbYD/20Iyifpv/AduF5ayNsaqtAAAAAElFTkSuQmCC";prototype.loaded=false;prototype.loadingImage=null;prototype.pending=null;prototype.chartView=null;prototype.showLoadingIndicator=function(){this.lastLoadingId++;this.currentLoadingId=this.lastLoadingId;this.getLoadingImage(this.getStartLoadingAnimationCallback());};prototype.hideLoadingIndicator=function(){if(this.lastLoadingId==this.currentLoadingId){this.lastLoadingId++;this.chartView.clearHighlight();}};prototype.getStartLoadingAnimationCallback=function(){var self=this;return function(){if(self.currentLoadingId==self.lastLoadingId){self.startLoadingAnimation();}};};prototype.startLoadingAnimation=function(){var self=this;var animationStartTime=(new Date()).getTime();var LOADING_CYCLE_TIME=1000;var animationCallback=function(){if(self.currentLoadingId==self.lastLoadingId){self.chartView.clearHighlight();var now=(new Date()).getTime();var ratio=(now-animationStartTime)/LOADING_CYCLE_TIME;if(ratio>=1){ratio=ratio-Math.floor(ratio);}
self.chartView.getOverlayLayer().drawRotatedImage(self.loadingImage,Math.PI*2.0*ratio);window.requestAnimationFrame(animationCallback);}};window.requestAnimationFrame(animationCallback);};prototype.getOnLoadCallback=function(){var self=this;return function(p1){self.loaded=true;var pendingCallback=self.pending.pop();while(pendingCallback!=null){pendingCallback();pendingCallback=self.pending.pop();}};};prototype.getLoadingImage=function(callback){if(!this.loaded){this.pending.push(callback);}else{callback();}};},{loadingImage:"Image",pending:{name:"Array",arguments:["Callback0"]},chartView:"CanvasChartView"},{});
var TextMessage=function(chartView){this.chartView=chartView;};TextMessage=stjs.extend(TextMessage,null,[],function(constructor,prototype){prototype.chartView=null;prototype.showNoPriceMessage=function(){var groundLayer=this.chartView.getGroundLayer();var noPriceMessage=ChartMessagesRepository.getInstance().get("noPrice");var graphArea=this.chartView.getArea(FinancialLayout.GRAPH_AREA);var graphStyle=this.chartView.getStyleModel().getStyle(DefaultLayout.GRAPH_AREA);CanvasBackgroundHelper.createBorders(groundLayer,graphArea,graphStyle);var fontSize=graphStyle.getFontSize();var textColor=ChartColor.black;var colorGradientParam=graphStyle.getTextColorGradientParams();var font=graphStyle.getFont();var isBold=graphStyle.isBoldFont();var labelWidth=stjs.trunc(Math.ceil(this.chartView.getLabelWidth(noPriceMessage,font,fontSize,isBold)));var areaBound=graphArea.getAreaBound();var xCenter=stjs.trunc(Math.round(areaBound.getContentLeft()+(areaBound.getContentWidth()/2.0)));var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+(areaBound.getContentHeight()/2.0)));var label=ChartElementFactory.createLabel(groundLayer,null,noPriceMessage,xCenter,yCenter,labelWidth,fontSize);label.setAlign(Label.ALIGN_CENTER);label.setBaseline(Label.BASELINE_MIDDLE);label.setColor(textColor);label.setColorGradientParam(colorGradientParam);label.setBold(isBold);label.setFont(font);label.setFontSize(fontSize);graphArea.addElement(label);graphArea.render();};},{chartView:"CanvasChartView"},{});
var ChartNotifications=function(chartView){this.loadingIndicator=new LoadingIndicator(chartView);this.textMessage=new TextMessage(chartView);};ChartNotifications=stjs.extend(ChartNotifications,null,[],function(constructor,prototype){prototype.loadingIndicator=null;prototype.textMessage=null;prototype.showNoPriceMessage=function(){this.textMessage.showNoPriceMessage();};prototype.showLoadingIndicator=function(){this.loadingIndicator.showLoadingIndicator();};prototype.hideLoadingIndicator=function(){this.loadingIndicator.hideLoadingIndicator();};},{loadingIndicator:"LoadingIndicator",textMessage:"TextMessage"},{});
var StyleModel=function(){this.styles={};};StyleModel=stjs.extend(StyleModel,null,[],function(constructor,prototype){prototype.globalStyle=null;prototype.tooltipStyle=null;prototype.titleStyle=null;prototype.xAxisStyle=null;prototype.y1AxisStyle=null;prototype.y2AxisStyle=null;prototype.legendStyle=null;prototype.graphStyle=null;prototype.drawStyle=null;prototype.styles=null;prototype.init=function(options){};prototype.getYAxesWidth=function(){};prototype.getTooltipStyle=function(){return this.tooltipStyle;};prototype.setTooltipStyle=function(tooltipStyle){this.tooltipStyle=tooltipStyle;};prototype.getGlobalStyle=function(){return this.globalStyle;};prototype.setGlobalStyle=function(globalStyle){this.globalStyle=globalStyle;};prototype.getTitleStyle=function(){return this.titleStyle;};prototype.setTitleStyle=function(titleStyle){this.titleStyle=titleStyle;};prototype.getLegendStyle=function(){return this.legendStyle;};prototype.setLegendStyle=function(legendStyle){this.legendStyle=legendStyle;};prototype.getGraphStyle=function(){return this.graphStyle;};prototype.setGraphStyle=function(graphStyle){this.graphStyle=graphStyle;};prototype.getXAxisStyle=function(){return this.xAxisStyle;};prototype.setxAxisStyle=function(xAxisStyle){this.xAxisStyle=xAxisStyle;};prototype.getY1AxisStyle=function(){return this.y1AxisStyle;};prototype.setY1AxisStyle=function(y1AxisStyle){this.y1AxisStyle=y1AxisStyle;};prototype.getY2AxisStyle=function(){return this.y2AxisStyle;};prototype.setY2AxisStyle=function(y2AxisStyle){this.y2AxisStyle=y2AxisStyle;};prototype.getStyle=function(styleId){return this.styles[styleId];};prototype.setStyle=function(styleId,style){this.styles[styleId]=style;};},{globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
var DefaultStyleModel=function(){StyleModel.call(this);};DefaultStyleModel=stjs.extend(DefaultStyleModel,StyleModel,[],function(constructor,prototype){prototype.init=function(options){this.graphStyle=this.getGraphStyleFromType(options);this.globalStyle=new DefaultGlobalStyle(options);this.tooltipStyle=new DefaultToolTipStyle(options);this.titleStyle=new DefaultTitleStyle(options);this.xAxisStyle=new DefaultXAxisStyle(options);this.y1AxisStyle=new DefaultYAxisStyle(options);this.y1AxisStyle.setPosition(options.getY1AxisPosition());this.y1AxisStyle.setVisible(options.getY1AxisPosition()!=Layout.Position.NONE);this.y2AxisStyle=new DefaultYAxisStyle(options);this.y2AxisStyle.setPosition(options.getY2AxisPosition());this.y2AxisStyle.setVisible(options.getY2AxisPosition()!=Layout.Position.NONE);this.legendStyle=new DefaultLegendStyle(options);this.drawStyle=new DefaultDrawStyle(options);this.extend(options);this.styles[DefaultLayout.TITLE_AREA]=this.titleStyle;this.styles[DefaultLayout.X_AXIS_AREA]=this.xAxisStyle;this.styles[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisStyle;this.styles[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisStyle;this.styles[DefaultLayout.GRAPH_AREA]=this.graphStyle;this.styles[DefaultLayout.LEGEND_AREA]=this.legendStyle;this.styles[DefaultLayout.TOOLTIP_AREA]=this.tooltipStyle;this.styles[DrawStyle.ID]=this.drawStyle;};prototype.extend=function(options){var customStyleModel=options.getCustomStyleModel();if(customStyleModel!=null){if((customStyleModel)["init"]!=null){options.setCustomeStyleModel(null);customStyleModel.init(options);options.setCustomeStyleModel(customStyleModel);}
var validStyles={};var tmp={};this.extendStyle(customStyleModel,validStyles,"titleStyle");this.extendStyle(customStyleModel,validStyles,"xAxisStyle");this.extendStyle(customStyleModel,validStyles,"y1AxisStyle");this.extendStyle(customStyleModel,validStyles,"y2AxisStyle");this.extendStyle(customStyleModel,validStyles,"graphStyle");this.extendStyle(customStyleModel,validStyles,"legendStyle");this.extendStyle(customStyleModel,validStyles,"tooltipStyle");this.extendStyle(customStyleModel,validStyles,"drawStyle");SQW.$.extend(true,tmp,customStyleModel,validStyles);SQW.$.extend(true,this,tmp);}};prototype.extendStyle=function(customStyleModel,a,propName){if((customStyleModel)[propName]!=null){(a)[propName]=SQW.$.extend((this)[propName],(customStyleModel)[propName]);}};prototype.getGraphStyleFromType=function(options){var type=Chart.ChartType.valueOf(options.getType());if(type==Chart.ChartType.LINE){return new DefaultLineGraphStyle(options);}else if(type==Chart.ChartType.POINT){return new DefaultPointGraphStyle(options);}else if(type==Chart.ChartType.AREA){return new DefaultAreaGraphStyle(options);}else if(type==Chart.ChartType.BAR){return new DefaultBarGraphStyle(options);}else{return new DefaultLineGraphStyle(options);}};prototype.getYAxesWidth=function(){var axesWidth={};var y1Width=this.y1AxisStyle!=null?this.y1AxisStyle.getLabelsWidth():0;var y2Width=this.y2AxisStyle!=null?this.y2AxisStyle.getLabelsWidth():0;axesWidth[DefaultLayout.Y1_AXIS_AREA]=y1Width;axesWidth[DefaultLayout.Y2_AXIS_AREA]=y2Width;return axesWidth;};},{globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
var Style=function(option){this.style={};this.zIndex=1;this.textColor=ChartColor.black;this.fontSize=12;this.boldFont=false;this.font="Arial";if(this.font==null){this.font="Arial";}
this.borderLeftStyle="solid";this.borderRightStyle="solid";this.borderTopStyle="solid";this.borderBottomStyle="solid";this.borderLeft=0;this.borderRight=0;this.borderTop=0;this.borderBottom=0;this.borderLeftColor=ChartColor.black;if(option!=null){this.backgroundColor=option.getBackgroundColor();this.backgroundColorGradientParams=option.getBackgroundColorGradientParams();if(option.getBorderColor()!=null){this.borderLeftColor=option.getBorderColor();}
if(option.getTextColor()!=null){this.textColor=option.getTextColor();}
this.font=option.getLabelFont();this.fontSize=option.getNormalLabelFontSize();}
this.borderRightColor=this.borderLeftColor;this.borderTopColor=this.borderLeftColor;this.borderBottomColor=this.borderLeftColor;this.visible=true;};Style=stjs.extend(Style,null,[],function(constructor,prototype){prototype.style=null;prototype.position=null;prototype.cursor=null;prototype.zIndex=0;prototype.textColor=null;prototype.textColorGradientParams=null;prototype.fontSize=0;prototype.boldFont=false;prototype.font=null;prototype.fontStyle=null;prototype.leftAbsolute=null;prototype.topAbsolute=null;prototype.widthAbsolute=null;prototype.heightAbsolute=null;prototype.leftRatio=null;prototype.topRatio=null;prototype.widthRatio=null;prototype.heightRatio=null;prototype.paddingLeftAbsolute=null;prototype.paddingRightAbsolute=null;prototype.paddingTopAbsolute=null;prototype.paddingBottomAbsolute=null;prototype.paddingLeftRatio=null;prototype.paddingRightRatio=null;prototype.paddingTopRatio=null;prototype.paddingBottomRatio=null;prototype.marginLeftAbsolute=null;prototype.marginRightAbsolute=null;prototype.marginTopAbsolute=null;prototype.marginBottomAbsolute=null;prototype.marginLeftRatio=null;prototype.marginRightRatio=null;prototype.marginTopRatio=null;prototype.marginBottomRatio=null;prototype.borderLeftStyle=null;prototype.borderRightStyle=null;prototype.borderTopStyle=null;prototype.borderBottomStyle=null;prototype.borderLeft=0.0;prototype.borderRight=0.0;prototype.borderTop=0.0;prototype.borderBottom=0.0;prototype.borderLeftColor=null;prototype.borderRightColor=null;prototype.borderTopColor=null;prototype.borderBottomColor=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParams=null;prototype.visible=false;prototype.getStyle=function(){return this.style;};prototype.setStyle=function(style){this.style=style;};prototype.getPosition=function(){return this.position;};prototype.setPosition=function(position){this.position=position;};prototype.getCursor=function(){return this.cursor;};prototype.setCursor=function(cursor){this.cursor=cursor;};prototype.getzIndex=function(){return this.zIndex;};prototype.setzIndex=function(zIndex){this.zIndex=zIndex;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getTextColorGradientParams=function(){return this.textColorGradientParams;};prototype.setTextColorGradientParams=function(textColorGradientParams){this.textColorGradientParams=textColorGradientParams;};prototype.getBorderLeftStyle=function(){return this.borderLeftStyle;};prototype.setBorderLeftStyle=function(borderLeftStyle){this.borderLeftStyle=borderLeftStyle;};prototype.getBorderRightStyle=function(){return this.borderRightStyle;};prototype.setBorderRightStyle=function(borderRightStyle){this.borderRightStyle=borderRightStyle;};prototype.getBorderTopStyle=function(){return this.borderTopStyle;};prototype.setBorderTopStyle=function(borderTopStyle){this.borderTopStyle=borderTopStyle;};prototype.getBorderBottomStyle=function(){return this.borderBottomStyle;};prototype.setBorderBottomStyle=function(borderBottomStyle){this.borderBottomStyle=borderBottomStyle;};prototype.getBorderLeft=function(){return this.borderLeft;};prototype.setBorderLeft=function(borderLeft){this.borderLeft=borderLeft;};prototype.getBorderRight=function(){return this.borderRight;};prototype.setBorderRight=function(borderRight){this.borderRight=borderRight;};prototype.getBorderTop=function(){return this.borderTop;};prototype.setBorderTop=function(borderTop){this.borderTop=borderTop;};prototype.getBorderBottom=function(){return this.borderBottom;};prototype.setBorderBottom=function(borderBottom){this.borderBottom=borderBottom;};prototype.getBorderLeftColor=function(){return this.borderLeftColor;};prototype.setBorderLeftColor=function(borderLeftColor){this.borderLeftColor=borderLeftColor;};prototype.getBorderRightColor=function(){return this.borderRightColor;};prototype.setBorderRightColor=function(borderRightColor){this.borderRightColor=borderRightColor;};prototype.getBorderTopColor=function(){return this.borderTopColor;};prototype.setBorderTopColor=function(borderTopColor){this.borderTopColor=borderTopColor;};prototype.getBorderBottomColor=function(){return this.borderBottomColor;};prototype.setBorderBottomColor=function(borderBottomColor){this.borderBottomColor=borderBottomColor;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParams=function(){return this.backgroundColorGradientParams;};prototype.setBackgroundColorGradientParams=function(backgroundColorGradientParams){this.backgroundColorGradientParams=backgroundColorGradientParams;};prototype.isVisible=function(){return this.visible;};prototype.setVisible=function(visible){this.visible=visible;};prototype.getFontSize=function(){return this.fontSize;};prototype.setFontSize=function(fontSize){this.fontSize=fontSize;};prototype.isBoldFont=function(){return this.boldFont;};prototype.setBoldFont=function(boldFont){this.boldFont=boldFont;};prototype.getFont=function(){return this.font;};prototype.setFont=function(font){this.font=font;};prototype.getFontStyle=function(){return this.fontStyle;};prototype.setFontStyle=function(fontStyle){this.fontStyle=fontStyle;};prototype.setAbsoluteLeft=function(absoluteLeft){this.leftAbsolute=absoluteLeft;this.leftRatio=null;};prototype.setAbsoluteTop=function(absoluteTop){this.topAbsolute=absoluteTop;this.topRatio=null;};prototype.setAbsoluteWidth=function(absoluteWidth){this.widthAbsolute=absoluteWidth;this.widthRatio=null;};prototype.setAbsoluteHeight=function(absoluteHeight){this.heightAbsolute=absoluteHeight;this.heightRatio=null;};prototype.setLeftRatio=function(leftRatio){this.leftAbsolute=null;this.leftRatio=leftRatio;};prototype.setTopRatio=function(topRatio){this.topAbsolute=null;this.topRatio=topRatio;};prototype.setWidthRatio=function(widthRatio){this.widthAbsolute=null;this.widthRatio=widthRatio;};prototype.setHeightRatio=function(heightRatio){this.heightAbsolute=null;this.heightRatio=heightRatio;};prototype.getLeft=function(fullWidth){if(this.leftAbsolute!=null){return this.leftAbsolute;}else if(this.leftRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.leftRatio*fullWidth));}else{return null;}};prototype.getTop=function(fullHeight){if(this.topAbsolute!=null){return this.topAbsolute;}else if(this.topRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.topRatio*fullHeight));}else{return null;}};prototype.getWidth=function(fullWidth){if(this.widthAbsolute!=null){return this.widthAbsolute;}else if(this.widthRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.widthRatio*fullWidth));}else{return null;}};prototype.getHeight=function(fullHeight){if(this.heightAbsolute!=null){return this.heightAbsolute;}else if(this.heightRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.heightRatio*fullHeight));}else{return null;}};prototype.setPaddingLeftAbsolute=function(paddingLeftAbsolute){this.paddingLeftAbsolute=paddingLeftAbsolute;this.paddingLeftRatio=null;};prototype.setPaddingRightAbsolute=function(paddingRightAbsolute){this.paddingRightAbsolute=paddingRightAbsolute;this.paddingRightRatio=null;};prototype.setPaddingTopAbsolute=function(paddingTopAbsolute){this.paddingTopAbsolute=paddingTopAbsolute;this.paddingTopRatio=null;};prototype.setPaddingBottomAbsolute=function(paddingBottomAbsolute){this.paddingBottomAbsolute=paddingBottomAbsolute;this.paddingBottomRatio=null;};prototype.setPaddingLeftRatio=function(paddingLeftRatio){this.paddingLeftAbsolute=null;this.paddingLeftRatio=paddingLeftRatio;};prototype.setPaddingRightRatio=function(paddingRightRatio){this.paddingRightAbsolute=null;this.paddingRightRatio=paddingRightRatio;};prototype.setPaddingTopRatio=function(paddingTopRatio){this.paddingTopAbsolute=null;this.paddingTopRatio=paddingTopRatio;};prototype.setPaddingBottomRatio=function(paddingBottomRatio){this.paddingBottomAbsolute=null;this.paddingBottomRatio=paddingBottomRatio;};prototype.getPaddingLeft=function(fullWidth){if(this.paddingLeftAbsolute!=null){return this.paddingLeftAbsolute;}else if(this.paddingLeftRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.paddingLeftRatio*fullWidth));}else{return null;}};prototype.getPaddingTop=function(fullHeight){if(this.paddingTopAbsolute!=null){return this.paddingTopAbsolute;}else if(this.paddingTopRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.paddingTopRatio*fullHeight));}else{return null;}};prototype.getPaddingRight=function(fullWidth){if(this.paddingRightAbsolute!=null){return this.paddingRightAbsolute;}else if(this.paddingRightRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.paddingRightRatio*fullWidth));}else{return null;}};prototype.getPaddingBottom=function(fullHeight){if(this.paddingBottomAbsolute!=null){return this.paddingBottomAbsolute;}else if(this.paddingBottomRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.paddingBottomRatio*fullHeight));}else{return null;}};prototype.setMarginLeftAbsolute=function(marginLeftAbsolute){this.marginLeftAbsolute=marginLeftAbsolute;this.marginLeftRatio=null;};prototype.setMarginRightAbsolute=function(marginRightAbsolute){this.marginRightAbsolute=marginRightAbsolute;this.marginRightRatio=null;};prototype.setMarginTopAbsolute=function(marginTopAbsolute){this.marginTopAbsolute=marginTopAbsolute;this.marginTopRatio=null;};prototype.setMarginBottomAbsolute=function(marginBottomAbsolute){this.marginBottomAbsolute=marginBottomAbsolute;this.marginBottomRatio=null;};prototype.setMarginLeftRatio=function(marginLeftRatio){this.marginLeftAbsolute=null;this.marginLeftRatio=marginLeftRatio;};prototype.setMarginRightRatio=function(marginRightRatio){this.marginRightAbsolute=null;this.marginRightRatio=marginRightRatio;};prototype.setMarginTopRatio=function(marginTopRatio){this.marginTopAbsolute=null;this.marginTopRatio=marginTopRatio;};prototype.setMarginBottomRatio=function(marginBottomRatio){this.marginBottomAbsolute=null;this.marginBottomRatio=marginBottomRatio;};prototype.getMarginLeft=function(fullWidth){if(this.marginLeftAbsolute!=null){return this.marginLeftAbsolute;}else if(this.marginLeftRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.marginLeftRatio*fullWidth));}else{return null;}};prototype.getMarginTop=function(fullHeight){if(this.marginTopAbsolute!=null){return this.marginTopAbsolute;}else if(this.marginTopRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.marginTopRatio*fullHeight));}else{return null;}};prototype.getMarginRight=function(fullWidth){if(this.marginRightAbsolute!=null){return this.marginRightAbsolute;}else if(this.marginRightRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.marginRightRatio*fullWidth));}else{return null;}};prototype.getMarginBottom=function(fullHeight){if(this.marginBottomAbsolute!=null){return this.marginBottomAbsolute;}else if(this.marginBottomRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.marginBottomRatio*fullHeight));}else{return null;}};},{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var AxisStyle=function(option){Style.call(this,option);};AxisStyle=stjs.extend(AxisStyle,Style,[],function(constructor,prototype){prototype.labelsHeight=0;prototype.tickWidth=0;prototype.axisTickLength=0;prototype.showAxisTicks=false;prototype.axisTicksColor=null;prototype.axisTicksColorGradientParam=null;prototype.showLabelHighlight=false;prototype.labelHighlightBold=false;prototype.labelHighlightColor=null;prototype.labelHighlightColorGradientParam=null;prototype.labelHighlightFormat=null;prototype.labelsWidth=0;prototype.labelHighlightTextColor=null;prototype.tickTextColor=null;prototype.getTickWidth=function(){return this.tickWidth;};prototype.setTickWidth=function(tickWidth){this.tickWidth=tickWidth;};prototype.getAxisTickLength=function(){return this.axisTickLength;};prototype.setAxisTickLength=function(axisTickLength){this.axisTickLength=axisTickLength;};prototype.isShowAxisTicks=function(){return this.showAxisTicks;};prototype.setShowAxisTicks=function(showAxisTicks){this.showAxisTicks=showAxisTicks;};prototype.getAxisTicksColor=function(){return this.axisTicksColor;};prototype.setAxisTicksColor=function(axisTicksColor){this.axisTicksColor=axisTicksColor;};prototype.getAxisTicksColorGradientParam=function(){return this.axisTicksColorGradientParam;};prototype.setAxisTicksColorGradientParam=function(axisTicksColorGradientParam){this.axisTicksColorGradientParam=axisTicksColorGradientParam;};prototype.getLabelHighlightTextColor=function(){return this.labelHighlightTextColor;};prototype.setLabelHighlightTextColor=function(labelHighlightTextColor){this.labelHighlightTextColor=labelHighlightTextColor;};prototype.getLabelsHeight=function(){return this.labelsHeight;};prototype.setLabelsHeight=function(labelsHeight){this.labelsHeight=labelsHeight;};prototype.isShowLabelHighlight=function(){return this.showLabelHighlight;};prototype.setShowLabelHighlight=function(showLabelHighlight){this.showLabelHighlight=showLabelHighlight;};prototype.getLabelHighlightColor=function(){return this.labelHighlightColor;};prototype.setLabelHighlightColor=function(labelHighlightColor){this.labelHighlightColor=labelHighlightColor;};prototype.getLabelHighlightColorGradientParam=function(){return this.labelHighlightColorGradientParam;};prototype.setLabelHighlightColorGradientParam=function(labelHighlightColorGradientParam){this.labelHighlightColorGradientParam=labelHighlightColorGradientParam;};prototype.getLabelHighlightFormat=function(){return this.labelHighlightFormat;};prototype.setLabelHighlightFormat=function(labelHighlightFormat){this.labelHighlightFormat=labelHighlightFormat;};prototype.isLabelHighlightBold=function(){return this.labelHighlightBold;};prototype.setLabelHighlightBold=function(labelHighlightBold){this.labelHighlightBold=labelHighlightBold;};prototype.getLabelsWidth=function(){return this.labelsWidth;};prototype.setLabelsWidth=function(labelsWidth){this.labelsWidth=labelsWidth;};prototype.getTickTextColor=function(){return this.tickTextColor;};prototype.setTickTextColor=function(tickTextColor){this.tickTextColor=tickTextColor;};},{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},labelHighlightTextColor:"ChartColor",tickTextColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DrawStyle=function(option){Style.call(this,option);};DrawStyle=stjs.extend(DrawStyle,Style,[],function(constructor,prototype){constructor.ID="drawStyleId";prototype.lineStyle=null;prototype.lineWidth=0.0;prototype.lineColor=null;prototype.getLineStyle=function(){return this.lineStyle;};prototype.setLineStyle=function(lineStyle){this.lineStyle=lineStyle;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getLineColor=function(){return this.lineColor;};prototype.setLineColor=function(lineColor){this.lineColor=lineColor;};},{lineColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var GlobalStyle=function(option){Style.call(this,option);};GlobalStyle=stjs.extend(GlobalStyle,Style,[],function(constructor,prototype){prototype.globalFontSize=0;prototype.labelFont=null;prototype.animateChart=false;prototype.animationTime=0.0;prototype.isAnimateChart=function(){return this.animateChart;};prototype.getAnimationTime=function(){return this.animationTime;};},{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var GraphStyle=function(option){Style.call(this,option);};GraphStyle=stjs.extend(GraphStyle,Style,[],function(constructor,prototype){constructor.NONE_GRID_STYLE="none";constructor.NORMAL_GRID_STYLE="normal";constructor.CLASSIC_GRID_STYLE="classic";constructor.DASHED_GRID_STYLE="dashed";constructor.HORIZONTAL_GRID_STYLE="horizontal";constructor.VERTICAL_GRID_STYLE="vertical";constructor.NO_HIGHLIGHT="none";constructor.CIRCLE_HIGHLIGHT="circle";constructor.LINES_HIGHLIGHT="lines";constructor.VERTICAL_LINE_HIGHLIGHT="vertical_line";constructor.HORIZONTAL_LINE_HIGHLIGHT="horizontal_line";constructor.INFO_HIGHLIGHT="info";constructor.COLOR_HIGHLIGHT="color";prototype.backgroundGridColor=null;prototype.backgroundGridColorGradientParams=null;prototype.backgroundGridStyle=null;prototype.backgroundGridLineWidth=0;prototype.barWidth=0;prototype.graphLineWidth=0;prototype.renderingRatio=0.0;prototype.halfSpacing=0;prototype.highlightType=null;prototype.highlightField=null;prototype.highlightLineWidth=0;prototype.highlightLineColor=null;prototype.highlightLineColorGradientParams=null;prototype.circleHighlightRadius=0;prototype.circleHighlightLineWidth=0;prototype.circleHighlightColor=null;prototype.circleHighlightColorGradientParams=null;prototype.copyrightFontSize=0;prototype.copyrightBold=false;prototype.copyrightColor=null;prototype.highlightBarMode=null;prototype.highlightBarWidth=0;prototype.highlightBarColor=null;prototype.highlightBarColorGradientParams=null;prototype.hoverBarMode=null;prototype.hoverBarWidth=0;prototype.hoverBarColor=null;prototype.hoverBarColorGradientParams=null;prototype.groupBarWidth=0;prototype.groupBarColor=null;prototype.groupBarColorGradientParams=null;prototype.areaContourColor=null;prototype.setHighlightType=function(highlightType){this.highlightType=highlightType;};prototype.getHighlightType=function(){return this.highlightType;};prototype.setRenderingRatio=function(ratio){this.renderingRatio=ratio;};prototype.getRenderingRatio=function(){return this.renderingRatio;};prototype.getBackgroundGridColor=function(){return this.backgroundGridColor;};prototype.setBackgroundGridColor=function(backgroundGridColor){this.backgroundGridColor=backgroundGridColor;};prototype.getBackgroundGridColorGradientParams=function(){return this.backgroundGridColorGradientParams;};prototype.setBackgroundGridColorGradientParams=function(backgroundGridColorGradientParams){this.backgroundGridColorGradientParams=backgroundGridColorGradientParams;};prototype.getBackgroundGridStyle=function(){return this.backgroundGridStyle;};prototype.setBackgroundGridStyle=function(backgroundGridStyle){this.backgroundGridStyle=backgroundGridStyle;};prototype.getBackgroundGridLineWidth=function(){return this.backgroundGridLineWidth;};prototype.setBackgroundGridLineWidth=function(backgroundGridLineWidth){this.backgroundGridLineWidth=backgroundGridLineWidth;};prototype.getGraphLineWidth=function(){return this.graphLineWidth;};prototype.setGraphLineWidth=function(graphLineWidth){this.graphLineWidth=graphLineWidth;};prototype.getHighlightLineWidth=function(){return this.highlightLineWidth;};prototype.setHighlightLineWidth=function(highlightLineWidth){this.highlightLineWidth=highlightLineWidth;};prototype.getHighlightLineColor=function(){return this.highlightLineColor;};prototype.setHighlightLineColor=function(highlightLineColor){this.highlightLineColor=highlightLineColor;};prototype.getHighlightLineColorGradientParams=function(){return this.highlightLineColorGradientParams;};prototype.setHighlightLineColorGradientParams=function(highlightLineColorGradientParams){this.highlightLineColorGradientParams=highlightLineColorGradientParams;};prototype.getCircleHighlightRadius=function(){return this.circleHighlightRadius;};prototype.setCircleHighlightRadius=function(circleHighlightRadius){this.circleHighlightRadius=circleHighlightRadius;};prototype.getCircleHighlightColor=function(){return this.circleHighlightColor;};prototype.setCircleHighlightColor=function(circleHighlightColor){this.circleHighlightColor=circleHighlightColor;};prototype.getCircleHighlightColorGradientParams=function(){return this.circleHighlightColorGradientParams;};prototype.setCircleHighlightColorGradientParams=function(circleHighlightColorGradientParams){this.circleHighlightColorGradientParams=circleHighlightColorGradientParams;};prototype.getCircleHighlightLineWidth=function(){return this.circleHighlightLineWidth;};prototype.setCircleHighlightLineWidth=function(circleHighlightLineWidth){this.circleHighlightLineWidth=circleHighlightLineWidth;};prototype.getBarWidth=function(){return this.barWidth;};prototype.setBarWidth=function(barWidth){this.barWidth=barWidth;};prototype.getCopyrightFontSize=function(){return this.copyrightFontSize;};prototype.setCopyrightFontSize=function(copyrightFontSize){this.copyrightFontSize=copyrightFontSize;};prototype.isCopyrightBold=function(){return this.copyrightBold;};prototype.setCopyrightBold=function(copyrightBold){this.copyrightBold=copyrightBold;};prototype.getCopyrightColor=function(){return this.copyrightColor;};prototype.setCopyrightColor=function(copyrightColor){this.copyrightColor=copyrightColor;};prototype.getHighlightBarMode=function(){return this.highlightBarMode;};prototype.setHighlightBarMode=function(highlightBarMode){this.highlightBarMode=highlightBarMode;};prototype.getHighlightBarWidth=function(){return this.highlightBarWidth;};prototype.setHighlightBarWidth=function(highlightBarWidth){this.highlightBarWidth=highlightBarWidth;};prototype.getHighlightBarColor=function(){return this.highlightBarColor;};prototype.setHighlightBarColor=function(highlightBarColor){this.highlightBarColor=highlightBarColor;};prototype.getHighlightBarColorGradientParams=function(){return this.highlightBarColorGradientParams;};prototype.setHighlightBarColorGradientParams=function(highlightBarColorGradientParams){this.highlightBarColorGradientParams=highlightBarColorGradientParams;};prototype.getHoverBarMode=function(){return this.hoverBarMode;};prototype.setHoverBarMode=function(hoverBarMode){this.hoverBarMode=hoverBarMode;};prototype.getHoverBarWidth=function(){return this.hoverBarWidth;};prototype.setHoverBarWidth=function(hoverBarWidth){this.hoverBarWidth=hoverBarWidth;};prototype.getHoverBarColor=function(){return this.hoverBarColor;};prototype.setHoverBarColor=function(hoverBarColor){this.hoverBarColor=hoverBarColor;};prototype.getHoverBarColorGradientParams=function(){return this.hoverBarColorGradientParams;};prototype.setHoverBarColorGradientParams=function(hoverBarColorGradientParams){this.hoverBarColorGradientParams=hoverBarColorGradientParams;};prototype.getHalfSpacing=function(){return this.halfSpacing;};prototype.setHalfSpacing=function(halfSpacing){this.halfSpacing=halfSpacing;};prototype.getHighlightField=function(){return this.highlightField;};prototype.setHighlightField=function(highlightField){this.highlightField=highlightField;};prototype.getGroupBarWidth=function(){return this.groupBarWidth;};prototype.setGroupBarWidth=function(groupBarWidth){this.groupBarWidth=groupBarWidth;};prototype.getGroupBarColor=function(){return this.groupBarColor;};prototype.setGroupBarColor=function(groupBarColor){this.groupBarColor=groupBarColor;};prototype.getGroupBarColorGradientParams=function(){return this.groupBarColorGradientParams;};prototype.setGroupBarColorGradientParams=function(groupBarColorGradientParams){this.groupBarColorGradientParams=groupBarColorGradientParams;};prototype.getAreaContourColor=function(){return this.areaContourColor;};prototype.setAreaContourColor=function(areaContourColor){this.areaContourColor=areaContourColor;};},{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var LegendStyle=function(option){Style.call(this,option);};LegendStyle=stjs.extend(LegendStyle,Style,[],function(constructor,prototype){prototype.columnsRelativeWidth=null;prototype.labelsHeight=0;prototype.headerBackgroundColor=null;prototype.headerBackgroundColorGradientParam=null;prototype.evenColumnsColor=null;prototype.oddColumnsColor=null;prototype.evenColumnsColorGradientParam=null;prototype.oddColumnsColorGradientParam=null;prototype.getColumnsRelativeWidth=function(){return this.columnsRelativeWidth;};prototype.setColumnsRelativeWidth=function(columnsRelativeWidth){this.columnsRelativeWidth=columnsRelativeWidth;};prototype.getLabelsHeight=function(){return this.labelsHeight;};prototype.setLabelsHeight=function(labelsHeight){this.labelsHeight=labelsHeight;};prototype.getHeaderBackgroundColor=function(){return this.headerBackgroundColor;};prototype.setHeaderBackgroundColor=function(headerBackgroundColor){this.headerBackgroundColor=headerBackgroundColor;};prototype.getHeaderBackgroundColorGradientParam=function(){return this.headerBackgroundColorGradientParam;};prototype.setHeaderBackgroundColorGradientParam=function(headerBackgroundColorGradientParam){this.headerBackgroundColorGradientParam=headerBackgroundColorGradientParam;};prototype.getEvenColumnsColor=function(){return this.evenColumnsColor;};prototype.getOddColumnsColor=function(){return this.oddColumnsColor;};prototype.getEvenColumnsColorGradientParam=function(){return this.evenColumnsColorGradientParam;};prototype.getOddColumnsColorGradientParam=function(){return this.oddColumnsColorGradientParam;};prototype.setEvenColumnsColor=function(evenColumnsColor){this.evenColumnsColor=evenColumnsColor;};prototype.setOddColumnsColor=function(oddColumnsColor){this.oddColumnsColor=oddColumnsColor;};prototype.setEvenColumnsColorGradientParam=function(evenColumnsColorGradientParam){this.evenColumnsColorGradientParam=evenColumnsColorGradientParam;};prototype.setOddColumnsColorGradientParam=function(oddColumnsColorGradientParam){this.oddColumnsColorGradientParam=oddColumnsColorGradientParam;};},{columnsRelativeWidth:{name:"Array",arguments:[null]},headerBackgroundColor:"ChartColor",headerBackgroundColorGradientParam:{name:"Array",arguments:[null]},evenColumnsColor:"ChartColor",oddColumnsColor:"ChartColor",evenColumnsColorGradientParam:{name:"Array",arguments:[null]},oddColumnsColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var TitleStyle=function(option){Style.call(this,option);};TitleStyle=stjs.extend(TitleStyle,Style,[],function(constructor,prototype){constructor.HIDE_VALUES="showNoValue";constructor.SHOW_MAIN_VALUE="showMainValue";constructor.SHOW_VALUE_VOLUME="showValueVolume";prototype.titleFontSize=0;prototype.copyrightFontSize=0;prototype.valueFontSize=0;prototype.zoomIconSize=0;prototype.titleBold=false;prototype.copyrightBold=false;prototype.valueBold=false;prototype.popoverAllowed=false;prototype.titleColor=null;prototype.copyrightColor=null;prototype.valueColor=null;prototype.type=null;prototype.iconType=null;prototype.getTitleFontSize=function(){return this.titleFontSize;};prototype.setTitleFontSize=function(titleFontSize){this.titleFontSize=titleFontSize;};prototype.getCopyrightFontSize=function(){return this.copyrightFontSize;};prototype.setCopyrightFontSize=function(copyrightFontSize){this.copyrightFontSize=copyrightFontSize;};prototype.getValueFontSize=function(){return this.valueFontSize;};prototype.setValueFontSize=function(valueFontSize){this.valueFontSize=valueFontSize;};prototype.getTitleColor=function(){return this.titleColor;};prototype.setTitleColor=function(titleColor){this.titleColor=titleColor;};prototype.getCopyrightColor=function(){return this.copyrightColor;};prototype.setCopyrightColor=function(copyrightColor){this.copyrightColor=copyrightColor;};prototype.getValueColor=function(){return this.valueColor;};prototype.setValueColor=function(valueColor){this.valueColor=valueColor;};prototype.isTitleBold=function(){return this.titleBold;};prototype.setTitleBold=function(titleBold){this.titleBold=titleBold;};prototype.isCopyrightBold=function(){return this.copyrightBold;};prototype.setCopyrightBold=function(copyrightBold){this.copyrightBold=copyrightBold;};prototype.isValueBold=function(){return this.valueBold;};prototype.setValueBold=function(valueBold){this.valueBold=valueBold;};prototype.getZoomIconSize=function(){return this.zoomIconSize;};prototype.setZoomIconSize=function(zoomIconSize){this.zoomIconSize=zoomIconSize;};prototype.isPopoverAllowed=function(){return this.popoverAllowed;};prototype.setPopoverAllowed=function(popoverAllowed){this.popoverAllowed=popoverAllowed;};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.getIconType=function(){return this.iconType;};prototype.setIconType=function(iconType){this.iconType=iconType;};},{titleColor:"ChartColor",copyrightColor:"ChartColor",valueColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var ToolTipStyle=function(){Style.call(this,null);this.valueStyle={};this.nameStyle={};};ToolTipStyle=stjs.extend(ToolTipStyle,Style,[],function(constructor,prototype){prototype.valueStyle=null;prototype.nameStyle=null;prototype.customElementStyle=function(data){};prototype.customeHeaderStyle=function(header){};prototype.getValueStyle=function(){return this.valueStyle;};prototype.setValueStyle=function(valueStyle){this.valueStyle=valueStyle;};prototype.getNameStyle=function(){return this.nameStyle;};prototype.setNameStyle=function(nameStyle){this.nameStyle=nameStyle;};},{valueStyle:{name:"Map",arguments:[null,"Object"]},nameStyle:{name:"Map",arguments:[null,"Object"]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultDrawStyle=function(option){DrawStyle.call(this,option);this.lineStyle="solid";this.lineWidth=1.0;this.lineColor=ChartColor.black;this.textColor=ChartColor.black;this.fontSize=12;};DefaultDrawStyle=stjs.extend(DefaultDrawStyle,DrawStyle,[],null,{lineColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultXAxisStyle=function(options){AxisStyle.call(this,options);this.tickWidth=0;this.axisTickLength=0;this.showAxisTicks=options.isShowXAxisTicks();this.axisTicksColor=options.getXAxisTicksColor();this.axisTicksColorGradientParam=null;this.fontSize=options.getNormalLabelFontSize();this.labelsHeight=this.fontSize;this.boldFont=false;this.font=options.getLabelFont();this.visible=options.getXAxisPosition()!=Layout.Position.NONE;this.labelHighlightFormat=options.getXHighlightLabelFormat();this.labelHighlightColor=options.getLabelHighlightColor();this.labelHighlightTextColor=options.getLabelHighlightTextColor();this.tickTextColor=options.getTickTextColor();this.showLabelHighlight=true;this.labelHighlightBold=true;this.position=options.getXAxisPosition();var paddingTop=stjs.trunc(Math.round(DefaultLayout.DEFAULT_PADDING_PIXELS/2.0));this.setPaddingTopAbsolute(paddingTop);this.setPaddingBottomAbsolute((2*DefaultLayout.DEFAULT_PADDING_PIXELS)-paddingTop);};DefaultXAxisStyle=stjs.extend(DefaultXAxisStyle,AxisStyle,[],null,{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},labelHighlightTextColor:"ChartColor",tickTextColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultYAxisStyle=function(options){AxisStyle.call(this,options);this.tickWidth=1;this.axisTickLength=3;this.showAxisTicks=options.isShowYAxisTicks();this.axisTicksColor=options.getYAxisTicksColor();this.axisTicksColorGradientParam=null;this.fontSize=options.getNormalLabelFontSize();this.labelsHeight=this.fontSize+2;this.boldFont=false;this.font=options.getLabelFont();this.labelHighlightColor=options.getLabelHighlightColor();this.labelHighlightTextColor=options.getLabelHighlightTextColor();this.tickTextColor=options.getTickTextColor();this.showLabelHighlight=true;this.labelHighlightBold=true;this.position=options.getY1AxisPosition();};DefaultYAxisStyle=stjs.extend(DefaultYAxisStyle,AxisStyle,[],null,{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},labelHighlightTextColor:"ChartColor",tickTextColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultGlobalStyle=function(options){GlobalStyle.call(this,options);this.animateChart=options.isAddYesterday();this.animationTime=options.getAnimationTime();this.setMarginLeftRatio(options.getChartMarginLeftPercent()/100.0);this.setMarginRightRatio(options.getChartMarginRightPercent()/100.0);this.setMarginTopRatio(options.getChartMarginTopPercent()/100.0);this.setMarginBottomRatio(options.getChartMarginBottomPercent()/100.0);};DefaultGlobalStyle=stjs.extend(DefaultGlobalStyle,GlobalStyle,[],function(constructor,prototype){prototype.DEFAULT_WIDTH=400;prototype.DEFAULT_HEIGHT=400;prototype.MINIMUM_WIDTH=100;prototype.MINIMUM_HEIGHT=100;prototype.MINIMUM_WIDTH_FOR_NORMAL_FONT=360;prototype.MINIMUM_HEIGHT_FOR_NORMAL_FONT=200;prototype.BIG_FONT_SIZE=13;prototype.NORMAL_FONT_SIZE=12;prototype.SMALL_FONT_SIZE=11;},{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultLegendStyle=function(options){LegendStyle.call(this,options);this.visible=options.isShowLegend();this.fontSize=options.getNormalLabelFontSize();this.labelsHeight=this.fontSize+DefaultLayout.DEFAULT_PADDING_PIXELS;this.boldFont=false;this.font=options.getLabelFont();this.columnsRelativeWidth=options.getColumnsRelativeWidth();this.headerBackgroundColor=ChartColor.greyBackground;this.oddColumnsColor=ChartColor.lightYellow;this.setPaddingTopAbsolute(2*DefaultLayout.DEFAULT_PADDING_PIXELS);this.setPaddingBottomAbsolute(0);this.setAbsoluteHeight(4*this.labelsHeight);};DefaultLegendStyle=stjs.extend(DefaultLegendStyle,LegendStyle,[],null,{columnsRelativeWidth:{name:"Array",arguments:[null]},headerBackgroundColor:"ChartColor",headerBackgroundColorGradientParam:{name:"Array",arguments:[null]},evenColumnsColor:"ChartColor",oddColumnsColor:"ChartColor",evenColumnsColorGradientParam:{name:"Array",arguments:[null]},oddColumnsColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultTitleStyle=function(options){TitleStyle.call(this,options);this.titleFontSize=16;this.valueFontSize=options.getBigLabelFontSize();this.copyrightFontSize=11;this.titleColor=options.getTitleColor();this.copyrightColor=options.getCopyrightColor()!=null?options.getCopyrightColor():ChartColor.black;this.valueColor=options.getTitleColor();this.titleBold=true;this.valueBold=true;this.copyrightBold=false;this.zoomIconSize=options.getZoomIconSize();this.popoverAllowed=options.isPopOverAllowed();this.position=Layout.Position.TOP;this.visible=options.isShowTitle()||options.isShowCopyright();this.type=options.getTitleType();if(this.type==null){this.type=TitleStyle.SHOW_MAIN_VALUE;}};DefaultTitleStyle=stjs.extend(DefaultTitleStyle,TitleStyle,[],null,{titleColor:"ChartColor",copyrightColor:"ChartColor",valueColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultToolTipStyle=function(options){ToolTipStyle.call(this);this.style["fontColor"]=ChartColor.black;this.nameStyle["fontStyle"]="bold";this.backgroundColor=ChartColor.white;};DefaultToolTipStyle=stjs.extend(DefaultToolTipStyle,ToolTipStyle,[],function(constructor,prototype){prototype.customElementStyle=function(data){};prototype.customeHeaderStyle=function(header){};},{valueStyle:{name:"Map",arguments:[null,"Object"]},nameStyle:{name:"Map",arguments:[null,"Object"]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultGraphStyle=function(options){GraphStyle.call(this,options);this.backgroundGridColor=options.getGridColor();this.backgroundGridColorGradientParams=options.getGridColorGradientParams();this.backgroundGridStyle=options.getGridStyle();if(this.backgroundGridColor==null){this.backgroundGridColor=ChartColor.grey;}
if(this.backgroundGridStyle==null){this.backgroundGridStyle=GraphStyle.CLASSIC_GRID_STYLE;}
this.areaContourColor=options.getAreaContourColor();this.barWidth=2;this.backgroundGridLineWidth=1;this.graphLineWidth=1;this.renderingRatio=1.0;this.highlightType=options.getHighlightType();if(this.highlightType==null){this.highlightType=GraphStyle.LINES_HIGHLIGHT+GraphStyle.COLOR_HIGHLIGHT;}
this.highlightLineWidth=1;this.highlightLineColor=options.getHighlightLineColor()!=null?options.getHighlightLineColor():ChartColor.black;this.copyrightFontSize=11;this.copyrightColor=options.getCopyrightColor()!=null?options.getCopyrightColor():ChartColor.black;this.copyrightBold=false;this.fontSize=options.getNormalLabelFontSize();this.boldFont=false;this.font=options.getLabelFont();this.setPaddingLeftRatio(options.getChartPaddingLeftPercent()/100.0);this.setPaddingRightRatio(options.getChartPaddingRightPercent()/100.0);this.setPaddingTopRatio(options.getChartPaddingTopPercent()/100.0);this.setPaddingBottomRatio(options.getChartPaddingBottomPercent()/100.0);this.borderLeft=options.getChartBorderLeft();this.borderRight=options.getChartBorderRight();this.borderTop=options.getChartBorderTop();this.borderBottom=options.getChartBorderBottom();};DefaultGraphStyle=stjs.extend(DefaultGraphStyle,GraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultAreaGraphStyle=function(options){DefaultGraphStyle.call(this,options);this.circleHighlightRadius=6;this.circleHighlightLineWidth=2;this.circleHighlightColor=ChartColor.orange;};DefaultAreaGraphStyle=stjs.extend(DefaultAreaGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultBarGraphStyle=function(options){DefaultGraphStyle.call(this,options);this.barWidth=2;this.circleHighlightRadius=6;this.circleHighlightLineWidth=2;this.circleHighlightColor=ChartColor.orange;this.highlightBarWidth=4;this.highlightBarColor=ChartColor.orange;this.highlightBarMode=sq.ChartElement.HIGHLIGHT.COLOR_FISH_EYE;this.hoverBarWidth=4;this.hoverBarColor=ChartColor.orange;this.hoverBarMode=sq.ChartElement.HOVER.COLOR_FISH_EYE;this.groupBarWidth=6;this.groupBarColor=ChartColor.orange;};DefaultBarGraphStyle=stjs.extend(DefaultBarGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultLineGraphStyle=function(options){DefaultGraphStyle.call(this,options);this.circleHighlightRadius=6;this.circleHighlightLineWidth=2;this.circleHighlightColor=ChartColor.orange;};DefaultLineGraphStyle=stjs.extend(DefaultLineGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultPointGraphStyle=function(options){DefaultGraphStyle.call(this,options);};DefaultPointGraphStyle=stjs.extend(DefaultPointGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var Point2D=function(x,y){this.x=x;this.y=y;};Point2D=stjs.extend(Point2D,null,[],function(constructor,prototype){prototype.x=null;prototype.y=null;prototype.distanceTo=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return Math.sqrt(diffX*diffX+diffY*diffY);}else{return Double.POSITIVE_INFINITY;}};prototype.distanceSquared=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return diffX*diffX+diffY*diffY;}else{return Double.POSITIVE_INFINITY;}};prototype.midpointWith=function(p2){if(p2==null){return new Point2D(this.x,this.y);}else{var midX=stjs.trunc(Math.round((this.x+p2.x)/2.0));var midY=stjs.trunc(Math.round((this.y+p2.y)/2.0));return new Point2D(midX,midY);}};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};prototype.getClone=function(){return new Point2D(this.x,this.y);};prototype.minus=function(p){return new Vector2D(this.x-p.x,this.y-p.y);};prototype.add=function(vector){if(vector!=null){return new Point2D(stjs.trunc(Math.round(this.x+vector.x)),stjs.trunc(Math.round(this.y+vector.y)));}else{return null;}};prototype.equals=function(obj){if(obj==null||!(stjs.isInstanceOf(obj.constructor,Point2D))){return false;}
var other=obj;return other.x==this.x&&other.y==this.y;};constructor.isPointBetween=function(pointInbetween,p1,p2){if(pointInbetween==null||p1==null||p2==null){return false;}
var xIsBetween=(pointInbetween.x>=p1.x&&pointInbetween.x<=p2.x)||(pointInbetween.x<=p1.x&&pointInbetween.x>=p2.x);var yIsBetween=(pointInbetween.y>=p1.y&&pointInbetween.y<=p2.y)||(pointInbetween.y<=p1.y&&pointInbetween.y>=p2.y);return xIsBetween&&yIsBetween;};constructor.distanceSquaredP1P2=function(p1X,p1Y,p2X,p2Y){var diffX=p1X-p2X;var diffY=p1Y-p2Y;return diffX*diffX+diffY*diffY;};},{},{});
var Point2Df=function(x,y){this.x=x;this.y=y;};Point2Df=stjs.extend(Point2Df,null,[],function(constructor,prototype){prototype.x=0.0;prototype.y=0.0;prototype.distanceTo=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return Math.sqrt(diffX*diffX+diffY*diffY);}else{return Double.POSITIVE_INFINITY;}};prototype.distanceSquared=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return diffX*diffX+diffY*diffY;}else{return Double.POSITIVE_INFINITY;}};prototype.midpointWith=function(p2){if(p2==null){return new Point2Df(this.x,this.y);}else{var midX=stjs.trunc(Math.round((this.x+p2.x)/2.0));var midY=stjs.trunc(Math.round((this.y+p2.y)/2.0));return new Point2Df(midX,midY);}};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};prototype.getClone=function(){return new Point2Df(this.x,this.y);};prototype.minus=function(p){return new Vector2D(this.x-p.x,this.y-p.y);};prototype.add=function(vector){if(vector!=null){return new Point2Df(Math.round(this.x+vector.x),Math.round(this.y+vector.y));}else{return null;}};prototype.equals=function(obj){if(obj==null||!(stjs.isInstanceOf(obj.constructor,Point2Df))){return false;}
var other=obj;return other.x==this.x&&other.y==this.y;};constructor.isPointBetween=function(pointInbetween,p1,p2){if(pointInbetween==null||p1==null||p2==null){return false;}
var xIsBetween=(pointInbetween.x>=p1.x&&pointInbetween.x<=p2.x)||(pointInbetween.x<=p1.x&&pointInbetween.x>=p2.x);var yIsBetween=(pointInbetween.y>=p1.y&&pointInbetween.y<=p2.y)||(pointInbetween.y<=p1.y&&pointInbetween.y>=p2.y);return xIsBetween&&yIsBetween;};},{},{});
var Vector2D=function(x,y){this.x=x;this.y=y;};Vector2D=stjs.extend(Vector2D,null,[],function(constructor,prototype){prototype.x=null;prototype.y=null;prototype.scalarMultiplication=function(scalar){return new Vector2D(this.x*scalar,this.y*scalar);};prototype.add=function(toAdd){if(toAdd!=null){return new Vector2D(this.x+toAdd.x,this.y+toAdd.y);}else{return null;}};prototype.dot=function(otherVector){if(otherVector!=null){return(this.x*otherVector.x)+(this.y*otherVector.y);}else{return null;}};prototype.normalize=function(){var currentLength=this.length();if(currentLength!=null){return new Vector2D(this.x/currentLength,this.y/currentLength);}else{return null;}};prototype.getOppositeVector=function(){return this.scalarMultiplication(-1.0);};prototype.minus=function(otherVector){if(otherVector!=null){return new Vector2D(this.x-otherVector.x,this.y-otherVector.y);}else{return null;}};prototype.length=function(){var factor=this.dot(this);if(factor!=null&&factor>0){return Math.sqrt(factor);}else{return null;}};prototype.magnitude=function(){return this.length();};prototype.equals=function(obj){if(obj==null||!(stjs.isInstanceOf(obj.constructor,Vector2D))){return false;}
var other=obj;return this.x==other.x&&this.y==other.y;};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};prototype.inverse=function(){return new Vector2D(-this.x,-this.y);};},{},{});
var Line2D=function(p1,p2){this.p1=p1.getClone();this.p2=p2.getClone();if(p1!=null&&p2!=null){this.n=p2.minus(p1).normalize();}};Line2D=stjs.extend(Line2D,null,[],function(constructor,prototype){prototype.p1=null;prototype.p2=null;prototype.n=null;prototype.dist=function(p){if(this.p1!=null&&this.p2!=null&&this.n!=null&&p!=null){return this.p1.minus(p).minus(this.n.scalarMultiplication(this.p1.minus(p).dot(this.n))).length();}else{return null;}};prototype.distFromSegment=function(p){if(this.p1!=null&&this.p2!=null&&p!=null){var segmentLengthSquared=this.p1.distanceSquared(this.p2);if(segmentLengthSquared==0){return p.distanceTo(this.p1);}
var t=((p.getX()-this.p1.getX())*(this.p2.getX()-this.p1.getX())+(p.getY()-this.p1.getY())*(this.p2.getY()-this.p1.getY()))/segmentLengthSquared;if(t<0){return p.distanceTo(this.p1);}
if(t>1){return p.distanceTo(this.p2);}
return this.dist(p);}else{return null;}};prototype.isOnLine=function(p1){return this.dist(p1)==0;};prototype.getIntersectionPoint=function(otherLine){if(otherLine==null||this.isParallel(otherLine)||this.n==null||otherLine.n==null){return null;}else{if(this.n.x!=0){var denominator=(this.n.x*otherLine.n.y)-(this.n.y*otherLine.n.x);var tmp1=(this.n.x*this.p1.y)+(this.n.y*otherLine.p1.x);var tmp2=(this.n.y*this.p1.x)+(this.n.x*otherLine.p1.y);var b=(tmp1-tmp2)/denominator;return otherLine.p1.add(otherLine.n.scalarMultiplication(b));}else{return otherLine.getIntersectionPoint(this);}}};prototype.isParallel=function(otherLine){if(otherLine!=null&&this.n!=null&&otherLine.n!=null){return this.n.equals(otherLine.n)||this.n.inverse().equals(otherLine.n);}else{return false;}};prototype.getP1=function(){return this.p1;};prototype.setP1=function(p1){this.p1=p1;};prototype.getP2=function(){return this.p2;};prototype.setP2=function(p2){this.p2=p2;};prototype.length=function(p2){this.p2=p2;};},{p1:"Point2D",p2:"Point2D",n:"Vector2D"},{});
var ArrayUtil=function(){};ArrayUtil=stjs.extend(ArrayUtil,null,[],function(constructor,prototype){constructor.SPECIAL_CHARACTERS="<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";constructor.TOLERANCE_PERCENT=1.0E-6;constructor.isSameArray=function(array1,array2){if(array1==null&&array2==null){return true;}else if(array1==null||array2==null||array1.length!=array2.length){return false;}else{var elementCount=array1.length;for(var i=0;i<elementCount;i++){if(array1[i]!=array2[i]){return false;}}
return true;}};constructor.isSimilarArray=function(array1,array2){var sameArray=ArrayUtil.isSameArray(array1,array2);if(sameArray){return true;}
var elementCount=array1.length;for(var i=0;i<elementCount;i++){var differencePercent=100*Math.abs(array1[i]-array2[i])/array1[i];if(differencePercent>ArrayUtil.TOLERANCE_PERCENT){return false;}}
return true;};constructor.containsSameObject=function(array,object){if(array==null||object==null||array.length<=0){return false;}else{var elementCount=array.length;for(var i=0;i<elementCount;i++){if(object.equals(array[i])){return true;}}
return false;}};constructor.getRangeSpan=function(range){if(!ArrayUtil.isValidRange(range)){return 0.0;}else{return Math.abs(range[1]-range[0]);}};constructor.isValidRange=function(range){if(range==null||range.length!=2||range[0]==null||range[1]==null||isNaN(range[0])||isNaN(range[1])){return false;}else{return true;}};constructor.sortFunction=function(a,b){if(a==null||b==null){return-1;}
if(ArrayUtil.startInSameCase(a,b)||ArrayUtil.startsWithSpecialCharacterOrNumber(a)&&ArrayUtil.startsWithSpecialCharacterOrNumber(b)){return ArrayUtil.naturalSortFunction(a,b);}else if(ArrayUtil.startsWithUppercase(a)){return-1;}else if(ArrayUtil.startsWithSpecialCharacterOrNumber(a)){return 1;}else if(ArrayUtil.startsWithSpecialCharacterOrNumber(b)){return-1;}
return 1;};constructor.naturalSortFunction=function(a,b){if(a>b){return 1;}
if(a<b){return-1;}
return 0;};constructor.startsWithUppercase=function(str){if(str!=null&&!ArrayUtil.startsWithSpecialCharacterOrNumber(str)){return str.charAt(0)==str.charAt(0).toUpperCase();}else{return false;}};constructor.startInSameCase=function(str1,str2){if(str1!=null&&str2!=null&&!ArrayUtil.startsWithSpecialCharacterOrNumber(str1)&&!ArrayUtil.startsWithSpecialCharacterOrNumber(str2)){return ArrayUtil.startsWithUppercase(str1)==ArrayUtil.startsWithUppercase(str2);}else{return false;}};constructor.startsWithSpecialCharacterOrNumber=function(str){if(str!=null){return ArrayUtil.SPECIAL_CHARACTERS.indexOf(str.charAt(0))>-1||str.charAt(0)>=0&&str.charAt(0)<=9;}else{return false;}};constructor.aplhabeticalArraySort=function(array){if(array!=null){array.sort(ArrayUtil.sortFunction);}};},{sortFunction:{name:"SortFunction",arguments:[null]}},{});
var ChartMessagesRepository=function(){this.messages={};this.messages["noPrice"]="No data found for this security";this.messages["compareWith"]="Compare with";this.messages["definePeriod"]="Define a period";this.messages["title"]="Title";this.messages["from"]="from";this.messages["to"]="to";this.messages["draw"]="Draw";this.messages["intraday"]="Intraday";this.messages["1week"]="One week";this.messages["1month"]="One month";this.messages["6months"]="Six months";this.messages["1year"]="One year";this.messages["maximum"]="Maximum";this.messages["noStock"]="- no stock -";this.messages["periodHigh"]="Period high";this.messages["periodLow"]="Period low";this.messages["periodChange"]="Change (%)";this.messages["YTDShort"]="YTD";this.messages["YTD"]="Year-to-date";this.messages["lang"]="en";this.messages["lang_short"]="e";this.messages["delete_confirm"]="Are you sure you want to delete";};ChartMessagesRepository=stjs.extend(ChartMessagesRepository,null,[],function(constructor,prototype){constructor.instance=null;prototype.messages=null;constructor.getInstance=function(){if(ChartMessagesRepository.instance==null){ChartMessagesRepository.instance=new ChartMessagesRepository();}
return ChartMessagesRepository.instance;};prototype.set=function(id,message){this.messages[id]=message;};prototype.get=function(id){return this.messages[id];};},{instance:"ChartMessagesRepository",messages:{name:"Map",arguments:[null,null]}},{});
var MathUtil=function(){};MathUtil=stjs.extend(MathUtil,null,[],function(constructor,prototype){constructor.EPSILON=1.0E-8;constructor.isPointInsideTriangle=function(point,p1,p2,p3){if(point==null||p1==null||p2==null||p3==null){return false;}
var b1=MathUtil.sign(point,p1,p2)<0;var b2=MathUtil.sign(point,p2,p3)<0;var b3=MathUtil.sign(point,p3,p1)<0;return((b1==b2)&&(b2==b3));};constructor.isPointInsideQuadri=function(point,p1,p2,p3,p4){if(point==null||p1==null||p2==null||p3==null||p4==null){return false;}
var b1=MathUtil.sign(point,p1,p2)<0;var b2=MathUtil.sign(point,p2,p3)<0;var b3=MathUtil.sign(point,p3,p4)<0;var b4=MathUtil.sign(point,p4,p1)<0;return((b1==b2)&&(b2==b3)&&(b3==b4));};constructor.sign=function(point,p1,p2){return(point.getX()-p1.getX())*(p2.getY()-p1.getY())-(p2.getX()-p1.getX())*(point.getY()-p1.getY());};constructor.setInsideComputationValues=function(points,constants,multiples){if(points==null||constants==null||multiples==null){return;}
var pointsCount=points.length;var pj=points[pointsCount-1];if(pj==null){return;}
for(var i=0;i<pointsCount;i++){var pi=points[i];if(pi==null){return;}
var denominator=pj.getY()-pi.getY();if(denominator==0){constants[i]=pi.getX();multiples[i]=0.0;}else{constants[i]=pi.getX()-(pi.getY()*pj.getX())/denominator+(pi.getY()*pi.getX())/denominator;multiples[i]=(pj.getX()-pi.getX())/denominator;}
pj=pi;}};constructor.isPointInPolygon=function(point,points){if(point==null||points==null){return false;}
var constants=[];var multiples=[];MathUtil.setInsideComputationValues(points,constants,multiples);if(constants==null||multiples==null||points.length!=constants.length||points.length!=multiples.length){return false;}
var pointsCount=points.length;var pj=points[pointsCount-1];var oddNodes=false;var x=point.getX();var y=point.getY();if(pj==null){return false;}
for(var i=0;i<pointsCount;i++){var pi=points[i];if(pi==null){return false;}
if(pi.getY()<y&&pj.getY()>=y||pj.getY()<y&&pi.getY()>=y){var tmp=(y*multiples[i]+constants[i]<x);oddNodes=oddNodes?!tmp:tmp;}
pj=pi;}
return oddNodes;};},{},{});
var StringUtil=function(){};StringUtil=stjs.extend(StringUtil,null,[],function(constructor,prototype){constructor.getCopyright=function(){return(String).fromCharCode(169)+" Swissquote";};},{},{});
var XMLUtil=function(){};XMLUtil=stjs.extend(XMLUtil,null,[],function(constructor,prototype){constructor.getValue=function(node,valueKey){if(node!=null&&valueKey!=null&&node.childNodes!=null){var childCount=node.childNodes.length;for(var i=0;i<childCount;i++){var currentNode=node.childNodes[i];if(currentNode!=null&&currentNode.nodeName==valueKey){return currentNode.textContent;}}}
return null;};constructor.getChildNodes=function(node,valueKey){if(node!=null&&valueKey!=null&&node.childNodes!=null){var childCount=node.childNodes.length;for(var i=0;i<childCount;i++){var currentNode=node.childNodes[i];if(currentNode!=null&&currentNode.nodeName==valueKey){return currentNode.childNodes;}}}
return null;};constructor.getNode=function(parentNode,valueKey){if(parentNode!=null&&valueKey!=null&&parentNode.childNodes!=null){var childCount=parentNode.childNodes.length;for(var i=0;i<childCount;i++){var currentNode=parentNode.childNodes[i];if(currentNode!=null&&currentNode.nodeName==valueKey){return currentNode;}}}
return null;};constructor.serializeXmlNode=function(xmlNode){if(typeof window.XMLSerializer!='undefined'){return(new window.XMLSerializer()).serializeToString(xmlNode);}else if(typeof xmlNode.xml!='undefined'){return xmlNode.xml;};return"";};constructor.getStringFromArray=function(name,list){var values="";for(var index in list){if(!(list).hasOwnProperty(index))
continue;var value=list[index];if(value!=null){values+=XMLUtil.createNodeString("item",String.valueOf(value));}else{values+="<item/>";}}
return XMLUtil.createNodeString(name,values);};constructor.createNodeString=function(nodeName,textContent){return"<"+nodeName+">"+textContent+"</"+nodeName+">";};},{},{});
var ChartColor=function(colorType,colorValues,colorStop){this.colorType=colorType;this.colorValues=colorValues;this.colorStop=colorStop;};ChartColor=stjs.extend(ChartColor,null,[],function(constructor,prototype){constructor.ColorType=stjs.enumeration("SIMPLE","LINEAR_GRADIENT","RADIAL_GRADIENT");constructor.transparent=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,0,0,0)"],null);constructor.black=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,0,0,1)"],null);constructor.lightOrange=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255,190,160,1)"],null);constructor.lightOrangeTransparent=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255,190,160,0.35)"],null);constructor.salmon=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 204, 153,1)"],null);constructor.lightYellow=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 255, 204,1)"],null);constructor.brown=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(204, 102, 51,1)"],null);constructor.kaki=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(140, 190, 40,1)"],null);constructor.lightRed=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(240, 216, 223,1)"],null);constructor.lightGreen=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(200, 240, 212,1)"],null);constructor.lightBlue=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(210, 220, 247,1)"],null);constructor.lightBlue2=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(56, 142, 240,1)"],null);constructor.red=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(235, 29, 37, 1)"],null);constructor.green=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 220, 0, 1)"],null);constructor.orange=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(253, 103, 50, 1)"],null);constructor.blue=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(30, 30, 230,1)"],null);constructor.white=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 255, 255, 1)"],null);constructor.cyan=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 255, 255, 1)"],null);constructor.yellow=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 255, 0, 1)"],null);constructor.redOld=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(230, 30, 30, 1)"],null);constructor.greenOld=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(30, 180, 30, 1)"],null);constructor.lightGrey=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(247, 247, 247, 1)"],null);constructor.lightGrey2=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(192, 192, 192, 1)"],null);constructor.darkGrey=new ChartColor(ChartColor.ColorType.SIMPLE,["#898989"],null);constructor.grey=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(217, 217, 217, 1)"],null);constructor.greyBackground=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(222, 222, 222, 1)"],null);constructor.redGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(235, 29, 37, 1)","rgba(252, 225, 225, 0.4)"],[1.0,0.0]);constructor.greenGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(0, 220, 0, 1)","rgba(235, 243, 222, 0.4)"],[1.0,0.0]);constructor.blueGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(0, 220, 0, 1)","rgba(235, 243, 222, 0.4)"],[1.0,0.0]);constructor.orangeGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(235, 29, 37, 1)","rgba(252, 225, 225, 0.4)"],[1.0,0.0]);constructor.blackGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(0, 0, 0, 1)","rgba(0, 0, 0, 0.4)"],[1.0,0.0]);constructor.LINE_SELECTED=ChartColor.blue;constructor.BG_UP=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(153, 255, 153,1)"],null);constructor.BG_DOWN=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 153, 153,1)"],null);constructor.GREEN_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,153,0,1)"],null);constructor.BLUE_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,0,255,1)"],null);constructor.RED_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255,0,0,1)"],null);constructor.GRAY_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(128,128,128,1)"],null);constructor.PURPLE=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(153, 51, 153,1)"],null);constructor.DARK_BLUE=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(51, 102, 153,1)"],null);constructor.LIGHT_ORANGE=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 120, 35,1)"],null);constructor.RED_MACD=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(204, 0, 0,1)"],null);constructor.MOMENTUM_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 102, 102,1)"],null);constructor.OBV_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 51, 0,1)"],null);constructor.RSI_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(204, 0, 204,1)"],null);constructor.STO_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 153, 153,1)"],null);constructor.RED_FULL=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 0, 0, 1)"],null);constructor.BLUE_SAR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 0, 204, 1)"],null);prototype.colorType=null;prototype.colorValues=null;prototype.colorStop=null;prototype.applyColor=function(context,gradientParams){this.applyColorToFillStyle(context,gradientParams);this.applyColorToStrokeStyle(context,gradientParams);};prototype.applyColorToFillStyle=function(context,gradientParams){if(this.colorType==ChartColor.ColorType.SIMPLE||gradientParams==null||gradientParams.length!=4){context.fillStyle=this.getFlatColor();}else if(this.colorType==ChartColor.ColorType.LINEAR_GRADIENT){var gradient=this.getLinearGradient(context,gradientParams);context.fillStyle=gradient;}else{var gradient=this.getRadialGradient(context,gradientParams);context.fillStyle=gradient;}};prototype.applyColorToStrokeStyle=function(context,gradientParams){if(this.colorType==ChartColor.ColorType.SIMPLE||gradientParams==null||gradientParams.length!=4){context.strokeStyle=this.getFlatColor();}else if(this.colorType==ChartColor.ColorType.LINEAR_GRADIENT){var gradient=this.getLinearGradient(context,gradientParams);context.strokeStyle=gradient;}else{var gradient=this.getRadialGradient(context,gradientParams);context.strokeStyle=gradient;}};prototype.getFlatColor=function(){return(this.colorValues!=null)?this.colorValues[0]:"black";};prototype.getLinearGradient=function(context,gradientParams){var gradient=context.createLinearGradient(gradientParams[0],gradientParams[1],gradientParams[2],gradientParams[3]);var stopCount=this.colorValues.length;for(var i=0;i<stopCount;i++){gradient.addColorStop(this.colorStop[i],this.colorValues[i]);}
return gradient;};prototype.getRadialGradient=function(context,gradientParams){var gradient=context.createRadialGradient(gradientParams[0],gradientParams[1],gradientParams[2],gradientParams[3],gradientParams[4],gradientParams[5]);var stopCount=this.colorValues.length;for(var i=0;i<stopCount;i++){gradient.addColorStop(this.colorStop[i],this.colorValues[i]);}
return gradient;};constructor.getColor=function(color){return new ChartColor(ChartColor.ColorType.SIMPLE,[color],null);};constructor.color2ChartColor=function(color){return new ChartColor(ChartColor.ColorType.SIMPLE,[color.getColor()],null);};prototype.toHex=function(){if(this.colorValues!=null&&this.colorValues[0]!=null){return new Color(this.colorValues[0]).getColor();}else{return null;}};prototype.isTransparent=function(){return new Color(this.colorValues[0]).getAlpha()==0;};prototype.getChartColorWithAlpha=function(alpha){var hexColor=this.toHex();hexColor=hexColor.replace("#","");var rgbaColorWithOpacity="rgba("+parseInt(hexColor.substring(0,2),16)+","+parseInt(hexColor.substring(2,4),16)+","+parseInt(hexColor.substring(4,6),16)+","+alpha+")";return new ChartColor(this.colorType,[rgbaColorWithOpacity],this.colorStop);};},{transparent:"ChartColor",black:"ChartColor",lightOrange:"ChartColor",lightOrangeTransparent:"ChartColor",salmon:"ChartColor",lightYellow:"ChartColor",brown:"ChartColor",kaki:"ChartColor",lightRed:"ChartColor",lightGreen:"ChartColor",lightBlue:"ChartColor",lightBlue2:"ChartColor",red:"ChartColor",green:"ChartColor",orange:"ChartColor",blue:"ChartColor",white:"ChartColor",cyan:"ChartColor",yellow:"ChartColor",redOld:"ChartColor",greenOld:"ChartColor",lightGrey:"ChartColor",lightGrey2:"ChartColor",darkGrey:"ChartColor",grey:"ChartColor",greyBackground:"ChartColor",redGradient:"ChartColor",greenGradient:"ChartColor",blueGradient:"ChartColor",orangeGradient:"ChartColor",blackGradient:"ChartColor",LINE_SELECTED:"ChartColor",BG_UP:"ChartColor",BG_DOWN:"ChartColor",GREEN_MAV:"ChartColor",BLUE_MAV:"ChartColor",RED_MAV:"ChartColor",GRAY_MAV:"ChartColor",PURPLE:"ChartColor",DARK_BLUE:"ChartColor",LIGHT_ORANGE:"ChartColor",RED_MACD:"ChartColor",MOMENTUM_COLOR:"ChartColor",OBV_COLOR:"ChartColor",RSI_COLOR:"ChartColor",STO_COLOR:"ChartColor",RED_FULL:"ChartColor",BLUE_SAR:"ChartColor",colorType:{name:"Enum",arguments:["ChartColor.ColorType"]},colorValues:{name:"Array",arguments:[null]},colorStop:{name:"Array",arguments:[null]}},{});
var Color=function(val){this.val=val;this.parse();};Color=stjs.extend(Color,null,[],function(constructor,prototype){constructor.TRANSPARENT="transparent";constructor.names={"aliceblue":"F0F8FF","antiquewhite":"FAEBD7","aqua":"0FF","aquamarine":"7FFFD4","azure":"F0FFFF","beige":"F5F5DC","bisque":"FFE4C4","black":"000","blanchedalmond":"FFEBCD","blue":"00F","blueviolet":"8A2BE2","brown":"A52A2A","burlywood":"DEB887","cadetblue":"5F9EA0","chartreuse":"7FFF00","chocolate":"D2691E","coral":"FF7F50","cornflowerblue":"6495ED","cornsilk":"FFF8DC","crimson":"DC143C","cyan":"0FF","darkblue":"00008B","darkcyan":"008B8B","darkgoldenrod":"B8860B","darkgray":"A9A9A9","darkgreen":"006400","darkkhaki":"BDB76B","darkmagenta":"8B008B","darkolivegreen":"556B2F","darkorange":"FF8C00","darkorchid":"9932CC","darkred":"8B0000","darksalmon":"E9967A","darkseagreen":"8FBC8F","darkslateblue":"483D8B","darkslategray":"2F4F4F","darkturquoise":"00CED1","darkviolet":"9400D3","deeppink":"FF1493","deepskyblue":"00BFFF","dimgray":"696969","dodgerblue":"1E90FF","firebrick":"B22222","floralwhite":"FFFAF0","forestgreen":"228B22","fuchsia":"F0F","gainsboro":"DCDCDC","ghostwhite":"F8F8FF","gold":"FFD700","goldenrod":"DAA520","gray":"808080","green":"008000","greenyellow":"ADFF2F","honeydew":"F0FFF0","hotpink":"FF69B4","indianred":"CD5C5C","indigo":"4B0082","ivory":"FFFFF0","khaki":"F0E68C","lavender":"E6E6FA","lavenderblush":"FFF0F5","lawngreen":"7CFC00","lemonchiffon":"FFFACD","lightblue":"ADD8E6","lightcoral":"F08080","lightcyan":"E0FFFF","lightgoldenrodyellow":"FAFAD2","lightgreen":"90EE90","lightgrey":"D3D3D3","lightpink":"FFB6C1","lightsalmon":"FFA07A","lightseagreen":"20B2AA","lightskyblue":"87CEFA","lightslategray":"789","lightsteelblue":"B0C4DE","lightyellow":"FFFFE0","lime":"0F0","limegreen":"32CD32","linen":"FAF0E6","magenta":"F0F","maroon":"800000","mediumauqamarine":"66CDAA","mediumblue":"0000CD","mediumorchid":"BA55D3","mediumpurple":"9370D8","mediumseagreen":"3CB371","mediumslateblue":"7B68EE","mediumspringgreen":"00FA9A","mediumturquoise":"48D1CC","mediumvioletred":"C71585","midnightblue":"191970","mintcream":"F5FFFA","mistyrose":"FFE4E1","moccasin":"FFE4B5","navajowhite":"FFDEAD","navy":"000080","oldlace":"FDF5E6","olive":"808000","olivedrab":"688E23","orange":"FFA500","orangered":"FF4500","orchid":"DA70D6","palegoldenrod":"EEE8AA","palegreen":"98FB98","paleturquoise":"AFEEEE","palevioletred":"D87093","papayawhip":"FFEFD5","peachpuff":"FFDAB9","peru":"CD853F","pink":"FFC0CB","plum":"DDA0DD","powderblue":"B0E0E6","purple":"800080","red":"F00","rosybrown":"BC8F8F","royalblue":"4169E1","saddlebrown":"8B4513","salmon":"FA8072","sandybrown":"F4A460","seagreen":"2E8B57","seashell":"FFF5EE","sienna":"A0522D","silver":"C0C0C0","skyblue":"87CEEB","slateblue":"6A5ACD","slategray":"708090","snow":"FFFAFA","springgreen":"00FF7F","steelblue":"4682B4","tan":"D2B48C","teal":"008080","thistle":"D8BFD8","tomato":"FF6347","turquoise":"40E0D0","violet":"EE82EE","wheat":"F5DEB3","white":"FFF","whitesmoke":"F5F5F5","yellow":"FF0","yellowgreen":"9ACD32"};prototype.val=null;prototype.color=null;prototype.alpha=1.0;prototype.rgbaRegExp="\\s*rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d+|\\d*\\.\\d+)\\s*\\)\\s*";prototype.parse=function(){if(this.val==null||this.val.length==0){return;}
var rgbaRE=new RegExp(this.rgbaRegExp);if(rgbaRE.test(this.val)){var m=rgbaRE.exec(this.val);this.alpha=parseFloat(m[4]);this.color=this.alpha==0?Color.TRANSPARENT:this.rgbToHex(m[1],m[2],m[3]);}else{var vLower=this.val.toLowerCase();var v=Color.names[vLower];if(v!=null&&v.length>0){this.color="#"+v;this.alpha=(Color.TRANSPARENT.equals(v)?0.0:1.0);}else{this.color=this.val;}}};prototype.rgbToHex=function(r,g,b){return"#"+this.componentToHex(r)+this.componentToHex(g)+this.componentToHex(b);};prototype.componentToHex=function(c){var res=parseInt(c);var hex=(res).toString(16);return hex.length==1?"0"+hex:hex;};prototype.getColor=function(){return this.color;};prototype.setColor=function(color){this.color=color;};prototype.getAlpha=function(){return this.alpha;};prototype.setAlpha=function(alpha){this.alpha=alpha;};constructor.isSameColorPoint=function(color1,color2){var res=false;if(color2==null){if(color1==null){res=true;}}else{var c=new Color(color2).getColor();if(c!=null){res=c.equals(color1);}}
return res;};},{names:{name:"Map",arguments:[null,null]}},{});
var Frequency=function(type,value,name){this.type=type;this.value=value;this.name=name;this.intraday=Frequency.isTypeIntraday(type);if(Frequency.instances==null){Frequency.instances={};}
name=name!=null?name.toLowerCase():null;Frequency.instances[name]=this;};Frequency=stjs.extend(Frequency,null,[],function(constructor,prototype){constructor.Type=stjs.enumeration("LIVE","SECOND","MINUTE","HOUR","DAY","WEEK","MONTH","YEAR");constructor.isTypeIntraday=function(type){switch(type){case Frequency.Type.LIVE:case Frequency.Type.SECOND:case Frequency.Type.MINUTE:case Frequency.Type.HOUR:return true;case Frequency.Type.DAY:case Frequency.Type.WEEK:case Frequency.Type.MONTH:case Frequency.Type.YEAR:default:return false;}};constructor.typeToString=function(type){return type.toString().toLowerCase();};constructor.getTypeInString=function(str){if(str==null){return null;}
str=str.toLowerCase();var typeArray=(Frequency.Type.values());var typeCount=typeArray.length;for(var i=0;i<typeCount;i++){if(str.indexOf(typeArray[i].toString().toLowerCase())!=-1){return typeArray[i];}}
return null;};constructor.instances=null;constructor.DAY=new Frequency(Frequency.Type.DAY,1,"daily");constructor.WEEK=new Frequency(Frequency.Type.WEEK,1,"weekly");constructor.MONTH=new Frequency(Frequency.Type.MONTH,1,"monthly");constructor.QUARTER=new Frequency(Frequency.Type.MONTH,3,"quarterly");constructor.SEMESTER=new Frequency(Frequency.Type.MONTH,6,"semesterly");constructor.YEAR=new Frequency(Frequency.Type.YEAR,1,"yearly");constructor.HOUR=new Frequency(Frequency.Type.HOUR,1,"60minute");constructor.TWO_HOUR=new Frequency(Frequency.Type.HOUR,2,"120minute");constructor.MINUTE=new Frequency(Frequency.Type.MINUTE,1,"1minute");constructor.FIVE_MINUTE=new Frequency(Frequency.Type.MINUTE,5,"5minute");constructor.FIFTEEN_MINUTE=new Frequency(Frequency.Type.MINUTE,15,"15minute");constructor.SECOND=new Frequency(Frequency.Type.SECOND,1,"second");constructor.FIVE_SECOND=new Frequency(Frequency.Type.SECOND,5,"5second");constructor.FIFTEEN_SECOND=new Frequency(Frequency.Type.SECOND,15,"15second");constructor.THIRTY_SECOND=new Frequency(Frequency.Type.SECOND,30,"30second");constructor.LIVE=new Frequency(Frequency.Type.LIVE,-1,"live");constructor.ALL=new Frequency(Frequency.Type.LIVE,-1,"all");prototype.type=null;prototype.value=0;prototype.name=null;prototype.intraday=false;prototype.isIntraday=function(){return this.intraday;};prototype.getType=function(){return this.type;};prototype.getValue=function(){return this.value;};prototype.getTimeValue=function(){var typeValue=0;switch(this.type){case Frequency.Type.LIVE:return-1;case Frequency.Type.SECOND:typeValue=DateUtil.MS_SECOND;break;case Frequency.Type.MINUTE:typeValue=DateUtil.MS_MINUTE;break;case Frequency.Type.HOUR:typeValue=DateUtil.MS_HOUR;break;case Frequency.Type.DAY:typeValue=DateUtil.MS_DAY_24H;break;case Frequency.Type.WEEK:typeValue=DateUtil.MS_WEEK;break;case Frequency.Type.MONTH:typeValue=DateUtil.MS_MONTH;break;case Frequency.Type.YEAR:typeValue=DateUtil.MS_YEAR;break;default:typeValue=DateUtil.MS_DAY_24H;}
return this.value*typeValue;};prototype.getName=function(){return this.name;};prototype.toString=function(){return this.name;};prototype.isRegularFrequency=function(){return this.type!=Frequency.Type.LIVE;};prototype.isLive=function(){return this.type==Frequency.Type.LIVE;};constructor.getInstance=function(freq){if(freq==null){return null;}
freq=freq.toLowerCase();var f=Frequency.instances[freq];if(f!=null){return f;}
var lastS=freq.lastIndexOf("s");if(lastS>0&&lastS==freq.length-1){freq=freq.substring(0,lastS);f=Frequency.instances[freq];if(f!=null){return f;}}
var value=parseInt(freq);if(isNaN(value)||value<=0){value=1;}
var type=Frequency.getTypeInString(freq);if(type!=null&&!isNaN(value)){if(type==Frequency.Type.HOUR&&value==1){return Frequency.HOUR;}else if(type==Frequency.Type.HOUR&&value==2){return Frequency.TWO_HOUR;}else if(type==Frequency.Type.DAY&&value==1){return Frequency.DAY;}else if(type==Frequency.Type.WEEK&&value==1){return Frequency.WEEK;}else if(type==Frequency.Type.MONTH&&value==1){return Frequency.MONTH;}else if(type==Frequency.Type.MONTH&&value==3){return Frequency.QUARTER;}else if(type==Frequency.Type.MONTH&&value==6){return Frequency.SEMESTER;}else if(type==Frequency.Type.YEAR&&value==1){return Frequency.YEAR;}else{return new Frequency(type,value,freq);}}
return null;};constructor.minutesSince=function(startXValue,xValue){if(startXValue==null||xValue==null||isNaN(startXValue)||isNaN(xValue)){return null;}
return(xValue-startXValue)/DateUtil.MS_MINUTE;};constructor.extractFrequency=function(serie,defaultFreq){var frequency=defaultFreq;var period=Period.extractPeriod(serie);if(period!=null){if(period.getFrequency()!=null){frequency=period.isLive()?defaultFreq:period.getFrequency();}}
return frequency;};},{instances:{name:"Map",arguments:[null,"Frequency"]},DAY:"Frequency",WEEK:"Frequency",MONTH:"Frequency",QUARTER:"Frequency",SEMESTER:"Frequency",YEAR:"Frequency",HOUR:"Frequency",TWO_HOUR:"Frequency",MINUTE:"Frequency",FIVE_MINUTE:"Frequency",FIFTEEN_MINUTE:"Frequency",SECOND:"Frequency",FIVE_SECOND:"Frequency",FIFTEEN_SECOND:"Frequency",THIRTY_SECOND:"Frequency",LIVE:"Frequency",ALL:"Frequency",type:{name:"Enum",arguments:["Frequency.Type"]}},{});
var Period=function(type,value,frequency){this.type=type;this.value=value;this.frequency=frequency;this.timeOffset=0;this.periodDates=null;if(type==null&&(frequency==null||!frequency.isIntraday())){this.type=Period.Type.MAXIMUM;}
if(frequency==null){if(this.type==Period.Type.LIVE||(this.type==Period.Type.DAY&&value==1)){this.frequency=Frequency.HOUR;}else{this.frequency=Frequency.DAY;}}
this.openPeriods=[];};Period=stjs.extend(Period,null,[],function(constructor,prototype){constructor.MAX_INTRADAY_DAYS=6;constructor.Type=stjs.enumeration("MAXIMUM","YEAR","MONTH","WEEK","DAY","LIVE");constructor.typeToRequestParameterString=function(type){switch(type){case Period.Type.MAXIMUM:return"a";case Period.Type.YEAR:return"y";case Period.Type.MONTH:return"m";case Period.Type.WEEK:return"w";case Period.Type.DAY:return"days";default:return"a";}};constructor.typeToTimeValue=function(type){switch(type){case Period.Type.MAXIMUM:return null;case Period.Type.YEAR:return DateUtil.MS_YEAR;case Period.Type.MONTH:return DateUtil.MS_MONTH;case Period.Type.WEEK:return DateUtil.MS_WEEK;case Period.Type.DAY:return DateUtil.MS_DAY_24H;default:return null;}};constructor.typeToString=function(type){if(type==null){return Period.Type.MAXIMUM.toString().toLowerCase();}
return type.toString().toLowerCase();};constructor.getTypeInString=function(str){if(str==null){return null;}
str=str.toLowerCase();var typeArray=(Period.Type.values());var typeCount=typeArray.length;for(var i=0;i<typeCount;i++){if(str.indexOf((typeArray[i].toString().toLowerCase()))!=-1){return typeArray[i];}}
return null;};constructor.HISTO="histo";constructor.INTRADAY="intraday";constructor.HISTO_DEFAULT=new Period(Period.Type.MAXIMUM,1,Frequency.DAY);constructor.INTRADAY_DEFAULT=new Period(Period.Type.DAY,1,Frequency.LIVE);prototype.type=null;prototype.value=0;prototype.frequency=null;prototype.from=null;prototype.to=null;prototype.forcedFrom=null;prototype.forcedTo=null;prototype.periodDates=null;prototype.openPeriods=null;prototype.timeOffset=0;prototype.isIntraday=function(){return(this.type==Period.Type.LIVE||this.type==Period.Type.DAY)&&this.frequency.isIntraday();};prototype.getForcedFrom=function(){return DateUtil.cloneDate(this.forcedFrom);};prototype.getType=function(){return this.type;};prototype.getValue=function(){return this.value;};prototype.getFrequency=function(){return this.frequency;};prototype.spanSeveralDays=function(){if(this.isIntraday()){if(this.openPeriods!=null&&this.openPeriods.length>0){return!DateUtil.isSameDay(this.from,this.to);}
return this.type!=Period.Type.DAY||this.value>1;}
return true;};prototype.setOpenPeriods=function(periodDates){this.periodDates=periodDates;this.openPeriods=[];this.from=null;this.to=null;if(periodDates==null){return;}
this.openPeriods=[];var openPeriodList=(periodDates).split(",");var openPeriodCount=openPeriodList.length;for(var i=0;i<openPeriodCount;i++){var openPeriodArray=(openPeriodList[i]).split("-");if(openPeriodArray.length==2){var currentFrom=new Date(parseInt(openPeriodArray[0])*DateUtil.MS_SECOND+this.timeOffset);var currentTo=new Date(parseInt(openPeriodArray[1])*DateUtil.MS_SECOND+this.timeOffset);if(this.forcedFrom==null||this.forcedTo==null||(currentFrom.getTime()<this.forcedTo.getTime()&&currentTo.getTime()>this.forcedFrom.getTime())){if(this.forcedFrom!=null&&currentFrom.getTime()<this.forcedFrom.getTime()){currentFrom=DateUtil.cloneDate(this.forcedFrom);}
if(this.forcedTo!=null&&currentTo.getTime()<this.forcedTo.getTime()){currentTo=DateUtil.cloneDate(this.forcedTo);}
if(currentFrom.getTime()<currentTo.getTime()){var openPeriod=[currentFrom,currentTo];this.openPeriods.push(openPeriod);}}}}
var sortFunc=function(a,b){return stjs.trunc((a[0].getTime()-b[0].getTime()));};this.openPeriods.sort(sortFunc);this.from=this.forcedFrom==null?this.openPeriods[0][0]:this.forcedFrom;var lastOpenPeriod=this.openPeriods.length-1;this.to=this.forcedTo==null?this.openPeriods[lastOpenPeriod][1]:this.forcedTo;};prototype.completeIntradayOpenPeriods=function(){var openPeriodsCount=this.openPeriods!=null?this.openPeriods.length:0;var refStart=this.openPeriods!=null?this.openPeriods[0]:null;if(this.isIntraday()&&openPeriodsCount>0&&this.value>openPeriodsCount&&refStart!=null&&refStart[0]!=null&&refStart[1]!=null){var daysToAdd=this.value-openPeriodsCount;var previousPeriods=[];for(var i=daysToAdd;i>=1;i--){var periodToAdd=[DateUtil.createDate(refStart[0].getTime()-(i*DateUtil.MS_DAY_24H)),DateUtil.createDate(refStart[1].getTime()-(i*DateUtil.MS_DAY_24H))];previousPeriods.push(periodToAdd);}
this.openPeriods=previousPeriods.concat(this.openPeriods);this.from=this.forcedFrom==null?this.openPeriods[0][0]:this.forcedFrom;var lastOpenPeriod=this.openPeriods.length-1;this.to=this.forcedTo==null?this.openPeriods[lastOpenPeriod][1]:this.forcedTo;}};prototype.getFrom=function(){return DateUtil.cloneDate(this.from);};prototype.getTo=function(){return DateUtil.cloneDate(this.to);};prototype.setTimeOffset=function(timeOffset){if(this.timeOffset!=timeOffset){this.timeOffset=timeOffset;this.setOpenPeriods(this.periodDates);}};prototype.getId=function(){var str="";if(this.frequency.isIntraday()){str=Period.INTRADAY;}else{str=Period.HISTO;}
str+=this.toString();str+="_"+this.frequency.toString();return str;};prototype.toString=function(){var typeString=Period.typeToString(this.type);if(this.forcedFrom!=null&&this.forcedTo!=null){return this.forcedFrom.getTime()+"-"+this.forcedTo.getTime();}else if(this.type==null||this.type==Period.Type.MAXIMUM||this.type==Period.Type.LIVE){return typeString;}else{if(this.value>1){typeString+="s";}
return String.valueOf(this.value)+typeString;}};prototype.hasOpenPeriods=function(){return this.openPeriods!=null&&this.openPeriods.length>0;};prototype.getOpenPeriods=function(){if(this.openPeriods==null){return null;}
var openPeriodsCount=this.openPeriods.length;var clonedOpenPeriods=[];for(var i=0;i<openPeriodsCount;i++){clonedOpenPeriods.push(Period.cloneOpenPeriod(this.openPeriods[i]));}
return clonedOpenPeriods;};prototype.getFirstOpenPeriod=function(){if(this.openPeriods==null){return null;}
return Period.cloneOpenPeriod(this.openPeriods[0]);};prototype.getLastOpenPeriod=function(){if(this.openPeriods==null){return null;}
var last=this.openPeriods.length-1;return Period.cloneOpenPeriod(this.openPeriods[last]);};prototype.hasRegularFrequency=function(){return this.frequency.isRegularFrequency();};prototype.isLive=function(){return this.frequency.isLive();};constructor.getInstance=function(period,frequency){var freq=Frequency.getInstance(frequency);if(period!=null&&period.indexOf("-")!=-1){var periodArray=(period).split("-");if(periodArray!=null&&periodArray.length==2){return Period.getInstanceBetweenDateValues(parseFloat(periodArray[0]),parseFloat(periodArray[1]));}}
var value=parseInt(period);if(isNaN(value)||value<=0){value=1;}
var type=Period.getTypeInString(period);if(type==Period.Type.LIVE){return new Period(Period.Type.DAY,1,Frequency.LIVE);}else if(type==Period.Type.DAY){var validValue=value;if(freq==null){if(value>Period.MAX_INTRADAY_DAYS){freq=Frequency.DAY;}else{freq=Frequency.MINUTE;}}
return new Period(type,validValue,freq);}else if(type==Period.Type.YEAR&&period=="yearToDate"){var now=new Date();var yesterday=DateUtil.createDate(DateUtil.getDateValueInScale(now.getTime(),DateUtil.MS_DAY_24H));yesterday.setMilliseconds(-1);var firstDayOfYear=DateUtil.createDate(DateUtil.getDateValueInScale(now.getTime(),DateUtil.MS_YEAR));if(yesterday.getTime()<firstDayOfYear.getTime()){return new Period(Period.Type.DAY,1,Frequency.LIVE);}
freq=freq!=null?freq:Frequency.DAY;var ytd=new Period(type,value,freq);ytd.forcedFrom=firstDayOfYear;ytd.forcedTo=yesterday;return ytd;}else if(type!=null){freq=freq!=null?freq:Frequency.DAY;return new Period(type,value,freq);}else if(freq!=null&&freq.isIntraday()){return new Period(Period.Type.DAY,1,freq);}else if(freq!=null){return new Period(Period.Type.MAXIMUM,1,freq);}else{return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}};prototype.toMaximumPeriod=function(){if(this.isIntraday()){return null;}
return new Period(Period.Type.MAXIMUM,this.value,this.frequency);};constructor.getInstanceBetweenDates=function(startDate,endDate){if(startDate==null||endDate==null){return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}else{return Period.getInstanceBetweenDateValues(startDate.getTime(),endDate.getTime());}};constructor.getInstanceBetweenDateValues=function(startDateValue,endDateValue){if(startDateValue==null||endDateValue==null){return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}
var startDate=DateUtil.createDate(startDateValue);var endDate=DateUtil.createDate(endDateValue);var olderDate=endDateValue<startDateValue?endDate:startDate;var newerDate=endDateValue<startDateValue?startDate:endDate;var startTime=DateUtil.getDateValueInScale(olderDate.getTime(),DateUtil.MS_DAY_24H);var endTime=DateUtil.getDateValueInScale(newerDate.getTime(),DateUtil.MS_DAY_24H);var todayTime=DateUtil.getDateValueInScale((new Date()).getTime(),DateUtil.MS_DAY_24H);var timeSinceStartDate=todayTime-startTime;var p=null;if(timeSinceStartDate<=DateUtil.MS_DAY_24H){p=new Period(Period.Type.DAY,1,Frequency.LIVE);}else if(timeSinceStartDate<=DateUtil.MS_WEEK){p=new Period(Period.Type.WEEK,1,Frequency.DAY);}else if(timeSinceStartDate<=DateUtil.MS_MONTH){p=new Period(Period.Type.MONTH,1,Frequency.DAY);}else if(timeSinceStartDate<=6*(DateUtil.MS_MONTH+DateUtil.MS_DAY_24H)){p=new Period(Period.Type.MONTH,6,Frequency.DAY);}else if(timeSinceStartDate<=DateUtil.MS_YEAR){p=new Period(Period.Type.YEAR,1,Frequency.DAY);}else{p=new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}
p.forcedFrom=DateUtil.cloneDate(olderDate);p.forcedTo=DateUtil.cloneDate(newerDate);return p;};prototype.getNextValueInPeriod=function(current,step){var nextValue=current+step;if(this.from!=null&&this.from.getTime()>nextValue){return this.from.getTime();}else if(this.openPeriods==null||this.openPeriods.length<=1){return nextValue;}else{var length=this.openPeriods!=null?this.openPeriods.length:0;for(var index=0;index<length;index++){var currentPeriod=this.openPeriods[index];if(currentPeriod!=null&&currentPeriod[0]!=null&&currentPeriod[1]!=null){var currentFromTime=currentPeriod[0].getTime();if(nextValue<currentFromTime){return currentPeriod[0].getTime();}else if(currentFromTime<=nextValue&&nextValue<=currentPeriod[1].getTime()){return nextValue;}}}
return nextValue;}};constructor.getInstanceBetweenDatesAsMax=function(startDateValue,endDateValue,freq){if(startDateValue==null||endDateValue==null){return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}
if(freq==null){freq=Frequency.DAY;}
var startDate=DateUtil.createDate(startDateValue);var endDate=DateUtil.createDate(endDateValue);var olderDate=endDateValue<startDateValue?endDate:startDate;var newerDate=endDateValue<startDateValue?startDate:endDate;var p=new Period(Period.Type.MAXIMUM,1,freq);p.forcedFrom=DateUtil.cloneDate(olderDate);p.forcedTo=DateUtil.cloneDate(newerDate);return p;};constructor.cloneOpenPeriod=function(openPeriodToClone){if(openPeriodToClone==null){return null;}
var d0=DateUtil.cloneDate(openPeriodToClone[0]);var d1=DateUtil.cloneDate(openPeriodToClone[1]);return[d0,d1];};constructor.extractPeriod=function(serie){if(serie!=null&&stjs.isInstanceOf(serie.constructor,FinancialSerie)){return(serie).getPeriod();}
return null;};},{HISTO_DEFAULT:"Period",INTRADAY_DEFAULT:"Period",type:{name:"Enum",arguments:["Period.Type"]},frequency:"Frequency",from:"Date",to:"Date",forcedFrom:"Date",forcedTo:"Date",openPeriods:{name:"Array",arguments:[{name:"Array",arguments:["Date"]}]}},{});
var Formatter=function(){};Formatter=stjs.extend(Formatter,null,[],function(constructor,prototype){constructor.DataType=stjs.enumeration("NUMBER","DATE","STRING","OBJECT");constructor.getObjectXType=function(obj){if(obj==null){return Formatter.DataType.OBJECT;}
if((typeof obj)=="number"){return Formatter.DataType.NUMBER;}else if((typeof obj)=="string"){return Formatter.DataType.STRING;}else if((typeof obj)=="object"&&stjs.isInstanceOf(obj.constructor,Date)){return Formatter.DataType.DATE;}else{return Formatter.DataType.OBJECT;}};prototype.type=null;prototype.getFormat=function(){};prototype.setFormat=function(format){};prototype.format=function(element){};prototype.formatValue=function(value){};prototype.toElement=function(value){};prototype.toValueInScale=function(value,scale){};prototype.nextValueInScale=function(value,scale){};prototype.getFormatterType=function(){return this.type;};prototype.formatValueInScale=function(value,scale){};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var StringFormatter=function(){Formatter.call(this);this.type=Formatter.DataType.STRING;};StringFormatter=stjs.extend(StringFormatter,Formatter,[],function(constructor,prototype){prototype.getFormat=function(){return null;};prototype.setFormat=function(format){};prototype.format=function(element){return element;};prototype.formatValue=function(value){return String.valueOf(value);};prototype.toElement=function(value){return String.valueOf(value);};prototype.toValueInScale=function(value,scale){if(scale==null||scale==0){return value;}
return(Math.round(value/scale)*scale);};prototype.nextValueInScale=function(value,scale){return value+scale;};prototype.formatValueInScale=function(value,scale){return this.formatValue(value);};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var DateTimeFormatter=function(){Formatter.call(this);this.setFormat(DateTimeFormatter.FORMAT_DEFAULT);this.type=Formatter.DataType.DATE;};DateTimeFormatter=stjs.extend(DateTimeFormatter,Formatter,[],function(constructor,prototype){constructor.SEPARATOR_DATE="/";constructor.SEPARATOR_DATE_TIME=" ";constructor.SEPARATOR_TIME=":";constructor.SEPARATOR_INTERVAL=" - ";constructor.FORMAT_DAY="dd";constructor.FORMAT_MONTH_NUMBER="mm";constructor.FORMAT_MONTH_ABBR="mmm";constructor.FORMAT_YEAR_SHORT="yy";constructor.FORMAT_YEAR_FULL="yyyy";constructor.FORMAT_HOUR="HH";constructor.FORMAT_MINUTE="MM";constructor.FORMAT_DAY_MONTH=DateTimeFormatter.FORMAT_DAY+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_MONTH_NUMBER;constructor.FORMAT_MONTH_YEAR_SHORT=DateTimeFormatter.FORMAT_MONTH_ABBR+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_YEAR_SHORT;constructor.FORMAT_MONTH_YEAR_FULL=DateTimeFormatter.FORMAT_MONTH_NUMBER+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_YEAR_FULL;constructor.FORMAT_DATE=DateTimeFormatter.FORMAT_DAY+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_MONTH_NUMBER+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_YEAR_FULL;constructor.FORMAT_TIME=DateTimeFormatter.FORMAT_HOUR+DateTimeFormatter.SEPARATOR_TIME+DateTimeFormatter.FORMAT_MINUTE;constructor.FORMAT_TIME_HOUR=DateTimeFormatter.FORMAT_HOUR+DateTimeFormatter.SEPARATOR_TIME+"00";constructor.FORMAT_DAY_MONTH_TIME=DateTimeFormatter.FORMAT_DAY_MONTH+DateTimeFormatter.SEPARATOR_DATE_TIME+DateTimeFormatter.FORMAT_TIME;constructor.FORMAT_DATE_TIME=DateTimeFormatter.FORMAT_DATE+DateTimeFormatter.SEPARATOR_DATE_TIME+DateTimeFormatter.FORMAT_TIME;constructor.FORMAT_DATE_HOUR=DateTimeFormatter.FORMAT_DATE+DateTimeFormatter.SEPARATOR_DATE_TIME+DateTimeFormatter.FORMAT_TIME_HOUR;constructor.FORMAT_DEFAULT=DateTimeFormatter.FORMAT_DATE;constructor.MS_DAY=24*60*60*1000;constructor.MS_MONTH=30*DateTimeFormatter.MS_DAY;prototype.currentFormat=null;constructor.globalInstance=null;constructor.getGlobalInstance=function(){if(DateTimeFormatter.globalInstance==null){DateTimeFormatter.globalInstance=new DateTimeFormatter();}
return DateTimeFormatter.globalInstance;};prototype.setFormat=function(format){this.currentFormat=format;};prototype.getFormat=function(){return this.currentFormat;};prototype.format=function(date){if(this.currentFormat==null){return date.toUTCString();}
return dateFormat(date,this.currentFormat);};prototype.formatValue=function(value){if(value==null){return null;}
return this.format(this.toElement(value));};prototype.toElement=function(value){return new Date(parseInt(Math.round(value)));};prototype.toValueInScale=function(value,scale){return DateUtil.getDateValueInScale(value,scale);};prototype.nextValueInScale=function(value,scale){return DateUtil.getNextDateValueInScale(value,scale);};prototype.formatValueInScale=function(value,scale){return this.formatValue(this.toValueInScale(value,scale));};constructor.formatAs=function(date,format){var formatter=DateTimeFormatter.getGlobalInstance();formatter.setFormat(format);return formatter.format(date);};constructor.formatValueAs=function(value,format){var formatter=DateTimeFormatter.getGlobalInstance();formatter.setFormat(format);return formatter.format(formatter.toElement(value));};constructor.formatDateAs=function(middleDateValue,step,format){if(Frequency.DAY.getTimeValue()==step||Frequency.ALL.getTimeValue()==step||Frequency.MINUTE.getTimeValue()==step){return DateTimeFormatter.formatValueAs(middleDateValue,format);}else if(Frequency.HOUR.getTimeValue()==step){var openDateFormat=DateTimeFormatter.FORMAT_TIME.equals(format)?DateTimeFormatter.FORMAT_TIME_HOUR:format;openDateFormat=openDateFormat.replace(DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_TIME_HOUR);var OPEN_DATE=DateTimeFormatter.formatValueAs(middleDateValue-stjs.trunc(step/2),openDateFormat);var CLOSE_DATE=DateTimeFormatter.formatValueAs(middleDateValue+stjs.trunc(step/2),DateTimeFormatter.FORMAT_TIME_HOUR);return DateTimeFormatter.startCloseDatesToInterval(OPEN_DATE,CLOSE_DATE);}else if(Frequency.WEEK.getTimeValue()==step){var TWO_DAYS=DateTimeFormatter.MS_DAY*2;var WEDNESDAY=middleDateValue;var MONDAY=DateTimeFormatter.formatValueAs(WEDNESDAY-TWO_DAYS,format);var FRIDAY=DateTimeFormatter.formatValueAs(WEDNESDAY+TWO_DAYS,format);return DateTimeFormatter.startCloseDatesToInterval(MONDAY,FRIDAY);}else if(Frequency.MONTH.getTimeValue()==step){return DateTimeFormatter.formatValueAs(middleDateValue,DateTimeFormatter.FORMAT_MONTH_YEAR_FULL);}else if(Frequency.QUARTER.getTimeValue()==step||Frequency.SEMESTER.getTimeValue()==step){var OPEN_DATE=DateTimeFormatter.formatValueAs(middleDateValue-DateTimeFormatter.truncateToFullMonth(stjs.trunc(step/2)),DateTimeFormatter.FORMAT_MONTH_YEAR_FULL);var CLOSE_DATE=DateTimeFormatter.formatValueAs(middleDateValue+DateTimeFormatter.truncateToFullMonth(stjs.trunc(step/2)),DateTimeFormatter.FORMAT_MONTH_YEAR_FULL);return DateTimeFormatter.startCloseDatesToInterval(OPEN_DATE,CLOSE_DATE);}else if(Frequency.YEAR.getTimeValue()==step){return DateTimeFormatter.formatValueAs(middleDateValue,DateTimeFormatter.FORMAT_YEAR_FULL);}else if(format.contains(DateTimeFormatter.FORMAT_MINUTE)){return DateTimeFormatter.formatCustomIntradayDateAs(middleDateValue,step,format);}
return DateTimeFormatter.formatCustomDateAs(middleDateValue,step,format);};constructor.formatCustomIntradayDateAs=function(middleDateValue,step,format){var OPEN_DATE=DateTimeFormatter.formatValueAs(middleDateValue-stjs.trunc(step/2),format);var CLOSE_DATE=DateTimeFormatter.formatValueAs(middleDateValue+stjs.trunc(step/2),DateTimeFormatter.FORMAT_TIME);return DateTimeFormatter.startCloseDatesToInterval(OPEN_DATE,CLOSE_DATE);};constructor.truncateToFullMonth=function(dateValue){return Math.ceil(stjs.trunc(dateValue/DateTimeFormatter.MS_MONTH))*DateTimeFormatter.MS_MONTH;};constructor.startCloseDatesToInterval=function(openDate,closeDate){return openDate+DateTimeFormatter.SEPARATOR_INTERVAL+closeDate;};constructor.createPeriodFromDates=function(openDate,closeDate,format){if(DateTimeFormatter.areDatesEquals(openDate,closeDate,format)){var period=DateTimeFormatter.formatValueAs(openDate,format);if(DateTimeFormatter.FORMAT_DATE_TIME.equals(format)){return DateTimeFormatter.startCloseDatesToInterval(period,DateTimeFormatter.formatValueAs(closeDate,DateTimeFormatter.FORMAT_TIME));}
if(DateTimeFormatter.FORMAT_DATE.equals(format)){return period;}}
return DateTimeFormatter.startCloseDatesToInterval(DateTimeFormatter.formatValueAs(openDate,format),DateTimeFormatter.formatValueAs(closeDate,format));};constructor.areDatesEquals=function(date1,date2,format){if(format.contains(DateTimeFormatter.FORMAT_DATE)){var formattedDate1=DateTimeFormatter.formatValueAs(date1,DateTimeFormatter.FORMAT_DATE);var formattedDate2=DateTimeFormatter.formatValueAs(date2,DateTimeFormatter.FORMAT_DATE);return formattedDate1==formattedDate2;}
return false;};constructor.formatCustomDateAs=function(dateValue,frequencyInMilliseconds,dateFormat){var FREQUENCY_DAYS=stjs.trunc(stjs.trunc(frequencyInMilliseconds)/DateTimeFormatter.MS_DAY);var daysToSkip=stjs.trunc(FREQUENCY_DAYS/2);var openDateInMilliseconds=DateTimeFormatter.skipWorkingDays(dateValue,daysToSkip,true);var openDate=DateTimeFormatter.formatValueAs(openDateInMilliseconds,dateFormat);if(FREQUENCY_DAYS%2==0){daysToSkip--;}
var closeDateInMilliseconds=DateTimeFormatter.skipWorkingDays(dateValue,daysToSkip,false);var closeDate=DateTimeFormatter.formatValueAs(closeDateInMilliseconds,dateFormat);return DateTimeFormatter.startCloseDatesToInterval(openDate,closeDate);};constructor.skipWorkingDays=function(startingDateInMilliseconds,daysToSkip,decreasing){var resultDateInMilliseconds=startingDateInMilliseconds;var workingDayInMilliseconds=DateTimeFormatter.MS_DAY;if(decreasing){workingDayInMilliseconds*=-1;}
for(var i=0;i<daysToSkip;i++){resultDateInMilliseconds+=workingDayInMilliseconds;var nextDay=new Date(stjs.trunc(resultDateInMilliseconds));if(nextDay.getDay()==6||nextDay.getDay()==0){resultDateInMilliseconds+=workingDayInMilliseconds*2;}}
return resultDateInMilliseconds;};constructor.closeDateOfIntervalToLiteral=function(intervalRepresentation,literal){return intervalRepresentation.split(DateTimeFormatter.SEPARATOR_INTERVAL)[0]+DateTimeFormatter.SEPARATOR_INTERVAL+literal;};constructor.getDateFormat=function(serie){if(serie!=null&&serie.getPeriod()!=null){if(serie.getPeriod().isLive()){return DateTimeFormatter.FORMAT_TIME;}else if(serie.getPeriod().isIntraday()){return DateTimeFormatter.FORMAT_DATE_TIME;}}
return DateTimeFormatter.FORMAT_DATE;};},{globalInstance:"DateTimeFormatter",type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var AbbreviateNumberFormatter=function(){Formatter.call(this);this.currentFormat=AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;this.type=Formatter.DataType.NUMBER;};AbbreviateNumberFormatter=stjs.extend(AbbreviateNumberFormatter,Formatter,[],function(constructor,prototype){constructor.ONE_THOUSAND=1000.0;constructor.TEN_THOUSAND=10000.0;constructor.ONE_HUNDRED_THOUSAND=100000.0;constructor.ONE_MILLION=1000000.0;constructor.ONE_BILLION=1.0E9;constructor.THOUSAND_SEPARATOR="'";constructor.THOUSAND_SUFFIX="K";constructor.MILLION_SUFFIX="M";constructor.BILLION_SUFFIX="B";constructor.NO_DECIMALS=0;constructor.EXACTLY_1_DECIMAL=1;constructor.EXACTLY_2_DECIMALS=2;constructor.EXACTLY_3_DECIMALS=3;constructor.EXACTLY_4_DECIMALS=4;constructor.EXACTLY_6_DECIMALS=6;prototype.currentFormat=0;prototype.getFormat=function(){return String.valueOf(this.currentFormat);};prototype.setFormat=function(currentFormat){var possibleFormat=parseInt(currentFormat);if(isNaN(possibleFormat)||possibleFormat<0){this.currentFormat=AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}else{this.currentFormat=possibleFormat;}};prototype.format=function(element){if(element==null){return null;}
return AbbreviateNumberFormatter.rawToFixedFormatted(element,this.currentFormat);};prototype.toElement=function(value){return value;};prototype.formatValue=function(value){return this.format(value);};prototype.toValueInScale=function(value,scale){if(scale==null||scale==0){return value;}
return Math.round(value/scale)*scale;};prototype.nextValueInScale=function(value,scale){return value+scale;};prototype.formatValueInScale=function(value,scale){return this.format(this.toValueInScale(value,scale));};constructor.formatAs=function(value,format){var parsedFormat=parseInt(format);if(parsedFormat==null||isNaN(parsedFormat)||parsedFormat<0||parsedFormat>=20){parsedFormat=AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}
return AbbreviateNumberFormatter.rawToFixedFormatted(value,parsedFormat);};constructor.rawToFixedFormatted=function(value,format){if(value==null){return null;}
var absValue=Math.abs(value);if(absValue>=AbbreviateNumberFormatter.ONE_BILLION){return((value/AbbreviateNumberFormatter.ONE_BILLION)).toFixed(format)+AbbreviateNumberFormatter.BILLION_SUFFIX;}else if(absValue>=AbbreviateNumberFormatter.ONE_MILLION){return((value/AbbreviateNumberFormatter.ONE_MILLION)).toFixed(format)+AbbreviateNumberFormatter.MILLION_SUFFIX;}else if(absValue>=AbbreviateNumberFormatter.ONE_HUNDRED_THOUSAND){return((value/AbbreviateNumberFormatter.ONE_THOUSAND)).toFixed(format)+AbbreviateNumberFormatter.THOUSAND_SUFFIX;}else if(absValue>=AbbreviateNumberFormatter.ONE_THOUSAND){var valueString=(value).toFixed(format);if(valueString==null){return null;}
var decimalLength=valueString.indexOf(".");if(decimalLength==-1){decimalLength=valueString.length;}
var prefix=valueString.substring(0,decimalLength-3);var suffix=valueString.substring(decimalLength-3);return prefix+AbbreviateNumberFormatter.THOUSAND_SEPARATOR+suffix;}
return(value).toFixed(format);};constructor.isSuffixed=function(formattedValue){return formattedValue.endsWith(AbbreviateNumberFormatter.BILLION_SUFFIX)||formattedValue.endsWith(AbbreviateNumberFormatter.MILLION_SUFFIX)||formattedValue.endsWith(AbbreviateNumberFormatter.THOUSAND_SUFFIX);};constructor.separatedToSuffixedThousands=function(currentValue){return currentValue.substring(0,currentValue.length-4)+AbbreviateNumberFormatter.THOUSAND_SUFFIX;};constructor.getDecimalPlacesString=function(value){return String.valueOf(AbbreviateNumberFormatter.getDecimalPlaces(value));};constructor.getDecimalPlaces=function(value){if(value==null){return AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}
var valueString=value.toString();var dotIndex=valueString.lastIndexOf(".");if(dotIndex<0){return AbbreviateNumberFormatter.NO_DECIMALS;}
var digitsAfterDot=valueString.substring(dotIndex+1).length;if(digitsAfterDot<=0||digitsAfterDot==1){return AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}else if(digitsAfterDot>AbbreviateNumberFormatter.EXACTLY_6_DECIMALS){return AbbreviateNumberFormatter.EXACTLY_6_DECIMALS;}
return digitsAfterDot;};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var ThousandsSeparatorNumberFormatter=function(){Formatter.call(this);};ThousandsSeparatorNumberFormatter=stjs.extend(ThousandsSeparatorNumberFormatter,Formatter,[],function(constructor,prototype){constructor.EMPTY_VALUE="-";prototype.getFormat=function(){return null;};prototype.setFormat=function(format){};prototype.format=function(element){return this.formatValue(element);};prototype.formatValue=function(value){if(value==null||value%1!=0||isNaN(value)){return ThousandsSeparatorNumberFormatter.EMPTY_VALUE;}
return ThousandsSeparatorNumberFormatter.insertSeparators((value).toFixed(0),AbbreviateNumberFormatter.THOUSAND_SEPARATOR);};prototype.toElement=function(value){return value;};prototype.toValueInScale=function(value,scale){return value;};prototype.nextValueInScale=function(value,scale){return value;};prototype.formatValueInScale=function(value,scale){return this.formatValue(value);};constructor.insertSeparators=function(str,separator){var numericString=str;var sign="";if(str.contains("-")){sign="-";numericString=numericString.substring(1,numericString.length);}
var numbersContainer=[];var length=numericString.length;while(length>3){length-=3;numbersContainer.unshift(numericString.substring(length));numericString=numericString.substring(0,length);}
numbersContainer.unshift(numericString);return sign+numbersContainer.join(separator);};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var InvalidDateFormat=function(){Exception.call(this,InvalidDateFormat.MESSAGE);};InvalidDateFormat=stjs.extend(InvalidDateFormat,Exception,[],function(constructor,prototype){constructor.MESSAGE="Error: Invalid date format!";},{},{});
var PercentNumberFormatter=function(){Formatter.call(this);this.currentFormat=PercentNumberFormatter.EXACTLY_2_DECIMALS;this.type=Formatter.DataType.NUMBER;};PercentNumberFormatter=stjs.extend(PercentNumberFormatter,Formatter,[],function(constructor,prototype){constructor.EXACTLY_2_DECIMALS=2;constructor.NO_DECIMALS=0;prototype.currentFormat=0;prototype.getFormat=function(){return String.valueOf(this.currentFormat);};prototype.setFormat=function(currentFormat){var possibleFormat=parseInt(currentFormat);if(isNaN(possibleFormat)||possibleFormat<0){this.currentFormat=PercentNumberFormatter.EXACTLY_2_DECIMALS;}else{this.currentFormat=possibleFormat;}};prototype.format=function(element){if(element==null){return null;}else{var d=((element).toFixed(this.currentFormat));if(d==0){d=((0).toFixed(this.currentFormat));}
return d+"%";}};prototype.toElement=function(value){return value;};prototype.formatValue=function(value){return this.format(value);};prototype.toValueInScale=function(value,scale){if(scale==null||scale==0){return value;}
return(Math.round(value/scale)*scale);};prototype.nextValueInScale=function(value,scale){return value+scale;};prototype.formatValueInScale=function(value,scale){return this.format(this.toValueInScale(value,scale));};constructor.formatAs=function(element,format){var formatValue=parseInt(format);if(formatValue==null||isNaN(formatValue)||formatValue<0){formatValue=PercentNumberFormatter.EXACTLY_2_DECIMALS;}
if(element==null){return null;}else{return(element).toFixed(formatValue)+"%";}};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var DateUtil=function(){};DateUtil=stjs.extend(DateUtil,null,[],function(constructor,prototype){constructor.WORK_WEEK_2_WEEK_RATIO=7.0/5.0;constructor.MS_MILISECONS=1;constructor.MS_SECOND=1000;constructor.MS_MINUTE=60*DateUtil.MS_SECOND;constructor.MS_FIVE_MINUTES=5*DateUtil.MS_MINUTE;constructor.MS_TEN_MINUTES=10*DateUtil.MS_MINUTE;constructor.MS_FIFTEEN_MINUTES=15*DateUtil.MS_MINUTE;constructor.MS_HOUR=60*DateUtil.MS_MINUTE;constructor.MS_TWO_HOURS=2*DateUtil.MS_HOUR;constructor.MS_FOUR_HOURS=4*DateUtil.MS_HOUR;constructor.MS_DAY_24H=24*DateUtil.MS_HOUR;constructor.MS_WEEK=7*DateUtil.MS_DAY_24H;constructor.MS_MONTH=30*DateUtil.MS_DAY_24H;constructor.MS_YEAR=365*DateUtil.MS_DAY_24H;constructor.FORMATS="formats";constructor.STEPS="steps";constructor.INTRADAY_BASIC_STEPS=[DateUtil.MS_MINUTE,DateUtil.MS_FIVE_MINUTES,DateUtil.MS_TEN_MINUTES,DateUtil.MS_FIFTEEN_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.HISTO_BASIC_STEPS=[DateUtil.MS_DAY_24H,DateUtil.MS_WEEK,DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.INTRADAY_MINUTE_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_MINUTE_STEPS=[DateUtil.MS_MINUTE,DateUtil.MS_HOUR];constructor.INTRADAY_FIVE_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_FIVE_MINUTES_STEPS=[DateUtil.MS_FIVE_MINUTES,DateUtil.MS_HOUR];constructor.INTRADAY_TEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_TEN_MINUTES_STEPS=[DateUtil.MS_TEN_MINUTES,DateUtil.MS_HOUR];constructor.INTRADAY_FIFTEEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_FIFTEEN_MINUTES_STEPS=[DateUtil.MS_FIFTEEN_MINUTES,DateUtil.MS_HOUR];constructor.INTRADAY_1HOUR_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_1HOUR_FULL_STEPS=[DateUtil.MS_HOUR];constructor.INTRADAY_1HOUR_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR];constructor.INTRADAY_1HOUR_SHORT_STEPS=[DateUtil.MS_HOUR];constructor.INTRADAY_2HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_2HOURS_FULL_STEPS=[DateUtil.MS_TWO_HOURS];constructor.INTRADAY_2HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR];constructor.INTRADAY_2HOURS_SHORT_STEPS=[DateUtil.MS_TWO_HOURS];constructor.INTRADAY_4HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_4HOURS_FULL_STEPS=[DateUtil.MS_FOUR_HOURS];constructor.INTRADAY_4HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR];constructor.INTRADAY_4HOURS_SHORT_STEPS=[DateUtil.MS_FOUR_HOURS];constructor.MULTI_INTRADAY_MINUTE_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_MINUTE_STEPS=[DateUtil.MS_MINUTE,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_FIVE_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_FIVE_MINUTES_STEPS=[DateUtil.MS_FIVE_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_TEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_TEN_MINUTES_STEPS=[DateUtil.MS_TEN_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS=[DateUtil.MS_FIFTEEN_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_1HOUR_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_1HOUR_FULL_STEPS=[DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_1HOUR_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_1HOUR_SHORT_STEPS=[DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_2HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_2HOURS_FULL_STEPS=[DateUtil.MS_TWO_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_2HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_2HOURS_SHORT_STEPS=[DateUtil.MS_TWO_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_4HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_4HOURS_FULL_STEPS=[DateUtil.MS_FOUR_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_4HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_4HOURS_SHORT_STEPS=[DateUtil.MS_FOUR_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_DAY_FORMATS=[DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_DAY_STEPS=[DateUtil.MS_DAY_24H];constructor.HISTO_DAY_FORMATS=[DateTimeFormatter.FORMAT_DAY,DateTimeFormatter.FORMAT_MONTH_ABBR,DateTimeFormatter.FORMAT_MONTH_YEAR_SHORT];constructor.HISTO_DAY_STEPS=[DateUtil.MS_DAY_24H,DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_WEEK_FORMATS=[DateTimeFormatter.FORMAT_DAY,DateTimeFormatter.FORMAT_MONTH_ABBR,DateTimeFormatter.FORMAT_MONTH_YEAR_SHORT];constructor.HISTO_WEEK_STEPS=[DateUtil.MS_WEEK,DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_MONTH1_FORMATS=[DateTimeFormatter.FORMAT_MONTH_ABBR,DateTimeFormatter.FORMAT_YEAR_FULL];constructor.HISTO_MONTH1_STEPS=[DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_MONTH2_FORMATS=[DateTimeFormatter.FORMAT_MONTH_NUMBER,DateTimeFormatter.FORMAT_YEAR_FULL];constructor.HISTO_MONTH2_STEPS=[DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_YEAR_FORMATS=[DateTimeFormatter.FORMAT_YEAR_FULL];constructor.HISTO_YEAR_STEPS=[DateUtil.MS_YEAR];constructor.getDateAfter=function(date,value,step){if(date==null){date=new Date();}
var time=date.getTime();return new Date(value*step+time);};constructor.getTimeAfter=function(date,value,step){if(date==null){date=new Date();}
var time=date.getTime();return new Date(value*step+time);};constructor.setXAxisFormatsAndSteps=function(period,formats,steps){if(period==null||!period.isIntraday()){DateUtil.setHistoXAxisFormatsAndSteps(period,formats,steps);}else if(DateUtil.isSameDay(period.getFrom(),period.getTo())){DateUtil.setIntradayXAxisFormatsAndSteps(period,formats,steps);}else{DateUtil.setMultiIntradayXAxisFormatsAndSteps(period,formats,steps);}};constructor.setXAxisFormatsAndStepsFromStepValue=function(currentStepValue,formats,steps){var i=0;while(currentStepValue>=DateUtil.HISTO_BASIC_STEPS[i]&&i<DateUtil.HISTO_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.HISTO_BASIC_STEPS[i];var currentSteps=null;if(basciStep==DateUtil.MS_DAY_24H){formats.push(DateUtil.HISTO_DAY_FORMATS,DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_WEEK_STEPS,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_WEEK){formats.push(DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_MONTH){formats.push(DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_YEAR];steps.push(currentSteps,currentSteps,DateUtil.HISTO_YEAR_STEPS);}else{formats.push(DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps);}};constructor.setHistoXAxisFormatsAndSteps=function(period,formats,steps){var currentStepValue=period.getFrequency().getTimeValue();var i=0;while(currentStepValue>=DateUtil.HISTO_BASIC_STEPS[i]&&i<DateUtil.HISTO_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.HISTO_BASIC_STEPS[i];var currentSteps=null;if(basciStep==DateUtil.MS_DAY_24H){formats.push(DateUtil.HISTO_DAY_FORMATS,DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_WEEK_STEPS,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_WEEK){formats.push(DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_MONTH){formats.push(DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_YEAR];steps.push(currentSteps,currentSteps,DateUtil.HISTO_YEAR_STEPS);}else{formats.push(DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps);}};constructor.setMultiIntradayXAxisFormatsAndSteps=function(period,formats,steps){var currentStepValue=period.getFrequency().getTimeValue();var i=0;while(currentStepValue>=DateUtil.INTRADAY_BASIC_STEPS[i]&&i<DateUtil.INTRADAY_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.INTRADAY_BASIC_STEPS[i];var currentSteps=null;currentStepValue=currentStepValue<0?DateUtil.MS_MINUTE:currentStepValue;if(basciStep==DateUtil.MS_MINUTE&&currentStepValue==DateUtil.MS_MINUTE){formats.push(DateUtil.MULTI_INTRADAY_MINUTE_FORMATS,DateUtil.MULTI_INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_TEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_FIVE_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_TEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep<=DateUtil.MS_FIVE_MINUTES){formats.push(DateUtil.MULTI_INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_TEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_TEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep<=DateUtil.MS_TEN_MINUTES){formats.push(DateUtil.MULTI_INTRADAY_TEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep<=DateUtil.MS_FIFTEEN_MINUTES){formats.push(DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep==DateUtil.MS_HOUR){formats.push(DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_DAY_24H];steps.push(currentSteps,currentSteps,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else{formats.push(DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps);}};constructor.setIntradayXAxisFormatsAndSteps=function(period,formats,steps){var currentStepValue=period.getFrequency().getTimeValue();var i=0;while(currentStepValue>=DateUtil.INTRADAY_BASIC_STEPS[i]&&i<DateUtil.INTRADAY_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.INTRADAY_BASIC_STEPS[i];var currentSteps=null;currentStepValue=currentStepValue<0?DateUtil.MS_MINUTE:currentStepValue;if(basciStep==DateUtil.MS_MINUTE&&currentStepValue==DateUtil.MS_MINUTE){formats.push(DateUtil.INTRADAY_MINUTE_FORMATS,DateUtil.INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.INTRADAY_TEN_MINUTES_FORMATS,DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_FIVE_MINUTES_STEPS,DateUtil.INTRADAY_TEN_MINUTES_STEPS,DateUtil.INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else if(basciStep<=DateUtil.MS_FIVE_MINUTES){formats.push(DateUtil.INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.INTRADAY_TEN_MINUTES_FORMATS,DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_TEN_MINUTES_STEPS,DateUtil.INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else if(basciStep<=DateUtil.MS_TEN_MINUTES){formats.push(DateUtil.INTRADAY_TEN_MINUTES_FORMATS,DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else if(basciStep<=DateUtil.MS_FIFTEEN_MINUTES){formats.push(DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else{formats.push(DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps,currentSteps,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}};constructor.isSameDay=function(date1,date2){if(date1==null||date2==null){return false;}
var sameYear=date1.getFullYear()==date2.getFullYear();var sameMonth=date1.getMonth()==date2.getMonth();var sameDay=date1.getDate()==date2.getDate();return sameDay&&sameMonth&&sameYear;};constructor.getDateValueInScale=function(currentDateTime,scale){if(currentDateTime==null||isNaN(currentDateTime)){return null;}
var roundedDate=new Date(Math.round(currentDateTime));if(scale==null||scale<=DateUtil.MS_MILISECONS){return roundedDate.getTime();}
roundedDate.setMilliseconds(0);if(scale<=DateUtil.MS_SECOND){return roundedDate.getTime();}
roundedDate.setSeconds(0);if(scale<=DateUtil.MS_MINUTE){return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIVE_MINUTES){var minutes=stjs.trunc((Math.floor(roundedDate.getMinutes()/5.0)*5));roundedDate.setMinutes(stjs.trunc(minutes));return roundedDate.getTime();}
if(scale<=DateUtil.MS_TEN_MINUTES){var minutes=stjs.trunc((Math.floor(roundedDate.getMinutes()/10.0)*10));roundedDate.setMinutes(stjs.trunc(minutes));return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIFTEEN_MINUTES){var minutes=stjs.trunc((Math.floor(roundedDate.getMinutes()/15.0)*15));roundedDate.setMinutes(stjs.trunc(minutes));return roundedDate.getTime();}
roundedDate.setMinutes(0);if(scale<=DateUtil.MS_FOUR_HOURS){return roundedDate.getTime();}
roundedDate.setHours(0);if(scale<=DateUtil.MS_WEEK){return roundedDate.getTime();}
roundedDate.setDate(1);if(scale<=DateUtil.MS_MONTH){return roundedDate.getTime();}
if(scale<DateUtil.MS_YEAR){var monthScale=stjs.trunc(Math.round(scale/DateUtil.MS_MONTH));var months=stjs.trunc(Math.floor(roundedDate.getMonth()/monthScale))*monthScale;roundedDate.setMonth(months);return roundedDate.getTime();}
roundedDate.setMonth(0);return roundedDate.getTime();};constructor.getNextDateValueInScale=function(currentDateTime,scale){if(currentDateTime==null||isNaN(currentDateTime)){return null;}
var roundedDate=new Date(Math.round(currentDateTime));if(scale==null){return roundedDate.getTime();}
if(scale<=DateUtil.MS_MILISECONS){roundedDate.setMilliseconds(roundedDate.getMilliseconds()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_SECOND){roundedDate.setSeconds(roundedDate.getSeconds()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_MINUTE){roundedDate.setMinutes(roundedDate.getMinutes()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIVE_MINUTES){roundedDate.setMinutes(roundedDate.getMinutes()+5);return roundedDate.getTime();}
if(scale<=DateUtil.MS_TEN_MINUTES){roundedDate.setMinutes(roundedDate.getMinutes()+10);return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIFTEEN_MINUTES){roundedDate.setMinutes(roundedDate.getMinutes()+15);return roundedDate.getTime();}
if(scale<=DateUtil.MS_HOUR){roundedDate.setHours(roundedDate.getHours()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_TWO_HOURS){roundedDate.setHours(roundedDate.getHours()+2);return roundedDate.getTime();}
if(scale<=DateUtil.MS_FOUR_HOURS){roundedDate.setHours(roundedDate.getHours()+4);return roundedDate.getTime();}
if(scale<=DateUtil.MS_DAY_24H){roundedDate.setDate(roundedDate.getDate()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_WEEK){roundedDate.setDate(roundedDate.getDate()+7);return roundedDate.getTime();}
if(scale<=DateUtil.MS_MONTH){roundedDate.setMonth(roundedDate.getMonth()+1);return roundedDate.getTime();}
if(scale<DateUtil.MS_YEAR){var monthsToAdd=stjs.trunc(Math.round(scale/DateUtil.MS_MONTH));roundedDate.setMonth(roundedDate.getMonth()+monthsToAdd);}else{var yearsToAdd=stjs.trunc(Math.round(scale/DateUtil.MS_YEAR));roundedDate.setFullYear(roundedDate.getFullYear()+yearsToAdd);}
return roundedDate.getTime();};constructor.cloneDate=function(date){if(date==null){return null;}
return new Date(date.getTime());};constructor.createDate=function(dateTime){if(dateTime==null){return null;}
return new Date(dateTime);};constructor.minutesSince=function(startXValue,xValue){if(startXValue==null||xValue==null||isNaN(startXValue)||isNaN(xValue)){return null;}
return(xValue-startXValue)/DateUtil.MS_MINUTE;};constructor.daysSince=function(startXValue,xValue){if(startXValue==null||xValue==null||isNaN(startXValue)||isNaN(xValue)){return null;}
return(xValue-startXValue)/DateUtil.MS_DAY_24H;};constructor.dateOnly=function(date){if(date==null){return null;}
date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);return date;};constructor.createDateOnly=function(dateMillis){if(dateMillis==null){return null;}
return DateUtil.dateOnly(new Date(dateMillis.longValue()));};constructor.todayDateOnly=function(){return DateUtil.dateOnly(new Date());};},{INTRADAY_BASIC_STEPS:{name:"Array",arguments:[null]},HISTO_BASIC_STEPS:{name:"Array",arguments:[null]},INTRADAY_MINUTE_FORMATS:{name:"Array",arguments:[null]},INTRADAY_MINUTE_STEPS:{name:"Array",arguments:[null]},INTRADAY_FIVE_MINUTES_FORMATS:{name:"Array",arguments:[null]},INTRADAY_FIVE_MINUTES_STEPS:{name:"Array",arguments:[null]},INTRADAY_TEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},INTRADAY_TEN_MINUTES_STEPS:{name:"Array",arguments:[null]},INTRADAY_FIFTEEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},INTRADAY_FIFTEEN_MINUTES_STEPS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_FULL_FORMATS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_FULL_STEPS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_SHORT_FORMATS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_SHORT_STEPS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_FULL_STEPS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_FULL_STEPS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_MINUTE_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_MINUTE_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIVE_MINUTES_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIVE_MINUTES_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_TEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_TEN_MINUTES_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_FULL_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_FULL_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_SHORT_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_FULL_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_FULL_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_DAY_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_DAY_STEPS:{name:"Array",arguments:[null]},HISTO_DAY_FORMATS:{name:"Array",arguments:[null]},HISTO_DAY_STEPS:{name:"Array",arguments:[null]},HISTO_WEEK_FORMATS:{name:"Array",arguments:[null]},HISTO_WEEK_STEPS:{name:"Array",arguments:[null]},HISTO_MONTH1_FORMATS:{name:"Array",arguments:[null]},HISTO_MONTH1_STEPS:{name:"Array",arguments:[null]},HISTO_MONTH2_FORMATS:{name:"Array",arguments:[null]},HISTO_MONTH2_STEPS:{name:"Array",arguments:[null]},HISTO_YEAR_FORMATS:{name:"Array",arguments:[null]},HISTO_YEAR_STEPS:{name:"Array",arguments:[null]}},{});
var ChartView=function(){};ChartView=stjs.extend(ChartView,null,[],function(constructor,prototype){constructor.AreaType=stjs.enumeration("AXIS","GRAPH","TITLE","LEGEND","TOOLTIP","CUSTOM");prototype.implementation=null;prototype.areas=null;prototype.width=0;prototype.height=0;prototype.layout=null;prototype.styleModel=null;prototype.interactionAllowed=false;prototype.animationId=0;prototype.animationStartTime=0.0;prototype.animationCallback=null;prototype.animationEndCallback=null;prototype.parentElement=null;prototype.init=function(width,height,parentDiv){};prototype.clear=function(){};prototype.clearDisplay=function(){};prototype.render=function(){};prototype.renderAnimation=function(animationEndCallback){};prototype.renderFrame=function(ratio){};prototype.refreshLayout=function(){};prototype.showHighlight=function(){};prototype.clearHighlight=function(){};prototype.onResize=function(){};prototype.resize=function(width,height){};prototype.addLayer=function(width,height,canvasWrapperElement,zIndex){};prototype.addAdditionalLayer=function(layerId,zIndex){};prototype.putLayer=function(layerId,layer){};prototype.removeLayer=function(layerId){};prototype.getLayer=function(layerId){};prototype.clearLayer=function(layerId){};prototype.renderLayer=function(layerId){};prototype.getGroundLayer=function(){};prototype.getMainLayer=function(){};prototype.getOverlayLayer=function(){};prototype.isValid=function(){};prototype.moveTo=function(newParentElement){};prototype.getLabelWidth=function(text,font,fontSize,bold){};prototype.getTextWidth=function(text,font,fontSize,bold){};prototype.getTextWidthFull=function(text,fontFamily,fontSize,fontStyle){};prototype.getClosestRectAtPosition2D=function(x,y){};prototype.getShapesAtPosition=function(x,y,maxDistance){};prototype.getClosestShapesAtPosition=function(x,y){};prototype.getImplementation=function(){return this.implementation;};prototype.getArea=function(areaId){return this.areas[areaId];};prototype.canInteract=function(){return this.interactionAllowed;};prototype.getStyleModel=function(){return this.styleModel;};prototype.getAreas=function(){return this.areas;};prototype.getLayout=function(){return this.layout;};prototype.findElementById=function(id){};prototype.isInside=function(offsetX,offsetY){};prototype.getAreaFromPosition=function(offsetX,offsetY){for(var id in this.areas){var area=this.areas[id];if(area!=null&&area.isInside(offsetX,offsetY)){return area;}}
return null;};prototype.getParentElement=function(){return this.parentElement;};prototype.setZoomAreaStartPos=function(offsetX,offsetY){};prototype.setCurrentZoomAreaPos=function(offsetX,offsetY){};},{implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},areas:{name:"Map",arguments:[null,"Area"]},layout:"Layout",styleModel:"StyleModel",animationCallback:"Callback0",animationEndCallback:"Callback0",parentElement:"SqwJQuery"},{});
var AbstractChartView=function(options,parentElement){ChartView.call(this);this.parentElement=parentElement;this.wrapperElement=$(window.document.createElement("div"));this.wrapperElement.addClass(AbstractChartView.CHART_WRAPPER_CSS_CLASS);this.wrapperElement.css("position","relative");if(parentElement!=null){parentElement.append(this.wrapperElement);this.width=parentElement.width();this.height=parentElement.height();}else{this.width=0;this.height=0;}
this.styleModel=options.getStyleModel();if(this.styleModel==null){this.styleModel=new DefaultStyleModel();}
this.styleModel.init(options);this.init(this.width,this.height,this.wrapperElement);this.layout=options.getLayout();if(this.layout==null){this.layout=new DefaultLayout();}
this.layout.init(this.styleModel);this.refreshLayout();this.animationId=0;};AbstractChartView=stjs.extend(AbstractChartView,ChartView,[],function(constructor,prototype){constructor.CHART_WRAPPER_CSS_CLASS="chart-wrapper-element";prototype.wrapperElement=null;prototype.areasByTypes=null;prototype.moveTo=function(newParentElement){if(this.parentElement!=null){this.parentElement.empty();}
this.wrapperElement.empty();this.parentElement=newParentElement;if(this.parentElement!=null){this.parentElement.append(this.wrapperElement);this.width=this.parentElement.width();this.height=this.parentElement.height();}else{this.width=0;this.height=0;}
this.init(this.width,this.height,this.wrapperElement);this.refreshLayout();};prototype.setupAreasByTypes=function(areas){var areasByTypes={};var typeArray=(ChartView.AreaType.values());for(var i in typeArray){if(!(typeArray).hasOwnProperty(i))
continue;var emptyArray=[];areasByTypes[typeArray[i].toString()]=emptyArray;}
for(var areaId in areas){var area=areas[areaId];var currentAreasWithType=areasByTypes[area.getAreaType().toString()];currentAreasWithType.push(area);}
return areasByTypes;};prototype.onResize=function(){if(this.parentElement!=null){this.width=this.parentElement.width();this.height=this.parentElement.height();}else{this.width=0;this.height=0;}
this.resize(this.width,this.height);};prototype.isValid=function(){return this.getArea(DefaultLayout.GRAPH_AREA)!=null;};prototype.refreshLayout=function(){this.layout.refresh(this,this.width,this.height);this.areas=this.layout.getAreas();this.areasByTypes=this.setupAreasByTypes(this.areas);};prototype.getArea=function(areaId){if(this.areas==null){return null;}
return this.areas[areaId];};prototype.findElementById=function(id){if(this.areas==null||id==null){return null;}
for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){var element=area.getElement(id);if(element!=null){return element;}}}
return null;};prototype.isInside=function(offsetX,offsetY){if(offsetX==null||offsetY==null||isNaN(offsetX)||isNaN(offsetY)){return false;}else if(offsetX>=0&&offsetY>=0&&offsetX<this.width&&offsetY<this.height){return true;}else{return false;}};prototype.getShapesAtPosition=function(x,y,maxDistance){if(this.isInside(x,y)){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var elements=graphArea.getElementsByLayer(this.getMainLayer().getId());var res=[];for(var i=0;i<elements.length;i++){var element=elements[i];if(stjs.isInstanceOf(element.constructor,Shape)){var shape=element;var distance=shape.calDistance(x,y);if(maxDistance<distance){res.push(shape);}}}
return res;}
return null;};prototype.getClosestRectAtPosition2D=function(x,y){if(this.isInside(x,y)){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var elements=graphArea.getElementsByLayer(this.getMainLayer().getId());if(elements==null){return null;}
var res=null;var minDistance=Double.POSITIVE_INFINITY;for(var i=0;i<elements.length;i++){var element=elements[i];if(stjs.isInstanceOf(element.constructor,Shape)&&stjs.isInstanceOf(element.constructor,CanvasRect)){var shape=element;var previousShape=null;var distanceX=shape.calDistance(x,y);if(minDistance>distanceX){minDistance=distanceX;res=shape;}
if((shape.calDistance(x,y)==minDistance)&&shape.calDistanceY(y)<res.calDistanceY(y)){res=shape;}}}
return res;}
return null;};prototype.getClosestShapesAtPosition=function(x,y){if(this.isInside(x,y)){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var elements=graphArea.getElementsByLayer(this.getMainLayer().getId());if(elements==null){return null;}
var res=null;var minDistance=Double.POSITIVE_INFINITY;for(var i=0;i<elements.length;i++){var element=elements[i];if(stjs.isInstanceOf(element.constructor,Shape)){var shape=element;var distance=shape.calDistance(x,y);if(minDistance>distance){minDistance=distance;res=shape;}}}
return res;}
return null;};},{wrapperElement:"SqwJQuery",areasByTypes:{name:"Map",arguments:[null,{name:"Array",arguments:["Area"]}]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},areas:{name:"Map",arguments:[null,"Area"]},layout:"Layout",styleModel:"StyleModel",animationCallback:"Callback0",animationEndCallback:"Callback0",parentElement:"SqwJQuery"},{});
var CanvasChartView=function(options,parentDiv){AbstractChartView.call(this,options,parentDiv);this.implementation=ChartOption.Implementation.CANVAS;this.layerCounter=0;this.zoomAreaColor=options.getZoomAreaColor();this.zoomAreaColorGradientParam=options.getZoomAreaColorGradientParam();};CanvasChartView=stjs.extend(CanvasChartView,AbstractChartView,[],function(constructor,prototype){constructor.LABELS_MARGIN=4;prototype.layers=null;prototype.orderedLayers=null;prototype.groundLayerId=null;prototype.mainLayerId=null;prototype.overlayLayerId=null;prototype.layerCounter=0;prototype.zoomAreaColor=null;prototype.zoomAreaColorGradientParam=null;prototype.zoomArea=null;prototype.zoomAreaStartPos=null;prototype.zoomAreaEndPos=null;constructor.createView=function(implementation,options,parentDiv){if(implementation==ChartOption.Implementation.CANVAS){return new CanvasChartView(options,parentDiv);}
return null;};prototype.init=function(width,height,wrapperElement){this.layers={};this.orderedLayers=[];this.groundLayerId=this.addLayer(width,height,wrapperElement,0);this.mainLayerId=this.addLayer(width,height,wrapperElement,1);this.overlayLayerId=this.addLayer(width,height,wrapperElement,2);};prototype.clear=function(){this.interactionAllowed=false;this.animationId++;for(var layerId in this.layers){this.clearLayer(layerId);}};prototype.clearDisplay=function(){this.interactionAllowed=false;for(var layerId in this.layers){var layer=this.layers[layerId];if(layer!=null){layer.clear();}}};prototype.clearLayer=function(layerId){var layer=this.getLayer(layerId);if(layer!=null){layer.clear();}
for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){area.clearElementsInLayer(layerId);}}};prototype.renderLayer=function(layerId){var layer=this.getLayer(layerId);for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){this.clipLayerToArea(layer,area);area.renderLayer(layer);this.unclipLayer(layer);}}};prototype.resize=function(width,height){this.width=width;this.height=height;for(var layerId in this.layers){var layer=this.getLayer(layerId);if(layer!=null){layer.setHeight(height);layer.setWidth(width);}}
this.refreshLayout();};prototype.render=function(){this.renderFrame(null);};prototype.setupRenderingRatio=function(layer,ratio){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var bounds=graphArea.getAreaBound();var context=layer.getCanvasRenderingContext2D();var startX=stjs.trunc(bounds.getLeft());var width=stjs.trunc(Math.round(ratio*bounds.getOuterWidth(true)));context.save();context.beginPath();context.rect(startX,0,width,layer.getHeight());context.clip();};prototype.clipLayerToArea=function(layer,area){var bounds=area.getAreaBound();var context=layer.getCanvasRenderingContext2D();var left=stjs.trunc(bounds.getLeft());var top=stjs.trunc(bounds.getTop());var width=stjs.trunc(bounds.getOuterWidth(true));var height=stjs.trunc(bounds.getOuterHeight(true));context.save();context.beginPath();context.rect(left,top,width,height);context.clip();};prototype.unclipLayer=function(layer){var context=layer.getCanvasRenderingContext2D();context.restore();};prototype.renderAnimation=function(animationEndCallback){var self=this;var animationTime=this.styleModel.getGlobalStyle().getAnimationTime();this.animationId++;var currentAnimationId=this.animationId;if(this.styleModel.getGlobalStyle().getAnimationTime()<=0){this.clearDisplay();this.renderFrame(null);if(animationEndCallback!=null){animationEndCallback();}
return;}
var animationCallback=function(){if(currentAnimationId!=self.animationId){return;}
var now=(new Date()).getTime();var ratio=(now-self.animationStartTime)/animationTime;if(ratio>=1){self.clearDisplay();self.renderFrame(null);if(animationEndCallback!=null){animationEndCallback();}}else{self.clearDisplay();self.renderFrame(ratio);window.requestAnimationFrame(animationCallback);}};this.animationStartTime=(new Date()).getTime();window.requestAnimationFrame(animationCallback);};prototype.renderFrame=function(ratio){var layersCount=this.orderedLayers!=null?this.orderedLayers.length:0;var restoreContextNeeded=false;for(var i=0;i<layersCount;i++){var layer=this.layers[this.orderedLayers[i]];if(ratio!=null&&layer!=null&&layer.getId()==this.mainLayerId&&ratio>0&&ratio<1.0){this.setupRenderingRatio(layer,ratio);restoreContextNeeded=true;}
this.renderLayer(this.orderedLayers[i]);if(restoreContextNeeded){restoreContextNeeded=false;layer.getCanvasRenderingContext2D().restore();}}};prototype.showHighlight=function(){var overlayLayer=this.getOverlayLayer();this.createZoomArea(overlayLayer);for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){this.clipLayerToArea(overlayLayer,area);area.renderLayer(overlayLayer);this.unclipLayer(overlayLayer);}}};prototype.createZoomArea=function(overlayLayer){if(this.zoomArea!=null&&this.zoomArea.getAreaBound()!=null&&this.zoomAreaStartPos!=null&&this.zoomAreaEndPos!=null){var bounds=this.zoomArea.getAreaBound();var x=stjs.trunc(Math.round(this.zoomAreaStartPos));var areaWidth=stjs.trunc(Math.round(this.zoomAreaEndPos-this.zoomAreaStartPos));var rect=ChartElementFactory.createRect(overlayLayer,x,stjs.trunc(bounds.getTop()),areaWidth,stjs.trunc(bounds.getOuterHeight(true)));rect.setFillColor(this.zoomAreaColor);rect.setFillColorGradientParam(this.zoomAreaColorGradientParam);this.zoomArea.addElement(rect);}};prototype.isInsideGraph=function(offsetX,offsetY){if(offsetX==null||offsetY==null||isNaN(offsetX)||isNaN(offsetY)){return false;}else{var graphs=this.areasByTypes[ChartView.AreaType.GRAPH.toString()];for(var i in graphs){if(!(graphs).hasOwnProperty(i))
continue;var currentGraph=graphs[i];if(currentGraph!=null){if(currentGraph.isInside(offsetX,offsetY)){return true;}}}
return false;}};prototype.clearHighlight=function(){this.clearLayer(this.overlayLayerId);};prototype.addLayer=function(width,height,wrapperElement,zIndex){var layer=new CanvasLayer(width,height);layer.setzIndex(zIndex);layer.attachTo(wrapperElement);var layerId=layer.getId();this.layers[layerId]=layer;this.addLayerToOrdered(layer);return layerId;};prototype.addAdditionalLayer=function(layerId,zIndex){var layer=new CanvasLayer(this.width,this.height);layer.setzIndex(zIndex);layer.attachTo(this.wrapperElement);layer.setId(layerId);this.layers[layerId]=layer;this.addLayerToOrdered(layer);return layer;};prototype.addLayerToOrdered=function(layer){if(layer==null){return;}
var layerId=layer.getId();var zIndex=layer.getZIndex();var currentCount=this.orderedLayers.length;for(var i=0;i<currentCount;i++){var currentLayerId=this.orderedLayers[i];if(currentLayerId!=null&&zIndex<this.layers[currentLayerId].getZIndex()){this.orderedLayers.splice(i,0,layerId);return;}}
this.orderedLayers.push(layerId);};prototype.removeLayerFromOrderer=function(layer){if(layer==null){return;}
var layerId=layer.getId();var currentCount=this.orderedLayers.length;for(var i=0;i<currentCount;i++){var currentLayerId=this.orderedLayers[i];if(currentLayerId==layerId){this.orderedLayers.splice(i,1);return;}}};prototype.removeLayer=function(layerId){this.clearLayer(layerId);this.removeLayerFromOrderer(this.layers[layerId]);delete this.layers[layerId];};prototype.getLayer=function(layerId){return this.layers[layerId];};prototype.putLayer=function(layerId,layer){this.clearLayer(layerId);this.removeLayerFromOrderer(this.layers[layerId]);this.layers[layerId]=layer;this.addLayerToOrdered(layer);};prototype.getGroundLayer=function(){return this.getLayer(this.groundLayerId);};prototype.getMainLayer=function(){return this.getLayer(this.mainLayerId);};prototype.getOverlayLayer=function(){return this.getLayer(this.overlayLayerId);};prototype.getTextWidth=function(text,font,fontSize,bold){return stjs.trunc(Math.ceil(this.getMainLayer().computeTextWidth(text,font,fontSize,bold)));};prototype.getLabelWidth=function(text,font,fontSize,bold){return this.getTextWidth(text,font,fontSize,bold)+2*CanvasChartView.LABELS_MARGIN;};prototype.getTextWidthFull=function(text,fontFamily,fontSize,fontStyle){return this.getMainLayer().computeTextWidthFull(text,fontFamily,fontSize,fontStyle);};prototype.setZoomAreaStartPos=function(offsetX,offsetY){this.zoomArea=this.getAreaFromPosition(offsetX,offsetY);this.zoomAreaStartPos=offsetX;};prototype.setCurrentZoomAreaPos=function(offsetX,offsetY){this.zoomAreaEndPos=offsetX;};},{layers:{name:"Map",arguments:[null,"CanvasLayer"]},orderedLayers:{name:"Array",arguments:[null]},zoomAreaColor:"ChartColor",zoomAreaColorGradientParam:{name:"Array",arguments:[null]},zoomArea:"Area",wrapperElement:"SqwJQuery",areasByTypes:{name:"Map",arguments:[null,{name:"Array",arguments:["Area"]}]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},areas:{name:"Map",arguments:[null,"Area"]},layout:"Layout",styleModel:"StyleModel",animationCallback:"Callback0",animationEndCallback:"Callback0",parentElement:"SqwJQuery"},{});
var AggregationStrategy=stjs.enumeration("FIRST","LAST","MEDIAN","AVERAGE","MIN","MAX","SUM","NONE","FIRST_LAST","MIN_MAX");
var ColorStrategy=function(positiveColor,negativeColor){this.positiveColor=positiveColor;this.negativeColor=negativeColor;};ColorStrategy=stjs.extend(ColorStrategy,null,[],function(constructor,prototype){prototype.positiveColor=null;prototype.negativeColor=null;constructor.GREEN_RED=new ColorStrategy(ChartColor.greenOld,ChartColor.redOld);constructor.GREEN_RED_GRADIENT=new ColorStrategy(ChartColor.greenGradient,ChartColor.redGradient);constructor.BLUE_ORANGE=new ColorStrategy(ChartColor.blue,ChartColor.orange);prototype.getColor=function(){return this.getPositiveColor();};prototype.getPositiveColor=function(){return this.positiveColor;};prototype.getNegativeColor=function(){return this.negativeColor;};},{positiveColor:"ChartColor",negativeColor:"ChartColor",GREEN_RED:"ColorStrategy",GREEN_RED_GRADIENT:"ColorStrategy",BLUE_ORANGE:"ColorStrategy"},{});
var AreaBound=function(left,top,width,height){this.left=left;this.top=top;this.width=width;this.height=height;this.visible=true;this.setPadding(0);this.setMargin(0);this.setBorder(0);this.setBorderColor(ChartColor.black);};AreaBound=stjs.extend(AreaBound,null,[],function(constructor,prototype){prototype.left=0.0;prototype.top=0.0;prototype.width=0.0;prototype.height=0.0;prototype.paddingLeft=0.0;prototype.paddingRight=0.0;prototype.paddingTop=0.0;prototype.paddingBottom=0.0;prototype.marginLeft=0.0;prototype.marginRight=0.0;prototype.marginTop=0.0;prototype.marginBottom=0.0;prototype.borderLeft=0.0;prototype.borderRight=0.0;prototype.borderTop=0.0;prototype.borderBottom=0.0;prototype.borderLeftColor=null;prototype.borderRightColor=null;prototype.borderTopColor=null;prototype.borderBottomColor=null;prototype.visible=false;prototype.setLeft=function(left){this.left=left;};prototype.setTop=function(top){this.top=top;};prototype.setWidth=function(width){this.width=width;};prototype.setHeight=function(height){this.height=height;};prototype.getPaddingLeft=function(){return this.paddingLeft;};prototype.setPaddingLeft=function(paddingLeft){this.paddingLeft=paddingLeft;};prototype.getPaddingRight=function(){return this.paddingRight;};prototype.setPaddingRight=function(paddingRight){this.paddingRight=paddingRight;};prototype.getPaddingTop=function(){return this.paddingTop;};prototype.setPaddingTop=function(paddingTop){this.paddingTop=paddingTop;};prototype.getPaddingBottom=function(){return this.paddingBottom;};prototype.setPaddingBottom=function(paddingBottom){this.paddingBottom=paddingBottom;};prototype.getMarginLeft=function(){return this.marginLeft;};prototype.setMarginLeft=function(marginLeft){this.marginLeft=marginLeft;};prototype.getMarginRight=function(){return this.marginRight;};prototype.setMarginRight=function(marginRight){this.marginRight=marginRight;};prototype.getMarginTop=function(){return this.marginTop;};prototype.setMarginTop=function(marginTop){this.marginTop=marginTop;};prototype.getMarginBottom=function(){return this.marginBottom;};prototype.setMarginBottom=function(marginBottom){this.marginBottom=marginBottom;};prototype.getBorderLeft=function(){return this.borderLeft;};prototype.setBorderLeft=function(borderLeft){this.borderLeft=borderLeft;};prototype.getBorderRight=function(){return this.borderRight;};prototype.setBorderRight=function(borderRight){this.borderRight=borderRight;};prototype.getBorderTop=function(){return this.borderTop;};prototype.setBorderTop=function(borderTop){this.borderTop=borderTop;};prototype.getBorderBottom=function(){return this.borderBottom;};prototype.setBorderBottom=function(borderBottom){this.borderBottom=borderBottom;};prototype.getBorderLeftColor=function(){return this.borderLeftColor;};prototype.setBorderLeftColor=function(borderLeftColor){this.borderLeftColor=borderLeftColor;};prototype.getBorderRightColor=function(){return this.borderRightColor;};prototype.setBorderRightColor=function(borderRightColor){this.borderRightColor=borderRightColor;};prototype.getBorderTopColor=function(){return this.borderTopColor;};prototype.setBorderTopColor=function(borderTopColor){this.borderTopColor=borderTopColor;};prototype.getBorderBottomColor=function(){return this.borderBottomColor;};prototype.setBorderBottomColor=function(borderBottomColor){this.borderBottomColor=borderBottomColor;};prototype.setPadding=function(globalPadding){this.paddingLeft=globalPadding;this.paddingRight=globalPadding;this.paddingTop=globalPadding;this.paddingBottom=globalPadding;};prototype.setPaddings=function(paddingLeft,paddingTop,paddingRight,paddingBottom){this.paddingLeft=paddingLeft;this.paddingTop=paddingTop;this.paddingRight=paddingRight;this.paddingBottom=paddingBottom;};prototype.setPaddingsFromArray=function(paddingsArray){if(paddingsArray==null){this.setPadding(0);}else{var left=paddingsArray[0]!=null?paddingsArray[0]:0.0;var top=paddingsArray[1]!=null?paddingsArray[1]:0.0;var right=paddingsArray[2]!=null?paddingsArray[2]:0.0;var bottom=paddingsArray[3]!=null?paddingsArray[3]:0.0;this.setPaddings(left,top,right,bottom);}};prototype.getPaddings=function(){var paddingsArray=[];paddingsArray.push(this.paddingLeft,this.paddingTop,this.paddingRight,this.paddingBottom);return paddingsArray;};prototype.setMargin=function(globalMargin){this.marginLeft=globalMargin;this.marginRight=globalMargin;this.marginTop=globalMargin;this.marginBottom=globalMargin;};prototype.setMargins=function(marginLeft,marginTop,marginRight,marginBottom){this.marginLeft=marginLeft;this.marginTop=marginTop;this.marginRight=marginRight;this.marginBottom=marginBottom;};prototype.setMarginsFromArray=function(marginsArray){if(marginsArray==null){this.setMargin(0);}else{var left=marginsArray[0]!=null?marginsArray[0]:0.0;var top=marginsArray[1]!=null?marginsArray[1]:0.0;var right=marginsArray[2]!=null?marginsArray[2]:0.0;var bottom=marginsArray[3]!=null?marginsArray[3]:0.0;this.setMargins(left,top,right,bottom);}};prototype.getMargins=function(){var marginsArray=[];marginsArray.push(this.marginLeft,this.marginTop,this.marginRight,this.marginBottom);return marginsArray;};prototype.setBorder=function(globalBorder){this.borderLeft=globalBorder;this.borderRight=globalBorder;this.borderTop=globalBorder;this.borderBottom=globalBorder;};prototype.setBorders=function(borderLeft,borderTop,borderRight,borderBottom){this.borderLeft=borderLeft;this.borderTop=borderTop;this.borderRight=borderRight;this.borderBottom=borderBottom;};prototype.setBordersFromArray=function(bordersArray){if(bordersArray==null){this.setBorder(0);}else{var left=bordersArray[0]!=null?bordersArray[0]:0.0;var top=bordersArray[1]!=null?bordersArray[1]:0.0;var right=bordersArray[2]!=null?bordersArray[2]:0.0;var bottom=bordersArray[3]!=null?bordersArray[3]:0.0;this.setBorders(left,top,right,bottom);}};prototype.getBorders=function(){var marginsArray=[];marginsArray.push(this.borderLeft,this.borderTop,this.borderRight,this.borderBottom);return marginsArray;};prototype.setBorderColor=function(globalBorderColor){this.borderLeftColor=globalBorderColor;this.borderRightColor=globalBorderColor;this.borderTopColor=globalBorderColor;this.borderBottomColor=globalBorderColor;};prototype.getLeft=function(){return this.left;};prototype.getTop=function(){return this.top;};prototype.getContentLeft=function(){return this.left+this.marginLeft+this.borderLeft+this.paddingLeft;};prototype.getInnerLeft=function(){return this.left+this.marginLeft+this.borderLeft;};prototype.getInnerRight=function(){return this.getInnerLeft()+this.getInnerWidth();};prototype.getRight=function(){return this.left+this.getOuterWidth(true);};prototype.getContentTop=function(){return this.top+this.marginTop+this.borderTop+this.paddingTop;};prototype.getInnerTop=function(){return this.top+this.marginTop+this.borderTop;};prototype.getInnerBottom=function(){return this.getInnerTop()+this.getInnerHeight();};prototype.getBottom=function(){return this.top+this.getOuterHeight(true);};prototype.getWidth=function(){return this.width;};prototype.getContentWidth=function(){return this.width;};prototype.getInnerWidth=function(){return this.width+this.paddingLeft+this.paddingRight;};prototype.getOuterWidth=function(includeMargin){var outerWidth=this.width+this.paddingLeft+this.paddingRight+this.borderLeft+this.borderRight;if(includeMargin){outerWidth+=(this.marginLeft+this.marginRight);}
return outerWidth;};prototype.getHeight=function(){return this.height;};prototype.getContentHeight=function(){return this.height;};prototype.getInnerHeight=function(){return this.height+this.paddingTop+this.paddingBottom;};prototype.getOuterHeight=function(includeMargin){var outerHeight=this.height+this.paddingTop+this.paddingBottom+this.borderTop+this.borderBottom;if(includeMargin){outerHeight+=(this.marginTop+this.marginBottom);}
return outerHeight;};prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.getInnerLeft()&&y>=this.getInnerTop()&&x<(this.getInnerLeft()+this.getInnerWidth())&&y<(this.getInnerTop()+this.getInnerHeight())){return true;}else{return false;}};prototype.isXInside=function(x){if(x!=null&&x>=this.getInnerLeft()&&x<(this.getInnerLeft()+this.getInnerWidth())){return true;}else{return false;}};prototype.isYInside=function(y){if(y!=null&&y>=this.getInnerTop()&&y<(this.getInnerTop()+this.getInnerHeight())){return true;}else{return false;}};prototype.intersects=function(bound){if(bound==null){return false;}
return!(bound.left>(this.left+this.getOuterWidth(true))||(bound.left+bound.getOuterWidth(true))<this.left||bound.top>(this.top+this.getOuterHeight(true))||(bound.top+bound.getOuterHeight(true))<this.top);};prototype.isVisible=function(){return this.visible&&this.height>0&&this.width>0;};prototype.setVisible=function(visible){this.visible=visible;};prototype.reset=function(){this.left=0;this.top=0;this.width=0;this.height=0;this.visible=true;this.setPadding(0);this.setMargin(0);this.setBorder(0);this.setBorderColor(ChartColor.black);};prototype.getContentBordersLines=function(){var left=stjs.trunc(Math.round(this.getContentLeft()));var right=stjs.trunc(Math.round(this.getContentLeft()+this.width-1));var top=stjs.trunc(Math.round(this.getContentTop()));var bottom=stjs.trunc(Math.round(this.getContentTop()+this.height-1));var topLeft=new Point2D(left,top);var topRight=new Point2D(right,top);var bottomLeft=new Point2D(left,bottom);var bottomRight=new Point2D(right,bottom);var topLine=new Line2D(topLeft,topRight);var leftLine=new Line2D(topLeft,bottomLeft);var bottomLine=new Line2D(bottomLeft,bottomRight);var rightLine=new Line2D(topRight,bottomRight);return[topLine,leftLine,bottomLine,rightLine];};prototype.getInnerBordersLines=function(){var left=stjs.trunc(Math.round(this.getInnerLeft()));var right=stjs.trunc(Math.round(this.getInnerLeft()+this.getInnerWidth()-1));var top=stjs.trunc(Math.round(this.getInnerTop()));var bottom=stjs.trunc(Math.round(this.getInnerTop()+this.getInnerHeight()-1));var topLeft=new Point2D(left,top);var topRight=new Point2D(right,top);var bottomLeft=new Point2D(left,bottom);var bottomRight=new Point2D(right,bottom);var topLine=new Line2D(topLeft,topRight);var leftLine=new Line2D(topLeft,bottomLeft);var bottomLine=new Line2D(bottomLeft,bottomRight);var rightLine=new Line2D(topRight,bottomRight);return[topLine,leftLine,bottomLine,rightLine];};},{borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor"},{});
var Area=function(id,type,areaBound){this.id=id;this.areaBound=areaBound;this.areaType=type;this.elementsByLayer={};this.elementsById={};this.layers={};};Area=stjs.extend(Area,null,[],function(constructor,prototype){prototype.areaBound=null;prototype.id=null;prototype.areaType=null;prototype.elementsByLayer=null;prototype.elementsById=null;prototype.layers=null;prototype.setAreaBound=function(areaBound){this.areaBound=areaBound;};prototype.getAreaBound=function(){return this.areaBound;};prototype.getAreaType=function(){return this.areaType;};prototype.addElement=function(element){if(element==null){return;}
var layerId=element.getLayerId();var elementsInLayer=this.elementsByLayer[layerId];if(elementsInLayer==null){elementsInLayer=[];this.elementsByLayer[layerId]=elementsInLayer;}
elementsInLayer.push(element);this.elementsById[element.getId()]=element;};prototype.addElements=function(elements){for(var index in elements){if(!(elements).hasOwnProperty(index))
continue;this.addElement(elements[index]);}};prototype.isInside=function(x,y){if(x==null||y==null||isNaN(x)||isNaN(y)){return false;}else{return this.areaBound.isInside(x,y);}};prototype.renderLayer=function(layer){if(layer!=null){this.renderLayerById(layer.getId());}};prototype.render=function(){for(var layerId in this.elementsByLayer){this.renderLayerById(layerId);}};prototype.clearLayer=function(layer){if(layer!=null){layer.clearArea(this.areaBound);this.clearElementsInLayer(layer.getId());}};prototype.clear=function(){for(var layerId in this.layers){this.clearLayer(this.layers[layerId]);}
this.clearElements();};prototype.clearShape=function(layerId,shape){};prototype.clearElements=function(){this.elementsByLayer={};this.elementsById={};this.layers={};};prototype.clearElementsInLayer=function(layerId){var elementsInLayer=this.elementsByLayer[layerId];var elementsInLayerCount=elementsInLayer!=null?elementsInLayer.length:0;for(var i=0;i<elementsInLayerCount;i++){var currentElement=elementsInLayer[i];if(currentElement!=null){delete this.elementsById[currentElement.getId()];}}
delete this.elementsByLayer[layerId];delete this.layers[layerId];};prototype.renderLayerById=function(layerId){if(layerId==null||this.areaBound==null||!this.areaBound.isVisible()){return;}
var elementsToBeRendered=null;if(this.elementsByLayer!=null){elementsToBeRendered=this.elementsByLayer[layerId];}
var elementsCount=elementsToBeRendered!=null?elementsToBeRendered.length:0;for(var i=0;i<elementsCount;i++){var currentElement=elementsToBeRendered[i];if(currentElement!=null){currentElement.render();}}};prototype.getElement=function(id){if(this.elementsById==null){return null;}
return this.elementsById[id];};prototype.getElementsByLayer=function(layerId){return this.elementsByLayer[layerId];};prototype.isPointInside=function(currentPosition){if(currentPosition==null){return false;}
var x=currentPosition.getX();var y=currentPosition.getY();return this.isInside(x,y);};prototype.getId=function(){return this.id;};},{areaBound:"AreaBound",areaType:{name:"Enum",arguments:["ChartView.AreaType"]},elementsByLayer:{name:"Map",arguments:[null,{name:"Array",arguments:["sq.ChartElement"]}]},elementsById:{name:"Map",arguments:[null,"sq.ChartElement"]},layers:{name:"Map",arguments:[null,"Layer"]}},{});
var Layer=function(width,height){this.width=width;this.height=height;this.id=Layer.LAYER+new Date().getTime()+"_"+Math.round((Math.random()*100000));this.zIndex=0;};Layer=stjs.extend(Layer,null,[],function(constructor,prototype){constructor.LAYER="layer";prototype.id=null;prototype.zIndex=0;prototype.width=0;prototype.height=0;prototype.implementation=null;prototype.clear=function(){};prototype.clearArea=function(areaBound){};prototype.attachTo=function(element){};prototype.detach=function(){};prototype.drawRotatedImage=function(image,angle){};prototype.drawImage=function(image,x,y){};prototype.computeTextWidth=function(text,font,fontSize,bold){};prototype.computeTextWidthFull=function(text,fontFamily,fontSize,fontStyle){};prototype.getImplementation=function(){return this.implementation;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getZIndex=function(){return this.zIndex;};prototype.setzIndex=function(zIndex){this.zIndex=zIndex;};},{implementation:{name:"Enum",arguments:["ChartOption.Implementation"]}},{});
var CanvasLayer=function(width,height){Layer.call(this,width,height);this.implementation=ChartOption.Implementation.CANVAS;this.canvas=window.document.createElement("canvas");this.canvas.setAttribute("width",String.valueOf(width));this.canvas.setAttribute("height",String.valueOf(height));if(this.canvas.getContext){this.canvasContext=this.canvas.getContext("2d");}
$(this.canvas).addClass(CanvasLayer.CSS_CANVAS_CLASS);};CanvasLayer=stjs.extend(CanvasLayer,Layer,[],function(constructor,prototype){constructor.CSS_CANVAS_CLASS="chart-canvas-element";prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height);};prototype.attachTo=function(element){element.append(this.canvas);if(!this.canvas.getContext&&(typeof G_vmlCanvasManager)!="undefined"){this.canvas=G_vmlCanvasManager.initElement(this.canvas);this.canvasContext=this.canvas.getContext("2d");}};prototype.detach=function(){SQW.$(this.canvas).detach();};prototype.setWidth=function(width){Layer.prototype.setWidth.call(this,width);this.canvas.width=width;};prototype.setHeight=function(height){Layer.prototype.setHeight.call(this,height);this.canvas.height=height;};prototype.getCanvas=function(){return this.canvas;};prototype.getCanvasRenderingContext2D=function(){return this.canvasContext;};prototype.drawRotatedImage=function(image,angle){var context=this.getCanvasRenderingContext2D();var centerX=stjs.trunc(Math.round(this.getWidth()/2.0));var centerY=stjs.trunc(Math.round(this.getHeight()/2.0));context.save();context.translate(centerX,centerY);context.rotate(angle);this.drawImage(image,stjs.trunc(-Math.round(image.width/2.0)),stjs.trunc(-Math.round(image.height/2.0)));context.restore();};prototype.drawImage=function(image,x,y){if(image==null){return;}
var context=this.getCanvasRenderingContext2D();context.drawImage(image,x,y,image.width,image.height);};prototype.clearArea=function(areaBound){if(areaBound!=null){var left=stjs.trunc(Math.round(areaBound.getLeft()));var top=stjs.trunc(Math.round(areaBound.getTop()));var width=stjs.trunc(Math.round(areaBound.getOuterWidth(true)));var height=stjs.trunc(Math.round(areaBound.getOuterHeight(true)));this.canvasContext.clearRect(left,top,width,height);}};prototype.computeTextWidth=function(text,font,fontSize,bold){if(text==null){return 0;}
var option="";if(bold){option+="bold ";}
this.canvasContext.save();this.canvasContext.font=option+fontSize+"px "+font;var metrics=this.canvasContext.measureText(text);this.canvasContext.restore();return metrics.width;};prototype.computeTextWidthFull=function(text,fontFamily,fontSize,fontStyle){if(text==null){return 0;}
this.canvasContext.save();this.canvasContext.font=fontStyle+" "+fontSize+"px "+fontFamily;var metrics=this.canvasContext.measureText(text);this.canvasContext.restore();return metrics.width;};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",implementation:{name:"Enum",arguments:["ChartOption.Implementation"]}},{});
var Layout=function(){this.areas={};};Layout=stjs.extend(Layout,null,[],function(constructor,prototype){constructor.Position=stjs.enumeration("LEFT","RIGHT","TOP","BOTTOM","CENTER","NONE");prototype.areas=null;prototype.currentWidth=0;prototype.currentHeight=0;prototype.getAreas=function(){return this.areas;};prototype.refresh=function(chartView,width,height){};prototype.init=function(styleModel){};prototype.updateTitleArea=function(newTitleHeight){};prototype.updateYAxis=function(){};},{areas:{name:"Map",arguments:[null,"Area"]}},{});
var DefaultLayout=function(){Layout.call(this);this.areasStyle={};this.areasBound={};this.titleHeight=null;this.currentFontSize=DefaultLayout.NORMAL_FONTS;};DefaultLayout=stjs.extend(DefaultLayout,Layout,[],function(constructor,prototype){constructor.DEFAULT_PADDING_PIXELS=3;constructor.TITLE_PADDING_BOTTOM=10;constructor.DEFAULT_LABEL_VALUE="55555";constructor.DEFAULT_PERCENT_LABEL_VALUE="-55.55%";constructor.NORMAL_FONTS="normal";constructor.SMALL_FONTS="small";constructor.MINIMUM_WIDTH_FOR_NORMAL_FONT=360;constructor.MINIMUM_HEIGHT_FOR_NORMAL_FONT=200;constructor.TITLE_AREA="titleAreaId";constructor.GRAPH_AREA="graphAreaId";constructor.X_AXIS_AREA="xAxisAreaId";constructor.Y1_AXIS_AREA="y1AxisAreaId";constructor.Y2_AXIS_AREA="y2AxisAreaId";constructor.LEGEND_AREA="legendAreaId";constructor.TOOLTIP_AREA="tooltipAreaId";prototype.areasStyle=null;prototype.areasBound=null;prototype.globalStyle=null;prototype.titleHeight=null;prototype.currentFontSize=null;prototype.init=function(styleModel){this.globalStyle=styleModel.getGlobalStyle();this.addArea(DefaultLayout.TITLE_AREA,ChartView.AreaType.TITLE,styleModel.getTitleStyle());this.addArea(DefaultLayout.Y1_AXIS_AREA,ChartView.AreaType.AXIS,styleModel.getY1AxisStyle());this.addArea(DefaultLayout.Y2_AXIS_AREA,ChartView.AreaType.AXIS,styleModel.getY2AxisStyle());this.addArea(DefaultLayout.X_AXIS_AREA,ChartView.AreaType.AXIS,styleModel.getXAxisStyle());this.addArea(DefaultLayout.GRAPH_AREA,ChartView.AreaType.GRAPH,styleModel.getGraphStyle());this.addArea(DefaultLayout.LEGEND_AREA,ChartView.AreaType.LEGEND,styleModel.getLegendStyle());this.addArea(DefaultLayout.TOOLTIP_AREA,ChartView.AreaType.TOOLTIP,styleModel.getTooltipStyle());};prototype.addArea=function(areaId,type,areaStyle){var bound=new AreaBound(0,0,0,0);var newArea=new Area(areaId,type,bound);this.areas[areaId]=newArea;this.areasStyle[areaId]=areaStyle;this.areasBound[areaId]=bound;};prototype.removeArea=function(areaId,areaStyle){delete this.areas[areaId];delete this.areasStyle[areaId];};prototype.updateTitleArea=function(newHeight){var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];var previousHeight=titleAreaBound.getHeight();if(newHeight>0){titleAreaBound.setHeight(newHeight);titleAreaBound.setVisible(true);}else{newHeight=0;titleAreaBound.setVisible(false);}
this.titleHeight=newHeight;var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var diff=newHeight-previousHeight;var newYStartPos=graphAreaBound.getTop()+diff;var newChartHeight=graphAreaBound.getHeight()-diff;graphAreaBound.setTop(newYStartPos);graphAreaBound.setHeight(newChartHeight);var y1AxisAreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];y1AxisAreaBound.setTop(newYStartPos);y1AxisAreaBound.setHeight(newChartHeight);var y2AxisAreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];y2AxisAreaBound.setTop(newYStartPos);y2AxisAreaBound.setHeight(newChartHeight);};prototype.updateYAxis=function(){var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var y1AreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];var y2AreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];var y1PreviousWidth=y1AreaBound.getWidth();var y2PreviousWidth=y2AreaBound.getWidth();var leftAxisNewWidth;var leftAxisPreviousWidth;var rightAxisNewWidth;var rightAxisPreviousWidth;var y1Left=true;var rightAxisOldLeft=0;var y1NewWidth=y1AxisStyle!=null?y1AxisStyle.getWidth(this.currentWidth):0;var y2NewWidth=y2AxisStyle!=null?y2AxisStyle.getWidth(this.currentWidth):0;var y1Pos=y1AxisStyle!=null?y1AxisStyle.getPosition():null;var y2Pos=y2AxisStyle!=null?y2AxisStyle.getPosition():null;if(y1Pos==null||y1Pos==Layout.Position.NONE||y1NewWidth==null||y1NewWidth<=0){y1NewWidth=0;y1AreaBound.setVisible(false);}else{y1AreaBound.setVisible(true);}
if(y2Pos==null||y2Pos==Layout.Position.NONE||y2NewWidth==null||y2NewWidth<=0){y2NewWidth=0;y2AreaBound.setVisible(false);}else{y2AreaBound.setVisible(true);}
if(y1Pos==Layout.Position.LEFT||y2Pos==Layout.Position.RIGHT){leftAxisNewWidth=y1NewWidth;leftAxisPreviousWidth=y1PreviousWidth;rightAxisNewWidth=y2NewWidth;rightAxisPreviousWidth=y2PreviousWidth;rightAxisOldLeft=y2AreaBound.getLeft();}else{rightAxisNewWidth=y1NewWidth;rightAxisPreviousWidth=y1PreviousWidth;leftAxisNewWidth=y2NewWidth;leftAxisPreviousWidth=y2PreviousWidth;y1Left=false;rightAxisOldLeft=y1AreaBound.getLeft();}
var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var leftAxisDiff=leftAxisNewWidth-leftAxisPreviousWidth;var newChartLeft=graphAreaBound.getLeft()+leftAxisDiff;var rightAxisDiff=rightAxisNewWidth-rightAxisPreviousWidth;var rightAxisNewLeft=rightAxisOldLeft-rightAxisDiff;var newChartWidth=graphAreaBound.getWidth()-leftAxisDiff-rightAxisDiff;graphAreaBound.setLeft(newChartLeft);graphAreaBound.setWidth(newChartWidth);var y1AxisAreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];if(!y1Left){y1AxisAreaBound.setLeft(rightAxisNewLeft);}
y1AxisAreaBound.setWidth(y1NewWidth);var y2AxisAreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];if(y1Left){y2AxisAreaBound.setLeft(rightAxisNewLeft);}
y2AxisAreaBound.setWidth(y2NewWidth);var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];titleAreaBound.setLeft(newChartLeft);titleAreaBound.setWidth(newChartWidth);var xAreaBound=this.areasBound[DefaultLayout.X_AXIS_AREA];xAreaBound.setLeft(newChartLeft);xAreaBound.setWidth(newChartWidth);var legendAreaBound=this.areasBound[DefaultLayout.LEGEND_AREA];legendAreaBound.setLeft(newChartLeft);legendAreaBound.setWidth(newChartWidth);};prototype.refresh=function(chartView,width,height){this.currentWidth=width;this.currentHeight=height;this.updateFontsSize(width,height);var chartXStartPos=0;var chartYStartPos=0;var chartWidth=width;var chartHeight=height;var titleHeight=0;var titleYStartPos=0;var xHeight=0;var xAxisYStartPos=0;var y1Width=0;var y1AxisXStartPos=0;var y2Width=0;var y2AxisXStartPos=0;var legendHeight=0;var legendYStartPos=0;var titlePaddingTop=0;var titlePaddingBottom=0;var xAxisPaddingTop=0;var xAxisPaddingBottom=0;var y1AxisPaddingLeft=0;var y1AxisPaddingRight=0;var y2AxisPaddingLeft=0;var y2AxisPaddingRight=0;var legendPaddingTop=0;var legendPaddingBottom=0;var globalMarginLeft=this.globalStyle.getMarginLeft(width);var globalMarginRight=this.globalStyle.getMarginRight(width);var globalMarginTop=this.globalStyle.getMarginTop(height);var globalMarginBottom=this.globalStyle.getMarginBottom(height);chartXStartPos+=globalMarginLeft;chartYStartPos+=globalMarginTop;chartWidth-=(globalMarginLeft+globalMarginRight);chartHeight-=(globalMarginTop+globalMarginBottom);var graphStyle=this.areasStyle[DefaultLayout.GRAPH_AREA];var titleStyle=this.areasStyle[DefaultLayout.TITLE_AREA];var legendStyle=this.areasStyle[DefaultLayout.LEGEND_AREA];var xAxisStyle=this.areasStyle[DefaultLayout.X_AXIS_AREA];var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var xAxisPosition=xAxisStyle.getPosition();var y1AxisPosition=y1AxisStyle.getPosition();var y2AxisPosition=y2AxisStyle.getPosition();if(titleStyle.isVisible()){titleHeight=this.titleHeight;if(this.titleHeight==null){titleHeight=titleStyle.getFontSize();if(titleStyle.isPopoverAllowed()){titleHeight=stjs.trunc(Math.max(titleHeight,titleStyle.getZoomIconSize()));}}
titlePaddingTop=0;titlePaddingBottom=DefaultLayout.TITLE_PADDING_BOTTOM;var titleOuterHeight=(titleHeight+titlePaddingTop+titlePaddingBottom);titleYStartPos=chartYStartPos;chartHeight-=titleOuterHeight;chartYStartPos+=titleOuterHeight;}
if(legendStyle.isVisible()){legendHeight=legendStyle.getHeight(height);legendPaddingTop=legendStyle.getPaddingTop(height);legendPaddingBottom=legendStyle.getPaddingBottom(height);var legendOuterHeight=(legendHeight+legendPaddingTop+titlePaddingBottom);chartHeight-=legendOuterHeight;if(xAxisPosition==Layout.Position.TOP){legendYStartPos=chartYStartPos;chartYStartPos+=legendOuterHeight;}else if(xAxisPosition==Layout.Position.BOTTOM){legendYStartPos=chartYStartPos+chartHeight;}else{chartHeight+=legendOuterHeight;legendHeight=0;}}
if(xAxisPosition!=Layout.Position.NONE){xHeight=xAxisStyle.getFontSize();xAxisPaddingTop=xAxisStyle.getPaddingTop(chartHeight);xAxisPaddingBottom=xAxisStyle.getPaddingBottom(chartHeight);var xAxisOuterHeight=(xHeight+xAxisPaddingTop+xAxisPaddingBottom);var addSpaceForTicks=height>=DefaultLayout.MINIMUM_HEIGHT_FOR_NORMAL_FONT&&xAxisStyle.isShowAxisTicks();if(addSpaceForTicks){xAxisOuterHeight+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
chartHeight-=xAxisOuterHeight;if(xAxisPosition==Layout.Position.TOP){var tmp=xAxisPaddingTop;xAxisPaddingTop=xAxisPaddingBottom;xAxisPaddingBottom=tmp;if(addSpaceForTicks){xAxisPaddingBottom+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
xAxisYStartPos=chartYStartPos;chartYStartPos+=xAxisOuterHeight;}else if(xAxisPosition==Layout.Position.BOTTOM){if(addSpaceForTicks){xAxisPaddingTop+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
xAxisYStartPos=chartYStartPos+chartHeight;}else{chartHeight+=xAxisOuterHeight;xHeight=0;}}
if(y1AxisPosition!=Layout.Position.NONE){var currentY1Width=y1AxisStyle.getWidth(width);if(currentY1Width==null){y1Width=chartView.getLabelWidth(DefaultLayout.DEFAULT_LABEL_VALUE,y1AxisStyle.getFont(),y1AxisStyle.getFontSize(),false);}else{y1Width=currentY1Width;}
y1AxisPaddingLeft=DefaultLayout.DEFAULT_PADDING_PIXELS;y1AxisPaddingRight=DefaultLayout.DEFAULT_PADDING_PIXELS;var y1OuterWidth=y1Width+y1AxisPaddingLeft+y1AxisPaddingRight;var addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&y1AxisStyle.isShowAxisTicks();if(addSpaceForTicks){y1OuterWidth+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
chartWidth-=y1OuterWidth;if(y1AxisPosition==Layout.Position.LEFT){if(addSpaceForTicks){y1AxisPaddingRight+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y1AxisXStartPos=chartXStartPos;chartXStartPos+=y1OuterWidth;}else if(y1AxisPosition==Layout.Position.RIGHT){if(addSpaceForTicks){y1AxisPaddingLeft+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y1AxisXStartPos=chartXStartPos+chartWidth;}else{chartWidth+=y1OuterWidth;y1Width=0;}}
if(y2AxisPosition!=Layout.Position.NONE&&y2AxisPosition!=y1AxisPosition){var currentY2Width=y2AxisStyle.getWidth(width);if(currentY2Width==null){y2Width=chartView.getLabelWidth(DefaultLayout.DEFAULT_PERCENT_LABEL_VALUE,y2AxisStyle.getFont(),y2AxisStyle.getFontSize(),false);}else{y2Width=currentY2Width;}
y2AxisPaddingLeft=DefaultLayout.DEFAULT_PADDING_PIXELS;y2AxisPaddingRight=DefaultLayout.DEFAULT_PADDING_PIXELS;var y2OuterWidth=y2Width+y2AxisPaddingLeft+y2AxisPaddingRight;var addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&y2AxisStyle.isShowAxisTicks();if(addSpaceForTicks){y2OuterWidth+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
chartWidth-=y2OuterWidth;if(y2AxisPosition==Layout.Position.LEFT){if(addSpaceForTicks){y2AxisPaddingRight+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y2AxisXStartPos=chartXStartPos;chartXStartPos+=y2OuterWidth;}else if(y2AxisPosition==Layout.Position.RIGHT){if(addSpaceForTicks){y2AxisPaddingLeft+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y2AxisXStartPos=chartXStartPos+chartWidth;}else{chartWidth+=y2OuterWidth;y2Width=0;}}
var paddingLeft=graphStyle.getPaddingLeft(chartWidth);var paddingRight=graphStyle.getPaddingRight(chartWidth);var paddingTop=graphStyle.getPaddingTop(chartHeight);var paddingBottom=graphStyle.getPaddingBottom(chartHeight);chartWidth-=(paddingLeft+paddingRight);chartHeight-=(paddingTop+paddingBottom);var borderLeft=graphStyle.getBorderLeft();var borderRight=graphStyle.getBorderRight();var borderTop=graphStyle.getBorderTop();var borderBottom=graphStyle.getBorderBottom();chartWidth-=(borderLeft+borderRight);chartHeight-=(borderTop+borderBottom);var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];graphAreaBound.reset();graphAreaBound.setLeft(chartXStartPos);graphAreaBound.setTop(chartYStartPos);graphAreaBound.setWidth(chartWidth);graphAreaBound.setHeight(chartHeight);graphAreaBound.setPaddings(paddingLeft,paddingTop,paddingRight,paddingBottom);graphAreaBound.setMargins(globalMarginLeft,globalMarginTop,globalMarginRight,globalMarginBottom);graphAreaBound.setBorders(borderLeft,borderTop,borderRight,borderBottom);var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];titleAreaBound.reset();if(titleHeight>0){titleAreaBound.setLeft(chartXStartPos);titleAreaBound.setTop(titleYStartPos);titleAreaBound.setWidth(chartWidth);titleAreaBound.setHeight(titleHeight);titleAreaBound.setPaddingTop(titlePaddingTop);titleAreaBound.setPaddingBottom(titlePaddingBottom);titleAreaBound.setPaddingLeft(paddingLeft);titleAreaBound.setPaddingRight(paddingRight);titleAreaBound.setMarginLeft(borderLeft+globalMarginLeft);titleAreaBound.setMarginRight(borderRight+globalMarginRight);}
var xAxisAreaBound=this.areasBound[DefaultLayout.X_AXIS_AREA];xAxisAreaBound.reset();if(xHeight>0){xAxisAreaBound.setLeft(chartXStartPos);xAxisAreaBound.setTop(xAxisYStartPos);xAxisAreaBound.setWidth(chartWidth);xAxisAreaBound.setHeight(xHeight);xAxisAreaBound.setPaddingTop(xAxisPaddingTop);xAxisAreaBound.setPaddingBottom(xAxisPaddingBottom);xAxisAreaBound.setPaddingLeft(paddingLeft);xAxisAreaBound.setPaddingRight(paddingRight);xAxisAreaBound.setMarginLeft(borderLeft+globalMarginLeft);xAxisAreaBound.setMarginRight(borderRight+globalMarginRight);}
var y1AxisAreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];y1AxisAreaBound.reset();y1AxisAreaBound.setLeft(y1AxisXStartPos);y1AxisAreaBound.setTop(chartYStartPos);y1AxisAreaBound.setWidth(y1Width);y1AxisAreaBound.setHeight(chartHeight);y1AxisAreaBound.setPaddingLeft(y1AxisPaddingLeft);y1AxisAreaBound.setPaddingRight(y1AxisPaddingRight);y1AxisAreaBound.setPaddingTop(paddingTop);y1AxisAreaBound.setPaddingBottom(paddingBottom);y1AxisAreaBound.setMarginTop(borderTop+globalMarginTop);y1AxisAreaBound.setMarginBottom(borderBottom+globalMarginBottom);if(y1Width<=0){y1AxisAreaBound.setVisible(false);}
var y2AxisAreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];y2AxisAreaBound.reset();y2AxisAreaBound.setLeft(y2AxisXStartPos);y2AxisAreaBound.setTop(chartYStartPos);y2AxisAreaBound.setWidth(y2Width);y2AxisAreaBound.setHeight(chartHeight);y2AxisAreaBound.setPaddingLeft(y2AxisPaddingLeft);y2AxisAreaBound.setPaddingRight(y2AxisPaddingRight);y2AxisAreaBound.setPaddingTop(paddingTop);y2AxisAreaBound.setPaddingBottom(paddingBottom);y2AxisAreaBound.setMarginTop(borderTop+globalMarginTop);y2AxisAreaBound.setMarginBottom(borderBottom+globalMarginBottom);if(y2Width<=0){y2AxisAreaBound.setVisible(false);}
var legendAreaBound=this.areasBound[DefaultLayout.LEGEND_AREA];legendAreaBound.reset();if(legendHeight>0){legendAreaBound.setLeft(chartXStartPos);legendAreaBound.setTop(legendYStartPos);legendAreaBound.setWidth(chartWidth);legendAreaBound.setHeight(legendHeight);legendAreaBound.setPaddingTop(legendPaddingTop);legendAreaBound.setPaddingBottom(legendPaddingBottom);legendAreaBound.setPaddingLeft(paddingLeft);legendAreaBound.setPaddingRight(paddingRight);}};prototype.updateFontsSize=function(width,height){var titleStyle=this.areasStyle[DefaultLayout.TITLE_AREA];var xAxisStyle=this.areasStyle[DefaultLayout.X_AXIS_AREA];var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var legendStyle=this.areasStyle[DefaultLayout.LEGEND_AREA];if(width<DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT||height<DefaultLayout.MINIMUM_HEIGHT_FOR_NORMAL_FONT){if(this.currentFontSize!=DefaultLayout.SMALL_FONTS){this.currentFontSize=DefaultLayout.SMALL_FONTS;titleStyle.setFontSize(titleStyle.getFontSize()-1);titleStyle.setTitleFontSize(titleStyle.getTitleFontSize()-1);titleStyle.setValueFontSize(titleStyle.getValueFontSize()-1);titleStyle.setCopyrightFontSize(titleStyle.getCopyrightFontSize()-1);titleStyle.setZoomIconSize(titleStyle.getZoomIconSize());legendStyle.setFontSize(legendStyle.getFontSize()-1);legendStyle.setLabelsHeight(legendStyle.getLabelsHeight()-1);xAxisStyle.setFontSize(xAxisStyle.getFontSize()-1);xAxisStyle.setLabelsHeight(xAxisStyle.getLabelsHeight()-1);y1AxisStyle.setFontSize(y1AxisStyle.getFontSize()-1);y1AxisStyle.setLabelsHeight(y1AxisStyle.getLabelsHeight()-1);y2AxisStyle.setFontSize(y2AxisStyle.getFontSize()-1);y2AxisStyle.setLabelsHeight(y2AxisStyle.getLabelsHeight()-1);}}else{if(this.currentFontSize!=DefaultLayout.NORMAL_FONTS){this.currentFontSize=DefaultLayout.NORMAL_FONTS;titleStyle.setFontSize(titleStyle.getFontSize()+1);titleStyle.setTitleFontSize(titleStyle.getTitleFontSize()+1);titleStyle.setValueFontSize(titleStyle.getValueFontSize()+1);titleStyle.setCopyrightFontSize(titleStyle.getCopyrightFontSize()+1);titleStyle.setZoomIconSize(titleStyle.getZoomIconSize()+5);legendStyle.setFontSize(legendStyle.getFontSize()+1);legendStyle.setLabelsHeight(legendStyle.getLabelsHeight()+1);xAxisStyle.setFontSize(xAxisStyle.getFontSize()+1);xAxisStyle.setLabelsHeight(xAxisStyle.getLabelsHeight()+1);y1AxisStyle.setFontSize(y1AxisStyle.getFontSize()+1);y1AxisStyle.setLabelsHeight(y1AxisStyle.getLabelsHeight()+1);y2AxisStyle.setFontSize(y2AxisStyle.getFontSize()+1);y2AxisStyle.setLabelsHeight(y2AxisStyle.getLabelsHeight()+1);}}};},{areasStyle:{name:"Map",arguments:[null,"Style"]},areasBound:{name:"Map",arguments:[null,"AreaBound"]},globalStyle:"GlobalStyle",areas:{name:"Map",arguments:[null,"Area"]}},{});
stjs.ns("sq");sq.ChartElement=function(layer){this.id=this.createId();this.highlightMode=sq.ChartElement.HIGHLIGHT.NONE;this.hoverMode=sq.ChartElement.HOVER.NONE;this.layer=layer;};sq.ChartElement=stjs.extend(sq.ChartElement,null,[],function(constructor,prototype){constructor.ELEMENT_PREFIX="element";constructor.HIGHLIGHT=stjs.enumeration("NONE","CHANGE_COLOR","FISH_EYE","COLOR_FISH_EYE","CIRLCE");constructor.HOVER=stjs.enumeration("NONE","CHANGE_COLOR","FISH_EYE","COLOR_FISH_EYE","CIRCLE");prototype.layer=null;prototype.id=null;prototype.x=0;prototype.y=0;prototype.highlightMode=null;prototype.hoverMode=null;prototype.highlightColor=null;prototype.hoverColor=null;prototype.groupColor=null;prototype.highlightColorGradientParam=null;prototype.hoverColorGradientParam=null;prototype.groupColorGradientParam=null;prototype.clear=function(){};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.copyTo=function(layer){};prototype.copyFieldsTo=function(copyElement){if(copyElement==null){return;}
copyElement.highlightMode=this.highlightMode;copyElement.hoverMode=this.hoverMode;copyElement.highlightColor=this.highlightColor;copyElement.hoverColor=this.hoverColor;copyElement.groupColor=this.groupColor;if(this.highlightColorGradientParam!=null){copyElement.highlightColorGradientParam=SQW.$.extend([],this.highlightColorGradientParam);}
if(this.hoverColorGradientParam!=null){copyElement.hoverColorGradientParam=SQW.$.extend([],this.hoverColorGradientParam);}
if(this.groupColorGradientParam!=null){copyElement.groupColorGradientParam=SQW.$.extend([],this.groupColorGradientParam);}};prototype.getLayer=function(){return this.layer;};prototype.setLayer=function(layer){this.layer=layer;};prototype.getHighlightMode=function(){return this.highlightMode;};prototype.setHighlightMode=function(highlightMode){this.highlightMode=highlightMode;};prototype.getHoverMode=function(){return this.hoverMode;};prototype.setHoverMode=function(hoverMode){this.hoverMode=hoverMode;};prototype.getHighlightColor=function(){return this.highlightColor;};prototype.setHighlightColor=function(highlightColor){this.highlightColor=highlightColor;};prototype.getHoverColor=function(){return this.hoverColor;};prototype.setHoverColor=function(hoverColor){this.hoverColor=hoverColor;};prototype.getGroupColor=function(){return this.groupColor;};prototype.setGroupColor=function(groupColor){this.groupColor=groupColor;};prototype.getHighlightColorGradientParam=function(){return this.highlightColorGradientParam;};prototype.setHighlightColorGradientParam=function(highlightColorGradientParam){this.highlightColorGradientParam=highlightColorGradientParam;};prototype.getHoverColorGradientParam=function(){return this.hoverColorGradientParam;};prototype.setHoverColorGradientParam=function(hoverColorGradientParam){this.hoverColorGradientParam=hoverColorGradientParam;};prototype.getGroupColorGradientParam=function(){return this.groupColorGradientParam;};prototype.setGroupColorGradientParam=function(groupColorGradientParam){this.groupColorGradientParam=groupColorGradientParam;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.createId=function(){return sq.ChartElement.ELEMENT_PREFIX+new Date().getTime()+"_"+Math.round((Math.random()*100000));};prototype.isInside=function(offsetX,offsetY){};prototype.getLayerId=function(){return this.layer!=null?this.layer.getId():null;};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};},{highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var ToolTipComponent=function(layer){sq.ChartElement.call(this,layer);this.data=[];this.formatter=new AbbreviateNumberFormatter();};ToolTipComponent=stjs.extend(ToolTipComponent,sq.ChartElement,[],function(constructor,prototype){constructor.ID="id";constructor.CLASS="class";constructor.NAME="name";constructor.VALUE="value";constructor.NAME_STYLE="name_style";constructor.VALUE_STYLE="value_style";constructor.ELEMENT_STYLE="element_style";constructor.CLASS_STYLE="class_style";prototype.longestValue=null;prototype.longestName=null;prototype.data=null;prototype.header=null;prototype.style=null;prototype.parent=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParam=null;prototype.formatter=null;prototype.fontFamily=null;prototype.fontSize=0;prototype.fontStyle=null;prototype.fontColor=null;prototype.width=0;prototype.height=0;prototype.ySpace=0;prototype.xSpace=0;prototype.nameWidth=0;prototype.valueWidth=0;prototype.init=function(layer,parent,x,y,width,height){this.layer=layer;this.parent=parent;this.x=x;this.y=y;this.width=width;this.height=height;this.backgroundColor=this.style.getBackgroundColor();this.backgroundColorGradientParam=this.style.getBackgroundColorGradientParams();};prototype.parseData=function(){if(this.parent==null){return;}
var res=[];var rawData=this.parent.getData();for(var key in rawData){var e=new ToolTipRow();e.setName(key);var value=rawData[key];var formattedValue=value.toString();if(stjs.isInstanceOf(value.constructor,Double)){formattedValue=this.formatter.format(value);}
e.setValue(formattedValue);res.push(e);}
this.setData(res);};prototype.configStyle=function(style){this.style=style;var nameStyle=this.style.getNameStyle();var valueStyle=this.style.getValueStyle();for(var i=0;i<this.data.length;i++){var e=this.data[i];e.setNameStyle(nameStyle);e.setValueStyle(valueStyle);}
if(this.header!=null){this.style.customeHeaderStyle(this.header);}
this.style.customElementStyle(this.data);};prototype.calFontStyle=function(style,fontStyles){if(style==null||fontStyles==null||fontStyles.length!=4){return;}
var defaultFontFamily=fontStyles[0];var defaultFontStyle=fontStyles[1];var defaultFontSize=fontStyles[2];var defaultFontColor=fontStyles[3];fontStyles[0]=style["fontFamily"]!=null?style["fontFamily"]:defaultFontFamily;fontStyles[1]=style["fontSize"]!=null?style["fontSize"]:defaultFontStyle;fontStyles[2]=style["fontStyle"]!=null?style["fontStyle"]:defaultFontSize;fontStyles[3]=style["fontColor"]!=null?style["fontColor"]:defaultFontColor;};prototype.getData=function(){return this.data;};prototype.setData=function(data){this.data=data;};prototype.getParent=function(){return this.parent;};prototype.setParent=function(parent){this.parent=parent;};prototype.getLongestValue=function(){return this.longestValue;};prototype.setLongestValue=function(longestValue){this.longestValue=longestValue;};prototype.getLongestName=function(){return this.longestName;};prototype.setLongestName=function(longestName){this.longestName=longestName;};prototype.getStyle=function(){return this.style;};prototype.setStyle=function(style){this.style=style;};prototype.getHeader=function(){return this.header;};prototype.setHeader=function(header){this.header=header;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParam=function(){return this.backgroundColorGradientParam;};prototype.setBackgroundColorGradientParam=function(backgroundColorGradientParam){this.backgroundColorGradientParam=backgroundColorGradientParam;};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getySpace=function(){return this.ySpace;};prototype.setySpace=function(ySpace){this.ySpace=ySpace;};prototype.getxSpace=function(){return this.xSpace;};prototype.setxSpace=function(xSpace){this.xSpace=xSpace;};prototype.getNameWidth=function(){return this.nameWidth;};prototype.setNameWidth=function(nameWidth){this.nameWidth=nameWidth;};prototype.getValueWidth=function(){return this.valueWidth;};prototype.setValueWidth=function(valueWidth){this.valueWidth=valueWidth;};prototype.getFontFamily=function(){return this.fontFamily;};prototype.setFontFamily=function(fontFamily){this.fontFamily=fontFamily;};prototype.getFontSize=function(){return this.fontSize;};prototype.setFontSize=function(fontSize){this.fontSize=fontSize;};prototype.getFontStyle=function(){return this.fontStyle;};prototype.setFontStyle=function(fontStyle){this.fontStyle=fontStyle;};prototype.getFontColor=function(){return this.fontColor;};prototype.setFontColor=function(fontColor){this.fontColor=fontColor;};},{data:{name:"Array",arguments:["ToolTipRow"]},header:"ToolTipRow",style:"ToolTipStyle",parent:"Shape",backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},formatter:"AbbreviateNumberFormatter",fontColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasToolTip=function(){ToolTipComponent.call(this,null);};CanvasToolTip=stjs.extend(CanvasToolTip,ToolTipComponent,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.init=function(layer,parent,x,y,width,height){ToolTipComponent.prototype.init.call(this,layer,parent,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};prototype.clear=function(){this.canvasContext.clearRect(this.x,this.y,this.width,this.height);};prototype.render=function(){var data=this.getData();if(data==null||data.length==0){return;}
this.canvasContext.save();this.canvasContext.beginPath();var previousFillStyle=this.canvasContext.fillStyle;if(this.backgroundColor!=null){this.backgroundColor.applyColorToFillStyle(this.canvasContext,this.backgroundColorGradientParam);this.canvasContext.fillRect(this.x,this.y,this.width,this.height);}
this.canvasContext.fillStyle=previousFillStyle;var fontFamily=this.getFontFamily();var fontSize=this.getFontSize();var fontStyle=this.getFontStyle();var fontColor=this.getFontColor();var fontStyles=[fontFamily,fontSize,fontStyle,fontColor];this.calFontStyle(this.style.getStyle(),fontStyles);var defaultFontFamily=fontStyles[0];var defaultFontSize=fontStyles[1];var defaultFontStyle=fontStyles[2];var defaultFontColor=fontStyles[3];this.canvasContext.translate(this.x,this.y+fontSize);defaultFontColor.applyColorToFillStyle(this.canvasContext,null);for(var i=0;i<data.length;i++){var te=data[i];this.calFontStyle(te.getNameStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];this.canvasContext.font=fontStyle+" "+fontSize+"px "+fontFamily;this.canvasContext.fillText(te.name,0,0,this.nameWidth);fontStyles=[defaultFontFamily,defaultFontSize,defaultFontStyle,defaultFontColor];this.calFontStyle(te.getValueStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];this.canvasContext.font=fontStyle+" "+fontSize+"px "+fontFamily;this.canvasContext.fillText(te.value,this.xSpace,0,this.valueWidth);this.canvasContext.translate(0,this.ySpace);}
this.canvasContext.restore();};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.copyTo=function(layer){return null;};prototype.isInside=function(offsetX,offsetY){return false;};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",data:{name:"Array",arguments:["ToolTipRow"]},header:"ToolTipRow",style:"ToolTipStyle",parent:"Shape",backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},formatter:"AbbreviateNumberFormatter",fontColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var ToolTipRow=function(){this.nameStyle={};this.valueStyle={};};ToolTipRow=stjs.extend(ToolTipRow,null,[],function(constructor,prototype){prototype.id=null;prototype.name=null;prototype.value=null;prototype.nameStyle=null;prototype.valueStyle=null;prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getValue=function(){return this.value;};prototype.setValue=function(value){this.value=value;};prototype.getNameStyle=function(){return this.nameStyle;};prototype.setNameStyle=function(nameStyle){this.nameStyle=nameStyle;};prototype.getValueStyle=function(){return this.valueStyle;};prototype.setValueStyle=function(valueStyle){this.valueStyle=valueStyle;};},{nameStyle:{name:"Map",arguments:[null,"Object"]},valueStyle:{name:"Map",arguments:[null,"Object"]}},{});
var Label=function(layer,value,text,x,y,width,height){sq.ChartElement.call(this,layer);this.value=value;this.text=text;this.x=x;this.y=y;this.width=width;this.height=height;this.bold=false;this.color=ChartColor.black;this.font="Arial";this.fontSize=12;this.align=Label.ALIGN_LEFT;this.baseline=null;this.backgroundColor=ChartColor.transparent;};Label=stjs.extend(Label,sq.ChartElement,[],function(constructor,prototype){constructor.ALIGN_LEFT="left";constructor.ALIGN_CENTER="center";constructor.ALIGN_RIGHT="right";constructor.BASELINE_TOP="top";constructor.BASELINE_MIDDLE="middle";constructor.BASELINE_BOTTOM="bottom";prototype.value=null;prototype.fontSize=0;prototype.font=null;prototype.bold=false;prototype.text=null;prototype.color=null;prototype.textColor=null;prototype.colorGradientParam=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParam=null;prototype.width=0;prototype.height=0;prototype.lineHeight=0;prototype.align=null;prototype.baseline=null;prototype.toString=function(){return this.text;};prototype.getValue=function(){return this.value;};prototype.setValue=function(value){this.value=value;};prototype.setFormattedValue=function(formattedValue){this.text=formattedValue;};prototype.isBold=function(){return this.bold;};prototype.getAlign=function(){return this.align;};prototype.setAlign=function(align){this.align=align;};prototype.getBaseline=function(){return this.baseline;};prototype.setBaseline=function(baseline){this.baseline=baseline;};prototype.getFont=function(){return this.font;};prototype.setFont=function(font){this.font=font;};prototype.getColor=function(){return this.color;};prototype.setColor=function(color){this.color=color;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getColorGradientParam=function(){return this.colorGradientParam;};prototype.setColorGradientParam=function(colorGradientParam){this.colorGradientParam=colorGradientParam;};prototype.getFontSize=function(){return this.fontSize;};prototype.setFontSize=function(fontSize){this.fontSize=fontSize;};prototype.setBold=function(bold){this.bold=bold;};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getLineHeight=function(){return this.lineHeight;};prototype.setLineHeight=function(lineHeight){this.lineHeight=lineHeight;};prototype.getText=function(){return this.text;};prototype.setText=function(text){this.text=text;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParam=function(){return this.backgroundColorGradientParam;};prototype.setBackgroundColorGradientParam=function(backgroundColorGradientParam){this.backgroundColorGradientParam=backgroundColorGradientParam;};prototype.getLeftPos=function(){if(this.align==Label.ALIGN_LEFT){return this.x;}else if(this.align==Label.ALIGN_CENTER){return this.x-stjs.trunc(Math.round(this.width/2.0));}else if(this.align==Label.ALIGN_RIGHT){return this.x-this.width;}else{return this.x;}};prototype.getTopPos=function(){if(this.baseline==Label.BASELINE_TOP){return this.y;}else if(this.baseline==Label.BASELINE_MIDDLE){return this.y-stjs.trunc(Math.round(this.height/2.0));}else if(this.baseline==Label.BASELINE_BOTTOM){return this.y-this.height;}else{return this.y-this.fontSize;}};prototype.copyTo=function(layer){};prototype.copyFieldsTo=function(copyElement){var otherLabel=copyElement;sq.ChartElement.prototype.copyFieldsTo.call(this,otherLabel);otherLabel.value=this.value;otherLabel.text=this.text;otherLabel.x=this.x;otherLabel.y=this.y;otherLabel.width=this.width;otherLabel.height=this.height;otherLabel.bold=this.bold;otherLabel.color=this.color;if(this.colorGradientParam!=null){otherLabel.colorGradientParam=SQW.$.extend([],this.colorGradientParam);}
otherLabel.font=this.font;otherLabel.fontSize=this.fontSize;otherLabel.align=this.align;otherLabel.baseline=this.baseline;otherLabel.backgroundColor=this.backgroundColor;if(this.backgroundColorGradientParam!=null){otherLabel.backgroundColorGradientParam=SQW.$.extend([],this.colorGradientParam);}};},{color:"ChartColor",textColor:"ChartColor",colorGradientParam:{name:"Array",arguments:[null]},backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasLabel=function(layer,value,text,x,y,width,height){Label.call(this,layer,value,text,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasLabel=stjs.extend(CanvasLabel,Label,[],function(constructor,prototype){constructor.BOLD_OPTION="bold ";prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.clearRect(this.x,this.y,this.width,this.height);};prototype.render=function(){if(this.text==null){return;}
this.canvasContext.save();this.canvasContext.beginPath();var previousFillStyle=this.canvasContext.fillStyle;if(this.backgroundColor!=null){this.backgroundColor.applyColorToFillStyle(this.canvasContext,this.backgroundColorGradientParam);this.canvasContext.fillRect(this.getLeftPos(),this.getTopPos(),this.width,this.height);}
this.canvasContext.fillStyle=previousFillStyle;if(this.color!=null){this.color.applyColorToFillStyle(this.canvasContext,this.colorGradientParam);}
if(this.align!=null){this.canvasContext.textAlign=this.align;}
if(this.baseline!=null){this.canvasContext.textBaseline=this.baseline;}
this.canvasContext.beginPath();if(this.textColor!=null){this.textColor.applyColorToFillStyle(this.canvasContext,null);}
this.canvasContext.font=this.getFontParam();if(this.text.contains(InteractiveTextArea.CUSTOM_NEWLINE_SYMBOL)){this.fillMultilineText();}else{this.canvasContext.fillText(this.text,this.x,this.y,this.width);}
this.canvasContext.restore();};prototype.fillMultilineText=function(){var lines=(this.text).split(InteractiveTextArea.CUSTOM_NEWLINE_SYMBOL);var textTopPosition=stjs.trunc(Math.round(this.y-this.height/2.0+this.lineHeight/2.0))+1;for(var i=0;i<lines.length;i++){this.canvasContext.fillText(lines[i],this.x,textTopPosition+(i*this.lineHeight),this.width);}};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:this.canvasContext.save();if(this.highlightColor!=null){this.highlightColor.applyColorToFillStyle(this.canvasContext,this.highlightColorGradientParam);}
if(this.align!=null){this.canvasContext.textAlign=this.align;}
if(this.baseline!=null){this.canvasContext.textBaseline=this.baseline;}
this.canvasContext.font=this.getFontParam();this.canvasContext.fillText(this.text,this.x,this.y,this.width);this.canvasContext.restore();break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){this.clear();};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.getFontParam=function(){var option="";if(this.bold){option+=CanvasLabel.BOLD_OPTION;}
return option+this.fontSize+"px "+this.font;};prototype.copyTo=function(layer){var copy=new CanvasLabel(layer,this.value,this.text,this.x,this.y,this.width,this.height);this.copyFieldsTo(copy);return copy;};prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.x&&y>=this.y&&x<(this.x+this.width)&&y<(this.y+this.height)){return true;}else{return false;}};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",color:"ChartColor",textColor:"ChartColor",colorGradientParam:{name:"Array",arguments:[null]},backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var EditableCanvasLabel=function(layer,value,text,x,y,width,height){CanvasLabel.call(this,layer,value,text,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();this.borderColor=ChartColor.black;};EditableCanvasLabel=stjs.extend(EditableCanvasLabel,CanvasLabel,[],function(constructor,prototype){constructor.SELECTION_INDICATOR_SIZE=5;constructor.SELECTION_INDICATOR_SPACE=2;constructor.REFERENCE_POINT_SIZE=2;constructor.BORDER_WIDTH=1;constructor.HALF_PIXEL_CANVAS_START=0.5;prototype.hovered=false;prototype.selected=false;prototype.borderColor=null;prototype.clear=function(){CanvasLabel.prototype.clear.call(this);};prototype.render=function(){CanvasLabel.prototype.render.call(this);if(this.hovered){this.drawSelection(0.3);}else if(this.selected){this.drawSelection(1.0);}};prototype.drawSelection=function(alpha){var leftPos=this.getLeftPos()+EditableCanvasLabel.HALF_PIXEL_CANVAS_START;var topPos=this.getTopPos()-EditableCanvasLabel.HALF_PIXEL_CANVAS_START;this.drawSelectionIndicators(leftPos,topPos,EditableCanvasLabel.SELECTION_INDICATOR_SIZE,alpha);this.drawSpaceBeforeSelectionIndicators(leftPos,topPos,EditableCanvasLabel.SELECTION_INDICATOR_SPACE);this.drawReferencePoint(leftPos+stjs.trunc(this.width/2),topPos+stjs.trunc(this.height/2),EditableCanvasLabel.REFERENCE_POINT_SIZE,alpha);};prototype.drawSelectionIndicators=function(leftPos,topPos,size,alpha){this.canvasContext.beginPath();this.canvasContext.strokeStyle=this.getBorderColor().getChartColorWithAlpha(alpha).getFlatColor();this.canvasContext.lineWidth=EditableCanvasLabel.BORDER_WIDTH;this.drawCrossLines(leftPos,topPos,this.width,this.height,size);this.canvasContext.stroke();};prototype.drawSpaceBeforeSelectionIndicators=function(leftPos,topPos,size){this.canvasContext.beginPath();this.canvasContext.strokeStyle=ChartColor.white.getFlatColor();this.canvasContext.lineWidth=EditableCanvasLabel.BORDER_WIDTH;this.drawCrossLines(leftPos,topPos,this.width,this.height,EditableCanvasLabel.SELECTION_INDICATOR_SPACE);this.canvasContext.stroke();};prototype.drawReferencePoint=function(leftPos,topPos,size,alpha){this.canvasContext.beginPath();this.canvasContext.strokeStyle=this.getBorderColor().getChartColorWithAlpha(alpha).getFlatColor();this.canvasContext.lineWidth=EditableCanvasLabel.BORDER_WIDTH;this.drawCrossLines(leftPos,topPos,0,0,size);this.canvasContext.stroke();};prototype.drawCrossLines=function(leftPos,topPos,width,height,size){this.drawLine(leftPos,topPos,0,-size);this.drawLine(leftPos,topPos,-size,0);this.drawLine(leftPos+width,topPos,0,-size);this.drawLine(leftPos+width,topPos,size,0);this.drawLine(leftPos,topPos+height,0,size);this.drawLine(leftPos,topPos+height,-size,0);this.drawLine(leftPos+width,topPos+height,size,0);this.drawLine(leftPos+width,topPos+height,0,size);};prototype.drawLine=function(startingPositionX,startingPositionY,offsetX,offsetY){this.canvasContext.moveTo(startingPositionX,startingPositionY);this.canvasContext.lineTo(startingPositionX+offsetX,startingPositionY+offsetY);};prototype.getBorderColor=function(){return this.borderColor;};prototype.setBorderColor=function(borderColor){this.borderColor=borderColor;};prototype.setHovered=function(hovered){this.hovered=hovered;};prototype.setSelected=function(selected){this.selected=selected;};},{borderColor:"ChartColor",canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",color:"ChartColor",textColor:"ChartColor",colorGradientParam:{name:"Array",arguments:[null]},backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasBackgroundHelper=function(){};CanvasBackgroundHelper=stjs.extend(CanvasBackgroundHelper,null,[],function(constructor,prototype){constructor.createBackground=function(layer,area,style){var backgroundColor=style.getBackgroundColor();var areaBound=area.getAreaBound();if(backgroundColor!=null){var x=stjs.trunc(Math.floor(areaBound.getLeft()));var y=stjs.trunc(Math.floor(areaBound.getTop()));var width=stjs.trunc(Math.ceil(areaBound.getOuterWidth(true)));var height=stjs.trunc(Math.ceil(areaBound.getOuterHeight(true)));var background=ChartElementFactory.createRect(layer,x,y,width,height);background.setFillColor(backgroundColor);background.setFillColorGradientParam(style.getBackgroundColorGradientParams());area.addElement(background);}};constructor.createBorders=function(layer,area,style){var areaBound=area.getAreaBound();var borderLeftPos=stjs.trunc((areaBound.getLeft()+areaBound.getMarginLeft()));var borderLeftSize=stjs.trunc(areaBound.getBorderLeft());var borderTopPos=stjs.trunc((areaBound.getTop()+areaBound.getMarginTop()));var borderTopSize=stjs.trunc(areaBound.getBorderTop());var borderRightPos=stjs.trunc((areaBound.getInnerLeft()+areaBound.getInnerWidth()));var borderRightSize=stjs.trunc(areaBound.getBorderRight());var borderBottomPos=stjs.trunc((areaBound.getInnerTop()+areaBound.getInnerHeight()));var borderBottomSize=stjs.trunc(areaBound.getBorderBottom());var borderLeftColor=ChartColor.black;var borderTopColor=ChartColor.black;var borderRightColor=ChartColor.black;var borderBottomColor=ChartColor.black;if(style!=null){borderLeftColor=style.getBorderLeftColor();borderTopColor=style.getBorderTopColor();borderRightColor=style.getBorderRightColor();borderBottomColor=style.getBorderBottomColor();}
if(borderLeftSize>0){CanvasBackgroundHelper.createBorder(layer,area,borderLeftPos,borderTopPos,borderLeftPos,borderBottomPos+1,borderLeftSize,borderLeftColor,null);}
if(borderTopSize>0){CanvasBackgroundHelper.createBorder(layer,area,borderLeftPos,borderTopPos,borderRightPos+1,borderTopPos,borderTopSize,borderTopColor,null);}
if(borderRightSize>0){CanvasBackgroundHelper.createBorder(layer,area,borderRightPos,borderTopPos,borderRightPos,borderBottomPos+1,borderRightSize,borderRightColor,null);}
if(borderBottomSize>0){CanvasBackgroundHelper.createBorder(layer,area,borderLeftPos,borderBottomPos,borderRightPos+1,borderBottomPos,borderBottomSize,borderBottomColor,null);}};constructor.createBorder=function(layer,area,startX,startY,endX,endY,size,color,gradientsParam){var border=ChartElementFactory.createLine(layer,startX,startY,endX,endY,size);border.setStrokeColor(color);border.setStrokeColorGradientParam(gradientsParam);area.addElement(border);};},{},{});
var ChartIcon=function(layer,x,y,width,height,iconType){sq.ChartElement.call(this,layer);this.x=x;this.y=y;this.width=width;this.height=height;this.iconType=iconType;};ChartIcon=stjs.extend(ChartIcon,sq.ChartElement,[],function(constructor,prototype){constructor.ENLARGE_ICON="enlargeIcon";prototype.iconType=null;prototype.width=0;prototype.height=0;prototype.backgroundColor=null;prototype.copyTo=function(layer){};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.setId=function(id){this.id=id;};prototype.getIconType=function(){return this.iconType;};prototype.setIconType=function(iconType){this.iconType=iconType;};},{backgroundColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasIcon=function(layer,x,y,width,height,iconType){ChartIcon.call(this,layer,x,y,width,height,iconType);this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasIcon=stjs.extend(CanvasIcon,ChartIcon,[],function(constructor,prototype){prototype.canvasContext=null;constructor.IMAGES_ROOT="/sqw-components/images/chart/";prototype.drawImage=function(imageName,x,y){var image=window.document.createElement("img");image.width=this.width;image.height=this.height;image.src=this.getContextPath()+CanvasIcon.IMAGES_ROOT+imageName;var that=this;image.onload=function(e){that.canvasContext.drawImage(image,x,y);};};prototype.getContextPath=function(){return window.location.pathname.substring(0,window.location.pathname.indexOf("/",2));};prototype.clear=function(){this.canvasContext.save();this.canvasContext.transform(1,0,0,1,0.5,0.5);this.canvasContext.clearRect(this.x,this.y,this.width,this.height);this.canvasContext.restore();};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){this.render();};prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.x&&y>=this.y&&x<(this.x+this.width)&&y<(this.y+this.height)){return true;}else{return false;}};prototype.copyTo=function(layer){var copy=CanvasIcon.createIcon(layer,this.x,this.y,this.width,this.height,this.iconType);this.copyFieldsTo(copy);return copy;};constructor.createIcon=function(layer,x,y,width,height,iconType){if(iconType==ChartIcon.ENLARGE_ICON){return new CanvasEnlargeIcon(layer,x,y,width,height);}
return null;};},{canvasContext:"CanvasRenderingContext2D",backgroundColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasEnlargeIcon=function(layer,x,y,width,height){CanvasIcon.call(this,layer,x,y,width,height,ChartIcon.ENLARGE_ICON);this.drawImage(CanvasEnlargeIcon.ICON_NAME,x,y);};CanvasEnlargeIcon=stjs.extend(CanvasEnlargeIcon,CanvasIcon,[],function(constructor,prototype){constructor.ICON_NAME="enlarge.png";},{canvasContext:"CanvasRenderingContext2D",backgroundColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Shape=function(layer,x,y){sq.ChartElement.call(this,layer);this.x=x;this.y=y;this.fillColor=ChartColor.black;this.strokeColor=ChartColor.black;this.highlightColor=ChartColor.orange;this.hoverColor=ChartColor.orange;this.groupColor=ChartColor.black;};Shape=stjs.extend(Shape,sq.ChartElement,[],function(constructor,prototype){prototype.width=0;prototype.height=0;prototype.fillShape=false;prototype.strokeShape=false;prototype.highlighted=false;prototype.grouped=false;prototype.fillColor=null;prototype.strokeColor=null;prototype.fillColorGradientParam=null;prototype.strokeColorGradientParam=null;prototype.data=null;prototype.clear=function(){};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.customRender=function(){};prototype.reset=function(){this.clear();this.render();};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getData=function(){return this.data;};prototype.setData=function(data){this.data=data;};prototype.getHighlightMode=function(){return this.highlightMode;};prototype.setHighlightMode=function(highlightMode){this.highlightMode=highlightMode;};prototype.getHoverMode=function(){return this.hoverMode;};prototype.setHoverMode=function(hoverMode){this.hoverMode=hoverMode;};prototype.isFillShape=function(){return this.fillShape;};prototype.setFillShape=function(fillShape){this.fillShape=fillShape;};prototype.isStrokeShape=function(){return this.strokeShape;};prototype.setStrokeShape=function(strokeShape){this.strokeShape=strokeShape;};prototype.getFillColor=function(){return this.fillColor;};prototype.setFillColor=function(fillColor){this.fillColor=fillColor;};prototype.getStrokeColor=function(){return this.strokeColor;};prototype.setStrokeColor=function(strokeColor){this.strokeColor=strokeColor;};prototype.getFillColorGradientParam=function(){return this.fillColorGradientParam;};prototype.setFillColorGradientParam=function(fillColorGradientParam){this.fillColorGradientParam=fillColorGradientParam;};prototype.getStrokeColorGradientParam=function(){return this.strokeColorGradientParam;};prototype.setStrokeColorGradientParam=function(strokeColorGradientParam){this.strokeColorGradientParam=strokeColorGradientParam;};prototype.getHighlightColorGradientParam=function(){return this.highlightColorGradientParam;};prototype.setHighlightColorGradientParam=function(highlightColorGradientParam){this.highlightColorGradientParam=highlightColorGradientParam;};prototype.getHoverColorGradientParam=function(){return this.hoverColorGradientParam;};prototype.setHoverColorGradientParam=function(hoverColorGradientParam){this.hoverColorGradientParam=hoverColorGradientParam;};prototype.isHighlighted=function(){return this.highlighted;};prototype.setHighlighted=function(highlighted){this.highlighted=highlighted;this.data["highlighted"]=highlighted;};prototype.isGrouped=function(){return this.grouped;};prototype.setGrouped=function(grouped){this.grouped=grouped;this.data["grouped"]=grouped;};prototype.calDistance=function(x,y){var currentPoint=new Point2D(x,y);var currentShapePoint=new Point2D(this.x,this.y);return currentPoint.distanceTo(currentShapePoint);};prototype.calDistanceY=function(y){var currentPoint=new Point2D(0,y);var currentShapePoint=new Point2D(0,this.y+this.height);return currentPoint.distanceTo(currentShapePoint);};},{fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Line=function(layer,x1,y1,x2,y2,width){Shape.call(this,layer,x1,y1);this.startPoint=new Point2D(x1,y1);this.endPoint=new Point2D(x2,y2);this.width=width;this.lineDashOffset=0;this.strokeShape=true;this.fillShape=false;this.dashed=false;this.dashValues=Line.DEFAULT_DASH_VALUES;};Line=stjs.extend(Line,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.startPoint=null;prototype.endPoint=null;prototype.dashed=false;prototype.lineDashOffset=0;prototype.dashValues=null;prototype.dashStyle=null;prototype.getStartPoint=function(){return this.startPoint;};prototype.getEndPoint=function(){return this.endPoint;};prototype.setStartPoint=function(start){if(start==null){this.startPoint=null;}else{this.startPoint=start.getClone();}};prototype.setEndPoint=function(end){if(end==null){this.endPoint=null;}else{this.endPoint=end.getClone();}};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getDashValues=function(){return this.dashValues;};prototype.setDashValues=function(dashValues){this.dashValues=dashValues;};prototype.getDashStyle=function(){return this.dashStyle;};prototype.setDashStyle=function(dashStyle){this.dashStyle=dashStyle;};prototype.isInside=function(x,y){return false;};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},startPoint:"Point2D",endPoint:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Rect=function(layer,x,y,width,height){Shape.call(this,layer,x,y);this.width=width;this.height=height;this.fillShape=true;this.strokeShape=false;this.lineWidth=1;};Rect=stjs.extend(Rect,Shape,[],function(constructor,prototype){prototype.highlightRectWidth=0;prototype.hoverRectWidth=0;prototype.groupRectWidth=0;prototype.lineWidth=0;prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.x&&y>=this.y&&x<(this.x+this.width)&&y<(this.y+this.height)){return true;}else{return false;}};prototype.getHighlightRectWidth=function(){return this.highlightRectWidth;};prototype.setHighlightRectWidth=function(highlightRectWidth){this.highlightRectWidth=highlightRectWidth;};prototype.getHoverRectWidth=function(){return this.hoverRectWidth;};prototype.setHoverRectWidth=function(hoverRectWidth){this.hoverRectWidth=hoverRectWidth;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getGroupRectWidth=function(){return this.groupRectWidth;};prototype.setGroupRectWidth=function(groupRectWidth){this.groupRectWidth=groupRectWidth;};},{fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Circle=function(layer,x,y,radius){Shape.call(this,layer,x,y);this.radius=radius;this.radiusSquare=radius*radius;this.width=stjs.trunc(Math.round(2*radius));this.height=this.width;this.startAngle=0.0;this.endAngle=2*Math.PI;this.strokeShape=true;this.fillShape=false;this.lineWidth=1;};Circle=stjs.extend(Circle,Shape,[],function(constructor,prototype){prototype.radius=0.0;prototype.radiusSquare=0.0;prototype.startAngle=0.0;prototype.endAngle=0.0;prototype.bounds=null;prototype.lineWidth=0;prototype.getRadius=function(){return this.radius;};prototype.setRadius=function(radius){this.radius=radius;this.radiusSquare=radius*radius;this.width=stjs.trunc(Math.round(2*radius));this.height=this.width;};prototype.setWidth=function(width){this.width=width;this.height=width;this.radius=width/2.0;this.radiusSquare=this.radius*this.radius;};prototype.setHeight=function(height){this.width=height;this.height=height;this.radius=height/2.0;this.radiusSquare=this.radius*this.radius;};prototype.getStartAngle=function(){return this.startAngle;};prototype.setStartAngle=function(startAngle){this.startAngle=startAngle;};prototype.getEndAngle=function(){return this.endAngle;};prototype.setEndAngle=function(endAngle){this.endAngle=endAngle;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.getBounds=function(){return this.bounds;};prototype.setBounds=function(bounds){this.bounds=bounds;};prototype.isInside=function(x,y){if(x==null||y==null){return false;}else{var diffXSquare=this.x-x;diffXSquare=diffXSquare*diffXSquare;var diffYSquare=this.y-y;diffYSquare=diffYSquare*diffYSquare;if((diffXSquare+diffYSquare)<=this.radiusSquare){return true;}else{return false;}}};},{bounds:"AreaBound",fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Path=function(layer,width){Shape.call(this,layer,-1,-1);this.points=[];this.width=width;this.lineDashOffset=0;this.strokeShape=true;this.fillShape=false;this.dashed=false;this.closePath=false;this.dashValues=Path.DEFAULT_DASH_VALUES;};Path=stjs.extend(Path,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.points=null;prototype.closePath=false;prototype.dashed=false;prototype.lineDashOffset=0;prototype.dashValues=null;prototype.dashStyle=null;prototype.pushPoint=function(x,y){this.points.push(new Point2D(x,y));};prototype.popPoint=function(){this.points.pop();};prototype.getStartPoint=function(){return this.points[0];};prototype.getEndPoint=function(){return this.points[this.points.length-1];};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getDashValues=function(){return this.dashValues;};prototype.setDashValues=function(dashValues){this.dashValues=dashValues;};prototype.getDashStyle=function(){return this.dashStyle;};prototype.setDashStyle=function(dashStyle){this.dashStyle=dashStyle;};prototype.isClosePath=function(){return this.closePath;};prototype.setClosePath=function(closePath){this.closePath=closePath;};prototype.getX=function(){if(this.points==null||this.points.length<=0){return null;}else{var fistPoint=this.points[0];return fistPoint!=null?fistPoint.getX():null;}};prototype.getY=function(){if(this.points==null||this.points.length<=0){return null;}else{var fistPoint=this.points[0];return fistPoint!=null?fistPoint.getY():null;}};prototype.isInside=function(x,y){return false;};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},points:{name:"Array",arguments:["Point2D"]},dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Polygon=function(layer,x,y,width){Shape.call(this,layer,x,y);this.points=[new Point2D(x,y)];this.width=width;this.strokeShape=true;this.fillShape=false;};Polygon=stjs.extend(Polygon,Shape,[],function(constructor,prototype){prototype.points=null;prototype.pushPoint=function(x,y){this.points.push(new Point2D(x,y));};prototype.popPoint=function(){this.points.pop();};prototype.isInside=function(x,y){return false;};},{points:{name:"Array",arguments:["Point2D"]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var TriangleShape=function(layer,x1,y1,x2,y2,x3,y3){Shape.call(this,layer,x1,y1);this.p1=new Point2D(x1,y1);this.p2=new Point2D(x2,y2);this.p3=new Point2D(x3,y3);this.lineDashOffset=0;this.strokeShape=true;this.fillShape=false;this.dashed=false;this.dashValues=TriangleShape.DEFAULT_DASH_VALUES;};TriangleShape=stjs.extend(TriangleShape,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.p1=null;prototype.p2=null;prototype.p3=null;prototype.dashed=false;prototype.lineDashOffset=0;prototype.dashValues=null;prototype.dashStyle=null;prototype.getP1=function(){return this.p1;};prototype.getP2=function(){return this.p2;};prototype.getP3=function(){return this.p3;};prototype.setP1=function(p1){if(p1==null){this.p1=null;}else{this.p1=p1.getClone();}};prototype.setP2=function(p2){if(p2==null){this.p2=null;}else{this.p2=p2.getClone();}};prototype.setP3=function(p3){if(p3==null){this.p3=null;}else{this.p3=p3.getClone();}};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getDashValues=function(){return this.dashValues;};prototype.setDashValues=function(dashValues){this.dashValues=dashValues;};prototype.getDashStyle=function(){return this.dashStyle;};prototype.setDashStyle=function(dashStyle){this.dashStyle=dashStyle;};prototype.isInside=function(x,y){return MathUtil.isPointInsideTriangle(new Point2D(x,y),this.p1,this.p2,this.p3);};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},p1:"Point2D",p2:"Point2D",p3:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Ellipse=function(layer,x,y,radiusX,radiusY){Shape.call(this,layer,x,y);this.radiusX=radiusX;this.radiusY=radiusY;this.radiusXSquare=radiusX*radiusX;this.radiusYSquare=radiusY*radiusY;this.width=stjs.trunc(Math.round(2*radiusX));this.height=stjs.trunc(Math.round(2*radiusY));this.startAngle=0.0;this.endAngle=2*Math.PI;this.strokeShape=true;this.fillShape=false;this.lineWidth=1;this.dashValues=Ellipse.DEFAULT_DASH_VALUES;};Ellipse=stjs.extend(Ellipse,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.radiusX=0.0;prototype.radiusY=0.0;prototype.radiusXSquare=0.0;prototype.radiusYSquare=0.0;prototype.startAngle=0.0;prototype.endAngle=0.0;prototype.bounds=null;prototype.dashValues=null;prototype.dashed=false;prototype.lineWidth=0;prototype.getRadiusX=function(){return this.radiusX;};prototype.getRadiusY=function(){return this.radiusY;};prototype.setRadiusX=function(radiusX){this.radiusX=radiusX;this.radiusXSquare=radiusX*radiusX;this.width=stjs.trunc(Math.round(2*radiusX));};prototype.setRadiusY=function(radiusY){this.radiusY=radiusY;this.radiusYSquare=radiusY*radiusY;this.height=stjs.trunc(Math.round(2*radiusY));};prototype.setWidth=function(width){this.width=width;this.radiusX=width/2.0;this.radiusXSquare=this.radiusX*this.radiusX;};prototype.setHeight=function(height){this.height=height;this.radiusY=height/2.0;this.radiusYSquare=this.radiusY*this.radiusY;};prototype.getStartAngle=function(){return this.startAngle;};prototype.setStartAngle=function(startAngle){this.startAngle=startAngle;};prototype.getEndAngle=function(){return this.endAngle;};prototype.setEndAngle=function(endAngle){this.endAngle=endAngle;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getBounds=function(){return this.bounds;};prototype.setBounds=function(bounds){this.bounds=bounds;};prototype.isInside=function(x,y){if(x==null||y==null||this.radiusXSquare==0||this.radiusYSquare==0){return false;}else{var diffXSquare=this.x-x;diffXSquare=diffXSquare*diffXSquare;diffXSquare/=this.radiusXSquare;var diffYSquare=this.y-y;diffYSquare=diffYSquare*diffYSquare;diffYSquare/=this.radiusYSquare;if((diffXSquare+diffYSquare)<=1){return true;}else{return false;}}};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},bounds:"AreaBound",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasLine=function(layer,x1,y1,x2,y2,width){Line.call(this,layer,x1,y1,x2,y2,width);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasLine=stjs.extend(CanvasLine,Line,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();if(this.width%2!=0){var offsetX=0.0;var offsetY=0.0;if(this.startPoint.getY()!=this.endPoint.getY()){offsetX=0.5;}
if(this.startPoint.getX()!=this.endPoint.getX()){offsetY=0.5;}
this.canvasContext.transform(1,0,0,1,offsetX,offsetY);}
this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.startPoint.getX(),this.startPoint.getY());this.canvasContext.lineTo(this.endPoint.getX(),this.endPoint.getY());if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed&&this.dashValues!=null){this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderDashLine();}};prototype.renderDashLine=function(){if(this.dashValues!=null&&this.dashValues[0]!=null){var dashLength=this.dashValues[0];var gapLength=this.dashValues[1];if(gapLength==null){gapLength=dashLength;}
var dx=(this.endPoint.getX()-this.startPoint.getX());var dy=(this.endPoint.getY()-this.startPoint.getY());var length=stjs.trunc(Math.round(this.endPoint.distanceTo(this.startPoint)));var rotation=Math.atan2(dy,dx);this.canvasContext.save();this.canvasContext.translate(this.startPoint.getX(),this.startPoint.getY());this.canvasContext.rotate(rotation);if(this.width%2!=0){var offsetX=0.0;var offsetY=0.0;if(this.startPoint.getY()!=this.endPoint.getY()){offsetX=0.5;}
if(this.startPoint.getX()!=this.endPoint.getX()){offsetY=0.5;}
this.canvasContext.transform(1,0,0,1,offsetX,offsetY);}
this.canvasContext.beginPath();this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(0,0);var draw=true;var x=0;while(length>x){if(draw){x+=dashLength;x=x<length?x:length;this.canvasContext.lineTo(x,0);}else{x+=gapLength;x=x<length?x:length;this.canvasContext.moveTo(x,0);}
draw=!draw;}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){this.canvasContext.save();this.canvasContext.beginPath();if(this.width%2!=0){var offsetX=0.0;var offsetY=0.0;if(this.startPoint.getY()!=this.endPoint.getY()){offsetX=0.5;}
if(this.startPoint.getX()!=this.endPoint.getX()){offsetY=0.5;}
this.canvasContext.transform(1,0,0,1,offsetX,offsetY);}
this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.startPoint.getX(),this.startPoint.getY());this.canvasContext.lineTo(this.endPoint.getX(),this.endPoint.getY());if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},startPoint:"Point2D",endPoint:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasRect=function(layer,x,y,width,height){Rect.call(this,layer,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasRect=stjs.extend(CanvasRect,Rect,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){if(this.isHighlighted()){this.canvasContext.clearRect(this.x,this.y,this.highlightRectWidth,this.height);}else{this.canvasContext.clearRect(this.x,this.y,this.width,this.height);}};prototype.render=function(){this.canvasContext.save();this.canvasContext.beginPath();if(this.isHighlighted()){this.renderWithColors(this.highlightColor,this.highlightColor,this.highlightRectWidth);}else if(this.isGrouped()){this.renderWithColors(this.groupColor,this.groupColor,this.groupRectWidth);}else{this.renderWithColors(this.fillColor,this.strokeColor,this.width);}
this.customRender();this.canvasContext.restore();};prototype.renderWithColors=function(fillColorToUse,strokeColorToUse,widthToUse){if(this.fillShape&&fillColorToUse!=null){fillColorToUse.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fillRect(this.x,this.y,widthToUse,this.height);}
if(this.strokeShape&&strokeColorToUse!=null){this.canvasContext.lineWidth=this.lineWidth;if(this.lineWidth%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
strokeColorToUse.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.strokeRect(this.x,this.y,widthToUse,this.height);}};prototype.highlight=function(){if(this.isHighlighted()){return;}
this.clear();switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:this.data[ChartConstant.HIGHLIGHT_COLOR]=this.highlightColor.getFlatColor();break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:this.data[ChartConstant.HIGHLIGHT_WIDTH]=this.highlightRectWidth;break;case sq.ChartElement.HIGHLIGHT.NONE:break;case sq.ChartElement.HIGHLIGHT.COLOR_FISH_EYE:this.data[ChartConstant.HIGHLIGHT_COLOR]=this.highlightColor.getFlatColor();this.data[ChartConstant.HIGHLIGHT_WIDTH]=this.highlightRectWidth;break;default:break;}
this.setHighlighted(true);this.render();};prototype.clearHighlight=function(){this.clear();this.setHighlighted(false);this.render();};prototype.hover=function(){if(this.isHighlighted()){return;}
var tmp=this.fillColor;var tmpW=this.width;switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:if(this.isGrouped()){this.groupColor=this.hoverColor;this.render();this.groupColor=tmp;}else{this.fillColor=this.hoverColor;this.render();this.fillColor=tmp;}
break;case sq.ChartElement.HOVER.FISH_EYE:if(this.isGrouped()){this.width=this.groupRectWidth+2;this.render();this.width=this.groupRectWidth;}else{this.width=this.hoverRectWidth;this.render();this.width=tmpW;}
break;case sq.ChartElement.HOVER.NONE:break;case sq.ChartElement.HOVER.COLOR_FISH_EYE:if(this.isGrouped()){this.groupColor=this.hoverColor;this.width=this.groupRectWidth+2;this.render();this.width=this.groupRectWidth;this.groupColor=tmp;}else{this.fillColor=this.hoverColor;this.width=this.hoverRectWidth;this.render();this.width=tmpW;this.fillColor=tmp;}
break;case sq.ChartElement.HOVER.CIRCLE:this.createCircleHighlight();break;default:break;}};prototype.createCircleHighlight=function(){var circleHighlight=ChartElementFactory.createCircle(this.layer,this.x,this.y,6);circleHighlight.setStrokeColor(this.hoverColor);circleHighlight.setLineWidth(2);circleHighlight.render();};prototype.copyTo=function(layer){var clone=new CanvasRect(layer,this.x,this.y,this.width,this.height);clone.setId(this.id);clone.setData(this.data);clone.setFillColor(this.fillColor);clone.setFillColorGradientParam(this.fillColorGradientParam);clone.setFillShape(this.fillShape);clone.setHighlightColor(this.highlightColor);clone.setHighlightColorGradientParam(this.highlightColorGradientParam);clone.setHighlightMode(this.highlightMode);clone.setHoverColor(this.hoverColor);clone.setHoverMode(this.hoverMode);clone.setStrokeColor(this.strokeColor);clone.setStrokeShape(this.strokeShape);clone.setHighlightRectWidth(this.highlightRectWidth);clone.setHoverRectWidth(this.hoverRectWidth);clone.setGroupRectWidth(this.groupRectWidth);clone.setHighlighted(this.highlighted);clone.setGrouped(this.grouped);return clone;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasCircle=function(layer,x,y,radius){Circle.call(this,layer,x,y,radius);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasCircle=stjs.extend(CanvasCircle,Circle,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();this.canvasContext.arc(this.x,this.y,this.radius,this.startAngle,this.endAngle,false);if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.lineWidth=this.lineWidth;this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){this.canvasContext.save();if(this.bounds!=null){var boundsX=stjs.trunc(Math.round(this.bounds.getLeft()));var boundsY=stjs.trunc(Math.round(this.bounds.getTop()));var boundsWidth=stjs.trunc(Math.round(this.bounds.getOuterWidth(true)));var boundsHeight=stjs.trunc(Math.round(this.bounds.getOuterHeight(true)));this.canvasContext.beginPath();this.canvasContext.rect(boundsX,boundsY,boundsWidth,boundsHeight);this.canvasContext.clip();}
this.canvasContext.beginPath();this.canvasContext.arc(this.x,this.y,this.radius,this.startAngle,this.endAngle,false);if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.canvasContext.lineWidth=this.lineWidth;this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",bounds:"AreaBound",fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasPath=function(layer,width){Path.call(this,layer,width);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasPath=stjs.extend(CanvasPath,Path,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();if(this.width%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
this.canvasContext.lineWidth=this.width;var pointCount=this.points.length;if(pointCount>0){var firstPoint=this.points[0];this.canvasContext.moveTo(firstPoint.getX(),firstPoint.getY());}
for(var i=1;i<pointCount;i++){var currentPoint=this.points[i];this.canvasContext.lineTo(currentPoint.getX(),currentPoint.getY());}
if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed){if(this.dashValues==null){this.dashValues=Path.DEFAULT_DASH_VALUES;}
this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderDashPath();}};prototype.renderDashLine=function(startPoint,endPoint,dashLength,gapLength){var dx=(endPoint.getX()-startPoint.getX());var dy=(endPoint.getY()-startPoint.getY());var length=stjs.trunc(Math.round(endPoint.distanceTo(startPoint)));var rotation=Math.atan2(dy,dx);this.canvasContext.save();this.canvasContext.translate(startPoint.getX(),startPoint.getY());this.canvasContext.rotate(rotation);this.canvasContext.moveTo(0,0);var draw=true;var x=0;while(length>x){if(draw){x+=dashLength;x=x<length?x:length;this.canvasContext.lineTo(x,0);}else{x+=gapLength;x=x<length?x:length;this.canvasContext.moveTo(x,0);}
draw=!draw;}
this.canvasContext.restore();};prototype.renderDashPath=function(){if(this.dashValues!=null&&this.dashValues[0]!=null){var dashLength=this.dashValues[0];var gapLength=this.dashValues[1];if(gapLength==null){gapLength=dashLength;}
this.canvasContext.save();this.canvasContext.beginPath();if(this.width%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
this.canvasContext.lineWidth=this.width;var pointCount=this.points.length;var firstPoint=null;if(pointCount>0){firstPoint=this.points[0];this.canvasContext.moveTo(firstPoint.getX(),firstPoint.getY());}
var previousPoint=firstPoint;var currentPoint=null;for(var i=1;i<pointCount;i++){currentPoint=this.points[i];this.renderDashLine(previousPoint,currentPoint,dashLength,gapLength);previousPoint=currentPoint;}
if(this.closePath&&firstPoint!=null){this.renderDashLine(currentPoint,firstPoint,dashLength,gapLength);}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){this.canvasContext.save();this.canvasContext.beginPath();if(this.width%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
this.canvasContext.lineWidth=this.width;var pointCount=this.points.length;if(pointCount>0){var firstPoint=this.points[0];this.canvasContext.moveTo(firstPoint.getX(),firstPoint.getY());}
for(var i=1;i<pointCount;i++){var currentPoint=this.points[i];this.canvasContext.lineTo(currentPoint.getX(),currentPoint.getY());}
if(this.closePath){this.canvasContext.closePath();}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},points:{name:"Array",arguments:["Point2D"]},dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasPolygon=function(layer,x,y,width){Polygon.call(this,layer,x,y,width);};CanvasPolygon=stjs.extend(CanvasPolygon,Polygon,[],function(constructor,prototype){prototype.clear=function(){};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{points:{name:"Array",arguments:["Point2D"]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasTriangle=function(layer,x1,y1,x2,y2,x3,y3){TriangleShape.call(this,layer,x1,y1,x2,y2,x3,y3);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasTriangle=stjs.extend(CanvasTriangle,TriangleShape,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.p1.getX(),this.p1.getY());this.canvasContext.lineTo(this.p2.getX(),this.p2.getY());this.canvasContext.lineTo(this.p3.getX(),this.p3.getY());this.canvasContext.closePath();if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed&&this.dashValues!=null){this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){this.canvasContext.save();this.canvasContext.beginPath();this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.p1.getX(),this.p1.getY());this.canvasContext.lineTo(this.p2.getX(),this.p2.getY());this.canvasContext.lineTo(this.p3.getX(),this.p3.getY());this.canvasContext.closePath();if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},p1:"Point2D",p2:"Point2D",p3:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasEllipse=function(layer,x,y,radiusX,radiusY){Ellipse.call(this,layer,x,y,radiusX,radiusY);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasEllipse=stjs.extend(CanvasEllipse,Ellipse,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();this.canvasContext.translate(stjs.trunc(Math.round(this.x-this.radiusX)),stjs.trunc(Math.round(this.y-this.radiusY)));this.canvasContext.scale(this.radiusX,this.radiusY);this.canvasContext.arc(1,1,1,this.startAngle,this.endAngle,false);if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.lineWidth=this.lineWidth;this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed&&this.dashValues!=null){this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){if(this.canvasContext.ellipse){this.canvasContext.save();if(this.bounds!=null){var boundsX=stjs.trunc(Math.round(this.bounds.getLeft()));var boundsY=stjs.trunc(Math.round(this.bounds.getTop()));var boundsWidth=stjs.trunc(Math.round(this.bounds.getOuterWidth(true)));var boundsHeight=stjs.trunc(Math.round(this.bounds.getOuterHeight(true)));this.canvasContext.beginPath();this.canvasContext.rect(boundsX,boundsY,boundsWidth,boundsHeight);this.canvasContext.clip();}
this.canvasContext.beginPath();try{this.canvasContext.ellipse(this.x,this.y,Math.abs(this.radiusX),Math.abs(this.radiusY),0,0,Math.PI*2);}catch(e){this.canvasContext.restore();this.renderEllipse();return;}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.canvasContext.lineWidth=this.lineWidth;this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();}else{this.renderEllipse();}};prototype.renderEllipse=function(){var kappa=0.5522848;var ox=this.radiusX*kappa;var oy=this.radiusY*kappa;var xCenter=this.x;var yCenter=this.y;var xLeft=stjs.trunc(Math.round(this.x-this.radiusX));var yTop=stjs.trunc(Math.round(this.y-this.radiusY));var xRight=stjs.trunc(Math.round(this.x+this.radiusX));var yBottom=stjs.trunc(Math.round(this.y+this.radiusY));var yIntermTop=stjs.trunc(Math.round(yCenter-oy));var xIntermLeft=stjs.trunc(Math.round(xCenter-ox));var yIntermBottom=stjs.trunc(Math.round(yCenter+oy));var xIntermRight=stjs.trunc(Math.round(xCenter+ox));this.canvasContext.save();if(this.bounds!=null){var boundsX=stjs.trunc(Math.round(this.bounds.getLeft()));var boundsY=stjs.trunc(Math.round(this.bounds.getTop()));var boundsWidth=stjs.trunc(Math.round(this.bounds.getOuterWidth(true)));var boundsHeight=stjs.trunc(Math.round(this.bounds.getOuterHeight(true)));this.canvasContext.beginPath();this.canvasContext.rect(boundsX,boundsY,boundsWidth,boundsHeight);this.canvasContext.clip();}
this.canvasContext.beginPath();this.canvasContext.moveTo(xLeft,this.y);this.canvasContext.bezierCurveTo(xLeft,yIntermTop,xIntermLeft,yTop,xCenter,yTop);this.canvasContext.bezierCurveTo(xIntermRight,yTop,xRight,yIntermTop,xRight,yCenter);this.canvasContext.bezierCurveTo(xRight,yIntermBottom,xIntermRight,yBottom,xCenter,yBottom);this.canvasContext.bezierCurveTo(xIntermLeft,yBottom,xLeft,yIntermBottom,xLeft,yCenter);if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.canvasContext.lineWidth=this.lineWidth;this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},bounds:"AreaBound",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var ChartElementFactory=function(){};ChartElementFactory=stjs.extend(ChartElementFactory,null,[],function(constructor,prototype){constructor.createCircle=function(layer,x,y,radius){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasCircle(layer,x,y,radius);}
return null;};constructor.createLine=function(layer,x1,y1,x2,y2,width){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasLine(layer,x1,y1,x2,y2,width);}
return null;};constructor.createTriangle=function(layer,x1,y1,x2,y2,x3,y3){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasTriangle(layer,x1,y1,x2,y2,x3,y3);}
return null;};constructor.createSimpleIsocelesTriangle=function(layer,baseLineCenterX,baseLineY,baseLineWidth,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){var x1=baseLineCenterX;var y1=baseLineY+height;var halfWidth=baseLineWidth/2.0;var x2=stjs.trunc(Math.round(baseLineCenterX-halfWidth));var y2=baseLineY;var x3=stjs.trunc(Math.round(baseLineCenterX+halfWidth));var y3=baseLineY;return new CanvasTriangle(layer,x1,y1,x2,y2,x3,y3);}
return null;};constructor.createPath=function(layer,width){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasPath(layer,width);}
return null;};constructor.createPolygon=function(layer,x,y,width){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasPolygon(layer,x,y,width);}
return null;};constructor.createRect=function(layer,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasRect(layer,x,y,width,height);}
return null;};constructor.createLabel=function(layer,value,formattedValue,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasLabel(layer,value,formattedValue,x,y,width,height);}
return null;};constructor.createDrawTextLabel=function(layer,value,formattedValue,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new EditableCanvasLabel(layer,value,formattedValue,x,y,width,height);}
return null;};constructor.createToolTip=function(layer,parent,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){var tooltip=new CanvasToolTip();tooltip.init(layer,parent,x,y,width,height);}
return null;};constructor.createIcon=function(layer,x,y,width,height,iconType){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return CanvasIcon.createIcon(layer,x,y,width,height,iconType);}
return null;};constructor.createEllipse=function(layer,x,y,radiusX,radiusY){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasEllipse(layer,x,y,radiusX,radiusY);}
return null;};},{},{});
var InteractiveShape=function(){this.id="iShape_"+new Date().getTime()+"_"+Math.round((Math.random()*1000));this.pointsValues=[];this.anchorPoints=[];this.complete=false;this.textColor=ChartColor.black;this.strokeColor=ChartColor.black;this.fillColor=ChartColor.transparent;this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;this.fontSize=12;this.lineWidth=1;this.isCurrentLogScale=false;};InteractiveShape=stjs.extend(InteractiveShape,null,[],function(constructor,prototype){constructor.INSIDE_DISTANCE_MAX=5;constructor.ANCHOR_POINT_RADIUS=4;constructor.SOLID_LINE_STYLE="solid";constructor.NO_LINE_STYLE="none";constructor.LEGACY_FONT_PREFIX="Dialog-PLAIN-";constructor.ZERO_PAD="000000";constructor.MAX_DAYS_TO_LIVE=15;constructor.REFERENCE_DATE_TIME_FORMAT="yyyy-mm-dd";prototype.pointsValues=null;prototype.anchorPoints=null;prototype.npoints=0;prototype.id=null;prototype.associatedAreaId=null;prototype.yAxisAreaId=null;prototype.complete=false;prototype.isCurrentLogScale=false;prototype.groupId=null;prototype.currentPosition=null;prototype.referenceDate=null;prototype.referenceFreq=0;prototype.currentContext=null;prototype.contextXRange=null;prototype.contextAbsoluteStart=null;prototype.contextYRange=null;prototype.contextWidth=0.0;prototype.contextHeight=0.0;prototype.contextFreq=null;prototype.contextUpdated=false;prototype.contextLength=0;prototype.lineStyle=null;prototype.lineWidth=0;prototype.fontSize=0;prototype.textColor=null;prototype.strokeColor=null;prototype.fillColor=null;prototype.transformAnchorId=null;prototype.transformOriginX=null;prototype.transformOriginY=null;prototype.isContextUpdated=function(){return this.contextUpdated;};prototype.isExpired=function(){if(this.referenceDate!=null&&this.groupId=="intraday"){var daysSince=DateUtil.daysSince(this.referenceDate.getTime(),DateUtil.todayDateOnly().getTime());if(daysSince>InteractiveShape.MAX_DAYS_TO_LIVE){return true;}}
return false;};prototype.getShapes=function(layer,view,data,context){if(!this.isCurrentContext(data,context,view)){this.updateContext(data,context,view);}
var translatedPoints=this.getExtendedAnchorPointsTranslated(context,view);var translatedElements=this.getElementsFromPoints(translatedPoints,view,layer,context);if(translatedElements!=null){return translatedElements;}
var mainPoints=this.getExtendedAnchorPoints(context,view);return this.getElementsFromPoints(mainPoints,view,layer,context);};prototype.willElementChange=function(data){var newFreq=Frequency.extractFrequency(data.getMainSerie(),this.getDefaultFrequency());if(this.isHistoGroup()&&(this.contextFreq==null||newFreq.getTimeValue()!=this.contextFreq.getTimeValue())){return true;}
return false;};prototype.getAnchorPoints=function(layer,view,chartData,context){if(!this.isCurrentContext(chartData,context,view)){this.updateContext(chartData,context,view);}
var points=this.getExtendedAnchorPointsTranslated(context,view);if(points==null){points=this.getExtendedAnchorPoints(context,view);}
if(points!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var left=stjs.trunc(graphBounds.getContentLeft());var top=stjs.trunc(graphBounds.getContentTop());for(var index in points){if(!(points).hasOwnProperty(index))
continue;var point=points[index];if(point!=null){var anchor=ChartElementFactory.createCircle(layer,left+point.getX(),top+point.getY(),InteractiveShape.ANCHOR_POINT_RADIUS);anchor.setFillShape(true);anchor.setFillColor(ChartColor.white);shapes.push(anchor);}}
return shapes;}
return null;};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){var currentArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var validArea=chart.getChartView().getArea(this.associatedAreaId);if(currentArea==null||currentArea.getAreaBound()==null||chart==null||currentArea.getId()!=validArea.getId()){return false;}else if(this.anchorPoints.length>=this.npoints){return true;}
var context=chart.getEngineModel().getContext();var areaBound=currentArea.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-areaBound.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-areaBound.getContentTop()));if(this.anchorPoints.length==0){this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=areaBound.getWidth();this.contextHeight=areaBound.getHeight();if(chart.getChartData()!=null){this.isCurrentLogScale=chart.getChartData().isLogScale();}else{this.isCurrentLogScale=false;}}
if(localXPosition>this.contextWidth){return false;}else if(localXPosition<0){return false;}
this.addPointValue(chart.getChartData(),context,localXPosition,localYPosition);this.anchorPoints.push(this.getUniquePointIn(new Point2D(localXPosition,localYPosition),this.anchorPoints));this.complete=this.anchorPoints.length>=this.npoints;return this.complete;};prototype.addPointValue=function(data,context,localXPosition,localYPosition){if((this.groupId!="intraday"&&this.groupId!="histo")||this.contextWidth<=0||this.contextHeight<=0||this.contextXRange==null||this.contextYRange==null||data==null){return;}
var mainSerie=data.getMainSerie();var freq=null;var currentLength=0;if(mainSerie!=null){currentLength=mainSerie.getLength();var mainSerieF=mainSerie;if(mainSerie.getPeriod&&mainSerieF.getPeriod()!=null){freq=mainSerieF.getPeriod().getFrequency();}}
if(freq==null||freq.isLive()){freq=Frequency.MINUTE;}
if(this.pointsValues.length==0){this.currentContext=context;this.contextFreq=freq;this.contextLength=currentLength;this.contextAbsoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:0);}
this.setPointValue(this.pointsValues.length,data,context,localXPosition,localYPosition);};prototype.setPointValue=function(i,data,context,localXPosition,localYPosition){if((this.groupId!="intraday"&&this.groupId!="histo")||this.contextWidth<=0||this.contextHeight<=0||this.contextXRange==null||this.contextYRange==null||data==null){return;}
var yValue=context.getYValueFromYPosition(localYPosition,this.contextHeight,this.yAxisAreaId,this.associatedAreaId==DefaultLayout.GRAPH_AREA);var xValue=this.getXValueFromXPosition(data,context,new Double(localXPosition),this.contextWidth,this.groupId);this.pointsValues[i]=new Point2Df(xValue,yValue);};prototype.getXValueFromXPosition=function(data,context,localXPosition,contextWidth,groupId){var mainSerie=data.getMainSerie();var freq=null;if(mainSerie!=null){var mainSerieF=mainSerie;if(mainSerie.getPeriod&&mainSerieF.getPeriod()!=null){freq=mainSerieF.getPeriod().getFrequency();}}
var contextXRange=context.getRange(Serie.X);var rangeStart=contextXRange!=null?contextXRange[0]:0.0;var xValue=localXPosition/contextWidth*data.getCurrentXSpaceSize(contextXRange);xValue=data.xSpace2NormalizedXValueNegative(xValue);xValue=rangeStart!=null?xValue+rangeStart:xValue;var serie=data.getMainSerie();if(serie.isIntraday()&&groupId=="intraday"){if(freq.isLive()){freq=Frequency.MINUTE;}
var absoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:0);var absoluteEnd=(data.getExtremums()!=null?data.getExtremums()[1]:0);var absoluteRange=[absoluteStart,absoluteEnd];var rangeValue=(rangeStart-absoluteStart)/freq.getTimeValue();var rangePoint=new Point2Df(rangeValue,0.0);var rangeXPosition=InteractiveShape.getXPositionFromXValue(data,context,absoluteRange,this.referenceFreq,rangePoint.getX(),groupId,contextWidth,absoluteStart);xValue=rangeXPosition/contextWidth*data.getCurrentXSpaceSize(absoluteRange);xValue+=localXPosition/contextWidth*data.getCurrentXSpaceSize(contextXRange);xValue=data.xSpace2NormalizedXValueNegative(xValue);xValue-=absoluteStart;xValue/=freq.getTimeValue();}
return xValue;};prototype.getElementsFromPoints=function(points,view,layer,context){};prototype.getPointsInContext=function(points,context,view){if(points!=null){var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var boundsTranslation=new Vector2D(graphBounds.getContentLeft(),graphBounds.getContentTop());var pointsInContext=[];var pointsCount=points.length;for(var i=0;i<pointsCount;i++){pointsInContext.push(points[i].add(boundsTranslation));}
return pointsInContext;}
return null;};prototype.getLinesInContext=function(points,context,view){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext.length>1){var pOrigin=pointsInContext[0];var p1=pOrigin;var p2=null;var pointsCount=pointsInContext.length;var lines=[];for(var i=1;i<pointsCount;i++){p2=pointsInContext[i];lines.push(new Line2D(p1,p2));p1=p2;}
if(pointsInContext.length>2){lines.push(new Line2D(p2,pOrigin));}
return lines;}
return null;};prototype.getExtendedAnchorPoints=function(context,view){if(context==null||view==null||this.anchorPoints.length==0||(this.anchorPoints.length==1&&context.getCurrentPosition()==null&&this.npoints>1)||view.getArea(this.associatedAreaId)==null){return null;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var anchorPointsClone=[];var anchorPointsOrigin=this.anchorPoints;for(var index in anchorPointsOrigin){if(!(anchorPointsOrigin).hasOwnProperty(index))
continue;var point=anchorPointsOrigin[index];if(point!=null){anchorPointsClone.push(point.getClone());}}
if(anchorPointsOrigin.length<this.npoints){var currentPosition=context.getCurrentPosition();var localXPosition=stjs.trunc(Math.round(currentPosition.getX()-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(currentPosition.getY()-graphBounds.getContentTop()));currentPosition=new Point2D(localXPosition,localYPosition);currentPosition=this.getUniquePointIn(currentPosition,anchorPointsClone);anchorPointsClone.push(currentPosition);}
return anchorPointsClone;};prototype.getExtendedAnchorPointsTranslated=function(context,view){var translation=this.getTranslation(context);if(translation!=null&&translation.dot(translation)>0){var points=this.getExtendedAnchorPoints(context,view);if(points!=null){var anchorPointsTranslated=[];var pointsCount=points.length;for(var i=0;i<pointsCount;i++){var point=points[i];if(this.transformAnchorId==-1||this.transformAnchorId==i){point=point.add(translation);}
anchorPointsTranslated.push(point);}
return anchorPointsTranslated;}}
return null;};prototype.getUniquePointIn=function(point,points){if(ArrayUtil.containsSameObject(points,point)){var uniqueX=point.getX()+1;var y=point.getY();var uniquePoint=new Point2D(uniqueX,y);while(ArrayUtil.containsSameObject(points,uniquePoint)){uniqueX++;uniquePoint=new Point2D(uniqueX,y);}
return uniquePoint;}
return point;};prototype.isCurrentContext=function(data,context,view){if(data==null||context==null||view==null||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var width=graphBounds.getContentWidth();var height=graphBounds.getContentHeight();var xRange=context.getRange(Serie.X);var yRange=context.getRange(this.yAxisAreaId);if(xRange==null||yRange==null||this.contextXRange==null||this.contextYRange==null){return false;}
var sameIntradayPeriod=true;if(this.groupId=="intraday"){if(this.contextAbsoluteStart!=0&&this.contextAbsoluteStart!=data.getExtremums()[0]){sameIntradayPeriod=false;}}
var result=width==this.contextWidth&&height==this.contextHeight&&(this.isCurrentLogScale==data.isLogScale())&&ArrayUtil.isSameArray(xRange,this.contextXRange)&&ArrayUtil.isSameArray(yRange,this.contextYRange)&&sameIntradayPeriod;this.contextUpdated=!result;return result;};prototype.updateContext=function(data,context,view){if(context==null||view==null||view.getArea(this.associatedAreaId)==null){return;}
var area=view.getArea(this.associatedAreaId);var areaBound=area.getAreaBound();this.contextAbsoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:null);if(this.referenceDate==null&&this.contextAbsoluteStart!=null){this.referenceDate=DateUtil.createDateOnly(this.contextAbsoluteStart);}
if(this.referenceFreq==0){this.referenceFreq=Frequency.extractFrequency(data.getMainSerie(),this.getDefaultFrequency()).getTimeValue();}
this.anchorPoints=this.getAnchorPointsInContext(data,context,view);this.currentContext=context;this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=areaBound.getWidth();this.contextHeight=areaBound.getHeight();};prototype.getAssociatedAreaId=function(){return this.associatedAreaId;};prototype.setAssociatedAreaId=function(associatedAreaId){this.associatedAreaId=associatedAreaId;};prototype.isComplete=function(){return this.complete;};prototype.updatePosition=function(currentPosition){this.currentPosition=currentPosition;};prototype.setOriginTransform=function(anchor,offsetX,offsetY){this.transformAnchorId=anchor;this.transformOriginX=offsetX;this.transformOriginY=offsetY;};prototype.setEndTransform=function(offsetX,offsetY){if(this.transformAnchorId==null||this.transformOriginX==null||this.transformOriginY==null){this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;return;}
var data=this.currentContext!=null?this.currentContext.getData():null;var translation=new Vector2D(offsetX-this.transformOriginX,offsetY-this.transformOriginY);if(this.transformAnchorId<=-1){var pointsCount=this.anchorPoints.length;for(var i=0;i<pointsCount;i++){var currentPoint=this.anchorPoints[i];if(currentPoint!=null){var translatedPoint=currentPoint.add(translation);this.anchorPoints[i]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(i,data,this.currentContext,localXPosition,localYPosition);}}}else{var changedAnchor=this.anchorPoints[this.transformAnchorId];if(changedAnchor!=null){var translatedPoint=changedAnchor.add(translation);this.anchorPoints[this.transformAnchorId]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(this.transformAnchorId,data,this.currentContext,localXPosition,localYPosition);}}
this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;};prototype.validXPos=function(localXPosition){if(this.groupId=="intraday"){if(localXPosition<0){localXPosition=0;}else if(localXPosition>this.contextWidth){localXPosition=stjs.trunc(this.contextWidth);}}
return localXPosition;};prototype.getLineStyle=function(){return this.lineStyle;};prototype.setLineStyle=function(lineStyle){this.lineStyle=lineStyle;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getStrokeColor=function(){return this.strokeColor;};prototype.setStrokeColor=function(strokeColor){this.strokeColor=strokeColor;};prototype.getFillColor=function(){return this.fillColor;};prototype.setFillColor=function(fillColor){this.fillColor=fillColor;};prototype.serialize=function(){};prototype.unserializeFromXML=function(currentFigure){this.complete=true;this.groupId=XMLUtil.getValue(currentFigure,"group");this.applyStyle(XMLUtil.getNode(currentFigure,"style"));return this.initShapeFromXML(currentFigure);};prototype.initShapeFromXML=function(currentFigure){this.initReferenceValues(currentFigure);var itemNodes=XMLUtil.getChildNodes(currentFigure,"points");if(itemNodes!=null&&itemNodes.length==this.npoints){var currentValues=[];for(var i=0;i<this.npoints;i++){var currentItem=itemNodes[i];if(currentItem!=null){var p1Values=(currentItem.textContent).split(",");var p1X=parseFloat(p1Values[0]);var p1Y=parseFloat(p1Values[1]);if(p1X!=null&&p1Y!=null&&!isNaN(p1X)&&!isNaN(p1Y)){currentValues.push(new Point2Df(p1X,p1Y));}else{return false;}}else{return false;}}
this.pointsValues=currentValues;return true;}
return false;};prototype.initReferenceValues=function(currentFigure){var stringReferenceDate=XMLUtil.getValue(currentFigure,"referenceDate");if(stringReferenceDate!=null&&stringReferenceDate.length!=0){this.referenceDate=DateUtil.createDateOnly(new Date(stringReferenceDate).getTime());}
var stringReferenceFreq=XMLUtil.getValue(currentFigure,"referenceFreq");if(stringReferenceFreq!=null){this.referenceFreq=Long.parseLong(stringReferenceFreq);}};prototype.getShapeName=function(){};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){};prototype.getAnchorPointsInContext=function(data,context,view){if(context==null||view==null){return null;}else if(this.anchorPoints==null||this.anchorPoints.length==0){if(this.pointsValues!=null&&this.pointsValues.length>0){this.initAnchorPointsFromPointsValues(data,context,view);}else{return null;}}else if(this.groupId=="intraday"||this.isHistoGroup()){this.updatePointsValues(data,context,view);this.initAnchorPointsFromPointsValues(data,context,view);}
var pointsInContext=[];var pointsCount=this.anchorPoints.length;for(var i=0;i<pointsCount;i++){var currentPoint=this.getPointInContext(this.anchorPoints[i],context,view);pointsInContext.push(currentPoint);}
return pointsInContext;};prototype.updatePointsValues=function(data,newContext,newView){if(this.contextFreq==null||newContext==null){return false;}
var ratio=1.0;var translation=0.0;var mainSerie=(newContext.getData()!=null?newContext.getData().getMainSerie():null);var newFreq=Frequency.extractFrequency(data.getMainSerie(),this.getDefaultFrequency());var newLength=0;if(mainSerie!=null){newLength=mainSerie.getLength();}
if(newFreq==null||this.contextLength<=0||newLength<=0){return false;}
if(newFreq.isLive()){newFreq=Frequency.MINUTE;}
var periodChange=false;if(this.isHistoGroup()){if(newFreq.getTimeValue()==this.contextFreq.getTimeValue()&&newLength==this.contextLength){return true;}else if(newFreq.getTimeValue()==this.contextFreq.getTimeValue()){periodChange=true;}
if(periodChange){translation=(newLength-this.contextLength);}else{ratio=newLength/this.contextLength;}
for(var index in this.pointsValues){if(!(this.pointsValues).hasOwnProperty(index))
continue;var currentValue=this.pointsValues[index];if(currentValue!=null){var xValue=currentValue.getX();var xValueUpdated=xValue*ratio+translation;this.pointsValues[index]=new Point2Df(xValueUpdated,currentValue.getY());}}}
this.currentContext=newContext;this.contextFreq=newFreq;this.contextLength=newLength;return true;};prototype.updateValue=function(data,newContext,currentValue){var xPos;var contextXRange=this.currentContext.getRange(Serie.X);xPos=InteractiveShape.getXPositionFromXValue(data,this.currentContext,contextXRange,this.referenceFreq,currentValue.getX(),this.groupId,this.contextWidth,this.contextAbsoluteStart);var xValue=this.getXValueFromXPosition(data,newContext,xPos,this.contextWidth,this.groupId);return xValue;};prototype.initAnchorPointsFromPointsValues=function(data,context,view){if(context==null||view==null||view.getArea(this.associatedAreaId)==null){return;}
var area=view.getArea(this.associatedAreaId);var areaBounds=area.getAreaBound();var width=areaBounds.getContentWidth();var height=areaBounds.getContentHeight();if(width<=0||height<=0){return;}
this.anchorPoints=[];this.currentContext=context;this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=width;this.contextHeight=height;this.isCurrentLogScale=data.isLogScale();this.contextLength=0;var mainSerie=(context.getData()!=null?context.getData().getMainSerie():null);if(mainSerie!=null){this.contextLength=mainSerie.getLength();}
var freq=Frequency.extractFrequency(data.getMainSerie(),this.getDefaultFrequency());this.contextFreq=freq;var xPos=0.0;var absoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:0);for(var index in this.pointsValues){if(!(this.pointsValues).hasOwnProperty(index))
continue;var currentValue=this.pointsValues[index];if(currentValue!=null){if(this.groupId=="intraday"){xPos=this.getIntraDayXAnchorPoint(currentValue.getX(),data);}else{var contextXRange=context.getRange(Serie.X);xPos=InteractiveShape.getXPositionFromXValue(data,context,contextXRange,this.referenceFreq,currentValue.getX(),this.groupId,this.contextWidth,absoluteStart);}
var yPos=context.getPositionFromYValue(currentValue.getY(),height,this.yAxisAreaId,this.associatedAreaId==DefaultLayout.GRAPH_AREA);if(xPos!=null&&yPos!=null){var x=stjs.trunc(Math.round(xPos));var y=stjs.trunc(Math.round(yPos));this.anchorPoints.push(new Point2D(x,y));}}}};prototype.getIntraDayXAnchorPoint=function(currentXValue,data){if(this.referenceDate==null||data==null||data.getMinXValue()==null){return currentXValue;}
var contextStartDate=DateUtil.createDateOnly(this.contextXRange[0]);var absoluteStart=new Date(data.getMinXValue().longValue());absoluteStart.setYear(stjs.trunc(contextStartDate.getUTCFullYear()));absoluteStart.setDate(stjs.trunc(contextStartDate.getDate()));var contextX=this.getXRelativeToReferenceDate(currentXValue,contextStartDate);var xPositionFromXValue=InteractiveShape.getXPositionFromXValue(data,this.currentContext,this.contextXRange,this.referenceFreq,contextX,this.groupId,this.contextWidth,absoluteStart.getTime());return xPositionFromXValue;};prototype.getXRelativeToReferenceDate=function(xValue,contextStartDate){if(!DateUtil.isSameDay(this.referenceDate,contextStartDate)){var startDateInMillis=contextStartDate.getTime();xValue=xValue+(this.referenceDate.getTime()-startDateInMillis)/this.referenceFreq;}
return xValue;};prototype.getDefaultFrequency=function(){if(this.isHistoGroup()){return Frequency.DAY;}
return Frequency.MINUTE;};prototype.isHistoGroup=function(){return this.groupId=="histo";};constructor.getXPositionFromXValue=function(data,context,contextXRange,freqInMs,xValue,groupId,contextWidth,absoluteStart){var xPos=0.0;var rangeStart=contextXRange!=null?contextXRange[0]:0.0;var serie=data.getMainSerie();if(serie!=null&&serie.isIntraday()&&groupId=="intraday"){xValue=xValue*freqInMs;var xValueInSpace=xValue+absoluteStart;xValueInSpace-=data.normalizeXSpaceNight(xValueInSpace);rangeStart-=data.normalizeXSpaceNight(rangeStart);var newValue=xValueInSpace-rangeStart;xPos=newValue*contextWidth/data.getCurrentXSpaceSize(contextXRange);}else if(groupId=="histo"){xPos=context.getPositionFromXSpaceValue(xValue,contextWidth);}
return xPos;};prototype.getPointInContext=function(point,context,view){if(context==null||view==null||point==null||view.getArea(this.associatedAreaId)==null){return null;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var width=graphBounds.getContentWidth();var height=graphBounds.getContentHeight();var x1PositionInContext=this.getXPositionInContext(context,point.getX(),width);var y1PositionInContext=this.getYPositionInContext(context,point.getY(),height);if(x1PositionInContext==null||y1PositionInContext==null||isNaN(x1PositionInContext)||isNaN(y1PositionInContext)){return null;}
return new Point2D(stjs.trunc(Math.round(x1PositionInContext)),stjs.trunc(Math.round(y1PositionInContext)));};prototype.getXPositionInContext=function(context,x,width){if(context==null||width<=0||this.contextWidth<=0||context.getRange(Serie.X)==null){return null;}
var xRange=context.getRange(Serie.X);if(xRange==null||xRange[0]==null||xRange[1]==null||xRange[0]==xRange[1]||this.contextXRange==null){return null;}
var widthRatio=width/this.contextWidth;var newValueLength=(xRange[1]-xRange[0]);var originalLength=(this.contextXRange[1]-this.contextXRange[0]);var pixelPerValue=width/newValueLength;var translationValue=(this.contextXRange[0]-xRange[0])*pixelPerValue;var scaledValue=x*widthRatio*originalLength/newValueLength;return scaledValue+translationValue;};prototype.getYPositionInContext=function(context,y,height){if(context==null||height<=0||this.contextHeight<=0||context.getRange(this.yAxisAreaId)==null){return null;}
var yRange=context.getRange(this.yAxisAreaId);if(yRange==null||yRange[0]==null||yRange[1]==null||yRange[0]==yRange[1]||this.contextYRange==null){return null;}
var heightRatio=height/this.contextHeight;var newValueLength=(yRange[1]-yRange[0]);var originalLength=(this.contextYRange[1]-this.contextYRange[0]);var pixelPerValue=height/newValueLength;var translationValue=(yRange[1]-this.contextYRange[1])*pixelPerValue;var scaledValue=y*heightRatio*originalLength/newValueLength;return scaledValue+translationValue;};prototype.projectLineOnBounds=function(baseline,graphBounds){if(baseline==null){return null;}
var borders=graphBounds.getInnerBordersLines();var firstPoint=null;for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(baseline);if(intersection!=null&&graphBounds.isInside(intersection.getX(),intersection.getY())){if(firstPoint==null){firstPoint=intersection;}else if(!firstPoint.equals(intersection)){var p1Dist=firstPoint.distanceSquared(baseline.getP1());var p2Dist=firstPoint.distanceSquared(baseline.getP2());if(p1Dist<p2Dist){return new Line2D(firstPoint,intersection);}
return new Line2D(intersection,firstPoint);}}}}
return null;};prototype.clipLineInViewport=function(baseline,graphBounds){if(baseline==null||graphBounds==null){return null;}
var borders=graphBounds.getInnerBordersLines();var topLine=borders[0];var leftLine=borders[1];var bottomLine=borders[2];var rightLine=borders[3];var p1Segment=baseline.getP1();var p2Segment=baseline.getP2();var pointInside=p2Segment;var pointInsideIsP1=false;if(graphBounds.isInside(p1Segment.getX(),p1Segment.getY())&&graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){return baseline;}else if(!graphBounds.isInside(p1Segment.getX(),p1Segment.getY())&&!graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){var top=topLine.getP1().getY();var left=leftLine.getP1().getX();var bottom=bottomLine.getP1().getY();var right=rightLine.getP1().getX();if((p1Segment.getX()<=left&&p2Segment.getX()<=left)||(p1Segment.getX()>=right&&p2Segment.getX()>=right)||(p1Segment.getY()<=top&&p2Segment.getY()<=top)||(p1Segment.getY()>=bottom&&p2Segment.getY()>=bottom)){return null;}
return this.projectLineOnBounds(baseline,graphBounds);}else if(graphBounds.isInside(p1Segment.getX(),p1Segment.getY())){pointInside=p1Segment;pointInsideIsP1=true;}
for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(baseline);if(intersection!=null&&graphBounds.isInside(intersection.getX(),intersection.getY())){if(Point2D.isPointBetween(intersection,p1Segment,p2Segment)){if(pointInsideIsP1){return new Line2D(pointInside,intersection);}
return new Line2D(intersection,pointInside);}}}}
return null;};prototype.clipAndProjectLine=function(baseline,graphBounds){if(baseline==null||graphBounds==null){return null;}
var borders=graphBounds.getInnerBordersLines();var p1Segment=baseline.getP1();var p2Segment=baseline.getP2();if(!graphBounds.isInside(p1Segment.getX(),p1Segment.getY())){if(graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){return this.projectLineOnBounds(baseline,graphBounds);}else if(graphBounds.isXInside(p1Segment.getX())){if(borders[0].dist(p2Segment)<borders[0].dist(p1Segment)){return this.projectLineOnBounds(baseline,graphBounds);}
return null;}else if(graphBounds.isYInside(p1Segment.getY())){if(borders[1].dist(p2Segment)<borders[1].dist(p1Segment)){return this.projectLineOnBounds(baseline,graphBounds);}
return null;}else{if(borders[0].dist(p2Segment)<borders[0].dist(p1Segment)&&borders[1].dist(p2Segment)<borders[1].dist(p1Segment)){return this.projectLineOnBounds(baseline,graphBounds);}
return null;}}else if(!graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){return this.clipLineInViewport(baseline,graphBounds);}
for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(baseline);if(intersection!=null&&graphBounds.isInside(intersection.getX(),intersection.getY())){if(Point2D.isPointBetween(p2Segment,p1Segment,intersection)){return new Line2D(p1Segment,intersection);}}}}
return null;};prototype.getTranslation=function(context){if(this.transformOriginX==null||this.transformOriginY==null||context==null||context.getCurrentPosition()==null){return null;}
var currentPosition=context.getCurrentPosition();return new Vector2D(currentPosition.getX()-this.transformOriginX,currentPosition.getY()-this.transformOriginY);};prototype.isMoving=function(context){return this.getTranslation(context)!=null;};prototype.getStyleString=function(){var content=XMLUtil.createNodeString("font",InteractiveShape.LEGACY_FONT_PREFIX+this.fontSize);if(this.textColor!=null){var cssHex=this.textColor.toHex();if(cssHex!=null){cssHex=cssHex.replaceFirst("#","0x");content+=XMLUtil.createNodeString("foreground",cssHex);}else{content+=XMLUtil.createNodeString("foreground","0x0");}}
if(this.fillColor!=null&&!this.fillColor.isTransparent()){var cssHex=this.fillColor.toHex();if(cssHex!=null){cssHex=cssHex.replaceFirst("#","0x");content+=XMLUtil.createNodeString("background",cssHex);}else{content+=XMLUtil.createNodeString("background","0x0");}}
if(this.strokeColor!=null&&!this.strokeColor.isTransparent()){var cssHex=this.strokeColor.toHex();if(cssHex!=null){cssHex=cssHex.replaceFirst("#","0x");content+=XMLUtil.createNodeString("border",this.lineStyle+" "+this.lineWidth+" "+cssHex);}else{content+=XMLUtil.createNodeString("border",this.lineStyle+" "+this.lineWidth+" "+"0x0");}}
return XMLUtil.createNodeString("style",content);};prototype.applyStyle=function(styleNode){var fontValue=XMLUtil.getValue(styleNode,"font");var foregroundValue=XMLUtil.getValue(styleNode,"foreground");var backgroundValue=XMLUtil.getValue(styleNode,"background");var borderValue=XMLUtil.getValue(styleNode,"border");if(fontValue!=null){var parsedValue=parseInt(fontValue.replaceFirst(InteractiveShape.LEGACY_FONT_PREFIX,""));if(parsedValue!=null&&!isNaN(parsedValue)){this.fontSize=parsedValue;}else{this.fontSize=12;}}else{this.fontSize=12;}
if(foregroundValue!=null&&!(foregroundValue==Color.TRANSPARENT)){var cssHex=foregroundValue.replaceFirst("0x","");if(cssHex!=null){cssHex="#"+InteractiveShape.ZERO_PAD.substring(0,InteractiveShape.ZERO_PAD.length-cssHex.length)+cssHex;this.textColor=new ChartColor(ChartColor.ColorType.SIMPLE,[cssHex],null);}else{this.textColor=ChartColor.black;}}else{this.textColor=ChartColor.transparent;}
if(backgroundValue!=null&&!(backgroundValue==Color.TRANSPARENT)){var cssHex=backgroundValue.replaceFirst("0x","");if(cssHex!=null){cssHex="#"+InteractiveShape.ZERO_PAD.substring(0,InteractiveShape.ZERO_PAD.length-cssHex.length)+cssHex;this.fillColor=new ChartColor(ChartColor.ColorType.SIMPLE,[cssHex],null);}else{this.fillColor=null;}}else{this.fillColor=ChartColor.transparent;}
if(borderValue!=null){var borderValues=(borderValue).split(" ");var borderStyle=borderValues[0];var borderWidth=borderValues[1];var borderColor=borderValues[2];if(borderStyle!=null){this.lineStyle=borderStyle;}else{this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;}
var bw=parseInt(borderWidth);if(bw!=null&&!isNaN(bw)){this.lineWidth=bw;}else{this.lineWidth=1;}
if(borderColor!=null){var cssHex=borderColor.replaceFirst("0x","");if(cssHex!=null){cssHex="#"+InteractiveShape.ZERO_PAD.substring(0,InteractiveShape.ZERO_PAD.length-cssHex.length)+cssHex;this.strokeColor=new ChartColor(ChartColor.ColorType.SIMPLE,[cssHex],null);}else{this.strokeColor=ChartColor.black;}}else{this.strokeColor=ChartColor.black;}}else{this.strokeColor=ChartColor.black;this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;this.lineWidth=1;}};prototype.setReferenceDate=function(referenceDate){this.referenceDate=referenceDate;};prototype.setReferenceFreq=function(referenceFreq){this.referenceFreq=referenceFreq;};prototype.getReferenceFreq=function(){return this.referenceFreq;};prototype.getGroupId=function(){return this.groupId;};prototype.setGroupId=function(groupId){this.groupId=groupId;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getTextColor=function(){return this.textColor;};prototype.setFontSize=function(textSize){this.fontSize=textSize;};prototype.getFontSize=function(){return this.fontSize;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Utils=function(){};Utils=stjs.extend(Utils,null,[],null,{},{});
var InfiniteLine=function(areaId,yAxisId){InteractiveShape.call(this);this.associatedAreaId=areaId;this.yAxisAreaId=yAxisId;this.anchorPoints=[];this.npoints=2;this.closePath=false;};InfiniteLine=stjs.extend(InfiniteLine,InteractiveShape,[],function(constructor,prototype){constructor.NAME="line";constructor.NPOINTS_ID="-3";prototype.closePath=false;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null){var color=null;var isDash=null;var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var pathShape=ChartElementFactory.createPath(layer,this.lineWidth);var previousP2=null;for(var index in lines){if(!(lines).hasOwnProperty(index))
continue;var line=lines[index];var croppedLine2D=this.applyModification(line,graphBounds);if(croppedLine2D!=null){var p1=croppedLine2D.getP1();var p2=croppedLine2D.getP2();if(p1.equals(previousP2)){pathShape.pushPoint(p2.getX(),p2.getY());}else{pathShape.pushPoint(p1.getX(),p1.getY());pathShape.pushPoint(p2.getX(),p2.getY());}
previousP2=p2;}}
pathShape.setClosePath(this.closePath);if(InteractiveShape.NO_LINE_STYLE.equals(this.lineStyle)){color=this.strokeColor.constructor.transparent;isDash=false;}else{color=this.strokeColor;isDash=!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle);}
pathShape.setDashed(isDash);pathShape.setStrokeColor(color);pathShape.setDashStyle(this.lineStyle);pathShape.setFillColor(this.fillColor);pathShape.setFillShape(this.fillColor!=null);pathShape.setStrokeShape(this.strokeColor!=null);shapes.push(pathShape);return shapes;}else{return null;}};prototype.applyModification=function(line,bounds){return this.projectLineOnBounds(line,bounds);};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(x,y);var line=new Line2D(this.anchorPoints[0],this.anchorPoints[1]);return line.dist(point)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.serialize=function(){var content="";var pointsId=this.getNPointsId();if(pointsId!=null){content=XMLUtil.createNodeString("npoints",pointsId);}
content+=this.serializeReferenceValues();content+=XMLUtil.createNodeString("group",this.groupId)+InfiniteLine.getStringFromArray("points",this.pointsValues)+this.getStyleString();return XMLUtil.createNodeString(this.getShapeName(),content);};prototype.serializeReferenceValues=function(){var serializedValues="";if(this.referenceDate!=null){serializedValues+=XMLUtil.createNodeString("referenceDate",DateTimeFormatter.formatAs(this.referenceDate,InteractiveShape.REFERENCE_DATE_TIME_FORMAT));}
if(this.referenceFreq!=0){serializedValues+=XMLUtil.createNodeString("referenceFreq",String.valueOf(this.referenceFreq));}
return serializedValues;};constructor.getStringFromArray=function(name,list){var values="";for(var index in list){if(!(list).hasOwnProperty(index))
continue;var value=list[index];if(value!=null&&value.getX()!=null&&value.getY()!=null){values+=XMLUtil.createNodeString("item",(value.getX()).toFixed(4)+","+(value.getY()).toFixed(4));}else{values+="<item/>";}}
return XMLUtil.createNodeString(name,values);};prototype.getShapeName=function(){return InfiniteLine.NAME;};prototype.getNPointsId=function(){return InfiniteLine.NPOINTS_ID;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Segment=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);};Segment=stjs.extend(Segment,InfiniteLine,[],function(constructor,prototype){prototype.applyModification=function(line,bounds){return line;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(x,y);var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];var line=new Line2D(p1,p2);return line.distFromSegment(point)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.getNPointsId=function(){return String.valueOf(this.npoints);};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InfiniteVerticalLine=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.npoints=1;};InfiniteVerticalLine=stjs.extend(InfiniteVerticalLine,InfiniteLine,[],function(constructor,prototype){constructor.NPOINTS_ID="-1";prototype.getElementsFromPoints=function(points,view,layer,context){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var p1=pointsInContext[0];var p2=new Point2D(p1.getX(),p1.getY()+1);var line=new Line2D(p1,p2);var croppedLine2D=this.applyModification(line,graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var croppedLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);croppedLineElement.setDashed(!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle));croppedLineElement.setDashStyle(this.lineStyle);croppedLineElement.setStrokeColor(this.strokeColor);croppedLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(croppedLineElement);}
return shapes;}else{return null;}};prototype.getYPositionInContext=function(context,localYPosition,height){return localYPosition;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var anchorX=this.anchorPoints[0].getX();return Math.abs(x-anchorX)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.getNPointsId=function(){return InfiniteVerticalLine.NPOINTS_ID;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InfiniteHorizontalLine=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.npoints=1;};InfiniteHorizontalLine=stjs.extend(InfiniteHorizontalLine,InfiniteLine,[],function(constructor,prototype){constructor.NPOINTS_ID="-2";prototype.getElementsFromPoints=function(points,view,layer,context){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var p1=pointsInContext[0];var p2=new Point2D(p1.getX()+1,p1.getY());var line=new Line2D(p1,p2);var croppedLine2D=this.applyModification(line,graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var croppedLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);croppedLineElement.setDashed(!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle));croppedLineElement.setDashStyle(this.lineStyle);croppedLineElement.setStrokeColor(this.strokeColor);croppedLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(croppedLineElement);}
return shapes;}else{return null;}};prototype.getXPositionInContext=function(context,localXPosition,width){return localXPosition;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var anchorY=this.anchorPoints[0].getY();return Math.abs(y-anchorY)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.getNPointsId=function(){return InfiniteHorizontalLine.NPOINTS_ID;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Triangle=function(areaId,yAxisId){Segment.call(this,areaId,yAxisId);this.npoints=3;this.closePath=true;};Triangle=stjs.extend(Triangle,Segment,[],function(constructor,prototype){prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(localXPosition,localYPosition);return MathUtil.isPointInsideTriangle(point,this.anchorPoints[0],this.anchorPoints[1],this.anchorPoints[2]);};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Quadrilateral=function(areaId,yAxisId){Triangle.call(this,areaId,yAxisId);this.npoints=4;};Quadrilateral=stjs.extend(Quadrilateral,Triangle,[],function(constructor,prototype){prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(localXPosition,localYPosition);return MathUtil.isPointInPolygon(point,this.anchorPoints);};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Rectangle=function(areaId,yAxisId){Segment.call(this,areaId,yAxisId);this.npoints=2;this.closePath=true;};Rectangle=stjs.extend(Rectangle,Segment,[],function(constructor,prototype){constructor.NAME="rectangle";prototype.getExtendedAnchorPoints=function(context,view){if(context==null||view==null||this.anchorPoints.length==0||(this.anchorPoints.length==1&&context.getCurrentPosition()==null)||view.getArea(this.associatedAreaId)==null){return null;}
if(this.anchorPoints.length>1){return this.getPointsFromCorners(this.anchorPoints[0],this.anchorPoints[1]);}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var corner0=this.anchorPoints[0];var currentPosition=context.getCurrentPosition();var localXPosition=stjs.trunc(Math.round(currentPosition.getX()-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(currentPosition.getY()-graphBounds.getContentTop()));var corner1=new Point2D(localXPosition,localYPosition);return this.getPointsFromCorners(corner0,corner1);};prototype.getExtendedAnchorPointsTranslated=function(context,view){if(this.transformAnchorId==null||this.anchorPoints.length<this.npoints){return null;}
var translation=this.getTranslation(context);var corner0Translation=this.getCorner0Translation(translation);var corner1Translation=this.getCorner1Translation(translation);if((corner0Translation==null||corner0Translation.dot(corner0Translation)==0)&&(corner1Translation==null||corner1Translation.dot(corner1Translation)==0)){return null;}
var corner0=this.anchorPoints[0];var corner1=this.anchorPoints[1];if(corner0Translation!=null){corner0=corner0.add(corner0Translation);}
if(corner1Translation!=null){corner1=corner1.add(corner1Translation);}
return this.getPointsFromCorners(corner0,corner1);};prototype.setEndTransform=function(offsetX,offsetY){if(this.transformAnchorId==null||this.transformOriginX==null||this.transformOriginY==null||this.anchorPoints.length<this.npoints){return;}
var translation=new Vector2D(offsetX-this.transformOriginX,offsetY-this.transformOriginY);var corner0Translation=this.getCorner0Translation(translation);var corner1Translation=this.getCorner1Translation(translation);var noCorner0Translation=corner0Translation==null||corner0Translation.dot(corner0Translation)==0;var noCorner1Translation=corner1Translation==null||corner1Translation.dot(corner1Translation)==0;if(noCorner0Translation&&noCorner1Translation){this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;return;}
var corner0=this.anchorPoints[0];var corner1=this.anchorPoints[1];var data=this.currentContext!=null?this.currentContext.getData():null;if(!noCorner0Translation){var translatedPoint=corner0.add(corner0Translation);this.anchorPoints[0]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(0,data,this.currentContext,localXPosition,localYPosition);}
if(!noCorner1Translation){var translatedPoint=corner1.add(corner1Translation);this.anchorPoints[1]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(1,data,this.currentContext,localXPosition,localYPosition);}
this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;};prototype.getPointsFromCorners=function(corner0,corner1){if(corner0==null||corner1==null){return null;}
if(corner1.equals(corner0)){corner1=new Point2D(corner0.getX()+2,corner0.getY()+2);}
var midX=stjs.trunc(Math.round((corner0.getX()+corner1.getX())/2.0));var midY=stjs.trunc(Math.round((corner0.getY()+corner1.getY())/2.0));var p1=corner0;var p2=new Point2D(corner0.getX(),midY);var p3=new Point2D(corner0.getX(),corner1.getY());var p4=new Point2D(midX,corner1.getY());var p5=corner1;var p6=new Point2D(corner1.getX(),midY);var p7=new Point2D(corner1.getX(),corner0.getY());var p8=new Point2D(midX,corner0.getY());return[p1,p2,p3,p4,p5,p6,p7,p8];};prototype.getCornersFromPoints=function(points){if(points!=null&&points[0]!=null&&points[4]!=null){return[points[0],points[4]];}else{return null;}};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var corner0=this.anchorPoints[0];var corner1=this.anchorPoints[1];var left=corner0.getX();var right=corner1.getX();var top=corner0.getY();var bottom=corner1.getY();if(left>right){left=right;right=corner0.getX();}
if(top>bottom){top=bottom;bottom=corner0.getY();}
top-=InteractiveShape.INSIDE_DISTANCE_MAX;left-=InteractiveShape.INSIDE_DISTANCE_MAX;bottom+=InteractiveShape.INSIDE_DISTANCE_MAX;right+=InteractiveShape.INSIDE_DISTANCE_MAX;return(x>=left&&y>=top&&x<=right&&y<=bottom);};prototype.getCorner0Translation=function(translation){if(this.transformAnchorId==null||translation==null){return null;}
switch(this.transformAnchorId){case-1:case 0:return translation;case 1:case 2:return new Vector2D(translation.getX(),0.0);case 6:case 7:return new Vector2D(0.0,translation.getY());default:return null;}};prototype.getCorner1Translation=function(translation){if(this.transformAnchorId==null||translation==null){return null;}
switch(this.transformAnchorId){case 2:case 3:return new Vector2D(0.0,translation.getY());case-1:case 4:return translation;case 5:case 6:return new Vector2D(translation.getX(),0.0);default:return null;}};prototype.getShapeName=function(){return Rectangle.NAME;};prototype.getNPointsId=function(){return null;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InteractiveEllipse=function(areaId,yAxisId){Rectangle.call(this,areaId,yAxisId);};InteractiveEllipse=stjs.extend(InteractiveEllipse,Rectangle,[],function(constructor,prototype){constructor.NAME="ellipse";prototype.getElementsFromPoints=function(points,view,layer,context){var corners=this.getPointsInContext(this.getCornersFromPoints(points),context,view);if(corners!=null&&corners[0]!=null&&corners[1]!=null){var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var p1=corners[0];var p2=corners[1];if(p1!=null&&p2!=null){var shapes=[];var x=p1.getX();var y=p1.getY();var width=p2.getX()-x;var height=p2.getY()-y;var radiusX=width/2.0;var radiusY=height/2.0;var centerX=stjs.trunc(Math.round(x+radiusX));var centerY=stjs.trunc(Math.round(y+radiusY));var ellipse=ChartElementFactory.createEllipse(layer,centerX,centerY,radiusX,radiusY);ellipse.setFillColor(this.fillColor);ellipse.setFillShape(this.fillColor!=null);if(InteractiveShape.NO_LINE_STYLE.equals(this.lineStyle)){ellipse.setStrokeColor(ChartColor.transparent);ellipse.setDashed(false);}else{ellipse.setStrokeColor(this.strokeColor);ellipse.setDashed(!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle));}
ellipse.setStrokeShape(this.strokeColor!=null);shapes.push(ellipse);return shapes;}}
return null;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(localXPosition,localYPosition);var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];if(p1!=null&&p2!=null){var x=p1.getX();var y=p1.getY();var width=p2.getX()-x;var height=p2.getY()-y;var radiusX=width/2.0+InteractiveShape.INSIDE_DISTANCE_MAX;var radiusY=height/2.0+InteractiveShape.INSIDE_DISTANCE_MAX;var centerX=stjs.trunc(Math.round(x+radiusX));var centerY=stjs.trunc(Math.round(y+radiusY));var radiusXSquare=radiusX*radiusX;var radiusYSquare=radiusY*radiusY;if(radiusXSquare==0||radiusYSquare==0){return false;}else{var diffXSquare=centerX-localXPosition;diffXSquare=diffXSquare*diffXSquare;diffXSquare/=radiusXSquare;var diffYSquare=centerY-localYPosition;diffYSquare=diffYSquare*diffYSquare;diffYSquare/=radiusYSquare;if((diffXSquare+diffYSquare)<=1){return true;}else{return false;}}}else{return false;}};prototype.getShapeName=function(){return InteractiveEllipse.NAME;};prototype.getNPointsId=function(){return null;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibArcs=function(areaId,yAxisId){Segment.call(this,areaId,yAxisId);this.minLevelDisplayed=2;this.maxLevelDisplayed=FibArcs.LEVELS.length-2;};FibArcs=stjs.extend(FibArcs,Segment,[],function(constructor,prototype){constructor.LEVELS=[0.0,23.6,38.2,50.0,61.8,100.0];constructor.NAME="far";prototype.localRadius=0;prototype.minLevelDisplayed=0;prototype.maxLevelDisplayed=0;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null&&lines[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var line=lines[0];if(line!=null){var p1=line.getP1();var p2=line.getP2();var croppedLine=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);croppedLine.setStrokeColor(this.strokeColor);croppedLine.setStrokeShape(this.strokeColor!=null);shapes.push(croppedLine);}
var p2=line.getP2();var p1=line.getP1();var startAngle=0;var endAngle=Math.PI;if(p2.getY()>p1.getY()){startAngle=endAngle;endAngle=2*Math.PI;}
var radius=stjs.trunc(Math.round(p1.distanceTo(p2)));for(var i=this.minLevelDisplayed;i<=this.maxLevelDisplayed;++i){var rf=stjs.trunc(((radius*FibArcs.LEVELS[i])/100.0));var currentHalfCircle=ChartElementFactory.createCircle(layer,p2.getX(),p2.getY(),rf);currentHalfCircle.setStartAngle(startAngle);currentHalfCircle.setEndAngle(endAngle);currentHalfCircle.setStrokeColor(this.strokeColor);currentHalfCircle.setStrokeShape(this.strokeColor!=null);shapes.push(currentHalfCircle);}
return shapes;}else{return null;}};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){if(!this.complete){if(InteractiveShape.prototype.addCurrentPositionToShape.call(this,offsetX,offsetY,chart)){this.localRadius=stjs.trunc(Math.round(this.anchorPoints[0].distanceTo(this.anchorPoints[1])));}}
return this.complete;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(Segment.prototype.isInsideCurrentShape.call(this,view,offsetX,offsetY)){return true;}
if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];if((p2.getY()>p1.getY()&&y>p2.getY())||(p2.getY()<=p1.getY()&&y<p2.getY())){return false;}else{var radius=stjs.trunc(Math.round(p1.distanceTo(p2)));var maxRadius=stjs.trunc(((radius*FibArcs.LEVELS[this.maxLevelDisplayed])/100.0));return p2.distanceTo(new Point2D(x,y))<=maxRadius;}};prototype.getShapeName=function(){return FibArcs.NAME;};},{LEVELS:{name:"Array",arguments:[null]},pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibFans=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.minLevelDisplayed=2;this.maxLevelDisplayed=FibFans.LEVELS.length-2;};FibFans=stjs.extend(FibFans,InfiniteLine,[],function(constructor,prototype){constructor.LEVELS=[0.0,23.6,38.2,50.0,61.8,100.0];constructor.NAME="ffa";prototype.minLevelDisplayed=0;prototype.maxLevelDisplayed=0;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null&&lines[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var mainLine=lines[0];var currentLine=mainLine;var mainP1=mainLine.getP1();var mainP2=mainLine.getP2();var croppedLine2D=this.clipAndProjectLine(currentLine,graphBounds);var p1=null;var p2=null;if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}
for(var i=this.minLevelDisplayed;i<=this.maxLevelDisplayed;i++){croppedLine2D=this.clipAndProjectLine(this.getFanLevel(mainP1,mainP2,i),graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setDashed(true);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}}
return shapes;}else{return null;}};prototype.getFanLevel=function(mainP1,mainP2,level){var fibY=mainP2.getY()-(((mainP2.getY()-mainP1.getY())*FibFans.LEVELS[level])/100);var currentY=stjs.trunc(Math.round(fibY));return new Line2D(mainP1,new Point2D(mainP2.getX(),currentY));};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var boundsTranslation=new Vector2D(graphBounds.getContentLeft(),graphBounds.getContentTop());var point=new Point2D(offsetX,offsetY);var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];if(p1!=null&&p2!=null){p1=p1.add(boundsTranslation);p2=p2.add(boundsTranslation);}else{return false;}
var mainLine=new Line2D(p1,p2);var otherExtremityLine=this.getFanLevel(p1,p2,this.maxLevelDisplayed);var borders=graphBounds.getInnerBordersLines();var mainLineOtherPoint=this.getFurthestPointInDirection(p1,p2,borders);var otherExtremityFurtherPoint=this.getFurthestPointInDirection(p1,otherExtremityLine.getP2(),borders);return mainLine.distFromSegment(point)<=InteractiveShape.INSIDE_DISTANCE_MAX||MathUtil.isPointInsideTriangle(point,p1,mainLineOtherPoint,otherExtremityFurtherPoint);};prototype.getFurthestPointInDirection=function(p1,p2,borders){var maxDist=0;var furthestPoint=null;var mainLine=new Line2D(p1,p2);for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(mainLine);if(intersection!=null&&intersection.distanceSquared(p2)<intersection.distanceSquared(p1)){var currentDist=intersection.distanceSquared(p2);if(currentDist>maxDist){maxDist=currentDist;furthestPoint=intersection;}}}}
return furthestPoint;};prototype.getShapeName=function(){return FibFans.NAME;};prototype.getNPointsId=function(){return String.valueOf(this.npoints);};},{LEVELS:{name:"Array",arguments:[null]},pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibRetracements=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.minLevelDisplayed=0;this.maxLevelDisplayed=FibRetracements.LEVELS.length-1;};FibRetracements=stjs.extend(FibRetracements,InfiniteLine,[],function(constructor,prototype){constructor.LEVELS=[0.0,23.6,38.2,50.0,61.8,100.0];constructor.NAME="fre";prototype.minLevelDisplayed=0;prototype.maxLevelDisplayed=0;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null&&lines[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var mainLine=lines[0];var mainP1=mainLine.getP1();var mainP2=mainLine.getP2();var tmpX=mainP1.getX();var tmpX2=tmpX+1;for(var i=this.minLevelDisplayed;i<=this.maxLevelDisplayed;i++){var fibY=mainP2.getY()-(((mainP2.getY()-mainP1.getY())*FibRetracements.LEVELS[i])/100);var currentY=stjs.trunc(Math.round(fibY));var intermediatePoint1=new Point2D(tmpX,currentY);var intermediatePoint2=new Point2D(tmpX2,currentY);var croppedLine2D=this.projectLineOnBounds(new Line2D(intermediatePoint1,intermediatePoint2),graphBounds);if(croppedLine2D!=null){var p1=croppedLine2D.getP1();var p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setDashed(i>this.minLevelDisplayed&&i<this.maxLevelDisplayed);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}}
return shapes;}else{return null;}};prototype.getAnchorPoints=function(layer,view,chartData,context){var anchorElements=InteractiveShape.prototype.getAnchorPoints.call(this,layer,view,chartData,context);if(anchorElements!=null){var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var xCenter=stjs.trunc(Math.round(graphBounds.getContentLeft()+(graphBounds.getContentWidth()/2.0)));for(var index in anchorElements){if(!(anchorElements).hasOwnProperty(index))
continue;var currentElement=anchorElements[index];if(currentElement!=null){currentElement.setX(xCenter);}}}
return anchorElements;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];var minY=p1.getY();var maxY=p2.getY();if(minY>maxY){maxY=minY;minY=p2.getY();}
minY-=InteractiveShape.INSIDE_DISTANCE_MAX;maxY+=InteractiveShape.INSIDE_DISTANCE_MAX;return localYPosition>=minY&&localYPosition<=maxY;};prototype.getShapeName=function(){return FibRetracements.NAME;};prototype.getNPointsId=function(){return String.valueOf(this.npoints);};},{LEVELS:{name:"Array",arguments:[null]},pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibTimeZones=function(areaId,yAxisId){InfiniteVerticalLine.call(this,areaId,yAxisId);this.currentStepRatio=1.0;};FibTimeZones=stjs.extend(FibTimeZones,InfiniteVerticalLine,[],function(constructor,prototype){constructor.N_FIB_ZONES=15;constructor.NAME="ftz";prototype.currentStepRatio=0.0;prototype.getElementsFromPoints=function(points,view,layer,context){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var mainP1=pointsInContext[0];var mainP2=new Point2D(mainP1.getX(),mainP1.getY()+1);var mainLine=new Line2D(mainP1,mainP2);var currentLine=mainLine;var croppedLine2D=this.projectLineOnBounds(currentLine,graphBounds);var p1=null;var p2=null;if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}
var p1Y=mainP2.getY();var p2Y=p1Y+1;var stepValue=this.currentStepRatio;if(stepValue==null||stepValue==0){stepValue=1.0;}
var x=mainP1.getX();var nFib0=0.0;var nFib1=stepValue;for(var i=0;i<FibTimeZones.N_FIB_ZONES;++i){var nFib=nFib0+nFib1;x+=stjs.trunc(Math.round(nFib));var intermediatePoint1=new Point2D(x,p1Y);var intermediatePoint2=new Point2D(x,p2Y);croppedLine2D=this.projectLineOnBounds(new Line2D(intermediatePoint1,intermediatePoint2),graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setDashed(true);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}
nFib0=nFib1;nFib1=nFib;}
return shapes;}else{return null;}};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){if(!this.complete){if(InteractiveShape.prototype.addCurrentPositionToShape.call(this,offsetX,offsetY,chart)){var currentArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var validArea=chart.getChartView().getArea(this.associatedAreaId);var context=chart.getEngineModel().getContext();var xRange=context.getRange(Serie.X);if(currentArea==null||currentArea.getAreaBound()==null||chart==null||currentArea.getId()!=validArea.getId()||xRange==null||xRange[0]==null||xRange[1]==null||xRange[0]==xRange[1]){return this.complete;}
var areaBound=currentArea.getAreaBound();var width=areaBound.getContentWidth();var newValueLength=(xRange[1]-xRange[0]);this.currentStepRatio=width/newValueLength;}}
return this.complete;};prototype.updateContext=function(data,context,view){InteractiveShape.prototype.updateContext.call(this,data,context,view);if(context==null||view==null||view.getArea(this.associatedAreaId)==null){return;}
var area=view.getArea(this.associatedAreaId);var xRange=context.getRange(Serie.X);if(area==null||area.getAreaBound()==null||xRange==null||xRange[0]==null||xRange[1]==null||xRange[0]==xRange[1]){return;}
var areaBound=area.getAreaBound();var width=areaBound.getContentWidth();var newValueLength=(xRange[1]-xRange[0]);this.currentStepRatio=width/newValueLength;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var p1=this.anchorPoints[0];var x=p1.getX();var minX=x-InteractiveShape.INSIDE_DISTANCE_MAX;var maxX=x+4*InteractiveShape.INSIDE_DISTANCE_MAX;return localXPosition>=minX&&localXPosition<=maxX;};prototype.getShapeName=function(){return FibTimeZones.NAME;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InteractiveText=function(areaId,yAxisId){Rectangle.call(this,areaId,yAxisId);this.fontSize=InteractiveText.DEFAULT_FONT_SIZE;this.currentWidth=InteractiveText.DEFAULT_TEXT_AREA_WIDTH;this.currentHeight=InteractiveText.DEFAULT_TEXT_AREA_HEIGHT;this.textColor=ChartColor.black;this.fillColor=ChartColor.transparent;this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;this.font=InteractiveText.DEFAULT_FONT;this.editMode=true;this.text="";this.fistFocus=true;};InteractiveText=stjs.extend(InteractiveText,Rectangle,[],function(constructor,prototype){constructor.NAME="text";constructor.DEFAULT_TEXT_AREA_WIDTH=20;constructor.DEFAULT_FONT_SIZE=12;constructor.DEFAULT_TEXT_AREA_HEIGHT=22;constructor.DEFAULT_FONT="Arial, Helvetica, sans-serif";prototype.interactiveTextArea=null;constructor.onTextChangeCallback={};prototype.currentWidth=0;prototype.currentHeight=0;prototype.font=null;prototype.text=null;prototype.labelArea=null;prototype.fistFocus=false;prototype.editMode=false;prototype.selected=false;prototype.hovered=false;prototype.currentBlurEventHandler=null;prototype.keypressEventHandler=null;prototype.getElementsFromPoints=function(points,view,layer,context){var self=this;var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.anchorPoints=this.calculateAnchorPoints(referencePoint);var upperLeftPoint=pointsInContext[0];var xCenter=upperLeftPoint.getX()+stjs.trunc(Math.round(this.currentWidth/2.0));var yCenter=upperLeftPoint.getY()+stjs.trunc(Math.round(this.currentHeight/2.0));if(this.fistFocus){this.fistFocus=false;this.setEditMode(view,context);return null;}
if(this.editMode){return null;}
this.labelArea=ChartElementFactory.createDrawTextLabel(layer,null,this.text,xCenter,yCenter,this.currentWidth,this.currentHeight);this.labelArea.setAlign(Label.ALIGN_CENTER);this.labelArea.setLineHeight(InteractiveText.DEFAULT_TEXT_AREA_HEIGHT);this.labelArea.setBaseline(Label.BASELINE_MIDDLE);this.labelArea.setBorderColor(this.strokeColor);this.labelArea.setColor(this.textColor);this.labelArea.setTextColor(this.textColor);this.labelArea.setFont(this.font);this.labelArea.setFontSize(this.fontSize);if(this.hovered){this.labelArea.setHovered(true);}
if(this.selected){this.labelArea.setSelected(true);this.labelArea.setTextColor(this.textColor.getChartColorWithAlpha(0.3));}
var shapes=null;if(this.strokeColor!=null){shapes=InfiniteLine.prototype.getElementsFromPoints.call(this,points,view,layer,context);}
if(shapes==null){shapes=[];}
shapes.push(this.labelArea);return shapes;}
return null;};prototype.setFontSize=function(textSize){InteractiveShape.prototype.setFontSize.call(this,textSize);this.calculateSize();};prototype.select=function(){this.hovered=false;this.selected=true;};prototype.hover=function(){this.hovered=true;this.selected=false;};prototype.dblclick=function(view,context){this.setEditMode(view,context);};prototype.setEditMode=function(view,context){var self=this;var pointsInContext=this.getPointsInContext(this.anchorPoints,context,view);if(pointsInContext!=null&&pointsInContext.length>=this.npoints){var area=view.getArea(this.associatedAreaId);var corner1=pointsInContext[0];var viewParent=view.getParentElement();if(this.interactiveTextArea==null){this.interactiveTextArea=new InteractiveTextArea(viewParent,new Point2D(corner1.getX()-5,corner1.getY()-5),this.text,function(){self.updateTextFromInput();viewParent.trigger("updateSelectedElement");});}
this.interactiveTextArea.setFontSize(this.fontSize);this.interactiveTextArea.setFontColor(this.textColor);this.interactiveTextArea.setBorderColor(this.strokeColor);this.interactiveTextArea.setBackgroundColor(this.fillColor);this.interactiveTextArea.setBorderStyle(this.lineStyle);this.hovered=false;this.editMode=true;this.selected=false;}};prototype.getAnchorPoints=function(layer,view,chartData,context){return null;};prototype.blur=function(){this.currentBlurEventHandler=null;this.hovered=false;this.selected=false;this.complete=true;if(this.interactiveTextArea!=null){this.interactiveTextArea.blur();}
this.editMode=false;};prototype.updateTextFromInput=function(){var currentMaxWidth=this.interactiveTextArea.getWidth();var currentMaxHeight=this.interactiveTextArea.getHeight();this.currentWidth=currentMaxWidth;this.currentHeight=currentMaxHeight;var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.anchorPoints=this.calculateAnchorPoints(referencePoint);this.text=this.interactiveTextArea.getText();this.currentBlurEventHandler=null;this.editMode=false;this.selected=false;this.hovered=false;this.complete=true;this.interactiveTextArea=null;};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){var currentArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var validArea=chart.getChartView().getArea(this.associatedAreaId);if(currentArea==null||currentArea.getAreaBound()==null||chart==null||currentArea.getId()!=validArea.getId()){return false;}else if(this.anchorPoints.length>=this.npoints){return true;}
var context=chart.getEngineModel().getContext();var areaBound=currentArea.getAreaBound();this.currentWidth=InteractiveText.DEFAULT_TEXT_AREA_WIDTH;var maxInputWidth=stjs.trunc((areaBound.getRight()))-offsetX;if(this.currentWidth>maxInputWidth){this.currentWidth=maxInputWidth;}
var upperLeftX=stjs.trunc(Math.round(offsetX-areaBound.getContentLeft()-stjs.trunc(this.currentWidth/2)));var upperLeftY=stjs.trunc(Math.round(offsetY-areaBound.getContentTop()-stjs.trunc(this.currentHeight/2)));var lowerRightX=upperLeftX+this.currentWidth;var lowerRightY=upperLeftY+this.currentHeight;this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=areaBound.getWidth();this.contextHeight=areaBound.getHeight();var referencePoint=this.calculatePointBetweenPoints2D(new Point2D(upperLeftX,upperLeftY),new Point2D(lowerRightX,lowerRightY));this.anchorPoints=this.calculateAnchorPoints(referencePoint);this.addPointValue(chart.getChartData(),context,referencePoint.getX(),referencePoint.getY());this.complete=true;return this.complete;};prototype.updateContext=function(data,context,view){InteractiveShape.prototype.updateContext.call(this,data,context,view);if(this.anchorPoints!=null&&this.anchorPoints[0]!=null){var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.anchorPoints=this.calculateAnchorPoints(referencePoint);}};prototype.setEndTransform=function(offsetX,offsetY){Rectangle.prototype.setEndTransform.call(this,offsetX,offsetY);this.pointsValues=[];var data=this.currentContext!=null?this.currentContext.getData():null;var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.setPointValue(0,data,this.currentContext,referencePoint.getX(),referencePoint.getY());};prototype.isHovered=function(){return this.hovered;};prototype.isSelected=function(){return this.selected;};prototype.isEditMode=function(){return this.editMode;};prototype.getCurrentTextHeight=function(){return this.fontSize+2*DefaultLayout.DEFAULT_PADDING_PIXELS;};prototype.getCurrentFontSize=function(){return this.fontSize;};prototype.setCurrentFontSize=function(currentFontSize){this.fontSize=currentFontSize;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getShapeName=function(){return InteractiveText.NAME;};prototype.setOriginTransform=function(anchor,offsetX,offsetY){InteractiveShape.prototype.setOriginTransform.call(this,-1,offsetX,offsetY);};constructor.registerTextChangeCallback=function(uId,onBlurEventHandler){InteractiveText.onTextChangeCallback[uId]=onBlurEventHandler;};constructor.unregisterTextChangeCallback=function(uId){delete InteractiveText.onTextChangeCallback[uId];};constructor.blurAll=function(chart){var engine=chart.getEngineModel().getEngine(DrawEngine.ID);var drawElements=engine.getDrawElements();for(var i=0;i<drawElements.length;i++){if(drawElements!=null&&stjs.isInstanceOf(drawElements[i].constructor,InteractiveText)){(drawElements[i]).blur();}}};constructor.blurAllExceptProvided=function(drawEngine,textLabelToAvoidBlur){var drawElements=drawEngine.getDrawElements();for(var i=0;i<drawElements.length;i++){if(drawElements!=null&&stjs.isInstanceOf(drawElements[i].constructor,InteractiveText)&&drawElements[i]!=textLabelToAvoidBlur){(drawElements[i]).blur();}}};constructor.isDrawEngineCompatible=function(drawEngine){return InteractiveShapeFactory.TEXT_TYPE.equals(drawEngine.getCurrentDrawType())||DrawEngine.MOVE_MODE.equals(drawEngine.getCurrentMode());};prototype.serialize=function(){var content="";var pointsId=this.getNPointsId();if(pointsId!=null){content=XMLUtil.createNodeString("npoints",pointsId);}
content+=this.serializeReferenceValues();content+=XMLUtil.createNodeString("group",this.groupId);content+=InfiniteLine.getStringFromArray("points",[this.calculateLabelCenterPoint()]);content+=this.getStyleString();var escapedText=this.text!=null?encodeURIComponent(this.text):"";content+=XMLUtil.createNodeString("text",escapedText);return XMLUtil.createNodeString(this.getShapeName(),content);};prototype.initShapeFromXML=function(currentFigure){var rawText=XMLUtil.getValue(currentFigure,"text");try{this.text=decodeURIComponent(rawText);}catch(ex){this.text="";}
this.fistFocus=false;this.editMode=false;this.calculateSize();this.initReferenceValues(currentFigure);var itemNodes=XMLUtil.getChildNodes(currentFigure,"points");if(itemNodes!=null&&itemNodes.length>0){if(itemNodes.length==1){var centerPointItemNode=itemNodes[0];if(centerPointItemNode!=null){this.pointsValues=[this.convertXMLNodeItemToPoint(centerPointItemNode)];}else{return false;}}else{var upperLeftItemNode=itemNodes[0];var lowerRightItemNode=itemNodes[1];var upperLeftPoint=this.convertXMLNodeItemToPoint(upperLeftItemNode);var lowerRightPoint=this.convertXMLNodeItemToPoint(lowerRightItemNode);this.pointsValues=[this.calculatePointBetweenPoints2Df(upperLeftPoint,lowerRightPoint)];}
return true;}
return false;};prototype.initAnchorPointsFromPointsValues=function(data,context,view){InteractiveShape.prototype.initAnchorPointsFromPointsValues.call(this,data,context,view);for(var i=0;i<this.anchorPoints.length;i++){var anchorPoint=this.anchorPoints[i];if(anchorPoint!=null){var translatedAnchorPoint=anchorPoint.add(new Vector2D(-this.currentWidth/2,-this.currentHeight/2));this.anchorPoints[i]=translatedAnchorPoint;}}};prototype.convertXMLNodeItemToPoint=function(xmlNodeItem){if(xmlNodeItem==null){return null;}
var pointData=(xmlNodeItem.textContent).split(",");var x=parseFloat(pointData[0]);var y=parseFloat(pointData[1]);if(x!=null&&y!=null&&!isNaN(x)&&!isNaN(y)){return new Point2Df(x,y);}
return null;};prototype.calculateLabelCenterPoint=function(){if(this.pointsValues==null||this.pointsValues.length==0||this.pointsValues[0]==null){return null;}else if(this.pointsValues.length==1){return new Point2Df(this.pointsValues[0].getX(),this.pointsValues[0].getY());}
return this.calculatePointBetweenPoints2Df(this.pointsValues[0],this.pointsValues[1]);};prototype.calculatePointBetweenPoints2Df=function(point1,point2){var point1X=point1.getX();var point1Y=point1.getY();if(point2!=null){var point2X=point2.getX();var point2Y=point2.getY();var pointBetweenX=point1X+(point2X-point1X)/2;var pointBetweenY=point1Y+(point2Y-point1Y)/2;return new Point2Df(pointBetweenX,pointBetweenY);}
return new Point2Df(point1X+stjs.trunc(this.currentWidth/2),point1Y+stjs.trunc(this.currentHeight/2));};prototype.calculatePointBetweenPoints2D=function(point1,point2){var point1X=point1.getX();var point1Y=point1.getY();if(point2!=null){var point2X=point2.getX();var point2Y=point2.getY();var pointBetweenX=point1X+stjs.trunc((point2X-point1X)/2);var pointBetweenY=point1Y+stjs.trunc((point2Y-point1Y)/2);return new Point2D(pointBetweenX,pointBetweenY);}
return new Point2D(point1X+stjs.trunc(this.currentWidth/2),point1Y+stjs.trunc(this.currentHeight/2));};prototype.calculateAnchorPoints=function(referencePoint){var upperLeftPoint=new Point2D(referencePoint.getX()-stjs.trunc(this.currentWidth/2),referencePoint.getY()-stjs.trunc(this.currentHeight/2));var lowerRightPoint=new Point2D(referencePoint.getX()+stjs.trunc(this.currentWidth/2),referencePoint.getY()+stjs.trunc(this.currentHeight/2));return[upperLeftPoint,lowerRightPoint];};prototype.calculateSize=function(){var textAreaSelector=InteractiveTextArea.getStubForSizeCalculation(this.text,this.fontSize);var hiddenTextCopyContainer=textAreaSelector.find(".TextAreaContainer__hiddenTextCopy");$("body").append(textAreaSelector);this.currentWidth=parseInt(hiddenTextCopyContainer.outerWidth());this.currentHeight=parseInt(hiddenTextCopyContainer.outerHeight());textAreaSelector.remove();};},{interactiveTextArea:"InteractiveTextArea",onTextChangeCallback:{name:"Map",arguments:[null,{name:"Callback1",arguments:["SqwJQuery"]}]},labelArea:"EditableCanvasLabel",currentBlurEventHandler:"EventHandler",keypressEventHandler:"EventHandler",pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",referenceDate:"Date",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InteractiveTextArea=function(parent,positionPoint,text,updateTextCallback){this.parent=parent;this.positionPoint=positionPoint;this.text=text;this.updateTextCallback=updateTextCallback;this.renderTextArea(text).appendTo(parent);this.setFocusToTextAreaEnd();this.referencePoint=this.calculateReferencePoint(positionPoint);this.initHandlers();this.adjustPaddingOnHiddenTextAreaIndentValue(this.hiddenTextCopy);};InteractiveTextArea=stjs.extend(InteractiveTextArea,null,[],function(constructor,prototype){constructor.ENTER_KEYCODE=13;constructor.ENTER_WITH_CTRL_KEYCODE=10;constructor.DELETE_KEYCODE=46;constructor.CUSTOM_NEWLINE_SYMBOL="[n]";constructor.SELECTED_LABEL_BORDER_ALPHA=0.3;constructor.IOS_TEXT_AREA_HIDDEN_INDENT=3;prototype.textAreaContainer=null;prototype.textArea=null;prototype.hiddenTextCopy=null;prototype.parent=null;prototype.positionPoint=null;prototype.referencePoint=null;prototype.text=null;prototype.updateTextCallback=null;prototype.renderTextArea=function(text){this.textAreaContainer=SQW.$("<div class='TextAreaContainer'>");this.textArea=SQW.$("<textarea class='TextAreaContainer__textArea'>").text(InteractiveTextArea.convertLineBreaksToNewLineSymbol(text));this.textAreaContainer.append(this.textArea);var selectionIndicators=SQW.$("<span class='TextAreaContainer__verticalSelectionIndicators'/><span class='TextAreaContainer__horizontalSelectionIndicators'/>");this.textAreaContainer.append(selectionIndicators);this.hiddenTextCopy=SQW.$("<span class='TextAreaContainer__hiddenTextCopy'>");this.hiddenTextCopy.text(InteractiveTextArea.convertLineBreaksToNewLineSymbol(text));this.textAreaContainer.append(this.hiddenTextCopy);var referencePoint=SQW.$("<span class='TextLabelContainer__referencePointAxisY'/><span class='TextLabelContainer__referencePointAxisX'/>");this.textAreaContainer.append(referencePoint);this.textAreaContainer.css("top",this.positionPoint.getY()+"px");this.textAreaContainer.css("left",this.positionPoint.getX()+"px");return this.textAreaContainer;};prototype.initHandlers=function(){var self=this;this.textAreaContainer.on("blur",".TextAreaContainer__textArea",stjs.bind(this,function(ev,THIS){self.blur();return false;},1));this.textAreaContainer.on("keydown",".TextAreaContainer__textArea",stjs.bind(this,function(ev,THIS){if(ev.keyCode==InteractiveTextArea.ENTER_WITH_CTRL_KEYCODE||(ev.ctrlKey||ev.altKey)&&ev.keyCode==InteractiveTextArea.ENTER_KEYCODE){self.insertEnterAtCaret();self.textArea.trigger("input");ev.preventDefault();}else if(ev.keyCode==InteractiveTextArea.ENTER_KEYCODE){self.blur();}else if(ev.keyCode==InteractiveTextArea.DELETE_KEYCODE){ev.stopPropagation();}
return true;},1));this.textArea.on("input selectionchange",stjs.bind(this,function(ev,THIS){self.hiddenTextCopy.text(self.textArea.val());self.updateTextAreaPosition();return true;},1));this.textArea.on("click mousedown mousemove",stjs.bind(this,function(ev,THIS){ev.stopPropagation();return true;},1));};prototype.blur=function(){this.text=this.convertLineBreaksToCustomSymbol(this.textArea.val());this.updateTextCallback();this.textAreaContainer.remove();};constructor.getStubForSizeCalculation=function(text,fontSize){var hiddenTextCopyContainer=SQW.$("<span class='TextAreaContainer__hiddenTextCopy'>").text(InteractiveTextArea.convertLineBreaksToNewLineSymbol(text));hiddenTextCopyContainer.css("font-size",fontSize);return SQW.$("<div class='TextAreaContainer'>").append(hiddenTextCopyContainer);};constructor.getColor=function(){return SQW.$("<textarea class='TextAreaContainer__textArea'>").css("border-color");};prototype.setBorderColor=function(color){if(color!=null){this.textArea.css("border-color",color.getFlatColor());this.textAreaContainer.css("border-color",color.getChartColorWithAlpha(InteractiveTextArea.SELECTED_LABEL_BORDER_ALPHA).getFlatColor());}};prototype.setFontColor=function(color){if(color!=null){this.textArea.css("color",color.getFlatColor());}};prototype.setBorderStyle=function(style){if(style!=null){this.textArea.css("border-style",style);}};prototype.setBackgroundColor=function(color){if(color!=null){this.textArea.css("background-color",color.getFlatColor());}};prototype.setFontSize=function(size){this.textArea.css("font-size",size);this.hiddenTextCopy.css("font-size",size);this.referencePoint=this.calculateReferencePoint(this.positionPoint);};prototype.getWidth=function(){return this.textArea.outerWidth()-2*this.getBorderWidth();};prototype.getHeight=function(){return this.textArea.outerHeight()-2*this.getBorderWidth();};prototype.getBorderWidth=function(){return parseInt(this.textArea.css("border-top-width"));};prototype.getText=function(){return this.text;};constructor.convertLineBreakToHTMLtag=function(textLine){return textLine.replace(/(?:\r\n|\r|\n|\[n\])/g,"<br />");};constructor.convertLineBreaksToNewLineSymbol=function(textLine){return textLine.replace(/(?:\[n\])/g,"\n");};prototype.convertLineBreaksToCustomSymbol=function(textLine){return textLine.replace(/(?:\n)/g,"[n]");};prototype.insertEnterAtCaret=function(){var selectionStart=parseInt(this.textArea.prop("selectionStart"));var selectionEnd=parseInt(this.textArea.prop("selectionEnd"));var textAreaValue=(this.textArea.val());var front=textAreaValue.substring(0,selectionStart);var back=textAreaValue.substring(selectionEnd,textAreaValue.length);this.textArea.val(front+"\n"+back);selectionStart=selectionStart+1;this.textArea.prop("selectionStart",selectionStart);this.textArea.prop("selectionEnd",selectionStart);this.textArea.focus();};prototype.calculateReferencePoint=function(positionPoint){var left=positionPoint.getX()+stjs.trunc(this.getWidth()/2);var top=positionPoint.getY()+stjs.trunc(this.getHeight()/2);return new Point2D(left,top);};prototype.updateTextAreaPosition=function(){var left=this.referencePoint.getX()-stjs.trunc(this.getWidth()/2);var top=this.referencePoint.getY()-stjs.trunc(this.getHeight()/2);this.textAreaContainer.css("top",top+"px");this.textAreaContainer.css("left",left+"px");};prototype.setFocusToTextAreaEnd=function(){var textAreaValue=(this.textArea.val());this.textArea.prop("selectionStart",textAreaValue.length);this.textArea.prop("selectionEnd",textAreaValue.length);this.textArea.focus();};prototype.adjustPaddingOnHiddenTextAreaIndentValue=function(sqwJQuery){if(this.isIOS()){var paddingLeftRightValue=parseInt(sqwJQuery.css("padding-left"));paddingLeftRightValue+=InteractiveTextArea.IOS_TEXT_AREA_HIDDEN_INDENT;sqwJQuery.css("padding-left",paddingLeftRightValue+"px");sqwJQuery.css("padding-right",paddingLeftRightValue+"px");}};prototype.isIOS=function(){if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){return true;};return false;};},{textAreaContainer:"SqwJQuery",textArea:"SqwJQuery",hiddenTextCopy:"SqwJQuery",parent:"SqwJQuery",positionPoint:"Point2D",referencePoint:"Point2D",updateTextCallback:"Callback0"},{});
var InteractiveShapeFactory=function(){};InteractiveShapeFactory=stjs.extend(InteractiveShapeFactory,null,[],function(constructor,prototype){constructor.AREA_0_ID="area_0";constructor.AREA_1_ID="area_1";constructor.TYPE_VERTICAL=-1;constructor.TYPE_HORIZONTAL=-2;constructor.TYPE_INFINITE_LINE=-3;constructor.TEXT_TYPE="textMode";constructor.FREE_LINE_TYPE="freeLineMode";constructor.SEGMENT_TYPE="segmentMode";constructor.HORIZONTAL_LINE_TYPE="horizontalLineMode";constructor.VERTICAL_LINE_TYPE="verticalLineMode";constructor.ELLIPSE_TYPE="ellipseMode";constructor.RECTANGLE_TYPE="rectangleMode";constructor.TRIANGLE_TYPE="triangleMode";constructor.QUADRI_TYPE="quadriMode";constructor.FIB_FANS_TYPE="fibFansMode";constructor.FIB_RETRACEMENT_TYPE="fibRetracMode";constructor.FIB_TIME_ZONES_TYPE="fibTimeZonesMode";constructor.FIB_ARCS_TYPE="fibArcsMode";constructor.createInteractiveShape=function(shapeType,areaId,yAxisId){if(shapeType==InteractiveShapeFactory.FREE_LINE_TYPE){return new InfiniteLine(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.SEGMENT_TYPE){return new Segment(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.HORIZONTAL_LINE_TYPE){return new InfiniteHorizontalLine(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.VERTICAL_LINE_TYPE){return new InfiniteVerticalLine(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.ELLIPSE_TYPE){return new InteractiveEllipse(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.RECTANGLE_TYPE){return new Rectangle(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.TRIANGLE_TYPE){return new Triangle(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.QUADRI_TYPE){return new Quadrilateral(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_FANS_TYPE){return new FibFans(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_RETRACEMENT_TYPE){return new FibRetracements(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_TIME_ZONES_TYPE){return new FibTimeZones(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_ARCS_TYPE){return new FibArcs(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.TEXT_TYPE){return new InteractiveText(areaId,yAxisId);}
return null;};constructor.createInteractiveShapeFromXML=function(currentFigure,areaName){if(currentFigure==null){return null;}
var areaId=null;var yAxisId=null;if(areaName==InteractiveShapeFactory.AREA_0_ID){areaId=DefaultLayout.GRAPH_AREA;yAxisId=DefaultLayout.Y1_AXIS_AREA;}else if(areaName==InteractiveShapeFactory.AREA_1_ID){areaId=FinancialLayout.BOTTOM_GRAPH_AREA;yAxisId=FinancialLayout.BOTTOM_AXIS_LEFT;}else{return null;}
var shapeType=InteractiveShapeFactory.getShapeTypeFromNode(currentFigure);if(shapeType!=null){var shape=InteractiveShapeFactory.createInteractiveShape(shapeType,areaId,yAxisId);var valid=shape.unserializeFromXML(currentFigure);return valid?shape:null;}else{return null;}};constructor.getShapeTypeFromNode=function(currentFigure){if(currentFigure.nodeName==InfiniteLine.NAME){var pointsCount=parseInt(XMLUtil.getValue(currentFigure,"npoints"));if(pointsCount==null||isNaN(pointsCount)){return null;}
switch(pointsCount){case InteractiveShapeFactory.TYPE_VERTICAL:return InteractiveShapeFactory.VERTICAL_LINE_TYPE;case InteractiveShapeFactory.TYPE_HORIZONTAL:return InteractiveShapeFactory.HORIZONTAL_LINE_TYPE;case InteractiveShapeFactory.TYPE_INFINITE_LINE:return InteractiveShapeFactory.FREE_LINE_TYPE;case 2:return InteractiveShapeFactory.SEGMENT_TYPE;case 3:return InteractiveShapeFactory.TRIANGLE_TYPE;case 4:return InteractiveShapeFactory.QUADRI_TYPE;default:return null;}}else if(currentFigure.nodeName==InteractiveEllipse.NAME){return InteractiveShapeFactory.ELLIPSE_TYPE;}else if(currentFigure.nodeName==Rectangle.NAME){return InteractiveShapeFactory.RECTANGLE_TYPE;}else if(currentFigure.nodeName==FibArcs.NAME){return InteractiveShapeFactory.FIB_ARCS_TYPE;}else if(currentFigure.nodeName==FibFans.NAME){return InteractiveShapeFactory.FIB_FANS_TYPE;}else if(currentFigure.nodeName==FibRetracements.NAME){return InteractiveShapeFactory.FIB_RETRACEMENT_TYPE;}else if(currentFigure.nodeName==FibTimeZones.NAME){return InteractiveShapeFactory.FIB_TIME_ZONES_TYPE;}else if(currentFigure.nodeName==InteractiveText.NAME){return InteractiveShapeFactory.TEXT_TYPE;}else{return null;}};},{},{});
(function($){$.fn.stocksearch=function(options){var settings=$.extend({},$.fn.stocksearch.defaults,options);return this.each(function(){$.stocksearch(this,settings);});};$.stocksearch=function(elm,settings){var elm=$(elm)[0];return elm.stocksearch||(elm.stocksearch=new $._stocksearch(elm,settings));}
$._stocksearch=function(elm,settings){var ss=this;ss.settings=settings;var $elm=$(elm);var prevVal=null;var mark=function(s,sub){var pos=s.toLowerCase().indexOf(sub.toLowerCase());if(pos!=0)
return s;return"<b>"+s.substring(0,sub.length)+"</b>"+s.substring(sub.length);}
var doSearch=function(){if(prevVal==$elm.val()||""==$elm.val()||$elm.val()==$elm.attr("explanation"))
return;var type="",market="";var url=settings.url.replace("$stock",$elm.val()).replace("$type",type).replace("$market",market);prevVal=$elm.val();$.ajax({url:url,dataType:"text",complete:function(res,status){if(status=="success"){stringToObjectArray(settings.headerLine+"\n"+res.responseText,ss);var list="<table>";for(var i=0;i<ss.rows.length;++i){var key=ss.rows[i].isin+"_"+ss.rows[i].exchangeId+"_"+ss.rows[i].currency;list+="<tr id='"+key+"' name='"+ss.rows[i].name+"'>";var market="<td class='market'>"+ss.rows[i].market+"</td>";var symbol=ss.rows[i].symbol||"";if(symbol.length>7)symbol=symbol.substring(0,8);var name="<td class='symbol'>"+mark(symbol,prevVal)+"</td><td>"+mark(ss.rows[i].name,prevVal)+"</td>";var currency="<td class='currency'>"+ss.rows[i].currency+"<img src='/gifs/flag_"+ss.rows[i].currency.toUpperCase()+".gif'></td>";list+=name+market+currency;list+="</tr>";}
list+="</table>";$("#search-results").html(list);}else{}}});}
$elm.focus(function(){bindSearchResultClickHandler();if($("#search-results").length==0){$("<div id='search-results'></div>").appendTo(document.body);$("#search-results").click(function(e){var elem=e.target.tagName.toLowerCase()=="tr"?$(e.target):$(e.target).parents("tr");settings.action(elem.attr("id"),elem.attr("name"));$("#search-results").hide();}).mousemove(function(e){$("#search-results tr").removeClass("hover");});}
var eoff=$elm.offset();var additionalHeight=0;if($elm.attr('data-offset')){additionalHeight=parseInt($elm.attr('data-offset'));}
$("#search-results").css({left:eoff.left,top:eoff.top+$elm.height()+10+additionalHeight});if($elm.val().length>0){$("#search-results").show();}else{$("#search-results").hide();}
ss.timer=setInterval(doSearch,settings.interval);});$elm.blur(function(){clearInterval(ss.timer);});var current=-1;var highlight=function(){current=Math.min(Math.max(current,0),$("#search-results tr").length-1);$("#search-results tr").removeClass("hover");$("#search-results tr:eq("+current+")").addClass("hover");}
var checkKey=function(e){var key=e.keyCode;if(!key&&e.which)
key=e.which;var results=$("#search-results");if(!results.is(":visible")){results.show();}
switch(key)
{case 40:current++;highlight();break;case 38:current--;highlight();break;case 13:if(current<0)current=0;settings.action($("#search-results tr:eq("+current+")").attr('id'),$("#search-results tr:eq("+current+")").attr('name'));results.hide();current=0;break;case 27:results.hide();break;}};if($.browser.mozilla){$elm.keypress(checkKey);}else{$elm.keydown(checkKey);}
var setSearchResultClickHandler=function(event){if(!$(event.target).is("#search-results")&&!$(event.target).is($elm)){$("#search-results").hide(0,unbindSearchResultClickHandler);}}
var bindSearchResultClickHandler=function(){$(document).bind("click",setSearchResultClickHandler);}
var unbindSearchResultClickHandler=function(){$(document).unbind("click",setSearchResultClickHandler);}}
$.fn.stocksearch.defaults={interval:200,url:"/sqi_ws/MetaSearchServlet2?stock=$stock&count=20&type=$type&market=$market",headerLine:"name,S|symbol,S|currency,S|isin,S|exchangeId,S|marketId,S|typeId,S|nationalNumber,S|marketdId2,S|null,S|phonetique,S|market,S",action:function(key,name){document.location="/sq_mi/market/Detail.action?s="+key;}}})(jQuery);
var SqwStockSearch=function(container,options,baseUrl){var that=this;this.options=options;this.container=container;this.searchId=0;this.input=SQW.$("<input class='stock-search-input autocompleteDisabled' size=\"20\"/>");this.results=SQW.$("<div class='stock-search-results' style=\"display:none\"/>");this.render();var servletUrl=baseUrl+"/sqi_ws/";servletUrl+="MetaSearchServlet?";if(options.markets!=null){servletUrl+="market="+options.markets+"&";}
if(options.stockTypes!=null){servletUrl+="stocktypes="+options.stockTypes+"&";}
servletUrl+="count="+options.maxResults+"&";this.url=servletUrl;this.selectedResultIndex=0;this.clickHandler=stjs.bind(this,function(ev,THIS){if(!SQW.$.contains(that.container.get(0),ev.target)){that.close(null,null);if(SQW.$.trim(that.input.val())==""&&that.options.selectCallback!=null){that.options.selectCallback(null);}
return true;}
var row=SQW.$(ev.target).closest("tr");if(row.size()>0&&SQW.$.contains(that.container.get(0),row.get(0))){that.close(row.data("searchResult"),row.data("stockKey"));if(that.options.selectCallback!=null){that.options.selectCallback(that.selectedStockKey);}
return true;}
return true;},1);this.arrowHandler=stjs.bind(this,function(ev,THIS){if(ev.keyCode==38){that.arrowUp();return false;}else if(ev.keyCode==40){that.arrowDown();return false;}else if(ev.keyCode==13){that.keyboardSelect();return false;}else{return true;}},1);this.clearKeyboardSelection=stjs.bind(this,function(ev,THIS){that.results.find("tr").removeClass("hover");that.selectedResultIndex=0;return false;},1);setTimeout(function(){that.input.focus(stjs.bind(this,function(ev,THIS){clearInterval(that.interval);if(that.options.focusCallback!=null){that.options.focusCallback();}
that.selectedResultIndex=0;SQW.$(window).unbind("click touchend",that.clickHandler);SQW.$(window).bind("click touchend",that.clickHandler);if(that.placeholder!=null&&that.input.val()==that.placeholder){that.input.val("");that.input.removeClass("stock-search-placeholder");}
that.interval=setInterval(function(){that.search();},that.options.interval);return true;},1));},10);SQW.$(this.results).bind("mousemove",that.clearKeyboardSelection);};SqwStockSearch=stjs.extend(SqwStockSearch,null,[],function(constructor,prototype){prototype.container=null;prototype.input=null;prototype.placeholder=null;prototype.results=null;prototype.options=null;prototype.url=null;prototype.interval=null;prototype.previousInputValue=null;prototype.clickHandler=null;prototype.arrowHandler=null;prototype.clearKeyboardSelection=null;prototype.searchId=0;prototype.selectedSearchResult=null;prototype.selectedStockKey=null;prototype.selectedResultIndex=0;prototype.render=function(){this.container.addClass("stock-search-container");this.container.append(this.input);this.container.append(this.results);};prototype.keyboardSelect=function(){if(this.selectedResultIndex>0){var row=this.results.find("tr:nth-child("+this.selectedResultIndex+")");if(row.size()>0){this.close(row.data("searchResult"),row.data("stockKey"));if(this.options.selectCallback!=null){this.options.selectCallback(this.selectedStockKey);}}}};prototype.arrowDown=function(){var nextRowIndex=this.selectedResultIndex+1;var row=this.results.find("tr:nth-child("+nextRowIndex+")");if(row.size()>0){this.results.find("tr:nth-child("+this.selectedResultIndex+")").removeClass("hover");this.selectedResultIndex=nextRowIndex;row.addClass("hover");this.scrollToRow(row);}};prototype.scrollToRow=function(row){var diff=row.offset().top-this.results.offset().top;if(diff<0){this.results.scrollTop(diff+this.results.scrollTop());}else if(diff+row.outerHeight(true)>this.results.innerHeight()){this.results.scrollTop(diff+row.outerHeight(true)-this.results.innerHeight()+this.results.scrollTop());}};prototype.arrowUp=function(){var previousRowIndex=this.selectedResultIndex-1;var row=this.results.find("tr:nth-child("+previousRowIndex+")");if(row.size()>0){this.results.find("tr:nth-child("+this.selectedResultIndex+")").removeClass("hover");this.selectedResultIndex=previousRowIndex;row.addClass("hover");this.scrollToRow(row);}};constructor.mark=function(content,toMark){var pos=content.toLowerCase().indexOf(toMark.toLowerCase());if(pos!=0){return content;}
return"<b>"+content.substring(0,toMark.length)+"</b>"+content.substring(toMark.length);};prototype.search=function(){if(this.previousInputValue==this.input.val()||""==this.input.val()||this.input.val()==this.input.attr("explanation")){if(""==this.input.val()){this.results.hide();}
return;}
this.previousInputValue=this.input.val();this.selectedSearchResult=null;this.selectedStockKey=null;this.selectedResultIndex=0;this.searchId++;var ajaxParams={};ajaxParams.url=this.url+"stock="+this.input.val();ajaxParams.dataType="jsonp";ajaxParams.success=this.getSuccessCallback();SQW.$.ajax(ajaxParams);};prototype.getSuccessCallback=function(){var that=this;var currentSearchCallbackId=this.searchId;return function(response,status,jqxhr){if(currentSearchCallbackId!=that.searchId){return;}
var table=SQW.$("<table/>");var searchResults=response["results"];for(var i=0;i<searchResults.length;i++){var r=new SqwStockSearchResult(searchResults[i]);var row=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(r.symbol,that.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(r.name,that.previousInputValue)+"</td>"+"<td class='market'>"+r.marketName+"</td>"+"<td class='currency'>"+r.currency+"<img src=\"/gifs/flag_"+r.currency+".gif\"></td>"+"</tr>");row.data("stockKey",SqwStockSearch.createKey(r.isin,r.stockExchangeId,r.currency));row.data("searchResult",r);table.append(row);}
that.results.html("");if(searchResults.length>0){that.results.append(table);that.displayResults();}else{that.results.hide();}};};constructor.createKey=function(isin,exchangeId,currency){var exchangeValue=parseInt(exchangeId);if(isin==null||exchangeId==null||currency==null||exchangeValue==null||isNaN(exchangeValue)){return null;}
var exchangeIdString=exchangeId;if(exchangeValue<0){exchangeIdString="M"+String.valueOf(-exchangeValue);}
return isin+"_"+exchangeIdString+"_"+currency;};prototype.displayResults=function(){this.results.show();SQW.$(window).unbind("keydown",this.arrowHandler);SQW.$(window).bind("keydown",this.arrowHandler);this.results.css("top",this.input.outerHeight());var leftPos=(this.input.outerWidth(true)-this.input.outerWidth())/2.0;this.results.css("left",leftPos);var rightOverflow=SQW.$(window).width()-(this.results.width()+this.results.offset().left);if(rightOverflow<0){this.results.css("left",Math.floor(leftPos)+Math.floor(rightOverflow)-1);}
this.results.css("height","auto");this.results.css("overflow-y","hidden");this.results.css("min-height","");var resultTopPosInViewport=this.results.offset().top-SQW.$(window).scrollTop();if(resultTopPosInViewport+this.results.outerHeight(true)>SQW.$(window).height()){this.results.css("height",(SQW.$(window).height()-resultTopPosInViewport)+"px");this.results.css("overflow-y","scroll");this.results.css("min-height","100px");}};prototype.close=function(selectedResult,selectedResultKey){this.searchId++;this.results.hide();clearInterval(this.interval);SQW.$(window).unbind("click",this.clickHandler);SQW.$(window).unbind("keydown",this.arrowHandler);this.previousInputValue="";this.selectedSearchResult=selectedResult;this.selectedStockKey=selectedResultKey;this.selectedResultIndex=0;if(selectedResult!=null){this.input.val(selectedResult.symbol);}else{this.input.val("");}
this.blur();};prototype.getSelectedStockKey=function(){return this.selectedStockKey;};prototype.getSelectedSearchResult=function(){return this.selectedSearchResult;};prototype.emptyValue=function(){this.input.val("");};prototype.setValue=function(value){this.input.removeClass("stock-search-placeholder");this.input.val(value);this.blur();};prototype.blur=function(){if(this.placeholder!=null&&(this.input.val()==""||this.input.val()==this.placeholder)){this.input.addClass("stock-search-placeholder");this.input.val(this.placeholder);}
this.input.blur();};prototype.getPlaceholder=function(){return this.placeholder;};prototype.setPlaceholder=function(placeholder){this.placeholder=placeholder;if(placeholder!=null&&(this.input.val()==""||this.input.val()==placeholder)){this.input.addClass("stock-search-placeholder");this.blur();}};},{container:"SqwJQuery",input:"SqwJQuery",results:"SqwJQuery",options:"SqwStockSearchOptions",interval:"TimeoutHandler",clickHandler:"EventHandler",arrowHandler:"EventHandler",clearKeyboardSelection:"EventHandler",selectedSearchResult:"SqwStockSearchResult"},{});
var SqwStockSearchOptions=function(){};SqwStockSearchOptions=stjs.extend(SqwStockSearchOptions,null,[],function(constructor,prototype){prototype.selectCallback=null;prototype.focusCallback=null;prototype.markets=null;prototype.stockTypes=null;prototype.maxResults=null;prototype.interval=0;constructor.getDefault=function(){var options=new SqwStockSearchOptions();options.interval=200;options.markets="";options.stockTypes="";options.maxResults="20";return options;};constructor.extend=function(options){var extendedOptions=new SqwStockSearchOptions();return extendedOptions=SQW.$.extend(extendedOptions,SqwStockSearchOptions.getDefault(),options);};},{selectCallback:{name:"Callback1",arguments:[null]},focusCallback:"Callback0"},{});
var SqwStockSearchResult=function(pipeSeparated){var splitResult=(pipeSeparated).split("|");this.name=splitResult[0];this.symbol=splitResult[1];this.currency=splitResult[2];this.isin=splitResult[3];this.stockExchangeId=splitResult[4];this.marketId=splitResult[5];this.stockTypeId=splitResult[6];this.marketName=splitResult[11];};SqwStockSearchResult=stjs.extend(SqwStockSearchResult,null,[],function(constructor,prototype){constructor.CURRENCY_TYPE_ID="5";prototype.name=null;prototype.symbol=null;prototype.currency=null;prototype.isin=null;prototype.stockExchangeId=null;prototype.marketId=null;prototype.marketName=null;prototype.stockTypeId=null;prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getSymbol=function(){return this.symbol;};prototype.setSymbol=function(symbol){this.symbol=symbol;};prototype.getCurrency=function(){return this.currency;};prototype.setCurrency=function(currency){this.currency=currency;};prototype.getIsin=function(){return this.isin;};prototype.setIsin=function(isin){this.isin=isin;};prototype.getStockExchangeId=function(){return this.stockExchangeId;};prototype.setStockExchangeId=function(stockExchangeId){this.stockExchangeId=stockExchangeId;};prototype.getMarketId=function(){return this.marketId;};prototype.setMarketId=function(marketId){this.marketId=marketId;};prototype.getMarketName=function(){return this.marketName;};prototype.setMarketName=function(marketName){this.marketName=marketName;};prototype.getStockTypeId=function(){return this.stockTypeId;};prototype.setStockTypeId=function(stockTypeId){this.stockTypeId=stockTypeId;};prototype.isCurrency=function(){return this.stockTypeId==SqwStockSearchResult.CURRENCY_TYPE_ID;};},{},{});
var FinancialChartOption=function(){ChartOption.call(this);};FinancialChartOption=stjs.extend(FinancialChartOption,ChartOption,[],function(constructor,prototype){prototype.indicatorsParametersIntraday=null;prototype.indicatorsParametersHisto=null;prototype.showCompareBox=false;prototype.showPeriodMenu=false;prototype.showLegendInPopover=false;prototype.graphHeightModifiable=false;prototype.currentColorSchema=null;prototype.delimiterHeightPixels=null;prototype.delimiterHighlightColor=null;prototype.customIconClickHandler=null;constructor.getDefaultFinancialChartOption=function(){var financialChartConfig=SQW.$.extend(new FinancialChartOption(),ChartOption.getDefault());financialChartConfig.showCompareBox=true;financialChartConfig.showPeriodMenu=true;financialChartConfig.showLegendInPopover=true;financialChartConfig.graphHeightModifiable=false;financialChartConfig.customIconClickHandler=null;financialChartConfig.delimiterHighlightColor=ChartColor.orange;financialChartConfig.styleModel=new FinancialStyleModel();financialChartConfig.layout=new FinancialLayout();financialChartConfig.engineModel=new FinancialEngineModel();financialChartConfig.indicatorsParametersIntraday=null;financialChartConfig.indicatorsParametersHisto=null;financialChartConfig.delimiterHeightPixels=4;financialChartConfig.currentColorSchema=DefaultIndicator.RED_GREEN_SCHEMA_ID;return financialChartConfig;};constructor.extendFinancialChartOption=function(chartOption){var userDefined=chartOption;var customStyleModel=null;var customEngineModel=null;if(userDefined!=null){if(userDefined.styleModel!=null){customStyleModel=userDefined.styleModel;delete userDefined.styleModel;}
if(userDefined.engineModel!=null){customEngineModel=userDefined.engineModel;delete userDefined.engineModel;}}
var fullConfig=new FinancialChartOption();fullConfig=SQW.$.extend(fullConfig,FinancialChartOption.getDefaultFinancialChartOption(),userDefined);if(customStyleModel!=null){fullConfig._styleModel=customStyleModel;userDefined.styleModel=customStyleModel;}
if(customEngineModel!=null){fullConfig._engineModel=customEngineModel;userDefined.engineModel=customEngineModel;}
if(fullConfig.indicatorsParametersIntraday!=null){fullConfig.indicatorsParametersIntraday=IndicatorsParameters.extend(fullConfig.indicatorsParametersIntraday);}
if(fullConfig.indicatorsParametersHisto!=null){fullConfig.indicatorsParametersHisto=IndicatorsParameters.extend(fullConfig.indicatorsParametersHisto);}
return fullConfig;};prototype.isShowCompareBox=function(){return this.showCompareBox;};prototype.setShowCompareBox=function(showCompareBox){this.showCompareBox=showCompareBox;};prototype.isShowPeriodMenu=function(){return this.showPeriodMenu;};prototype.setShowPeriodMenu=function(showPeriodMenu){this.showPeriodMenu=showPeriodMenu;};prototype.isShowLegendInPopover=function(){return this.showLegendInPopover;};prototype.setShowLegendInPopover=function(showLegendInPopover){this.showLegendInPopover=showLegendInPopover;};prototype.getIndicatorsParametersIntraday=function(){return this.indicatorsParametersIntraday;};prototype.setIndicatorsParametersIntraday=function(indicatorsParametersIntraday){this.indicatorsParametersIntraday=indicatorsParametersIntraday;};prototype.getIndicatorsParametersHisto=function(){return this.indicatorsParametersHisto;};prototype.setIndicatorsParametersHisto=function(indicatorsParametersHisto){this.indicatorsParametersHisto=indicatorsParametersHisto;};prototype.getColorSchema=function(){return this.currentColorSchema;};prototype.setColorSchema=function(currentColorSchema){this.currentColorSchema=currentColorSchema;};prototype.getCustomIconClickHandler=function(){return this.customIconClickHandler;};prototype.setCustomIconClickHandler=function(customIconClickHandler){this.customIconClickHandler=customIconClickHandler;};prototype.isGraphHeightModifiable=function(){return this.graphHeightModifiable;};prototype.setGraphHeightModifiable=function(graphHeightModifiable){this.graphHeightModifiable=graphHeightModifiable;};prototype.getDelimiterHighlightColor=function(){return this.delimiterHighlightColor;};prototype.setDelimiterHighlightColor=function(delimiterHighlightColor){this.delimiterHighlightColor=delimiterHighlightColor;};prototype.getDelimiterHeightPixels=function(){return this.delimiterHeightPixels;};prototype.setDelimiterHeightPixels=function(delimiterHeightPixels){this.delimiterHeightPixels=delimiterHeightPixels;};},{indicatorsParametersIntraday:"IndicatorsParameters",indicatorsParametersHisto:"IndicatorsParameters",delimiterHighlightColor:"ChartColor",customIconClickHandler:{name:"Function1",arguments:[null,"Void"]},DEFAULT:{name:"Enum",arguments:["ChartOption.Implementation"]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},colorStrategy:"ColorStrategy",volumeColorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},xAxisPosition:{name:"Enum",arguments:["Layout.Position"]},y1AxisPosition:{name:"Enum",arguments:["Layout.Position"]},y2AxisPosition:{name:"Enum",arguments:["Layout.Position"]},mainAxisMinMax:{name:"Array",arguments:[null]},interactionModel:"AbstractInteractionModel",styleModel:"StyleModel",engineModel:"EngineModel",layout:"Layout",volumeAxisPosition:{name:"Enum",arguments:["Layout.Position"]},backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]},oddLinesColor:"ChartColor",oddLinesColorGradientParams:{name:"Array",arguments:[null]},evenLinesColor:"ChartColor",evenLinesColorGradientParams:{name:"Array",arguments:[null]},gridColor:"ChartColor",gridColorGradientParams:{name:"Array",arguments:[null]},yesterdayLineColor:"ChartColor",yesterdayLineColorGradientParams:{name:"Array",arguments:[null]},tickTextColor:"ChartColor",tickTextColorGradientParams:{name:"Array",arguments:[null]},tickColor:"ChartColor",tickColorGradientParams:{name:"Array",arguments:[null]},borderColor:"ChartColor",borderColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",zoomAreaColor:"ChartColor",zoomAreaColorGradientParam:{name:"Array",arguments:[null]},textColor:"ChartColor",volumeLabelColor:"ChartColor",titleColor:"ChartColor",yAxisTicksColor:"ChartColor",xAxisTicksColor:"ChartColor",labelHighlightColor:"ChartColor",xAxisFormatter:"Formatter",y1AxisFormatter:"Formatter",y2AxisFormatter:"Formatter",highlightLineColor:"ChartColor",copyrightColor:"ChartColor",stocks:{name:"Array",arguments:["Stock"]},urls:{name:"Array",arguments:[null]},data:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},copyrightPosition:{name:"Array",arguments:[null]},legendPosition:{name:"Array",arguments:[null]},legendAreaPostion:{name:"Enum",arguments:["Layout.Position"]},zoomType:{name:"Map",arguments:[null,null]},rangeSelector:{name:"Map",arguments:[null,"Object"]},startScale:{name:"Array",arguments:[null]},columnsRelativeWidth:{name:"Array",arguments:[null]},_styleModel:"StyleModel",_engineModel:"EngineModel",defaultHistoColor:"ChartColor",labelHighlightTextColor:"ChartColor"},{});
var FinancialChart=function(parentDiv,options){DefaultChart.call(this,parentDiv,options);};FinancialChart=stjs.extend(FinancialChart,DefaultChart,[],function(constructor,prototype){constructor.MINIMUM_INTRADAY_ZOOM_FACTOR=4*DateUtil.MS_MINUTE;constructor.MINIMUM_HISTO_ZOOM_FACTOR=4;prototype.provider=null;prototype.init=function(parentDiv,optionsParam){DefaultChart.prototype.init.call(this,parentDiv,optionsParam);this.updatePeriodAndFrequency(this.options.getPeriod(),this.options.getFrequency());if(this.options.isShowVolume()){this.addIndicator(IndicatorsManager.VOLUME_INDICATOR_ID);}};prototype.getExtendedOption=function(optionParams){return FinancialChartOption.extendFinancialChartOption(optionParams);};prototype.initSpecifics=function(){this.engineModel=this.options.getEngineModel();if(this.engineModel==null){this.engineModel=new FinancialEngineModel();}
this.engineModel.init(this.options);this.provider=this.options.getDataProvider();this.data=new FinancialChartData(this,this.provider,this.engineModel.getContext());this.data.attach(this);};prototype.updatePeriodAndFrequency=function(newPeriod,newFrequency){this.options.setPeriod(newPeriod);this.options.setFrequency(newFrequency);var period=Period.getInstance(newPeriod,newFrequency);if(period!=null&&period.isIntraday()){this.minimumZoomFactor=FinancialChart.MINIMUM_INTRADAY_ZOOM_FACTOR;}else{this.minimumZoomFactor=FinancialChart.MINIMUM_HISTO_ZOOM_FACTOR;}
if(this.provider!=null){this.provider.updateConfig(this.options);}
return period;};prototype.updatePeriod=function(newPeriod){this.updatePeriodAndFrequency(newPeriod,null);};prototype.updateFrequency=function(newFrequency){this.updatePeriodAndFrequency(null,newFrequency);};prototype.setPeriod=function(period){if(period==null){period=Period.HISTO_DEFAULT;}
var freq=period.getFrequency();this.options.setPeriod(period.toString());this.options.setFrequency(freq.toString());if(period.isIntraday()){this.minimumZoomFactor=FinancialChart.MINIMUM_INTRADAY_ZOOM_FACTOR;}else{this.minimumZoomFactor=FinancialChart.MINIMUM_HISTO_ZOOM_FACTOR;}
if(this.provider!=null){this.provider.updateConfig(this.options);}};prototype.isValidPositionForInteraction=function(offsetX,offsetY){var mainGraph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);var volumeGraph=this.chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);return mainGraph!=null&&(mainGraph.isInside(offsetX,offsetY)||(volumeGraph!=null&&volumeGraph.isInside(offsetX,offsetY)));};prototype.openPopOver=function(){var customIconClickHandler=this.options.getCustomIconClickHandler();if(customIconClickHandler!=null){var currentIcon=this.chartView.findElementById(DefaultTitleEngine.ICON_ID);customIconClickHandler(currentIcon!=null?currentIcon.getIconType():null);}else if(this.options.isPopOverAllowed()){FinancialPopover.getInstance().open(this);}};prototype.getDataProvider=function(){return this.provider;};prototype.add=function(stock){};prototype.remove=function(stock){};prototype.updateHistoIndicatorParams=function(params){this.options.setIndicatorsParametersHisto(params);this.data.updateIndicatorParameters(this.options);};prototype.updateIntradayIndicatorParams=function(params){this.options.setIndicatorsParametersIntraday(params);this.data.updateIndicatorParameters(this.options);};prototype.updateIndicatorParams=function(paramsHisto,paramsIntraday){this.options.setIndicatorsParametersHisto(paramsHisto);this.options.setIndicatorsParametersIntraday(paramsIntraday);this.data.updateIndicatorParameters(this.options);};prototype.getIndicator=function(indicatorId){return this.data.getIndicator(indicatorId,this.options);};prototype.addIndicator=function(indicatorId){this.data.addIndicator(indicatorId,this.options);};prototype.removeIndicator=function(indicatorId){this.data.removeIndicator(indicatorId,this.options);};prototype.getChartData=function(){return this.data;};prototype.getPeriod=function(){if(this.data!=null&&this.data.getMainSerie()!=null){return(this.data.getMainSerie()).getPeriod();}else{return null;}};prototype.setId=function(chartId){this.id=chartId;};prototype.getChartOption=function(){return this.options;};prototype.getStock=function(){var stocks=this.getStocks();if(stocks!=null){return stocks[0];}else{return null;}};prototype.getStocks=function(){return this.options!=null?this.options.getStocks():null;};},{provider:"DataProvider",zoomHistory:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},zoomLevel:{name:"Array",arguments:[null]},notifications:"ChartNotifications",panLevel:{name:"Array",arguments:[null]},renderEndCallback:"Callback0",charts:{name:"Map",arguments:[null,"Chart"]},relatedCharts:{name:"Map",arguments:[null,"Chart"]},renderCallbacks:{name:"Map",arguments:[null,"Callback1"]},parentElement:"SqwJQuery",chartType:{name:"Enum",arguments:["Chart.ChartType"]},engineModel:"EngineModel",chartView:"CanvasChartView",interactionModel:"AbstractInteractionModel"},{});
var IndicatorSerie=function(){};IndicatorSerie=stjs.extend(IndicatorSerie,null,[],function(constructor,prototype){prototype.update=function(mainSerie,range){};prototype.setUniformValue=function(unifromValue){};prototype.setValues=function(values){};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.substract=function(baseSerie,minusSerie){};prototype.getMainSerie=function(){};prototype.reset=function(){};},{},{});
var IndexedIndicatorSerie=function(name,mainSerie,colorStrategy,stepSize){IndexedSerie.call(this,colorStrategy,stepSize);this.name=name;this.id=name;this.mainSerie=mainSerie;this.uniformValue=null;if(this.mainSerie!=null){this.logScale=mainSerie.isLogScale();}};IndexedIndicatorSerie=stjs.extend(IndexedIndicatorSerie,IndexedSerie,[IndicatorSerie],function(constructor,prototype){prototype.mainSerie=null;prototype.uniformValue=null;prototype.getValue=function(i,which){if(which==Serie.X){return this.mainSerie.getValue(i,which);}else if(which==Serie.Y&&this.uniformValue!=null){return this.uniformValue;}else{return Serie.prototype.getValue.call(this,i,which);}};prototype.findIndexAtOrBeforeXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexAtOrBeforeXValue(xValue);}else{return Serie.prototype.findIndexAtOrBeforeXValue.call(this,xValue);}};prototype.findIndexClosestToXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexClosestToXValue(xValue);}else{return Serie.prototype.findIndexClosestToXValue.call(this,xValue);}};prototype.getReferenceValue=function(){return this.mainSerie.getReferenceValue();};prototype.update=function(mainSerie,range){this.mainSerie=mainSerie;};prototype.reset=function(){this.removeAllPoints();this.mainSerie=null;};prototype.setValues=function(values){this.removeAllPoints();if(values!=null){var valuesCount=values.length;for(var i=0;i<valuesCount;i++){this.pushValue(values[i]);}}};prototype.setUniformValue=function(unifromValue){this.uniformValue=unifromValue;};prototype.isEmpty=function(){if(this.uniformValue!=null){return this.mainSerie!=null?this.mainSerie.isEmpty():false;}else{return Serie.prototype.isEmpty.call(this);}};prototype.getAggregatedValues=function(aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition){if(this.uniformValue!=null){if(exactPosition){if(currentPos==0||currentPos==(width-1)){return[this.uniformValue];}else{return null;}}else{return[this.uniformValue];}}else{return Serie.prototype.getAggregatedValues.call(this,aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition);}};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else{var barTotal=0;var currentPeriodCount=0;for(var j=i;j>i-period;j--){var currentVal=mainSerie.getValueAsDouble(j,which);if(currentVal!=null&&!isNaN(currentVal)){barTotal+=currentVal;currentPeriodCount++;}}
if(currentPeriodCount>0){this.pushValue(barTotal/currentPeriodCount);}else{this.pushValue(null);}}}};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;var lastValidValue=0.0;var exp=2/(period+1);var first=true;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else if(first){var currentPeriodCount=0;var movingAve=0;for(var j=i;j>i-period;j--){var currentValue=mainSerie.getValueAsDouble(j,which);if(currentValue!=null&&!isNaN(currentValue)){movingAve+=currentValue;currentPeriodCount++;}}
if(currentPeriodCount>0){lastValidValue=movingAve/currentPeriodCount;this.pushValue(lastValidValue);first=false;}else{this.pushValue(null);}}else{var v1=mainSerie.getValueAsDouble(i,which);var v2=this.getValueAsDouble(i-1,which);if(v2!=null){lastValidValue=v2;}
if(v1!=null&&!isNaN(v1)){this.pushValue(v1*exp+lastValidValue*(1-exp));}else{this.pushValue(null);}}}};prototype.substract=function(baseSerie,minusSerie){this.removeAllPoints();if(baseSerie==null||minusSerie==null){return;}
var serieLength=stjs.trunc(Math.max(baseSerie.getLength(),minusSerie.getLength()));var which=Serie.Y;for(var i=0;i<serieLength;i++){var value1=baseSerie.getValueAsDouble(i,which);var value2=minusSerie.getValueAsDouble(i,which);if(value1!=null&&value2!=null){this.pushValue(value1-value2);}else{this.pushValue(null);}}};prototype.getMainSerie=function(){return this.mainSerie;};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var IntradayIndicatorSerie=function(name,mainSerie,colorStrategy,stepSize){TimeSerie.call(this,colorStrategy,DateUtil.MS_SECOND);this.name=name;this.id=name;this.mainSerie=mainSerie;this.uniformValue=null;};IntradayIndicatorSerie=stjs.extend(IntradayIndicatorSerie,TimeSerie,[IndicatorSerie],function(constructor,prototype){prototype.mainSerie=null;prototype.uniformValue=null;prototype.getValue=function(i,which){if(which==Serie.X){return this.mainSerie.getValue(i,which);}else if(which==Serie.Y&&this.uniformValue!=null){return this.uniformValue;}else{return Serie.prototype.getValue.call(this,i,which);}};prototype.getReferenceValue=function(){return this.mainSerie.getReferenceValue();};prototype.findIndexAtOrBeforeXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexAtOrBeforeXValue(xValue);}else{return Serie.prototype.findIndexAtOrBeforeXValue.call(this,xValue);}};prototype.findIndexClosestToXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexClosestToXValue(xValue);}else{return Serie.prototype.findIndexClosestToXValue.call(this,xValue);}};prototype.update=function(mainSerie,range){this.mainSerie=mainSerie;};prototype.reset=function(){this.removeAllPoints();this.mainSerie=null;};prototype.setValues=function(values){this.removeAllPoints();if(values!=null){var valuesCount=values.length;for(var i=0;i<valuesCount;i++){this.pushValue(values[i]);}}};prototype.setUniformValue=function(unifromValue){this.uniformValue=unifromValue;};prototype.isEmpty=function(){if(this.uniformValue!=null){return this.mainSerie!=null?this.mainSerie.isEmpty():false;}else{return Serie.prototype.isEmpty.call(this);}};prototype.getAggregatedValues=function(aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition){if(this.uniformValue!=null){if(exactPosition){if(currentPos==0||currentPos==(width-1)){return[this.uniformValue];}else{return null;}}else{return[this.uniformValue];}}else{return Serie.prototype.getAggregatedValues.call(this,aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition);}};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else{var barTotal=0;var currentPeriodCount=0;for(var j=i;j>i-period;j--){var currentVal=mainSerie.getValueAsDouble(j,which);if(currentVal!=null&&!isNaN(currentVal)){barTotal+=currentVal;currentPeriodCount++;}}
if(currentPeriodCount>0){this.pushValue(barTotal/currentPeriodCount);}else{this.pushValue(null);}}}};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;var lastValidValue=0.0;var exp=2/(period+1);var first=true;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else if(first){var currentPeriodCount=0;var movingAve=0;for(var j=i;j>i-period;j--){var currentValue=mainSerie.getValueAsDouble(j,which);if(currentValue!=null&&!isNaN(currentValue)){movingAve+=currentValue;currentPeriodCount++;}}
if(currentPeriodCount>0){lastValidValue=movingAve/currentPeriodCount;this.pushValue(lastValidValue);first=false;}else{this.pushValue(null);}}else{var v1=mainSerie.getValueAsDouble(i,which);var v2=this.getValueAsDouble(i-1,which);if(v2!=null){lastValidValue=v2;}
if(v1!=null&&!isNaN(v1)){this.pushValue(v1*exp+lastValidValue*(1-exp));}else{this.pushValue(null);}}}};prototype.substract=function(baseSerie,minusSerie){this.removeAllPoints();if(baseSerie==null||minusSerie==null){return;}
var serieLength=stjs.trunc(Math.max(baseSerie.getLength(),minusSerie.getLength()));var which=Serie.Y;for(var i=0;i<serieLength;i++){var value1=baseSerie.getValueAsDouble(i,which);var value2=minusSerie.getValueAsDouble(i,which);if(value1!=null&&value2!=null){this.pushValue(value1-value2);}else{this.pushValue(null);}}};prototype.getMainSerie=function(){return this.mainSerie;};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var YesterdayLine=function(mainSerie,range,color,dashed){IntradaySerie.call(this,null,null,mainSerie.getStock(),false);this.mainSerie=mainSerie;this.xSpaceScale=mainSerie.getXSpaceScale();this.id=YesterdayLine.INDICATOR_ID;this.name=YesterdayLine.INDICATOR_NAME;this.type=Chart.ChartType.LINE;this.setColor(color);this.setDashed(dashed);this.setInteractionAllowed(false);};YesterdayLine=stjs.extend(YesterdayLine,IntradaySerie,[IndicatorSerie],function(constructor,prototype){constructor.INDICATOR_NAME="Yesterday close";constructor.INDICATOR_ID="yesterdayLineId";prototype.mainSerie=null;prototype.update=function(mainSerie,range){if(mainSerie==null||range==null){return;}
this.mainSerie=mainSerie;this.setXSpaceScale(mainSerie.getXSpaceScale());var yesterdayValue=mainSerie.getReferenceValue();var firstXValue=range[0];var lastXValue=range[1];var firstPoint={};var lastPoint={};firstPoint[Serie.X]=firstXValue;firstPoint[Serie.Y]=yesterdayValue;firstPoint[FinancialSerie.HIGH]=yesterdayValue;firstPoint[FinancialSerie.LOW]=yesterdayValue;firstPoint[FinancialSerie.OPEN]=yesterdayValue;firstPoint[FinancialSerie.VOLUME]=0;lastPoint[Serie.X]=lastXValue;lastPoint[Serie.Y]=yesterdayValue;lastPoint[FinancialSerie.HIGH]=yesterdayValue;lastPoint[FinancialSerie.LOW]=yesterdayValue;lastPoint[FinancialSerie.OPEN]=yesterdayValue;lastPoint[FinancialSerie.VOLUME]=0;this.removeAllPoints();this.pushPoint(firstPoint);this.pushPoint(lastPoint);};prototype.getDataId=function(pixelCount){return this.id;};prototype.getMetadataId=function(pixelCount){return this.id;};prototype.getStartXValue=function(){return this.getFirstXValue();};prototype.getEndXValue=function(){return this.getLastXValue();};prototype.reset=function(){this.setColor(ChartColor.red);this.setDashed(true);this.setInteractionAllowed(false);this.removeAllPoints();};prototype.setUniformValue=function(unifromValue){};prototype.setValues=function(values){};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.substract=function(baseSerie,minusSerie){};prototype.getMainSerie=function(){return this.mainSerie;};prototype.getReferenceValue=function(){return this.mainSerie.getReferenceValue();};},{stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var IndicatorsParameters=function(){this.ADX={};this.ARO={};this.BOL={};this.CCI={};this.EMA={};this.HVO={};this.LRC={};this.MACD={};this.MAV={};this.MOM={};this.OBV={};this.RSI={};this.SAR={};this.STD={};this.STO={};this.VOL={};this.WIL={};this.ZIG={};this.parameters={};for(var index in IndicatorsManager.AVAILABLE_INDICATORS){if(!(IndicatorsManager.AVAILABLE_INDICATORS).hasOwnProperty(index))
continue;var indicatorName=IndicatorsManager.AVAILABLE_INDICATORS[index];this.parameters[indicatorName]=(this)[indicatorName];}};IndicatorsParameters=stjs.extend(IndicatorsParameters,null,[],function(constructor,prototype){constructor.defaultInstance=null;constructor.ENABLED_PARAMETER="enabled";constructor.PERIOD_PARAMETER="period";constructor.DEVIATIONS_PARAMETER="deviations";constructor.PERIOD_SHORT_PARAMETER="period_short";constructor.PERIOD_MEDIUM_PARAMETER="period_medium";constructor.PERIOD_LONG_PARAMETER="period_long";constructor.PERIOD_9_PARAMETER="period_9";constructor.PERIOD_12_PARAMETER="period_12";constructor.PERIOD_26_PARAMETER="period_26";constructor.ACCELERATION_PARAMETER="acceleration";constructor.MAX_ACCELERATION_PARAMETER="max_acceleration";constructor.PERIOD_K_PARAMETER="period_k";constructor.PERIOD_D_PARAMETER="period_d";constructor.PERCENT_PARAMETER="percent";prototype.ADX=null;prototype.ARO=null;prototype.BOL=null;prototype.CCI=null;prototype.EMA=null;prototype.HVO=null;prototype.LRC=null;prototype.MACD=null;prototype.MAV=null;prototype.MOM=null;prototype.OBV=null;prototype.RSI=null;prototype.SAR=null;prototype.STD=null;prototype.STO=null;prototype.VOL=null;prototype.WIL=null;prototype.ZIG=null;prototype.parameters=null;constructor.extend=function(partialParams){if(partialParams!=null){var defaultParamsExtended=IndicatorsParameters.getDefault();for(var index in IndicatorsManager.AVAILABLE_INDICATORS){if(!(IndicatorsManager.AVAILABLE_INDICATORS).hasOwnProperty(index))
continue;var indicatorName=IndicatorsManager.AVAILABLE_INDICATORS[index];var customIndicatorParams=(partialParams)[indicatorName];if(customIndicatorParams!=null){var defaultIndicatorParams=(defaultParamsExtended)[indicatorName];SQW.$.extend(defaultIndicatorParams,customIndicatorParams);}}
return defaultParamsExtended;}else{return IndicatorsParameters.getDefault();}};constructor.getDefault=function(){var defaultParam=new IndicatorsParameters();defaultParam.ADX[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.ADX[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.ARO[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.ARO[IndicatorsParameters.PERIOD_PARAMETER]=25.0;defaultParam.BOL[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.BOL[IndicatorsParameters.PERIOD_PARAMETER]=20.0;defaultParam.BOL[IndicatorsParameters.DEVIATIONS_PARAMETER]=2.0;defaultParam.CCI[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.CCI[IndicatorsParameters.PERIOD_PARAMETER]=20.0;defaultParam.EMA[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.EMA[IndicatorsParameters.PERIOD_SHORT_PARAMETER]=20.0;defaultParam.EMA[IndicatorsParameters.PERIOD_MEDIUM_PARAMETER]=50.0;defaultParam.EMA[IndicatorsParameters.PERIOD_LONG_PARAMETER]=200.0;defaultParam.HVO[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.HVO[IndicatorsParameters.PERIOD_PARAMETER]=100.0;defaultParam.LRC[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.LRC[IndicatorsParameters.PERIOD_PARAMETER]=200.0;defaultParam.MACD[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.MACD[IndicatorsParameters.PERIOD_9_PARAMETER]=9.0;defaultParam.MACD[IndicatorsParameters.PERIOD_12_PARAMETER]=12.0;defaultParam.MACD[IndicatorsParameters.PERIOD_26_PARAMETER]=26.0;defaultParam.MAV[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.MAV[IndicatorsParameters.PERIOD_SHORT_PARAMETER]=20.0;defaultParam.MAV[IndicatorsParameters.PERIOD_MEDIUM_PARAMETER]=50.0;defaultParam.MAV[IndicatorsParameters.PERIOD_LONG_PARAMETER]=200.0;defaultParam.MOM[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.MOM[IndicatorsParameters.PERIOD_PARAMETER]=12.0;defaultParam.OBV[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.RSI[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.RSI[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.SAR[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.SAR[IndicatorsParameters.PERIOD_PARAMETER]=2.0;defaultParam.SAR[IndicatorsParameters.ACCELERATION_PARAMETER]=2.0;defaultParam.SAR[IndicatorsParameters.MAX_ACCELERATION_PARAMETER]=20.0;defaultParam.STD[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.STD[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.STO[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.STO[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.STO[IndicatorsParameters.PERIOD_K_PARAMETER]=3.0;defaultParam.STO[IndicatorsParameters.PERIOD_D_PARAMETER]=3.0;defaultParam.VOL[IndicatorsParameters.ENABLED_PARAMETER]=true;defaultParam.WIL[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.WIL[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.ZIG[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.ZIG[IndicatorsParameters.PERCENT_PARAMETER]=5.0;return defaultParam;};prototype.getIndicatorParameters=function(indicatorId){return this.parameters[indicatorId];};constructor.getDefaultIndicatorParameters=function(indicatorId){if(IndicatorsParameters.defaultInstance==null){IndicatorsParameters.defaultInstance=IndicatorsParameters.getDefault();}
return SQW.$.extend({},IndicatorsParameters.defaultInstance.getIndicatorParameters(indicatorId));};constructor.addDefaultIndicatorParametersTo=function(indicatorName,currentVal){if(IndicatorsParameters.defaultInstance==null){IndicatorsParameters.defaultInstance=IndicatorsParameters.getDefault();}
return SQW.$.extend({},IndicatorsParameters.defaultInstance.getIndicatorParameters(indicatorName),currentVal);};prototype.isEnabled=function(indicatorId){var param=this.parameters[indicatorId];if(param!=null){return param[IndicatorsParameters.ENABLED_PARAMETER];}else{return false;}};},{defaultInstance:"IndicatorsParameters",ADX:{name:"Map",arguments:[null,"Object"]},ARO:{name:"Map",arguments:[null,"Object"]},BOL:{name:"Map",arguments:[null,"Object"]},CCI:{name:"Map",arguments:[null,"Object"]},EMA:{name:"Map",arguments:[null,"Object"]},HVO:{name:"Map",arguments:[null,"Object"]},LRC:{name:"Map",arguments:[null,"Object"]},MACD:{name:"Map",arguments:[null,"Object"]},MAV:{name:"Map",arguments:[null,"Object"]},MOM:{name:"Map",arguments:[null,"Object"]},OBV:{name:"Map",arguments:[null,"Object"]},RSI:{name:"Map",arguments:[null,"Object"]},SAR:{name:"Map",arguments:[null,"Object"]},STD:{name:"Map",arguments:[null,"Object"]},STO:{name:"Map",arguments:[null,"Object"]},VOL:{name:"Map",arguments:[null,"Object"]},WIL:{name:"Map",arguments:[null,"Object"]},ZIG:{name:"Map",arguments:[null,"Object"]},parameters:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]}},{});
var Indicator=function(){};Indicator=stjs.extend(Indicator,null,[],function(constructor,prototype){prototype.getId=function(){};prototype.setId=function(id){};prototype.getName=function(){};prototype.setName=function(name){};prototype.getDescription=function(){};prototype.setParameters=function(parameters){};prototype.getParameter=function(param){};prototype.getDoubleParameter=function(param){};prototype.calculate=function(mainSerie,context){};prototype.getSeries=function(){};prototype.reset=function(){};prototype.getSignal=function(mainSerie,index){};prototype.getSignals=function(){};prototype.getColors=function(){};prototype.updateColorSchema=function(newSchemaId){};prototype.setColors=function(colors){};prototype.setEnabled=function(enabled){};prototype.isEnabled=function(){};prototype.getCorrespondingAreaId=function(){};prototype.isOnArea=function(graphArea){};prototype.hasAxisPosition=function(axisPos){};prototype.getAxisPosition=function(){};prototype.isHasSignals=function(){};},{},{});
var DefaultIndicator=function(name,id,correspondingAreaId,axisPosition,parameters){this.name=name;this.id=id;this.correspondingAreaId=correspondingAreaId;this.parameters=parameters;this.currentSchemaId=DefaultIndicator.RED_GREEN_SCHEMA_ID;this.axisPosition=axisPosition;this.hasSignals=true;};DefaultIndicator=stjs.extend(DefaultIndicator,null,[Indicator],function(constructor,prototype){constructor.MIN_AREA_CROSS_LINE=10;constructor.RED_GREEN_SCHEMA_ID="0";constructor.ORANGE_BLUE_SCHEMA_ID="1";prototype.name=null;prototype.id=null;prototype.currentSchemaId=null;prototype.previouslyComputedSchemaId=null;prototype.correspondingAreaId=null;prototype.axisPosition=null;prototype.parameters=null;prototype.series=null;prototype.colors=null;prototype.signalsColorStrategy=null;prototype.signals=null;prototype.currentSerieId=null;prototype.currentSize=null;prototype.hasSignals=false;prototype.calculate=function(mainSerie,context){if(this.needComputation(mainSerie,context)){if(this.currentSchemaId==DefaultIndicator.ORANGE_BLUE_SCHEMA_ID){this.colors=this.getOrangeBlueSchema();this.signalsColorStrategy=ColorStrategy.BLUE_ORANGE;}else{this.colors=this.getRedGreenSchema();this.signalsColorStrategy=ColorStrategy.GREEN_RED;}
this.previouslyComputedSchemaId=this.currentSchemaId;this.currentSerieId=mainSerie!=null?mainSerie.getDataId(""):null;this.currentSize=mainSerie!=null?mainSerie.getLength():0;var regularIntervalSerie=IntradaySerie.toRegularFrequency(mainSerie);this.calculateSeries(regularIntervalSerie,context);this.calculateSignals(regularIntervalSerie);}};prototype.getRedGreenSchema=function(){};prototype.getOrangeBlueSchema=function(){};prototype.updateColorSchema=function(newSchemaId){this.currentSchemaId=newSchemaId;};prototype.needComputation=function(mainSerie,context){var hasDiffParam=this.hasDifferentParameters();var isDifferentSerie=(mainSerie==null)?(this.currentSerieId!=null):mainSerie.getDataId("")!=this.currentSerieId;var hasDifferentSize=(mainSerie==null)?(this.currentSize!=null):mainSerie.getLength()!=this.currentSize;var hasDiffSchema=this.currentSchemaId!=this.previouslyComputedSchemaId;return hasDiffParam||isDifferentSerie||hasDifferentSize||hasDiffSchema||this.isDifferentReference(this.getSeries(),mainSerie);};prototype.isDifferentReference=function(computedSeries,mainSerie){var computedIndicator=computedSeries!=null?computedSeries[0]:null;if(computedIndicator==null||computedIndicator.getMainSerie()==null||mainSerie==null){return true;}
return!mainSerie.isIntraday()&&computedIndicator.getMainSerie().getId()!=mainSerie.getId();};prototype.hasDifferentParameters=function(){};prototype.calculateSeries=function(mainSerie,context){};prototype.createIndicatorSerie=function(mainSerie,name,colorStrategy,stepSize){var indicatorSerie=null;if(mainSerie==null||mainSerie.isIndexed()){indicatorSerie=new IndexedIndicatorSerie(name,mainSerie,colorStrategy,stepSize);}else{indicatorSerie=new IntradayIndicatorSerie(name,mainSerie,colorStrategy,stepSize);}
indicatorSerie.setType(Chart.ChartType.LINE);return indicatorSerie;};prototype.calculateSignals=function(mainSerie){if(this.hasSignals){var signalsSerie=this.createIndicatorSerie(mainSerie,this.name+"_signals",null,null);signalsSerie.setColorStrategy(this.signalsColorStrategy);var length=mainSerie!=null?mainSerie.getLength():0;if(length>0){signalsSerie.pushValue(0.0);}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,Serie.Y,0)+1;for(var i=1;i<length;i++){if(i<firstValidIndex){signalsSerie.pushValue(0.0);}else{signalsSerie.pushValue(this.getSignal(mainSerie,i));}}
this.signals=signalsSerie;}else{this.signals=null;}};prototype.reset=function(){this.series=null;this.signals=null;};prototype.getName=function(){return this.name;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.setName=function(strName){this.name=strName;};prototype.setEnabled=function(enabled){if(this.parameters!=null){this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=enabled;}
for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;this.series[index].setEnabled(enabled);}};prototype.isEnabled=function(){if(this.parameters==null||this.parameters[IndicatorsParameters.ENABLED_PARAMETER]==null){return false;}
if(this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="true"){return true;}
if(this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="false"){return false;}
return this.parameters[IndicatorsParameters.ENABLED_PARAMETER];};prototype.setParameters=function(parameters){this.parameters=parameters;};prototype.getParameter=function(param){var validDoubleValue=null;if(this.parameters!=null&&this.parameters[param]!=null&&!isNaN(this.parameters[param])){validDoubleValue=this.parameters[param];}else{validDoubleValue=IndicatorsParameters.getDefaultIndicatorParameters(this.id)[param];}
return stjs.trunc(Math.round(validDoubleValue));};prototype.getDoubleParameter=function(param){if(this.parameters!=null&&this.parameters[param]!=null&&!isNaN(this.parameters[param])){return this.parameters[param];}else{return IndicatorsParameters.getDefaultIndicatorParameters(this.id)[param];}};prototype.getSeries=function(){return this.series;};prototype.setColors=function(colors){this.colors=colors;};prototype.getColors=function(){return this.colors;};prototype.getSignals=function(){return this.signals;};prototype.crossAscSerie=function(crossingSerie,comparedSerie,index){var y=Serie.Y;var v1=crossingSerie.getValueAsDouble(index-1,y);var v2=comparedSerie.getValueAsDouble(index-1,y);var v3=crossingSerie.getValueAsDouble(index,y);var v4=comparedSerie.getValueAsDouble(index,y);return v1!=null&&v2!=null&&v3!=null&&v4!=null&&(v1<v2&&v3>v4);};prototype.crossDescSerie=function(crossingSerie,comparedSerie,index){var y=Serie.Y;var v1=crossingSerie.getValueAsDouble(index-1,y);var v2=comparedSerie.getValueAsDouble(index-1,y);var v3=crossingSerie.getValueAsDouble(index,y);var v4=comparedSerie.getValueAsDouble(index,y);return v1!=null&&v2!=null&&v3!=null&&v4!=null&&(v1>v2&&v3<v4);};prototype.crossAscConstant=function(s,nLevel,idx){var y=Serie.Y;var v1=s.getValueAsDouble(idx-1,y);var v2=s.getValueAsDouble(idx,y);if(v1!=null&&v2!=null&&v1<nLevel&&v2>=nLevel){return DefaultIndicator.isAreaBigger(s,nLevel,idx-1,DefaultIndicator.MIN_AREA_CROSS_LINE);}
return false;};prototype.crossDescConstant=function(s,nLevel,idx){var y=Serie.Y;var v1=s.getValueAsDouble(idx-1,y);var v2=s.getValueAsDouble(idx,y);if(v1!=null&&v2!=null&&v1>nLevel&&v2<=nLevel){return DefaultIndicator.isAreaBigger(s,nLevel,idx-1,DefaultIndicator.MIN_AREA_CROSS_LINE);}
return false;};constructor.isAreaBigger=function(s,nLevel,idx,min){var y=Serie.Y;var area=0;var diff=s.getValueAsDouble(idx,y)-nLevel;var sgn=(diff>=0)?1:-1;for(var i=idx;i>=0;i--){diff=s.getValueAsDouble(i,y)-nLevel;if(diff*sgn<0){return false;}
area+=sgn*diff;if(area>=min){return true;}}
return false;};prototype.getCorrespondingAreaId=function(){return this.correspondingAreaId;};constructor.getFirstValidFinancialIndex=function(mainSerie,which,startIndex){var length=mainSerie!=null?mainSerie.getLength():0;for(var i=startIndex;i<length;i++){if(DefaultIndicator.isValidFinancialValue(mainSerie.getValueAsDouble(i,which))){return i;}}
return length;};constructor.isValidFinancialValue=function(value){return value!=null&&!isNaN(value)&&value>0;};prototype.isOnArea=function(graphArea){return this.correspondingAreaId==graphArea;};prototype.hasAxisPosition=function(axisPos){return this.axisPosition==axisPos;};prototype.isHasSignals=function(){return this.hasSignals;};prototype.getDescription=function(){var description=[];var serieDescription={};var paramsString="";if(this.getParamValues()!=null){paramsString="("+this.getParamValues()+")";}
serieDescription["text"]=this.getName()+paramsString;serieDescription["color"]=this.colors!=null?this.colors[0]:ChartColor.black;description.push(serieDescription);return description;};prototype.getParamValues=function(){return null;};prototype.getAxisPosition=function(){return this.axisPosition;};},{axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var AroonIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Aroon",IndicatorsManager.AROON_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=AroonIndicator.COLORS_DEFAULT;this.hasSignals=false;};AroonIndicator=stjs.extend(AroonIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.GREEN_MAV,ChartColor.RED_MAV,ChartColor.GRAY_MAV];constructor.COLORS_ORANGE_BLUE=[ChartColor.blue,ChartColor.orange,ChartColor.GRAY_MAV];prototype.up=null;prototype.down=null;prototype.upLine=null;prototype.midLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var period=this.currentPeriod;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,FinancialSerie.HIGH,0);var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.up.pushValue(null);this.down.pushValue(null);}else{var u=0,d=0;var high=0,low=Double.MAX_VALUE;for(var j=i-period+1;j<=i;j++){var tmpHigh=mainSerie.getValueAsDouble(j,FinancialSerie.HIGH);var tmpLow=mainSerie.getValueAsDouble(j,FinancialSerie.LOW);if(tmpHigh>=high){high=tmpHigh;u=j-(i-period);}
if(tmpLow<=low){low=tmpLow;d=j-(i-period);}}
this.up.pushValue(u*100/period);this.down.pushValue(d*100/period);}}};prototype.updateSeries=function(mainSerie){this.up=this.createIndicatorSerie(mainSerie,"Aroon Up",null,null);this.down=this.createIndicatorSerie(mainSerie,"Aroon Down",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"aroon_up_line",null,null);this.midLine=this.createIndicatorSerie(mainSerie,"aroon_middle_line",null,null);this.midLine.setDashed(true);this.downLine=this.createIndicatorSerie(mainSerie,"aroon_down_line",null,null);this.upLine.setUniformValue(70.0);this.midLine.setUniformValue(50.0);this.downLine.setUniformValue(30.0);this.series=[this.up,this.down,this.upLine,this.midLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.up.setColor(colors[0]);this.down.setColor(colors[1]);this.upLine.setColor(colors[2]);this.midLine.setColor(colors[2]);this.downLine.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return AroonIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return AroonIndicator.COLORS_ORANGE_BLUE;};prototype.getSignal=function(mainSerie,index){return 0;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var AverageDirectionalMovementIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"ADX",IndicatorsManager.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=AverageDirectionalMovementIndicator.COLORS_DEFAULT;};AverageDirectionalMovementIndicator=stjs.extend(AverageDirectionalMovementIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.blue,ChartColor.GREEN_MAV,ChartColor.RED_MAV];constructor.COLORS_ORANGE_BLUE=[ChartColor.GRAY_MAV,ChartColor.blue,ChartColor.orange];prototype.lineColor=null;prototype.sDmiMinus=null;prototype.sDmiPlus=null;prototype.sAdx=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var period=this.currentPeriod;var DMI_PLUS=[];DMI_PLUS.length=mainPointsCount;var DMI_MINUS=[];DMI_MINUS.length=mainPointsCount;var TRUE_RANGE=[];TRUE_RANGE.length=mainPointsCount;var high=FinancialSerie.HIGH;var low=FinancialSerie.LOW;var close=FinancialSerie.CLOSE;for(var i=0;i<mainPointsCount;i++){var currentHigh=mainSerie.getValueAsDouble(i,high);var currentLow=mainSerie.getValueAsDouble(i,low);var previousHigh=mainSerie.getValueAsDouble(i-1,high);var previousLow=mainSerie.getValueAsDouble(i-1,low);var previousClose=mainSerie.getValueAsDouble(i-1,close);var currentClose=mainSerie.getValueAsDouble(i,close);if(DefaultIndicator.isValidFinancialValue(currentHigh)&&DefaultIndicator.isValidFinancialValue(currentLow)&&DefaultIndicator.isValidFinancialValue(previousHigh)&&DefaultIndicator.isValidFinancialValue(previousLow)&&DefaultIndicator.isValidFinancialValue(currentClose)&&DefaultIndicator.isValidFinancialValue(previousClose)){var hiDiff=currentHigh-previousHigh;var loDiff=previousLow-currentLow;DMI_PLUS[i]=0.0;DMI_MINUS[i]=0.0;if((hiDiff<0&&loDiff<0)||hiDiff==loDiff){DMI_PLUS[i]=0.0;DMI_MINUS[i]=0.0;}else if(hiDiff>loDiff){DMI_PLUS[i]=hiDiff;}else if(hiDiff<loDiff){DMI_MINUS[i]=loDiff;}
TRUE_RANGE[i]=Math.max(Math.max(Math.abs(currentHigh-currentLow),Math.abs(currentHigh-previousClose)),Math.abs(previousClose-currentLow));}else{DMI_PLUS[i]=0.0;DMI_MINUS[i]=0.0;TRUE_RANGE[i]=0.0;}}
var EMA_DMI_PLUS=this.ema(DMI_PLUS,this.currentPeriod);var EMA_DMI_MINUS=this.ema(DMI_MINUS,this.currentPeriod);var EMA_TRUE_RANGE=this.ema(TRUE_RANGE,this.currentPeriod);var DX=[];var currentCount=EMA_TRUE_RANGE.length;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,Serie.Y,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<currentCount;i++){if(i>=periodLimit&&EMA_TRUE_RANGE[i]!=0){var currentDmiPlusValue=100*EMA_DMI_PLUS[i]/EMA_TRUE_RANGE[i];var currentDmiMinusValue=100*EMA_DMI_MINUS[i]/EMA_TRUE_RANGE[i];this.sDmiPlus.pushValue(currentDmiPlusValue);this.sDmiMinus.pushValue(currentDmiMinusValue);DX.push(100*Math.abs(currentDmiPlusValue-currentDmiMinusValue)/(currentDmiPlusValue+currentDmiMinusValue)/this.currentPeriod);}else{this.sDmiMinus.pushValue(0.0);this.sDmiPlus.pushValue(0.0);DX.push(0.0);}}
var ADX=this.ema(DX,this.currentPeriod);this.sAdx.setValues(ADX);};prototype.updateSeries=function(mainSerie){this.sDmiMinus=this.createIndicatorSerie(mainSerie,"DI-",null,null);this.sDmiPlus=this.createIndicatorSerie(mainSerie,"DI+",null,null);this.sAdx=this.createIndicatorSerie(mainSerie,"ADX",null,null);this.series=[this.sAdx,this.sDmiPlus,this.sDmiMinus];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.ema=function(v,n){var vt=[];vt[0]=v[0];var vLength=v.length;for(var i=1;i<vLength;i++){vt[i]=vt[i-1]*(n-1)/n+v[i];}
return vt;};prototype.getSignal=function(mainSerie,index){var y=Serie.Y;if(this.crossAscSerie(this.sDmiPlus,this.sDmiMinus,index)&&this.sAdx.getValueAsDouble(index,y)>Math.max(this.sDmiMinus.getValueAsDouble(index,y),this.sDmiPlus.getValueAsDouble(index,y))){return 1;}
if(this.crossDescSerie(this.sDmiPlus,this.sDmiMinus,index)&&this.sAdx.getValueAsDouble(index,y)>Math.max(this.sDmiMinus.getValueAsDouble(index,y),this.sDmiPlus.getValueAsDouble(index,y))){return-1;}
if(index<3){return 0;}
for(var i=index-2;i<=index;i++){if(this.sAdx.getValueAsDouble(i,y)<Math.max(this.sDmiMinus.getValueAsDouble(i,y),this.sDmiPlus.getValueAsDouble(i,y))){return 0;}}
if(this.sAdx.getValueAsDouble(index-3,y)<this.sAdx.getValueAsDouble(index-2,y)&&this.sAdx.getValueAsDouble(index-2,y)<this.sAdx.getValueAsDouble(index-1,y)&&this.sAdx.getValueAsDouble(index-1,y)>=this.sAdx.getValueAsDouble(index,y)){if(this.sDmiPlus.getValueAsDouble(index-1,y)>=this.sDmiMinus.getValueAsDouble(index-1,y)){return-1;}
return 1;}
return 0;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.sAdx.getName()+" ";serieDescription["color"]=this.sAdx!=null?this.sAdx.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[0];description.push(serieDescription);serieDescription={};serieDescription["text"]=this.sDmiPlus.getName()+" ";serieDescription["color"]=this.sDmiPlus!=null?this.sDmiPlus.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]=this.sDmiMinus.getName();serieDescription["color"]=this.sDmiMinus!=null?this.sDmiMinus.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[2];description.push(serieDescription);serieDescription={};serieDescription["text"]="("+Math.round(this.currentPeriod)+")";serieDescription["color"]=this.sAdx!=null?this.sAdx.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[0];description.push(serieDescription);return description;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.sAdx.setColor(colors[0]);this.sDmiPlus.setColor(colors[1]);this.sDmiMinus.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return AverageDirectionalMovementIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return AverageDirectionalMovementIndicator.COLORS_ORANGE_BLUE;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},lineColor:"ChartColor",axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var BollingerIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Bollinger",IndicatorsManager.BOLLINGER_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=BollingerIndicator.COLORS_DEFAULT;};BollingerIndicator=stjs.extend(BollingerIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.PURPLE,ChartColor.PURPLE,ChartColor.PURPLE];prototype.upperBand=null;prototype.middleBand=null;prototype.lowerBand=null;prototype.currentPeriod=0;prototype.numberOfStandardDeviations=0.0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER)||this.numberOfStandardDeviations!=this.getDoubleParameter(IndicatorsParameters.DEVIATIONS_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);this.numberOfStandardDeviations=this.getDoubleParameter(IndicatorsParameters.DEVIATIONS_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var period=this.currentPeriod;this.updateSeries(mainSerie);var barTotal=0;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,Serie.Y,0);var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){barTotal=0;if(i>=periodLimit){var actualVal=0;for(var j=i;j>i-period;j--){var currValue=mainSerie.getValueAsDouble(j,Serie.Y);if(DefaultIndicator.isValidFinancialValue(currValue)){barTotal+=currValue;actualVal++;}}
if(actualVal>0){var mb=barTotal/actualVal;var innerSum=0.0;var temp=0.0;for(var j=i;j>i-period;j--){var currValue=mainSerie.getValueAsDouble(j,Serie.Y);if(DefaultIndicator.isValidFinancialValue(currValue)){temp=(currValue-mb);innerSum+=temp*temp;}}
this.middleBand.pushValue(mb);this.upperBand.pushValue(mb+this.numberOfStandardDeviations*Math.sqrt(innerSum/actualVal));this.lowerBand.pushValue(mb-this.numberOfStandardDeviations*Math.sqrt(innerSum/actualVal));}else{this.middleBand.pushValue(null);this.upperBand.pushValue(null);this.lowerBand.pushValue(null);}}else{this.middleBand.pushValue(null);this.upperBand.pushValue(null);this.lowerBand.pushValue(null);}}};prototype.updateSeries=function(mainSerie){this.upperBand=this.createIndicatorSerie(mainSerie,"Bol-Upper",null,null);this.middleBand=this.createIndicatorSerie(mainSerie,"Bol-Middle",null,null);this.lowerBand=this.createIndicatorSerie(mainSerie,"Bol-Lower",null,null);this.series=[this.upperBand,this.middleBand,this.lowerBand];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossAscSerie(mainSerie,this.upperBand,index)){return 1;}
if(this.crossDescSerie(mainSerie,this.lowerBand,index)){return-1;}
return 0;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod))+"/"+String.valueOf(Math.round(this.numberOfStandardDeviations));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.upperBand.setColor(colors[0]);this.middleBand.setColor(colors[1]);this.lowerBand.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return BollingerIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return BollingerIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var CommodityChannelIndexIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Commodity Channel Index",IndicatorsManager.COMMODITY_CHANNEL_INDEX_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=CommodityChannelIndexIndicator.COLORS_DEFAULT;};CommodityChannelIndexIndicator=stjs.extend(CommodityChannelIndexIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.PURPLE,ChartColor.PURPLE,ChartColor.PURPLE];prototype.cci=null;prototype.upLine=null;prototype.midLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var timePeriod=this.currentPeriod;var currentValues=null;this.updateSeries(mainSerie);for(var i=0;i<mainPointsCount;i++){var currentHigh=mainSerie.getValueAsDouble(i,FinancialSerie.HIGH);var currentLow=mainSerie.getValueAsDouble(i,FinancialSerie.LOW);var currentClose=mainSerie.getValueAsDouble(i,FinancialSerie.CLOSE);if(i<timePeriod||!DefaultIndicator.isValidFinancialValue(currentHigh)||!DefaultIndicator.isValidFinancialValue(currentLow)||!DefaultIndicator.isValidFinancialValue(currentClose)){this.cci.pushValue(null);}else{var tpma=0;currentValues=[];for(var j=i;j>i-timePeriod;j--){var v1=mainSerie.getValueAsDouble(j,FinancialSerie.HIGH);var v2=mainSerie.getValueAsDouble(j,FinancialSerie.LOW);var v3=mainSerie.getValueAsDouble(j,FinancialSerie.CLOSE);if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)&&DefaultIndicator.isValidFinancialValue(v3)){var tp=(v1+v2+v3)/3;tpma+=tp;currentValues.push(tp);}}
var validCount=currentValues.length;if(validCount>0){tpma/=validCount;var md=0;for(var j=0;j<validCount;j++){md+=Math.abs(currentValues[j]-tpma);}
md/=validCount;if(md!=0){var tpi=(currentHigh+currentLow+currentClose)/3;var ccival=(tpi-tpma)/(0.015*md);this.cci.pushValue(ccival);}else{this.cci.pushValue(null);}}else{this.cci.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.cci=this.createIndicatorSerie(mainSerie,"CCI",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"cci_up_line",null,null);this.midLine=this.createIndicatorSerie(mainSerie,"cci_middle_line",null,null);this.midLine.setDashed(true);this.downLine=this.createIndicatorSerie(mainSerie,"cci_down_line",null,null);this.upLine.setUniformValue(100.0);this.midLine.setUniformValue(0.0);this.downLine.setUniformValue(-100.0);this.series=[this.cci,this.upLine,this.midLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossAscConstant(this.cci,-100,index)){return 1;}
if(this.crossDescConstant(this.cci,100,index)){return-1;}
return 0;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.cci.setColor(colors[0]);this.upLine.setColor(colors[0]);this.midLine.setColor(colors[0]);this.downLine.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return CommodityChannelIndexIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return CommodityChannelIndexIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var HistoricalVolatilityIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Volatility",IndicatorsManager.HISTORICAL_VOLATILITY_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=HistoricalVolatilityIndicator.COLORS_DEFAULT;this.hasSignals=false;};HistoricalVolatilityIndicator=stjs.extend(HistoricalVolatilityIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.DAILYVALUESBYYEAR=252;constructor.WEEKLYVALUESBYYEAR=52;constructor.MONTHLYVALUESBYYEAR=12;constructor.COLORS_DEFAULT=[ChartColor.black,ChartColor.black,ChartColor.black];prototype.continualProfitability=null;prototype.continualProfitabilityMAV=null;prototype.volatility=null;prototype.currentPeriod=0;constructor.getValueNumber=function(type){switch(type){case Frequency.Type.LIVE:case Frequency.Type.SECOND:case Frequency.Type.MINUTE:case Frequency.Type.HOUR:return 20;case Frequency.Type.DAY:return HistoricalVolatilityIndicator.DAILYVALUESBYYEAR;case Frequency.Type.WEEK:return HistoricalVolatilityIndicator.WEEKLYVALUESBYYEAR;case Frequency.Type.MONTH:return HistoricalVolatilityIndicator.MONTHLYVALUESBYYEAR;case Frequency.Type.YEAR:return 1;default:return 1;}};prototype.hasDifferentParameters=function(){return this.currentPeriod!=(this.getParameter(IndicatorsParameters.PERIOD_PARAMETER));};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var period=this.currentPeriod;this.updateSeries(mainSerie);var nbValues=HistoricalVolatilityIndicator.getValueNumber(mainSerie.getPeriod().getFrequency().getType());var which=Serie.Y;this.continualProfitability.pushValue(0.0);for(var i=1;i<mainPointsCount;i++){this.continualProfitability.pushValue(Math.log(mainSerie.getValueAsDouble(i,which)/mainSerie.getValueAsDouble(i-1,which)));}
this.continualProfitabilityMAV.computeMovingAverage(this.continualProfitability,0,period);var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.volatility.pushValue(null);}else{var total=0.0;var validCount=0;for(var k=0;k<period;k++){var cpVal=this.continualProfitability.getValueAsDouble(i-k,which);var cpMAVVal=this.continualProfitabilityMAV.getValueAsDouble(i,which);if(cpVal!=null&&!isNaN(cpVal)&&cpMAVVal!=null&&!isNaN(cpMAVVal)){validCount++;total+=Math.pow(cpVal-cpMAVVal,2);}}
if(validCount>1){var variance=(1.0/(validCount-1.0))*total;this.volatility.pushValue(100*(Math.sqrt(variance)*Math.sqrt(nbValues)));}else{this.volatility.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.volatility=this.createIndicatorSerie(mainSerie,"Volatility",null,null);this.continualProfitability=this.createIndicatorSerie(mainSerie,"Volatility",null,null);this.continualProfitabilityMAV=this.createIndicatorSerie(mainSerie,"volatilityMav",null,null);this.series=[this.volatility];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.volatility.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return HistoricalVolatilityIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return HistoricalVolatilityIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var LinearRegressionChannelIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Linear Regression",IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=LinearRegressionChannelIndicator.COLORS_DEFAULT;this.hasSignals=false;};LinearRegressionChannelIndicator=stjs.extend(LinearRegressionChannelIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.DAILYVALUESBYYEAR=252;constructor.WEEKLYVALUESBYYEAR=52;constructor.MONTHLYVALUESBYYEAR=12;constructor.COLORS_DEFAULT=[ChartColor.DARK_BLUE,ChartColor.LIGHT_ORANGE,ChartColor.LIGHT_ORANGE];prototype.pointsSerie=null;prototype.topSerie=null;prototype.bottomSerie=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return true;};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var period=this.currentPeriod-1;this.updateSeries(mainSerie);var nb=mainPointsCount;context.getMainMaxIndex(Serie.X);if(mainSerie!=null&&context.getRange(DefaultLayout.X_AXIS_AREA)!=null&&context.getRange(DefaultLayout.X_AXIS_AREA)[1]!=null){var lastIndex=mainSerie.findIndexAtOrBeforeXValue(context.getRange(DefaultLayout.X_AXIS_AREA)[1]);if(lastIndex!=null&&!isNaN(lastIndex)&&lastIndex<mainPointsCount){nb=lastIndex+1;}}
var startBar=nb-period;if(startBar<0){return;}
var x=0.0;var y=0.0;var xy=0.0;var xSquared=0.0;var validValues=0;for(var i=startBar;i<nb;i++){var value=mainSerie.getValueAsDouble(i,Serie.Y);if(DefaultIndicator.isValidFinancialValue(value)){x+=i;validValues++;y+=value;xy+=i*value;xSquared+=i*i;}}
period=validValues;var b=(period*xy-x*y)/(period*xSquared-x*x);var a=(y-b*x)/period;var dummy=0.0;var diff=0.0;var yOffset=0.0;for(var i=startBar;i<nb;i++){var value=mainSerie.getValueAsDouble(i,Serie.Y);if(DefaultIndicator.isValidFinancialValue(value)){dummy=b*i+a;diff=Math.abs(value-dummy);yOffset=Math.max(yOffset,diff);}}
for(var i=0;i<nb;i++){if(i<startBar){this.pointsSerie.pushValue(null);this.topSerie.pushValue(null);this.bottomSerie.pushValue(null);}else{this.pointsSerie.pushValue(b*i+a);this.topSerie.pushValue(b*i+a+yOffset);this.bottomSerie.pushValue(b*i+a-yOffset);}}};prototype.updateSeries=function(mainSerie){this.pointsSerie=this.createIndicatorSerie(mainSerie,"LRC Points",null,null);this.topSerie=this.createIndicatorSerie(mainSerie,"LRC Top",null,null);this.bottomSerie=this.createIndicatorSerie(mainSerie,"LRC Bottom",null,null);this.series=[this.pointsSerie,this.topSerie,this.bottomSerie];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.pointsSerie.setColor(colors[0]);this.topSerie.setColor(colors[1]);this.bottomSerie.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return LinearRegressionChannelIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return LinearRegressionChannelIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var MACDIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"MACD",IndicatorsManager.MACD_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=MACDIndicator.COLORS_DEFAULT;this.histoColorStrategy=new ColorStrategy(ChartColor.orange,ChartColor.lightGrey2);};MACDIndicator=stjs.extend(MACDIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.black,ChartColor.RED_MACD,ChartColor.black];prototype.histogram=null;prototype.macd=null;prototype.signal=null;prototype.origin=null;prototype.period9=0;prototype.period12=0;prototype.period26=0;prototype.histoColorStrategy=null;prototype.hasDifferentParameters=function(){return this.period9!=this.getParameter(IndicatorsParameters.PERIOD_9_PARAMETER)||this.period12!=this.getParameter(IndicatorsParameters.PERIOD_12_PARAMETER)||this.period26!=this.getParameter(IndicatorsParameters.PERIOD_26_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.period9=this.getParameter(IndicatorsParameters.PERIOD_9_PARAMETER);this.period12=this.getParameter(IndicatorsParameters.PERIOD_12_PARAMETER);this.period26=this.getParameter(IndicatorsParameters.PERIOD_26_PARAMETER);this.updateSeries(mainSerie);var mae12=this.createIndicatorSerie(mainSerie,"mae12",null,null);mae12.computeExponentialMovingAverage(mainSerie,0,this.period12);var mae26=this.createIndicatorSerie(mainSerie,"mae26",null,null);mae26.computeExponentialMovingAverage(mainSerie,0,this.period26);this.macd.substract(mae12,mae26);this.signal.computeExponentialMovingAverage(this.macd,0,this.period9);this.histogram.substract(this.macd,this.signal);};prototype.updateSeries=function(mainSerie){this.histogram=this.createIndicatorSerie(mainSerie,"Histogram",null,null);this.macd=this.createIndicatorSerie(mainSerie,"MACD",null,null);this.signal=this.createIndicatorSerie(mainSerie,"MACD signal",null,null);this.origin=this.createIndicatorSerie(mainSerie,"macd_origin",null,null);this.histogram.setType(Chart.ChartType.BAR);this.origin.setUniformValue(0.0);this.origin.setDashed(true);this.series=[this.histogram,this.macd,this.signal,this.origin];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossDescSerie(this.signal,this.macd,index)){return 1;}
if(this.crossAscSerie(this.signal,this.macd,index)){return-1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.histogram.setColorStrategy(this.histoColorStrategy);this.macd.setColor(colors[1]);this.signal.setColor(colors[2]);this.origin.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return MACDIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return MACDIndicator.COLORS_DEFAULT;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.getName()+" "+Math.round(this.period26)+"/"+Math.round(this.period12);serieDescription["color"]=MACDIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+Math.round(this.period9);serieDescription["color"]=MACDIndicator.COLORS_DEFAULT[0];description.push(serieDescription);return description;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},histoColorStrategy:"ColorStrategy",axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var MomentumIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Momentum",IndicatorsManager.MOMENTUM_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=MomentumIndicator.COLORS_DEFAULT;this.hasSignals=false;};MomentumIndicator=stjs.extend(MomentumIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.MOMENTUM_COLOR,ChartColor.MOMENTUM_COLOR,ChartColor.MOMENTUM_COLOR];prototype.momentum=null;prototype.origin=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var period=this.currentPeriod;var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){var v1=mainSerie.getValueAsDouble(i,which);var v2=mainSerie.getValueAsDouble(i-period,which);if(i<=periodLimit||!DefaultIndicator.isValidFinancialValue(v1)||!DefaultIndicator.isValidFinancialValue(v2)){this.momentum.pushValue(null);}else{this.momentum.pushValue(v1-v2);}}};prototype.updateSeries=function(mainSerie){this.momentum=this.createIndicatorSerie(mainSerie,"Momentum",null,null);this.origin=this.createIndicatorSerie(mainSerie,"momentum_origin",null,null);this.origin.setUniformValue(0.0);this.origin.setDashed(true);this.series=[this.momentum,this.origin];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.momentum.setColor(colors[0]);this.origin.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return MomentumIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return MomentumIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var MovingAverageIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Moving Average",IndicatorsManager.MOVING_AVERAGE_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=MovingAverageIndicator.COLORS_DEFAULT;};MovingAverageIndicator=stjs.extend(MovingAverageIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.GREEN_MAV,ChartColor.BLUE_MAV,ChartColor.RED_MAV];constructor.COLORS_ORANGE_BLUE=[ChartColor.blue,ChartColor.GRAY_MAV,ChartColor.orange];prototype.shortSerie=null;prototype.mediumSerie=null;prototype.longSerie=null;prototype.shortPeriodValue=null;prototype.mediumPeriodValue=null;prototype.longPeriodValue=null;prototype.hasDifferentParameters=function(){return this.shortPeriodValue!=this.getParameter(IndicatorsParameters.PERIOD_SHORT_PARAMETER)||this.mediumPeriodValue!=this.getParameter(IndicatorsParameters.PERIOD_MEDIUM_PARAMETER)||this.longPeriodValue!=this.getParameter(IndicatorsParameters.PERIOD_LONG_PARAMETER);};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.getName()+" "+Math.round(this.shortPeriodValue);serieDescription["color"]=this.shortSerie!=null?this.shortSerie.getColor():MovingAverageIndicator.COLORS_DEFAULT[0];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+Math.round(this.mediumPeriodValue);serieDescription["color"]=this.mediumSerie!=null?this.mediumSerie.getColor():MovingAverageIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+Math.round(this.longPeriodValue);serieDescription["color"]=this.longSerie!=null?this.longSerie.getColor():MovingAverageIndicator.COLORS_DEFAULT[2];description.push(serieDescription);return description;};prototype.calculateSeries=function(mainSerie,context){this.shortPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_SHORT_PARAMETER);this.mediumPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_MEDIUM_PARAMETER);this.longPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_LONG_PARAMETER);this.updateSeries(mainSerie);this.shortSerie.computeMovingAverage(mainSerie,0,this.shortPeriodValue);this.mediumSerie.computeMovingAverage(mainSerie,0,this.mediumPeriodValue);this.longSerie.computeMovingAverage(mainSerie,0,this.longPeriodValue);};prototype.updateSeries=function(mainSerie){this.shortSerie=this.createIndicatorSerie(mainSerie,this.getId()+" Short",null,null);this.mediumSerie=this.createIndicatorSerie(mainSerie,this.getId()+" Medium",null,null);this.longSerie=this.createIndicatorSerie(mainSerie,this.getId()+" Long",null,null);this.series=[this.shortSerie,this.mediumSerie,this.longSerie];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.shortSerie.setColor(colors[0]);this.mediumSerie.setColor(colors[1]);this.longSerie.setColor(colors[2]);}};prototype.getSignal=function(mainSerie,idx){if(this.crossAscSerie(this.shortSerie,this.mediumSerie,idx)){return 1;}
if(this.crossDescSerie(this.shortSerie,this.mediumSerie,idx)){return-1;}
if(this.crossAscSerie(this.shortSerie,this.longSerie,idx)){return 1;}
if(this.crossDescSerie(this.shortSerie,this.longSerie,idx)){return-1;}
if(this.crossAscSerie(this.mediumSerie,this.longSerie,idx)){return 1;}
if(this.crossDescSerie(this.mediumSerie,this.longSerie,idx)){return-1;}
return 0;};prototype.getRedGreenSchema=function(){return MovingAverageIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return MovingAverageIndicator.COLORS_ORANGE_BLUE;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var ExponentialMovingAverageIndicator=function(parameters,correspondingAreaId){MovingAverageIndicator.call(this,parameters,correspondingAreaId);this.name="Exponential Moving Average";this.id=IndicatorsManager.EXP_MOVING_AVERAGE_INDICATOR_ID;this.colors=MovingAverageIndicator.COLORS_DEFAULT;};ExponentialMovingAverageIndicator=stjs.extend(ExponentialMovingAverageIndicator,MovingAverageIndicator,[],function(constructor,prototype){prototype.calculateSeries=function(mainSerie,context){this.shortPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_SHORT_PARAMETER);this.mediumPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_MEDIUM_PARAMETER);this.longPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_LONG_PARAMETER);this.updateSeries(mainSerie);this.shortSerie.computeExponentialMovingAverage(mainSerie,0,this.shortPeriodValue);this.mediumSerie.computeExponentialMovingAverage(mainSerie,0,this.mediumPeriodValue);this.longSerie.computeExponentialMovingAverage(mainSerie,0,this.longPeriodValue);};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var OnBalanceVolumeIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"OBV",IndicatorsManager.ON_BALANCE_VOLUME_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=OnBalanceVolumeIndicator.COLORS_DEFAULT;this.hasSignals=false;};OnBalanceVolumeIndicator=stjs.extend(OnBalanceVolumeIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.OBV_COLOR,ChartColor.OBV_COLOR,ChartColor.OBV_COLOR];prototype.obv=null;prototype.hasDifferentParameters=function(){return false;};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);if(mainPointsCount<=0){return;}
var total=0;total=0;var which=Serie.Y;var volume=FinancialSerie.VOLUME;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);for(var i=0;i<mainPointsCount;i++){var currentVolume=mainSerie.getValueAsDouble(i,volume);if(i>=firstValidIndex&&currentVolume!=null&&!isNaN(currentVolume)){if(mainSerie.getValueAsDouble(i-1,which)<mainSerie.getValueAsDouble(i,which)){total=total+currentVolume;}else{total=total-currentVolume;}
this.obv.pushValue(total);}else{this.obv.pushValue(null);}}};prototype.updateSeries=function(mainSerie){this.obv=this.createIndicatorSerie(mainSerie,"OBV",null,null);this.series=[this.obv];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.obv.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return OnBalanceVolumeIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return OnBalanceVolumeIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var RSIIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Relative Strength Index",IndicatorsManager.RSI_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=RSIIndicator.COLORS_DEFAULT;};RSIIndicator=stjs.extend(RSIIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.RSI_COLOR,ChartColor.RSI_COLOR,ChartColor.RSI_COLOR];prototype.rsi=null;prototype.upLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.getMeanUp=function(s,period,idx,which){var diff;var up=0;var validCount=0;for(var j=idx;j>idx-period;j--){var v1=s.getValueAsDouble(j,which);var v2=s.getValueAsDouble(j-1,which);diff=v1-v2;if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)&&diff>=0){up+=diff;validCount++;}}
if(validCount>0){return up/validCount;}else{return null;}};prototype.getMeanDown=function(s,period,idx,which){var diff;var down=0;var validCount=0;for(var j=idx;j>idx-period;j--){var v1=s.getValueAsDouble(j,which);var v2=s.getValueAsDouble(j-1,which);diff=v1-v2;if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)&&diff<0){down-=diff;validCount++;}}
if(validCount>0){return down/validCount;}else{return null;}};prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var upClosingTotal=0;var downClosingTotal=0;var diff=0;var U=0.0;var D=0.0;var first=true;var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.rsi.pushValue(null);}else{upClosingTotal=0;downClosingTotal=0;var v1=mainSerie.getValueAsDouble(i,which);var v2=mainSerie.getValueAsDouble(i-1,which);if(first){U=this.getMeanUp(mainSerie,this.currentPeriod,i,which);D=this.getMeanDown(mainSerie,this.currentPeriod,i,which);if(U!=null&&D!=null){this.rsi.pushValue(100-(100/(1+(U/D))));first=false;}else{this.rsi.pushValue(null);}}else if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)){diff=v1-v2;if(diff>=0){upClosingTotal=U*(this.currentPeriod-1)+diff;downClosingTotal=D*(this.currentPeriod-1);}
if(diff<0){upClosingTotal=U*(this.currentPeriod-1);downClosingTotal=D*(this.currentPeriod-1)+Math.abs(diff);}
U=upClosingTotal/this.currentPeriod;D=downClosingTotal/this.currentPeriod;this.rsi.pushValue(100-(100/(1+(U/D))));}else{this.rsi.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.rsi=this.createIndicatorSerie(mainSerie,"RSI",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"rsi_up",null,null);this.upLine.setDashed(true);this.downLine=this.createIndicatorSerie(mainSerie,"rsi_down",null,null);this.downLine.setDashed(true);this.upLine.setUniformValue(70.0);this.downLine.setUniformValue(30.0);this.series=[this.rsi,this.upLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossDescConstant(this.rsi,70,index)){return-1;}
if(this.crossAscConstant(this.rsi,30,index)){return 1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.rsi.setColor(colors[0]);this.upLine.setColor(colors[1]);this.downLine.setColor(colors[2]);}};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.getRedGreenSchema=function(){return RSIIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return RSIIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var SARIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Parabolic SAR",IndicatorsManager.SAR_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=SARIndicator.COLORS_DEFAULT;};SARIndicator=stjs.extend(SARIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.BLUE_SAR,ChartColor.BLUE_SAR,ChartColor.BLUE_SAR];prototype.sarSerie=null;prototype.currentPeriod=0;prototype.currentAcceleration=0.0;prototype.currentMaxAcceleration=0.0;prototype.isBigger=function(high,sar){var dh=Math.round(high*1000);var ds=Math.round(sar*1000);if((dh-ds)+1>=0){return true;}
return false;};prototype.isLower=function(low,sar){var dl=Math.round(low*1000);var ds=Math.round(sar*1000);if((ds-dl)+1>=0){return true;}
return false;};prototype.getMaxValueInRange=function(serie,start,end,which){if(serie==null||which==null||end<start){return null;}
var currentMaxValue=Double.NEGATIVE_INFINITY;for(var i=start;i<end;i++){var currentValue=serie.getValueAsDouble(i,which);if(currentValue!=null&&currentValue>currentMaxValue){currentMaxValue=currentValue;}}
return currentMaxValue;};prototype.getMinValueInRange=function(serie,start,end,which){if(serie==null||which==null||end<start){return null;}
var currentMinValue=Double.POSITIVE_INFINITY;for(var i=start;i<end;i++){var currentValue=serie.getValueAsDouble(i,which);if(currentValue!=null&&currentValue<currentMinValue){currentMinValue=currentValue;}}
return currentMinValue;};prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER)||(this.currentAcceleration!=this.getDoubleParameter(IndicatorsParameters.ACCELERATION_PARAMETER))||(this.currentMaxAcceleration!=this.getDoubleParameter(IndicatorsParameters.MAX_ACCELERATION_PARAMETER));};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);this.currentAcceleration=this.getDoubleParameter(IndicatorsParameters.ACCELERATION_PARAMETER);this.currentMaxAcceleration=this.getDoubleParameter(IndicatorsParameters.MAX_ACCELERATION_PARAMETER);var currentAcceleration=this.currentAcceleration*(0.01);var currentMaxAcceleration=this.currentMaxAcceleration*(0.01);this.updateSeries(mainSerie);var highWhich=FinancialSerie.HIGH;var lowWhich=FinancialSerie.LOW;var firstHigh=this.getMaxValueInRange(mainSerie,0,this.currentPeriod,highWhich);var firstLow=this.getMinValueInRange(mainSerie,0,this.currentPeriod,lowWhich);var secHigh=this.getMaxValueInRange(mainSerie,this.currentPeriod,2*this.currentPeriod,highWhich);var secLow=this.getMinValueInRange(mainSerie,this.currentPeriod,2*this.currentPeriod,lowWhich);var sar;var sarUp;sarUp=(firstHigh<secHigh)&&(firstLow<secLow)||(firstHigh+firstLow<=secHigh+secLow);sar=sarUp?firstLow:firstHigh;var a=currentAcceleration;var hereWeGo=false;var high=firstHigh;var low=firstLow;var oldHigh;var oldLow;for(var i=0;i<mainPointsCount;i++){var currentValue=mainSerie.getValueAsDouble(i,Serie.Y);var previousValue=mainSerie.getValueAsDouble(i-1,Serie.Y);if(i<this.currentPeriod||!DefaultIndicator.isValidFinancialValue(currentValue)||!DefaultIndicator.isValidFinancialValue(previousValue)){this.sarSerie.pushValue(null);continue;}
var dataH=mainSerie.getValueAsDouble(i,highWhich);var dataL=mainSerie.getValueAsDouble(i,lowWhich);var result=0;oldHigh=high;oldLow=low;hereWeGo=false;if(high<dataH){high=dataH;}
if(low>dataL){low=dataL;}
if((this.isLower(dataL,sar))&&(sarUp)){sarUp=false;low=dataL;sar=high;result=sar;a=currentAcceleration;hereWeGo=true;}
if((this.isBigger(dataH,sar))&&(!hereWeGo&&!sarUp)){sarUp=true;high=dataH;sar=low;result=sar;a=currentAcceleration;hereWeGo=true;}
if(!hereWeGo){if(sarUp){result=(sar+a*(high-sar));result=Math.min(result,Math.min(dataL,mainSerie.getValueAsDouble(i-1,lowWhich)));sar=result;if(high!=oldHigh){a=a+currentAcceleration;}}else{result=(sar+a*(low-sar));result=Math.max(result,Math.max(dataH,mainSerie.getValueAsDouble(i-1,highWhich)));sar=result;if(low!=oldLow){a=a+currentAcceleration;}}
if(a>currentMaxAcceleration){a=currentMaxAcceleration;}}
this.sarSerie.pushValue(sar);}};prototype.updateSeries=function(mainSerie){this.sarSerie=this.createIndicatorSerie(mainSerie,"SAR",null,null);this.sarSerie.setType(Chart.ChartType.POINT);this.series=[this.sarSerie];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossAscSerie(this.sarSerie,mainSerie,index)){return-1;}
if(this.crossDescSerie(this.sarSerie,mainSerie,index)){return 1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.sarSerie.setColor(colors[0]);}};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod))+"/"+String.valueOf(Math.round(this.currentAcceleration))+"/"+String.valueOf(Math.round(this.currentMaxAcceleration));};prototype.getRedGreenSchema=function(){return SARIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return SARIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var StandardDeviationIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Standard Deviation",IndicatorsManager.STANDARD_DEVIATION_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=StandardDeviationIndicator.COLORS_DEFAULT;this.hasSignals=false;};StandardDeviationIndicator=stjs.extend(StandardDeviationIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.OBV_COLOR,ChartColor.OBV_COLOR,ChartColor.OBV_COLOR];prototype.stdDev=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var ma=this.createIndicatorSerie(mainSerie,"ma",null,null);ma.computeMovingAverage(mainSerie,0,this.currentPeriod);var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<mainPointsCount;i++){var maVal=ma.getValueAsDouble(i,which);if(i<periodLimit||maVal==null||isNaN(maVal)){this.stdDev.pushValue(null);}else{var barTotal=0;var validCount=0;for(var j=i;j>i-this.currentPeriod&&j>=0;j--){var v1=mainSerie.getValueAsDouble(j,which);if(DefaultIndicator.isValidFinancialValue(v1)){barTotal+=Math.pow(v1-maVal,2);validCount++;}}
if(validCount>0){this.stdDev.pushValue(Math.sqrt(barTotal/validCount));}else{this.stdDev.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.stdDev=this.createIndicatorSerie(mainSerie,"Std.Dev.",null,null);this.series=[this.stdDev];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.stdDev.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return StandardDeviationIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return StandardDeviationIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var StochasticOscillatorIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Stochastic",IndicatorsManager.STOCHASTIC_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=StochasticOscillatorIndicator.COLORS_DEFAULT;};StochasticOscillatorIndicator=stjs.extend(StochasticOscillatorIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.STO_COLOR,ChartColor.black,ChartColor.STO_COLOR,ChartColor.STO_COLOR];prototype.kVals=null;prototype.dVals=null;prototype.upLine=null;prototype.downLine=null;prototype.period=0;prototype.percentKPeriods=0;prototype.percentDPeriods=0;prototype.getHighestHigh=function(s,kper,period){var sr=this.createIndicatorSerie(s,"tmp",null,null);var serieLength=s!=null?s.getLength():0;for(var i=0;i<serieLength;i++){var v=s.getValueAsDouble(i,FinancialSerie.HIGH);for(var j=stjs.trunc(Math.max(i-period,0));j<=i;j++){v=Math.max(v,s.getValueAsDouble(j,FinancialSerie.HIGH));}
sr.pushValue(v);}
var highestHigh=this.createIndicatorSerie(s,"highestHigh",null,null);highestHigh.computeMovingAverage(sr,0,kper);return highestHigh;};prototype.getLowestLow=function(s,kper,period){var sr=this.createIndicatorSerie(s,"tmp",null,null);var serieLength=s!=null?s.getLength():0;for(var i=0;i<serieLength;i++){var v=s.getValueAsDouble(i,FinancialSerie.LOW);for(var j=stjs.trunc(Math.max(i-period,0));j<=i;j++){v=Math.min(v,s.getValueAsDouble(j,FinancialSerie.LOW));}
sr.pushValue(v);}
var lowestLow=this.createIndicatorSerie(s,"lowestLow",null,null);lowestLow.computeMovingAverage(sr,0,kper);return lowestLow;};prototype.hasDifferentParameters=function(){return this.period!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER)||this.percentKPeriods!=this.getParameter(IndicatorsParameters.PERIOD_K_PARAMETER)||this.percentDPeriods!=this.getParameter(IndicatorsParameters.PERIOD_D_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.period=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);this.percentKPeriods=this.getParameter(IndicatorsParameters.PERIOD_K_PARAMETER);this.percentDPeriods=this.getParameter(IndicatorsParameters.PERIOD_D_PARAMETER);this.updateSeries(mainSerie);var lowestLow=this.getLowestLow(mainSerie,this.percentKPeriods,this.period);var highestHigh=this.getHighestHigh(mainSerie,this.percentKPeriods,this.period);var myClose=this.createIndicatorSerie(mainSerie,"myClose",null,null);myClose.computeMovingAverage(mainSerie,0,this.percentKPeriods);var firstPoint=this.period+this.percentKPeriods+this.percentDPeriods;var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+firstPoint;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.kVals.pushValue(null);}else{this.kVals.pushValue(100*(myClose.getValueAsDouble(i,which)-lowestLow.getValueAsDouble(i,which))/(highestHigh.getValueAsDouble(i,which)-lowestLow.getValueAsDouble(i,which)));}}
this.dVals.computeMovingAverage(this.kVals,0,this.percentDPeriods);};prototype.updateSeries=function(mainSerie){this.kVals=this.createIndicatorSerie(mainSerie,"Stochastic %K.",null,null);this.dVals=this.createIndicatorSerie(mainSerie,"Stochastic %D",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"sto_up",null,null);this.downLine=this.createIndicatorSerie(mainSerie,"sto_down",null,null);this.upLine.setDashed(true);this.upLine.setUniformValue(80.0);this.downLine.setDashed(true);this.downLine.setUniformValue(20.0);this.series=[this.kVals,this.dVals,this.upLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.dVals.getValueAsDouble(index-1,Serie.Y)<20&&this.crossAscSerie(this.kVals,this.dVals,index)){return 1;}
if(this.kVals.getValueAsDouble(index-1,Serie.Y)>80&&this.crossAscSerie(this.dVals,this.kVals,index)){return-1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=4){this.kVals.setColor(colors[0]);this.dVals.setColor(colors[1]);this.upLine.setColor(colors[2]);this.downLine.setColor(colors[3]);}};prototype.getRedGreenSchema=function(){return StochasticOscillatorIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return StochasticOscillatorIndicator.COLORS_DEFAULT;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=")";serieDescription["color"]=StochasticOscillatorIndicator.COLORS_DEFAULT[0];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+String.valueOf(Math.round(this.percentDPeriods));serieDescription["color"]=StochasticOscillatorIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]=this.getName()+"("+String.valueOf(Math.round(this.period))+"/"+String.valueOf(Math.round(this.percentKPeriods));serieDescription["color"]=StochasticOscillatorIndicator.COLORS_DEFAULT[0];description.push(serieDescription);return description;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var VolumeIndicator=function(correspondingAreaId){DefaultIndicator.call(this,"Volume",IndicatorsManager.VOLUME_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,{});this.colors=VolumeIndicator.COLORS_DEFAULT;this.valid=false;this.hasSignals=false;};VolumeIndicator=stjs.extend(VolumeIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.greenOld,ChartColor.redOld];constructor.COLORS_BLUE=[ChartColor.blue,ChartColor.orange];prototype.volume=null;prototype.valid=false;prototype.hasDifferentParameters=function(){return false;};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var which=FinancialSerie.VOLUME;this.valid=false;for(var i=0;i<mainPointsCount;i++){var volumeValue=mainSerie.getValueAsDouble(i,which);this.volume.setValue(i,volumeValue);if(volumeValue!=null&&volumeValue>0){this.valid=true;}}};prototype.getSeries=function(){if(this.valid){return this.series;}else{return[];}};prototype.setEnabled=function(enabled){if(this.parameters!=null){if(enabled==null){enabled=true;}
this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=enabled;}
for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;this.series[index].setEnabled(enabled);}};prototype.isEnabled=function(){if(this.parameters==null||this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="false"){return false;}
if(this.parameters[IndicatorsParameters.ENABLED_PARAMETER]==null||this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="true"){return true;}
return this.parameters[IndicatorsParameters.ENABLED_PARAMETER];};prototype.updateSeries=function(mainSerie){this.volume=this.createIndicatorSerie(mainSerie,"Volume",null,null);this.series=[this.volume];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=2){var a=new ColorStrategy(colors[0],colors[1]);this.volume.setColorStrategy(a);}};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getRedGreenSchema=function(){return VolumeIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return VolumeIndicator.COLORS_BLUE;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.getName();description.push(serieDescription);return description;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var WilliamsPercentRIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Williams %",IndicatorsManager.AROON_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=WilliamsPercentRIndicator.COLORS_DEFAULT;this.hasSignals=false;};WilliamsPercentRIndicator=stjs.extend(WilliamsPercentRIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.black,ChartColor.black,ChartColor.black];prototype.wil=null;prototype.upLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var min;var max;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,FinancialSerie.LOW,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.wil.pushValue(null);}else{min=mainSerie.getValueAsDouble(i,FinancialSerie.LOW);max=mainSerie.getValueAsDouble(i,FinancialSerie.HIGH);for(var j=i-1;j>=i-this.currentPeriod;j--){if(mainSerie.getValueAsDouble(j,FinancialSerie.LOW)<min){min=mainSerie.getValueAsDouble(j,FinancialSerie.LOW);}
if(mainSerie.getValueAsDouble(j,FinancialSerie.HIGH)>max){max=mainSerie.getValueAsDouble(j,FinancialSerie.HIGH);}}
this.wil.pushValue((max-mainSerie.getValueAsDouble(i,FinancialSerie.CLOSE))/(max-min)*(-100));}}};prototype.updateSeries=function(mainSerie){this.wil=this.createIndicatorSerie(mainSerie,"Williams %",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"williams_up",null,null);this.downLine=this.createIndicatorSerie(mainSerie,"williams_down",null,null);this.upLine.setUniformValue(-20.0);this.upLine.setDashed(true);this.downLine.setUniformValue(-80.0);this.downLine.setDashed(true);this.series=[this.wil,this.upLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.wil.setColor(colors[0]);this.upLine.setColor(colors[2]);this.downLine.setColor(colors[2]);}};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getRedGreenSchema=function(){return WilliamsPercentRIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return WilliamsPercentRIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var ZigZagIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Zig Zag",IndicatorsManager.ZIG_ZAG_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=ZigZagIndicator.COLORS_DEFAULT;this.hasSignals=false;};ZigZagIndicator=stjs.extend(ZigZagIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.RED_FULL,ChartColor.RED_FULL,ChartColor.RED_FULL];prototype.zigZag=null;prototype.currentPercent=0;prototype.hasDifferentParameters=function(){return true;};prototype.calculateSeries=function(mainSerie,context){this.currentPercent=this.getParameter(IndicatorsParameters.PERCENT_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var which=Serie.Y;var nStartIdx=0;var trend=0;var limit=mainSerie.getValueAsDouble(nStartIdx,which);var iLimit=nStartIdx;this.zigZag.setValue(iLimit,limit);for(var i=nStartIdx;i<mainPointsCount;i++){var close=mainSerie.getValueAsDouble(i,which);if(trend==0){if(close-limit>=limit*this.currentPercent/100){trend=1;}else if(limit-close>=limit*this.currentPercent/100){trend=-1;}else{continue;}}
if(-trend*(close-limit)>=limit*this.currentPercent/100){trend=-trend;this.zigZag.setValue(iLimit,limit);iLimit=i;limit=close;}
if(trend*close>=trend*limit){iLimit=i;limit=close;}}
this.zigZag.setValue(mainPointsCount-1,mainSerie.getValueAsDouble(mainPointsCount-1,which));};prototype.updateSeries=function(mainSerie){this.zigZag=this.createIndicatorSerie(mainSerie,"ZigZag",null,null);this.series=[this.zigZag];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.zigZag.setColor(colors[0]);}};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getRedGreenSchema=function(){return ZigZagIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return ZigZagIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPercent));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var IndicatorsManager=function(financialChartOption){this.indicatorsBySerie={};this.indicatorParamsIntraday=financialChartOption.getIndicatorsParametersIntraday();this.indicatorParamsHisto=financialChartOption.getIndicatorsParametersHisto();if(this.indicatorParamsIntraday==null){this.indicatorParamsIntraday=IndicatorsParameters.getDefault();}
if(this.indicatorParamsHisto==null){this.indicatorParamsHisto=IndicatorsParameters.getDefault();}
this.currentColorSchema=financialChartOption.getColorSchema();};IndicatorsManager=stjs.extend(IndicatorsManager,null,[],function(constructor,prototype){constructor.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID="ADX";constructor.AROON_INDICATOR_ID="ARO";constructor.BOLLINGER_INDICATOR_ID="BOL";constructor.COMMODITY_CHANNEL_INDEX_INDICATOR_ID="CCI";constructor.EXP_MOVING_AVERAGE_INDICATOR_ID="EMA";constructor.HISTORICAL_VOLATILITY_INDICATOR_ID="HVO";constructor.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID="LRC";constructor.MACD_INDICATOR_ID="MACD";constructor.MOVING_AVERAGE_INDICATOR_ID="MAV";constructor.MOMENTUM_INDICATOR_ID="MOM";constructor.ON_BALANCE_VOLUME_INDICATOR_ID="OBV";constructor.RSI_INDICATOR_ID="RSI";constructor.SAR_INDICATOR_ID="SAR";constructor.STANDARD_DEVIATION_INDICATOR_ID="STD";constructor.STOCHASTIC_INDICATOR_ID="STO";constructor.VOLUME_INDICATOR_ID="VOL";constructor.WILLIAMS_PERC_INDICATOR_ID="WIL";constructor.ZIG_ZAG_INDICATOR_ID="ZIG";constructor.AVAILABLE_INDICATORS=[IndicatorsManager.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID,IndicatorsManager.AROON_INDICATOR_ID,IndicatorsManager.BOLLINGER_INDICATOR_ID,IndicatorsManager.COMMODITY_CHANNEL_INDEX_INDICATOR_ID,IndicatorsManager.EXP_MOVING_AVERAGE_INDICATOR_ID,IndicatorsManager.HISTORICAL_VOLATILITY_INDICATOR_ID,IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID,IndicatorsManager.MACD_INDICATOR_ID,IndicatorsManager.MOVING_AVERAGE_INDICATOR_ID,IndicatorsManager.MOMENTUM_INDICATOR_ID,IndicatorsManager.ON_BALANCE_VOLUME_INDICATOR_ID,IndicatorsManager.RSI_INDICATOR_ID,IndicatorsManager.SAR_INDICATOR_ID,IndicatorsManager.STANDARD_DEVIATION_INDICATOR_ID,IndicatorsManager.STOCHASTIC_INDICATOR_ID,IndicatorsManager.VOLUME_INDICATOR_ID,IndicatorsManager.WILLIAMS_PERC_INDICATOR_ID,IndicatorsManager.ZIG_ZAG_INDICATOR_ID];prototype.indicatorsBySerie=null;prototype.indicatorParamsIntraday=null;prototype.indicatorParamsHisto=null;prototype.currentColorSchema=null;prototype.updateIndicatorParameters=function(financialChartOption){this.indicatorParamsIntraday=financialChartOption.getIndicatorsParametersIntraday();this.indicatorParamsHisto=financialChartOption.getIndicatorsParametersHisto();if(this.indicatorParamsIntraday==null){this.indicatorParamsIntraday=IndicatorsParameters.getDefault();}
if(this.indicatorParamsHisto==null){this.indicatorParamsHisto=IndicatorsParameters.getDefault();}
this.currentColorSchema=financialChartOption.getColorSchema();};prototype.enable=function(options,indicatorId){var intraday=IndicatorsManager.isIntradayFromOptions(options);var indicator=this.getIndicator(IndicatorsManager.getSerieTypeIdFromOptions(options),indicatorId,intraday);var indicatorsParams=this.indicatorParamsHisto;if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
if(indicator!=null){indicator.setEnabled(true);var indicatorParam=indicatorsParams.getIndicatorParameters(indicatorId);if(indicatorParam!=null){indicatorParam["enabled"]=true;}}
return indicator;};prototype.disable=function(options,indicatorId){var intraday=IndicatorsManager.isIntradayFromOptions(options);var indicator=this.getIndicator(IndicatorsManager.getSerieTypeIdFromOptions(options),indicatorId,intraday);var indicatorsParams=this.indicatorParamsHisto;if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
if(indicator!=null){indicator.setEnabled(false);var indicatorParam=indicatorsParams.getIndicatorParameters(indicatorId);if(indicatorParam!=null){indicatorParam["enabled"]=false;}}
return indicator;};prototype.disableAll=function(mainSerie){var intraday=mainSerie!=null&&mainSerie.getPeriod()!=null&&mainSerie.isIntraday();var indicatorsParams=this.indicatorParamsHisto;if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
var serieTypeId=IndicatorsManager.getSerieTypeId(mainSerie);var indicators=this.indicatorsBySerie[serieTypeId];for(var indicatorId in indicators){var currentIndicator=indicators[indicatorId];if(currentIndicator!=null){currentIndicator.setEnabled(false);var indicatorParam=indicatorsParams.getIndicatorParameters(indicatorId);if(indicatorParam!=null){indicatorParam["enabled"]=false;}}}};prototype.getActiveIndicators=function(mainSerie){var activeIndicatorsArray=[];var indicators=this.indicatorsBySerie[IndicatorsManager.getSerieTypeId(mainSerie)];var indicatorsParams=this.indicatorParamsHisto;var intraday=mainSerie!=null&&mainSerie.getPeriod()!=null&&mainSerie.isIntraday();if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
for(var index in IndicatorsManager.AVAILABLE_INDICATORS){if(!(IndicatorsManager.AVAILABLE_INDICATORS).hasOwnProperty(index))
continue;var indicatorId=IndicatorsManager.AVAILABLE_INDICATORS[index];var currentIndicator=this.getIndicator(IndicatorsManager.getSerieTypeId(mainSerie),indicatorId,intraday);if(currentIndicator!=null){currentIndicator.setParameters(indicatorsParams.getIndicatorParameters(indicatorId));currentIndicator.updateColorSchema(this.currentColorSchema);if(currentIndicator.isEnabled()){activeIndicatorsArray.push(currentIndicator);}}}
return activeIndicatorsArray;};prototype.isActiveIndicators=function(mainSerie,indicatorId){var indicators=this.indicatorsBySerie[IndicatorsManager.getSerieTypeId(mainSerie)];if(indicators!=null){var indicator=indicators[indicatorId];return indicator!=null&&indicator.isEnabled();}else{return false;}};prototype.getIndicator=function(serieId,indicatorId,isIntraday){var indicators=this.indicatorsBySerie[serieId];var indicator=null;var indicatorsParams=this.indicatorParamsHisto;if(isIntraday){indicatorsParams=this.indicatorParamsIntraday;}
if(indicators==null){indicator=IndicatorsManager.createIndicator(indicatorsParams,indicatorId);indicators={};if(indicator!=null){indicators[indicatorId]=indicator;}
this.indicatorsBySerie[serieId]=indicators;}else{indicator=indicators[indicatorId];if(indicator==null){indicator=IndicatorsManager.createIndicator(indicatorsParams,indicatorId);if(indicator!=null){indicators[indicatorId]=indicator;}}}
return indicator;};constructor.createIndicator=function(indicatorsParams,indicatorId){var parameters=null;if(indicatorsParams!=null){parameters=indicatorsParams.getIndicatorParameters(indicatorId);}
if(parameters==null){parameters=IndicatorsParameters.getDefaultIndicatorParameters(indicatorId);}
if(indicatorId==IndicatorsManager.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID){return new AverageDirectionalMovementIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.AROON_INDICATOR_ID){return new AroonIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.BOLLINGER_INDICATOR_ID){return new BollingerIndicator(parameters,FinancialLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.COMMODITY_CHANNEL_INDEX_INDICATOR_ID){return new CommodityChannelIndexIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.EXP_MOVING_AVERAGE_INDICATOR_ID){return new ExponentialMovingAverageIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.HISTORICAL_VOLATILITY_INDICATOR_ID){return new HistoricalVolatilityIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID){return new LinearRegressionChannelIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.MACD_INDICATOR_ID){return new MACDIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.MOVING_AVERAGE_INDICATOR_ID){return new MovingAverageIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.MOMENTUM_INDICATOR_ID){return new MomentumIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.ON_BALANCE_VOLUME_INDICATOR_ID){return new OnBalanceVolumeIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.RSI_INDICATOR_ID){return new RSIIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.SAR_INDICATOR_ID){return new SARIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.STANDARD_DEVIATION_INDICATOR_ID){return new StandardDeviationIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.STOCHASTIC_INDICATOR_ID){return new StochasticOscillatorIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.VOLUME_INDICATOR_ID){return new VolumeIndicator(FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.WILLIAMS_PERC_INDICATOR_ID){return new WilliamsPercentRIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.ZIG_ZAG_INDICATOR_ID){return new ZigZagIndicator(parameters,DefaultLayout.GRAPH_AREA);}else{return null;}};constructor.getSerieTypeId=function(mainSerie){if(mainSerie==null){return null;}
var prefix=mainSerie.getKey();var suffix=Period.HISTO;if(mainSerie.getPeriod()!=null&&mainSerie.isIntraday()){suffix=Period.INTRADAY;}
return prefix+"_"+suffix;};constructor.getSerieTypeIdFromOptions=function(options){if(options==null||options.getStocks()==null||options.getStocks()[0]==null){return null;}
var prefix=options.getStocks()[0].getKey();var suffix=Period.HISTO;var period=Period.getInstance(options.getPeriod(),options.getFrequency());if(period!=null&&period.isIntraday()){suffix=Period.INTRADAY;}
return prefix+"_"+suffix;};constructor.isIntradayFromOptions=function(options){if(options==null||options.getStocks()==null||options.getStocks()[0]==null){return false;}
var period=Period.getInstance(options.getPeriod(),options.getFrequency());if(period!=null&&period.isIntraday()){return true;}else{return false;}};},{AVAILABLE_INDICATORS:{name:"Array",arguments:[null]},indicatorsBySerie:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Indicator"]}]},indicatorParamsIntraday:"IndicatorsParameters",indicatorParamsHisto:"IndicatorsParameters"},{});
var FinancialSeriesDataProvider=function(config){MobileServiceDataProvider.call(this,config);};FinancialSeriesDataProvider=stjs.extend(FinancialSeriesDataProvider,MobileServiceDataProvider,[],function(constructor,prototype){prototype.getNewSeries=function(data){if(data==null){return null;}
var keysCount=this.stocks!=null?this.stocks.length:0;var colorStrategy=this.config.getColorStrategy();var addYesterday=this.config.isAddYesterday();var series=data.getSeries();var newSeries=[];var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());if(keysCount>0){var mainSerie=this.getSerieFromChartType((series!=null)?series[0]:null,this.stocks[0],this.config,period);if(mainSerie!=null){mainSerie.setColorStrategy(colorStrategy);newSeries[0]=mainSerie;}else{return newSeries;}}
for(var i=1;i<keysCount;i++){var currentStock=this.stocks[i];var currentDataSerie=(series!=null)?series[i]:null;period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());if(currentStock!=null&&(currentDataSerie==null||currentDataSerie.getDataId(this.config.getWidthParam())!=currentDataSerie.createDataId(currentStock.getKey(),period,this.config.getWidthParam()))){if(period.isIntraday()){var newIntradaySerie=new IntradaySerie(period,colorStrategy,currentStock,addYesterday);newIntradaySerie.setStretchLeftSide(this.config.isStretchLeftSide());newIntradaySerie.setStretchRightSide(this.config.isStretchRightSide());currentDataSerie=newIntradaySerie;}else{var newHistoSerie=new HistoSerie(period,null,currentStock);newHistoSerie.setColor(this.config.getDefaultHistoColor());currentDataSerie=newHistoSerie;}}else if(currentDataSerie!=null){if(currentDataSerie.isIntraday()){currentDataSerie.setColorStrategy(colorStrategy);}else{currentDataSerie.setColorStrategy(null);}
currentDataSerie.setStock(currentStock);}
currentDataSerie.setMainField(Serie.Y);currentDataSerie.setMainFields([Serie.Y]);currentDataSerie.setType(Chart.ChartType.LINE);newSeries[i]=currentDataSerie;}
return newSeries;};prototype.getSerieFromChartType=function(currentDataSerie,currentStock,config,period){var colorStrategy=config.getColorStrategy();var addYesterday=config.isAddYesterday();var mainChartType=Chart.ChartType.valueOf(config.getType());if(currentStock!=null&&(currentDataSerie==null||currentDataSerie.getDataId(config.getWidthParam())!=currentDataSerie.createDataId(currentStock.getKey(),period,config.getWidthParam())||(currentDataSerie.getType()==Chart.ChartType.BID_ASK&&mainChartType!=Chart.ChartType.BID_ASK))){if(period.isIntraday()){var newIntradaySerie=new IntradaySerie(period,colorStrategy,currentStock,addYesterday);newIntradaySerie.setStretchLeftSide(config.isStretchLeftSide());newIntradaySerie.setStretchRightSide(config.isStretchRightSide());currentDataSerie=newIntradaySerie;}else{var newHistoSerie=new HistoSerie(period,null,currentStock);currentDataSerie=newHistoSerie;}}else if(currentDataSerie!=null){if(currentDataSerie.isIntraday()){currentDataSerie.setColorStrategy(colorStrategy);}else{currentDataSerie.setColorStrategy(null);}
currentDataSerie.setStock(currentStock);}
if(currentStock!=null&&currentStock.isSwissDotsMarket()&&period!=null&&period.isLive()&&!period.spanSeveralDays()){var newBidAskSerie=new BidAskSerie(period,colorStrategy,currentStock);newBidAskSerie.setStretchLeftSide(config.isStretchLeftSide());newBidAskSerie.setStretchRightSide(config.isStretchRightSide());currentDataSerie=newBidAskSerie;currentDataSerie.setType(Chart.ChartType.BID_ASK);}else if(mainChartType==Chart.ChartType.POINT){if(period.isLive()){var newBidAskSerie=new BidAskSerie(period,colorStrategy,currentStock);newBidAskSerie.setStretchLeftSide(config.isStretchLeftSide());newBidAskSerie.setStretchRightSide(config.isStretchRightSide());currentDataSerie=newBidAskSerie;currentDataSerie.setType(Chart.ChartType.BID_ASK);}else if(period.isIntraday()){currentDataSerie.setMainField(FinancialSerie.CLOSE);currentDataSerie.setMainFields([FinancialSerie.HIGH,FinancialSerie.LOW,FinancialSerie.CLOSE]);}else{currentDataSerie.setMainField(FinancialSerie.CLOSE);currentDataSerie.setMainFields([FinancialSerie.CLOSE]);}}else if(mainChartType==Chart.ChartType.HL_AREA||mainChartType==Chart.ChartType.CANDLESTICK||mainChartType==Chart.ChartType.HLOC){currentDataSerie.setMainField(Serie.Y);currentDataSerie.setMainFields([FinancialSerie.HIGH,FinancialSerie.LOW,Serie.Y]);}else{currentDataSerie.setMainField(Serie.Y);currentDataSerie.setMainFields([Serie.Y]);}
currentDataSerie.setColor(FinancialEngineModel.COLORS_ARRAY[0]);return currentDataSerie;};prototype.clone=function(){return new FinancialSeriesDataProvider(this.config);};},{refreshTimer:"TimeoutHandler",retrySetDataCallback:{name:"Callback2",arguments:[null,{name:"Array",arguments:[null]}]},autorefreshFunction:"Callback0",onRequestCompleteCallback:{name:"Callback4",arguments:[null,null,"D",{name:"Array",arguments:["S"]}]},stocks:{name:"Array",arguments:["Stock"]},dataProcessor:"PipeDelimitedDataProcessor",cache:"Cache",config:"ChartOption"},{});
var FinancialChartData=function(chart,provider,context){ChartData.call(this,chart,provider);if(chart!=null){this.indicatorsManager=new IndicatorsManager(chart.getChartOption());}
this.activeIndicatorSeries={};this.mainGraphActiveIndicatorSeries={};this.intraday=false;this.context=context;};FinancialChartData=stjs.extend(FinancialChartData,ChartData,[],function(constructor,prototype){prototype.indicatorsManager=null;prototype.activeIndicatorSeries=null;prototype.mainGraphActiveIndicatorSeries=null;prototype.intraday=false;prototype.context=null;prototype.validateData=function(){var serieCount=(this.series!=null)?this.series.length:0;var mainSerie=this.getMainSerie();if(serieCount<=0||mainSerie==null){this.xValuesPeriods=null;this.extremums=null;this.totalXSpace=0;return;}
this.intraday=mainSerie.isIntraday();this.xSpaceValuesScale=mainSerie.getXSpaceScale();this.indexedXSpace=mainSerie.isIndexed();this.stepSize=mainSerie.getStepSize();if(this.indexedXSpace){this.indexedXValues=this.createGlobalIndexedXValues();}
var minNormalizedXValue=Double.POSITIVE_INFINITY;var maxNormalizedXValue=Double.NEGATIVE_INFINITY;var seriesPeriods=[];var flattenedPeriodSpace=0.0;for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.isEnabled()&&serie.getId()!=YesterdayLine.INDICATOR_ID){var serieStartValue=serie.getAbsoluteStartXValue();var serieEndValue=serie.getAbsoluteEndXValue();if(this.intraday&&serie.getPeriod()!=null&&serie.getPeriod().hasOpenPeriods()){flattenedPeriodSpace=this.updateDatePeriods(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue,serie.getPeriod().getOpenPeriods());}else{flattenedPeriodSpace=this.updatePeriods(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue);}
if(!isNaN(serieStartValue)&&serieStartValue<minNormalizedXValue){minNormalizedXValue=serieStartValue;}
if(!isNaN(serieEndValue)&&serieEndValue>maxNormalizedXValue){maxNormalizedXValue=serieEndValue;}}}
this.xValuesPeriods=seriesPeriods;this.totalXSpace=flattenedPeriodSpace;if(minNormalizedXValue==Double.POSITIVE_INFINITY||maxNormalizedXValue==Double.NEGATIVE_INFINITY){this.extremums=null;}else{this.extremums=[];this.extremums[0]=minNormalizedXValue;this.extremums[1]=maxNormalizedXValue;}
this.availableFormats=[];this.possibleXSteps=[];mainSerie.setXAxisFormatsAndSteps(this.availableFormats,this.possibleXSteps);if(this.extremums!=null&&this.extremums[0]!=null&&this.extremums[1]!=null&&(this.extremums[0]<0||this.extremums[1]<0)){this.clear();}
if(mainSerie!=null&&this.intraday&&this.getSerieCount()==1&&mainSerie.isEmpty()&&mainSerie.getStartXValue()!=null&&mainSerie.getEndXValue()!=null){this.extremums=[mainSerie.getAbsoluteStartXValue(),mainSerie.getAbsoluteEndXValue()];this.totalXSpace=this.computeXSpaceSizeFromPeriods(this.xValuesPeriods,mainSerie.getStartXValue(),mainSerie.getEndXValue());}
this.updateIndicators();};prototype.updateDatePeriods=function(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue,openPeriods){if(serieStartValue==null||serieEndValue==null){return flattenedPeriodSpace;}
var newFlattenedPeriodSpace=flattenedPeriodSpace;for(var index in openPeriods){if(!(openPeriods).hasOwnProperty(index))
continue;var currentPeriod=openPeriods[index];if(currentPeriod!=null&&currentPeriod[0]!=null&&currentPeriod[1]!=null){var currentStart=currentPeriod[0].getTime();var currentEnd=currentPeriod[1].getTime();if(currentStart<serieEndValue&&currentEnd>serieStartValue){if(currentStart<serieStartValue){currentStart=serieStartValue;}
if(currentEnd>serieEndValue){currentEnd=serieEndValue;}
if(currentStart<currentEnd){newFlattenedPeriodSpace=this.updatePeriods(seriesPeriods,newFlattenedPeriodSpace,currentStart,currentEnd);}}}}
return newFlattenedPeriodSpace;};prototype.createGlobalIndexedXValues=function(){var orderedX=[];var seriesCurrentIndices={};var seriesCount=this.getSerieCount();for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){seriesCurrentIndices[currentSerie.getId()]=0;}}
var nextX=this.getNext(seriesCurrentIndices);while(nextX!=null){orderedX.push(nextX);for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieId=currentSerie.getId();var currentSerieNextIndex=seriesCurrentIndices[currentSerieId];var currentSerieNextX=currentSerie.getValueAsDouble(currentSerieNextIndex,Serie.X);if(currentSerieNextX!=null&&currentSerieNextX>nextX){currentSerie.addPoint(currentSerieNextIndex,null);}
seriesCurrentIndices[currentSerieId]=currentSerieNextIndex+1;}}
nextX=this.getNext(seriesCurrentIndices);}
return orderedX;};prototype.getNextNormalizedXValue=function(normalizedXValue,xValueStep){if(this.isIntraday()){return ChartData.prototype.getNextNormalizedXValue.call(this,normalizedXValue,xValueStep);}else if(normalizedXValue!=null){var index=stjs.trunc(Math.round(normalizedXValue));var nextValue=DateUtil.getNextDateValueInScale(this.indexedXValues[index],xValueStep);var possibleNext=this.findIndexAtOrAfterValue(nextValue,this.indexedXValues,DateUtil.MS_DAY_24H);if(possibleNext!=null){return Math.round(possibleNext);}else{return null;}}else{return null;}};prototype.getNext=function(currentIndices){var seriesCount=this.getSerieCount();var currentNext=Double.POSITIVE_INFINITY;for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieNextIndex=currentIndices[currentSerie.getId()];var currentSerieNextX=currentSerie.getValueAsDouble(currentSerieNextIndex,Serie.X);if(currentSerieNextX!=null&&currentSerieNextX<currentNext){currentNext=currentSerieNextX;}}}
if(currentNext==Double.POSITIVE_INFINITY){return null;}else{return currentNext;}};prototype.addIndicator=function(indicatorId,options){this.addIndicatorSeries(this.indicatorsManager.enable(options,indicatorId));};prototype.updateIndicatorParameters=function(options){this.indicatorsManager.updateIndicatorParameters(options);this.updateIndicators();};prototype.addIndicatorSeries=function(indicator){var newSeries=null;var isSerieOnMainGraph=true;if(indicator!=null&&this.getMainSerie()!=null){indicator.calculate(this.getMainSerie(),this.context);newSeries=indicator.getSeries();isSerieOnMainGraph=indicator.getCorrespondingAreaId()==DefaultLayout.GRAPH_AREA;}
var newSeriesCount=newSeries!=null?newSeries.length:0;for(var i=0;i<newSeriesCount;i++){var currentIndicatorSerie=newSeries[i];if(currentIndicatorSerie!=null){this.activeIndicatorSeries[currentIndicatorSerie.getId()]=currentIndicatorSerie;if(isSerieOnMainGraph){currentIndicatorSerie.setLogScale(this.logScale);this.mainGraphActiveIndicatorSeries[currentIndicatorSerie.getId()]=currentIndicatorSerie;}}}};prototype.removeIndicator=function(indicatorId,options){var disabledIndicator=this.indicatorsManager.disable(options,indicatorId);var seriesToRemove=disabledIndicator!=null?disabledIndicator.getSeries():null;var seriesToRemoveCount=seriesToRemove!=null?seriesToRemove.length:0;for(var i=0;i<seriesToRemoveCount;i++){var currentSerie=seriesToRemove[i];if(currentSerie!=null){delete this.activeIndicatorSeries[currentSerie.getId()];delete this.mainGraphActiveIndicatorSeries[currentSerie.getId()];}}};prototype.getIndicator=function(indicatorId,options){return this.indicatorsManager.getIndicator(IndicatorsManager.getSerieTypeId(this.getMainSerie()),indicatorId,this.intraday);};prototype.clearIndicators=function(){this.indicatorsManager.disableAll(this.getMainSerie());this.activeIndicatorSeries={};this.mainGraphActiveIndicatorSeries={};};prototype.isIntraday=function(){return this.intraday;};prototype.hasCurrency=function(){for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;var currentSerie=this.series[index];if(currentSerie!=null&&currentSerie.getStock()!=null&&currentSerie.getStock().isCurrency()){return true;}}
return false;};prototype.isMainCurrency=function(){var currentSerie=this.getMainSerie();return currentSerie!=null&&currentSerie.getStock()!=null&&currentSerie.getStock().isCurrency();};prototype.setExtremums=function(newExtremums){if(newExtremums!=null&&newExtremums[0]!=null&&newExtremums[1]!=null){for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;var currentSerie=this.series[index];if(currentSerie!=null){currentSerie.setForcedInterval(newExtremums[0],newExtremums[1]);}}
this.validateData();}};prototype.isSwissDots=function(){return this.getMainSerie()!=null&&this.getMainSerie().getStock()!=null&&this.getMainSerie().getStock().isSwissDotsMarket();};prototype.getActiveIndicators=function(){return this.indicatorsManager.getActiveIndicators(this.getMainSerie());};prototype.getAllSeries=function(){var allSeries=[];if(this.series!=null){allSeries=this.series.slice(0);}
for(var serieId in this.activeIndicatorSeries){allSeries.push(this.activeIndicatorSeries[serieId]);}
return allSeries;};prototype.getMainGraphSeries=function(){var allSeries=[];if(this.series!=null){allSeries=this.series.slice(0);}
for(var serieId in this.mainGraphActiveIndicatorSeries){allSeries.push(this.mainGraphActiveIndicatorSeries[serieId]);}
return allSeries;};prototype.updateIndicators=function(){this.activeIndicatorSeries={};this.mainGraphActiveIndicatorSeries={};var activeIndicators=this.getActiveIndicators();var activeIndicatorsCount=activeIndicators!=null?activeIndicators.length:0;for(var i=0;i<activeIndicatorsCount;i++){this.addIndicatorSeries(activeIndicators[i]);}};prototype.updateContextDependentIndicators=function(){var lrcIndic=this.indicatorsManager.getIndicator(this.indicatorsManager.constructor.getSerieTypeId(this.getMainSerie()),IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID,this.intraday);if(lrcIndic!=null&&lrcIndic.isEnabled()){lrcIndic.calculate(this.getMainSerie(),this.context);}};prototype.isActiveIndicator=function(indicatorId){return this.indicatorsManager.isActiveIndicators(this.getMainSerie(),indicatorId);};prototype.addSerie=function(yesterdayLine){if(yesterdayLine==null){return;}
yesterdayLine.setLogScale(this.logScale);if(this.series!=null){this.series.push(yesterdayLine);}else{this.series=[yesterdayLine];}};prototype.removeSerie=function(serieId){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.getId()==serieId){this.series.splice(i,1);return;}}};prototype.isEmpty=function(){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.getSerie(i);if(serie!=null&&serie.getId()!=YesterdayLine.INDICATOR_ID&&!serie.isEmpty()){return false;}}
return true;};prototype.getActiveIndicatorSerie=function(indicatorId){return this.activeIndicatorSeries[indicatorId];};prototype.updateSeriesLogScale=function(){ChartData.prototype.updateSeriesLogScale.call(this);for(var serieId in this.mainGraphActiveIndicatorSeries){var currentIndicator=this.mainGraphActiveIndicatorSeries[serieId];if(currentIndicator!=null){currentIndicator.setLogScale(this.logScale);}}};prototype.hasValidBottomIndicators=function(){for(var index in this.activeIndicatorSeries){if(this.mainGraphActiveIndicatorSeries[index]==null){return true;}}
return false;};prototype.getActiveIndicatorsAssociatedWith=function(graphArea,axisPos){var indicators=this.getActiveIndicators();var associatedIndicators=[];for(var index in indicators){if(!(indicators).hasOwnProperty(index))
continue;var ind=indicators[index];if(ind!=null&&ind.isOnArea(graphArea)&&ind.hasAxisPosition(axisPos)){associatedIndicators.push(ind);}}
return associatedIndicators;};},{indicatorsManager:{name:"IndicatorsManager",arguments:["S"]},activeIndicatorSeries:{name:"Map",arguments:[null,"S"]},mainGraphActiveIndicatorSeries:{name:"Map",arguments:[null,"S"]},context:"ChartContext",chart:"DefaultChart",provider:{name:"DataProvider",arguments:[{name:"ChartData",arguments:["S"]}]},cache:"Cache",series:{name:"Array",arguments:["S"]},extremums:{name:"Array",arguments:[null]},indexedXValues:{name:"Array",arguments:[null]},availableFormats:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},possibleXSteps:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},xValuesPeriods:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},observers:{name:"Map",arguments:[null,"Observer"]}},{});
var DefaultDelimiterEngine=function(options){Engine.call(this);this.correspondingAreaId=FinancialLayout.DELIMITER_AREA;this.selected=false;};DefaultDelimiterEngine=stjs.extend(DefaultDelimiterEngine,Engine,[],function(constructor,prototype){constructor.DELIMITER_ELEMENT_ID="delimtierElement";prototype.selected=false;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){var groundLayer=chartView.getGroundLayer();var delimiterArea=chartView.getArea(this.correspondingAreaId);var delimiterStyle=chartView.getStyleModel().getStyle(FinancialLayout.DELIMITER_AREA);var position=context.getCurrentPosition();if(delimiterStyle!=null&&delimiterStyle.isVisible()&&delimiterArea!=null){var bounds=delimiterArea.getAreaBound();var delimiterHighlight=ChartElementFactory.createRect(groundLayer,stjs.trunc(bounds.getLeft()),stjs.trunc(bounds.getTop()),stjs.trunc(bounds.getOuterWidth(false)),stjs.trunc(bounds.getHeight()));delimiterHighlight.setFillShape(false);delimiterHighlight.setStrokeShape(false);delimiterHighlight.setId(DefaultDelimiterEngine.DELIMITER_ELEMENT_ID);delimiterArea.addElement(delimiterHighlight);}};prototype.createInteractiveGraphics=function(chartView,chartData,context){var overlayLayer=chartView.getOverlayLayer();var delimiterArea=chartView.getArea(this.correspondingAreaId);var delimiterStyle=chartView.getStyleModel().getStyle(FinancialLayout.DELIMITER_AREA);var position=context.getCurrentPosition();if(delimiterStyle!=null&&delimiterStyle.isVisible()&&delimiterArea!=null&&(this.selected||(position!=null&&delimiterArea.isInside(position.getX(),position.getY())))){var bounds=delimiterArea.getAreaBound();var left=stjs.trunc(bounds.getLeft());var top=stjs.trunc(bounds.getTop());var width=stjs.trunc(bounds.getOuterWidth(false));var height=stjs.trunc(bounds.getHeight());var delimiterHighlight=ChartElementFactory.createRect(overlayLayer,left,top,width,height);delimiterHighlight.setFillColor(delimiterStyle.getBackgroundColor());delimiterArea.addElement(delimiterHighlight);if(this.selected){var topGraphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var bottomGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var topGraphAreaBounds=topGraphArea.getAreaBound();var bottomGraphAreaBounds=bottomGraphArea.getAreaBound();if(bottomGraphAreaBounds==null||!bottomGraphAreaBounds.isVisible()){bottomGraphAreaBounds=topGraphAreaBounds;}
if(topGraphAreaBounds==null){return;}
var newTopPos=position.getY();var minY=stjs.trunc(topGraphAreaBounds.getTop());var maxY=stjs.trunc((bottomGraphAreaBounds.getTop()+bottomGraphAreaBounds.getHeight()-bounds.getHeight()));if(newTopPos<minY){newTopPos=minY;}else if(newTopPos>maxY){newTopPos=maxY;}
var newDelimiterHighlight=ChartElementFactory.createRect(overlayLayer,left,newTopPos,width,height);newDelimiterHighlight.setFillColor(delimiterStyle.getBackgroundColor());if(newTopPos>top){bottomGraphArea.addElement(newDelimiterHighlight);}else{topGraphArea.addElement(newDelimiterHighlight);}}}};prototype.isSelected=function(){return this.selected;};prototype.setSelected=function(selected){this.selected=selected;};},{},{});
var CandlesticksGraphEngine=function(){DefaultGraphEngine.call(this);};CandlesticksGraphEngine=stjs.extend(CandlesticksGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.MAX_LENGTH=6;constructor.getInstance=function(){if(CandlesticksGraphEngine.instance==null){CandlesticksGraphEngine.instance=new CandlesticksGraphEngine();}
return CandlesticksGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var high=FinancialSerie.HIGH;var low=FinancialSerie.LOW;var open=FinancialSerie.OPEN;var close=FinancialSerie.CLOSE;var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin!=null&&yMin>0&&yMax!=null&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var positiveColor=ChartColor.greenOld;var negativeColor=ChartColor.redOld;if(serie.getColorStrategy()!=null){var cs=serie.getColorStrategy();if(cs.getPositiveColor()!=null){positiveColor=cs.getPositiveColor();}
if(cs.getNegativeColor()!=null){negativeColor=cs.getNegativeColor();}}
var heightRatio=chartHeight/(yMax-yMin);var sideLength=stjs.trunc(Math.round(stjs.trunc(chartWidth/(2*serieLength))));if(sideLength<=0){sideLength=1;}else if(sideLength>CandlesticksGraphEngine.MAX_LENGTH){sideLength=CandlesticksGraphEngine.MAX_LENGTH;}
for(var i=0;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;var currentHighValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,high,true);var currentLowValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,low,true);var currentOpenValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,open,true);var currentCloseValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,close,true);if(currentHighValues!=null&&currentHighValues.length>0&&currentLowValues!=null&&currentLowValues.length>0&&currentOpenValues!=null&&currentOpenValues.length>0&&currentCloseValues!=null&&currentCloseValues.length>0){var highValue=this.filterValue(currentHighValues[0],yMin,useLogScale);var lowValue=this.filterValue(currentLowValues[0],yMin,useLogScale);var openValue=this.filterValue(currentOpenValues[0],yMin,useLogScale);var closeValue=this.filterValue(currentCloseValues[0],yMin,useLogScale);if(highValue!=null&&lowValue!=null){var highCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(highValue-yMin)));var lowCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(lowValue-yMin)));if(highCoordinate<chartTopPos){highCoordinate=chartTopPos;}else if(highCoordinate>chartBottomPos){highCoordinate=chartBottomPos;}
if(lowCoordinate<chartTopPos){lowCoordinate=chartTopPos;}else if(lowCoordinate>chartBottomPos){lowCoordinate=chartBottomPos;}
var centerLine=ChartElementFactory.createLine(layer,currentXPosition,highCoordinate,currentXPosition,lowCoordinate,1);centerLine.setStrokeColor(ChartColor.orange);area.addElement(centerLine);}
var openCoordinate=openValue==null?null:stjs.trunc(Math.round(chartBottomPos-heightRatio*(openValue-yMin)));var closeCoordinate=closeValue==null?null:stjs.trunc(Math.round(chartBottomPos-heightRatio*(closeValue-yMin)));if(openCoordinate!=null&&closeCoordinate!=null&&openCoordinate!=closeCoordinate){if(closeCoordinate<chartTopPos){closeCoordinate=chartTopPos;}else if(closeCoordinate>chartBottomPos){closeCoordinate=chartBottomPos;}
if(openCoordinate<chartTopPos){openCoordinate=chartTopPos;}else if(openCoordinate>chartBottomPos){openCoordinate=chartBottomPos;}
var topPosition=closeCoordinate;var height=openCoordinate-closeCoordinate;var color=positiveColor;if(openCoordinate<closeCoordinate){color=negativeColor;}
var candle=ChartElementFactory.createRect(layer,currentXPosition-sideLength,topPosition,2*sideLength,height);candle.setFillColor(color);area.addElement(candle);}else if(openCoordinate!=null||closeCoordinate!=null){var validCoordinate=openCoordinate!=null?openCoordinate:closeCoordinate;if(validCoordinate<chartTopPos){validCoordinate=chartTopPos;}else if(validCoordinate>chartBottomPos){validCoordinate=chartBottomPos;}
var validLine=ChartElementFactory.createLine(layer,currentXPosition-sideLength,validCoordinate,currentXPosition+sideLength,validCoordinate,1);validLine.setStrokeColor(ChartColor.black);area.addElement(validLine);}}}};},{instance:"CandlesticksGraphEngine"},{});
var HLOCGraphEngine=function(){DefaultGraphEngine.call(this);};HLOCGraphEngine=stjs.extend(HLOCGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.MAX_LENGTH=6;constructor.getInstance=function(){if(HLOCGraphEngine.instance==null){HLOCGraphEngine.instance=new HLOCGraphEngine();}
return HLOCGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var high=FinancialSerie.HIGH;var low=FinancialSerie.LOW;var open=FinancialSerie.OPEN;var close=FinancialSerie.CLOSE;var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin!=null&&yMin>0&&yMax!=null&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);var sideLength=stjs.trunc(Math.round(stjs.trunc(chartWidth/serieLength)));if(sideLength<=0){sideLength=1;}else if(sideLength>HLOCGraphEngine.MAX_LENGTH){sideLength=HLOCGraphEngine.MAX_LENGTH;}
for(var i=0;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;var currentHighValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,high,true);var currentLowValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,low,true);var currentOpenValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,open,true);var currentCloseValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,close,true);if(currentHighValues!=null&&currentHighValues.length>0&&currentLowValues!=null&&currentLowValues.length>0&&currentOpenValues!=null&&currentOpenValues.length>0&&currentCloseValues!=null&&currentCloseValues.length>0){var highValue=this.filterValue(currentHighValues[0],yMin,useLogScale);var lowValue=this.filterValue(currentLowValues[0],yMin,useLogScale);var openValue=this.filterValue(currentOpenValues[0],yMin,useLogScale);var closeValue=this.filterValue(currentCloseValues[0],yMin,useLogScale);if(highValue!=null&&lowValue!=null){var highCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(highValue-yMin)));var lowCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(lowValue-yMin)));if(highCoordinate<chartTopPos){highCoordinate=chartTopPos;}else if(highCoordinate>chartBottomPos){highCoordinate=chartBottomPos;}
if(lowCoordinate<chartTopPos){lowCoordinate=chartTopPos;}else if(lowCoordinate>chartBottomPos){lowCoordinate=chartBottomPos;}
var centerLine=ChartElementFactory.createLine(layer,currentXPosition,highCoordinate,currentXPosition,lowCoordinate,1);centerLine.setStrokeColor(ChartColor.orange);area.addElement(centerLine);}
if(openValue!=null){var openCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(openValue-yMin)));if(openCoordinate<chartTopPos){openCoordinate=chartTopPos;}else if(openCoordinate>chartBottomPos){openCoordinate=chartBottomPos;}
var openLine=ChartElementFactory.createLine(layer,currentXPosition-sideLength,openCoordinate,currentXPosition,openCoordinate,1);openLine.setStrokeColor(ChartColor.orange);area.addElement(openLine);}
if(closeValue!=null){var closeCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(closeValue-yMin)));if(closeCoordinate<chartTopPos){closeCoordinate=chartTopPos;}else if(closeCoordinate>chartBottomPos){closeCoordinate=chartBottomPos;}
var closeLine=ChartElementFactory.createLine(layer,currentXPosition,closeCoordinate,currentXPosition+sideLength,closeCoordinate,1);closeLine.setStrokeColor(ChartColor.orange);area.addElement(closeLine);}}}};},{instance:"HLOCGraphEngine"},{});
var SignalsEngine=function(){DefaultGraphEngine.call(this);};SignalsEngine=stjs.extend(SignalsEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.BORDER_PADDING=3;constructor.SIGNALS_BASELINE_WIDTH=8;constructor.SIGNALS_HEIGHT=4;constructor.getInstance=function(){if(SignalsEngine.instance==null){SignalsEngine.instance=new SignalsEngine();}
return SignalsEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var which=Serie.Y;var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartInnerTopPos=stjs.trunc(bounds.getInnerTop())+SignalsEngine.BORDER_PADDING;var chartInnerBottomPos=stjs.trunc(bounds.getInnerBottom())-SignalsEngine.BORDER_PADDING;var startIndex=context.getMainMinIndex(Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMainMaxIndex(Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;if(this.isSpecialAggregatedSerie(serie)){startIndex=0;endIndex=serie.getLength()-1;}
var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
context.setMinIndex(serieId,startIndex,Serie.X);context.setMaxIndex(serieId,endIndex,Serie.X);var positiveColor=ChartColor.greenOld;var negativeColor=ChartColor.redOld;if(serie.getColorStrategy()!=null){var cs=serie.getColorStrategy();if(cs.getPositiveColor()!=null){positiveColor=cs.getPositiveColor();}
if(cs.getNegativeColor()!=null){negativeColor=cs.getNegativeColor();}}
for(var i=0;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;var currentSignalValues=serie.getAggregatedValues(AggregationStrategy.MIN_MAX,context,i,chartWidth,which,true);if(currentSignalValues!=null){var sellSignal=false;var buySignal=false;for(var index in currentSignalValues){if(!(currentSignalValues).hasOwnProperty(index))
continue;var signalValue=currentSignalValues[index];if(signalValue!=null){sellSignal=sellSignal||signalValue<0;buySignal=buySignal||signalValue>0;}}
if(sellSignal){var signal=ChartElementFactory.createSimpleIsocelesTriangle(layer,currentXPosition,chartInnerTopPos,SignalsEngine.SIGNALS_BASELINE_WIDTH,SignalsEngine.SIGNALS_HEIGHT);signal.setStrokeColor(negativeColor);signal.setFillColor(negativeColor);signal.setFillShape(true);area.addElement(signal);}
if(buySignal){var signal=ChartElementFactory.createSimpleIsocelesTriangle(layer,currentXPosition,chartInnerBottomPos,SignalsEngine.SIGNALS_BASELINE_WIDTH,-SignalsEngine.SIGNALS_HEIGHT);signal.setStrokeColor(positiveColor);signal.setFillColor(positiveColor);signal.setFillShape(true);area.addElement(signal);}}}};prototype.isSpecialAggregatedSerie=function(serie){if(serie!=null&&!serie.isIndexed()&&(serie)["getMainSerie"]){var indSerie=serie;var mainSerie=indSerie.getMainSerie();var mainPeriod=mainSerie!=null?mainSerie.getPeriod():null;if(mainPeriod==null||!(mainPeriod.isLive()||(mainPeriod.isIntraday()&&mainPeriod.getValue()>MultiIntradayServletRequest.MAX_INTRADAY))||mainPeriod.getFrom()==null||mainPeriod.getTo()==null){return false;}else{return true;}}
return false;};},{instance:"SignalsEngine"},{});
var FinancialTitleEngine=function(options){DefaultTitleEngine.call(this,options);var titleHeight=options.getBigLabelFontSize();if(options.isPopOverAllowed()){titleHeight=stjs.trunc(Math.max(titleHeight,options.getZoomIconSize()));}
this.initialHeight=titleHeight+DefaultLayout.DEFAULT_PADDING_PIXELS;this.valueLabelsOffset=0;this.forceShortTitle=false;};FinancialTitleEngine=stjs.extend(FinancialTitleEngine,DefaultTitleEngine,[],function(constructor,prototype){constructor.SEPARATION_WIDTH=25;prototype.initialHeight=0;prototype.valueLabelsOffset=0;prototype.forceShortTitle=false;prototype.titles=null;prototype.values=null;prototype.priceFormat=null;prototype.volumeFormat=null;prototype.update=function(chartView,chartData,context){if(chartData!=null&&chartData.getMainSerie()!=null){var mainSerie=chartData.getMainSerie();if(mainSerie.getStock()!=null){this.title=mainSerie.getStock().getName();this.alternateTitle=mainSerie.getStock().getSymbol();}}
var titleStyle=chartView.getStyleModel().getTitleStyle();var titleHeight=titleStyle.getTitleFontSize();if(titleStyle.isPopoverAllowed()){titleHeight=stjs.trunc(Math.max(titleHeight,titleStyle.getZoomIconSize()));}
this.initialHeight=titleHeight+DefaultLayout.DEFAULT_PADDING_PIXELS;};prototype.createMainGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var layer=chartView.getGroundLayer();var overlayLayer=chartView.getOverlayLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();if(chartData.getDataSerieCount()>1){chartView.getLayout().updateTitleArea(2*this.initialHeight);this.valueLabelsOffset=this.initialHeight;}else{chartView.getLayout().updateTitleArea(this.initialHeight);this.valueLabelsOffset=0;}
this.usedWidth=0;if(this.showEnlargeIcon){this.rightWidth=this.createTitleIcon(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}else{this.rightWidth=this.createCopyrightLabel(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}
var areaBound=titleArea.getAreaBound();var maxValueWidth=0;if(context.getRange(this.associatedAxisId)!=null&&context.getRange(this.associatedAxisId)[1]!=null){this.valueFormatter.setFormat(context.getFormat(this.associatedAxisId));var valueString=this.valueFormatter.formatValue(context.getRange(this.associatedAxisId)[1]);maxValueWidth=chartView.getTextWidth(valueString,titleStyle.getFont(),titleStyle.getValueFontSize(),titleStyle.isValueBold());}
var availableWidth=stjs.trunc((areaBound.getInnerWidth()-this.usedWidth))-2*FinancialTitleEngine.SEPARATION_WIDTH-maxValueWidth;this.displayedTitle=this.getTitle(chartView,availableWidth);this.forceShortTitle=false;if(chartData.getDataSerieCount()==1){var mainLabel=this.createTitleLabel(layer,this.displayedTitle,chartView,titleStyle.getTitleColor(),titleArea,titleStyle,0);this.usedWidth+=mainLabel!=null?mainLabel.getWidth():0;}else{this.usedWidth+=this.createTitleLabels(layer,chartView,chartData,context,titleArea,titleStyle);}
var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);this.priceFormat=context.getFormat(DefaultLayout.Y1_AXIS_AREA);this.volumeFormat=context.getFormat(FinancialLayout.BOTTOM_AXIS_LEFT);this.createValueLabels(overlayLayer,chartView,chartData,context,titleArea,titleStyle,this.usedWidth);};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var overlayLayer=chartView.getOverlayLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();var position=context.getCurrentPosition();var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var volumeAreaBounds=volumeGraphArea.getAreaBound();this.priceFormat=context.getFormat(DefaultLayout.Y1_AXIS_AREA);this.volumeFormat=context.getFormat(FinancialLayout.BOTTOM_AXIS_LEFT);this.createValueLabels(overlayLayer,chartView,chartData,context,titleArea,titleStyle,this.usedWidth);if(this.currentIcon!=null&&position!=null&&this.currentIcon.isInside(position.getX(),position.getY())){var copyIcon=this.currentIcon.copyTo(overlayLayer);copyIcon.setBackgroundColor(ChartColor.orange);titleArea.addElement(copyIcon);}};prototype.createTitleLabels=function(layer,chartView,chartData,context,area,style){var seriesCount=chartData.getSerieCount();var titlesWidth=0;this.titles={};var titleType=style.getType();var volumeInTitle=titleType==TitleStyle.SHOW_VALUE_VOLUME;for(var j=0;j<seriesCount;j++){var currentSerie=chartData.getSerie(j);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieLabel=this.createTitleLabel(layer,currentSerie.getName(),chartView,currentSerie.getColor(),area,style,titlesWidth);this.titles[currentSerie.getId()]=currentSerieLabel;var currentLabelWidth=currentSerieLabel!=null?currentSerieLabel.getWidth():0;titlesWidth+=currentLabelWidth+FinancialTitleEngine.SEPARATION_WIDTH;if(volumeInTitle){titlesWidth+=2*FinancialTitleEngine.SEPARATION_WIDTH;}}}
var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var availableWidth=stjs.trunc((graphAreaBound.getOuterWidth(true)-this.usedWidth))-2*FinancialTitleEngine.SEPARATION_WIDTH;if(titlesWidth>availableWidth&&volumeInTitle){this.forceShortTitle=true;for(var j=1;j<seriesCount;j++){var currentSerie=chartData.getSerie(j);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieLabel=this.titles[currentSerie.getId()];currentSerieLabel.setX(currentSerieLabel.getX()-2*j*FinancialTitleEngine.SEPARATION_WIDTH);titlesWidth-=2*FinancialTitleEngine.SEPARATION_WIDTH;}}}
return titlesWidth;};prototype.createTitleLabel=function(layer,title,chartView,color,area,style,previousTitlesWidth){if(!this.showTitle){return null;}
title=title!=null?title.replace("_","/"):"";var fontSize=style.getTitleFontSize();var isBold=style.isTitleBold();var areaBound=area.getAreaBound();var titleWidth=chartView.getLabelWidth(title,style.getFont(),fontSize,isBold);var height=this.initialHeight;var yCenter=stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var xPos=stjs.trunc(areaBound.getInnerLeft())+previousTitlesWidth;var titleLabel=ChartElementFactory.createLabel(layer,0.0,title,xPos,yCenter,titleWidth,height);titleLabel.setAlign(Label.ALIGN_LEFT);titleLabel.setColor(color);titleLabel.setFontSize(fontSize);titleLabel.setBold(isBold);area.addElement(titleLabel);return titleLabel;};prototype.createValueLabels=function(layer,chartView,chartData,context,area,style,usedWidth){var graphArea=chartView.getArea(this.associatedGraphId);var graphBound=graphArea.getAreaBound();var currentPosition=context.getCurrentPosition();if(!this.showValue||currentPosition==null||!graphBound.isInside(currentPosition.getX(),currentPosition.getY())){return 0;}
var graphWidth=stjs.trunc(graphBound.getContentWidth());var currentPointsBySerie=context.getClosestPointsFromCurrentPosition(graphBound.getContentLeft(),graphWidth);if(currentPointsBySerie==null){return 0;}
var valuesWidth=0;var seriesCount=chartData.getSerieCount();var currentSerie=chartData.getSerie(0);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){valuesWidth+=this.createValueLabel(currentSerie,currentPointsBySerie[currentSerie.getId()],layer,chartView,area,style,valuesWidth,style.getTitleColor());valuesWidth+=FinancialTitleEngine.SEPARATION_WIDTH;}
for(var j=1;j<seriesCount;j++){currentSerie=chartData.getSerie(j);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){valuesWidth+=this.createValueLabel(currentSerie,currentPointsBySerie[currentSerie.getId()],layer,chartView,area,style,valuesWidth,currentSerie.getColor());valuesWidth+=FinancialTitleEngine.SEPARATION_WIDTH;}}
return valuesWidth;};prototype.createValueLabel=function(currentSerie,currentPoints,layer,chartView,area,style,previousValuesWidth,color){var pointCount=currentPoints!=null?currentPoints.length:0;var currentPriceValue=Double.NEGATIVE_INFINITY;var currentVolumeValue=0.0;for(var i=0;i<pointCount;i++){var currentPoint=currentPoints[i];if(currentPoint!=null){var priceValue=currentPoint[Serie.Y];var volumeValue=currentPoint[FinancialSerie.VOLUME];if(volumeValue!=null&&volumeValue>currentVolumeValue){currentVolumeValue=volumeValue;currentPriceValue=priceValue;}else if(currentVolumeValue<=0.0&&priceValue!=null&&priceValue>currentPriceValue){currentVolumeValue=0.0;currentPriceValue=priceValue;}}}
if(currentPriceValue!=Double.NEGATIVE_INFINITY){this.valueFormatter.setFormat(this.priceFormat);var priceValueString=this.valueFormatter.formatValue(currentPriceValue);this.valueFormatter.setFormat(this.volumeFormat);var volumeValueString=this.valueFormatter.formatValue(currentVolumeValue);var valueString=priceValueString;var titleType=style.getType();if(titleType==TitleStyle.HIDE_VALUES){return 0;}else if(this.forceShortTitle||titleType==TitleStyle.SHOW_MAIN_VALUE){if(this.associatedGraphId==FinancialLayout.BOTTOM_GRAPH_AREA){if(currentVolumeValue>0.0){valueString=volumeValueString;}else{valueString="";}}}else if(titleType==TitleStyle.SHOW_VALUE_VOLUME&&currentVolumeValue>0.0){valueString=priceValueString+" ("+volumeValueString+")";}
var fontSize=style.getValueFontSize();var isBold=style.isValueBold();var valueWidth=chartView.getLabelWidth(valueString,style.getFont(),fontSize,isBold);var areaBound=area.getAreaBound();var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var availableWidth=stjs.trunc((graphAreaBound.getOuterWidth(true)-this.usedWidth-previousValuesWidth))-2*FinancialTitleEngine.SEPARATION_WIDTH;var xCenter=stjs.trunc(Math.round(graphAreaBound.getLeft()+((graphAreaBound.getOuterWidth(true)+this.usedWidth-2*this.rightWidth)/2.0)));var height=this.initialHeight;var align=Label.ALIGN_CENTER;var xPos=xCenter+previousValuesWidth;if(this.valueLabelsOffset>0){xPos=this.titles[currentSerie.getId()].getX();align=Label.ALIGN_LEFT;}else if(valueWidth>availableWidth){if(this.associatedGraphId==FinancialLayout.BOTTOM_GRAPH_AREA){valueString=volumeValueString;}else{valueString=priceValueString;}
valueWidth=chartView.getLabelWidth(valueString,style.getFont(),fontSize,isBold);}
var yCenter=this.valueLabelsOffset+stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var valueLabel=ChartElementFactory.createLabel(layer,0.0,valueString,xPos,yCenter,valueWidth,height);valueLabel.setAlign(align);valueLabel.setColor(color);valueLabel.setFontSize(fontSize);valueLabel.setBold(isBold);area.addElement(valueLabel);return valueWidth;}
return 0;};},{titles:{name:"Map",arguments:[null,"Label"]},values:{name:"Array",arguments:["Label"]},currentIcon:"ChartIcon",valueFormatter:"Formatter"},{});
var FinancialXAxisEngine=function(options){DefaultXAxisEngine.call(this,options);};FinancialXAxisEngine=stjs.extend(FinancialXAxisEngine,DefaultXAxisEngine,[],function(constructor,prototype){prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var xAxisStyle=chartView.getStyleModel().getXAxisStyle();var graphArea=chartView.getArea(this.associatedGraphId);var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);if(xAxisStyle.isVisible()&&xAxisStyle.isShowLabelHighlight()&&(graphArea.isPointInside(context.getCurrentPosition())||volumeGraphArea.isPointInside(context.getCurrentPosition()))&&!chartData.isEmpty()){this.createHighlightLabel(layer,chartView,chartData,context);}};},{labelsParameters:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},messages:"ChartMessagesRepository",boldDateLabelsPositions:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var VolumeAxisEngine=function(options,correspondingAreaId,pos){DefaultY1AxisEngine.call(this,options);this.labelsFormatter=new AbbreviateNumberFormatter();this.labelsFormatter.setFormat("0");this.correspondingAreaId=correspondingAreaId;this.associatedGraphId=FinancialLayout.BOTTOM_GRAPH_AREA;this.position=pos;};VolumeAxisEngine=stjs.extend(VolumeAxisEngine,DefaultY1AxisEngine,[],function(constructor,prototype){prototype.update=function(chartView,chartData,context){DefaultYAxisEngine.prototype.update.call(this,chartView,chartData,context);this.logScale=false;};},{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var VolumeGraphEngine=function(options){GraphEngine.call(this,options);this.showIndicatorsDescriptions=options.isShowIndicatorsDescriptions();this.showIndicatorsSignals=true;this.labelsXPositionsByArea={};this.currentBarWidth=1;this.volumeColorStrategy=options.getVolumeColorStrategy();this.volumeLabelColor=(options.getVolumeLabelColor()||ChartColor.black);};VolumeGraphEngine=stjs.extend(VolumeGraphEngine,GraphEngine,[],function(constructor,prototype){constructor.MAX_BAR_WIDTH=7;constructor.DESCRIPTIONS_LABEL_FONT_SIZE=10;constructor.DESCRIPTIONS_LABEL_Y_MARGIN=3;prototype.showIndicatorsDescriptions=false;prototype.showIndicatorsSignals=false;prototype.labelsXPositionsByArea=null;prototype.currentBarWidth=0;prototype.volumeColorStrategy=null;prototype.volumeLabelColor=null;prototype.createMainGraphics=function(chartView,chartData,context){this.createMainGraphGraphics(chartView,chartData,context);var groundLayer=chartView.getGroundLayer();var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var graphStyle=chartView.getStyleModel().getStyle(FinancialLayout.BOTTOM_GRAPH_AREA);var mainSerie=chartData.getMainSerie();this.currentBarWidth=this.computeCurrentBarWidth(volumeGraphArea,mainSerie,context);CanvasBackgroundHelper.createBackground(groundLayer,volumeGraphArea,graphStyle);var boldDateLabelsPositions=GraphEngine.getBoldDateLabelsPositions(context);this.createBackgroundGrid(groundLayer,volumeGraphArea,graphStyle,context.getLabelsPosition(DefaultLayout.X_AXIS_AREA),context.getLabelsPosition(FinancialLayout.BOTTOM_AXIS_LEFT),boldDateLabelsPositions);CanvasBackgroundHelper.createBorders(groundLayer,volumeGraphArea,graphStyle);var mainLayer=chartView.getMainLayer();if(chartData.isActiveIndicator(IndicatorsManager.VOLUME_INDICATOR_ID)&&chartData.getMainSerie()!=null){this.createGraphElement(mainLayer,volumeGraphArea,mainSerie,context,graphStyle);}
this.createIndicatorsGraphics(chartView,chartData,context);if(chartData.isEmpty()){this.emptyPriceAreas(chartView);new ChartNotifications(chartView).showNoPriceMessage();}};prototype.computeCurrentBarWidth=function(area,serie,context){if(area==null||serie==null){return this.currentBarWidth;}
var bounds=area.getAreaBound();var serieId=serie.getId();var chartWidth=stjs.trunc(bounds.getContentWidth());var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;var barWidth=stjs.trunc(Math.round(stjs.trunc(chartWidth/(2*serieLength))));if(barWidth<=0){barWidth=1;}else if(barWidth>VolumeGraphEngine.MAX_BAR_WIDTH){barWidth=VolumeGraphEngine.MAX_BAR_WIDTH;}
return barWidth;};prototype.createMainGraphGraphics=function(chartView,chartData,context){var saved=false;var savedColor=null;var savedStrat=null;var mainSerie=chartData.getMainSerie();var type=mainSerie!=null?mainSerie.getType():null;if(type==null){type=this.getDefaultType();}
if(!chartData.isIntraday()&&mainSerie!=null&&(type==null||type==Chart.ChartType.LINE)){saved=true;savedStrat=mainSerie.getColorStrategy();savedColor=mainSerie.getColor();mainSerie.setColor(FinancialEngineModel.COLORS_ARRAY[0]);mainSerie.setColorStrategy(null);}
GraphEngine.prototype.createMainGraphics.call(this,chartView,chartData,context);if(saved){mainSerie.setColor(savedColor);mainSerie.setColorStrategy(savedStrat);}};prototype.emptyPriceAreas=function(chartView){var y1AxisArea=chartView.getArea(FinancialLayout.Y1_AXIS_AREA);if(y1AxisArea!=null){y1AxisArea.clearElements();}
var y2AxisArea=chartView.getArea(FinancialLayout.Y2_AXIS_AREA);if(y2AxisArea!=null){y2AxisArea.clearElements();}
var graphArea=chartView.getArea(FinancialLayout.GRAPH_AREA);if(graphArea!=null){graphArea.clearElements();}
var xAxisArea=chartView.getArea(FinancialLayout.X_AXIS_AREA);if(xAxisArea!=null){xAxisArea.clearElements();}
var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);if(volumeGraphArea!=null){volumeGraphArea.clearElements();}
var bottomLeftAxisArea=chartView.getArea(FinancialLayout.BOTTOM_AXIS_LEFT);if(bottomLeftAxisArea!=null){bottomLeftAxisArea.clearElements();}
var bottomRightAxisArea=chartView.getArea(FinancialLayout.BOTTOM_AXIS_RIGHT);if(bottomRightAxisArea!=null){bottomRightAxisArea.clearElements();}};prototype.getGraphEngine=function(serieType){var type=serieType==null?this.defaultType:serieType;if(type==Chart.ChartType.LINE){return DefaultLineGraphEngine.getInstance();}else if(type==Chart.ChartType.POINT){return DefaultPointGraphEngine.getInstance();}else if(type==Chart.ChartType.AREA){return DefaultAreaGraphEngine.getInstance();}else if(type==Chart.ChartType.BAR){var barGraphEngine=DefaultBarGraphEngine.getInstance();barGraphEngine.setBarType(this.barType);return barGraphEngine;}else if(type==Chart.ChartType.BID_ASK){return BidAskAreaEngine.getInstance();}else if(type==Chart.ChartType.HLOC){return HLOCGraphEngine.getInstance();}else if(type==Chart.ChartType.CANDLESTICK){return CandlesticksGraphEngine.getInstance();}else if(type==Chart.ChartType.HL_AREA){return HighLowAreaGraphEngine.getInstance();}else if(type==Chart.ChartType.NONE){return null;}else{return DefaultLineGraphEngine.getInstance();}};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=FinancialSerie.VOLUME;var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartRightPos=stjs.trunc((bounds.getOuterWidth(true)+bounds.getLeft()));var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var positiveColor=ChartColor.greenOld;var negativeColor=ChartColor.redOld;if(this.volumeColorStrategy!=null){if(this.volumeColorStrategy.getPositiveColor()!=null){positiveColor=this.volumeColorStrategy.getPositiveColor();}
if(this.volumeColorStrategy.getNegativeColor()!=null){negativeColor=this.volumeColorStrategy.getNegativeColor();}}
var heightRatio=chartHeight/(yMax-yMin);var yCoordinate=0;var barWidth=this.currentBarWidth;if(barWidth==null||barWidth<=0){barWidth=1;}
var xRectCorrection=stjs.trunc(Math.floor(barWidth/2.0));var normalBar=ChartOption.NORMAL_BAR;for(var i=0;i<renderingWidth;i++){var xRect=i+chartLeftPos-xRectCorrection;var currentPointsIndices=serie.getCorrespondingIndices(context,i,chartWidth,true);if(currentPointsIndices!=null&&currentPointsIndices.length>0){var currentVolumeValue=null;var currentMainValue=null;var previousPointMainValue=null;var volumeMaxIndex=null;if(currentPointsIndices.length==1){volumeMaxIndex=currentPointsIndices[0];}else{var first=currentPointsIndices[0];var last=currentPointsIndices[1];currentVolumeValue=Double.NEGATIVE_INFINITY;for(var j=first;j<=last;j++){var currentIndexVolumeValue=serie.getValueAsDouble(j,mainField);if(currentIndexVolumeValue!=null&&currentIndexVolumeValue>currentVolumeValue){currentVolumeValue=currentIndexVolumeValue;volumeMaxIndex=j;}}}
currentVolumeValue=serie.getValueAsDouble(volumeMaxIndex,mainField);currentMainValue=serie.getValueAsDouble(volumeMaxIndex,Serie.Y);previousPointMainValue=serie.getValueAsDouble(volumeMaxIndex-1,Serie.Y);yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentVolumeValue-yMin)));yCoordinate=VolumeGraphEngine.filterYCoordinate(yCoordinate,chartTopPos,chartBottomPos,currentVolumeValue,normalBar);var height=yCoordinate-chartBottomPos+1;if(currentVolumeValue<=0){height=0;currentMainValue=null;previousPointMainValue=null;}else if(height>=0){height=-1;}
var bar=ChartElementFactory.createRect(layer,xRect,chartBottomPos,barWidth,height);if(previousPointMainValue==null||currentMainValue>=previousPointMainValue){bar.setFillColor(positiveColor);}else{bar.setFillColor(negativeColor);}
area.addElement(bar);}}};constructor.filterYCoordinate=function(yValue,chartTopPos,chartBottomPos,currentValue,barType){var res=yValue;if(res<chartTopPos){res=chartTopPos;}
if(res>chartBottomPos){res=chartBottomPos;}
if(res==chartBottomPos&&currentValue>0){res=chartBottomPos-1;}
if(res==chartTopPos&&currentValue<0&&ChartOption.INVERSE_NEGATIVE_BAR.equals(barType)){res=chartTopPos+1;}
return res;};prototype.createInteractiveGraphics=function(chartView,chartData,context){GraphEngine.prototype.createInteractiveGraphics.call(this,chartView,chartData,context);var overlayLayer=chartView.getOverlayLayer();var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var volumeGraphAreaBounds=volumeGraphArea.getAreaBound();var volumeGraphStyle=chartView.getStyleModel().getStyle(FinancialLayout.BOTTOM_GRAPH_AREA);var mainGraphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var position=context.getCurrentPosition();var type=volumeGraphStyle.getHighlightType();if(type==null){return;}
if(volumeGraphArea.isPointInside(position)&&volumeGraphAreaBounds.isVisible()){this.createPositionLines(overlayLayer,volumeGraphArea,context,volumeGraphStyle);if(chartData.isActiveIndicator(IndicatorsManager.VOLUME_INDICATOR_ID)&&type.indexOf(GraphStyle.CIRCLE_HIGHLIGHT)!=-1&&context.getCurrentPosition()!=null){var currentPositionOnGraph=stjs.trunc(Math.round(context.getCurrentPosition().getX()-volumeGraphAreaBounds.getContentLeft()));var mainSerie=chartData.getMainSerie();var isLogScale=mainSerie.isLogScale();mainSerie.setLogScale(false);var closestDataPointPosition=context.getClosestDataPointPosition(mainSerie,currentPositionOnGraph,volumeGraphAreaBounds,AggregationStrategy.MAX,FinancialSerie.VOLUME,FinancialSerie.VOLUME,null);mainSerie.setLogScale(isLogScale);if(closestDataPointPosition!=null&&volumeGraphArea.isPointInside(closestDataPointPosition)){this.createCircleHighlight(overlayLayer,closestDataPointPosition,volumeGraphArea,mainSerie,volumeGraphStyle);}}
if(type.indexOf(GraphStyle.COLOR_HIGHLIGHT)!=-1){}
this.addVerticalLine(type,mainGraphArea,overlayLayer,position,volumeGraphStyle);}else if(mainGraphArea.isPointInside(position)){this.addVerticalLine(type,mainGraphArea,overlayLayer,position,volumeGraphStyle);}};prototype.addVerticalLine=function(type,mainGraphArea,overlayLayer,position,volumeGraphStyle){if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.VERTICAL_LINE_HIGHLIGHT)!=-1){var mainGraphBound=mainGraphArea.getAreaBound();var yInnerStart=stjs.trunc(mainGraphBound.getInnerTop());var yInnerEnd=stjs.trunc((mainGraphBound.getInnerHeight()+yInnerStart));var mainGraphVerticalLine=ChartElementFactory.createLine(overlayLayer,position.getX(),yInnerStart,position.getX(),yInnerEnd,volumeGraphStyle.getHighlightLineWidth());mainGraphVerticalLine.setStrokeColor(volumeGraphStyle.getHighlightLineColor());mainGraphVerticalLine.setStrokeColorGradientParam(volumeGraphStyle.getHighlightLineColorGradientParams());mainGraphArea.addElement(mainGraphVerticalLine);}};prototype.createIndicatorsGraphics=function(chartView,chartData,context){var indicatorLayer=chartView.getMainLayer();var indicators=chartData.getActiveIndicators();this.createIndicators(indicatorLayer,indicators,chartView,context);if(this.showIndicatorsSignals){this.createSignals(indicatorLayer,indicators,chartView,context);}
if(this.showIndicatorsDescriptions){this.createDescriptions(indicatorLayer,chartData,chartView,context);}};prototype.createIndicators=function(indicatorLayer,indicators,chartView,context){var indicatorsCount=indicators!=null?indicators.length:0;for(var i=0;i<indicatorsCount;i++){var indicator=indicators[i];if(indicator!=null){var indicatorArea=indicator.getCorrespondingAreaId();var correspondingArea=chartView.getArea(indicatorArea);var correspondingStyle=chartView.getStyleModel().getStyle(indicatorArea);if(correspondingArea!=null&&correspondingArea.getAreaBound()!=null&&correspondingArea.getAreaBound().isVisible()){var indicatorSeries=indicator.getSeries();var indicatorSeriesCount=indicatorSeries!=null?indicatorSeries.length:0;for(var j=0;j<indicatorSeriesCount;j++){var currentSerie=indicatorSeries[j];if(currentSerie!=null&&currentSerie.getId()!="Volume"){var graphEngine=this.getGraphEngine(currentSerie.getType());if(currentSerie.getName()=="Histogram"){var barGraphEngine=DefaultBarGraphEngine.getInstance();var savedType=barGraphEngine.getBarType();barGraphEngine.setBarType(ChartOption.INVERSE_NEGATIVE_BAR);correspondingStyle.setBarWidth(this.currentBarWidth);barGraphEngine.createGraphElement(indicatorLayer,correspondingArea,currentSerie,context,correspondingStyle);barGraphEngine.setBarType(savedType);}else if(graphEngine!=null){graphEngine.createGraphElement(indicatorLayer,correspondingArea,currentSerie,context,correspondingStyle);}}}}}}};prototype.createDescriptions=function(indicatorLayer,chartData,chartView,context){var indicators=chartData.getActiveIndicators();var series=chartData.getSeries();this.labelsXPositionsByArea={};var seriesCount=series!=null?series.length:null;for(var i=0;i<seriesCount;i++){var serie=series[i];if(serie!=null&&serie.isEnabled()&&!serie.isEmpty()&&serie.getId()!=YesterdayLine.INDICATOR_ID){var serieName=serie.getName();var currentStock=serie.getStock?serie.getStock():null;if(currentStock!=null&&currentStock.getSymbol()!=null){serieName=currentStock.getSymbol();if(currentStock.getMarketExtension()!=null){serieName+=currentStock.getMarketExtension();}}
if(serieName!=null&&(typeof serieName)!="undefined"){this.addLabel(indicatorLayer,Layout.Position.LEFT,DefaultLayout.GRAPH_AREA,serieName+" ",serie.getColor(),chartView);}}}
var indicatorsCount=indicators!=null?indicators.length:0;for(var i=0;i<indicatorsCount;i++){var indicator=indicators[i];if(indicator!=null){var indicatorPosition=indicator.getAxisPosition();var indicatorArea=indicator.getCorrespondingAreaId();var descriptions=indicator.getDescription();var descCount=descriptions!=null?descriptions.length:0;var separatorIndex=indicatorPosition==Layout.Position.RIGHT?0:descCount-1;for(var index=0;index<descCount;index++){var separator=index==separatorIndex?" ":"";var description=descriptions[index];if(description!=null&&description["text"]!=null){this.addLabel(indicatorLayer,indicatorPosition,indicatorArea,description["text"]+separator,this.volumeLabelColor,chartView);}}}}};prototype.addLabel=function(layer,position,areaId,text,color,chartView){var area=chartView.getArea(areaId);if(area==null||area.getAreaBound()==null||!area.getAreaBound().isVisible()){return;}
var areaBounds=area.getAreaBound();var style=chartView.getStyleModel().getStyle(areaId);var font="Georgia";var fontSize=VolumeGraphEngine.DESCRIPTIONS_LABEL_FONT_SIZE;var bold=false;if(style!=null){font=style.getFont();bold=style.isBoldFont();}
var left=stjs.trunc(areaBounds.getInnerLeft());var right=stjs.trunc(areaBounds.getInnerRight());var top=stjs.trunc(areaBounds.getInnerTop());var labelsXPosition=this.labelsXPositionsByArea[areaId];if(labelsXPosition==null){labelsXPosition={};labelsXPosition[String.valueOf(Layout.Position.LEFT)]=left+1;labelsXPosition[String.valueOf(Layout.Position.RIGHT)]=right-1;labelsXPosition[String.valueOf(Layout.Position.TOP)]=top+VolumeGraphEngine.DESCRIPTIONS_LABEL_Y_MARGIN;this.labelsXPositionsByArea[areaId]=labelsXPosition;}
var currentLeft=labelsXPosition[String.valueOf(Layout.Position.LEFT)];var currentRight=labelsXPosition[String.valueOf(Layout.Position.RIGHT)];var currentTop=labelsXPosition[String.valueOf(Layout.Position.TOP)];var currentRemainingWidth=currentRight-currentLeft;var neededWidth=chartView.getTextWidth(text,font,fontSize,bold);if(currentRemainingWidth<neededWidth){currentLeft=left+1;currentRight=right-1;currentTop=currentTop+fontSize+VolumeGraphEngine.DESCRIPTIONS_LABEL_Y_MARGIN;labelsXPosition[String.valueOf(Layout.Position.LEFT)]=currentLeft;labelsXPosition[String.valueOf(Layout.Position.RIGHT)]=currentRight;labelsXPosition[String.valueOf(Layout.Position.TOP)]=currentTop;}
var labelLeftPos=0;if(position==Layout.Position.RIGHT){currentRight=currentRight-neededWidth;labelLeftPos=currentRight;labelsXPosition[String.valueOf(Layout.Position.RIGHT)]=currentRight;}else{labelLeftPos=currentLeft;labelsXPosition[String.valueOf(Layout.Position.LEFT)]=currentLeft+neededWidth;}
var label=ChartElementFactory.createLabel(layer,null,text,labelLeftPos,currentTop,neededWidth,fontSize+VolumeGraphEngine.DESCRIPTIONS_LABEL_Y_MARGIN);label.setBaseline(Label.BASELINE_TOP);label.setColor(color);label.setBold(bold);label.setFont(font);label.setFontSize(fontSize);area.addElement(label);};prototype.createSignals=function(indicatorLayer,indicators,chartView,context){var indicatorsCount=indicators!=null?indicators.length:0;for(var i=0;i<indicatorsCount;i++){var indicator=indicators[i];if(indicator!=null&&indicator.isHasSignals()&&indicator.getSignals()!=null){var indicatorArea=indicator.getCorrespondingAreaId();var correspondingArea=chartView.getArea(indicatorArea);var correspondingStyle=chartView.getStyleModel().getStyle(indicatorArea);if(correspondingArea!=null&&correspondingArea.getAreaBound()!=null&&correspondingArea.getAreaBound().isVisible()){var signalSerie=indicator.getSignals();SignalsEngine.getInstance().createGraphElement(indicatorLayer,correspondingArea,signalSerie,context,correspondingStyle);}}}};prototype.isShowIndicatorsDescriptions=function(){return this.showIndicatorsDescriptions;};prototype.setShowIndicatorsDescriptions=function(showIndicatorsDescriptions){this.showIndicatorsDescriptions=showIndicatorsDescriptions;};prototype.isShowIndicatorsSignals=function(){return this.showIndicatorsSignals;};prototype.setShowIndicatorsSignals=function(showIndicatorsSignals){this.showIndicatorsSignals=showIndicatorsSignals;};},{labelsXPositionsByArea:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]},volumeColorStrategy:"ColorStrategy",volumeLabelColor:"ChartColor",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},defaultType:{name:"Enum",arguments:["Chart.ChartType"]}},{});
var IndicatorsEngine=function(){DefaultLineGraphEngine.call(this);};IndicatorsEngine=stjs.extend(IndicatorsEngine,DefaultLineGraphEngine,[],null,{instance:"DefaultLineGraphEngine"},{});
var FinancialChartContext=function(){ChartContext.call(this);};FinancialChartContext=stjs.extend(FinancialChartContext,ChartContext,[],function(constructor,prototype){prototype.update=function(data,aggregationStrategy){this.data=data;this.aggregationStrategy=aggregationStrategy;var mainSerie=data.getMainSerie();if(data==null||data.getSerieCount()==0||mainSerie==null){return;}
var series=data.getMainGraphSeries();var yesterdayLine=data.getSerieById(YesterdayLine.INDICATOR_ID);if(yesterdayLine!=null){var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);if(xRange==null){yesterdayLine.setEnabled(true);yesterdayLine.update(mainSerie,data.getExtremums());yesterdayLine.computeChangeValues(Serie.Y);}else{yesterdayLine.update(mainSerie,xRange);yesterdayLine.computeChangeValues(Serie.Y);yesterdayLine.setEnabled(false);}}
var addedReferencePrice=false;if(mainSerie!=null&&mainSerie.isEmpty()&&mainSerie.isIntraday()){addedReferencePrice=true;var startXValue=mainSerie.getStartXValue();var endXValue=mainSerie.getEndXValue();var referenceValue=mainSerie.getReferenceValue();var referencePoint=IntradaySerie.createReferencePricePoint(startXValue,referenceValue);mainSerie.addPoint(0,referencePoint);var referencePoint2=IntradaySerie.createReferencePricePoint(endXValue,referenceValue);mainSerie.addPoint(1,referencePoint2);}
this.updateSeriesContext(series);if(addedReferencePrice){mainSerie.removeAllPoints();}
this.setRange(FinancialLayout.BOTTOM_AXIS_LEFT,[0.0,this.getMax(mainSerie.getId(),FinancialSerie.VOLUME)]);};prototype.setIndicatorsMinMaxInRange=function(range){var extremums=this.data.getExtremums();if(extremums==null){return;}
var startXValue=extremums[0];var endXValue=extremums[1];if(range!=null){var rangeStartXValue=range[0];var rangeEndXValue=range[1];if(!isNaN(rangeStartXValue)&&rangeStartXValue>startXValue&&rangeStartXValue<endXValue){startXValue=rangeStartXValue;}
if(!isNaN(rangeEndXValue)&&rangeEndXValue>startXValue&&rangeEndXValue<endXValue){endXValue=rangeEndXValue;}}
var activeIndicators=this.data.getActiveIndicators();var indicatorsCount=activeIndicators!=null?activeIndicators.length:0;for(var k=0;k<indicatorsCount;k++){var activeIndicator=activeIndicators[k];var indicatorMinValue=Double.POSITIVE_INFINITY;var indicatorMaxValue=Double.NEGATIVE_INFINITY;var serieCount=0;var series=null;if(activeIndicator!=null&&activeIndicator.getSeries()!=null&&activeIndicator.getCorrespondingAreaId()!=DefaultLayout.GRAPH_AREA){series=activeIndicator.getSeries();serieCount=series.length;}
for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var currentSerieMinIndex=currentSerie.findIndexClosestToXValue(startXValue);var currentSerieMaxIndex=currentSerie.findIndexClosestToXValue(endXValue);this.setMinIndex(serieId,currentSerieMinIndex,Serie.X);this.setMaxIndex(serieId,currentSerieMaxIndex,Serie.X);var currentSerieMinXValue=currentSerie.getValue(currentSerieMinIndex,Serie.X);var currentSerieMaxXValue=currentSerie.getValue(currentSerieMaxIndex,Serie.X);this.setMin(serieId,Serie.X,currentSerieMinXValue);this.setMax(serieId,Serie.X,currentSerieMaxXValue);var currentMinValue=Double.POSITIVE_INFINITY;var currentMaxValue=Double.NEGATIVE_INFINITY;for(var j=currentSerieMinIndex;j<=currentSerieMaxIndex;j++){var currentValue=currentSerie.getValueAsDouble(j,Serie.Y);if(currentValue!=null&&!isNaN(currentValue)&&currentValue<currentMinValue){currentMinValue=currentValue;}
if(currentValue!=null&&!isNaN(currentValue)&&currentValue>currentMaxValue){currentMaxValue=currentValue;}}
if(currentMinValue<indicatorMinValue){indicatorMinValue=currentMinValue;}
if(currentMaxValue>indicatorMaxValue){indicatorMaxValue=currentMaxValue;}}}
if(indicatorMinValue!=Double.POSITIVE_INFINITY&&indicatorMaxValue!=Double.NEGATIVE_INFINITY){this.setRange(activeIndicator.getId(),[indicatorMinValue,indicatorMaxValue]);}}};prototype.setSeriesMinMaxInRange=function(range,series){var globalPercentChanges=ChartContext.prototype.setSeriesMinMaxInRange.call(this,range,series);if(globalPercentChanges==null){return null;}
this.setIndicatorsMinMaxInRange(range);var mainSerie=this.data.getMainSerie();if(mainSerie!=null&&mainSerie.isEnabled()){var serieId=mainSerie.getId();var mainSerieMinIndex=this.getMinIndex(serieId,Serie.X);var mainSerieMaxIndex=this.getMaxIndex(serieId,Serie.X);var volumeMax=0;for(var j=mainSerieMinIndex;j<=mainSerieMaxIndex;j++){var currentVolumeValue=mainSerie.getValueAsInteger(j,FinancialSerie.VOLUME);if(currentVolumeValue!=null&&!isNaN(currentVolumeValue)&&currentVolumeValue>volumeMax){volumeMax=currentVolumeValue;}}
this.setMin(serieId,FinancialSerie.VOLUME,0);this.setMax(serieId,FinancialSerie.VOLUME,volumeMax);}
return globalPercentChanges;};prototype.adjustIndicatorsRange=function(){var activeIndicators=this.data.getActiveIndicators();var indicatorsCount=activeIndicators!=null?activeIndicators.length:0;for(var k=0;k<indicatorsCount;k++){var activeIndicator=activeIndicators[k];var currentIndicatorRange=this.getRange(activeIndicator.getId());var serieCount=0;var series=null;var indicatorMinValue=0;var indicatorMaxValue=0;if(activeIndicator!=null&&activeIndicator.getSeries()!=null&&currentIndicatorRange!=null&&currentIndicatorRange[0]!=null&&currentIndicatorRange[1]!=null){series=activeIndicator.getSeries();serieCount=series.length;indicatorMinValue=currentIndicatorRange[0];indicatorMaxValue=currentIndicatorRange[1];}
for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();this.setMin(serieId,Serie.Y,indicatorMinValue);this.setMax(serieId,Serie.Y,indicatorMaxValue);}}}};prototype.adjustY1Range=function(newY1Range){var newY1Min=newY1Range!=null?newY1Range[0]:null;var newY1Max=newY1Range!=null?newY1Range[1]:null;if(newY1Min!=null&&newY1Max!=null){var referenceValue=this.data.getMainSerie().getReferenceValue();this.adjustRefValue=referenceValue!=0.0?referenceValue:1.0;var adjustedMinPercent=100.0*(newY1Min-this.adjustRefValue)/Math.abs(this.adjustRefValue);var adjustedMaxPercent=100.0*(newY1Max-this.adjustRefValue)/Math.abs(this.adjustRefValue);this.setRange(DefaultLayout.Y1_AXIS_AREA,[newY1Min,newY1Max]);this.setRange(DefaultLayout.Y2_AXIS_AREA,[adjustedMinPercent,adjustedMaxPercent]);}
this.adjustSeriesMinMax(this.data.getMainGraphSeries());var yesterdayLine=this.data.getSerieById(YesterdayLine.INDICATOR_ID);var y2Range=this.getRange(DefaultLayout.Y2_AXIS_AREA);if(yesterdayLine!=null&&y2Range!=null&&newY1Min!=null&&newY1Max!=null){var min=y2Range[0];var max=y2Range[1];if(min!=null&&max!=null&&min<=0.0&&max>=0.0){yesterdayLine.setEnabled(true);this.setMin(yesterdayLine.getId(),yesterdayLine.getMainField(),newY1Min);this.setMax(yesterdayLine.getId(),yesterdayLine.getMainField(),newY1Max);}}};prototype.adjustY2Range=function(newY2Range){if(newY2Range!=null){this.setRange(DefaultLayout.Y2_AXIS_AREA,[newY2Range[0],newY2Range[1]]);}
this.adjustSeriesMinMax(this.data.getMainGraphSeries());};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},currentPosition:"Point2D",ranges:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},labelsPosition:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},formats:{name:"Map",arguments:[null,null]},seriesMinValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMaxValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMinIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]},seriesMaxIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]}},{});
var FinancialEngineModel=function(){DefaultEngineModel.call(this);this.fContext=new FinancialChartContext();this.context=this.fContext;};FinancialEngineModel=stjs.extend(FinancialEngineModel,DefaultEngineModel,[],function(constructor,prototype){prototype.bottomLeftAxisEngine=null;prototype.bottomRightAxisEngine=null;prototype.delimiterEngine=null;prototype.volumeAggregationStrategy=null;prototype.volumeField=null;prototype.fContext=null;prototype.showYesterdayLine=false;prototype.options=null;constructor.COLORS_ARRAY=[ChartColor.orange,ChartColor.black,ChartColor.blue,ChartColor.kaki,ChartColor.cyan,ChartColor.brown,ChartColor.salmon,ChartColor.yellow,ChartColor.darkGrey,ChartColor.grey,ChartColor.lightBlue,ChartColor.lightGrey];prototype.init=function(options){DefaultEngineModel.prototype.init.call(this,options);this.options=options;this.volumeField=FinancialSerie.VOLUME;this.aggregationStrategy=AggregationStrategy.MAX;this.showYesterdayLine=options.isShowYesterday();this.titleEngine=new FinancialTitleEngine(options);this.xAxisEngine=new FinancialXAxisEngine(options);this.legendEngine=new FinancialLegendEngine(options);this.bottomLeftAxisEngine=new VolumeAxisEngine(options,FinancialLayout.BOTTOM_AXIS_LEFT,Layout.Position.LEFT);this.bottomRightAxisEngine=new VolumeAxisEngine(options,FinancialLayout.BOTTOM_AXIS_RIGHT,Layout.Position.RIGHT);this.delimiterEngine=new DefaultDelimiterEngine(options);this.graphEngine=new VolumeGraphEngine(options);if(options!=null){var customEngineModel=options.getCustomEngineModel();if(customEngineModel!=null){if((customEngineModel)["init"]!=null){options.setCustomeEngineModel(null);customEngineModel.init(options);options.setCustomeEngineModel(customEngineModel);}
var validEngines={};var tmp={};this.extendEngine(customEngineModel,validEngines,"titleEngine");this.extendEngine(customEngineModel,validEngines,"xAxisEngine");this.extendEngine(customEngineModel,validEngines,"y1AxisEngine");this.extendEngine(customEngineModel,validEngines,"y2AxisEngine");this.extendEngine(customEngineModel,validEngines,"graphEngine");this.extendEngine(customEngineModel,validEngines,"legendEngine");this.extendEngine(customEngineModel,validEngines,"tooltipEngine");if(options.isAllowOverlayDrawing()){this.extendEngine(customEngineModel,validEngines,"drawEngine");}
this.extendEngine(customEngineModel,validEngines,"bottomLeftAxisEngine");this.extendEngine(customEngineModel,validEngines,"bottomRightAxisEngine");this.extendEngine(customEngineModel,validEngines,"delimiterEngine");SQW.$.extend(true,tmp,customEngineModel,validEngines);SQW.$.extend(true,this,tmp);}}
this.engines[DefaultLayout.TITLE_AREA]=this.titleEngine;this.engines[DefaultLayout.X_AXIS_AREA]=this.xAxisEngine;this.engines[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisEngine;this.engines[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisEngine;this.engines[DefaultLayout.GRAPH_AREA]=this.graphEngine;this.engines[DefaultLayout.LEGEND_AREA]=this.legendEngine;this.engines[DefaultLayout.TOOLTIP_AREA]=this.tooltipEngine;this.engines[DrawEngine.ID]=this.drawEngine;this.engines[FinancialLayout.BOTTOM_AXIS_LEFT]=this.bottomLeftAxisEngine;this.engines[FinancialLayout.BOTTOM_AXIS_RIGHT]=this.bottomRightAxisEngine;this.engines[FinancialLayout.DELIMITER_AREA]=this.delimiterEngine;};prototype.extend=function(options){};prototype.updateRange=function(xRange,chartView,chartData){this.context.setRange(DefaultLayout.X_AXIS_AREA,xRange);this.setupSeriesColor(chartData);if(this.showYesterdayLine&&chartData.isIntraday()){var yesterdayLine=chartData.getSerieById(YesterdayLine.INDICATOR_ID);if(yesterdayLine==null){var yesterdayLineColor=ChartColor.orange;var yesterdayLineDashed=true;if(this.options!=null){yesterdayLineColor=this.options.getYesterdayLineColor();yesterdayLineDashed=this.options.isYesterdayLineDashed();}
yesterdayLine=new YesterdayLine(chartData.getMainSerie(),xRange,yesterdayLineColor,yesterdayLineDashed);chartData.addSerie(yesterdayLine);}
yesterdayLine.update(chartData.getMainSerie(),xRange);}else if(chartData.getSerieById(YesterdayLine.INDICATOR_ID)!=null){chartData.removeSerie(YesterdayLine.INDICATOR_ID);}
if(!chartData.isIntraday()&&xRange!=null&&xRange[0]!=null&&xRange[1]!=null){var serieCount=chartData.getSerieCount();for(var i=0;i<serieCount;i++){var serie=chartData.getSerie(i);if(serie!=null){serie.setForcedInterval(xRange[0],xRange[1]);}}}
chartData.updateContextDependentIndicators();this.context.update(chartData,this.aggregationStrategy);this.setCustomMinMaxAxis(chartData.getMainSerie());var styleModel=chartView.getStyleModel();if(chartData.isActiveIndicator(IndicatorsManager.VOLUME_INDICATOR_ID)&&chartData.getActiveIndicatorSerie("Volume")!=null){var bottomLeftAxisStyle=styleModel.getStyle(FinancialLayout.BOTTOM_AXIS_LEFT);bottomLeftAxisStyle.setVisible(true);var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var bottomAxisLeft=this.engines[FinancialLayout.BOTTOM_AXIS_LEFT];bottomAxisLeft.computePrettyLabels(volumeGraphArea,this.context.getRange(FinancialLayout.BOTTOM_AXIS_LEFT),0,bottomLeftAxisStyle,false);this.context.setRange(FinancialLayout.BOTTOM_AXIS_LEFT,bottomAxisLeft.getRange());this.context.setLabelsPosition(FinancialLayout.BOTTOM_AXIS_LEFT,bottomAxisLeft.getLabelsPosition());this.context.setFormat(FinancialLayout.BOTTOM_AXIS_LEFT,"0");if(bottomAxisLeft.getRange()!=null){this.context.setMin(chartData.getMainSerie().getId(),FinancialSerie.VOLUME,bottomAxisLeft.getRange()[0]);this.context.setMax(chartData.getMainSerie().getId(),FinancialSerie.VOLUME,bottomAxisLeft.getRange()[1]);}}else{this.adjustBottomAxis(FinancialLayout.BOTTOM_AXIS_LEFT,chartView,chartData);}
this.adjustBottomAxis(FinancialLayout.BOTTOM_AXIS_RIGHT,chartView,chartData);var layout=chartView.getLayout();if(layout.setShowBottomGraph&&layout.isShowBottomGraph){var bottomGraphStyle=styleModel.getStyle(FinancialLayout.BOTTOM_GRAPH_AREA);if(bottomGraphStyle!=null&&!bottomGraphStyle.isVisible()){if(layout.isShowBottomGraph()){layout.setShowBottomGraph(false);chartView.refreshLayout();}}else if(!chartData.isEmpty()&&chartData.hasValidBottomIndicators()){if(!layout.isShowBottomGraph()){layout.setShowBottomGraph(true);chartView.refreshLayout();}}else if(layout.isShowBottomGraph()){layout.setShowBottomGraph(false);chartView.refreshLayout();}}
var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var mainYAxis=this.engines[DefaultLayout.Y1_AXIS_AREA];var step=mainYAxis.computePrettyLabels(graphArea,this.context.getRange(DefaultLayout.Y1_AXIS_AREA),this.context.getPrecision(),chartView.getStyleModel().getY1AxisStyle(),chartData.isLogScale());if(chartData.isMainCurrency()){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));this.context.setFormat(FinancialLayout.BOTTOM_AXIS_RIGHT,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));}else if(chartData.isSwissDots()){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_3_DECIMALS));}else if(step==1||step>=5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.NO_DECIMALS));}else if(step==0.1||step>=0.5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_1_DECIMAL));}else if(step>=0.01||ArrayUtil.getRangeSpan(mainYAxis.getRange())>=0.01){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_2_DECIMALS));}else{this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));this.context.setFormat(FinancialLayout.BOTTOM_AXIS_RIGHT,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));}
if(chartData.getMainSerie()!=null&&(chartData.getMainSerie()).isIntraday()){this.context.setFormat(DefaultLayout.X_AXIS_AREA,DateTimeFormatter.FORMAT_TIME);}else{this.context.setFormat(DefaultLayout.X_AXIS_AREA,DateTimeFormatter.FORMAT_DATE);}
if(step!=null){this.context.adjustY1Range(mainYAxis.getRange());this.context.setLabelsPosition(DefaultLayout.Y1_AXIS_AREA,mainYAxis.getLabelsPosition());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,mainYAxis.getLabelsPosition());}else{var y2Axis=this.engines[DefaultLayout.Y2_AXIS_AREA];y2Axis.setRange(this.context.getRange(DefaultLayout.Y2_AXIS_AREA));this.context.adjustY2Range(y2Axis.getRange());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,y2Axis.getLabelsPosition());}
(this.context).adjustIndicatorsRange();for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.update(chartView,chartData,this.context);}}};prototype.adjustBottomAxis=function(axisId,chartView,chartData){var styleModel=chartView.getStyleModel();var correspondingBottomAxisStyle=styleModel.getStyle(axisId);var correspondingBottomAxis=this.engines[axisId];var bottomGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);if(correspondingBottomAxisStyle!=null&&correspondingBottomAxis!=null&&bottomGraphArea!=null){var axisPos=correspondingBottomAxisStyle.getPosition();var correspondingIndicators=chartData.getActiveIndicatorsAssociatedWith(FinancialLayout.BOTTOM_GRAPH_AREA,axisPos);if(correspondingIndicators!=null&&correspondingIndicators[0]!=null){var correspondingIndicator=correspondingIndicators[0];var indicatorId=correspondingIndicator.getId();correspondingBottomAxisStyle.setVisible(true);var step=correspondingBottomAxis.computePrettyLabels(bottomGraphArea,this.context.getRange(indicatorId),this.context.getPrecision(),correspondingBottomAxisStyle,false);this.context.setRange(axisId,correspondingBottomAxis.getRange());this.context.setRange(indicatorId,correspondingBottomAxis.getRange());this.context.setLabelsPosition(axisId,correspondingBottomAxis.getLabelsPosition());if(step==1||step>=5){this.context.setFormat(axisId,String.valueOf(AbbreviateNumberFormatter.NO_DECIMALS));}else{this.context.setFormat(axisId,String.valueOf(AbbreviateNumberFormatter.EXACTLY_2_DECIMALS));}
if(correspondingBottomAxis.getRange()!=null){this.context.setMin(indicatorId,Serie.Y,correspondingBottomAxis.getRange()[0]);this.context.setMax(indicatorId,Serie.Y,correspondingBottomAxis.getRange()[1]);}}else{correspondingBottomAxisStyle.setVisible(false);}}else if(correspondingBottomAxisStyle!=null){correspondingBottomAxisStyle.setVisible(false);}};prototype.setupSeriesColor=function(chartData){var mainSerie=chartData.getMainSerie();if(mainSerie==null){return;}else{var seriesCount=chartData.getSerieCount();for(var i=1;i<seriesCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){currentSerie.setColor(FinancialEngineModel.COLORS_ARRAY[i%FinancialEngineModel.COLORS_ARRAY.length]);currentSerie.setColorStrategy(null);}}}};prototype.createInteractiveGraphics=function(chartView,data){var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var volumeGraphAreaBound=volumeGraphArea.getAreaBound();var titleEngine=this.engines[DefaultLayout.TITLE_AREA];var mainSerie=data.getMainSerie();var mainField=mainSerie!=null?mainSerie.getMainField():"";if(volumeGraphArea!=null&&volumeGraphAreaBound!=null&&volumeGraphAreaBound.isVisible()&&volumeGraphArea.isPointInside(this.context.getCurrentPosition())){titleEngine.setAssociatedGraphId(FinancialLayout.BOTTOM_GRAPH_AREA);titleEngine.setAssociatedAxisId(FinancialLayout.BOTTOM_AXIS_LEFT);}else{titleEngine.setAssociatedGraphId(DefaultLayout.GRAPH_AREA);titleEngine.setAssociatedAxisId(DefaultLayout.Y1_AXIS_AREA);}
DefaultEngineModel.prototype.createInteractiveGraphics.call(this,chartView,data);};prototype.updateXType=function(xType){};},{bottomLeftAxisEngine:"AxisEngine",bottomRightAxisEngine:"AxisEngine",delimiterEngine:"Engine",volumeAggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},fContext:"FinancialChartContext",options:"ChartOption",COLORS_ARRAY:{name:"Array",arguments:["ChartColor"]},aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},customMainAxisMinMax:{name:"Array",arguments:[null]},context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
var CompareBoxPopover=function(compareCallback,startYear,endYear){this.compareCallback=compareCallback;this.box=$(window.document.createElement("div"));this.box.addClass(CompareBoxPopover.COMPARE_BOX_CSS_CLASS);var choosersContainer=$(window.document.createElement("div"));choosersContainer.addClass(CompareBoxPopover.CHOOSERS_CSS_CLASS);var titleChooserContainer=$(window.document.createElement("div"));titleChooserContainer.addClass(CompareBoxPopover.TITLE_CHOOSER_CSS_CLASS);var titleChooserTitle=$(window.document.createElement("div"));titleChooserTitle.addClass(CompareBoxPopover.CHOOSERS_TITLE_CSS_CLASS);titleChooserTitle.text(ChartMessagesRepository.getInstance().get("compareWith")+" :");var titleChooserContent=$(window.document.createElement("div"));titleChooserContent.addClass(CompareBoxPopover.TITLE_CHOOSER_SELECTION_CSS_CLASS);var c1Container=$(window.document.createElement("div"));c1Container.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var title1=$(window.document.createElement("span"));title1.text(ChartMessagesRepository.getInstance().get("title")+" 1");title1.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);var inputContainer=$(window.document.createElement("div"));this.stockSearch1=new GeneralStockSearch(inputContainer,SqwStockSearchOptions.getDefault());c1Container.append(title1);c1Container.append(inputContainer);var c2Container=this.createCompareElement(ChartMessagesRepository.getInstance().get("title")+" 2");titleChooserContent.append(c1Container);titleChooserContent.append(c2Container);titleChooserContainer.append(titleChooserTitle);titleChooserContainer.append(titleChooserContent);var periodChooserContainer=$(window.document.createElement("div"));periodChooserContainer.addClass(CompareBoxPopover.PERIOD_CHOOSER_CSS_CLASS);var periodChooserTitle=$(window.document.createElement("div"));periodChooserTitle.addClass(CompareBoxPopover.CHOOSERS_TITLE_CSS_CLASS);periodChooserTitle.text(ChartMessagesRepository.getInstance().get("definePeriod")+" :");var periodChooserContent=$(window.document.createElement("div"));periodChooserContent.addClass(CompareBoxPopover.PERIOD_CHOOSER_SELECTION_CSS_CLASS);var fromContainer=$(window.document.createElement("div"));fromContainer.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var fromPrefix=$(window.document.createElement("span"));fromPrefix.text(ChartMessagesRepository.getInstance().get("from"));fromPrefix.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);this.fromDatepicker=new DatePicker(startYear,endYear);fromContainer.append(fromPrefix);fromContainer.append(this.fromDatepicker.getElement());var toContainer=$(window.document.createElement("div"));toContainer.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var toPrefix=$(window.document.createElement("span"));toPrefix.text(ChartMessagesRepository.getInstance().get("to"));toPrefix.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);this.toDatepicker=new DatePicker(startYear,endYear);toContainer.append(toPrefix);toContainer.append(this.toDatepicker.getElement());periodChooserContent.append(fromContainer);periodChooserContent.append(toContainer);periodChooserContainer.append(periodChooserTitle);periodChooserContainer.append(periodChooserContent);var bottomContainer=$(window.document.createElement("div"));bottomContainer.addClass(CompareBoxPopover.BOTTOM_CSS_CLASS);var drawButton=$(window.document.createElement("button"));drawButton.addClass(CompareBoxPopover.DRAW_BUTTON_CSS_CLASS);drawButton.text(ChartMessagesRepository.getInstance().get("draw"));var self=this;var openTest=stjs.bind(this,function(ev,THIS){var stocks=[self.getStock1(),self.getStock2()];var period=[self.getFrom(),self.getTo()];self.compareCallback(stocks,period);return false;},1);drawButton.on("click",openTest);bottomContainer.append(drawButton);choosersContainer.append(titleChooserContainer);choosersContainer.append(periodChooserContainer);this.box.append(choosersContainer);this.box.append(bottomContainer);};CompareBoxPopover=stjs.extend(CompareBoxPopover,null,[],function(constructor,prototype){constructor.ALL_STOCKTYPES="share,index,currency,warrant,etf,commodity,bond";constructor.COMPARE_BOX_CSS_CLASS="compare-box";constructor.CHOOSERS_CSS_CLASS="choosers-container";constructor.TITLE_CHOOSER_CSS_CLASS="title-chooser";constructor.PERIOD_CHOOSER_CSS_CLASS="period-chooser";constructor.TITLE_CHOOSER_SELECTION_CSS_CLASS="title-chooser-content";constructor.PERIOD_CHOOSER_SELECTION_CSS_CLASS="period-chooser-content";constructor.DRAW_BUTTON_CSS_CLASS="compare-draw-button";constructor.CHOOSERS_TITLE_CSS_CLASS="chooser-title";constructor.CHOOSER_ELEMENT_CSS_CLASS="chooser-element";constructor.CHOOSER_ELEMENT_TITLE_CSS_CLASS="chooser-element-title";constructor.BOTTOM_CSS_CLASS="compare-box-button-container";prototype.box=null;prototype.stockSearch1=null;prototype.stockSearch2=null;prototype.fromDatepicker=null;prototype.toDatepicker=null;prototype.compareCallback=null;prototype.createCompareElement=function(prefixTitle){var compareContainer=$(window.document.createElement("div"));compareContainer.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var compareElementTitle=$(window.document.createElement("span"));compareElementTitle.text(prefixTitle);compareElementTitle.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);var stockSearchContainer=$(window.document.createElement("div"));this.stockSearch2=new GeneralStockSearch(stockSearchContainer,SqwStockSearchOptions.getDefault());compareContainer.append(compareElementTitle);compareContainer.append(stockSearchContainer);return compareContainer;};prototype.getBox=function(){return this.box;};prototype.getStock1=function(){return this.stockSearch1.getSelectedStock();};prototype.getStock2=function(){return this.stockSearch2.getSelectedStock();};prototype.getFrom=function(){if(this.fromDatepicker!=null){return this.fromDatepicker.getSelectedDate();}else{return null;}};prototype.getTo=function(){if(this.toDatepicker!=null){return this.toDatepicker.getSelectedDate();}else{return null;}};prototype.blur=function(){this.stockSearch1.close(null,null);this.stockSearch1.setSelectedStock(null);this.stockSearch2.close(null,null);this.stockSearch2.setSelectedStock(null);};prototype.setPeriod=function(minXValue,maxXValue){this.fromDatepicker.selectDateTime(minXValue);this.toDatepicker.selectDateTime(maxXValue);};prototype.show=function(){this.box.show();};prototype.hide=function(){this.box.hide();};},{box:"SqwJQuery",stockSearch1:"GeneralStockSearch",stockSearch2:"GeneralStockSearch",fromDatepicker:"DatePicker",toDatepicker:"DatePicker",compareCallback:{name:"Callback2",arguments:[{name:"Array",arguments:["Stock"]},{name:"Array",arguments:["Date"]}]}},{});
var GeneralStockSearch=function(container,options){SqwStockSearch.call(this,container,options,ServerRequest.getBaseURL());var servletUrl=ServerRequest.getBaseURL()+ServerRequest.WEB_SERVICE_PREFIX_URL;servletUrl+="MetaSearchServlet?";if(options.stockTypes!=null){servletUrl+="stocktypes="+options.stockTypes+"&";}
var that=this;this.simpleUrl=servletUrl;this.clickHandler=stjs.bind(this,function(ev,THIS){var stockSearch=that.container.get(0);if(!SQW.$.contains(stockSearch,ev.target)&&!SQW.$(ev.target).is(stockSearch)){that.selectedStock=null;that.close(null,null);if(that.options.selectCallback!=null){that.options.selectCallback(null);}
return true;}
var row=SQW.$(ev.target).closest("tr");if(row.size()>0&&SQW.$.contains(stockSearch,row.get(0))){that.close(row.data("searchResult"),row.data("stockKey"));that.selectedStock=row.data("stock");if(that.options.selectCallback!=null){that.options.selectCallback(that.selectedStockKey);}
return false;}
return true;},1);};GeneralStockSearch=stjs.extend(GeneralStockSearch,SqwStockSearch,[],function(constructor,prototype){prototype.simpleUrl=null;prototype.selectedStock=null;prototype.currencySearch=false;prototype.keyboardSelect=function(){if(this.selectedResultIndex>0){var row=this.results.find("tr:nth-child("+this.selectedResultIndex+")");if(row.size()>0){this.close(row.data("searchResult"),row.data("stockKey"));this.selectedStock=row.data("stock");if(this.options.selectCallback!=null){this.options.selectCallback(this.selectedStockKey);}}}};prototype.search=function(){var currentVal=this.input.val();if(currentVal!=null&&(currentVal.indexOf("_")!=-1||currentVal.indexOf("/")!=-1)){this.url=this.simpleUrl+"count=10&market=cu&";this.currencySearch=true;}else{this.url=this.simpleUrl+"count=20&market=&";this.currencySearch=false;}
this.selectedStock=null;SqwStockSearch.prototype.search.call(this);};prototype.getSelectedStock=function(){return this.selectedStock;};prototype.setSelectedStock=function(stock){this.selectedStock=stock;};prototype.getSuccessCallback=function(){var that=this;var currentSearchCallbackId=this.searchId;return function(response,status,jqxhr){if(currentSearchCallbackId!=that.searchId){return;}
var searchResults=response["results"];var table=null;if(!that.currencySearch){table=that.createResultTable(searchResults);}else{table=that.createCurrencyResultTable(searchResults);}
that.results.html("");if(searchResults.length>0){that.results.append(table);that.displayResults();}else{that.results.hide();}};};prototype.createCurrencyResultTable=function(searchResults){var table=SQW.$("<table/>");var currencies=[];var keys=[];var index=-1;for(var i=0;i<searchResults.length;i++){var r1=new SqwStockSearchResult(searchResults[i]);var r2=new SqwStockSearchResult(searchResults[i]);var key=SqwStockSearch.createKey(r1.getIsin(),r1.getStockExchangeId(),r1.getCurrency());var currencyStock=Stock.stockSearchResult2Stock(key,r1);if(currencyStock!=null){var row1=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(r1.getSymbol(),this.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(r1.getName(),this.previousInputValue)+"</td>"+"<td class='market'>"+r1.getMarketName()+"</td>"+"<td class='currency'>"+r1.getCurrency()+"<img src=\"/gifs/flag_"+r1.getCurrency()+".gif\"></td>"+"</tr>");row1.data("stockKey",key);row1.data("searchResult",r1);row1.data("stock",currencyStock);currencies[++index]=row1;keys[index]=key;var inverseCurr=currencyStock.getInverseCurrency();if(inverseCurr!=null){r2.setCurrency(inverseCurr.getCurrency());r2.setSymbol(inverseCurr.getSymbol());r2.setName(inverseCurr.getName());r2.setIsin(inverseCurr.getIsin());var row2=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(inverseCurr.getSymbol(),this.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(inverseCurr.getName(),this.previousInputValue)+"</td>"+"<td class='market'>"+inverseCurr.getMarketName()+"</td>"+"<td class='currency'>"+inverseCurr.getCurrency()+"<img src=\"/gifs/flag_"+inverseCurr.getCurrency()+".gif\"></td>"+"</tr>");row2.data("stockKey",inverseCurr.getKey());row2.data("searchResult",r2);row2.data("stock",inverseCurr);currencies[++index]=row2;keys[index]=inverseCurr.getKey();}}}
var uniqueKeys=SQW.utils.array.unique(keys);for(var i=0;i<uniqueKeys.length;i++){table.append(this.getRow(currencies,uniqueKeys[i]));}
return table;};prototype.getRow=function(currencies,key){for(var i=0;i<currencies.length;i++){var currency=currencies[i];if(currency.data("stockKey").equals(key)){return currency;}}
return null;};prototype.createResultTable=function(searchResults){var table=SQW.$("<table/>");for(var i=0;i<searchResults.length;i++){var r=new SqwStockSearchResult(searchResults[i]);var key=SqwStockSearch.createKey(r.getIsin(),r.getStockExchangeId(),r.getCurrency());var row=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(r.getSymbol(),this.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(r.getName(),this.previousInputValue)+"</td>"+"<td class='market'>"+r.getMarketName()+"</td>"+"<td class='currency'>"+r.getCurrency()+"<img src=\"/gifs/flag_"+r.getCurrency()+".gif\"></td>"+"</tr>");row.data("stockKey",key);row.data("searchResult",r);row.data("stock",Stock.stockSearchResult2Stock(key,r));table.append(row);}
return table;};},{selectedStock:"Stock",container:"SqwJQuery",input:"SqwJQuery",results:"SqwJQuery",options:"SqwStockSearchOptions",interval:"TimeoutHandler",clickHandler:"EventHandler",arrowHandler:"EventHandler",clearKeyboardSelection:"EventHandler",selectedSearchResult:"SqwStockSearchResult"},{});
var DatePicker=function(startYear,endYear){this.datepicker=$(window.document.createElement("span"));this.minDate=new Date();this.minDate.setMilliseconds(0);this.minDate.setSeconds(0);this.minDate.setMinutes(0);this.minDate.setHours(0);this.minDate.setDate(1);this.minDate.setMonth(0);this.minDate.setFullYear(startYear);this.maxDate=new Date();this.maxDate.setMilliseconds(0);this.maxDate.setSeconds(0);this.maxDate.setMinutes(0);this.maxDate.setHours(0);this.maxDate.setDate(31);this.maxDate.setMonth(11);this.maxDate.setFullYear(endYear);this.dayPicker=this.createSelectElement(1,31);this.monthPicker=this.createSelectElement(1,12);this.yearPicker=this.createSelectElement(startYear,endYear);this.datepicker.append(this.dayPicker);this.datepicker.append(this.monthPicker);this.datepicker.append(this.yearPicker);};DatePicker=stjs.extend(DatePicker,null,[],function(constructor,prototype){prototype.datepicker=null;prototype.dayPicker=null;prototype.monthPicker=null;prototype.yearPicker=null;prototype.minDate=null;prototype.maxDate=null;prototype.getElement=function(){return this.datepicker;};prototype.addClass=function(classId){this.datepicker.addClass(classId);};prototype.createSelectElement=function(from,to){var selectElement=$(window.document.createElement("select"));if(from==null||to==null||isNaN(from)||isNaN(to)||from>to){return selectElement;}
for(var i=from;i<=to;i++){var currentOption=$(window.document.createElement("option"));currentOption.val(i);var text=String.valueOf(i);if(i<10){text="0"+text;}
currentOption.text(text);selectElement.append(currentOption);}
return selectElement;};prototype.getSelectedDate=function(){var dayElement=this.dayPicker.find(":selected");var monthElement=this.monthPicker.find(":selected");var yearElement=this.yearPicker.find(":selected");if(dayElement==null||monthElement==null||yearElement==null){return null;}
var day=parseInt(dayElement.text());var month=parseInt(monthElement.text());var year=parseInt(yearElement.text());if(day==null||month==null||year==null||isNaN(day)||isNaN(month)||isNaN(year)){return null;}
var date=new Date();date.setMilliseconds(0);date.setSeconds(0);date.setMinutes(0);date.setHours(0);date.setFullYear(year);date.setMonth(month-1);date.setDate(day);return date;};prototype.selectDateTime=function(timeValue){if(timeValue!=null){this.selectDate(DateUtil.createDate(timeValue));}};prototype.selectDate=function(toSelect){if(toSelect!=null){var day=stjs.trunc(toSelect.getDate());var month=stjs.trunc(toSelect.getMonth());var year=stjs.trunc(toSelect.getFullYear());this.dayPicker.val(day);this.monthPicker.val(month+1);this.yearPicker.val(year);}};},{datepicker:"SqwJQuery",dayPicker:"SqwJQuery",monthPicker:"SqwJQuery",yearPicker:"SqwJQuery",minDate:"Date",maxDate:"Date"},{});
var PeriodChooser=function(aTools){this.periodElements={};this.container=this.createPeriodsContainer(aTools);};PeriodChooser=stjs.extend(PeriodChooser,null,[],function(constructor,prototype){constructor.POPOVER_PERIODS_CSS_CLASS="chart-popover-periods-container";constructor.POPOVER_PERIODS_ELEMENT_CSS_CLASS="chart-popover-periods-element";constructor.POPOVER_PERIODS_SELECTED_ELEMENT_CSS_CLASS="chart-popover-periods-selected-element";prototype.container=null;prototype.periodElements=null;prototype.selectedPeriod=null;prototype.getContainer=function(){return this.container;};prototype.isClickable=function(period){if(period!=null){return this.selectedPeriod!=period.toString();}else{return false;}};prototype.selectPeriod=function(period){if(this.selectedPeriod!=null){this.unselect(this.selectedPeriod);}
if(period!=null){this.selectedPeriod=period.toString();this.select(this.selectedPeriod);}else{this.selectedPeriod=null;}};prototype.select=function(periodParam){var element=this.periodElements[periodParam];if(element!=null){element.removeClass(PeriodChooser.POPOVER_PERIODS_ELEMENT_CSS_CLASS);element.addClass(PeriodChooser.POPOVER_PERIODS_SELECTED_ELEMENT_CSS_CLASS);}};prototype.unselect=function(periodParam){var element=this.periodElements[periodParam];if(element!=null){element.removeClass(PeriodChooser.POPOVER_PERIODS_SELECTED_ELEMENT_CSS_CLASS);element.addClass(PeriodChooser.POPOVER_PERIODS_ELEMENT_CSS_CLASS);}};prototype.createPeriodsContainer=function(aTools){var container=SQW.$(window.document.createElement("div"));container.addClass(PeriodChooser.POPOVER_PERIODS_CSS_CLASS);var messagesRepo=ChartMessagesRepository.getInstance();this.createPeriodListElement(container,messagesRepo.get("intraday"),aTools,"live",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("1week"),aTools,"5days","1minute");this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("1month"),aTools,"month",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("6months"),aTools,"6months",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("1year"),aTools,"year",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("maximum"),aTools,"maximum",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("YTD"),aTools,"yearToDate",null);return container;};prototype.addTextToElement=function(parent,text){if(parent==null){return;}
var textNode=window.document.createTextNode(text);parent.append(textNode);};prototype.createPeriodListElement=function(parent,text,aTools,periodParam,freqParam){if(parent==null){return;}
var element=SQW.$(window.document.createElement("span"));element.addClass(PeriodChooser.POPOVER_PERIODS_ELEMENT_CSS_CLASS);element.text(text);var period=Period.getInstance(periodParam,null);var self=this;var onClickHandler=stjs.bind(this,function(ev,THIS){if(self.isClickable(period)){self.selectPeriod(period);aTools.selectPeriod(periodParam,freqParam);}
return false;},1);element.on("click",onClickHandler);this.periodElements[period.toString()]=element;parent.append(element);};prototype.show=function(){this.container.show();};prototype.hide=function(){this.container.hide();};},{container:"SqwJQuery",periodElements:{name:"Map",arguments:[null,"SqwJQuery"]}},{});
var FinancialPopover=function(){this.pageReloadDelayed=false;this.customPeriod=false;this.currentChartContainerHeight=-1;this.overlay=SQW.$(window.document.createElement("div"));this.overlay.addClass(FinancialPopover.POPOVER_OVERLAY_CSS_CLASS);this.overlay.on("click",this.getOnCloseEventHandler());this.closeBox=SQW.$(window.document.createElement("div"));this.closeBox.addClass(FinancialPopover.POPOVER_CLOSE_BOX_CSS_CLASS);this.closeBox.on("click",this.getOnCloseEventHandler());this.atoolsContainer=SQW.$(window.document.createElement("div"));this.atoolsContainer.addClass(FinancialPopover.POPOVER_WINDOW_CSS_CLASS);this.periodChooser=new PeriodChooser(this);this.periodsContainer=this.periodChooser.getContainer();this.wrapperElement=SQW.$(window.document.createElement("div"));this.wrapperElement.addClass(FinancialPopover.POPOVER_WRAPPER_CSS_CLASS);this.wrapperElement.append(this.overlay);this.wrapperElement.append(this.atoolsContainer);this.hide();SQW.$(window.document.body).append(this.wrapperElement);SQW.$(window).resize(this.getOnResizeEventHandler());this.centerContainer();this.atoolsContainer.append(this.closeBox);this.addChart(FinancialPopover.POPOVER_CHART_PARENT_CSS_CLASS);this.atoolsContainer.append(this.periodsContainer);var now=new Date();this.compareBox=new CompareBoxPopover(this.getCompareCallback(),1998,parseInt(now.getFullYear()));this.atoolsContainer.append(this.compareBox.getBox());};FinancialPopover=stjs.extend(FinancialPopover,null,[PopOver,Observer],function(constructor,prototype){constructor.POPOVER_OVERLAY_CSS_CLASS="chart-popover-overlay";constructor.POPOVER_WINDOW_CSS_CLASS="chart-popover-window";constructor.POPOVER_CHART_PARENT_CSS_CLASS="chart-popover-parent";constructor.POPOVER_WRAPPER_CSS_CLASS="chart-popover-wrapper";constructor.POPOVER_CLOSE_BOX_CSS_CLASS="chart-popover-close-box";constructor.MARGIN=60;prototype.currentChartContainerHeight=0;prototype.wrapperElement=null;prototype.overlay=null;prototype.atoolsContainer=null;prototype.closeBox=null;prototype.compareBox=null;prototype.periodChooser=null;prototype.periodsContainer=null;prototype.chartParent=null;prototype.chart=null;constructor.instance=null;prototype.resizeTimer=null;prototype.pageReloadFunctionId=null;prototype.pageReloadDelayed=false;prototype.pageReloadFunction=null;prototype.periodBoxStartTime=null;prototype.periodBoxEndTime=null;prototype.customPeriod=false;prototype.centerContainer=function(){var chartWidth=this.atoolsContainer.width();var chartHeight=this.atoolsContainer.height();var availableWidth=SQW.$(window).width();var availableHeight=SQW.$(window).height();if(chartWidth<availableWidth&&chartHeight<availableHeight){this.atoolsContainer.css("position","fixed");}else{this.atoolsContainer.css("position","absolute");}};prototype.getOnResizeEventHandler=function(){var self=this;return stjs.bind(this,function(ev,THIS){clearTimeout(self.resizeTimer);var recenterContainer=function(){self.centerContainer();return false;};self.resizeTimer=setTimeout(recenterContainer,100);return true;},1);};prototype.getCompareCallback=function(){var self=this;return function(compareStocks,datePeriod){var mainChart=self.chart;var options=mainChart.getChartOption();var stocks=options.getStocks();if(stocks==null||stocks.length<=0||compareStocks==null||compareStocks.length<=0){return;}
var mainStock=stocks[0];var newStocks=[mainStock];var compareCount=compareStocks!=null?compareStocks.length:0;for(var i=0;i<compareCount;i++){var currentStock=compareStocks[i];if(currentStock!=null){newStocks.push(currentStock);}}
if(datePeriod!=null){var startDate=datePeriod[0];var endDate=datePeriod[1];if(startDate==null){startDate=DateUtil.createDate(mainChart.getChartData().getMinXValue());}
if(endDate==null){endDate=DateUtil.createDate(mainChart.getChartData().getMaxXValue());}
var startTime=startDate.getTime();var endTime=endDate.getTime();if(startTime>endTime){var tmp=endTime;var tmpDate=endDate;endTime=startTime;startTime=tmp;endDate=startDate;startDate=tmpDate;}
var currentPeriod=mainChart.getPeriod();options.setStocks(newStocks);if(currentPeriod==null||!currentPeriod.isIntraday()||currentPeriod.getFrom()==null||currentPeriod.getTo()==null||!DateUtil.isSameDay(currentPeriod.getFrom(),startDate)||!DateUtil.isSameDay(currentPeriod.getTo(),endDate)){var wrapperPeriod=Period.getInstanceBetweenDates(startDate,endDate);mainChart.setPeriod(wrapperPeriod);self.periodBoxStartTime=startTime;self.periodBoxEndTime=endTime+DateUtil.MS_DAY_24H-1;self.customPeriod=true;}else if(mainChart.getDataProvider()!=null){mainChart.getDataProvider().updateConfig(options);self.periodBoxStartTime=null;self.periodBoxEndTime=null;self.customPeriod=false;}
var zoomHistory=[];mainChart.setZoomHistory(zoomHistory);mainChart.setZoomLevel(null);mainChart.refresh();}};};prototype.addChart=function(chartParentClass){this.chartParent=SQW.$(window.document.createElement("div"));this.chartParent.addClass(chartParentClass);this.atoolsContainer.append(this.chartParent);var optionsParam=SQW.$.extend(true,{},FinancialChartOption.getDefaultFinancialChartOption());optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);optionsParam.setShowVolume(true);this.chart=new FinancialChart(this.chartParent,optionsParam);};prototype.init=function(trigger){this.updateView(trigger.getChartOption());this.initActiveChart(trigger);var data=trigger.getChartData();if(data!=null){this.compareBox.setPeriod(data.getMinXValue(),data.getMaxXValue());}
var serie=data.getMainSerie();this.periodChooser.selectPeriod(serie.getPeriod());};prototype.updateView=function(chartOption){var percent=100;if(chartOption.isShowCompareBox()){this.compareBox.show();percent=70;}else{this.compareBox.hide();}
var periodHeight=0;if(chartOption.isShowPeriodMenu()){this.periodChooser.show();periodHeight=this.periodChooser.getContainer().height();}else{this.periodChooser.hide();}
var absPixelToRemove=periodHeight+FinancialPopover.MARGIN;this.chartParent.css("height","calc("+percent+"% - "+absPixelToRemove+"px)");};constructor.getInstance=function(){if(FinancialPopover.instance==null){FinancialPopover.instance=new FinancialPopover();}
return FinancialPopover.instance;};prototype.open=function(trigger){this.delayPageReload(trigger.getChartOption());Chart.pauseAll();this.init(trigger);this.show();this.chart.unpause();this.chart.refresh();};prototype.close=function(){this.managePageReload();this.chart.getChartData().detachAll();this.hide();this.compareBox.blur();Chart.unpauseAll();this.chart.pause();};prototype.show=function(){this.overlay.css("display","block");this.wrapperElement.css("visibility","visible");};prototype.hide=function(){this.overlay.css("display","none");this.wrapperElement.css("visibility","hidden");};prototype.getOnCloseEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){self.close();return false;},1);return eh;};prototype.delayPageReload=function(option){this.pageReloadFunctionId=option.getReloadFunctionId();if(this.pageReloadFunctionId!=null&&(typeof SQW.$(window).prop(this.pageReloadFunctionId))!="undefined"){this.pageReloadFunction=SQW.$(window).prop(this.pageReloadFunctionId);var self=this;var delayedReloadPageFunction=function(){self.pageReloadDelayed=true;return null;};SQW.$(window).prop(this.pageReloadFunctionId,delayedReloadPageFunction);}};prototype.managePageReload=function(){if(this.pageReloadFunctionId!=null&&(typeof SQW.$(window).prop(this.pageReloadFunctionId))!="undefined"){SQW.$(window).prop(this.pageReloadFunctionId,this.pageReloadFunction);if(this.pageReloadDelayed&&this.pageReloadFunction!=null){this.pageReloadFunction();}}};prototype.initActiveChart=function(trigger){if(trigger==null){return;}
var initialSetting=trigger.getChartOption();var optionsParam=FinancialChartOption.extendFinancialChartOption(initialSetting);optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);optionsParam.setAnimateChart(false);optionsParam.setShowVolume(true);optionsParam.setStyleModel(initialSetting.getCustomStyleModel());optionsParam.setEngineModel(initialSetting.getCustomEngineModel());optionsParam.setLayout(new FinancialLayout());optionsParam.setShowCopyright(false);optionsParam.setWidthParam("10000");optionsParam.setXAxisPosition(Layout.Position.BOTTOM);optionsParam.setY1AxisPosition(Layout.Position.RIGHT);optionsParam.setY2AxisPosition(Layout.Position.LEFT);optionsParam.setShowLegend(optionsParam.isShowLegendInPopover());var provider=DataProviderFactory.getInstance().getProvider(initialSetting);var newProvider=provider.clone();var providerClass="popOverProvider";DataProviderFactory.getInstance().registerProvider(providerClass,newProvider);optionsParam.setProviderClass(providerClass);this.chartParent.empty();this.chart.init(this.chartParent,optionsParam);this.chart.getChartData().attach(this);};prototype.getId=function(){return"aTools";};prototype.update=function(newData){if(this.periodBoxStartTime!=null||this.periodBoxEndTime!=null){if(this.periodBoxStartTime==null){this.periodBoxStartTime=newData.getMinXValue();}
if(this.periodBoxEndTime==null){this.periodBoxEndTime=newData.getMaxXValue();}
var data=this.chart.getChartData();this.compareBox.setPeriod(this.periodBoxStartTime,this.periodBoxEndTime);if(this.customPeriod){this.periodChooser.selectPeriod(null);}else{this.periodChooser.selectPeriod(this.chart.getPeriod());}
this.periodBoxStartTime=null;this.periodBoxEndTime=null;this.chart.setZoomLevel(null);this.chart.render(null);}else{this.compareBox.setPeriod(newData.getMinXValue(),newData.getMaxXValue());var zoomLevel=this.chart.getZoomLevel();this.chart.setZoomLevel(zoomLevel);this.chart.render(zoomLevel);this.periodChooser.selectPeriod(this.chart.getPeriod());}};prototype.selectPeriod=function(periodParam,freqParam){if(this.chart!=null){this.customPeriod=false;this.chart.updatePeriodAndFrequency(periodParam,freqParam);this.periodBoxStartTime=null;this.periodBoxEndTime=null;this.chart.reset();}};},{wrapperElement:"SqwJQuery",overlay:"SqwJQuery",atoolsContainer:"SqwJQuery",closeBox:"SqwJQuery",compareBox:"CompareBoxPopover",periodChooser:"PeriodChooser",periodsContainer:"SqwJQuery",chartParent:"SqwJQuery",chart:"FinancialChart",instance:"FinancialPopover",resizeTimer:"TimeoutHandler",pageReloadFunction:"Function0"},{});
var DefaultDelimiterStyle=function(option){Style.call(this,option);this.visible=option.isGraphHeightModifiable();this.backgroundColor=option.getDelimiterHighlightColor();this.setAbsoluteHeight(option.getDelimiterHeightPixels());if(this.backgroundColor==null){this.backgroundColor=ChartColor.orange;}};DefaultDelimiterStyle=stjs.extend(DefaultDelimiterStyle,Style,[],null,{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultVolumeGraphStyle=function(options){DefaultBarGraphStyle.call(this,options);this.visible=options.isShowVolume();this.setHeightRatio(options.getVolumeHeightRatio());this.halfSpacing=options.getGraphsHalfSpacing();};DefaultVolumeGraphStyle=stjs.extend(DefaultVolumeGraphStyle,DefaultBarGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var FinancialStyleModel=function(){DefaultStyleModel.call(this);};FinancialStyleModel=stjs.extend(FinancialStyleModel,DefaultStyleModel,[],function(constructor,prototype){prototype.bottomLeftAxisStyle=null;prototype.bottomRightAxisStyle=null;prototype.bottomGraphStyle=null;prototype.delimiterStyle=null;prototype.init=function(options){DefaultStyleModel.prototype.init.call(this,options);this.bottomLeftAxisStyle=new DefaultYAxisStyle(options);this.bottomLeftAxisStyle.setPosition(options.getVolumeAxisPosition());this.bottomLeftAxisStyle.setVisible(options.getVolumeAxisPosition()!=Layout.Position.NONE);this.bottomRightAxisStyle=new DefaultYAxisStyle(options);this.bottomRightAxisStyle.setPosition(Layout.Position.RIGHT);this.bottomRightAxisStyle.setVisible(false);this.bottomGraphStyle=new DefaultVolumeGraphStyle(options);this.delimiterStyle=new DefaultDelimiterStyle(options);if(this.titleStyle!=null&&options.getTitleType()==null){this.titleStyle.setType(TitleStyle.SHOW_VALUE_VOLUME);}
var customStyleModel=options.getCustomStyleModel();if(customStyleModel!=null){if((customStyleModel)["init"]!=null){options.setCustomeStyleModel(null);customStyleModel.init(options);options.setCustomeStyleModel(customStyleModel);}
var validStyles={};var tmp={};this.extendStyle(customStyleModel,validStyles,"titleStyle");this.extendStyle(customStyleModel,validStyles,"xAxisStyle");this.extendStyle(customStyleModel,validStyles,"y1AxisStyle");this.extendStyle(customStyleModel,validStyles,"y2AxisStyle");this.extendStyle(customStyleModel,validStyles,"graphStyle");this.extendStyle(customStyleModel,validStyles,"legendStyle");this.extendStyle(customStyleModel,validStyles,"tooltipStyle");this.extendStyle(customStyleModel,validStyles,"drawStyle");this.extendStyle(customStyleModel,validStyles,"bottomLeftAxisStyle");this.extendStyle(customStyleModel,validStyles,"bottomRightAxisStyle");this.extendStyle(customStyleModel,validStyles,"bottomGraphStyle");this.extendStyle(customStyleModel,validStyles,"delimiterStyle");SQW.$.extend(true,tmp,customStyleModel,validStyles);SQW.$.extend(true,this,tmp);}
this.styles[DefaultLayout.TITLE_AREA]=this.titleStyle;this.styles[DefaultLayout.X_AXIS_AREA]=this.xAxisStyle;this.styles[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisStyle;this.styles[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisStyle;this.styles[DefaultLayout.GRAPH_AREA]=this.graphStyle;this.styles[DefaultLayout.LEGEND_AREA]=this.legendStyle;this.styles[DefaultLayout.TOOLTIP_AREA]=this.tooltipStyle;this.styles[DrawStyle.ID]=this.drawStyle;this.styles[FinancialLayout.BOTTOM_AXIS_LEFT]=this.bottomLeftAxisStyle;this.styles[FinancialLayout.BOTTOM_AXIS_RIGHT]=this.bottomRightAxisStyle;this.styles[FinancialLayout.BOTTOM_GRAPH_AREA]=this.bottomGraphStyle;this.styles[FinancialLayout.DELIMITER_AREA]=this.delimiterStyle;};prototype.extend=function(options){};},{bottomLeftAxisStyle:"AxisStyle",bottomRightAxisStyle:"AxisStyle",bottomGraphStyle:"GraphStyle",delimiterStyle:"Style",globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
var FinancialLayout=function(){DefaultLayout.call(this);this.showBottomArea=true;};FinancialLayout=stjs.extend(FinancialLayout,DefaultLayout,[],function(constructor,prototype){constructor.BOTTOM_AXIS_LEFT="bottomLeftAxisAreaId";constructor.BOTTOM_AXIS_RIGHT="bottomRightAxisAreaId";constructor.BOTTOM_GRAPH_AREA="bottomGraphAreaId";constructor.DELIMITER_AREA="delimiterAreaId";prototype.showBottomArea=false;prototype.init=function(styleModel){DefaultLayout.prototype.init.call(this,styleModel);this.addArea(FinancialLayout.BOTTOM_AXIS_LEFT,ChartView.AreaType.AXIS,styleModel.getStyle(FinancialLayout.BOTTOM_AXIS_LEFT));this.addArea(FinancialLayout.BOTTOM_AXIS_RIGHT,ChartView.AreaType.AXIS,styleModel.getStyle(FinancialLayout.BOTTOM_AXIS_RIGHT));this.addArea(FinancialLayout.BOTTOM_GRAPH_AREA,ChartView.AreaType.GRAPH,styleModel.getStyle(FinancialLayout.BOTTOM_GRAPH_AREA));this.addArea(FinancialLayout.DELIMITER_AREA,ChartView.AreaType.CUSTOM,styleModel.getStyle(FinancialLayout.DELIMITER_AREA));};prototype.updateYAxis=function(){DefaultLayout.prototype.updateYAxis.call(this);this.updateBottomAxis(FinancialLayout.BOTTOM_AXIS_LEFT);this.updateBottomAxis(FinancialLayout.BOTTOM_AXIS_RIGHT);var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var delimiterAreaBound=this.areasBound[FinancialLayout.DELIMITER_AREA];delimiterAreaBound.setLeft(graphAreaBound.getLeft());delimiterAreaBound.setWidth(graphAreaBound.getWidth());};prototype.updateBottomAxis=function(bottomAxisId){var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var bottomAxisStyle=this.areasStyle[bottomAxisId];var bottomAxisPosition=bottomAxisStyle.getPosition();var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var bottomGraphBound=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomAxisBound=this.areasBound[bottomAxisId];var mainAxisSameSideAsBottom=null;var mainAxisBoundsSameSide=null;var mainAxisCurrentWidth=0;if(y1AxisStyle.getPosition()==bottomAxisPosition){mainAxisSameSideAsBottom=y1AxisStyle;mainAxisBoundsSameSide=this.areasBound[DefaultLayout.Y1_AXIS_AREA];mainAxisCurrentWidth=mainAxisBoundsSameSide.getWidth();}else if(y2AxisStyle.getPosition()==bottomAxisPosition){mainAxisSameSideAsBottom=y2AxisStyle;mainAxisBoundsSameSide=this.areasBound[DefaultLayout.Y2_AXIS_AREA];mainAxisCurrentWidth=mainAxisBoundsSameSide.getWidth();}
var bottomAxisNewWidth=bottomAxisStyle!=null?bottomAxisStyle.getWidth(this.currentWidth):0;if(bottomAxisPosition==Layout.Position.NONE){bottomGraphBound.setLeft(graphAreaBound.getLeft());bottomGraphBound.setWidth(graphAreaBound.getWidth());}else if(mainAxisSameSideAsBottom!=null&&mainAxisBoundsSameSide!=null&&mainAxisCurrentWidth<=mainAxisCurrentWidth){bottomGraphBound.setLeft(graphAreaBound.getLeft());bottomGraphBound.setWidth(graphAreaBound.getWidth());bottomAxisBound.setLeft(mainAxisBoundsSameSide.getLeft());bottomAxisBound.setWidth(mainAxisBoundsSameSide.getWidth());}else{var newAxisLeft=mainAxisBoundsSameSide!=null?mainAxisBoundsSameSide.getLeft():bottomAxisBound.getLeft();var widthDiff=bottomAxisNewWidth-mainAxisCurrentWidth;var newChartLeft=graphAreaBound.getLeft();var newChartWidth=graphAreaBound.getWidth()-widthDiff;if(bottomAxisPosition==Layout.Position.LEFT){newChartLeft+=widthDiff;}else{newAxisLeft-=widthDiff;}
graphAreaBound.setLeft(newChartLeft);graphAreaBound.setWidth(newChartWidth);bottomGraphBound.setLeft(newChartLeft);bottomGraphBound.setWidth(newChartWidth);bottomAxisBound.setLeft(newAxisLeft);bottomAxisBound.setWidth(bottomAxisNewWidth);if(mainAxisBoundsSameSide!=null){mainAxisBoundsSameSide.setLeft(newAxisLeft);mainAxisBoundsSameSide.setWidth(bottomAxisNewWidth);}
var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];titleAreaBound.setLeft(newChartLeft);titleAreaBound.setWidth(newChartWidth);var xAreaBound=this.areasBound[DefaultLayout.X_AXIS_AREA];xAreaBound.setLeft(newChartLeft);xAreaBound.setWidth(newChartWidth);var legendAreaBound=this.areasBound[DefaultLayout.LEGEND_AREA];legendAreaBound.setLeft(newChartLeft);legendAreaBound.setWidth(newChartWidth);}};prototype.refresh=function(chartView,width,height){DefaultLayout.prototype.refresh.call(this,chartView,width,height);var bottomGraphStyle=this.areasStyle[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomGraphBounds=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomLeftAxisBounds=this.areasBound[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisBounds=this.areasBound[FinancialLayout.BOTTOM_AXIS_RIGHT];var delimiterAreaBound=this.areasBound[FinancialLayout.DELIMITER_AREA];if(!this.showBottomArea){bottomGraphBounds.setVisible(false);bottomLeftAxisBounds.setVisible(false);bottomRightAxisBounds.setVisible(false);delimiterAreaBound.setVisible(false);return;}
var chartAreaBounds=this.areasBound[DefaultLayout.GRAPH_AREA];var titleAreaBounds=this.areasBound[DefaultLayout.TITLE_AREA];var xAxisAreaBounds=this.areasBound[DefaultLayout.X_AXIS_AREA];var y1AxisAreaBounds=this.areasBound[DefaultLayout.Y1_AXIS_AREA];var y2AxisAreaBounds=this.areasBound[DefaultLayout.Y2_AXIS_AREA];var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var bottomLeftAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_RIGHT];var delimiterStyle=this.areasStyle[FinancialLayout.DELIMITER_AREA];var chartLeftPos=chartAreaBounds.getLeft();var chartWidth=chartAreaBounds.getWidth();var newChartHeight=chartAreaBounds.getHeight();var chartOuterHeight=stjs.trunc(chartAreaBounds.getOuterHeight(true));var totalBottomHeight=bottomGraphStyle.getHeight(chartOuterHeight);var delimiterHeight=delimiterStyle.getHeight(chartOuterHeight);var topHalfSpacing=delimiterHeight/2.0;var bottomHalfSpacing=topHalfSpacing;if(delimiterHeight==null||delimiterHeight<0){delimiterHeight=0;topHalfSpacing=0.0;bottomHalfSpacing=0.0;}
if(totalBottomHeight==null||totalBottomHeight<bottomHalfSpacing){totalBottomHeight=0.0;topHalfSpacing=delimiterHeight;bottomHalfSpacing=0.0;bottomGraphBounds.setVisible(false);bottomLeftAxisBounds.setVisible(false);bottomRightAxisBounds.setVisible(false);}else{bottomGraphBounds.setVisible(true);bottomLeftAxisBounds.setVisible(true);bottomRightAxisBounds.setVisible(true);}
if(totalBottomHeight!=null&&(chartOuterHeight-totalBottomHeight)<topHalfSpacing){newChartHeight=0.0;topHalfSpacing=0.0;totalBottomHeight=chartOuterHeight;bottomHalfSpacing=delimiterHeight;chartAreaBounds.setVisible(false);y1AxisAreaBounds.setVisible(false);y2AxisAreaBounds.setVisible(false);}else{newChartHeight-=totalBottomHeight;newChartHeight-=topHalfSpacing;chartAreaBounds.setVisible(true);y1AxisAreaBounds.setVisible(true);y2AxisAreaBounds.setVisible(true);}
totalBottomHeight-=bottomHalfSpacing;chartAreaBounds.setHeight(newChartHeight);var topGraphHeight=newChartHeight>0?chartAreaBounds.getOuterHeight(true):0.0;var bottomYStartPos=chartAreaBounds.getTop()+topGraphHeight+delimiterHeight;var leftMainAxis=null;var rightMainAxis=null;if(y1AxisAreaBounds!=null){y1AxisAreaBounds.setHeight(newChartHeight);if(y1AxisStyle.getPosition()==Layout.Position.LEFT){leftMainAxis=y1AxisAreaBounds;}else{rightMainAxis=y1AxisAreaBounds;}}
if(y2AxisAreaBounds!=null){y2AxisAreaBounds.setHeight(newChartHeight);if(y2AxisStyle.getPosition()==Layout.Position.LEFT){leftMainAxis=y2AxisAreaBounds;}else{rightMainAxis=y2AxisAreaBounds;}}
var bottomLeftAxisWidth=0;var bottomLeftAxisLeftPos=0;var bottomLeftAxisLeftPadding=0;var bottomLeftAxisRightPadding=0;var addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&bottomLeftAxisStyle.isShowAxisTicks();var bottomLeftAxisPosition=bottomLeftAxisStyle.getPosition();if(bottomLeftAxisPosition!=Layout.Position.NONE){if(bottomLeftAxisPosition==Layout.Position.LEFT){if(leftMainAxis!=null){bottomLeftAxisLeftPos=leftMainAxis.getLeft();bottomLeftAxisWidth=leftMainAxis.getWidth();bottomLeftAxisLeftPadding=leftMainAxis.getPaddingLeft();bottomLeftAxisRightPadding=leftMainAxis.getPaddingRight();}else{var currentAxisWidth=bottomLeftAxisStyle.getWidth(width);if(currentAxisWidth==null){bottomLeftAxisWidth=chartView.getLabelWidth(DefaultLayout.DEFAULT_LABEL_VALUE,bottomLeftAxisStyle.getFont(),bottomLeftAxisStyle.getFontSize(),false);}else{bottomLeftAxisWidth=currentAxisWidth;}
bottomLeftAxisLeftPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;bottomLeftAxisRightPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;if(addSpaceForTicks){bottomLeftAxisRightPadding+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
var bottomLeftAxisOuterWidth=bottomLeftAxisWidth+bottomLeftAxisLeftPadding+bottomLeftAxisRightPadding;chartWidth-=bottomLeftAxisOuterWidth;bottomLeftAxisLeftPos=chartLeftPos;chartLeftPos+=bottomLeftAxisOuterWidth;chartAreaBounds.setLeft(chartLeftPos);chartAreaBounds.setWidth(chartWidth);titleAreaBounds.setLeft(chartLeftPos);titleAreaBounds.setWidth(chartWidth);xAxisAreaBounds.setLeft(chartLeftPos);xAxisAreaBounds.setWidth(chartWidth);}}else{bottomLeftAxisWidth=0;}}
var bottomRightAxisWidth=0;var bottomRightAxisLeftPos=0;var bottomRightAxisLeftPadding=0;var bottomRightAxisRightPadding=0;addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&bottomRightAxisStyle.isShowAxisTicks();var bottomRightAxisPosition=bottomRightAxisStyle.getPosition();if(bottomRightAxisPosition!=Layout.Position.NONE){if(bottomRightAxisPosition==Layout.Position.RIGHT){if(rightMainAxis!=null){bottomRightAxisLeftPos=rightMainAxis.getLeft();bottomRightAxisWidth=rightMainAxis.getWidth();bottomRightAxisLeftPadding=rightMainAxis.getPaddingLeft();bottomRightAxisRightPadding=rightMainAxis.getPaddingRight();}else{var currentBottomAxisWidth=bottomRightAxisStyle.getWidth(width);if(currentBottomAxisWidth==null){bottomRightAxisWidth=chartView.getLabelWidth(DefaultLayout.DEFAULT_LABEL_VALUE,bottomRightAxisStyle.getFont(),bottomRightAxisStyle.getFontSize(),false);}else{bottomRightAxisWidth=currentBottomAxisWidth;}
bottomRightAxisLeftPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;bottomRightAxisRightPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;if(addSpaceForTicks){bottomRightAxisLeftPadding+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
var bottomRightAxisOuterWidth=bottomRightAxisWidth+bottomRightAxisLeftPadding+bottomRightAxisRightPadding;chartWidth-=bottomRightAxisOuterWidth;chartAreaBounds.setWidth(chartWidth);titleAreaBounds.setWidth(chartWidth);xAxisAreaBounds.setWidth(chartWidth);bottomRightAxisLeftPos=chartLeftPos+chartAreaBounds.getOuterWidth(true);}}else{bottomRightAxisWidth=0;}}
var contentHeight=totalBottomHeight;var paddingLeft=chartAreaBounds.getPaddingLeft();var paddingRight=chartAreaBounds.getPaddingRight();var paddingTop=chartAreaBounds.getPaddingBottom();var paddingBottom=0;contentHeight-=(paddingTop+paddingBottom);var marginLeft=chartAreaBounds.getMarginLeft();var marginRight=chartAreaBounds.getMarginRight();var marginTop=0;var marginBottom=0;contentHeight-=(marginTop+marginBottom);var borderLeft=chartAreaBounds.getBorderLeft();var borderRight=chartAreaBounds.getBorderRight();var borderTop=chartAreaBounds.getBorderTop();var borderBottom=chartAreaBounds.getBorderBottom();contentHeight-=(borderTop+borderBottom);bottomGraphBounds.reset();bottomGraphBounds.setLeft(chartLeftPos);bottomGraphBounds.setTop(bottomYStartPos);bottomGraphBounds.setWidth(chartWidth);bottomGraphBounds.setHeight(contentHeight);bottomGraphBounds.setPaddings(paddingLeft,paddingTop,paddingRight,paddingBottom);bottomGraphBounds.setMargins(marginLeft,marginTop,marginRight,marginBottom);bottomGraphBounds.setBorders(borderLeft,borderTop,borderRight,borderBottom);delimiterAreaBound.reset();delimiterAreaBound.setLeft(chartLeftPos);delimiterAreaBound.setTop(bottomYStartPos-delimiterHeight);delimiterAreaBound.setWidth(chartWidth);delimiterAreaBound.setHeight(delimiterHeight);delimiterAreaBound.setPaddings(paddingLeft,0,paddingRight,0);delimiterAreaBound.setBorders(borderLeft,0,borderRight,0);bottomLeftAxisBounds.reset();bottomLeftAxisBounds.setLeft(bottomLeftAxisLeftPos);bottomLeftAxisBounds.setTop(bottomYStartPos);bottomLeftAxisBounds.setWidth(bottomLeftAxisWidth);bottomLeftAxisBounds.setHeight(contentHeight);bottomLeftAxisBounds.setPaddingLeft(bottomLeftAxisLeftPadding);bottomLeftAxisBounds.setPaddingRight(bottomLeftAxisRightPadding);bottomLeftAxisBounds.setPaddingTop(paddingTop);bottomLeftAxisBounds.setPaddingBottom(paddingBottom);bottomLeftAxisBounds.setMarginTop(borderTop+marginTop);bottomLeftAxisBounds.setMarginBottom(borderBottom+marginBottom+DefaultLayout.DEFAULT_PADDING_PIXELS);bottomRightAxisBounds.reset();bottomRightAxisBounds.setLeft(bottomRightAxisLeftPos);bottomRightAxisBounds.setTop(bottomYStartPos);bottomRightAxisBounds.setWidth(bottomRightAxisWidth);bottomRightAxisBounds.setHeight(contentHeight);bottomRightAxisBounds.setPaddingLeft(bottomRightAxisLeftPadding);bottomRightAxisBounds.setPaddingRight(bottomRightAxisRightPadding);bottomRightAxisBounds.setPaddingTop(paddingTop);bottomRightAxisBounds.setPaddingBottom(paddingBottom);bottomRightAxisBounds.setMarginTop(borderTop+marginTop);bottomRightAxisBounds.setMarginBottom(borderBottom+marginBottom+DefaultLayout.DEFAULT_PADDING_PIXELS);if(bottomRightAxisWidth<=0){bottomRightAxisBounds.setVisible(false);}};prototype.setShowBottomGraph=function(showBottomGraph){this.showBottomArea=showBottomGraph;var bottomGraphBounds=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomLeftAxisBounds=this.areasBound[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisAreaBound=this.areasBound[FinancialLayout.BOTTOM_AXIS_RIGHT];var delimiterAreaBound=this.areasBound[FinancialLayout.DELIMITER_AREA];bottomGraphBounds.setVisible(showBottomGraph);bottomLeftAxisBounds.setVisible(showBottomGraph);bottomRightAxisAreaBound.setVisible(showBottomGraph);delimiterAreaBound.setVisible(showBottomGraph);};prototype.isShowBottomGraph=function(){return this.showBottomArea;};prototype.updateFontsSize=function(width,height){var currentFontSize=this.currentFontSize;DefaultLayout.prototype.updateFontsSize.call(this,width,height);var bottomLeftAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_RIGHT];if(width<DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT||height<DefaultLayout.MINIMUM_HEIGHT_FOR_NORMAL_FONT){if(currentFontSize!=DefaultLayout.SMALL_FONTS){bottomLeftAxisStyle.setFontSize(bottomLeftAxisStyle.getFontSize()-1);bottomLeftAxisStyle.setLabelsHeight(bottomLeftAxisStyle.getFontSize()+2);bottomRightAxisStyle.setFontSize(bottomRightAxisStyle.getFontSize()-1);bottomRightAxisStyle.setLabelsHeight(bottomRightAxisStyle.getFontSize()+2);}}else{if(currentFontSize!=DefaultLayout.NORMAL_FONTS){bottomLeftAxisStyle.setFontSize(bottomLeftAxisStyle.getFontSize()+1);bottomLeftAxisStyle.setLabelsHeight(bottomLeftAxisStyle.getFontSize()+2);bottomRightAxisStyle.setFontSize(bottomRightAxisStyle.getFontSize()+1);bottomRightAxisStyle.setLabelsHeight(bottomRightAxisStyle.getFontSize()+2);}}};prototype.moveDelimiter=function(newY){var bottomGraphStyle=this.areasStyle[FinancialLayout.BOTTOM_GRAPH_AREA];var delimiterBounds=this.areasBound[FinancialLayout.DELIMITER_AREA];if(delimiterBounds!=null&&delimiterBounds.isVisible()){var topGraphAreaBounds=this.areasBound[DefaultLayout.GRAPH_AREA];var bottomGraphAreaBounds=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];if(bottomGraphAreaBounds==null||!bottomGraphAreaBounds.isVisible()){bottomGraphAreaBounds=topGraphAreaBounds;}
if(topGraphAreaBounds==null||!topGraphAreaBounds.isVisible()){topGraphAreaBounds=bottomGraphAreaBounds;}
if(topGraphAreaBounds==null){return;}
var minY=topGraphAreaBounds.getTop();var maxY=(bottomGraphAreaBounds.getTop()+bottomGraphAreaBounds.getOuterHeight(true)-delimiterBounds.getHeight());var validYPos=newY;if(newY<minY){validYPos=minY;}else if(newY>maxY){validYPos=maxY;}
var heightRatio=1.0-(validYPos-minY)/(maxY-minY);bottomGraphStyle.setHeightRatio(heightRatio);}};},{areasStyle:{name:"Map",arguments:[null,"Style"]},areasBound:{name:"Map",arguments:[null,"AreaBound"]},globalStyle:"GlobalStyle",areas:{name:"Map",arguments:[null,"Area"]}},{});
var dateFormat=function(){var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};return function(date,mask,utc){var dF=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(date)=="[object String]"&&!/\d/.test(date)){mask=date;date=undefined;}
date=date?new Date(date):new Date;if(isNaN(date))throw SyntaxError("invalid date");mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true;}
var _=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});};}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(mask,utc){return dateFormat(this,mask,utc);};
;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b)&&c(b).matches||!1;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
function formatAmount(amount,currency){if(isNaN(amount)){return amount;}
amount=amount*1;if(currency=="JPY"){return amount.toFixed(0);}
return amount.toFixed(2);}
function displayResultContainer(rate){if(rate==null){$(".has-rate").hide();}else{$(".has-rate").show();}}
function displayCurrencyRateInfo(historical){if(actionBean.indicative){$("#midRate_label").css("visibility","visible");}else{$("#midRate_label").css("visibility","visible");}
if(historical){$("#currencyRate_label").html(actionBean.translations.sqRateHistoricalText);}else if(actionBean.indicative){$("#currencyRate_label").html(actionBean.translations.sqRateIndicativeText);}else{$("#currencyRate_label").html(actionBean.translations.sqRateText);}}
function displayActionButton(indicative){if(indicative){$("#btn_tradeIt").hide();$("#phone_text").show();$("#openAccount_text").hide();}else if(document.cookie.match(/big8/)==null||document.cookie.match(/big5/)==null){$("#btn_tradeIt").hide();$("#phone_text").hide();$("#openAccount_text").show();}else{$("#btn_tradeIt").show();$("#phone_text").hide();$("#openAccount_text").hide();}}
function getFromCurrency(){return $("#fromCurrency .Picklist__value").data("value");}
function getToCurrency(){return $("#toCurrency .Picklist__value").data("value");}
function getFromAmount(){return $("#fromAmount").attr("value");}
function getToAmount(){return $("#toAmount").attr("value");}
function setTradeLink(event){var val=$(".is-reference").find(".InputGroup__input").attr("value");var refId=$(".is-reference").attr("id");var action;switch(refId){case"fromCurrency":action="SELL";break;case"toCurrency":action="BUY";break;default:event.preventDefault;break;}
var fromCurrency=getFromCurrency();var toCurrency=getToCurrency();var tradeLink=baseTradeItUrl+"?commandName=exchange"+"&fromCurrency="+fromCurrency+"&transactionType="+action+"&toCurrency="+toCurrency+"&quantity="+val;$("#tradeLink").attr("href",tradeLink);_paq.push(["trackEvent","CurrencyConverter","trade it button clicked [fromCurrency="+fromCurrency
+", toCurrency="+toCurrency+"]","trade clicked"]);_paq.push(["trackGoal",1]);}
var updateAmount=function(){};var customAxisFormatter=new AbbreviateNumberFormatter();function updateChart(){var base=getFromCurrency();var term=getToCurrency();var chart=$(".chart-container").data("chart");if(chart!=undefined){chart.reset();chart.options.stocks=[new Stock("CCX"+base+"X"+term+"XX_M2_"+term)];DataProviderFactory.getInstance().retriveProvider($(".chart-container").attr("id")+"Provider").updateConfig(chart.options);chart.reset();}}
function loadCurrencyRate(){$.getJSON("Convertor.action?rate=&fromCurrency="+getFromCurrency()
+"&toCurrency="+getToCurrency(),function(data){customAxisFormatter.currentFormat=data.labelRateDecimal;updateChart();actionBean.rate=data.rate;actionBean.mid=data.mid;actionBean.indicative=data.indicative;actionBean.fromChfMid=data.fromChfMid;actionBean.toChfMid=data.toChfMid;actionBean.labelRateDecimal=data.labelRateDecimal;$("#currencyRate").html(data.rate);$("#currencyRateDate").html(data.quoteTime);$("#midRate").html(data.mid);displayCurrencyRateInfo(false);displayActionButton(data.indicative);displayResultContainer(data.rate);updateAmount();});}
function updateFromAmount(){$("#toCurrency").addClass("is-reference");$("#fromCurrency").removeClass("is-reference");$("#fromCurrency").removeClass("is-error");$("#fromAmount").attr("value",formatAmount(formatAmount(getToAmount(),getToCurrency())/actionBean.getRate(),getFromCurrency()));$("#currencyRate").html(actionBean.getRate());$("#currencyRateDate").html(actionBean.getRateDate());}
function updateToAmount(){$("#fromCurrency").addClass("is-reference");$("#toCurrency").removeClass("is-reference");$("#toCurrency").removeClass("is-error");$("#toAmount").attr("value",formatAmount(formatAmount(getFromAmount(),getFromCurrency())*actionBean.getRate(),getToCurrency()));$("#currencyRate").html(actionBean.getRate());$("#currencyRateDate").html(actionBean.getRateDate());}
function stopEvPropagation(ev){if(ev.stopPropagation){ev.stopImmediatePropagation();}}
var getPointFromChart=function(){var chart=$(".chart-container").data("chart");var bounds=chart.getChartView().getArea("graphAreaId").getAreaBound();var context=chart.getEngineModel().getContext();var pointsBySerie=context.getClosestPointsFromCurrentPosition(bounds.getContentLeft(),bounds.getContentWidth());if(pointsBySerie&&pointsBySerie[context.getMainSerieId()]&&pointsBySerie[context.getMainSerieId()][0]){var highlightedPoint=pointsBySerie[context.getMainSerieId()][0];actionBean.chartRate=highlightedPoint.y;var chartDate=new Date(highlightedPoint.x);var chartDateString=chartDate.toLocaleDateString();if(chart.data.intraday){chartDateString+=" "+chartDate.toLocaleTimeString();}
actionBean.chartRateDate=chartDateString;displayCurrencyRateInfo(true);updateAmount();}};var hoverChartStart=0;var intoChart=function(){hoverChartStart=new Date().getTime();};var outFromChart=function(){hoverChartStart=0;actionBean.chartRate=null;actionBean.chartRateDate=null;displayCurrencyRateInfo(false);updateAmount();_paq.push(["trackEvent","CurrencyConverter","hover ccy chart","chart hover"]);};function setErrorLabel(element,errorMessage){var errorLabel=$($(element.siblings("h1.Heading--label")[0]));element.removeClass("is-reference");element.addClass("is-error");errorLabel.html(errorMessage);}
var amountInputHandler=function(event){var shiftKeyCode=16;var value=$(event.target).attr("value");var parent=$($(event.target).parents(".InputGroup")[0]);if(isNaN(value)){setErrorLabel(parent,actionBean.translations.errorAmountInvalid);updateAmount=function(){};}else if(value<0){setErrorLabel(parent,actionBean.translations.errorAmountNegative);updateAmount=function(){};}else if(value*event.data.getMid()>1000000){setErrorLabel(parent,actionBean.translations.errorAmountTooBig);updateAmount=function(){};}else{$(".is-reference").removeClass("is-reference");parent.addClass("is-reference");parent.removeClass("is-error");if(event.keyCode!=$.ui.keyCode.TAB&&event.keyCode!=shiftKeyCode){updateAmount=event.data.updateAmount;}}
updateAmount();if(event.currentTarget.id=="fromAmount"){_paq.push(["trackEvent","CurrencyConverter","entered value","Qty field - fromAmount"]);}
if(event.currentTarget.id=="toAmount"){_paq.push(["trackEvent","CurrencyConverter","entered value","Qty field - toAmount"]);}};function picklistComportement($picklist){var $value=$($picklist).find(".Picklist__value");var $option=$($picklist).find(".Picklist__options");var $items=$($picklist).find(".Picklist__item");var $search=$($picklist).find(".Picklist__searchInput");var $defaultSelected=$($picklist).find(".is-selected");var $referenceItems=$items;var numberOfItems=$items.length;var scrollHeight=$($items).outerHeight();var current=-1;var isChildSelected=false;var isExpanded=false;var isSearchActive=false;var keys={enter:13,space:32,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40,escape:27};$($value).html($($defaultSelected).find(".flag-and-short").html());$($value).data("value",$($defaultSelected).data("value"));function stopEvPropagation(ev){if(ev.stopPropagation){ev.stopImmediatePropagation();}}
function getPrevIndex(){prevIndex=current-1<0?numberOfItems-1:current-1;return prevIndex;}
function getNextIndex(){nextIndex=current+1>numberOfItems-1?0:current+1;return nextIndex;}
function startSearchProcess(){isSearchActive=true;$($picklist).on("keyup",".Picklist__searchInput",function(ev){if($.inArray(ev.keyCode,[keys.leftArrow,keys.upArrow,keys.rightArrow,keys.downArrow])<=-1){var target=ev.target||ev.srcElement;var value=$.trim($(target).val().toLowerCase());if(value!==""){$($items).addClass("is-hidden");$(".Picklist__header").addClass("is-hidden");$items=$.map($($referenceItems),function($item,index){var itemValue=$($item).data("value");if(itemValue.toLowerCase().indexOf(value)>-1){return $item;}});}else if(value===""){$items=$referenceItems;$(".Picklist__header").removeClass("is-hidden");}
$($items).removeClass("is-hidden");numberOfItems=$items.length;$($option).scrollTop(0);current=-1;if(numberOfItems===0){$(".Picklist__searchLabel").removeClass("is-hidden");$(".Picklist__searchResult").html("No results found for ");$(".Picklist__searchValue").html("\""+value+"\"");}else{$(".Picklist__searchLabel").addClass("is-hidden");}}});}
function stopSearchProcess(){isSearchActive=false;$($picklist).off("keyup",".Picklist__searchInput");$(".Picklist__searchInput").val("");$(".Picklist__header").removeClass("is-hidden");if(!$(".Picklist__searchLabel").hasClass("is-hidden")){$(".Picklist__searchLabel").addClass("is-hidden");}
$items=$referenceItems;$($items).removeClass("is-hidden");numberOfItems=$items.length;}
function moveCurrent(itemToSelectIndex){var $itemToSelect=$($items[itemToSelectIndex]);if(current!==itemToSelectIndex&&typeof $items[current]!==undefined){$(".is-active").removeClass("is-active");$($itemToSelect).addClass("is-active");var index=$.inArray($itemToSelect,$items);$($option).scrollTop($($option).scrollTop()+$($itemToSelect).position().top);current=itemToSelectIndex;}}
function selectItem(itemToSelectIndex){var $itemToSelect=$($items[itemToSelectIndex]);var $previousItem=$($picklist).find(".is-selected");var prevValue=$previousItem.data("value");var newValue=$($itemToSelect).data("value");$($value).html($($itemToSelect).find(".flag-and-short").html()).data("value",newValue).trigger("change",prevValue);$previousItem.removeClass("is-selected");$($picklist).find(".is-active").removeClass("is-active");$($itemToSelect).addClass("is-selected");_paq.push(["trackEvent","CurrencyConverter","select ["+newValue+"]","Qty field - "+$($picklist).parents(".InputGroup")[0].id]);}
function closePickList($expandedPicklist){$($expandedPicklist).removeClass("is-expanded");isExpanded=false;isChildSelected=false;$($search).blur();$($expandedPicklist).focus();stopSearchProcess();}
function openPickList(){closePickList($(".Picklist.is-expanded"));$($picklist).addClass("is-expanded");isExpanded=true;$($search).focus();startSearchProcess();}
$($picklist).on("focus",".Picklist__searchInput",function(ev){isChildSelected=true;});$($picklist).on("keydown",function(ev){if(!isExpanded){if($.inArray(ev.keyCode,[keys.space,keys.leftArrow,keys.upArrow,keys.rightArrow,keys.downArrow])>-1){openPickList();}}else if(isExpanded){if($.inArray(ev.keyCode,[keys.leftArrow,keys.upArrow])>-1){moveCurrent(getPrevIndex());}else if($.inArray(ev.keyCode,[keys.rightArrow,keys.downArrow])>-1){moveCurrent(getNextIndex());}else if($.inArray(ev.keyCode,[keys.enter])>-1){selectItem(current);closePickList($picklist);}else if($.inArray(ev.keyCode,[keys.escape])>-1){closePickList($picklist);}}});$($picklist).on("click",".Picklist__trigger",function(ev){stopEvPropagation(ev);if(isExpanded){closePickList($picklist);}else{$(".Picklist.is-expanded").removeClass("is-expanded");openPickList();}});$($picklist).on("mousedown",".Picklist__item",function(ev){isChildSelected=true;});$($picklist).on("mouseup",".Picklist__item",function(ev){isChildSelected=false;});$($picklist).on("click",".Picklist__item",function(ev){selectItem(current);closePickList($picklist);});$($items).hover(function(ev){var $target=ev.target||ev.srcElement;var targetIndex=$($items).index($target);$(".is-active").removeClass("is-active");$($target).addClass("is-active");if(ev.stopPropagation){ev.stopImmediatePropagation();}
current=targetIndex;},function(ev){});$(document).on("click",function(ev){if(!$(ev.target).closest(".Picklist.is-expanded").length){$(".Picklist.is-expanded").removeClass("is-expanded");isExpanded=false;isChildSelected=false;}});}
$(document).ready(function(){customAxisFormatter.setFormat=function(){};customAxisFormatter.currentFormat=actionBean.labelRateDecimal;updateAmount=updateToAmount;$("#fromAmount").keyup({updateAmount:updateToAmount,getMid:function(){return actionBean.fromChfMid;}},amountInputHandler).click(function(event){updateAmount=updateToAmount;updateAmount();}).blur(function(event){var $el=$(event.target);$el.attr("value",formatAmount($el.attr("value"),getFromCurrency()));});$("#toAmount").keyup({updateAmount:updateFromAmount,getMid:function(){return actionBean.toChfMid;}},amountInputHandler).click(function(event){updateAmount=updateFromAmount;updateAmount();}).blur(function(event){var $el=$(event.target);$el.attr("value",formatAmount($el.attr("value"),getToCurrency()));});$("a").click(function(event){if($(event.target).hasClass("financial-chart-period-link")){var frequency=$(event.target).attr("class").split(" ")[1];_paq.push(["trackEvent","CurrencyConverter","chart frequency selected ["+frequency+"]","chart frequency selected"]);}else{var linkName=$(event.target).attr("name");if($(event.target).attr("href").startsWith("javascript:")){linkName=$(event.target).attr("href");}
_paq.push(["trackEvent","CurrencyConverter",linkName,"sent to link ["+linkName+"]"]);}});$(".Picklist__value").change(function(event,previousValue){var current=$($(event.target)[0]);var other;$(".Picklist__value").each(function(index,el){$el=$(el);if(current.is($el)==false){other=$el;}});if(previousValue==current.data("value")){event.preventDefault();return;}
if(current.data("value")==other.data("value")){$otherParent=$($(other).parents(".Picklist")[0]);$otherParent.find(".is-selected").removeClass("is-selected");$otherItem=$($otherParent.find(".Picklist__item[data-value="+previousValue+"]"));$(other).html($otherItem.find(".flag-and-short").html());$otherItem.addClass("is-selected");$(other).data("value",previousValue);}
loadCurrencyRate();});$(".financial-chart-period-link.maximum").css({"color":"rgb(255, 153, 102)","text-decoration":"none"});var $picklist=$(".Picklist");$picklist.each(function(index,$el){picklistComportement($el);});$(".chart-container").on("mouseenter",intoChart);$(".chart-container").on("mouseout",outFromChart);$(".chart-container").on("mousemove",getPointFromChart);displayCurrencyRateInfo(false);displayActionButton(actionBean.indicative);displayResultContainer(actionBean.rate);$("input[type=text]").dblclick(function(e){$(e.target).select();}).trigger("blur");});var $picklist=$(".Picklist");$picklist.each(function(index,$el){picklistComportement($el);});
